From 7b0232818fb319cd1e1a34e1dc72d47e14af0572 Mon Sep 17 00:00:00 2001 From: leeduckgo Date: Thu, 11 Aug 2022 16:52:50 +0800 Subject: [PATCH] update my-token exp --- move-dapp/CryptoXiuXian in Move Lang.md | 4 +- .../sources/AddrAggregator.move | 2 +- .../sources/EndpointAggregator.move | 38 +++++++++++++++++++ move-dapp/my-token/Move.toml | 2 +- move-dapp/my-token/README.md | 15 ++++++++ 5 files changed, 58 insertions(+), 3 deletions(-) create mode 100644 move-dapp/addr-aggregator/sources/EndpointAggregator.move create mode 100644 move-dapp/my-token/README.md diff --git a/move-dapp/CryptoXiuXian in Move Lang.md b/move-dapp/CryptoXiuXian in Move Lang.md index 23d708b..ba7daa5 100644 --- a/move-dapp/CryptoXiuXian in Move Lang.md +++ b/move-dapp/CryptoXiuXian in Move Lang.md @@ -215,7 +215,9 @@ account unlock [addr] -p [pwd] 1. 调用 init_counter 脚本函数来初始化资源。 ``` -starcoin% account execute-function --function {MyCounterAddr-in-Move.toml}::MyCounter::init_counter -s 0x23dc2c167fcd16e28917765848e189ce -b +starcoin% account execute-function --function {MyCounterAddr-in-Move.toml}::MyCounter::init_counter -s 0x23dc2c167fcd16e28917765848e189ce -b # call the script fun + +# starcoin% dev call --function 0x1168e88ffc5cec53b398b42d61885bbb::EthSigVerifier::verify_eth_sig --arg x"90a938f7457df6e8f741264c32697fc52f9a8f867c52dd70713d9d2d472f2e415d9c94148991bbe1f4a1818d1dff09165782749c877f5cf1eff4ef126e55714d1c" --arg x"29c76e6ad8f28bb1004902578fb108c507be341b" --arg x"b453bd4e271eed985cbab8231da609c4ce0a9cf1f763b6c1594e76315510e0f1" # call the fun(no script) ``` 其中: - `{MyCounterAddr-in-Move.toml}::MyCounter::init_counter`为完整的函数链上地址,包括合约所在地址+包名+函数名。 diff --git a/move-dapp/addr-aggregator/sources/AddrAggregator.move b/move-dapp/addr-aggregator/sources/AddrAggregator.move index 1650f3b..de9cc16 100644 --- a/move-dapp/addr-aggregator/sources/AddrAggregator.move +++ b/move-dapp/addr-aggregator/sources/AddrAggregator.move @@ -53,7 +53,7 @@ module MyAddr::AddrAggregator { let addr_info = AddrInfo{ addr: addr, chain_name: chain_name, - description, description, + description: description, signature: signature }; Vector::push_back(&mut addr_aggr.addr_infos, addr_info); diff --git a/move-dapp/addr-aggregator/sources/EndpointAggregator.move b/move-dapp/addr-aggregator/sources/EndpointAggregator.move new file mode 100644 index 0000000..7b5952d --- /dev/null +++ b/move-dapp/addr-aggregator/sources/EndpointAggregator.move @@ -0,0 +1,38 @@ +module MyAddr::EndpointAggregator { + use StarcoinFramework::Vector; + use StarcoinFramework::Signer; + + struct Endpoint has store, copy, drop { + url: vector, + description: vector + } + + struct EndpointAggregator has key { + key_addr: address, + endpoints: vector + } + + public fun create_endpoint_aggregator(acct: &signer){ + let endpoint_aggr = EndpointAggregator{ + key_addr: Signer::address_of(acct), + endpoints: Vector::empty() + }; + move_to(acct, endpoint_aggr); + } + + public fun add_endpoint( + acct: &signer, + url: vector, + description: vector) acquires EndpointAggregator{ + let endpoint_aggr = borrow_global_mut(Signer::address_of(acct)); + let endpoint_info = Endpoint{ + url: url, + description: description + }; + Vector::push_back(&mut endpoint_aggr.endpoints, endpoint_info); + } + // TODO: + // public fun update endpoint with description, url + // public fun delete endpoint + +} diff --git a/move-dapp/my-token/Move.toml b/move-dapp/my-token/Move.toml index 6f10856..74100db 100644 --- a/move-dapp/my-token/Move.toml +++ b/move-dapp/my-token/Move.toml @@ -4,7 +4,7 @@ version = "0.0.1" [addresses] StarcoinFramework = "0x1" -MyTokenCreator = "0x2fe27a8d6a04d57583172cdda79df0e9" +MyTokenCreator = "0x1168e88ffc5cec53b398b42d61885bbb" [dependencies] StarcoinFramework = {git = "https://github.com/starcoinorg/starcoin-framework.git", rev="cf1deda180af40a8b3e26c0c7b548c4c290cd7e7"} \ No newline at end of file diff --git a/move-dapp/my-token/README.md b/move-dapp/my-token/README.md new file mode 100644 index 0000000..db17147 --- /dev/null +++ b/move-dapp/my-token/README.md @@ -0,0 +1,15 @@ +# My Token Example + +See in: + +> https://starcoinorg.github.io/starcoin-cookbook/docs/move/move-examples/create-a-new-token + +// TODO: A dApp for My Token Example + +// Wallet including balance, transfer, and others + +// Money: `150 xUSDT` + +// TODO: A Article for My Token Example + +// Money: `100 xUSDT` \ No newline at end of file