Skip to content

fix: calculate maximum transferable balance without storage deposit#2

Open
atomauro wants to merge 1 commit intoHackHumanityOrg:mainfrom
atomauro:fix/correct-transfer-balance
Open

fix: calculate maximum transferable balance without storage deposit#2
atomauro wants to merge 1 commit intoHackHumanityOrg:mainfrom
atomauro:fix/correct-transfer-balance

Conversation

@atomauro
Copy link
Copy Markdown

@atomauro atomauro commented Mar 25, 2026

Summary

Users are unable to withdraw their liquid NEAR using the "Transfer to My Wallet" button in the frontend. The transferToAccount hook fetches get_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: DMdm64maxBWrP6dPvNa8V4m7h7Q2agCNpxhLVEsxFTKJ

Smart contract panicked: panicked at lockup-contract/src/owner.rs:421:9:
The available liquid balance 17786010680563709254320813861 is smaller than the requested transfer amount 17788010680563709254320813860

As shown in the error, the user attempted to transfer 17788.01 NEAR, but exactly 2 NEAR was locked by the contract 17786.01 NEAR, causing the transaction to fail.

Key changes

Replaced the get_venear_liquid_balance RPC call in useVenearContract.ts with the stricter get_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.

@vercel
Copy link
Copy Markdown
Contributor

vercel bot commented Mar 25, 2026

@atomauro is attempting to deploy a commit to the Hack Humanity Team on Vercel.

A member of the Team first needs to authorize it.

@atomauro atomauro marked this pull request as ready for review March 25, 2026 20:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant