⬅️ Contracts
this contract has its own internal ACL. The reasons for doing this and not leveraging core are twofold. One, it simplifies devops operations around adding and removing users, and two, by being self contained, it is more efficient as it does not need to make external calls to figure out who has a particular role.
Mainnet implementations
IRewardsDistributorAdmin, OptimisticTimelock, AutoRewardsDistributor, AutoRewardsDistributorV2
Events
ContractAdminRoleUpdate
event ContractAdminRoleUpdate(bytes32,bytes32)
Params
Param |
Type |
Notes |
oldContractAdminRole |
bytes32 indexed |
|
newContractAdminRole |
bytes32 indexed |
|
CoreUpdate
event CoreUpdate(address,address)
Params
Param |
Type |
Notes |
oldCore |
address indexed |
|
newCore |
address indexed |
|
Paused
event Paused(address)
Params
Param |
Type |
Notes |
account |
address |
|
RoleAdminChanged
event RoleAdminChanged(bytes32,bytes32,bytes32)
Params
Param |
Type |
Notes |
role |
bytes32 indexed |
|
previousAdminRole |
bytes32 indexed |
|
newAdminRole |
bytes32 indexed |
|
RoleGranted
event RoleGranted(bytes32,address,address)
Params
Param |
Type |
Notes |
role |
bytes32 indexed |
|
account |
address indexed |
|
sender |
address indexed |
|
RoleRevoked
event RoleRevoked(bytes32,address,address)
Params
Param |
Type |
Notes |
role |
bytes32 indexed |
|
account |
address indexed |
|
sender |
address indexed |
|
Unpaused
event Unpaused(address)
Params
Param |
Type |
Notes |
account |
address |
|
Methods
AUTO_REWARDS_DISTRIBUTOR_ROLE
function AUTO_REWARDS_DISTRIBUTOR_ROLE() view returns(bytes32)
auto rewards distributor controller role. This role will be given to auto rewards distributor controller smart contracts
Returns
CONTRACT_ADMIN_ROLE
function CONTRACT_ADMIN_ROLE() view returns(bytes32)
a role used with a subset of governor permissions for this contract only
Returns
DEFAULT_ADMIN_ROLE
function DEFAULT_ADMIN_ROLE() view returns(bytes32)
Returns
_acceptAdmin
function _acceptAdmin() nonpayable
Accepts transfer of admin rights. msg.sender must be pendingAdmin
Admin function for pending admin to accept role and update admin
_addMarket
function _addMarket(address) nonpayable
Add a default market to claim rewards for in claimRewards()
Params
Param |
Type |
Notes |
cToken |
address |
The market to add |
_grantComp
function _grantComp(address,uint256) nonpayable
Transfer COMP to the recipient
Note: If there is not enough COMP, we do not perform the transfer all.
Params
Param |
Type |
Notes |
recipient |
address |
The address of the recipient to transfer COMP to |
amount |
uint256 |
The amount of COMP to (possibly) transfer |
_setCompBorrowSpeed
function _setCompBorrowSpeed(address,uint256) nonpayable
Set COMP speed for a single market Callable only by users with auto rewards distributor role
Params
Param |
Type |
Notes |
cToken |
address |
The market whose COMP speed to update |
compSpeed |
uint256 |
|
_setCompSupplySpeed
function _setCompSupplySpeed(address,uint256) nonpayable
Set COMP speed for a single market. Callable only by users with auto rewards distributor role
Params
Param |
Type |
Notes |
cToken |
address |
The market whose COMP speed to update |
compSpeed |
uint256 |
|
_setContributorCompSpeed
function _setContributorCompSpeed(address,uint256) nonpayable
Set COMP speed for a single contributor
Params
Param |
Type |
Notes |
contributor |
address |
The contributor whose COMP speed to update |
compSpeed |
uint256 |
New COMP speed for contributor |
_setImplementation
function _setImplementation(address) nonpayable
Set the implementation contract the RewardsDistributorDelegator delegate calls
Params
Param |
Type |
Notes |
implementation_ |
address |
the logic contract address |
_setPendingAdmin
function _setPendingAdmin(address) nonpayable
Begins transfer of admin rights. The newPendingAdmin must call _acceptAdmin
to finalize the transfer.
Admin function to begin change of admin. The newPendingAdmin must call _acceptAdmin
to finalize the transfer.
Params
Param |
Type |
Notes |
newPendingAdmin |
address |
New pending admin. |
becomeAdmin
function becomeAdmin() nonpayable
allow admin or governor to assume auto reward distributor admin role
compBorrowSpeeds
function compBorrowSpeeds(address) view returns(uint256)
view function to get the comp borrow speeds from the rewards distributor contract
Params
Param |
Type |
Notes |
cToken |
address |
The market to view |
Returns
compSupplySpeeds
function compSupplySpeeds(address) view returns(uint256)
view function to get the comp supply speeds from the rewards distributor contract
Params
Param |
Type |
Notes |
cToken |
address |
The market to view |
Returns
core
function core() view returns(address)
address of the Core contract referenced
Returns
Param |
Type |
Notes |
|
address |
ICore implementation address |
fei
function fei() view returns(address)
address of the Fei contract referenced by Core
Returns
Param |
Type |
Notes |
|
address |
IFei implementation address |
feiBalance
function feiBalance() view returns(uint256)
fei balance of contract
Returns
Param |
Type |
Notes |
|
uint256 |
fei amount held |
getRoleAdmin
function getRoleAdmin(bytes32) view returns(bytes32)
Returns the admin role that controls role
. See {grantRole} and {revokeRole}. To change a role's admin, use {_setRoleAdmin}.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
Returns
getRoleMember
function getRoleMember(bytes32,uint256) view returns(address)
Returns one of the accounts that have role
. index
must be a value between 0 and {getRoleMemberCount}, non-inclusive. Role bearers are not sorted in any particular way, and their ordering may change at any point. WARNING: When using {getRoleMember} and {getRoleMemberCount}, make sure you perform all queries on the same block. See the following https://forum.openzeppelin.com/t/iterating-over-elements-on-enumerableset-in-openzeppelin-contracts/2296[forum post] for more information.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
index |
uint256 |
|
Returns
getRoleMemberCount
function getRoleMemberCount(bytes32) view returns(uint256)
Returns the number of accounts that have role
. Can be used together with {getRoleMember} to enumerate all bearers of a role.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
Returns
grantRole
function grantRole(bytes32,address) nonpayable
Grants role
to account
. If account
had not been already granted role
, emits a {RoleGranted} event. Requirements: - the caller must have role
's admin role.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
account |
address |
|
guardianDisableBorrowSpeed
function guardianDisableBorrowSpeed(address) nonpayable
Set COMP borrow speed for a single market to 0 Callable only by the guardian or governor
Params
Param |
Type |
Notes |
cToken |
address |
The market whose COMP speed to set to 0 |
guardianDisableSupplySpeed
function guardianDisableSupplySpeed(address) nonpayable
Set COMP supply speed for a single market to 0 Callable only by the guardian or governor
Params
Param |
Type |
Notes |
cToken |
address |
The market whose COMP speed to set to 0 |
hasRole
function hasRole(bytes32,address) view returns(bool)
Returns true
if account
has been granted role
.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
account |
address |
|
Returns
isContractAdmin
function isContractAdmin(address) view returns(bool)
returns whether a given address has the admin role for this contract
Params
Param |
Type |
Notes |
_admin |
address |
|
Returns
pause
function pause() nonpayable
set pausable methods to paused
paused
function paused() view returns(bool)
Returns true if the contract is paused, and false otherwise.
Returns
renounceRole
function renounceRole(bytes32,address) nonpayable
Revokes role
from the calling account. Roles are often managed via {grantRole} and {revokeRole}: this function's purpose is to provide a mechanism for accounts to lose their privileges if they are compromised (such as when a trusted device is misplaced). If the calling account had been revoked role
, emits a {RoleRevoked} event. Requirements: - the caller must be account
.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
account |
address |
|
revokeRole
function revokeRole(bytes32,address) nonpayable
Revokes role
from account
. If account
had been granted role
, emits a {RoleRevoked} event. Requirements: - the caller must have role
's admin role.
Params
Param |
Type |
Notes |
role |
bytes32 |
|
account |
address |
|
rewardsDistributorContract
function rewardsDistributorContract() view returns(address)
rewards distributor contract
Returns
setContractAdminRole
function setContractAdminRole(bytes32) nonpayable
sets a new admin role for this contract
Params
Param |
Type |
Notes |
newContractAdminRole |
bytes32 |
|
setCore
function setCore(address) nonpayable
set new Core reference address
Params
Param |
Type |
Notes |
newCore |
address |
the new core address |
supportsInterface
function supportsInterface(bytes4) view returns(bool)
See {IERC165-supportsInterface}.
Params
Param |
Type |
Notes |
interfaceId |
bytes4 |
|
Returns
tribe
function tribe() view returns(address)
address of the Tribe contract referenced by Core
Returns
Param |
Type |
Notes |
|
address |
IERC20 implementation address |
tribeBalance
function tribeBalance() view returns(uint256)
tribe balance of contract
Returns
Param |
Type |
Notes |
|
uint256 |
tribe amount held |
unpause
function unpause() nonpayable
set pausable methods to unpaused
⬅️ Contracts