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

Redeemer

Git Source

Permissionless contract for redeeming iBGT tokens for BERA via the Infrared protocol.

State Variables

bgt

Address of the BGT token.

address public immutable bgt;

ibgt

Address of the iBGT token.

address public immutable ibgt;

infrared

Address of the Infrared protocol contract.

InfraredV1_8 public immutable infrared;

Functions

constructor

Constructor to initialize the contract.

constructor(address _bgt, address _infrared);

Parameters

NameTypeDescription
_bgtaddressAddress of the BGT token.
_infraredaddressAddress of the Infrared protocol.

redeemIbgtForBera

Redeems iBGT for BERA.

Caller must approve this contract for iBGT. Checks unboosted BGT availability on Infrared. Burns iBGT, calls Infrared to redeem, and transfers BERA to the caller.

function redeemIbgtForBera(uint256 amount) external;

Parameters

NameTypeDescription
amountuint256The amount of iBGT to redeem.

receive

Fallback to receive BERA from Infrared.

receive() external payable;

Events

IbgtRedeemed

Event emitted when iBGT is redeemed for BERA.

event IbgtRedeemed(address indexed user, uint256 amount);

Parameters

NameTypeDescription
useraddressThe user who redeemed.
amountuint256The amount of iBGT redeemed.

Errors

InvalidAmount

Error thrown for zero amount

error InvalidAmount();

InvalidAddress

Error thrown for invalid address

error InvalidAddress();

InsufficientUnboostedBGT

Error thrown when insufficient unboosted BGT is available for redemption.

error InsufficientUnboostedBGT();