Deposit
How to deposit stablecoins into Gro Protocol in exchange for PWRD or Vault (GVT) tokens

Required contract addresses

1) Calculate mininum amount of PWRD or GVT to get in return

First calculate the expected minAmount. The amount in stablecoin must be converted to LP using the buoy contract. The value of slippage is then applied to get the minAmount.
1
const buoyContract = new web3.eth.Contract(
2
buoy.abi,
3
buoy.address
4
)
5
6
// second parameter is always true for deposit
7
const lpAmount = await buoyContract.methods.stableToLp(stablecoins, true).call();
8
9
// 2% slippage => 0.02
10
const minAmount = lpAmount.mul(1 - slippage)
Copied!
  • buoy.address is a string set to the Buoy address
  • stablecoins is an integer array (uint256[]) where each element refers to the amount of each stablecoin being deposited in the order of [DAI, USDC, USDT]. All numeric values are in the BigNumber format with conversions performed using BN.js.

2) Deposit stablecoin for PWRD or GVT

1
const depositHandler = new web3.eth.Contract(
2
depositHandler.abi,
3
depositHandler.address
4
)
5
6
// To Deposit into PWRD
7
depositHandler.method.depositPwrd(stablecoins, minAmount, referral)
8
9
// To Deposit into GVT
10
depositHandler.method.depositGvt(stablecoins, minAmount, referral)
Copied!
Required Parameters
  • depositHandler.address is a string set to the DepositHandler contract address
  • stablecoins is an integer array (uint256[]) where each element refers to the amount of each stablecoin being deposited in the order of [DAI, USDC, USDT]. All numeric values are in the BigNumber format with conversions performed using BN.js.
  • minAmount is the minimum amount (uint256) of PWRD or GVT tokens to get in return (value denoted in LP tokens). This value was calculated in step one.
  • referral is the string address of the referral account. The default referral is 0x0000000000000000000000000000000000000000
To earn partnership bonus rewards, please set referral to a wallet address that you could use to interact with Gro dApp in claiming GRO rewards at http://app.gro.xyz/rewards - please test for wallet connection on our dApp before setting referral to that wallet
1
// To set referral to your wallet address (default value used here as example)
2
const referral = '0x0000000000000000000000000000000000000000'
Copied!