Warning! Contract bytecode has been changed and doesn't match the verified one. Therefore, interaction with this smart contract may be risky.
- Contract name:
- PriceFeed
- Optimization enabled
- true
- Compiler version
- v0.8.22+commit.4fc1097e
- Optimization runs
- 20000
- EVM Version
- paris
- Verified at
- 2026-02-23T05:05:02.545675Z
contracts/PriceFeed.sol
// SPDX-License-Identifier: LZBL-1.2
pragma solidity ^0.8.20;
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";
import { Proxied } from "hardhat-deploy/solc_0.8/proxy/Proxied.sol";
import { ILayerZeroEndpointV2 } from "@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol";
import { Transfer } from "@layerzerolabs/lz-evm-protocol-v2/contracts/libs/Transfer.sol";
import { ILayerZeroPriceFeed } from "./interfaces/ILayerZeroPriceFeed.sol";
enum ModelType {
DEFAULT,
ARB_STACK,
OP_STACK
}
struct SetEidToModelTypeParam {
uint32 dstEid;
ModelType modelType;
}
// PriceFeed is updated based on v1 eids
// v2 eids will fall to the convention of v1 eid + 30,000
contract PriceFeed is ILayerZeroPriceFeed, OwnableUpgradeable, Proxied {
uint128 internal PRICE_RATIO_DENOMINATOR;
// sets pricing
mapping(address updater => bool active) public priceUpdater;
mapping(uint32 dstEid => Price) internal _defaultModelPrice;
ArbitrumPriceExt internal _arbitrumPriceExt;
uint128 internal _nativePriceUSD; // uses PRICE_RATIO_DENOMINATOR
// upgrade: arbitrum compression - percentage of callDataSize after brotli compression
uint128 public ARBITRUM_COMPRESSION_PERCENT;
ILayerZeroEndpointV2 public endpoint;
// for the destination endpoint id, return the fee model type
mapping(uint32 => ModelType) public eidToModelType;
// ============================ Constructor ===================================
function initialize(address _priceUpdater) public proxied initializer {
__Ownable_init();
priceUpdater[_priceUpdater] = true;
PRICE_RATIO_DENOMINATOR = 1e20;
ARBITRUM_COMPRESSION_PERCENT = 47;
}
// ============================ Modifier ======================================
// owner is always approved
modifier onlyPriceUpdater() {
if (owner() != msg.sender) {
if (!priceUpdater[msg.sender]) {
revert LZ_PriceFeed_OnlyPriceUpdater();
}
}
_;
}
// ============================ OnlyOwner =====================================
function setPriceUpdater(address _addr, bool _active) external onlyOwner {
priceUpdater[_addr] = _active;
}
function setPriceRatioDenominator(uint128 _denominator) external onlyOwner {
PRICE_RATIO_DENOMINATOR = _denominator;
}
function setArbitrumCompressionPercent(uint128 _compressionPercent) external onlyOwner {
ARBITRUM_COMPRESSION_PERCENT = _compressionPercent;
}
// set the fee ModelType for the destination eid
function setEidToModelType(SetEidToModelTypeParam[] calldata _params) external onlyOwner {
for (uint i = 0; i < _params.length; i++) {
eidToModelType[_params[i].dstEid] = _params[i].modelType;
}
}
function setEndpoint(address _endpoint) external onlyOwner {
endpoint = ILayerZeroEndpointV2(_endpoint);
}
function withdrawFee(address _to, uint256 _amount) external onlyOwner {
Transfer.native(_to, _amount);
}
// ============================ OnlyPriceUpdater =====================================
function setPrice(UpdatePrice[] calldata _price) external onlyPriceUpdater {
for (uint256 i = 0; i < _price.length; i++) {
UpdatePrice calldata _update = _price[i];
_setPrice(_update.eid, _update.price);
}
}
function setPriceForArbitrum(UpdatePriceExt calldata _update) external onlyPriceUpdater {
_setPrice(_update.eid, _update.price);
uint64 gasPerL2Tx = _update.extend.gasPerL2Tx;
uint32 gasPerL1CalldataByte = _update.extend.gasPerL1CallDataByte;
_arbitrumPriceExt.gasPerL2Tx = gasPerL2Tx;
_arbitrumPriceExt.gasPerL1CallDataByte = gasPerL1CalldataByte;
}
function setNativeTokenPriceUSD(uint128 _nativeTokenPriceUSD) external onlyPriceUpdater {
_nativePriceUSD = _nativeTokenPriceUSD;
}
// ============================ External =====================================
function estimateFeeOnSend(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) external payable returns (uint256, uint128, uint128, uint128) {
uint256 fee = getFee(_dstEid, _callDataSize, _gas);
if (msg.value < fee) revert LZ_PriceFeed_InsufficientFee(msg.value, fee);
return _estimateFeeByEid(_dstEid, _callDataSize, _gas);
}
// ============================ View ==========================================
// get fee for calling estimateFeeOnSend
function getFee(uint32 /*_dstEid*/, uint256 /*_callDataSize*/, uint256 /*_gas*/) public pure returns (uint256) {
return 0;
}
function getPriceRatioDenominator() external view returns (uint128) {
return PRICE_RATIO_DENOMINATOR;
}
// NOTE: to be reverted when endpoint is in sendContext
function nativeTokenPriceUSD() external view returns (uint128) {
return _nativePriceUSD;
}
// NOTE: to be reverted when endpoint is in sendContext
function arbitrumPriceExt() external view returns (ArbitrumPriceExt memory) {
return _arbitrumPriceExt;
}
// NOTE: to be reverted when endpoint is in sendContext
function getPrice(uint32 _dstEid) external view returns (Price memory price) {
price = _defaultModelPrice[_dstEid];
}
// NOTE: to be reverted when endpoint is in sendContext
function estimateFeeByEid(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) external view returns (uint256, uint128, uint128, uint128) {
return _estimateFeeByEid(_dstEid, _callDataSize, _gas);
}
// NOTE: to be reverted when endpoint is in sendContext
// NOTE: to support legacy
function getPrice(uint16 _dstEid) external view returns (Price memory price) {
price = _defaultModelPrice[_dstEid];
}
// NOTE: to be reverted when endpoint is in sendContext
// NOTE: to support legacy
function estimateFeeByChain(
uint16 _dstEid,
uint256 _callDataSize,
uint256 _gas
) external view returns (uint256 fee, uint128 priceRatio) {
// legacy if-statement uses very little gas, can keep using it until future upgrade
if (_dstEid == 110 || _dstEid == 10143 || _dstEid == 20143) {
return _estimateFeeWithArbitrumModel(_dstEid, _callDataSize, _gas);
} else if (_dstEid == 111 || _dstEid == 10132 || _dstEid == 20132) {
return _estimateFeeWithOptimismModel(_dstEid, _callDataSize, _gas);
}
// fee model type is configured per eid
ModelType _modelType = eidToModelType[_dstEid];
if (_modelType == ModelType.OP_STACK) {
return _estimateFeeWithOptimismModel(_dstEid, _callDataSize, _gas);
} else if (_modelType == ModelType.ARB_STACK) {
return _estimateFeeWithArbitrumModel(_dstEid, _callDataSize, _gas);
} else {
return _estimateFeeWithDefaultModel(_dstEid, _callDataSize, _gas);
}
}
// ============================ Internal ==========================================
function _setPrice(uint32 _dstEid, Price memory _price) internal {
uint128 priceRatio = _price.priceRatio;
uint64 gasPriceInUnit = _price.gasPriceInUnit;
uint32 gasPerByte = _price.gasPerByte;
_defaultModelPrice[_dstEid] = Price(priceRatio, gasPriceInUnit, gasPerByte);
}
function _getL1LookupIdForOptimismModel(uint32 _l2Eid) internal view returns (uint32) {
uint32 l2Eid = _l2Eid % 30_000;
if (l2Eid == 111) {
return 101;
} else if (l2Eid == 10132) {
return 10121; // ethereum-goerli
} else if (l2Eid == 20132) {
return 20121; // ethereum-goerli
}
if (eidToModelType[l2Eid] != ModelType.OP_STACK) revert LZ_PriceFeed_NotAnOPStack(_l2Eid);
if (l2Eid < 10000) {
return 101;
} else if (l2Eid < 20000) {
return 10161; // ethereum-sepolia
} else {
return 20121; // ethereum-goerli
}
}
function _estimateFeeWithDefaultModel(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) internal view returns (uint256 fee, uint128 priceRatio) {
Price storage remotePrice = _defaultModelPrice[_dstEid];
// assuming the _gas includes (1) the 21,000 overhead and (2) not the calldata gas
uint256 gasForCallData = _callDataSize * remotePrice.gasPerByte;
uint256 remoteFee = (gasForCallData + _gas) * remotePrice.gasPriceInUnit;
return ((remoteFee * remotePrice.priceRatio) / PRICE_RATIO_DENOMINATOR, remotePrice.priceRatio);
}
function _estimateFeeByEid(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) internal view returns (uint256 fee, uint128 priceRatio, uint128 priceRatioDenominator, uint128 priceUSD) {
uint32 dstEid = _dstEid % 30_000;
if (dstEid == 110 || dstEid == 10143 || dstEid == 20143) {
(fee, priceRatio) = _estimateFeeWithArbitrumModel(dstEid, _callDataSize, _gas);
} else if (dstEid == 111 || dstEid == 10132 || dstEid == 20132) {
(fee, priceRatio) = _estimateFeeWithOptimismModel(dstEid, _callDataSize, _gas);
}
// lookup map stuff
ModelType _modelType = eidToModelType[dstEid];
if (_modelType == ModelType.OP_STACK) {
(fee, priceRatio) = _estimateFeeWithOptimismModel(dstEid, _callDataSize, _gas);
} else if (_modelType == ModelType.ARB_STACK) {
(fee, priceRatio) = _estimateFeeWithArbitrumModel(dstEid, _callDataSize, _gas);
} else {
(fee, priceRatio) = _estimateFeeWithDefaultModel(dstEid, _callDataSize, _gas);
}
priceRatioDenominator = PRICE_RATIO_DENOMINATOR;
priceUSD = _nativePriceUSD;
}
function _estimateFeeWithOptimismModel(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) internal view returns (uint256 fee, uint128 priceRatio) {
uint32 ethereumId = _getL1LookupIdForOptimismModel(_dstEid);
// L1 fee
Price storage ethereumPrice = _defaultModelPrice[ethereumId];
uint256 gasForL1CallData = (_callDataSize * ethereumPrice.gasPerByte) + 3188; // 2100 + 68 * 16
uint256 l1Fee = gasForL1CallData * ethereumPrice.gasPriceInUnit;
// L2 fee
Price storage optimismPrice = _defaultModelPrice[_dstEid];
uint256 gasForL2CallData = _callDataSize * optimismPrice.gasPerByte;
uint256 l2Fee = (gasForL2CallData + _gas) * optimismPrice.gasPriceInUnit;
uint256 l1FeeInSrcPrice = (l1Fee * ethereumPrice.priceRatio) / PRICE_RATIO_DENOMINATOR;
uint256 l2FeeInSrcPrice = (l2Fee * optimismPrice.priceRatio) / PRICE_RATIO_DENOMINATOR;
uint256 gasFee = l1FeeInSrcPrice + l2FeeInSrcPrice;
return (gasFee, optimismPrice.priceRatio);
}
function _estimateFeeWithArbitrumModel(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) internal view returns (uint256 fee, uint128 priceRatio) {
Price storage arbitrumPrice = _defaultModelPrice[_dstEid];
// L1 fee
uint256 gasForL1CallData = ((_callDataSize * ARBITRUM_COMPRESSION_PERCENT) / 100) *
_arbitrumPriceExt.gasPerL1CallDataByte;
// L2 Fee
uint256 gasForL2CallData = _callDataSize * arbitrumPrice.gasPerByte;
uint256 gasFee = (_gas + _arbitrumPriceExt.gasPerL2Tx + gasForL1CallData + gasForL2CallData) *
arbitrumPrice.gasPriceInUnit;
return ((gasFee * arbitrumPrice.priceRatio) / PRICE_RATIO_DENOMINATOR, arbitrumPrice.priceRatio);
}
}
@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/ILayerZeroEndpointV2.sol
// 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;
}
@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessageLibManager.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
struct SetConfigParam {
uint32 eid;
uint32 configType;
bytes config;
}
interface IMessageLibManager {
struct Timeout {
address lib;
uint256 expiry;
}
event LibraryRegistered(address newLib);
event DefaultSendLibrarySet(uint32 eid, address newLib);
event DefaultReceiveLibrarySet(uint32 eid, address newLib);
event DefaultReceiveLibraryTimeoutSet(uint32 eid, address oldLib, uint256 expiry);
event SendLibrarySet(address sender, uint32 eid, address newLib);
event ReceiveLibrarySet(address receiver, uint32 eid, address newLib);
event ReceiveLibraryTimeoutSet(address receiver, uint32 eid, address oldLib, uint256 timeout);
function registerLibrary(address _lib) external;
function isRegisteredLibrary(address _lib) external view returns (bool);
function getRegisteredLibraries() external view returns (address[] memory);
function setDefaultSendLibrary(uint32 _eid, address _newLib) external;
function defaultSendLibrary(uint32 _eid) external view returns (address);
function setDefaultReceiveLibrary(uint32 _eid, address _newLib, uint256 _gracePeriod) external;
function defaultReceiveLibrary(uint32 _eid) external view returns (address);
function setDefaultReceiveLibraryTimeout(uint32 _eid, address _lib, uint256 _expiry) external;
function defaultReceiveLibraryTimeout(uint32 _eid) external view returns (address lib, uint256 expiry);
function isSupportedEid(uint32 _eid) external view returns (bool);
function isValidReceiveLibrary(address _receiver, uint32 _eid, address _lib) external view returns (bool);
/// ------------------- OApp interfaces -------------------
function setSendLibrary(address _oapp, uint32 _eid, address _newLib) external;
function getSendLibrary(address _sender, uint32 _eid) external view returns (address lib);
function isDefaultSendLibrary(address _sender, uint32 _eid) external view returns (bool);
function setReceiveLibrary(address _oapp, uint32 _eid, address _newLib, uint256 _gracePeriod) external;
function getReceiveLibrary(address _receiver, uint32 _eid) external view returns (address lib, bool isDefault);
function setReceiveLibraryTimeout(address _oapp, uint32 _eid, address _lib, uint256 _expiry) external;
function receiveLibraryTimeout(address _receiver, uint32 _eid) external view returns (address lib, uint256 expiry);
function setConfig(address _oapp, address _lib, SetConfigParam[] calldata _params) external;
function getConfig(
address _oapp,
address _lib,
uint32 _eid,
uint32 _configType
) external view returns (bytes memory config);
}
@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingChannel.sol
// 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);
}
@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingComposer.sol
// 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;
}
@layerzerolabs/lz-evm-protocol-v2/contracts/interfaces/IMessagingContext.sol
// 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);
}
@layerzerolabs/lz-evm-protocol-v2/contracts/libs/Transfer.sol
// 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);
}
}
}
@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (access/Ownable.sol)
pragma solidity ^0.8.0;
import "../utils/ContextUpgradeable.sol";
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Contract module which provides a basic access control mechanism, where
* there is an account (an owner) that can be granted exclusive access to
* specific functions.
*
* 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 OwnableUpgradeable is Initializable, ContextUpgradeable {
address private _owner;
event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);
/**
* @dev Initializes the contract setting the deployer as the initial owner.
*/
function __Ownable_init() internal onlyInitializing {
__Ownable_init_unchained();
}
function __Ownable_init_unchained() internal onlyInitializing {
_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);
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[49] private __gap;
}
@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.0) (proxy/utils/Initializable.sol)
pragma solidity ^0.8.2;
import "../../utils/AddressUpgradeable.sol";
/**
* @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
* behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
* external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
* function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
*
* The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
* reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
* case an upgrade adds a module that needs to be initialized.
*
* For example:
*
* [.hljs-theme-light.nopadding]
* ```solidity
* contract MyToken is ERC20Upgradeable {
* function initialize() initializer public {
* __ERC20_init("MyToken", "MTK");
* }
* }
*
* contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
* function initializeV2() reinitializer(2) public {
* __ERC20Permit_init("MyToken");
* }
* }
* ```
*
* TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
* possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
*
* CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
* that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
*
* [CAUTION]
* ====
* Avoid leaving a contract uninitialized.
*
* An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
* contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
* the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
*
* [.hljs-theme-light.nopadding]
* ```
* /// @custom:oz-upgrades-unsafe-allow constructor
* constructor() {
* _disableInitializers();
* }
* ```
* ====
*/
abstract contract Initializable {
/**
* @dev Indicates that the contract has been initialized.
* @custom:oz-retyped-from bool
*/
uint8 private _initialized;
/**
* @dev Indicates that the contract is in the process of being initialized.
*/
bool private _initializing;
/**
* @dev Triggered when the contract has been initialized or reinitialized.
*/
event Initialized(uint8 version);
/**
* @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
* `onlyInitializing` functions can be used to initialize parent contracts.
*
* Similar to `reinitializer(1)`, except that functions marked with `initializer` can be nested in the context of a
* constructor.
*
* Emits an {Initialized} event.
*/
modifier initializer() {
bool isTopLevelCall = !_initializing;
require(
(isTopLevelCall && _initialized < 1) || (!AddressUpgradeable.isContract(address(this)) && _initialized == 1),
"Initializable: contract is already initialized"
);
_initialized = 1;
if (isTopLevelCall) {
_initializing = true;
}
_;
if (isTopLevelCall) {
_initializing = false;
emit Initialized(1);
}
}
/**
* @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
* contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
* used to initialize parent contracts.
*
* A reinitializer may be used after the original initialization step. This is essential to configure modules that
* are added through upgrades and that require initialization.
*
* When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
* cannot be nested. If one is invoked in the context of another, execution will revert.
*
* Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
* a contract, executing them in the right order is up to the developer or operator.
*
* WARNING: setting the version to 255 will prevent any future reinitialization.
*
* Emits an {Initialized} event.
*/
modifier reinitializer(uint8 version) {
require(!_initializing && _initialized < version, "Initializable: contract is already initialized");
_initialized = version;
_initializing = true;
_;
_initializing = false;
emit Initialized(version);
}
/**
* @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
* {initializer} and {reinitializer} modifiers, directly or indirectly.
*/
modifier onlyInitializing() {
require(_initializing, "Initializable: contract is not initializing");
_;
}
/**
* @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
* Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
* to any version. It is recommended to use this to lock implementation contracts that are designed to be called
* through proxies.
*
* Emits an {Initialized} event the first time it is successfully executed.
*/
function _disableInitializers() internal virtual {
require(!_initializing, "Initializable: contract is initializing");
if (_initialized != type(uint8).max) {
_initialized = type(uint8).max;
emit Initialized(type(uint8).max);
}
}
/**
* @dev Returns the highest version that has been initialized. See {reinitializer}.
*/
function _getInitializedVersion() internal view returns (uint8) {
return _initialized;
}
/**
* @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
*/
function _isInitializing() internal view returns (bool) {
return _initializing;
}
}
@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol
// 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 AddressUpgradeable {
/**
* @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);
}
}
}
@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol)
pragma solidity ^0.8.0;
import {Initializable} from "../proxy/utils/Initializable.sol";
/**
* @dev Provides information about the current execution context, including the
* sender of the transaction and its data. While these are generally available
* via msg.sender and msg.data, they should not be accessed in such a direct
* manner, since when dealing with meta-transactions the account sending and
* paying for execution may not be the actual sender (as far as an application
* is concerned).
*
* This contract is only required for intermediate, library-like contracts.
*/
abstract contract ContextUpgradeable is Initializable {
function __Context_init() internal onlyInitializing {
}
function __Context_init_unchained() internal onlyInitializing {
}
function _msgSender() internal view virtual returns (address) {
return msg.sender;
}
function _msgData() internal view virtual returns (bytes calldata) {
return msg.data;
}
function _contextSuffixLength() internal view virtual returns (uint256) {
return 0;
}
/**
* @dev This empty reserved space is put in place to allow future versions to add new
* variables without shifting down storage in the inheritance chain.
* See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps
*/
uint256[50] private __gap;
}
@openzeppelin/contracts/token/ERC20/IERC20.sol
// 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);
}
@openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol
// 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);
}
@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol
// 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));
}
}
@openzeppelin/contracts/utils/Address.sol
// 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);
}
}
}
contracts/interfaces/ILayerZeroPriceFeed.sol
// SPDX-License-Identifier: MIT
pragma solidity >=0.8.0;
interface ILayerZeroPriceFeed {
/**
* @dev
* priceRatio: (USD price of 1 unit of remote native token in unit of local native token) * PRICE_RATIO_DENOMINATOR
*/
struct Price {
uint128 priceRatio; // float value * 10 ^ 20, decimal awared. for aptos to evm, the basis would be (10^18 / 10^8) * 10 ^20 = 10 ^ 30.
uint64 gasPriceInUnit; // for evm, it is in wei, for aptos, it is in octas.
uint32 gasPerByte;
}
struct UpdatePrice {
uint32 eid;
Price price;
}
/**
* @dev
* ArbGasInfo.go:GetPricesInArbGas
*
*/
struct ArbitrumPriceExt {
uint64 gasPerL2Tx; // L2 overhead
uint32 gasPerL1CallDataByte;
}
struct UpdatePriceExt {
uint32 eid;
Price price;
ArbitrumPriceExt extend;
}
error LZ_PriceFeed_OnlyPriceUpdater();
error LZ_PriceFeed_InsufficientFee(uint256 provided, uint256 required);
error LZ_PriceFeed_NotAnOPStack(uint32 l2Eid);
function nativeTokenPriceUSD() external view returns (uint128);
function getFee(uint32 _dstEid, uint256 _callDataSize, uint256 _gas) external view returns (uint256);
function getPrice(uint32 _dstEid) external view returns (Price memory);
function getPriceRatioDenominator() external view returns (uint128);
function estimateFeeByEid(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) external view returns (uint256 fee, uint128 priceRatio, uint128 priceRatioDenominator, uint128 nativePriceUSD);
function estimateFeeOnSend(
uint32 _dstEid,
uint256 _callDataSize,
uint256 _gas
) external payable returns (uint256 fee, uint128 priceRatio, uint128 priceRatioDenominator, uint128 nativePriceUSD);
}
hardhat-deploy/solc_0.8/proxy/Proxied.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
abstract contract Proxied {
/// @notice to be used by initialisation / postUpgrade function so that only the proxy's admin can execute them
/// It also allows these functions to be called inside a contructor
/// even if the contract is meant to be used without proxy
modifier proxied() {
address proxyAdminAddress = _proxyAdmin();
// With hardhat-deploy proxies
// the proxyAdminAddress is zero only for the implementation contract
// if the implementation contract want to be used as a standalone/immutable contract
// it simply has to execute the `proxied` function
// This ensure the proxyAdminAddress is never zero post deployment
// And allow you to keep the same code for both proxied contract and immutable contract
if (proxyAdminAddress == address(0)) {
// ensure can not be called twice when used outside of proxy : no admin
// solhint-disable-next-line security/no-inline-assembly
assembly {
sstore(
0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103,
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
)
}
} else {
require(msg.sender == proxyAdminAddress);
}
_;
}
modifier onlyProxyAdmin() {
require(msg.sender == _proxyAdmin(), "NOT_AUTHORIZED");
_;
}
function _proxyAdmin() internal view returns (address ownerAddress) {
// solhint-disable-next-line security/no-inline-assembly
assembly {
ownerAddress := sload(0xb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d6103)
}
}
}
Compiler Settings
{"outputSelection":{"*":{"*":["*"],"":["*"]}},"optimizer":{"runs":20000,"enabled":true},"metadata":{"useLiteralContent":true,"bytecodeHash":"ipfs"},"libraries":{},"evmVersion":"paris"}
Contract ABI
[{"type":"error","name":"LZ_PriceFeed_InsufficientFee","inputs":[{"type":"uint256","name":"provided","internalType":"uint256"},{"type":"uint256","name":"required","internalType":"uint256"}]},{"type":"error","name":"LZ_PriceFeed_NotAnOPStack","inputs":[{"type":"uint32","name":"l2Eid","internalType":"uint32"}]},{"type":"error","name":"LZ_PriceFeed_OnlyPriceUpdater","inputs":[]},{"type":"error","name":"Transfer_NativeFailed","inputs":[{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_value","internalType":"uint256"}]},{"type":"error","name":"Transfer_ToAddressIsZero","inputs":[]},{"type":"event","name":"Initialized","inputs":[{"type":"uint8","name":"version","internalType":"uint8","indexed":false}],"anonymous":false},{"type":"event","name":"OwnershipTransferred","inputs":[{"type":"address","name":"previousOwner","internalType":"address","indexed":true},{"type":"address","name":"newOwner","internalType":"address","indexed":true}],"anonymous":false},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"ARBITRUM_COMPRESSION_PERCENT","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"","internalType":"struct ILayerZeroPriceFeed.ArbitrumPriceExt","components":[{"type":"uint64","name":"gasPerL2Tx","internalType":"uint64"},{"type":"uint32","name":"gasPerL1CallDataByte","internalType":"uint32"}]}],"name":"arbitrumPriceExt","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint8","name":"","internalType":"enum ModelType"}],"name":"eidToModelType","inputs":[{"type":"uint32","name":"","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"contract ILayerZeroEndpointV2"}],"name":"endpoint","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"fee","internalType":"uint256"},{"type":"uint128","name":"priceRatio","internalType":"uint128"}],"name":"estimateFeeByChain","inputs":[{"type":"uint16","name":"_dstEid","internalType":"uint16"},{"type":"uint256","name":"_callDataSize","internalType":"uint256"},{"type":"uint256","name":"_gas","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint128","name":"","internalType":"uint128"},{"type":"uint128","name":"","internalType":"uint128"},{"type":"uint128","name":"","internalType":"uint128"}],"name":"estimateFeeByEid","inputs":[{"type":"uint32","name":"_dstEid","internalType":"uint32"},{"type":"uint256","name":"_callDataSize","internalType":"uint256"},{"type":"uint256","name":"_gas","internalType":"uint256"}]},{"type":"function","stateMutability":"payable","outputs":[{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint128","name":"","internalType":"uint128"},{"type":"uint128","name":"","internalType":"uint128"},{"type":"uint128","name":"","internalType":"uint128"}],"name":"estimateFeeOnSend","inputs":[{"type":"uint32","name":"_dstEid","internalType":"uint32"},{"type":"uint256","name":"_callDataSize","internalType":"uint256"},{"type":"uint256","name":"_gas","internalType":"uint256"}]},{"type":"function","stateMutability":"pure","outputs":[{"type":"uint256","name":"","internalType":"uint256"}],"name":"getFee","inputs":[{"type":"uint32","name":"","internalType":"uint32"},{"type":"uint256","name":"","internalType":"uint256"},{"type":"uint256","name":"","internalType":"uint256"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"price","internalType":"struct ILayerZeroPriceFeed.Price","components":[{"type":"uint128","name":"priceRatio","internalType":"uint128"},{"type":"uint64","name":"gasPriceInUnit","internalType":"uint64"},{"type":"uint32","name":"gasPerByte","internalType":"uint32"}]}],"name":"getPrice","inputs":[{"type":"uint32","name":"_dstEid","internalType":"uint32"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"tuple","name":"price","internalType":"struct ILayerZeroPriceFeed.Price","components":[{"type":"uint128","name":"priceRatio","internalType":"uint128"},{"type":"uint64","name":"gasPriceInUnit","internalType":"uint64"},{"type":"uint32","name":"gasPerByte","internalType":"uint32"}]}],"name":"getPrice","inputs":[{"type":"uint16","name":"_dstEid","internalType":"uint16"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"getPriceRatioDenominator","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"initialize","inputs":[{"type":"address","name":"_priceUpdater","internalType":"address"}]},{"type":"function","stateMutability":"view","outputs":[{"type":"uint128","name":"","internalType":"uint128"}],"name":"nativeTokenPriceUSD","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"address","name":"","internalType":"address"}],"name":"owner","inputs":[]},{"type":"function","stateMutability":"view","outputs":[{"type":"bool","name":"active","internalType":"bool"}],"name":"priceUpdater","inputs":[{"type":"address","name":"updater","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"renounceOwnership","inputs":[]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setArbitrumCompressionPercent","inputs":[{"type":"uint128","name":"_compressionPercent","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEidToModelType","inputs":[{"type":"tuple[]","name":"_params","internalType":"struct SetEidToModelTypeParam[]","components":[{"type":"uint32","name":"dstEid","internalType":"uint32"},{"type":"uint8","name":"modelType","internalType":"enum ModelType"}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setEndpoint","inputs":[{"type":"address","name":"_endpoint","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setNativeTokenPriceUSD","inputs":[{"type":"uint128","name":"_nativeTokenPriceUSD","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPrice","inputs":[{"type":"tuple[]","name":"_price","internalType":"struct ILayerZeroPriceFeed.UpdatePrice[]","components":[{"type":"uint32","name":"eid","internalType":"uint32"},{"type":"tuple","name":"price","internalType":"struct ILayerZeroPriceFeed.Price","components":[{"type":"uint128","name":"priceRatio","internalType":"uint128"},{"type":"uint64","name":"gasPriceInUnit","internalType":"uint64"},{"type":"uint32","name":"gasPerByte","internalType":"uint32"}]}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPriceForArbitrum","inputs":[{"type":"tuple","name":"_update","internalType":"struct ILayerZeroPriceFeed.UpdatePriceExt","components":[{"type":"uint32","name":"eid","internalType":"uint32"},{"type":"tuple","name":"price","internalType":"struct ILayerZeroPriceFeed.Price","components":[{"type":"uint128","name":"priceRatio","internalType":"uint128"},{"type":"uint64","name":"gasPriceInUnit","internalType":"uint64"},{"type":"uint32","name":"gasPerByte","internalType":"uint32"}]},{"type":"tuple","name":"extend","internalType":"struct ILayerZeroPriceFeed.ArbitrumPriceExt","components":[{"type":"uint64","name":"gasPerL2Tx","internalType":"uint64"},{"type":"uint32","name":"gasPerL1CallDataByte","internalType":"uint32"}]}]}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPriceRatioDenominator","inputs":[{"type":"uint128","name":"_denominator","internalType":"uint128"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"setPriceUpdater","inputs":[{"type":"address","name":"_addr","internalType":"address"},{"type":"bool","name":"_active","internalType":"bool"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"transferOwnership","inputs":[{"type":"address","name":"newOwner","internalType":"address"}]},{"type":"function","stateMutability":"nonpayable","outputs":[],"name":"withdrawFee","inputs":[{"type":"address","name":"_to","internalType":"address"},{"type":"uint256","name":"_amount","internalType":"uint256"}]}]
Contract Creation Code
0x608060405234801561001057600080fd5b506120f5806100206000396000f3fe6080604052600436106101a15760003560e01c80638ca2fb08116100e1578063cd68b79b1161008a578063dbbb415511610064578063dbbb4155146106a6578063e0ad121a146106c6578063f2fde38b1461077b578063fd9be5221461079b57600080fd5b8063cd68b79b14610552578063d350ad251461058f578063da26663a146105af57600080fd5b8063c1723a1d116100bb578063c1723a1d146104f8578063c18403271461050b578063c4d66de81461053257600080fd5b80638ca2fb08146104495780638da5cb5b1461048957806392807f58146104b457600080fd5b80635d6d7ccb1161014e5780637760e22d116101285780637760e22d1461036b5780637bc3c9ab1461038b5780637dc438a4146103d157806388a4124c146103f157600080fd5b80635d6d7ccb146102e45780635e280f1114610304578063715018a61461035657600080fd5b80633161b7f61161017f5780633161b7f61461023c57806336a5beba1461025c57806352a72510146102c457600080fd5b806311f2c343146101a6578063223cf5b2146101dd5780632f7cb0b41461021a575b600080fd5b3480156101b257600080fd5b506101ca6101c1366004611c04565b60009392505050565b6040519081526020015b60405180910390f35b3480156101e957600080fd5b5061020d6101f8366004611c37565b606b6020526000908152604090205460ff1681565b6040516101d49190611c88565b34801561022657600080fd5b5061023a610235366004611ce9565b6107bb565b005b34801561024857600080fd5b5061023a610257366004611d04565b6107f8565b34801561026857600080fd5b5060408051808201825260008082526020918201528151808301835260685467ffffffffffffffff811680835263ffffffff680100000000000000009092048216928401928352845190815291511691810191909152016101d4565b3480156102d057600080fd5b5061023a6102df366004611d9d565b6109c8565b3480156102f057600080fd5b5061023a6102ff366004611ce9565b610a26565b34801561031057600080fd5b50606a546103319073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d4565b34801561036257600080fd5b5061023a610aed565b34801561037757600080fd5b5061023a610386366004611dd9565b610b01565b34801561039757600080fd5b506103ab6103a6366004611e4e565b610bc5565b604080519283526fffffffffffffffffffffffffffffffff9091166020830152016101d4565b3480156103dd57600080fd5b5061023a6103ec366004611e6c565b610cd1565b3480156103fd57600080fd5b5061041161040c366004611c04565b610dde565b604080519485526fffffffffffffffffffffffffffffffff9384166020860152918316918401919091521660608201526080016101d4565b34801561045557600080fd5b50610479610464366004611e84565b60666020526000908152604090205460ff1681565b60405190151581526020016101d4565b34801561049557600080fd5b5060335473ffffffffffffffffffffffffffffffffffffffff16610331565b3480156104c057600080fd5b506069546fffffffffffffffffffffffffffffffff165b6040516fffffffffffffffffffffffffffffffff90911681526020016101d4565b610411610506366004611c04565b610e00565b34801561051757600080fd5b506065546fffffffffffffffffffffffffffffffff166104d7565b34801561053e57600080fd5b5061023a61054d366004611e84565b610e31565b34801561055e57600080fd5b506069546104d79070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b34801561059b57600080fd5b5061023a6105aa366004611ce9565b611118565b3480156105bb57600080fd5b506106626105ca366004611c37565b60408051606080820183526000808352602080840182905292840181905263ffffffff94851681526067835283902083519182018452546fffffffffffffffffffffffffffffffff81168252700100000000000000000000000000000000810467ffffffffffffffff169282019290925278010000000000000000000000000000000000000000000000009091049092169082015290565b6040805182516fffffffffffffffffffffffffffffffff16815260208084015167ffffffffffffffff16908201529181015163ffffffff16908201526060016101d4565b3480156106b257600080fd5b5061023a6106c1366004611e84565b611163565b3480156106d257600080fd5b506106626106e1366004611e9f565b60408051606080820183526000808352602080840182905292840181905261ffff949094168452606782529282902082519384018352546fffffffffffffffffffffffffffffffff8116845267ffffffffffffffff700100000000000000000000000000000000820416918401919091527801000000000000000000000000000000000000000000000000900463ffffffff169082015290565b34801561078757600080fd5b5061023a610796366004611e84565b6111b2565b3480156107a757600080fd5b5061023a6107b6366004611eba565b611269565b6107c361127f565b606980546fffffffffffffffffffffffffffffffff928316700100000000000000000000000000000000029216919091179055565b3361081860335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461087c573360009081526066602052604090205460ff1661087c576040517f320ae52900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156109c3573683838381811061089a5761089a611ee4565b6080029190910191506109ba90506108b56020830183611c37565b6108c736849003840160208501611f2b565b805160208083015160409384015184516060810186526fffffffffffffffffffffffffffffffff948516815267ffffffffffffffff92831681850190815263ffffffff9283168288019081529783166000908152606790955295909320925183549551965194167fffffffffffffffff000000000000000000000000000000000000000000000000909516949094177001000000000000000000000000000000009590911694909402939093177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff1678010000000000000000000000000000000000000000000000009190921602179055565b5060010161087f565b505050565b6109d061127f565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260666020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b33610a4660335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610aaa573360009081526066602052604090205460ff16610aaa576040517f320ae52900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b610af561127f565b610aff6000611300565b565b610b0961127f565b60005b818110156109c357828282818110610b2657610b26611ee4565b9050604002016020016020810190610b3e9190611fbe565b606b6000858585818110610b5457610b54611ee4565b610b6a9260206040909202019081019150611c37565b63ffffffff168152602081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001836002811115610bb857610bb8611c59565b0217905550600101610b0c565b6000808461ffff16606e1480610be057508461ffff1661279f145b80610bf057508461ffff16614eaf145b15610c0d57610c048561ffff168585611377565b91509150610cc9565b8461ffff16606f1480610c2557508461ffff16612794145b80610c3557508461ffff16614ea4145b15610c4957610c048561ffff1685856114d4565b61ffff85166000908152606b602052604090205460ff166002816002811115610c7457610c74611c59565b03610c9257610c888661ffff1686866114d4565b9250925050610cc9565b6001816002811115610ca657610ca6611c59565b03610cba57610c888661ffff168686611377565b610c888661ffff168686611685565b935093915050565b33610cf160335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610d55573360009081526066602052604090205460ff16610d55576040517f320ae52900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d656108b56020830183611c37565b6000610d7760a0830160808401611fdf565b90506000610d8b60c0840160a08501611c37565b6068805463ffffffff90921668010000000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921667ffffffffffffffff90941693909317179091555050565b600080600080610def87878761175a565b935093509350935093509350935093565b600080808080610e14565b60405180910390fd5b610e1f88888861175a565b94509450945094505093509350935093565b6000610e5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b905073ffffffffffffffffffffffffffffffffffffffff8116610eb45773ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355610ed6565b3373ffffffffffffffffffffffffffffffffffffffff821614610ed657600080fd5b600054610100900460ff1615808015610ef65750600054600160ff909116105b80610f105750303b158015610f10575060005460ff166001145b610f9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610e0b565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610ffa57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6110026118a4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260666020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055606580547fffffffffffffffffffffffffffffffff000000000000000000000000000000001668056bc75e2d6310000017905560698054702f000000000000000000000000000000006fffffffffffffffffffffffffffffffff9190911617905580156109c357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b61112061127f565b606580547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b61116b61127f565b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6111ba61127f565b73ffffffffffffffffffffffffffffffffffffffff811661125d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0b565b61126681611300565b50565b61127161127f565b61127b8282611943565b5050565b60335473ffffffffffffffffffffffffffffffffffffffff163314610aff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0b565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b63ffffffff8381166000908152606760205260408120606854606954929384938492680100000000000000009004909116906064906113dc9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1689612029565b6113e69190612075565b6113f09190612029565b8254909150600090611424907801000000000000000000000000000000000000000000000000900463ffffffff1688612029565b835460685491925060009167ffffffffffffffff7001000000000000000000000000000000009092048216918491869161145f91168b612089565b6114699190612089565b6114739190612089565b61147d9190612029565b60655485549192506fffffffffffffffffffffffffffffffff908116916114a5911683612029565b6114af9190612075565b935493996fffffffffffffffffffffffffffffffff9094169850929650505050505050565b60008060006114e286611a49565b63ffffffff8082166000908152606760205260408120805493945092909161152791780100000000000000000000000000000000000000000000000090041688612029565b61153390610c74612089565b825490915060009061156390700100000000000000000000000000000000900467ffffffffffffffff1683612029565b63ffffffff808b16600090815260676020526040812080549394509290916115a89178010000000000000000000000000000000000000000000000009004168b612029565b8254909150600090700100000000000000000000000000000000900467ffffffffffffffff166115d88b84612089565b6115e29190612029565b60655487549192506000916fffffffffffffffffffffffffffffffff9182169161160d911687612029565b6116179190612075565b60655485549192506000916fffffffffffffffffffffffffffffffff91821691611642911685612029565b61164c9190612075565b9050600061165a8284612089565b9554959f6fffffffffffffffffffffffffffffffff9096169e50949c50505050505050505050505050565b63ffffffff808416600090815260676020526040812080549192839283916116ca91780100000000000000000000000000000000000000000000000090041687612029565b8254909150600090700100000000000000000000000000000000900467ffffffffffffffff166116fa8784612089565b6117049190612029565b60655484549192506fffffffffffffffffffffffffffffffff9081169161172c911683612029565b6117369190612075565b925492986fffffffffffffffffffffffffffffffff90931697509195505050505050565b60008080808061176c6175308961209c565b90508063ffffffff16606e148061178a57508063ffffffff1661279f145b8061179c57508063ffffffff16614eaf145b156117b6576117ac818888611377565b90955093506117fa565b8063ffffffff16606f14806117d257508063ffffffff16612794145b806117e457508063ffffffff16614ea4145b156117fa576117f48188886114d4565b90955093505b63ffffffff81166000908152606b602052604090205460ff16600281600281111561182757611827611c59565b03611841576118378289896114d4565b9096509450611876565b600181600281111561185557611855611c59565b0361186557611837828989611377565b611870828989611685565b90965094505b505060655460695494989397506fffffffffffffffffffffffffffffffff9081169650909316935090915050565b600054610100900460ff1661193b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610e0b565b610aff611b4b565b73ffffffffffffffffffffffffffffffffffffffff8216611990576040517f6b7a931000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146119ea576040519150601f19603f3d011682016040523d82523d6000602084013e6119ef565b606091505b50509050806109c3576040517f465bc83400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101839052604401610e0b565b600080611a586175308461209c565b90508063ffffffff16606f03611a715750606592915050565b8063ffffffff1661279403611a8a575061278992915050565b8063ffffffff16614ea403611aa35750614e9992915050565b600263ffffffff82166000908152606b602052604090205460ff166002811115611acf57611acf611c59565b14611b0e576040517ff42c33dc00000000000000000000000000000000000000000000000000000000815263ffffffff84166004820152602401610e0b565b6127108163ffffffff161015611b275750606592915050565b614e208163ffffffff161015611b4157506127b192915050565b50614e9992915050565b600054610100900460ff16611be2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610e0b565b610aff33611300565b803563ffffffff81168114611bff57600080fd5b919050565b600080600060608486031215611c1957600080fd5b611c2284611beb565b95602085013595506040909401359392505050565b600060208284031215611c4957600080fd5b611c5282611beb565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6020810160038310611cc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b80356fffffffffffffffffffffffffffffffff81168114611bff57600080fd5b600060208284031215611cfb57600080fd5b611c5282611cc9565b60008060208385031215611d1757600080fd5b823567ffffffffffffffff80821115611d2f57600080fd5b818501915085601f830112611d4357600080fd5b813581811115611d5257600080fd5b8660208260071b8501011115611d6757600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bff57600080fd5b60008060408385031215611db057600080fd5b611db983611d79565b915060208301358015158114611dce57600080fd5b809150509250929050565b60008060208385031215611dec57600080fd5b823567ffffffffffffffff80821115611e0457600080fd5b818501915085601f830112611e1857600080fd5b813581811115611e2757600080fd5b8660208260061b8501011115611d6757600080fd5b803561ffff81168114611bff57600080fd5b600080600060608486031215611e6357600080fd5b611c2284611e3c565b600060c08284031215611e7e57600080fd5b50919050565b600060208284031215611e9657600080fd5b611c5282611d79565b600060208284031215611eb157600080fd5b611c5282611e3c565b60008060408385031215611ecd57600080fd5b611ed683611d79565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b803567ffffffffffffffff81168114611bff57600080fd5b600060608284031215611f3d57600080fd5b6040516060810181811067ffffffffffffffff82111715611f87577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052611f9383611cc9565b8152611fa160208401611f13565b6020820152611fb260408401611beb565b60408201529392505050565b600060208284031215611fd057600080fd5b813560038110611c5257600080fd5b600060208284031215611ff157600080fd5b611c5282611f13565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761204057612040611ffa565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261208457612084612046565b500490565b8082018082111561204057612040611ffa565b600063ffffffff808416806120b3576120b3612046565b9216919091069291505056fea26469706673582212202368d77009043311184ccc44845e21050131e4a67e3465034cbef11db565817164736f6c63430008160033
Deployed ByteCode
0x6080604052600436106101a15760003560e01c80638ca2fb08116100e1578063cd68b79b1161008a578063dbbb415511610064578063dbbb4155146106a6578063e0ad121a146106c6578063f2fde38b1461077b578063fd9be5221461079b57600080fd5b8063cd68b79b14610552578063d350ad251461058f578063da26663a146105af57600080fd5b8063c1723a1d116100bb578063c1723a1d146104f8578063c18403271461050b578063c4d66de81461053257600080fd5b80638ca2fb08146104495780638da5cb5b1461048957806392807f58146104b457600080fd5b80635d6d7ccb1161014e5780637760e22d116101285780637760e22d1461036b5780637bc3c9ab1461038b5780637dc438a4146103d157806388a4124c146103f157600080fd5b80635d6d7ccb146102e45780635e280f1114610304578063715018a61461035657600080fd5b80633161b7f61161017f5780633161b7f61461023c57806336a5beba1461025c57806352a72510146102c457600080fd5b806311f2c343146101a6578063223cf5b2146101dd5780632f7cb0b41461021a575b600080fd5b3480156101b257600080fd5b506101ca6101c1366004611c04565b60009392505050565b6040519081526020015b60405180910390f35b3480156101e957600080fd5b5061020d6101f8366004611c37565b606b6020526000908152604090205460ff1681565b6040516101d49190611c88565b34801561022657600080fd5b5061023a610235366004611ce9565b6107bb565b005b34801561024857600080fd5b5061023a610257366004611d04565b6107f8565b34801561026857600080fd5b5060408051808201825260008082526020918201528151808301835260685467ffffffffffffffff811680835263ffffffff680100000000000000009092048216928401928352845190815291511691810191909152016101d4565b3480156102d057600080fd5b5061023a6102df366004611d9d565b6109c8565b3480156102f057600080fd5b5061023a6102ff366004611ce9565b610a26565b34801561031057600080fd5b50606a546103319073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020016101d4565b34801561036257600080fd5b5061023a610aed565b34801561037757600080fd5b5061023a610386366004611dd9565b610b01565b34801561039757600080fd5b506103ab6103a6366004611e4e565b610bc5565b604080519283526fffffffffffffffffffffffffffffffff9091166020830152016101d4565b3480156103dd57600080fd5b5061023a6103ec366004611e6c565b610cd1565b3480156103fd57600080fd5b5061041161040c366004611c04565b610dde565b604080519485526fffffffffffffffffffffffffffffffff9384166020860152918316918401919091521660608201526080016101d4565b34801561045557600080fd5b50610479610464366004611e84565b60666020526000908152604090205460ff1681565b60405190151581526020016101d4565b34801561049557600080fd5b5060335473ffffffffffffffffffffffffffffffffffffffff16610331565b3480156104c057600080fd5b506069546fffffffffffffffffffffffffffffffff165b6040516fffffffffffffffffffffffffffffffff90911681526020016101d4565b610411610506366004611c04565b610e00565b34801561051757600080fd5b506065546fffffffffffffffffffffffffffffffff166104d7565b34801561053e57600080fd5b5061023a61054d366004611e84565b610e31565b34801561055e57600080fd5b506069546104d79070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1681565b34801561059b57600080fd5b5061023a6105aa366004611ce9565b611118565b3480156105bb57600080fd5b506106626105ca366004611c37565b60408051606080820183526000808352602080840182905292840181905263ffffffff94851681526067835283902083519182018452546fffffffffffffffffffffffffffffffff81168252700100000000000000000000000000000000810467ffffffffffffffff169282019290925278010000000000000000000000000000000000000000000000009091049092169082015290565b6040805182516fffffffffffffffffffffffffffffffff16815260208084015167ffffffffffffffff16908201529181015163ffffffff16908201526060016101d4565b3480156106b257600080fd5b5061023a6106c1366004611e84565b611163565b3480156106d257600080fd5b506106626106e1366004611e9f565b60408051606080820183526000808352602080840182905292840181905261ffff949094168452606782529282902082519384018352546fffffffffffffffffffffffffffffffff8116845267ffffffffffffffff700100000000000000000000000000000000820416918401919091527801000000000000000000000000000000000000000000000000900463ffffffff169082015290565b34801561078757600080fd5b5061023a610796366004611e84565b6111b2565b3480156107a757600080fd5b5061023a6107b6366004611eba565b611269565b6107c361127f565b606980546fffffffffffffffffffffffffffffffff928316700100000000000000000000000000000000029216919091179055565b3361081860335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff161461087c573360009081526066602052604090205460ff1661087c576040517f320ae52900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60005b818110156109c3573683838381811061089a5761089a611ee4565b6080029190910191506109ba90506108b56020830183611c37565b6108c736849003840160208501611f2b565b805160208083015160409384015184516060810186526fffffffffffffffffffffffffffffffff948516815267ffffffffffffffff92831681850190815263ffffffff9283168288019081529783166000908152606790955295909320925183549551965194167fffffffffffffffff000000000000000000000000000000000000000000000000909516949094177001000000000000000000000000000000009590911694909402939093177fffffffff00000000ffffffffffffffffffffffffffffffffffffffffffffffff1678010000000000000000000000000000000000000000000000009190921602179055565b5060010161087f565b505050565b6109d061127f565b73ffffffffffffffffffffffffffffffffffffffff91909116600090815260666020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff0016911515919091179055565b33610a4660335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610aaa573360009081526066602052604090205460ff16610aaa576040517f320ae52900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b606980547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b610af561127f565b610aff6000611300565b565b610b0961127f565b60005b818110156109c357828282818110610b2657610b26611ee4565b9050604002016020016020810190610b3e9190611fbe565b606b6000858585818110610b5457610b54611ee4565b610b6a9260206040909202019081019150611c37565b63ffffffff168152602081019190915260400160002080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001836002811115610bb857610bb8611c59565b0217905550600101610b0c565b6000808461ffff16606e1480610be057508461ffff1661279f145b80610bf057508461ffff16614eaf145b15610c0d57610c048561ffff168585611377565b91509150610cc9565b8461ffff16606f1480610c2557508461ffff16612794145b80610c3557508461ffff16614ea4145b15610c4957610c048561ffff1685856114d4565b61ffff85166000908152606b602052604090205460ff166002816002811115610c7457610c74611c59565b03610c9257610c888661ffff1686866114d4565b9250925050610cc9565b6001816002811115610ca657610ca6611c59565b03610cba57610c888661ffff168686611377565b610c888661ffff168686611685565b935093915050565b33610cf160335473ffffffffffffffffffffffffffffffffffffffff1690565b73ffffffffffffffffffffffffffffffffffffffff1614610d55573360009081526066602052604090205460ff16610d55576040517f320ae52900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b610d656108b56020830183611c37565b6000610d7760a0830160808401611fdf565b90506000610d8b60c0840160a08501611c37565b6068805463ffffffff90921668010000000000000000027fffffffffffffffffffffffffffffffffffffffff00000000000000000000000090921667ffffffffffffffff90941693909317179091555050565b600080600080610def87878761175a565b935093509350935093509350935093565b600080808080610e14565b60405180910390fd5b610e1f88888861175a565b94509450945094505093509350935093565b6000610e5b7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d61035490565b905073ffffffffffffffffffffffffffffffffffffffff8116610eb45773ffffffffffffffffffffffffffffffffffffffff7fb53127684a568b3173ae13b9f8a6016e243e63b6e8ee1178d6a717850b5d610355610ed6565b3373ffffffffffffffffffffffffffffffffffffffff821614610ed657600080fd5b600054610100900460ff1615808015610ef65750600054600160ff909116105b80610f105750303b158015610f10575060005460ff166001145b610f9c576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201527f647920696e697469616c697a65640000000000000000000000000000000000006064820152608401610e0b565b600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff001660011790558015610ffa57600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff166101001790555b6110026118a4565b73ffffffffffffffffffffffffffffffffffffffff8316600090815260666020526040902080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00166001179055606580547fffffffffffffffffffffffffffffffff000000000000000000000000000000001668056bc75e2d6310000017905560698054702f000000000000000000000000000000006fffffffffffffffffffffffffffffffff9190911617905580156109c357600080547fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00ff169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a1505050565b61112061127f565b606580547fffffffffffffffffffffffffffffffff00000000000000000000000000000000166fffffffffffffffffffffffffffffffff92909216919091179055565b61116b61127f565b606a80547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff92909216919091179055565b6111ba61127f565b73ffffffffffffffffffffffffffffffffffffffff811661125d576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201527f64647265737300000000000000000000000000000000000000000000000000006064820152608401610e0b565b61126681611300565b50565b61127161127f565b61127b8282611943565b5050565b60335473ffffffffffffffffffffffffffffffffffffffff163314610aff576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610e0b565b6033805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b63ffffffff8381166000908152606760205260408120606854606954929384938492680100000000000000009004909116906064906113dc9070010000000000000000000000000000000090046fffffffffffffffffffffffffffffffff1689612029565b6113e69190612075565b6113f09190612029565b8254909150600090611424907801000000000000000000000000000000000000000000000000900463ffffffff1688612029565b835460685491925060009167ffffffffffffffff7001000000000000000000000000000000009092048216918491869161145f91168b612089565b6114699190612089565b6114739190612089565b61147d9190612029565b60655485549192506fffffffffffffffffffffffffffffffff908116916114a5911683612029565b6114af9190612075565b935493996fffffffffffffffffffffffffffffffff9094169850929650505050505050565b60008060006114e286611a49565b63ffffffff8082166000908152606760205260408120805493945092909161152791780100000000000000000000000000000000000000000000000090041688612029565b61153390610c74612089565b825490915060009061156390700100000000000000000000000000000000900467ffffffffffffffff1683612029565b63ffffffff808b16600090815260676020526040812080549394509290916115a89178010000000000000000000000000000000000000000000000009004168b612029565b8254909150600090700100000000000000000000000000000000900467ffffffffffffffff166115d88b84612089565b6115e29190612029565b60655487549192506000916fffffffffffffffffffffffffffffffff9182169161160d911687612029565b6116179190612075565b60655485549192506000916fffffffffffffffffffffffffffffffff91821691611642911685612029565b61164c9190612075565b9050600061165a8284612089565b9554959f6fffffffffffffffffffffffffffffffff9096169e50949c50505050505050505050505050565b63ffffffff808416600090815260676020526040812080549192839283916116ca91780100000000000000000000000000000000000000000000000090041687612029565b8254909150600090700100000000000000000000000000000000900467ffffffffffffffff166116fa8784612089565b6117049190612029565b60655484549192506fffffffffffffffffffffffffffffffff9081169161172c911683612029565b6117369190612075565b925492986fffffffffffffffffffffffffffffffff90931697509195505050505050565b60008080808061176c6175308961209c565b90508063ffffffff16606e148061178a57508063ffffffff1661279f145b8061179c57508063ffffffff16614eaf145b156117b6576117ac818888611377565b90955093506117fa565b8063ffffffff16606f14806117d257508063ffffffff16612794145b806117e457508063ffffffff16614ea4145b156117fa576117f48188886114d4565b90955093505b63ffffffff81166000908152606b602052604090205460ff16600281600281111561182757611827611c59565b03611841576118378289896114d4565b9096509450611876565b600181600281111561185557611855611c59565b0361186557611837828989611377565b611870828989611685565b90965094505b505060655460695494989397506fffffffffffffffffffffffffffffffff9081169650909316935090915050565b600054610100900460ff1661193b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610e0b565b610aff611b4b565b73ffffffffffffffffffffffffffffffffffffffff8216611990576040517f6b7a931000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60008273ffffffffffffffffffffffffffffffffffffffff168260405160006040518083038185875af1925050503d80600081146119ea576040519150601f19603f3d011682016040523d82523d6000602084013e6119ef565b606091505b50509050806109c3576040517f465bc83400000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff8416600482015260248101839052604401610e0b565b600080611a586175308461209c565b90508063ffffffff16606f03611a715750606592915050565b8063ffffffff1661279403611a8a575061278992915050565b8063ffffffff16614ea403611aa35750614e9992915050565b600263ffffffff82166000908152606b602052604090205460ff166002811115611acf57611acf611c59565b14611b0e576040517ff42c33dc00000000000000000000000000000000000000000000000000000000815263ffffffff84166004820152602401610e0b565b6127108163ffffffff161015611b275750606592915050565b614e208163ffffffff161015611b4157506127b192915050565b50614e9992915050565b600054610100900460ff16611be2576040517f08c379a000000000000000000000000000000000000000000000000000000000815260206004820152602b60248201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960448201527f6e697469616c697a696e670000000000000000000000000000000000000000006064820152608401610e0b565b610aff33611300565b803563ffffffff81168114611bff57600080fd5b919050565b600080600060608486031215611c1957600080fd5b611c2284611beb565b95602085013595506040909401359392505050565b600060208284031215611c4957600080fd5b611c5282611beb565b9392505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b6020810160038310611cc3577f4e487b7100000000000000000000000000000000000000000000000000000000600052602160045260246000fd5b91905290565b80356fffffffffffffffffffffffffffffffff81168114611bff57600080fd5b600060208284031215611cfb57600080fd5b611c5282611cc9565b60008060208385031215611d1757600080fd5b823567ffffffffffffffff80821115611d2f57600080fd5b818501915085601f830112611d4357600080fd5b813581811115611d5257600080fd5b8660208260071b8501011115611d6757600080fd5b60209290920196919550909350505050565b803573ffffffffffffffffffffffffffffffffffffffff81168114611bff57600080fd5b60008060408385031215611db057600080fd5b611db983611d79565b915060208301358015158114611dce57600080fd5b809150509250929050565b60008060208385031215611dec57600080fd5b823567ffffffffffffffff80821115611e0457600080fd5b818501915085601f830112611e1857600080fd5b813581811115611e2757600080fd5b8660208260061b8501011115611d6757600080fd5b803561ffff81168114611bff57600080fd5b600080600060608486031215611e6357600080fd5b611c2284611e3c565b600060c08284031215611e7e57600080fd5b50919050565b600060208284031215611e9657600080fd5b611c5282611d79565b600060208284031215611eb157600080fd5b611c5282611e3c565b60008060408385031215611ecd57600080fd5b611ed683611d79565b946020939093013593505050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b803567ffffffffffffffff81168114611bff57600080fd5b600060608284031215611f3d57600080fd5b6040516060810181811067ffffffffffffffff82111715611f87577f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b604052611f9383611cc9565b8152611fa160208401611f13565b6020820152611fb260408401611beb565b60408201529392505050565b600060208284031215611fd057600080fd5b813560038110611c5257600080fd5b600060208284031215611ff157600080fd5b611c5282611f13565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b808202811582820484141761204057612040611ffa565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601260045260246000fd5b60008261208457612084612046565b500490565b8082018082111561204057612040611ffa565b600063ffffffff808416806120b3576120b3612046565b9216919091069291505056fea26469706673582212202368d77009043311184ccc44845e21050131e4a67e3465034cbef11db565817164736f6c63430008160033