Skip to content

Commit

Permalink
Update my_coin.move (#18125)
Browse files Browse the repository at this point in the history
## Description 

Describe the changes or additions included in this PR.

## Test plan 

How did you test the new or updated feature?

---

## Release notes

Check each box that your changes affect. If none of the boxes relate to
your changes, release notes aren't required.

For each box you select, include information after the relevant heading
that describes the impact of your changes that a user might notice and
any actions they must take to implement updates.

- [ ] Protocol: 
- [ ] Nodes (Validators and Full nodes): 
- [ ] Indexer: 
- [ ] JSON-RPC: 
- [ ] GraphQL: 
- [ ] CLI: 
- [ ] Rust SDK:

---------

Co-authored-by: ronny-mysten <118224482+ronny-mysten@users.noreply.github.com>
  • Loading branch information
techdebt-99 and ronny-mysten authored Jun 10, 2024
1 parent 88fe0df commit 15df381
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions examples/move/coin/sources/my_coin.move
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@ module examples::my_coin {

// Module initializer is called once on module publish. A treasury
// cap is sent to the publisher, who then controls minting and burning.
// Use #[allow(lint(share_owned))] to create editable metadata.
#[allow(lint(share_owned))]
fun init(witness: MY_COIN, ctx: &mut TxContext) {
let (treasury, metadata) = coin::create_currency(witness, 6, b"MY_COIN", b"", b"", option::none(), ctx);
// Share the metadata object so that it can be edited. You could instead
// prevent updates to the icon_url and other metadata with public_freeze_object.
transfer::public_share_object(metadata);
// Freezing this object makes the metadata immutable, including the title, name, and icon image.
// If you want to allow mutability, share it with public_share_object instead.
transfer::public_freeze_object(metadata);
transfer::public_transfer(treasury, ctx.sender())
}

Expand All @@ -31,4 +29,4 @@ module examples::my_coin {
let coin = coin::mint(treasury_cap, amount, ctx);
transfer::public_transfer(coin, recipient)
}
}
}

0 comments on commit 15df381

Please sign in to comment.