Skip to content

Commit

Permalink
Update move-bytecode-template README.md (#20279)
Browse files Browse the repository at this point in the history
  • Loading branch information
xiaodi007 authored Nov 15, 2024
1 parent 986d1c6 commit 5271252
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions sdk/move-bytecode-template/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ This package is a perfect fit for the following applications:
## Example of a Template Module

The following code is a close-copy of the `Coin` example from the
[Move by Example](https://examples.sui.io/samples/coin.html) book.
[Coins and Tokens](https://docs.sui.io/guides/developer/coin).

```move
module 0x0::template {
Expand Down Expand Up @@ -86,20 +86,24 @@ updated = update_constants(
// Update SYMBOL
updated = update_constants(
updated,
bcs.vector(bcs.string()).serialize('MYC').toBytes(), // new value
bcs.vector(bcs.string()).serialize('TMPL').toBytes(), // current value
bcs.string().serialize('MYC').toBytes(), // new value
bcs.string().serialize('TMPL').toBytes(), // current value
'Vector(U8)', // type of the constant
);

// Update NAME
updated = update_constants(
updated,
bcs.vector(bcs.string()).serialize('My Coin').toBytes(), // new value
bcs.vector(bcs.string()).serialize('Template Coin').toBytes(), // current value
bcs.string().serialize('My Coin').toBytes(), // new value
bcs.string().serialize('Template Coin').toBytes(), // current value
'Vector(U8)', // type of the constant
);
```

After updating the bytecode, refer to the
[Asset Tokenization](https://docs.sui.io/guides/developer/nft/asset-tokenization#closer-view-of-the-template-module)
guide to deploy the contract.

## Usage in Web applications

The package consists of code and a wasm binary. While the former can be imported directly, the
Expand Down

0 comments on commit 5271252

Please sign in to comment.