-
aptos init generate .aptos file (contains rpc and prikey)
-
(if need faucet ) aptos account fund-with-faucet --account [your address]
-
compile contracts
aptos move compile --named-addresses NBCOIN=default -
publish (deploy contracts )
aptos move publish --named-addresses NBCOIN=defaultnow can see my publish tx in aptos testnet explorer -
Our Coin should be initilized when we has deployed the Token run
aptos move run --function-id 'default::TestCoin::initialize' --args 'string::BAICECOIN' 'string::BCT' u8:8 u128:100000000in this command we define all params in the initialize function [founction id, args(type::param)] this function use move_to
function move_to which takes signer as a first argument and Collection as second put a resource under your account Once Second attempt to create existing resource will fail with error.
-
now I need to register this token to my account .
aptos move run --function-id 'default::TestCoin::register' -
mint some token for me
aptos move run --function-id 'default::TestCoin::mint' --args address:default u128:1000000I can get all my tokens in the aptos rpc url in my account resource -
I can make an another account (import from prikey in testnet) used as a receiver token address profile define another wallet name , my first is default
aptos init --profile a2 -
register another account
aptos move run --profile a2 --function-id 'default::TestCoin::register' -
now test transfer token from my resource to a2's resource
aptos move run --function-id 'default::TestCoin::transfer' --args address:a2 u128:33333now we see : my default coin value has decrease 33333
and my another wallet coin value has increased 33333 https://fullnode.testnet.aptoslabs.com/v1/accounts/0xd7d1b12297217d5ded851c03c28ed98085997c058402dc27045fec49efbf1270/resource/0x85c30a87fb365137ac507ed2daa316a21f8b1f64bcd28f0adea60f4f8a1e1cc7::TestCoin::CoinStore
-
Test burn my token from my resources
aptos move run --function-id 'default::TestCoin::burn' --args u128:667and then the coinStore value decrease 667
libaice/move-coin
Folders and files
| Name | Name | Last commit date | ||
|---|---|---|---|---|