false
false

Contract Address Details

0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675

Contract Name
NonceContract
Creator
0x9f4031–4ef327 at 0xce6356–cfbbf6
Balance
0 ( )
Tokens
Fetching tokens...
Transactions
0 Transactions
Transfers
0 Transfers
Gas Used
Fetching gas used...
Last Balance Update
170721
Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
This contract has been partially verified via Sourcify.
Contract name:
NonceContract




Optimization enabled
true
Compiler version
v0.7.6+commit.7338295f




Optimization runs
30000
EVM Version
istanbul




Verified at
2024-09-23T06:29:49.278111Z

Constructor Arguments

0x000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7

Arg [0] (address) : 0xb6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7

              

contracts/NonceContract.sol

Sol2uml
new
// SPDX-License-Identifier: BUSL-1.1

pragma solidity 0.7.6;

import "./interfaces/ILayerZeroEndpoint.sol";

contract NonceContract {
    ILayerZeroEndpoint public immutable endpoint;
    // outboundNonce = [dstChainId][remoteAddress + localAddress]
    mapping(uint16 => mapping(bytes => uint64)) public outboundNonce;

    constructor(address _endpoint) {
        endpoint = ILayerZeroEndpoint(_endpoint);
    }

    function increment(uint16 _chainId, address _ua, bytes calldata _path) external returns (uint64) {
        require(
            endpoint.getSendLibraryAddress(_ua) == msg.sender,
            "NonceContract: msg.sender is not valid sendlibrary"
        );
        return ++outboundNonce[_chainId][_path];
    }
}
        

contracts/interfaces/ILayerZeroEndpoint.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity >=0.5.0;

import "./ILayerZeroUserApplicationConfig.sol";

interface ILayerZeroEndpoint is ILayerZeroUserApplicationConfig {
    // @notice send a LayerZero message to the specified address at a LayerZero endpoint.
    // @param _dstChainId - the destination chain identifier
    // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains
    // @param _payload - a custom bytes payload to send to the destination contract
    // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address
    // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction
    // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination
    function send(
        uint16 _dstChainId,
        bytes calldata _destination,
        bytes calldata _payload,
        address payable _refundAddress,
        address _zroPaymentAddress,
        bytes calldata _adapterParams
    ) external payable;

    // @notice used by the messaging library to publish verified payload
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source contract (as bytes) at the source chain
    // @param _dstAddress - the address on destination chain
    // @param _nonce - the unbound message ordering nonce
    // @param _gasLimit - the gas limit for external contract execution
    // @param _payload - verified payload to send to the destination contract
    function receivePayload(
        uint16 _srcChainId,
        bytes calldata _srcAddress,
        address _dstAddress,
        uint64 _nonce,
        uint _gasLimit,
        bytes calldata _payload
    ) external;

    // @notice get the inboundNonce of a receiver from a source chain which could be EVM or non-EVM chain
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source chain contract address
    function getInboundNonce(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (uint64);

    // @notice get the outboundNonce from this source chain which, consequently, is always an EVM
    // @param _srcAddress - the source chain contract address
    function getOutboundNonce(uint16 _dstChainId, address _srcAddress) external view returns (uint64);

    // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery
    // @param _dstChainId - the destination chain identifier
    // @param _userApplication - the user app address on this EVM chain
    // @param _payload - the custom message to send over LayerZero
    // @param _payInZRO - if false, user app pays the protocol fee in native token
    // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain
    function estimateFees(
        uint16 _dstChainId,
        address _userApplication,
        bytes calldata _payload,
        bool _payInZRO,
        bytes calldata _adapterParam
    ) external view returns (uint nativeFee, uint zroFee);

    // @notice get this Endpoint's immutable source identifier
    function getChainId() external view returns (uint16);

    // @notice the interface to retry failed message on this Endpoint destination
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source chain contract address
    // @param _payload - the payload to be retried
    function retryPayload(uint16 _srcChainId, bytes calldata _srcAddress, bytes calldata _payload) external;

    // @notice query if any STORED payload (message blocking) at the endpoint.
    // @param _srcChainId - the source chain identifier
    // @param _srcAddress - the source chain contract address
    function hasStoredPayload(uint16 _srcChainId, bytes calldata _srcAddress) external view returns (bool);

    // @notice query if the _libraryAddress is valid for sending msgs.
    // @param _userApplication - the user app address on this EVM chain
    function getSendLibraryAddress(address _userApplication) external view returns (address);

    // @notice query if the _libraryAddress is valid for receiving msgs.
    // @param _userApplication - the user app address on this EVM chain
    function getReceiveLibraryAddress(address _userApplication) external view returns (address);

    // @notice query if the non-reentrancy guard for send() is on
    // @return true if the guard is on. false otherwise
    function isSendingPayload() external view returns (bool);

    // @notice query if the non-reentrancy guard for receive() is on
    // @return true if the guard is on. false otherwise
    function isReceivingPayload() external view returns (bool);

    // @notice get the configuration of the LayerZero messaging library of the specified version
    // @param _version - messaging library version
    // @param _chainId - the chainId for the pending config change
    // @param _userApplication - the contract address of the user application
    // @param _configType - type of configuration. every messaging library has its own convention.
    function getConfig(
        uint16 _version,
        uint16 _chainId,
        address _userApplication,
        uint _configType
    ) external view returns (bytes memory);

    // @notice get the send() LayerZero messaging library version
    // @param _userApplication - the contract address of the user application
    function getSendVersion(address _userApplication) external view returns (uint16);

    // @notice get the lzReceive() LayerZero messaging library version
    // @param _userApplication - the contract address of the user application
    function getReceiveVersion(address _userApplication) external view returns (uint16);
}
          

contracts/interfaces/ILayerZeroUserApplicationConfig.sol

// SPDX-License-Identifier: BUSL-1.1

pragma solidity >=0.5.0;

interface ILayerZeroUserApplicationConfig {
    // @notice set the configuration of the LayerZero messaging library of the specified version
    // @param _version - messaging library version
    // @param _chainId - the chainId for the pending config change
    // @param _configType - type of configuration. every messaging library has its own convention.
    // @param _config - configuration in the bytes. can encode arbitrary content.
    function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external;

    // @notice set the send() LayerZero messaging library version to _version
    // @param _version - new messaging library version
    function setSendVersion(uint16 _version) external;

    // @notice set the lzReceive() LayerZero messaging library version to _version
    // @param _version - new messaging library version
    function setReceiveVersion(uint16 _version) external;

    // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload
    // @param _srcChainId - the chainId of the source chain
    // @param _srcAddress - the contract address of the source contract at the source chain
    function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external;
}
          

Compiler Settings

{"outputSelection":{},"optimizer":{"runs":30000,"enabled":true},"libraries":{},"evmVersion":"istanbul"}
              

Contract ABI

[{"type":"constructor","stateMutability":"nonpayable","inputs":[{"type":"address","name":"_endpoint","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ILayerZeroEndpoint"}],"name":"endpoint","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"increment","inputs":[{"type":"uint16","name":"_chainId","internalType":"uint16"},{"type":"address","name":"_ua","internalType":"address"},{"type":"bytes","name":"_path","internalType":"bytes"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint64","name":"","internalType":"uint64"}],"name":"outboundNonce","inputs":[{"type":"uint16","name":"","internalType":"uint16"},{"type":"bytes","name":"","internalType":"bytes"}]}]
              

Contract Creation Code

Verify & Publish
0x60a060405234801561001057600080fd5b506040516104c53803806104c58339818101604052602081101561003357600080fd5b5051606081901b6001600160601b0319166080526001600160a01b031661045961006c600039806101dd528061021a52506104596000f3fe608060405234801561001057600080fd5b50600436106100415760003560e01c80635e280f11146100465780636fe7b67314610077578063c533338f1461012a575b600080fd5b61004e6101db565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61010d6004803603606081101561008d57600080fd5b61ffff8235169173ffffffffffffffffffffffffffffffffffffffff602082013516918101906060810160408201356401000000008111156100ce57600080fd5b8201836020820111156100e057600080fd5b8035906020019184600183028401116401000000008311171561010257600080fd5b5090925090506101ff565b6040805167ffffffffffffffff9092168252519081900360200190f35b61010d6004803603604081101561014057600080fd5b61ffff823516919081019060408101602082013564010000000081111561016657600080fd5b82018360208201111561017857600080fd5b8035906020019184600183028401116401000000008311171561019a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103bc945050505050565b7f000000000000000000000000000000000000000000000000000000000000000081565b60003373ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff16639c729da1866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561029f57600080fd5b505afa1580156102b3573d6000803e3d6000fd5b505050506040513d60208110156102c957600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1614610337576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806103f26032913960400191505060405180910390fd5b6000808661ffff1661ffff1681526020019081526020016000208383604051808383808284379190910194855250506040516020938190039390930190922080547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008116600167ffffffffffffffff9283160191821617909155979650505050505050565b6000602081815292815260409020815180830184018051928152908401929093019190912091525467ffffffffffffffff168156fe4e6f6e6365436f6e74726163743a206d73672e73656e646572206973206e6f742076616c69642073656e646c696272617279a2646970667358221220afafcc3ab7d18f838c9c0f24cbad3ff228610acf8df48ce2767e0ec2e6c6a1b164736f6c63430007060033000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7

Deployed ByteCode

0x608060405234801561001057600080fd5b50600436106100415760003560e01c80635e280f11146100465780636fe7b67314610077578063c533338f1461012a575b600080fd5b61004e6101db565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b61010d6004803603606081101561008d57600080fd5b61ffff8235169173ffffffffffffffffffffffffffffffffffffffff602082013516918101906060810160408201356401000000008111156100ce57600080fd5b8201836020820111156100e057600080fd5b8035906020019184600183028401116401000000008311171561010257600080fd5b5090925090506101ff565b6040805167ffffffffffffffff9092168252519081900360200190f35b61010d6004803603604081101561014057600080fd5b61ffff823516919081019060408101602082013564010000000081111561016657600080fd5b82018360208201111561017857600080fd5b8035906020019184600183028401116401000000008311171561019a57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506103bc945050505050565b7f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd781565b60003373ffffffffffffffffffffffffffffffffffffffff167f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd773ffffffffffffffffffffffffffffffffffffffff16639c729da1866040518263ffffffff1660e01b8152600401808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060206040518083038186803b15801561029f57600080fd5b505afa1580156102b3573d6000803e3d6000fd5b505050506040513d60208110156102c957600080fd5b505173ffffffffffffffffffffffffffffffffffffffff1614610337576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260328152602001806103f26032913960400191505060405180910390fd5b6000808661ffff1661ffff1681526020019081526020016000208383604051808383808284379190910194855250506040516020938190039390930190922080547fffffffffffffffffffffffffffffffffffffffffffffffff00000000000000008116600167ffffffffffffffff9283160191821617909155979650505050505050565b6000602081815292815260409020815180830184018051928152908401929093019190912091525467ffffffffffffffff168156fe4e6f6e6365436f6e74726163743a206d73672e73656e646572206973206e6f742076616c69642073656e646c696272617279a2646970667358221220afafcc3ab7d18f838c9c0f24cbad3ff228610acf8df48ce2767e0ec2e6c6a1b164736f6c63430007060033