WRC30
简介
WRC30
是基于维基链公链底层发行的数字资产的Token标准。
特性
-
基于公链底层开发的代币标准
-
通过去中心化治理之后才能进行稳定币借贷
-
支持在维基链去中心化交易所WaykiDEX上进行交易
-
对开发者更友好,发行、转账开发过程更简便
发行资产费用与规则说明
1、资产发行费用 : 550 WICC
2、资产发行者和资产拥有者必须是regid已成熟
WRC30 资产发行
通过维基时代 一键发行WRC30数字资产
通过wasm系统合约发行WRC30数字资产
发行,铸币,转账都通过submittx接口操作,设置contract 为0-800,即为系统合约。详情参考SmartContract-wasm中的submittx
1. 使用接口 issue 发行WRC30数字资产
资产发行费用 : 550 WICC
交易手续费: 参考手续费列表
Parameters
addr
交易发起者,可与资产拥有者不同
symbol
资产符号 6~7个[A-Z]字符(前面固定要加8,表示8位精度)
owner
资产拥有者地址
name
资产名称 1~32个随意字符
total_supply
资产发行量,最大:900 x 10^8 x 10^8 单位sawi
mintable
资产是否可以增发 true
或 false
memo
备注
Returns
txid
资产发行的交易哈希
Example
// Request
root@0e7612ac5bc5:/opt/wicc# coind submittx 0-2 0-800 issue '["8,HHHHHH", "0-2", "issue-test",10000000000,true,"issue uia"]'
// Respond
{
"txid" : "bfbdcf4448ab5e440be11e4efd1b127472c6216ebddd31f281e4afe7a6ac6ddf",
"tx_trace" : {
"trx_id" : "bfbdcf4448ab5e440be11e4efd1b127472c6216ebddd31f281e4afe7a6ac6ddf",
"elapsed" : 2542,
"minimum_fee" : 100000,
"traces" : [
{
"trx_id" : "bfbdcf4448ab5e440be11e4efd1b127472c6216ebddd31f281e4afe7a6ac6ddf",
"receiver" : "0-800",
"trx" : {
"contract" : "0-800",
"action" : "issue",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"symbol" : "8,HHHHHH",
"owner" : "0-2",
"name" : "issue-test",
"total_supply" : 10000000000,
"mintable" : true,
"memo" : "issue uia"
}
}
}
]
}
}
// As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method":"submittx", "params":["0-2", "0-800", "issue", '["8,HHHHHH", "0-2", "issue-test",10000000000,true,"issue to bob"]']}' -H 'Content-Type: application/json;' http://127.0.0.1:8332
}
2.确认资产是否发行成功
调用RPC接口 getaccountinfo 查看资产拥有者 tokens列表是否新增了发行的代币
或者 调用RPC接口 getassetinfo
查询发行的代币信息
Parameters
asset_symbol
资产符号, 6~7个[A-Z]字符
Returns
asset_symbol
资产符号
asset_name
资产名称
asset_type
资产类型
perms_sum
权限
owner_regid
资产拥有者regid
total_supply
资产发行总量,单位为sawi
mintable
资产是否可以增发 true
或 false
// Request
root@0e7612ac5bc5:/opt/wicc# coind getassetinfo HHHHHH
// Response
{
"asset_symbol" : "HHHHHH",
"asset_name" : "issue-test",
"asset_type" : 3,
"perms_sum" : "00011",
"owner_regid" : "0-2",
"total_supply" : 10000000000,
"mintable" : true
}
// As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method": "getassetinfo", "params": [MINEUSD] }' -H 'Content-Type: application/json;' http://127.0.0.1:8332/
3.使用transfer进行WRC30资产转账
Parameters
from
转出账户
to
转入账户
quantity
转账数量 货币类型
memo
备注
Returns
txid
资产转账的交易哈希
Example
// Resquest
root@0e7612ac5bc5:/opt/wicc# coind submittx 0-2 0-800 transfer '["0-2", "0-3", "100.00000000 HHHHHH","transfer to bob"]'
// Respond
{
"txid" : "23a22a9658173927e617ecfc30781ed1ad061beaddd355bcbf6e6c29b885c2f5",
"tx_trace" : {
"trx_id" : "23a22a9658173927e617ecfc30781ed1ad061beaddd355bcbf6e6c29b885c2f5",
"elapsed" : 720,
"minimum_fee" : 100000,
"traces" : [
{
"trx_id" : "23a22a9658173927e617ecfc30781ed1ad061beaddd355bcbf6e6c29b885c2f5",
"receiver" : "0-800",
"trx" : {
"contract" : "0-800",
"action" : "transfer",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"from" : "0-2",
"to" : "0-3",
"quantity" : "100.00000000 HHHHHH",
"memo" : "transfer to bob"
}
},
"inline_traces" : [
{
"trx_id" : "23a22a9658173927e617ecfc30781ed1ad061beaddd355bcbf6e6c29b885c2f5",
"receiver" : "0-2",
"trx" : {
"contract" : "0-800",
"action" : "transfer",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"from" : "0-2",
"to" : "0-3",
"quantity" : "100.00000000 HHHHHH",
"memo" : "transfer to bob"
}
}
},
{
"trx_id" : "23a22a9658173927e617ecfc30781ed1ad061beaddd355bcbf6e6c29b885c2f5",
"receiver" : "0-3",
"trx" : {
"contract" : "0-800",
"action" : "transfer",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"from" : "0-2",
"to" : "0-3",
"quantity" : "100.00000000 HHHHHH",
"memo" : "transfer to bob"
}
}
}
]
}
]
}
}
// As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method":"submittx", "params":["0-2", "0-800", "transfer", '["0-2", "0-3", "100.00000000 HHHHHH","transfer to bob"]']}' -H 'Content-Type: application/json;' http://127.0.0.1:8332
4.使用RPC接口 getaccountinfo 查看接收者账户是否收到WRC30资产
// Request
root@0e7612ac5bc5:/opt/wicc# coind getaccountinfo 0-3
// Respond
{
"address" : "wNuJM44FPC5NxearNLP98pg295VqP7hsqu",
"keyid" : "23e8b4ac5e3dea621474cad9d9dc4323018856c9",
"regid" : "0-3",
"regid_mature" : true,
"owner_pubkey" : "025a37cb6ec9f63bb17e562865e006f0bafa9afbd8a846bd87fc8ff9e35db1252e",
"miner_pubkey" : "",
"perms" : "1111111111",
"tokens" : {
"HHHHHH" : {
"free_amount" : 10000000000,
"staked_amount" : 0,
"frozen_amount" : 0,
"voted_amount" : 0,
"pledged_amount" : 0,
"total_amount" : 10000000000
},
"WICC" : {
"free_amount" : 30201100011,
"staked_amount" : 0,
"frozen_amount" : 0,
"voted_amount" : 0,
"pledged_amount" : 0,
"total_amount" : 30201100011
}
},
"received_votes" : 0,
"vote_list" : [
],
"onchain" : true,
"in_wallet" : true,
"pubkey_registered" : true,
"cdp_list" : [
]
}
5、使用mint进行铸币,增加资产
Parameters
to
转入账户
quantity
转账数量 货币类型
memo
备注
Returns
txid
资产铸币的交易哈希
Example
// Resquest
root@0e7612ac5bc5:/opt/wicc# coind submittx 0-2 0-800 mint '["0-3", "241.00000000 HHHHHH","mint"]'
// Respond
{
"txid" : "4b10fca887fe3abd4d74eda6afa0088d1fee5cb037dc292744b8fba014ef8205",
"tx_trace" : {
"trx_id" : "4b10fca887fe3abd4d74eda6afa0088d1fee5cb037dc292744b8fba014ef8205",
"elapsed" : 75,
"minimum_fee" : 100000,
"traces" : [
{
"trx_id" : "4b10fca887fe3abd4d74eda6afa0088d1fee5cb037dc292744b8fba014ef8205",
"receiver" : "0-800",
"trx" : {
"contract" : "0-800",
"action" : "mint",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"to" : "0-3",
"quantity" : "241.00000000 HHHHHH",
"memo" : "mint"
}
},
"inline_traces" : [
{
"trx_id" : "4b10fca887fe3abd4d74eda6afa0088d1fee5cb037dc292744b8fba014ef8205",
"receiver" : "0-3",
"trx" : {
"contract" : "0-800",
"action" : "mint",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"to" : "0-3",
"quantity" : "241.00000000 HHHHHH",
"memo" : "mint"
}
}
}
]
}
]
}
}
// As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method":"submittx", "params":["0-2", "0-800", "mint", '["0-3", "241.00000000 HHHHHH","mint to bob"]']}' -H 'Content-Type: application/json;' http://127.0.0.1:8332
6、使用burn进行资产销毁
Parameters
owner
资产拥有者 s
quantity
销毁数量 货币类型
memo
备注
Returns
txid
资产销毁的交易哈希
Example
// Resquest
root@0e7612ac5bc5:/opt/wicc# coind submittx 0-2 0-800 burn '["0-2","1.00000000 HHHHHH","burn"]'
// Respond
{
"txid" : "7d9ec072d21201508cb6c9786bd6f5fcea9abe6662f6dbcf55dbafbdedf7c41e",
"tx_trace" : {
"trx_id" : "7d9ec072d21201508cb6c9786bd6f5fcea9abe6662f6dbcf55dbafbdedf7c41e",
"elapsed" : 56,
"minimum_fee" : 100000,
"traces" : [
{
"trx_id" : "7d9ec072d21201508cb6c9786bd6f5fcea9abe6662f6dbcf55dbafbdedf7c41e",
"receiver" : "0-800",
"trx" : {
"contract" : "0-800",
"action" : "burn",
"authorization" : [
{
"account" : "0-2",
"permission" : "wasmio_owner"
}
],
"data" : {
"owner" : "0-2",
"quantity" : "1.00000000 HHHHHH",
"memo" : "burn"
}
}
}
]
}
}
// As json rpc call
> curl --user myusername -d '{"jsonrpc": "1.0", "id":"curltest", "method":"submittx", "params":["0-2", "0-800", "burn", '["0-2", "1.00000000 HHHHHH","burn to bob"]']}' -H 'Content-Type: application/json;' http://127.0.0.1:8332