diff --git a/framework/cached-packages/src/libra_framework_sdk_builder.rs b/framework/cached-packages/src/libra_framework_sdk_builder.rs index 6e00fdd5d..b506801c1 100644 --- a/framework/cached-packages/src/libra_framework_sdk_builder.rs +++ b/framework/cached-packages/src/libra_framework_sdk_builder.rs @@ -258,17 +258,17 @@ pub enum EntryFunctionCall { /// Only callable in tests and testnets where the core resources account exists. /// Claim the delegated mint capability and destroy the delegated token. - GasCoinClaimMintCapability {}, + LibraCoinClaimMintCapability {}, /// Only callable in tests and testnets where the core resources account exists. /// Create delegated token for the address so the account could claim MintCapability later. - GasCoinDelegateMintCapability { + LibraCoinDelegateMintCapability { to: AccountAddress, }, /// Root account can mint to an address. Only used for genesis and tests. /// The "root" account in smoke tests has some privileges. - GasCoinMintToImpl { + LibraCoinMintToImpl { dst_addr: AccountAddress, amount: u64, }, @@ -705,9 +705,9 @@ impl EntryFunctionCall { id, } => donor_voice_vote_veto_tx(multisig_address, id), JailUnjailByVoucher { addr } => jail_unjail_by_voucher(addr), - GasCoinClaimMintCapability {} => gas_coin_claim_mint_capability(), - GasCoinDelegateMintCapability { to } => gas_coin_delegate_mint_capability(to), - GasCoinMintToImpl { dst_addr, amount } => gas_coin_mint_to_impl(dst_addr, amount), + LibraCoinClaimMintCapability {} => libra_coin_claim_mint_capability(), + LibraCoinDelegateMintCapability { to } => libra_coin_delegate_mint_capability(to), + LibraCoinMintToImpl { dst_addr, amount } => libra_coin_mint_to_impl(dst_addr, amount), MultisigAccountAddOwner { new_owner } => multisig_account_add_owner(new_owner), MultisigAccountAddOwners { new_owners } => multisig_account_add_owners(new_owners), MultisigAccountApproveTransaction { @@ -1515,14 +1515,14 @@ pub fn jail_unjail_by_voucher(addr: AccountAddress) -> TransactionPayload { /// Only callable in tests and testnets where the core resources account exists. /// Claim the delegated mint capability and destroy the delegated token. -pub fn gas_coin_claim_mint_capability() -> TransactionPayload { +pub fn libra_coin_claim_mint_capability() -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( AccountAddress::new([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]), - ident_str!("gas_coin").to_owned(), + ident_str!("libra_coin").to_owned(), ), ident_str!("claim_mint_capability").to_owned(), vec![], @@ -1532,14 +1532,14 @@ pub fn gas_coin_claim_mint_capability() -> TransactionPayload { /// Only callable in tests and testnets where the core resources account exists. /// Create delegated token for the address so the account could claim MintCapability later. -pub fn gas_coin_delegate_mint_capability(to: AccountAddress) -> TransactionPayload { +pub fn libra_coin_delegate_mint_capability(to: AccountAddress) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( AccountAddress::new([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]), - ident_str!("gas_coin").to_owned(), + ident_str!("libra_coin").to_owned(), ), ident_str!("delegate_mint_capability").to_owned(), vec![], @@ -1549,14 +1549,14 @@ pub fn gas_coin_delegate_mint_capability(to: AccountAddress) -> TransactionPaylo /// Root account can mint to an address. Only used for genesis and tests. /// The "root" account in smoke tests has some privileges. -pub fn gas_coin_mint_to_impl(dst_addr: AccountAddress, amount: u64) -> TransactionPayload { +pub fn libra_coin_mint_to_impl(dst_addr: AccountAddress, amount: u64) -> TransactionPayload { TransactionPayload::EntryFunction(EntryFunction::new( ModuleId::new( AccountAddress::new([ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, ]), - ident_str!("gas_coin").to_owned(), + ident_str!("libra_coin").to_owned(), ), ident_str!("mint_to_impl").to_owned(), vec![], @@ -2723,21 +2723,21 @@ mod decoder { } } - pub fn gas_coin_claim_mint_capability( + pub fn libra_coin_claim_mint_capability( payload: &TransactionPayload, ) -> Option { if let TransactionPayload::EntryFunction(_script) = payload { - Some(EntryFunctionCall::GasCoinClaimMintCapability {}) + Some(EntryFunctionCall::LibraCoinClaimMintCapability {}) } else { None } } - pub fn gas_coin_delegate_mint_capability( + pub fn libra_coin_delegate_mint_capability( payload: &TransactionPayload, ) -> Option { if let TransactionPayload::EntryFunction(script) = payload { - Some(EntryFunctionCall::GasCoinDelegateMintCapability { + Some(EntryFunctionCall::LibraCoinDelegateMintCapability { to: bcs::from_bytes(script.args().get(0)?).ok()?, }) } else { @@ -2745,9 +2745,9 @@ mod decoder { } } - pub fn gas_coin_mint_to_impl(payload: &TransactionPayload) -> Option { + pub fn libra_coin_mint_to_impl(payload: &TransactionPayload) -> Option { if let TransactionPayload::EntryFunction(script) = payload { - Some(EntryFunctionCall::GasCoinMintToImpl { + Some(EntryFunctionCall::LibraCoinMintToImpl { dst_addr: bcs::from_bytes(script.args().get(0)?).ok()?, amount: bcs::from_bytes(script.args().get(1)?).ok()?, }) @@ -3335,16 +3335,16 @@ static SCRIPT_FUNCTION_DECODER_MAP: once_cell::sync::Lazy anyhow::Result<()> { let payload = public_info .transaction_factory() - .payload(libra_stdlib::gas_coin_mint_to_impl(addr, amount)); + .payload(libra_stdlib::libra_coin_mint_to_impl(addr, amount)); let mint_txn = public_info .root_account() diff --git a/tools/genesis/src/genesis_functions.rs b/tools/genesis/src/genesis_functions.rs index 084ce031d..9eb1e8b72 100644 --- a/tools/genesis/src/genesis_functions.rs +++ b/tools/genesis/src/genesis_functions.rs @@ -476,7 +476,7 @@ pub fn set_final_supply(session: &mut SessionExt, supply_settings: &SupplySettin exec_function( session, - "gas_coin", + "libra_coin", "genesis_set_final_supply", vec![], serialized_values, diff --git a/tools/query/tests/view.rs b/tools/query/tests/view.rs index ee1600461..627469ede 100644 --- a/tools/query/tests/view.rs +++ b/tools/query/tests/view.rs @@ -9,7 +9,7 @@ async fn libra_view_test() { let c = s.client(); let q = QueryType::View { - function_id: "0x1::gas_coin::supply".to_string(), + function_id: "0x1::libra_coin::supply".to_string(), type_args: None, args: None, }; diff --git a/types/src/move_resource/gas_coin.rs b/types/src/move_resource/gas_coin.rs index cc8981c8c..ff5126dad 100644 --- a/types/src/move_resource/gas_coin.rs +++ b/types/src/move_resource/gas_coin.rs @@ -17,7 +17,7 @@ use crate::ONCHAIN_DECIMAL_PRECISION; pub static GAS_COIN_TYPE: Lazy = Lazy::new(|| { TypeTag::Struct(Box::new(StructTag { address: AccountAddress::ONE, - module: ident_str!("gas_coin").to_owned(), + module: ident_str!("libra_coin").to_owned(), name: ident_str!("LibraCoin").to_owned(), type_params: vec![], })) diff --git a/types/src/move_resource/tower_state.rs b/types/src/move_resource/libra_coin.rs similarity index 91% rename from types/src/move_resource/tower_state.rs rename to types/src/move_resource/libra_coin.rs index b53cadee6..e02ca1d43 100644 --- a/types/src/move_resource/tower_state.rs +++ b/types/src/move_resource/libra_coin.rs @@ -15,14 +15,13 @@ use crate::ONCHAIN_DECIMAL_PRECISION; /// The balance resource held under an account. #[derive(Debug, Serialize, Deserialize)] // #[cfg_attr(any(test, feature = "fuzzing"), derive(Arbitrary))] -pub struct GasCoinStoreResource { +pub struct LibraCoinStoreResource { coin: u64, - frozen: bool, deposit_events: EventHandle, withdraw_events: EventHandle, } -impl GasCoinStoreResource { +impl LibraCoinStoreResource { pub fn new( coin: u64, frozen: bool, @@ -54,7 +53,7 @@ impl GasCoinStoreResource { } } -impl MoveStructType for GasCoinStoreResource { +impl MoveStructType for LibraCoinStoreResource { const MODULE_NAME: &'static IdentStr = ident_str!("coin"); const STRUCT_NAME: &'static IdentStr = ident_str!("CoinStore"); @@ -63,12 +62,12 @@ impl MoveStructType for GasCoinStoreResource { } } -impl MoveResource for GasCoinStoreResource {} +impl MoveResource for LibraCoinStoreResource {} // TODO: This might break reading from API maybe it must be diem_api_types::U64; #[derive(Debug, Serialize, Deserialize)] -pub struct GasCoin { +pub struct LibraCoin { pub value: u64, } @@ -106,7 +105,7 @@ impl SlowWalletBalance { } /// This is the same shape as Slow Wallet balance, except that it is scaled. -/// The slow wallet struct contains the coin value as it exists in the database which is without decimals. The decimal precision for GasCoin is 6. So we need to scale it for human consumption. +/// The slow wallet struct contains the coin value as it exists in the database which is without decimals. The decimal precision for LibraCoin is 6. So we need to scale it for human consumption. #[derive(Debug, Serialize, Deserialize)] pub struct LibraBalanceDisplay {