Comptroller
@author Compound -> Union Finance @title Comptroller @dev For the time being, only the reward calculation of a single token is supported, and the contract needs to be revised after determining the reward calculation scheme of multiple tokens
Info
UserManagerState
UserManagerAccountState
INIT_INFLATION_INDEX
Initial inflation index
nonMemberRatio
Non member reward multiplier rate (75%)
memberRatio
Member reward multiplier rate (100%)
halfDecayPoint
Half decay point to reduce rewards at
gInflationIndex
store the latest inflation index
gLastUpdatedBlock
block number when updating the inflation index
unionToken
$UNION token contract
marketRegistry
The market registry contract
users
Map account to token to Info
LogWithdrawRewards
@dev Withdraw rewards event @param account The staker's address @param amount The amount of Union tokens to withdraw
SenderNotUserManager
NotZero
FrozenCoinAge
InflationIndexTooSmall
__Comptroller_init
onlyUserManager
setHalfDecayPoint
Set the half decay point
getRewardsMultiplier
@dev Get the reward multipier based on the account status @param account Account address @param token ERC20 token address @return Multiplier number (in wei)
calculateRewardsByBlocks
@dev Calculate unclaimed rewards based on blocks @param account User address @param token Staking token address @param futureBlocks Number of blocks in the future @return Unclaimed rewards
calculateRewards
@dev Calculate currently unclaimed rewards @param account Account address @param token Staking token address @return Unclaimed rewards
inflationPerBlock
@dev Calculate inflation per block @param effectiveTotalStake Effective total stake @return Inflation amount, div totalSupply is the inflation rate
withdrawRewards
@dev Withdraw rewards @param token Staking token address @return Amount of rewards
updateTotalStaked
@dev When total staked change update inflation index @param totalStaked totalStaked amount @return Whether succeeded
_getUserManagerState
Get UserManager global state values
_getUserInfoView
Get UserManager user specific state (view function does NOT update UserManage state)
Parameters
userManager
contract IUserManager
UserManager contract
account
address
Account address
token
address
Token address
futureBlocks
uint256
Blocks in the future
_getUserInfo
Get UserManager user specific state (function does update UserManage state)
Parameters
userManager
contract IUserManager
UserManager contract
account
address
Account address
token
address
Token address
futureBlocks
uint256
Blocks in the future
_calculateRewardsByBlocks
@dev Calculate currently unclaimed rewards @param account Account address @param token Staking token address @param userManagerState User manager global state @return Unclaimed rewards
_getInflationIndexNew
@dev Calculate new inflation index based on # of blocks @param totalStaked_ Number of total staked tokens in the system @param blockDelta Number of blocks @return New inflation index
_calculateRewards
_getUserManager
Get the UserManager contract. First try and load it from state if it has been previously saved and fallback to loading it from the marketRegistry
Return Values
[0]
contract IUserManager
userManager contract
_inflationPerBlock
@dev See Comptroller.inflationPerBlock
_lookup
_getInflationIndex
_getRewardsMultiplier
Last updated