You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
constdepositAmount=100000000000//100 everconstfee=2000000000//2 everawaitStEverVault.methods.deposit({_amount: depositAmount,_nonce: randomNonce,}).send({from: accountAddress,amount: depositAmountfee,});/*after it we can catch deposit event { "event": "Deposit", "data": { "user": accountAddress, "depositAmount": depositAmount, "receivedStEvers": received StEver tokens } }*/
2. Withdraw
constwithdrawAmount=1000000000constwithdrawPayload=awaitStEverVault.methods.encodeDepositPayload({_nonce: randomNonce,//randomNonce you can set this nonce as Date.now() for better preview in the FE_deposit_owner: userAddress,}).call();awaitUserStEverTokenWallet.methods.transfer({remainingGasTo: this.account.address,deployWalletValue: 0,amount: withdrawAmount,notify: true,recipient: this.vault.vaultContract.address,payload: withdrawPayload.depositPayload,}).send({from: this.account.address,amount: 3000000000// 3 ever, 1 ever will freeze until withdraw won't be completed})/*and then we can catch the event { "event": "WithdrawRequest", "data": { "user": userAddress, "amount": withdrawAmount, "nonce": nonce which was added when we was building a withdrawPayload } } */
3. Remove withdraw request
awaitStEverVault.methods.removePendingWithdraw({_nonce: nonce//nonce from withdraw request}).send({from: this.account.address,amount: 2000000000,//2 ever})/*and then we can catch the event { "event": "WithdrawRequestRemoved", "data": { "user": userAddress, "nonce": nonce from withdraw request } } */
const{value0: stEverVaultDetails}=awaitStEverVault.methods.getDetails({answerId: 0}).call()// calcualting the rateconststEverToEverRate=stEverVaultDetails.stEverSupply/stEverVaultDetails.totalAssets// also provided two methods// get how many stEvers we can get for eversconst{value0: howManyStEverWillReceived}=awaitStEverVault.methods.getDepositStEverAmount({_amount: 1000000000//e.g. 1 ever}).call()// get how many evers we can get for stEversconst{value0: howManyEverWillReceived}=awaitStEverVault.methods.getWithdrawEverAmount({_amount: 1000000000//e.g. 1 stEver}).call()