LzIndirectOFTV2
The LzIndirectOFTV2.sol
contract acts as an Omnichain Fungible Token (OFT) in the LayerZero bridging system. This contract operates on sidechains and enables the transfer of MIM tokens from the Ethereum mainnet to the sidechain.
Here is a detailed overview of the contract:
Contract Inheritance
The LzIndirectOFTV2.sol
contract inherits from LzBaseOFTV2.sol
, which provides the basic structure and functions for an OFT.
Imported Libraries and Interfaces
IMintableBurnable.sol
: The interface for theElevatedMinterBurner
contract
State Variables
minterBurner
: An immutable instance ofIMintableBurnable
that represents theElevatedMinterBurner
contract. This contract is authorized to mint and burn MIM tokens on the sidechain.innerToken
: An instance ofIERC20
that represents the MIM token on the sidechain.ld2sdRate
: An immutable uint that represents the conversion rate from the token's native decimal places to the shared decimal places used in the LayerZero system. LayerZero using 8 decimals.
Constructor
The constructor for this contract takes four arguments: _token
, _minterBurner
, _sharedDecimals
, and _lzEndpoint
. These arguments are used to set the initial state of the contract.
Public Functions
circulatingSupply()
: Returns the total supply of theinnerToken
.token()
: Returns the address of theinnerToken
.
Internal Functions
_debitFrom()
: Burns the specified amount ofinnerToken
from the_from
address. This function calls the minterBurner.burn()_creditTo()
: Mints the specified amount ofinnerToken
to the_toAddress
. This function calls the minterBurner.mint()_ld2sdRate()
: Returns the conversion rate from the token's native decimal places to the shared decimal places used in the LayerZero system.
Last updated