-
Notifications
You must be signed in to change notification settings - Fork 12
idexo Staking Contracts
Source: https://github.com/idexo/ido-contracts/blob/main/contracts/staking/StakePoolSimpleCombinedNew.sol
Address : 0x1fac57c7FCDe23376C197e3bA7fa34D2200459fA
Deployed: https://ftmscan.com/address/0x1fac57c7fcde23376c197e3ba7fa34d2200459fa#code
Pool Deposit Token: FIDO https://ftmscan.com/token/0x7aa1d538bc7b8f756179d37fb92dc0435fb71ab1
Pool Reward Token: USDC https://ftmscan.com/token/0x04068da6c83afcfa0e13ba15a6696662335d5b75
In the deposit token contract:
- Check if the amount allowed for the spender (stake contract) and the balance is equal to or greater than the amount to be deposited;
If it is less, it is necessary to approve, in the deposit token contract, the amount to be deposited.
- Deposit
.deposit(amount, timestamplock)
Call the deposit method, passing the amount and timestamplock. Use 0 as the timestamplock value, for deposits with no withdrawal lock time.
After the deposit, a stake token representing the deposit will be assigned to the address.
- Stake Info
.balanceOf(address) returns how many stakeTokens the address owns.
.getStakeAmount(address) returns the total amount deposited (pool deposit token).
.getStakeTokenIds(address) returns an array with the tokenIds that the address owns.
.getStakeInfo(tokenId) returns the amount, multiplier, deposit timestamp and lock timestamp (0 if there is no lock).
- Withdraw Deposited Tokens
.withdraw(tokenId, amount)
Call withdraw method, passing the tokenId and amount to withdraw.
- Claim Rewards
.getClaimableReward(tokenId) returns the amount of rewards that can be claimed (pool reward token).
.claimReward(tokenId, amount)
Call claimReward method, passing the tokenID and amount of reward token.
To get the user-owned tokenIds, with their respective stakeAmount and claimableRewards: Get the stake tokenIds array from the address by calling getStakeTokenIds( address ), and iterate by calling getStakeAmount(tokenId) and getClaimableReward(tokenId)