RewardsLib
State Variables
RATE_UNIT
RED mint rate in hundredths of 1 bip
Used as the denominator when calculating IRED minting (1e6)
uint256 internal constant RATE_UNIT = 1e6;
WEIGHT_UNIT
Weight units when partitioning reward amounts in hundredths of 1 bip
Used as the denominator when calculating weighted distributions (1e6)
uint256 internal constant WEIGHT_UNIT = 1e6;
FEE_UNIT
Protocol fee rate in hundredths of 1 bip
Used as the denominator when calculating protocol fees (1e6)
uint256 internal constant FEE_UNIT = 1e6;
Functions
chargedFeesOnRewards
Calculates how fees are split between protocol, voters, and the recipient.
function chargedFeesOnRewards(
RewardsStorage storage,
uint256 _amt,
uint256 _feeTotal,
uint256 _feeProtocol
)
external
pure
returns (uint256 amtRecipient, uint256 amtVoter, uint256 amtProtocol);
_chargedFeesOnRewards
function _chargedFeesOnRewards(
uint256 _amt,
uint256 _feeTotal,
uint256 _feeProtocol
)
internal
pure
returns (uint256 amtRecipient, uint256 amtVoter, uint256 amtProtocol);
_distributeFeesOnRewards
function _distributeFeesOnRewards(
mapping(address => uint256) storage protocolFeeAmounts,
address _voter,
address _token,
uint256 _amtVoter,
uint256 _amtProtocol
) internal;
harvestBase
function harvestBase(address bgt, address ibgt, address ibera)
external
returns (uint256 bgtAmt);
harvestVault
function harvestVault(
RewardsStorage storage $,
IInfraredVault vault,
address bgt,
address ibgt,
address voter,
address red,
uint256 rewardsDuration
) external returns (uint256 bgtAmt);
harvestBribes
function harvestBribes(
RewardsStorage storage $,
address wbera,
address collector,
address[] memory _tokens,
bool[] memory whitelisted
) external returns (address[] memory tokens, uint256[] memory _amounts);
collectBribesInWBERA
function collectBribesInWBERA(
RewardsStorage storage $,
uint256 _amount,
address wbera,
address ibera,
address ibgtVault,
address voter,
uint256 rewardsDuration
) external returns (uint256 amtInfraredBERA, uint256 amtIbgtVault);
harvestBoostRewards
function harvestBoostRewards(
RewardsStorage storage $,
address bgt,
address ibgtVault,
address voter,
uint256 rewardsDuration
) external returns (address _vault, address _token, uint256 _amount);
harvestOperatorRewards
function harvestOperatorRewards(
RewardsStorage storage $,
address ibera,
address voter,
address distributor
) external returns (uint256 _amt);
_handleTokenRewardsForVault
Handles non-InfraredBGT token rewards to the vault.
function _handleTokenRewardsForVault(
RewardsStorage storage $,
IInfraredVault _vault,
address _token,
address voter,
uint256 _amount,
uint256 _feeTotal,
uint256 _feeProtocol,
uint256 rewardsDuration
) internal;
Parameters
Name | Type | Description |
---|---|---|
$ | RewardsStorage | |
_vault | IInfraredVault | IInfraredVault The address of the vault. |
_token | address | address The reward token. |
voter | address | |
_amount | uint256 | uint256 The amount of reward token to send to vault. |
_feeTotal | uint256 | uint256 The rate to charge for total fees on _amount . |
_feeProtocol | uint256 | uint256 The rate to charge for protocol treasury on total fees. |
rewardsDuration | uint256 |
_handleTokenBribesForReceiver
Handles non-InfraredBGT token bribe rewards to a non-vault receiver address.
Does not take protocol fee on bribe coin, as taken on bribe collector payout token in eventual callback.
function _handleTokenBribesForReceiver(
RewardsStorage storage,
address _recipient,
address _token,
uint256 _amount
) internal;
Parameters
Name | Type | Description |
---|---|---|
<none> | RewardsStorage | |
_recipient | address | address The address of the recipient. |
_token | address | address The address of the token to forward to recipient. |
_amount | uint256 |
_handleRewardsForOperators
Handles BGT base rewards supplied to validator distributor.
function _handleRewardsForOperators(
RewardsStorage storage $,
address ibera,
address voter,
address distributor,
uint256 _iBERAShares,
uint256 _feeTotal,
uint256 _feeProtocol
) internal returns (uint256 _amt);
Parameters
Name | Type | Description |
---|---|---|
$ | RewardsStorage | |
ibera | address | |
voter | address | |
distributor | address | |
_iBERAShares | uint256 | uint256 The BGT reward amount. |
_feeTotal | uint256 | uint256 The rate to charge for total fees on _iBERAShares . |
_feeProtocol | uint256 | uint256 The rate to charge for protocol treasury on total fees. |
delegateBGT
function delegateBGT(RewardsStorage storage, address _delegatee, address bgt)
external;
updateInfraredBERABribesWeight
function updateInfraredBERABribesWeight(
RewardsStorage storage $,
uint256 _weight
) external;
updateFee
function updateFee(
RewardsStorage storage $,
ConfigTypes.FeeType _t,
uint256 _fee
) external;
claimProtocolFees
function claimProtocolFees(
RewardsStorage storage $,
address _to,
address _token,
uint256 _amount
) external;
getBGTBalance
function getBGTBalance(RewardsStorage storage, address bgt)
external
view
returns (uint256);
_getBGTBalance
function _getBGTBalance(address bgt) internal view returns (uint256);
updateRedMintRate
function updateRedMintRate(RewardsStorage storage $, uint256 _iredMintRate)
external;
Events
RedNotMinted
Emitted when Red cannot be minted during a harvest because of pause
event RedNotMinted(uint256 amount);
Structs
RewardsStorage
struct RewardsStorage {
mapping(address => uint256) protocolFeeAmounts;
uint256 redMintRate;
uint256 collectBribesWeight;
mapping(uint256 => uint256) fees;
}