Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

BatchClaimerV2_2

Git Source

Inherits: Initializable, UUPSUpgradeable, OwnableUpgradeable

Enables batch claiming of rewards for multiple staking assets for a given user.

This contract interacts with the InfraredV1_9 contract and InfraredVaults to claim rewards.

This contract is upgradeable using the UUPS proxy pattern.

State Variables

infrared

Reference to the InfraredV1_9 contract used to fetch vaults and manage reward claims.

InfraredV1_9 internal constant infrared =
    InfraredV1_9(payable(0xb71b3DaEA39012Fb0f2B14D2a9C86da9292fC126));

wBYUSD

wBYUSD ERC4626 vault constant

ERC4626 public constant wBYUSD =
    ERC4626(0x334404782aB67b4F6B2A619873E579E971f9AAB7);

rewardsFactory

IBerachainRewardsVaultFactory instance of the rewards factory contract address

Changed from immutable to storage variable for upgradeability

IBerachainRewardsVaultFactory public rewardsFactory;

wiBGT

wiBGT ERC4626 wrapper for iBGT

ERC4626 public wiBGT;

__gap

This empty reserved space is put in place to allow future versions to add new variables without shifting down storage in the inheritance chain. See https://docs.openzeppelin.com/upgrades-plugins/1.x/writing-upgradeable#storage-gaps

uint256[49] private __gap;

Functions

constructor

Note: oz-upgrades-unsafe-allow: constructor

constructor();

initialize

Initializes the contract

This function replaces the constructor for upgradeable contracts

function initialize(address _owner, address _wibgt) public initializer;

Parameters

NameTypeDescription
_owneraddressThe address of the contract owner
_wibgtaddressThe address of wrapped ibgt contract

batchClaim

Allows batch claiming of staking rewards from multiple vaults for a user.

*This function iterates over the stakingAssets array and attempts to:

  • Claim rewards from the InfraredVault if it exists.
  • Claim external vault rewards if available.*
function batchClaim(address user, address[] calldata stakingAssets) external;

Parameters

NameTypeDescription
useraddressThe address of the user for whom rewards are to be claimed.
stakingAssetsaddress[]An array of addresses representing staking asset vaults to process.

updateRewardsFactory

Updates the rewards factory address

Only callable by the owner

function updateRewardsFactory(address _newRewardsFactory) external onlyOwner;

Parameters

NameTypeDescription
_newRewardsFactoryaddressThe new rewards factory address

_authorizeUpgrade

Required by UUPSUpgradeable to authorize upgrades

Only the owner can authorize upgrades

function _authorizeUpgrade(address newImplementation)
    internal
    override
    onlyOwner;

Parameters

NameTypeDescription
newImplementationaddressAddress of the new implementation

version

Returns the current version of the contract

function version() external pure returns (string memory);

Returns

NameTypeDescription
<none>stringThe version string

Errors

ZeroAddress

Error indicating the provided address was the zero address.

error ZeroAddress();

InvalidInputs

Error indicating that the provided inputs are invalid (e.g., empty array).

error InvalidInputs();