GoodCompoundStaking V2 (DAI)
Supporters / stakers can stake their DAI which is sent to permissionless protocols which earn interest. The FundManager has permissions to collect interest-earned from this contract.
Events
Staked
Emitted when staker
stake value
tokens of token
.
Parameter name | Annotation |
---|---|
staker | The address of the staker. |
token | The address of the staking token. |
value | The value to be staked. |
StakeWithdraw
Emitted when staker
withdraws their stake value
tokens of token
.
Parameter name | Annotation |
---|---|
staker | The address of the staker. |
token | The address of the staking token that beign withdrawn. |
value | The value to be withdrawn. |
InterestCollected
Emitted when fundmanager transfers interest collected from DeFi protrocol.
Parameter name | Annotation |
---|---|
recipient | The recipient address of the interest |
iTokenGains | The amount of intereset accrued. |
tokenGains | The amount of interest worth in underlying token value. |
actualTokenRedeemed | Actual token redeemed in Uniswap V2 (max 0.3% of liquidity) to token (in this case DAI). |
actualRewardTokenEarned | Actual amount of reward tokens earned. |
interestCollectedInDAI | Actual DAI amount sent to the reserve as interest from converting token and optionally reward token in Uniswap V2. |
getSettings
View function to get protocol management fees.
Returns: a tuple of _collectInterestGasCost
and _compCollectGasCost
which represents the gas cost fee for collecting interest from the contract and gas cost fee for collecting COMP rewards.
currentGains
Function that calculates current interest gains of this staking contract.
Parameter name | Annotation |
---|---|
_returnTokenBalanceInUSD | Determine return token balance of staking contract in USD. |
_returnTokenGainsInUSD | Determine return token gains of staking contract in USD. |
Return parameter name | Annotation |
---|---|
iTokenGains | Gains in iToken (in this case cDAI). |
tokenGains | Gains in token (in this case DAI). |
tokenBalance | Total tokens locked. |
balanceInUSD | Locked tokens worth in USD. |
tokenGainsInUSD | Gains in USD. |
stake
Allows a staker to deposit Tokens (in this case DAI). Notice that approve
is needed to be executed before the execution of this method.
Parameter name | Annotation |
---|---|
_amount | The amount of Token (in this case DAI) or iToken (in this case cDAI) to stake (it depends on |
_donationPer | The % of interest staker want to donate. |
_inInterestToken | Specificy if stake in iToken (in this case cDAI) or Token (in this case DAI). |
Can be executed only when the contract is not paused.
withdrawStake
Withdraws the sender staked Token (in this case DAI).
Parameter name | Annotation |
---|---|
_amount | Amount to withdraw in Token (in this case DAI) or iToken (in this case cDAI). |
_inInterestToken | If |
Can be executed only when the contract is not paused.
withdrawRewards
Withdraw staker G$ rewards + GDAO (GOOD) rewards to the caller (staker).
claimReputation
Withdraw staker GDAO (GOOD) rewards to the caller (staker).
collectUBIInterest
Collects gained interest (in G$) by fundmanager.
Parameter name | Annotation |
---|---|
_recipient | The recipient of iToken (in this case cDAI) gains. |
Return parameter name | Annotation |
---|---|
actualTokensRedeemed | Collected interest from token. |
actualRewardTokenRedeemed | Collected interest from reward token. |
actualDai | Total Token (in this case DAI) received from swapping token + reward token. |
getTokenValueInUSD
The function is to calculate Token (in this case DAI) price in USD.
Parameter name | Annotation |
---|---|
_oracle | Chainlink oracle usd/token oralce. |
_amount | Amount of Token to calculate worth of it. |
_decimals | Decimals of Token. |
Returns: worth of Tokens in USD, the decimals are 8.
getUserMintedAndPending
The function that can provide information about minted and pending rewards in G$ of the _staker
.
Parameter name | Annotation |
---|---|
_staker | Account to get rewards status for. |
Returns: The first element of the tuple is Minted value and the second is Pending value in G$; 2 decimals.
Last updated