fix: calculate maximum transferable balance without storage deposit#2
Open
atomauro wants to merge 1 commit intoHackHumanityOrg:mainfrom
Open
fix: calculate maximum transferable balance without storage deposit#2atomauro wants to merge 1 commit intoHackHumanityOrg:mainfrom
atomauro wants to merge 1 commit intoHackHumanityOrg:mainfrom
Conversation
…e funds without storage deposit
Contributor
|
@atomauro is attempting to deploy a commit to the Hack Humanity Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Users are unable to withdraw their liquid NEAR using the "Transfer to My Wallet" button in the frontend. The
transferToAccounthook fetchesget_venear_liquid_balance(), which returns the absolute maximum unlocked amount. However, the House of Stake lockup smart contract requires a ~2 NEAR Storage Deposit that cannot be transferred out using the standard transfer method.Because the frontend calculates the transfer amount using the raw liquid balance, it forces the smart contract to exceed its safely transferable bounds.
Example Failed Transaction:
Hash:
DMdm64maxBWrP6dPvNa8V4m7h7Q2agCNpxhLVEsxFTKJAs shown in the error, the user attempted to transfer
17788.01NEAR, but exactly 2 NEAR was locked by the contract17786.01NEAR, causing the transaction to fail.Key changes
Replaced the
get_venear_liquid_balanceRPC call inuseVenearContract.tswith the stricterget_liquid_owners_balance.This ensures the frontend accurately calculates and requests only the safely transferable liquid amount, excluding the restricted storage deposit.
Users can safely retrieve their remaining 2 NEAR Storage Deposit cleanly using the
deleteLockup/ "Delete Contract" function once their primary balances are empty.