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 the ElevatedMinterBurner contract

State Variables

  • minterBurner: An immutable instance of IMintableBurnable that represents the ElevatedMinterBurner contract. This contract is authorized to mint and burn MIM tokens on the sidechain.

  • innerToken: An instance of IERC20 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 the innerToken.

  • token(): Returns the address of the innerToken.

Internal Functions

  • _debitFrom(): Burns the specified amount of innerToken from the _from address. This function calls the minterBurner.burn()

  • _creditTo(): Mints the specified amount of innerToken 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