Skip to content

Commit

Permalink
rename
Browse files Browse the repository at this point in the history
  • Loading branch information
yito88 committed Jun 16, 2023
1 parent d02b9ad commit 84e44dc
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 12 deletions.
20 changes: 11 additions & 9 deletions core/src/types/address.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub const FIXED_LEN_STRING_BYTES: usize = 45;
/// Internal IBC address
pub const IBC: Address = Address::Internal(InternalAddress::Ibc);
/// Internal multitoken mint address
pub const MINT: Address = Address::Internal(InternalAddress::Mint);
pub const MINTED: Address = Address::Internal(InternalAddress::Minted);
/// Internal ledger parameters address
pub const PARAMETERS: Address = Address::Internal(InternalAddress::Parameters);
/// Internal PoS address
Expand Down Expand Up @@ -85,7 +85,7 @@ mod internal {
"ano::Replay Protection ";
pub const MULTITOKEN: &str =
"ano::Multitoken ";
pub const MINT: &str =
pub const MINTED: &str =
"ano::Multitoken Mint Address ";
}

Expand Down Expand Up @@ -233,7 +233,7 @@ impl Address {
InternalAddress::Multitoken => {
internal::MULTITOKEN.to_string()
}
InternalAddress::Mint => internal::MINT.to_string(),
InternalAddress::Minted => internal::MINTED.to_string(),
};
debug_assert_eq!(string.len(), FIXED_LEN_STRING_BYTES);
string
Expand Down Expand Up @@ -307,7 +307,9 @@ impl Address {
internal::MULTITOKEN => {
Ok(Address::Internal(InternalAddress::Multitoken))
}
internal::MINT => Ok(Address::Internal(InternalAddress::Mint)),
internal::MINTED => {
Ok(Address::Internal(InternalAddress::Minted))
}
_ => Err(Error::new(
ErrorKind::InvalidData,
"Invalid internal address",
Expand Down Expand Up @@ -522,7 +524,7 @@ pub enum InternalAddress {
/// Multitoken
Multitoken,
/// Minted multitoken address
Mint,
Minted,
}

impl Display for InternalAddress {
Expand All @@ -541,7 +543,7 @@ impl Display for InternalAddress {
Self::EthBridge => "EthBridge".to_string(),
Self::ReplayProtection => "ReplayProtection".to_string(),
Self::Multitoken => "Multitoken".to_string(),
Self::Mint => "Mint".to_string(),
Self::Minted => "Minted".to_string(),
}
)
}
Expand Down Expand Up @@ -809,8 +811,8 @@ pub mod testing {
InternalAddress::EthBridge => {}
InternalAddress::ReplayProtection => {}
InternalAddress::Multitoken => {}
InternalAddress::Mint => {} /* Add new addresses in the
* `prop_oneof` below. */
InternalAddress::Minted => {} /* Add new addresses in the
* `prop_oneof` below. */
};
prop_oneof![
Just(InternalAddress::PoS),
Expand All @@ -823,7 +825,7 @@ pub mod testing {
Just(InternalAddress::EthBridge),
Just(InternalAddress::ReplayProtection),
Just(InternalAddress::Multitoken),
Just(InternalAddress::Mint)
Just(InternalAddress::Minted)
]
}

Expand Down
4 changes: 2 additions & 2 deletions core/src/types/token.rs
Original file line number Diff line number Diff line change
Expand Up @@ -372,7 +372,7 @@ pub fn minter_key(token_addr: &Address) -> Key {
/// Obtain a storage key for the minted multitoken balance.
pub fn minted_balance_key(token_addr: &Address) -> Key {
balance_prefix(token_addr)
.push(&Address::Internal(InternalAddress::Mint).to_db_key())
.push(&Address::Internal(InternalAddress::Minted).to_db_key())
.expect("Cannot obtain a storage key")
}

Expand Down Expand Up @@ -429,7 +429,7 @@ pub fn is_masp_key(key: &Key) -> bool {
/// Is storage key for total supply of a specific token?
pub fn is_minted_balance_key(token_addr: &Address, key: &Key) -> bool {
if let Some(owner) = is_balance_key(token_addr, key) {
*owner == Address::Internal(InternalAddress::Mint)
*owner == Address::Internal(InternalAddress::Minted)
} else {
false
}
Expand Down
2 changes: 1 addition & 1 deletion shared/src/ledger/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ where
result
}
InternalAddress::IbcToken(_)
| InternalAddress::Mint => {
| InternalAddress::Minted => {
// These addresses should be a part of a multitoken
// key
gas_meter = ctx.gas_meter.into_inner();
Expand Down

0 comments on commit 84e44dc

Please sign in to comment.