-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[examples] Run formatter over examples/move (#20330)
## Description Autoformatted all .move files in the `examples/move` folder. ## 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: - [ ] REST API:
- Loading branch information
Showing
63 changed files
with
7,982 additions
and
8,078 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,14 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module basics::clock { | ||
use sui::{clock::Clock, event}; | ||
module basics::clock; | ||
|
||
public struct TimeEvent has copy, drop, store { | ||
timestamp_ms: u64, | ||
} | ||
use sui::{clock::Clock, event}; | ||
|
||
entry fun access(clock: &Clock) { | ||
event::emit(TimeEvent { timestamp_ms: clock.timestamp_ms() }); | ||
} | ||
public struct TimeEvent has copy, drop, store { | ||
timestamp_ms: u64, | ||
} | ||
|
||
entry fun access(clock: &Clock) { | ||
event::emit(TimeEvent { timestamp_ms: clock.timestamp_ms() }); | ||
} |
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
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 |
---|---|---|
@@ -1,32 +1,40 @@ | ||
// Copyright (c) Mysten Labs, Inc. | ||
// SPDX-License-Identifier: Apache-2.0 | ||
|
||
module examples::my_coin { | ||
use sui::coin::{Self, TreasuryCap}; | ||
module examples::my_coin; | ||
|
||
// The type identifier of coin. The coin will have a type | ||
// tag of kind: `Coin<package_object::mycoin::MYCOIN>` | ||
// Make sure that the name of the type matches the module's name. | ||
public struct MY_COIN has drop {} | ||
use sui::coin::{Self, TreasuryCap}; | ||
|
||
// Module initializer is called once on module publish. A treasury | ||
// cap is sent to the publisher, who then controls minting and burning. | ||
fun init(witness: MY_COIN, ctx: &mut TxContext) { | ||
let (treasury, metadata) = coin::create_currency(witness, 6, b"MY_COIN", b"", b"", option::none(), ctx); | ||
// 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()) | ||
} | ||
// The type identifier of coin. The coin will have a type | ||
// tag of kind: `Coin<package_object::mycoin::MYCOIN>` | ||
// Make sure that the name of the type matches the module's name. | ||
public struct MY_COIN has drop {} | ||
|
||
// Create MY_COINs using the TreasuryCap. | ||
public fun mint( | ||
treasury_cap: &mut TreasuryCap<MY_COIN>, | ||
amount: u64, | ||
recipient: address, | ||
ctx: &mut TxContext, | ||
) { | ||
let coin = coin::mint(treasury_cap, amount, ctx); | ||
transfer::public_transfer(coin, recipient) | ||
} | ||
// Module initializer is called once on module publish. A treasury | ||
// cap is sent to the publisher, who then controls minting and burning. | ||
fun init(witness: MY_COIN, ctx: &mut TxContext) { | ||
let (treasury, metadata) = coin::create_currency( | ||
witness, | ||
6, | ||
b"MY_COIN", | ||
b"", | ||
b"", | ||
option::none(), | ||
ctx, | ||
); | ||
// 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()) | ||
} | ||
|
||
// Create MY_COINs using the TreasuryCap. | ||
public fun mint( | ||
treasury_cap: &mut TreasuryCap<MY_COIN>, | ||
amount: u64, | ||
recipient: address, | ||
ctx: &mut TxContext, | ||
) { | ||
let coin = coin::mint(treasury_cap, amount, ctx); | ||
transfer::public_transfer(coin, recipient) | ||
} |
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
Oops, something went wrong.