IncreasingTreasuryReimbursement
is a contract meant to be inherited from and used as a way to offer an increasing stability fee reward (pulled from the SF treasury) to any address.authorizedAccounts[usr: address]
- addAuthorization
/removeAuthorization
- auth mechanismsbaseUpdateCallerReward
- starting reward offer to a fee receivermaxUpdateCallerReward
- max possible reward for a fee receivermaxRewardIncreaseDelay
- max delay taken into consideration when calculating the adjusted rewardperSecondCallerRewardIncrease
- rate applied to baseUpdateCallerReward
every extra second passed beyond a certain date (e.g next time when a specific function needs to be called)treasury
- stability fee treasury contracttreasuryAllowance() public view returns (uint256)
- this returns the stability fee treasury allowance for the reimbursement contract by taking the minimum between the per block and the total allowancesgetCallerReward(uint256 timeOfLastUpdate
, uint256 defaultDelayBetweenCalls) public
view returns (uint256)
- get the SF reward that can be sent to an address right nowrewardCaller(proposedFeeReceiver: address, reward: uint256) internal
- internal function that's meant to send a SF reward to a proposedFeeReceiver
isAuthorized
- checks whether an address is part of authorizedAddresses
(and thus can call authed functions)AddAuthorization
- emitted when a new address becomes authorized. Contains:account
- the new authorized accountRemoveAuthorization
- emitted when an address is de-authorized. Contains:account
- the address that was de-authorizedModifyParameters
- emitted when a parameter is updated.FailRewardCaller
- emitted when the contract cannot reward an address. Contains:revertReason
- the reason why the contract could not send the rewardfeeReceiver
- the address that was supposed to get the rewardamount
- the reward that had to be sentrewardCaller
is the most important function in this contract. It takes care of pulling the SF reward from the treasury and then sending it to a proposedFeeReceiver
.getCallerReward
can be used to retrieve the current SF fee that can be pulled from the treasury. If baseUpdateCallerReward
and maxUpdateCallerReward
are both zero or if timeOfLastUpdate >= now
, getCallerReward
will return zero.maxRewardIncreaseDelay
and perSecondCallerRewardIncrease
can make getCallerReward
revertperSecondCallerRewardIncrease
is set to a large value and maxRewardIncreaseDelay
is also large, getCallerReward
may revert. In most scenarios, maxRewardIncreaseDelay
should be set to a very conservative value (a couple of hours at most) in order to avoid this scenario.NoSetupIncreasingTreasuryReimbursement
- this contract has the exact same logic as the core one but it does not set any parameters in its constructorNoSetupNoAuthIncreasingTreasuryReimbursement
- this contract has the same logic as the core one but it does not set any parameters in its constructor and it also does not have any authorization logic (addAuthorization
/removeAuthorization
)