Overview
ETH Balance
0.000060758199936 ETH
ETH Value
$0.24 (@ $3,997.12/ETH)More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 147 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Transfer Ownersh... | 7537966 | 143 days ago | IN | 0 ETH | 0.0000458 | ||||
Set Default Exec... | 3007747 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007747 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007747 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007747 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007747 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007747 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007747 | 309 days ago | IN | 0 ETH | 0.00029476 | ||||
Set Default Uln ... | 3007747 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007747 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007746 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007746 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007746 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007746 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007746 | 309 days ago | IN | 0 ETH | 0.00037954 | ||||
Set Address Size | 3007746 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007746 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007746 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007746 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007746 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007746 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007746 | 309 days ago | IN | 0 ETH | 0.00025977 | ||||
Set Default Exec... | 3007745 | 309 days ago | IN | 0 ETH | 0.00029537 | ||||
Set Default Uln ... | 3007745 | 309 days ago | IN | 0 ETH | 0.00038014 | ||||
Set Address Size | 3007745 | 309 days ago | IN | 0 ETH | 0.00025977 |
Latest 21 internal transactions
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
4046981 | 271 days ago | 0.00363817 ETH | ||||
3127146 | 305 days ago | 0.00033437 ETH | ||||
3127142 | 305 days ago | 0.00002011 ETH | ||||
3127139 | 305 days ago | 0.00009165 ETH | ||||
3127136 | 305 days ago | 0.0000421 ETH | ||||
3127134 | 305 days ago | 0.00001872 ETH | ||||
3127130 | 305 days ago | 0.0008967 ETH | ||||
3127127 | 305 days ago | 0.00013711 ETH | ||||
3127125 | 305 days ago | 0.00014735 ETH | ||||
3127123 | 305 days ago | 0.00001979 ETH | ||||
3127122 | 305 days ago | 0.00000706 ETH | ||||
3127120 | 305 days ago | 0.00017938 ETH | ||||
3127118 | 305 days ago | 0.0000194 ETH | ||||
3127116 | 305 days ago | 0.00002272 ETH | ||||
3127112 | 305 days ago | 0.0001915 ETH | ||||
3127111 | 305 days ago | 0.00025612 ETH | ||||
3127109 | 305 days ago | 0.00013733 ETH | ||||
3127107 | 305 days ago | 0.00023956 ETH | ||||
3127104 | 305 days ago | 0.00014011 ETH | ||||
3127103 | 305 days ago | 0.0002527 ETH | ||||
3091590 | 306 days ago | 0.00054505 ETH |
Loading...
Loading
Contract Name:
SendUln301
Compiler Version
v0.8.22+commit.4fc1097e
Optimization Enabled:
Yes with 20000 runs
Other Settings:
paris EvmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Packet } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ISendLib.sol"; import { ExecutorConfig, WorkerOptions } from "../../SendLibBase.sol"; import { SendLibBaseE1 } from "./SendLibBaseE1.sol"; import { SendUlnBase } from "../SendUlnBase.sol"; import { UlnConfig } from "../UlnBase.sol"; /// @dev ULN301 will be deployed on EndpointV1 and is for backward compatibility with ULN302 on EndpointV2. 301 can talk to both 301 and 302 /// @dev This is a gluing contract. It simply parses the requests and forward to the super.impl() accordingly. /// @dev In this case, it combines the logic of SendUlnBase and SendLibBaseE1 contract SendUln301 is SendUlnBase, SendLibBaseE1 { uint256 internal constant CONFIG_TYPE_EXECUTOR = 1; uint256 internal constant CONFIG_TYPE_ULN = 2; error LZ_ULN_InvalidConfigType(uint256 configType); constructor( address _endpoint, uint256 _treasuryGasLimit, uint256 _treasuryGasForFeeCap, address _nonceContract, uint32 _localEid, address _treasuryFeeHandler ) SendLibBaseE1( _endpoint, _treasuryGasLimit, _treasuryGasForFeeCap, _nonceContract, _localEid, _treasuryFeeHandler ) {} // ============================ OnlyEndpoint =================================== function setConfig( uint16 _eid, address _oapp, uint256 _configType, bytes calldata _config ) external override onlyEndpoint { _assertSupportedEid(_eid); if (_configType == CONFIG_TYPE_EXECUTOR) { _setExecutorConfig(_eid, _oapp, abi.decode(_config, (ExecutorConfig))); } else if (_configType == CONFIG_TYPE_ULN) { _setUlnConfig(_eid, _oapp, abi.decode(_config, (UlnConfig))); } else { revert LZ_ULN_InvalidConfigType(_configType); } } // ============================ View =================================== function getConfig(uint16 _eid, address _oapp, uint256 _configType) external view override returns (bytes memory) { if (_configType == CONFIG_TYPE_EXECUTOR) { return abi.encode(getExecutorConfig(_oapp, _eid)); } else if (_configType == CONFIG_TYPE_ULN) { return abi.encode(getUlnConfig(_oapp, _eid)); } else { revert LZ_ULN_InvalidConfigType(_configType); } } function version() external pure override returns (uint64 major, uint8 minor, uint8 endpointVersion) { return (3, 0, 1); } function isSupportedEid(uint32 _eid) external view returns (bool) { return _isSupportedEid(_eid); } // ============================ Internal =================================== function _quoteVerifier( address _sender, uint32 _dstEid, WorkerOptions[] memory _options ) internal view override returns (uint256) { return _quoteDVNs(_sender, _dstEid, _options); } function _payVerifier( Packet memory _packet, WorkerOptions[] memory _options ) internal virtual override returns (uint256 otherWorkerFees, bytes memory encodedPacket) { (otherWorkerFees, encodedPacket) = _payDVNs(fees, _packet, _options); } function _splitOptions( bytes calldata _options ) internal pure override returns (bytes memory, WorkerOptions[] memory) { return _splitUlnOptions(_options); } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { IMessageLibManager } from "./IMessageLibManager.sol"; import { IMessagingComposer } from "./IMessagingComposer.sol"; import { IMessagingChannel } from "./IMessagingChannel.sol"; import { IMessagingContext } from "./IMessagingContext.sol"; struct MessagingParams { uint32 dstEid; bytes32 receiver; bytes message; bytes options; bool payInLzToken; } struct MessagingReceipt { bytes32 guid; uint64 nonce; MessagingFee fee; } struct MessagingFee { uint256 nativeFee; uint256 lzTokenFee; } struct Origin { uint32 srcEid; bytes32 sender; uint64 nonce; } interface ILayerZeroEndpointV2 is IMessageLibManager, IMessagingComposer, IMessagingChannel, IMessagingContext { event PacketSent(bytes encodedPayload, bytes options, address sendLibrary); event PacketVerified(Origin origin, address receiver, bytes32 payloadHash); event PacketDelivered(Origin origin, address receiver); event LzReceiveAlert( address indexed receiver, address indexed executor, Origin origin, bytes32 guid, uint256 gas, uint256 value, bytes message, bytes extraData, bytes reason ); event LzTokenSet(address token); event DelegateSet(address sender, address delegate); function quote(MessagingParams calldata _params, address _sender) external view returns (MessagingFee memory); function send( MessagingParams calldata _params, address _refundAddress ) external payable returns (MessagingReceipt memory); function verify(Origin calldata _origin, address _receiver, bytes32 _payloadHash) external; function verifiable(Origin calldata _origin, address _receiver) external view returns (bool); function initializable(Origin calldata _origin, address _receiver) external view returns (bool); function lzReceive( Origin calldata _origin, address _receiver, bytes32 _guid, bytes calldata _message, bytes calldata _extraData ) external payable; // oapp can burn messages partially by calling this function with its own business logic if messages are verified in order function clear(address _oapp, Origin calldata _origin, bytes32 _guid, bytes calldata _message) external; function setLzToken(address _lzToken) external; function lzToken() external view returns (address); function nativeToken() external view returns (address); function setDelegate(address _delegate) external; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { IERC165 } from "@openzeppelin/contracts/utils/introspection/IERC165.sol"; import { SetConfigParam } from "./IMessageLibManager.sol"; enum MessageLibType { Send, Receive, SendAndReceive } interface IMessageLib is IERC165 { function setConfig(address _oapp, SetConfigParam[] calldata _config) external; function getConfig(uint32 _eid, address _oapp, uint32 _configType) external view returns (bytes memory config); function isSupportedEid(uint32 _eid) external view returns (bool); // message libs of same major version are compatible function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion); function messageLibType() external view returns (MessageLibType); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; struct SetConfigParam { uint32 eid; uint32 configType; bytes config; } interface IMessageLibManager { struct Timeout { address lib; uint256 expiry; } event LibraryRegistered(address newLib); event DefaultSendLibrarySet(uint32 eid, address newLib); event DefaultReceiveLibrarySet(uint32 eid, address newLib); event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry); event SendLibrarySet(address sender, uint32 eid, address newLib); event ReceiveLibrarySet(address receiver, uint32 eid, address newLib); event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout); function registerLibrary(address _lib) external; function isRegisteredLibrary(address _lib) external view returns (bool); function getRegisteredLibraries() external view returns (address[] memory); function setDefaultSendLibrary(uint32 _eid, address _newLib) external; function defaultSendLibrary(uint32 _eid) external view returns (address); function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _timeout) external; function defaultReceiveLibrary(uint32 _eid) external view returns (address); function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external; function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry); function isSupportedEid(uint32 _eid) external view returns (bool); function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool); /// ------------------- OApp interfaces ------------------- function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external; function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib); function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool); function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external; function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault); function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _gracePeriod) external; function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry); function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external; function getConfig( address _oapp, address _lib, uint32 _eid, uint32 _configType ) external view returns (bytes memory config); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingChannel { event InboundNonceSkipped(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce); event PacketNilified(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); event PacketBurnt(uint32 srcEid, bytes32 sender, address receiver, uint64 nonce, bytes32 payloadHash); function eid() external view returns (uint32); // this is an emergency function if a message cannot be verified for some reasons // required to provide _nextNonce to avoid race condition function skip(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce) external; function nilify(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function burn(address _oapp, uint32 _srcEid, bytes32 _sender, uint64 _nonce, bytes32 _payloadHash) external; function nextGuid(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (bytes32); function inboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); function outboundNonce(address _sender, uint32 _dstEid, bytes32 _receiver) external view returns (uint64); function inboundPayloadHash( address _receiver, uint32 _srcEid, bytes32 _sender, uint64 _nonce ) external view returns (bytes32); function lazyInboundNonce(address _receiver, uint32 _srcEid, bytes32 _sender) external view returns (uint64); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingComposer { event ComposeSent(address from, address to, bytes32 guid, uint16 index, bytes message); event ComposeDelivered(address from, address to, bytes32 guid, uint16 index); event LzComposeAlert( address indexed from, address indexed to, address indexed executor, bytes32 guid, uint16 index, uint256 gas, uint256 value, bytes message, bytes extraData, bytes reason ); function composeQueue( address _from, address _to, bytes32 _guid, uint16 _index ) external view returns (bytes32 messageHash); function sendCompose(address _to, bytes32 _guid, uint16 _index, bytes calldata _message) external; function lzCompose( address _from, address _to, bytes32 _guid, uint16 _index, bytes calldata _message, bytes calldata _extraData ) external payable; }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface IMessagingContext { function isSendingMessage() external view returns (bool); function getSendContext() external view returns (uint32 dstEid, address sender); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { MessagingFee } from "./ILayerZeroEndpointV2.sol"; import { IMessageLib } from "./IMessageLib.sol"; struct Packet { uint64 nonce; uint32 srcEid; address sender; uint32 dstEid; bytes32 receiver; bytes32 guid; bytes message; } interface ISendLib is IMessageLib { function send( Packet calldata _packet, bytes calldata _options, bool _payInLzToken ) external returns (MessagingFee memory, bytes memory encodedPacket); function quote( Packet calldata _packet, bytes calldata _options, bool _payInLzToken ) external view returns (MessagingFee memory); function setTreasury(address _treasury) external; function withdrawFee(address _to, uint256 _amount) external; function withdrawLzTokenFee(address _lzToken, address _to, uint256 _amount) external; }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; library AddressCast { error AddressCast_InvalidSizeForAddress(); error AddressCast_InvalidAddress(); function toBytes32(bytes calldata _addressBytes) internal pure returns (bytes32 result) { if (_addressBytes.length > 32) revert AddressCast_InvalidAddress(); result = bytes32(_addressBytes); unchecked { uint256 offset = 32 - _addressBytes.length; result = result >> (offset * 8); } } function toBytes32(address _address) internal pure returns (bytes32 result) { result = bytes32(uint256(uint160(_address))); } function toBytes(bytes32 _addressBytes32, uint256 _size) internal pure returns (bytes memory result) { if (_size == 0 || _size > 32) revert AddressCast_InvalidSizeForAddress(); result = new bytes(_size); unchecked { uint256 offset = 256 - _size * 8; assembly { mstore(add(result, 32), shl(offset, _addressBytes32)) } } } function toAddress(bytes32 _addressBytes32) internal pure returns (address result) { result = address(uint160(uint256(_addressBytes32))); } function toAddress(bytes calldata _addressBytes) internal pure returns (address result) { if (_addressBytes.length != 20) revert AddressCast_InvalidAddress(); result = address(bytes20(_addressBytes)); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; library CalldataBytesLib { function toU8(bytes calldata _bytes, uint256 _start) internal pure returns (uint8) { return uint8(_bytes[_start]); } function toU16(bytes calldata _bytes, uint256 _start) internal pure returns (uint16) { unchecked { uint256 end = _start + 2; return uint16(bytes2(_bytes[_start:end])); } } function toU32(bytes calldata _bytes, uint256 _start) internal pure returns (uint32) { unchecked { uint256 end = _start + 4; return uint32(bytes4(_bytes[_start:end])); } } function toU64(bytes calldata _bytes, uint256 _start) internal pure returns (uint64) { unchecked { uint256 end = _start + 8; return uint64(bytes8(_bytes[_start:end])); } } function toU128(bytes calldata _bytes, uint256 _start) internal pure returns (uint128) { unchecked { uint256 end = _start + 16; return uint128(bytes16(_bytes[_start:end])); } } function toU256(bytes calldata _bytes, uint256 _start) internal pure returns (uint256) { unchecked { uint256 end = _start + 32; return uint256(bytes32(_bytes[_start:end])); } } function toAddr(bytes calldata _bytes, uint256 _start) internal pure returns (address) { unchecked { uint256 end = _start + 20; return address(bytes20(_bytes[_start:end])); } } function toB32(bytes calldata _bytes, uint256 _start) internal pure returns (bytes32) { unchecked { uint256 end = _start + 32; return bytes32(_bytes[_start:end]); } } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { AddressCast } from "./AddressCast.sol"; library GUID { using AddressCast for address; function generate( uint64 _nonce, uint32 _srcEid, address _sender, uint32 _dstEid, bytes32 _receiver ) internal pure returns (bytes32) { return keccak256(abi.encodePacked(_nonce, _srcEid, _sender.toBytes32(), _dstEid, _receiver)); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { SafeERC20 } from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; import { IERC20 } from "@openzeppelin/contracts/token/ERC20/IERC20.sol"; library Transfer { using SafeERC20 for IERC20; address internal constant ADDRESS_ZERO = address(0); error Transfer_NativeFailed(address _to, uint256 _value); error Transfer_ToAddressIsZero(); function native(address _to, uint256 _value) internal { if (_to == ADDRESS_ZERO) revert Transfer_ToAddressIsZero(); (bool success, ) = _to.call{ value: _value }(""); if (!success) revert Transfer_NativeFailed(_to, _value); } function token(address _token, address _to, uint256 _value) internal { if (_to == ADDRESS_ZERO) revert Transfer_ToAddressIsZero(); IERC20(_token).safeTransfer(_to, _value); } function nativeOrToken(address _token, address _to, uint256 _value) internal { if (_token == ADDRESS_ZERO) { native(_to, _value); } else { token(_token, _to, _value); } } }
// SPDX-License-Identifier: MIT // modified from https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/utils/structs/BitMaps.sol pragma solidity ^0.8.20; type BitMap256 is uint256; using BitMaps for BitMap256 global; library BitMaps { /** * @dev Returns whether the bit at `index` is set. */ function get(BitMap256 bitmap, uint8 index) internal pure returns (bool) { uint256 mask = 1 << index; return BitMap256.unwrap(bitmap) & mask != 0; } /** * @dev Sets the bit at `index`. */ function set(BitMap256 bitmap, uint8 index) internal pure returns (BitMap256) { uint256 mask = 1 << index; return BitMap256.wrap(BitMap256.unwrap(bitmap) | mask); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { CalldataBytesLib } from "../../libs/CalldataBytesLib.sol"; library ExecutorOptions { using CalldataBytesLib for bytes; uint8 internal constant WORKER_ID = 1; uint8 internal constant OPTION_TYPE_LZRECEIVE = 1; uint8 internal constant OPTION_TYPE_NATIVE_DROP = 2; uint8 internal constant OPTION_TYPE_LZCOMPOSE = 3; uint8 internal constant OPTION_TYPE_ORDERED_EXECUTION = 4; error Executor_InvalidLzReceiveOption(); error Executor_InvalidNativeDropOption(); error Executor_InvalidLzComposeOption(); /// @dev decode the next executor option from the options starting from the specified cursor /// @param _options [executor_id][executor_option][executor_id][executor_option]... /// executor_option = [option_size][option_type][option] /// option_size = len(option_type) + len(option) /// executor_id: uint8, option_size: uint16, option_type: uint8, option: bytes /// @param _cursor the cursor to start decoding from /// @return optionType the type of the option /// @return option the option of the executor /// @return cursor the cursor to start decoding the next executor option function nextExecutorOption( bytes calldata _options, uint256 _cursor ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) { unchecked { // skip worker id cursor = _cursor + 1; // read option size uint16 size = _options.toU16(cursor); cursor += 2; // read option type optionType = _options.toU8(cursor); // startCursor and endCursor are used to slice the option from _options uint256 startCursor = cursor + 1; // skip option type uint256 endCursor = cursor + size; option = _options[startCursor:endCursor]; cursor += size; } } function decodeLzReceiveOption(bytes calldata _option) internal pure returns (uint128 gas, uint128 value) { if (_option.length != 16 && _option.length != 32) revert Executor_InvalidLzReceiveOption(); gas = _option.toU128(0); value = _option.length == 32 ? _option.toU128(16) : 0; } function decodeNativeDropOption(bytes calldata _option) internal pure returns (uint128 amount, bytes32 receiver) { if (_option.length != 48) revert Executor_InvalidNativeDropOption(); amount = _option.toU128(0); receiver = _option.toB32(16); } function decodeLzComposeOption( bytes calldata _option ) internal pure returns (uint16 index, uint128 gas, uint128 value) { if (_option.length != 18 && _option.length != 34) revert Executor_InvalidLzComposeOption(); index = _option.toU16(0); gas = _option.toU128(2); value = _option.length == 34 ? _option.toU128(18) : 0; } function encodeLzReceiveOption(uint128 _gas, uint128 _value) internal pure returns (bytes memory) { return _value == 0 ? abi.encodePacked(_gas) : abi.encodePacked(_gas, _value); } function encodeNativeDropOption(uint128 _amount, bytes32 _receiver) internal pure returns (bytes memory) { return abi.encodePacked(_amount, _receiver); } function encodeLzComposeOption(uint16 _index, uint128 _gas, uint128 _value) internal pure returns (bytes memory) { return _value == 0 ? abi.encodePacked(_index, _gas) : abi.encodePacked(_index, _gas, _value); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Packet } from "../../interfaces/ISendLib.sol"; import { AddressCast } from "../../libs/AddressCast.sol"; library PacketV1Codec { using AddressCast for address; using AddressCast for bytes32; uint8 internal constant PACKET_VERSION = 1; // header (version + nonce + path) // version uint256 private constant PACKET_VERSION_OFFSET = 0; // nonce uint256 private constant NONCE_OFFSET = 1; // path uint256 private constant SRC_EID_OFFSET = 9; uint256 private constant SENDER_OFFSET = 13; uint256 private constant DST_EID_OFFSET = 45; uint256 private constant RECEIVER_OFFSET = 49; // payload (guid + message) uint256 private constant GUID_OFFSET = 81; // keccak256(nonce + path) uint256 private constant MESSAGE_OFFSET = 113; function encode(Packet memory _packet) internal pure returns (bytes memory encodedPacket) { encodedPacket = abi.encodePacked( PACKET_VERSION, _packet.nonce, _packet.srcEid, _packet.sender.toBytes32(), _packet.dstEid, _packet.receiver, _packet.guid, _packet.message ); } function encodePacketHeader(Packet memory _packet) internal pure returns (bytes memory) { return abi.encodePacked( PACKET_VERSION, _packet.nonce, _packet.srcEid, _packet.sender.toBytes32(), _packet.dstEid, _packet.receiver ); } function encodePayload(Packet memory _packet) internal pure returns (bytes memory) { return abi.encodePacked(_packet.guid, _packet.message); } function header(bytes calldata _packet) internal pure returns (bytes calldata) { return _packet[0:GUID_OFFSET]; } function version(bytes calldata _packet) internal pure returns (uint8) { return uint8(bytes1(_packet[PACKET_VERSION_OFFSET:NONCE_OFFSET])); } function nonce(bytes calldata _packet) internal pure returns (uint64) { return uint64(bytes8(_packet[NONCE_OFFSET:SRC_EID_OFFSET])); } function srcEid(bytes calldata _packet) internal pure returns (uint32) { return uint32(bytes4(_packet[SRC_EID_OFFSET:SENDER_OFFSET])); } function sender(bytes calldata _packet) internal pure returns (bytes32) { return bytes32(_packet[SENDER_OFFSET:DST_EID_OFFSET]); } function senderAddressB20(bytes calldata _packet) internal pure returns (address) { return sender(_packet).toAddress(); } function dstEid(bytes calldata _packet) internal pure returns (uint32) { return uint32(bytes4(_packet[DST_EID_OFFSET:RECEIVER_OFFSET])); } function receiver(bytes calldata _packet) internal pure returns (bytes32) { return bytes32(_packet[RECEIVER_OFFSET:GUID_OFFSET]); } function receiverB20(bytes calldata _packet) internal pure returns (address) { return receiver(_packet).toAddress(); } function guid(bytes calldata _packet) internal pure returns (bytes32) { return bytes32(_packet[GUID_OFFSET:MESSAGE_OFFSET]); } function message(bytes calldata _packet) internal pure returns (bytes calldata) { return bytes(_packet[MESSAGE_OFFSET:]); } function payload(bytes calldata _packet) internal pure returns (bytes calldata) { return bytes(_packet[GUID_OFFSET:]); } function payloadHash(bytes calldata _packet) internal pure returns (bytes32) { return keccak256(payload(_packet)); } }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.7.0; import "./ILayerZeroUserApplicationConfig.sol"; interface ILayerZeroMessagingLibrary { // send(), messages will be inflight. function send( address _userApplication, uint64 _lastNonce, uint16 _chainId, bytes calldata _destination, bytes calldata _payload, address payable refundAddress, address _zroPaymentAddress, bytes calldata _adapterParams ) external payable; // estimate native fee at the send side function estimateFees( uint16 _chainId, address _userApplication, bytes calldata _payload, bool _payInZRO, bytes calldata _adapterParam ) external view returns (uint nativeFee, uint zroFee); //--------------------------------------------------------------------------- // setConfig / getConfig are User Application (UA) functions to specify Oracle, Relayer, blockConfirmations, libraryVersion function setConfig(uint16 _chainId, address _userApplication, uint _configType, bytes calldata _config) external; function getConfig( uint16 _chainId, address _userApplication, uint _configType ) external view returns (bytes memory); }
// SPDX-License-Identifier: BUSL-1.1 pragma solidity >=0.5.0; interface ILayerZeroUserApplicationConfig { // @notice set the configuration of the LayerZero messaging library of the specified version // @param _version - messaging library version // @param _chainId - the chainId for the pending config change // @param _configType - type of configuration. every messaging library has its own convention. // @param _config - configuration in the bytes. can encode arbitrary content. function setConfig(uint16 _version, uint16 _chainId, uint _configType, bytes calldata _config) external; // @notice set the send() LayerZero messaging library version to _version // @param _version - new messaging library version function setSendVersion(uint16 _version) external; // @notice set the lzReceive() LayerZero messaging library version to _version // @param _version - new messaging library version function setReceiveVersion(uint16 _version) external; // @notice Only when the UA needs to resume the message flow in blocking mode and clear the stored payload // @param _srcChainId - the chainId of the source chain // @param _srcAddress - the contract address of the source contract at the source chain function forceResumeReceive(uint16 _srcChainId, bytes calldata _srcAddress) external; }
// 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) (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 // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SafeCast.sol) // This file was procedurally generated from scripts/generate/templates/SafeCast.js. pragma solidity ^0.8.0; /** * @dev Wrappers over Solidity's uintXX/intXX casting operators with added overflow * checks. * * Downcasting from uint256/int256 in Solidity does not revert on overflow. This can * easily result in undesired exploitation or bugs, since developers usually * assume that overflows raise errors. `SafeCast` restores this intuition by * reverting the transaction when such an operation overflows. * * Using this library instead of the unchecked operations eliminates an entire * class of bugs, so it's recommended to use it always. * * Can be combined with {SafeMath} and {SignedSafeMath} to extend it to smaller types, by performing * all math on `uint256` and `int256` and then downcasting. */ library SafeCast { /** * @dev Returns the downcasted uint248 from uint256, reverting on * overflow (when the input is greater than largest uint248). * * Counterpart to Solidity's `uint248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toUint248(uint256 value) internal pure returns (uint248) { require(value <= type(uint248).max, "SafeCast: value doesn't fit in 248 bits"); return uint248(value); } /** * @dev Returns the downcasted uint240 from uint256, reverting on * overflow (when the input is greater than largest uint240). * * Counterpart to Solidity's `uint240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toUint240(uint256 value) internal pure returns (uint240) { require(value <= type(uint240).max, "SafeCast: value doesn't fit in 240 bits"); return uint240(value); } /** * @dev Returns the downcasted uint232 from uint256, reverting on * overflow (when the input is greater than largest uint232). * * Counterpart to Solidity's `uint232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toUint232(uint256 value) internal pure returns (uint232) { require(value <= type(uint232).max, "SafeCast: value doesn't fit in 232 bits"); return uint232(value); } /** * @dev Returns the downcasted uint224 from uint256, reverting on * overflow (when the input is greater than largest uint224). * * Counterpart to Solidity's `uint224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.2._ */ function toUint224(uint256 value) internal pure returns (uint224) { require(value <= type(uint224).max, "SafeCast: value doesn't fit in 224 bits"); return uint224(value); } /** * @dev Returns the downcasted uint216 from uint256, reverting on * overflow (when the input is greater than largest uint216). * * Counterpart to Solidity's `uint216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toUint216(uint256 value) internal pure returns (uint216) { require(value <= type(uint216).max, "SafeCast: value doesn't fit in 216 bits"); return uint216(value); } /** * @dev Returns the downcasted uint208 from uint256, reverting on * overflow (when the input is greater than largest uint208). * * Counterpart to Solidity's `uint208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toUint208(uint256 value) internal pure returns (uint208) { require(value <= type(uint208).max, "SafeCast: value doesn't fit in 208 bits"); return uint208(value); } /** * @dev Returns the downcasted uint200 from uint256, reverting on * overflow (when the input is greater than largest uint200). * * Counterpart to Solidity's `uint200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toUint200(uint256 value) internal pure returns (uint200) { require(value <= type(uint200).max, "SafeCast: value doesn't fit in 200 bits"); return uint200(value); } /** * @dev Returns the downcasted uint192 from uint256, reverting on * overflow (when the input is greater than largest uint192). * * Counterpart to Solidity's `uint192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toUint192(uint256 value) internal pure returns (uint192) { require(value <= type(uint192).max, "SafeCast: value doesn't fit in 192 bits"); return uint192(value); } /** * @dev Returns the downcasted uint184 from uint256, reverting on * overflow (when the input is greater than largest uint184). * * Counterpart to Solidity's `uint184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toUint184(uint256 value) internal pure returns (uint184) { require(value <= type(uint184).max, "SafeCast: value doesn't fit in 184 bits"); return uint184(value); } /** * @dev Returns the downcasted uint176 from uint256, reverting on * overflow (when the input is greater than largest uint176). * * Counterpart to Solidity's `uint176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toUint176(uint256 value) internal pure returns (uint176) { require(value <= type(uint176).max, "SafeCast: value doesn't fit in 176 bits"); return uint176(value); } /** * @dev Returns the downcasted uint168 from uint256, reverting on * overflow (when the input is greater than largest uint168). * * Counterpart to Solidity's `uint168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toUint168(uint256 value) internal pure returns (uint168) { require(value <= type(uint168).max, "SafeCast: value doesn't fit in 168 bits"); return uint168(value); } /** * @dev Returns the downcasted uint160 from uint256, reverting on * overflow (when the input is greater than largest uint160). * * Counterpart to Solidity's `uint160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toUint160(uint256 value) internal pure returns (uint160) { require(value <= type(uint160).max, "SafeCast: value doesn't fit in 160 bits"); return uint160(value); } /** * @dev Returns the downcasted uint152 from uint256, reverting on * overflow (when the input is greater than largest uint152). * * Counterpart to Solidity's `uint152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toUint152(uint256 value) internal pure returns (uint152) { require(value <= type(uint152).max, "SafeCast: value doesn't fit in 152 bits"); return uint152(value); } /** * @dev Returns the downcasted uint144 from uint256, reverting on * overflow (when the input is greater than largest uint144). * * Counterpart to Solidity's `uint144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toUint144(uint256 value) internal pure returns (uint144) { require(value <= type(uint144).max, "SafeCast: value doesn't fit in 144 bits"); return uint144(value); } /** * @dev Returns the downcasted uint136 from uint256, reverting on * overflow (when the input is greater than largest uint136). * * Counterpart to Solidity's `uint136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toUint136(uint256 value) internal pure returns (uint136) { require(value <= type(uint136).max, "SafeCast: value doesn't fit in 136 bits"); return uint136(value); } /** * @dev Returns the downcasted uint128 from uint256, reverting on * overflow (when the input is greater than largest uint128). * * Counterpart to Solidity's `uint128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v2.5._ */ function toUint128(uint256 value) internal pure returns (uint128) { require(value <= type(uint128).max, "SafeCast: value doesn't fit in 128 bits"); return uint128(value); } /** * @dev Returns the downcasted uint120 from uint256, reverting on * overflow (when the input is greater than largest uint120). * * Counterpart to Solidity's `uint120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toUint120(uint256 value) internal pure returns (uint120) { require(value <= type(uint120).max, "SafeCast: value doesn't fit in 120 bits"); return uint120(value); } /** * @dev Returns the downcasted uint112 from uint256, reverting on * overflow (when the input is greater than largest uint112). * * Counterpart to Solidity's `uint112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toUint112(uint256 value) internal pure returns (uint112) { require(value <= type(uint112).max, "SafeCast: value doesn't fit in 112 bits"); return uint112(value); } /** * @dev Returns the downcasted uint104 from uint256, reverting on * overflow (when the input is greater than largest uint104). * * Counterpart to Solidity's `uint104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toUint104(uint256 value) internal pure returns (uint104) { require(value <= type(uint104).max, "SafeCast: value doesn't fit in 104 bits"); return uint104(value); } /** * @dev Returns the downcasted uint96 from uint256, reverting on * overflow (when the input is greater than largest uint96). * * Counterpart to Solidity's `uint96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.2._ */ function toUint96(uint256 value) internal pure returns (uint96) { require(value <= type(uint96).max, "SafeCast: value doesn't fit in 96 bits"); return uint96(value); } /** * @dev Returns the downcasted uint88 from uint256, reverting on * overflow (when the input is greater than largest uint88). * * Counterpart to Solidity's `uint88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toUint88(uint256 value) internal pure returns (uint88) { require(value <= type(uint88).max, "SafeCast: value doesn't fit in 88 bits"); return uint88(value); } /** * @dev Returns the downcasted uint80 from uint256, reverting on * overflow (when the input is greater than largest uint80). * * Counterpart to Solidity's `uint80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toUint80(uint256 value) internal pure returns (uint80) { require(value <= type(uint80).max, "SafeCast: value doesn't fit in 80 bits"); return uint80(value); } /** * @dev Returns the downcasted uint72 from uint256, reverting on * overflow (when the input is greater than largest uint72). * * Counterpart to Solidity's `uint72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toUint72(uint256 value) internal pure returns (uint72) { require(value <= type(uint72).max, "SafeCast: value doesn't fit in 72 bits"); return uint72(value); } /** * @dev Returns the downcasted uint64 from uint256, reverting on * overflow (when the input is greater than largest uint64). * * Counterpart to Solidity's `uint64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v2.5._ */ function toUint64(uint256 value) internal pure returns (uint64) { require(value <= type(uint64).max, "SafeCast: value doesn't fit in 64 bits"); return uint64(value); } /** * @dev Returns the downcasted uint56 from uint256, reverting on * overflow (when the input is greater than largest uint56). * * Counterpart to Solidity's `uint56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toUint56(uint256 value) internal pure returns (uint56) { require(value <= type(uint56).max, "SafeCast: value doesn't fit in 56 bits"); return uint56(value); } /** * @dev Returns the downcasted uint48 from uint256, reverting on * overflow (when the input is greater than largest uint48). * * Counterpart to Solidity's `uint48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toUint48(uint256 value) internal pure returns (uint48) { require(value <= type(uint48).max, "SafeCast: value doesn't fit in 48 bits"); return uint48(value); } /** * @dev Returns the downcasted uint40 from uint256, reverting on * overflow (when the input is greater than largest uint40). * * Counterpart to Solidity's `uint40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toUint40(uint256 value) internal pure returns (uint40) { require(value <= type(uint40).max, "SafeCast: value doesn't fit in 40 bits"); return uint40(value); } /** * @dev Returns the downcasted uint32 from uint256, reverting on * overflow (when the input is greater than largest uint32). * * Counterpart to Solidity's `uint32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v2.5._ */ function toUint32(uint256 value) internal pure returns (uint32) { require(value <= type(uint32).max, "SafeCast: value doesn't fit in 32 bits"); return uint32(value); } /** * @dev Returns the downcasted uint24 from uint256, reverting on * overflow (when the input is greater than largest uint24). * * Counterpart to Solidity's `uint24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toUint24(uint256 value) internal pure returns (uint24) { require(value <= type(uint24).max, "SafeCast: value doesn't fit in 24 bits"); return uint24(value); } /** * @dev Returns the downcasted uint16 from uint256, reverting on * overflow (when the input is greater than largest uint16). * * Counterpart to Solidity's `uint16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v2.5._ */ function toUint16(uint256 value) internal pure returns (uint16) { require(value <= type(uint16).max, "SafeCast: value doesn't fit in 16 bits"); return uint16(value); } /** * @dev Returns the downcasted uint8 from uint256, reverting on * overflow (when the input is greater than largest uint8). * * Counterpart to Solidity's `uint8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v2.5._ */ function toUint8(uint256 value) internal pure returns (uint8) { require(value <= type(uint8).max, "SafeCast: value doesn't fit in 8 bits"); return uint8(value); } /** * @dev Converts a signed int256 into an unsigned uint256. * * Requirements: * * - input must be greater than or equal to 0. * * _Available since v3.0._ */ function toUint256(int256 value) internal pure returns (uint256) { require(value >= 0, "SafeCast: value must be positive"); return uint256(value); } /** * @dev Returns the downcasted int248 from int256, reverting on * overflow (when the input is less than smallest int248 or * greater than largest int248). * * Counterpart to Solidity's `int248` operator. * * Requirements: * * - input must fit into 248 bits * * _Available since v4.7._ */ function toInt248(int256 value) internal pure returns (int248 downcasted) { downcasted = int248(value); require(downcasted == value, "SafeCast: value doesn't fit in 248 bits"); } /** * @dev Returns the downcasted int240 from int256, reverting on * overflow (when the input is less than smallest int240 or * greater than largest int240). * * Counterpart to Solidity's `int240` operator. * * Requirements: * * - input must fit into 240 bits * * _Available since v4.7._ */ function toInt240(int256 value) internal pure returns (int240 downcasted) { downcasted = int240(value); require(downcasted == value, "SafeCast: value doesn't fit in 240 bits"); } /** * @dev Returns the downcasted int232 from int256, reverting on * overflow (when the input is less than smallest int232 or * greater than largest int232). * * Counterpart to Solidity's `int232` operator. * * Requirements: * * - input must fit into 232 bits * * _Available since v4.7._ */ function toInt232(int256 value) internal pure returns (int232 downcasted) { downcasted = int232(value); require(downcasted == value, "SafeCast: value doesn't fit in 232 bits"); } /** * @dev Returns the downcasted int224 from int256, reverting on * overflow (when the input is less than smallest int224 or * greater than largest int224). * * Counterpart to Solidity's `int224` operator. * * Requirements: * * - input must fit into 224 bits * * _Available since v4.7._ */ function toInt224(int256 value) internal pure returns (int224 downcasted) { downcasted = int224(value); require(downcasted == value, "SafeCast: value doesn't fit in 224 bits"); } /** * @dev Returns the downcasted int216 from int256, reverting on * overflow (when the input is less than smallest int216 or * greater than largest int216). * * Counterpart to Solidity's `int216` operator. * * Requirements: * * - input must fit into 216 bits * * _Available since v4.7._ */ function toInt216(int256 value) internal pure returns (int216 downcasted) { downcasted = int216(value); require(downcasted == value, "SafeCast: value doesn't fit in 216 bits"); } /** * @dev Returns the downcasted int208 from int256, reverting on * overflow (when the input is less than smallest int208 or * greater than largest int208). * * Counterpart to Solidity's `int208` operator. * * Requirements: * * - input must fit into 208 bits * * _Available since v4.7._ */ function toInt208(int256 value) internal pure returns (int208 downcasted) { downcasted = int208(value); require(downcasted == value, "SafeCast: value doesn't fit in 208 bits"); } /** * @dev Returns the downcasted int200 from int256, reverting on * overflow (when the input is less than smallest int200 or * greater than largest int200). * * Counterpart to Solidity's `int200` operator. * * Requirements: * * - input must fit into 200 bits * * _Available since v4.7._ */ function toInt200(int256 value) internal pure returns (int200 downcasted) { downcasted = int200(value); require(downcasted == value, "SafeCast: value doesn't fit in 200 bits"); } /** * @dev Returns the downcasted int192 from int256, reverting on * overflow (when the input is less than smallest int192 or * greater than largest int192). * * Counterpart to Solidity's `int192` operator. * * Requirements: * * - input must fit into 192 bits * * _Available since v4.7._ */ function toInt192(int256 value) internal pure returns (int192 downcasted) { downcasted = int192(value); require(downcasted == value, "SafeCast: value doesn't fit in 192 bits"); } /** * @dev Returns the downcasted int184 from int256, reverting on * overflow (when the input is less than smallest int184 or * greater than largest int184). * * Counterpart to Solidity's `int184` operator. * * Requirements: * * - input must fit into 184 bits * * _Available since v4.7._ */ function toInt184(int256 value) internal pure returns (int184 downcasted) { downcasted = int184(value); require(downcasted == value, "SafeCast: value doesn't fit in 184 bits"); } /** * @dev Returns the downcasted int176 from int256, reverting on * overflow (when the input is less than smallest int176 or * greater than largest int176). * * Counterpart to Solidity's `int176` operator. * * Requirements: * * - input must fit into 176 bits * * _Available since v4.7._ */ function toInt176(int256 value) internal pure returns (int176 downcasted) { downcasted = int176(value); require(downcasted == value, "SafeCast: value doesn't fit in 176 bits"); } /** * @dev Returns the downcasted int168 from int256, reverting on * overflow (when the input is less than smallest int168 or * greater than largest int168). * * Counterpart to Solidity's `int168` operator. * * Requirements: * * - input must fit into 168 bits * * _Available since v4.7._ */ function toInt168(int256 value) internal pure returns (int168 downcasted) { downcasted = int168(value); require(downcasted == value, "SafeCast: value doesn't fit in 168 bits"); } /** * @dev Returns the downcasted int160 from int256, reverting on * overflow (when the input is less than smallest int160 or * greater than largest int160). * * Counterpart to Solidity's `int160` operator. * * Requirements: * * - input must fit into 160 bits * * _Available since v4.7._ */ function toInt160(int256 value) internal pure returns (int160 downcasted) { downcasted = int160(value); require(downcasted == value, "SafeCast: value doesn't fit in 160 bits"); } /** * @dev Returns the downcasted int152 from int256, reverting on * overflow (when the input is less than smallest int152 or * greater than largest int152). * * Counterpart to Solidity's `int152` operator. * * Requirements: * * - input must fit into 152 bits * * _Available since v4.7._ */ function toInt152(int256 value) internal pure returns (int152 downcasted) { downcasted = int152(value); require(downcasted == value, "SafeCast: value doesn't fit in 152 bits"); } /** * @dev Returns the downcasted int144 from int256, reverting on * overflow (when the input is less than smallest int144 or * greater than largest int144). * * Counterpart to Solidity's `int144` operator. * * Requirements: * * - input must fit into 144 bits * * _Available since v4.7._ */ function toInt144(int256 value) internal pure returns (int144 downcasted) { downcasted = int144(value); require(downcasted == value, "SafeCast: value doesn't fit in 144 bits"); } /** * @dev Returns the downcasted int136 from int256, reverting on * overflow (when the input is less than smallest int136 or * greater than largest int136). * * Counterpart to Solidity's `int136` operator. * * Requirements: * * - input must fit into 136 bits * * _Available since v4.7._ */ function toInt136(int256 value) internal pure returns (int136 downcasted) { downcasted = int136(value); require(downcasted == value, "SafeCast: value doesn't fit in 136 bits"); } /** * @dev Returns the downcasted int128 from int256, reverting on * overflow (when the input is less than smallest int128 or * greater than largest int128). * * Counterpart to Solidity's `int128` operator. * * Requirements: * * - input must fit into 128 bits * * _Available since v3.1._ */ function toInt128(int256 value) internal pure returns (int128 downcasted) { downcasted = int128(value); require(downcasted == value, "SafeCast: value doesn't fit in 128 bits"); } /** * @dev Returns the downcasted int120 from int256, reverting on * overflow (when the input is less than smallest int120 or * greater than largest int120). * * Counterpart to Solidity's `int120` operator. * * Requirements: * * - input must fit into 120 bits * * _Available since v4.7._ */ function toInt120(int256 value) internal pure returns (int120 downcasted) { downcasted = int120(value); require(downcasted == value, "SafeCast: value doesn't fit in 120 bits"); } /** * @dev Returns the downcasted int112 from int256, reverting on * overflow (when the input is less than smallest int112 or * greater than largest int112). * * Counterpart to Solidity's `int112` operator. * * Requirements: * * - input must fit into 112 bits * * _Available since v4.7._ */ function toInt112(int256 value) internal pure returns (int112 downcasted) { downcasted = int112(value); require(downcasted == value, "SafeCast: value doesn't fit in 112 bits"); } /** * @dev Returns the downcasted int104 from int256, reverting on * overflow (when the input is less than smallest int104 or * greater than largest int104). * * Counterpart to Solidity's `int104` operator. * * Requirements: * * - input must fit into 104 bits * * _Available since v4.7._ */ function toInt104(int256 value) internal pure returns (int104 downcasted) { downcasted = int104(value); require(downcasted == value, "SafeCast: value doesn't fit in 104 bits"); } /** * @dev Returns the downcasted int96 from int256, reverting on * overflow (when the input is less than smallest int96 or * greater than largest int96). * * Counterpart to Solidity's `int96` operator. * * Requirements: * * - input must fit into 96 bits * * _Available since v4.7._ */ function toInt96(int256 value) internal pure returns (int96 downcasted) { downcasted = int96(value); require(downcasted == value, "SafeCast: value doesn't fit in 96 bits"); } /** * @dev Returns the downcasted int88 from int256, reverting on * overflow (when the input is less than smallest int88 or * greater than largest int88). * * Counterpart to Solidity's `int88` operator. * * Requirements: * * - input must fit into 88 bits * * _Available since v4.7._ */ function toInt88(int256 value) internal pure returns (int88 downcasted) { downcasted = int88(value); require(downcasted == value, "SafeCast: value doesn't fit in 88 bits"); } /** * @dev Returns the downcasted int80 from int256, reverting on * overflow (when the input is less than smallest int80 or * greater than largest int80). * * Counterpart to Solidity's `int80` operator. * * Requirements: * * - input must fit into 80 bits * * _Available since v4.7._ */ function toInt80(int256 value) internal pure returns (int80 downcasted) { downcasted = int80(value); require(downcasted == value, "SafeCast: value doesn't fit in 80 bits"); } /** * @dev Returns the downcasted int72 from int256, reverting on * overflow (when the input is less than smallest int72 or * greater than largest int72). * * Counterpart to Solidity's `int72` operator. * * Requirements: * * - input must fit into 72 bits * * _Available since v4.7._ */ function toInt72(int256 value) internal pure returns (int72 downcasted) { downcasted = int72(value); require(downcasted == value, "SafeCast: value doesn't fit in 72 bits"); } /** * @dev Returns the downcasted int64 from int256, reverting on * overflow (when the input is less than smallest int64 or * greater than largest int64). * * Counterpart to Solidity's `int64` operator. * * Requirements: * * - input must fit into 64 bits * * _Available since v3.1._ */ function toInt64(int256 value) internal pure returns (int64 downcasted) { downcasted = int64(value); require(downcasted == value, "SafeCast: value doesn't fit in 64 bits"); } /** * @dev Returns the downcasted int56 from int256, reverting on * overflow (when the input is less than smallest int56 or * greater than largest int56). * * Counterpart to Solidity's `int56` operator. * * Requirements: * * - input must fit into 56 bits * * _Available since v4.7._ */ function toInt56(int256 value) internal pure returns (int56 downcasted) { downcasted = int56(value); require(downcasted == value, "SafeCast: value doesn't fit in 56 bits"); } /** * @dev Returns the downcasted int48 from int256, reverting on * overflow (when the input is less than smallest int48 or * greater than largest int48). * * Counterpart to Solidity's `int48` operator. * * Requirements: * * - input must fit into 48 bits * * _Available since v4.7._ */ function toInt48(int256 value) internal pure returns (int48 downcasted) { downcasted = int48(value); require(downcasted == value, "SafeCast: value doesn't fit in 48 bits"); } /** * @dev Returns the downcasted int40 from int256, reverting on * overflow (when the input is less than smallest int40 or * greater than largest int40). * * Counterpart to Solidity's `int40` operator. * * Requirements: * * - input must fit into 40 bits * * _Available since v4.7._ */ function toInt40(int256 value) internal pure returns (int40 downcasted) { downcasted = int40(value); require(downcasted == value, "SafeCast: value doesn't fit in 40 bits"); } /** * @dev Returns the downcasted int32 from int256, reverting on * overflow (when the input is less than smallest int32 or * greater than largest int32). * * Counterpart to Solidity's `int32` operator. * * Requirements: * * - input must fit into 32 bits * * _Available since v3.1._ */ function toInt32(int256 value) internal pure returns (int32 downcasted) { downcasted = int32(value); require(downcasted == value, "SafeCast: value doesn't fit in 32 bits"); } /** * @dev Returns the downcasted int24 from int256, reverting on * overflow (when the input is less than smallest int24 or * greater than largest int24). * * Counterpart to Solidity's `int24` operator. * * Requirements: * * - input must fit into 24 bits * * _Available since v4.7._ */ function toInt24(int256 value) internal pure returns (int24 downcasted) { downcasted = int24(value); require(downcasted == value, "SafeCast: value doesn't fit in 24 bits"); } /** * @dev Returns the downcasted int16 from int256, reverting on * overflow (when the input is less than smallest int16 or * greater than largest int16). * * Counterpart to Solidity's `int16` operator. * * Requirements: * * - input must fit into 16 bits * * _Available since v3.1._ */ function toInt16(int256 value) internal pure returns (int16 downcasted) { downcasted = int16(value); require(downcasted == value, "SafeCast: value doesn't fit in 16 bits"); } /** * @dev Returns the downcasted int8 from int256, reverting on * overflow (when the input is less than smallest int8 or * greater than largest int8). * * Counterpart to Solidity's `int8` operator. * * Requirements: * * - input must fit into 8 bits * * _Available since v3.1._ */ function toInt8(int256 value) internal pure returns (int8 downcasted) { downcasted = int8(value); require(downcasted == value, "SafeCast: value doesn't fit in 8 bits"); } /** * @dev Converts an unsigned uint256 into a signed int256. * * Requirements: * * - input must be less than or equal to maxInt256. * * _Available since v3.0._ */ function toInt256(uint256 value) internal pure returns (int256) { // Note: Unsafe cast below is okay because `type(int256).max` is guaranteed to be positive require(value <= uint256(type(int256).max), "SafeCast: value doesn't fit in an int256"); return int256(value); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; /// @dev simply a container of endpoint address and local eid abstract contract MessageLibBase { address internal immutable endpoint; uint32 internal immutable localEid; error LZ_MessageLib_OnlyEndpoint(); modifier onlyEndpoint() { if (endpoint != msg.sender) revert LZ_MessageLib_OnlyEndpoint(); _; } constructor(address _endpoint, uint32 _localEid) { endpoint = _endpoint; localEid = _localEid; } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; import { Transfer } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/Transfer.sol"; import { ILayerZeroExecutor } from "./interfaces/ILayerZeroExecutor.sol"; import { ILayerZeroTreasury } from "./interfaces/ILayerZeroTreasury.sol"; import { SafeCall } from "./libs/SafeCall.sol"; import { MessageLibBase } from "./MessageLibBase.sol"; struct WorkerOptions { uint8 workerId; bytes options; } struct SetDefaultExecutorConfigParam { uint32 eid; ExecutorConfig config; } struct ExecutorConfig { uint32 maxMessageSize; address executor; } /// @dev base contract for both SendLibBaseE1 and SendLibBaseE2 abstract contract SendLibBase is MessageLibBase, Ownable { using SafeCall for address; address private constant DEFAULT_CONFIG = address(0); uint16 internal constant TREASURY_MAX_COPY = 32; uint256 internal immutable treasuryGasLimit; uint256 internal treasuryNativeFeeCap; // config address public treasury; mapping(address oapp => mapping(uint32 eid => ExecutorConfig)) public executorConfigs; // accumulated fees for workers and treasury mapping(address worker => uint256) public fees; event ExecutorFeePaid(address executor, uint256 fee); event TreasurySet(address treasury); event DefaultExecutorConfigsSet(SetDefaultExecutorConfigParam[] params); event ExecutorConfigSet(address oapp, uint32 eid, ExecutorConfig config); event TreasuryNativeFeeCapSet(uint256 newTreasuryNativeFeeCap); error LZ_MessageLib_InvalidMessageSize(uint256 actual, uint256 max); error LZ_MessageLib_InvalidAmount(uint256 requested, uint256 available); error LZ_MessageLib_TransferFailed(); error LZ_MessageLib_InvalidExecutor(); error LZ_MessageLib_ZeroMessageSize(); constructor( address _endpoint, uint32 _localEid, uint256 _treasuryGasLimit, uint256 _treasuryNativeFeeCap ) MessageLibBase(_endpoint, _localEid) { treasuryGasLimit = _treasuryGasLimit; treasuryNativeFeeCap = _treasuryNativeFeeCap; } function setDefaultExecutorConfigs(SetDefaultExecutorConfigParam[] calldata _params) external onlyOwner { for (uint256 i = 0; i < _params.length; ++i) { SetDefaultExecutorConfigParam calldata param = _params[i]; if (param.config.executor == address(0x0)) revert LZ_MessageLib_InvalidExecutor(); if (param.config.maxMessageSize == 0) revert LZ_MessageLib_ZeroMessageSize(); executorConfigs[DEFAULT_CONFIG][param.eid] = param.config; } emit DefaultExecutorConfigsSet(_params); } /// @dev the new value can not be greater than the old value, i.e. down only function setTreasuryNativeFeeCap(uint256 _newTreasuryNativeFeeCap) external onlyOwner { // assert the new value is no greater than the old value if (_newTreasuryNativeFeeCap > treasuryNativeFeeCap) revert LZ_MessageLib_InvalidAmount(_newTreasuryNativeFeeCap, treasuryNativeFeeCap); treasuryNativeFeeCap = _newTreasuryNativeFeeCap; emit TreasuryNativeFeeCapSet(_newTreasuryNativeFeeCap); } // ============================ View =================================== // @dev get the executor config and if not set, return the default config function getExecutorConfig(address _oapp, uint32 _remoteEid) public view returns (ExecutorConfig memory rtnConfig) { ExecutorConfig storage defaultConfig = executorConfigs[DEFAULT_CONFIG][_remoteEid]; ExecutorConfig storage customConfig = executorConfigs[_oapp][_remoteEid]; uint32 maxMessageSize = customConfig.maxMessageSize; rtnConfig.maxMessageSize = maxMessageSize != 0 ? maxMessageSize : defaultConfig.maxMessageSize; address executor = customConfig.executor; rtnConfig.executor = executor != address(0x0) ? executor : defaultConfig.executor; } // ======================= Internal ======================= function _assertMessageSize(uint256 _actual, uint256 _max) internal pure { if (_actual > _max) revert LZ_MessageLib_InvalidMessageSize(_actual, _max); } function _payExecutor( address _executor, uint32 _dstEid, address _sender, uint256 _msgSize, bytes memory _executorOptions ) internal returns (uint256 executorFee) { executorFee = ILayerZeroExecutor(_executor).assignJob(_dstEid, _sender, _msgSize, _executorOptions); if (executorFee > 0) { fees[_executor] += executorFee; } emit ExecutorFeePaid(_executor, executorFee); } function _payTreasury( address _sender, uint32 _dstEid, uint256 _totalNativeFee, bool _payInLzToken ) internal returns (uint256 treasuryNativeFee, uint256 lzTokenFee) { if (treasury != address(0x0)) { bytes memory callData = abi.encodeCall( ILayerZeroTreasury.payFee, (_sender, _dstEid, _totalNativeFee, _payInLzToken) ); (bool success, bytes memory result) = treasury.safeCall(treasuryGasLimit, 0, TREASURY_MAX_COPY, callData); (treasuryNativeFee, lzTokenFee) = _parseTreasuryResult(_totalNativeFee, _payInLzToken, success, result); // fee should be in lzTokenFee if payInLzToken, otherwise in native if (treasuryNativeFee > 0) { fees[treasury] += treasuryNativeFee; } } } /// @dev the abstract process for quote() is: /// 0/ split out the executor options and options of other workers /// 1/ quote workers /// 2/ quote executor /// 3/ quote treasury /// @return nativeFee, lzTokenFee function _quote( address _sender, uint32 _dstEid, uint256 _msgSize, bool _payInLzToken, bytes calldata _options ) internal view returns (uint256, uint256) { (bytes memory executorOptions, WorkerOptions[] memory validationOptions) = _splitOptions(_options); // quote the verifier used in the library. for ULN, it is a list of DVNs uint256 nativeFee = _quoteVerifier(_sender, _dstEid, validationOptions); // quote executor ExecutorConfig memory config = getExecutorConfig(_sender, _dstEid); // assert msg size _assertMessageSize(_msgSize, config.maxMessageSize); nativeFee += ILayerZeroExecutor(config.executor).getFee(_dstEid, _sender, _msgSize, executorOptions); // quote treasury (uint256 treasuryNativeFee, uint256 lzTokenFee) = _quoteTreasury(_sender, _dstEid, nativeFee, _payInLzToken); nativeFee += treasuryNativeFee; return (nativeFee, lzTokenFee); } /// @dev this interface should be DoS-free if the user is paying with native. properties /// 1/ treasury can return an overly high lzToken fee /// 2/ if treasury returns an overly high native fee, it will be capped by maxNativeFee, /// which can be reasoned with the configurations /// 3/ the owner can not configure the treasury in a way that force this function to revert function _quoteTreasury( address _sender, uint32 _dstEid, uint256 _totalNativeFee, bool _payInLzToken ) internal view returns (uint256 nativeFee, uint256 lzTokenFee) { // treasury must be set, and it has to be a contract if (treasury != address(0x0)) { bytes memory callData = abi.encodeCall( ILayerZeroTreasury.getFee, (_sender, _dstEid, _totalNativeFee, _payInLzToken) ); (bool success, bytes memory result) = treasury.safeStaticCall( treasuryGasLimit, TREASURY_MAX_COPY, callData ); return _parseTreasuryResult(_totalNativeFee, _payInLzToken, success, result); } } function _parseTreasuryResult( uint256 _totalNativeFee, bool _payInLzToken, bool _success, bytes memory _result ) internal view returns (uint256 nativeFee, uint256 lzTokenFee) { // failure, charges nothing if (!_success || _result.length < TREASURY_MAX_COPY) return (0, 0); // parse the result uint256 treasureFeeQuote = abi.decode(_result, (uint256)); if (_payInLzToken) { lzTokenFee = treasureFeeQuote; } else { // pay in native // we must prevent high-treasuryFee Dos attack // nativeFee = min(treasureFeeQuote, maxNativeFee) // opportunistically raise the maxNativeFee to be the same as _totalNativeFee // can't use the _totalNativeFee alone because the oapp can use custom workers to force the fee to 0. // maxNativeFee = max (_totalNativeFee, treasuryNativeFeeCap) uint256 maxNativeFee = _totalNativeFee > treasuryNativeFeeCap ? _totalNativeFee : treasuryNativeFeeCap; // min (treasureFeeQuote, nativeFeeCap) nativeFee = treasureFeeQuote > maxNativeFee ? maxNativeFee : treasureFeeQuote; } } /// @dev authenticated by msg.sender only function _debitFee(uint256 _amount) internal { uint256 fee = fees[msg.sender]; if (_amount > fee) revert LZ_MessageLib_InvalidAmount(_amount, fee); unchecked { fees[msg.sender] = fee - _amount; } } function _setTreasury(address _treasury) internal { treasury = _treasury; emit TreasurySet(_treasury); } function _setExecutorConfig(uint32 _remoteEid, address _oapp, ExecutorConfig memory _config) internal { executorConfigs[_oapp][_remoteEid] = _config; emit ExecutorConfigSet(_oapp, _remoteEid, _config); } // ======================= Virtual ======================= /// @dev these two functions will be overridden with specific logics of the library function function _quoteVerifier( address _oapp, uint32 _eid, WorkerOptions[] memory _options ) internal view virtual returns (uint256 nativeFee); /// @dev this function will split the options into executorOptions and validationOptions function _splitOptions( bytes calldata _options ) internal view virtual returns (bytes memory executorOptions, WorkerOptions[] memory validationOptions); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ILayerZeroExecutor { // @notice query price and assign jobs at the same time // @param _dstEid - the destination endpoint identifier // @param _sender - the source sending contract address. executors may apply price discrimination to senders // @param _calldataSize - dynamic data size of message + caller params // @param _options - optional parameters for extra service plugins, e.g. sending dust tokens at the destination chain function assignJob( uint32 _dstEid, address _sender, uint256 _calldataSize, bytes calldata _options ) external returns (uint256 price); // @notice query the executor price for relaying the payload and its proof to the destination chain // @param _dstEid - the destination endpoint identifier // @param _sender - the source sending contract address. executors may apply price discrimination to senders // @param _calldataSize - dynamic data size of message + caller params // @param _options - optional parameters for extra service plugins, e.g. sending dust tokens at the destination chain function getFee( uint32 _dstEid, address _sender, uint256 _calldataSize, bytes calldata _options ) external view returns (uint256 price); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ILayerZeroTreasury { function getFee( address _sender, uint32 _dstEid, uint256 _totalNativeFee, bool _payInLzToken ) external view returns (uint256 fee); function payFee( address _sender, uint32 _dstEid, uint256 _totalNativeFee, bool _payInLzToken ) external payable returns (uint256 fee); }
// SPDX-License-Identifier: MIT OR Apache-2.0 pragma solidity ^0.8.20; /// @dev copied from https://github.com/nomad-xyz/ExcessivelySafeCall/blob/main/src/ExcessivelySafeCall.sol. library SafeCall { /// @notice calls a contract with a specified gas limit and value and captures the return data /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _value The value in wei to send to the remote contract /// to memory. /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function safeCall( address _target, uint256 _gas, uint256 _value, uint16 _maxCopy, bytes memory _calldata ) internal returns (bool, bytes memory) { // check that target has code uint size; assembly { size := extcodesize(_target) } if (size == 0) { return (false, new bytes(0)); } // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := call( _gas, // gas _target, // recipient _value, // ether value add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 100 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } /// @notice Use when you _really_ really _really_ don't trust the called /// contract. This prevents the called contract from causing reversion of /// the caller in as many ways as we can. /// @dev The main difference between this and a solidity low-level call is /// that we limit the number of bytes that the callee can cause to be /// copied to caller memory. This prevents stupid things like malicious /// contracts returning 10,000,000 bytes causing a local OOG when copying /// to memory. /// @param _target The address to call /// @param _gas The amount of gas to forward to the remote contract /// @param _maxCopy The maximum number of bytes of returndata to copy /// to memory. /// @param _calldata The data to send to the remote contract /// @return success and returndata, as `.call()`. Returndata is capped to /// `_maxCopy` bytes. function safeStaticCall( address _target, uint256 _gas, uint16 _maxCopy, bytes memory _calldata ) internal view returns (bool, bytes memory) { // check that target has code uint size; assembly { size := extcodesize(_target) } if (size == 0) { return (false, new bytes(0)); } // set up for assembly call uint256 _toCopy; bool _success; bytes memory _returnData = new bytes(_maxCopy); // dispatch message to recipient // by assembly calling "handle" function // we call via assembly to avoid memcopying a very large returndata // returned by a malicious contract assembly { _success := staticcall( _gas, // gas _target, // recipient add(_calldata, 0x20), // inloc mload(_calldata), // inlen 0, // outloc 0 // outlen ) // limit our copy to 256 bytes _toCopy := returndatasize() if gt(_toCopy, _maxCopy) { _toCopy := _maxCopy } // Store the length of the copied bytes mstore(_returnData, _toCopy) // copy the bytes from returndata[0:_toCopy] returndatacopy(add(_returnData, 0x20), 0, _toCopy) } return (_success, _returnData); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Packet } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ISendLib.sol"; import { PacketV1Codec } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/PacketV1Codec.sol"; import { ILayerZeroDVN } from "./interfaces/ILayerZeroDVN.sol"; import { DVNOptions } from "./libs/DVNOptions.sol"; import { UlnOptions } from "./libs/UlnOptions.sol"; import { WorkerOptions } from "../SendLibBase.sol"; import { UlnConfig, UlnBase } from "./UlnBase.sol"; /// @dev includes the utility functions for checking ULN states and logics abstract contract SendUlnBase is UlnBase { event DVNFeePaid(address[] requiredDVNs, address[] optionalDVNs, uint256[] fees); function _splitUlnOptions(bytes calldata _options) internal pure returns (bytes memory, WorkerOptions[] memory) { (bytes memory executorOpts, bytes memory dvnOpts) = UlnOptions.decode(_options); if (dvnOpts.length == 0) { return (executorOpts, new WorkerOptions[](0)); } WorkerOptions[] memory workerOpts = new WorkerOptions[](1); workerOpts[0] = WorkerOptions(DVNOptions.WORKER_ID, dvnOpts); return (executorOpts, workerOpts); } /// ---------- pay and assign jobs ---------- function _payDVNs( mapping(address => uint256) storage _fees, Packet memory _packet, WorkerOptions[] memory _options ) internal returns (uint256 totalFee, bytes memory encodedPacket) { bytes memory packetHeader = PacketV1Codec.encodePacketHeader(_packet); bytes memory payload = PacketV1Codec.encodePayload(_packet); bytes32 payloadHash = keccak256(payload); uint32 dstEid = _packet.dstEid; address sender = _packet.sender; UlnConfig memory config = getUlnConfig(sender, dstEid); // if options is not empty, it must be dvn options bytes memory dvnOptions = _options.length == 0 ? bytes("") : _options[0].options; uint256[] memory dvnFees; (totalFee, dvnFees) = _assignJobs( _fees, config, ILayerZeroDVN.AssignJobParam(dstEid, packetHeader, payloadHash, config.confirmations, sender), dvnOptions ); encodedPacket = abi.encodePacked(packetHeader, payload); emit DVNFeePaid(config.requiredDVNs, config.optionalDVNs, dvnFees); } function _assignJobs( mapping(address => uint256) storage _fees, UlnConfig memory _ulnConfig, ILayerZeroDVN.AssignJobParam memory _param, bytes memory dvnOptions ) internal returns (uint256 totalFee, uint256[] memory dvnFees) { (bytes[] memory optionsArray, uint8[] memory dvnIds) = DVNOptions.groupDVNOptionsByIdx(dvnOptions); uint8 dvnsLength = _ulnConfig.requiredDVNCount + _ulnConfig.optionalDVNCount; dvnFees = new uint256[](dvnsLength); for (uint8 i = 0; i < dvnsLength; ++i) { address dvn = i < _ulnConfig.requiredDVNCount ? _ulnConfig.requiredDVNs[i] : _ulnConfig.optionalDVNs[i - _ulnConfig.requiredDVNCount]; bytes memory options = ""; for (uint256 j = 0; j < dvnIds.length; ++j) { if (dvnIds[j] == i) { options = optionsArray[j]; break; } } dvnFees[i] = ILayerZeroDVN(dvn).assignJob(_param, options); if (dvnFees[i] > 0) { _fees[dvn] += dvnFees[i]; totalFee += dvnFees[i]; } } } /// ---------- quote ---------- function _quoteDVNs( address _sender, uint32 _dstEid, WorkerOptions[] memory _options ) internal view returns (uint256 totalFee) { UlnConfig memory config = getUlnConfig(_sender, _dstEid); // if options is not empty, it must be dvn options bytes memory dvnOptions = _options.length == 0 ? bytes("") : _options[0].options; (bytes[] memory optionsArray, uint8[] memory dvnIndices) = DVNOptions.groupDVNOptionsByIdx(dvnOptions); totalFee = _getFees(config, _dstEid, _sender, optionsArray, dvnIndices); } function _getFees( UlnConfig memory _config, uint32 _dstEid, address _sender, bytes[] memory _optionsArray, uint8[] memory _dvnIds ) internal view returns (uint256 totalFee) { // here we merge 2 list of dvns into 1 to allocate the indexed dvn options to the right dvn uint8 dvnsLength = _config.requiredDVNCount + _config.optionalDVNCount; for (uint8 i = 0; i < dvnsLength; ++i) { address dvn = i < _config.requiredDVNCount ? _config.requiredDVNs[i] : _config.optionalDVNs[i - _config.requiredDVNCount]; bytes memory options = ""; // it is a double loop here. however, if the list is short, the cost is very acceptable. for (uint256 j = 0; j < _dvnIds.length; ++j) { if (_dvnIds[j] == i) { options = _optionsArray[j]; break; } } totalFee += ILayerZeroDVN(dvn).getFee(_dstEid, _config.confirmations, _sender, options); } } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; // the formal properties are documented in the setter functions struct UlnConfig { uint64 confirmations; // we store the length of required DVNs and optional DVNs instead of using DVN.length directly to save gas uint8 requiredDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default) uint8 optionalDVNCount; // 0 indicate DEFAULT, NIL_DVN_COUNT indicate NONE (to override the value of default) uint8 optionalDVNThreshold; // (0, optionalDVNCount] address[] requiredDVNs; // no duplicates. sorted an an ascending order. allowed overlap with optionalDVNs address[] optionalDVNs; // no duplicates. sorted an an ascending order. allowed overlap with requiredDVNs } struct SetDefaultUlnConfigParam { uint32 eid; UlnConfig config; } /// @dev includes the utility functions for checking ULN states and logics abstract contract UlnBase is Ownable { address private constant DEFAULT_CONFIG = address(0); // reserved values for uint8 internal constant DEFAULT = 0; uint8 internal constant NIL_DVN_COUNT = type(uint8).max; uint64 internal constant NIL_CONFIRMATIONS = type(uint64).max; // 127 to prevent total number of DVNs (127 * 2) exceeding uint8.max (255) // by limiting the total size, it would help constraint the design of DVNOptions uint8 private constant MAX_COUNT = (type(uint8).max - 1) / 2; mapping(address oapp => mapping(uint32 eid => UlnConfig)) internal ulnConfigs; error LZ_ULN_Unsorted(); error LZ_ULN_InvalidRequiredDVNCount(); error LZ_ULN_InvalidOptionalDVNCount(); error LZ_ULN_AtLeastOneDVN(); error LZ_ULN_InvalidOptionalDVNThreshold(); error LZ_ULN_InvalidConfirmations(); error LZ_ULN_UnsupportedEid(uint32 eid); event DefaultUlnConfigsSet(SetDefaultUlnConfigParam[] params); event UlnConfigSet(address oapp, uint32 eid, UlnConfig config); // ============================ OnlyOwner =================================== /// @dev about the DEFAULT ULN config /// 1) its values are all LITERAL (e.g. 0 is 0). whereas in the oapp ULN config, 0 (default value) points to the default ULN config /// this design enables the oapp to point to DEFAULT config without explicitly setting the config /// 2) its configuration is more restrictive than the oapp ULN config that /// a) it must not use NIL value, where NIL is used only by oapps to indicate the LITERAL 0 /// b) it must have at least one DVN function setDefaultUlnConfigs(SetDefaultUlnConfigParam[] calldata _params) external onlyOwner { for (uint256 i = 0; i < _params.length; ++i) { SetDefaultUlnConfigParam calldata param = _params[i]; // 2.a must not use NIL if (param.config.requiredDVNCount == NIL_DVN_COUNT) revert LZ_ULN_InvalidRequiredDVNCount(); if (param.config.optionalDVNCount == NIL_DVN_COUNT) revert LZ_ULN_InvalidOptionalDVNCount(); if (param.config.confirmations == NIL_CONFIRMATIONS) revert LZ_ULN_InvalidConfirmations(); // 2.b must have at least one dvn _assertAtLeastOneDVN(param.config); _setConfig(DEFAULT_CONFIG, param.eid, param.config); } emit DefaultUlnConfigsSet(_params); } // ============================ View =================================== // @dev assuming most oapps use default, we get default as memory and custom as storage to save gas function getUlnConfig(address _oapp, uint32 _remoteEid) public view returns (UlnConfig memory rtnConfig) { UlnConfig storage defaultConfig = ulnConfigs[DEFAULT_CONFIG][_remoteEid]; UlnConfig storage customConfig = ulnConfigs[_oapp][_remoteEid]; // if confirmations is 0, use default uint64 confirmations = customConfig.confirmations; if (confirmations == DEFAULT) { rtnConfig.confirmations = defaultConfig.confirmations; } else if (confirmations != NIL_CONFIRMATIONS) { // if confirmations is uint64.max, no block confirmations required rtnConfig.confirmations = confirmations; } // else do nothing, rtnConfig.confirmation is 0 if (customConfig.requiredDVNCount == DEFAULT) { if (defaultConfig.requiredDVNCount > 0) { // copy only if count > 0. save gas rtnConfig.requiredDVNs = defaultConfig.requiredDVNs; rtnConfig.requiredDVNCount = defaultConfig.requiredDVNCount; } // else, do nothing } else { if (customConfig.requiredDVNCount != NIL_DVN_COUNT) { rtnConfig.requiredDVNs = customConfig.requiredDVNs; rtnConfig.requiredDVNCount = customConfig.requiredDVNCount; } // else, do nothing } if (customConfig.optionalDVNCount == DEFAULT) { if (defaultConfig.optionalDVNCount > 0) { // copy only if count > 0. save gas rtnConfig.optionalDVNs = defaultConfig.optionalDVNs; rtnConfig.optionalDVNCount = defaultConfig.optionalDVNCount; rtnConfig.optionalDVNThreshold = defaultConfig.optionalDVNThreshold; } } else { if (customConfig.optionalDVNCount != NIL_DVN_COUNT) { rtnConfig.optionalDVNs = customConfig.optionalDVNs; rtnConfig.optionalDVNCount = customConfig.optionalDVNCount; rtnConfig.optionalDVNThreshold = customConfig.optionalDVNThreshold; } } // the final value must have at least one dvn // it is possible that some default config result into 0 dvns _assertAtLeastOneDVN(rtnConfig); } /// @dev Get the uln config without the default config for the given remoteEid. function getAppUlnConfig(address _oapp, uint32 _remoteEid) external view returns (UlnConfig memory) { return ulnConfigs[_oapp][_remoteEid]; } // ============================ Internal =================================== function _setUlnConfig(uint32 _remoteEid, address _oapp, UlnConfig memory _param) internal { _setConfig(_oapp, _remoteEid, _param); // get ULN config again as a catch all to ensure the config is valid getUlnConfig(_oapp, _remoteEid); emit UlnConfigSet(_oapp, _remoteEid, _param); } /// @dev a supported Eid must have a valid default uln config, which has at least one dvn function _isSupportedEid(uint32 _remoteEid) internal view returns (bool) { UlnConfig storage defaultConfig = ulnConfigs[DEFAULT_CONFIG][_remoteEid]; return defaultConfig.requiredDVNCount > 0 || defaultConfig.optionalDVNThreshold > 0; } function _assertSupportedEid(uint32 _remoteEid) internal view { if (!_isSupportedEid(_remoteEid)) revert LZ_ULN_UnsupportedEid(_remoteEid); } // ============================ Private =================================== function _assertAtLeastOneDVN(UlnConfig memory _config) private pure { if (_config.requiredDVNCount == 0 && _config.optionalDVNThreshold == 0) revert LZ_ULN_AtLeastOneDVN(); } /// @dev this private function is used in both setDefaultUlnConfigs and setUlnConfig function _setConfig(address _oapp, uint32 _eid, UlnConfig memory _param) private { // @dev required dvns // if dvnCount == NONE, dvns list must be empty // if dvnCount == DEFAULT, dvn list must be empty // otherwise, dvnList.length == dvnCount and assert the list is valid if (_param.requiredDVNCount == NIL_DVN_COUNT || _param.requiredDVNCount == DEFAULT) { if (_param.requiredDVNs.length != 0) revert LZ_ULN_InvalidRequiredDVNCount(); } else { if (_param.requiredDVNs.length != _param.requiredDVNCount || _param.requiredDVNCount > MAX_COUNT) revert LZ_ULN_InvalidRequiredDVNCount(); _assertNoDuplicates(_param.requiredDVNs); } // @dev optional dvns // if optionalDVNCount == NONE, optionalDVNs list must be empty and threshold must be 0 // if optionalDVNCount == DEFAULT, optionalDVNs list must be empty and threshold must be 0 // otherwise, optionalDVNs.length == optionalDVNCount, threshold > 0 && threshold <= optionalDVNCount and assert the list is valid // example use case: an oapp uses the DEFAULT 'required' but // a) use a custom 1/1 dvn (practically a required dvn), or // b) use a custom 2/3 dvn if (_param.optionalDVNCount == NIL_DVN_COUNT || _param.optionalDVNCount == DEFAULT) { if (_param.optionalDVNs.length != 0) revert LZ_ULN_InvalidOptionalDVNCount(); if (_param.optionalDVNThreshold != 0) revert LZ_ULN_InvalidOptionalDVNThreshold(); } else { if (_param.optionalDVNs.length != _param.optionalDVNCount || _param.optionalDVNCount > MAX_COUNT) revert LZ_ULN_InvalidOptionalDVNCount(); if (_param.optionalDVNThreshold == 0 || _param.optionalDVNThreshold > _param.optionalDVNCount) revert LZ_ULN_InvalidOptionalDVNThreshold(); _assertNoDuplicates(_param.optionalDVNs); } // don't assert valid count here, as it needs to be validated along side default config ulnConfigs[_oapp][_eid] = _param; } function _assertNoDuplicates(address[] memory _dvns) private pure { address lastDVN = address(0); for (uint256 i = 0; i < _dvns.length; i++) { address dvn = _dvns[i]; if (dvn <= lastDVN) revert LZ_ULN_Unsorted(); // to ensure no duplicates lastDVN = dvn; } } }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ILayerZeroDVN { struct AssignJobParam { uint32 dstEid; bytes packetHeader; bytes32 payloadHash; uint64 confirmations; address sender; } // @notice query price and assign jobs at the same time // @param _dstEid - the destination endpoint identifier // @param _packetHeader - version + nonce + path // @param _payloadHash - hash of guid + message // @param _confirmations - block confirmation delay before relaying blocks // @param _sender - the source sending contract address // @param _options - options function assignJob(AssignJobParam calldata _param, bytes calldata _options) external payable returns (uint256 fee); // @notice query the dvn fee for relaying block information to the destination chain // @param _dstEid the destination endpoint identifier // @param _confirmations - block confirmation delay before relaying blocks // @param _sender - the source sending contract address // @param _options - options function getFee( uint32 _dstEid, uint64 _confirmations, address _sender, bytes calldata _options ) external view returns (uint256 fee); }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { BytesLib } from "solidity-bytes-utils/contracts/BytesLib.sol"; import { BitMap256 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/BitMaps.sol"; import { CalldataBytesLib } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/CalldataBytesLib.sol"; library DVNOptions { using CalldataBytesLib for bytes; using BytesLib for bytes; uint8 internal constant WORKER_ID = 2; uint8 internal constant OPTION_TYPE_PRECRIME = 1; error DVN_InvalidDVNIdx(); error DVN_InvalidDVNOptions(uint256 cursor); /// @dev group dvn options by its idx /// @param _options [dvn_id][dvn_option][dvn_id][dvn_option]... /// dvn_option = [option_size][dvn_idx][option_type][option] /// option_size = len(dvn_idx) + len(option_type) + len(option) /// dvn_id: uint8, dvn_idx: uint8, option_size: uint16, option_type: uint8, option: bytes /// @return dvnOptions the grouped options, still share the same format of _options /// @return dvnIndices the dvn indices function groupDVNOptionsByIdx( bytes memory _options ) internal pure returns (bytes[] memory dvnOptions, uint8[] memory dvnIndices) { if (_options.length == 0) return (dvnOptions, dvnIndices); uint8 numDVNs = getNumDVNs(_options); // if there is only 1 dvn, we can just return the whole options if (numDVNs == 1) { dvnOptions = new bytes[](1); dvnOptions[0] = _options; dvnIndices = new uint8[](1); dvnIndices[0] = _options.toUint8(3); // dvn idx return (dvnOptions, dvnIndices); } // otherwise, we need to group the options by dvn_idx dvnIndices = new uint8[](numDVNs); dvnOptions = new bytes[](numDVNs); unchecked { uint256 cursor = 0; uint256 start = 0; uint8 lastDVNIdx = 255; // 255 is an invalid dvn_idx while (cursor < _options.length) { ++cursor; // skip worker_id // optionLength asserted in getNumDVNs (skip check) uint16 optionLength = _options.toUint16(cursor); cursor += 2; // dvnIdx asserted in getNumDVNs (skip check) uint8 dvnIdx = _options.toUint8(cursor); // dvnIdx must equal to the lastDVNIdx for the first option // so it is always skipped in the first option // this operation slices out options whenever the scan finds a different lastDVNIdx if (lastDVNIdx == 255) { lastDVNIdx = dvnIdx; } else if (dvnIdx != lastDVNIdx) { uint256 len = cursor - start - 3; // 3 is for worker_id and option_length bytes memory opt = _options.slice(start, len); _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, opt); // reset the start and lastDVNIdx start += len; lastDVNIdx = dvnIdx; } cursor += optionLength; } // skip check the cursor here because the cursor is asserted in getNumDVNs // if we have reached the end of the options, we need to process the last dvn uint256 size = cursor - start; bytes memory op = _options.slice(start, size); _insertDVNOptions(dvnOptions, dvnIndices, lastDVNIdx, op); // revert dvnIndices to start from 0 for (uint8 i = 0; i < numDVNs; ++i) { --dvnIndices[i]; } } } function _insertDVNOptions( bytes[] memory _dvnOptions, uint8[] memory _dvnIndices, uint8 _dvnIdx, bytes memory _newOptions ) internal pure { // dvnIdx starts from 0 but default value of dvnIndices is 0, // so we tell if the slot is empty by adding 1 to dvnIdx if (_dvnIdx == 255) revert DVN_InvalidDVNIdx(); uint8 dvnIdxAdj = _dvnIdx + 1; for (uint256 j = 0; j < _dvnIndices.length; ++j) { uint8 index = _dvnIndices[j]; if (dvnIdxAdj == index) { _dvnOptions[j] = abi.encodePacked(_dvnOptions[j], _newOptions); break; } else if (index == 0) { // empty slot, that means it is the first time we see this dvn _dvnIndices[j] = dvnIdxAdj; _dvnOptions[j] = _newOptions; break; } } } /// @dev get the number of unique dvns /// @param _options the format is the same as groupDVNOptionsByIdx function getNumDVNs(bytes memory _options) internal pure returns (uint8 numDVNs) { uint256 cursor = 0; BitMap256 bitmap; // find number of unique dvn_idx unchecked { while (cursor < _options.length) { ++cursor; // skip worker_id uint16 optionLength = _options.toUint16(cursor); cursor += 2; if (optionLength < 2) revert DVN_InvalidDVNOptions(cursor); // at least 1 byte for dvn_idx and 1 byte for option_type uint8 dvnIdx = _options.toUint8(cursor); // if dvnIdx is not set, increment numDVNs // max num of dvns is 255, 255 is an invalid dvn_idx // The order of the dvnIdx is not required to be sequential, as enforcing the order may weaken // the composability of the options. e.g. if we refrain from enforcing the order, an OApp that has // already enforced certain options can append additional options to the end of the enforced // ones without restrictions. if (dvnIdx == 255) revert DVN_InvalidDVNIdx(); if (!bitmap.get(dvnIdx)) { ++numDVNs; bitmap = bitmap.set(dvnIdx); } cursor += optionLength; } } if (cursor != _options.length) revert DVN_InvalidDVNOptions(cursor); } /// @dev decode the next dvn option from _options starting from the specified cursor /// @param _options the format is the same as groupDVNOptionsByIdx /// @param _cursor the cursor to start decoding /// @return optionType the type of the option /// @return option the option /// @return cursor the cursor to start decoding the next option function nextDVNOption( bytes calldata _options, uint256 _cursor ) internal pure returns (uint8 optionType, bytes calldata option, uint256 cursor) { unchecked { // skip worker id cursor = _cursor + 1; // read option size uint16 size = _options.toU16(cursor); cursor += 2; // read option type optionType = _options.toU8(cursor + 1); // skip dvn_idx // startCursor and endCursor are used to slice the option from _options uint256 startCursor = cursor + 2; // skip option type and dvn_idx uint256 endCursor = cursor + size; option = _options[startCursor:endCursor]; cursor += size; } } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { SafeCast } from "@openzeppelin/contracts/utils/math/SafeCast.sol"; import { ExecutorOptions } from "@layerzerolabs/lz-evm-protocol-v2/contracts/messagelib/libs/ExecutorOptions.sol"; import { DVNOptions } from "./DVNOptions.sol"; library UlnOptions { using SafeCast for uint256; uint16 internal constant TYPE_1 = 1; // legacy options type 1 uint16 internal constant TYPE_2 = 2; // legacy options type 2 uint16 internal constant TYPE_3 = 3; error LZ_ULN_InvalidWorkerOptions(uint256 cursor); error LZ_ULN_InvalidWorkerId(uint8 workerId); error LZ_ULN_InvalidLegacyType1Option(); error LZ_ULN_InvalidLegacyType2Option(); error LZ_ULN_UnsupportedOptionType(uint16 optionType); /// @dev decode the options into executorOptions and dvnOptions /// @param _options the options can be either legacy options (type 1 or 2) or type 3 options /// @return executorOptions the executor options, share the same format of type 3 options /// @return dvnOptions the dvn options, share the same format of type 3 options function decode( bytes calldata _options ) internal pure returns (bytes memory executorOptions, bytes memory dvnOptions) { // at least 2 bytes for the option type, but can have no options if (_options.length < 2) revert LZ_ULN_InvalidWorkerOptions(0); uint16 optionsType = uint16(bytes2(_options[0:2])); uint256 cursor = 2; // type3 options: [worker_option][worker_option]... // worker_option: [worker_id][option_size][option] // worker_id: uint8, option_size: uint16, option: bytes if (optionsType == TYPE_3) { unchecked { uint256 start = cursor; uint8 lastWorkerId; // worker_id starts from 1, so 0 is an invalid worker_id // heuristic: we assume that the options are mostly EXECUTOR options only // checking the workerID can reduce gas usage for most cases while (cursor < _options.length) { uint8 workerId = uint8(bytes1(_options[cursor:cursor + 1])); if (workerId == 0) revert LZ_ULN_InvalidWorkerId(0); // workerId must equal to the lastWorkerId for the first option // so it is always skipped in the first option // this operation slices out options whenever the the scan finds a different workerId if (lastWorkerId == 0) { lastWorkerId = workerId; } else if (workerId != lastWorkerId) { bytes calldata op = _options[start:cursor]; // slice out the last worker's options (executorOptions, dvnOptions) = _insertWorkerOptions( executorOptions, dvnOptions, lastWorkerId, op ); // reset the start cursor and lastWorkerId start = cursor; lastWorkerId = workerId; } ++cursor; // for workerId uint16 size = uint16(bytes2(_options[cursor:cursor + 2])); if (size == 0) revert LZ_ULN_InvalidWorkerOptions(cursor); cursor += size + 2; } // the options length must be the same as the cursor at the end if (cursor != _options.length) revert LZ_ULN_InvalidWorkerOptions(cursor); // if we have reached the end of the options and the options are not empty // we need to process the last worker's options if (_options.length > 2) { bytes calldata op = _options[start:cursor]; (executorOptions, dvnOptions) = _insertWorkerOptions(executorOptions, dvnOptions, lastWorkerId, op); } } } else { executorOptions = decodeLegacyOptions(optionsType, _options); } } function _insertWorkerOptions( bytes memory _executorOptions, bytes memory _dvnOptions, uint8 _workerId, bytes calldata _newOptions ) private pure returns (bytes memory, bytes memory) { if (_workerId == ExecutorOptions.WORKER_ID) { _executorOptions = _executorOptions.length == 0 ? _newOptions : abi.encodePacked(_executorOptions, _newOptions); } else if (_workerId == DVNOptions.WORKER_ID) { _dvnOptions = _dvnOptions.length == 0 ? _newOptions : abi.encodePacked(_dvnOptions, _newOptions); } else { revert LZ_ULN_InvalidWorkerId(_workerId); } return (_executorOptions, _dvnOptions); } /// @dev decode the legacy options (type 1 or 2) into executorOptions /// @param _optionType the legacy option type /// @param _options the legacy options, which still has the option type in the first 2 bytes /// @return executorOptions the executor options, share the same format of type 3 options /// Data format: /// legacy type 1: [extraGas] /// legacy type 2: [extraGas][dstNativeAmt][dstNativeAddress] /// extraGas: uint256, dstNativeAmt: uint256, dstNativeAddress: bytes function decodeLegacyOptions( uint16 _optionType, bytes calldata _options ) internal pure returns (bytes memory executorOptions) { if (_optionType == TYPE_1) { if (_options.length != 34) revert LZ_ULN_InvalidLegacyType1Option(); // execution gas uint128 executionGas = uint256(bytes32(_options[2:2 + 32])).toUint128(); // dont use the encode function in the ExecutorOptions lib for saving gas by calling abi.encodePacked once // the result is a lzReceive option: [executor_id][option_size][option_type][execution_gas] // option_type: uint8, execution_gas: uint128 // option_size = len(option_type) + len(execution_gas) = 1 + 16 = 17 executorOptions = abi.encodePacked( ExecutorOptions.WORKER_ID, uint16(17), // 16 + 1, 16 for option_length, + 1 for option_type ExecutorOptions.OPTION_TYPE_LZRECEIVE, executionGas ); } else if (_optionType == TYPE_2) { // receiver size <= 32 if (_options.length <= 66 || _options.length > 98) revert LZ_ULN_InvalidLegacyType2Option(); // execution gas uint128 executionGas = uint256(bytes32(_options[2:2 + 32])).toUint128(); // nativeDrop (amount + receiver) uint128 amount = uint256(bytes32(_options[34:34 + 32])).toUint128(); // offset 2 + 32 bytes32 receiver; unchecked { uint256 receiverLen = _options.length - 66; // offset 2 + 32 + 32 receiver = bytes32(_options[66:]); receiver = receiver >> (8 * (32 - receiverLen)); // padding 0 to the left } // dont use the encode function in the ExecutorOptions lib for saving gas by calling abi.encodePacked once // the result has one lzReceive option and one nativeDrop option: // [executor_id][lzReceive_option_size][option_type][execution_gas] + // [executor_id][nativeDrop_option_size][option_type][nativeDrop_amount][receiver] // option_type: uint8, execution_gas: uint128, nativeDrop_amount: uint128, receiver: bytes32 // lzReceive_option_size = len(option_type) + len(execution_gas) = 1 + 16 = 17 // nativeDrop_option_size = len(option_type) + len(nativeDrop_amount) + len(receiver) = 1 + 16 + 32 = 49 executorOptions = abi.encodePacked( ExecutorOptions.WORKER_ID, uint16(17), // 16 + 1, 16 for option_length, + 1 for option_type ExecutorOptions.OPTION_TYPE_LZRECEIVE, executionGas, ExecutorOptions.WORKER_ID, uint16(49), // 48 + 1, 32 + 16 for option_length, + 1 for option_type ExecutorOptions.OPTION_TYPE_NATIVE_DROP, amount, receiver ); } else { revert LZ_ULN_UnsupportedOptionType(_optionType); } } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; abstract contract AddressSizeConfig is Ownable { // EndpointV1 is using bytes as address. this map is for address length assertion mapping(uint32 dstEid => uint256 size) public addressSizes; event AddressSizeSet(uint16 eid, uint256 size); error AddressSizeConfig_InvalidAddressSize(); error AddressSizeConfig_AddressSizeAlreadySet(); function setAddressSize(uint16 _eid, uint256 _size) external onlyOwner { if (_size > 32) revert AddressSizeConfig_InvalidAddressSize(); if (addressSizes[_eid] != 0) revert AddressSizeConfig_AddressSizeAlreadySet(); addressSizes[_eid] = _size; emit AddressSizeSet(_eid, _size); } }
// SPDX-License-Identifier: LZBL-1.2 pragma solidity ^0.8.20; import { Packet } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ISendLib.sol"; import { AddressCast } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/AddressCast.sol"; import { GUID } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/GUID.sol"; import { Transfer } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/Transfer.sol"; import { IMessageLibE1 } from "./interfaces/IMessageLibE1.sol"; import { ITreasuryFeeHandler } from "./interfaces/ITreasuryFeeHandler.sol"; import { INonceContract } from "./interfaces/INonceContract.sol"; import { SendLibBase, WorkerOptions, ExecutorConfig } from "../../SendLibBase.sol"; import { AddressSizeConfig } from "./AddressSizeConfig.sol"; /// @dev send-side message library base contract on endpoint v1. /// design: /// 1/ it enforces the path definition on V1 and interacts with the nonce contract /// 2/ quote: first executor, then verifier (e.g. DVNs), then treasury /// 3/ send: first executor, then verifier (e.g. DVNs), then treasury. the treasury pay much be DoS-proof abstract contract SendLibBaseE1 is SendLibBase, AddressSizeConfig, IMessageLibE1 { INonceContract public immutable nonceContract; ITreasuryFeeHandler public immutable treasuryFeeHandler; // config address internal lzToken; // this event should be identical to the one on Endpoint V2 event PacketSent(bytes encodedPayload, bytes options, uint256 nativeFee, uint256 lzTokenFee); event NativeFeeWithdrawn(address user, address receiver, uint256 amount); event LzTokenSet(address token); constructor( address _endpoint, uint256 _treasuryGasLimit, uint256 _treasuryNativeFeeCap, address _nonceContract, uint32 _localEid, address _treasuryFeeHandler ) SendLibBase(_endpoint, _localEid, _treasuryGasLimit, _treasuryNativeFeeCap) { nonceContract = INonceContract(_nonceContract); treasuryFeeHandler = ITreasuryFeeHandler(_treasuryFeeHandler); } // ======================= OnlyEndpoint ======================= /// @dev the abstract process for send() is: /// 1/ pay workers, which includes the executor and the validation workers /// 2/ pay treasury /// 3/ in EndpointV1, here we handle the fees and refunds function send( address _sender, uint64, // _nonce uint16 _dstEid, bytes calldata _path, // remoteAddress + localAddress bytes calldata _message, address payable _refundAddress, address _lzTokenPaymentAddress, bytes calldata _options ) external payable onlyEndpoint { (bytes memory encodedPacket, uint256 totalNativeFee) = _payWorkers(_sender, _dstEid, _path, _message, _options); // quote treasury fee uint32 dstEid = _dstEid; // stack too deep address sender = _sender; // stack too deep bool payInLzToken = _lzTokenPaymentAddress != address(0x0) && address(lzToken) != address(0x0); (uint256 treasuryNativeFee, uint256 lzTokenFee) = _payTreasury(sender, dstEid, totalNativeFee, payInLzToken); totalNativeFee += treasuryNativeFee; // pay native fee // assert the user has attached enough native token for this address if (msg.value < totalNativeFee) revert LZ_MessageLib_InsufficientMsgValue(); // refund if they send too much uint256 refundAmt = msg.value - totalNativeFee; if (refundAmt > 0) { Transfer.native(_refundAddress, refundAmt); } // pay lz token fee if needed if (lzTokenFee > 0) { // in v2, we let user pass a payInLzToken boolean but always charging the sender // likewise in v1, if _lzTokenPaymentAddress is passed, it must be the sender if (_lzTokenPaymentAddress != sender) revert LZ_MessageLib_LzTokenPaymentAddressMustBeSender(); _payLzTokenFee(sender, lzTokenFee); } emit PacketSent(encodedPacket, _options, totalNativeFee, lzTokenFee); } // ======================= OnlyOwner ======================= function setLzToken(address _lzToken) external onlyOwner { lzToken = _lzToken; emit LzTokenSet(_lzToken); } function setTreasury(address _treasury) external onlyOwner { _setTreasury(_treasury); } // ======================= External ======================= function withdrawFee(address _to, uint256 _amount) external { _debitFee(_amount); Transfer.native(_to, _amount); emit NativeFeeWithdrawn(msg.sender, _to, _amount); } // ======================= View ======================= function estimateFees( uint16 _dstEid, address _sender, bytes calldata _message, bool _payInLzToken, bytes calldata _options ) external view returns (uint256 nativeFee, uint256 lzTokenFee) { return _quote(_sender, _dstEid, _message.length, _payInLzToken, _options); } // ======================= Internal ======================= /// @dev path = remoteAddress + localAddress. function _assertPath(address _sender, bytes calldata _path, uint256 remoteAddressSize) internal pure { if (_path.length != 20 + remoteAddressSize) revert LZ_MessageLib_InvalidPath(); address srcInPath = AddressCast.toAddress(_path[remoteAddressSize:]); if (_sender != srcInPath) revert LZ_MessageLib_InvalidSender(); } function _payLzTokenFee(address _sender, uint256 _lzTokenFee) internal { treasuryFeeHandler.payFee( lzToken, _sender, _lzTokenFee, // the supplied fee is always equal to the required fee _lzTokenFee, treasury ); } /// @dev outbound does three things /// @dev 1) asserts path /// @dev 2) increments the nonce /// @dev 3) assemble packet /// @return packet to be sent to workers function _outbound( address _sender, uint16 _dstEid, bytes calldata _path, bytes calldata _message ) internal returns (Packet memory packet) { // assert toAddress size uint256 remoteAddressSize = addressSizes[_dstEid]; if (remoteAddressSize == 0) revert LZ_MessageLib_InvalidPath(); _assertPath(_sender, _path, remoteAddressSize); // increment nonce uint64 nonce = nonceContract.increment(_dstEid, _sender, _path); bytes32 receiver = AddressCast.toBytes32(_path[0:remoteAddressSize]); bytes32 guid = GUID.generate(nonce, localEid, _sender, _dstEid, receiver); // assemble packet packet = Packet(nonce, localEid, _sender, _dstEid, receiver, guid, _message); } /// 1/ handle executor /// 2/ handle other workers function _payWorkers( address _sender, uint16 _dstEid, bytes calldata _path, bytes calldata _message, bytes calldata _options ) internal returns (bytes memory encodedPacket, uint256 totalNativeFee) { Packet memory packet = _outbound(_sender, _dstEid, _path, _message); // split workers options (bytes memory executorOptions, WorkerOptions[] memory verificationOptions) = _splitOptions(_options); // handle executor ExecutorConfig memory config = getExecutorConfig(_sender, _dstEid); uint256 msgSize = packet.message.length; _assertMessageSize(msgSize, config.maxMessageSize); totalNativeFee += _payExecutor(config.executor, packet.dstEid, packet.sender, msgSize, executorOptions); // handle other workers (uint256 verifierFee, bytes memory packetBytes) = _payVerifier(packet, verificationOptions); totalNativeFee += verifierFee; encodedPacket = packetBytes; } // ======================= Virtual ======================= function _payVerifier( Packet memory _packet, // packet is assembled in memory for endpoint-v1. so the location can not be calldata WorkerOptions[] memory _options ) internal virtual returns (uint256 otherWorkerFees, bytes memory encodedPacket); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; import { ILayerZeroMessagingLibrary } from "@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroMessagingLibrary.sol"; /// extends ILayerZeroMessagingLibrary instead of ILayerZeroMessagingLibraryV2 for reducing the contract size interface IMessageLibE1 is ILayerZeroMessagingLibrary { error LZ_MessageLib_InvalidPath(); error LZ_MessageLib_InvalidSender(); error LZ_MessageLib_InsufficientMsgValue(); error LZ_MessageLib_LzTokenPaymentAddressMustBeSender(); function setLzToken(address _lzToken) external; function setTreasury(address _treasury) external; function withdrawFee(address _to, uint256 _amount) external; // message libs of same major version are compatible function version() external view returns (uint64 major, uint8 minor, uint8 endpointVersion); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface INonceContract { function increment(uint16 _chainId, address _ua, bytes calldata _path) external returns (uint64); }
// SPDX-License-Identifier: MIT pragma solidity >=0.8.0; interface ITreasuryFeeHandler { function payFee( address _lzToken, address _sender, uint256 _required, uint256 _supplied, address _treasury ) external; }
// SPDX-License-Identifier: Unlicense /* * @title Solidity Bytes Arrays Utils * @author Gonçalo Sá <[email protected]> * * @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity. * The library lets you concatenate, slice and type cast bytes arrays both in memory and storage. */ pragma solidity >=0.8.0 <0.9.0; library BytesLib { function concat( bytes memory _preBytes, bytes memory _postBytes ) internal pure returns (bytes memory) { bytes memory tempBytes; assembly { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // Store the length of the first bytes array at the beginning of // the memory for tempBytes. let length := mload(_preBytes) mstore(tempBytes, length) // Maintain a memory counter for the current write location in the // temp bytes array by adding the 32 bytes for the array length to // the starting location. let mc := add(tempBytes, 0x20) // Stop copying when the memory counter reaches the length of the // first bytes array. let end := add(mc, length) for { // Initialize a copy counter to the start of the _preBytes data, // 32 bytes into its memory. let cc := add(_preBytes, 0x20) } lt(mc, end) { // Increase both counters by 32 bytes each iteration. mc := add(mc, 0x20) cc := add(cc, 0x20) } { // Write the _preBytes data into the tempBytes memory 32 bytes // at a time. mstore(mc, mload(cc)) } // Add the length of _postBytes to the current length of tempBytes // and store it as the new length in the first 32 bytes of the // tempBytes memory. length := mload(_postBytes) mstore(tempBytes, add(length, mload(tempBytes))) // Move the memory counter back from a multiple of 0x20 to the // actual end of the _preBytes data. mc := end // Stop copying when the memory counter reaches the new combined // length of the arrays. end := add(mc, length) for { let cc := add(_postBytes, 0x20) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } // Update the free-memory pointer by padding our last write location // to 32 bytes: add 31 bytes to the end of tempBytes to move to the // next 32 byte block, then round down to the nearest multiple of // 32. If the sum of the length of the two arrays is zero then add // one before rounding down to leave a blank 32 bytes (the length block with 0). mstore(0x40, and( add(add(end, iszero(add(length, mload(_preBytes)))), 31), not(31) // Round down to the nearest 32 bytes. )) } return tempBytes; } function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal { assembly { // Read the first 32 bytes of _preBytes storage, which is the length // of the array. (We don't need to use the offset into the slot // because arrays use the entire slot.) let fslot := sload(_preBytes.slot) // Arrays of 31 bytes or less have an even value in their slot, // while longer arrays have an odd value. The actual length is // the slot divided by two for odd values, and the lowest order // byte divided by two for even values. // If the slot is even, bitwise and the slot with 255 and divide by // two to get the length. If the slot is odd, bitwise and the slot // with -1 and divide by two. let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) let newlength := add(slength, mlength) // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage switch add(lt(slength, 32), lt(newlength, 32)) case 2 { // Since the new array still fits in the slot, we just need to // update the contents of the slot. // uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length sstore( _preBytes.slot, // all the modifications to the slot are inside this // next block add( // we can just add to the slot contents because the // bytes we want to change are the LSBs fslot, add( mul( div( // load the bytes from memory mload(add(_postBytes, 0x20)), // zero all bytes to the right exp(0x100, sub(32, mlength)) ), // and now shift left the number of bytes to // leave space for the length in the slot exp(0x100, sub(32, newlength)) ), // increase length by the double of the memory // bytes length mul(mlength, 2) ) ) ) } case 1 { // The stored value fits in the slot, but the combined value // will exceed it. // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // The contents of the _postBytes array start 32 bytes into // the structure. Our first read should obtain the `submod` // bytes that can fit into the unused space in the last word // of the stored array. To get this, we read 32 bytes starting // from `submod`, so the data we read overlaps with the array // contents by `submod` bytes. Masking the lowest-order // `submod` bytes allows us to add that value directly to the // stored value. let submod := sub(32, slength) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore( sc, add( and( fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00 ), and(mload(mc), mask) ) ) for { mc := add(mc, 0x20) sc := add(sc, 1) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } default { // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) // Start copying to the last used word of the stored array. let sc := add(keccak256(0x0, 0x20), div(slength, 32)) // save new length sstore(_preBytes.slot, add(mul(newlength, 2), 1)) // Copy over the first `submod` bytes of the new data as in // case 1 above. let slengthmod := mod(slength, 32) let mlengthmod := mod(mlength, 32) let submod := sub(32, slengthmod) let mc := add(_postBytes, submod) let end := add(_postBytes, mlength) let mask := sub(exp(0x100, submod), 1) sstore(sc, add(sload(sc), and(mload(mc), mask))) for { sc := add(sc, 1) mc := add(mc, 0x20) } lt(mc, end) { sc := add(sc, 1) mc := add(mc, 0x20) } { sstore(sc, mload(mc)) } mask := exp(0x100, sub(mc, end)) sstore(sc, mul(div(mload(mc), mask), mask)) } } } function slice( bytes memory _bytes, uint256 _start, uint256 _length ) internal pure returns (bytes memory) { require(_length + 31 >= _length, "slice_overflow"); require(_bytes.length >= _start + _length, "slice_outOfBounds"); bytes memory tempBytes; assembly { switch iszero(_length) case 0 { // Get a location of some free memory and store it in tempBytes as // Solidity does for memory variables. tempBytes := mload(0x40) // The first word of the slice result is potentially a partial // word read from the original array. To read it, we calculate // the length of that partial word and start copying that many // bytes into the array. The first word we copy will start with // data we don't care about, but the last `lengthmod` bytes will // land at the beginning of the contents of the new array. When // we're done copying, we overwrite the full first word with // the actual length of the slice. let lengthmod := and(_length, 31) // The multiplication in the next line is necessary // because when slicing multiples of 32 bytes (lengthmod == 0) // the following copy loop was copying the origin's length // and then ending prematurely not copying everything it should. let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod))) let end := add(mc, _length) for { // The multiplication in the next line has the same exact purpose // as the one above. let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start) } lt(mc, end) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { mstore(mc, mload(cc)) } mstore(tempBytes, _length) //update free-memory pointer //allocating the array padded to 32 bytes like the compiler does now mstore(0x40, and(add(mc, 31), not(31))) } //if we want a zero-length slice let's just return a zero-length array default { tempBytes := mload(0x40) //zero out the 32 bytes slice we are about to return //we need to do it because Solidity does not garbage collect mstore(tempBytes, 0) mstore(0x40, add(tempBytes, 0x20)) } } return tempBytes; } function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) { require(_bytes.length >= _start + 20, "toAddress_outOfBounds"); address tempAddress; assembly { tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000) } return tempAddress; } function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) { require(_bytes.length >= _start + 1 , "toUint8_outOfBounds"); uint8 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x1), _start)) } return tempUint; } function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) { require(_bytes.length >= _start + 2, "toUint16_outOfBounds"); uint16 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x2), _start)) } return tempUint; } function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) { require(_bytes.length >= _start + 4, "toUint32_outOfBounds"); uint32 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x4), _start)) } return tempUint; } function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) { require(_bytes.length >= _start + 8, "toUint64_outOfBounds"); uint64 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x8), _start)) } return tempUint; } function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) { require(_bytes.length >= _start + 12, "toUint96_outOfBounds"); uint96 tempUint; assembly { tempUint := mload(add(add(_bytes, 0xc), _start)) } return tempUint; } function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) { require(_bytes.length >= _start + 16, "toUint128_outOfBounds"); uint128 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x10), _start)) } return tempUint; } function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) { require(_bytes.length >= _start + 32, "toUint256_outOfBounds"); uint256 tempUint; assembly { tempUint := mload(add(add(_bytes, 0x20), _start)) } return tempUint; } function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) { require(_bytes.length >= _start + 32, "toBytes32_outOfBounds"); bytes32 tempBytes32; assembly { tempBytes32 := mload(add(add(_bytes, 0x20), _start)) } return tempBytes32; } function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) { bool success = true; assembly { let length := mload(_preBytes) // if lengths don't match the arrays are not equal switch eq(length, mload(_postBytes)) case 1 { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 let mc := add(_preBytes, 0x20) let end := add(mc, length) for { let cc := add(_postBytes, 0x20) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) } eq(add(lt(mc, end), cb), 2) { mc := add(mc, 0x20) cc := add(cc, 0x20) } { // if any of these checks fails then arrays are not equal if iszero(eq(mload(mc), mload(cc))) { // unsuccess: success := 0 cb := 0 } } } default { // unsuccess: success := 0 } } return success; } function equalStorage( bytes storage _preBytes, bytes memory _postBytes ) internal view returns (bool) { bool success = true; assembly { // we know _preBytes_offset is 0 let fslot := sload(_preBytes.slot) // Decode the length of the stored array like in concatStorage(). let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2) let mlength := mload(_postBytes) // if lengths don't match the arrays are not equal switch eq(slength, mlength) case 1 { // slength can contain both the length and contents of the array // if length < 32 bytes so let's prepare for that // v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage if iszero(iszero(slength)) { switch lt(slength, 32) case 1 { // blank the last byte which is the length fslot := mul(div(fslot, 0x100), 0x100) if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) { // unsuccess: success := 0 } } default { // cb is a circuit breaker in the for loop since there's // no said feature for inline assembly loops // cb = 1 - don't breaker // cb = 0 - break let cb := 1 // get the keccak hash to get the contents of the array mstore(0x0, _preBytes.slot) let sc := keccak256(0x0, 0x20) let mc := add(_postBytes, 0x20) let end := add(mc, mlength) // the next line is the loop condition: // while(uint256(mc < end) + cb == 2) for {} eq(add(lt(mc, end), cb), 2) { sc := add(sc, 1) mc := add(mc, 0x20) } { if iszero(eq(sload(sc), mload(mc))) { // unsuccess: success := 0 cb := 0 } } } } } default { // unsuccess: success := 0 } } return success; } }
{ "evmVersion": "paris", "optimizer": { "enabled": true, "runs": 20000 }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"_endpoint","type":"address"},{"internalType":"uint256","name":"_treasuryGasLimit","type":"uint256"},{"internalType":"uint256","name":"_treasuryGasForFeeCap","type":"uint256"},{"internalType":"address","name":"_nonceContract","type":"address"},{"internalType":"uint32","name":"_localEid","type":"uint32"},{"internalType":"address","name":"_treasuryFeeHandler","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"AddressCast_InvalidAddress","type":"error"},{"inputs":[],"name":"AddressSizeConfig_AddressSizeAlreadySet","type":"error"},{"inputs":[],"name":"AddressSizeConfig_InvalidAddressSize","type":"error"},{"inputs":[],"name":"DVN_InvalidDVNIdx","type":"error"},{"inputs":[{"internalType":"uint256","name":"cursor","type":"uint256"}],"name":"DVN_InvalidDVNOptions","type":"error"},{"inputs":[],"name":"LZ_MessageLib_InsufficientMsgValue","type":"error"},{"inputs":[{"internalType":"uint256","name":"requested","type":"uint256"},{"internalType":"uint256","name":"available","type":"uint256"}],"name":"LZ_MessageLib_InvalidAmount","type":"error"},{"inputs":[],"name":"LZ_MessageLib_InvalidExecutor","type":"error"},{"inputs":[{"internalType":"uint256","name":"actual","type":"uint256"},{"internalType":"uint256","name":"max","type":"uint256"}],"name":"LZ_MessageLib_InvalidMessageSize","type":"error"},{"inputs":[],"name":"LZ_MessageLib_InvalidPath","type":"error"},{"inputs":[],"name":"LZ_MessageLib_InvalidSender","type":"error"},{"inputs":[],"name":"LZ_MessageLib_LzTokenPaymentAddressMustBeSender","type":"error"},{"inputs":[],"name":"LZ_MessageLib_OnlyEndpoint","type":"error"},{"inputs":[],"name":"LZ_MessageLib_TransferFailed","type":"error"},{"inputs":[],"name":"LZ_MessageLib_ZeroMessageSize","type":"error"},{"inputs":[],"name":"LZ_ULN_AtLeastOneDVN","type":"error"},{"inputs":[{"internalType":"uint256","name":"configType","type":"uint256"}],"name":"LZ_ULN_InvalidConfigType","type":"error"},{"inputs":[],"name":"LZ_ULN_InvalidConfirmations","type":"error"},{"inputs":[],"name":"LZ_ULN_InvalidLegacyType1Option","type":"error"},{"inputs":[],"name":"LZ_ULN_InvalidLegacyType2Option","type":"error"},{"inputs":[],"name":"LZ_ULN_InvalidOptionalDVNCount","type":"error"},{"inputs":[],"name":"LZ_ULN_InvalidOptionalDVNThreshold","type":"error"},{"inputs":[],"name":"LZ_ULN_InvalidRequiredDVNCount","type":"error"},{"inputs":[{"internalType":"uint8","name":"workerId","type":"uint8"}],"name":"LZ_ULN_InvalidWorkerId","type":"error"},{"inputs":[{"internalType":"uint256","name":"cursor","type":"uint256"}],"name":"LZ_ULN_InvalidWorkerOptions","type":"error"},{"inputs":[],"name":"LZ_ULN_Unsorted","type":"error"},{"inputs":[{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"LZ_ULN_UnsupportedEid","type":"error"},{"inputs":[{"internalType":"uint16","name":"optionType","type":"uint16"}],"name":"LZ_ULN_UnsupportedOptionType","type":"error"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_value","type":"uint256"}],"name":"Transfer_NativeFailed","type":"error"},{"inputs":[],"name":"Transfer_ToAddressIsZero","type":"error"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint16","name":"eid","type":"uint16"},{"indexed":false,"internalType":"uint256","name":"size","type":"uint256"}],"name":"AddressSizeSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address[]","name":"requiredDVNs","type":"address[]"},{"indexed":false,"internalType":"address[]","name":"optionalDVNs","type":"address[]"},{"indexed":false,"internalType":"uint256[]","name":"fees","type":"uint256[]"}],"name":"DVNFeePaid","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"components":[{"internalType":"uint32","name":"maxMessageSize","type":"uint32"},{"internalType":"address","name":"executor","type":"address"}],"internalType":"struct ExecutorConfig","name":"config","type":"tuple"}],"indexed":false,"internalType":"struct SetDefaultExecutorConfigParam[]","name":"params","type":"tuple[]"}],"name":"DefaultExecutorConfigsSet","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"components":[{"internalType":"uint64","name":"confirmations","type":"uint64"},{"internalType":"uint8","name":"requiredDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNThreshold","type":"uint8"},{"internalType":"address[]","name":"requiredDVNs","type":"address[]"},{"internalType":"address[]","name":"optionalDVNs","type":"address[]"}],"internalType":"struct UlnConfig","name":"config","type":"tuple"}],"indexed":false,"internalType":"struct SetDefaultUlnConfigParam[]","name":"params","type":"tuple[]"}],"name":"DefaultUlnConfigsSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oapp","type":"address"},{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"components":[{"internalType":"uint32","name":"maxMessageSize","type":"uint32"},{"internalType":"address","name":"executor","type":"address"}],"indexed":false,"internalType":"struct ExecutorConfig","name":"config","type":"tuple"}],"name":"ExecutorConfigSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"executor","type":"address"},{"indexed":false,"internalType":"uint256","name":"fee","type":"uint256"}],"name":"ExecutorFeePaid","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"}],"name":"LzTokenSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"user","type":"address"},{"indexed":false,"internalType":"address","name":"receiver","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"NativeFeeWithdrawn","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"bytes","name":"encodedPayload","type":"bytes"},{"indexed":false,"internalType":"bytes","name":"options","type":"bytes"},{"indexed":false,"internalType":"uint256","name":"nativeFee","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"name":"PacketSent","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"newTreasuryNativeFeeCap","type":"uint256"}],"name":"TreasuryNativeFeeCapSet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"treasury","type":"address"}],"name":"TreasurySet","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"oapp","type":"address"},{"indexed":false,"internalType":"uint32","name":"eid","type":"uint32"},{"components":[{"internalType":"uint64","name":"confirmations","type":"uint64"},{"internalType":"uint8","name":"requiredDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNThreshold","type":"uint8"},{"internalType":"address[]","name":"requiredDVNs","type":"address[]"},{"internalType":"address[]","name":"optionalDVNs","type":"address[]"}],"indexed":false,"internalType":"struct UlnConfig","name":"config","type":"tuple"}],"name":"UlnConfigSet","type":"event"},{"inputs":[{"internalType":"uint32","name":"dstEid","type":"uint32"}],"name":"addressSizes","outputs":[{"internalType":"uint256","name":"size","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_dstEid","type":"uint16"},{"internalType":"address","name":"_sender","type":"address"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"bool","name":"_payInLzToken","type":"bool"},{"internalType":"bytes","name":"_options","type":"bytes"}],"name":"estimateFees","outputs":[{"internalType":"uint256","name":"nativeFee","type":"uint256"},{"internalType":"uint256","name":"lzTokenFee","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"oapp","type":"address"},{"internalType":"uint32","name":"eid","type":"uint32"}],"name":"executorConfigs","outputs":[{"internalType":"uint32","name":"maxMessageSize","type":"uint32"},{"internalType":"address","name":"executor","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"worker","type":"address"}],"name":"fees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oapp","type":"address"},{"internalType":"uint32","name":"_remoteEid","type":"uint32"}],"name":"getAppUlnConfig","outputs":[{"components":[{"internalType":"uint64","name":"confirmations","type":"uint64"},{"internalType":"uint8","name":"requiredDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNThreshold","type":"uint8"},{"internalType":"address[]","name":"requiredDVNs","type":"address[]"},{"internalType":"address[]","name":"optionalDVNs","type":"address[]"}],"internalType":"struct UlnConfig","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint16","name":"_eid","type":"uint16"},{"internalType":"address","name":"_oapp","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"}],"name":"getConfig","outputs":[{"internalType":"bytes","name":"","type":"bytes"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oapp","type":"address"},{"internalType":"uint32","name":"_remoteEid","type":"uint32"}],"name":"getExecutorConfig","outputs":[{"components":[{"internalType":"uint32","name":"maxMessageSize","type":"uint32"},{"internalType":"address","name":"executor","type":"address"}],"internalType":"struct ExecutorConfig","name":"rtnConfig","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_oapp","type":"address"},{"internalType":"uint32","name":"_remoteEid","type":"uint32"}],"name":"getUlnConfig","outputs":[{"components":[{"internalType":"uint64","name":"confirmations","type":"uint64"},{"internalType":"uint8","name":"requiredDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNThreshold","type":"uint8"},{"internalType":"address[]","name":"requiredDVNs","type":"address[]"},{"internalType":"address[]","name":"optionalDVNs","type":"address[]"}],"internalType":"struct UlnConfig","name":"rtnConfig","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint32","name":"_eid","type":"uint32"}],"name":"isSupportedEid","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nonceContract","outputs":[{"internalType":"contract INonceContract","name":"","type":"address"}],"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":"_sender","type":"address"},{"internalType":"uint64","name":"","type":"uint64"},{"internalType":"uint16","name":"_dstEid","type":"uint16"},{"internalType":"bytes","name":"_path","type":"bytes"},{"internalType":"bytes","name":"_message","type":"bytes"},{"internalType":"address payable","name":"_refundAddress","type":"address"},{"internalType":"address","name":"_lzTokenPaymentAddress","type":"address"},{"internalType":"bytes","name":"_options","type":"bytes"}],"name":"send","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_eid","type":"uint16"},{"internalType":"uint256","name":"_size","type":"uint256"}],"name":"setAddressSize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint16","name":"_eid","type":"uint16"},{"internalType":"address","name":"_oapp","type":"address"},{"internalType":"uint256","name":"_configType","type":"uint256"},{"internalType":"bytes","name":"_config","type":"bytes"}],"name":"setConfig","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"components":[{"internalType":"uint32","name":"maxMessageSize","type":"uint32"},{"internalType":"address","name":"executor","type":"address"}],"internalType":"struct ExecutorConfig","name":"config","type":"tuple"}],"internalType":"struct SetDefaultExecutorConfigParam[]","name":"_params","type":"tuple[]"}],"name":"setDefaultExecutorConfigs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"uint32","name":"eid","type":"uint32"},{"components":[{"internalType":"uint64","name":"confirmations","type":"uint64"},{"internalType":"uint8","name":"requiredDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNCount","type":"uint8"},{"internalType":"uint8","name":"optionalDVNThreshold","type":"uint8"},{"internalType":"address[]","name":"requiredDVNs","type":"address[]"},{"internalType":"address[]","name":"optionalDVNs","type":"address[]"}],"internalType":"struct UlnConfig","name":"config","type":"tuple"}],"internalType":"struct SetDefaultUlnConfigParam[]","name":"_params","type":"tuple[]"}],"name":"setDefaultUlnConfigs","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_lzToken","type":"address"}],"name":"setLzToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_treasury","type":"address"}],"name":"setTreasury","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_newTreasuryNativeFeeCap","type":"uint256"}],"name":"setTreasuryNativeFeeCap","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"treasury","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"treasuryFeeHandler","outputs":[{"internalType":"contract ITreasuryFeeHandler","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint64","name":"major","type":"uint64"},{"internalType":"uint8","name":"minor","type":"uint8"},{"internalType":"uint8","name":"endpointVersion","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_to","type":"address"},{"internalType":"uint256","name":"_amount","type":"uint256"}],"name":"withdrawFee","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
6101206040523480156200001257600080fd5b5060405162005a3c38038062005a3c8339810160408190526200003591620000ff565b6001600160a01b03861660805263ffffffff821660a05285858585858585828686620000613362000092565b60c09190915260025550506001600160a01b0392831660e05290911661010052506200017898505050505050505050565b600080546001600160a01b038381166001600160a01b0319831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b80516001600160a01b0381168114620000fa57600080fd5b919050565b60008060008060008060c087890312156200011957600080fd5b6200012487620000e2565b955060208701519450604087015193506200014260608801620000e2565b9250608087015163ffffffff811681146200015c57600080fd5b91506200016c60a08801620000e2565b90509295509295509295565b60805160a05160c05160e0516101005161585c620001e0600039600081816104a50152611fe90152600081816101ad0152612668015260008181611de801526125580152600081816127340152612802015260008181610e740152611568015261585c6000f3fe6080604052600436106101965760003560e01c80636750cd4c116100e1578063c28e0eed1161008a578063f2fde38b11610064578063f2fde38b14610572578063f8e1734c14610592578063faaebd21146105b2578063fd9be522146105df57600080fd5b8063c28e0eed14610512578063d15b0d4914610532578063f0f442601461055257600080fd5b806389b69dec116100bb57806389b69dec146104935780638da5cb5b146104c7578063c14c4349146104f257600080fd5b80636750cd4c1461042e5780636d26e5d01461045e578063715018a61461047e57600080fd5b806343ea4fa91161014357806352d2871f1161011d57806352d2871f146103a757806354fd4d50146103d457806361d027b31461040157600080fd5b806343ea4fa9146102e55780634d3a0f7c146103055780634d9632001461031857600080fd5b806329460b0b1161017457806329460b0b1461026157806339e3f9381461028357806340a7bb10146102b057600080fd5b806302bd97431461019b5780630f8355c0146101f9578063188183f414610234575b600080fd5b3480156101a757600080fd5b506101cf7f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561020557600080fd5b506102266102143660046144a7565b60066020526000908152604090205481565b6040519081526020016101f0565b34801561024057600080fd5b5061025461024f3660046144f6565b6105ff565b6040516101f0919061452f565b34801561026d57600080fd5b5061028161027c366004614562565b61070c565b005b34801561028f57600080fd5b506102a361029e3660046144f6565b6108f1565b6040516101f0919061469b565b3480156102bc57600080fd5b506102d06102cb366004614702565b610a93565b604080519283526020830191909152016101f0565b3480156102f157600080fd5b506102a36103003660046144f6565b610ab8565b6102816103133660046147d0565b610e72565b34801561032457600080fd5b506103766103333660046144f6565b600460209081526000928352604080842090915290825290205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016101f0565b3480156103b357600080fd5b506103c76103c23660046148c4565b611080565b6040516101f09190614971565b3480156103e057600080fd5b506040805160038152600060208201526001918101919091526060016101f0565b34801561040d57600080fd5b506003546101cf9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561043a57600080fd5b5061044e6104493660046144a7565b611125565b60405190151581526020016101f0565b34801561046a57600080fd5b50610281610479366004614984565b611130565b34801561048a57600080fd5b50610281611209565b34801561049f57600080fd5b506101cf7f000000000000000000000000000000000000000000000000000000000000000081565b3480156104d357600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166101cf565b3480156104fe57600080fd5b5061028161050d3660046149ae565b61121d565b34801561051e57600080fd5b5061028161052d366004614a11565b611395565b34801561053e57600080fd5b5061028161054d366004614a2e565b611417565b34801561055e57600080fd5b5061028161056d366004614a11565b61149e565b34801561057e57600080fd5b5061028161058d366004614a11565b6114b2565b34801561059e57600080fd5b506102816105ad366004614a47565b611566565b3480156105be57600080fd5b506102266105cd366004614a11565b60056020526000908152604090205481565b3480156105eb57600080fd5b506102816105fa366004614ab8565b611667565b604080518082019091526000808252602082015263ffffffff80831660008181527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916845260048352818420948452939091528120805492939092169081900361069057825463ffffffff16610692565b805b63ffffffff1684528154640100000000900473ffffffffffffffffffffffffffffffffffffffff16806106e4578354640100000000900473ffffffffffffffffffffffffffffffffffffffff166106e6565b805b73ffffffffffffffffffffffffffffffffffffffff166020860152509295945050505050565b6107146116cd565b60005b818110156108b3573683838381811061073257610732614ad6565b90506020028101906107449190614b05565b905060ff6107556020830183614b43565b610766906040810190602001614b88565b60ff16036107a0576040517f83aa17da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff6107af6020830183614b43565b6107c0906060810190604001614b88565b60ff16036107fa576040517f4221136600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff6108106020830183614b43565b61081e906020810190614ba3565b67ffffffffffffffff160361085f576040517f503667ae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61087d61086f6020830183614b43565b61087890614d90565b61174e565b6108aa600061088f60208401846144a7565b61089c6020850185614b43565b6108a590614d90565b61179f565b50600101610717565b507faaf3aaa0c11056e86ac56eb653e25b005ca1a7d4dcd21ba24647f7ab63f3b56082826040516108e5929190614e4e565b60405180910390a15050565b6040805160c0810182526000808252602082018190529181018290526060808201929092526080810182905260a081019190915273ffffffffffffffffffffffffffffffffffffffff8316600090815260016020818152604080842063ffffffff87168552825292839020835160c081018552815467ffffffffffffffff8116825260ff680100000000000000008204811683860152690100000000000000000082048116838801526a01000000000000000000009091041660608201529281018054855181850281018501909652808652939491936080860193830182828015610a1257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116109e7575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610a8157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610a56575b50505050508152505090505b92915050565b600080610aa88861ffff8b1688888888611b33565b9150915097509795505050505050565b6040805160c0810182526000808252602080830182905282840182905260608084018390526080840181905260a084015263ffffffff85168083527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49825284832073ffffffffffffffffffffffffffffffffffffffff88168452600183528584209184529152929020805491929167ffffffffffffffff1680610b6857825467ffffffffffffffff168452610b87565b67ffffffffffffffff81811614610b875767ffffffffffffffff811684525b815468010000000000000000900460ff16610c3d57825468010000000000000000900460ff1615610c385782600101805480602002602001604051908101604052809291908181526020018280548015610c1757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610bec575b50505050506080850152825468010000000000000000900460ff1660208501525b610cdb565b815468010000000000000000900460ff90811614610cdb5781600101805480602002602001604051908101604052809291908181526020018280548015610cba57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610c8f575b50505050506080850152815468010000000000000000900460ff1660208501525b81546901000000000000000000900460ff16610daa5782546901000000000000000000900460ff1615610da55782600201805480602002602001604051908101604052809291908181526020018280548015610d6d57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d42575b505050505060a0850152825460ff69010000000000000000008204811660408701526a01000000000000000000009091041660608501525b610e60565b81546901000000000000000000900460ff90811614610e605781600201805480602002602001604051908101604052809291908181526020018280548015610e2857602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dfd575b505050505060a0850152815460ff69010000000000000000008204811660408701526a01000000000000000000009091041660608501525b610e698461174e565b50505092915050565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff163314610ee1576040517f467409c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080610ef48d8c8c8c8c8c8a8a611c39565b909250905061ffff8b168d600073ffffffffffffffffffffffffffffffffffffffff881615801590610f3d575060075473ffffffffffffffffffffffffffffffffffffffff1615155b9050600080610f4e84868886611ce6565b9092509050610f5d828761501f565b955085341015610f99576040517f645f0f4f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610fa58734615032565b90508015610fb757610fb78c82611e75565b811561102c578473ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1614611022576040517f5dc90ccd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61102c8583611f80565b7f3dc6f2ede34d1db05729bbb76e5efd17ec1bc83f98f665e7fba0596dca438b96888b8b8a8660405161106395949392919061508e565b60405180910390a150505050505050505050505050505050505050565b6060600182036110be57611098838561ffff166105ff565b6040516020016110a8919061452f565b604051602081830303815290604052905061111e565b600282036110e4576110d4838561ffff16610ab8565b6040516020016110a8919061469b565b6040517f0c509b5b000000000000000000000000000000000000000000000000000000008152600481018390526024015b60405180910390fd5b9392505050565b6000610a8d82612043565b6111386116cd565b6020811115611173576040517f6f85e1b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff8216600090815260066020526040902054156111be576040517fe4df7bef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff8216600081815260066020908152604091829020849055815192835282018390527ee9ab3709e58edd0db46318d63673d8ae4681fa3e51d9f9dc07cde5109ff74891016108e5565b6112116116cd565b61121b60006120aa565b565b6112256116cd565b60005b81811015611363573683838381811061124357611243614ad6565b60609081029290920192506000916112619150830160408401614a11565b73ffffffffffffffffffffffffffffffffffffffff16036112ae576040517f20e9d05a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112be60408201602083016144a7565b63ffffffff166000036112fd576040517f49cfac4300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808052600460209081528201907f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec9061133883856144a7565b63ffffffff168152602081019190915260400160002061135882826150c9565b505050600101611228565b507f2b001e1c6683bf79cc52891bd7215b204c787d18134fc7f3d21b4f32a49e47de82826040516108e5929190615161565b61139d6116cd565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fd476ec5ec1ac11cec3714d41e7ea49419471aceb9bd0dff1becfc3e363a62396906020015b60405180910390a150565b61141f6116cd565b600254811115611469576002546040517f34084fb8000000000000000000000000000000000000000000000000000000008152611115918391600401918252602082015260400190565b60028190556040518181527f491ff913b5444f4136b0d4075f020cfe3a5f60de926ec0b091612401a22b78429060200161140c565b6114a66116cd565b6114af8161211f565b50565b6114ba6116cd565b73ffffffffffffffffffffffffffffffffffffffff811661155d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401611115565b6114af816120aa565b7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1633146115d5576040517f467409c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115e28561ffff16612192565b600183036116095761160461ffff8616856115ff848601866151ee565b6121d9565b611660565b6002830361162b5761160461ffff8616856116268486018661524d565b612293565b6040517f0c509b5b00000000000000000000000000000000000000000000000000000000815260048101849052602401611115565b5050505050565b611670816122dc565b61167a8282611e75565b6040805133815273ffffffffffffffffffffffffffffffffffffffff841660208201529081018290527f820b7fd51bf79c54350bab98400651b3314ff6e79b33528821871d94a6669883906060016108e5565b60005473ffffffffffffffffffffffffffffffffffffffff16331461121b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611115565b602081015160ff161580156117685750606081015160ff16155b156114af576040517fce2c375100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602081015160ff90811614806117ba5750602081015160ff16155b1561180157608081015151156117fc576040517f83aa17da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611880565b806020015160ff1681608001515114158061183c57506002611825600160ff615282565b61182f919061529b565b60ff16816020015160ff16115b15611873576040517f83aa17da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118808160800151612346565b604081015160ff908116148061189b5750604081015160ff16155b156119215760a081015151156118dd576040517f4221136600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606081015160ff161561191c576040517f38682fa900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6119f8565b806040015160ff168160a001515114158061195c57506002611945600160ff615282565b61194f919061529b565b60ff16816040015160ff16115b15611993576040517f4221136600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606081015160ff1615806119b45750806040015160ff16816060015160ff16115b156119eb576040517f38682fa900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6119f88160a00151612346565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020818152604080842063ffffffff87168552825292839020845181548684015195870151606088015167ffffffffffffffff9093167fffffffffffffffffffffffffffffffffffffffffffffff000000000000000000909216919091176801000000000000000060ff97881602177fffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffffffff166901000000000000000000918716919091027fffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffff16176a0100000000000000000000959091169490940293909317835560808401518051859493611b0f939085019201906143ff565b5060a08201518051611b2b9160028401916020909101906143ff565b505050505050565b600080600080611b4386866123e0565b915091506000611b548b8b846123f9565b90506000611b628c8c6105ff565b9050611b788a826000015163ffffffff1661240e565b806020015173ffffffffffffffffffffffffffffffffffffffff1663709eb6648c8e8d886040518563ffffffff1660e01b8152600401611bbb94939291906152e4565b602060405180830381865afa158015611bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bfc919061532f565b611c06908361501f565b9150600080611c178e8e868e612456565b9092509050611c26828561501f565b9e909d509b505050505050505050505050565b6060600080611c4c8b8b8b8b8b8b61259a565b9050600080611c5b87876123e0565b915091506000611c6f8e8e61ffff166105ff565b60c085015151815191925090611c8c90829063ffffffff1661240e565b611ca582602001518660600151876040015184886128ab565b611caf908761501f565b9550600080611cbe87866129e4565b9092509050611ccd828961501f565b9750809850505050505050509850989650505050505050565b600354600090819073ffffffffffffffffffffffffffffffffffffffff1615611e6c5760405173ffffffffffffffffffffffffffffffffffffffff8716602482015263ffffffff8616604482015260648101859052831515608482015260009060a401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd51c5486000000000000000000000000000000000000000000000000000000001790526003549192506000918291611e109173ffffffffffffffffffffffffffffffffffffffff16907f0000000000000000000000000000000000000000000000000000000000000000908490876129ff565b91509150611e2087878484612ab0565b90955093508415611e685760035473ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604081208054879290611e6290849061501f565b90915550505b5050505b94509492505050565b73ffffffffffffffffffffffffffffffffffffffff8216611ec2576040517f6b7a931000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611f1c576040519150601f19603f3d011682016040523d82523d6000602084013e611f21565b606091505b5050905080611f7b576040517f465bc83400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101839052604401611115565b505050565b6007546003546040517f7da56b4b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201528483166024820152604481018490526064810184905290821660848201527f000000000000000000000000000000000000000000000000000000000000000090911690637da56b4b9060a401600060405180830381600087803b15801561202f57600080fd5b505af1158015611b2b573d6000803e3d6000fd5b63ffffffff811660009081527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4960205260408120805468010000000000000000900460ff1615158061111e5750546a0100000000000000000000900460ff16151592915050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f9060200161140c565b61219b81612043565b6114af576040517ff0c10d0400000000000000000000000000000000000000000000000000000000815263ffffffff82166004820152602401611115565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260046020908152604080832063ffffffff8089168552908352928190208551815493870151909516640100000000027fffffffffffffffff0000000000000000000000000000000000000000000000009093169490931693909317179055517f779cb2dd9d2bb1be1737d05435d744facbfb84a2a4912e21379d39beddcdc8059061228690849086908590615348565b60405180910390a1505050565b61229e82848361179f565b6122a88284610ab8565b507f82118522aa536ac0e96cc5c689407ae42b89d592aa133890a01f1509842f5081828483604051612286939291906153a4565b3360009081526005602052604090205480821115612330576040517f34084fb80000000000000000000000000000000000000000000000000000000081526004810183905260248101829052604401611115565b3360009081526005602052604090209190039055565b6000805b8251811015611f7b57600083828151811061236757612367614ad6565b602002602001015190508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16116123d6576040517f447516e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b915060010161234a565b6060806123ed8484612b2b565b915091505b9250929050565b6000612406848484612c18565b949350505050565b80821115612452576040517fc667af3e0000000000000000000000000000000000000000000000000000000081526004810183905260248101829052604401611115565b5050565b600354600090819073ffffffffffffffffffffffffffffffffffffffff1615611e6c5760405173ffffffffffffffffffffffffffffffffffffffff8716602482015263ffffffff8616604482015260648101859052831515608482015260009060a401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd424422100000000000000000000000000000000000000000000000000000000179052600354919250600091829161257e9173ffffffffffffffffffffffffffffffffffffffff16907f00000000000000000000000000000000000000000000000000000000000000009086612c92565b9150915061258e87878484612ab0565b94509450505050611e6c565b6040805160e0810182526000808252602080830182905282840182905260608084018390526080840183905260a0840183905260c084015261ffff891682526006905291822054909181900361261c576040517fefa83a1300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61262888878784612d3f565b6040517f6fe7b67300000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001690636fe7b673906126a3908b908d908c908c906004016153df565b6020604051808303816000875af11580156126c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e69190615419565b905060006126fe6126f984838a8c615436565b612dff565b6040805160c085901b7fffffffffffffffff000000000000000000000000000000000000000000000000166020808301919091527f000000000000000000000000000000000000000000000000000000000000000060e090811b7fffffffff0000000000000000000000000000000000000000000000000000000016602884015273ffffffffffffffffffffffffffffffffffffffff8f16602c8401528d901b7dffff0000000000000000000000000000000000000000000000000000000016604c830152605080830185905283518084039091018152607090920190925280519101209091506040518060e001604052808467ffffffffffffffff1681526020017f000000000000000000000000000000000000000000000000000000000000000063ffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b61ffff1663ffffffff16815260200183815260200182815260200188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152509b9a5050505050505050505050565b6040517f717e8a4200000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff87169063717e8a42906129069088908890889088906004016152e4565b6020604051808303816000875af1158015612925573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612949919061532f565b9050801561298c5773ffffffffffffffffffffffffffffffffffffffff86166000908152600560205260408120805483929061298690849061501f565b90915550505b6040805173ffffffffffffffffffffffffffffffffffffffff88168152602081018390527f61ed099e74a97a1d7f8bb0952a88ca8b7b8ebd00c126ea04671f92a81213318a910160405180910390a195945050505050565b600060606129f460058585612e59565b909590945092505050565b60006060863b808303612a2657604080516000808252602082019092529250925050612aa6565b60008060008761ffff1667ffffffffffffffff811115612a4857612a48614bc0565b6040519080825280601f01601f191660200182016040528015612a72576020820181803683370190505b509050600080885160208a018c8f8ff191503d925087831115612a93578792505b828152826000602083013e909450925050505b9550959350505050565b600080831580612ac1575082516020115b15612ad157506000905080611e6c565b600083806020019051810190612ae7919061532f565b90508515612af757809150612b21565b60006002548811612b0a57600254612b0c565b875b9050808211612b1b5781612b1d565b805b9350505b5094509492505050565b606080600080612b3b8686612fb5565b915091508051600003612b9357604080516000808252602082019092528391612b87565b604080518082019091526000815260606020820152815260200190600190039081612b5f5790505b509350935050506123f2565b604080516001808252818301909252600091816020015b604080518082019091526000815260606020820152815260200190600190039081612baa5790505090506040518060400160405280600260ff1681526020018381525081600081518110612c0057612c00614ad6565b60209081029190910101529196919550909350505050565b600080612c258585610ab8565b905060008351600014612c565783600081518110612c4557612c45614ad6565b602002602001015160200151612c67565b604051806020016040528060008152505b9050600080612c75836131f6565b91509150612c8684888a858561349a565b98975050505050505050565b60006060853b808303612cb957604080516000808252602082019092529250925050611e6c565b60008060008761ffff1667ffffffffffffffff811115612cdb57612cdb614bc0565b6040519080825280601f01601f191660200182016040528015612d05576020820181803683370190505b509050600080885160208a018d8dfa91503d925087831115612d25578792505b828152826000602083013e90999098509650505050505050565b612d4a81601461501f565b8214612d82576040517fefa83a1300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612d98612d9384848188615436565b613658565b90508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611660576040517fc1c149b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020821115612e3c576040517f6281faa200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612e468284615460565b6020929092036008029190911c92915050565b600060606000612e68856136a8565b90506000612e758661378e565b805160208201206060880151604089015192935090916000612e978284610ab8565b905060008951600014612ec85789600081518110612eb757612eb7614ad6565b602002602001015160200151612ed9565b604051806020016040528060008152505b90506060612f398d846040518060a001604052808963ffffffff1681526020018c81526020018a8152602001876000015167ffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff16815250856137ab565b604051919b509150612f51908990899060200161549c565b60405160208183030381529060405298507f07ea52d82345d6e838192107d8fd7123d9c2ec8e916cd0aad13fd2b60db2464483608001518460a0015183604051612f9d939291906154cb565b60405180910390a15050505050505050935093915050565b6060806002831015612ff6576040517f6592671c00000000000000000000000000000000000000000000000000000000815260006004820152602401611115565b60006130056002828688615436565b61300e91615529565b60f01c905060027ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd82016131df578060005b8683101561316b57600061305960018501858a8c615436565b61306291615571565b60f81c905060008190036130a5576040517f6780cfaf00000000000000000000000000000000000000000000000000000000815260006004820152602401611115565b8160ff166000036130b8578091506130f5565b8160ff168160ff16146130f5573660006130d486868c8e615436565b915091506130e58989868585613a97565b9099509750859450919250829150505b600184019360009061310c90600301868b8d615436565b61311591615529565b60f01c90506000819003613158576040517f6592671c00000000000000000000000000000000000000000000000000000000815260048101869052602401611115565b8060020161ffff16850194505050613040565b8287146131a7576040517f6592671c00000000000000000000000000000000000000000000000000000000815260048101849052602401611115565b60028711156131d8573660006131bf85858b8d615436565b915091506131d08888858585613a97565b909850965050505b50506131ed565b6131ea828787613c0c565b93505b50509250929050565b606080825160000361320757915091565b600061321284613e8b565b90508060ff166001036132c45760408051600180825281830190925290816020015b6060815260200190600190039081613234579050509250838360008151811061325f5761325f614ad6565b602090810291909101015260408051600180825281830190925290816020016020820280368337019050509150613297846003613fb0565b826000815181106132aa576132aa614ad6565b602002602001019060ff16908160ff168152505050915091565b8060ff1667ffffffffffffffff8111156132e0576132e0614bc0565b604051908082528060200260200182016040528015613309578160200160208202803683370190505b5091508060ff1667ffffffffffffffff81111561332857613328614bc0565b60405190808252806020026020018201604052801561335b57816020015b60608152602001906001900390816133465790505b50925060008060ff5b865183101561340f57600190920191600061337f8885614030565b60029490940193905060006133948986613fb0565b90508260ff1660ff036133a957809250613400565b8260ff168160ff1614613400577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8486030160006133e88b87846140b0565b90506133f68a8a878461422a565b5093909301929150815b5061ffff169290920191613364565b818303600061341f8985846140b0565b905061342d8888858461422a565b60005b8660ff168160ff16101561348e57878160ff168151811061345357613453614ad6565b6020908102919091010180517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0160ff169052600101613430565b50505050505050915091565b600080866040015187602001516134b191906155b7565b905060005b8160ff168160ff16101561364d576000886020015160ff168260ff161061350b5760a089015160208a01516134eb9084615282565b60ff16815181106134fe576134fe614ad6565b602002602001015161352d565b88608001518260ff168151811061352457613524614ad6565b60200260200101515b60408051602081019091526000808252919250905b865181101561359a578360ff1687828151811061356157613561614ad6565b602002602001015160ff16036135925787818151811061358357613583614ad6565b6020026020010151915061359a565b600101613542565b5089516040517f30bb3aac00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416916330bb3aac916135f3918d918d9087906004016155d0565b602060405180830381865afa158015613610573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613634919061532f565b61363e908661501f565b945050508060010190506134b6565b505095945050505050565b600060148214613694576040517f6281faa200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61369e828461561b565b60601c9392505050565b8051602080830151604080850151606080870151608088015193517f01000000000000000000000000000000000000000000000000000000000000009681019690965260c09690961b7fffffffffffffffff00000000000000000000000000000000000000000000000016602186015260e093841b7fffffffff00000000000000000000000000000000000000000000000000000000908116602987015273ffffffffffffffffffffffffffffffffffffffff909216602d8601529490921b909116604d83015260518201526071015b6040516020818303038152906040529050919050565b60608160a001518260c00151604051602001613778929190615661565b600060606000806137bb856131f6565b915091506000876040015188602001516137d591906155b7565b90508060ff1667ffffffffffffffff8111156137f3576137f3614bc0565b60405190808252806020026020018201604052801561381c578160200160208202803683370190505b50935060005b8160ff168160ff161015613a8a576000896020015160ff168260ff16106138775760a08a015160208b01516138579084615282565b60ff168151811061386a5761386a614ad6565b6020026020010151613899565b89608001518260ff168151811061389057613890614ad6565b60200260200101515b60408051602081019091526000808252919250905b8551811015613906578360ff168682815181106138cd576138cd614ad6565b602002602001015160ff16036138fe578681815181106138ef576138ef614ad6565b60200260200101519150613906565b6001016138ae565b506040517f95d376d700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316906395d376d79061395b908d908590600401615687565b6020604051808303816000875af115801561397a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399e919061532f565b878460ff16815181106139b3576139b3614ad6565b6020026020010181815250506000878460ff16815181106139d6576139d6614ad6565b60200260200101511115613a8057868360ff16815181106139f9576139f9614ad6565b60200260200101518c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613a4e919061501f565b92505081905550868360ff1681518110613a6a57613a6a614ad6565b602002602001015188613a7d919061501f565b97505b5050600101613822565b5050505094509492505050565b6060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ff861601613b3257865115613af457868484604051602001613ae093929190615705565b604051602081830303815290604052613b2b565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050505b9650613c01565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe60ff861601613bca57855115613b8c57858484604051602001613b7893929190615705565b604051602081830303815290604052613bc3565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050505b9550613c01565b6040517f6780cfaf00000000000000000000000000000000000000000000000000000000815260ff86166004820152602401611115565b509495939450505050565b60607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61ffff851601613d325760228214613c73576040517f0dc652a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613c94613c86602260028688615436565b613c8f91615460565b614359565b6040517f0100000000000000000000000000000000000000000000000000000000000000602082018190527e11000000000000000000000000000000000000000000000000000000000000602183015260238201527fffffffffffffffffffffffffffffffff00000000000000000000000000000000608083901b16602482015290915060340160405160208183030381529060405291505061111e565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe61ffff851601613e5357604282111580613d6d5750606282115b15613da4576040517fc0927c5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613db7613c86602260028688615436565b90506000613dcc613c86604260228789615436565b905060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbe8501613e00866042818a615436565b613e0991615460565b60405160086020938403029190911c9250613e3a916001916011918391889183916031916002918b918b910161572d565b604051602081830303815290604052935050505061111e565b6040517f4170513000000000000000000000000000000000000000000000000000000000815261ffff85166004820152602401611115565b600080805b8351821015613f6c576001909101906000613eab8584614030565b905060028301925060028161ffff161015613ef5576040517f04eb6e0c00000000000000000000000000000000000000000000000000000000815260048101849052602401611115565b6000613f018685613fb0565b90508060ff1660ff03613f40576040517fd3d3d9bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160ff82161b8316613f5d5760019485019460ff82161b831792505b5061ffff169190910190613e90565b83518214613fa9576040517f04eb6e0c00000000000000000000000000000000000000000000000000000000815260048101839052602401611115565b5050919050565b6000613fbd82600161501f565b83511015614027576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152606401611115565b50016001015190565b600061403d82600261501f565b835110156140a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7431365f6f75744f66426f756e64730000000000000000000000006044820152606401611115565b50016002015190565b6060816140be81601f61501f565b1015614126576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401611115565b614130828461501f565b8451101561419a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606401611115565b6060821580156141b95760405191506000825260208201604052614221565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156141f25780518352602092830192016141da565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b8160ff1660ff03614267576040517fd3d3d9bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006142748360016155b7565b905060005b8451811015611b2b57600085828151811061429657614296614ad6565b602002602001015190508060ff168360ff160361430b578682815181106142bf576142bf614ad6565b6020026020010151846040516020016142d992919061549c565b6040516020818303038152906040528783815181106142fa576142fa614ad6565b602002602001018190525050611b2b565b8060ff16600003614350578286838151811061432957614329614ad6565b602002602001019060ff16908160ff1681525050838783815181106142fa576142fa614ad6565b50600101614279565b60006fffffffffffffffffffffffffffffffff8211156143fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f32382062697473000000000000000000000000000000000000000000000000006064820152608401611115565b5090565b828054828255906000526020600020908101928215614479579160200282015b8281111561447957825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617825560209092019160019091019061441f565b506143fb9291505b808211156143fb5760008155600101614481565b63ffffffff811681146114af57600080fd5b6000602082840312156144b957600080fd5b813561111e81614495565b73ffffffffffffffffffffffffffffffffffffffff811681146114af57600080fd5b80356144f1816144c4565b919050565b6000806040838503121561450957600080fd5b8235614514816144c4565b9150602083013561452481614495565b809150509250929050565b815163ffffffff16815260208083015173ffffffffffffffffffffffffffffffffffffffff169082015260408101610a8d565b6000806020838503121561457557600080fd5b823567ffffffffffffffff8082111561458d57600080fd5b818501915085601f8301126145a157600080fd5b8135818111156145b057600080fd5b8660208260051b85010111156145c557600080fd5b60209290920196919550909350505050565b60008151808452602080850194506020840160005b8381101561461e57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016145ec565b509495945050505050565b67ffffffffffffffff815116825260ff602082015116602083015260ff604082015116604083015260ff60608201511660608301526000608082015160c0608085015261467960c08501826145d7565b905060a083015184820360a086015261469282826145d7565b95945050505050565b60208152600061111e6020830184614629565b803561ffff811681146144f157600080fd5b60008083601f8401126146d257600080fd5b50813567ffffffffffffffff8111156146ea57600080fd5b6020830191508360208285010111156123f257600080fd5b600080600080600080600060a0888a03121561471d57600080fd5b614726886146ae565b96506020880135614736816144c4565b9550604088013567ffffffffffffffff8082111561475357600080fd5b61475f8b838c016146c0565b909750955060608a01359150811515821461477957600080fd5b9093506080890135908082111561478f57600080fd5b5061479c8a828b016146c0565b989b979a50959850939692959293505050565b67ffffffffffffffff811681146114af57600080fd5b80356144f1816147af565b60008060008060008060008060008060006101008c8e0312156147f257600080fd5b6147fb8c6144e6565b9a5061480960208d016147c5565b995061481760408d016146ae565b985067ffffffffffffffff8060608e0135111561483357600080fd5b6148438e60608f01358f016146c0565b909950975060808d013581101561485957600080fd5b6148698e60808f01358f016146c0565b909750955061487a60a08e016144e6565b945061488860c08e016144e6565b93508060e08e0135111561489b57600080fd5b506148ac8d60e08e01358e016146c0565b81935080925050509295989b509295989b9093969950565b6000806000606084860312156148d957600080fd5b6148e2846146ae565b925060208401356148f2816144c4565b929592945050506040919091013590565b60005b8381101561491e578181015183820152602001614906565b50506000910152565b6000815180845261493f816020860160208601614903565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061111e6020830184614927565b6000806040838503121561499757600080fd5b6149a0836146ae565b946020939093013593505050565b600080602083850312156149c157600080fd5b823567ffffffffffffffff808211156149d957600080fd5b818501915085601f8301126149ed57600080fd5b8135818111156149fc57600080fd5b8660206060830285010111156145c557600080fd5b600060208284031215614a2357600080fd5b813561111e816144c4565b600060208284031215614a4057600080fd5b5035919050565b600080600080600060808688031215614a5f57600080fd5b614a68866146ae565b94506020860135614a78816144c4565b935060408601359250606086013567ffffffffffffffff811115614a9b57600080fd5b614aa7888289016146c0565b969995985093965092949392505050565b60008060408385031215614acb57600080fd5b82356149a0816144c4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112614b3957600080fd5b9190910192915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff41833603018112614b3957600080fd5b803560ff811681146144f157600080fd5b600060208284031215614b9a57600080fd5b61111e82614b77565b600060208284031215614bb557600080fd5b813561111e816147af565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715614c1257614c12614bc0565b60405290565b600082601f830112614c2957600080fd5b8135602067ffffffffffffffff80831115614c4657614c46614bc0565b8260051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108482111715614c8957614c89614bc0565b6040529384526020818701810194908101925087851115614ca957600080fd5b6020870191505b84821015614cd2578135614cc3816144c4565b83529183019190830190614cb0565b979650505050505050565b600060c08284031215614cef57600080fd5b614cf7614bef565b9050614d02826147c5565b8152614d1060208301614b77565b6020820152614d2160408301614b77565b6040820152614d3260608301614b77565b6060820152608082013567ffffffffffffffff80821115614d5257600080fd5b614d5e85838601614c18565b608084015260a0840135915080821115614d7757600080fd5b50614d8484828501614c18565b60a08301525092915050565b6000610a8d3683614cdd565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614dd157600080fd5b830160208101925035905067ffffffffffffffff811115614df157600080fd5b8060051b36038213156123f257600080fd5b8183526000602080850194508260005b8581101561461e578135614e26816144c4565b73ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614e13565b60208082528181018390526000906040808401600586901b8501820187855b88811015614fe2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08089850301855282357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18c3603018112614ecf57600080fd5b8b018035614edc81614495565b63ffffffff16855280880135368290037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff41018112614f1957600080fd5b858901889052018035614f2b816147af565b67ffffffffffffffff1685880152614f44818901614b77565b606060ff80831682890152614f5a8a8501614b77565b92506080818416818a0152614f70838601614b77565b935060a09250818416838a0152614f8981860186614d9c565b60c08b81015294509150614fa4905061010089018483614e03565b925050614fb381840184614d9c565b93509050838783030160e0880152614fcc828483614e03565b978a019796505050928701925050600101614e6d565b509098975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610a8d57610a8d614ff0565b81810381811115610a8d57610a8d614ff0565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6080815260006150a16080830188614927565b82810360208401526150b4818789615045565b60408401959095525050606001529392505050565b81356150d481614495565b63ffffffff811690508154817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000082161783556020840135615114816144c4565b77ffffffffffffffffffffffffffffffffffffffff000000008160201b16837fffffffffffffffff0000000000000000000000000000000000000000000000008416171784555050505050565b6020808252818101839052600090604080840186845b878110156151e157813561518a81614495565b63ffffffff908116845282860135906151a282614495565b1683860152818401356151b4816144c4565b73ffffffffffffffffffffffffffffffffffffffff16838501526060928301929190910190600101615177565b5090979650505050505050565b60006040828403121561520057600080fd5b6040516040810181811067ffffffffffffffff8211171561522357615223614bc0565b604052823561523181614495565b81526020830135615241816144c4565b60208201529392505050565b60006020828403121561525f57600080fd5b813567ffffffffffffffff81111561527657600080fd5b61240684828501614cdd565b60ff8281168282160390811115610a8d57610a8d614ff0565b600060ff8316806152d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8060ff84160491505092915050565b63ffffffff8516815273ffffffffffffffffffffffffffffffffffffffff841660208201528260408201526080606082015260006153256080830184614927565b9695505050505050565b60006020828403121561534157600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff83166020820152608081016124066040830184805163ffffffff16825260209081015173ffffffffffffffffffffffffffffffffffffffff16910152565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff831660208201526060604082015260006146926060830184614629565b61ffff8516815273ffffffffffffffffffffffffffffffffffffffff84166020820152606060408201526000615325606083018486615045565b60006020828403121561542b57600080fd5b815161111e816147af565b6000808585111561544657600080fd5b8386111561545357600080fd5b5050820193919092039150565b80356020831015610a8d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b600083516154ae818460208801614903565b8351908301906154c2818360208801614903565b01949350505050565b6060815260006154de60608301866145d7565b602083820360208501526154f282876145d7565b84810360408601528551808252602080880194509091019060005b81811015614fe25784518352938301939183019160010161550d565b7fffff00000000000000000000000000000000000000000000000000000000000081358181169160028510156155695780818660020360031b1b83161692505b505092915050565b7fff0000000000000000000000000000000000000000000000000000000000000081358181169160018510156155695760019490940360031b84901b1690921692915050565b60ff8181168382160190811115610a8d57610a8d614ff0565b63ffffffff8516815267ffffffffffffffff8416602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006153256080830184614927565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081358181169160148510156155695760149490940360031b84901b1690921692915050565b82815260008251615679816020850160208701614903565b919091016020019392505050565b6040815263ffffffff83511660408201526000602084015160a060608401526156b360e0840182614927565b90506040850151608084015267ffffffffffffffff60608601511660a084015273ffffffffffffffffffffffffffffffffffffffff60808601511660c084015282810360208401526146928185614927565b60008451615717818460208901614903565b8201838582376000930192835250909392505050565b60007fff00000000000000000000000000000000000000000000000000000000000000808c60f81b1683527fffff000000000000000000000000000000000000000000000000000000000000808c60f01b166001850152818b60f81b1660038501527fffffffffffffffffffffffffffffffff000000000000000000000000000000008a60801b166004850152818960f81b166014850152808860f01b16601585015250808660f81b1660178401525061580e601883018560801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000169052565b5060288101919091526048019897505050505050505056fea2646970667358221220abc6a1f4c7f02e4cc85ec6c01abfcdb8ca7e00eb209be79ae92e7ac1c048019064736f6c63430008160033000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd70000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000019945ca26200000000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000c614e9c511a5149f1969f2cb0199d508bbb5b915
Deployed Bytecode
0x6080604052600436106101965760003560e01c80636750cd4c116100e1578063c28e0eed1161008a578063f2fde38b11610064578063f2fde38b14610572578063f8e1734c14610592578063faaebd21146105b2578063fd9be522146105df57600080fd5b8063c28e0eed14610512578063d15b0d4914610532578063f0f442601461055257600080fd5b806389b69dec116100bb57806389b69dec146104935780638da5cb5b146104c7578063c14c4349146104f257600080fd5b80636750cd4c1461042e5780636d26e5d01461045e578063715018a61461047e57600080fd5b806343ea4fa91161014357806352d2871f1161011d57806352d2871f146103a757806354fd4d50146103d457806361d027b31461040157600080fd5b806343ea4fa9146102e55780634d3a0f7c146103055780634d9632001461031857600080fd5b806329460b0b1161017457806329460b0b1461026157806339e3f9381461028357806340a7bb10146102b057600080fd5b806302bd97431461019b5780630f8355c0146101f9578063188183f414610234575b600080fd5b3480156101a757600080fd5b506101cf7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67581565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b34801561020557600080fd5b506102266102143660046144a7565b60066020526000908152604090205481565b6040519081526020016101f0565b34801561024057600080fd5b5061025461024f3660046144f6565b6105ff565b6040516101f0919061452f565b34801561026d57600080fd5b5061028161027c366004614562565b61070c565b005b34801561028f57600080fd5b506102a361029e3660046144f6565b6108f1565b6040516101f0919061469b565b3480156102bc57600080fd5b506102d06102cb366004614702565b610a93565b604080519283526020830191909152016101f0565b3480156102f157600080fd5b506102a36103003660046144f6565b610ab8565b6102816103133660046147d0565b610e72565b34801561032457600080fd5b506103766103333660046144f6565b600460209081526000928352604080842090915290825290205463ffffffff811690640100000000900473ffffffffffffffffffffffffffffffffffffffff1682565b6040805163ffffffff909316835273ffffffffffffffffffffffffffffffffffffffff9091166020830152016101f0565b3480156103b357600080fd5b506103c76103c23660046148c4565b611080565b6040516101f09190614971565b3480156103e057600080fd5b506040805160038152600060208201526001918101919091526060016101f0565b34801561040d57600080fd5b506003546101cf9073ffffffffffffffffffffffffffffffffffffffff1681565b34801561043a57600080fd5b5061044e6104493660046144a7565b611125565b60405190151581526020016101f0565b34801561046a57600080fd5b50610281610479366004614984565b611130565b34801561048a57600080fd5b50610281611209565b34801561049f57600080fd5b506101cf7f000000000000000000000000c614e9c511a5149f1969f2cb0199d508bbb5b91581565b3480156104d357600080fd5b5060005473ffffffffffffffffffffffffffffffffffffffff166101cf565b3480156104fe57600080fd5b5061028161050d3660046149ae565b61121d565b34801561051e57600080fd5b5061028161052d366004614a11565b611395565b34801561053e57600080fd5b5061028161054d366004614a2e565b611417565b34801561055e57600080fd5b5061028161056d366004614a11565b61149e565b34801561057e57600080fd5b5061028161058d366004614a11565b6114b2565b34801561059e57600080fd5b506102816105ad366004614a47565b611566565b3480156105be57600080fd5b506102266105cd366004614a11565b60056020526000908152604090205481565b3480156105eb57600080fd5b506102816105fa366004614ab8565b611667565b604080518082019091526000808252602082015263ffffffff80831660008181527f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec6020908152604080832073ffffffffffffffffffffffffffffffffffffffff8916845260048352818420948452939091528120805492939092169081900361069057825463ffffffff16610692565b805b63ffffffff1684528154640100000000900473ffffffffffffffffffffffffffffffffffffffff16806106e4578354640100000000900473ffffffffffffffffffffffffffffffffffffffff166106e6565b805b73ffffffffffffffffffffffffffffffffffffffff166020860152509295945050505050565b6107146116cd565b60005b818110156108b3573683838381811061073257610732614ad6565b90506020028101906107449190614b05565b905060ff6107556020830183614b43565b610766906040810190602001614b88565b60ff16036107a0576040517f83aa17da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60ff6107af6020830183614b43565b6107c0906060810190604001614b88565b60ff16036107fa576040517f4221136600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b67ffffffffffffffff6108106020830183614b43565b61081e906020810190614ba3565b67ffffffffffffffff160361085f576040517f503667ae00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61087d61086f6020830183614b43565b61087890614d90565b61174e565b6108aa600061088f60208401846144a7565b61089c6020850185614b43565b6108a590614d90565b61179f565b50600101610717565b507faaf3aaa0c11056e86ac56eb653e25b005ca1a7d4dcd21ba24647f7ab63f3b56082826040516108e5929190614e4e565b60405180910390a15050565b6040805160c0810182526000808252602082018190529181018290526060808201929092526080810182905260a081019190915273ffffffffffffffffffffffffffffffffffffffff8316600090815260016020818152604080842063ffffffff87168552825292839020835160c081018552815467ffffffffffffffff8116825260ff680100000000000000008204811683860152690100000000000000000082048116838801526a01000000000000000000009091041660608201529281018054855181850281018501909652808652939491936080860193830182828015610a1257602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff1681526001909101906020018083116109e7575b5050505050815260200160028201805480602002602001604051908101604052809291908181526020018280548015610a8157602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610a56575b50505050508152505090505b92915050565b600080610aa88861ffff8b1688888888611b33565b9150915097509795505050505050565b6040805160c0810182526000808252602080830182905282840182905260608084018390526080840181905260a084015263ffffffff85168083527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb49825284832073ffffffffffffffffffffffffffffffffffffffff88168452600183528584209184529152929020805491929167ffffffffffffffff1680610b6857825467ffffffffffffffff168452610b87565b67ffffffffffffffff81811614610b875767ffffffffffffffff811684525b815468010000000000000000900460ff16610c3d57825468010000000000000000900460ff1615610c385782600101805480602002602001604051908101604052809291908181526020018280548015610c1757602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610bec575b50505050506080850152825468010000000000000000900460ff1660208501525b610cdb565b815468010000000000000000900460ff90811614610cdb5781600101805480602002602001604051908101604052809291908181526020018280548015610cba57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610c8f575b50505050506080850152815468010000000000000000900460ff1660208501525b81546901000000000000000000900460ff16610daa5782546901000000000000000000900460ff1615610da55782600201805480602002602001604051908101604052809291908181526020018280548015610d6d57602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610d42575b505050505060a0850152825460ff69010000000000000000008204811660408701526a01000000000000000000009091041660608501525b610e60565b81546901000000000000000000900460ff90811614610e605781600201805480602002602001604051908101604052809291908181526020018280548015610e2857602002820191906000526020600020905b815473ffffffffffffffffffffffffffffffffffffffff168152600190910190602001808311610dfd575b505050505060a0850152815460ff69010000000000000000008204811660408701526a01000000000000000000009091041660608501525b610e698461174e565b50505092915050565b7f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd773ffffffffffffffffffffffffffffffffffffffff163314610ee1576040517f467409c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600080610ef48d8c8c8c8c8c8a8a611c39565b909250905061ffff8b168d600073ffffffffffffffffffffffffffffffffffffffff881615801590610f3d575060075473ffffffffffffffffffffffffffffffffffffffff1615155b9050600080610f4e84868886611ce6565b9092509050610f5d828761501f565b955085341015610f99576040517f645f0f4f00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000610fa58734615032565b90508015610fb757610fb78c82611e75565b811561102c578473ffffffffffffffffffffffffffffffffffffffff168b73ffffffffffffffffffffffffffffffffffffffff1614611022576040517f5dc90ccd00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61102c8583611f80565b7f3dc6f2ede34d1db05729bbb76e5efd17ec1bc83f98f665e7fba0596dca438b96888b8b8a8660405161106395949392919061508e565b60405180910390a150505050505050505050505050505050505050565b6060600182036110be57611098838561ffff166105ff565b6040516020016110a8919061452f565b604051602081830303815290604052905061111e565b600282036110e4576110d4838561ffff16610ab8565b6040516020016110a8919061469b565b6040517f0c509b5b000000000000000000000000000000000000000000000000000000008152600481018390526024015b60405180910390fd5b9392505050565b6000610a8d82612043565b6111386116cd565b6020811115611173576040517f6f85e1b700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff8216600090815260066020526040902054156111be576040517fe4df7bef00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61ffff8216600081815260066020908152604091829020849055815192835282018390527ee9ab3709e58edd0db46318d63673d8ae4681fa3e51d9f9dc07cde5109ff74891016108e5565b6112116116cd565b61121b60006120aa565b565b6112256116cd565b60005b81811015611363573683838381811061124357611243614ad6565b60609081029290920192506000916112619150830160408401614a11565b73ffffffffffffffffffffffffffffffffffffffff16036112ae576040517f20e9d05a00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6112be60408201602083016144a7565b63ffffffff166000036112fd576040517f49cfac4300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000808052600460209081528201907f17ef568e3e12ab5b9c7254a8d58478811de00f9e6eb34345acd53bf8fd09d3ec9061133883856144a7565b63ffffffff168152602081019190915260400160002061135882826150c9565b505050600101611228565b507f2b001e1c6683bf79cc52891bd7215b204c787d18134fc7f3d21b4f32a49e47de82826040516108e5929190615161565b61139d6116cd565b600780547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527fd476ec5ec1ac11cec3714d41e7ea49419471aceb9bd0dff1becfc3e363a62396906020015b60405180910390a150565b61141f6116cd565b600254811115611469576002546040517f34084fb8000000000000000000000000000000000000000000000000000000008152611115918391600401918252602082015260400190565b60028190556040518181527f491ff913b5444f4136b0d4075f020cfe3a5f60de926ec0b091612401a22b78429060200161140c565b6114a66116cd565b6114af8161211f565b50565b6114ba6116cd565b73ffffffffffffffffffffffffffffffffffffffff811661155d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401611115565b6114af816120aa565b7f000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd773ffffffffffffffffffffffffffffffffffffffff1633146115d5576040517f467409c300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6115e28561ffff16612192565b600183036116095761160461ffff8616856115ff848601866151ee565b6121d9565b611660565b6002830361162b5761160461ffff8616856116268486018661524d565b612293565b6040517f0c509b5b00000000000000000000000000000000000000000000000000000000815260048101849052602401611115565b5050505050565b611670816122dc565b61167a8282611e75565b6040805133815273ffffffffffffffffffffffffffffffffffffffff841660208201529081018290527f820b7fd51bf79c54350bab98400651b3314ff6e79b33528821871d94a6669883906060016108e5565b60005473ffffffffffffffffffffffffffffffffffffffff16331461121b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401611115565b602081015160ff161580156117685750606081015160ff16155b156114af576040517fce2c375100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b602081015160ff90811614806117ba5750602081015160ff16155b1561180157608081015151156117fc576040517f83aa17da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b611880565b806020015160ff1681608001515114158061183c57506002611825600160ff615282565b61182f919061529b565b60ff16816020015160ff16115b15611873576040517f83aa17da00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6118808160800151612346565b604081015160ff908116148061189b5750604081015160ff16155b156119215760a081015151156118dd576040517f4221136600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606081015160ff161561191c576040517f38682fa900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6119f8565b806040015160ff168160a001515114158061195c57506002611945600160ff615282565b61194f919061529b565b60ff16816040015160ff16115b15611993576040517f4221136600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606081015160ff1615806119b45750806040015160ff16816060015160ff16115b156119eb576040517f38682fa900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6119f88160a00151612346565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260016020818152604080842063ffffffff87168552825292839020845181548684015195870151606088015167ffffffffffffffff9093167fffffffffffffffffffffffffffffffffffffffffffffff000000000000000000909216919091176801000000000000000060ff97881602177fffffffffffffffffffffffffffffffffffffffffff0000ffffffffffffffffff166901000000000000000000918716919091027fffffffffffffffffffffffffffffffffffffffffff00ffffffffffffffffffff16176a0100000000000000000000959091169490940293909317835560808401518051859493611b0f939085019201906143ff565b5060a08201518051611b2b9160028401916020909101906143ff565b505050505050565b600080600080611b4386866123e0565b915091506000611b548b8b846123f9565b90506000611b628c8c6105ff565b9050611b788a826000015163ffffffff1661240e565b806020015173ffffffffffffffffffffffffffffffffffffffff1663709eb6648c8e8d886040518563ffffffff1660e01b8152600401611bbb94939291906152e4565b602060405180830381865afa158015611bd8573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611bfc919061532f565b611c06908361501f565b9150600080611c178e8e868e612456565b9092509050611c26828561501f565b9e909d509b505050505050505050505050565b6060600080611c4c8b8b8b8b8b8b61259a565b9050600080611c5b87876123e0565b915091506000611c6f8e8e61ffff166105ff565b60c085015151815191925090611c8c90829063ffffffff1661240e565b611ca582602001518660600151876040015184886128ab565b611caf908761501f565b9550600080611cbe87866129e4565b9092509050611ccd828961501f565b9750809850505050505050509850989650505050505050565b600354600090819073ffffffffffffffffffffffffffffffffffffffff1615611e6c5760405173ffffffffffffffffffffffffffffffffffffffff8716602482015263ffffffff8616604482015260648101859052831515608482015260009060a401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd51c5486000000000000000000000000000000000000000000000000000000001790526003549192506000918291611e109173ffffffffffffffffffffffffffffffffffffffff16907f0000000000000000000000000000000000000000000000000000000000030d40908490876129ff565b91509150611e2087878484612ab0565b90955093508415611e685760035473ffffffffffffffffffffffffffffffffffffffff1660009081526005602052604081208054879290611e6290849061501f565b90915550505b5050505b94509492505050565b73ffffffffffffffffffffffffffffffffffffffff8216611ec2576040517f6b7a931000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d8060008114611f1c576040519150601f19603f3d011682016040523d82523d6000602084013e611f21565b606091505b5050905080611f7b576040517f465bc83400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101839052604401611115565b505050565b6007546003546040517f7da56b4b00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff92831660048201528483166024820152604481018490526064810184905290821660848201527f000000000000000000000000c614e9c511a5149f1969f2cb0199d508bbb5b91590911690637da56b4b9060a401600060405180830381600087803b15801561202f57600080fd5b505af1158015611b2b573d6000803e3d6000fd5b63ffffffff811660009081527fa6eef7e35abe7026729641147f7915573c7e97b47efa546f5f6e3230263bcb4960205260408120805468010000000000000000900460ff1615158061111e5750546a0100000000000000000000900460ff16151592915050565b6000805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681178455604051919092169283917f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e09190a35050565b600380547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff83169081179091556040519081527f3c864541ef71378c6229510ed90f376565ee42d9c5e0904a984a9e863e6db44f9060200161140c565b61219b81612043565b6114af576040517ff0c10d0400000000000000000000000000000000000000000000000000000000815263ffffffff82166004820152602401611115565b73ffffffffffffffffffffffffffffffffffffffff808316600090815260046020908152604080832063ffffffff8089168552908352928190208551815493870151909516640100000000027fffffffffffffffff0000000000000000000000000000000000000000000000009093169490931693909317179055517f779cb2dd9d2bb1be1737d05435d744facbfb84a2a4912e21379d39beddcdc8059061228690849086908590615348565b60405180910390a1505050565b61229e82848361179f565b6122a88284610ab8565b507f82118522aa536ac0e96cc5c689407ae42b89d592aa133890a01f1509842f5081828483604051612286939291906153a4565b3360009081526005602052604090205480821115612330576040517f34084fb80000000000000000000000000000000000000000000000000000000081526004810183905260248101829052604401611115565b3360009081526005602052604090209190039055565b6000805b8251811015611f7b57600083828151811061236757612367614ad6565b602002602001015190508273ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff16116123d6576040517f447516e100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b915060010161234a565b6060806123ed8484612b2b565b915091505b9250929050565b6000612406848484612c18565b949350505050565b80821115612452576040517fc667af3e0000000000000000000000000000000000000000000000000000000081526004810183905260248101829052604401611115565b5050565b600354600090819073ffffffffffffffffffffffffffffffffffffffff1615611e6c5760405173ffffffffffffffffffffffffffffffffffffffff8716602482015263ffffffff8616604482015260648101859052831515608482015260009060a401604080517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0818403018152919052602080820180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fd424422100000000000000000000000000000000000000000000000000000000179052600354919250600091829161257e9173ffffffffffffffffffffffffffffffffffffffff16907f0000000000000000000000000000000000000000000000000000000000030d409086612c92565b9150915061258e87878484612ab0565b94509450505050611e6c565b6040805160e0810182526000808252602080830182905282840182905260608084018390526080840183905260a0840183905260c084015261ffff891682526006905291822054909181900361261c576040517fefa83a1300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61262888878784612d3f565b6040517f6fe7b67300000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd6751690636fe7b673906126a3908b908d908c908c906004016153df565b6020604051808303816000875af11580156126c2573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906126e69190615419565b905060006126fe6126f984838a8c615436565b612dff565b6040805160c085901b7fffffffffffffffff000000000000000000000000000000000000000000000000166020808301919091527f00000000000000000000000000000000000000000000000000000000000000d660e090811b7fffffffff0000000000000000000000000000000000000000000000000000000016602884015273ffffffffffffffffffffffffffffffffffffffff8f16602c8401528d901b7dffff0000000000000000000000000000000000000000000000000000000016604c830152605080830185905283518084039091018152607090920190925280519101209091506040518060e001604052808467ffffffffffffffff1681526020017f00000000000000000000000000000000000000000000000000000000000000d663ffffffff1681526020018c73ffffffffffffffffffffffffffffffffffffffff1681526020018b61ffff1663ffffffff16815260200183815260200182815260200188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050509152509b9a5050505050505050505050565b6040517f717e8a4200000000000000000000000000000000000000000000000000000000815260009073ffffffffffffffffffffffffffffffffffffffff87169063717e8a42906129069088908890889088906004016152e4565b6020604051808303816000875af1158015612925573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612949919061532f565b9050801561298c5773ffffffffffffffffffffffffffffffffffffffff86166000908152600560205260408120805483929061298690849061501f565b90915550505b6040805173ffffffffffffffffffffffffffffffffffffffff88168152602081018390527f61ed099e74a97a1d7f8bb0952a88ca8b7b8ebd00c126ea04671f92a81213318a910160405180910390a195945050505050565b600060606129f460058585612e59565b909590945092505050565b60006060863b808303612a2657604080516000808252602082019092529250925050612aa6565b60008060008761ffff1667ffffffffffffffff811115612a4857612a48614bc0565b6040519080825280601f01601f191660200182016040528015612a72576020820181803683370190505b509050600080885160208a018c8f8ff191503d925087831115612a93578792505b828152826000602083013e909450925050505b9550959350505050565b600080831580612ac1575082516020115b15612ad157506000905080611e6c565b600083806020019051810190612ae7919061532f565b90508515612af757809150612b21565b60006002548811612b0a57600254612b0c565b875b9050808211612b1b5781612b1d565b805b9350505b5094509492505050565b606080600080612b3b8686612fb5565b915091508051600003612b9357604080516000808252602082019092528391612b87565b604080518082019091526000815260606020820152815260200190600190039081612b5f5790505b509350935050506123f2565b604080516001808252818301909252600091816020015b604080518082019091526000815260606020820152815260200190600190039081612baa5790505090506040518060400160405280600260ff1681526020018381525081600081518110612c0057612c00614ad6565b60209081029190910101529196919550909350505050565b600080612c258585610ab8565b905060008351600014612c565783600081518110612c4557612c45614ad6565b602002602001015160200151612c67565b604051806020016040528060008152505b9050600080612c75836131f6565b91509150612c8684888a858561349a565b98975050505050505050565b60006060853b808303612cb957604080516000808252602082019092529250925050611e6c565b60008060008761ffff1667ffffffffffffffff811115612cdb57612cdb614bc0565b6040519080825280601f01601f191660200182016040528015612d05576020820181803683370190505b509050600080885160208a018d8dfa91503d925087831115612d25578792505b828152826000602083013e90999098509650505050505050565b612d4a81601461501f565b8214612d82576040517fefa83a1300000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000612d98612d9384848188615436565b613658565b90508073ffffffffffffffffffffffffffffffffffffffff168573ffffffffffffffffffffffffffffffffffffffff1614611660576040517fc1c149b600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006020821115612e3c576040517f6281faa200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b612e468284615460565b6020929092036008029190911c92915050565b600060606000612e68856136a8565b90506000612e758661378e565b805160208201206060880151604089015192935090916000612e978284610ab8565b905060008951600014612ec85789600081518110612eb757612eb7614ad6565b602002602001015160200151612ed9565b604051806020016040528060008152505b90506060612f398d846040518060a001604052808963ffffffff1681526020018c81526020018a8152602001876000015167ffffffffffffffff1681526020018873ffffffffffffffffffffffffffffffffffffffff16815250856137ab565b604051919b509150612f51908990899060200161549c565b60405160208183030381529060405298507f07ea52d82345d6e838192107d8fd7123d9c2ec8e916cd0aad13fd2b60db2464483608001518460a0015183604051612f9d939291906154cb565b60405180910390a15050505050505050935093915050565b6060806002831015612ff6576040517f6592671c00000000000000000000000000000000000000000000000000000000815260006004820152602401611115565b60006130056002828688615436565b61300e91615529565b60f01c905060027ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd82016131df578060005b8683101561316b57600061305960018501858a8c615436565b61306291615571565b60f81c905060008190036130a5576040517f6780cfaf00000000000000000000000000000000000000000000000000000000815260006004820152602401611115565b8160ff166000036130b8578091506130f5565b8160ff168160ff16146130f5573660006130d486868c8e615436565b915091506130e58989868585613a97565b9099509750859450919250829150505b600184019360009061310c90600301868b8d615436565b61311591615529565b60f01c90506000819003613158576040517f6592671c00000000000000000000000000000000000000000000000000000000815260048101869052602401611115565b8060020161ffff16850194505050613040565b8287146131a7576040517f6592671c00000000000000000000000000000000000000000000000000000000815260048101849052602401611115565b60028711156131d8573660006131bf85858b8d615436565b915091506131d08888858585613a97565b909850965050505b50506131ed565b6131ea828787613c0c565b93505b50509250929050565b606080825160000361320757915091565b600061321284613e8b565b90508060ff166001036132c45760408051600180825281830190925290816020015b6060815260200190600190039081613234579050509250838360008151811061325f5761325f614ad6565b602090810291909101015260408051600180825281830190925290816020016020820280368337019050509150613297846003613fb0565b826000815181106132aa576132aa614ad6565b602002602001019060ff16908160ff168152505050915091565b8060ff1667ffffffffffffffff8111156132e0576132e0614bc0565b604051908082528060200260200182016040528015613309578160200160208202803683370190505b5091508060ff1667ffffffffffffffff81111561332857613328614bc0565b60405190808252806020026020018201604052801561335b57816020015b60608152602001906001900390816133465790505b50925060008060ff5b865183101561340f57600190920191600061337f8885614030565b60029490940193905060006133948986613fb0565b90508260ff1660ff036133a957809250613400565b8260ff168160ff1614613400577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffd8486030160006133e88b87846140b0565b90506133f68a8a878461422a565b5093909301929150815b5061ffff169290920191613364565b818303600061341f8985846140b0565b905061342d8888858461422a565b60005b8660ff168160ff16101561348e57878160ff168151811061345357613453614ad6565b6020908102919091010180517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0160ff169052600101613430565b50505050505050915091565b600080866040015187602001516134b191906155b7565b905060005b8160ff168160ff16101561364d576000886020015160ff168260ff161061350b5760a089015160208a01516134eb9084615282565b60ff16815181106134fe576134fe614ad6565b602002602001015161352d565b88608001518260ff168151811061352457613524614ad6565b60200260200101515b60408051602081019091526000808252919250905b865181101561359a578360ff1687828151811061356157613561614ad6565b602002602001015160ff16036135925787818151811061358357613583614ad6565b6020026020010151915061359a565b600101613542565b5089516040517f30bb3aac00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416916330bb3aac916135f3918d918d9087906004016155d0565b602060405180830381865afa158015613610573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190613634919061532f565b61363e908661501f565b945050508060010190506134b6565b505095945050505050565b600060148214613694576040517f6281faa200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61369e828461561b565b60601c9392505050565b8051602080830151604080850151606080870151608088015193517f01000000000000000000000000000000000000000000000000000000000000009681019690965260c09690961b7fffffffffffffffff00000000000000000000000000000000000000000000000016602186015260e093841b7fffffffff00000000000000000000000000000000000000000000000000000000908116602987015273ffffffffffffffffffffffffffffffffffffffff909216602d8601529490921b909116604d83015260518201526071015b6040516020818303038152906040529050919050565b60608160a001518260c00151604051602001613778929190615661565b600060606000806137bb856131f6565b915091506000876040015188602001516137d591906155b7565b90508060ff1667ffffffffffffffff8111156137f3576137f3614bc0565b60405190808252806020026020018201604052801561381c578160200160208202803683370190505b50935060005b8160ff168160ff161015613a8a576000896020015160ff168260ff16106138775760a08a015160208b01516138579084615282565b60ff168151811061386a5761386a614ad6565b6020026020010151613899565b89608001518260ff168151811061389057613890614ad6565b60200260200101515b60408051602081019091526000808252919250905b8551811015613906578360ff168682815181106138cd576138cd614ad6565b602002602001015160ff16036138fe578681815181106138ef576138ef614ad6565b60200260200101519150613906565b6001016138ae565b506040517f95d376d700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8316906395d376d79061395b908d908590600401615687565b6020604051808303816000875af115801561397a573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061399e919061532f565b878460ff16815181106139b3576139b3614ad6565b6020026020010181815250506000878460ff16815181106139d6576139d6614ad6565b60200260200101511115613a8057868360ff16815181106139f9576139f9614ad6565b60200260200101518c60008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000828254613a4e919061501f565b92505081905550868360ff1681518110613a6a57613a6a614ad6565b602002602001015188613a7d919061501f565b97505b5050600101613822565b5050505094509492505050565b6060807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60ff861601613b3257865115613af457868484604051602001613ae093929190615705565b604051602081830303815290604052613b2b565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050505b9650613c01565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe60ff861601613bca57855115613b8c57858484604051602001613b7893929190615705565b604051602081830303815290604052613bc3565b83838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152505050505b9550613c01565b6040517f6780cfaf00000000000000000000000000000000000000000000000000000000815260ff86166004820152602401611115565b509495939450505050565b60607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61ffff851601613d325760228214613c73576040517f0dc652a800000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613c94613c86602260028688615436565b613c8f91615460565b614359565b6040517f0100000000000000000000000000000000000000000000000000000000000000602082018190527e11000000000000000000000000000000000000000000000000000000000000602183015260238201527fffffffffffffffffffffffffffffffff00000000000000000000000000000000608083901b16602482015290915060340160405160208183030381529060405291505061111e565b7ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe61ffff851601613e5357604282111580613d6d5750606282115b15613da4576040517fc0927c5600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6000613db7613c86602260028688615436565b90506000613dcc613c86604260228789615436565b905060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffbe8501613e00866042818a615436565b613e0991615460565b60405160086020938403029190911c9250613e3a916001916011918391889183916031916002918b918b910161572d565b604051602081830303815290604052935050505061111e565b6040517f4170513000000000000000000000000000000000000000000000000000000000815261ffff85166004820152602401611115565b600080805b8351821015613f6c576001909101906000613eab8584614030565b905060028301925060028161ffff161015613ef5576040517f04eb6e0c00000000000000000000000000000000000000000000000000000000815260048101849052602401611115565b6000613f018685613fb0565b90508060ff1660ff03613f40576040517fd3d3d9bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600160ff82161b8316613f5d5760019485019460ff82161b831792505b5061ffff169190910190613e90565b83518214613fa9576040517f04eb6e0c00000000000000000000000000000000000000000000000000000000815260048101839052602401611115565b5050919050565b6000613fbd82600161501f565b83511015614027576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601360248201527f746f55696e74385f6f75744f66426f756e6473000000000000000000000000006044820152606401611115565b50016001015190565b600061403d82600261501f565b835110156140a7576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601460248201527f746f55696e7431365f6f75744f66426f756e64730000000000000000000000006044820152606401611115565b50016002015190565b6060816140be81601f61501f565b1015614126576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152600e60248201527f736c6963655f6f766572666c6f770000000000000000000000000000000000006044820152606401611115565b614130828461501f565b8451101561419a576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152601160248201527f736c6963655f6f75744f66426f756e64730000000000000000000000000000006044820152606401611115565b6060821580156141b95760405191506000825260208201604052614221565b6040519150601f8416801560200281840101858101878315602002848b0101015b818310156141f25780518352602092830192016141da565b5050858452601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe016604052505b50949350505050565b8160ff1660ff03614267576040517fd3d3d9bc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60006142748360016155b7565b905060005b8451811015611b2b57600085828151811061429657614296614ad6565b602002602001015190508060ff168360ff160361430b578682815181106142bf576142bf614ad6565b6020026020010151846040516020016142d992919061549c565b6040516020818303038152906040528783815181106142fa576142fa614ad6565b602002602001018190525050611b2b565b8060ff16600003614350578286838151811061432957614329614ad6565b602002602001019060ff16908160ff1681525050838783815181106142fa576142fa614ad6565b50600101614279565b60006fffffffffffffffffffffffffffffffff8211156143fb576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602760248201527f53616665436173743a2076616c756520646f65736e27742066697420696e203160448201527f32382062697473000000000000000000000000000000000000000000000000006064820152608401611115565b5090565b828054828255906000526020600020908101928215614479579160200282015b8281111561447957825182547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff90911617825560209092019160019091019061441f565b506143fb9291505b808211156143fb5760008155600101614481565b63ffffffff811681146114af57600080fd5b6000602082840312156144b957600080fd5b813561111e81614495565b73ffffffffffffffffffffffffffffffffffffffff811681146114af57600080fd5b80356144f1816144c4565b919050565b6000806040838503121561450957600080fd5b8235614514816144c4565b9150602083013561452481614495565b809150509250929050565b815163ffffffff16815260208083015173ffffffffffffffffffffffffffffffffffffffff169082015260408101610a8d565b6000806020838503121561457557600080fd5b823567ffffffffffffffff8082111561458d57600080fd5b818501915085601f8301126145a157600080fd5b8135818111156145b057600080fd5b8660208260051b85010111156145c557600080fd5b60209290920196919550909350505050565b60008151808452602080850194506020840160005b8381101561461e57815173ffffffffffffffffffffffffffffffffffffffff16875295820195908201906001016145ec565b509495945050505050565b67ffffffffffffffff815116825260ff602082015116602083015260ff604082015116604083015260ff60608201511660608301526000608082015160c0608085015261467960c08501826145d7565b905060a083015184820360a086015261469282826145d7565b95945050505050565b60208152600061111e6020830184614629565b803561ffff811681146144f157600080fd5b60008083601f8401126146d257600080fd5b50813567ffffffffffffffff8111156146ea57600080fd5b6020830191508360208285010111156123f257600080fd5b600080600080600080600060a0888a03121561471d57600080fd5b614726886146ae565b96506020880135614736816144c4565b9550604088013567ffffffffffffffff8082111561475357600080fd5b61475f8b838c016146c0565b909750955060608a01359150811515821461477957600080fd5b9093506080890135908082111561478f57600080fd5b5061479c8a828b016146c0565b989b979a50959850939692959293505050565b67ffffffffffffffff811681146114af57600080fd5b80356144f1816147af565b60008060008060008060008060008060006101008c8e0312156147f257600080fd5b6147fb8c6144e6565b9a5061480960208d016147c5565b995061481760408d016146ae565b985067ffffffffffffffff8060608e0135111561483357600080fd5b6148438e60608f01358f016146c0565b909950975060808d013581101561485957600080fd5b6148698e60808f01358f016146c0565b909750955061487a60a08e016144e6565b945061488860c08e016144e6565b93508060e08e0135111561489b57600080fd5b506148ac8d60e08e01358e016146c0565b81935080925050509295989b509295989b9093969950565b6000806000606084860312156148d957600080fd5b6148e2846146ae565b925060208401356148f2816144c4565b929592945050506040919091013590565b60005b8381101561491e578181015183820152602001614906565b50506000910152565b6000815180845261493f816020860160208601614903565b601f017fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0169290920160200192915050565b60208152600061111e6020830184614927565b6000806040838503121561499757600080fd5b6149a0836146ae565b946020939093013593505050565b600080602083850312156149c157600080fd5b823567ffffffffffffffff808211156149d957600080fd5b818501915085601f8301126149ed57600080fd5b8135818111156149fc57600080fd5b8660206060830285010111156145c557600080fd5b600060208284031215614a2357600080fd5b813561111e816144c4565b600060208284031215614a4057600080fd5b5035919050565b600080600080600060808688031215614a5f57600080fd5b614a68866146ae565b94506020860135614a78816144c4565b935060408601359250606086013567ffffffffffffffff811115614a9b57600080fd5b614aa7888289016146c0565b969995985093965092949392505050565b60008060408385031215614acb57600080fd5b82356149a0816144c4565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc1833603018112614b3957600080fd5b9190910192915050565b600082357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff41833603018112614b3957600080fd5b803560ff811681146144f157600080fd5b600060208284031215614b9a57600080fd5b61111e82614b77565b600060208284031215614bb557600080fd5b813561111e816147af565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b60405160c0810167ffffffffffffffff81118282101715614c1257614c12614bc0565b60405290565b600082601f830112614c2957600080fd5b8135602067ffffffffffffffff80831115614c4657614c46614bc0565b8260051b6040517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0603f83011681018181108482111715614c8957614c89614bc0565b6040529384526020818701810194908101925087851115614ca957600080fd5b6020870191505b84821015614cd2578135614cc3816144c4565b83529183019190830190614cb0565b979650505050505050565b600060c08284031215614cef57600080fd5b614cf7614bef565b9050614d02826147c5565b8152614d1060208301614b77565b6020820152614d2160408301614b77565b6040820152614d3260608301614b77565b6060820152608082013567ffffffffffffffff80821115614d5257600080fd5b614d5e85838601614c18565b608084015260a0840135915080821115614d7757600080fd5b50614d8484828501614c18565b60a08301525092915050565b6000610a8d3683614cdd565b60008083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112614dd157600080fd5b830160208101925035905067ffffffffffffffff811115614df157600080fd5b8060051b36038213156123f257600080fd5b8183526000602080850194508260005b8581101561461e578135614e26816144c4565b73ffffffffffffffffffffffffffffffffffffffff1687529582019590820190600101614e13565b60208082528181018390526000906040808401600586901b8501820187855b88811015614fe2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc08089850301855282357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc18c3603018112614ecf57600080fd5b8b018035614edc81614495565b63ffffffff16855280880135368290037fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff41018112614f1957600080fd5b858901889052018035614f2b816147af565b67ffffffffffffffff1685880152614f44818901614b77565b606060ff80831682890152614f5a8a8501614b77565b92506080818416818a0152614f70838601614b77565b935060a09250818416838a0152614f8981860186614d9c565b60c08b81015294509150614fa4905061010089018483614e03565b925050614fb381840184614d9c565b93509050838783030160e0880152614fcc828483614e03565b978a019796505050928701925050600101614e6d565b509098975050505050505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b80820180821115610a8d57610a8d614ff0565b81810381811115610a8d57610a8d614ff0565b8183528181602085013750600060208284010152600060207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f840116840101905092915050565b6080815260006150a16080830188614927565b82810360208401526150b4818789615045565b60408401959095525050606001529392505050565b81356150d481614495565b63ffffffff811690508154817fffffffffffffffffffffffffffffffffffffffffffffffffffffffff0000000082161783556020840135615114816144c4565b77ffffffffffffffffffffffffffffffffffffffff000000008160201b16837fffffffffffffffff0000000000000000000000000000000000000000000000008416171784555050505050565b6020808252818101839052600090604080840186845b878110156151e157813561518a81614495565b63ffffffff908116845282860135906151a282614495565b1683860152818401356151b4816144c4565b73ffffffffffffffffffffffffffffffffffffffff16838501526060928301929190910190600101615177565b5090979650505050505050565b60006040828403121561520057600080fd5b6040516040810181811067ffffffffffffffff8211171561522357615223614bc0565b604052823561523181614495565b81526020830135615241816144c4565b60208201529392505050565b60006020828403121561525f57600080fd5b813567ffffffffffffffff81111561527657600080fd5b61240684828501614cdd565b60ff8281168282160390811115610a8d57610a8d614ff0565b600060ff8316806152d5577f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b8060ff84160491505092915050565b63ffffffff8516815273ffffffffffffffffffffffffffffffffffffffff841660208201528260408201526080606082015260006153256080830184614927565b9695505050505050565b60006020828403121561534157600080fd5b5051919050565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff83166020820152608081016124066040830184805163ffffffff16825260209081015173ffffffffffffffffffffffffffffffffffffffff16910152565b73ffffffffffffffffffffffffffffffffffffffff8416815263ffffffff831660208201526060604082015260006146926060830184614629565b61ffff8516815273ffffffffffffffffffffffffffffffffffffffff84166020820152606060408201526000615325606083018486615045565b60006020828403121561542b57600080fd5b815161111e816147af565b6000808585111561544657600080fd5b8386111561545357600080fd5b5050820193919092039150565b80356020831015610a8d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff602084900360031b1b1692915050565b600083516154ae818460208801614903565b8351908301906154c2818360208801614903565b01949350505050565b6060815260006154de60608301866145d7565b602083820360208501526154f282876145d7565b84810360408601528551808252602080880194509091019060005b81811015614fe25784518352938301939183019160010161550d565b7fffff00000000000000000000000000000000000000000000000000000000000081358181169160028510156155695780818660020360031b1b83161692505b505092915050565b7fff0000000000000000000000000000000000000000000000000000000000000081358181169160018510156155695760019490940360031b84901b1690921692915050565b60ff8181168382160190811115610a8d57610a8d614ff0565b63ffffffff8516815267ffffffffffffffff8416602082015273ffffffffffffffffffffffffffffffffffffffff831660408201526080606082015260006153256080830184614927565b7fffffffffffffffffffffffffffffffffffffffff00000000000000000000000081358181169160148510156155695760149490940360031b84901b1690921692915050565b82815260008251615679816020850160208701614903565b919091016020019392505050565b6040815263ffffffff83511660408201526000602084015160a060608401526156b360e0840182614927565b90506040850151608084015267ffffffffffffffff60608601511660a084015273ffffffffffffffffffffffffffffffffffffffff60808601511660c084015282810360208401526146928185614927565b60008451615717818460208901614903565b8201838582376000930192835250909392505050565b60007fff00000000000000000000000000000000000000000000000000000000000000808c60f81b1683527fffff000000000000000000000000000000000000000000000000000000000000808c60f01b166001850152818b60f81b1660038501527fffffffffffffffffffffffffffffffff000000000000000000000000000000008a60801b166004850152818960f81b166014850152808860f01b16601585015250808660f81b1660178401525061580e601883018560801b7fffffffffffffffffffffffffffffffff00000000000000000000000000000000169052565b5060288101919091526048019897505050505050505056fea2646970667358221220abc6a1f4c7f02e4cc85ec6c01abfcdb8ca7e00eb209be79ae92e7ac1c048019064736f6c63430008160033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd70000000000000000000000000000000000000000000000000000000000030d4000000000000000000000000000000000000000000000000000019945ca26200000000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd67500000000000000000000000000000000000000000000000000000000000000d6000000000000000000000000c614e9c511a5149f1969f2cb0199d508bbb5b915
-----Decoded View---------------
Arg [0] : _endpoint (address): 0xb6319cC6c8c27A8F5dAF0dD3DF91EA35C4720dd7
Arg [1] : _treasuryGasLimit (uint256): 200000
Arg [2] : _treasuryGasForFeeCap (uint256): 450000000000000
Arg [3] : _nonceContract (address): 0x66A71Dcef29A0fFBDBE3c6a460a3B5BC225Cd675
Arg [4] : _localEid (uint32): 214
Arg [5] : _treasuryFeeHandler (address): 0xC614E9C511a5149f1969F2CB0199d508bBB5b915
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 000000000000000000000000b6319cc6c8c27a8f5daf0dd3df91ea35c4720dd7
Arg [1] : 0000000000000000000000000000000000000000000000000000000000030d40
Arg [2] : 00000000000000000000000000000000000000000000000000019945ca262000
Arg [3] : 00000000000000000000000066a71dcef29a0ffbdbe3c6a460a3b5bc225cd675
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000d6
Arg [5] : 000000000000000000000000c614e9c511a5149f1969f2cb0199d508bbb5b915
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
SCROLL | Ether (ETH) | 100.00% | $3,995.84 | 0.00006076 | $0.24278 |
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.