Subscribe to Untitled
Subscribe to Untitled
Share Dialog
Share Dialog
<100 subscribers
<100 subscribers
According to the official documentation(opens new window)
CW20 is a specification for fungible tokens based on CosmWasm. The name and design is loosely based on Ethereum's ERC20 standard, but many changes have been made. The types in here can be imported by contracts that wish to implement this spec, or by contracts that call to any standard cw20 contract.
Query to /wasm/contracts/<tokenContractAddress>/store with query_msg {"balance":{"address":"<userAddress>"}}
Response: {"height":"2947306","result":{"balance":"24732816921"}}
CW20 is a cosmwasm contract and wasm/MsgExecuteContract is used to interact with it
Breakdown of message payload format is as follows (similar to bank/MsgSend but execute_msg is added):
{
"type": "wasm/MsgExecuteContract",
"value": {
// sender address
"sender": "terra1zyrpkll2xpgcdsz42xm3k8qfnddcdu0w7jzx6y",
// token contract address
"contract": "terra1rz5chzn0g07hp5jx63srpkhv8hd7x8pss20w2e",
// base64-encoded payload of contract execution message (refer to below)
"execute_msg": "ewogICJzZW5kIjogewogICAgImFtb3VudCI6ICIxMDAwMDAwMDAwIiwKICAgICJjb250cmFjdCI6IDxyZWNpcGllbnRDb250cmFjdEFkZHJlc3M+LAogICAgIm1zZyI6ICJleUp6YjIxbFgyMWxjM05oWjJVaU9udDlmUT09IiAKICB9Cn0=",
// used in case you are sending native tokens along with this message
"coins": []
}
}
// base64-encode the below message (without the comments), send that as `execute_msg`
{
"send": {
// amount of CW20 tokens being transferred
"amount": "1000000000",
// recipient of this transfer
"contract": <recipientContractAddress>,
// execute_msg to be executed in the context of recipient contract
"msg": "eyJzb21lX21lc3NhZ2UiOnt9fQ=="
}
}
transfer is different to send, as in it only transfers ownership of CW20 balance within the contract, whereas send is capable of transferring & relays a contract msg to be executed
Example
Find other messages at cw20 documentation(opens new window)
{
"transfer": {
"amount": "1000000",
"recipient": "<recipient>"
}
}
Edit this page on GitHub (opens new window)
UPDATED ON: 10/19/2021, 1:45:01 AM
TERRAFORM LABS PTE.LTD
Subscribe to get updates
real people should not fill this in and expect good things - do not remove this or risk form bot signupsSubmit
According to the official documentation(opens new window)
CW20 is a specification for fungible tokens based on CosmWasm. The name and design is loosely based on Ethereum's ERC20 standard, but many changes have been made. The types in here can be imported by contracts that wish to implement this spec, or by contracts that call to any standard cw20 contract.
Query to /wasm/contracts/<tokenContractAddress>/store with query_msg {"balance":{"address":"<userAddress>"}}
Response: {"height":"2947306","result":{"balance":"24732816921"}}
CW20 is a cosmwasm contract and wasm/MsgExecuteContract is used to interact with it
Breakdown of message payload format is as follows (similar to bank/MsgSend but execute_msg is added):
{
"type": "wasm/MsgExecuteContract",
"value": {
// sender address
"sender": "terra1zyrpkll2xpgcdsz42xm3k8qfnddcdu0w7jzx6y",
// token contract address
"contract": "terra1rz5chzn0g07hp5jx63srpkhv8hd7x8pss20w2e",
// base64-encoded payload of contract execution message (refer to below)
"execute_msg": "ewogICJzZW5kIjogewogICAgImFtb3VudCI6ICIxMDAwMDAwMDAwIiwKICAgICJjb250cmFjdCI6IDxyZWNpcGllbnRDb250cmFjdEFkZHJlc3M+LAogICAgIm1zZyI6ICJleUp6YjIxbFgyMWxjM05oWjJVaU9udDlmUT09IiAKICB9Cn0=",
// used in case you are sending native tokens along with this message
"coins": []
}
}
// base64-encode the below message (without the comments), send that as `execute_msg`
{
"send": {
// amount of CW20 tokens being transferred
"amount": "1000000000",
// recipient of this transfer
"contract": <recipientContractAddress>,
// execute_msg to be executed in the context of recipient contract
"msg": "eyJzb21lX21lc3NhZ2UiOnt9fQ=="
}
}
transfer is different to send, as in it only transfers ownership of CW20 balance within the contract, whereas send is capable of transferring & relays a contract msg to be executed
Example
Find other messages at cw20 documentation(opens new window)
{
"transfer": {
"amount": "1000000",
"recipient": "<recipient>"
}
}
Edit this page on GitHub (opens new window)
UPDATED ON: 10/19/2021, 1:45:01 AM
TERRAFORM LABS PTE.LTD
Subscribe to get updates
real people should not fill this in and expect good things - do not remove this or risk form bot signupsSubmit
No activity yet