Infrared.sol
Inherits: InfraredUpgradeable, IInfrared A contract for managing the set of infrared validators, infrared vaults, and interacting with all forms of staking, delegating, incentive rewards. This contract is the main entry point for interacting with the Infrared protocol.
State Variables
whitelistedRewardTokens
vaultRegistry
_infraredValidatorIds
_infraredValidatorPubkeys
_bgt
ibgt
The IBGT liquid staked token
wibera
The wrapped Infrared bera token
rewardsFactory
The Berachain rewards vault factory address
chef
inheritdoc IInfrared
wbera
Wrapped bera
honey
Honey ERC20 token
collector
bribe collector contract
distributor
Infrared distributor for BGT rewards to validators
rewardsDuration
The rewards duration
ibgtVault
The IBGT vault
wiberaVault
The wrapped IBERA vault
protocolFeeAmounts
The unclaimed Infrared protocol fees of token accumulated by contract
weights
Weights for various harvest function distributions
fees
Protocol fee rates to charge for various harvest function distributions
WEIGHT_UNIT
Weight units when partitioning reward amounts in hundredths of 1 bip
FEE_UNIT
Protocol fee rate in hundredths of 1 bip
COMMISSION_MAX
Commission rate in units of 1 bip
Functions
onlyCollector
constructor
initialize
_registerVault
Registers a new vault
registerVault
Registers a new vault.
Infrared.sol must be admin over MINTER_ROLE on IBGT to grant minter role to deployed vault.
Parameters
Name | Type | Description |
---|---|---|
_asset | address | address The address of the asset, e.g. Honey:Bera LP token. |
_rewardTokens | address[] |
Returns
Name | Type | Description |
---|---|---|
<none> | IInfraredVault | vault IInfraredVault The address of the new InfraredVault contract. |
_updateWhiteListedRewardTokens
Updates whitelisted reward tokens
updateWhiteListedRewardTokens
whitelists a reward token
Parameters
Name | Type | Description |
---|---|---|
_token | address | address The address of the token to whitelist. |
_whitelisted | bool | bool Whether the token is whitelisted or not. |
updateRewardsDuration
Updates the period that rewards will be distributed over in InfraredVaults.
Parameters
Name | Type | Description |
---|---|---|
_rewardsDuration | uint256 | uint256 The new rewards duration. |
pauseVault
Pauses staking functionality on this vault.
Parameters
Name | Type | Description |
---|---|---|
_asset | address | address The address of the staking asset that the vault is for. |
recoverERC20
Recover ERC20 tokens that were accidentally sent to the contract or where not whitelisted.
Parameters
Name | Type | Description |
---|---|---|
_to | address | address The address to send the tokens to. |
_token | address | address The address of the token to recover. |
_amount | uint256 | uint256 The amount of the token to recover. |
delegateBGT
Delegates BGT votes to _delegatee
address.
Parameters
Name | Type | Description |
---|---|---|
_delegatee | address | address The address to delegate votes to |
updateWeight
Updates the weight for a weight type.
Parameters
Name | Type | Description |
---|---|---|
_t | WeightType | WeightType The weight type |
_weight | uint256 | uint256 The weight value |
updateFee
Updates the fee rate charged on different harvest functions
Fee rate in units of 1e6 or hundredths of 1 bip
Parameters
Name | Type | Description |
---|---|---|
_t | FeeType | FeeType The fee type |
_fee | uint256 | uint256 The fee rate to update to |
claimProtocolFees
Claims accumulated protocol fees in contract
Parameters
Name | Type | Description |
---|---|---|
_to | address | address The recipient of the fees |
_token | address | address The token to claim fees in |
_amount | uint256 | uint256 The amount of accumulated fees to claim |
chargedFeesOnRewards
_distributeFeesOnRewards
harvestBase
Claims all the BGT base and commission rewards minted to this contract for validators.
harvestVault
Claims all the BGT rewards for the vault associated with the given staking token.
Parameters
Name | Type | Description |
---|---|---|
_asset | address | address The address of the staking asset that the vault is for. |
harvestBribes
Claims all the bribes rewards in the contract forwarded from Berachain POL.
Parameters
Name | Type | Description |
---|---|---|
_tokens | address[] | address[] memory The addresses of the tokens to harvest in the contract. |
collectBribes
Collects bribes from bribe collector and distributes to wiBERA and iBGT Infrared vaults.
harvestBoostRewards
Claims all the BGT staker rewards from boosting validators.
Sends rewards to iBGT vault.
_handleTokenRewardsForVault
Handles non-IBGT token rewards to the vault.
Parameters
Name | Type | Description |
---|---|---|
_vault | IInfraredVault | IInfraredVault The address of the vault. |
_token | address | address The reward token. |
_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. |
_handleTokenBribesForReceiver
Handles non-IBGT 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.
Parameters
Name | Type | Description |
---|---|---|
_recipient | address | address The address of the recipient. |
_token | address | address The address of the token to forward to recipient. |
_amount | uint256 |
_handleBGTRewardsForVault
Handles BGT token rewards, minting IBGT and supplying to the vault.
Parameters
Name | Type | Description |
---|---|---|
_vault | IInfraredVault | address The address of the vault. |
_bgtAmt | uint256 | uint256 The BGT reward amount. |
_feeTotal | uint256 | uint256 The rate to charge for total fees on iBGT _bgtAmt . |
_feeProtocol | uint256 | uint256 The rate to charge for protocol treasury on total iBGT fees. |
_handleBGTRewardsForDistributor
Handles BGT base rewards supplied to validator distributor.
Parameters
Name | Type | Description |
---|---|---|
_bgtAmt | uint256 | uint256 The BGT reward amount. |
_feeTotal | uint256 | uint256 The rate to charge for total fees on _bgtAmt . |
_feeProtocol | uint256 | uint256 The rate to charge for protocol treasury on total fees. |
_getValidatorId
Gets the validator ID for associated CL pubkey
Parameters
Name | Type | Description |
---|---|---|
pubkey | bytes | The CL pubkey of validator |
_addValidatorToSet
Adds validator pubkey to validator set
Reverts if already exists in set
_removeValidatorFromSet
Removes validator pubkey from validator set
Reverts if does not already exist in set
addValidators
Adds validators to the set of InfraredValidators
.
Parameters
Name | Type | Description |
---|---|---|
_validators | Validator[] | Validator[] memory The validators to add. |
removeValidators
Removes validators from the set of InfraredValidators
.
Parameters
Name | Type | Description |
---|---|---|
_pubkeys | bytes[] | bytes[] memory The pubkeys of the validators to remove. |
replaceValidator
Replaces a validator in the set of InfraredValidators
.
Parameters
Name | Type | Description |
---|---|---|
_current | bytes | bytes The pubkey of the validator to replace. |
_new | bytes | bytes The new validator pubkey. |
_getValidatorCommission
Gets the current validator commission rate by calling BGT.
_getValidatorAddress
Gets the validator address for claiming on distributor associated with pubkey
_updateValidatorCommission
Updates validator commission rate calling BGT to set.
updateValidatorCommission
Updates a validator commission rate in the set of InfraredValidators
.
Parameters
Name | Type | Description |
---|---|---|
_pubkey | bytes | bytes The pubkey of the validator to update commission rate for. |
_commission | uint256 | uint256 The commission rate to update to. |
queueNewCuttingBoard
Queues a new cutting board on BeraChef for reward weight distribution for validator
Parameters
Name | Type | Description |
---|---|---|
_pubkey | bytes | bytes The pubkey of the validator to queue the cutting board for |
_startBlock | uint64 | uint64 The start block for reward weightings |
_weights | IBeraChef.Weight[] | IBeraChef.Weight[] calldata The weightings used when distributor calls chef to distribute validator rewards |
queueBoosts
Queue _amts
of tokens to _validators
for boosts.
Parameters
Name | Type | Description |
---|---|---|
_pubkeys | bytes[] | bytes[] memory The pubkeys of the validators to queue boosts for. |
_amts | uint128[] | uint128[] memory The amount of BGT to boost with. |
cancelBoosts
Removes _amts
from previously queued boosts to _validators
.
_pubkeys
need not be in the current validator set in case just removed but need to cancel.
Parameters
Name | Type | Description |
---|---|---|
_pubkeys | bytes[] | bytes[] memory The pubkeys of the validators to remove boosts for. |
_amts | uint128[] | uint128[] memory The amounts of BGT to remove from the queued boosts. |
activateBoosts
Activates queued boosts for _pubkeys
.
Parameters
Name | Type | Description |
---|---|---|
_pubkeys | bytes[] | bytes[] memory The pubkeys of the validators to activate boosts for. |
dropBoosts
Removes boost _amt
of BGT boost from _pubkey
.
Parameters
Name | Type | Description |
---|---|---|
_pubkeys | bytes[] | address[] memory The pubkeys of the validator to remove boost from. |
_amts | uint128[] | uint128[] memory The amounts of BGT to remove from the boost. |
infraredValidators
Gets the set of infrared validator pubkeys.
Returns
Name | Type | Description |
---|---|---|
validators | Validator[] | Validator[] memory The set of infrared validators. |
numInfraredValidators
Gets the number of infrared validators in validator set.
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | num uint256 The number of infrared validators in validator set. |
isInfraredValidator
Checks if a validator is an infrared validator.
Parameters
Name | Type | Description |
---|---|---|
_validator | bytes |
Returns
Name | Type | Description |
---|---|---|
<none> | bool | _isValidator bool Whether the validator is an infrared validator. |
getBGTBalance
Gets the BGT balance for this contract
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | bgtBalance The BGT balance held by this address |