-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
58 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module MyAddr::EndpointAggregator { | ||
use StarcoinFramework::Vector; | ||
use StarcoinFramework::Signer; | ||
|
||
struct Endpoint has store, copy, drop { | ||
url: vector<u8>, | ||
description: vector<u8> | ||
} | ||
|
||
struct EndpointAggregator has key { | ||
key_addr: address, | ||
endpoints: vector<Endpoint> | ||
} | ||
|
||
public fun create_endpoint_aggregator(acct: &signer){ | ||
let endpoint_aggr = EndpointAggregator{ | ||
key_addr: Signer::address_of(acct), | ||
endpoints: Vector::empty<Endpoint>() | ||
}; | ||
move_to<EndpointAggregator>(acct, endpoint_aggr); | ||
} | ||
|
||
public fun add_endpoint( | ||
acct: &signer, | ||
url: vector<u8>, | ||
description: vector<u8>) acquires EndpointAggregator{ | ||
let endpoint_aggr = borrow_global_mut<EndpointAggregator>(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 | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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` |