Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Sponsored
Loading...
Loading
Contract Name:
OFTWrapper
Compiler Version
v0.8.22+commit.4fc1097e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { ReentrancyGuard } from "@openzeppelin/contracts/security/ReentrancyGuard.sol"; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { IERC20, SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IOFTV2 } from "@layerzerolabs/solidity-examples/contracts/token/oft/v2/interfaces/IOFTV2.sol"; import { IOFTWithFee } from "@layerzerolabs/solidity-examples/contracts/token/oft/v2/fee/IOFTWithFee.sol"; import { IOFT } from "@layerzerolabs/solidity-examples/contracts/token/oft/v1/interfaces/IOFT.sol"; import { IOFTWrapper } from "./interfaces/IOFTWrapper.sol"; import { INativeOFT } from "./interfaces/INativeOFT.sol"; import { IOFT as IOFTEpv2, MessagingFee as MessagingFeeEpv2, SendParam as SendParamEpv2 } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/interfaces/IOFT.sol"; contract OFTWrapper is IOFTWrapper, Ownable, ReentrancyGuard { using SafeERC20 for IERC20; using SafeERC20 for IOFT; uint256 public constant BPS_DENOMINATOR = 10000; uint256 public constant MAX_UINT = 2 ** 256 - 1; // indicates a bp fee of 0 that overrides the default bps uint256 public defaultBps; mapping(address => uint256) public oftBps; uint256 public callerBpsCap; constructor(uint256 _defaultBps, uint256 _callerBpsCap) { require(_defaultBps < BPS_DENOMINATOR, "OFTWrapper: defaultBps >= 100%"); defaultBps = _defaultBps; callerBpsCap = _callerBpsCap; } function setDefaultBps(uint256 _defaultBps) external onlyOwner { require(_defaultBps < BPS_DENOMINATOR, "OFTWrapper: defaultBps >= 100%"); defaultBps = _defaultBps; emit DefaultBpsSet(_defaultBps); } function setOFTBps(address _token, uint256 _bps) external onlyOwner { require(_bps < BPS_DENOMINATOR || _bps == MAX_UINT, "OFTWrapper: oftBps[_oft] >= 100%"); oftBps[_token] = _bps; emit OFTBpsSet(_token, _bps); } function setCallerBpsCap(uint256 _callerBpsCap) external onlyOwner { require(_callerBpsCap <= BPS_DENOMINATOR, "OFTWrapper: callerBpsCap > 100%"); callerBpsCap = _callerBpsCap; emit CallerBpsCapSet(_callerBpsCap); } function withdrawFees(address _oft, address _to, uint256 _amount) external onlyOwner { IOFT(_oft).safeTransfer(_to, _amount); emit WrapperFeeWithdrawn(_oft, _to, _amount); } function sendOFT( address _oft, uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, uint256 _minAmount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); uint256 amountToSwap = _getAmountAndPayFee(_oft, _amount, _minAmount, _feeObj); IOFT(_oft).sendFrom{ value: msg.value }( msg.sender, _dstChainId, _toAddress, amountToSwap, _refundAddress, _zroPaymentAddress, _adapterParams ); } function sendProxyOFT( address _proxyOft, uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, uint256 _minAmount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); address token = IOFTV2(_proxyOft).token(); { uint256 amountToSwap = _getAmountAndPayFeeProxy(token, _amount, _minAmount, _feeObj); // approve proxy to spend tokens IOFT(token).safeApprove(_proxyOft, amountToSwap); IOFT(_proxyOft).sendFrom{ value: msg.value }( address(this), _dstChainId, _toAddress, amountToSwap, _refundAddress, _zroPaymentAddress, _adapterParams ); } // reset allowance if sendFrom() does not consume full amount if (IOFT(token).allowance(address(this), _proxyOft) > 0) IOFT(token).safeApprove(_proxyOft, 0); } function sendNativeOFT( address _nativeOft, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, uint256 _minAmount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); require(msg.value >= _amount, "OFTWrapper: not enough value sent"); INativeOFT(_nativeOft).deposit{ value: _amount }(); uint256 amountToSwap = _getAmountAndPayFeeNative(_nativeOft, _amount, _minAmount, _feeObj); IOFT(_nativeOft).sendFrom{ value: msg.value - _amount }( address(this), _dstChainId, _toAddress, amountToSwap, _refundAddress, _zroPaymentAddress, _adapterParams ); } function sendOFTV2( address _oft, uint16 _dstChainId, bytes32 _toAddress, uint256 _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); uint256 amountToSwap = _getAmountAndPayFee(_oft, _amount, _minAmount, _feeObj); IOFTV2(_oft).sendFrom{ value: msg.value }(msg.sender, _dstChainId, _toAddress, amountToSwap, _callParams); } function sendOFTFeeV2( address _oft, uint16 _dstChainId, bytes32 _toAddress, uint256 _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); uint256 amountToSwap = _getAmountAndPayFee(_oft, _amount, _minAmount, _feeObj); IOFTWithFee(_oft).sendFrom{ value: msg.value }( msg.sender, _dstChainId, _toAddress, amountToSwap, _minAmount, _callParams ); } function sendProxyOFTV2( address _proxyOft, uint16 _dstChainId, bytes32 _toAddress, uint256 _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); address token = IOFTV2(_proxyOft).token(); uint256 amountToSwap = _getAmountAndPayFeeProxy(token, _amount, _minAmount, _feeObj); // approve proxy to spend tokens IOFT(token).safeApprove(_proxyOft, amountToSwap); IOFTV2(_proxyOft).sendFrom{ value: msg.value }( address(this), _dstChainId, _toAddress, amountToSwap, _callParams ); // reset allowance if sendFrom() does not consume full amount if (IOFT(token).allowance(address(this), _proxyOft) > 0) IOFT(token).safeApprove(_proxyOft, 0); } function sendProxyOFTFeeV2( address _proxyOft, uint16 _dstChainId, bytes32 _toAddress, uint256 _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); address token = IOFTV2(_proxyOft).token(); uint256 amountToSwap = _getAmountAndPayFeeProxy(token, _amount, _minAmount, _feeObj); // approve proxy to spend tokens IOFT(token).safeApprove(_proxyOft, amountToSwap); IOFTWithFee(_proxyOft).sendFrom{ value: msg.value }( address(this), _dstChainId, _toAddress, amountToSwap, _minAmount, _callParams ); // reset allowance if sendFrom() does not consume full amount if (IOFT(token).allowance(address(this), _proxyOft) > 0) IOFT(token).safeApprove(_proxyOft, 0); } function sendNativeOFTFeeV2( address _nativeOft, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); require(msg.value >= _amount, "OFTWrapper: not enough value sent"); INativeOFT(_nativeOft).deposit{ value: _amount }(); uint256 amountToSwap = _getAmountAndPayFeeNative(_nativeOft, _amount, _minAmount, _feeObj); IOFTWithFee(_nativeOft).sendFrom{ value: msg.value - _amount }( address(this), _dstChainId, _toAddress, amountToSwap, _minAmount, _callParams ); } function sendOFTEpv2( address _oft, SendParamEpv2 calldata _sendParam, MessagingFeeEpv2 calldata _fee, address _refundAddress, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); uint256 amountToSwap = _getAmountAndPayFeeProxy(_oft, _sendParam.amountLD, _sendParam.minAmountLD, _feeObj); IOFTEpv2(_oft).send{ value: msg.value }( SendParamEpv2( _sendParam.dstEid, _sendParam.to, amountToSwap, _sendParam.minAmountLD, _sendParam.extraOptions, _sendParam.composeMsg, _sendParam.oftCmd ), _fee, _refundAddress ); } function sendOFTAdapterEpv2( address _adapterOFT, SendParamEpv2 calldata _sendParam, MessagingFeeEpv2 calldata _fee, address _refundAddress, FeeObj calldata _feeObj ) external payable nonReentrant { _assertCallerBps(_feeObj.callerBps); address token = IOFT(_adapterOFT).token(); uint256 amountToSwap = _getAmountAndPayFeeProxy(token, _sendParam.amountLD, _sendParam.minAmountLD, _feeObj); IERC20(token).safeApprove(_adapterOFT, amountToSwap); IOFTEpv2(_adapterOFT).send{ value: msg.value }( SendParamEpv2( _sendParam.dstEid, _sendParam.to, amountToSwap, _sendParam.minAmountLD, _sendParam.extraOptions, _sendParam.composeMsg, _sendParam.oftCmd ), _fee, _refundAddress ); if (IERC20(token).allowance(address(this), _adapterOFT) > 0) IERC20(token).safeApprove(_adapterOFT, 0); } function _getAmountAndPayFeeProxy( address _token, uint256 _amount, uint256 _minAmount, FeeObj calldata _feeObj ) internal returns (uint256) { (uint256 amountToSwap, uint256 wrapperFee, uint256 callerFee) = _getAmountAndFees( _token, _amount, _feeObj.callerBps ); require(amountToSwap >= _minAmount && amountToSwap > 0, "OFTWrapper: not enough amountToSwap"); IOFT(_token).safeTransferFrom(msg.sender, address(this), amountToSwap + wrapperFee); // pay wrapper and move proxy tokens to contract if (callerFee > 0) IOFT(_token).safeTransferFrom(msg.sender, _feeObj.caller, callerFee); // pay caller emit WrapperFees(_feeObj.partnerId, _token, wrapperFee, callerFee); return amountToSwap; } function _getAmountAndPayFee( address _token, uint256 _amount, uint256 _minAmount, FeeObj calldata _feeObj ) internal returns (uint256) { (uint256 amountToSwap, uint256 wrapperFee, uint256 callerFee) = _getAmountAndFees( _token, _amount, _feeObj.callerBps ); require(amountToSwap >= _minAmount && amountToSwap > 0, "OFTWrapper: not enough amountToSwap"); if (wrapperFee > 0) IOFT(_token).safeTransferFrom(msg.sender, address(this), wrapperFee); // pay wrapper if (callerFee > 0) IOFT(_token).safeTransferFrom(msg.sender, _feeObj.caller, callerFee); // pay caller emit WrapperFees(_feeObj.partnerId, _token, wrapperFee, callerFee); return amountToSwap; } function _getAmountAndPayFeeNative( address _nativeOft, uint256 _amount, uint256 _minAmount, FeeObj calldata _feeObj ) internal returns (uint256) { (uint256 amountToSwap, uint256 wrapperFee, uint256 callerFee) = _getAmountAndFees( _nativeOft, _amount, _feeObj.callerBps ); require(amountToSwap >= _minAmount && amountToSwap > 0, "OFTWrapper: not enough amountToSwap"); // pay fee in NativeOFT token as the caller might not be able to receive ETH // wrapper fee is already in the contract after calling NativeOFT.deposit() if (callerFee > 0) IOFT(_nativeOft).safeTransfer(_feeObj.caller, callerFee); // pay caller emit WrapperFees(_feeObj.partnerId, _nativeOft, wrapperFee, callerFee); return amountToSwap; } function getAmountAndFees( address _token, // will be the token on proxies, and the oft on non-proxy uint256 _amount, uint256 _callerBps ) public view override returns (uint256 amount, uint256 wrapperFee, uint256 callerFee) { _assertCallerBps(_callerBps); return _getAmountAndFees(_token, _amount, _callerBps); } function _getAmountAndFees( address _token, // will be the token on proxies, and the oft on non-proxy uint256 _amount, uint256 _callerBps ) internal view returns (uint256 amount, uint256 wrapperFee, uint256 callerFee) { uint256 wrapperBps; uint256 tokenBps = oftBps[_token]; if (tokenBps == MAX_UINT) { wrapperBps = 0; } else if (tokenBps > 0) { wrapperBps = tokenBps; } else { wrapperBps = defaultBps; } require(wrapperBps + _callerBps < BPS_DENOMINATOR, "OFTWrapper: Fee bps >= 100%"); wrapperFee = wrapperBps > 0 ? (_amount * wrapperBps) / BPS_DENOMINATOR : 0; callerFee = _callerBps > 0 ? (_amount * _callerBps) / BPS_DENOMINATOR : 0; amount = wrapperFee > 0 || callerFee > 0 ? _amount - wrapperFee - callerFee : _amount; } function estimateSendFee( address _oft, uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, bool _useZro, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external view override returns (uint nativeFee, uint zroFee) { _assertCallerBps(_feeObj.callerBps); (uint256 amount, , ) = _getAmountAndFees(IOFT(_oft).token(), _amount, _feeObj.callerBps); return IOFT(_oft).estimateSendFee(_dstChainId, _toAddress, amount, _useZro, _adapterParams); } function estimateSendFeeV2( address _oft, uint16 _dstChainId, bytes32 _toAddress, uint256 _amount, bool _useZro, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external view override returns (uint nativeFee, uint zroFee) { _assertCallerBps(_feeObj.callerBps); (uint256 amount, , ) = _getAmountAndFees(IOFTV2(_oft).token(), _amount, _feeObj.callerBps); return IOFTV2(_oft).estimateSendFee(_dstChainId, _toAddress, amount, _useZro, _adapterParams); } function estimateSendFeeEpv2( address _oft, SendParamEpv2 calldata _sendParam, bool _payInLzToken, FeeObj calldata _feeObj ) external view returns (MessagingFeeEpv2 memory) { _assertCallerBps(_feeObj.callerBps); (uint256 amount, , ) = _getAmountAndFees(IOFTEpv2(_oft).token(), _sendParam.amountLD, _feeObj.callerBps); return IOFTEpv2(_oft).quoteSend( SendParamEpv2( _sendParam.dstEid, _sendParam.to, amount, _sendParam.minAmountLD, _sendParam.extraOptions, _sendParam.composeMsg, _sendParam.oftCmd ), _payInLzToken ); } function _assertCallerBps(uint256 _callerBps) internal view { require(_callerBps <= callerBpsCap, "OFTWrapper: callerBps > callerBpsCap"); } }
// 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; 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; } enum ExecutionState { NotExecutable, Executable, Executed } 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); 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, address _receiveLib, bytes32 _payloadHash ) external view returns (bool); function executable(Origin calldata _origin, address _receiver) external view returns (ExecutionState); 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 oldLib, 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 oldLib, address newLib); event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout); function registerLibrary(address _lib) external; function isRegisteredLibrary(address _lib) external view returns (bool); function getRegisteredLibraries() external view returns (address[] memory); function setDefaultSendLibrary(uint32 _eid, address _newLib) external; function defaultSendLibrary(uint32 _eid) external view returns (address); function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external; function defaultReceiveLibrary(uint32 _eid) external view returns (address); function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external; function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry); function isSupportedEid(uint32 _eid) external view returns (bool); /// ------------------- OApp interfaces ------------------- function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external; function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib); function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool); function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external; function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault); function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external; function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry); function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external; function getConfig( address _oapp, address _lib, uint32 _eid, uint32 _configType ) external view returns (bytes memory config); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingChannel { event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce); event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); function eid() external view returns (uint32); // this is an emergency function if a message cannot be verified for some reasons // required to provide _nextNonce to avoid race condition function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external; function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32); function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64); function inboundPayloadHash( address _receiver, uint32 _srcEid, bytes32 _sender, uint64 _nonce ) external view returns (bytes32); }
// 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 pragma solidity >=0.5.0; import "./IOFTCore.sol"; import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; /** * @dev Interface of the OFT standard */ interface IOFT is IOFTCore, IERC20 { }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the IOFT core standard */ interface IOFTCore is IERC165 { /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _dstChainId - L0 defined chain id to send tokens too * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain * _amount - amount of the tokens to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParam - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendFee(uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); /** * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` * `_from` the owner of token * `_dstChainId` the destination chain identifier * `_toAddress` can be any size depending on the `dstChainId`. * `_amount` the quantity of tokens in wei * `_refundAddress` the address LayerZero refunds if too much message fee is sent * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function sendFrom(address _from, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams) external payable; /** * @dev returns the circulating amount of tokens on current chain */ function circulatingSupply() external view returns (uint); /** * @dev returns the address of the ERC20 token */ function token() external view returns (address); /** * @dev Emitted when `_amount` tokens are moved from the `_sender` to (`_dstChainId`, `_toAddress`) * `_nonce` is the outbound nonce */ event SendToChain(uint16 indexed _dstChainId, address indexed _from, bytes _toAddress, uint _amount); /** * @dev Emitted when `_amount` tokens are received from `_srcChainId` into the `_toAddress` on the local chain. * `_nonce` is the inbound nonce. */ event ReceiveFromChain(uint16 indexed _srcChainId, address indexed _to, uint _amount); event SetUseCustomAdapterParams(bool _useCustomAdapterParams); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "../interfaces/ICommonOFT.sol"; /** * @dev Interface of the IOFT core standard */ interface IOFTWithFee is ICommonOFT { /** * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` * `_from` the owner of token * `_dstChainId` the destination chain identifier * `_toAddress` can be any size depending on the `dstChainId`. * `_amount` the quantity of tokens in wei * `_minAmount` the minimum amount of tokens to receive on dstChain * `_refundAddress` the address LayerZero refunds if too much message fee is sent * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, LzCallParams calldata _callParams) external payable; function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint _minAmount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "@openzeppelin/contracts/utils/introspection/IERC165.sol"; /** * @dev Interface of the IOFT core standard */ interface ICommonOFT is IERC165 { struct LzCallParams { address payable refundAddress; address zroPaymentAddress; bytes adapterParams; } /** * @dev estimate send token `_tokenId` to (`_dstChainId`, `_toAddress`) * _dstChainId - L0 defined chain id to send tokens too * _toAddress - dynamic bytes array which contains the address to whom you are sending tokens to on the dstChain * _amount - amount of the tokens to transfer * _useZro - indicates to use zro to pay L0 fees * _adapterParam - flexible bytes array to indicate messaging adapter services in L0 */ function estimateSendFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); function estimateSendAndCallFee(uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, bool _useZro, bytes calldata _adapterParams) external view returns (uint nativeFee, uint zroFee); /** * @dev returns the circulating amount of tokens on current chain */ function circulatingSupply() external view returns (uint); /** * @dev returns the address of the ERC20 token */ function token() external view returns (address); }
// SPDX-License-Identifier: MIT pragma solidity >=0.5.0; import "./ICommonOFT.sol"; /** * @dev Interface of the IOFT core standard */ interface IOFTV2 is ICommonOFT { /** * @dev send `_amount` amount of token to (`_dstChainId`, `_toAddress`) from `_from` * `_from` the owner of token * `_dstChainId` the destination chain identifier * `_toAddress` can be any size depending on the `dstChainId`. * `_amount` the quantity of tokens in wei * `_refundAddress` the address LayerZero refunds if too much message fee is sent * `_zroPaymentAddress` set to address(0x0) if not paying in ZRO (LayerZero Token) * `_adapterParams` is a flexible bytes array to indicate messaging adapter services */ function sendFrom(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, LzCallParams calldata _callParams) external payable; function sendAndCall(address _from, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bytes calldata _payload, uint64 _dstGasForCall, LzCallParams calldata _callParams) external payable; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/Context.sol"; /** * @dev Contract module which provides a basic access control mechanism, where * there is an account (an owner) that can be granted exclusive access to * specific functions. * * By default, the owner account will be the one that deploys the contract. This * can later be changed with {transferOwnership}. * * This module is used through inheritance. It will make available the modifier * `onlyOwner`, which can be applied to your functions to restrict their use to * the owner. */ abstract contract Ownable is Context { address private _owner; event OwnershipTransferred(address indexed previousOwner, address indexed newOwner); /** * @dev Initializes the contract setting the deployer as the initial owner. */ constructor() { _transferOwnership(_msgSender()); } /** * @dev Throws if called by any account other than the owner. */ modifier onlyOwner() { _checkOwner(); _; } /** * @dev Returns the address of the current owner. */ function owner() public view virtual returns (address) { return _owner; } /** * @dev Throws if the sender is not the owner. */ function _checkOwner() internal view virtual { require(owner() == _msgSender(), "Ownable: caller is not the owner"); } /** * @dev Leaves the contract without owner. It will not be possible to call * `onlyOwner` functions. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby disabling any functionality that is only available to the owner. */ function renounceOwnership() public virtual onlyOwner { _transferOwnership(address(0)); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Can only be called by the current owner. */ function transferOwnership(address newOwner) public virtual onlyOwner { require(newOwner != address(0), "Ownable: new owner is the zero address"); _transferOwnership(newOwner); } /** * @dev Transfers ownership of the contract to a new account (`newOwner`). * Internal function without access restriction. */ function _transferOwnership(address newOwner) internal virtual { address oldOwner = _owner; _owner = newOwner; emit OwnershipTransferred(oldOwner, newOwner); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuard { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; constructor() { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { _nonReentrantBefore(); _; _nonReentrantAfter(); } function _nonReentrantBefore() private { // On the first call to nonReentrant, _status will be _NOT_ENTERED require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; } function _nonReentrantAfter() private { // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a * `nonReentrant` function in the call stack. */ function _reentrancyGuardEntered() internal view returns (bool) { return _status == _ENTERED; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20.sol"; import "../extensions/IERC20Permit.sol"; import "../../../utils/Address.sol"; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC165 standard, as defined in the * https://eips.ethereum.org/EIPS/eip-165[EIP]. * * Implementers can declare support of contract interfaces, which can then be * queried by others ({ERC165Checker}). * * For an implementation, see {ERC165}. */ interface IERC165 { /** * @dev Returns true if this contract implements the interface defined by * `interfaceId`. See the corresponding * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section] * to learn more about how these ids are created. * * This function call must use less than 30 000 gas. */ function supportsInterface(bytes4 interfaceId) external view returns (bool); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface INativeOFT { function deposit() external payable; }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; import { IOFTV2 } from "@layerzerolabs/solidity-examples/contracts/token/oft/v2/interfaces/IOFTV2.sol"; import { MessagingFee as MessagingFeeEpv2, SendParam as SendParamEpv2 } from "@layerzerolabs/lz-evm-oapp-v2/contracts/oft/interfaces/IOFT.sol"; interface IOFTWrapper { event CallerBpsCapSet(uint256 bps); event DefaultBpsSet(uint256 bps); event OFTBpsSet(address indexed token, uint256 bps); event WrapperFees(bytes2 indexed partnerId, address token, uint256 wrapperFee, uint256 callerFee); event WrapperFeeWithdrawn(address indexed oft, address to, uint256 amount); struct FeeObj { uint256 callerBps; address caller; bytes2 partnerId; } function sendOFT( address _oft, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, uint256 _minAmount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external payable; function sendProxyOFT( address _proxyOft, uint16 _dstChainId, bytes calldata _toAddress, uint256 _amount, uint256 _minAmount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external payable; function sendNativeOFT( address _nativeOft, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, uint256 _minAmount, address payable _refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external payable; function sendOFTV2( address _oft, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable; function sendOFTFeeV2( address _oft, uint16 _dstChainId, bytes32 _toAddress, uint256 _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable; function sendProxyOFTV2( address _proxyOft, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable; function sendProxyOFTFeeV2( address _proxyOft, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable; function sendNativeOFTFeeV2( address _nativeOft, uint16 _dstChainId, bytes32 _toAddress, uint _amount, uint256 _minAmount, IOFTV2.LzCallParams calldata _callParams, FeeObj calldata _feeObj ) external payable; function sendOFTEpv2( address _oft, SendParamEpv2 calldata _sendParam, MessagingFeeEpv2 calldata _fee, address _refundAddress, FeeObj calldata _feeObj ) external payable; function sendOFTAdapterEpv2( address _adapterOFT, SendParamEpv2 calldata _sendParam, MessagingFeeEpv2 calldata _fee, address _refundAddress, FeeObj calldata _feeObj ) external payable; function getAmountAndFees( address _oft, uint256 _amount, uint256 _callerBps ) external view returns (uint256 amount, uint256 wrapperFee, uint256 callerFee); function estimateSendFee( address _oft, uint16 _dstChainId, bytes calldata _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external view returns (uint nativeFee, uint zroFee); function estimateSendFeeV2( address _oft, uint16 _dstChainId, bytes32 _toAddress, uint _amount, bool _useZro, bytes calldata _adapterParams, FeeObj calldata _feeObj ) external view returns (uint nativeFee, uint zroFee); function estimateSendFeeEpv2( address _oft, SendParamEpv2 calldata _sendParam, bool _payInLzToken, FeeObj calldata _feeObj ) external view returns (MessagingFeeEpv2 memory); }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 5000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_defaultBps","type":"uint256"},{"internalType":"uint256","name":"_callerBpsCap","type":"uint256"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bps","type":"uint256"}],"name":"CallerBpsCapSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"bps","type":"uint256"}],"name":"DefaultBpsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"bps","type":"uint256"}],"name":"OFTBpsSet","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":true,"internalType":"address","name":"oft","type":"address"},{"indexed":false,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"WrapperFeeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes2","name":"partnerId","type":"bytes2"},{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"wrapperFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"callerFee","type":"uint256"}],"name":"WrapperFees","type":"event"},{"inputs":[],"name":"BPS_DENOMINATOR","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_UINT","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"callerBpsCap","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"defaultBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"estimateSendFee","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"internalType":"bool","name":"_payInLzToken","type":"bool"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"estimateSendFeeEpv2","outputs":[{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"bool","name":"_useZro","type":"bool"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"estimateSendFeeV2","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"zroFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_callerBps","type":"uint256"}],"name":"getAmountAndFees","outputs":[{"internalType":"uint256","name":"amount","type":"uint256"},{"internalType":"uint256","name":"wrapperFee","type":"uint256"},{"internalType":"uint256","name":"callerFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"oftBps","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_nativeOft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendNativeOFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_nativeOft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendNativeOFTFeeV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendOFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_adapterOFT","type":"address"},{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"_fee","type":"tuple"},{"internalType":"address","name":"_refundAddress","type":"address"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendOFTAdapterEpv2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"components":[{"internalType":"uint32","name":"dstEid","type":"uint32"},{"internalType":"bytes32","name":"to","type":"bytes32"},{"internalType":"uint256","name":"amountLD","type":"uint256"},{"internalType":"uint256","name":"minAmountLD","type":"uint256"},{"internalType":"bytes","name":"extraOptions","type":"bytes"},{"internalType":"bytes","name":"composeMsg","type":"bytes"},{"internalType":"bytes","name":"oftCmd","type":"bytes"}],"internalType":"struct SendParam","name":"_sendParam","type":"tuple"},{"components":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"internalType":"struct MessagingFee","name":"_fee","type":"tuple"},{"internalType":"address","name":"_refundAddress","type":"address"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendOFTEpv2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendOFTFeeV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendOFTV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyOft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes","name":"_toAddress","type":"bytes"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"_adapterParams","type":"bytes"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendProxyOFT","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyOft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendProxyOFTFeeV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"_proxyOft","type":"address"},{"internalType":"uint16","name":"_dstChainId","type":"uint16"},{"internalType":"bytes32","name":"_toAddress","type":"bytes32"},{"internalType":"uint256","name":"_amount","type":"uint256"},{"internalType":"uint256","name":"_minAmount","type":"uint256"},{"components":[{"internalType":"address payable","name":"refundAddress","type":"address"},{"internalType":"address","name":"zroPaymentAddress","type":"address"},{"internalType":"bytes","name":"adapterParams","type":"bytes"}],"internalType":"struct ICommonOFT.LzCallParams","name":"_callParams","type":"tuple"},{"components":[{"internalType":"uint256","name":"callerBps","type":"uint256"},{"internalType":"address","name":"caller","type":"address"},{"internalType":"bytes2","name":"partnerId","type":"bytes2"}],"internalType":"struct IOFTWrapper.FeeObj","name":"_feeObj","type":"tuple"}],"name":"sendProxyOFTV2","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_callerBpsCap","type":"uint256"}],"name":"setCallerBpsCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_defaultBps","type":"uint256"}],"name":"setDefaultBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"},{"internalType":"uint256","name":"_bps","type":"uint256"}],"name":"setOFTBps","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_oft","type":"address"},{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawFees","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60806040523480156200001157600080fd5b5060405162003174380380620031748339810160408190526200003491620000f8565b6200003f33620000a8565b600180556127108210620000995760405162461bcd60e51b815260206004820152601e60248201527f4f4654577261707065723a2064656661756c74427073203e3d20313030250000604482015260640160405180910390fd5b6002919091556004556200011d565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600080604083850312156200010c57600080fd5b505080516020909101519092909150565b613047806200012d6000396000f3fe6080604052600436106101a15760003560e01c8063a8198c00116100e1578063e1a452181161008a578063e5b5019a11610064578063e5b5019a14610422578063e90d5fc914610456578063f2fde38b14610491578063fdb80c81146104b157600080fd5b8063e1a45218146103cc578063e1bafc80146103e2578063e55dc4e61461040257600080fd5b8063ca3e534c116100bb578063ca3e534c14610390578063d1b308dc146103a3578063dda16a10146103b957600080fd5b8063a8198c0014610354578063ab03b5fd14610367578063c3c8032a1461037d57600080fd5b80637a7511821161014e5780638bcb586c116101285780638bcb586c146102c45780638d8c915c146102d75780638da5cb5b1461030c578063a46d74bc1461033457600080fd5b80637a7511821461026357806383e166381461029e57806385154849146102b157600080fd5b8063498eff641161017f578063498eff641461022857806362bf7c9e1461023b578063715018a61461024e57600080fd5b80630c3d2756146101a657806317696f64146101c857806336739d3d14610208575b600080fd5b3480156101b257600080fd5b506101c66101c13660046123ce565b6104c4565b005b3480156101d457600080fd5b506101e86101e33660046123fa565b6105a5565b604080519384526020840192909252908201526060015b60405180910390f35b34801561021457600080fd5b506101c661022336600461242f565b6105cd565b6101c66102363660046124bb565b610663565b6101c66102493660046125b1565b61070b565b34801561025a57600080fd5b506101c66108ef565b34801561026f57600080fd5b5061029061027e366004612661565b60036020526000908152604090205481565b6040519081526020016101ff565b6101c66102ac3660046125b1565b610903565b6101c66102bf366004612685565b610c03565b6101c66102d2366004612685565b610ca1565b3480156102e357600080fd5b506102f76102f2366004612723565b610e72565b604080519283526020830191909152016101ff565b34801561031857600080fd5b506000546040516001600160a01b0390911681526020016101ff565b34801561034057600080fd5b506101c661034f36600461242f565b610f94565b6101c6610362366004612685565b611022565b34801561037357600080fd5b5061029060045481565b6101c661038b3660046124bb565b611079565b6101c661039e366004612685565b611230565b3480156103af57600080fd5b5061029060025481565b6101c66103c7366004612685565b61135c565b3480156103d857600080fd5b5061029061271081565b3480156103ee57600080fd5b506102f76103fd3660046127c2565b611447565b34801561040e57600080fd5b506101c661041d366004612885565b611540565b34801561042e57600080fd5b506102907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b34801561046257600080fd5b506104766104713660046128c6565b6115a7565b604080518251815260209283015192810192909252016101ff565b34801561049d57600080fd5b506101c66104ac366004612661565b6117e9565b6101c66104bf3660046124bb565b611879565b6104cc6119ab565b6127108110806104fb57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81145b61054c5760405162461bcd60e51b815260206004820181905260248201527f4f4654577261707065723a206f66744270735b5f6f66745d203e3d203130302560448201526064015b60405180910390fd5b6001600160a01b03821660008181526003602052604090819020839055517ff51611cfa84d1f2df6840c4651ba5b8f3f45d66811e43567dfe472a6b5a7ffb8906105999084815260200190565b60405180910390a25050565b60008060006105b384611a05565b6105be868686611a7c565b92509250925093509350939050565b6105d56119ab565b6127108111156106275760405162461bcd60e51b815260206004820152601f60248201527f4f4654577261707065723a2063616c6c6572427073436170203e2031303025006044820152606401610543565b60048190556040518181527fb474bfee9176a4392a746f7432e2daa216a9db2234f881770e4096bddeefaeb2906020015b60405180910390a150565b61066b611ba5565b6106758135611a05565b60006106838c898985611bfe565b90508b6001600160a01b0316635190563634338e8e8e878d8d8d8d6040518b63ffffffff1660e01b81526004016106c299989796959493929190612965565b6000604051808303818588803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b5050505050506106fe60018055565b5050505050505050505050565b610713611ba5565b61071d8135611a05565b6000610733868660400135876060013585611d6a565b9050856001600160a01b031663c7c7f5b3346040518060e0016040528089600001602081019061076391906129cd565b63ffffffff168152602001896020013581526020018581526020018960600135815260200189806080019061079891906129f3565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016107df60a08b018b6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161082660c08b018b6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152610899919089908990600401612b27565b60c06040518083038185885af11580156108b7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108dc9190612bda565b5050506108e860018055565b5050505050565b6108f76119ab565b6109016000611e24565b565b61090b611ba5565b6109158135611a05565b6000856001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109799190612c95565b90506000610991828760400135886060013586611d6a565b90506109a76001600160a01b0383168883611e8c565b866001600160a01b031663c7c7f5b3346040518060e001604052808a60000160208101906109d591906129cd565b63ffffffff1681526020018a6020013581526020018581526020018a6060013581526020018a8060800190610a0a91906129f3565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610a5160a08c018c6129f3565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610a9860c08c018c6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152610b0b91908a908a90600401612b27565b60c06040518083038185885af1158015610b29573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b4e9190612bda565b50506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0388811660248301526000919084169063dd62ed3e90604401602060405180830381865afa158015610bb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdd9190612cb2565b1115610bf857610bf86001600160a01b038316886000611e8c565b50506108e860018055565b610c0b611ba5565b610c158135611a05565b6000610c2388868685611bfe565b9050876001600160a01b0316632cdf0b9534338a8a868a8a6040518863ffffffff1660e01b8152600401610c5c96959493929190612d71565b6000604051808303818588803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b505050505050610c9860018055565b50505050505050565b610ca9611ba5565b610cb38135611a05565b6000876001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190612c95565b90506000610d2782878786611d6a565b9050610d3d6001600160a01b0383168a83611e8c565b6040517f2cdf0b950000000000000000000000000000000000000000000000000000000081526001600160a01b038a1690632cdf0b95903490610d8e9030908d908d9088908d908d90600401612d71565b6000604051808303818588803b158015610da757600080fd5b505af1158015610dbb573d6000803e3d6000fd5b50506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038d81166024830152600094508616925063dd62ed3e9150604401602060405180830381865afa158015610e28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4c9190612cb2565b1115610e6757610e676001600160a01b0383168a6000611e8c565b5050610c9860018055565b600080610e7f8335611a05565b6000610eee8b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee69190612c95565b898635611a7c565b50506040517f365260b40000000000000000000000000000000000000000000000000000000081529091506001600160a01b038c169063365260b490610f42908d908d9086908d908d908d90600401612dbb565b6040805180830381865afa158015610f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f829190612ded565b92509250509850989650505050505050565b610f9c6119ab565b6127108110610fed5760405162461bcd60e51b815260206004820152601e60248201527f4f4654577261707065723a2064656661756c74427073203e3d203130302500006044820152606401610543565b60028190556040518181527f935f0caa3a542ed0e18e9116cee6e58fc0e502596c9a47909aa4af65fd69b99190602001610658565b61102a611ba5565b6110348135611a05565b600061104288868685611bfe565b9050876001600160a01b031663695ef6bf34338a8a86896040518763ffffffff1660e01b8152600401610c5c959493929190612e11565b611081611ba5565b61108b8135611a05565b60008b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef9190612c95565b905060006110ff828a8a86611d6a565b90506111156001600160a01b0383168e83611e8c565b8c6001600160a01b0316635190563634308f8f8f878e8e8e8e6040518b63ffffffff1660e01b815260040161115299989796959493929190612965565b6000604051808303818588803b15801561116b57600080fd5b505af115801561117f573d6000803e3d6000fd5b5050505050506000816001600160a01b031663dd62ed3e308f6040518363ffffffff1660e01b81526004016111ca9291906001600160a01b0392831681529116602082015260400190565b602060405180830381865afa1580156111e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120b9190612cb2565b1115611226576112266001600160a01b0382168d6000611e8c565b506106fe60018055565b611238611ba5565b6112428135611a05565b833410156112b85760405162461bcd60e51b815260206004820152602160248201527f4f4654577261707065723a206e6f7420656e6f7567682076616c75652073656e60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610543565b866001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156112f357600080fd5b505af1158015611307573d6000803e3d6000fd5b5050505050600061131a8886868561203f565b90506001600160a01b038816632cdf0b956113358734612e78565b308a8a868a8a6040518863ffffffff1660e01b8152600401610c5c96959493929190612d71565b611364611ba5565b61136e8135611a05565b6000876001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d29190612c95565b905060006113e282878786611d6a565b90506113f86001600160a01b0383168a83611e8c565b6040517f695ef6bf0000000000000000000000000000000000000000000000000000000081526001600160a01b038a169063695ef6bf903490610d8e9030908d908d9088908c90600401612e11565b6000806114548335611a05565b60006114978c6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec2573d6000803e3d6000fd5b50506040517f2a205e3d0000000000000000000000000000000000000000000000000000000081529091506001600160a01b038d1690632a205e3d906114ed908e908e908e9087908e908e908e90600401612e91565b6040805180830381865afa158015611509573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152d9190612ded565b9250925050995099975050505050505050565b6115486119ab565b61155c6001600160a01b03841683836120fe565b604080516001600160a01b038481168252602082018490528516917ff6514f9f283faac4cf3f3a6a702c116227ad0f2c727fb336e4c10b418bc6d613910160405180910390a2505050565b60408051808201909152600080825260208201526115c58235611a05565b6000611638866001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162c9190612c95565b60408701358535611a7c565b50509050856001600160a01b0316633b6f743b6040518060e0016040528088600001602081019061166991906129cd565b63ffffffff168152602001886020013581526020018481526020018860600135815260200188806080019061169e91906129f3565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016116e560a08a018a6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161172c60c08a018a6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261179d91908890600401612ede565b6040805180830381865afa1580156117b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117dd9190612f02565b9150505b949350505050565b6117f16119ab565b6001600160a01b03811661186d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610543565b61187681611e24565b50565b611881611ba5565b61188b8135611a05565b863410156119015760405162461bcd60e51b815260206004820152602160248201527f4f4654577261707065723a206e6f7420656e6f7567682076616c75652073656e60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610543565b8a6001600160a01b031663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b15801561193c57600080fd5b505af1158015611950573d6000803e3d6000fd5b505050505060006119638c89898561203f565b90506001600160a01b038c16635190563661197e8a34612e78565b308e8e8e878d8d8d8d6040518b63ffffffff1660e01b81526004016106c299989796959493929190612965565b6000546001600160a01b031633146109015760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610543565b6004548111156118765760405162461bcd60e51b8152602060048201526024808201527f4f4654577261707065723a2063616c6c6572427073203e2063616c6c6572427060448201527f73436170000000000000000000000000000000000000000000000000000000006064820152608401610543565b6001600160a01b03831660009081526003602052604081205481908190819060018101611aac5760009150611ac0565b8015611aba57809150611ac0565b60025491505b612710611acd8784612f1e565b10611b1a5760405162461bcd60e51b815260206004820152601b60248201527f4f4654577261707065723a2046656520627073203e3d203130302500000000006044820152606401610543565b60008211611b29576000611b40565b612710611b368389612f31565b611b409190612f48565b935060008611611b51576000611b68565b612710611b5e8789612f31565b611b689190612f48565b92506000841180611b795750600083115b611b835786611b98565b82611b8e8589612e78565b611b989190612e78565b9450505093509350939050565b600260015403611bf75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610543565b6002600155565b6000808080611c0f88888735611a7c565b925092509250858310158015611c255750600083115b611c975760405162461bcd60e51b815260206004820152602360248201527f4f4654577261707065723a206e6f7420656e6f75676820616d6f756e74546f5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152608401610543565b8115611cb257611cb26001600160a01b038916333085612147565b8015611cde57611cde33611ccc6040880160208901612661565b6001600160a01b038b16919084612147565b611cee6060860160408701612f83565b604080516001600160a01b038b168152602081018590529081018390527fffff00000000000000000000000000000000000000000000000000000000000091909116907f97bcdc1dd7ab82ef93280983f23d391afea463d0333fddd1a4617693b9ccfeea9060600160405180910390a250909695505050505050565b6000808080611d7b88888735611a7c565b925092509250858310158015611d915750600083115b611e035760405162461bcd60e51b815260206004820152602360248201527f4f4654577261707065723a206e6f7420656e6f75676820616d6f756e74546f5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152608401610543565b611cb23330611e128587612f1e565b6001600160a01b038c16929190612147565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b801580611f1f57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d9190612cb2565b155b611f915760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610543565b6040516001600160a01b03831660248201526044810182905261203a9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261219e565b505050565b600080808061205088888735611a7c565b9250925092508583101580156120665750600083115b6120d85760405162461bcd60e51b815260206004820152602360248201527f4f4654577261707065723a206e6f7420656e6f75676820616d6f756e74546f5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152608401610543565b8015611cde57611cde6120f16040870160208801612661565b6001600160a01b038a1690835b6040516001600160a01b03831660248201526044810182905261203a9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611fd6565b6040516001600160a01b03808516602483015283166044820152606481018290526121989085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611fd6565b50505050565b60006121f3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122869092919063ffffffff16565b90508051600014806122145750808060200190518101906122149190612fc5565b61203a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610543565b60606117e1848460008585600080866001600160a01b031685876040516122ad9190612fe2565b60006040518083038185875af1925050503d80600081146122ea576040519150601f19603f3d011682016040523d82523d6000602084013e6122ef565b606091505b50915091506123008783838761230b565b979650505050505050565b6060831561237a578251600003612373576001600160a01b0385163b6123735760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610543565b50816117e1565b6117e1838381511561238f5781518083602001fd5b8060405162461bcd60e51b81526004016105439190612ffe565b6001600160a01b038116811461187657600080fd5b80356123c9816123a9565b919050565b600080604083850312156123e157600080fd5b82356123ec816123a9565b946020939093013593505050565b60008060006060848603121561240f57600080fd5b833561241a816123a9565b95602085013595506040909401359392505050565b60006020828403121561244157600080fd5b5035919050565b803561ffff811681146123c957600080fd5b60008083601f84011261246c57600080fd5b50813567ffffffffffffffff81111561248457600080fd5b60208301915083602082850101111561249c57600080fd5b9250929050565b6000606082840312156124b557600080fd5b50919050565b60008060008060008060008060008060006101608c8e0312156124dd57600080fd5b6124e78c356123a9565b8b359a506124f760208d01612448565b995067ffffffffffffffff8060408e0135111561251357600080fd5b6125238e60408f01358f0161245a565b909a50985060608d0135975060808d0135965061254360a08e01356123a9565b60a08d0135955061255660c08e016123be565b94508060e08e0135111561256957600080fd5b5061257a8d60e08e01358e0161245a565b909350915061258d8d6101008e016124a3565b90509295989b509295989b9093969950565b600060e082840312156124b557600080fd5b60008060008060008587036101008112156125cb57600080fd5b86356125d6816123a9565b9550602087013567ffffffffffffffff8111156125f257600080fd5b6125fe89828a0161259f565b95505060407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08201121561263157600080fd5b506040860192506080860135612646816123a9565b91506126558760a088016124a3565b90509295509295909350565b60006020828403121561267357600080fd5b813561267e816123a9565b9392505050565b6000806000806000806000610120888a0312156126a157600080fd5b87356126ac816123a9565b96506126ba60208901612448565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff8111156126eb57600080fd5b6126f78a828b016124a3565b9250506127078960c08a016124a3565b905092959891949750929550565b801515811461187657600080fd5b600080600080600080600080610120898b03121561274057600080fd5b883561274b816123a9565b975061275960208a01612448565b96506040890135955060608901359450608089013561277781612715565b935060a089013567ffffffffffffffff81111561279357600080fd5b61279f8b828c0161245a565b90945092506127b390508a60c08b016124a3565b90509295985092959890939650565b60008060008060008060008060006101208a8c0312156127e157600080fd5b89356127ec816123a9565b98506127fa60208b01612448565b975060408a013567ffffffffffffffff8082111561281757600080fd5b6128238d838e0161245a565b909950975060608c0135965060808c0135915061283f82612715565b90945060a08b0135908082111561285557600080fd5b506128628c828d0161245a565b909450925061287690508b60c08c016124a3565b90509295985092959850929598565b60008060006060848603121561289a57600080fd5b83356128a5816123a9565b925060208401356128b5816123a9565b929592945050506040919091013590565b60008060008060c085870312156128dc57600080fd5b84356128e7816123a9565b9350602085013567ffffffffffffffff81111561290357600080fd5b61290f8782880161259f565b935050604085013561292081612715565b915061292f86606087016124a3565b905092959194509250565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60006001600160a01b03808c16835261ffff8b16602084015260e0604084015261299360e084018a8c61293a565b886060850152818816608085015281871660a085015283810360c08501526129bc81868861293a565b9d9c50505050505050505050505050565b6000602082840312156129df57600080fd5b813563ffffffff8116811461267e57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612a2857600080fd5b83018035915067ffffffffffffffff821115612a4357600080fd5b60200191503681900382131561249c57600080fd5b60005b83811015612a73578181015183820152602001612a5b565b50506000910152565b60008151808452612a94816020860160208601612a58565b601f01601f19169290920160200192915050565b63ffffffff81511682526020810151602083015260408101516040830152606081015160608301526000608082015160e06080850152612aeb60e0850182612a7c565b905060a083015184820360a0860152612b048282612a7c565b91505060c083015184820360c0860152612b1e8282612a7c565b95945050505050565b608081526000612b3a6080830186612aa8565b905083356020830152602084013560408301526001600160a01b0383166060830152949350505050565b600060408284031215612b7657600080fd5b6040516040810181811067ffffffffffffffff82111715612bc0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b60008082840360c0811215612bee57600080fd5b6080811215612bfc57600080fd5b506040516060810167ffffffffffffffff8282108183111715612c48577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8160405285518352602086015191508082168214612c6557600080fd5b506020820152612c788560408601612b64565b60408201529150612c8c8460808501612b64565b90509250929050565b600060208284031215612ca757600080fd5b815161267e816123a9565b600060208284031215612cc457600080fd5b5051919050565b60008135612cd8816123a9565b6001600160a01b039081168452602083013590612cf4826123a9565b1660208401526040820135368390037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1018112612d3057600080fd5b820160208101903567ffffffffffffffff811115612d4d57600080fd5b803603821315612d5c57600080fd5b60606040860152612b1e60608601828461293a565b6001600160a01b038716815261ffff8616602082015284604082015283606082015282608082015260c060a08201526000612daf60c0830184612ccb565b98975050505050505050565b61ffff87168152856020820152846040820152831515606082015260a060808201526000612daf60a08301848661293a565b60008060408385031215612e0057600080fd5b505080516020909101519092909150565b6001600160a01b038616815261ffff8516602082015283604082015282606082015260a06080820152600061230060a0830184612ccb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115612e8b57612e8b612e49565b92915050565b61ffff8816815260a060208201526000612eaf60a08301888a61293a565b86604084015285151560608401528281036080840152612ed081858761293a565b9a9950505050505050505050565b604081526000612ef16040830185612aa8565b905082151560208301529392505050565b600060408284031215612f1457600080fd5b61267e8383612b64565b80820180821115612e8b57612e8b612e49565b8082028115828204841417612e8b57612e8b612e49565b600082612f7e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600060208284031215612f9557600080fd5b81357fffff0000000000000000000000000000000000000000000000000000000000008116811461267e57600080fd5b600060208284031215612fd757600080fd5b815161267e81612715565b60008251612ff4818460208701612a58565b9190910192915050565b60208152600061267e6020830184612a7c56fea26469706673582212204004b1b28a37016a635ed8741c8b5ec3c78d029e1953c4122e4eef539fc5091c64736f6c634300081600330000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000012c
Deployed Bytecode
0x6080604052600436106101a15760003560e01c8063a8198c00116100e1578063e1a452181161008a578063e5b5019a11610064578063e5b5019a14610422578063e90d5fc914610456578063f2fde38b14610491578063fdb80c81146104b157600080fd5b8063e1a45218146103cc578063e1bafc80146103e2578063e55dc4e61461040257600080fd5b8063ca3e534c116100bb578063ca3e534c14610390578063d1b308dc146103a3578063dda16a10146103b957600080fd5b8063a8198c0014610354578063ab03b5fd14610367578063c3c8032a1461037d57600080fd5b80637a7511821161014e5780638bcb586c116101285780638bcb586c146102c45780638d8c915c146102d75780638da5cb5b1461030c578063a46d74bc1461033457600080fd5b80637a7511821461026357806383e166381461029e57806385154849146102b157600080fd5b8063498eff641161017f578063498eff641461022857806362bf7c9e1461023b578063715018a61461024e57600080fd5b80630c3d2756146101a657806317696f64146101c857806336739d3d14610208575b600080fd5b3480156101b257600080fd5b506101c66101c13660046123ce565b6104c4565b005b3480156101d457600080fd5b506101e86101e33660046123fa565b6105a5565b604080519384526020840192909252908201526060015b60405180910390f35b34801561021457600080fd5b506101c661022336600461242f565b6105cd565b6101c66102363660046124bb565b610663565b6101c66102493660046125b1565b61070b565b34801561025a57600080fd5b506101c66108ef565b34801561026f57600080fd5b5061029061027e366004612661565b60036020526000908152604090205481565b6040519081526020016101ff565b6101c66102ac3660046125b1565b610903565b6101c66102bf366004612685565b610c03565b6101c66102d2366004612685565b610ca1565b3480156102e357600080fd5b506102f76102f2366004612723565b610e72565b604080519283526020830191909152016101ff565b34801561031857600080fd5b506000546040516001600160a01b0390911681526020016101ff565b34801561034057600080fd5b506101c661034f36600461242f565b610f94565b6101c6610362366004612685565b611022565b34801561037357600080fd5b5061029060045481565b6101c661038b3660046124bb565b611079565b6101c661039e366004612685565b611230565b3480156103af57600080fd5b5061029060025481565b6101c66103c7366004612685565b61135c565b3480156103d857600080fd5b5061029061271081565b3480156103ee57600080fd5b506102f76103fd3660046127c2565b611447565b34801561040e57600080fd5b506101c661041d366004612885565b611540565b34801561042e57600080fd5b506102907fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81565b34801561046257600080fd5b506104766104713660046128c6565b6115a7565b604080518251815260209283015192810192909252016101ff565b34801561049d57600080fd5b506101c66104ac366004612661565b6117e9565b6101c66104bf3660046124bb565b611879565b6104cc6119ab565b6127108110806104fb57507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81145b61054c5760405162461bcd60e51b815260206004820181905260248201527f4f4654577261707065723a206f66744270735b5f6f66745d203e3d203130302560448201526064015b60405180910390fd5b6001600160a01b03821660008181526003602052604090819020839055517ff51611cfa84d1f2df6840c4651ba5b8f3f45d66811e43567dfe472a6b5a7ffb8906105999084815260200190565b60405180910390a25050565b60008060006105b384611a05565b6105be868686611a7c565b92509250925093509350939050565b6105d56119ab565b6127108111156106275760405162461bcd60e51b815260206004820152601f60248201527f4f4654577261707065723a2063616c6c6572427073436170203e2031303025006044820152606401610543565b60048190556040518181527fb474bfee9176a4392a746f7432e2daa216a9db2234f881770e4096bddeefaeb2906020015b60405180910390a150565b61066b611ba5565b6106758135611a05565b60006106838c898985611bfe565b90508b6001600160a01b0316635190563634338e8e8e878d8d8d8d6040518b63ffffffff1660e01b81526004016106c299989796959493929190612965565b6000604051808303818588803b1580156106db57600080fd5b505af11580156106ef573d6000803e3d6000fd5b5050505050506106fe60018055565b5050505050505050505050565b610713611ba5565b61071d8135611a05565b6000610733868660400135876060013585611d6a565b9050856001600160a01b031663c7c7f5b3346040518060e0016040528089600001602081019061076391906129cd565b63ffffffff168152602001896020013581526020018581526020018960600135815260200189806080019061079891906129f3565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016107df60a08b018b6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161082660c08b018b6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152610899919089908990600401612b27565b60c06040518083038185885af11580156108b7573d6000803e3d6000fd5b50505050506040513d601f19601f820116820180604052508101906108dc9190612bda565b5050506108e860018055565b5050505050565b6108f76119ab565b6109016000611e24565b565b61090b611ba5565b6109158135611a05565b6000856001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610955573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906109799190612c95565b90506000610991828760400135886060013586611d6a565b90506109a76001600160a01b0383168883611e8c565b866001600160a01b031663c7c7f5b3346040518060e001604052808a60000160208101906109d591906129cd565b63ffffffff1681526020018a6020013581526020018581526020018a6060013581526020018a8060800190610a0a91906129f3565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610a5160a08c018c6129f3565b8080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250505090825250602001610a9860c08c018c6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152610b0b91908a908a90600401612b27565b60c06040518083038185885af1158015610b29573d6000803e3d6000fd5b50505050506040513d601f19601f82011682018060405250810190610b4e9190612bda565b50506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b0388811660248301526000919084169063dd62ed3e90604401602060405180830381865afa158015610bb9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610bdd9190612cb2565b1115610bf857610bf86001600160a01b038316886000611e8c565b50506108e860018055565b610c0b611ba5565b610c158135611a05565b6000610c2388868685611bfe565b9050876001600160a01b0316632cdf0b9534338a8a868a8a6040518863ffffffff1660e01b8152600401610c5c96959493929190612d71565b6000604051808303818588803b158015610c7557600080fd5b505af1158015610c89573d6000803e3d6000fd5b505050505050610c9860018055565b50505050505050565b610ca9611ba5565b610cb38135611a05565b6000876001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610cf3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610d179190612c95565b90506000610d2782878786611d6a565b9050610d3d6001600160a01b0383168a83611e8c565b6040517f2cdf0b950000000000000000000000000000000000000000000000000000000081526001600160a01b038a1690632cdf0b95903490610d8e9030908d908d9088908d908d90600401612d71565b6000604051808303818588803b158015610da757600080fd5b505af1158015610dbb573d6000803e3d6000fd5b50506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b038d81166024830152600094508616925063dd62ed3e9150604401602060405180830381865afa158015610e28573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e4c9190612cb2565b1115610e6757610e676001600160a01b0383168a6000611e8c565b5050610c9860018055565b600080610e7f8335611a05565b6000610eee8b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec2573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610ee69190612c95565b898635611a7c565b50506040517f365260b40000000000000000000000000000000000000000000000000000000081529091506001600160a01b038c169063365260b490610f42908d908d9086908d908d908d90600401612dbb565b6040805180830381865afa158015610f5e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610f829190612ded565b92509250509850989650505050505050565b610f9c6119ab565b6127108110610fed5760405162461bcd60e51b815260206004820152601e60248201527f4f4654577261707065723a2064656661756c74427073203e3d203130302500006044820152606401610543565b60028190556040518181527f935f0caa3a542ed0e18e9116cee6e58fc0e502596c9a47909aa4af65fd69b99190602001610658565b61102a611ba5565b6110348135611a05565b600061104288868685611bfe565b9050876001600160a01b031663695ef6bf34338a8a86896040518763ffffffff1660e01b8152600401610c5c959493929190612e11565b611081611ba5565b61108b8135611a05565b60008b6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110cb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110ef9190612c95565b905060006110ff828a8a86611d6a565b90506111156001600160a01b0383168e83611e8c565b8c6001600160a01b0316635190563634308f8f8f878e8e8e8e6040518b63ffffffff1660e01b815260040161115299989796959493929190612965565b6000604051808303818588803b15801561116b57600080fd5b505af115801561117f573d6000803e3d6000fd5b5050505050506000816001600160a01b031663dd62ed3e308f6040518363ffffffff1660e01b81526004016111ca9291906001600160a01b0392831681529116602082015260400190565b602060405180830381865afa1580156111e7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061120b9190612cb2565b1115611226576112266001600160a01b0382168d6000611e8c565b506106fe60018055565b611238611ba5565b6112428135611a05565b833410156112b85760405162461bcd60e51b815260206004820152602160248201527f4f4654577261707065723a206e6f7420656e6f7567682076616c75652073656e60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610543565b866001600160a01b031663d0e30db0856040518263ffffffff1660e01b81526004016000604051808303818588803b1580156112f357600080fd5b505af1158015611307573d6000803e3d6000fd5b5050505050600061131a8886868561203f565b90506001600160a01b038816632cdf0b956113358734612e78565b308a8a868a8a6040518863ffffffff1660e01b8152600401610c5c96959493929190612d71565b611364611ba5565b61136e8135611a05565b6000876001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156113ae573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d29190612c95565b905060006113e282878786611d6a565b90506113f86001600160a01b0383168a83611e8c565b6040517f695ef6bf0000000000000000000000000000000000000000000000000000000081526001600160a01b038a169063695ef6bf903490610d8e9030908d908d9088908c90600401612e11565b6000806114548335611a05565b60006114978c6001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610ec2573d6000803e3d6000fd5b50506040517f2a205e3d0000000000000000000000000000000000000000000000000000000081529091506001600160a01b038d1690632a205e3d906114ed908e908e908e9087908e908e908e90600401612e91565b6040805180830381865afa158015611509573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061152d9190612ded565b9250925050995099975050505050505050565b6115486119ab565b61155c6001600160a01b03841683836120fe565b604080516001600160a01b038481168252602082018490528516917ff6514f9f283faac4cf3f3a6a702c116227ad0f2c727fb336e4c10b418bc6d613910160405180910390a2505050565b60408051808201909152600080825260208201526115c58235611a05565b6000611638866001600160a01b031663fc0c546a6040518163ffffffff1660e01b8152600401602060405180830381865afa158015611608573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061162c9190612c95565b60408701358535611a7c565b50509050856001600160a01b0316633b6f743b6040518060e0016040528088600001602081019061166991906129cd565b63ffffffff168152602001886020013581526020018481526020018860600135815260200188806080019061169e91906129f3565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050908252506020016116e560a08a018a6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509082525060200161172c60c08a018a6129f3565b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152506040517fffffffff0000000000000000000000000000000000000000000000000000000060e084901b16815261179d91908890600401612ede565b6040805180830381865afa1580156117b9573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906117dd9190612f02565b9150505b949350505050565b6117f16119ab565b6001600160a01b03811661186d5760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610543565b61187681611e24565b50565b611881611ba5565b61188b8135611a05565b863410156119015760405162461bcd60e51b815260206004820152602160248201527f4f4654577261707065723a206e6f7420656e6f7567682076616c75652073656e60448201527f74000000000000000000000000000000000000000000000000000000000000006064820152608401610543565b8a6001600160a01b031663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b15801561193c57600080fd5b505af1158015611950573d6000803e3d6000fd5b505050505060006119638c89898561203f565b90506001600160a01b038c16635190563661197e8a34612e78565b308e8e8e878d8d8d8d6040518b63ffffffff1660e01b81526004016106c299989796959493929190612965565b6000546001600160a01b031633146109015760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610543565b6004548111156118765760405162461bcd60e51b8152602060048201526024808201527f4f4654577261707065723a2063616c6c6572427073203e2063616c6c6572427060448201527f73436170000000000000000000000000000000000000000000000000000000006064820152608401610543565b6001600160a01b03831660009081526003602052604081205481908190819060018101611aac5760009150611ac0565b8015611aba57809150611ac0565b60025491505b612710611acd8784612f1e565b10611b1a5760405162461bcd60e51b815260206004820152601b60248201527f4f4654577261707065723a2046656520627073203e3d203130302500000000006044820152606401610543565b60008211611b29576000611b40565b612710611b368389612f31565b611b409190612f48565b935060008611611b51576000611b68565b612710611b5e8789612f31565b611b689190612f48565b92506000841180611b795750600083115b611b835786611b98565b82611b8e8589612e78565b611b989190612e78565b9450505093509350939050565b600260015403611bf75760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c006044820152606401610543565b6002600155565b6000808080611c0f88888735611a7c565b925092509250858310158015611c255750600083115b611c975760405162461bcd60e51b815260206004820152602360248201527f4f4654577261707065723a206e6f7420656e6f75676820616d6f756e74546f5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152608401610543565b8115611cb257611cb26001600160a01b038916333085612147565b8015611cde57611cde33611ccc6040880160208901612661565b6001600160a01b038b16919084612147565b611cee6060860160408701612f83565b604080516001600160a01b038b168152602081018590529081018390527fffff00000000000000000000000000000000000000000000000000000000000091909116907f97bcdc1dd7ab82ef93280983f23d391afea463d0333fddd1a4617693b9ccfeea9060600160405180910390a250909695505050505050565b6000808080611d7b88888735611a7c565b925092509250858310158015611d915750600083115b611e035760405162461bcd60e51b815260206004820152602360248201527f4f4654577261707065723a206e6f7420656e6f75676820616d6f756e74546f5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152608401610543565b611cb23330611e128587612f1e565b6001600160a01b038c16929190612147565b600080546001600160a01b038381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b801580611f1f57506040517fdd62ed3e0000000000000000000000000000000000000000000000000000000081523060048201526001600160a01b03838116602483015284169063dd62ed3e90604401602060405180830381865afa158015611ef9573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611f1d9190612cb2565b155b611f915760405162461bcd60e51b815260206004820152603660248201527f5361666545524332303a20617070726f76652066726f6d206e6f6e2d7a65726f60448201527f20746f206e6f6e2d7a65726f20616c6c6f77616e6365000000000000000000006064820152608401610543565b6040516001600160a01b03831660248201526044810182905261203a9084907f095ea7b300000000000000000000000000000000000000000000000000000000906064015b60408051601f198184030181529190526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fffffffff000000000000000000000000000000000000000000000000000000009093169290921790915261219e565b505050565b600080808061205088888735611a7c565b9250925092508583101580156120665750600083115b6120d85760405162461bcd60e51b815260206004820152602360248201527f4f4654577261707065723a206e6f7420656e6f75676820616d6f756e74546f5360448201527f77617000000000000000000000000000000000000000000000000000000000006064820152608401610543565b8015611cde57611cde6120f16040870160208801612661565b6001600160a01b038a1690835b6040516001600160a01b03831660248201526044810182905261203a9084907fa9059cbb0000000000000000000000000000000000000000000000000000000090606401611fd6565b6040516001600160a01b03808516602483015283166044820152606481018290526121989085907f23b872dd0000000000000000000000000000000000000000000000000000000090608401611fd6565b50505050565b60006121f3826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122869092919063ffffffff16565b90508051600014806122145750808060200190518101906122149190612fc5565b61203a5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f742073756363656564000000000000000000000000000000000000000000006064820152608401610543565b60606117e1848460008585600080866001600160a01b031685876040516122ad9190612fe2565b60006040518083038185875af1925050503d80600081146122ea576040519150601f19603f3d011682016040523d82523d6000602084013e6122ef565b606091505b50915091506123008783838761230b565b979650505050505050565b6060831561237a578251600003612373576001600160a01b0385163b6123735760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610543565b50816117e1565b6117e1838381511561238f5781518083602001fd5b8060405162461bcd60e51b81526004016105439190612ffe565b6001600160a01b038116811461187657600080fd5b80356123c9816123a9565b919050565b600080604083850312156123e157600080fd5b82356123ec816123a9565b946020939093013593505050565b60008060006060848603121561240f57600080fd5b833561241a816123a9565b95602085013595506040909401359392505050565b60006020828403121561244157600080fd5b5035919050565b803561ffff811681146123c957600080fd5b60008083601f84011261246c57600080fd5b50813567ffffffffffffffff81111561248457600080fd5b60208301915083602082850101111561249c57600080fd5b9250929050565b6000606082840312156124b557600080fd5b50919050565b60008060008060008060008060008060006101608c8e0312156124dd57600080fd5b6124e78c356123a9565b8b359a506124f760208d01612448565b995067ffffffffffffffff8060408e0135111561251357600080fd5b6125238e60408f01358f0161245a565b909a50985060608d0135975060808d0135965061254360a08e01356123a9565b60a08d0135955061255660c08e016123be565b94508060e08e0135111561256957600080fd5b5061257a8d60e08e01358e0161245a565b909350915061258d8d6101008e016124a3565b90509295989b509295989b9093969950565b600060e082840312156124b557600080fd5b60008060008060008587036101008112156125cb57600080fd5b86356125d6816123a9565b9550602087013567ffffffffffffffff8111156125f257600080fd5b6125fe89828a0161259f565b95505060407fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08201121561263157600080fd5b506040860192506080860135612646816123a9565b91506126558760a088016124a3565b90509295509295909350565b60006020828403121561267357600080fd5b813561267e816123a9565b9392505050565b6000806000806000806000610120888a0312156126a157600080fd5b87356126ac816123a9565b96506126ba60208901612448565b955060408801359450606088013593506080880135925060a088013567ffffffffffffffff8111156126eb57600080fd5b6126f78a828b016124a3565b9250506127078960c08a016124a3565b905092959891949750929550565b801515811461187657600080fd5b600080600080600080600080610120898b03121561274057600080fd5b883561274b816123a9565b975061275960208a01612448565b96506040890135955060608901359450608089013561277781612715565b935060a089013567ffffffffffffffff81111561279357600080fd5b61279f8b828c0161245a565b90945092506127b390508a60c08b016124a3565b90509295985092959890939650565b60008060008060008060008060006101208a8c0312156127e157600080fd5b89356127ec816123a9565b98506127fa60208b01612448565b975060408a013567ffffffffffffffff8082111561281757600080fd5b6128238d838e0161245a565b909950975060608c0135965060808c0135915061283f82612715565b90945060a08b0135908082111561285557600080fd5b506128628c828d0161245a565b909450925061287690508b60c08c016124a3565b90509295985092959850929598565b60008060006060848603121561289a57600080fd5b83356128a5816123a9565b925060208401356128b5816123a9565b929592945050506040919091013590565b60008060008060c085870312156128dc57600080fd5b84356128e7816123a9565b9350602085013567ffffffffffffffff81111561290357600080fd5b61290f8782880161259f565b935050604085013561292081612715565b915061292f86606087016124a3565b905092959194509250565b818352818160208501375060006020828401015260006020601f19601f840116840101905092915050565b60006001600160a01b03808c16835261ffff8b16602084015260e0604084015261299360e084018a8c61293a565b886060850152818816608085015281871660a085015283810360c08501526129bc81868861293a565b9d9c50505050505050505050505050565b6000602082840312156129df57600080fd5b813563ffffffff8116811461267e57600080fd5b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112612a2857600080fd5b83018035915067ffffffffffffffff821115612a4357600080fd5b60200191503681900382131561249c57600080fd5b60005b83811015612a73578181015183820152602001612a5b565b50506000910152565b60008151808452612a94816020860160208601612a58565b601f01601f19169290920160200192915050565b63ffffffff81511682526020810151602083015260408101516040830152606081015160608301526000608082015160e06080850152612aeb60e0850182612a7c565b905060a083015184820360a0860152612b048282612a7c565b91505060c083015184820360c0860152612b1e8282612a7c565b95945050505050565b608081526000612b3a6080830186612aa8565b905083356020830152602084013560408301526001600160a01b0383166060830152949350505050565b600060408284031215612b7657600080fd5b6040516040810181811067ffffffffffffffff82111715612bc0577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052825181526020928301519281019290925250919050565b60008082840360c0811215612bee57600080fd5b6080811215612bfc57600080fd5b506040516060810167ffffffffffffffff8282108183111715612c48577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b8160405285518352602086015191508082168214612c6557600080fd5b506020820152612c788560408601612b64565b60408201529150612c8c8460808501612b64565b90509250929050565b600060208284031215612ca757600080fd5b815161267e816123a9565b600060208284031215612cc457600080fd5b5051919050565b60008135612cd8816123a9565b6001600160a01b039081168452602083013590612cf4826123a9565b1660208401526040820135368390037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1018112612d3057600080fd5b820160208101903567ffffffffffffffff811115612d4d57600080fd5b803603821315612d5c57600080fd5b60606040860152612b1e60608601828461293a565b6001600160a01b038716815261ffff8616602082015284604082015283606082015282608082015260c060a08201526000612daf60c0830184612ccb565b98975050505050505050565b61ffff87168152856020820152846040820152831515606082015260a060808201526000612daf60a08301848661293a565b60008060408385031215612e0057600080fd5b505080516020909101519092909150565b6001600160a01b038616815261ffff8516602082015283604082015282606082015260a06080820152600061230060a0830184612ccb565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b81810381811115612e8b57612e8b612e49565b92915050565b61ffff8816815260a060208201526000612eaf60a08301888a61293a565b86604084015285151560608401528281036080840152612ed081858761293a565b9a9950505050505050505050565b604081526000612ef16040830185612aa8565b905082151560208301529392505050565b600060408284031215612f1457600080fd5b61267e8383612b64565b80820180821115612e8b57612e8b612e49565b8082028115828204841417612e8b57612e8b612e49565b600082612f7e577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b500490565b600060208284031215612f9557600080fd5b81357fffff0000000000000000000000000000000000000000000000000000000000008116811461267e57600080fd5b600060208284031215612fd757600080fd5b815161267e81612715565b60008251612ff4818460208701612a58565b9190910192915050565b60208152600061267e6020830184612a7c56fea26469706673582212204004b1b28a37016a635ed8741c8b5ec3c78d029e1953c4122e4eef539fc5091c64736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000000000000000000000000000000000000000012c
-----Decoded View---------------
Arg [0] : _defaultBps (uint256): 2
Arg [1] : _callerBpsCap (uint256): 300
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000002
Arg [1] : 000000000000000000000000000000000000000000000000000000000000012c
Loading...
Loading
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.