More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 382 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Claim | 4186818 | 27 mins ago | IN | 0 S | 0.0066627 | ||||
Claim | 4186469 | 31 mins ago | IN | 0 S | 0.00702391 | ||||
Claim | 4186377 | 33 mins ago | IN | 0 S | 0.0066627 | ||||
Claim | 4185793 | 39 mins ago | IN | 0 S | 0.0066627 | ||||
Claim | 4185310 | 46 mins ago | IN | 0 S | 0.00702391 | ||||
Claim | 4184865 | 52 mins ago | IN | 0 S | 0.00702391 | ||||
Claim | 4182142 | 1 hr ago | IN | 0 S | 0.0066627 | ||||
Claim | 4182015 | 1 hr ago | IN | 0 S | 0.0066627 | ||||
Claim | 4181599 | 1 hr ago | IN | 0 S | 0.0066627 | ||||
Claim | 4181280 | 1 hr ago | IN | 0 S | 0.0066627 | ||||
Claim | 4180457 | 1 hr ago | IN | 0 S | 0.00702391 | ||||
Claim | 4179495 | 1 hr ago | IN | 0 S | 0.00702391 | ||||
Claim | 4179019 | 2 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4174455 | 2 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4173352 | 3 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4172867 | 3 hrs ago | IN | 0 S | 0.0066627 | ||||
Claim | 4172008 | 3 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4168541 | 3 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4167989 | 3 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4165626 | 4 hrs ago | IN | 0 S | 0.0091309 | ||||
Claim | 4163739 | 4 hrs ago | IN | 0 S | 0.0066627 | ||||
Claim | 4161754 | 4 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4161722 | 4 hrs ago | IN | 0 S | 0.0066627 | ||||
Claim | 4154915 | 5 hrs ago | IN | 0 S | 0.00702391 | ||||
Claim | 4154491 | 5 hrs ago | IN | 0 S | 0.00702391 |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
ShadowMessageRecipient
Compiler Version
v0.8.28+commit.7893614a
Optimization Enabled:
Yes with 1633 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.22; import {OApp, Origin, MessagingFee} from "@layerzerolabs/oapp-evm/contracts/oapp/OApp.sol"; import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; import {IShadowMessageRecipient} from "../migration/interfaces/IShadowMessageRecipient.sol"; import {IXShadow} from "../interfaces/IXShadow.sol"; /// @title Shadow's x-chain messaging receiver contract, utilizing LayerZero and selected, secure DVNs contract ShadowMessageRecipient is IShadowMessageRecipient, OApp { bool public paused = true; IXShadow public xShadow; /// @inheritdoc IShadowMessageRecipient mapping(address => uint256) public claimable; /// @inheritdoc IShadowMessageRecipient mapping(address => uint256) public userMigratedTotal; constructor( address _endpoint, address _owner ) OApp(_endpoint, _owner) Ownable(_owner) {} /// @inheritdoc IShadowMessageRecipient function claim() external { require(!paused, "paused"); /// @dev grab claimable from mapping uint256 claimableAmount = claimable[msg.sender]; /// @dev ensure there's a balance require(claimableAmount != 0, "no allocation"); require( xShadow.balanceOf(address(this)) >= claimableAmount, "contract needs refilling" ); /// @dev zero out the user's claimable balance claimable[msg.sender] = 0; /// @dev send the xShadow xShadow.transfer(msg.sender, claimableAmount); } /// @inheritdoc IShadowMessageRecipient function rescue(address _to) external onlyOwner { xShadow.transfer(_to, xShadow.balanceOf(address(this))); } /// @inheritdoc IShadowMessageRecipient function setXShadow(address _xShadow) external onlyOwner { require(address(xShadow) == address(0), "already initialized"); paused = false; xShadow = IXShadow(_xShadow); } /** * @dev Called when data is received from the protocol. It overrides the equivalent function in the parent contract. * Protocol messages are defined as packets, comprised of the following parameters. * @param _origin A struct containing information about where the packet came from. * @param _guid A global unique identifier for tracking the packet. * @param payload Encoded message. */ function _lzReceive( Origin calldata _origin, bytes32 _guid, bytes calldata payload, address, // Executor address as specified by the OApp. bytes calldata // Any extra data or options to trigger on receipt. ) internal override { /// @dev decode the payload to get the message LocalParameters memory data = abi.decode(payload, (LocalParameters)); /// @dev sanity check for message being decoded if (data.amountMigrated > 0 && data.user != address(0)) { /// @dev add to migration mapping claimable[data.user] += data.amountMigrated; userMigratedTotal[data.user] += data.amountMigrated; return; } else { /// @dev terminate or handle non-operating return; } } }
// 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 // OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol) pragma solidity ^0.8.20; import {Context} from "../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. * * 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 Ownable is Context { address private _owner; /** * @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. */ constructor(address initialOwner) { 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) { 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 { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.26; interface IShadowMessageRecipient { /// @dev parameters of the x-chain msg struct LocalParameters { address user; uint256 amountMigrated; } function claim() external; function rescue(address) external; function setXShadow(address _xShadow) external; function claimable(address) external view returns (uint256); function userMigratedTotal(address) external view returns (uint256); }
// SPDX-License-Identifier: GPL-2.0-or-later pragma solidity ^0.8.24; import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; import {IVoter} from "./IVoter.sol"; interface IXShadow is IERC20 { struct VestPosition { /// @dev amount of xShadow uint256 amount; /// @dev start unix timestamp uint256 start; /// @dev start + MAX_VEST (end timestamp) uint256 maxEnd; /// @dev vest identifier (starting from 0) uint256 vestID; } error NOT_WHITELISTED(address); error NOT_MINTER(); error ZERO(); error NO_VEST(); error ALREADY_EXEMPT(); error NOT_EXEMPT(); error CANT_RESCUE(); error NO_CHANGE(); error ARRAY_LENGTHS(); error TOO_HIGH(); error VEST_OVERLAP(); event CancelVesting( address indexed user, uint256 indexed vestId, uint256 amount ); event ExitVesting( address indexed user, uint256 indexed vestId, uint256 amount ); event InstantExit(address indexed user, uint256); event NewSlashingPenalty(uint256 penalty); event NewVest( address indexed user, uint256 indexed vestId, uint256 indexed amount ); event NewVestingTimes(uint256 min, uint256 max); event Converted(address indexed user, uint256); event Exemption(address indexed candidate, bool status, bool success); event XShadowRedeemed(address indexed user, uint256); event NewOperator(address indexed o, address indexed n); event Rebase(address indexed caller, uint256 amount); /// @notice returns info on a user's vests function vestInfo( address user, uint256 ) external view returns (uint256 amount, uint256 start, uint256 maxEnd, uint256 vestID); /// @notice address of the shadow token function SHADOW() external view returns (IERC20); /// @notice address of the voter function VOTER() external view returns (IVoter); function MINTER() external view returns (address); function ACCESS_HUB() external view returns (address); /// @notice address of the operator function operator() external view returns (address); /// @notice address of the VoteModule function VOTE_MODULE() external view returns (address); /// @notice max slashing amount function SLASHING_PENALTY() external view returns (uint256); /// @notice denominator function BASIS() external view returns (uint256); /// @notice the minimum vesting length function MIN_VEST() external view returns (uint256); /// @notice the maximum vesting length function MAX_VEST() external view returns (uint256); function shadow() external view returns (address); /// @notice the last period rebases were distributed function lastDistributedPeriod() external view returns (uint256); /// @notice amount of pvp rebase penalties accumulated pending to be distributed function pendingRebase() external view returns (uint256); /// @notice pauses the contract function pause() external; /// @notice unpauses the contract function unpause() external; /*****************************************************************/ // General use functions /*****************************************************************/ /// @dev mints xShadows for each shadow. function convertEmissionsToken(uint256 _amount) external; /// @notice function called by the minter to send the rebases once a week function rebase() external; /** * @dev exit instantly with a penalty * @param _amount amount of xShadows to exit */ function exit(uint256 _amount) external returns(uint256 _exitedAmount); /// @dev vesting xShadows --> emissionToken functionality function createVest(uint256 _amount) external; /// @dev handles all situations regarding exiting vests function exitVest(uint256 _vestID) external; /*****************************************************************/ // Permissioned functions, timelock/operator gated /*****************************************************************/ /// @dev allows the operator to redeem collected xShadows function operatorRedeem(uint256 _amount) external; /// @dev allows rescue of any non-stake token function rescueTrappedTokens( address[] calldata _tokens, uint256[] calldata _amounts ) external; /// @notice migrates the operator to another contract function migrateOperator(address _operator) external; /// @notice set exemption status for an address function setExemption( address[] calldata _exemptee, bool[] calldata _exempt ) external; function setExemptionTo( address[] calldata _exemptee, bool[] calldata _exempt ) external; /*****************************************************************/ // Getter functions /*****************************************************************/ /// @notice returns the amount of SHADOW within the contract function getBalanceResiding() external view returns (uint256); /// @notice returns the total number of individual vests the user has function usersTotalVests( address _who ) external view returns (uint256 _numOfVests); /// @notice whether the address is exempt /// @param _who who to check /// @return _exempt whether it's exempt function isExempt(address _who) external view returns (bool _exempt); /// @notice returns the vest info for a user /// @param _who who to check /// @param _vestID vest ID to check /// @return VestPosition vest info function getVestInfo( address _who, uint256 _vestID ) external view returns (VestPosition memory); }
// 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.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 = 2; /** * @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 Indicates whether an address is an approved composeMsg sender to the Endpoint. * @dev _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. * @dev _message The lzReceive payload. * @param _sender The sender address. * @return isSender Is a valid sender. * * @dev Applications can optionally choose to implement separate composeMsg senders that are NOT the bridging layer. * @dev The default sender IS the OAppReceiver implementer. */ function isComposeMsgSender( Origin calldata /*_origin*/, bytes calldata /*_message*/, address _sender ) public view virtual returns (bool) { return _sender == 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 { 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 { _setPeer(_eid, _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. * * @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) internal virtual { 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 // OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol) pragma solidity ^0.8.20; /** * @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 // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-20 standard as defined in the ERC. */ 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 value of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the value of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves a `value` amount of 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 value) 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 a `value` amount of tokens 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 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the * allowance mechanism. `value` 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 value) external returns (bool); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity ^0.8.26; pragma abicoder v2; interface IVoter { error ACTIVE_GAUGE(address gauge); error GAUGE_INACTIVE(address gauge); error ALREADY_WHITELISTED(address token); error NOT_AUTHORIZED(address caller); error NOT_WHITELISTED(); error NOT_POOL(); error NOT_INIT(); error LENGTH_MISMATCH(); error NO_GAUGE(); error ALREADY_DISTRIBUTED(address gauge, uint256 period); error ZERO_VOTE(address pool); error RATIO_TOO_HIGH(uint256 _xRatio); error VOTE_UNSUCCESSFUL(); event GaugeCreated( address indexed gauge, address creator, address feeDistributor, address indexed pool ); event GaugeKilled(address indexed gauge); event GaugeRevived(address indexed gauge); event Voted(address indexed owner, uint256 weight, address indexed pool); event Abstained(address indexed owner, uint256 weight); event Deposit( address indexed lp, address indexed gauge, address indexed owner, uint256 amount ); event Withdraw( address indexed lp, address indexed gauge, address indexed owner, uint256 amount ); event NotifyReward( address indexed sender, address indexed reward, uint256 amount ); event DistributeReward( address indexed sender, address indexed gauge, uint256 amount ); event EmissionsRatio( address indexed caller, uint256 oldRatio, uint256 newRatio ); event NewGovernor(address indexed sender, address indexed governor); event Whitelisted(address indexed whitelister, address indexed token); event WhitelistRevoked( address indexed forbidder, address indexed token, bool status ); event MainTickSpacingChanged( address indexed token0, address indexed token1, int24 indexed newMainTickSpacing ); event Poke(address indexed user); function initialize( address _shadow, address _legacyFactory, address _gauges, address _feeDistributorFactory, address _minter, address _msig, address _xShadow, address _clFactory, address _clGaugeFactory, address _nfpManager, address _feeRecipientFactory, address _voteModule, address _launcherPlugin ) external; /// @notice denominator basis function BASIS() external view returns (uint256); /// @notice ratio of xShadow emissions globally function xRatio() external view returns (uint256); /// @notice xShadow contract address function xShadow() external view returns (address); /// @notice legacy factory address (uni-v2/stableswap) function legacyFactory() external view returns (address); /// @notice concentrated liquidity factory function clFactory() external view returns (address); /// @notice gauge factory for CL function clGaugeFactory() external view returns (address); /// @notice legacy fee recipient factory function feeRecipientFactory() external view returns (address); /// @notice peripheral NFPManager contract function nfpManager() external view returns (address); /// @notice returns the address of the current governor /// @return _governor address of the governor function governor() external view returns (address _governor); /// @notice the address of the vote module /// @return _voteModule the vote module contract address function voteModule() external view returns (address _voteModule); /// @notice address of the central access Hub function accessHub() external view returns (address); /// @notice the address of the shadow launcher plugin to enable third party launchers /// @return _launcherPlugin the address of the plugin function launcherPlugin() external view returns (address _launcherPlugin); /// @notice distributes emissions from the minter to the voter /// @param amount the amount of tokens to notify function notifyRewardAmount(uint256 amount) external; /// @notice distributes the emissions for a specific gauge /// @param _gauge the gauge address function distribute(address _gauge) external; /// @notice returns the address of the gauge factory /// @param _gaugeFactory gauge factory address function gaugeFactory() external view returns (address _gaugeFactory); /// @notice returns the address of the feeDistributor factory /// @return _feeDistributorFactory feeDist factory address function feeDistributorFactory() external view returns (address _feeDistributorFactory); /// @notice returns the address of the minter contract /// @return _minter address of the minter function minter() external view returns (address _minter); /// @notice check if the gauge is active for governance use /// @param _gauge address of the gauge /// @return _trueOrFalse if the gauge is alive function isAlive(address _gauge) external view returns (bool _trueOrFalse); /// @notice allows the token to be paired with other whitelisted assets to participate in governance /// @param _token the address of the token function whitelist(address _token) external; /// @notice effectively disqualifies a token from governance /// @param _token the address of the token function revokeWhitelist(address _token) external; /// @notice returns if the address is a gauge /// @param gauge address of the gauge /// @return _trueOrFalse boolean if the address is a gauge function isGauge(address gauge) external view returns (bool _trueOrFalse); /// @notice disable a gauge from governance /// @param _gauge address of the gauge function killGauge(address _gauge) external; /// @notice re-activate a dead gauge /// @param _gauge address of the gauge function reviveGauge(address _gauge) external; /// @notice re-cast a tokenID's votes /// @param owner address of the owner function poke(address owner) external; /// @notice sets the main tickspacing of a token pairing /// @param tokenA address of tokenA /// @param tokenB address of tokenB /// @param tickSpacing the main tickspacing to set to function setMainTickSpacing( address tokenA, address tokenB, int24 tickSpacing ) external; /// @notice returns if the address is a fee distributor /// @param _feeDistributor address of the feeDist /// @return _trueOrFalse if the address is a fee distributor function isFeeDistributor( address _feeDistributor ) external view returns (bool _trueOrFalse); /// @notice returns the address of the emission's token /// @return _shadow emissions token contract address function shadow() external view returns (address _shadow); /// @notice returns the address of the pool's gauge, if any /// @param _pool pool address /// @return _gauge gauge address function gaugeForPool(address _pool) external view returns (address _gauge); /// @notice returns the address of the pool's feeDistributor, if any /// @param _gauge address of the gauge /// @return _feeDistributor address of the pool's feedist function feeDistributorForGauge( address _gauge ) external view returns (address _feeDistributor); /// @notice returns the new toPool that was redirected fromPool /// @param fromPool address of the original pool /// @return toPool the address of the redirected pool function poolRedirect( address fromPool ) external view returns (address toPool); /// @notice returns the gauge address of a CL pool /// @param tokenA address of token A in the pair /// @param tokenB address of token B in the pair /// @param tickSpacing tickspacing of the pool /// @return gauge address of the gauge function gaugeForClPool( address tokenA, address tokenB, int24 tickSpacing ) external view returns (address gauge); /// @notice returns the array of all tickspacings for the tokenA/tokenB combination /// @param tokenA address of token A in the pair /// @param tokenB address of token B in the pair /// @return _ts array of all the tickspacings function tickSpacingsForPair( address tokenA, address tokenB ) external view returns (int24[] memory _ts); /// @notice returns the main tickspacing used in the gauge/governance process /// @param tokenA address of token A in the pair /// @param tokenB address of token B in the pair /// @return _ts the main tickspacing function mainTickSpacingForPair( address tokenA, address tokenB ) external view returns (int24 _ts); /// @notice returns the block.timestamp divided by 1 week in seconds /// @return period the period used for gauges function getPeriod() external view returns (uint256 period); /// @notice cast a vote to direct emissions to gauges and earn incentives /// @param owner address of the owner /// @param _pools the list of pools to vote on /// @param _weights an arbitrary weight per pool which will be normalized to 100% regardless of numerical inputs function vote( address owner, address[] calldata _pools, uint256[] calldata _weights ) external; /// @notice reset the vote of an address /// @param owner address of the owner function reset(address owner) external; /// @notice set the governor address /// @param _governor the new governor address function setGovernor(address _governor) external; /// @notice recover stuck emissions /// @param _gauge the gauge address /// @param _period the period function stuckEmissionsRecovery(address _gauge, uint256 _period) external; /// @notice whitelists extra rewards for a gauge /// @param _gauge the gauge to whitelist rewards to /// @param _reward the reward to whitelist function whitelistGaugeRewards(address _gauge, address _reward) external; /// @notice removes a reward from the gauge whitelist /// @param _gauge the gauge to remove the whitelist from /// @param _reward the reward to remove from the whitelist function removeGaugeRewardWhitelist( address _gauge, address _reward ) external; /// @notice creates a legacy gauge for the pool /// @param _pool pool's address /// @return _gauge address of the new gauge function createGauge(address _pool) external returns (address _gauge); /// @notice create a concentrated liquidity gauge /// @param tokenA the address of tokenA /// @param tokenB the address of tokenB /// @param tickSpacing the tickspacing of the pool /// @return _clGauge address of the new gauge function createCLGauge( address tokenA, address tokenB, int24 tickSpacing ) external returns (address _clGauge); /// @notice claim concentrated liquidity gauge rewards for specific NFP token ids /// @param _gauges array of gauges /// @param _tokens two dimensional array for the tokens to claim /// @param _nfpTokenIds two dimensional array for the NFPs function claimClGaugeRewards( address[] calldata _gauges, address[][] calldata _tokens, uint256[][] calldata _nfpTokenIds ) external; /// @notice claim arbitrary rewards from specific feeDists /// @param owner address of the owner /// @param _feeDistributors address of the feeDists /// @param _tokens two dimensional array for the tokens to claim function claimIncentives( address owner, address[] calldata _feeDistributors, address[][] calldata _tokens ) external; /// @notice claim arbitrary rewards from specific gauges /// @param _gauges address of the gauges /// @param _tokens two dimensional array for the tokens to claim function claimRewards( address[] calldata _gauges, address[][] calldata _tokens ) external; /// @notice distribute emissions to a gauge for a specific period /// @param _gauge address of the gauge /// @param _period value of the period function distributeForPeriod(address _gauge, uint256 _period) external; /// @notice attempt distribution of emissions to all gauges function distributeAll() external; /// @notice distribute emissions to gauges by index /// @param startIndex start of the loop /// @param endIndex end of the loop function batchDistributeByIndex( uint256 startIndex, uint256 endIndex ) external; /// @notice returns the votes cast for a tokenID /// @param owner address of the owner /// @return votes an array of votes casted /// @return weights an array of the weights casted per pool function getVotes( address owner, uint256 period ) external view returns (address[] memory votes, uint256[] memory weights); /// @notice returns an array of all the gauges /// @return _gauges the array of gauges function getAllGauges() external view returns (address[] memory _gauges); /// @notice returns an array of all the feeDists /// @return _feeDistributors the array of feeDists function getAllFeeDistributors() external view returns (address[] memory _feeDistributors); /// @notice sets the xShadowRatio default function setGlobalRatio(uint256 _xRatio) external; /// @notice whether the token is whitelisted in governance function isWhitelisted(address _token) external view returns (bool _tf); /// @notice function for removing malicious or stuffed tokens function removeFeeDistributorReward( address _feeDist, address _token ) external; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC1363} from "../../../interfaces/IERC1363.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC-20 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 { /** * @dev An operation with an ERC-20 token failed. */ error SafeERC20FailedOperation(address token); /** * @dev Indicates a failed `decreaseAllowance` request. */ error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease); /** * @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.encodeCall(token.transfer, (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.encodeCall(token.transferFrom, (from, to, 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. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); forceApprove(token, spender, oldAllowance + value); } /** * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no * value, non-reverting calls are assumed to be successful. * * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client" * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal { unchecked { uint256 currentAllowance = token.allowance(address(this), spender); if (currentAllowance < requestedDecrease) { revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease); } forceApprove(token, spender, currentAllowance - requestedDecrease); } } /** * @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. * * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being * set here. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value)); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0))); _callOptionalReturn(token, approvalCall); } } /** * @dev Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { safeTransfer(token, to, value); } else if (!token.transferAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * Reverts if the returned value is other than `true`. */ function transferFromAndCallRelaxed( IERC1363 token, address from, address to, uint256 value, bytes memory data ) internal { if (to.code.length == 0) { safeTransferFrom(token, from, to, value); } else if (!token.transferFromAndCall(from, to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when * targeting contracts. * * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}. * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall} * once without retrying, and relies on the returned value to be true. * * Reverts if the returned value is other than `true`. */ function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal { if (to.code.length == 0) { forceApprove(token, to, value); } else if (!token.approveAndCall(to, value, data)) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements. */ function _callOptionalReturn(IERC20 token, bytes memory data) private { uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) // bubble errors if iszero(success) { let ptr := mload(0x40) returndatacopy(ptr, 0, returndatasize()) revert(ptr, returndatasize()) } returnSize := returndatasize() returnValue := mload(0) } if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) { revert SafeERC20FailedOperation(address(token)); } } /** * @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 silently catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { bool success; uint256 returnSize; uint256 returnValue; assembly ("memory-safe") { success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20) returnSize := returndatasize() returnValue := mload(0) } return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1); } }
// 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.20; import { ILayerZeroReceiver, Origin } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroReceiver.sol"; interface IOAppReceiver is ILayerZeroReceiver { /** * @notice Indicates whether an address is an approved composeMsg sender to 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 _message The lzReceive payload. * @param _sender The sender address. * @return isSender Is a valid sender. * * @dev Applications can optionally choose to implement a separate composeMsg sender that is NOT the bridging layer. * @dev The default sender IS the OAppReceiver implementer. */ function isComposeMsgSender( Origin calldata _origin, bytes calldata _message, address _sender ) external view returns (bool isSender); }
// 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 // OpenZeppelin Contracts (last updated v5.1.0) (interfaces/IERC1363.sol) pragma solidity ^0.8.20; import {IERC20} from "./IERC20.sol"; import {IERC165} from "./IERC165.sol"; /** * @title IERC1363 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363]. * * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction. */ interface IERC1363 is IERC20, IERC165 { /* * Note: the ERC-165 identifier for this interface is 0xb0202a11. * 0xb0202a11 === * bytes4(keccak256('transferAndCall(address,uint256)')) ^ * bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^ * bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^ * bytes4(keccak256('approveAndCall(address,uint256)')) ^ * bytes4(keccak256('approveAndCall(address,uint256,bytes)')) */ /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from the caller's account to `to` * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value) external returns (bool); /** * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism * and then calls {IERC1363Receiver-onTransferReceived} on `to`. * @param from The address which you want to send tokens from. * @param to The address which you want to transfer to. * @param value The amount of tokens to be transferred. * @param data Additional data with no specified format, sent in call to `to`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value) external returns (bool); /** * @dev Sets a `value` amount of tokens as the allowance of `spender` over the * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`. * @param spender The address which will spend the funds. * @param value The amount of tokens to be spent. * @param data Additional data with no specified format, sent in call to `spender`. * @return A boolean value indicating whether the operation succeeded unless throwing. */ function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol) pragma solidity ^0.8.20; import {Errors} from "./Errors.sol"; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @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.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { if (address(this).balance < amount) { revert Errors.InsufficientBalance(address(this).balance, amount); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert Errors.FailedCall(); } } /** * @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 or custom error, it is bubbled * up by this function (like regular Solidity function calls). However, if * the call reverted with no returned reason, this function reverts with a * {Errors.FailedCall} error. * * 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. */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0); } /** * @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`. */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { if (address(this).balance < value) { revert Errors.InsufficientBalance(address(this).balance, value); } (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target * was not a contract or bubbling up the revert reason (falling back to {Errors.FailedCall}) in case * of an unsuccessful call. */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata ) internal view returns (bytes memory) { if (!success) { _revert(returndata); } else { // only check if target is a contract if the call was successful and the return data is empty // otherwise we already know that it was a contract if (returndata.length == 0 && target.code.length == 0) { revert AddressEmptyCode(target); } return returndata; } } /** * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the * revert reason or with a default {Errors.FailedCall} error. */ function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) { if (!success) { _revert(returndata); } else { return returndata; } } /** * @dev Reverts with returndata if present. Otherwise reverts with {Errors.FailedCall}. */ function _revert(bytes memory returndata) 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 assembly ("memory-safe") { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert Errors.FailedCall(); } } }
// 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 _gracePeriod) 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 _expiry) 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 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 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 IMessagingContext { function isSendingMessage() external view returns (bool); function getSendContext() external view returns (uint32 dstEid, address sender); }
// 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 // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../token/ERC20/IERC20.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC165.sol) pragma solidity ^0.8.20; import {IERC165} from "../utils/introspection/IERC165.sol";
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol) pragma solidity ^0.8.20; /** * @dev Collection of common custom errors used in multiple contracts * * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library. * It is recommended to avoid relying on the error API for critical functionality. * * _Available since v5.1._ */ library Errors { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error InsufficientBalance(uint256 balance, uint256 needed); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedCall(); /** * @dev The deployment failed. */ error FailedDeployment(); /** * @dev A necessary precompile is missing. */ error MissingPrecompile(address); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.1.0) (utils/introspection/IERC165.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC-165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[ERC]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
{ "remappings": [ "@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/", "@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/", "@forge-std-1.9.4/=dependencies/forge-std-1.9.4/", "@layerzerolabs/=node_modules/@layerzerolabs/", "@layerzerolabs/lz-evm-protocol-v2/=node_modules/@layerzerolabs/lz-evm-protocol-v2/", "@openzeppelin-contracts-upgradeable/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/", "@openzeppelin-contracts/contracts/=dependencies/@openzeppelin-contracts-5.1.0/", "@openzeppelin/contracts/=dependencies/@openzeppelin-contracts-5.1.0/", "erc4626-tests/=dependencies/erc4626-property-tests-1.0/", "forge-std/=dependencies/forge-std-1.9.4/src/", "permit2/=lib/permit2/", "@openzeppelin-3.4.2/=node_modules/@openzeppelin-3.4.2/", "@openzeppelin-contracts-5.1.0/=dependencies/@openzeppelin-contracts-5.1.0/", "@openzeppelin-contracts-upgradeable-5.1.0/=dependencies/@openzeppelin-contracts-upgradeable-5.1.0/", "@uniswap/=node_modules/@uniswap/", "base64-sol/=node_modules/base64-sol/", "ds-test/=node_modules/ds-test/", "erc4626-property-tests-1.0/=dependencies/erc4626-property-tests-1.0/", "eth-gas-reporter/=node_modules/eth-gas-reporter/", "forge-std-1.9.4/=dependencies/forge-std-1.9.4/src/", "hardhat/=node_modules/hardhat/", "solidity-bytes-utils/=node_modules/solidity-bytes-utils/", "solmate/=node_modules/solmate/" ], "optimizer": { "enabled": true, "runs": 1633 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": true, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"address","name":"_owner","type":"address"}],"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"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"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"},{"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":[],"name":"claim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"claimable","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"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":"","type":"tuple"},{"internalType":"bytes","name":"","type":"bytes"},{"internalType":"address","name":"_sender","type":"address"}],"name":"isComposeMsgSender","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":[],"name":"paused","outputs":[{"internalType":"bool","name":"","type":"bool"}],"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":"address","name":"_to","type":"address"}],"name":"rescue","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","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":"_xShadow","type":"address"}],"name":"setXShadow","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"userMigratedTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"xShadow","outputs":[{"internalType":"contract IXShadow","name":"","type":"address"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
60a0806040523461013c57600090604081610e5080380380916100228285610141565b833981010312610138576100358161017a565b906001600160a01b039061004b9060200161017a565b1680156101245782546001600160a01b03198116821784556040519284929182906001600160a01b03167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08580a36001600160a01b0316608081905290813b15610120578383819360249363ca5eb5e160e01b845260048401525af1801561011557610105575b600160ff196002541617600255604051610cc1908161018f82396080518181816103050152818161062701526109980152f35b8161010f91610141565b386100d2565b6040513d84823e3d90fd5b8280fd5b631e4fbdf760e01b83526004839052602483fd5b5080fd5b600080fd5b601f909101601f19168101906001600160401b0382119082101761016457604052565b634e487b7160e01b600052604160045260246000fd5b51906001600160a01b038216820361013c5756fe6080604052600436101561001257600080fd5b6000803560e01c806313137d651461092a57806317442b70146109085780633400288b1461089d578063402914f5146108655780634256f5e71461083b5780634e71d92d1461066e5780635c975abb1461064b5780635e280f1114610607578063715018a6146105965780637d25a05e1461057057806382413eac14610513578063839006f2146103f45780638da5cb5b146103ce578063bb0b6a5314610399578063ca5eb5e1146102d8578063ce88355014610218578063f2fde38b14610162578063fcbebd671461012a5763ff7bd03d146100ee57600080fd5b346101275760603660031901126101275760209060409063ffffffff610112610afe565b16815260018352205460405190602435148152f35b80fd5b50346101275760203660031901126101275760406020916001600160a01b03610151610ad5565b168152600483522054604051908152f35b5034610127576020366003190112610127576001600160a01b03610184610ad5565b61018c610c49565b1680156101ec576001600160a01b038254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b6024827f1e4fbdf700000000000000000000000000000000000000000000000000000000815280600452fd5b503461012757602036600319011261012757610232610ad5565b61023a610c49565b600254906001600160a01b038260081c166102945774ffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffff0000000000000000000000000000000000000000009160081b1691161760025580f35b606460405162461bcd60e51b815260206004820152601360248201527f616c726561647920696e697469616c697a6564000000000000000000000000006044820152fd5b5034610127576020366003190112610127576102f2610ad5565b6102fa610c49565b816001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001691823b15610395576001600160a01b03602483928360405196879485937fca5eb5e10000000000000000000000000000000000000000000000000000000085521660048401525af180156103885761037a5780f35b61038391610b11565b388180f35b50604051903d90823e3d90fd5b5080fd5b503461012757602036600319011261012757604060209163ffffffff6103bd610aeb565b168152600183522054604051908152f35b50346101275780600319360112610127576001600160a01b036020915416604051908152f35b50346101275760203660031901126101275761040e610ad5565b610416610c49565b6001600160a01b0360025460081c1690604051906370a0823160e01b8252306004830152602082602481865afa9182156105085784926104ce575b5060405163a9059cbb60e01b81526001600160a01b0390911660048201526024810191909152906020908290818581604481015b03925af180156104c357610497575080f35b6104b89060203d6020116104bc575b6104b08183610b11565b810190610b49565b5080f35b503d6104a6565b6040513d84823e3d90fd5b91506020823d602011610500575b816104e960209383610b11565b810103126104fc57905190610485610451565b8380fd5b3d91506104dc565b6040513d86823e3d90fd5b503461012757366003190160a08112610395576060136101275760643567ffffffffffffffff81116103955761054d903690600401610a8c565b50506084356001600160a01b038116809103610395576020906040519030148152f35b50346101275760403660031901126101275760209061058d610aeb565b50604051908152f35b50346101275780600319360112610127576105af610c49565b806001600160a01b0381547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461012757806003193601126101275760206040516001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168152f35b5034610127578060031936011261012757602060ff600254166040519015158152f35b503461012757806003193601126101275760025460ff81166107f757338252600360205260408220549081156107b35760206001600160a01b03916024604051809481936370a0823160e01b835230600484015260081c165afa80156107a8578291849161076f575b501061072b5733808352600360209081526040808520859055600254905163a9059cbb60e01b8152600481019390935260248301939093529091829060081c6001600160a01b031681858160448101610485565b606460405162461bcd60e51b815260206004820152601860248201527f636f6e7472616374206e6565647320726566696c6c696e6700000000000000006044820152fd5b9150506020813d6020116107a0575b8161078b60209383610b11565b8101031261079c57819051386106d7565b8280fd5b3d915061077e565b6040513d85823e3d90fd5b606460405162461bcd60e51b815260206004820152600d60248201527f6e6f20616c6c6f636174696f6e000000000000000000000000000000000000006044820152fd5b606460405162461bcd60e51b815260206004820152600660248201527f70617573656400000000000000000000000000000000000000000000000000006044820152fd5b503461012757806003193601126101275760206001600160a01b0360025460081c16604051908152f35b50346101275760203660031901126101275760406020916001600160a01b0361088c610ad5565b168152600383522054604051908152f35b5034610127576040366003190112610127577f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b60406108da610aeb565b63ffffffff602435916108eb610c49565b16908185526001602052808386205582519182526020820152a180f35b5034610127578060031936011261012757604080516001815260026020820152f35b50366003190160e08112610395576060136101275760843567ffffffffffffffff81116103955761095f903690600401610a8c565b61096a929192610abf565b5060c43567ffffffffffffffff811161079c5761098b903690600401610a8c565b5050336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001603610a605763ffffffff6109ca610afe565b169283835260016020526040832054938415610a3557506024358094036109f857906109f591610b84565b80f35b6044838563ffffffff610a09610afe565b7fc26bebcc00000000000000000000000000000000000000000000000000000000845216600452602452fd5b7ff6ff4fb7000000000000000000000000000000000000000000000000000000008452600452602483fd5b6024827f91ac5e4f00000000000000000000000000000000000000000000000000000000815233600452fd5b9181601f84011215610aba5782359167ffffffffffffffff8311610aba5760208381860195010111610aba57565b600080fd5b60a435906001600160a01b0382168203610aba57565b600435906001600160a01b0382168203610aba57565b6004359063ffffffff82168203610aba57565b60043563ffffffff81168103610aba5790565b90601f8019910116810190811067ffffffffffffffff821117610b3357604052565b634e487b7160e01b600052604160045260246000fd5b90816020910312610aba57518015158103610aba5790565b91908201809211610b6e57565b634e487b7160e01b600052601160045260246000fd5b908160409181010312610aba57600090604051916040830183811067ffffffffffffffff821117610c35576040528135916001600160a01b0383169283810361079c57906020918552013590602084019282845282151580610c2c575b15610c2557610c21936040936001600160a01b039284526003602052610c0b858520918254610b61565b9055519451168152600460205220918254610b61565b9055565b5050505050565b50801515610be1565b602482634e487b7160e01b81526041600452fd5b6001600160a01b03600054163303610c5d57565b7f118cdaa7000000000000000000000000000000000000000000000000000000006000523360045260246000fdfea2646970667358221220024620c66a0ee621220882efc63adf46c92f7204f829388436a950176ef6901c64736f6c634300081c00330000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b00000000000000000000000007712d748c40608810a0305751e35f0eedef70d2
Deployed Bytecode
0x6080604052600436101561001257600080fd5b6000803560e01c806313137d651461092a57806317442b70146109085780633400288b1461089d578063402914f5146108655780634256f5e71461083b5780634e71d92d1461066e5780635c975abb1461064b5780635e280f1114610607578063715018a6146105965780637d25a05e1461057057806382413eac14610513578063839006f2146103f45780638da5cb5b146103ce578063bb0b6a5314610399578063ca5eb5e1146102d8578063ce88355014610218578063f2fde38b14610162578063fcbebd671461012a5763ff7bd03d146100ee57600080fd5b346101275760603660031901126101275760209060409063ffffffff610112610afe565b16815260018352205460405190602435148152f35b80fd5b50346101275760203660031901126101275760406020916001600160a01b03610151610ad5565b168152600483522054604051908152f35b5034610127576020366003190112610127576001600160a01b03610184610ad5565b61018c610c49565b1680156101ec576001600160a01b038254827fffffffffffffffffffffffff00000000000000000000000000000000000000008216178455167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08380a380f35b6024827f1e4fbdf700000000000000000000000000000000000000000000000000000000815280600452fd5b503461012757602036600319011261012757610232610ad5565b61023a610c49565b600254906001600160a01b038260081c166102945774ffffffffffffffffffffffffffffffffffffffff007fffffffffffffffffffffff0000000000000000000000000000000000000000009160081b1691161760025580f35b606460405162461bcd60e51b815260206004820152601360248201527f616c726561647920696e697469616c697a6564000000000000000000000000006044820152fd5b5034610127576020366003190112610127576102f2610ad5565b6102fa610c49565b816001600160a01b037f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b1691823b15610395576001600160a01b03602483928360405196879485937fca5eb5e10000000000000000000000000000000000000000000000000000000085521660048401525af180156103885761037a5780f35b61038391610b11565b388180f35b50604051903d90823e3d90fd5b5080fd5b503461012757602036600319011261012757604060209163ffffffff6103bd610aeb565b168152600183522054604051908152f35b50346101275780600319360112610127576001600160a01b036020915416604051908152f35b50346101275760203660031901126101275761040e610ad5565b610416610c49565b6001600160a01b0360025460081c1690604051906370a0823160e01b8252306004830152602082602481865afa9182156105085784926104ce575b5060405163a9059cbb60e01b81526001600160a01b0390911660048201526024810191909152906020908290818581604481015b03925af180156104c357610497575080f35b6104b89060203d6020116104bc575b6104b08183610b11565b810190610b49565b5080f35b503d6104a6565b6040513d84823e3d90fd5b91506020823d602011610500575b816104e960209383610b11565b810103126104fc57905190610485610451565b8380fd5b3d91506104dc565b6040513d86823e3d90fd5b503461012757366003190160a08112610395576060136101275760643567ffffffffffffffff81116103955761054d903690600401610a8c565b50506084356001600160a01b038116809103610395576020906040519030148152f35b50346101275760403660031901126101275760209061058d610aeb565b50604051908152f35b50346101275780600319360112610127576105af610c49565b806001600160a01b0381547fffffffffffffffffffffffff000000000000000000000000000000000000000081168355167f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e08280a380f35b503461012757806003193601126101275760206040516001600160a01b037f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b168152f35b5034610127578060031936011261012757602060ff600254166040519015158152f35b503461012757806003193601126101275760025460ff81166107f757338252600360205260408220549081156107b35760206001600160a01b03916024604051809481936370a0823160e01b835230600484015260081c165afa80156107a8578291849161076f575b501061072b5733808352600360209081526040808520859055600254905163a9059cbb60e01b8152600481019390935260248301939093529091829060081c6001600160a01b031681858160448101610485565b606460405162461bcd60e51b815260206004820152601860248201527f636f6e7472616374206e6565647320726566696c6c696e6700000000000000006044820152fd5b9150506020813d6020116107a0575b8161078b60209383610b11565b8101031261079c57819051386106d7565b8280fd5b3d915061077e565b6040513d85823e3d90fd5b606460405162461bcd60e51b815260206004820152600d60248201527f6e6f20616c6c6f636174696f6e000000000000000000000000000000000000006044820152fd5b606460405162461bcd60e51b815260206004820152600660248201527f70617573656400000000000000000000000000000000000000000000000000006044820152fd5b503461012757806003193601126101275760206001600160a01b0360025460081c16604051908152f35b50346101275760203660031901126101275760406020916001600160a01b0361088c610ad5565b168152600383522054604051908152f35b5034610127576040366003190112610127577f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b60406108da610aeb565b63ffffffff602435916108eb610c49565b16908185526001602052808386205582519182526020820152a180f35b5034610127578060031936011261012757604080516001815260026020820152f35b50366003190160e08112610395576060136101275760843567ffffffffffffffff81116103955761095f903690600401610a8c565b61096a929192610abf565b5060c43567ffffffffffffffff811161079c5761098b903690600401610a8c565b5050336001600160a01b037f0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b1603610a605763ffffffff6109ca610afe565b169283835260016020526040832054938415610a3557506024358094036109f857906109f591610b84565b80f35b6044838563ffffffff610a09610afe565b7fc26bebcc00000000000000000000000000000000000000000000000000000000845216600452602452fd5b7ff6ff4fb7000000000000000000000000000000000000000000000000000000008452600452602483fd5b6024827f91ac5e4f00000000000000000000000000000000000000000000000000000000815233600452fd5b9181601f84011215610aba5782359167ffffffffffffffff8311610aba5760208381860195010111610aba57565b600080fd5b60a435906001600160a01b0382168203610aba57565b600435906001600160a01b0382168203610aba57565b6004359063ffffffff82168203610aba57565b60043563ffffffff81168103610aba5790565b90601f8019910116810190811067ffffffffffffffff821117610b3357604052565b634e487b7160e01b600052604160045260246000fd5b90816020910312610aba57518015158103610aba5790565b91908201809211610b6e57565b634e487b7160e01b600052601160045260246000fd5b908160409181010312610aba57600090604051916040830183811067ffffffffffffffff821117610c35576040528135916001600160a01b0383169283810361079c57906020918552013590602084019282845282151580610c2c575b15610c2557610c21936040936001600160a01b039284526003602052610c0b858520918254610b61565b9055519451168152600460205220918254610b61565b9055565b5050505050565b50801515610be1565b602482634e487b7160e01b81526041600452fd5b6001600160a01b03600054163303610c5d57565b7f118cdaa7000000000000000000000000000000000000000000000000000000006000523360045260246000fdfea2646970667358221220024620c66a0ee621220882efc63adf46c92f7204f829388436a950176ef6901c64736f6c634300081c0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b00000000000000000000000007712d748c40608810a0305751e35f0eedef70d2
-----Decoded View---------------
Arg [0] : _endpoint (address): 0x6F475642a6e85809B1c36Fa62763669b1b48DD5B
Arg [1] : _owner (address): 0x07712D748c40608810A0305751E35f0EeDEF70d2
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000006f475642a6e85809b1c36fa62763669b1b48dd5b
Arg [1] : 00000000000000000000000007712d748c40608810a0305751e35f0eedef70d2
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ 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.