Skip to content

Commit

Permalink
Change Type id::ID in Rust to id::VersionedID
Browse files Browse the repository at this point in the history
  • Loading branch information
666lcz committed Feb 21, 2022
1 parent 0930333 commit a4c82ff
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions sui_types/src/coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use serde::{Deserialize, Serialize};

use crate::{
base_types::{ObjectID, SequenceNumber},
id::ID,
id::VersionedID,
SUI_FRAMEWORK_ADDRESS,
};

Expand All @@ -21,12 +21,12 @@ pub const COIN_STRUCT_NAME: &IdentStr = COIN_MODULE_NAME;
// Rust version of the Move FastX::Coin::Coin type
#[derive(Debug, Serialize, Deserialize)]
pub struct Coin {
id: ID,
id: VersionedID,
value: u64,
}

impl Coin {
pub fn new(id: ID, value: u64) -> Self {
pub fn new(id: VersionedID, value: u64) -> Self {
Self { id, value }
}

Expand Down Expand Up @@ -61,7 +61,7 @@ impl Coin {
fields: vec![
MoveFieldLayout::new(
ident_str!("id").to_owned(),
MoveTypeLayout::Struct(ID::layout()),
MoveTypeLayout::Struct(VersionedID::layout()),
),
MoveFieldLayout::new(ident_str!("value").to_owned(), MoveTypeLayout::U64),
],
Expand Down
4 changes: 2 additions & 2 deletions sui_types/src/gas_coin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ use crate::{
base_types::{ObjectID, SequenceNumber},
coin::Coin,
error::{SuiError, SuiResult},
id::ID,
id::VersionedID,
object::{Data, MoveObject, Object},
SUI_FRAMEWORK_ADDRESS,
};
Expand Down Expand Up @@ -44,7 +44,7 @@ pub struct GasCoin(Coin);

impl GasCoin {
pub fn new(id: ObjectID, version: SequenceNumber, value: u64) -> Self {
Self(Coin::new(ID::new(id, version), value))
Self(Coin::new(VersionedID::new(id, version), value))
}

pub fn value(&self) -> u64 {
Expand Down
4 changes: 2 additions & 2 deletions sui_types/src/id.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub const ID_BYTES_STRUCT_NAME: &IdentStr = ident_str!("IDBytes");

/// Rust version of the Move FastX::ID::VersionedID type
#[derive(Debug, Serialize, Deserialize)]
pub struct ID {
pub struct VersionedID {
id: IDBytes,
version: u64,
}
Expand All @@ -31,7 +31,7 @@ struct IDBytes {
bytes: ObjectID,
}

impl ID {
impl VersionedID {
pub fn new(bytes: ObjectID, version: SequenceNumber) -> Self {
Self {
id: IDBytes::new(bytes),
Expand Down

0 comments on commit a4c82ff

Please sign in to comment.