Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 10 from a total of 10 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Donate And Claim | 20251041 | 170 days ago | IN | 0.00048904 ETH | 0.0000372 | ||||
Donate And Claim | 20138694 | 185 days ago | IN | 0.00025619 ETH | 0.000137 | ||||
Transfer Ownersh... | 20132575 | 186 days ago | IN | 0 ETH | 0.00075922 | ||||
Set Delegate | 20132574 | 186 days ago | IN | 0 ETH | 0.00093735 | ||||
Set Merkle Root | 20132374 | 186 days ago | IN | 0 ETH | 0.00036697 | ||||
Set Rate Limits | 20132322 | 186 days ago | IN | 0 ETH | 0.00027076 | ||||
Set Rate Limits | 20131783 | 186 days ago | IN | 0 ETH | 0.0014155 | ||||
Set Enforced Opt... | 20131782 | 186 days ago | IN | 0 ETH | 0.00151896 | ||||
Set Peer | 20131780 | 186 days ago | IN | 0 ETH | 0.00067526 | ||||
Set Donate And C... | 20131702 | 186 days ago | IN | 0 ETH | 0.00043569 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block |
From
|
To
|
|||
---|---|---|---|---|---|---|
21013236 | 63 days ago | 0.00443616 ETH | ||||
21013236 | 63 days ago | 0.00443616 ETH | ||||
21012593 | 63 days ago | 0.00506431 ETH | ||||
21012593 | 63 days ago | 0.00506431 ETH | ||||
21007864 | 64 days ago | 0.00618822 ETH | ||||
21007864 | 64 days ago | 0.00618822 ETH | ||||
21005564 | 64 days ago | 0.00538705 ETH | ||||
21005564 | 64 days ago | 0.00538705 ETH | ||||
21004347 | 64 days ago | 0.00406537 ETH | ||||
21004347 | 64 days ago | 0.00406537 ETH | ||||
21003774 | 65 days ago | 0.00454964 ETH | ||||
21003774 | 65 days ago | 0.00454964 ETH | ||||
21002852 | 65 days ago | 0.00431339 ETH | ||||
21002852 | 65 days ago | 0.00431339 ETH | ||||
21002515 | 65 days ago | 0.00449334 ETH | ||||
21002515 | 65 days ago | 0.00449334 ETH | ||||
21001950 | 65 days ago | 0.00411299 ETH | ||||
21001950 | 65 days ago | 0.00411299 ETH | ||||
20995250 | 66 days ago | 0.00572768 ETH | ||||
20995250 | 66 days ago | 0.00572768 ETH | ||||
20993236 | 66 days ago | 0.01544894 ETH | ||||
20993236 | 66 days ago | 0.01544894 ETH | ||||
20984426 | 67 days ago | 0.00899637 ETH | ||||
20984426 | 67 days ago | 0.00899637 ETH | ||||
20984375 | 67 days ago | 0.01020084 ETH |
Loading...
Loading
Contract Name:
ClaimRemote
Compiler Version
v0.8.22+commit.4fc1097e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.22; import { OAppOptionsType3 } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/libs/OAppOptionsType3.sol"; import { OAppSender } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppSender.sol"; import { OAppCore } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/OAppCore.sol"; import { RateLimiter } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oapp/utils/RateLimiter.sol"; // solhint-disable-next-line max-line-length import { MessagingFee, MessagingReceipt, MessagingParams } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol"; import { ClaimCore, Currency } from "./ClaimCore.sol"; /** * @title ZROClaimRemote */ contract ClaimRemote is ClaimCore, OAppSender, OAppOptionsType3, RateLimiter { uint8 internal constant MSG_TYPE_CLAIM = 1; uint32 public immutable remoteEid; constructor( uint32 _remoteEid, address _endpoint, bytes32 _merkleRoot, address _donateContract, address _stargateUsdc, address _stargateUsdt, address _stargateNative, uint256 _nativePrice, address _owner ) ClaimCore(_merkleRoot, _donateContract, _stargateUsdc, _stargateUsdt, _stargateNative, _nativePrice, _owner) OAppCore(_endpoint, _owner) { remoteEid = _remoteEid; } function setRateLimits(RateLimitConfig[] memory _rateLimitConfigs) external onlyOwner { _setRateLimits(_rateLimitConfigs); } /** * @notice Quote the fee for MSG_TYPE_CLAIM to claim tokens from a remote ZROClaimHub contract * @param _to The address to send the tokens to on this chain * @param _zroAmount The amount of tokens to claim * @param _extraOptions Additional options for the message * @return fee The MessagingFee for MSG_TYPE_CLAIM */ function quoteClaim( address _to, uint256 _zroAmount, bytes calldata _extraOptions ) external view virtual returns (MessagingFee memory fee) { bytes memory payload = abi.encode(msg.sender, _zroAmount, _to); bytes memory options = combineOptions(remoteEid, MSG_TYPE_CLAIM, _extraOptions); return _quote(remoteEid, payload, options, false); } /** * @notice Claim tokens from a remote ZROClaimHub contract. Pay for donation on source chain and send a LZ message * to the ZROClaimHub contract on the destination chain. Once the message is received, the ZRO tokens will be sent * back to this chain to the provided 'to' address * @param _currency The currency of the donation to be paid * @param _zroAmount The amount of tokens to claim * @param _proof The Merkle proof for the redemption * @param _to The address to send the tokens to on this chain * @param _extraOptions Additional options for the message * @return receipt The MessagingReceipt for the message */ function claim( Currency _currency, uint256 _zroAmount, bytes32[] calldata _proof, address _to, bytes calldata _extraOptions // need enough to send 'msg.value' back to this chain via, quoteClaimCallback() ) external payable returns (MessagingReceipt memory receipt) { return _claim(msg.sender, _currency, _zroAmount, _proof, _to, _extraOptions); } function claim( address _user, Currency _currency, uint256 _zroAmount, bytes32[] calldata _proof, address _to, bytes calldata _extraOptions // need enough to send 'msg.value' back to this chain via, quoteClaimCallback() ) external payable onlyDonateAndClaim returns (MessagingReceipt memory receipt) { return _claim(_user, _currency, _zroAmount, _proof, _to, _extraOptions); } function _claim( address _user, Currency _currency, uint256 _zroAmount, bytes32[] calldata _proof, address _to, bytes calldata _extraOptions // need enough to send 'msg.value' back to this chain via, quoteClaimCallback() ) internal returns (MessagingReceipt memory receipt) { if (_to == address(0)) revert InvalidToAddress(); // step 1: assert claimer has donated sufficient amount assertDonation(_currency, _user, _zroAmount); // step 2: validate the proof is correct if (!_verifyProof(_user, _zroAmount, _proof)) revert InvalidProof(); // step 3: rate limiting the transactions _checkAndUpdateRateLimit(remoteEid, 1 /** amount */); // step 4: generate the message and options for the crosschain call bytes memory payload = abi.encode(_user, _zroAmount, _to); bytes memory options = combineOptions(remoteEid, MSG_TYPE_CLAIM, _extraOptions); // step 5: send the message cross chain // solhint-disable-next-line check-send-result receipt = endpoint.send{ value: msg.value }( MessagingParams(remoteEid, _getPeerOrRevert(remoteEid), payload, options, false), payable(_user) ); emit ZRORequested(_user, _zroAmount, _to); } }
// 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 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 { ILayerZeroEndpointV2 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol"; /** * @title IOAppCore */ interface IOAppCore { // Custom error messages error OnlyPeer(uint32 eid, bytes32 sender); error NoPeer(uint32 eid); error InvalidEndpointCall(); error InvalidDelegate(); // Event emitted when a peer (OApp) is set for a corresponding endpoint event PeerSet(uint32 eid, bytes32 peer); /** * @notice Retrieves the OApp version information. * @return senderVersion The version of the OAppSender.sol contract. * @return receiverVersion The version of the OAppReceiver.sol contract. */ function oAppVersion() external view returns (uint64 senderVersion, uint64 receiverVersion); /** * @notice Retrieves the LayerZero endpoint associated with the OApp. * @return iEndpoint The LayerZero endpoint as an interface. */ function endpoint() external view returns (ILayerZeroEndpointV2 iEndpoint); /** * @notice Retrieves the peer (OApp) associated with a corresponding endpoint. * @param _eid The endpoint ID. * @return peer The peer address (OApp instance) associated with the corresponding endpoint. */ function peers(uint32 _eid) external view returns (bytes32 peer); /** * @notice Sets the peer address (OApp instance) for a corresponding endpoint. * @param _eid The endpoint ID. * @param _peer The address of the peer to be associated with the corresponding endpoint. */ function setPeer(uint32 _eid, bytes32 _peer) external; /** * @notice Sets the delegate address for the OApp Core. * @param _delegate The address of the delegate to be set. */ function setDelegate(address _delegate) external; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; /** * @dev Struct representing enforced option parameters. */ struct EnforcedOptionParam { uint32 eid; // Endpoint ID uint16 msgType; // Message Type bytes options; // Additional options } /** * @title IOAppOptionsType3 * @dev Interface for the OApp with Type 3 Options, allowing the setting and combining of enforced options. */ interface IOAppOptionsType3 { // Custom error message for invalid options error InvalidOptions(bytes options); // Event emitted when enforced options are set event EnforcedOptionSet(EnforcedOptionParam[] _enforcedOptions); /** * @notice Sets enforced options for specific endpoint and message type combinations. * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options. */ function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) external; /** * @notice Combines options for a given endpoint and message type. * @param _eid The endpoint ID. * @param _msgType The OApp message type. * @param _extraOptions Additional options passed by the caller. * @return options The combination of caller specified options AND enforced options. */ function combineOptions( uint32 _eid, uint16 _msgType, bytes calldata _extraOptions ) external view returns (bytes memory options); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IOAppOptionsType3, EnforcedOptionParam } from "../interfaces/IOAppOptionsType3.sol"; /** * @title OAppOptionsType3 * @dev Abstract contract implementing the IOAppOptionsType3 interface with type 3 options. */ abstract contract OAppOptionsType3 is IOAppOptionsType3, Ownable { uint16 internal constant OPTION_TYPE_3 = 3; // @dev The "msgType" should be defined in the child contract. mapping(uint32 eid => mapping(uint16 msgType => bytes enforcedOption)) public enforcedOptions; /** * @dev Sets the enforced options for specific endpoint and message type combinations. * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options. * * @dev Only the owner/admin of the OApp can call this function. * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc. * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType. * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose(). */ function setEnforcedOptions(EnforcedOptionParam[] calldata _enforcedOptions) public virtual onlyOwner { _setEnforcedOptions(_enforcedOptions); } /** * @dev Sets the enforced options for specific endpoint and message type combinations. * @param _enforcedOptions An array of EnforcedOptionParam structures specifying enforced options. * * @dev Provides a way for the OApp to enforce things like paying for PreCrime, AND/OR minimum dst lzReceive gas amounts etc. * @dev These enforced options can vary as the potential options/execution on the remote may differ as per the msgType. * eg. Amount of lzReceive() gas necessary to deliver a lzCompose() message adds overhead you dont want to pay * if you are only making a standard LayerZero message ie. lzReceive() WITHOUT sendCompose(). */ function _setEnforcedOptions(EnforcedOptionParam[] memory _enforcedOptions) internal virtual { for (uint256 i = 0; i < _enforcedOptions.length; i++) { // @dev Enforced options are only available for optionType 3, as type 1 and 2 dont support combining. _assertOptionsType3(_enforcedOptions[i].options); enforcedOptions[_enforcedOptions[i].eid][_enforcedOptions[i].msgType] = _enforcedOptions[i].options; } emit EnforcedOptionSet(_enforcedOptions); } /** * @notice Combines options for a given endpoint and message type. * @param _eid The endpoint ID. * @param _msgType The OAPP message type. * @param _extraOptions Additional options passed by the caller. * @return options The combination of caller specified options AND enforced options. * * @dev If there is an enforced lzReceive option: * - {gasLimit: 200k, msg.value: 1 ether} AND a caller supplies a lzReceive option: {gasLimit: 100k, msg.value: 0.5 ether} * - The resulting options will be {gasLimit: 300k, msg.value: 1.5 ether} when the message is executed on the remote lzReceive() function. * @dev This presence of duplicated options is handled off-chain in the verifier/executor. */ function combineOptions( uint32 _eid, uint16 _msgType, bytes calldata _extraOptions ) public view virtual returns (bytes memory) { bytes memory enforced = enforcedOptions[_eid][_msgType]; // No enforced options, pass whatever the caller supplied, even if it's empty or legacy type 1/2 options. if (enforced.length == 0) return _extraOptions; // No caller options, return enforced if (_extraOptions.length == 0) return enforced; // @dev If caller provided _extraOptions, must be type 3 as its the ONLY type that can be combined. if (_extraOptions.length >= 2) { _assertOptionsType3(_extraOptions); // @dev Remove the first 2 bytes containing the type from the _extraOptions and combine with enforced. return bytes.concat(enforced, _extraOptions[2:]); } // No valid set of options was found. revert InvalidOptions(_extraOptions); } /** * @dev Internal function to assert that options are of type 3. * @param _options The options to be checked. */ function _assertOptionsType3(bytes memory _options) internal pure virtual { uint16 optionsType; assembly { optionsType := mload(add(_options, 2)) } if (optionsType != OPTION_TYPE_3) revert InvalidOptions(_options); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; /** * @title RateLimiter * @dev Abstract contract for implementing rate limiting functionality. This contract provides a basic framework for * rate limiting how often a function can be executed. It is designed to be inherited by other contracts requiring rate * limiting capabilities to protect resources or services from excessive use. * * Example 1: Max rate limit reached at beginning of window. As time continues the amount of in flights comes down. * * Rate Limit Config: * limit: 100 units * window: 60 seconds * * Amount in Flight (units) vs. Time Graph (seconds) * * 100 | * - (Max limit reached at beginning of window) * | * * | * * | * * 50 | * (After 30 seconds only 50 units in flight) * | * * | * * | * * 0 +--|---|---|---|---|-->(After 60 seconds 0 units are in flight) * 0 15 30 45 60 (seconds) * * Example 2: Max rate limit reached at beginning of window. As time continues the amount of in flights comes down * allowing for more to be sent. At the 90 second mark, more in flights come in. * * Rate Limit Config: * limit: 100 units * window: 60 seconds * * Amount in Flight (units) vs. Time Graph (seconds) * * 100 | * - (Max limit reached at beginning of window) * | * * | * * | * * 50 | * * (50 inflight) * | * * * | * * * | * * * 0 +--|--|--|--|--|--|--|--|--|--> Time * 0 15 30 45 60 75 90 105 120 (seconds) * * Example 3: Max rate limit reached at beginning of window. At the 15 second mark, the window gets updated to 60 * seconds and the limit gets updated to 50 units. This scenario shows the direct depiction of "in flight" from the * previous window affecting the current window. * * Initial Rate Limit Config: For first 15 seconds * limit: 100 units * window: 30 seconds * * Updated Rate Limit Config: Updated at 15 second mark * limit: 50 units * window: 60 seconds * * Amount in Flight (units) vs. Time Graph (seconds) * 100 - * * |* * | * * | * * | * * | * * | * * 75 - | * * | * * | * * | * * | * * | * * | * * | * * 50 - | 𐫰 <--(Slope changes at the 15 second mark because of the update. * | ✧ * Window extended to 60 seconds and limit reduced to 50 units. * | ✧ ︎ * Because amountInFlight/lastUpdated do not reset, 50 units are * | ✧ * considered in flight from the previous window and the corresponding * | ✧ ︎ * decay from the previous rate.) * | ✧ * * 25 - | ✧ * * | ✧ * * | ✧ * * | ✧ * * | ✧ * * | ✧ * * | ✧ * * | ✧ * * 0 - +---|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----|----> Time * 0 5 10 15 20 25 30 35 40 45 50 55 60 65 70 75 80 85 90 (seconds) * [ Initial 30 Second Window ] * [ --------------- Extended 60 Second Window --------------- ] */ abstract contract RateLimiter { /** * @notice Rate Limit struct. * @param amountInFlight The amount in the current window. * @param lastUpdated Timestamp representing the last time the rate limit was checked or updated. * @param limit This represents the maximum allowed amount within a given window. * @param window Defines the duration of the rate limiting window. */ struct RateLimit { uint256 amountInFlight; uint256 lastUpdated; uint256 limit; uint256 window; } /** * @notice Rate Limit Configuration struct. * @param dstEid The destination endpoint id. * @param limit This represents the maximum allowed amount within a given window. * @param window Defines the duration of the rate limiting window. */ struct RateLimitConfig { uint32 dstEid; uint256 limit; uint256 window; } /** * @dev Mapping from destination endpoint id to RateLimit Configurations. */ mapping(uint32 dstEid => RateLimit limit) public rateLimits; /** * @notice Emitted when _setRateLimits occurs. * @param rateLimitConfigs An array of `RateLimitConfig` structs representing the rate limit configurations set. * - `dstEid`: The destination endpoint id. * - `limit`: This represents the maximum allowed amount within a given window. * - `window`: Defines the duration of the rate limiting window. */ event RateLimitsChanged(RateLimitConfig[] rateLimitConfigs); /** * @notice Error that is thrown when an amount exceeds the rate_limit. */ error RateLimitExceeded(); /** * @notice Get the current amount that can be sent to this destination endpoint id for the given rate limit window. * @param _dstEid The destination endpoint id. * @return currentAmountInFlight The current amount that was sent. * @return amountCanBeSent The amount that can be sent. */ function getAmountCanBeSent( uint32 _dstEid ) external view virtual returns (uint256 currentAmountInFlight, uint256 amountCanBeSent) { RateLimit memory rl = rateLimits[_dstEid]; return _amountCanBeSent(rl.amountInFlight, rl.lastUpdated, rl.limit, rl.window); } /** * @notice Sets the Rate Limit. * @param _rateLimitConfigs A `RateLimitConfig` struct representing the rate limit configuration. * - `dstEid`: The destination endpoint id. * - `limit`: This represents the maximum allowed amount within a given window. * - `window`: Defines the duration of the rate limiting window. */ function _setRateLimits(RateLimitConfig[] memory _rateLimitConfigs) internal virtual { unchecked { for (uint256 i = 0; i < _rateLimitConfigs.length; i++) { RateLimit storage rl = rateLimits[_rateLimitConfigs[i].dstEid]; // @dev Ensure we checkpoint the existing rate limit as to not retroactively apply the new decay rate. _checkAndUpdateRateLimit(_rateLimitConfigs[i].dstEid, 0); // @dev Does NOT reset the amountInFlight/lastUpdated of an existing rate limit. rl.limit = _rateLimitConfigs[i].limit; rl.window = _rateLimitConfigs[i].window; } } emit RateLimitsChanged(_rateLimitConfigs); } /** * @notice Checks current amount in flight and amount that can be sent for a given rate limit window. * @param _amountInFlight The amount in the current window. * @param _lastUpdated Timestamp representing the last time the rate limit was checked or updated. * @param _limit This represents the maximum allowed amount within a given window. * @param _window Defines the duration of the rate limiting window. * @return currentAmountInFlight The amount in the current window. * @return amountCanBeSent The amount that can be sent. */ function _amountCanBeSent( uint256 _amountInFlight, uint256 _lastUpdated, uint256 _limit, uint256 _window ) internal view virtual returns (uint256 currentAmountInFlight, uint256 amountCanBeSent) { uint256 timeSinceLastDeposit = block.timestamp - _lastUpdated; if (timeSinceLastDeposit >= _window) { currentAmountInFlight = 0; amountCanBeSent = _limit; } else { // @dev Presumes linear decay. uint256 decay = (_limit * timeSinceLastDeposit) / _window; currentAmountInFlight = _amountInFlight <= decay ? 0 : _amountInFlight - decay; // @dev In the event the _limit is lowered, and the 'in-flight' amount is higher than the _limit, set to 0. amountCanBeSent = _limit <= currentAmountInFlight ? 0 : _limit - currentAmountInFlight; } } /** * @notice Verifies whether the specified amount falls within the rate limit constraints for the targeted * endpoint ID. On successful verification, it updates amountInFlight and lastUpdated. If the amount exceeds * the rate limit, the operation reverts. * @param _dstEid The destination endpoint id. * @param _amount The amount to check for rate limit constraints. */ function _checkAndUpdateRateLimit(uint32 _dstEid, uint256 _amount) internal virtual { // @dev By default dstEid that have not been explicitly set will return amountCanBeSent == 0. RateLimit storage rl = rateLimits[_dstEid]; (uint256 currentAmountInFlight, uint256 amountCanBeSent) = _amountCanBeSent( rl.amountInFlight, rl.lastUpdated, rl.limit, rl.window ); if (_amount > amountCanBeSent) revert RateLimitExceeded(); // @dev Update the storage to contain the new amount and current timestamp. rl.amountInFlight = currentAmountInFlight + _amount; rl.lastUpdated = block.timestamp; } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.20; import { MessagingReceipt, MessagingFee } from "../../oapp/OAppSender.sol"; /** * @dev Struct representing token parameters for the OFT send() operation. */ struct SendParam { uint32 dstEid; // Destination endpoint ID. bytes32 to; // Recipient address. uint256 amountLD; // Amount to send in local decimals. uint256 minAmountLD; // Minimum amount to send in local decimals. bytes extraOptions; // Additional options supplied by the caller to be used in the LayerZero message. bytes composeMsg; // The composed message for the send() operation. bytes oftCmd; // The OFT command to be executed, unused in default OFT implementations. } /** * @dev Struct representing OFT limit information. * @dev These amounts can change dynamically and are up the the specific oft implementation. */ struct OFTLimit { uint256 minAmountLD; // Minimum amount in local decimals that can be sent to the recipient. uint256 maxAmountLD; // Maximum amount in local decimals that can be sent to the recipient. } /** * @dev Struct representing OFT receipt information. */ struct OFTReceipt { uint256 amountSentLD; // Amount of tokens ACTUALLY debited from the sender in local decimals. // @dev In non-default implementations, the amountReceivedLD COULD differ from this value. uint256 amountReceivedLD; // Amount of tokens to be received on the remote side. } /** * @dev Struct representing OFT fee details. * @dev Future proof mechanism to provide a standardized way to communicate fees to things like a UI. */ struct OFTFeeDetail { int256 feeAmountLD; // Amount of the fee in local decimals. string description; // Description of the fee. } /** * @title IOFT * @dev Interface for the OftChain (OFT) token. * @dev Does not inherit ERC20 to accommodate usage by OFTAdapter as well. * @dev This specific interface ID is '0x02e49c2c'. */ interface IOFT { // Custom error messages error InvalidLocalDecimals(); error SlippageExceeded(uint256 amountLD, uint256 minAmountLD); // Events event OFTSent( bytes32 indexed guid, // GUID of the OFT message. uint32 dstEid, // Destination Endpoint ID. address indexed fromAddress, // Address of the sender on the src chain. uint256 amountSentLD, // Amount of tokens sent in local decimals. uint256 amountReceivedLD // Amount of tokens received in local decimals. ); event OFTReceived( bytes32 indexed guid, // GUID of the OFT message. uint32 srcEid, // Source Endpoint ID. address indexed toAddress, // Address of the recipient on the dst chain. uint256 amountReceivedLD // Amount of tokens received in local decimals. ); /** * @notice Retrieves interfaceID and the version of the OFT. * @return interfaceId The interface ID. * @return version The version. * * @dev interfaceId: This specific interface ID is '0x02e49c2c'. * @dev version: Indicates a cross-chain compatible msg encoding with other OFTs. * @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented. * ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1) */ function oftVersion() external view returns (bytes4 interfaceId, uint64 version); /** * @notice Retrieves the address of the token associated with the OFT. * @return token The address of the ERC20 token implementation. */ function token() external view returns (address); /** * @notice Indicates whether the OFT contract requires approval of the 'token()' to send. * @return requiresApproval Needs approval of the underlying token implementation. * * @dev Allows things like wallet implementers to determine integration requirements, * without understanding the underlying token implementation. */ function approvalRequired() external view returns (bool); /** * @notice Retrieves the shared decimals of the OFT. * @return sharedDecimals The shared decimals of the OFT. */ function sharedDecimals() external view returns (uint8); /** * @notice Provides a quote for OFT-related operations. * @param _sendParam The parameters for the send operation. * @return limit The OFT limit information. * @return oftFeeDetails The details of OFT fees. * @return receipt The OFT receipt information. */ function quoteOFT( SendParam calldata _sendParam ) external view returns (OFTLimit memory, OFTFeeDetail[] memory oftFeeDetails, OFTReceipt memory); /** * @notice Provides a quote for the send() operation. * @param _sendParam The parameters for the send() operation. * @param _payInLzToken Flag indicating whether the caller is paying in the LZ token. * @return fee The calculated LayerZero messaging fee from the send() operation. * * @dev MessagingFee: LayerZero msg fee * - nativeFee: The native fee. * - lzTokenFee: The lzToken fee. */ function quoteSend(SendParam calldata _sendParam, bool _payInLzToken) external view returns (MessagingFee memory); /** * @notice Executes the send() operation. * @param _sendParam The parameters for the send operation. * @param _fee The fee information supplied by the caller. * - nativeFee: The native fee. * - lzTokenFee: The lzToken fee. * @param _refundAddress The address to receive any excess funds from fees etc. on the src. * @return receipt The LayerZero messaging receipt from the send() operation. * @return oftReceipt The OFT receipt information. * * @dev MessagingReceipt: LayerZero msg receipt * - guid: The unique identifier for the sent message. * - nonce: The nonce of the sent message. * - fee: The LayerZero fee incurred for the message. */ function send( SendParam calldata _sendParam, MessagingFee calldata _fee, address _refundAddress ) external payable returns (MessagingReceipt memory, OFTReceipt memory); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { IMessageLibManager } from "./IMessageLibManager.sol"; import { IMessagingComposer } from "./IMessagingComposer.sol"; import { IMessagingChannel } from "./IMessagingChannel.sol"; import { IMessagingContext } from "./IMessagingContext.sol"; struct MessagingParams { uint32 dstEid; bytes32 receiver; bytes message; bytes options; bool payInLzToken; } struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; } struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; } struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; } interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext { event PacketSent(bytes encodedPayload, bytes options, address sendLibrary); event PacketVerified(Origin origin, address receiver, bytes32 payloadHash); event PacketDelivered(Origin origin, address receiver); event LzReceiveAlert( address indexed receiver, address indexed executor, Origin origin, bytes32 guid, uint256 gas, uint256 value, bytes message, bytes extraData, bytes reason ); event LzTokenSet(address token); event DelegateSet(address sender, address delegate); function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory); function send( MessagingParams calldata _params, address _refundAddress ) external payable returns (MessagingReceipt memory); function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external; function verifiable(Origin calldata _origin, address _receiver) external view returns (bool); function initializable(Origin calldata _origin, address _receiver) external view returns (bool); function lzReceive( Origin calldata _origin, address _receiver, bytes32 _guid, bytes calldata _message, bytes calldata _extraData ) external payable; // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external; function setLzToken(address _lzToken) external; function lzToken() external view returns (address); function nativeToken() external view returns (address); function setDelegate(address _delegate) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; 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 IMessagingChannel { event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce); event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); function eid() external view returns (uint32); // this is an emergency function if a message cannot be verified for some reasons // required to provide _nextNonce to avoid race condition function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external; function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32); function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64); function inboundPayloadHash( address _receiver, uint32 _srcEid, bytes32 _sender, uint64 _nonce ) external view returns (bytes32); function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingComposer { event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message); event ComposeDelivered(address from, address to, bytes32 guid, uint16 index); event LzComposeAlert( address indexed from, address indexed to, address indexed executor, bytes32 guid, uint16 index, uint256 gas, uint256 value, bytes message, bytes extraData, bytes reason ); function composeQueue( address _from, address _to, bytes32 _guid, uint16 _index ) external view returns (bytes32 messageHash); function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external; function lzCompose( address _from, address _to, bytes32 _guid, uint16 _index, bytes calldata _message, bytes calldata _extraData ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingContext { function isSendingMessage() external view returns (bool); function getSendContext() external view returns (uint32 dstEid, address sender); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated 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 // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the 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: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; /** * @dev Interface for the optional metadata functions from the ERC20 standard. */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.20; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.20; import {IERC20} from "../IERC20.sol"; import {IERC20Permit} from "../extensions/IERC20Permit.sol"; import {Address} from "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev An operation with an ERC20 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. */ 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. */ 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. */ 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 Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data); if (returndata.length != 0 && !abi.decode(returndata, (bool))) { 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 silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol) pragma solidity ^0.8.20; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev The ETH balance of the account is not enough to perform the operation. */ error AddressInsufficientBalance(address account); /** * @dev There's no code at `target` (it is not a contract). */ error AddressEmptyCode(address target); /** * @dev A call to an address target failed. The target may have reverted. */ error FailedInnerCall(); /** * @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 AddressInsufficientBalance(address(this)); } (bool success, ) = recipient.call{value: amount}(""); if (!success) { revert FailedInnerCall(); } } /** * @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 * {FailedInnerCall} 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 AddressInsufficientBalance(address(this)); } (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 {FailedInnerCall}) 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 {FailedInnerCall} 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 {FailedInnerCall}. */ 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 /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert FailedInnerCall(); } } }
// 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.0.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.20; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The tree and the proofs can be generated using our * https://github.com/OpenZeppelin/merkle-tree[JavaScript library]. * You will find a quickstart guide in the readme. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the Merkle tree could be reinterpreted as a leaf value. * OpenZeppelin's JavaScript library generates Merkle trees that are safe * against this attack out of the box. */ library MerkleProof { /** *@dev The multiproof provided is not valid. */ error MerkleProofInvalidMultiproof(); /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify(bytes32[] memory proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} */ function verifyCalldata(bytes32[] calldata proof, bytes32 root, bytes32 leaf) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be simultaneously proven to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and sibling nodes in `proof`. The reconstruction * proceeds by incrementally reconstructing all inner nodes by combining a leaf/inner node with either another * leaf/inner node or a proof sibling node, depending on whether each `proofFlags` item is true or false * respectively. * * CAUTION: Not all Merkle trees admit multiproofs. To use multiproofs, it is sufficient to ensure that: 1) the tree * is complete (but not necessarily perfect), 2) the leaves to be proven are in the opposite order they are in the * tree (i.e., as seen from right to left starting at the deepest layer and continuing at the next layer). */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof}. * * CAUTION: Not all Merkle trees admit multiproofs. See {processMultiProof} for details. */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuilds the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the Merkle tree. uint256 leavesLen = leaves.length; uint256 proofLen = proof.length; uint256 totalHashes = proofFlags.length; // Check proof validity. if (leavesLen + proofLen != totalHashes + 1) { revert MerkleProofInvalidMultiproof(); } // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value from the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? (leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]) : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { if (proofPos != proofLen) { revert MerkleProofInvalidMultiproof(); } unchecked { return hashes[totalHashes - 1]; } } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Sorts the pair (a, b) and hashes the result. */ function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } /** * @dev Implementation of keccak256(abi.encode(a, b)) that doesn't allocate or expand memory. */ function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.22; import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; import { MerkleProof } from "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IOFT } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/interfaces/IOFT.sol"; import { IClaim, IDonate, Currency, Donation } from "./IClaim.sol"; /** * @title ClaimCore */ abstract contract ClaimCore is IClaim, Ownable { bytes32 public merkleRoot; IDonate public immutable donateContract; uint256 public immutable numeratorUsdc; uint256 public immutable numeratorUsdt; uint256 public immutable numeratorNative; uint256 public constant DENOMINATOR = 10 ** 18; address public donateAndClaim; modifier onlyDonateAndClaim() { if (msg.sender != donateAndClaim) revert OnlyDonateAndClaim(); _; } constructor( bytes32 _merkleRoot, address _donateContract, address _stargateUsdc, address _stargateUsdt, address _stargateNative, uint256 _nativePrice, address _owner ) Ownable(_owner) { merkleRoot = _merkleRoot; donateContract = IDonate(_donateContract); if (_stargateUsdc != address(0)) { numeratorUsdc = 10 ** (IERC20Metadata(IOFT(_stargateUsdc).token()).decimals() - 1); // -1 for 10% } if (_stargateUsdt != address(0)) { numeratorUsdt = 10 ** (IERC20Metadata(IOFT(_stargateUsdt).token()).decimals() - 1); // -1 for 10% } // native is always denominated in 18 decimals if (_stargateNative != address(0)) { // Validate this is an actual native pool, eg. NOT WETH if (IOFT(_stargateNative).token() != address(0)) { revert InvalidNativeStargate(); } if (_nativePrice == 0) revert InvalidNativePrice(); numeratorNative = (10 ** (18 - 1)) / _nativePrice; // -1 for 10% } } function setDonateAndClaim(address _donateAndClaim) external onlyOwner { if (donateAndClaim != address(0)) revert DonateAndClaimAlreadySet(); donateAndClaim = _donateAndClaim; emit DonateAndClaimSet(_donateAndClaim); } /** * @notice Quote the donation amount * @param _zroAmount amount of zro to calculate required donation against * @return donation amount in native and stable coin. */ function requiredDonation(uint256 _zroAmount) public view returns (Donation memory) { uint256 usdc = (_zroAmount * numeratorUsdc) / DENOMINATOR; uint256 usdt = (_zroAmount * numeratorUsdt) / DENOMINATOR; uint256 native = (_zroAmount * numeratorNative) / DENOMINATOR; return Donation(usdc, usdt, native); } function assertDonation(Currency _currency, address _user, uint256 _zroAmount) public view { // retrieve the expected and actual donation amounts Donation memory expectedDonation = requiredDonation(_zroAmount); Donation memory actualDonation = donateContract.getDonation(_user); // numerator must be set, otherwise indicates theres an unsupported currency attempting to assert // this is a threshold, users can submit more than "required" if (_currency == Currency.USDC && numeratorUsdc > 0) { if (expectedDonation.usdc > actualDonation.usdc) { revert InsufficientDonation(_currency, expectedDonation.usdc, actualDonation.usdc); } } else if (_currency == Currency.USDT && numeratorUsdt > 0) { if (expectedDonation.usdt > actualDonation.usdt) { revert InsufficientDonation(_currency, expectedDonation.usdt, actualDonation.usdt); } } else if (_currency == Currency.Native && numeratorNative > 0) { if (expectedDonation.native > actualDonation.native) { revert InsufficientDonation(_currency, expectedDonation.native, actualDonation.native); } } else { revert IDonate.UnsupportedCurrency(_currency); } } /** * @notice Set the merkle root for the claim * @param _merkleRoot New merkle root */ function setMerkleRoot(bytes32 _merkleRoot) external onlyOwner { // Can be set to zero address to effectively pause merkleRoot = _merkleRoot; emit MerkleRootSet(_merkleRoot); } /** * @notice Leaf encode the user and amount * @param _account User address * @param _zroAmount Amount of ZRO * @return Leaf hash */ function _leafEncode(address _account, uint256 _zroAmount) internal pure returns (bytes32) { return keccak256(abi.encodePacked(keccak256(abi.encodePacked(_account, _zroAmount)))); } /** * @notice Verify the proof using the merkle root * @param _user User address * @param _zroAmount Amount of ZRO * @param _proof Merkle proof * @return True if proof is valid */ function _verifyProof( address _user, uint256 _zroAmount, bytes32[] calldata _proof ) internal view virtual returns (bool) { bytes32 leaf = _leafEncode(_user, _zroAmount); return MerkleProof.verify(_proof, merkleRoot, leaf); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.22; import { MessagingReceipt } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol"; // solhint-disable-next-line no-unused-import import { IDonate, Currency, Donation } from "../donate/IDonate.sol"; interface IClaim { // Custom Errors error AlreadyClaimed(address user); error InsufficientDonation(Currency currency, uint256 expectedAmount, uint256 actualAmount); error InvalidProof(); error InvalidNativeStargate(); error InvalidNativePrice(); error OnlyDonateAndClaim(); error DonateAndClaimAlreadySet(); error WithdrawFailed(); error MsgValueNotSupported(); error InvalidToAddress(); // Events event MerkleRootSet(bytes32 merkleRoot); event ZRORequested(address requester, uint256 zroAmount, address to); event DonateAndClaimSet(address donateAndClaim); event ZroWithdrawn(address to, uint256 amount); event NativeWithdrawn(address to, uint256 amount); // Functions function claim( Currency currency, uint256 zroAmount, bytes32[] calldata proof, address to, bytes calldata extraBytes ) external payable returns (MessagingReceipt memory receipt); function claim( address user, Currency currency, uint256 zroAmount, bytes32[] calldata proof, address to, bytes calldata extraBytes ) external payable returns (MessagingReceipt memory receipt); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.22; enum Currency { USDC, USDT, Native } struct Donation { uint256 usdc; uint256 usdt; uint256 native; } interface IDonate { // Custom Errors error InsufficientMsgValue(); error InsufficientBalance(); error UnsupportedCurrency(Currency currency); error WithdrawDonationFailed(); error InvalidNativeStargate(); error InvalidDonationReceiver(); error UnexpectedMsgValue(); // Events event Donated(Currency currency, address from, address beneficiary, uint256 amount); event DonationWithdrawn(Currency currency, address to, uint256 amount); // Functions function getDonation(address user) external view returns (Donation memory donation); function withdrawDonation(Currency currency, uint256 minAmount) external payable; function donate(Currency currency, uint256 amount, address beneficiary) external payable; }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 200 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint32","name":"_remoteEid","type":"uint32"},{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"},{"internalType":"address","name":"_donateContract","type":"address"},{"internalType":"address","name":"_stargateUsdc","type":"address"},{"internalType":"address","name":"_stargateUsdt","type":"address"},{"internalType":"address","name":"_stargateNative","type":"address"},{"internalType":"uint256","name":"_nativePrice","type":"uint256"},{"internalType":"address","name":"_owner","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"AlreadyClaimed","type":"error"},{"inputs":[],"name":"DonateAndClaimAlreadySet","type":"error"},{"inputs":[{"internalType":"enum Currency","name":"currency","type":"uint8"},{"internalType":"uint256","name":"expectedAmount","type":"uint256"},{"internalType":"uint256","name":"actualAmount","type":"uint256"}],"name":"InsufficientDonation","type":"error"},{"inputs":[],"name":"InvalidDelegate","type":"error"},{"inputs":[],"name":"InvalidEndpointCall","type":"error"},{"inputs":[],"name":"InvalidNativePrice","type":"error"},{"inputs":[],"name":"InvalidNativeStargate","type":"error"},{"inputs":[{"internalType":"bytes","name":"options","type":"bytes"}],"name":"InvalidOptions","type":"error"},{"inputs":[],"name":"InvalidProof","type":"error"},{"inputs":[],"name":"InvalidToAddress","type":"error"},{"inputs":[],"name":"LzTokenUnavailable","type":"error"},{"inputs":[],"name":"MsgValueNotSupported","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":[],"name":"OnlyDonateAndClaim","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"},{"inputs":[],"name":"RateLimitExceeded","type":"error"},{"inputs":[{"internalType":"enum Currency","name":"currency","type":"uint8"}],"name":"UnsupportedCurrency","type":"error"},{"inputs":[],"name":"WithdrawFailed","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"donateAndClaim","type":"address"}],"name":"DonateAndClaimSet","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"indexed":false,"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"EnforcedOptionSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"MerkleRootSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NativeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"indexed":false,"internalType":"bytes32","name":"peer","type":"bytes32"}],"name":"PeerSet","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"}],"indexed":false,"internalType":"struct RateLimiter.RateLimitConfig[]","name":"rateLimitConfigs","type":"tuple[]"}],"name":"RateLimitsChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"requester","type":"address"},{"indexed":false,"internalType":"uint256","name":"zroAmount","type":"uint256"},{"indexed":false,"internalType":"address","name":"to","type":"address"}],"name":"ZRORequested","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"ZroWithdrawn","type":"event"},{"inputs":[],"name":"DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"enum Currency","name":"_currency","type":"uint8"},{"internalType":"address","name":"_user","type":"address"},{"internalType":"uint256","name":"_zroAmount","type":"uint256"}],"name":"assertDonation","outputs":[],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_user","type":"address"},{"internalType":"enum Currency","name":"_currency","type":"uint8"},{"internalType":"uint256","name":"_zroAmount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"claim","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"receipt","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"enum Currency","name":"_currency","type":"uint8"},{"internalType":"uint256","name":"_zroAmount","type":"uint256"},{"internalType":"bytes32[]","name":"_proof","type":"bytes32[]"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"claim","outputs":[{"components":[{"internalType":"bytes32","name":"guid","type":"bytes32"},{"internalType":"uint64","name":"nonce","type":"uint64"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"internalType":"struct MessagingReceipt","name":"receipt","type":"tuple"}],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"},{"internalType":"uint16","name":"_msgType","type":"uint16"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"combineOptions","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"donateAndClaim","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"donateContract","outputs":[{"internalType":"contract IDonate","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"endpoint","outputs":[{"internalType":"contract ILayerZeroEndpointV2","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"}],"name":"enforcedOptions","outputs":[{"internalType":"bytes","name":"enforcedOption","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_dstEid","type":"uint32"}],"name":"getAmountCanBeSent","outputs":[{"internalType":"uint256","name":"currentAmountInFlight","type":"uint256"},{"internalType":"uint256","name":"amountCanBeSent","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"merkleRoot","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numeratorNative","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numeratorUsdc","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"numeratorUsdt","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"oAppVersion","outputs":[{"internalType":"uint64","name":"senderVersion","type":"uint64"},{"internalType":"uint64","name":"receiverVersion","type":"uint64"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"peers","outputs":[{"internalType":"bytes32","name":"peer","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_zroAmount","type":"uint256"},{"internalType":"bytes","name":"_extraOptions","type":"bytes"}],"name":"quoteClaim","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"fee","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"dstEid","type":"uint32"}],"name":"rateLimits","outputs":[{"internalType":"uint256","name":"amountInFlight","type":"uint256"},{"internalType":"uint256","name":"lastUpdated","type":"uint256"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"remoteEid","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_zroAmount","type":"uint256"}],"name":"requiredDonation","outputs":[{"components":[{"internalType":"uint256","name":"usdc","type":"uint256"},{"internalType":"uint256","name":"usdt","type":"uint256"},{"internalType":"uint256","name":"native","type":"uint256"}],"internalType":"struct Donation","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_delegate","type":"address"}],"name":"setDelegate","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_donateAndClaim","type":"address"}],"name":"setDonateAndClaim","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"internalType":"uint16","name":"msgType","type":"uint16"},{"internalType":"bytes","name":"options","type":"bytes"}],"internalType":"struct EnforcedOptionParam[]","name":"_enforcedOptions","type":"tuple[]"}],"name":"setEnforcedOptions","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_merkleRoot","type":"bytes32"}],"name":"setMerkleRoot","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":[{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"uint256","name":"limit","type":"uint256"},{"internalType":"uint256","name":"window","type":"uint256"}],"internalType":"struct RateLimiter.RateLimitConfig[]","name":"_rateLimitConfigs","type":"tuple[]"}],"name":"setRateLimits","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101406040523480156200001257600080fd5b5060405162002cb038038062002cb083398101604081905262000035916200047b565b878188888888888886806001600160a01b0381166200006e57604051631e4fbdf760e01b81526000600482015260240160405180910390fd5b62000079816200040e565b5060018790556001600160a01b038087166080528516156200017d576001856001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000d6573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000fc91906200052e565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200013a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000160919062000553565b6200016c91906200058e565b6200017990600a620006ad565b60a0525b6001600160a01b0384161562000275576001846001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001ce573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001f491906200052e565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000232573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019062000258919062000553565b6200026491906200058e565b6200027190600a620006ad565b60c0525b6001600160a01b03831615620003575760006001600160a01b0316836001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620002cf573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002f591906200052e565b6001600160a01b0316146200031d57604051630692f76560e01b815260040160405180910390fd5b816000036200033f576040516347da897160e01b815260040160405180910390fd5b620003538267016345785d8a0000620006be565b60e0525b5050506001600160a01b0380871661010052851693506200038f9250505057604051632d618d8160e21b815260040160405180910390fd5b6101005160405163ca5eb5e160e01b81526001600160a01b0383811660048301529091169063ca5eb5e190602401600060405180830381600087803b158015620003d857600080fd5b505af1158015620003ed573d6000803e3d6000fd5b50505063ffffffff909b166101205250620006e19950505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b03811681146200047657600080fd5b919050565b60008060008060008060008060006101208a8c0312156200049b57600080fd5b895163ffffffff81168114620004b057600080fd5b9850620004c060208b016200045e565b975060408a01519650620004d760608b016200045e565b9550620004e760808b016200045e565b9450620004f760a08b016200045e565b93506200050760c08b016200045e565b925060e08a015191506200051f6101008b016200045e565b90509295985092959850929598565b6000602082840312156200054157600080fd5b6200054c826200045e565b9392505050565b6000602082840312156200056657600080fd5b815160ff811681146200054c57600080fd5b634e487b7160e01b600052601160045260246000fd5b60ff8281168282160390811115620005aa57620005aa62000578565b92915050565b600181815b80851115620005f1578160001904821115620005d557620005d562000578565b80851615620005e357918102915b93841c9390800290620005b5565b509250929050565b6000826200060a57506001620005aa565b816200061957506000620005aa565b81600181146200063257600281146200063d576200065d565b6001915050620005aa565b60ff84111562000651576200065162000578565b50506001821b620005aa565b5060208310610133831016604e8410600b841016171562000682575081810a620005aa565b6200068e8383620005b0565b8060001904821115620006a557620006a562000578565b029392505050565b60006200054c60ff841683620005f9565b600082620006dc57634e487b7160e01b600052601260045260246000fd5b500490565b60805160a05160c05160e051610100516101205161250f620007a16000396000818161036701528181610b1c01528181610b4b015281816111bc015281816112230152818161128a01526112b901526000818161033301528181610dca0152818161124f01526113c80152600081816101d901528181610a4b0152610ed8015260008181610646015281816109ce0152610e9701526000818161047f0152818161094f0152610e560152600081816102e701526108c2015261250f6000f3fe6080604052600436106101c25760003560e01c80638da5cb5b116100f7578063bb0b6a5311610095578063d6d754db11610064578063d6d754db146105f2578063d776b41814610634578063f2fde38b14610668578063f94296371461068857600080fd5b8063bb0b6a5314610550578063bc70b3541461057d578063c272198d1461059d578063ca5eb5e1146105d257600080fd5b806399ba4f59116100d157806399ba4f591461046d5780639baa23e6146104a1578063ab99095d146104ce578063b98bd0701461053057600080fd5b80638da5cb5b146104135780638dab3f8114610431578063918f86741461045157600080fd5b8063569f9b7711610164578063715018a61161013e578063715018a61461039e57806379567417146103b35780637cb64759146103d35780638b2eddf9146103f357600080fd5b8063569f9b77146102d55780635e280f1114610321578063645b7fa61461035557600080fd5b80632eb4a7ab116101a05780632eb4a7ab146102525780633400288b1461026857806346f943e9146102885780635535d461146102a857600080fd5b80630904cc50146101c757806317442b701461020e57806318d79d1314610230575b600080fd5b3480156101d357600080fd5b506101fb7f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020015b60405180910390f35b34801561021a57600080fd5b5060408051600181526000602082015201610205565b34801561023c57600080fd5b5061025061024b3660046118a5565b61069b565b005b34801561025e57600080fd5b506101fb60015481565b34801561027457600080fd5b506102506102833660046118d4565b610722565b34801561029457600080fd5b506102506102a336600461198f565b610738565b3480156102b457600080fd5b506102c86102c3366004611a6a565b61074c565b6040516102059190611aed565b3480156102e157600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610205565b34801561032d57600080fd5b506103097f000000000000000000000000000000000000000000000000000000000000000081565b34801561036157600080fd5b506103897f000000000000000000000000000000000000000000000000000000000000000081565b60405163ffffffff9091168152602001610205565b3480156103aa57600080fd5b506102506107f1565b3480156103bf57600080fd5b50600254610309906001600160a01b031681565b3480156103df57600080fd5b506102506103ee366004611b00565b610805565b610406610401366004611bb4565b610842565b6040516102059190611c61565b34801561041f57600080fd5b506000546001600160a01b0316610309565b34801561043d57600080fd5b5061025061044c366004611ca3565b610892565b34801561045d57600080fd5b506101fb670de0b6b3a764000081565b34801561047957600080fd5b506101fb7f000000000000000000000000000000000000000000000000000000000000000081565b3480156104ad57600080fd5b506104c16104bc366004611cdf565b610aca565b6040516102059190611d38565b3480156104da57600080fd5b506105106104e9366004611d4f565b60056020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610205565b34801561053c57600080fd5b5061025061054b366004611d6a565b610b80565b34801561055c57600080fd5b506101fb61056b366004611d4f565b60036020526000908152604090205481565b34801561058957600080fd5b506102c8610598366004611dab565b610b9a565b3480156105a957600080fd5b506105bd6105b8366004611d4f565b610d42565b60408051928352602083019190915201610205565b3480156105de57600080fd5b506102506105ed3660046118a5565b610da3565b3480156105fe57600080fd5b5061061261060d366004611b00565b610e22565b6040805182518152602080840151908201529181015190820152606001610205565b34801561064057600080fd5b506101fb7f000000000000000000000000000000000000000000000000000000000000000081565b34801561067457600080fd5b506102506106833660046118a5565b610f2a565b610406610696366004611df3565b610f65565b6106a3610f89565b6002546001600160a01b0316156106cd57604051630abf614160e41b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f40dd9837620e8955c26f089308a386b585e7476d1b96cc080f88022a28406545906020015b60405180910390a150565b61072a610f89565b6107348282610fb6565b5050565b610740610f89565b6107498161100b565b50565b60046020908152600092835260408084209091529082529020805461077090611e90565b80601f016020809104026020016040519081016040528092919081815260200182805461079c90611e90565b80156107e95780601f106107be576101008083540402835291602001916107e9565b820191906000526020600020905b8154815290600101906020018083116107cc57829003601f168201915b505050505081565b6107f9610f89565b6108036000611104565b565b61080d610f89565b60018190556040518181527f42cbc405e4dbf1b691e85b9a34b08ecfcf7a9ad9078bf4d645ccfa1fac11c10b90602001610717565b61084a611842565b6002546001600160a01b031633146108755760405163118e623160e31b815260040160405180910390fd5b6108858989898989898989611154565b9998505050505050505050565b600061089d82610e22565b6040516320850e9960e11b81526001600160a01b0385811660048301529192506000917f0000000000000000000000000000000000000000000000000000000000000000169063410a1d3290602401606060405180830381865afa158015610909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092d9190611eca565b9050600085600281111561094357610943611f06565b148015610970575060007f0000000000000000000000000000000000000000000000000000000000000000115b156109ae578051825111156109a957815181516040516306cb6f9f60e41b81526109a09288929091600401611f3e565b60405180910390fd5b610ac3565b60018560028111156109c2576109c2611f06565b1480156109ef575060007f0000000000000000000000000000000000000000000000000000000000000000115b15610a2b578060200151826020015111156109a95784826020015182602001516040516306cb6f9f60e41b81526004016109a093929190611f3e565b6002856002811115610a3f57610a3f611f06565b148015610a6c575060007f0000000000000000000000000000000000000000000000000000000000000000115b15610aa8578060400151826040015111156109a95784826040015182604001516040516306cb6f9f60e41b81526004016109a093929190611f3e565b8460405163de0a0bd160e01b81526004016109a09190611f5d565b5050505050565b6040805180820190915260008082526020820152604080513360208201529081018590526001600160a01b038616606082015260009060800160408051601f1981840301815291905290506000610b447f000000000000000000000000000000000000000000000000000000000000000060018787610b9a565b9050610b737f0000000000000000000000000000000000000000000000000000000000000000838360006113b2565b925050505b949350505050565b610b88610f89565b610734610b958284611f6b565b611493565b63ffffffff8416600090815260046020908152604080832061ffff87168452909152812080546060929190610bce90611e90565b80601f0160208091040260200160405190810160405280929190818152602001828054610bfa90611e90565b8015610c475780601f10610c1c57610100808354040283529160200191610c47565b820191906000526020600020905b815481529060010190602001808311610c2a57829003601f168201915b505050505090508051600003610c975783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929450610b789350505050565b6000839003610ca7579050610b78565b60028310610d2557610cee84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061159a92505050565b80610cfc8460028188612088565b604051602001610d0e939291906120b2565b604051602081830303815290604052915050610b78565b8383604051639a6d49cd60e01b81526004016109a09291906120da565b63ffffffff8116600090815260056020908152604080832081516080810183528154808252600183015494820185905260028301549382018490526003909201546060820181905285949193610d999392916115c6565b9250925050915091565b610dab610f89565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000000000000000000000000000000000000000000000169063ca5eb5e190602401600060405180830381600087803b158015610e0e57600080fd5b505af1158015610ac3573d6000803e3d6000fd5b610e4660405180606001604052806000815260200160008152602001600081525090565b6000670de0b6b3a7640000610e7b7f00000000000000000000000000000000000000000000000000000000000000008561211f565b610e859190612136565b90506000670de0b6b3a7640000610ebc7f00000000000000000000000000000000000000000000000000000000000000008661211f565b610ec69190612136565b90506000670de0b6b3a7640000610efd7f00000000000000000000000000000000000000000000000000000000000000008761211f565b610f079190612136565b604080516060810182529485526020850193909352918301919091525092915050565b610f32610f89565b6001600160a01b038116610f5c57604051631e4fbdf760e01b8152600060048201526024016109a0565b61074981611104565b610f6d611842565b610f7d3389898989898989611154565b98975050505050505050565b6000546001600160a01b031633146108035760405163118cdaa760e01b81523360048201526024016109a0565b63ffffffff8216600081815260036020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b60005b81518110156110d45760006005600084848151811061102f5761102f612158565b60200260200101516000015163ffffffff1663ffffffff168152602001908152602001600020905061107f83838151811061106c5761106c612158565b6020026020010151600001516000611646565b82828151811061109157611091612158565b60200260200101516020015181600201819055508282815181106110b7576110b7612158565b60209081029190910101516040015160039091015560010161100e565b507fe888347665897e637801f36c5129f510657276178c89022bc5fa0246dbc19de181604051610717919061216e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61115c611842565b6001600160a01b03841661118357604051638aa3a72f60e01b815260040160405180910390fd5b61118e888a89610892565b61119a898888886116bc565b6111b7576040516309bde33960e01b815260040160405180910390fd5b6111e27f00000000000000000000000000000000000000000000000000000000000000006001611646565b604080516001600160a01b03808c166020830152918101899052908516606082015260009060800160408051601f198184030181529190529050600061124b7f000000000000000000000000000000000000000000000000000000000000000060018787610b9a565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316632637a450346040518060a001604052807f000000000000000000000000000000000000000000000000000000000000000063ffffffff1681526020016112dd7f0000000000000000000000000000000000000000000000000000000000000000611775565b8152602001868152602001858152602001600015158152508e6040518463ffffffff1660e01b815260040161131392919061222e565b60806040518083038185885af1158015611331573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061135691906122a6565b604080516001600160a01b038e81168252602082018d905289168183015290519194507fa249b2de7880ddae7545b21bb8c53b5d091a775a6af75203985e48e2bde60760919081900360600190a1505098975050505050505050565b60408051808201909152600080825260208201527f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161141589611775565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b815260040161144a92919061222e565b6040805180830381865afa158015611466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148a91906122fc565b95945050505050565b60005b815181101561156a576114c58282815181106114b4576114b4612158565b60200260200101516040015161159a565b8181815181106114d7576114d7612158565b602002602001015160400151600460008484815181106114f9576114f9612158565b60200260200101516000015163ffffffff1663ffffffff168152602001908152602001600020600084848151811061153357611533612158565b60200260200101516020015161ffff1661ffff16815260200190815260200160002090816115619190612369565b50600101611496565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b674816040516107179190612428565b600281015161ffff81166003146107345781604051639a6d49cd60e01b81526004016109a09190611aed565b600080806115d486426124b3565b90508381106115e9576000925084915061163c565b6000846115f6838861211f565b6116009190612136565b9050808811156116195761161481896124b3565b61161c565b60005b9350838611156116355761163084876124b3565b611638565b60005b9250505b5094509492505050565b63ffffffff821660009081526005602052604081208054600182015460028301546003840154939493849361167e93909290916115c6565b91509150808411156116a35760405163a74c1c5f60e01b815260040160405180910390fd5b6116ad84836124c6565b83555050426001909101555050565b60008061172886866040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120905092915050565b905061176b8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060015491508490506117b7565b9695505050505050565b63ffffffff8116600090815260036020526040812054806117b15760405163f6ff4fb760e01b815263ffffffff841660048201526024016109a0565b92915050565b6000826117c485846117cd565b14949350505050565b600081815b8451811015611808576117fe828683815181106117f1576117f1612158565b6020026020010151611810565b91506001016117d2565b509392505050565b600081831061182c57600082815260208490526040902061183b565b60008381526020839052604090205b9392505050565b60405180606001604052806000801916815260200160006001600160401b03168152602001611884604051806040016040528060008152602001600081525090565b905290565b80356001600160a01b03811681146118a057600080fd5b919050565b6000602082840312156118b757600080fd5b61183b82611889565b803563ffffffff811681146118a057600080fd5b600080604083850312156118e757600080fd5b6118f0836118c0565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715611936576119366118fe565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611964576119646118fe565b604052919050565b60006001600160401b03821115611985576119856118fe565b5060051b60200190565b600060208083850312156119a257600080fd5b82356001600160401b038111156119b857600080fd5b8301601f810185136119c957600080fd5b80356119dc6119d78261196c565b61193c565b818152606091820283018401918482019190888411156119fb57600080fd5b938501935b83851015611a4c5780858a031215611a185760008081fd5b611a20611914565b611a29866118c0565b815285870135878201526040808701359082015283529384019391850191611a00565b50979650505050505050565b803561ffff811681146118a057600080fd5b60008060408385031215611a7d57600080fd5b611a86836118c0565b9150611a9460208401611a58565b90509250929050565b60005b83811015611ab8578181015183820152602001611aa0565b50506000910152565b60008151808452611ad9816020860160208601611a9d565b601f01601f19169290920160200192915050565b60208152600061183b6020830184611ac1565b600060208284031215611b1257600080fd5b5035919050565b8035600381106118a057600080fd5b60008083601f840112611b3a57600080fd5b5081356001600160401b03811115611b5157600080fd5b6020830191508360208260051b8501011115611b6c57600080fd5b9250929050565b60008083601f840112611b8557600080fd5b5081356001600160401b03811115611b9c57600080fd5b602083019150836020828501011115611b6c57600080fd5b60008060008060008060008060c0898b031215611bd057600080fd5b611bd989611889565b9750611be760208a01611b19565b96506040890135955060608901356001600160401b0380821115611c0a57600080fd5b611c168c838d01611b28565b9097509550859150611c2a60808c01611889565b945060a08b0135915080821115611c4057600080fd5b50611c4d8b828c01611b73565b999c989b5096995094979396929594505050565b6000608082019050825182526001600160401b0360208401511660208301526040830151611c9c604084018280518252602090810151910152565b5092915050565b600080600060608486031215611cb857600080fd5b611cc184611b19565b9250611ccf60208501611889565b9150604084013590509250925092565b60008060008060608587031215611cf557600080fd5b611cfe85611889565b93506020850135925060408501356001600160401b03811115611d2057600080fd5b611d2c87828801611b73565b95989497509550505050565b8151815260208083015190820152604081016117b1565b600060208284031215611d6157600080fd5b61183b826118c0565b60008060208385031215611d7d57600080fd5b82356001600160401b03811115611d9357600080fd5b611d9f85828601611b28565b90969095509350505050565b60008060008060608587031215611dc157600080fd5b611dca856118c0565b9350611dd860208601611a58565b925060408501356001600160401b03811115611d2057600080fd5b600080600080600080600060a0888a031215611e0e57600080fd5b611e1788611b19565b96506020880135955060408801356001600160401b0380821115611e3a57600080fd5b611e468b838c01611b28565b9097509550859150611e5a60608b01611889565b945060808a0135915080821115611e7057600080fd5b50611e7d8a828b01611b73565b989b979a50959850939692959293505050565b600181811c90821680611ea457607f821691505b602082108103611ec457634e487b7160e01b600052602260045260246000fd5b50919050565b600060608284031215611edc57600080fd5b611ee4611914565b8251815260208301516020820152604083015160408201528091505092915050565b634e487b7160e01b600052602160045260246000fd5b60038110611f3a57634e487b7160e01b600052602160045260246000fd5b9052565b60608101611f4c8286611f1c565b602082019390935260400152919050565b602081016117b18284611f1c565b6000611f796119d78461196c565b80848252602080830192508560051b850136811115611f9757600080fd5b855b8181101561207c5780356001600160401b0380821115611fb95760008081fd5b818901915060608236031215611fcf5760008081fd5b611fd7611914565b611fe0836118c0565b8152611fed868401611a58565b86820152604080840135838111156120055760008081fd5b9390930192601f368186011261201b5760008081fd5b84358481111561202d5761202d6118fe565b61203e818301601f19168a0161193c565b9450808552368982880101111561205757600091508182fd5b808987018a870137600090850189015250810191909152865250938201938201611f99565b50919695505050505050565b6000808585111561209857600080fd5b838611156120a557600080fd5b5050820193919092039150565b600084516120c4818460208901611a9d565b8201838582376000930192835250909392505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176117b1576117b1612109565b60008261215357634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b602080825282518282018190526000919060409081850190868401855b828110156121c0578151805163ffffffff1685528681015187860152850151858501526060909301929085019060010161218b565b5091979650505050505050565b63ffffffff8151168252602081015160208301526000604082015160a060408501526121fc60a0850182611ac1565b9050606083015184820360608601526122158282611ac1565b9150506080830151151560808501528091505092915050565b60408152600061224160408301856121cd565b905060018060a01b03831660208301529392505050565b60006040828403121561226a57600080fd5b604051604081018181106001600160401b038211171561228c5761228c6118fe565b604052825181526020928301519281019290925250919050565b6000608082840312156122b857600080fd5b6122c0611914565b8251815260208301516001600160401b03811681146122de57600080fd5b60208201526122f08460408501612258565b60408201529392505050565b60006040828403121561230e57600080fd5b61183b8383612258565b601f821115612364576000816000526020600020601f850160051c810160208610156123415750805b601f850160051c820191505b818110156123605782815560010161234d565b5050505b505050565b81516001600160401b03811115612382576123826118fe565b612396816123908454611e90565b84612318565b602080601f8311600181146123cb57600084156123b35750858301515b600019600386901b1c1916600185901b178555612360565b600085815260208120601f198616915b828110156123fa578886015182559484019460019091019084016123db565b50858210156124185787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b838110156124a557888303603f190185528151805163ffffffff1684528781015161ffff1688850152860151606087850181905261249181860183611ac1565b968901969450505090860190600101612451565b509098975050505050505050565b818103818111156117b1576117b1612109565b808201808211156117b1576117b161210956fea2646970667358221220620d2116ab04120a6569fbc84ee00ee54023aff6820ab18df569211a44cb93cf64736f6c63430008160033000000000000000000000000000000000000000000000000000000000000759e0000000000000000000000001a44076050125825900e736c501f859c50fe728c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035644a949d2eeb4b5e592f13166aafd330645cf6000000000000000000000000c026395860db2d07ee33e05fe50ed7bd583189c7000000000000000000000000933597a323eb81cae705c5bc29985172fd5a397300000000000000000000000077b2043768d28e9c9ab44e1abfc95944bce579310000000000000000000000000000000000000000000000000000000000000e100000000000000000000000001e6e44b259912b6021e84086a47d1843494c146c
Deployed Bytecode
0x6080604052600436106101c25760003560e01c80638da5cb5b116100f7578063bb0b6a5311610095578063d6d754db11610064578063d6d754db146105f2578063d776b41814610634578063f2fde38b14610668578063f94296371461068857600080fd5b8063bb0b6a5314610550578063bc70b3541461057d578063c272198d1461059d578063ca5eb5e1146105d257600080fd5b806399ba4f59116100d157806399ba4f591461046d5780639baa23e6146104a1578063ab99095d146104ce578063b98bd0701461053057600080fd5b80638da5cb5b146104135780638dab3f8114610431578063918f86741461045157600080fd5b8063569f9b7711610164578063715018a61161013e578063715018a61461039e57806379567417146103b35780637cb64759146103d35780638b2eddf9146103f357600080fd5b8063569f9b77146102d55780635e280f1114610321578063645b7fa61461035557600080fd5b80632eb4a7ab116101a05780632eb4a7ab146102525780633400288b1461026857806346f943e9146102885780635535d461146102a857600080fd5b80630904cc50146101c757806317442b701461020e57806318d79d1314610230575b600080fd5b3480156101d357600080fd5b506101fb7f000000000000000000000000000000000000000000000000000019438493bc7181565b6040519081526020015b60405180910390f35b34801561021a57600080fd5b5060408051600181526000602082015201610205565b34801561023c57600080fd5b5061025061024b3660046118a5565b61069b565b005b34801561025e57600080fd5b506101fb60015481565b34801561027457600080fd5b506102506102833660046118d4565b610722565b34801561029457600080fd5b506102506102a336600461198f565b610738565b3480156102b457600080fd5b506102c86102c3366004611a6a565b61074c565b6040516102059190611aed565b3480156102e157600080fd5b506103097f00000000000000000000000035644a949d2eeb4b5e592f13166aafd330645cf681565b6040516001600160a01b039091168152602001610205565b34801561032d57600080fd5b506103097f0000000000000000000000001a44076050125825900e736c501f859c50fe728c81565b34801561036157600080fd5b506103897f000000000000000000000000000000000000000000000000000000000000759e81565b60405163ffffffff9091168152602001610205565b3480156103aa57600080fd5b506102506107f1565b3480156103bf57600080fd5b50600254610309906001600160a01b031681565b3480156103df57600080fd5b506102506103ee366004611b00565b610805565b610406610401366004611bb4565b610842565b6040516102059190611c61565b34801561041f57600080fd5b506000546001600160a01b0316610309565b34801561043d57600080fd5b5061025061044c366004611ca3565b610892565b34801561045d57600080fd5b506101fb670de0b6b3a764000081565b34801561047957600080fd5b506101fb7f00000000000000000000000000000000000000000000000000000000000186a081565b3480156104ad57600080fd5b506104c16104bc366004611cdf565b610aca565b6040516102059190611d38565b3480156104da57600080fd5b506105106104e9366004611d4f565b60056020526000908152604090208054600182015460028301546003909301549192909184565b604080519485526020850193909352918301526060820152608001610205565b34801561053c57600080fd5b5061025061054b366004611d6a565b610b80565b34801561055c57600080fd5b506101fb61056b366004611d4f565b60036020526000908152604090205481565b34801561058957600080fd5b506102c8610598366004611dab565b610b9a565b3480156105a957600080fd5b506105bd6105b8366004611d4f565b610d42565b60408051928352602083019190915201610205565b3480156105de57600080fd5b506102506105ed3660046118a5565b610da3565b3480156105fe57600080fd5b5061061261060d366004611b00565b610e22565b6040805182518152602080840151908201529181015190820152606001610205565b34801561064057600080fd5b506101fb7f00000000000000000000000000000000000000000000000000000000000186a081565b34801561067457600080fd5b506102506106833660046118a5565b610f2a565b610406610696366004611df3565b610f65565b6106a3610f89565b6002546001600160a01b0316156106cd57604051630abf614160e41b815260040160405180910390fd5b600280546001600160a01b0319166001600160a01b0383169081179091556040519081527f40dd9837620e8955c26f089308a386b585e7476d1b96cc080f88022a28406545906020015b60405180910390a150565b61072a610f89565b6107348282610fb6565b5050565b610740610f89565b6107498161100b565b50565b60046020908152600092835260408084209091529082529020805461077090611e90565b80601f016020809104026020016040519081016040528092919081815260200182805461079c90611e90565b80156107e95780601f106107be576101008083540402835291602001916107e9565b820191906000526020600020905b8154815290600101906020018083116107cc57829003601f168201915b505050505081565b6107f9610f89565b6108036000611104565b565b61080d610f89565b60018190556040518181527f42cbc405e4dbf1b691e85b9a34b08ecfcf7a9ad9078bf4d645ccfa1fac11c10b90602001610717565b61084a611842565b6002546001600160a01b031633146108755760405163118e623160e31b815260040160405180910390fd5b6108858989898989898989611154565b9998505050505050505050565b600061089d82610e22565b6040516320850e9960e11b81526001600160a01b0385811660048301529192506000917f00000000000000000000000035644a949d2eeb4b5e592f13166aafd330645cf6169063410a1d3290602401606060405180830381865afa158015610909573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061092d9190611eca565b9050600085600281111561094357610943611f06565b148015610970575060007f00000000000000000000000000000000000000000000000000000000000186a0115b156109ae578051825111156109a957815181516040516306cb6f9f60e41b81526109a09288929091600401611f3e565b60405180910390fd5b610ac3565b60018560028111156109c2576109c2611f06565b1480156109ef575060007f00000000000000000000000000000000000000000000000000000000000186a0115b15610a2b578060200151826020015111156109a95784826020015182602001516040516306cb6f9f60e41b81526004016109a093929190611f3e565b6002856002811115610a3f57610a3f611f06565b148015610a6c575060007f000000000000000000000000000000000000000000000000000019438493bc71115b15610aa8578060400151826040015111156109a95784826040015182604001516040516306cb6f9f60e41b81526004016109a093929190611f3e565b8460405163de0a0bd160e01b81526004016109a09190611f5d565b5050505050565b6040805180820190915260008082526020820152604080513360208201529081018590526001600160a01b038616606082015260009060800160408051601f1981840301815291905290506000610b447f000000000000000000000000000000000000000000000000000000000000759e60018787610b9a565b9050610b737f000000000000000000000000000000000000000000000000000000000000759e838360006113b2565b925050505b949350505050565b610b88610f89565b610734610b958284611f6b565b611493565b63ffffffff8416600090815260046020908152604080832061ffff87168452909152812080546060929190610bce90611e90565b80601f0160208091040260200160405190810160405280929190818152602001828054610bfa90611e90565b8015610c475780601f10610c1c57610100808354040283529160200191610c47565b820191906000526020600020905b815481529060010190602001808311610c2a57829003601f168201915b505050505090508051600003610c975783838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929450610b789350505050565b6000839003610ca7579050610b78565b60028310610d2557610cee84848080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061159a92505050565b80610cfc8460028188612088565b604051602001610d0e939291906120b2565b604051602081830303815290604052915050610b78565b8383604051639a6d49cd60e01b81526004016109a09291906120da565b63ffffffff8116600090815260056020908152604080832081516080810183528154808252600183015494820185905260028301549382018490526003909201546060820181905285949193610d999392916115c6565b9250925050915091565b610dab610f89565b60405163ca5eb5e160e01b81526001600160a01b0382811660048301527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c169063ca5eb5e190602401600060405180830381600087803b158015610e0e57600080fd5b505af1158015610ac3573d6000803e3d6000fd5b610e4660405180606001604052806000815260200160008152602001600081525090565b6000670de0b6b3a7640000610e7b7f00000000000000000000000000000000000000000000000000000000000186a08561211f565b610e859190612136565b90506000670de0b6b3a7640000610ebc7f00000000000000000000000000000000000000000000000000000000000186a08661211f565b610ec69190612136565b90506000670de0b6b3a7640000610efd7f000000000000000000000000000000000000000000000000000019438493bc718761211f565b610f079190612136565b604080516060810182529485526020850193909352918301919091525092915050565b610f32610f89565b6001600160a01b038116610f5c57604051631e4fbdf760e01b8152600060048201526024016109a0565b61074981611104565b610f6d611842565b610f7d3389898989898989611154565b98975050505050505050565b6000546001600160a01b031633146108035760405163118cdaa760e01b81523360048201526024016109a0565b63ffffffff8216600081815260036020908152604091829020849055815192835282018390527f238399d427b947898edb290f5ff0f9109849b1c3ba196a42e35f00c50a54b98b910160405180910390a15050565b60005b81518110156110d45760006005600084848151811061102f5761102f612158565b60200260200101516000015163ffffffff1663ffffffff168152602001908152602001600020905061107f83838151811061106c5761106c612158565b6020026020010151600001516000611646565b82828151811061109157611091612158565b60200260200101516020015181600201819055508282815181106110b7576110b7612158565b60209081029190910101516040015160039091015560010161100e565b507fe888347665897e637801f36c5129f510657276178c89022bc5fa0246dbc19de181604051610717919061216e565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b61115c611842565b6001600160a01b03841661118357604051638aa3a72f60e01b815260040160405180910390fd5b61118e888a89610892565b61119a898888886116bc565b6111b7576040516309bde33960e01b815260040160405180910390fd5b6111e27f000000000000000000000000000000000000000000000000000000000000759e6001611646565b604080516001600160a01b03808c166020830152918101899052908516606082015260009060800160408051601f198184030181529190529050600061124b7f000000000000000000000000000000000000000000000000000000000000759e60018787610b9a565b90507f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b0316632637a450346040518060a001604052807f000000000000000000000000000000000000000000000000000000000000759e63ffffffff1681526020016112dd7f000000000000000000000000000000000000000000000000000000000000759e611775565b8152602001868152602001858152602001600015158152508e6040518463ffffffff1660e01b815260040161131392919061222e565b60806040518083038185885af1158015611331573d6000803e3d6000fd5b50505050506040513d601f19601f8201168201806040525081019061135691906122a6565b604080516001600160a01b038e81168252602082018d905289168183015290519194507fa249b2de7880ddae7545b21bb8c53b5d091a775a6af75203985e48e2bde60760919081900360600190a1505098975050505050505050565b60408051808201909152600080825260208201527f0000000000000000000000001a44076050125825900e736c501f859c50fe728c6001600160a01b031663ddc28c586040518060a001604052808863ffffffff16815260200161141589611775565b8152602001878152602001868152602001851515815250306040518363ffffffff1660e01b815260040161144a92919061222e565b6040805180830381865afa158015611466573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061148a91906122fc565b95945050505050565b60005b815181101561156a576114c58282815181106114b4576114b4612158565b60200260200101516040015161159a565b8181815181106114d7576114d7612158565b602002602001015160400151600460008484815181106114f9576114f9612158565b60200260200101516000015163ffffffff1663ffffffff168152602001908152602001600020600084848151811061153357611533612158565b60200260200101516020015161ffff1661ffff16815260200190815260200160002090816115619190612369565b50600101611496565b507fbe4864a8e820971c0247f5992e2da559595f7bf076a21cb5928d443d2a13b674816040516107179190612428565b600281015161ffff81166003146107345781604051639a6d49cd60e01b81526004016109a09190611aed565b600080806115d486426124b3565b90508381106115e9576000925084915061163c565b6000846115f6838861211f565b6116009190612136565b9050808811156116195761161481896124b3565b61161c565b60005b9350838611156116355761163084876124b3565b611638565b60005b9250505b5094509492505050565b63ffffffff821660009081526005602052604081208054600182015460028301546003840154939493849361167e93909290916115c6565b91509150808411156116a35760405163a74c1c5f60e01b815260040160405180910390fd5b6116ad84836124c6565b83555050426001909101555050565b60008061172886866040516bffffffffffffffffffffffff19606084901b1660208201526034810182905260009060540160408051601f198184030181528282528051602091820120908301520160405160208183030381529060405280519060200120905092915050565b905061176b8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152505060015491508490506117b7565b9695505050505050565b63ffffffff8116600090815260036020526040812054806117b15760405163f6ff4fb760e01b815263ffffffff841660048201526024016109a0565b92915050565b6000826117c485846117cd565b14949350505050565b600081815b8451811015611808576117fe828683815181106117f1576117f1612158565b6020026020010151611810565b91506001016117d2565b509392505050565b600081831061182c57600082815260208490526040902061183b565b60008381526020839052604090205b9392505050565b60405180606001604052806000801916815260200160006001600160401b03168152602001611884604051806040016040528060008152602001600081525090565b905290565b80356001600160a01b03811681146118a057600080fd5b919050565b6000602082840312156118b757600080fd5b61183b82611889565b803563ffffffff811681146118a057600080fd5b600080604083850312156118e757600080fd5b6118f0836118c0565b946020939093013593505050565b634e487b7160e01b600052604160045260246000fd5b604051606081016001600160401b0381118282101715611936576119366118fe565b60405290565b604051601f8201601f191681016001600160401b0381118282101715611964576119646118fe565b604052919050565b60006001600160401b03821115611985576119856118fe565b5060051b60200190565b600060208083850312156119a257600080fd5b82356001600160401b038111156119b857600080fd5b8301601f810185136119c957600080fd5b80356119dc6119d78261196c565b61193c565b818152606091820283018401918482019190888411156119fb57600080fd5b938501935b83851015611a4c5780858a031215611a185760008081fd5b611a20611914565b611a29866118c0565b815285870135878201526040808701359082015283529384019391850191611a00565b50979650505050505050565b803561ffff811681146118a057600080fd5b60008060408385031215611a7d57600080fd5b611a86836118c0565b9150611a9460208401611a58565b90509250929050565b60005b83811015611ab8578181015183820152602001611aa0565b50506000910152565b60008151808452611ad9816020860160208601611a9d565b601f01601f19169290920160200192915050565b60208152600061183b6020830184611ac1565b600060208284031215611b1257600080fd5b5035919050565b8035600381106118a057600080fd5b60008083601f840112611b3a57600080fd5b5081356001600160401b03811115611b5157600080fd5b6020830191508360208260051b8501011115611b6c57600080fd5b9250929050565b60008083601f840112611b8557600080fd5b5081356001600160401b03811115611b9c57600080fd5b602083019150836020828501011115611b6c57600080fd5b60008060008060008060008060c0898b031215611bd057600080fd5b611bd989611889565b9750611be760208a01611b19565b96506040890135955060608901356001600160401b0380821115611c0a57600080fd5b611c168c838d01611b28565b9097509550859150611c2a60808c01611889565b945060a08b0135915080821115611c4057600080fd5b50611c4d8b828c01611b73565b999c989b5096995094979396929594505050565b6000608082019050825182526001600160401b0360208401511660208301526040830151611c9c604084018280518252602090810151910152565b5092915050565b600080600060608486031215611cb857600080fd5b611cc184611b19565b9250611ccf60208501611889565b9150604084013590509250925092565b60008060008060608587031215611cf557600080fd5b611cfe85611889565b93506020850135925060408501356001600160401b03811115611d2057600080fd5b611d2c87828801611b73565b95989497509550505050565b8151815260208083015190820152604081016117b1565b600060208284031215611d6157600080fd5b61183b826118c0565b60008060208385031215611d7d57600080fd5b82356001600160401b03811115611d9357600080fd5b611d9f85828601611b28565b90969095509350505050565b60008060008060608587031215611dc157600080fd5b611dca856118c0565b9350611dd860208601611a58565b925060408501356001600160401b03811115611d2057600080fd5b600080600080600080600060a0888a031215611e0e57600080fd5b611e1788611b19565b96506020880135955060408801356001600160401b0380821115611e3a57600080fd5b611e468b838c01611b28565b9097509550859150611e5a60608b01611889565b945060808a0135915080821115611e7057600080fd5b50611e7d8a828b01611b73565b989b979a50959850939692959293505050565b600181811c90821680611ea457607f821691505b602082108103611ec457634e487b7160e01b600052602260045260246000fd5b50919050565b600060608284031215611edc57600080fd5b611ee4611914565b8251815260208301516020820152604083015160408201528091505092915050565b634e487b7160e01b600052602160045260246000fd5b60038110611f3a57634e487b7160e01b600052602160045260246000fd5b9052565b60608101611f4c8286611f1c565b602082019390935260400152919050565b602081016117b18284611f1c565b6000611f796119d78461196c565b80848252602080830192508560051b850136811115611f9757600080fd5b855b8181101561207c5780356001600160401b0380821115611fb95760008081fd5b818901915060608236031215611fcf5760008081fd5b611fd7611914565b611fe0836118c0565b8152611fed868401611a58565b86820152604080840135838111156120055760008081fd5b9390930192601f368186011261201b5760008081fd5b84358481111561202d5761202d6118fe565b61203e818301601f19168a0161193c565b9450808552368982880101111561205757600091508182fd5b808987018a870137600090850189015250810191909152865250938201938201611f99565b50919695505050505050565b6000808585111561209857600080fd5b838611156120a557600080fd5b5050820193919092039150565b600084516120c4818460208901611a9d565b8201838582376000930192835250909392505050565b60208152816020820152818360408301376000818301604090810191909152601f909201601f19160101919050565b634e487b7160e01b600052601160045260246000fd5b80820281158282048414176117b1576117b1612109565b60008261215357634e487b7160e01b600052601260045260246000fd5b500490565b634e487b7160e01b600052603260045260246000fd5b602080825282518282018190526000919060409081850190868401855b828110156121c0578151805163ffffffff1685528681015187860152850151858501526060909301929085019060010161218b565b5091979650505050505050565b63ffffffff8151168252602081015160208301526000604082015160a060408501526121fc60a0850182611ac1565b9050606083015184820360608601526122158282611ac1565b9150506080830151151560808501528091505092915050565b60408152600061224160408301856121cd565b905060018060a01b03831660208301529392505050565b60006040828403121561226a57600080fd5b604051604081018181106001600160401b038211171561228c5761228c6118fe565b604052825181526020928301519281019290925250919050565b6000608082840312156122b857600080fd5b6122c0611914565b8251815260208301516001600160401b03811681146122de57600080fd5b60208201526122f08460408501612258565b60408201529392505050565b60006040828403121561230e57600080fd5b61183b8383612258565b601f821115612364576000816000526020600020601f850160051c810160208610156123415750805b601f850160051c820191505b818110156123605782815560010161234d565b5050505b505050565b81516001600160401b03811115612382576123826118fe565b612396816123908454611e90565b84612318565b602080601f8311600181146123cb57600084156123b35750858301515b600019600386901b1c1916600185901b178555612360565b600085815260208120601f198616915b828110156123fa578886015182559484019460019091019084016123db565b50858210156124185787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b600060208083018184528085518083526040925060408601915060408160051b87010184880160005b838110156124a557888303603f190185528151805163ffffffff1684528781015161ffff1688850152860151606087850181905261249181860183611ac1565b968901969450505090860190600101612451565b509098975050505050505050565b818103818111156117b1576117b1612109565b808201808211156117b1576117b161210956fea2646970667358221220620d2116ab04120a6569fbc84ee00ee54023aff6820ab18df569211a44cb93cf64736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000759e0000000000000000000000001a44076050125825900e736c501f859c50fe728c000000000000000000000000000000000000000000000000000000000000000000000000000000000000000035644a949d2eeb4b5e592f13166aafd330645cf6000000000000000000000000c026395860db2d07ee33e05fe50ed7bd583189c7000000000000000000000000933597a323eb81cae705c5bc29985172fd5a397300000000000000000000000077b2043768d28e9c9ab44e1abfc95944bce579310000000000000000000000000000000000000000000000000000000000000e100000000000000000000000001e6e44b259912b6021e84086a47d1843494c146c
-----Decoded View---------------
Arg [0] : _remoteEid (uint32): 30110
Arg [1] : _endpoint (address): 0x1a44076050125825900e736c501f859c50fE728c
Arg [2] : _merkleRoot (bytes32): 0x0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : _donateContract (address): 0x35644a949D2Eeb4b5e592f13166AafD330645Cf6
Arg [4] : _stargateUsdc (address): 0xc026395860Db2d07ee33e05fE50ed7bD583189C7
Arg [5] : _stargateUsdt (address): 0x933597a323Eb81cAe705C5bC29985172fd5A3973
Arg [6] : _stargateNative (address): 0x77b2043768d28E9C9aB44E1aBfC95944bcE57931
Arg [7] : _nativePrice (uint256): 3600
Arg [8] : _owner (address): 0x1e6e44B259912B6021E84086A47D1843494c146c
-----Encoded View---------------
9 Constructor Arguments found :
Arg [0] : 000000000000000000000000000000000000000000000000000000000000759e
Arg [1] : 0000000000000000000000001a44076050125825900e736c501f859c50fe728c
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [3] : 00000000000000000000000035644a949d2eeb4b5e592f13166aafd330645cf6
Arg [4] : 000000000000000000000000c026395860db2d07ee33e05fe50ed7bd583189c7
Arg [5] : 000000000000000000000000933597a323eb81cae705c5bc29985172fd5a3973
Arg [6] : 00000000000000000000000077b2043768d28e9c9ab44e1abfc95944bce57931
Arg [7] : 0000000000000000000000000000000000000000000000000000000000000e10
Arg [8] : 0000000000000000000000001e6e44b259912b6021e84086a47d1843494c146c
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
AVAX | 66.52% | $1 | 16,427.5074 | $16,430.51 | |
AVAX | 32.72% | $0.998856 | 8,089.9434 | $8,080.69 | |
ZKSYNC | 0.24% | $3,389.01 | 0.0174 | $59.09 | |
SCROLL | 0.13% | $3,389.01 | 0.00979078 | $33.18 | |
LINEA | 0.13% | $3,389.01 | 0.00924751 | $31.34 | |
ARB | 0.11% | $3,384.01 | 0.00794029 | $26.87 | |
BASE | 0.08% | $3,385.06 | 0.00600603 | $20.33 | |
BLAST | 0.04% | $3,384.56 | 0.00262042 | $8.87 | |
BSC | 0.03% | $693.05 | 0.00961542 | $6.66 | |
OP | <0.01% | $1 | 1.6789 | $1.68 | |
POL | <0.01% | $0.498614 | 0.00503983 | $0.002513 | |
MANTLE | <0.01% | $1.19 | 0.00065829 | $0.000786 |
Loading...
Loading
[ Download: CSV Export ]
[ 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.