Skip to main content

AutoRewardsDistributorV2

Controller Contract to set tribe per block in Rewards Distributor Admin on Rari

Functions

constructor

function constructor(
address coreAddress,
contract IRewardsDistributorAdmin _rewardsDistributorAdmin,
contract ITribalChief _tribalChief,
contract StakingTokenWrapper _stakedTokenWrapper,
address _underlying,
bool _isBorrowIncentivized,
contract Unitroller _comptroller
) public

constructor function

Parameters

NameTypeDescription
coreAddressaddressaddress of core contract
_rewardsDistributorAdmincontract IRewardsDistributorAdminaddress of rewards distributor admin contract
_tribalChiefcontract ITribalChiefaddress of tribalchief contract
_stakedTokenWrappercontract StakingTokenWrapperthe stakedTokenWrapper this contract controls rewards for
_underlyingaddressaddress of the underlying for the cToken
_isBorrowIncentivizedboolboolean that incentivizes borrow or supply
_comptrollercontract Unitrolleraddress of the comptroller contract

init

function init() external

_deriveRequiredCompSpeed

function _deriveRequiredCompSpeed() internal returns (uint256 compSpeed)

helper function that gets all needed state from the TribalChief contract based on this state, it then calculates what the compSpeed should be.

getNewRewardSpeed

function getNewRewardSpeed() public returns (uint256 newCompSpeed, bool updateNeeded)

function to get the new comp speed and figure out if an update is needed

Return Values

NameTypeDescription
newCompSpeeduint256the newly calculated compSpeed based on allocation points in the TribalChief
updateNeededboolboolean indicating whether the new compSpeed is not equal to the existing compSpeed

setAutoRewardsDistribution

function setAutoRewardsDistribution() external

function to automatically set the rewards speed on the RewardsDistributor contract through the RewardsDistributorAdmin

setRewardsDistributorAdmin

function setRewardsDistributorAdmin(
contract IRewardsDistributorAdmin _newRewardsDistributorAdmin
) external

API to point to a new rewards distributor admin contract

Parameters

NameTypeDescription
_newRewardsDistributorAdmincontract IRewardsDistributorAdminthe address of the new RewardsDistributorAdmin contract

Events

SpeedChanged

event SpeedChanged(
uint256 newSpeed
)

Parameters

NameTypeDescription
newSpeeduint256

RewardsDistributorAdminChanged

event RewardsDistributorAdminChanged(
contract IRewardsDistributorAdmin oldRewardsDistributorAdmin,
contract IRewardsDistributorAdmin newRewardsDistributorAdmin
)

Parameters

NameTypeDescription
oldRewardsDistributorAdmincontract IRewardsDistributorAdmin
newRewardsDistributorAdmincontract IRewardsDistributorAdmin