Documentation Index
Fetch the complete documentation index at: https://docs.saucerswap.finance/llms.txt
Use this file to discover all available pages before exploring further.
Ensure that the WHBAR ****token ID is associated with the account prior to calling the deposit function. Failure to do so will result in a TOKEN_NOT_ASSOCIATED_TO_ACCOUNT error
Function name: deposit
function deposit() public payable {
IWHBAR(whbarContract).deposit{value: msg.value}(msg.sender, msg.sender);
}
Code Overview
⛽ Recommended gas: 100,000 gwei (~ $0.009 USD)
Resources:import {
ContractExecuteTransaction,
TokenAssociateTransaction,
Hbar,
HbarUnit,
..
} from '@hashgraph/sdk';
//Client pre-checks:
// - WHBAR token is associated
const depositHbar = Hbar.from(depositAmount, HbarUnit.Hbar)
await new ContractExecuteTransaction()
.setContractId(whbarHelperContractId)
.setPayableAmount(depositHbar)
.setGas(gasLim)
.setFunction('deposit')
.execute(client);