LBGT
Author: BeraPaw
ERC20 token representing liquid staked BGT in the BeraPaw protocol
Implementation of liquid staking token with: Core functions:
- mint/burn: Controlled by BeraPawForge
- flash loans: Configurable amounts and fees
- permit: ERC20 gasless approvals
State Variables
beraPawForge
Gets BeraPaw Forge contract address.
address public immutable beraPawForge;
flashMintPercentualFee
Get the current percentual fee for flash minting LBGT tokens
Fee is represented in basis points (1 = 0.01%), with a max of 10,000 (100%)
uint16 public flashMintPercentualFee;
flashFeeCollector
Get the address that collects flash mint fees
Returns address(0) if no fee collector has been set
address public flashFeeCollector;
flashMaxMint
Get the maximum amount of LBGT that can be flash minted
Flash minters with ROLE_FLASH_MINTER bypass this limit
uint256 public flashMaxMint;
Functions
onlyBeraPawForge
modifier onlyBeraPawForge();
constructor
constructor(
address _berapawForge,
address _owner
)
ERC20("Liquid BGT", "LBGT")
ERC20Permit("Liquid BGT")
ERC20FlashMint();
setFlashMintFee
Set the flash mint fee in basis points (bps).
Only the admin can set the flash mint fee.
function setFlashMintFee(uint16 _flashMintPercentualFee) public onlyRole(ROLE_ADMIN);
Parameters
Name | Type | Description |
---|---|---|
_flashMintPercentualFee | uint16 | The flash mint fee in basis points (bps). |
setFlashMaxMint
Set the flash mint max limit.
Only the admin can set the flash mint max limit.
function setFlashMaxMint(uint256 _maxFlashMint) public onlyRole(ROLE_ADMIN);
Parameters
Name | Type | Description |
---|---|---|
_maxFlashMint | uint256 | The flash mint max limit. |
setFlashFeeCollector
Set the flash fee collector address.
Only the admin can set the flash fee collector address.
function setFlashFeeCollector(address _feeCollector) public onlyRole(ROLE_ADMIN);
Parameters
Name | Type | Description |
---|---|---|
_feeCollector | address | The address to set as the flash fee collector. |
mint
Mint new tokens to a given address.
Only the BeraPaw vault can mint tokens.
function mint(address to, uint256 amount) public onlyBeraPawForge;
Parameters
Name | Type | Description |
---|---|---|
to | address | The address to mint tokens to. |
amount | uint256 | The amount of tokens to mint. |
burn
Burn a given amount of tokens from a given address.
Only the BeraPaw vault can burn tokens.
function burn(address from, uint256 amount) public onlyBeraPawForge;
Parameters
Name | Type | Description |
---|---|---|
from | address | The address to burn tokens from. |
amount | uint256 | The amount of tokens to burn. |
maxFlashLoan
Get the max flash loan amount of the given token.
Only LBGT can be flash loaned. The ROLE_FLASH_MINTER can flash mint regardless of the limit.
function maxFlashLoan(address token) public view override returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
token | address | The token to get the max flash loan amount for. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The max flash loan amount of the given token. |