Check Spending Limits
Before any interaction with any token, you can check how much the user can spend on a specific address (deposit or LP token staker).
1
const contract = new web3.eth.Contract(contractAbi, contractAddress)
2
3
contract.methods.allowance(wallet, spender).call()
Copied!
  • contractAddress: the string token contract address (USDC, DAI, USDT, PWRD, GVT). Please use the contract addresses listed in Gro Tokens - Ethereum for PWRD and GVT.
  • wallet: the string user’s address
  • spender: the smart contract address that is asking for permission to spend the user's assets (e.g. depositHandler address or LPTokenStaker address).
  • This function returns the user’s allowed amount of spending as a string
USDT is the only token that requires resetting allowance to 0 before increasing allowance to a new value (lower or higher); the rest of them can set a new allowance directly.
Copy link