diff --git a/core/src/types/eth_bridge_pool.rs b/core/src/types/eth_bridge_pool.rs index 22539714ff6..3d95d50446e 100644 --- a/core/src/types/eth_bridge_pool.rs +++ b/core/src/types/eth_bridge_pool.rs @@ -8,7 +8,7 @@ use borsh_ext::BorshSerializeExt; use ethabi::token::Token; use serde::{Deserialize, Serialize}; -use crate::ledger::eth_bridge::storage::wrapped_erc20s; +use super::address::InternalAddress; use crate::types::address::Address; use crate::types::eth_abi::Encode; use crate::types::ethereum_events::{ @@ -173,16 +173,26 @@ pub struct PendingTransfer { pub gas_fee: GasFee, } +/// Construct a token address from an ERC20 address. +pub fn erc20_token_address(address: &EthAddress) -> Address { + Address::Internal(InternalAddress::Erc20(*address)) +} + +/// Construct a NUT token address from an ERC20 address. +pub fn erc20_nut_address(address: &EthAddress) -> Address { + Address::Internal(InternalAddress::Nut(*address)) +} + impl PendingTransfer { /// Get a token [`Address`] from this [`PendingTransfer`]. #[inline] pub fn token_address(&self) -> Address { match &self.transfer.kind { TransferToEthereumKind::Erc20 => { - wrapped_erc20s::token(&self.transfer.asset) + erc20_token_address(&self.transfer.asset) } TransferToEthereumKind::Nut => { - wrapped_erc20s::nut(&self.transfer.asset) + erc20_nut_address(&self.transfer.asset) } } } diff --git a/ethereum_bridge/src/storage/wrapped_erc20.rs b/ethereum_bridge/src/storage/wrapped_erc20.rs index e4cf39779ac..0a4a5760385 100644 --- a/ethereum_bridge/src/storage/wrapped_erc20.rs +++ b/ethereum_bridge/src/storage/wrapped_erc20.rs @@ -9,16 +9,6 @@ use crate::types::token::{ balance_key, minted_balance_key, MINTED_STORAGE_KEY, }; -/// Construct a token address from an ERC20 address. -pub fn token(address: &EthAddress) -> Address { - Address::Internal(InternalAddress::Erc20(*address)) -} - -/// Construct a NUT token address from an ERC20 address. -pub fn nut(address: &EthAddress) -> Address { - Address::Internal(InternalAddress::Nut(*address)) -} - /// Represents the type of a key relating to a wrapped ERC20 #[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash, Clone)] pub enum KeyType {