Skip to main content

MasaTokenNativeOFT

MasaTokenNativeOFT

MasaTokenNativeOFT is a LayerZero OFTCore contract for Native Masa Token on Masa subnet

Methods

SEND

function SEND() external view returns (uint16)

Returns

NameTypeDescription
_0uint16undefined

SEND_AND_CALL

function SEND_AND_CALL() external view returns (uint16)

Returns

NameTypeDescription
_0uint16undefined

allowInitializePath

function allowInitializePath(Origin origin) external view returns (bool)

Parameters

NameTypeDescription
originOriginundefined

Returns

NameTypeDescription
_0boolundefined

allowance

function allowance(address owner, address spender) external view returns (uint256)

See {IERC20-allowance}.

Parameters

NameTypeDescription
owneraddressundefined
spenderaddressundefined

Returns

NameTypeDescription
_0uint256undefined

approvalRequired

function approvalRequired() external pure returns (bool)

Indicates whether the OFT contract requires approval of the 'token()' to send.

In the case of OFT where the contract IS the token, approval is NOT required.

Returns

NameTypeDescription
_0boolrequiresApproval Needs approval of the underlying token implementation.

approve

function approve(address spender, uint256 amount) external nonpayable returns (bool)

See {IERC20-approve}. NOTE: If amount is the maximum uint256, the allowance is not updated on transferFrom. This is semantically equivalent to an infinite approval. Requirements: - spender cannot be the zero address.

Parameters

NameTypeDescription
spenderaddressundefined
amountuint256undefined

Returns

NameTypeDescription
_0boolundefined

balanceOf

function balanceOf(address account) external view returns (uint256)

See {IERC20-balanceOf}.

Parameters

NameTypeDescription
accountaddressundefined

Returns

NameTypeDescription
_0uint256undefined

combineOptions

function combineOptions(uint32 _eid, uint16 _msgType, bytes _extraOptions) external view returns (bytes)

Combines options for a given endpoint and message type.

If there is an enforced lzReceive option: - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether} - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function.This presence of duplicated options is handled off-chain in the verifier/executor.

Parameters

NameTypeDescription
_eiduint32The endpoint ID.
_msgTypeuint16The OAPP message type.
_extraOptionsbytesAdditional options passed by the caller.

Returns

NameTypeDescription
_0bytesoptions The combination of caller specified options AND enforced options.

decimalConversionRate

function decimalConversionRate() external view returns (uint256)

Returns

NameTypeDescription
_0uint256undefined

decimals

function decimals() external view returns (uint8)

Returns the number of decimals used to get its user representation. For example, if decimals equals 2, a balance of 505 tokens should be displayed to a user as 5.05 (505 / 10 ** 2). Tokens usually opt for a value of 18, imitating the relationship between Ether and Wei. This is the default value returned by this function, unless it's overridden. NOTE: This information is only used for display purposes: it in no way affects any of the arithmetic of the contract, including {IERC20-balanceOf} and {IERC20-transfer}.

Returns

NameTypeDescription
_0uint8undefined

decreaseAllowance

function decreaseAllowance(address spender, uint256 subtractedValue) external nonpayable returns (bool)

Atomically decreases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address. - spender must have allowance for the caller of at least subtractedValue.

Parameters

NameTypeDescription
spenderaddressundefined
subtractedValueuint256undefined

Returns

NameTypeDescription
_0boolundefined

deposit

function deposit() external payable

endpoint

function endpoint() external view returns (contract ILayerZeroEndpointV2)

Retrieves the LayerZero endpoint associated with the OApp.

Returns

NameTypeDescription
_0contract ILayerZeroEndpointV2undefined

enforcedOptions

function enforcedOptions(uint32 eid, uint16 msgType) external view returns (bytes enforcedOption)

Parameters

NameTypeDescription
eiduint32undefined
msgTypeuint16undefined

Returns

NameTypeDescription
enforcedOptionbytesundefined

increaseAllowance

function increaseAllowance(address spender, uint256 addedValue) external nonpayable returns (bool)

Atomically increases the allowance granted to spender by the caller. This is an alternative to {approve} that can be used as a mitigation for problems described in {IERC20-approve}. Emits an {Approval} event indicating the updated allowance. Requirements: - spender cannot be the zero address.

Parameters

NameTypeDescription
spenderaddressundefined
addedValueuint256undefined

Returns

NameTypeDescription
_0boolundefined

isComposeMsgSender

function isComposeMsgSender(Origin, bytes, address _sender) external view returns (bool)

Parameters

NameTypeDescription
_0Originundefined
_1bytesundefined
_senderaddressundefined

Returns

NameTypeDescription
_0boolundefined

isPeer

function isPeer(uint32 _eid, bytes32 _peer) external view returns (bool)

Check if the peer is considered 'trusted' by the OApp.Enables OAppPreCrimeSimulator to check whether a potential Inbound Packet is from a trusted source.

Parameters

NameTypeDescription
_eiduint32The endpoint ID to check.
_peerbytes32The peer to check.

Returns

NameTypeDescription
_0boolWhether the peer passed is considered 'trusted' by the OApp.

lzReceive

function lzReceive(Origin _origin, bytes32 _guid, bytes _message, address _executor, bytes _extraData) external payable

Parameters

NameTypeDescription
_originOriginundefined
_guidbytes32undefined
_messagebytesundefined
_executoraddressundefined
_extraDatabytesundefined

lzReceiveAndRevert

function lzReceiveAndRevert(InboundPacket[] _packets) external payable

Parameters

NameTypeDescription
_packetsInboundPacket[]undefined

lzReceiveSimulate

function lzReceiveSimulate(Origin _origin, bytes32 _guid, bytes _message, address _executor, bytes _extraData) external payable

Parameters

NameTypeDescription
_originOriginundefined
_guidbytes32undefined
_messagebytesundefined
_executoraddressundefined
_extraDatabytesundefined

msgInspector

function msgInspector() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

name

function name() external view returns (string)

Returns the name of the token.

Returns

NameTypeDescription
_0stringundefined

nextNonce

function nextNonce(uint32, bytes32) external view returns (uint64 nonce)

Retrieves the next nonce for a given source endpoint and sender address.

_srcEid The source endpoint ID._sender The sender address.The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.Is required by the off-chain executor to determine the OApp expects msg execution is ordered.This is also enforced by the OApp.By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.

Parameters

NameTypeDescription
_0uint32undefined
_1bytes32undefined

Returns

NameTypeDescription
nonceuint64The next nonce.

oApp

function oApp() external view returns (address)

Retrieves the address of the OApp contract.The simulator contract is the base contract for the OApp by default.If the simulator is a separate contract, override this function.

Returns

NameTypeDescription
_0addressThe address of the OApp contract.

oAppVersion

function oAppVersion() external pure returns (uint64 senderVersion, uint64 receiverVersion)

Retrieves the OApp version information.

Returns

NameTypeDescription
senderVersionuint64The version of the OAppSender.sol implementation.
receiverVersionuint64The version of the OAppReceiver.sol implementation.

oftVersion

function oftVersion() external pure returns (bytes4 interfaceId, uint64 version)

Retrieves interfaceID and the version of the OFT.

interfaceId: This specific interface ID is '0x02e49c2c'.version: Indicates a cross-chain compatible msg encoding with other OFTs.If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented. ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)

Returns

NameTypeDescription
interfaceIdbytes4The interface ID.
versionuint64The version.

owner

function owner() external view returns (address)

Returns the address of the current owner.

Returns

NameTypeDescription
_0addressundefined

peers

function peers(uint32 eid) external view returns (bytes32 peer)

Retrieves the peer (OApp) associated with a corresponding endpoint.

Parameters

NameTypeDescription
eiduint32undefined

Returns

NameTypeDescription
peerbytes32undefined

preCrime

function preCrime() external view returns (address)

Returns

NameTypeDescription
_0addressundefined

quoteOFT

function quoteOFT(SendParam _sendParam) external view returns (struct OFTLimit oftLimit, struct OFTFeeDetail[] oftFeeDetails, struct OFTReceipt oftReceipt)

Parameters

NameTypeDescription
_sendParamSendParamundefined

Returns

NameTypeDescription
oftLimitOFTLimitundefined
oftFeeDetailsOFTFeeDetail[]undefined
oftReceiptOFTReceiptundefined

quoteSend

function quoteSend(SendParam _sendParam, bool _payInLzToken) external view returns (struct MessagingFee msgFee)

Parameters

NameTypeDescription
_sendParamSendParamundefined
_payInLzTokenboolundefined

Returns

NameTypeDescription
msgFeeMessagingFeeundefined

renounceOwnership

function renounceOwnership() external nonpayable

Leaves the contract without owner. It will not be possible to call onlyOwner functions. Can only be called by the current owner. NOTE: Renouncing ownership will leave the contract without an owner, thereby disabling any functionality that is only available to the owner.

send

function send(SendParam _sendParam, MessagingFee _fee, address _refundAddress) external payable returns (struct MessagingReceipt msgReceipt, struct OFTReceipt oftReceipt)

Parameters

NameTypeDescription
_sendParamSendParamundefined
_feeMessagingFeeundefined
_refundAddressaddressundefined

Returns

NameTypeDescription
msgReceiptMessagingReceiptundefined
oftReceiptOFTReceiptundefined

setDelegate

function setDelegate(address _delegate) external nonpayable

Sets the delegate address for the OApp.

Only the owner/admin of the OApp can call this function.Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.

Parameters

NameTypeDescription
_delegateaddressThe address of the delegate to be set.

setEnforcedOptions

function setEnforcedOptions(EnforcedOptionParam[] _enforcedOptions) external nonpayable

Parameters

NameTypeDescription
_enforcedOptionsEnforcedOptionParam[]undefined

setMsgInspector

function setMsgInspector(address _msgInspector) external nonpayable

Sets the message inspector address for the OFT.This is an optional contract that can be used to inspect both 'message' and 'options'.Set it to address(0) to disable it, or set it to a contract address to enable it.

Parameters

NameTypeDescription
_msgInspectoraddressThe address of the message inspector.

setPeer

function setPeer(uint32 _eid, bytes32 _peer) external nonpayable

Sets the peer address (OApp instance) for a corresponding endpoint.

Only the owner/admin of the OApp can call this function.Indicates that the peer is trusted to send LayerZero messages to this OApp.Set this to bytes32(0) to remove the peer address.Peer is a bytes32 to accommodate non-evm chains.

Parameters

NameTypeDescription
_eiduint32The endpoint ID.
_peerbytes32The address of the peer to be associated with the corresponding endpoint.

setPreCrime

function setPreCrime(address _preCrime) external nonpayable

Sets the preCrime contract address.

Parameters

NameTypeDescription
_preCrimeaddressThe address of the preCrime contract.

sharedDecimals

function sharedDecimals() external view returns (uint8)

Retrieves the shared decimals of the OFT.Sets an implicit cap on the amount of tokens, over uint64.max() will need some sort of outbound cap / totalSupply cap Lowest common decimal denominator between chains. Defaults to 6 decimal places to provide up to 18,446,744,073,709.551615 units (max uint64). For tokens exceeding this totalSupply(), they will need to override the sharedDecimals function with something smaller. ie. 4 sharedDecimals would be 1,844,674,407,370,955.1615

Returns

NameTypeDescription
_0uint8The shared decimals of the OFT.

symbol

function symbol() external view returns (string)

Returns the symbol of the token, usually a shorter version of the name.

Returns

NameTypeDescription
_0stringundefined

token

function token() external view returns (address)

Retrieves the address of the underlying ERC20 implementation.In the case of OFT, address(this) and erc20 are the same contract.

Returns

NameTypeDescription
_0addressThe address of the OFT token.

totalSupply

function totalSupply() external view returns (uint256)

See {IERC20-totalSupply}.

Returns

NameTypeDescription
_0uint256undefined

transfer

function transfer(address to, uint256 amount) external nonpayable returns (bool)

See {IERC20-transfer}. Requirements: - to cannot be the zero address. - the caller must have a balance of at least amount.

Parameters

NameTypeDescription
toaddressundefined
amountuint256undefined

Returns

NameTypeDescription
_0boolundefined

transferFrom

function transferFrom(address from, address to, uint256 amount) external nonpayable returns (bool)

See {IERC20-transferFrom}. Emits an {Approval} event indicating the updated allowance. This is not required by the EIP. See the note at the beginning of {ERC20}. NOTE: Does not update the allowance if the current allowance is the maximum uint256. Requirements: - from and to cannot be the zero address. - from must have a balance of at least amount. - the caller must have allowance for from's tokens of at least amount.

Parameters

NameTypeDescription
fromaddressundefined
toaddressundefined
amountuint256undefined

Returns

NameTypeDescription
_0boolundefined

transferOwnership

function transferOwnership(address newOwner) external nonpayable

Transfers ownership of the contract to a new account (newOwner). Can only be called by the current owner.

Parameters

NameTypeDescription
newOwneraddressundefined

withdraw

function withdraw(uint256 _amount) external nonpayable

Parameters

NameTypeDescription
_amountuint256undefined

Events

Approval

event Approval(address indexed owner, address indexed spender, uint256 value)

Emitted when the allowance of a spender for an owner is set by a call to {approve}. value is the new allowance.

Parameters

NameTypeDescription
owner indexedaddressundefined
spender indexedaddressundefined
valueuint256undefined

Deposit

event Deposit(address indexed _dst, uint256 _amount)

Parameters

NameTypeDescription
_dst indexedaddressundefined
_amountuint256undefined

EnforcedOptionSet

event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions)

Parameters

NameTypeDescription
_enforcedOptionsEnforcedOptionParam[]undefined

MsgInspectorSet

event MsgInspectorSet(address inspector)

Parameters

NameTypeDescription
inspectoraddressundefined

OFTReceived

event OFTReceived(bytes32 indexed guid, uint32 srcEid, address indexed toAddress, uint256 amountReceivedLD)

Parameters

NameTypeDescription
guid indexedbytes32undefined
srcEiduint32undefined
toAddress indexedaddressundefined
amountReceivedLDuint256undefined

OFTSent

event OFTSent(bytes32 indexed guid, uint32 dstEid, address indexed fromAddress, uint256 amountSentLD, uint256 amountReceivedLD)

Parameters

NameTypeDescription
guid indexedbytes32undefined
dstEiduint32undefined
fromAddress indexedaddressundefined
amountSentLDuint256undefined
amountReceivedLDuint256undefined

OwnershipTransferred

event OwnershipTransferred(address indexed previousOwner, address indexed newOwner)

Parameters

NameTypeDescription
previousOwner indexedaddressundefined
newOwner indexedaddressundefined

PeerSet

event PeerSet(uint32 eid, bytes32 peer)

Parameters

NameTypeDescription
eiduint32undefined
peerbytes32undefined

PreCrimeSet

event PreCrimeSet(address preCrimeAddress)

Emitted when the preCrime contract address is set.

Parameters

NameTypeDescription
preCrimeAddressaddressThe address of the preCrime contract.

Transfer

event Transfer(address indexed from, address indexed to, uint256 value)

Emitted when value tokens are moved from one account (from) to another (to). Note that value may be zero.

Parameters

NameTypeDescription
from indexedaddressundefined
to indexedaddressundefined
valueuint256undefined

Withdrawal

event Withdrawal(address indexed _src, uint256 _amount)

Parameters

NameTypeDescription
_src indexedaddressundefined
_amountuint256undefined

Errors

InvalidDelegate

error InvalidDelegate()

InvalidEndpointCall

error InvalidEndpointCall()

InvalidLocalDecimals

error InvalidLocalDecimals()

InvalidOptions

error InvalidOptions(bytes options)

Parameters

NameTypeDescription
optionsbytesundefined

LzTokenUnavailable

error LzTokenUnavailable()

NoPeer

error NoPeer(uint32 eid)

Parameters

NameTypeDescription
eiduint32undefined

NotEnoughNative

error NotEnoughNative(uint256 msgValue)

Parameters

NameTypeDescription
msgValueuint256undefined

OnlyEndpoint

error OnlyEndpoint(address addr)

Parameters

NameTypeDescription
addraddressundefined

OnlyPeer

error OnlyPeer(uint32 eid, bytes32 sender)

Parameters

NameTypeDescription
eiduint32undefined
senderbytes32undefined

OnlySelf

error OnlySelf()

SimulationResult

error SimulationResult(bytes result)

Parameters

NameTypeDescription
resultbytesundefined

SlippageExceeded

error SlippageExceeded(uint256 amountLD, uint256 minAmountLD)

Parameters

NameTypeDescription
amountLDuint256undefined
minAmountLDuint256undefined