Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
Value | ||||
---|---|---|---|---|---|---|---|---|---|
0x60806040 | 19767077 | 66 days ago | IN | Create: MsgSendEndpointUpg | 0 ETH | 0.01566978 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
MsgSendEndpointUpg
Compiler Version
v0.8.23+commit.f704f362
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.23; import { IPMsgSendEndpoint } from "../interfaces/ICrossChainMsg/IPMsgSendEndpoint.sol"; import { ILayerZeroEndpoint } from "../interfaces/ICrossChainMsg/ILayerZeroEndpoint.sol"; import { LayerZeroHelper } from "./libraries/LayerZeroHelper.sol"; import { Errors } from "../libraries/Errors.sol"; import { OwnableUpgradeable, Initializable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import { EnumerableMap } from "@openzeppelin/contracts/utils/structs/EnumerableMap.sol"; /** * @dev Initially, currently we will use layer zero's default send and receive version (which is most updated) * So we can leave the configuration unset. */ ///@custom:oz-upgrades-unsafe-allow state-variable-immutable contract MsgSendEndpointUpg is IPMsgSendEndpoint, Initializable, OwnableUpgradeable { using EnumerableMap for EnumerableMap.UintToAddressMap; address payable public refundAddress; ILayerZeroEndpoint public lzEndpoint; EnumerableMap.UintToAddressMap internal receiveEndpoints; mapping(uint256 => uint16) public chainIdToLzChainId; mapping(address => bool) public isWhitelisted; uint256[50] private __gap; event ReceiveEndpointAdded(uint256 chainId, address addr); event whitelistUpdated(address addr, bool status); event SendVersionUpdated(uint16 newVersion); modifier onlyWhitelisted() { if (!isWhitelisted[msg.sender]) revert Errors.OnlyWhitelisted(); _; } /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } function initialize(address _refundAddress, ILayerZeroEndpoint _lzEndpoint) external initializer { if (_refundAddress == address(0)) revert Errors.ZeroAddress(); if (address(_lzEndpoint) == address(0)) revert Errors.ZeroAddress(); refundAddress = payable(_refundAddress); lzEndpoint = _lzEndpoint; chainIdToLzChainId[1] = 101; chainIdToLzChainId[42161] = 110; chainIdToLzChainId[34443] = 260; chainIdToLzChainId[8453] = 184; chainIdToLzChainId[238] = 243; chainIdToLzChainId[5000] = 181; chainIdToLzChainId[10] = 111; __Ownable_init(msg.sender); } function setLayerZeroChainId(uint256 chainId, uint16 lzChainId) external onlyOwner { chainIdToLzChainId[chainId] = lzChainId; } function setLzEndpoint(ILayerZeroEndpoint _lzEndpoint) external onlyOwner { lzEndpoint = _lzEndpoint; } function calcFee( address dstAddress, uint256 dstChainId, bytes memory payload, uint256 estimatedGasAmount ) external view returns (uint256 fee) { (fee, ) = lzEndpoint.estimateFees( chainIdToLzChainId[dstChainId], receiveEndpoints.get(dstChainId), abi.encode(dstAddress, payload), false, _getAdapterParams(estimatedGasAmount) ); } function sendMessage( address dstAddress, uint256 dstChainId, bytes calldata payload, uint256 estimatedGasAmount ) external payable onlyWhitelisted { if (chainIdToLzChainId[dstChainId] == 0) revert Errors.LzChainIdNotSet(dstChainId); bytes memory path = abi.encodePacked(receiveEndpoints.get(dstChainId), address(this)); lzEndpoint.send{ value: msg.value }( chainIdToLzChainId[dstChainId], path, abi.encode(dstAddress, payload), refundAddress, address(0), _getAdapterParams(estimatedGasAmount) ); } function addReceiveEndpoints(address endpointAddr, uint256 endpointChainId) external payable onlyOwner { receiveEndpoints.set(endpointChainId, endpointAddr); emit ReceiveEndpointAdded(endpointChainId, endpointAddr); } function setWhitelisted(address addr, bool status) external onlyOwner { isWhitelisted[addr] = status; emit whitelistUpdated(addr, status); } function setLzSendVersion(uint16 _newVersion) external onlyOwner { ILayerZeroEndpoint(lzEndpoint).setSendVersion(_newVersion); emit SendVersionUpdated(_newVersion); } function getAllReceiveEndpoints() external view returns (uint256[] memory chainIds, address[] memory addrs) { uint256 length = receiveEndpoints.length(); chainIds = new uint256[](length); addrs = new address[](length); for (uint256 i = 0; i < length; ++i) { (chainIds[i], addrs[i]) = receiveEndpoints.at(i); } } function _getAdapterParams(uint256 estimatedGasAmount) internal pure returns (bytes memory adapterParams) { // this is more like "type" rather than version // It is the type of adapter params you want to pass to relayer adapterParams = abi.encodePacked(uint16(1), estimatedGasAmount); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {ContextUpgradeable} from "../utils/ContextUpgradeable.sol"; import {Initializable} from "../proxy/utils/Initializable.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. * * The initial owner is set to the address provided by the deployer. 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 OwnableUpgradeable is Initializable, ContextUpgradeable { /// @custom:storage-location erc7201:openzeppelin.storage.Ownable struct OwnableStorage { address _owner; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Ownable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant OwnableStorageLocation = 0x9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300; function _getOwnableStorage() private pure returns (OwnableStorage storage $) { assembly { $.slot := OwnableStorageLocation } } /** * @dev The caller account is not authorized to perform an operation. */ error OwnableUnauthorizedAccount(address account); /** * @dev The owner is not a valid owner account. (eg. `address(0)`) */ error OwnableInvalidOwner(address owner); event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the address provided by the deployer as the initial owner. */ function __Ownable_init(address initialOwner) internal onlyInitializing { __Ownable_init_unchained(initialOwner); } function __Ownable_init_unchained(address initialOwner) internal onlyInitializing { if (initialOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(initialOwner); } /** * @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) { OwnableStorage storage $ = _getOwnableStorage(); return $._owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { if (owner() != _msgSender()) { revert OwnableUnauthorizedAccount(_msgSender()); } } /** * @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 { if (newOwner == address(0)) { revert OwnableInvalidOwner(address(0)); } _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { OwnableStorage storage $ = _getOwnableStorage(); address oldOwner = $._owner; $._owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (proxy/utils/Initializable.sol) pragma solidity ^0.8.20; /** * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect. * * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in * case an upgrade adds a module that needs to be initialized. * * For example: * * [.hljs-theme-light.nopadding] * ```solidity * contract MyToken is ERC20Upgradeable { * function initialize() initializer public { * __ERC20_init("MyToken", "MTK"); * } * } * * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable { * function initializeV2() reinitializer(2) public { * __ERC20Permit_init("MyToken"); * } * } * ``` * * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}. * * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity. * * [CAUTION] * ==== * Avoid leaving a contract uninitialized. * * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed: * * [.hljs-theme-light.nopadding] * ``` * /// @custom:oz-upgrades-unsafe-allow constructor * constructor() { * _disableInitializers(); * } * ``` * ==== */ abstract contract Initializable { /** * @dev Storage of the initializable contract. * * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions * when using with upgradeable contracts. * * @custom:storage-location erc7201:openzeppelin.storage.Initializable */ struct InitializableStorage { /** * @dev Indicates that the contract has been initialized. */ uint64 _initialized; /** * @dev Indicates that the contract is in the process of being initialized. */ bool _initializing; } // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff)) bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00; /** * @dev The contract is already initialized. */ error InvalidInitialization(); /** * @dev The contract is not initializing. */ error NotInitializing(); /** * @dev Triggered when the contract has been initialized or reinitialized. */ event Initialized(uint64 version); /** * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope, * `onlyInitializing` functions can be used to initialize parent contracts. * * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in * production. * * Emits an {Initialized} event. */ modifier initializer() { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); // Cache values to avoid duplicated sloads bool isTopLevelCall = !$._initializing; uint64 initialized = $._initialized; // Allowed calls: // - initialSetup: the contract is not in the initializing state and no previous version was // initialized // - construction: the contract is initialized at version 1 (no reininitialization) and the // current contract is just being deployed bool initialSetup = initialized == 0 && isTopLevelCall; bool construction = initialized == 1 && address(this).code.length == 0; if (!initialSetup && !construction) { revert InvalidInitialization(); } $._initialized = 1; if (isTopLevelCall) { $._initializing = true; } _; if (isTopLevelCall) { $._initializing = false; emit Initialized(1); } } /** * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be * used to initialize parent contracts. * * A reinitializer may be used after the original initialization step. This is essential to configure modules that * are added through upgrades and that require initialization. * * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer` * cannot be nested. If one is invoked in the context of another, execution will revert. * * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in * a contract, executing them in the right order is up to the developer or operator. * * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization. * * Emits an {Initialized} event. */ modifier reinitializer(uint64 version) { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing || $._initialized >= version) { revert InvalidInitialization(); } $._initialized = version; $._initializing = true; _; $._initializing = false; emit Initialized(version); } /** * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the * {initializer} and {reinitializer} modifiers, directly or indirectly. */ modifier onlyInitializing() { _checkInitializing(); _; } /** * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}. */ function _checkInitializing() internal view virtual { if (!_isInitializing()) { revert NotInitializing(); } } /** * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call. * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized * to any version. It is recommended to use this to lock implementation contracts that are designed to be called * through proxies. * * Emits an {Initialized} event the first time it is successfully executed. */ function _disableInitializers() internal virtual { // solhint-disable-next-line var-name-mixedcase InitializableStorage storage $ = _getInitializableStorage(); if ($._initializing) { revert InvalidInitialization(); } if ($._initialized != type(uint64).max) { $._initialized = type(uint64).max; emit Initialized(type(uint64).max); } } /** * @dev Returns the highest version that has been initialized. See {reinitializer}. */ function _getInitializedVersion() internal view returns (uint64) { return _getInitializableStorage()._initialized; } /** * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}. */ function _isInitializing() internal view returns (bool) { return _getInitializableStorage()._initializing; } /** * @dev Returns a pointer to the storage namespace. */ // solhint-disable-next-line var-name-mixedcase function _getInitializableStorage() private pure returns (InitializableStorage storage $) { assembly { $.slot := INITIALIZABLE_STORAGE } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; import {Initializable} from "../proxy/utils/Initializable.sol"; /** * @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 ContextUpgradeable is Initializable { function __Context_init() internal onlyInitializing { } function __Context_init_unchained() internal onlyInitializing { } 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 // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableMap.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableMap.js. pragma solidity ^0.8.20; import {EnumerableSet} from "./EnumerableSet.sol"; /** * @dev Library for managing an enumerable variant of Solidity's * https://solidity.readthedocs.io/en/latest/types.html#mapping-types[`mapping`] * type. * * Maps have the following properties: * * - Entries are added, removed, and checked for existence in constant time * (O(1)). * - Entries are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableMap for EnumerableMap.UintToAddressMap; * * // Declare a set state variable * EnumerableMap.UintToAddressMap private myMap; * } * ``` * * The following map types are supported: * * - `uint256 -> address` (`UintToAddressMap`) since v3.0.0 * - `address -> uint256` (`AddressToUintMap`) since v4.6.0 * - `bytes32 -> bytes32` (`Bytes32ToBytes32Map`) since v4.6.0 * - `uint256 -> uint256` (`UintToUintMap`) since v4.7.0 * - `bytes32 -> uint256` (`Bytes32ToUintMap`) since v4.7.0 * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableMap, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableMap. * ==== */ library EnumerableMap { using EnumerableSet for EnumerableSet.Bytes32Set; // To implement this library for multiple types with as little code repetition as possible, we write it in // terms of a generic Map type with bytes32 keys and values. The Map implementation uses private functions, // and user-facing implementations such as `UintToAddressMap` are just wrappers around the underlying Map. // This means that we can only create new EnumerableMaps for types that fit in bytes32. /** * @dev Query for a nonexistent map key. */ error EnumerableMapNonexistentKey(bytes32 key); struct Bytes32ToBytes32Map { // Storage of keys EnumerableSet.Bytes32Set _keys; mapping(bytes32 key => bytes32) _values; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToBytes32Map storage map, bytes32 key, bytes32 value) internal returns (bool) { map._values[key] = value; return map._keys.add(key); } /** * @dev Removes a key-value pair from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToBytes32Map storage map, bytes32 key) internal returns (bool) { delete map._values[key]; return map._keys.remove(key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool) { return map._keys.contains(key); } /** * @dev Returns the number of key-value pairs in the map. O(1). */ function length(Bytes32ToBytes32Map storage map) internal view returns (uint256) { return map._keys.length(); } /** * @dev Returns the key-value pair stored at position `index` in the map. O(1). * * Note that there are no guarantees on the ordering of entries inside the * array, and it may change when more entries are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToBytes32Map storage map, uint256 index) internal view returns (bytes32, bytes32) { bytes32 key = map._keys.at(index); return (key, map._values[key]); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bool, bytes32) { bytes32 value = map._values[key]; if (value == bytes32(0)) { return (contains(map, key), bytes32(0)); } else { return (true, value); } } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToBytes32Map storage map, bytes32 key) internal view returns (bytes32) { bytes32 value = map._values[key]; if (value == 0 && !contains(map, key)) { revert EnumerableMapNonexistentKey(key); } return value; } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToBytes32Map storage map) internal view returns (bytes32[] memory) { return map._keys.values(); } // UintToUintMap struct UintToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToUintMap storage map, uint256 key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToUintMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToUintMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToUintMap storage map, uint256 index) internal view returns (uint256, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToUintMap storage map, uint256 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToUintMap storage map, uint256 key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(key))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToUintMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintToAddressMap struct UintToAddressMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(UintToAddressMap storage map, uint256 key, address value) internal returns (bool) { return set(map._inner, bytes32(key), bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(UintToAddressMap storage map, uint256 key) internal returns (bool) { return remove(map._inner, bytes32(key)); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(UintToAddressMap storage map, uint256 key) internal view returns (bool) { return contains(map._inner, bytes32(key)); } /** * @dev Returns the number of elements in the map. O(1). */ function length(UintToAddressMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintToAddressMap storage map, uint256 index) internal view returns (uint256, address) { (bytes32 key, bytes32 value) = at(map._inner, index); return (uint256(key), address(uint160(uint256(value)))); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(UintToAddressMap storage map, uint256 key) internal view returns (bool, address) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(key)); return (success, address(uint160(uint256(value)))); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(UintToAddressMap storage map, uint256 key) internal view returns (address) { return address(uint160(uint256(get(map._inner, bytes32(key))))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(UintToAddressMap storage map) internal view returns (uint256[] memory) { bytes32[] memory store = keys(map._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressToUintMap struct AddressToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(AddressToUintMap storage map, address key, uint256 value) internal returns (bool) { return set(map._inner, bytes32(uint256(uint160(key))), bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(AddressToUintMap storage map, address key) internal returns (bool) { return remove(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(AddressToUintMap storage map, address key) internal view returns (bool) { return contains(map._inner, bytes32(uint256(uint160(key)))); } /** * @dev Returns the number of elements in the map. O(1). */ function length(AddressToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressToUintMap storage map, uint256 index) internal view returns (address, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (address(uint160(uint256(key))), uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(AddressToUintMap storage map, address key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, bytes32(uint256(uint160(key)))); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(AddressToUintMap storage map, address key) internal view returns (uint256) { return uint256(get(map._inner, bytes32(uint256(uint160(key))))); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(AddressToUintMap storage map) internal view returns (address[] memory) { bytes32[] memory store = keys(map._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // Bytes32ToUintMap struct Bytes32ToUintMap { Bytes32ToBytes32Map _inner; } /** * @dev Adds a key-value pair to a map, or updates the value for an existing * key. O(1). * * Returns true if the key was added to the map, that is if it was not * already present. */ function set(Bytes32ToUintMap storage map, bytes32 key, uint256 value) internal returns (bool) { return set(map._inner, key, bytes32(value)); } /** * @dev Removes a value from a map. O(1). * * Returns true if the key was removed from the map, that is if it was present. */ function remove(Bytes32ToUintMap storage map, bytes32 key) internal returns (bool) { return remove(map._inner, key); } /** * @dev Returns true if the key is in the map. O(1). */ function contains(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool) { return contains(map._inner, key); } /** * @dev Returns the number of elements in the map. O(1). */ function length(Bytes32ToUintMap storage map) internal view returns (uint256) { return length(map._inner); } /** * @dev Returns the element stored at position `index` in the map. O(1). * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32ToUintMap storage map, uint256 index) internal view returns (bytes32, uint256) { (bytes32 key, bytes32 value) = at(map._inner, index); return (key, uint256(value)); } /** * @dev Tries to returns the value associated with `key`. O(1). * Does not revert if `key` is not in the map. */ function tryGet(Bytes32ToUintMap storage map, bytes32 key) internal view returns (bool, uint256) { (bool success, bytes32 value) = tryGet(map._inner, key); return (success, uint256(value)); } /** * @dev Returns the value associated with `key`. O(1). * * Requirements: * * - `key` must be in the map. */ function get(Bytes32ToUintMap storage map, bytes32 key) internal view returns (uint256) { return uint256(get(map._inner, key)); } /** * @dev Return the an array containing all the keys * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the map grows to a point where copying to memory consumes too much gas to fit in a block. */ function keys(Bytes32ToUintMap storage map) internal view returns (bytes32[] memory) { bytes32[] memory store = keys(map._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/structs/EnumerableSet.sol) // This file was procedurally generated from scripts/generate/templates/EnumerableSet.js. pragma solidity ^0.8.20; /** * @dev Library for managing * https://en.wikipedia.org/wiki/Set_(abstract_data_type)[sets] of primitive * types. * * Sets have the following properties: * * - Elements are added, removed, and checked for existence in constant time * (O(1)). * - Elements are enumerated in O(n). No guarantees are made on the ordering. * * ```solidity * contract Example { * // Add the library methods * using EnumerableSet for EnumerableSet.AddressSet; * * // Declare a set state variable * EnumerableSet.AddressSet private mySet; * } * ``` * * As of v3.3.0, sets of type `bytes32` (`Bytes32Set`), `address` (`AddressSet`) * and `uint256` (`UintSet`) are supported. * * [WARNING] * ==== * Trying to delete such a structure from storage will likely result in data corruption, rendering the structure * unusable. * See https://github.com/ethereum/solidity/pull/11843[ethereum/solidity#11843] for more info. * * In order to clean an EnumerableSet, you can either remove all elements one by one or create a fresh instance using an * array of EnumerableSet. * ==== */ library EnumerableSet { // To implement this library for multiple types with as little code // repetition as possible, we write it in terms of a generic Set type with // bytes32 values. // The Set implementation uses private functions, and user-facing // implementations (such as AddressSet) are just wrappers around the // underlying Set. // This means that we can only create new EnumerableSets for types that fit // in bytes32. struct Set { // Storage of set values bytes32[] _values; // Position is the index of the value in the `values` array plus 1. // Position 0 is used to mean a value is not in the set. mapping(bytes32 value => uint256) _positions; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function _add(Set storage set, bytes32 value) private returns (bool) { if (!_contains(set, value)) { set._values.push(value); // The value is stored at length-1, but we add 1 to all indexes // and use 0 as a sentinel value set._positions[value] = set._values.length; return true; } else { return false; } } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function _remove(Set storage set, bytes32 value) private returns (bool) { // We cache the value's position to prevent multiple reads from the same storage slot uint256 position = set._positions[value]; if (position != 0) { // Equivalent to contains(set, value) // To delete an element from the _values array in O(1), we swap the element to delete with the last one in // the array, and then remove the last element (sometimes called as 'swap and pop'). // This modifies the order of the array, as noted in {at}. uint256 valueIndex = position - 1; uint256 lastIndex = set._values.length - 1; if (valueIndex != lastIndex) { bytes32 lastValue = set._values[lastIndex]; // Move the lastValue to the index where the value to delete is set._values[valueIndex] = lastValue; // Update the tracked position of the lastValue (that was just moved) set._positions[lastValue] = position; } // Delete the slot where the moved value was stored set._values.pop(); // Delete the tracked position for the deleted slot delete set._positions[value]; return true; } else { return false; } } /** * @dev Returns true if the value is in the set. O(1). */ function _contains(Set storage set, bytes32 value) private view returns (bool) { return set._positions[value] != 0; } /** * @dev Returns the number of values on the set. O(1). */ function _length(Set storage set) private view returns (uint256) { return set._values.length; } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function _at(Set storage set, uint256 index) private view returns (bytes32) { return set._values[index]; } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function _values(Set storage set) private view returns (bytes32[] memory) { return set._values; } // Bytes32Set struct Bytes32Set { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _add(set._inner, value); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(Bytes32Set storage set, bytes32 value) internal returns (bool) { return _remove(set._inner, value); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(Bytes32Set storage set, bytes32 value) internal view returns (bool) { return _contains(set._inner, value); } /** * @dev Returns the number of values in the set. O(1). */ function length(Bytes32Set storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(Bytes32Set storage set, uint256 index) internal view returns (bytes32) { return _at(set._inner, index); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(Bytes32Set storage set) internal view returns (bytes32[] memory) { bytes32[] memory store = _values(set._inner); bytes32[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // AddressSet struct AddressSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(AddressSet storage set, address value) internal returns (bool) { return _add(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(AddressSet storage set, address value) internal returns (bool) { return _remove(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(AddressSet storage set, address value) internal view returns (bool) { return _contains(set._inner, bytes32(uint256(uint160(value)))); } /** * @dev Returns the number of values in the set. O(1). */ function length(AddressSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(AddressSet storage set, uint256 index) internal view returns (address) { return address(uint160(uint256(_at(set._inner, index)))); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(AddressSet storage set) internal view returns (address[] memory) { bytes32[] memory store = _values(set._inner); address[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } // UintSet struct UintSet { Set _inner; } /** * @dev Add a value to a set. O(1). * * Returns true if the value was added to the set, that is if it was not * already present. */ function add(UintSet storage set, uint256 value) internal returns (bool) { return _add(set._inner, bytes32(value)); } /** * @dev Removes a value from a set. O(1). * * Returns true if the value was removed from the set, that is if it was * present. */ function remove(UintSet storage set, uint256 value) internal returns (bool) { return _remove(set._inner, bytes32(value)); } /** * @dev Returns true if the value is in the set. O(1). */ function contains(UintSet storage set, uint256 value) internal view returns (bool) { return _contains(set._inner, bytes32(value)); } /** * @dev Returns the number of values in the set. O(1). */ function length(UintSet storage set) internal view returns (uint256) { return _length(set._inner); } /** * @dev Returns the value stored at position `index` in the set. O(1). * * Note that there are no guarantees on the ordering of values inside the * array, and it may change when more values are added or removed. * * Requirements: * * - `index` must be strictly less than {length}. */ function at(UintSet storage set, uint256 index) internal view returns (uint256) { return uint256(_at(set._inner, index)); } /** * @dev Return the entire set in an array * * WARNING: This operation will copy the entire storage to memory, which can be quite expensive. This is designed * to mostly be used by view accessors that are queried without any gas fees. Developers should keep in mind that * this function has an unbounded cost, and using it as part of a state-changing function may render the function * uncallable if the set grows to a point where copying to memory consumes too much gas to fit in a block. */ function values(UintSet storage set) internal view returns (uint256[] memory) { bytes32[] memory store = _values(set._inner); uint256[] memory result; /// @solidity memory-safe-assembly assembly { result := store } return result; } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.23; library LayerZeroHelper { uint256 constant EVM_ADDRESS_SIZE = 20; function _getFirstAddressFromPath(bytes memory path) internal pure returns (address dst) { assembly { dst := mload(add(add(path, EVM_ADDRESS_SIZE), 0)) } } // function _getLayerZeroChainIds(uint256 chainId) internal pure returns (uint16) { // //mainnet // if (chainId == 1) return 101; // //arb mainnet // else if (chainId == 42161) return 110; // //mode // else if (chainId == 34443) return 260; // //Base // else if (chainId == 8453) return 184; // //Blast // else if (chainId == 238) return 243; // // mantle // else if (chainId == 5000) return 181; // // optimism // else if (chainId == 10) return 111; // // BnB Chain // else if (chainId == 56) return 102; // assert(false); // } // // function _getOriginalChainIds(uint16 chainId) internal pure returns (uint256) { // // Mainnet // if (chainId == 101) return 1; // // Arb Mainnet // else if (chainId == 110) return 42161; // // Matic // else if (chainId == 260) return 34443; // // Base // else if (chainId == 184) return 8453; // // Blast // else if (chainId == 243) return 238; // // Mantle // else if (chainId == 181) return 5000; // // Optimism // else if (chainId == 111) return 10; // // BNB Chain // else if (chainId == 102) return 56; // assert(false); // } }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.5.0; interface ILayerZeroEndpoint { // @notice send a LayerZero message to the specified address at a LayerZero endpoint. // @param _dstChainId - the destination chain identifier // @param _destination - the address on destination chain (in bytes). address length/format may vary by chains // @param _payload - a custom bytes payload to send to the destination contract // @param _refundAddress - if the source transaction is cheaper than the amount of value passed, refund the additional amount to this address // @param _zroPaymentAddress - the address of the ZRO token holder who would pay for the transaction // @param _adapterParams - parameters for custom functionality. e.g. receive airdropped native gas from the relayer on destination function send( uint16 _dstChainId, bytes calldata _destination, bytes calldata _payload, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; // @notice gets a quote in source native gas, for the amount that send() requires to pay for message delivery // @param _dstChainId - the destination chain identifier // @param _userApplication - the user app address on this EVM chain // @param _payload - the custom message to send over LayerZero // @param _payInZRO - if false, user app pays the protocol fee in native token // @param _adapterParam - parameters for the adapter service, e.g. send some dust native token to dstChain function estimateFees( uint16 _dstChainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam ) external view returns (uint256 nativeFee, uint256 zroFee); function setSendVersion(uint16 _newVersion) external; function setReceiveVersion(uint16 _newVersion) external; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity >=0.8.0; interface IPMsgSendEndpoint { function calcFee( address dstAddress, uint256 dstChainId, bytes memory payload, uint256 estimatedGasAmount ) external view returns (uint256 fee); function sendMessage( address dstAddress, uint256 dstChainId, bytes calldata payload, uint256 estimatedGasAmount ) external payable; }
// SPDX-License-Identifier: GPL-3.0-or-later pragma solidity ^0.8.23; library Errors { // Liquidity Mining error VEInvalidNewExpiry(uint256 newExpiry); error VEExceededMaxLockTime(); error VEInsufficientLockTime(); error VENotAllowedReduceExpiry(); error VEZeroAmountLocked(); error VEPositionNotExpired(); error VEZeroPosition(); error VEZeroSlope(uint128 bias, uint128 slope); error VEReceiveOldSupply(uint256 msgTime); error InvalidWTime(uint256 wTime); error ExpiryInThePast(uint256 expiry); error ChainNotSupported(uint256 chainId); error EthTransferFailed(); error UpdateInProgress(); // Cross-Chain error MsgNotFromSendEndpoint(uint16 srcChainId, bytes path); error MsgNotFromReceiveEndpoint(address sender); error InsufficientFeeToSendMsg(uint256 currentFee, uint256 requiredFee); error ApproxDstExecutionGasNotSet(); error InvalidRetryData(); // GENERIC MSG error ArrayLengthMismatch(); error ArrayEmpty(); error ArrayOutOfBounds(); error ZeroAddress(); error FailedToSendEther(); error InvalidMerkleProof(); error OnlyLayerZeroEndpoint(); error OnlyYT(); error OnlyYCFactory(); error OnlyWhitelisted(); error LzChainIdNotSet(uint256 dstChainId); }
{ "optimizer": { "enabled": true, "runs": 200 }, "evmVersion": "paris", "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "metadata": { "useLiteralContent": true }, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"key","type":"bytes32"}],"name":"EnumerableMapNonexistentKey","type":"error"},{"inputs":[],"name":"InvalidInitialization","type":"error"},{"inputs":[{"internalType":"uint256","name":"dstChainId","type":"uint256"}],"name":"LzChainIdNotSet","type":"error"},{"inputs":[],"name":"NotInitializing","type":"error"},{"inputs":[],"name":"OnlyWhitelisted","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ZeroAddress","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint64","name":"version","type":"uint64"}],"name":"Initialized","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":"uint256","name":"chainId","type":"uint256"},{"indexed":false,"internalType":"address","name":"addr","type":"address"}],"name":"ReceiveEndpointAdded","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"newVersion","type":"uint16"}],"name":"SendVersionUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"addr","type":"address"},{"indexed":false,"internalType":"bool","name":"status","type":"bool"}],"name":"whitelistUpdated","type":"event"},{"inputs":[{"internalType":"address","name":"endpointAddr","type":"address"},{"internalType":"uint256","name":"endpointChainId","type":"uint256"}],"name":"addReceiveEndpoints","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"dstAddress","type":"address"},{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"estimatedGasAmount","type":"uint256"}],"name":"calcFee","outputs":[{"internalType":"uint256","name":"fee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"chainIdToLzChainId","outputs":[{"internalType":"uint16","name":"","type":"uint16"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getAllReceiveEndpoints","outputs":[{"internalType":"uint256[]","name":"chainIds","type":"uint256[]"},{"internalType":"address[]","name":"addrs","type":"address[]"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_refundAddress","type":"address"},{"internalType":"contract ILayerZeroEndpoint","name":"_lzEndpoint","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isWhitelisted","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lzEndpoint","outputs":[{"internalType":"contract ILayerZeroEndpoint","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"refundAddress","outputs":[{"internalType":"address payable","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"dstAddress","type":"address"},{"internalType":"uint256","name":"dstChainId","type":"uint256"},{"internalType":"bytes","name":"payload","type":"bytes"},{"internalType":"uint256","name":"estimatedGasAmount","type":"uint256"}],"name":"sendMessage","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"chainId","type":"uint256"},{"internalType":"uint16","name":"lzChainId","type":"uint16"}],"name":"setLayerZeroChainId","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract ILayerZeroEndpoint","name":"_lzEndpoint","type":"address"}],"name":"setLzEndpoint","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_newVersion","type":"uint16"}],"name":"setLzSendVersion","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"addr","type":"address"},{"internalType":"bool","name":"status","type":"bool"}],"name":"setWhitelisted","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
608060405234801561001057600080fd5b5061001961001e565b6100d0565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00805468010000000000000000900460ff161561006e5760405163f92ee8a960e01b815260040160405180910390fd5b80546001600160401b03908116146100cd5780546001600160401b0319166001600160401b0390811782556040519081527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50565b611394806100df6000396000f3fe6080604052600436106100f35760003560e01c8063b21e3efb1161008a578063d9331a1111610059578063d9331a11146102e1578063f080765a14610301578063f2fde38b14610324578063f4f4d34e1461034457600080fd5b8063b21e3efb1461024a578063b2267a7b1461028e578063b353aaa7146102a1578063d35794fd146102c157600080fd5b806384fe1721116100c657806384fe1721146101ac5780638da5cb5b146101da5780639281aa0b1461021757806393bf751e1461023757600080fd5b80630cb61f6c146100f85780633af32abf14610135578063485cc95514610175578063715018a614610197575b600080fd5b34801561010457600080fd5b50600054610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610165610150366004610e93565b60066020526000908152604090205460ff1681565b604051901515815260200161012c565b34801561018157600080fd5b50610195610190366004610eb0565b610364565b005b3480156101a357600080fd5b50610195610627565b3480156101b857600080fd5b506101cc6101c7366004610eff565b61063b565b60405190815260200161012c565b3480156101e657600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610118565b34801561022357600080fd5b50610195610232366004610fd4565b610705565b610195610245366004611007565b610771565b34801561025657600080fd5b5061027b610265366004611033565b60056020526000908152604090205461ffff1681565b60405161ffff909116815260200161012c565b61019561029c36600461104c565b6107c4565b3480156102ad57600080fd5b50600154610118906001600160a01b031681565b3480156102cd57600080fd5b506101956102dc3660046110f4565b610937565b3480156102ed57600080fd5b506101956102fc366004610e93565b610963565b34801561030d57600080fd5b5061031661098d565b60405161012c929190611120565b34801561033057600080fd5b5061019561033f366004610e93565b610a93565b34801561035057600080fd5b5061019561035f3660046111a4565b610ad1565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156103aa5750825b905060008267ffffffffffffffff1660011480156103c75750303b155b9050811580156103d5575080155b156103f35760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561041d57845460ff60401b1916600160401b1785555b6001600160a01b0387166104445760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03861661046b5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b03808a166001600160a01b031992831617835560018054918a169190921617905560056020527f1471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017b805461ffff199081166065179091557f44135cd3b3b629bd4adccb5728787fdbe398bbb91c17a294e402786476e8746880548216606e1790557f1769647bd65c77e1ed526c094f1f390badad63e9ca5e41b7016a85d496a30839805482166101041790557f892999ef8486d1d8d98ca69fabdb4a0efee8d000af740b6281df4ac7f437b0d48054821660b81790557f363d3eca645461a89868e2d177d079dfa222f93ac92576c6a53e4dda614a71888054821660f31790557f1a092008002bd10df49715acd1e5aa90bf5483dc71e2a7c7a0d4ce6996499bd48054821660b5179055600a9091527fa18b128af1c8fc61ff46f02d146e54546f34d340574cf2cef6a753cba6b6701d8054909116606f1790556105d833610b74565b831561061e57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b61062f610b85565b6106396000610be0565b565b60015460008481526005602052604081205490916001600160a01b0316906340a7bb109061ffff1661066e600288610c51565b8887604051602001610681929190611205565b604051602081830303815290604052600061069b88610c66565b6040518663ffffffff1660e01b81526004016106bb959493929190611229565b6040805180830381865afa1580156106d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fb919061127d565b5095945050505050565b61070d610b85565b6001600160a01b038216600081815260066020908152604091829020805460ff19168515159081179091558251938452908301527fb17e5ef82d64736b74ace0e0fc1e75469c90bb65bc25a92302e3fb37b803732f91015b60405180910390a15050565b610779610b85565b61078560028284610c8f565b50604080518281526001600160a01b03841660208201527f5718b3bd423ee6c83643fcd4fc0321bc4e9555a50ef373bc98251fc525952d609101610765565b3360009081526006602052604090205460ff166107f3576040516286200b60e81b815260040160405180910390fd5b60008481526005602052604081205461ffff16900361082d57604051637169a9c760e11b8152600481018590526024015b60405180910390fd5b600061083a600286610c51565b6040516bffffffffffffffffffffffff19606092831b811660208301523090921b909116603482015260480160408051601f19818403018152828252600154600089815260056020908152939020549194506001600160a01b03169263c580310092349261ffff169186916108b5918d918c918c91016112a1565b60408051601f19818403018152919052600080546001600160a01b0316906108dc8a610c66565b6040518863ffffffff1660e01b81526004016108fd969594939291906112e1565b6000604051808303818588803b15801561091657600080fd5b505af115801561092a573d6000803e3d6000fd5b5050505050505050505050565b61093f610b85565b600091825260056020526040909120805461ffff191661ffff909216919091179055565b61096b610b85565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b606080600061099c6002610cad565b90508067ffffffffffffffff8111156109b7576109b7610ee9565b6040519080825280602002602001820160405280156109e0578160200160208202803683370190505b5092508067ffffffffffffffff8111156109fc576109fc610ee9565b604051908082528060200260200182016040528015610a25578160200160208202803683370190505b50915060005b81811015610a8d57610a3e600282610cb8565b858381518110610a5057610a50611348565b60200260200101858481518110610a6957610a69611348565b6001600160a01b039093166020938402919091019092019190915252600101610a2b565b50509091565b610a9b610b85565b6001600160a01b038116610ac557604051631e4fbdf760e01b815260006004820152602401610824565b610ace81610be0565b50565b610ad9610b85565b6001546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db1790602401600060405180830381600087803b158015610b2257600080fd5b505af1158015610b36573d6000803e3d6000fd5b505060405161ffff841681527eeb3e80cba2ce864358daf1dfa4c0b773cfdaa5a6b2b4718996c155b48c71639250602001905060405180910390a150565b610b7c610cd4565b610ace81610d1d565b33610bb77f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146106395760405163118cdaa760e01b8152336004820152602401610824565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6000610c5d8383610d25565b90505b92915050565b60408051600160f01b602082015260228082019390935281518082039093018352604201905290565b6000610ca584846001600160a01b038516610d6c565b949350505050565b6000610c6082610d89565b6000808080610cc78686610d94565b9097909650945050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661063957604051631afcd79f60e31b815260040160405180910390fd5b610a9b610cd4565b600081815260028301602052604081205480158015610d4b5750610d498484610dbf565b155b15610c5d5760405163015ab34360e11b815260048101849052602401610824565b60008281526002840160205260408120829055610ca58484610dcb565b6000610c6082610dd7565b60008080610da28585610de1565b600081815260029690960160205260409095205494959350505050565b6000610c5d8383610ded565b6000610c5d8383610e05565b6000610c60825490565b6000610c5d8383610e54565b60008181526001830160205260408120541515610c5d565b6000818152600183016020526040812054610e4c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c60565b506000610c60565b6000826000018281548110610e6b57610e6b611348565b9060005260206000200154905092915050565b6001600160a01b0381168114610ace57600080fd5b600060208284031215610ea557600080fd5b8135610c5d81610e7e565b60008060408385031215610ec357600080fd5b8235610ece81610e7e565b91506020830135610ede81610e7e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215610f1557600080fd5b8435610f2081610e7e565b935060208501359250604085013567ffffffffffffffff80821115610f4457600080fd5b818701915087601f830112610f5857600080fd5b813581811115610f6a57610f6a610ee9565b604051601f8201601f19908116603f01168101908382118183101715610f9257610f92610ee9565b816040528281528a6020848701011115610fab57600080fd5b826020860160208301376000928101602001929092525095989497509495606001359450505050565b60008060408385031215610fe757600080fd5b8235610ff281610e7e565b915060208301358015158114610ede57600080fd5b6000806040838503121561101a57600080fd5b823561102581610e7e565b946020939093013593505050565b60006020828403121561104557600080fd5b5035919050565b60008060008060006080868803121561106457600080fd5b853561106f81610e7e565b945060208601359350604086013567ffffffffffffffff8082111561109357600080fd5b818801915088601f8301126110a757600080fd5b8135818111156110b657600080fd5b8960208285010111156110c857600080fd5b96999598505060200195606001359392505050565b803561ffff811681146110ef57600080fd5b919050565b6000806040838503121561110757600080fd5b82359150611117602084016110dd565b90509250929050565b604080825283519082018190526000906020906060840190828701845b828110156111595781518452928401929084019060010161113d565b5050508381038285015284518082528583019183019060005b818110156111975783516001600160a01b031683529284019291840191600101611172565b5090979650505050505050565b6000602082840312156111b657600080fd5b610c5d826110dd565b6000815180845260005b818110156111e5576020818501810151868301820152016111c9565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b0383168152604060208201819052600090610ca5908301846111bf565b61ffff861681526001600160a01b038516602082015260a060408201819052600090611257908301866111bf565b8415156060840152828103608084015261127181856111bf565b98975050505050505050565b6000806040838503121561129057600080fd5b505080516020909101519092909150565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b61ffff8716815260c0602082015260006112fe60c08301886111bf565b828103604084015261131081886111bf565b6001600160a01b0387811660608601528616608085015283810360a0850152905061133b81856111bf565b9998505050505050505050565b634e487b7160e01b600052603260045260246000fdfea264697066735822122063d8f3da39b49a1a078c0cbe92f6e1463d385d9d7c1379766990f08b2bb8da2464736f6c63430008170033
Deployed Bytecode
0x6080604052600436106100f35760003560e01c8063b21e3efb1161008a578063d9331a1111610059578063d9331a11146102e1578063f080765a14610301578063f2fde38b14610324578063f4f4d34e1461034457600080fd5b8063b21e3efb1461024a578063b2267a7b1461028e578063b353aaa7146102a1578063d35794fd146102c157600080fd5b806384fe1721116100c657806384fe1721146101ac5780638da5cb5b146101da5780639281aa0b1461021757806393bf751e1461023757600080fd5b80630cb61f6c146100f85780633af32abf14610135578063485cc95514610175578063715018a614610197575b600080fd5b34801561010457600080fd5b50600054610118906001600160a01b031681565b6040516001600160a01b0390911681526020015b60405180910390f35b34801561014157600080fd5b50610165610150366004610e93565b60066020526000908152604090205460ff1681565b604051901515815260200161012c565b34801561018157600080fd5b50610195610190366004610eb0565b610364565b005b3480156101a357600080fd5b50610195610627565b3480156101b857600080fd5b506101cc6101c7366004610eff565b61063b565b60405190815260200161012c565b3480156101e657600080fd5b507f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b0316610118565b34801561022357600080fd5b50610195610232366004610fd4565b610705565b610195610245366004611007565b610771565b34801561025657600080fd5b5061027b610265366004611033565b60056020526000908152604090205461ffff1681565b60405161ffff909116815260200161012c565b61019561029c36600461104c565b6107c4565b3480156102ad57600080fd5b50600154610118906001600160a01b031681565b3480156102cd57600080fd5b506101956102dc3660046110f4565b610937565b3480156102ed57600080fd5b506101956102fc366004610e93565b610963565b34801561030d57600080fd5b5061031661098d565b60405161012c929190611120565b34801561033057600080fd5b5061019561033f366004610e93565b610a93565b34801561035057600080fd5b5061019561035f3660046111a4565b610ad1565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a008054600160401b810460ff16159067ffffffffffffffff166000811580156103aa5750825b905060008267ffffffffffffffff1660011480156103c75750303b155b9050811580156103d5575080155b156103f35760405163f92ee8a960e01b815260040160405180910390fd5b845467ffffffffffffffff19166001178555831561041d57845460ff60401b1916600160401b1785555b6001600160a01b0387166104445760405163d92e233d60e01b815260040160405180910390fd5b6001600160a01b03861661046b5760405163d92e233d60e01b815260040160405180910390fd5b600080546001600160a01b03808a166001600160a01b031992831617835560018054918a169190921617905560056020527f1471eb6eb2c5e789fc3de43f8ce62938c7d1836ec861730447e2ada8fd81017b805461ffff199081166065179091557f44135cd3b3b629bd4adccb5728787fdbe398bbb91c17a294e402786476e8746880548216606e1790557f1769647bd65c77e1ed526c094f1f390badad63e9ca5e41b7016a85d496a30839805482166101041790557f892999ef8486d1d8d98ca69fabdb4a0efee8d000af740b6281df4ac7f437b0d48054821660b81790557f363d3eca645461a89868e2d177d079dfa222f93ac92576c6a53e4dda614a71888054821660f31790557f1a092008002bd10df49715acd1e5aa90bf5483dc71e2a7c7a0d4ce6996499bd48054821660b5179055600a9091527fa18b128af1c8fc61ff46f02d146e54546f34d340574cf2cef6a753cba6b6701d8054909116606f1790556105d833610b74565b831561061e57845460ff60401b19168555604051600181527fc7f505b2f371ae2175ee4913f4499e1f2633a7b5936321eed1cdaeb6115181d29060200160405180910390a15b50505050505050565b61062f610b85565b6106396000610be0565b565b60015460008481526005602052604081205490916001600160a01b0316906340a7bb109061ffff1661066e600288610c51565b8887604051602001610681929190611205565b604051602081830303815290604052600061069b88610c66565b6040518663ffffffff1660e01b81526004016106bb959493929190611229565b6040805180830381865afa1580156106d7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906106fb919061127d565b5095945050505050565b61070d610b85565b6001600160a01b038216600081815260066020908152604091829020805460ff19168515159081179091558251938452908301527fb17e5ef82d64736b74ace0e0fc1e75469c90bb65bc25a92302e3fb37b803732f91015b60405180910390a15050565b610779610b85565b61078560028284610c8f565b50604080518281526001600160a01b03841660208201527f5718b3bd423ee6c83643fcd4fc0321bc4e9555a50ef373bc98251fc525952d609101610765565b3360009081526006602052604090205460ff166107f3576040516286200b60e81b815260040160405180910390fd5b60008481526005602052604081205461ffff16900361082d57604051637169a9c760e11b8152600481018590526024015b60405180910390fd5b600061083a600286610c51565b6040516bffffffffffffffffffffffff19606092831b811660208301523090921b909116603482015260480160408051601f19818403018152828252600154600089815260056020908152939020549194506001600160a01b03169263c580310092349261ffff169186916108b5918d918c918c91016112a1565b60408051601f19818403018152919052600080546001600160a01b0316906108dc8a610c66565b6040518863ffffffff1660e01b81526004016108fd969594939291906112e1565b6000604051808303818588803b15801561091657600080fd5b505af115801561092a573d6000803e3d6000fd5b5050505050505050505050565b61093f610b85565b600091825260056020526040909120805461ffff191661ffff909216919091179055565b61096b610b85565b600180546001600160a01b0319166001600160a01b0392909216919091179055565b606080600061099c6002610cad565b90508067ffffffffffffffff8111156109b7576109b7610ee9565b6040519080825280602002602001820160405280156109e0578160200160208202803683370190505b5092508067ffffffffffffffff8111156109fc576109fc610ee9565b604051908082528060200260200182016040528015610a25578160200160208202803683370190505b50915060005b81811015610a8d57610a3e600282610cb8565b858381518110610a5057610a50611348565b60200260200101858481518110610a6957610a69611348565b6001600160a01b039093166020938402919091019092019190915252600101610a2b565b50509091565b610a9b610b85565b6001600160a01b038116610ac557604051631e4fbdf760e01b815260006004820152602401610824565b610ace81610be0565b50565b610ad9610b85565b6001546040516307e0db1760e01b815261ffff831660048201526001600160a01b03909116906307e0db1790602401600060405180830381600087803b158015610b2257600080fd5b505af1158015610b36573d6000803e3d6000fd5b505060405161ffff841681527eeb3e80cba2ce864358daf1dfa4c0b773cfdaa5a6b2b4718996c155b48c71639250602001905060405180910390a150565b610b7c610cd4565b610ace81610d1d565b33610bb77f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c199300546001600160a01b031690565b6001600160a01b0316146106395760405163118cdaa760e01b8152336004820152602401610824565b7f9016d09d72d40fdae2fd8ceac6b6234c7706214fd39c1cd1e609a0528c19930080546001600160a01b031981166001600160a01b03848116918217845560405192169182907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3505050565b6000610c5d8383610d25565b90505b92915050565b60408051600160f01b602082015260228082019390935281518082039093018352604201905290565b6000610ca584846001600160a01b038516610d6c565b949350505050565b6000610c6082610d89565b6000808080610cc78686610d94565b9097909650945050505050565b7ff0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a0054600160401b900460ff1661063957604051631afcd79f60e31b815260040160405180910390fd5b610a9b610cd4565b600081815260028301602052604081205480158015610d4b5750610d498484610dbf565b155b15610c5d5760405163015ab34360e11b815260048101849052602401610824565b60008281526002840160205260408120829055610ca58484610dcb565b6000610c6082610dd7565b60008080610da28585610de1565b600081815260029690960160205260409095205494959350505050565b6000610c5d8383610ded565b6000610c5d8383610e05565b6000610c60825490565b6000610c5d8383610e54565b60008181526001830160205260408120541515610c5d565b6000818152600183016020526040812054610e4c57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c60565b506000610c60565b6000826000018281548110610e6b57610e6b611348565b9060005260206000200154905092915050565b6001600160a01b0381168114610ace57600080fd5b600060208284031215610ea557600080fd5b8135610c5d81610e7e565b60008060408385031215610ec357600080fd5b8235610ece81610e7e565b91506020830135610ede81610e7e565b809150509250929050565b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215610f1557600080fd5b8435610f2081610e7e565b935060208501359250604085013567ffffffffffffffff80821115610f4457600080fd5b818701915087601f830112610f5857600080fd5b813581811115610f6a57610f6a610ee9565b604051601f8201601f19908116603f01168101908382118183101715610f9257610f92610ee9565b816040528281528a6020848701011115610fab57600080fd5b826020860160208301376000928101602001929092525095989497509495606001359450505050565b60008060408385031215610fe757600080fd5b8235610ff281610e7e565b915060208301358015158114610ede57600080fd5b6000806040838503121561101a57600080fd5b823561102581610e7e565b946020939093013593505050565b60006020828403121561104557600080fd5b5035919050565b60008060008060006080868803121561106457600080fd5b853561106f81610e7e565b945060208601359350604086013567ffffffffffffffff8082111561109357600080fd5b818801915088601f8301126110a757600080fd5b8135818111156110b657600080fd5b8960208285010111156110c857600080fd5b96999598505060200195606001359392505050565b803561ffff811681146110ef57600080fd5b919050565b6000806040838503121561110757600080fd5b82359150611117602084016110dd565b90509250929050565b604080825283519082018190526000906020906060840190828701845b828110156111595781518452928401929084019060010161113d565b5050508381038285015284518082528583019183019060005b818110156111975783516001600160a01b031683529284019291840191600101611172565b5090979650505050505050565b6000602082840312156111b657600080fd5b610c5d826110dd565b6000815180845260005b818110156111e5576020818501810151868301820152016111c9565b506000602082860101526020601f19601f83011685010191505092915050565b6001600160a01b0383168152604060208201819052600090610ca5908301846111bf565b61ffff861681526001600160a01b038516602082015260a060408201819052600090611257908301866111bf565b8415156060840152828103608084015261127181856111bf565b98975050505050505050565b6000806040838503121561129057600080fd5b505080516020909101519092909150565b6001600160a01b03841681526040602082018190528101829052818360608301376000818301606090810191909152601f909201601f1916010192915050565b61ffff8716815260c0602082015260006112fe60c08301886111bf565b828103604084015261131081886111bf565b6001600160a01b0387811660608601528616608085015283810360a0850152905061133b81856111bf565b9998505050505050505050565b634e487b7160e01b600052603260045260246000fdfea264697066735822122063d8f3da39b49a1a078c0cbe92f6e1463d385d9d7c1379766990f08b2bb8da2464736f6c63430008170033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 26 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.