Source Code
Overview
GLMR Balance
GLMR Value
$0.00Latest 16 from a total of 16 transactions
| Transaction Hash |
|
Block
|
From
|
To
|
|||||
|---|---|---|---|---|---|---|---|---|---|
| Set Peer | 5427535 | 726 days ago | IN | 0 GLMR | 0.00625035 | ||||
| Set Chain Mappin... | 5427533 | 726 days ago | IN | 0 GLMR | 0.00914191 | ||||
| Set Peer | 5427525 | 726 days ago | IN | 0 GLMR | 0.00626185 | ||||
| Set Chain Mappin... | 5427523 | 726 days ago | IN | 0 GLMR | 0.0091683 | ||||
| Set Peer | 5427517 | 726 days ago | IN | 0 GLMR | 0.00628104 | ||||
| Set Chain Mappin... | 5427515 | 726 days ago | IN | 0 GLMR | 0.00919166 | ||||
| Set Peer | 5427507 | 726 days ago | IN | 0 GLMR | 0.00629692 | ||||
| Set Chain Mappin... | 5427505 | 726 days ago | IN | 0 GLMR | 0.00921124 | ||||
| Set Peer | 5427498 | 726 days ago | IN | 0 GLMR | 0.0063014 | ||||
| Set Chain Mappin... | 5427496 | 726 days ago | IN | 0 GLMR | 0.00922309 | ||||
| Set Peer | 5427490 | 726 days ago | IN | 0 GLMR | 0.00631826 | ||||
| Set Chain Mappin... | 5427487 | 726 days ago | IN | 0 GLMR | 0.00925375 | ||||
| Set Peer | 5427481 | 726 days ago | IN | 0 GLMR | 0.00632574 | ||||
| Set Chain Mappin... | 5427479 | 726 days ago | IN | 0 GLMR | 0.00925627 | ||||
| Set Peer | 5427472 | 726 days ago | IN | 0 GLMR | 0.006334 | ||||
| Set Chain Mappin... | 5427470 | 726 days ago | IN | 0 GLMR | 0.00926219 |
View more zero value Internal Transactions in Advanced View mode
Cross-Chain Transactions
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x63Bc4A76...032e94bef The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
LayerZeroV2Handle
Compiler Version
v0.8.20+commit.a1b79de6
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "../interfaces/IUserApplication.sol";
import "../interfaces/IBridgeHandle.sol";
import {OApp, Origin} from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OApp.sol";
import {MessagingFee, MessagingReceipt} from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
contract LayerZeroV2Handle is OApp, IBridgeHandle {
event SendLzMessage(
uint64 indexed nonce,
uint32 dstChainId,
address dstAddress,
bytes32 messageHash
);
event ReceiveLzMessage(
uint64 indexed nonce,
uint32 srcChainId,
address srcAddress,
bytes32 messageHash
);
event NewChainMapping(uint16 uaChainId, uint32 bridgeChainId);
event ModUserApplication(
address oldUserApplication,
address newUserApplication
);
//l0ChainId=> ua chainId
mapping(uint32 => uint16) public uaChainIdMapping;
//ua chainId=>l0ChainId
mapping(uint16 => uint32) public bridgeChainIdMapping;
IUserApplication public userApplication;
// zkBridgeHandle or l0BridgeHandle or l0BridgeV2Handle
string public label;
constructor(
address _userApplication,
address _lzEndpoint,
string memory _label
) OApp(_lzEndpoint, msg.sender) {
userApplication = IUserApplication(_userApplication);
label = _label;
}
function sendMessage(
uint16 _dstChainId,
bytes memory _payload,
address payable _refundAddress,
bytes memory _adapterParams,
uint _nativeFee
) external payable {
require(
msg.sender == address(userApplication),
"LayerZeroHandle:not a trusted source"
);
uint32 bridgeChainId = _getBridgeChainId(_dstChainId);
MessagingReceipt memory receipt = _lzSend(
bridgeChainId, // Destination chain's endpoint ID.
_payload, // Encoded message payload being sent.
_adapterParams, // Message execution options (e.g., gas to use on destination).
MessagingFee(_nativeFee, 0), // Fee struct containing native gas and ZRO token.
_refundAddress // The refund address in case the send call reverts.
);
bytes32 _bytes = _getPeerOrRevert(bridgeChainId);
address dstAddress;
assembly {
dstAddress := and(_bytes, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
}
emit SendLzMessage(
receipt.nonce,
bridgeChainId,
dstAddress,
keccak256(_payload)
);
}
///===================================================
//=============== view/pure function ================
//===================================================
function estimateFees(
uint16 _dstChainId,
bytes calldata _payload,
bytes calldata _adapterParam
) external view returns (uint256 fee) {
MessagingFee memory messageFee = _quote(
_getBridgeChainId(_dstChainId),
_payload,
_adapterParam,
false
);
fee = messageFee.nativeFee;
}
///===================================================
//================ internal function ================
//===================================================
function _lzReceive(
Origin calldata _origin,
bytes32 /** _guid */,
bytes calldata _message,
address /** _executor */,
bytes calldata /** _extraData */
) internal override {
bytes32 _bytes = _getPeerOrRevert(_origin.srcEid);
address srcAddress;
assembly {
srcAddress := and(_bytes, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)
}
userApplication.receiveMessage(
_getUaCHainId(_origin.srcEid),
srcAddress,
_origin.nonce,
_message
);
emit ReceiveLzMessage(
_origin.nonce,
_origin.srcEid,
srcAddress,
keccak256(_message)
);
}
function _getBridgeChainId(
uint16 uaChainId
) internal view returns (uint32) {
uint32 bridgeChainId = bridgeChainIdMapping[uaChainId];
require(bridgeChainId != 0, "LayerZeroHandle: invalid chainId");
return bridgeChainId;
}
function _getUaCHainId(
uint32 bridgeChainId
) internal view returns (uint16) {
uint16 uaChainId = uaChainIdMapping[bridgeChainId];
require(uaChainId != 0, "LayerZeroHandle: invalid chainId");
return uaChainId;
}
///===================================================
//=============== governance function ===============
//===================================================
function setChainMapping(
uint16 uaChainId,
uint32 bridgeChainId
) external onlyOwner {
bridgeChainIdMapping[uaChainId] = bridgeChainId;
uaChainIdMapping[bridgeChainId] = uaChainId;
emit NewChainMapping(uaChainId, bridgeChainId);
}
function setUa(address _userApplication) external onlyOwner {
require(
_userApplication != address(0),
"LayerZeroHandle:to Cannot be zero address"
);
emit ModUserApplication(address(userApplication), _userApplication);
userApplication = IUserApplication(_userApplication);
}
function setLabel(string calldata _label) external onlyOwner {
require(bytes(_label).length > 0, "LayerZeroHandle:invalid label");
label = _label;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { ILayerZeroEndpointV2 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
/**
* @title IOAppCore
*/
interface IOAppCore {
// Custom error messages
error OnlyPeer(uint32 eid, bytes32 sender);
error NoPeer(uint32 eid);
error InvalidEndpointCall();
error InvalidDelegate();
// Event emitted when a peer (OApp) is set for a corresponding endpoint
event PeerSet(uint32 eid, bytes32 peer);
/**
* @notice Retrieves the OApp version information.
* @return senderVersion The version of the OAppSender.sol contract.
* @return receiverVersion The version of the OAppReceiver.sol contract.
*/
function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion);
/**
* @notice Retrieves the LayerZero endpoint associated with the OApp.
* @return iEndpoint The LayerZero endpoint as an interface.
*/
function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint);
/**
* @notice Retrieves the peer (OApp) associated with a corresponding endpoint.
* @param _eid The endpoint ID.
* @return peer The peer address (OApp instance) associated with the corresponding endpoint.
*/
function peers(uint32 _eid) external view returns (bytes32 peer);
/**
* @notice Sets the peer address (OApp instance) for a corresponding endpoint.
* @param _eid The endpoint ID.
* @param _peer The address of the peer to be associated with the corresponding endpoint.
*/
function setPeer(uint32 _eid, bytes32 _peer) external;
/**
* @notice Sets the delegate address for the OApp Core.
* @param _delegate The address of the delegate to be set.
*/
function setDelegate(address _delegate) external;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { ILayerZeroReceiver, Origin } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol";
interface IOAppReceiver is ILayerZeroReceiver {
/**
* @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint.
* @return sender The address responsible for 'sending' composeMsg's to the Endpoint.
*
* @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
* @dev The default sender IS the OApp implementer.
*/
function composeMsgSender() external view returns (address sender);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
// @dev Import the 'MessagingFee' and 'MessagingReceipt' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppSender, MessagingFee, MessagingReceipt } from "./OAppSender.sol";
// @dev Import the 'Origin' so it's exposed to OApp implementers
// solhint-disable-next-line no-unused-import
import { OAppReceiver, Origin } from "./OAppReceiver.sol";
import { OAppCore } from "./OAppCore.sol";
/**
* @title OApp
* @dev Abstract contract serving as the base for OApp implementation, combining OAppSender and OAppReceiver functionality.
*/
abstract contract OApp is OAppSender, OAppReceiver {
/**
* @dev Constructor to initialize the OApp with the provided endpoint and owner.
* @param _endpoint The address of the LOCAL LayerZero endpoint.
* @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
*/
constructor(address _endpoint, address _delegate) OAppCore(_endpoint, _delegate) {}
/**
* @notice Retrieves the OApp version information.
* @return senderVersion The version of the OAppSender.sol implementation.
* @return receiverVersion The version of the OAppReceiver.sol implementation.
*/
function oAppVersion()
public
pure
virtual
override(OAppSender, OAppReceiver)
returns (uint64 senderVersion, uint64 receiverVersion)
{
return (SENDER_VERSION, RECEIVER_VERSION);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol";
import { IOAppCore, ILayerZeroEndpointV2 } from "./interfaces/IOAppCore.sol";
/**
* @title OAppCore
* @dev Abstract contract implementing the IOAppCore interface with basic OApp configurations.
*/
abstract contract OAppCore is IOAppCore, Ownable {
// The LayerZero endpoint associated with the given OApp
ILayerZeroEndpointV2 public immutable endpoint;
// Mapping to store peers associated with corresponding endpoints
mapping(uint32 eid => bytes32 peer) public peers;
/**
* @dev Constructor to initialize the OAppCore with the provided endpoint and delegate.
* @param _endpoint The address of the LOCAL Layer Zero endpoint.
* @param _delegate The delegate capable of making OApp configurations inside of the endpoint.
*
* @dev The delegate typically should be set as the owner of the contract.
*/
constructor(address _endpoint, address _delegate) {
endpoint = ILayerZeroEndpointV2(_endpoint);
if (_delegate == address(0)) revert InvalidDelegate();
endpoint.setDelegate(_delegate);
}
/**
* @notice Sets the peer address (OApp instance) for a corresponding endpoint.
* @param _eid The endpoint ID.
* @param _peer The address of the peer to be associated with the corresponding endpoint.
*
* @dev Only the owner/admin of the OApp can call this function.
* @dev Indicates that the peer is trusted to send LayerZero messages to this OApp.
* @dev Set this to bytes32(0) to remove the peer address.
* @dev Peer is a bytes32 to accommodate non-evm chains.
*/
function setPeer(uint32 _eid, bytes32 _peer) public virtual onlyOwner {
peers[_eid] = _peer;
emit PeerSet(_eid, _peer);
}
/**
* @notice Internal function to get the peer address associated with a specific endpoint; reverts if NOT set.
* ie. the peer is set to bytes32(0).
* @param _eid The endpoint ID.
* @return peer The address of the peer associated with the specified endpoint.
*/
function _getPeerOrRevert(uint32 _eid) internal view virtual returns (bytes32) {
bytes32 peer = peers[_eid];
if (peer == bytes32(0)) revert NoPeer(_eid);
return peer;
}
/**
* @notice Sets the delegate address for the OApp.
* @param _delegate The address of the delegate to be set.
*
* @dev Only the owner/admin of the OApp can call this function.
* @dev Provides the ability for a delegate to set configs, on behalf of the OApp, directly on the Endpoint contract.
*/
function setDelegate(address _delegate) public onlyOwner {
endpoint.setDelegate(_delegate);
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { IOAppReceiver, Origin } from "./interfaces/IOAppReceiver.sol";
import { OAppCore } from "./OAppCore.sol";
/**
* @title OAppReceiver
* @dev Abstract contract implementing the ILayerZeroReceiver interface and extending OAppCore for OApp receivers.
*/
abstract contract OAppReceiver is IOAppReceiver, OAppCore {
// Custom error message for when the caller is not the registered endpoint/
error OnlyEndpoint(address addr);
// @dev The version of the OAppReceiver implementation.
// @dev Version is bumped when changes are made to this contract.
uint64 internal constant RECEIVER_VERSION = 1;
/**
* @notice Retrieves the OApp version information.
* @return senderVersion The version of the OAppSender.sol contract.
* @return receiverVersion The version of the OAppReceiver.sol contract.
*
* @dev Providing 0 as the default for OAppSender version. Indicates that the OAppSender is not implemented.
* ie. this is a RECEIVE only OApp.
* @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions.
*/
function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
return (0, RECEIVER_VERSION);
}
/**
* @notice Retrieves the address responsible for 'sending' composeMsg's to the Endpoint.
* @return sender The address responsible for 'sending' composeMsg's to the Endpoint.
*
* @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer.
* @dev The default sender IS the OApp implementer.
*/
function composeMsgSender() public view virtual returns (address sender) {
return address(this);
}
/**
* @notice Checks if the path initialization is allowed based on the provided origin.
* @param origin The origin information containing the source endpoint and sender address.
* @return Whether the path has been initialized.
*
* @dev This indicates to the endpoint that the OApp has enabled msgs for this particular path to be received.
* @dev This defaults to assuming if a peer has been set, its initialized.
* Can be overridden by the OApp if there is other logic to determine this.
*/
function allowInitializePath(Origin calldata origin) public view virtual returns (bool) {
return peers[origin.srcEid] == origin.sender;
}
/**
* @notice Retrieves the next nonce for a given source endpoint and sender address.
* @dev _srcEid The source endpoint ID.
* @dev _sender The sender address.
* @return nonce The next nonce.
*
* @dev The path nonce starts from 1. If 0 is returned it means that there is NO nonce ordered enforcement.
* @dev Is required by the off-chain executor to determine the OApp expects msg execution is ordered.
* @dev This is also enforced by the OApp.
* @dev By default this is NOT enabled. ie. nextNonce is hardcoded to return 0.
*/
function nextNonce(uint32 /*_srcEid*/, bytes32 /*_sender*/) public view virtual returns (uint64 nonce) {
return 0;
}
/**
* @dev Entry point for receiving messages or packets from the endpoint.
* @param _origin The origin information containing the source endpoint and sender address.
* - srcEid: The source chain endpoint ID.
* - sender: The sender address on the src chain.
* - nonce: The nonce of the message.
* @param _guid The unique identifier for the received LayerZero message.
* @param _message The payload of the received message.
* @param _executor The address of the executor for the received message.
* @param _extraData Additional arbitrary data provided by the corresponding executor.
*
* @dev Entry point for receiving msg/packet from the LayerZero endpoint.
*/
function lzReceive(
Origin calldata _origin,
bytes32 _guid,
bytes calldata _message,
address _executor,
bytes calldata _extraData
) public payable virtual {
// Ensures that only the endpoint can attempt to lzReceive() messages to this OApp.
if (address(endpoint) != msg.sender) revert OnlyEndpoint(msg.sender);
// Ensure that the sender matches the expected peer for the source endpoint.
if (_getPeerOrRevert(_origin.srcEid) != _origin.sender) revert OnlyPeer(_origin.srcEid, _origin.sender);
// Call the internal OApp implementation of lzReceive.
_lzReceive(_origin, _guid, _message, _executor, _extraData);
}
/**
* @dev Internal function to implement lzReceive logic without needing to copy the basic parameter validation.
*/
function _lzReceive(
Origin calldata _origin,
bytes32 _guid,
bytes calldata _message,
address _executor,
bytes calldata _extraData
) internal virtual;
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
import { SafeERC20, IERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import { MessagingParams, MessagingFee, MessagingReceipt } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import { OAppCore } from "./OAppCore.sol";
/**
* @title OAppSender
* @dev Abstract contract implementing the OAppSender functionality for sending messages to a LayerZero endpoint.
*/
abstract contract OAppSender is OAppCore {
using SafeERC20 for IERC20;
// Custom error messages
error NotEnoughNative(uint256 msgValue);
error LzTokenUnavailable();
// @dev The version of the OAppSender implementation.
// @dev Version is bumped when changes are made to this contract.
uint64 internal constant SENDER_VERSION = 1;
/**
* @notice Retrieves the OApp version information.
* @return senderVersion The version of the OAppSender.sol contract.
* @return receiverVersion The version of the OAppReceiver.sol contract.
*
* @dev Providing 0 as the default for OAppReceiver version. Indicates that the OAppReceiver is not implemented.
* ie. this is a SEND only OApp.
* @dev If the OApp uses both OAppSender and OAppReceiver, then this needs to be override returning the correct versions
*/
function oAppVersion() public view virtual returns (uint64 senderVersion, uint64 receiverVersion) {
return (SENDER_VERSION, 0);
}
/**
* @dev Internal function to interact with the LayerZero EndpointV2.quote() for fee calculation.
* @param _dstEid The destination endpoint ID.
* @param _message The message payload.
* @param _options Additional options for the message.
* @param _payInLzToken Flag indicating whether to pay the fee in LZ tokens.
* @return fee The calculated MessagingFee for the message.
* - nativeFee: The native fee for the message.
* - lzTokenFee: The LZ token fee for the message.
*/
function _quote(
uint32 _dstEid,
bytes memory _message,
bytes memory _options,
bool _payInLzToken
) internal view virtual returns (MessagingFee memory fee) {
return
endpoint.quote(
MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _payInLzToken),
address(this)
);
}
/**
* @dev Internal function to interact with the LayerZero EndpointV2.send() for sending a message.
* @param _dstEid The destination endpoint ID.
* @param _message The message payload.
* @param _options Additional options for the message.
* @param _fee The calculated LayerZero fee for the message.
* - nativeFee: The native fee.
* - lzTokenFee: The lzToken fee.
* @param _refundAddress The address to receive any excess fee values sent to the endpoint.
* @return receipt The receipt for the sent message.
* - guid: The unique identifier for the sent message.
* - nonce: The nonce of the sent message.
* - fee: The LayerZero fee incurred for the message.
*/
function _lzSend(
uint32 _dstEid,
bytes memory _message,
bytes memory _options,
MessagingFee memory _fee,
address _refundAddress
) internal virtual returns (MessagingReceipt memory receipt) {
// @dev Push corresponding fees to the endpoint, any excess is sent back to the _refundAddress from the endpoint.
uint256 messageValue = _payNative(_fee.nativeFee);
if (_fee.lzTokenFee > 0) _payLzToken(_fee.lzTokenFee);
return
// solhint-disable-next-line check-send-result
endpoint.send{ value: messageValue }(
MessagingParams(_dstEid, _getPeerOrRevert(_dstEid), _message, _options, _fee.lzTokenFee > 0),
_refundAddress
);
}
/**
* @dev Internal function to pay the native fee associated with the message.
* @param _nativeFee The native fee to be paid.
* @return nativeFee The amount of native currency paid.
*
* @dev If the OApp needs to initiate MULTIPLE LayerZero messages in a single transaction,
* this will need to be overridden because msg.value would contain multiple lzFees.
* @dev Should be overridden in the event the LayerZero endpoint requires a different native currency.
* @dev Some EVMs use an ERC20 as a method for paying transactions/gasFees.
* @dev The endpoint is EITHER/OR, ie. it will NOT support both types of native payment at a time.
*/
function _payNative(uint256 _nativeFee) internal virtual returns (uint256 nativeFee) {
if (msg.value != _nativeFee) revert NotEnoughNative(msg.value);
return _nativeFee;
}
/**
* @dev Internal function to pay the LZ token fee associated with the message.
* @param _lzTokenFee The LZ token fee to be paid.
*
* @dev If the caller is trying to pay in the specified lzToken, then the lzTokenFee is passed to the endpoint.
* @dev Any excess sent, is passed back to the specified _refundAddress in the _lzSend().
*/
function _payLzToken(uint256 _lzTokenFee) internal virtual {
// @dev Cannot cache the token because it is not immutable in the endpoint.
address lzToken = endpoint.lzToken();
if (lzToken == address(0)) revert LzTokenUnavailable();
// Pay LZ token fee by sending tokens to the endpoint.
IERC20(lzToken).safeTransferFrom(msg.sender, address(endpoint), _lzTokenFee);
}
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import { IMessageLibManager } from "./IMessageLibManager.sol";
import { IMessagingComposer } from "./IMessagingComposer.sol";
import { IMessagingChannel } from "./IMessagingChannel.sol";
import { IMessagingContext } from "./IMessagingContext.sol";
struct MessagingParams {
uint32 dstEid;
bytes32 receiver;
bytes message;
bytes options;
bool payInLzToken;
}
struct MessagingReceipt {
bytes32 guid;
uint64 nonce;
MessagingFee fee;
}
struct MessagingFee {
uint256 nativeFee;
uint256 lzTokenFee;
}
struct Origin {
uint32 srcEid;
bytes32 sender;
uint64 nonce;
}
interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext {
event PacketSent(bytes encodedPayload, bytes options, address sendLibrary);
event PacketVerified(Origin origin, address receiver, bytes32 payloadHash);
event PacketDelivered(Origin origin, address receiver);
event LzReceiveAlert(
address indexed receiver,
address indexed executor,
Origin origin,
bytes32 guid,
uint256 gas,
uint256 value,
bytes message,
bytes extraData,
bytes reason
);
event LzTokenSet(address token);
event DelegateSet(address sender, address delegate);
function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory);
function send(
MessagingParams calldata _params,
address _refundAddress
) external payable returns (MessagingReceipt memory);
function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external;
function verifiable(Origin calldata _origin, address _receiver) external view returns (bool);
function initializable(Origin calldata _origin, address _receiver) external view returns (bool);
function lzReceive(
Origin calldata _origin,
address _receiver,
bytes32 _guid,
bytes calldata _message,
bytes calldata _extraData
) external payable;
// oapp can burn messages partially by calling this function with its own business logic if messages are verified in order
function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external;
function setLzToken(address _lzToken) external;
function lzToken() external view returns (address);
function nativeToken() external view returns (address);
function setDelegate(address _delegate) external;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
import { Origin } from "./ILayerZeroEndpointV2.sol";
interface ILayerZeroReceiver {
function allowInitializePath(Origin calldata _origin) external view returns (bool);
function nextNonce(uint32 _eid, bytes32 _sender) external view returns (uint64);
function lzReceive(
Origin calldata _origin,
bytes32 _guid,
bytes calldata _message,
address _executor,
bytes calldata _extraData
) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
struct SetConfigParam {
uint32 eid;
uint32 configType;
bytes config;
}
interface IMessageLibManager {
struct Timeout {
address lib;
uint256 expiry;
}
event LibraryRegistered(address newLib);
event DefaultSendLibrarySet(uint32 eid, address newLib);
event DefaultReceiveLibrarySet(uint32 eid, address newLib);
event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
event SendLibrarySet(address sender, uint32 eid, address newLib);
event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);
function registerLibrary(address _lib) external;
function isRegisteredLibrary(address _lib) external view returns (bool);
function getRegisteredLibraries() external view returns (address[] memory);
function setDefaultSendLibrary(uint32 _eid, address _newLib) external;
function defaultSendLibrary(uint32 _eid) external view returns (address);
function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external;
function defaultReceiveLibrary(uint32 _eid) external view returns (address);
function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;
function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);
function isSupportedEid(uint32 _eid) external view returns (bool);
function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);
/// ------------------- OApp interfaces -------------------
function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;
function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);
function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);
function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;
function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);
function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external;
function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);
function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;
function getConfig(
address _oapp,
address _lib,
uint32 _eid,
uint32 _configType
) external view returns (bytes memory config);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IMessagingChannel {
event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce);
event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash);
function eid() external view returns (uint32);
// this is an emergency function if a message cannot be verified for some reasons
// required to provide _nextNonce to avoid race condition
function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external;
function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;
function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external;
function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32);
function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);
function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64);
function inboundPayloadHash(
address _receiver,
uint32 _srcEid,
bytes32 _sender,
uint64 _nonce
) external view returns (bytes32);
function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64);
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IMessagingComposer {
event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message);
event ComposeDelivered(address from, address to, bytes32 guid, uint16 index);
event LzComposeAlert(
address indexed from,
address indexed to,
address indexed executor,
bytes32 guid,
uint16 index,
uint256 gas,
uint256 value,
bytes message,
bytes extraData,
bytes reason
);
function composeQueue(
address _from,
address _to,
bytes32 _guid,
uint16 _index
) external view returns (bytes32 messageHash);
function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external;
function lzCompose(
address _from,
address _to,
bytes32 _guid,
uint16 _index,
bytes calldata _message,
bytes calldata _extraData
) external payable;
}// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface IMessagingContext {
function isSendingMessage() external view returns (bool);
function getSendContext() external view returns (uint32 dstEid, address sender);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/Context.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* By default, the owner account will be the one that deploys the contract. This
* can later be changed with {transferOwnership}.
*
* This module is used through inheritance. It will make available the modifier
* `onlyOwner`, which can be applied to your functions to restrict their use to
* the owner.
*/
abstract contract Ownable is Context {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
constructor() {
_transferOwnership(_msgSender());
}
/**
* @dev Throws if called by any account other than the owner.
*/
modifier onlyOwner() {
_checkOwner();
_;
}
/**
* @dev Returns the address of the current owner.
*/
function owner() public view virtual returns (address) {
return _owner;
}
/**
* @dev Throws if the sender is not the owner.
*/
function _checkOwner() internal view virtual {
require(owner() == _msgSender(), "Ownable: caller is not the owner");
}
/**
* @dev 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.
*/
function renounceOwnership() public virtual onlyOwner {
_transferOwnership(address(0));
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Can only be called by the current owner.
*/
function transferOwnership(address newOwner) public virtual onlyOwner {
require(newOwner != address(0), "Ownable: new owner is the zero address");
_transferOwnership(newOwner);
}
/**
* @dev Transfers ownership of the contract to a new account (`newOwner`).
* Internal function without access restriction.
*/
function _transferOwnership(address newOwner) internal virtual {
address oldOwner = _owner;
_owner = newOwner;
emit OwnershipTransferred(oldOwner, newOwner);
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
* https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
*
* Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
* presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
* need to send a transaction, and thus is not required to hold Ether at all.
*
* ==== Security Considerations
*
* There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
* expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
* considered as an intention to spend the allowance in any specific way. The second is that because permits have
* built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
* take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
* generally recommended is:
*
* ```solidity
* function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
* try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
* doThing(..., value);
* }
*
* function doThing(..., uint256 value) public {
* token.safeTransferFrom(msg.sender, address(this), value);
* ...
* }
* ```
*
* Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
* `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
* {SafeERC20-safeTransferFrom}).
*
* Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
* contracts should have entry points that don't rely on permit.
*/
interface IERC20Permit {
/**
* @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
* given ``owner``'s signed approval.
*
* IMPORTANT: The same issues {IERC20-approve} has related to transaction
* ordering also apply here.
*
* Emits an {Approval} event.
*
* Requirements:
*
* - `spender` cannot be the zero address.
* - `deadline` must be a timestamp in the future.
* - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
* over the EIP712-formatted function arguments.
* - the signature must use ``owner``'s current nonce (see {nonces}).
*
* For more information on the signature format, see the
* https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
* section].
*
* CAUTION: See Security Considerations above.
*/
function permit(
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) external;
/**
* @dev Returns the current nonce for `owner`. This value must be
* included whenever a signature is generated for {permit}.
*
* Every successful call to {permit} increases ``owner``'s nonce by one. This
* prevents a signature from being used multiple times.
*/
function nonces(address owner) external view returns (uint256);
/**
* @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
*/
// solhint-disable-next-line func-name-mixedcase
function DOMAIN_SEPARATOR() external view returns (bytes32);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol)
pragma solidity ^0.8.0;
/**
* @dev Interface of the ERC20 standard as defined in the EIP.
*/
interface IERC20 {
/**
* @dev Emitted when `value` tokens are moved from one account (`from`) to
* another (`to`).
*
* Note that `value` may be zero.
*/
event Transfer(address indexed from, address indexed to, uint256 value);
/**
* @dev Emitted when the allowance of a `spender` for an `owner` is set by
* a call to {approve}. `value` is the new allowance.
*/
event Approval(address indexed owner, address indexed spender, uint256 value);
/**
* @dev Returns the amount of tokens in existence.
*/
function totalSupply() external view returns (uint256);
/**
* @dev Returns the amount of tokens owned by `account`.
*/
function balanceOf(address account) external view returns (uint256);
/**
* @dev Moves `amount` tokens from the caller's account to `to`.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transfer(address to, uint256 amount) external returns (bool);
/**
* @dev Returns the remaining number of tokens that `spender` will be
* allowed to spend on behalf of `owner` through {transferFrom}. This is
* zero by default.
*
* This value changes when {approve} or {transferFrom} are called.
*/
function allowance(address owner, address spender) external view returns (uint256);
/**
* @dev Sets `amount` as the allowance of `spender` over the caller's tokens.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* IMPORTANT: Beware that changing an allowance with this method brings the risk
* that someone may use both the old and the new allowance by unfortunate
* transaction ordering. One possible solution to mitigate this race
* condition is to first reduce the spender's allowance to 0 and set the
* desired value afterwards:
* https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
*
* Emits an {Approval} event.
*/
function approve(address spender, uint256 amount) external returns (bool);
/**
* @dev Moves `amount` tokens from `from` to `to` using the
* allowance mechanism. `amount` is then deducted from the caller's
* allowance.
*
* Returns a boolean value indicating whether the operation succeeded.
*
* Emits a {Transfer} event.
*/
function transferFrom(address from, address to, uint256 amount) external returns (bool);
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol)
pragma solidity ^0.8.0;
import "../IERC20.sol";
import "../extensions/IERC20Permit.sol";
import "../../../utils/Address.sol";
/**
* @title SafeERC20
* @dev Wrappers around ERC20 operations that throw on failure (when the token
* contract returns false). Tokens that return no value (and instead revert or
* throw on failure) are also supported, non-reverting calls are assumed to be
* successful.
* To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
* which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
*/
library SafeERC20 {
using Address for address;
/**
* @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeTransfer(IERC20 token, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value));
}
/**
* @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
* calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
*/
function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
_callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value));
}
/**
* @dev Deprecated. This function has issues similar to the ones found in
* {IERC20-approve}, and its usage is discouraged.
*
* Whenever possible, use {safeIncreaseAllowance} and
* {safeDecreaseAllowance} instead.
*/
function safeApprove(IERC20 token, address spender, uint256 value) internal {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require(
(value == 0) || (token.allowance(address(this), spender) == 0),
"SafeERC20: approve from non-zero to non-zero allowance"
);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value));
}
/**
* @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
uint256 oldAllowance = token.allowance(address(this), spender);
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value));
}
/**
* @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful.
*/
function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal {
unchecked {
uint256 oldAllowance = token.allowance(address(this), spender);
require(oldAllowance >= value, "SafeERC20: decreased allowance below zero");
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value));
}
}
/**
* @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
* non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
* to be set to zero before setting it to a non-zero value, such as USDT.
*/
function forceApprove(IERC20 token, address spender, uint256 value) internal {
bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value);
if (!_callOptionalReturnBool(token, approvalCall)) {
_callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0));
_callOptionalReturn(token, approvalCall);
}
}
/**
* @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`.
* Revert on invalid signature.
*/
function safePermit(
IERC20Permit token,
address owner,
address spender,
uint256 value,
uint256 deadline,
uint8 v,
bytes32 r,
bytes32 s
) internal {
uint256 nonceBefore = token.nonces(owner);
token.permit(owner, spender, value, deadline, v, r, s);
uint256 nonceAfter = token.nonces(owner);
require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*/
function _callOptionalReturn(IERC20 token, bytes memory data) private {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
// the target address contains contract code and also asserts for success in the low-level call.
bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed");
require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed");
}
/**
* @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
* on the return value: the return value is optional (but if data is returned, it must not be false).
* @param token The token targeted by the call.
* @param data The call data (encoded using abi.encode or one of its variants).
*
* This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
*/
function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
// We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
// we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
// and not revert is the subcall reverts.
(bool success, bytes memory returndata) = address(token).call(data);
return
success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token));
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol)
pragma solidity ^0.8.1;
/**
* @dev Collection of functions related to the address type
*/
library Address {
/**
* @dev Returns true if `account` is a contract.
*
* [IMPORTANT]
* ====
* It is unsafe to assume that an address for which this function returns
* false is an externally-owned account (EOA) and not a contract.
*
* Among others, `isContract` will return false for the following
* types of addresses:
*
* - an externally-owned account
* - a contract in construction
* - an address where a contract will be created
* - an address where a contract lived, but was destroyed
*
* Furthermore, `isContract` will also return true if the target contract within
* the same transaction is already scheduled for destruction by `SELFDESTRUCT`,
* which only has an effect at the end of a transaction.
* ====
*
* [IMPORTANT]
* ====
* You shouldn't rely on `isContract` to protect against flash loan attacks!
*
* Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets
* like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract
* constructor.
* ====
*/
function isContract(address account) internal view returns (bool) {
// This method relies on extcodesize/address.code.length, which returns 0
// for contracts in construction, since the code is only stored at the end
// of the constructor execution.
return account.code.length > 0;
}
/**
* @dev Replacement for Solidity's `transfer`: sends `amount` wei to
* `recipient`, forwarding all available gas and reverting on errors.
*
* https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
* of certain opcodes, possibly making contracts go over the 2300 gas limit
* imposed by `transfer`, making them unable to receive funds via
* `transfer`. {sendValue} removes this limitation.
*
* https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
*
* IMPORTANT: because control is transferred to `recipient`, care must be
* taken to not create reentrancy vulnerabilities. Consider using
* {ReentrancyGuard} or the
* https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
*/
function sendValue(address payable recipient, uint256 amount) internal {
require(address(this).balance >= amount, "Address: insufficient balance");
(bool success, ) = recipient.call{value: amount}("");
require(success, "Address: unable to send value, recipient may have reverted");
}
/**
* @dev Performs a Solidity function call using a low level `call`. A
* plain `call` is an unsafe replacement for a function call: use this
* function instead.
*
* If `target` reverts with a revert reason, it is bubbled up by this
* function (like regular Solidity function calls).
*
* Returns the raw returned data. To convert to the expected return value,
* use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
*
* Requirements:
*
* - `target` must be a contract.
* - calling `target` with `data` must not revert.
*
* _Available since v3.1._
*/
function functionCall(address target, bytes memory data) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, "Address: low-level call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with
* `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
return functionCallWithValue(target, data, 0, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but also transferring `value` wei to `target`.
*
* Requirements:
*
* - the calling contract must have an ETH balance of at least `value`.
* - the called Solidity function must be `payable`.
*
* _Available since v3.1._
*/
function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
return functionCallWithValue(target, data, value, "Address: low-level call with value failed");
}
/**
* @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but
* with `errorMessage` as a fallback revert reason when `target` reverts.
*
* _Available since v3.1._
*/
function functionCallWithValue(
address target,
bytes memory data,
uint256 value,
string memory errorMessage
) internal returns (bytes memory) {
require(address(this).balance >= value, "Address: insufficient balance for call");
(bool success, bytes memory returndata) = target.call{value: value}(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
return functionStaticCall(target, data, "Address: low-level static call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a static call.
*
* _Available since v3.3._
*/
function functionStaticCall(
address target,
bytes memory data,
string memory errorMessage
) internal view returns (bytes memory) {
(bool success, bytes memory returndata) = target.staticcall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
return functionDelegateCall(target, data, "Address: low-level delegate call failed");
}
/**
* @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],
* but performing a delegate call.
*
* _Available since v3.4._
*/
function functionDelegateCall(
address target,
bytes memory data,
string memory errorMessage
) internal returns (bytes memory) {
(bool success, bytes memory returndata) = target.delegatecall(data);
return verifyCallResultFromTarget(target, success, returndata, errorMessage);
}
/**
* @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling
* the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract.
*
* _Available since v4.8._
*/
function verifyCallResultFromTarget(
address target,
bool success,
bytes memory returndata,
string memory errorMessage
) internal view returns (bytes memory) {
if (success) {
if (returndata.length == 0) {
// only check isContract if the call was successful and the return data is empty
// otherwise we already know that it was a contract
require(isContract(target), "Address: call to non-contract");
}
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
/**
* @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the
* revert reason or using the provided one.
*
* _Available since v4.3._
*/
function verifyCallResult(
bool success,
bytes memory returndata,
string memory errorMessage
) internal pure returns (bytes memory) {
if (success) {
return returndata;
} else {
_revert(returndata, errorMessage);
}
}
function _revert(bytes memory returndata, string memory errorMessage) private pure {
// Look for revert reason and bubble it up if present
if (returndata.length > 0) {
// The easiest way to bubble the revert reason is using memory via assembly
/// @solidity memory-safe-assembly
assembly {
let returndata_size := mload(returndata)
revert(add(32, returndata), returndata_size)
}
} else {
revert(errorMessage);
}
}
}// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract Context {
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IBridgeHandle {
function sendMessage(uint16 _dstChainId, bytes memory _payload, address payable _refundAddress, bytes memory _adapterParams, uint256 _nativeFee) payable external;
function estimateFees(uint16 _dstChainId, bytes calldata _payload, bytes calldata _adapterParam) external view returns (uint256 fee);
}// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
interface IUserApplication {
// @param srcChainId - the source endpoint identifier
// @param srcAddress - the source sending contract address from the source chain
// @param nonce - the ordered message nonce
// @param payload - the signed payload is the UA bytes has encoded to be sent
function receiveMessage(uint16 srcChainId, address srcAddress, uint64 nonce, bytes calldata payload) external;
}{
"optimizer": {
"enabled": true,
"runs": 200
},
"evmVersion": "paris",
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"libraries": {}
}Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
Contract ABI
API[{"inputs":[{"internalType":"address","name":"_userApplication","type":"address"},{"internalType":"address","name":"_lzEndpoint","type":"address"},{"internalType":"string","name":"_label","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"NoPeer","type":"error"},{"inputs":[{"internalType":"uint256","name":"msgValue","type":"uint256"}],"name":"NotEnoughNative","type":"error"},{"inputs":[{"internalType":"address","name":"addr","type":"address"}],"name":"OnlyEndpoint","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"}],"name":"OnlyPeer","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oldUserApplication","type":"address"},{"indexed":false,"internalType":"address","name":"newUserApplication","type":"address"}],"name":"ModUserApplication","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"uaChainId","type":"uint16"},{"indexed":false,"internalType":"uint32","name":"bridgeChainId","type":"uint32"}],"name":"NewChainMapping","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"nonce","type":"uint64"},{"indexed":false,"internalType":"uint32","name":"srcChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"srcAddress","type":"address"},{"indexed":false,"internalType":"bytes32","name":"messageHash","type":"bytes32"}],"name":"ReceiveLzMessage","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint64","name":"nonce","type":"uint64"},{"indexed":false,"internalType":"uint32","name":"dstChainId","type":"uint32"},{"indexed":false,"internalType":"address","name":"dstAddress","type":"address"},{"indexed":false,"internalType":"bytes32","name":"messageHash","type":"bytes32"}],"name":"SendLzMessage","type":"event"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"origin","type":"tuple"}],"name":"allowInitializePath","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"","type":"uint16"}],"name":"bridgeChainIdMapping","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"composeMsgSender","outputs":[{"internalType":"address","name":"sender","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"bytes","name":"_adapterParam","type":"bytes"}],"name":"estimateFees","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"label","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"srcEid","type":"uint32"},{"internalType":"bytes32","name":"sender","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"}],"internalType":"struct Origin","name":"_origin","type":"tuple"},{"internalType":"bytes32","name":"_guid","type":"bytes32"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address","name":"_executor","type":"address"},{"internalType":"bytes","name":"_extraData","type":"bytes"}],"name":"lzReceive","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"},{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"nextNonce","outputs":[{"internalType":"uint64","name":"nonce","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_payload","type":"bytes"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"},{"internalType":"uint256","name":"_nativeFee","type":"uint256"}],"name":"sendMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"uaChainId","type":"uint16"},{"internalType":"uint32","name":"bridgeChainId","type":"uint32"}],"name":"setChainMapping","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"string","name":"_label","type":"string"}],"name":"setLabel","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"bytes32","name":"_peer","type":"bytes32"}],"name":"setPeer","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_userApplication","type":"address"}],"name":"setUa","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint32","name":"","type":"uint32"}],"name":"uaChainIdMapping","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"userApplication","outputs":[{"internalType":"contract IUserApplication","name":"","type":"address"}],"stateMutability":"view","type":"function"}]Contract Creation Code
0x60a06040523480156200001157600080fd5b5060405162001f8538038062001f85833981016040819052620000349162000191565b8133818162000043816200010e565b6001600160a01b0380831660805281166200007157604051632d618d8160e21b815260040160405180910390fd5b60805160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b158015620000b957600080fd5b505af1158015620000ce573d6000803e3d6000fd5b5050600480546001600160a01b0319166001600160a01b038b1617905550600594506200010493508592508491506200031a9050565b50505050620003e6565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200017657600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b600080600060608486031215620001a757600080fd5b620001b2846200015e565b92506020620001c38186016200015e565b60408601519093506001600160401b0380821115620001e157600080fd5b818701915087601f830112620001f657600080fd5b8151818111156200020b576200020b6200017b565b604051601f8201601f19908116603f011681019083821181831017156200023657620002366200017b565b816040528281528a868487010111156200024f57600080fd5b600093505b8284101562000273578484018601518185018701529285019262000254565b60008684830101528096505050505050509250925092565b600181811c90821680620002a057607f821691505b602082108103620002c157634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200031557600081815260208120601f850160051c81016020861015620002f05750805b601f850160051c820191505b818110156200031157828155600101620002fc565b5050505b505050565b81516001600160401b038111156200033657620003366200017b565b6200034e816200034784546200028b565b84620002c7565b602080601f8311600181146200038657600084156200036d5750858301515b600019600386901b1c1916600185901b17855562000311565b600085815260208120601f198616915b82811015620003b75788860151825594840194600190910190840162000396565b5085821015620003d65787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b608051611b596200042c6000396000818161022e015281816104650152818161078701528181610d0a01528181610e5a01528181610fc701526110800152611b596000f3fe60806040526004361061012a5760003560e01c8063acac2b54116100ab578063cb4774c41161006f578063cb4774c414610376578063cd89600614610398578063d9e98998146103e0578063f2fde38b14610400578063f4a6c3e614610420578063ff7bd03d1461043357600080fd5b8063acac2b54146102d6578063b92d0eff146102f6578063bb0b6a5314610309578063bf53096914610336578063ca5eb5e11461035657600080fd5b806345e380a3116100f257806345e380a3146101ee5780635e280f111461021c578063715018a6146102685780637d25a05e1461027d5780638da5cb5b146102b857600080fd5b806313137d651461012f57806317442b701461014457806332eab36a1461016a5780633400288b1461018a5780633de46aee146101aa575b600080fd5b61014261013d3660046113ad565b610463565b005b34801561015057600080fd5b506040805160018082526020820152015b60405180910390f35b34801561017657600080fd5b5061014261018536600461144c565b610523565b34801561019657600080fd5b506101426101a5366004611489565b6105fc565b3480156101b657600080fd5b506101db6101c53660046114b3565b60026020526000908152604090205461ffff1681565b60405161ffff9091168152602001610161565b3480156101fa57600080fd5b5061020e6102093660046114e0565b61065a565b604051908152602001610161565b34801561022857600080fd5b506102507f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610161565b34801561027457600080fd5b506101426106e5565b34801561028957600080fd5b506102a0610298366004611489565b600092915050565b6040516001600160401b039091168152602001610161565b3480156102c457600080fd5b506000546001600160a01b0316610250565b3480156102e257600080fd5b50600454610250906001600160a01b031681565b34801561030257600080fd5b5030610250565b34801561031557600080fd5b5061020e6103243660046114b3565b60016020526000908152604090205481565b34801561034257600080fd5b50610142610351366004611560565b6106f9565b34801561036257600080fd5b5061014261037136600461144c565b610760565b34801561038257600080fd5b5061038b6107e6565b60405161016191906115f1565b3480156103a457600080fd5b506103cb6103b3366004611604565b60036020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610161565b3480156103ec57600080fd5b506101426103fb36600461161f565b610874565b34801561040c57600080fd5b5061014261041b36600461144c565b6108f2565b61014261042e3660046116f4565b61096b565b34801561043f57600080fd5b5061045361044e366004611784565b610a89565b6040519015158152602001610161565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031633146104b3576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b602087018035906104cd906104c8908a6114b3565b610abf565b1461050b576104df60208801886114b3565b60405163309afaf360e21b815263ffffffff9091166004820152602088013560248201526044016104aa565b61051a87878787878787610b01565b50505050505050565b61052b610c31565b6001600160a01b0381166105935760405162461bcd60e51b815260206004820152602960248201527f4c617965725a65726f48616e646c653a746f2043616e6e6f74206265207a65726044820152686f206164647265737360b81b60648201526084016104aa565b600454604080516001600160a01b03928316815291831660208301527fae84ea74f4d2692b42e7031d5db858b7a9b476c33344e3aefae6b1a185687d95910160405180910390a1600480546001600160a01b0319166001600160a01b0392909216919091179055565b610604610c31565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b91015b60405180910390a15050565b6000806106d961066988610c8b565b87878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201829052509250610cf4915050565b51979650505050505050565b6106ed610c31565b6106f76000610dd7565b565b610701610c31565b8061074e5760405162461bcd60e51b815260206004820152601d60248201527f4c617965725a65726f48616e646c653a696e76616c6964206c6162656c00000060448201526064016104aa565b600561075b828483611822565b505050565b610768610c31565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b1580156107cb57600080fd5b505af11580156107df573d6000803e3d6000fd5b5050505050565b600580546107f3906117a0565b80601f016020809104026020016040519081016040528092919081815260200182805461081f906117a0565b801561086c5780601f106108415761010080835404028352916020019161086c565b820191906000526020600020905b81548152906001019060200180831161084f57829003601f168201915b505050505081565b61087c610c31565b61ffff82166000818152600360209081526040808320805463ffffffff191663ffffffff87169081179091558084526002835292819020805461ffff1916851790558051938452908301919091527f971cbe55087b02ba556dd46343dc89b9f8504896ff90b7841c2cebaf709d2759910161064e565b6108fa610c31565b6001600160a01b03811661095f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104aa565b61096881610dd7565b50565b6004546001600160a01b031633146109d15760405162461bcd60e51b8152602060048201526024808201527f4c617965725a65726f48616e646c653a6e6f742061207472757374656420736f6044820152637572636560e01b60648201526084016104aa565b60006109dc86610c8b565b90506000610a028287866040518060400160405280888152602001600081525089610e27565b90506000610a0f83610abf565b60208084015189518a8301206040805163ffffffff891681526001600160a01b0386169481018590529081019190915292935090916001600160401b03909116907f43c60a8487238bbcef828a1bb6bfdec05c6c05caa475af9d090f7eb155d0a196906060015b60405180910390a2505050505050505050565b6000602082018035906001908390610aa190866114b3565b63ffffffff1681526020810191909152604001600020541492915050565b63ffffffff811660009081526001602052604081205480610afb5760405163f6ff4fb760e01b815263ffffffff841660048201526024016104aa565b92915050565b6000610b136104c860208a018a6114b3565b6004549091506001600160a01b0380831691166303c9e62e610b40610b3b60208d018d6114b3565b610f32565b83610b5160608e0160408f016118f6565b8b8b6040518663ffffffff1660e01b8152600401610b73959493929190611913565b600060405180830381600087803b158015610b8d57600080fd5b505af1158015610ba1573d6000803e3d6000fd5b50610bb69250505060608a0160408b016118f6565b6001600160401b03167f604b0582761a3df5828af47dbd17bf839299be7d6b72f7dd1e8d45f7a2eb6f45610bed60208c018c6114b3565b838a8a604051610bfe92919061196e565b6040805191829003822063ffffffff90941682526001600160a01b03909216602082015290810191909152606001610a76565b6000546001600160a01b031633146106f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104aa565b61ffff811660009081526003602052604081205463ffffffff16808203610afb5760405162461bcd60e51b815260206004820181905260248201527f4c617965725a65726f48616e646c653a20696e76616c696420636861696e496460448201526064016104aa565b60408051808201909152600080825260208201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc28c586040518060a001604052808863ffffffff168152602001610d5789610abf565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b8152600401610d8c92919061197e565b6040805180830381865afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190611a45565b90505b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e2f6112f1565b6000610e3e8460000151610f9b565b602085015190915015610e5857610e588460200151610fc3565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632637a450826040518060a001604052808b63ffffffff168152602001610ea88c610abf565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401610ee492919061197e565b60806040518083038185885af1158015610f02573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f279190611a61565b979650505050505050565b63ffffffff811660009081526002602052604081205461ffff16808203610afb5760405162461bcd60e51b815260206004820181905260248201527f4c617965725a65726f48616e646c653a20696e76616c696420636861696e496460448201526064016104aa565b6000813414610fbf576040516304fb820960e51b81523460048201526024016104aa565b5090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015611023573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110479190611ac8565b90506001600160a01b038116611070576040516329b99a9560e11b815260040160405180910390fd5b6110a56001600160a01b038216337f0000000000000000000000000000000000000000000000000000000000000000856110a9565b5050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611103908590611109565b50505050565b600061115e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111de9092919063ffffffff16565b905080516000148061117f57508080602001905181019061117f9190611ae5565b61075b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104aa565b6060610dcf848460008585600080866001600160a01b031685876040516112059190611b07565b60006040518083038185875af1925050503d8060008114611242576040519150601f19603f3d011682016040523d82523d6000602084013e611247565b606091505b5091509150610f2787838387606083156112c25782516000036112bb576001600160a01b0385163b6112bb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104aa565b5081610dcf565b610dcf83838151156112d75781518083602001fd5b8060405162461bcd60e51b81526004016104aa91906115f1565b60405180606001604052806000801916815260200160006001600160401b03168152602001611333604051806040016040528060008152602001600081525090565b905290565b60006060828403121561134a57600080fd5b50919050565b60008083601f84011261136257600080fd5b5081356001600160401b0381111561137957600080fd5b60208301915083602082850101111561139157600080fd5b9250929050565b6001600160a01b038116811461096857600080fd5b600080600080600080600060e0888a0312156113c857600080fd5b6113d28989611338565b96506060880135955060808801356001600160401b03808211156113f557600080fd5b6114018b838c01611350565b909750955060a08a0135915061141682611398565b90935060c0890135908082111561142c57600080fd5b506114398a828b01611350565b989b979a50959850939692959293505050565b60006020828403121561145e57600080fd5b813561146981611398565b9392505050565b803563ffffffff8116811461148457600080fd5b919050565b6000806040838503121561149c57600080fd5b6114a583611470565b946020939093013593505050565b6000602082840312156114c557600080fd5b61146982611470565b803561ffff8116811461148457600080fd5b6000806000806000606086880312156114f857600080fd5b611501866114ce565b945060208601356001600160401b038082111561151d57600080fd5b61152989838a01611350565b9096509450604088013591508082111561154257600080fd5b5061154f88828901611350565b969995985093965092949392505050565b6000806020838503121561157357600080fd5b82356001600160401b0381111561158957600080fd5b61159585828601611350565b90969095509350505050565b60005b838110156115bc5781810151838201526020016115a4565b50506000910152565b600081518084526115dd8160208601602086016115a1565b601f01601f19169290920160200192915050565b60208152600061146960208301846115c5565b60006020828403121561161657600080fd5b611469826114ce565b6000806040838503121561163257600080fd5b61163b836114ce565b915061164960208401611470565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261167957600080fd5b81356001600160401b038082111561169357611693611652565b604051601f8301601f19908116603f011681019082821181831017156116bb576116bb611652565b816040528381528660208588010111156116d457600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060a0868803121561170c57600080fd5b611715866114ce565b945060208601356001600160401b038082111561173157600080fd5b61173d89838a01611668565b95506040880135915061174f82611398565b9093506060870135908082111561176557600080fd5b5061177288828901611668565b95989497509295608001359392505050565b60006060828403121561179657600080fd5b6114698383611338565b600181811c908216806117b457607f821691505b60208210810361134a57634e487b7160e01b600052602260045260246000fd5b601f82111561075b57600081815260208120601f850160051c810160208610156117fb5750805b601f850160051c820191505b8181101561181a57828155600101611807565b505050505050565b6001600160401b0383111561183957611839611652565b61184d8361184783546117a0565b836117d4565b6000601f84116001811461188157600085156118695750838201355b600019600387901b1c1916600186901b1783556107df565b600083815260209020601f19861690835b828110156118b25786850135825560209485019460019092019101611892565b50868210156118cf5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160401b038116811461096857600080fd5b60006020828403121561190857600080fd5b8135611469816118e1565b61ffff861681526001600160a01b03851660208201526001600160401b03841660408201526080606082018190528101829052818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b8183823760009101908152919050565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a060808401526119b460e08401826115c5565b90506060850151603f198483030160a08501526119d182826115c5565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b600060408284031215611a0957600080fd5b604051604081018181106001600160401b0382111715611a2b57611a2b611652565b604052825181526020928301519281019290925250919050565b600060408284031215611a5757600080fd5b61146983836119f7565b600060808284031215611a7357600080fd5b604051606081018181106001600160401b0382111715611a9557611a95611652565b604052825181526020830151611aaa816118e1565b6020820152611abc84604085016119f7565b60408201529392505050565b600060208284031215611ada57600080fd5b815161146981611398565b600060208284031215611af757600080fd5b8151801515811461146957600080fd5b60008251611b198184602087016115a1565b919091019291505056fea26469706673582212201559eae8d37a0d4074f3947399f78fabbf65fa36f2c899c08d04f39b3f341d8a64736f6c63430008140033000000000000000000000000515b7c9d166cb1f0356966e1831e5b6695de53020000000000000000000000001a44076050125825900e736c501f859c50fe728c000000000000000000000000000000000000000000000000000000000000006000000000000000000000000000000000000000000000000000000000000000106c30427269646765563248616e646c6500000000000000000000000000000000
Deployed Bytecode
0x60806040526004361061012a5760003560e01c8063acac2b54116100ab578063cb4774c41161006f578063cb4774c414610376578063cd89600614610398578063d9e98998146103e0578063f2fde38b14610400578063f4a6c3e614610420578063ff7bd03d1461043357600080fd5b8063acac2b54146102d6578063b92d0eff146102f6578063bb0b6a5314610309578063bf53096914610336578063ca5eb5e11461035657600080fd5b806345e380a3116100f257806345e380a3146101ee5780635e280f111461021c578063715018a6146102685780637d25a05e1461027d5780638da5cb5b146102b857600080fd5b806313137d651461012f57806317442b701461014457806332eab36a1461016a5780633400288b1461018a5780633de46aee146101aa575b600080fd5b61014261013d3660046113ad565b610463565b005b34801561015057600080fd5b506040805160018082526020820152015b60405180910390f35b34801561017657600080fd5b5061014261018536600461144c565b610523565b34801561019657600080fd5b506101426101a5366004611489565b6105fc565b3480156101b657600080fd5b506101db6101c53660046114b3565b60026020526000908152604090205461ffff1681565b60405161ffff9091168152602001610161565b3480156101fa57600080fd5b5061020e6102093660046114e0565b61065a565b604051908152602001610161565b34801561022857600080fd5b506102507f0000000000000000000000001a44076050125825900e736c501f859c50fe728c81565b6040516001600160a01b039091168152602001610161565b34801561027457600080fd5b506101426106e5565b34801561028957600080fd5b506102a0610298366004611489565b600092915050565b6040516001600160401b039091168152602001610161565b3480156102c457600080fd5b506000546001600160a01b0316610250565b3480156102e257600080fd5b50600454610250906001600160a01b031681565b34801561030257600080fd5b5030610250565b34801561031557600080fd5b5061020e6103243660046114b3565b60016020526000908152604090205481565b34801561034257600080fd5b50610142610351366004611560565b6106f9565b34801561036257600080fd5b5061014261037136600461144c565b610760565b34801561038257600080fd5b5061038b6107e6565b60405161016191906115f1565b3480156103a457600080fd5b506103cb6103b3366004611604565b60036020526000908152604090205463ffffffff1681565b60405163ffffffff9091168152602001610161565b3480156103ec57600080fd5b506101426103fb36600461161f565b610874565b34801561040c57600080fd5b5061014261041b36600461144c565b6108f2565b61014261042e3660046116f4565b61096b565b34801561043f57600080fd5b5061045361044e366004611784565b610a89565b6040519015158152602001610161565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031633146104b3576040516391ac5e4f60e01b81523360048201526024015b60405180910390fd5b602087018035906104cd906104c8908a6114b3565b610abf565b1461050b576104df60208801886114b3565b60405163309afaf360e21b815263ffffffff9091166004820152602088013560248201526044016104aa565b61051a87878787878787610b01565b50505050505050565b61052b610c31565b6001600160a01b0381166105935760405162461bcd60e51b815260206004820152602960248201527f4c617965725a65726f48616e646c653a746f2043616e6e6f74206265207a65726044820152686f206164647265737360b81b60648201526084016104aa565b600454604080516001600160a01b03928316815291831660208301527fae84ea74f4d2692b42e7031d5db858b7a9b476c33344e3aefae6b1a185687d95910160405180910390a1600480546001600160a01b0319166001600160a01b0392909216919091179055565b610604610c31565b63ffffffff8216600081815260016020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b91015b60405180910390a15050565b6000806106d961066988610c8b565b87878080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8b01819004810282018101909252898152925089915088908190840183828082843760009201829052509250610cf4915050565b51979650505050505050565b6106ed610c31565b6106f76000610dd7565b565b610701610c31565b8061074e5760405162461bcd60e51b815260206004820152601d60248201527f4c617965725a65726f48616e646c653a696e76616c6964206c6162656c00000060448201526064016104aa565b600561075b828483611822565b505050565b610768610c31565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c169063ca5eb5e190602401600060405180830381600087803b1580156107cb57600080fd5b505af11580156107df573d6000803e3d6000fd5b5050505050565b600580546107f3906117a0565b80601f016020809104026020016040519081016040528092919081815260200182805461081f906117a0565b801561086c5780601f106108415761010080835404028352916020019161086c565b820191906000526020600020905b81548152906001019060200180831161084f57829003601f168201915b505050505081565b61087c610c31565b61ffff82166000818152600360209081526040808320805463ffffffff191663ffffffff87169081179091558084526002835292819020805461ffff1916851790558051938452908301919091527f971cbe55087b02ba556dd46343dc89b9f8504896ff90b7841c2cebaf709d2759910161064e565b6108fa610c31565b6001600160a01b03811661095f5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b60648201526084016104aa565b61096881610dd7565b50565b6004546001600160a01b031633146109d15760405162461bcd60e51b8152602060048201526024808201527f4c617965725a65726f48616e646c653a6e6f742061207472757374656420736f6044820152637572636560e01b60648201526084016104aa565b60006109dc86610c8b565b90506000610a028287866040518060400160405280888152602001600081525089610e27565b90506000610a0f83610abf565b60208084015189518a8301206040805163ffffffff891681526001600160a01b0386169481018590529081019190915292935090916001600160401b03909116907f43c60a8487238bbcef828a1bb6bfdec05c6c05caa475af9d090f7eb155d0a196906060015b60405180910390a2505050505050505050565b6000602082018035906001908390610aa190866114b3565b63ffffffff1681526020810191909152604001600020541492915050565b63ffffffff811660009081526001602052604081205480610afb5760405163f6ff4fb760e01b815263ffffffff841660048201526024016104aa565b92915050565b6000610b136104c860208a018a6114b3565b6004549091506001600160a01b0380831691166303c9e62e610b40610b3b60208d018d6114b3565b610f32565b83610b5160608e0160408f016118f6565b8b8b6040518663ffffffff1660e01b8152600401610b73959493929190611913565b600060405180830381600087803b158015610b8d57600080fd5b505af1158015610ba1573d6000803e3d6000fd5b50610bb69250505060608a0160408b016118f6565b6001600160401b03167f604b0582761a3df5828af47dbd17bf839299be7d6b72f7dd1e8d45f7a2eb6f45610bed60208c018c6114b3565b838a8a604051610bfe92919061196e565b6040805191829003822063ffffffff90941682526001600160a01b03909216602082015290810191909152606001610a76565b6000546001600160a01b031633146106f75760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e657260448201526064016104aa565b61ffff811660009081526003602052604081205463ffffffff16808203610afb5760405162461bcd60e51b815260206004820181905260248201527f4c617965725a65726f48616e646c653a20696e76616c696420636861696e496460448201526064016104aa565b60408051808201909152600080825260208201527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663ddc28c586040518060a001604052808863ffffffff168152602001610d5789610abf565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b8152600401610d8c92919061197e565b6040805180830381865afa158015610da8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610dcc9190611a45565b90505b949350505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b610e2f6112f1565b6000610e3e8460000151610f9b565b602085015190915015610e5857610e588460200151610fc3565b7f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b0316632637a450826040518060a001604052808b63ffffffff168152602001610ea88c610abf565b81526020018a815260200189815260200160008960200151111515815250866040518463ffffffff1660e01b8152600401610ee492919061197e565b60806040518083038185885af1158015610f02573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610f279190611a61565b979650505050505050565b63ffffffff811660009081526002602052604081205461ffff16808203610afb5760405162461bcd60e51b815260206004820181905260248201527f4c617965725a65726f48616e646c653a20696e76616c696420636861696e496460448201526064016104aa565b6000813414610fbf576040516304fb820960e51b81523460048201526024016104aa565b5090565b60007f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663e4fe1d946040518163ffffffff1660e01b8152600401602060405180830381865afa158015611023573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110479190611ac8565b90506001600160a01b038116611070576040516329b99a9560e11b815260040160405180910390fd5b6110a56001600160a01b038216337f0000000000000000000000001a44076050125825900e736c501f859c50fe728c856110a9565b5050565b604080516001600160a01b0385811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180516001600160e01b03166323b872dd60e01b179052611103908590611109565b50505050565b600061115e826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166111de9092919063ffffffff16565b905080516000148061117f57508080602001905181019061117f9190611ae5565b61075b5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b60648201526084016104aa565b6060610dcf848460008585600080866001600160a01b031685876040516112059190611b07565b60006040518083038185875af1925050503d8060008114611242576040519150601f19603f3d011682016040523d82523d6000602084013e611247565b606091505b5091509150610f2787838387606083156112c25782516000036112bb576001600160a01b0385163b6112bb5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016104aa565b5081610dcf565b610dcf83838151156112d75781518083602001fd5b8060405162461bcd60e51b81526004016104aa91906115f1565b60405180606001604052806000801916815260200160006001600160401b03168152602001611333604051806040016040528060008152602001600081525090565b905290565b60006060828403121561134a57600080fd5b50919050565b60008083601f84011261136257600080fd5b5081356001600160401b0381111561137957600080fd5b60208301915083602082850101111561139157600080fd5b9250929050565b6001600160a01b038116811461096857600080fd5b600080600080600080600060e0888a0312156113c857600080fd5b6113d28989611338565b96506060880135955060808801356001600160401b03808211156113f557600080fd5b6114018b838c01611350565b909750955060a08a0135915061141682611398565b90935060c0890135908082111561142c57600080fd5b506114398a828b01611350565b989b979a50959850939692959293505050565b60006020828403121561145e57600080fd5b813561146981611398565b9392505050565b803563ffffffff8116811461148457600080fd5b919050565b6000806040838503121561149c57600080fd5b6114a583611470565b946020939093013593505050565b6000602082840312156114c557600080fd5b61146982611470565b803561ffff8116811461148457600080fd5b6000806000806000606086880312156114f857600080fd5b611501866114ce565b945060208601356001600160401b038082111561151d57600080fd5b61152989838a01611350565b9096509450604088013591508082111561154257600080fd5b5061154f88828901611350565b969995985093965092949392505050565b6000806020838503121561157357600080fd5b82356001600160401b0381111561158957600080fd5b61159585828601611350565b90969095509350505050565b60005b838110156115bc5781810151838201526020016115a4565b50506000910152565b600081518084526115dd8160208601602086016115a1565b601f01601f19169290920160200192915050565b60208152600061146960208301846115c5565b60006020828403121561161657600080fd5b611469826114ce565b6000806040838503121561163257600080fd5b61163b836114ce565b915061164960208401611470565b90509250929050565b634e487b7160e01b600052604160045260246000fd5b600082601f83011261167957600080fd5b81356001600160401b038082111561169357611693611652565b604051601f8301601f19908116603f011681019082821181831017156116bb576116bb611652565b816040528381528660208588010111156116d457600080fd5b836020870160208301376000602085830101528094505050505092915050565b600080600080600060a0868803121561170c57600080fd5b611715866114ce565b945060208601356001600160401b038082111561173157600080fd5b61173d89838a01611668565b95506040880135915061174f82611398565b9093506060870135908082111561176557600080fd5b5061177288828901611668565b95989497509295608001359392505050565b60006060828403121561179657600080fd5b6114698383611338565b600181811c908216806117b457607f821691505b60208210810361134a57634e487b7160e01b600052602260045260246000fd5b601f82111561075b57600081815260208120601f850160051c810160208610156117fb5750805b601f850160051c820191505b8181101561181a57828155600101611807565b505050505050565b6001600160401b0383111561183957611839611652565b61184d8361184783546117a0565b836117d4565b6000601f84116001811461188157600085156118695750838201355b600019600387901b1c1916600186901b1783556107df565b600083815260209020601f19861690835b828110156118b25786850135825560209485019460019092019101611892565b50868210156118cf5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6001600160401b038116811461096857600080fd5b60006020828403121561190857600080fd5b8135611469816118e1565b61ffff861681526001600160a01b03851660208201526001600160401b03841660408201526080606082018190528101829052818360a0830137600081830160a090810191909152601f909201601f19160101949350505050565b8183823760009101908152919050565b6040815263ffffffff8351166040820152602083015160608201526000604084015160a060808401526119b460e08401826115c5565b90506060850151603f198483030160a08501526119d182826115c5565b60809690960151151560c08501525050506001600160a01b039190911660209091015290565b600060408284031215611a0957600080fd5b604051604081018181106001600160401b0382111715611a2b57611a2b611652565b604052825181526020928301519281019290925250919050565b600060408284031215611a5757600080fd5b61146983836119f7565b600060808284031215611a7357600080fd5b604051606081018181106001600160401b0382111715611a9557611a95611652565b604052825181526020830151611aaa816118e1565b6020820152611abc84604085016119f7565b60408201529392505050565b600060208284031215611ada57600080fd5b815161146981611398565b600060208284031215611af757600080fd5b8151801515811461146957600080fd5b60008251611b198184602087016115a1565b919091019291505056fea26469706673582212201559eae8d37a0d4074f3947399f78fabbf65fa36f2c899c08d04f39b3f341d8a64736f6c63430008140033
Loading...
Loading
Loading...
Loading
Loading...
Loading
Net Worth in USD
$0.00
Net Worth in GLMR
Multichain Portfolio | 35 Chains
| Chain | Token | Portfolio % | Price | Amount | Value |
|---|
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.