near-wallet icon indicating copy to clipboard operation
near-wallet copied to clipboard

`storage_deposit()` fails when transferring some fungible tokens

Open think-in-universe opened this issue 2 years ago • 1 comments

Problem

Now when transferring fungible token in NEAR Wallet, a fixed minimum FT storage balance is used to call storage_deposit()

https://github.com/near/near-wallet/blob/bbc258315eb41fba49e30387c79507e284ad4acd/packages/frontend/src/services/FungibleTokens.js#L29

In some cases, the required storage deposit amount is not the minimum, and the wallet need to query storage_balance_bounds() method on the FT contract to get the required deposit.

$ NEAR_ENV=mainnet near view berryclub.ek.near storage_balance_bounds           
View call: berryclub.ek.near.storage_balance_bounds()
{ min: '2560000000000000000000', max: '2560000000000000000000' }

A relevant issue is mentioned in https://github.com/near/near-wallet/issues/2338

Though this seems not to be a critical issue since most of the FT now uses the 0.00125 minimum storage balance, the current design will conflict with or restrict the usage of the fungible tokens that uses a custom implementation.

Expected Behavior

The storage_deposit() NEAR amount should not be fixed. The wallet should respect the storage_balance_bounds() function call result of the FT contract.

Steps to reproduce

  1. Transfer Banana (berryclub.ek.near) with NEAR Wallet
  2. The storage_deposit() failed when calling FT transfer. Here is an example.

think-in-universe avatar Mar 11 '22 11:03 think-in-universe

Issue has been created in Jira for tracking and prioritization: https://nearinc.atlassian.net/browse/WAL-204

Patrick1904 avatar Mar 21 '22 21:03 Patrick1904