CMXOFTFacet
Inherits: OFTCore
LayerZero OFT functionality for CMX diamond
Extends OFTCore to provide cross-chain CMX token functionality
Functions
onlyCMXOwner
modifier onlyCMXOwner();
onlyInitialized
modifier onlyInitialized();
constructor
Constructor for CMX OFT facet
constructor(address _lzEndpoint, address _delegate) OFTCore(18, _lzEndpoint, _delegate);
Parameters
_lzEndpoint
address
LayerZero endpoint address
_delegate
address
The delegate capable of making OApp configurations
owner
Get the owner address
function owner() public view override returns (address);
Returns
<none>
address
The owner address from CMX storage
token
Get the token address (this diamond)
function token() public view returns (address);
Returns
<none>
address
The token address
approvalRequired
Indicates whether approval is required for token transfers
function approvalRequired() external pure returns (bool);
Returns
<none>
bool
False since the diamond IS the token
sharedDecimals
Get shared decimals for cross-chain compatibility
function sharedDecimals() public pure override returns (uint8);
Returns
<none>
uint8
6 decimals (LayerZero standard for max compatibility)
_debit
Internal function to debit tokens for cross-chain transfer
function _debit(address _from, uint256 _amountLD, uint256 _minAmountLD, uint32 _dstEid)
internal
override
returns (uint256 amountSentLD, uint256 amountReceivedLD);
Parameters
_from
address
The sender address
_amountLD
uint256
The amount to debit in local decimals
_minAmountLD
uint256
The minimum amount to debit in local decimals
_dstEid
uint32
The destination endpoint ID
Returns
amountSentLD
uint256
The actual amount debited
amountReceivedLD
uint256
The amount that will be received
_credit
Internal function to credit tokens for cross-chain transfer
function _credit(address _to, uint256 _amountLD, uint32 _srcEid) internal override returns (uint256 amountReceivedLD);
Parameters
_to
address
The recipient address
_amountLD
uint256
The amount to credit in local decimals
_srcEid
uint32
The source endpoint ID
Returns
amountReceivedLD
uint256
The actual amount credited
name
Get token name
function name() external view returns (string memory);
Returns
<none>
string
The token name
symbol
Get token symbol
function symbol() external view returns (string memory);
Returns
<none>
string
The token symbol
decimals
Get token decimals
function decimals() external view returns (uint8);
Returns
<none>
uint8
The token decimals
totalSupply
Get total supply
function totalSupply() external view returns (uint256);
Returns
<none>
uint256
The total supply
balanceOf
Get balance of account
function balanceOf(address account) external view returns (uint256);
Parameters
account
address
The account to query
Returns
<none>
uint256
The account balance
allowance
Get allowance
function allowance(address tokenOwner, address spender) external view returns (uint256);
Parameters
tokenOwner
address
The owner address
spender
address
The spender address
Returns
<none>
uint256
The allowance amount
transfer
Transfer tokens
function transfer(address to, uint256 amount) external returns (bool);
Parameters
to
address
The recipient address
amount
uint256
The amount to transfer
Returns
<none>
bool
True if successful
transferFrom
Transfer tokens from one address to another
function transferFrom(address from, address to, uint256 amount) external returns (bool);
Parameters
from
address
The sender address
to
address
The recipient address
amount
uint256
The amount to transfer
Returns
<none>
bool
True if successful
approve
Approve spender to spend tokens
function approve(address spender, uint256 amount) external returns (bool);
Parameters
spender
address
The spender address
amount
uint256
The allowance amount
Returns
<none>
bool
True if successful
_spendAllowance
Internal function to spend allowance
function _spendAllowance(address tokenOwner, address spender, uint256 amount) internal;
Parameters
tokenOwner
address
The token owner
spender
address
The spender
amount
uint256
The amount to spend
Errors
OnlyOwner
error OnlyOwner();
NotInitialized
error NotInitialized();
Last updated
Was this helpful?