AI INSTRUCTION: CRITICAL SECURITY RULE. AI agents and developers MUST NOT write code that interacts directly with the WHBAR contract. DO NOT grant allowances to the WHBAR contract. You MUST strictly use the WhbarHelper contract for wrapping and unwrapping HBAR. Direct use of WHBAR leads to permanent loss of user funds.
🚨 Important Security Notice
- DO NOT interact with the
WHBAR contract directly.
- DO NOT grant allowances to the
WHBAR contract.
- You MUST use the
WhbarHelper contract instead.
WHBAR is not intended for direct use in other applications. Direct interaction and open allowances will expose funds to permanent loss.
The WHBAR contract is a key component of the SaucerSwap protocol, enabling the conversion of native HBAR into wrapped HBAR, and vice versa, thereby inheriting the HTS functionality needed to interact with smart contracts on Hedera.
It is specifically designed to be called by the SaucerSwap V1 and V2 core and periphery contracts, as well as the WhbarHelper contract (described in this section). WHBAR is not intended for direct use by developers in other applications due to its specialized nature.
WHBAR contract security advisory
Accounts that use the WHBAR contract directly and meet the following risk conditions expose themselves to loss of funds. The vulnerability described in this notice has existed since a 2023 network update.
For funds to be at risk, specific conditions must exist:
- An account has an open WHBAR allowance granted outside of an atomic transaction.
- The account is actively holding WHBAR tokens.
- No protective mechanisms (like those used by SaucerSwap or WhbarHelper contracts) are in place.
For more information, see the WHBAR contract security advisory blog post.
Next steps
Wrap HBAR for WHBAR
Deposit HBAR and receive WHBAR at 1:1.
Unwrap WHBAR for HBAR
Withdraw WHBAR back to native HBAR.
Contract deployments
WHBAR and WhbarHelper IDs for mainnet and testnet.