Skip to content

Commit

Permalink
Rename type ID in Move Framework to Versioned ID
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz committed Feb 21, 2022
1 parent da25197 commit 3fc772a
Show file tree
Hide file tree
Showing 28 changed files with 87 additions and 87 deletions.
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Test::M1 {
use FastX::ID::ID;
use FastX::ID::VersionedID;
use FastX::TxContext::{Self, TxContext};
use FastX::Transfer;

struct Object has key, store {
id: ID,
id: VersionedID,
value: u64,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Test::M1 {
use FastX::ID::ID;
use FastX::ID::VersionedID;
use FastX::TxContext::{Self, TxContext};
use FastX::Transfer;

struct Object has key, store {
id: ID,
id: VersionedID,
value: u64,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Test::M1 {
use FastX::ID::ID;
use FastX::ID::VersionedID;
use FastX::TxContext::{Self, TxContext};
use FastX::Transfer;

struct Object has key, store {
id: ID,
id: VersionedID,
value: u64,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
module Test::M1 {
use FastX::ID::ID;
use FastX::ID::VersionedID;
use FastX::TxContext::{Self, TxContext};
use FastX::Transfer;

struct Object has key, store {
id: ID,
id: VersionedID,
value: u64,
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
module Test::M1 {
use FastX::Address;
use FastX::ID::ID;
use FastX::ID::VersionedID;
use FastX::TxContext::{Self, TxContext};
use FastX::Transfer;
use FastX::Coin::Coin;

struct Object has key, store {
id: ID,
id: VersionedID,
value: u64,
}

Expand Down
8 changes: 4 additions & 4 deletions sui_programmability/examples/sources/CombinableObjects.move
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ module Examples::CombinableObjects {
use Examples::TrustedCoin::EXAMPLE;
use FastX::Address::{Self, Address};
use FastX::Coin::{Self, Coin};
use FastX::ID::{Self, ID};
use FastX::ID::{Self, VersionedID};
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};

struct Ham has key {
id: ID
id: VersionedID
}

struct Bread has key {
id: ID
id: VersionedID
}

struct Sandwich has key {
id: ID
id: VersionedID
}

/// Address selling ham, bread, etc
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/// An example of a custom object with comments explaining the relevant bits
module Examples::CustomObjectTemplate {
use FastX::Address::{Self, Address};
use FastX::ID::ID;
use FastX::ID::VersionedID;
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};

Expand All @@ -11,7 +11,7 @@ module Examples::CustomObjectTemplate {
/// Other object attributes present at the protocol level (authenticator,
/// sequence number, TxDigest, ...) are intentionally not exposed here.
struct Object has key {
id: ID,
id: VersionedID,
/// Custom objects can have fields of arbitrary type...
custom_field: u64,
/// ... including other objects
Expand All @@ -30,7 +30,7 @@ module Examples::CustomObjectTemplate {
/// An object that can live either in the global object pool or as a nested
/// object.
struct AnotherObject has key, store {
id: ID,
id: VersionedID,
}

/// Example of updating an object. All Move fields are private, so the
Expand Down
4 changes: 2 additions & 2 deletions sui_programmability/examples/sources/EconMod.move
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ module Examples::EconMod {
use Examples::Hero::Hero;
use FastX::Address::Address;
use FastX::Coin::{Self, Coin};
use FastX::ID::{Self, ID};
use FastX::ID::{Self, VersionedID};
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};

Expand All @@ -16,7 +16,7 @@ module Examples::EconMod {
/// The two players split the reward for slaying the monster according to
/// the `helper_reward` parameter.
struct HelpMeSlayThisMonster has key {
id: ID,
id: VersionedID,
/// Monster to be slay by the owner of this object
monster: SeaMonster,
/// Identity of the user that originally owned the monster
Expand Down
12 changes: 6 additions & 6 deletions sui_programmability/examples/sources/Hero.move
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@ module Examples::Hero {
use FastX::Address::{Self, Address};
use FastX::Coin::{Self, Coin};
use FastX::Event;
use FastX::ID::{Self, ID, IDBytes};
use FastX::ID::{Self, VersionedID, IDBytes};
use FastX::Math;
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};
use Std::Option::{Self, Option};

/// Our hero!
struct Hero has key, store {
id: ID,
id: VersionedID,
/// Hit points. If they go to zero, the hero can't do anything
hp: u64,
/// Experience of the hero. Begins at zero
Expand All @@ -24,7 +24,7 @@ module Examples::Hero {

/// The hero's trusty sword
struct Sword has key, store {
id: ID,
id: VersionedID,
/// Constant set at creation. Acts as a multiplier on sword's strength.
/// Swords with high magic are rarer (because they cost more).
magic: u64,
Expand All @@ -34,14 +34,14 @@ module Examples::Hero {

/// For healing wounded heroes
struct Potion has key, store {
id: ID,
id: VersionedID,
/// Effectivenss of the potion
potency: u64
}

/// A creature that the hero can slay to level up
struct Boar has key {
id: ID,
id: VersionedID,
/// Hit points before the boar is slain
hp: u64,
/// Strength of this particular boar
Expand All @@ -50,7 +50,7 @@ module Examples::Hero {

/// Capability conveying the authority to create boars and potions
struct GameAdmin has key {
id: ID,
id: VersionedID,
/// Total number of boars the admin has created
boars_created: u64,
/// Total number of potions the admin has created
Expand Down
6 changes: 3 additions & 3 deletions sui_programmability/examples/sources/HeroMod.move
Original file line number Diff line number Diff line change
Expand Up @@ -8,22 +8,22 @@
module Examples::HeroMod {
use Examples::Hero::{Self, Hero};
use FastX::Address::Address;
use FastX::ID::{Self, ID};
use FastX::ID::{Self, VersionedID};
use FastX::Coin::{Self, Coin, TreasuryCap };
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};

/// A new kind of monster for the hero to fight
struct SeaMonster has key, store {
id: ID,
id: VersionedID,
/// Tokens that the user will earn for slaying this monster
reward: Coin<RUM>
}

/// Admin capability granting permission to mint RUM tokens and
/// create monsters
struct SeaScapeAdmin has key {
id: ID,
id: VersionedID,
/// Permission to mint RUM
treasury_cap: TreasuryCap<RUM>,
/// Total number of monsters created so far
Expand Down
10 changes: 5 additions & 5 deletions sui_programmability/examples/sources/TicTacToe.move
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module Examples::TicTacToe {
use Std::Vector;

use FastX::Address::Address;
use FastX::ID::{Self, ID, IDBytes};
use FastX::ID::{Self, VersionedID, IDBytes};
use FastX::Event;
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};
Expand All @@ -19,7 +19,7 @@ module Examples::TicTacToe {
const NO_MORE_MARK: u64 = 1;

struct TicTacToe has key {
id: ID,
id: VersionedID,
gameboard: vector<vector<Option<Mark>>>,
cur_turn: u8,
game_status: u8,
Expand All @@ -28,20 +28,20 @@ module Examples::TicTacToe {
}

struct MarkMintCap has key {
id: ID,
id: VersionedID,
game_id: IDBytes,
remaining_supply: u8,
}

struct Mark has key, store {
id: ID,
id: VersionedID,
player: Address,
row: u64,
col: u64,
}

struct Trophy has key {
id: ID,
id: VersionedID,
}

struct MarkSentEvent has copy, drop {
Expand Down
6 changes: 3 additions & 3 deletions sui_programmability/framework/sources/Coin.move
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
module FastX::Coin {
use FastX::Address::{Self, Address};
use FastX::ID::{Self, ID};
use FastX::ID::{Self, VersionedID};
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};
use Std::Errors;
use Std::Vector;

/// A coin of type `T` worth `value`. Transferrable
struct Coin<phantom T> has key, store {
id: ID,
id: VersionedID,
value: u64
}

/// Capability allowing the bearer to mint and burn
/// coins of type `T`. Transferrable
struct TreasuryCap<phantom T> has key, store {
id: ID,
id: VersionedID,
total_supply: u64
}

Expand Down
4 changes: 2 additions & 2 deletions sui_programmability/framework/sources/Collection.move
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module FastX::Collection {
use Std::Option::{Self, Option};
use Std::Vector::Self;
use FastX::Address::{Self, Address};
use FastX::ID::{Self, ID, IDBytes};
use FastX::ID::{Self, VersionedID, IDBytes};
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};

Expand All @@ -17,7 +17,7 @@ module FastX::Collection {
const DEFAULT_MAX_CAPACITY: u64 = 65536;

struct Collection has key {
id: ID,
id: VersionedID,
objects: vector<IDBytes>,
max_capacity: u64,
}
Expand Down
4 changes: 2 additions & 2 deletions sui_programmability/framework/sources/Escrow.move
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
/// safety.
module FastX::Escrow {
use FastX::Address::Address;
use FastX::ID::{Self, IDBytes, ID};
use FastX::ID::{Self, IDBytes, VersionedID};
use FastX::Transfer;
use FastX::TxContext::{Self, TxContext};

/// An object held in escrow
struct EscrowedObj<T: key + store, phantom ExchangeForT: key + store> has key, store {
id: ID,
id: VersionedID,
/// owner of the escrowed object
sender: Address,
/// intended recipient of the escrowed object
Expand Down
8 changes: 4 additions & 4 deletions sui_programmability/framework/sources/Geniteam.move
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module FastX::Geniteam {
use FastX::ID::{Self, ID, IDBytes};
use FastX::ID::{Self, VersionedID, IDBytes};
use FastX::TxContext::{Self, TxContext};
use FastX::Transfer;
use Std::ASCII::{Self, String};
Expand All @@ -12,7 +12,7 @@ module FastX::Geniteam {
const EMONSTER_NOT_FOUND: u64 = 1;

struct Player has key {
id: ID,
id: VersionedID,
player_name: String,
farm: Farm,
water_runes_count: u64,
Expand All @@ -22,7 +22,7 @@ module FastX::Geniteam {
}

struct Farm has key, store {
id: ID,
id: VersionedID,
farm_name: String,
farm_img_id: u64,
level: u64,
Expand All @@ -34,7 +34,7 @@ module FastX::Geniteam {
}

struct Monster has key, store {
id: ID,
id: VersionedID,
monster_name: String,
monster_img_id: u64,
breed: u8,
Expand Down
Loading

0 comments on commit 3fc772a

Please sign in to comment.