From dea171cd348260ac7288bc011d785442695a1ffb Mon Sep 17 00:00:00 2001 From: Chris Li <666lcz@gmail.com> Date: Tue, 22 Mar 2022 10:24:16 -0700 Subject: [PATCH] Add license header to all move files --- .../sources/CombinableObjects.move | 3 ++ .../sources/CustomObjectTemplate.move | 3 ++ .../sources/TicTacToe.move | 5 ++- .../sources/TrustedCoin.move | 3 ++ .../custom_genesis_package_2/sources/M1.move | 3 ++ .../sources/TrustedCoin.move | 3 ++ .../unit_tests/data/hero/sources/Hero.move | 11 ++++-- .../data/hero/sources/TrustedCoin.move | 3 ++ .../object_owner/sources/ObjectOwner.move | 3 ++ .../sources/ObjectWrapping.move | 5 ++- .../unit_tests/data/call_ret/sources/M1.move | 3 ++ .../data/publish_init/sources/M1.move | 3 ++ .../data/publish_init_param/sources/M1.move | 3 ++ .../data/publish_init_public/sources/M1.move | 3 ++ .../data/publish_init_ret/sources/M1.move | 3 ++ .../data/simple_call/sources/M1.move | 7 +++- .../examples/basics/sources/Lock.move | 13 ++++--- .../examples/basics/sources/Object.move | 3 ++ .../examples/basics/sources/Sandwich.move | 3 ++ .../examples/defi/sources/Escrow.move | 3 ++ .../examples/defi/sources/FlashLender.move | 19 +++++---- .../examples/defi/tests/FlashLenderTests.move | 5 ++- .../fungible_tokens/sources/MANAGED.move | 5 ++- .../examples/games/hero/sources/Hero.move | 3 ++ .../examples/games/hero/sources/SeaHero.move | 3 ++ .../games/hero/sources/SeaHeroHelper.move | 3 ++ .../games/sources/RockPaperScissors.move | 39 ++++++++++--------- .../games/sources/SharedTicTacToe.move | 3 ++ .../examples/games/sources/TicTacToe.move | 3 ++ .../games/tests/RockPaperScissorsTests.move | 21 +++++----- .../games/tests/SharedTicTacToeTests.move | 5 ++- .../examples/games/tests/TicTacToeTests.move | 5 ++- .../examples/nfts/sources/Auction.move | 3 ++ .../examples/nfts/sources/AuctionLib.move | 3 ++ .../examples/nfts/sources/Geniteam.move | 3 ++ .../examples/nfts/sources/Marketplace.move | 25 ++++++------ .../examples/nfts/sources/Num.move | 3 ++ .../examples/nfts/sources/SharedAuction.move | 3 ++ .../examples/nfts/tests/AuctionTests.move | 5 ++- .../nfts/tests/SharedAuctionTests.move | 5 ++- .../deps/move-stdlib/sources/ASCII.move | 3 ++ .../deps/move-stdlib/sources/BCS.move | 3 ++ .../deps/move-stdlib/sources/BitVector.move | 3 ++ .../deps/move-stdlib/sources/Capability.move | 3 ++ .../deps/move-stdlib/sources/Debug.move | 3 ++ .../deps/move-stdlib/sources/Errors.move | 3 ++ .../move-stdlib/sources/FixedPoint32.move | 3 ++ .../deps/move-stdlib/sources/GUID.move | 3 ++ .../deps/move-stdlib/sources/Hash.move | 3 ++ .../deps/move-stdlib/sources/Option.move | 3 ++ .../deps/move-stdlib/sources/Signer.move | 5 ++- .../deps/move-stdlib/sources/UnitTest.move | 3 ++ .../deps/move-stdlib/sources/Vector.move | 3 ++ .../framework/sources/Bag.move | 3 ++ .../framework/sources/Coin.move | 3 ++ .../framework/sources/Collection.move | 3 ++ .../framework/sources/ERC721Metadata.move | 17 ++++---- .../framework/sources/Event.move | 7 +++- .../framework/sources/GAS.move | 3 ++ .../framework/sources/Geniteam.move | 3 ++ sui_programmability/framework/sources/ID.move | 3 ++ .../framework/sources/Math.move | 3 ++ .../framework/sources/NFT.move | 3 ++ .../framework/sources/ObjectBasics.move | 5 ++- .../framework/sources/Transfer.move | 3 ++ .../framework/sources/TxContext.move | 7 +++- .../framework/sources/UTF8.move | 7 +++- .../framework/sources/Url.move | 3 ++ .../framework/tests/BagTests.move | 3 ++ .../framework/tests/CollectionTests.move | 3 ++ .../framework/tests/IDTests.move | 5 ++- .../framework/tests/TxContextTests.move | 5 ++- .../framework/tests/UrlTests.move | 3 ++ sui_programmability/tutorial/sources/M1.move | 31 ++++++++------- 74 files changed, 318 insertions(+), 96 deletions(-) diff --git a/sui/src/unit_tests/data/custom_genesis_package_1/sources/CombinableObjects.move b/sui/src/unit_tests/data/custom_genesis_package_1/sources/CombinableObjects.move index 225c69536e978..8c0b1d651c41e 100644 --- a/sui/src/unit_tests/data/custom_genesis_package_1/sources/CombinableObjects.move +++ b/sui/src/unit_tests/data/custom_genesis_package_1/sources/CombinableObjects.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example of objects that can be combined to create /// new objects module Examples::CombinableObjects { diff --git a/sui/src/unit_tests/data/custom_genesis_package_1/sources/CustomObjectTemplate.move b/sui/src/unit_tests/data/custom_genesis_package_1/sources/CustomObjectTemplate.move index 1f529eb22c441..86e697d1d0bd4 100644 --- a/sui/src/unit_tests/data/custom_genesis_package_1/sources/CustomObjectTemplate.move +++ b/sui/src/unit_tests/data/custom_genesis_package_1/sources/CustomObjectTemplate.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// An example of a custom object with comments explaining the relevant bits module Examples::CustomObjectTemplate { use Sui::ID::VersionedID; diff --git a/sui/src/unit_tests/data/custom_genesis_package_1/sources/TicTacToe.move b/sui/src/unit_tests/data/custom_genesis_package_1/sources/TicTacToe.move index 6d2b739c87754..fe7afc33d0e1b 100644 --- a/sui/src/unit_tests/data/custom_genesis_package_1/sources/TicTacToe.move +++ b/sui/src/unit_tests/data/custom_genesis_package_1/sources/TicTacToe.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Examples::TicTacToe { use Std::Option::{Self, Option}; use Std::Vector; @@ -263,4 +266,4 @@ module Examples::TicTacToe { public fun mark_col(mark: &Mark): u64 { mark.col } -} \ No newline at end of file +} diff --git a/sui/src/unit_tests/data/custom_genesis_package_1/sources/TrustedCoin.move b/sui/src/unit_tests/data/custom_genesis_package_1/sources/TrustedCoin.move index 95cff6e23f0f6..0f574a74eece9 100644 --- a/sui/src/unit_tests/data/custom_genesis_package_1/sources/TrustedCoin.move +++ b/sui/src/unit_tests/data/custom_genesis_package_1/sources/TrustedCoin.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example coin with a trusted owner responsible for minting/burning (e.g., a stablecoin) module Examples::TrustedCoin { use Sui::Coin::{Self, TreasuryCap}; diff --git a/sui/src/unit_tests/data/custom_genesis_package_2/sources/M1.move b/sui/src/unit_tests/data/custom_genesis_package_2/sources/M1.move index f53f8ab3ea12d..60ca3d1bfbf41 100644 --- a/sui/src/unit_tests/data/custom_genesis_package_2/sources/M1.move +++ b/sui/src/unit_tests/data/custom_genesis_package_2/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Sui::ID::VersionedID; use Sui::TxContext::{Self, TxContext}; diff --git a/sui/src/unit_tests/data/dummy_modules_publish/sources/TrustedCoin.move b/sui/src/unit_tests/data/dummy_modules_publish/sources/TrustedCoin.move index 95cff6e23f0f6..0f574a74eece9 100644 --- a/sui/src/unit_tests/data/dummy_modules_publish/sources/TrustedCoin.move +++ b/sui/src/unit_tests/data/dummy_modules_publish/sources/TrustedCoin.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example coin with a trusted owner responsible for minting/burning (e.g., a stablecoin) module Examples::TrustedCoin { use Sui::Coin::{Self, TreasuryCap}; diff --git a/sui_core/src/unit_tests/data/hero/sources/Hero.move b/sui_core/src/unit_tests/data/hero/sources/Hero.move index 9ad8903bcf229..08a27d2ffa577 100644 --- a/sui_core/src/unit_tests/data/hero/sources/Hero.move +++ b/sui_core/src/unit_tests/data/hero/sources/Hero.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example of a game character with basic attributes, inventory, and /// associated logic. module Examples::Hero { @@ -34,7 +37,7 @@ module Examples::Hero { /// For healing wounded heroes struct Potion has key, store { id: VersionedID, - /// Effectivenss of the potion + /// Effectiveness of the potion potency: u64 } @@ -206,7 +209,7 @@ module Examples::Hero { let value = Coin::value(&payment); // ensure the user pays enough for the sword assert!(value >= MIN_SWORD_COST, EINSUFFICIENT_FUNDS); - // pay the admin for ths sword + // pay the admin for this sword Transfer::transfer(payment, admin()); // magic of the sword is proportional to the amount you paid, up to @@ -225,7 +228,7 @@ module Examples::Hero { Transfer::transfer(hero, TxContext::sender(ctx)) } - /// Anyone can create a hero if they have a sword. All heros start with the + /// Anyone can create a hero if they have a sword. All heroes start with the /// same attributes. public fun create_hero(sword: Sword, ctx: &mut TxContext): Hero { Hero { @@ -338,4 +341,4 @@ module Examples::Hero { TestScenario::return_object(scenario, hero) }; } -} \ No newline at end of file +} diff --git a/sui_core/src/unit_tests/data/hero/sources/TrustedCoin.move b/sui_core/src/unit_tests/data/hero/sources/TrustedCoin.move index 95cff6e23f0f6..0f574a74eece9 100644 --- a/sui_core/src/unit_tests/data/hero/sources/TrustedCoin.move +++ b/sui_core/src/unit_tests/data/hero/sources/TrustedCoin.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example coin with a trusted owner responsible for minting/burning (e.g., a stablecoin) module Examples::TrustedCoin { use Sui::Coin::{Self, TreasuryCap}; diff --git a/sui_core/src/unit_tests/data/object_owner/sources/ObjectOwner.move b/sui_core/src/unit_tests/data/object_owner/sources/ObjectOwner.move index 8a82cbe02a34b..6379e7ef12f1e 100644 --- a/sui_core/src/unit_tests/data/object_owner/sources/ObjectOwner.move +++ b/sui_core/src/unit_tests/data/object_owner/sources/ObjectOwner.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module ObjectOwner::ObjectOwner { use Std::Option::{Self, Option}; use Sui::ID::{Self, VersionedID}; diff --git a/sui_core/src/unit_tests/data/object_wrapping/sources/ObjectWrapping.move b/sui_core/src/unit_tests/data/object_wrapping/sources/ObjectWrapping.move index b57d25205689b..01e1c651a4e23 100644 --- a/sui_core/src/unit_tests/data/object_wrapping/sources/ObjectWrapping.move +++ b/sui_core/src/unit_tests/data/object_wrapping/sources/ObjectWrapping.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module ObjectWrapping::ObjectWrapping { use Std::Option::{Self, Option}; use Sui::Transfer; @@ -54,4 +57,4 @@ module ObjectWrapping::ObjectWrapping { }; Option::destroy_none(child_opt) } -} \ No newline at end of file +} diff --git a/sui_programmability/adapter/src/unit_tests/data/call_ret/sources/M1.move b/sui_programmability/adapter/src/unit_tests/data/call_ret/sources/M1.move index 647e984f0fcca..73ece7a5b6cff 100644 --- a/sui_programmability/adapter/src/unit_tests/data/call_ret/sources/M1.move +++ b/sui_programmability/adapter/src/unit_tests/data/call_ret/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Std::Vector; diff --git a/sui_programmability/adapter/src/unit_tests/data/publish_init/sources/M1.move b/sui_programmability/adapter/src/unit_tests/data/publish_init/sources/M1.move index 572e6176c54f3..a80b3d3728059 100644 --- a/sui_programmability/adapter/src/unit_tests/data/publish_init/sources/M1.move +++ b/sui_programmability/adapter/src/unit_tests/data/publish_init/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Sui::ID::VersionedID; use Sui::TxContext::{Self, TxContext}; diff --git a/sui_programmability/adapter/src/unit_tests/data/publish_init_param/sources/M1.move b/sui_programmability/adapter/src/unit_tests/data/publish_init_param/sources/M1.move index caa9aad67b4ca..65f584a2350c8 100644 --- a/sui_programmability/adapter/src/unit_tests/data/publish_init_param/sources/M1.move +++ b/sui_programmability/adapter/src/unit_tests/data/publish_init_param/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Sui::ID::VersionedID; use Sui::TxContext::{Self, TxContext}; diff --git a/sui_programmability/adapter/src/unit_tests/data/publish_init_public/sources/M1.move b/sui_programmability/adapter/src/unit_tests/data/publish_init_public/sources/M1.move index 0f8d348807733..810c0ec41bede 100644 --- a/sui_programmability/adapter/src/unit_tests/data/publish_init_public/sources/M1.move +++ b/sui_programmability/adapter/src/unit_tests/data/publish_init_public/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Sui::ID::VersionedID; use Sui::TxContext::{Self, TxContext}; diff --git a/sui_programmability/adapter/src/unit_tests/data/publish_init_ret/sources/M1.move b/sui_programmability/adapter/src/unit_tests/data/publish_init_ret/sources/M1.move index 13dd12b3462b9..82dfa6e395a3c 100644 --- a/sui_programmability/adapter/src/unit_tests/data/publish_init_ret/sources/M1.move +++ b/sui_programmability/adapter/src/unit_tests/data/publish_init_ret/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Sui::ID::VersionedID; use Sui::TxContext::{Self, TxContext}; diff --git a/sui_programmability/adapter/src/unit_tests/data/simple_call/sources/M1.move b/sui_programmability/adapter/src/unit_tests/data/simple_call/sources/M1.move index a30afbb7b0b38..a4072a9e0159c 100644 --- a/sui_programmability/adapter/src/unit_tests/data/simple_call/sources/M1.move +++ b/sui_programmability/adapter/src/unit_tests/data/simple_call/sources/M1.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Test::M1 { use Sui::ID::VersionedID; use Sui::TxContext::{Self, TxContext}; @@ -10,7 +13,7 @@ module Test::M1 { } fun foo(_p1: u64, value1: T, _value2: &Coin, _p2: u64): T { - value1 + value1 } public fun create(value: u64, recipient: address, ctx: &mut TxContext) { @@ -18,5 +21,5 @@ module Test::M1 { Object { id: TxContext::new_id(ctx), value }, recipient ) - } + } } diff --git a/sui_programmability/examples/basics/sources/Lock.move b/sui_programmability/examples/basics/sources/Lock.move index cd00eb71d35c0..a9ef6d058c17b 100644 --- a/sui_programmability/examples/basics/sources/Lock.move +++ b/sui_programmability/examples/basics/sources/Lock.move @@ -1,8 +1,11 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// An example of a module that uses Shared Objects and ID linking/access. /// /// This module allows any content to be locked inside a 'virtual chest' and later /// be accessed by putting a 'key' into the 'lock'. Lock is shared and is visible -/// and discoverable by the key owner. +/// and discoverable by the key owner. module Basics::Lock { use Sui::ID::{Self, ID, VersionedID}; use Sui::Transfer; @@ -18,14 +21,14 @@ module Basics::Lock { /// Lock already contains something. const ELOCK_IS_FULL: u64 = 2; - /// Lock that stores any content inside it. + /// Lock that stores any content inside it. struct Lock has key, store { id: VersionedID, locked: Option } /// A key that is created with a Lock; is transferable - /// and contains all the needed information to open the Lock. + /// and contains all the needed information to open the Lock. struct Key has key, store { id: VersionedID, for: ID, @@ -36,7 +39,7 @@ module Basics::Lock { key.for } - /// Lock some content inside a shared object. A Key is created and is + /// Lock some content inside a shared object. A Key is created and is /// sent to the transaction sender. public fun create(obj: T, ctx: &mut TxContext) { let id = TxContext::new_id(ctx); @@ -67,7 +70,7 @@ module Basics::Lock { Option::fill(&mut lock.locked, obj); } - /// Unlock the Lock with a Key and access its contents. + /// Unlock the Lock with a Key and access its contents. /// Can only be called if both conditions are met: /// - key matches the lock /// - lock is not empty diff --git a/sui_programmability/examples/basics/sources/Object.move b/sui_programmability/examples/basics/sources/Object.move index d595bf8c46496..ed20e3ac772cf 100644 --- a/sui_programmability/examples/basics/sources/Object.move +++ b/sui_programmability/examples/basics/sources/Object.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// An example of a custom object with comments explaining the relevant bits module Basics::Object { use Sui::ID::VersionedID; diff --git a/sui_programmability/examples/basics/sources/Sandwich.move b/sui_programmability/examples/basics/sources/Sandwich.move index a37299120e954..92e5cf9910ea8 100644 --- a/sui_programmability/examples/basics/sources/Sandwich.move +++ b/sui_programmability/examples/basics/sources/Sandwich.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example of objects that can be combined to create /// new objects module Basics::Sandwich { diff --git a/sui_programmability/examples/defi/sources/Escrow.move b/sui_programmability/examples/defi/sources/Escrow.move index e91fe335eb3f0..2c4397f71ddfd 100644 --- a/sui_programmability/examples/defi/sources/Escrow.move +++ b/sui_programmability/examples/defi/sources/Escrow.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// An escrow for atomic swap of objects that trusts a third party for liveness, but not safety. module DeFi::Escrow { use Sui::ID::{Self, ID, VersionedID}; diff --git a/sui_programmability/examples/defi/sources/FlashLender.move b/sui_programmability/examples/defi/sources/FlashLender.move index 246dd614c71d3..4abe97c49a5a3 100644 --- a/sui_programmability/examples/defi/sources/FlashLender.move +++ b/sui_programmability/examples/defi/sources/FlashLender.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// A flash loan that works for any Coin type module DeFi::FlashLender { use Sui::Coin::{Self, Coin}; @@ -30,8 +33,8 @@ module DeFi::FlashLender { repay_amount: u64 } - /// An object conveying the privilege to withdraw funds from and deposit funds to the - /// `FlashLender` instance with ID `flash_lender_id`. Initially granted to the creator + /// An object conveying the privilege to withdraw funds from and deposit funds to the + /// `FlashLender` instance with ID `flash_lender_id`. Initially granted to the creator /// of the `FlashLender`, and only one `AdminCap` per lender exists. struct AdminCap has key, store { id: VersionedID, @@ -82,7 +85,7 @@ module DeFi::FlashLender { // === Core functionality: requesting a loan and repaying it === /// Request a loan of `amount` from `lender`. The returned `Receipt` "hot potato" ensures - /// that the borrower will call `repay(lender, ...)` later on in this tx. + /// that the borrower will call `repay(lender, ...)` later on in this tx. /// Aborts if `amount` is greater that the amount that `lender` has available for lending. public fun loan( self: &mut FlashLender, amount: u64, ctx: &mut TxContext @@ -91,14 +94,14 @@ module DeFi::FlashLender { assert!(Coin::value(to_lend) >= amount, ELOAN_TOO_LARGE); let loan = Coin::withdraw(to_lend, amount, ctx); - let repay_amount = amount + self.fee; + let repay_amount = amount + self.fee; let receipt = Receipt { flash_lender_id: *ID::id(self), repay_amount }; (loan, receipt) } /// Repay the loan recorded by `receipt` to `lender` with `payment`. /// Aborts if the repayment amount is incorrect or `lender` is not the `FlashLender` - /// that issued the original loan. + /// that issued the original loan. public fun repay(self: &mut FlashLender, payment: Coin, receipt: Receipt) { let Receipt { flash_lender_id, repay_amount } = receipt; assert!(ID::id(self) == &flash_lender_id, EREPAY_TO_WRONG_LENDER); @@ -111,9 +114,9 @@ module DeFi::FlashLender { /// Allow admin for `self` to withdraw funds. public fun withdraw( - self: &mut FlashLender, + self: &mut FlashLender, admin_cap: &AdminCap, - amount: u64, + amount: u64, ctx: &mut TxContext ): Coin { // only the holder of the `AdminCap` for `self` can withdraw funds @@ -169,4 +172,4 @@ module DeFi::FlashLender { public fun flash_lender_id(self: &Receipt): ID { self.flash_lender_id } -} \ No newline at end of file +} diff --git a/sui_programmability/examples/defi/tests/FlashLenderTests.move b/sui_programmability/examples/defi/tests/FlashLenderTests.move index eda07618fb6ff..f730429083f40 100644 --- a/sui_programmability/examples/defi/tests/FlashLenderTests.move +++ b/sui_programmability/examples/defi/tests/FlashLenderTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module DeFi::FlashLenderTests { use DeFi::FlashLender::{Self, AdminCap, FlashLender}; @@ -53,4 +56,4 @@ module DeFi::FlashLenderTests { TestScenario::return_object(scenario, admin_cap); } } -} \ No newline at end of file +} diff --git a/sui_programmability/examples/fungible_tokens/sources/MANAGED.move b/sui_programmability/examples/fungible_tokens/sources/MANAGED.move index 4fb56994d98e5..95c030c1d583c 100644 --- a/sui_programmability/examples/fungible_tokens/sources/MANAGED.move +++ b/sui_programmability/examples/fungible_tokens/sources/MANAGED.move @@ -1,5 +1,8 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example coin with a trusted manager responsible for minting/burning (e.g., a stablecoin) -/// By convention, modules defining custom coin types use upper case names, in constrast to +/// By convention, modules defining custom coin types use upper case names, in contrast to /// ordinary modules, which use camel case. module FungibleTokens::MANAGED { use Sui::Coin::{Self, Coin, TreasuryCap}; diff --git a/sui_programmability/examples/games/hero/sources/Hero.move b/sui_programmability/examples/games/hero/sources/Hero.move index 00bfa174097e0..a77ee88401bd2 100644 --- a/sui_programmability/examples/games/hero/sources/Hero.move +++ b/sui_programmability/examples/games/hero/sources/Hero.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example of a game character with basic attributes, inventory, and /// associated logic. module HeroGame::Hero { diff --git a/sui_programmability/examples/games/hero/sources/SeaHero.move b/sui_programmability/examples/games/hero/sources/SeaHero.move index 4be36b464874a..9da410e7b689a 100644 --- a/sui_programmability/examples/games/hero/sources/SeaHero.move +++ b/sui_programmability/examples/games/hero/sources/SeaHero.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Example of a game mod or different game that uses objects from the Hero /// game. /// This mod introduces sea monsters that can also be slain with the hero's diff --git a/sui_programmability/examples/games/hero/sources/SeaHeroHelper.move b/sui_programmability/examples/games/hero/sources/SeaHeroHelper.move index b5ec02134ec86..ca107ca69a471 100644 --- a/sui_programmability/examples/games/hero/sources/SeaHeroHelper.move +++ b/sui_programmability/examples/games/hero/sources/SeaHeroHelper.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Mod of the economics of the SeaHero game. In the game, a `Hero` can onAly /// slay a `SeaMonster` if they have sufficient strength. This mod allows a /// player with a weak `Hero` to ask a player with a stronger `Hero` to slay diff --git a/sui_programmability/examples/games/sources/RockPaperScissors.move b/sui_programmability/examples/games/sources/RockPaperScissors.move index fa8313dd68e05..dc933264c7591 100644 --- a/sui_programmability/examples/games/sources/RockPaperScissors.move +++ b/sui_programmability/examples/games/sources/RockPaperScissors.move @@ -1,9 +1,12 @@ -// This is an idea of a module which will allow some asset to be +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + +// This is an idea of a module which will allow some asset to be // won by playing a rock-paper-scissors (then lizard-spoke) game. // -// Initial implementation implies so-called commit-reveal scheme +// Initial implementation implies so-called commit-reveal scheme // in which players first submit their commitments -// and then reveal the data that led to these commitments. The +// and then reveal the data that led to these commitments. The // data is then being verified by one of the parties or a third // party (depends on implementation and security measures). // @@ -49,15 +52,15 @@ module Games::RockPaperScissors { const STATUS_REVEALING: u8 = 3; const STATUS_REVEALED: u8 = 4; - /// The Prize that's being held inside the [`Game`] object. Should be - /// eventually replaced with some generic T inside the [`Game`]. + /// The Prize that's being held inside the [`Game`] object. Should be + /// eventually replaced with some generic T inside the [`Game`]. struct ThePrize has key, store { id: VersionedID } /// The main resource of the RockPaperScissors module. Contains all the /// information about the game state submitted by both players. By default - /// contains empty values and fills as the game progresses. + /// contains empty values and fills as the game progresses. /// Being destroyed in the end, once [`select_winner`] is called and the game /// has reached its final state by that time. struct Game has key { @@ -155,7 +158,7 @@ module Games::RockPaperScissors { } else { abort 0 // unreachable!() }; - + ID::delete(id); } @@ -170,8 +173,8 @@ module Games::RockPaperScissors { } /// Use submitted [`Secret`]'s salt to find the gesture played by the player and set it - /// in the [`Game`] object. - /// TODO: think of ways to + /// in the [`Game`] object. + /// TODO: think of ways to public fun match_secret(game: &mut Game, secret: Secret, _ctx: &mut TxContext) { let Secret { salt, player, id } = secret; @@ -186,11 +189,11 @@ module Games::RockPaperScissors { ID::delete(id); } - /// The final accord to the game logic. After both secrets have been revealed, + /// The final accord to the game logic. After both secrets have been revealed, /// the game owner can choose a winner and release the prize. public fun select_winner(game: Game, ctx: &mut TxContext) { assert!(status(&game) == STATUS_REVEALED, 0); - + let Game { id, prize, @@ -201,7 +204,7 @@ module Games::RockPaperScissors { gesture_one, gesture_two, } = game; - + let p1_wins = play(gesture_one, gesture_two); let p2_wins = play(gesture_two, gesture_one); @@ -209,22 +212,22 @@ module Games::RockPaperScissors { // If one of the players wins, he takes the prize. // If there's a tie, the game owner gets the prize. - if (p1_wins) { + if (p1_wins) { Transfer::transfer(prize, player_one) } else if (p2_wins) { Transfer::transfer(prize, player_two) - } else { + } else { Transfer::transfer(prize, TxContext::sender(ctx)) - }; + }; } - /// Implement the basic logic of the game. + /// Implement the basic logic of the game. fun play(one: u8, two: u8): bool { if (one == ROCK && two == SCISSORS) { true } else if (one == PAPER && two == ROCK) { true } else if (one == SCISSORS && two == PAPER) { true } else if (one != CHEAT && two == CHEAT) { true } - else { false } + else { false } } /// Hash the salt and the gesture_id and match it against the stored hash. If something @@ -245,7 +248,7 @@ module Games::RockPaperScissors { /// Internal hashing function to build a [`Secret`] and match it later at the reveal stage. /// /// - `salt` argument here is a secret that is only known to the sender. That way we ensure - /// that nobody knows the gesture until the end, but at the same time each player commits + /// that nobody knows the gesture until the end, but at the same time each player commits /// to the result with his hash; fun hash(gesture: u8, salt: vector): vector { Vector::push_back(&mut salt, gesture); diff --git a/sui_programmability/examples/games/sources/SharedTicTacToe.move b/sui_programmability/examples/games/sources/SharedTicTacToe.move index 146fa54a0cb72..f0ae4947af6a3 100644 --- a/sui_programmability/examples/games/sources/SharedTicTacToe.move +++ b/sui_programmability/examples/games/sources/SharedTicTacToe.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + // This is a rewrite of TicTacToe using a completely different approach. // In TicTacToe, since the game object is owned by the admin, the players was not // able to directly mutate the gameboard. Hence each marker placement takes diff --git a/sui_programmability/examples/games/sources/TicTacToe.move b/sui_programmability/examples/games/sources/TicTacToe.move index efb50b02217d1..797411a9bba2d 100644 --- a/sui_programmability/examples/games/sources/TicTacToe.move +++ b/sui_programmability/examples/games/sources/TicTacToe.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + // This is an implementation of the TicTacToe game. // The game object (which includes gameboard) is owned by a game admin. // Since players don't have ownership over the game object, they cannot diff --git a/sui_programmability/examples/games/tests/RockPaperScissorsTests.move b/sui_programmability/examples/games/tests/RockPaperScissorsTests.move index 1958e9c640c07..149de7cdf4015 100644 --- a/sui_programmability/examples/games/tests/RockPaperScissorsTests.move +++ b/sui_programmability/examples/games/tests/RockPaperScissorsTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Games::RockPaperScissorsTests { use Games::RockPaperScissors::{Self as Game, Game, PlayerTurn, Secret, ThePrize}; @@ -7,7 +10,7 @@ module Games::RockPaperScissorsTests { #[test] public fun play_rock_paper_scissors() { - // So these are our heros. + // So these are our heroes. let the_main_guy = @0xA1C05; let mr_lizard = @0xA55555; let mr_spock = @0x590C; @@ -15,10 +18,10 @@ module Games::RockPaperScissorsTests { let scenario = &mut TestScenario::begin(&the_main_guy); // Let the game begin! - Game::new_game(mr_spock, mr_lizard, TestScenario::ctx(scenario)); + Game::new_game(mr_spock, mr_lizard, TestScenario::ctx(scenario)); // Mr Spock makes his move. He does it secretly and hashes the gesture with a salt - // so that only he knows what it is. + // so that only he knows what it is. TestScenario::next_tx(scenario, &mr_spock); { let hash = hash(Game::rock(), b"my_phaser_never_failed_me!"); @@ -30,11 +33,11 @@ module Games::RockPaperScissorsTests { { let game = TestScenario::remove_object(scenario); let cap = TestScenario::remove_object(scenario); - + assert!(Game::status(&game) == 0, 0); // STATUS_READY - + Game::add_hash(&mut game, cap, TestScenario::ctx(scenario)); - + assert!(Game::status(&game) == 1, 0); // STATUS_HASH_SUBMISSION TestScenario::return_object(scenario, game); @@ -92,10 +95,10 @@ module Games::RockPaperScissorsTests { }; TestScenario::next_tx(scenario, &mr_spock); - // If it works, then MrSpock is in posession of the prize; - let prize = TestScenario::remove_object(scenario); + // If it works, then MrSpock is in possession of the prize; + let prize = TestScenario::remove_object(scenario); // Don't forget to give it back! - TestScenario::return_object(scenario, prize); + TestScenario::return_object(scenario, prize); } // Copy of the hashing function from the main module. diff --git a/sui_programmability/examples/games/tests/SharedTicTacToeTests.move b/sui_programmability/examples/games/tests/SharedTicTacToeTests.move index 48d0174e2924c..f241a44211b79 100644 --- a/sui_programmability/examples/games/tests/SharedTicTacToeTests.move +++ b/sui_programmability/examples/games/tests/SharedTicTacToeTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Games::SharedTicTacToeTests { use Sui::TestScenario::{Self, Scenario}; @@ -90,4 +93,4 @@ module Games::SharedTicTacToeTests { }; status } -} \ No newline at end of file +} diff --git a/sui_programmability/examples/games/tests/TicTacToeTests.move b/sui_programmability/examples/games/tests/TicTacToeTests.move index 98767fa485391..f0caa536a8603 100644 --- a/sui_programmability/examples/games/tests/TicTacToeTests.move +++ b/sui_programmability/examples/games/tests/TicTacToeTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Games::TicTacToeTests { use Sui::TestScenario::{Self, Scenario}; @@ -101,4 +104,4 @@ module Games::TicTacToeTests { // return the game status status } -} \ No newline at end of file +} diff --git a/sui_programmability/examples/nfts/sources/Auction.move b/sui_programmability/examples/nfts/sources/Auction.move index 347ac97a7b208..b7b812bd6e631 100644 --- a/sui_programmability/examples/nfts/sources/Auction.move +++ b/sui_programmability/examples/nfts/sources/Auction.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// This is an implementation of an English auction /// (https://en.wikipedia.org/wiki/English_auction) using single-owner /// objects only. There are 3 types of parties participating in an diff --git a/sui_programmability/examples/nfts/sources/AuctionLib.move b/sui_programmability/examples/nfts/sources/AuctionLib.move index ef622e5176f5c..683cfe172175e 100644 --- a/sui_programmability/examples/nfts/sources/AuctionLib.move +++ b/sui_programmability/examples/nfts/sources/AuctionLib.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// This is a helper module for implementing two versions of an /// English auction (https://en.wikipedia.org/wiki/English_auction), /// one using single-owner objects only and the other using shared diff --git a/sui_programmability/examples/nfts/sources/Geniteam.move b/sui_programmability/examples/nfts/sources/Geniteam.move index 76650f1bdd4bc..e505f63eac719 100644 --- a/sui_programmability/examples/nfts/sources/Geniteam.move +++ b/sui_programmability/examples/nfts/sources/Geniteam.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module NFTs::Geniteam { use Sui::ID::{Self, ID, VersionedID}; use Sui::TxContext::{Self, TxContext}; diff --git a/sui_programmability/examples/nfts/sources/Marketplace.move b/sui_programmability/examples/nfts/sources/Marketplace.move index f736c1fa96416..e50c786351154 100644 --- a/sui_programmability/examples/nfts/sources/Marketplace.move +++ b/sui_programmability/examples/nfts/sources/Marketplace.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module NFTs::Marketplace { use Sui::TxContext::{Self, TxContext}; use Sui::ID::{Self, ID, VersionedID}; @@ -22,7 +25,7 @@ module NFTs::Marketplace { id: VersionedID, objects: vector, owner: address, - } + } /// A single listing which contains the listed item and its price in [`Coin`]. struct Listing has key, store { @@ -91,7 +94,7 @@ module NFTs::Marketplace { let listing = internal_remove(marketplace, listing); let Listing { id, item, ask, owner } = listing; - assert!(ask == Coin::value(&paid), EAMOUNT_INCORRECT); + assert!(ask == Coin::value(&paid), EAMOUNT_INCORRECT); Transfer::transfer(paid, owner); ID::delete(id); @@ -192,10 +195,10 @@ module NFTs::MarketplaceTests { // SELLER lists KITTY at the Marketplace for 100 GAS. fun list_kitty(scenario: &mut Scenario) { - TestScenario::next_tx(scenario, &SELLER); + TestScenario::next_tx(scenario, &SELLER); let mkp = TestScenario::remove_object(scenario); let nft = TestScenario::remove_object>(scenario); - + Marketplace::list, GAS>(&mut mkp, nft, 100, TestScenario::ctx(scenario)); TestScenario::return_object(scenario, mkp); } @@ -207,7 +210,7 @@ module NFTs::MarketplaceTests { create_marketplace(scenario); mint_kitty(scenario); list_kitty(scenario); - + TestScenario::next_tx(scenario, &SELLER); { let mkp = TestScenario::remove_object(scenario); @@ -216,7 +219,7 @@ module NFTs::MarketplaceTests { // Do the delist operation on a Marketplace. let nft = Marketplace::delist, GAS>(&mut mkp, listing, TestScenario::ctx(scenario)); let kitten = NFT::burn(nft); - + assert!(kitten.id == 1, 0); TestScenario::return_object(scenario, mkp); @@ -238,7 +241,7 @@ module NFTs::MarketplaceTests { { let mkp = TestScenario::remove_object(scenario); let listing = TestScenario::remove_nested_object, GAS>>(scenario, &mkp); - + // Do the delist operation on a Marketplace. let nft = Marketplace::delist, GAS>(&mut mkp, listing, TestScenario::ctx(scenario)); let _ = NFT::burn(nft); @@ -267,14 +270,14 @@ module NFTs::MarketplaceTests { // Do the buy call and expect successful purchase. let nft = Marketplace::buy, GAS>(&mut mkp, listing, payment); let kitten = NFT::burn(nft); - + assert!(kitten.id == 1, 0); TestScenario::return_object(scenario, mkp); TestScenario::return_object(scenario, coin); }; } - + #[test] #[expected_failure(abort_code = 0)] fun fail_to_buy() { @@ -291,14 +294,14 @@ module NFTs::MarketplaceTests { let coin = TestScenario::remove_object>(scenario); let mkp = TestScenario::remove_object(scenario); let listing = TestScenario::remove_nested_object, GAS>>(scenario, &mkp); - + // AMOUNT here is 10 while expected is 100. let payment = Coin::withdraw(&mut coin, 10, TestScenario::ctx(scenario)); // Attempt to buy and expect failure purchase. let nft = Marketplace::buy, GAS>(&mut mkp, listing, payment); let _ = NFT::burn(nft); - + TestScenario::return_object(scenario, mkp); TestScenario::return_object(scenario, coin); }; diff --git a/sui_programmability/examples/nfts/sources/Num.move b/sui_programmability/examples/nfts/sources/Num.move index 63895ece9a0a6..d7f69213356fa 100644 --- a/sui_programmability/examples/nfts/sources/Num.move +++ b/sui_programmability/examples/nfts/sources/Num.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module NFTs::Num { use Sui::ID::VersionedID; use Sui::NFT::{Self, NFT}; diff --git a/sui_programmability/examples/nfts/sources/SharedAuction.move b/sui_programmability/examples/nfts/sources/SharedAuction.move index af47e0451a972..f2f8a58aacf96 100644 --- a/sui_programmability/examples/nfts/sources/SharedAuction.move +++ b/sui_programmability/examples/nfts/sources/SharedAuction.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// This is an implementation of an English auction /// (https://en.wikipedia.org/wiki/English_auction) using shared /// objects. There are types of participants: diff --git a/sui_programmability/examples/nfts/tests/AuctionTests.move b/sui_programmability/examples/nfts/tests/AuctionTests.move index 93866ce30a181..7c3f0a81cb4f7 100644 --- a/sui_programmability/examples/nfts/tests/AuctionTests.move +++ b/sui_programmability/examples/nfts/tests/AuctionTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module NFTs::AuctionTests { use Std::Vector; @@ -20,7 +23,7 @@ module NFTs::AuctionTests { value: u64, } - // Initializes the "state of the world" that mimicks what should + // Initializes the "state of the world" that mimics what should // be available in Sui genesis state (e.g., mints and distributes // coins to users). fun init(ctx: &mut TxContext, bidders: vector
) { diff --git a/sui_programmability/examples/nfts/tests/SharedAuctionTests.move b/sui_programmability/examples/nfts/tests/SharedAuctionTests.move index 974856caac0e6..467c409ffdca5 100644 --- a/sui_programmability/examples/nfts/tests/SharedAuctionTests.move +++ b/sui_programmability/examples/nfts/tests/SharedAuctionTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module NFTs::SharedAuctionTests { use Std::Vector; @@ -24,7 +27,7 @@ module NFTs::SharedAuctionTests { value: u64, } - // Initializes the "state of the world" that mimicks what should + // Initializes the "state of the world" that mimics what should // be available in Sui genesis state (e.g., mints and distributes // coins to users). fun init(ctx: &mut TxContext, bidders: vector
) { diff --git a/sui_programmability/framework/deps/move-stdlib/sources/ASCII.move b/sui_programmability/framework/deps/move-stdlib/sources/ASCII.move index b2cfca8826217..51f14fefaf7c3 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/ASCII.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/ASCII.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// The `ASCII` module defines basic string and char newtypes in Move that verify /// that characters are valid ASCII, and that strings consist of only valid ASCII characters. module Std::ASCII { diff --git a/sui_programmability/framework/deps/move-stdlib/sources/BCS.move b/sui_programmability/framework/deps/move-stdlib/sources/BCS.move index 712c2f2ec2689..fccf887032c09 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/BCS.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/BCS.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Utility for converting a Move value to its binary representation in BCS (Binary Canonical /// Serialization). BCS is the binary encoding for Move resources and other non-module values /// published on-chain. See https://github.com/diem/bcs#binary-canonical-serialization-bcs for more diff --git a/sui_programmability/framework/deps/move-stdlib/sources/BitVector.move b/sui_programmability/framework/deps/move-stdlib/sources/BitVector.move index 8f276219e0190..afcce8c32cc63 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/BitVector.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/BitVector.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Std::BitVector { use Std::Vector; use Std::Errors; diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Capability.move b/sui_programmability/framework/deps/move-stdlib/sources/Capability.move index 1b035bfadf2fd..69a907d6fd615 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Capability.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Capability.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// A module which defines the basic concept of /// [*capabilities*](https://en.wikipedia.org/wiki/Capability-based_security) for managing access control. /// diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Debug.move b/sui_programmability/framework/deps/move-stdlib/sources/Debug.move index 777a75d035749..6af0608bd875e 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Debug.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Debug.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Module providing debug functionality. module Std::Debug { native public fun print(x: &T); diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Errors.move b/sui_programmability/framework/deps/move-stdlib/sources/Errors.move index a28df1e935a01..e589b46d38ad6 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Errors.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Errors.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Module defining error codes used in Move aborts throughout the framework. /// /// A `u64` error code is constructed from two values: diff --git a/sui_programmability/framework/deps/move-stdlib/sources/FixedPoint32.move b/sui_programmability/framework/deps/move-stdlib/sources/FixedPoint32.move index 97ed75e627c2b..6e0e8bc60b54c 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/FixedPoint32.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/FixedPoint32.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Defines a fixed-point numeric type with a 32-bit integer part and /// a 32-bit fractional part. diff --git a/sui_programmability/framework/deps/move-stdlib/sources/GUID.move b/sui_programmability/framework/deps/move-stdlib/sources/GUID.move index 2caa4dd511ebc..c5c7ec3597dba 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/GUID.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/GUID.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// A module for generating globally unique identifiers module Std::GUID { use Std::Signer; diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Hash.move b/sui_programmability/framework/deps/move-stdlib/sources/Hash.move index cc11f95c8414d..e6665386b352d 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Hash.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Hash.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Module which defines SHA hashes for byte vectors. /// /// The functions in this module are natively declared both in the Move runtime diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Option.move b/sui_programmability/framework/deps/move-stdlib/sources/Option.move index 40735b3dc8d94..65e492c8e6611 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Option.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Option.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// This module defines the Option type and its methods to represent and handle an optional value. module Std::Option { use Std::Errors; diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Signer.move b/sui_programmability/framework/deps/move-stdlib/sources/Signer.move index 38473a20237e5..7f5f96500d7ec 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Signer.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Signer.move @@ -1,6 +1,9 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Std::Signer { // Borrows the address of the signer - // Conceptually, you can think of the `signer` as being a struct wrapper arround an + // Conceptually, you can think of the `signer` as being a struct wrapper around an // address // ``` // struct Signer has drop { addr: address } diff --git a/sui_programmability/framework/deps/move-stdlib/sources/UnitTest.move b/sui_programmability/framework/deps/move-stdlib/sources/UnitTest.move index 0f81535c73381..b16211e4fe95c 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/UnitTest.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/UnitTest.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] /// Module providing testing functionality. Only included for tests. module Std::UnitTest { diff --git a/sui_programmability/framework/deps/move-stdlib/sources/Vector.move b/sui_programmability/framework/deps/move-stdlib/sources/Vector.move index b875791a4c87e..043f45b3b6dd5 100644 --- a/sui_programmability/framework/deps/move-stdlib/sources/Vector.move +++ b/sui_programmability/framework/deps/move-stdlib/sources/Vector.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// A variable-sized container that can hold any type. Indexing is 0-based, and /// vectors are growable. This module has many native functions. /// Verification of modules that use this one uses model functions that are implemented diff --git a/sui_programmability/framework/sources/Bag.move b/sui_programmability/framework/sources/Bag.move index 9e557fb9c53f1..9d4df97db1743 100644 --- a/sui_programmability/framework/sources/Bag.move +++ b/sui_programmability/framework/sources/Bag.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// A Bag is a heterogeneous collection of objects with arbitrary types, i.e. /// the objects in the bag don't need to be of the same type. /// These objects are not stored in the Bag directly, instead only a reference diff --git a/sui_programmability/framework/sources/Coin.move b/sui_programmability/framework/sources/Coin.move index 42fd348b2e77f..a08a304eed242 100644 --- a/sui_programmability/framework/sources/Coin.move +++ b/sui_programmability/framework/sources/Coin.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::Coin { use Sui::ID::{Self, VersionedID}; use Sui::Transfer; diff --git a/sui_programmability/framework/sources/Collection.move b/sui_programmability/framework/sources/Collection.move index 8ef1df01c21fd..4366f7822df44 100644 --- a/sui_programmability/framework/sources/Collection.move +++ b/sui_programmability/framework/sources/Collection.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// The `Collection` type represents a collection of objects of the same type `T`. /// In contrast to `vector` which stores the object in the vector directly, /// `Collection` only tracks the ownership indirectly, by keeping a list of diff --git a/sui_programmability/framework/sources/ERC721Metadata.move b/sui_programmability/framework/sources/ERC721Metadata.move index cf02cca4c2ae5..8bd53ee8153d2 100644 --- a/sui_programmability/framework/sources/ERC721Metadata.move +++ b/sui_programmability/framework/sources/ERC721Metadata.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::ERC721Metadata { use Std::ASCII; use Sui::Url::{Self, Url}; @@ -5,17 +8,17 @@ module Sui::ERC721Metadata { // TODO: add symbol()? /// A wrapper type for the ERC721 metadata standard https://eips.ethereum.org/EIPS/eip-721 - struct ERC721Metadata has store { + struct ERC721Metadata has store { /// The token id associated with the source contract on Ethereum token_id: TokenID, - /// A descriptive name for a collection of NFTs in this contract. + /// A descriptive name for a collection of NFTs in this contract. /// This corresponds to the `name()` method in the /// ERC721Metadata interface in EIP-721. - name: UTF8::String, + name: UTF8::String, /// A distinct Uniform Resource Identifier (URI) for a given asset. - /// This corresponds to the `tokenURI()` method in the ERC721Metadata + /// This corresponds to the `tokenURI()` method in the ERC721Metadata /// interface in EIP-721. - token_uri: Url, + token_uri: Url, } // TODO: replace u64 with u256 once the latter is supported @@ -30,7 +33,7 @@ module Sui::ERC721Metadata { public fun new(token_id: TokenID, name: vector, token_uri: vector): ERC721Metadata { // Note: this will abort if `token_uri` is not valid ASCII let uri_str = ASCII::string(token_uri); - ERC721Metadata { + ERC721Metadata { token_id, name: UTF8::string_unsafe(name), token_uri: Url::new_unsafe(uri_str), @@ -52,4 +55,4 @@ module Sui::ERC721Metadata { public fun name(self: &ERC721Metadata): &UTF8::String { &self.name } -} \ No newline at end of file +} diff --git a/sui_programmability/framework/sources/Event.move b/sui_programmability/framework/sources/Event.move index 195d4cc216107..983cd12d2cd7a 100644 --- a/sui_programmability/framework/sources/Event.move +++ b/sui_programmability/framework/sources/Event.move @@ -1,7 +1,10 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::Event { /// Add `t` to the event log of this transaction - // TODO(https://github.com/MystenLabs/sui/issues/19): + // TODO(https://github.com/MystenLabs/sui/issues/19): // restrict to internal types once we can express this in the ability system public native fun emit(event: T); -} \ No newline at end of file +} diff --git a/sui_programmability/framework/sources/GAS.move b/sui_programmability/framework/sources/GAS.move index 3dc71c38658bf..41828ca6d6c0e 100644 --- a/sui_programmability/framework/sources/GAS.move +++ b/sui_programmability/framework/sources/GAS.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Coin is the token used to pay for gas in Sui module Sui::GAS { use Sui::Coin; diff --git a/sui_programmability/framework/sources/Geniteam.move b/sui_programmability/framework/sources/Geniteam.move index b2393d89ab633..54e3f57885c57 100644 --- a/sui_programmability/framework/sources/Geniteam.move +++ b/sui_programmability/framework/sources/Geniteam.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::Geniteam { use Sui::Bag::{Self, Bag}; use Sui::Collection::{Self, Collection}; diff --git a/sui_programmability/framework/sources/ID.move b/sui_programmability/framework/sources/ID.move index f579ba4da3d86..5dc7dd1971ef9 100644 --- a/sui_programmability/framework/sources/ID.move +++ b/sui_programmability/framework/sources/ID.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Sui object identifiers module Sui::ID { use Std::BCS; diff --git a/sui_programmability/framework/sources/Math.move b/sui_programmability/framework/sources/Math.move index fd69fd4dd1342..48ab21fc2f4ec 100644 --- a/sui_programmability/framework/sources/Math.move +++ b/sui_programmability/framework/sources/Math.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Basic math for nicer programmability module Sui::Math { diff --git a/sui_programmability/framework/sources/NFT.move b/sui_programmability/framework/sources/NFT.move index b73891e1acfdd..305ae3965d4b7 100644 --- a/sui_programmability/framework/sources/NFT.move +++ b/sui_programmability/framework/sources/NFT.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::NFT { use Sui::ID::{Self, VersionedID}; use Sui::Transfer; diff --git a/sui_programmability/framework/sources/ObjectBasics.move b/sui_programmability/framework/sources/ObjectBasics.move index e5eb031af856d..b1427cfcdd2f6 100644 --- a/sui_programmability/framework/sources/ObjectBasics.move +++ b/sui_programmability/framework/sources/ObjectBasics.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// Test CTURD object basics (create, transfer, update, read, delete) module Sui::ObjectBasics { use Sui::Event; @@ -12,7 +15,7 @@ module Sui::ObjectBasics { struct Wrapper has key { id: VersionedID, - o: Object + o: Object } struct NewValueEvent has copy, drop { diff --git a/sui_programmability/framework/sources/Transfer.move b/sui_programmability/framework/sources/Transfer.move index 0d033605cfeae..e4add480d005c 100644 --- a/sui_programmability/framework/sources/Transfer.move +++ b/sui_programmability/framework/sources/Transfer.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::Transfer { use Sui::ID::{Self, ID, VersionedID}; diff --git a/sui_programmability/framework/sources/TxContext.move b/sui_programmability/framework/sources/TxContext.move index 7291cf698ed68..5fd10471a6a14 100644 --- a/sui_programmability/framework/sources/TxContext.move +++ b/sui_programmability/framework/sources/TxContext.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::TxContext { use Std::Signer; use Sui::ID::{Self, VersionedID}; @@ -14,7 +17,7 @@ module Sui::TxContext { const EBAD_TX_HASH_LENGTH: u64 = 0; /// Information about the transaction currently being executed. - /// This cannot be constructed by a transaction--it is a privileged object created by + /// This cannot be constructed by a transaction--it is a privileged object created by /// the VM and passed in to the entrypoint of the transaction as `&mut TxContext`. struct TxContext has drop { /// A `signer` wrapping the address of the user that signed the current transaction @@ -37,7 +40,7 @@ module Sui::TxContext { &self.signer } - /// Generate a new, globally unqiue object ID with version 0 + /// Generate a new, globally unique object ID with version 0 public fun new_id(ctx: &mut TxContext): VersionedID { let ids_created = ctx.ids_created; let id = ID::new_versioned_id(fresh_id(*&ctx.tx_hash, ids_created)); diff --git a/sui_programmability/framework/sources/UTF8.move b/sui_programmability/framework/sources/UTF8.move index a9cb281240338..acebb6c3c57a7 100644 --- a/sui_programmability/framework/sources/UTF8.move +++ b/sui_programmability/framework/sources/UTF8.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module Sui::UTF8 { use Std::ASCII; use Std::Option::Option; @@ -24,7 +27,7 @@ module Sui::UTF8 { ASCII::try_string(self.bytes) } - /// Return the underyling bytes of `self` + /// Return the underlying bytes of `self` public fun bytes(self: &String): &vector { &self.bytes } @@ -34,4 +37,4 @@ module Sui::UTF8 { let String { bytes } = self; bytes } -} \ No newline at end of file +} diff --git a/sui_programmability/framework/sources/Url.move b/sui_programmability/framework/sources/Url.move index 4cc73cd2c4295..476b01fc0c90f 100644 --- a/sui_programmability/framework/sources/Url.move +++ b/sui_programmability/framework/sources/Url.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + /// URL: standard Uniform Resource Locator string /// Url: Sui type which wraps a URL /// UrlCommitment: Sui type which wraps a Url but also includes an immutable commitment diff --git a/sui_programmability/framework/tests/BagTests.move b/sui_programmability/framework/tests/BagTests.move index a1bb2998bc86e..90d514bc491e6 100644 --- a/sui_programmability/framework/tests/BagTests.move +++ b/sui_programmability/framework/tests/BagTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Sui::BagTests { use Sui::Bag::{Self, Bag}; diff --git a/sui_programmability/framework/tests/CollectionTests.move b/sui_programmability/framework/tests/CollectionTests.move index 2dc7201fb1c88..220c9d8bc59d3 100644 --- a/sui_programmability/framework/tests/CollectionTests.move +++ b/sui_programmability/framework/tests/CollectionTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Sui::CollectionTests { use Sui::Collection::{Self, Collection}; diff --git a/sui_programmability/framework/tests/IDTests.move b/sui_programmability/framework/tests/IDTests.move index 9186309a9a46c..f3aa0c7b44b42 100644 --- a/sui_programmability/framework/tests/IDTests.move +++ b/sui_programmability/framework/tests/IDTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Sui::IDTests { use Sui::ID; @@ -19,4 +22,4 @@ module Sui::IDTests { let Object { id } = obj; ID::delete(id); } -} \ No newline at end of file +} diff --git a/sui_programmability/framework/tests/TxContextTests.move b/sui_programmability/framework/tests/TxContextTests.move index 0270652e1300d..4b7eff4719762 100644 --- a/sui_programmability/framework/tests/TxContextTests.move +++ b/sui_programmability/framework/tests/TxContextTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Sui::TxContextTests { use Sui::ID; @@ -18,4 +21,4 @@ module Sui::TxContextTests { ID::delete(id2); } -} \ No newline at end of file +} diff --git a/sui_programmability/framework/tests/UrlTests.move b/sui_programmability/framework/tests/UrlTests.move index b20ca50cad7c1..192aeb9cffee4 100644 --- a/sui_programmability/framework/tests/UrlTests.move +++ b/sui_programmability/framework/tests/UrlTests.move @@ -1,3 +1,6 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + #[test_only] module Sui::UrlTests { use Sui::Url; diff --git a/sui_programmability/tutorial/sources/M1.move b/sui_programmability/tutorial/sources/M1.move index d5e7ac303abb2..9efa016f3ae6f 100644 --- a/sui_programmability/tutorial/sources/M1.move +++ b/sui_programmability/tutorial/sources/M1.move @@ -1,7 +1,10 @@ +// Copyright (c) 2022, Mysten Labs, Inc. +// SPDX-License-Identifier: Apache-2.0 + module MyFirstPackage::M1 { use Sui::ID::VersionedID; use Sui::TxContext::TxContext; - + struct Sword has key, store { id: VersionedID, magic: u64, @@ -24,12 +27,12 @@ module MyFirstPackage::M1 { // transfer the forge object to the module/package publisher // (presumably the game admin) Transfer::transfer(admin, TxContext::sender(ctx)); - } + } public fun swords_created(self: &Forge): u64 { self.swords_created } - + public fun magic(self: &Sword): u64 { self.magic } @@ -45,7 +48,7 @@ module MyFirstPackage::M1 { let sword = Sword { id: TxContext::new_id(ctx), magic: magic, - strength: strength, + strength: strength, }; // transfer the sword Transfer::transfer(sword, recipient); @@ -66,7 +69,7 @@ module MyFirstPackage::M1 { let admin = @0xBABE; // first transaction to emulate module initialization - let scenario = &mut TestScenario::begin(&admin); + let scenario = &mut TestScenario::begin(&admin); { init(TestScenario::ctx(scenario)); }; @@ -116,7 +119,7 @@ module MyFirstPackage::M1 { // fourth transaction executed by the final sword owner TestScenario::next_tx(scenario, &final_owner); { - + // extract the sword owned by the final owner let sword = TestScenario::remove_object(scenario); // verify that the sword has expected properties @@ -125,29 +128,29 @@ module MyFirstPackage::M1 { TestScenario::return_object(scenario, sword) } } - - + + #[test] public fun test_sword_create() { use Sui::Transfer; use Sui::TxContext; - + // create a dummy TxContext for testing let ctx = TxContext::dummy(); - + // create a sword let sword = Sword { id: TxContext::new_id(&mut ctx), magic: 42, - strength: 7, + strength: 7, }; - + // check if accessor functions return correct values assert!(magic(&sword) == 42 && strength(&sword) == 7, 1); // create a dummy address and transfer the sword - let dummy_address = @0xCAFE; + let dummy_address = @0xCAFE; Transfer::transfer(sword, dummy_address); } - + }