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

HarvestBaseCollector

Git Source

Inherits: InfraredUpgradeable

Auction contract for iBGT to WBERA conversion for base fees to compound to iBERA holders

Simplified version of BribeCollector. This contract allows keepers to claim iBGT fees by paying a fixed WBERA amount, which is converted to native BERA and sent to the fee receiver for compounding.

Note: oz-upgrades:

State Variables

feeReceivor

the addres of the fee recivor contract that compounds BERA to iBERA.

address public feeReceivor;

ibgt

the addres of iBGT, the expected fee token

ERC20 public ibgt;

wbera

WBERA token that is used instead of native BERA token.

WBERA public wbera;

payoutAmount

Payout amount is a constant value that is paid by the caller of the claimFees function.

uint256 public payoutAmount;

__gap

uint256[20] private __gap;

Functions

initialize

Initializes the contract with required parameters and roles.

Reverts if any address is zero or payout amount is zero. Grants roles and initializes upgradeable components.

function initialize(
    address _infrared,
    address _gov,
    address _keeper,
    address _ibgt,
    address _wbera,
    address _feeReceivor,
    uint256 _payoutAmount
) external initializer;

Parameters

NameTypeDescription
_infraredaddressAddress of the Infrared contract.
_govaddressAddress of the governance.
_keeperaddressAddress of the keeper.
_ibgtaddressAddress of the iBGT token.
_wberaaddressAddress of the WBERA token.
_feeReceivoraddressAddress of the fee receiver.
_payoutAmountuint256Initial payout amount.

setPayoutAmount

Set the payout amount for the bribe collector.

Only callable by the governor. Reverts if amount is zero. Emits PayoutAmountSet.

function setPayoutAmount(uint256 _newPayoutAmount) external onlyGovernor;

Parameters

NameTypeDescription
_newPayoutAmountuint256updated payout amount

claimFee

Claims fees by transferring WBERA payout from caller, converting to native BERA, sending to fee receiver, and transferring iBGT to recipient.

Only callable by keeper. Reverts on insufficient balances or zero recipient. Emits FeeClaimed.

function claimFee(address _recipient, uint256 _feeAmount) external onlyKeeper;

Parameters

NameTypeDescription
_recipientaddressThe address to receive the iBGT fees.
_feeAmountuint256The amount of iBGT to transfer.

sweep

Sweeps any WBERA or native BERA balances to the fee receiver.

Only callable by keeper. Useful for recovering stuck funds.

function sweep() external onlyKeeper;

receive

Fallback function to receive BERA

receive() external payable;

Events

PayoutAmountSet

Emitted when the payout amount is updated by the governor

event PayoutAmountSet(
    uint256 indexed oldPayoutAmount, uint256 indexed newPayoutAmount
);

Parameters

NameTypeDescription
oldPayoutAmountuint256Previous payout amount
newPayoutAmountuint256New payout amount set

FeeClaimed

Emitted when the fees are claimed

event FeeClaimed(
    address indexed caller, address indexed recipient, uint256 amount
);

Parameters

NameTypeDescription
calleraddressCaller of the claimFees function
recipientaddressThe address to which collected POL bribes will be transferred
amountuint256The amount of fee token to transfer