mytokencontract. Now click the other field below and choose the location of
mytoken.contractfile you have previously generated with
cargo contract(it should be located in
mytoken/target/ink/folder). Metadata contained in the
.contractfile should be immediately parsed by the wizard and it should present the summary of your contract's ABI (a list of constructors and methods):
mytokencontract and click on "Messages(3)" to see the list of available contract calls:
totalSupply), it gets automatically executed by the wallet and the resulting current value is shown.
balanceOfmessage and fill in the details in the popup menu:
transfermessage of your contract:
balanceOfmethod to verify that your account has transferred some of their initial supply to the chosen recipient.
cargo contractcommand line tool, which we have compiled our contract with, can also be used to perform all the actions described above. A brief summary of all extrinsics-related functionalities of
cargo contractcan be found here.
cargo contractsubcommand which interacts with a live chain needs to be invoked with flags defining the chain endpoint address and the user's private key (seed phrase). To make the commands present in this section more concise, let's first define some environmental variables with values that will be used with these flags:
instantiatesubcommand. Make sure you are in
mytokenfolder, where our contract lives, and execute the following command:
System ➜ ExtrinsicSuccessindicating that the deployment was successful, followed by the information about the address of the contract we just created. Let's store this address in another environmental variable for more convenient interaction with the contract:
cargo contractby the
balance_of, we need to add
--argsflag, similarly to when we were deploying the contact and and calling its constructor:
$SEED) have 0 tokens and the creator holds the total supply of 1000 tokens. So let's change it by transferring some tokens to another account:
--dry-runflag should be omitted. The output will contain a list of events generated by our transaction ending with familiar
System ➜ ExtrinsicSuccessindicating that our call was successful. We can now verify that the transfer of 100 tokens indeed happened: