diff --git a/eth-connector/src/lib.rs b/eth-connector/src/lib.rs index 48ea01d..c3f3c15 100644 --- a/eth-connector/src/lib.rs +++ b/eth-connector/src/lib.rs @@ -20,6 +20,9 @@ use near_contract_standards::fungible_token::metadata::{ use near_contract_standards::fungible_token::receiver::ext_ft_receiver; use near_contract_standards::fungible_token::resolver::{ext_ft_resolver, FungibleTokenResolver}; use near_contract_standards::fungible_token::FungibleToken; +use near_contract_standards::storage_management::{ + StorageBalance, StorageBalanceBounds, StorageManagement, +}; use near_plugins::{ access_control, access_control_any, pause, AccessControlRole, AccessControllable, Pausable, Upgradable, @@ -579,7 +582,46 @@ impl FungibleTokenResolver for EthConnectorContract { } } -near_contract_standards::impl_fungible_token_storage!(EthConnectorContract, ft); +#[near_bindgen] +impl StorageManagement for EthConnectorContract { + #[payable] + fn storage_deposit( + &mut self, + account_id: Option, + registration_only: Option, + ) -> StorageBalance { + self.ft.storage_deposit(account_id, registration_only) + } + + #[payable] + fn storage_withdraw(&mut self, amount: Option) -> StorageBalance { + self.ft.storage_withdraw(amount) + } + + #[payable] + fn storage_unregister(&mut self, force: Option) -> bool { + if let Some(_) = self.ft.internal_storage_unregister(force) { + true + } else { + false + } + } + + fn storage_balance_bounds(&self) -> StorageBalanceBounds { + self.ft.storage_balance_bounds() + } + + fn storage_balance_of(&self, account_id: AccountId) -> Option { + if self.ft.account_storage_usage == 0 { + Some(StorageBalance { + total: 0.into(), + available: 0.into(), + }) + } else { + self.ft.storage_balance_of(account_id) + } + } +} #[near_bindgen] impl FungibleTokenMetadataProvider for EthConnectorContract { diff --git a/res/aurora-eth-connector-mainnet-migration.wasm b/res/aurora-eth-connector-mainnet-migration.wasm index 717e194..8ba70e9 100755 Binary files a/res/aurora-eth-connector-mainnet-migration.wasm and b/res/aurora-eth-connector-mainnet-migration.wasm differ diff --git a/res/aurora-eth-connector-mainnet.wasm b/res/aurora-eth-connector-mainnet.wasm index 06699d0..717e68b 100755 Binary files a/res/aurora-eth-connector-mainnet.wasm and b/res/aurora-eth-connector-mainnet.wasm differ