Command to instantiate contract on chain
Created by: ascjones
WIP (see todos)
Following on from the deploy
command: https://github.com/paritytech/ink/issues/134, the next step is to instantiate the contract on chain.
Command Name
The name of the command is important - we need to choose whether we should be consistent with the naming in polkadot-js
UI:
-
put_code
=> Upload -
create
=> Deploy.
For this we would need to change our existing deploy
command to upload
.
Alternatively we could align with the names of the contract runtime calls: put_code
(or simply put
?) and create
.
UX
cargo contract create ARGS
Args
-
code hash: the hash of the contract code on chain: result of the
deploy
command - Endowment todo
- Gas: (optional) Max gas for deploying contract, defaults to 500000
-
Url: (optional) Websockets url to a node on the target chain. defaults to
http://localhost:9944
- Secret URI: The secret URI
- Counstructor Args todo
Output
Should return the AccountId
of the instantiated contract.
Implementation
- See existing
deploy
implementation for constructing extrinsic utilisingsubxt
Constructor Args
- Need to figure out the best way to supply constructor args to be added to the
extrinsic
. - Could support parsing of certain contract primitives from the command, and use contract abi metadata to determine the required signature and perform validation/parsing of the input. todo: elaborate