Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x60c06040 | 15621920 | 774 days ago | IN | 0 ETH | 0.04560123 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
FlatPriceSale
Compiler Version
v0.8.16+commit.07a7930e
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; // pragma abicoder v2; import "@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/security/PullPaymentUpgradeable.sol"; import "./Sale.sol"; /** Allow qualified users to participate in a sale according to sale rules. Management - the address that deploys the sale is the sale owner - owners may change some sale parameters (e.g. start and end times) - sale proceeds are sent to the sale recipient Qualification - public sale: anyone can participate - private sale: only users who can prove membership in a merkle tree can participate Sale Rules - timing: purchases can only be made - after the sale opens - after the per-account random queue time has elapsed - before the sale ends - purchase quantity: quantity is limited by - per-address limit - total sale limit - payment method: participants can pay using either - the native token on the network (e.g. ETH) - a single ERC-20 token (e.g. USDC) - number of purchases: there is no limit to the number of compliant purchases a user may make Token Distribution - this contract does not distribute any purchased tokens Metrics - purchase count: number of purchases made in this sale - user count: number of unique addresses that participated in this sale - total bought: value of purchases denominated in a base currency (e.g. USD) as an integer (to get the float value, divide by oracle decimals) - bought per user: value of a user's purchases denominated in a base currency (e.g. USD) total bought and bought per user metrics are inclusive of any fee charged (if a fee is charged, the sale recipient will receive less than the total spend) */ // Sale can only be updated post-initialization by the contract owner! struct Config { // the address that will receive sale proceeds (tokens and native) minus any fees sent to the fee recipient address payable recipient; // the merkle root used for proving access bytes32 merkleRoot; // max that can be spent in the sale in the base currency uint256 saleMaximum; // max that can be spent per user in the base currency uint256 userMaximum; // minimum that can be bought in a specific purchase uint256 purchaseMinimum; // the time at which the sale starts (users will have an additional random delay if maxQueueTime is set) uint startTime; // the time at which the sale will end, regardless of tokens raised uint endTime; // what is the maximum length of time a user could wait in the queue after the sale starts? uint256 maxQueueTime; // a link to off-chain information about this sale string URI; } // Metrics are only updated by the buyWithToken() and buyWithNative() functions struct Metrics { // number of purchases uint256 purchaseCount; // number of buyers uint256 buyerCount; // amount bought denominated in a base currency uint256 purchaseTotal; // amount bought for each user denominated in a base currency mapping(address => uint256) buyerTotal; } struct PaymentTokenInfo { AggregatorV3Interface oracle; uint8 decimals; } contract FlatPriceSale is Sale, PullPaymentUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; event ImplementationConstructor(address payable indexed feeRecipient, uint256 feeBips); event Update(Config config); event Initialize(Config config, string baseCurrency, AggregatorV3Interface nativeOracle, bool nativePaymentsEnabled); event SetPaymentTokenInfo(IERC20Upgradeable token, PaymentTokenInfo paymentTokenInfo); event SweepToken(address indexed token, uint256 amount); event SweepNative(uint256 amount); // All chainlink oracles used must have 8 decimals! uint256 constant public BASE_CURRENCY_DECIMALS = 8; // All supported chains must use 18 decimals (e.g. 1e18 wei / eth) uint256 constant internal NATIVE_TOKEN_DECIMALS = 18; // flag for additional merkle root data uint8 constant internal PER_USER_PURCHASE_LIMIT = 1; uint8 constant internal PER_USER_END_TIME = 2; /** Variables set by implementation contract constructor (immutable) */ // a fee may be charged by the sale manager uint256 immutable feeBips; // the recipient of the fee address payable immutable feeRecipient; /** Variables set during initialization of clone contracts ("immutable" on each instance) */ // the base currency being used, e.g. 'USD' string public baseCurrency; string public constant VERSION = "2.0"; // <native token>/<base currency> price, e.g. ETH/USD price AggregatorV3Interface public nativeTokenPriceOracle; // whether native payments are enabled (set during intialization) bool nativePaymentsEnabled; // <ERC20 token>/<base currency> price oracles, eg USDC address => ETH/USDC price mapping(IERC20Upgradeable => PaymentTokenInfo) public paymentTokens; // owner can update these Config public config; // derived from payments Metrics public metrics; // reasonably random value: xor of merkle root and blockhash for transaction setting merkle root uint160 internal randomValue; // All clones will share the information in the implementation constructor constructor( uint256 _feeBips, address payable _feeRecipient ) { if (_feeBips > 0) { require(_feeRecipient != address(0), "feeRecipient == 0"); } feeRecipient = _feeRecipient; feeBips = _feeBips; emit ImplementationConstructor(feeRecipient, feeBips); } /** Replacement for constructor for clones of the implementation contract Important: anyone can call the initialize function! */ function initialize( address _owner, Config calldata _config, string calldata _baseCurrency, bool _nativePaymentsEnabled, AggregatorV3Interface _nativeTokenPriceOracle, IERC20Upgradeable[] calldata tokens, AggregatorV3Interface[] calldata oracles, uint8[] calldata decimals ) public initializer validUpdate(_config) { // initialize the PullPayment escrow contract __PullPayment_init(); // validate the new sale require(tokens.length == oracles.length, "token and oracle lengths !="); require(tokens.length == decimals.length, "token and decimals lengths !="); require(address(_nativeTokenPriceOracle) != address(0), "native oracle == 0"); require(_nativeTokenPriceOracle.decimals() == BASE_CURRENCY_DECIMALS, "native oracle decimals != 8"); // save the new sale config = _config; // save payment config baseCurrency = _baseCurrency; nativeTokenPriceOracle = _nativeTokenPriceOracle; nativePaymentsEnabled = _nativePaymentsEnabled; emit Initialize(config, baseCurrency, nativeTokenPriceOracle, _nativePaymentsEnabled); for (uint i = 0; i < tokens.length; i++) { // double check that tokens and oracles are real addresses require(address(tokens[i]) != address(0), "payment token == 0"); require(address(oracles[i]) != address(0), "token oracle == 0"); // Double check that oracles use the expected 8 decimals require(oracles[i].decimals() == BASE_CURRENCY_DECIMALS, "token oracle decimals != 8"); // save the payment token info paymentTokens[tokens[i]] = PaymentTokenInfo({ oracle: oracles[i], decimals: decimals[i] }); emit SetPaymentTokenInfo(tokens[i], paymentTokens[tokens[i]]); } // Set the random value for the fair queue time randomValue = generatePseudorandomValue(config.merkleRoot); // transfer ownership to the user initializing the sale _transferOwnership(_owner); } /** Check that the user can currently participate in the sale based on the merkle root Merkle root options: - bytes32(0): this is a public sale, any address can participate - otherwise: this is a private sale, users must submit a merkle proof that their address is included in the merkle root */ modifier canAccessSale(bytes calldata data, bytes32[] calldata proof) { // make sure the buyer is an EOA // TODO: Review this check for meta-transactions require((_msgSender() == tx.origin), "Must buy with an EOA"); // If the merkle root is non-zero this is a private sale and requires a valid proof if (config.merkleRoot == bytes32(0)) { // this is a public sale // IMPORTANT: data is only validated if the merkle root is checked! Public sales do not check any merkle roots! require(data.length == 0, "data not permitted on public sale"); } else { // this is a private sale require( this.isValidMerkleProof( config.merkleRoot, _msgSender(), data, proof ) == true, "bad merkle proof for sale" ); } // Require the sale to be open require(block.timestamp > config.startTime, "sale has not started yet"); require(block.timestamp < config.endTime, "sale has ended"); require(metrics.purchaseTotal < config.saleMaximum, "sale buy limit reached"); // Reduce congestion by randomly assigning each user a delay time in a virtual queue based on comparing their address and a random value // if config.maxQueueTime == 0 the delay is 0 require(block.timestamp - config.startTime > getFairQueueTime(_msgSender()), "not your turn yet"); _; } /** Check that the new sale is a valid update - If the config already exists, it must not be over (cannot edit sale after it concludes) - Sale start, end, and max queue times must be consistent and not too far in the future */ modifier validUpdate(Config calldata newConfig) { // get the existing config Config memory oldConfig = config; /** - @notice - Block updates after sale is over - @dev - Since validUpdate is called by initialize(), we can have a new - sale here, identifiable by default randomValue of 0 */ if (randomValue != 0) { // this is an existing sale: cannot update after it has ended require(block.timestamp < oldConfig.endTime, "sale is over: cannot upate"); if (block.timestamp > oldConfig.startTime) { // the sale has already started, some things should not be edited require(oldConfig.saleMaximum == newConfig.saleMaximum, "editing saleMaximum after sale start"); } } // the total sale limit must be at least as large as the per-user limit // all required values must be present and reasonable // check if the caller accidentally entered a value in milliseconds instead of seconds require(newConfig.startTime <= 4102444800, "start > 4102444800 (Jan 1 2100)"); require(newConfig.endTime <= 4102444800, "end > 4102444800 (Jan 1 2100)"); require(newConfig.maxQueueTime <= 604800, "max queue time > 604800 (1 week)"); require(newConfig.recipient != address(0), "recipient == address(0)"); // sale, user, and purchase limits must be compatible require(newConfig.saleMaximum > 0, "saleMaximum == 0"); require(newConfig.userMaximum > 0, "userMaximum == 0"); require(newConfig.userMaximum <= newConfig.saleMaximum, "userMaximum > saleMaximum"); require(newConfig.purchaseMinimum <= newConfig.userMaximum, "purchaseMinimum > userMaximum"); // new sale times must be internally consistent require(newConfig.startTime + newConfig.maxQueueTime < newConfig.endTime, "sale must be open for at least maxQueueTime"); _; } modifier validPaymentToken(IERC20Upgradeable token) { // check that this token is configured as a payment method PaymentTokenInfo memory info = paymentTokens[token]; require(address(info.oracle) != address(0), "invalid payment token"); _; } modifier areNativePaymentsEnabled() { require(nativePaymentsEnabled, "native payments disabled"); _; } // Get info on a payment token function getPaymentToken(IERC20Upgradeable token) external view returns (PaymentTokenInfo memory) { return paymentTokens[token]; } // Get a positive token price from a chainlink oracle function getOraclePrice(AggregatorV3Interface oracle) public view returns (uint) { ( uint80 roundID, int _price, uint startedAt, uint timeStamp, uint80 answeredInRound ) = oracle.latestRoundData(); require(_price > 0, "negative price"); require(answeredInRound > 0, "answer == 0"); require(timeStamp > 0, "round not complete"); require(answeredInRound >= roundID, "stale price"); return uint(_price); } /** Generate a pseudorandom value This is not a truly random value: - miners can alter the block hash - owners can repeatedly call setMerkleRoot() - owners can choose when to submit the transaction */ function generatePseudorandomValue(bytes32 merkleRoot) public view returns(uint160) { return uint160(uint256(blockhash(block.number - 1))) ^ uint160(uint256(merkleRoot)); } /** Get the delay in seconds that a specific buyer must wait after the sale begins in order to buy tokens in the sale Buyers cannot exploit the fair queue when: - The sale is private (merkle root != bytes32(0)) - Each eligible buyer gets exactly one address in the merkle root Although miners and sellers can minimize the delay for an arbitrary address, these are not significant threats: - the economic opportunity to miners is zero or relatively small (only specific addresses can participate in private sales, and a better queue postion does not imply high returns) - sellers can repeatedly set merkle roots to achieve a favorable queue time for any address, but sellers already control the tokens being sold! */ function getFairQueueTime(address buyer) public view returns(uint) { if (config.maxQueueTime == 0) { // there is no delay: all addresses may participate immediately return 0; } // calculate a distance between the random value and the user's address using the XOR distance metric (c.f. Kademlia) uint160 distance = uint160(buyer) ^ randomValue; // calculate a speed at which the queue is exhausted such that all users complete the queue by sale.maxQueueTime uint160 distancePerSecond = type(uint160).max / uint160(config.maxQueueTime); // return the delay (seconds) return distance / distancePerSecond; } /** Convert a token quantity (e.g. USDC or ETH) to a base currency (e.g. USD) with the same number of decimals as the price oracle (e.g. 8) Example: given 2 NCT tokens, each worth $1.23, tokensToBaseCurrency should return 246000000 ($2.46) Function arguments - tokenQuantity: 2000000000000000000 - tokenDecimals: 18 NCT/USD chainlink oracle (important! the oracle must be <token>/<base currency> not <currency>/<base token>, e.g. ETH/USD, ~$2000 not USD/ETH, ~0.0005) - baseCurrencyPerToken: 123000000 - baseCurrencyDecimals: 8 Calculation: 2000000000000000000 * 123000000 / 1000000000000000000 Returns: 246000000 */ // function tokensToBaseCurrency(SafeERC20Upgradeable token, uint256 quantity) public view validPaymentToken(token) returns (uint256) { // PaymentTokenInfo info = paymentTokens[token]; // return quantity * getOraclePrice(info.oracle) / (10 ** info.decimals); // } function tokensToBaseCurrency(uint256 tokenQuantity, uint256 tokenDecimals, AggregatorV3Interface oracle) public view returns (uint256 value) { return tokenQuantity * getOraclePrice(oracle) / (10 ** tokenDecimals); } function total() external override view returns(uint256) { return metrics.purchaseTotal; } // return the amount bought by this user in base currency function buyerTotal(address user) external override view returns(uint256) { return metrics.buyerTotal[user]; } /** Records a purchase Follow the Checks -> Effects -> Interactions pattern * Checks: CALLER MUST ENSURE BUYER IS PERMITTED TO PARTICIPATE IN THIS SALE: THIS METHOD DOES NOT CHECK WHETHER THE BUYER SHOULD BE ABLE TO ACCESS THE SALE! * Effects: record the payment * Interactions: none! */ function _execute(uint256 baseCurrencyQuantity, bytes calldata data) internal { // Checks uint256 userLimit = config.userMaximum; if (data.length > 0) { require(uint8(bytes1(data[0:1])) == PER_USER_PURCHASE_LIMIT, "unknown data"); require(data.length == 33, "data length != 33 bytes"); userLimit = uint256(bytes32(data[1:33])); } require( baseCurrencyQuantity + metrics.buyerTotal[_msgSender()] <= userLimit, "purchase exceeds your limit" ); require( baseCurrencyQuantity + metrics.purchaseTotal <= config.saleMaximum, "purchase exceeds sale limit" ); require( baseCurrencyQuantity >= config.purchaseMinimum, "purchase under minimum" ); // Effects metrics.purchaseCount += 1; if (metrics.buyerTotal[_msgSender()] == 0) { // if no prior purchases, this is a new buyer metrics.buyerCount += 1; } metrics.purchaseTotal += baseCurrencyQuantity; metrics.buyerTotal[_msgSender()] += baseCurrencyQuantity; } /** Settle payment made with payment token Important: this function has no checks! Only call if the purchase is valid! */ function _settlePaymentToken(uint256 baseCurrencyValue, IERC20Upgradeable token, uint256 quantity) internal { uint256 fee = 0; if (feeBips > 0) { fee = (quantity * feeBips) / 10000; token.safeTransferFrom(_msgSender(), feeRecipient, fee); } token.safeTransferFrom(_msgSender(), address(this), quantity - fee); emit Buy(_msgSender(), address(token), baseCurrencyValue, quantity, fee); } /** Settle payment made with native token Important: this function has no checks! Only call if the purchase is valid! */ function _settleNativeToken(uint256 baseCurrencyValue, uint256 nativeTokenQuantity) internal { uint256 nativeFee = 0; if (feeBips > 0) { nativeFee = (nativeTokenQuantity * feeBips) / 10000; _asyncTransfer(feeRecipient, nativeFee); } _asyncTransfer(config.recipient, nativeFee); // This contract will hold the native token until claimed by the owner emit Buy(_msgSender(), address(0), baseCurrencyValue, nativeTokenQuantity, nativeFee); } /** Pay with the payment token (e.g. USDC) */ function buyWithToken( IERC20Upgradeable token, uint256 quantity, bytes calldata data, bytes32[] calldata proof ) external override canAccessSale(data, proof) validPaymentToken(token) nonReentrant { // convert to base currency from native tokens PaymentTokenInfo memory tokenInfo = paymentTokens[token]; uint256 baseCurrencyValue = tokensToBaseCurrency(quantity, tokenInfo.decimals, tokenInfo.oracle); // Checks and Effects _execute(baseCurrencyValue, data); // Interactions _settlePaymentToken(baseCurrencyValue, token, quantity); } /** Pay with the native token (e.g. ETH) */ function buyWithNative( bytes calldata data, bytes32[] calldata proof ) external override payable canAccessSale(data, proof) areNativePaymentsEnabled nonReentrant { // convert to base currency from native tokens uint256 baseCurrencyValue = tokensToBaseCurrency(msg.value, NATIVE_TOKEN_DECIMALS, nativeTokenPriceOracle); // Checks and Effects _execute(baseCurrencyValue, data); // Interactions _settleNativeToken(baseCurrencyValue, msg.value); } /** External management functions (only the owner may update the sale) */ function update(Config calldata _config) external validUpdate(_config) onlyOwner { config = _config; // updates always reset the random value randomValue = generatePseudorandomValue(config.merkleRoot); emit Update(config); } /** Public management functions */ // Sweep an ERC20 token to the recipient (public function) function sweepToken(IERC20Upgradeable token) external { uint256 amount = token.balanceOf(address(this)); token.safeTransfer(config.recipient, amount); emit SweepToken(address(token), amount); } // sweep native token to the recipient (public function) function sweepNative() external { uint256 amount = address(this).balance; (bool success, ) = config.recipient.call{value: amount}(""); require(success, "Transfer failed."); emit SweepNative(amount); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface AggregatorV3Interface { function decimals() external view returns (uint8); function description() external view returns (string memory); function version() external view returns (uint256); // getRoundData and latestRoundData should both raise "No data present" // if they do not have data to report, instead of returning unset values // which could be misinterpreted as actual reported values. function getRoundData(uint80 _roundId) external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); function latestRoundData() external view returns ( uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound ); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (access/Ownable.sol) pragma solidity ^0.8.0; import "../utils/ContextUpgradeable.sol"; import "../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 anymore. Can only be called by the current owner. * * NOTE: Renouncing ownership will leave the contract without an owner, * thereby removing 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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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] * ``` * 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. Equivalent to `reinitializer(1)`. */ 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. * * `initializer` is equivalent to `reinitializer(1)`, so 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. * * 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. */ 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. */ function _disableInitializers() internal virtual { require(!_initializing, "Initializable: contract is initializing"); if (_initialized < type(uint8).max) { _initialized = type(uint8).max; emit Initialized(type(uint8).max); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (security/PullPayment.sol) pragma solidity ^0.8.0; import "../utils/escrow/EscrowUpgradeable.sol"; import "../proxy/utils/Initializable.sol"; /** * @dev Simple implementation of a * https://consensys.github.io/smart-contract-best-practices/recommendations/#favor-pull-over-push-for-external-calls[pull-payment] * strategy, where the paying contract doesn't interact directly with the * receiver account, which must withdraw its payments itself. * * Pull-payments are often considered the best practice when it comes to sending * Ether, security-wise. It prevents recipients from blocking execution, and * eliminates reentrancy concerns. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. * * To use, derive from the `PullPayment` contract, and use {_asyncTransfer} * instead of Solidity's `transfer` function. Payees can query their due * payments with {payments}, and retrieve them with {withdrawPayments}. * * @custom:storage-size 51 */ abstract contract PullPaymentUpgradeable is Initializable { EscrowUpgradeable private _escrow; function __PullPayment_init() internal onlyInitializing { __PullPayment_init_unchained(); } function __PullPayment_init_unchained() internal onlyInitializing { _escrow = new EscrowUpgradeable(); _escrow.initialize(); } /** * @dev Withdraw accumulated payments, forwarding all gas to the recipient. * * Note that _any_ account can call this function, not just the `payee`. * This means that contracts unaware of the `PullPayment` protocol can still * receive funds this way, by having a separate account call * {withdrawPayments}. * * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. * Make sure you trust the recipient, or are either following the * checks-effects-interactions pattern or using {ReentrancyGuard}. * * @param payee Whose payments will be withdrawn. * * Causes the `escrow` to emit a {Withdrawn} event. */ function withdrawPayments(address payable payee) public virtual { _escrow.withdraw(payee); } /** * @dev Returns the payments owed to an address. * @param dest The creditor's address. */ function payments(address dest) public view returns (uint256) { return _escrow.depositsOf(dest); } /** * @dev Called by the payer to store the sent amount as credit to be pulled. * Funds sent in this way are stored in an intermediate {Escrow} contract, so * there is no danger of them being spent before withdrawal. * * @param dest The destination address of the funds. * @param amount The amount to transfer. * * Causes the `escrow` to emit a {Deposited} event. */ function _asyncTransfer(address dest, uint256 amount) internal virtual { _escrow.deposit{value: amount}(dest); } /** * @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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (security/ReentrancyGuard.sol) pragma solidity ^0.8.0; import "../proxy/utils/Initializable.sol"; /** * @dev Contract module that helps prevent reentrant calls to a function. * * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier * available, which can be applied to functions to make sure there are no nested * (reentrant) calls to them. * * Note that because there is a single `nonReentrant` guard, functions marked as * `nonReentrant` may not call one another. This can be worked around by making * those functions `private`, and then adding `external` `nonReentrant` entry * points to them. * * TIP: If you would like to learn more about reentrancy and alternative ways * to protect against it, check out our blog post * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul]. */ abstract contract ReentrancyGuardUpgradeable is Initializable { // Booleans are more expensive than uint256 or any type that takes up a full // word because each write operation emits an extra SLOAD to first read the // slot's contents, replace the bits taken up by the boolean, and then write // back. This is the compiler's defense against contract upgrades and // pointer aliasing, and it cannot be disabled. // The values being non-zero value makes deployment a bit more expensive, // but in exchange the refund on every call to nonReentrant will be lower in // amount. Since refunds are capped to a percentage of the total // transaction's gas, it is best to keep them low in cases like this one, to // increase the likelihood of the full refund coming into effect. uint256 private constant _NOT_ENTERED = 1; uint256 private constant _ENTERED = 2; uint256 private _status; function __ReentrancyGuard_init() internal onlyInitializing { __ReentrancyGuard_init_unchained(); } function __ReentrancyGuard_init_unchained() internal onlyInitializing { _status = _NOT_ENTERED; } /** * @dev Prevents a contract from calling itself, directly or indirectly. * Calling a `nonReentrant` function from another `nonReentrant` * function is not supported. It is possible to prevent this from happening * by making the `nonReentrant` function external, and making it call a * `private` function that does the actual work. */ modifier nonReentrant() { // On the first call to nonReentrant, _notEntered will be true require(_status != _ENTERED, "ReentrancyGuard: reentrant call"); // Any calls to nonReentrant after this point will fail _status = _ENTERED; _; // By storing the original value once again, a refund is triggered (see // https://eips.ethereum.org/EIPS/eip-2200) _status = _NOT_ENTERED; } /** * @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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.6.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20Upgradeable { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom( address from, address to, uint256 amount ) external returns (bool); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/draft-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. */ interface IERC20PermitUpgradeable { /** * @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]. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; import "../IERC20Upgradeable.sol"; import "../extensions/draft-IERC20PermitUpgradeable.sol"; import "../../../utils/AddressUpgradeable.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 SafeERC20Upgradeable { using AddressUpgradeable for address; function safeTransfer( IERC20Upgradeable token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } function safeTransferFrom( IERC20Upgradeable 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( IERC20Upgradeable 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)); } function safeIncreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20Upgradeable token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } function safePermit( IERC20PermitUpgradeable 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(IERC20Upgradeable 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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.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 * ==== * * [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://diligence.consensys.net/posts/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.5.11/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 functionCall(target, data, "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"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(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) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason 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 { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts v4.4.1 (utils/Context.sol) pragma solidity ^0.8.0; import "../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; } /** * @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; }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/cryptography/MerkleProof.sol) pragma solidity ^0.8.0; /** * @dev These functions deal with verification of Merkle Tree proofs. * * The proofs can be generated using the JavaScript library * https://github.com/miguelmota/merkletreejs[merkletreejs]. * Note: the hashing algorithm should be keccak256 and pair sorting should be enabled. * * See `test/utils/cryptography/MerkleProof.test.js` for some examples. * * WARNING: You should avoid using leaf values that are 64 bytes long prior to * hashing, or use a hash function other than keccak256 for hashing leaves. * This is because the concatenation of a sorted pair of internal nodes in * the merkle tree could be reinterpreted as a leaf value. */ library MerkleProofUpgradeable { /** * @dev Returns true if a `leaf` can be proved to be a part of a Merkle tree * defined by `root`. For this, a `proof` must be provided, containing * sibling hashes on the branch from the leaf to the root of the tree. Each * pair of leaves and each pair of pre-images are assumed to be sorted. */ function verify( bytes32[] memory proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProof(proof, leaf) == root; } /** * @dev Calldata version of {verify} * * _Available since v4.7._ */ function verifyCalldata( bytes32[] calldata proof, bytes32 root, bytes32 leaf ) internal pure returns (bool) { return processProofCalldata(proof, leaf) == root; } /** * @dev Returns the rebuilt hash obtained by traversing a Merkle tree up * from `leaf` using `proof`. A `proof` is valid if and only if the rebuilt * hash matches the root of the tree. When processing the proof, the pairs * of leafs & pre-images are assumed to be sorted. * * _Available since v4.4._ */ function processProof(bytes32[] memory proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Calldata version of {processProof} * * _Available since v4.7._ */ function processProofCalldata(bytes32[] calldata proof, bytes32 leaf) internal pure returns (bytes32) { bytes32 computedHash = leaf; for (uint256 i = 0; i < proof.length; i++) { computedHash = _hashPair(computedHash, proof[i]); } return computedHash; } /** * @dev Returns true if the `leaves` can be proved to be a part of a Merkle tree defined by * `root`, according to `proof` and `proofFlags` as described in {processMultiProof}. * * _Available since v4.7._ */ function multiProofVerify( bytes32[] memory proof, bool[] memory proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProof(proof, proofFlags, leaves) == root; } /** * @dev Calldata version of {multiProofVerify} * * _Available since v4.7._ */ function multiProofVerifyCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32 root, bytes32[] memory leaves ) internal pure returns (bool) { return processMultiProofCalldata(proof, proofFlags, leaves) == root; } /** * @dev Returns the root of a tree reconstructed from `leaves` and the sibling nodes in `proof`, * consuming from one or the other at each step according to the instructions given by * `proofFlags`. * * _Available since v4.7._ */ function processMultiProof( bytes32[] memory proof, bool[] memory proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } /** * @dev Calldata version of {processMultiProof} * * _Available since v4.7._ */ function processMultiProofCalldata( bytes32[] calldata proof, bool[] calldata proofFlags, bytes32[] memory leaves ) internal pure returns (bytes32 merkleRoot) { // This function rebuild the root hash by traversing the tree up from the leaves. The root is rebuilt by // consuming and producing values on a queue. The queue starts with the `leaves` array, then goes onto the // `hashes` array. At the end of the process, the last hash in the `hashes` array should contain the root of // the merkle tree. uint256 leavesLen = leaves.length; uint256 totalHashes = proofFlags.length; // Check proof validity. require(leavesLen + proof.length - 1 == totalHashes, "MerkleProof: invalid multiproof"); // The xxxPos values are "pointers" to the next value to consume in each array. All accesses are done using // `xxx[xxxPos++]`, which return the current value and increment the pointer, thus mimicking a queue's "pop". bytes32[] memory hashes = new bytes32[](totalHashes); uint256 leafPos = 0; uint256 hashPos = 0; uint256 proofPos = 0; // At each step, we compute the next hash using two values: // - a value from the "main queue". If not all leaves have been consumed, we get the next leaf, otherwise we // get the next hash. // - depending on the flag, either another value for the "main queue" (merging branches) or an element from the // `proof` array. for (uint256 i = 0; i < totalHashes; i++) { bytes32 a = leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++]; bytes32 b = proofFlags[i] ? leafPos < leavesLen ? leaves[leafPos++] : hashes[hashPos++] : proof[proofPos++]; hashes[i] = _hashPair(a, b); } if (totalHashes > 0) { return hashes[totalHashes - 1]; } else if (leavesLen > 0) { return leaves[0]; } else { return proof[0]; } } function _hashPair(bytes32 a, bytes32 b) private pure returns (bytes32) { return a < b ? _efficientHash(a, b) : _efficientHash(b, a); } function _efficientHash(bytes32 a, bytes32 b) private pure returns (bytes32 value) { /// @solidity memory-safe-assembly assembly { mstore(0x00, a) mstore(0x20, b) value := keccak256(0x00, 0x40) } } }
// SPDX-License-Identifier: MIT // OpenZeppelin Contracts (last updated v4.7.0) (utils/escrow/Escrow.sol) pragma solidity ^0.8.0; import "../../access/OwnableUpgradeable.sol"; import "../AddressUpgradeable.sol"; import "../../proxy/utils/Initializable.sol"; /** * @title Escrow * @dev Base escrow contract, holds funds designated for a payee until they * withdraw them. * * Intended usage: This contract (and derived escrow contracts) should be a * standalone contract, that only interacts with the contract that instantiated * it. That way, it is guaranteed that all Ether will be handled according to * the `Escrow` rules, and there is no need to check for payable functions or * transfers in the inheritance tree. The contract that uses the escrow as its * payment method should be its owner, and provide public methods redirecting * to the escrow's deposit and withdraw. */ contract EscrowUpgradeable is Initializable, OwnableUpgradeable { function __Escrow_init() internal onlyInitializing { __Ownable_init_unchained(); } function __Escrow_init_unchained() internal onlyInitializing { } function initialize() public virtual initializer { __Escrow_init(); } using AddressUpgradeable for address payable; event Deposited(address indexed payee, uint256 weiAmount); event Withdrawn(address indexed payee, uint256 weiAmount); mapping(address => uint256) private _deposits; function depositsOf(address payee) public view returns (uint256) { return _deposits[payee]; } /** * @dev Stores the sent amount as credit to be withdrawn. * @param payee The destination address of the funds. * * Emits a {Deposited} event. */ function deposit(address payee) public payable virtual onlyOwner { uint256 amount = msg.value; _deposits[payee] += amount; emit Deposited(payee, amount); } /** * @dev Withdraw accumulated balance for a payee, forwarding all gas to the * recipient. * * WARNING: Forwarding all gas opens the door to reentrancy vulnerabilities. * Make sure you trust the recipient, or are either following the * checks-effects-interactions pattern or using {ReentrancyGuard}. * * @param payee The address whose funds will be withdrawn and transferred to. * * Emits a {Withdrawn} event. */ function withdraw(address payable payee) public virtual onlyOwner { uint256 payment = _deposits[payee]; _deposits[payee] = 0; payee.sendValue(payment); emit Withdrawn(payee, payment); } /** * @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; }
// SPDX-License-Identifier: MIT pragma solidity 0.8.16; import "@openzeppelin/contracts-upgradeable/security/ReentrancyGuardUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; import "@openzeppelin/contracts-upgradeable/token/ERC20/utils/SafeERC20Upgradeable.sol"; import "@openzeppelin/contracts-upgradeable/utils/cryptography/MerkleProofUpgradeable.sol"; // Upgradeable contracts are required to use clone() in SaleFactory abstract contract Sale is ReentrancyGuardUpgradeable, OwnableUpgradeable { using SafeERC20Upgradeable for IERC20Upgradeable; event Buy(address indexed buyer, address indexed token, uint256 baseCurrencyValue, uint256 tokenValue, uint256 tokenFee); /** Important: the constructor is only called once on the implementation contract (which is never initialized) Clones using this implementation cannot use this constructor method. Thus every clone must use the same fields stored in the constructor (feeBips, feeRecipient) */ /// @custom:oz-upgrades-unsafe-allow constructor constructor() { _disableInitializers(); } // is this user permitted to access a sale? function isValidMerkleProof( bytes32 root, address account, bytes calldata data, bytes32[] calldata proof ) public pure returns (bool) { // check if the account is in the merkle tree bytes32 leaf = keccak256(abi.encodePacked(account, data)); if (MerkleProofUpgradeable.verify(proof, root, leaf)) { return true; } return false; } function buyWithToken( IERC20Upgradeable token, uint256 quantity, bytes calldata data, bytes32[] calldata proof ) external virtual {} function buyWithNative( bytes calldata data, bytes32[] calldata proof ) external virtual payable {} function isOpen() public virtual view returns(bool) {} function isOver() public virtual view returns(bool) {} function buyerTotal(address user) external virtual view returns(uint256) {} function total() external virtual view returns(uint256) {} }
{ "evmVersion": "london", "libraries": {}, "metadata": { "bytecodeHash": "ipfs", "useLiteralContent": true }, "optimizer": { "enabled": true, "runs": 200 }, "remappings": [], "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"uint256","name":"_feeBips","type":"uint256"},{"internalType":"address payable","name":"_feeRecipient","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"buyer","type":"address"},{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"baseCurrencyValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenValue","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"tokenFee","type":"uint256"}],"name":"Buy","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address payable","name":"feeRecipient","type":"address"},{"indexed":false,"internalType":"uint256","name":"feeBips","type":"uint256"}],"name":"ImplementationConstructor","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"saleMaximum","type":"uint256"},{"internalType":"uint256","name":"userMaximum","type":"uint256"},{"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"maxQueueTime","type":"uint256"},{"internalType":"string","name":"URI","type":"string"}],"indexed":false,"internalType":"struct Config","name":"config","type":"tuple"},{"indexed":false,"internalType":"string","name":"baseCurrency","type":"string"},{"indexed":false,"internalType":"contract AggregatorV3Interface","name":"nativeOracle","type":"address"},{"indexed":false,"internalType":"bool","name":"nativePaymentsEnabled","type":"bool"}],"name":"Initialize","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint8","name":"version","type":"uint8"}],"name":"Initialized","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"components":[{"internalType":"contract AggregatorV3Interface","name":"oracle","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"indexed":false,"internalType":"struct PaymentTokenInfo","name":"paymentTokenInfo","type":"tuple"}],"name":"SetPaymentTokenInfo","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SweepNative","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"SweepToken","type":"event"},{"anonymous":false,"inputs":[{"components":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"saleMaximum","type":"uint256"},{"internalType":"uint256","name":"userMaximum","type":"uint256"},{"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"maxQueueTime","type":"uint256"},{"internalType":"string","name":"URI","type":"string"}],"indexed":false,"internalType":"struct Config","name":"config","type":"tuple"}],"name":"Update","type":"event"},{"inputs":[],"name":"BASE_CURRENCY_DECIMALS","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"baseCurrency","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buyWithNative","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"},{"internalType":"uint256","name":"quantity","type":"uint256"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"buyWithToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"user","type":"address"}],"name":"buyerTotal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"config","outputs":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"saleMaximum","type":"uint256"},{"internalType":"uint256","name":"userMaximum","type":"uint256"},{"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"maxQueueTime","type":"uint256"},{"internalType":"string","name":"URI","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"}],"name":"generatePseudorandomValue","outputs":[{"internalType":"uint160","name":"","type":"uint160"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"buyer","type":"address"}],"name":"getFairQueueTime","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract AggregatorV3Interface","name":"oracle","type":"address"}],"name":"getOraclePrice","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"}],"name":"getPaymentToken","outputs":[{"components":[{"internalType":"contract AggregatorV3Interface","name":"oracle","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"internalType":"struct PaymentTokenInfo","name":"","type":"tuple"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"components":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"saleMaximum","type":"uint256"},{"internalType":"uint256","name":"userMaximum","type":"uint256"},{"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"maxQueueTime","type":"uint256"},{"internalType":"string","name":"URI","type":"string"}],"internalType":"struct Config","name":"_config","type":"tuple"},{"internalType":"string","name":"_baseCurrency","type":"string"},{"internalType":"bool","name":"_nativePaymentsEnabled","type":"bool"},{"internalType":"contract AggregatorV3Interface","name":"_nativeTokenPriceOracle","type":"address"},{"internalType":"contract IERC20Upgradeable[]","name":"tokens","type":"address[]"},{"internalType":"contract AggregatorV3Interface[]","name":"oracles","type":"address[]"},{"internalType":"uint8[]","name":"decimals","type":"uint8[]"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"isOpen","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"isOver","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"root","type":"bytes32"},{"internalType":"address","name":"account","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"bytes32[]","name":"proof","type":"bytes32[]"}],"name":"isValidMerkleProof","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"metrics","outputs":[{"internalType":"uint256","name":"purchaseCount","type":"uint256"},{"internalType":"uint256","name":"buyerCount","type":"uint256"},{"internalType":"uint256","name":"purchaseTotal","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nativeTokenPriceOracle","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"","type":"address"}],"name":"paymentTokens","outputs":[{"internalType":"contract AggregatorV3Interface","name":"oracle","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"dest","type":"address"}],"name":"payments","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"sweepNative","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"contract IERC20Upgradeable","name":"token","type":"address"}],"name":"sweepToken","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"tokenQuantity","type":"uint256"},{"internalType":"uint256","name":"tokenDecimals","type":"uint256"},{"internalType":"contract AggregatorV3Interface","name":"oracle","type":"address"}],"name":"tokensToBaseCurrency","outputs":[{"internalType":"uint256","name":"value","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"total","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address payable","name":"recipient","type":"address"},{"internalType":"bytes32","name":"merkleRoot","type":"bytes32"},{"internalType":"uint256","name":"saleMaximum","type":"uint256"},{"internalType":"uint256","name":"userMaximum","type":"uint256"},{"internalType":"uint256","name":"purchaseMinimum","type":"uint256"},{"internalType":"uint256","name":"startTime","type":"uint256"},{"internalType":"uint256","name":"endTime","type":"uint256"},{"internalType":"uint256","name":"maxQueueTime","type":"uint256"},{"internalType":"string","name":"URI","type":"string"}],"internalType":"struct Config","name":"_config","type":"tuple"}],"name":"update","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address payable","name":"payee","type":"address"}],"name":"withdrawPayments","outputs":[],"stateMutability":"nonpayable","type":"function"}]
Contract Creation Code
60c06040523480156200001157600080fd5b50604051620044fd380380620044fd8339810160408190526200003491620001a3565b6200003e620000e4565b811562000095576001600160a01b038116620000955760405162461bcd60e51b81526020600482015260116024820152700666565526563697069656e74203d3d203607c1b60448201526064015b60405180910390fd5b6001600160a01b03811660a081905260808390526040518381527fdac4fd790edde0c2ab54e0618fa7d2d818b20fe5504b25328f64c7246121e0eb9060200160405180910390a25050620001e2565b600054610100900460ff16156200014e5760405162461bcd60e51b815260206004820152602760248201527f496e697469616c697a61626c653a20636f6e747261637420697320696e697469604482015266616c697a696e6760c81b60648201526084016200008c565b60005460ff9081161015620001a1576000805460ff191660ff9081179091556040519081527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b565b60008060408385031215620001b757600080fd5b825160208401519092506001600160a01b0381168114620001d757600080fd5b809150509250929050565b60805160a0516142d962000224600039600081816128db01526129d0015260008181612879015281816128a501528181612963015261298f01526142d96000f3fe6080604052600436106101b75760003560e01c80638dbc8343116100ec578063cc8f91821161008a578063e6064de311610064578063e6064de31461057c578063ea5176451461059c578063f2fde38b146105bc578063ffa1ad74146105dc57600080fd5b8063cc8f918214610529578063e2982c211461053c578063e49248d51461055c57600080fd5b8063a9e0c9c3116100c6578063a9e0c9c314610491578063ab803a76146104b1578063b4bd9e2714610267578063c3b88b42146104c657600080fd5b80638dbc8343146103a657806392a85fde14610435578063a04748f61461045757600080fd5b8063621aa9251161015957806375f620ac1161013357806375f620ac1461031e57806379502c551461033e578063826b90f2146103685780638da5cb5b1461038857600080fd5b8063621aa925146102b1578063669ad092146102e9578063715018a61461030957600080fd5b8063311d5c6211610195578063311d5c621461023257806331b3eb941461024757806347535d7b146102675780634cc233a81461027b57600080fd5b806301c3753f146101bc5780631be19560146101f15780632ddbd13a14610213575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004612ee2565b61060b565b60405190151581526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004612f6d565b61069a565b005b34801561021f57600080fd5b5060d8545b6040519081526020016101e8565b34801561023e57600080fd5b50610224600881565b34801561025357600080fd5b50610211610262366004612f6d565b610769565b34801561027357600080fd5b5060006101dc565b34801561028757600080fd5b50610224610296366004612f6d565b6001600160a01b0316600090815260d9602052604090205490565b3480156102bd57600080fd5b506102d16102cc366004612f8a565b6107cb565b6040516001600160a01b0390911681526020016101e8565b3480156102f557600080fd5b50610211610304366004612fd5565b6107e1565b34801561031557600080fd5b5061021161137a565b34801561032a57600080fd5b50610224610339366004612f6d565b61138e565b34801561034a57600080fd5b50610353611534565b6040516101e899989796959493929190613160565b34801561037457600080fd5b506102116103833660046131bd565b6115f7565b34801561039457600080fd5b506065546001600160a01b03166102d1565b3480156103b257600080fd5b5061040e6103c1366004612f6d565b604080518082018252600080825260209182018190526001600160a01b03938416815260cc82528290208251808401909352549283168252600160a01b90920460ff169181019190915290565b6040805182516001600160a01b0316815260209283015160ff1692810192909252016101e8565b34801561044157600080fd5b5061044a611ad9565b6040516101e891906131f9565b34801561046357600080fd5b5060d65460d75460d85461047692919083565b604080519384526020840192909252908201526060016101e8565b34801561049d57600080fd5b506102246104ac366004612f6d565b611b67565b3480156104bd57600080fd5b50610211611bb8565b3480156104d257600080fd5b506105086104e1366004612f6d565b60cc602052600090815260409020546001600160a01b03811690600160a01b900460ff1682565b604080516001600160a01b03909316835260ff9091166020830152016101e8565b61021161053736600461320c565b611c89565b34801561054857600080fd5b50610224610557366004612f6d565b611fde565b34801561056857600080fd5b50610224610577366004613277565b612053565b34801561058857600080fd5b5060cb546102d1906001600160a01b031681565b3480156105a857600080fd5b506102116105b73660046132b0565b612087565b3480156105c857600080fd5b506102116105d7366004612f6d565b612435565b3480156105e857600080fd5b5061044a604051806040016040528060038152602001620322e360ec1b81525081565b600080868686604051602001610623939291906132f7565b60405160208183030381529060405280519060200120905061067b8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508c92508591506124ae9050565b1561068a576001915050610690565b60009150505b9695505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107059190613323565b60cd54909150610722906001600160a01b038481169116836124c4565b816001600160a01b03167ff4a44a7f605c4971a27bcecb448108e6328b7fad34fab5bff4f69377294b826d8260405161075d91815260200190565b60405180910390a25050565b6097546040516351cff8d960e01b81526001600160a01b038381166004830152909116906351cff8d990602401600060405180830381600087803b1580156107b057600080fd5b505af11580156107c4573d6000803e3d6000fd5b5050505050565b6000816107d9600143613352565b401892915050565b600054610100900460ff16158080156108015750600054600160ff909116105b8061081b5750303b15801561081b575060005460ff166001145b6108835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156108a6576000805461ff0019166101001790555b604080516101208101825260cd80546001600160a01b0316825260ce54602083015260cf549282019290925260d054606082015260d154608082015260d25460a082015260d35460c082015260d45460e082015260d580548f936000939290916101008401919061091690613365565b80601f016020809104026020016040519081016040528092919081815260200182805461094290613365565b801561098f5780601f106109645761010080835404028352916020019161098f565b820191906000526020600020905b81548152906001019060200180831161097257829003601f168201915b50505091909252505060da54919250506001600160a01b031615610a33578060c001514210610a005760405162461bcd60e51b815260206004820152601a60248201527f73616c65206973206f7665723a2063616e6e6f74207570617465000000000000604482015260640161087a565b8060a00151421115610a33578160400135816040015114610a335760405162461bcd60e51b815260040161087a90613399565b63f48657008260a001351115610a8b5760405162461bcd60e51b815260206004820152601f60248201527f7374617274203e203431303234343438303020284a616e203120323130302900604482015260640161087a565b63f48657008260c001351115610ae35760405162461bcd60e51b815260206004820152601d60248201527f656e64203e203431303234343438303020284a616e2031203231303029000000604482015260640161087a565b62093a808260e001351115610b3a5760405162461bcd60e51b815260206004820181905260248201527f6d61782071756575652074696d65203e20363034383030202831207765656b29604482015260640161087a565b6000610b496020840184612f6d565b6001600160a01b031603610b995760405162461bcd60e51b8152602060048201526017602482015276726563697069656e74203d3d206164647265737328302960481b604482015260640161087a565b6000826040013511610be05760405162461bcd60e51b815260206004820152601060248201526f073616c654d6178696d756d203d3d20360841b604482015260640161087a565b6000826060013511610c275760405162461bcd60e51b815260206004820152601060248201526f0757365724d6178696d756d203d3d20360841b604482015260640161087a565b816040013582606001351115610c7b5760405162461bcd60e51b8152602060048201526019602482015278757365724d6178696d756d203e2073616c654d6178696d756d60381b604482015260640161087a565b816060013582608001351115610cd35760405162461bcd60e51b815260206004820152601d60248201527f70757263686173654d696e696d756d203e20757365724d6178696d756d000000604482015260640161087a565b60c0820135610cea60e084013560a08501356133dd565b10610d075760405162461bcd60e51b815260040161087a906133f0565b610d0f61252c565b878614610d5e5760405162461bcd60e51b815260206004820152601b60248201527f746f6b656e20616e64206f7261636c65206c656e6774687320213d0000000000604482015260640161087a565b878414610dad5760405162461bcd60e51b815260206004820152601d60248201527f746f6b656e20616e6420646563696d616c73206c656e6774687320213d000000604482015260640161087a565b6001600160a01b038a16610df85760405162461bcd60e51b815260206004820152601260248201527106e6174697665206f7261636c65203d3d20360741b604482015260640161087a565b60088a6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5c919061344a565b60ff1614610eac5760405162461bcd60e51b815260206004820152601b60248201527f6e6174697665206f7261636c6520646563696d616c7320213d20380000000000604482015260640161087a565b8d60cd610eb982826135dd565b5060ca9050610ec98d8f8361351e565b508960cb60006101000a8154816001600160a01b0302191690836001600160a01b031602179055508a60cb60146101000a81548160ff0219169083151502179055507fb08510a4a112663ff701fcf43686a47fd456cb1a471dd63d662b73612cf700b360cd60ca60cb60009054906101000a90046001600160a01b03168e604051610f579493929190613768565b60405180910390a160005b888110156112ed5760008a8a83818110610f7e57610f7e6137af565b9050602002016020810190610f939190612f6d565b6001600160a01b031603610fde5760405162461bcd60e51b815260206004820152601260248201527107061796d656e7420746f6b656e203d3d20360741b604482015260640161087a565b6000888883818110610ff257610ff26137af565b90506020020160208101906110079190612f6d565b6001600160a01b0316036110515760405162461bcd60e51b81526020600482015260116024820152700746f6b656e206f7261636c65203d3d203607c1b604482015260640161087a565b6008888883818110611065576110656137af565b905060200201602081019061107a9190612f6d565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110db919061344a565b60ff161461112b5760405162461bcd60e51b815260206004820152601a60248201527f746f6b656e206f7261636c6520646563696d616c7320213d2038000000000000604482015260640161087a565b6040518060400160405280898984818110611148576111486137af565b905060200201602081019061115d9190612f6d565b6001600160a01b0316815260200187878481811061117d5761117d6137af565b905060200201602081019061119291906137c5565b60ff16905260cc60008c8c858181106111ad576111ad6137af565b90506020020160208101906111c29190612f6d565b6001600160a01b039081168252602080830193909352604090910160002083518154949093015160ff16600160a01b026001600160a81b031990941692909116919091179190911790557f1573dfedb5172e215558f8ffa409a71a5e42c596c15c482a04ff548914ebfa778a8a8381811061123f5761123f6137af565b90506020020160208101906112549190612f6d565b60cc60008d8d8681811061126a5761126a6137af565b905060200201602081019061127f9190612f6d565b6001600160a01b03166001600160a01b031681526020019081526020016000206040516112d39291906001600160a01b0392831681529054918216602082015260a09190911c60ff16604082015260600190565b60405180910390a1806112e5816137e2565b915050610f62565b5060ce546112fa906107cb565b60da80546001600160a01b0319166001600160a01b03929092169190911790556113238f61255b565b5050801561136b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b6113826125ad565b61138c600061255b565b565b600080600080600080866001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156113d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f99190613815565b94509450945094509450600084136114445760405162461bcd60e51b815260206004820152600e60248201526d6e6567617469766520707269636560901b604482015260640161087a565b60008169ffffffffffffffffffff161161148e5760405162461bcd60e51b815260206004820152600b60248201526a0616e73776572203d3d20360ac1b604482015260640161087a565b600082116114d35760405162461bcd60e51b8152602060048201526012602482015271726f756e64206e6f7420636f6d706c65746560701b604482015260640161087a565b8469ffffffffffffffffffff168169ffffffffffffffffffff1610156115295760405162461bcd60e51b815260206004820152600b60248201526a7374616c6520707269636560a81b604482015260640161087a565b509195945050505050565b60cd805460ce5460cf5460d05460d15460d25460d35460d45460d580546001600160a01b0390991699979896979596949593949293919261157490613365565b80601f01602080910402602001604051908101604052809291908181526020018280546115a090613365565b80156115ed5780601f106115c2576101008083540402835291602001916115ed565b820191906000526020600020905b8154815290600101906020018083116115d057829003601f168201915b5050505050905089565b604080516101208101825260cd80546001600160a01b0316825260ce54602083015260cf549282019290925260d054606082015260d154608082015260d25460a082015260d35460c082015260d45460e082015260d5805484936000939290916101008401919061166790613365565b80601f016020809104026020016040519081016040528092919081815260200182805461169390613365565b80156116e05780601f106116b5576101008083540402835291602001916116e0565b820191906000526020600020905b8154815290600101906020018083116116c357829003601f168201915b50505091909252505060da54919250506001600160a01b031615611784578060c0015142106117515760405162461bcd60e51b815260206004820152601a60248201527f73616c65206973206f7665723a2063616e6e6f74207570617465000000000000604482015260640161087a565b8060a001514211156117845781604001358160400151146117845760405162461bcd60e51b815260040161087a90613399565b63f48657008260a0013511156117dc5760405162461bcd60e51b815260206004820152601f60248201527f7374617274203e203431303234343438303020284a616e203120323130302900604482015260640161087a565b63f48657008260c0013511156118345760405162461bcd60e51b815260206004820152601d60248201527f656e64203e203431303234343438303020284a616e2031203231303029000000604482015260640161087a565b62093a808260e00135111561188b5760405162461bcd60e51b815260206004820181905260248201527f6d61782071756575652074696d65203e20363034383030202831207765656b29604482015260640161087a565b600061189a6020840184612f6d565b6001600160a01b0316036118ea5760405162461bcd60e51b8152602060048201526017602482015276726563697069656e74203d3d206164647265737328302960481b604482015260640161087a565b60008260400135116119315760405162461bcd60e51b815260206004820152601060248201526f073616c654d6178696d756d203d3d20360841b604482015260640161087a565b60008260600135116119785760405162461bcd60e51b815260206004820152601060248201526f0757365724d6178696d756d203d3d20360841b604482015260640161087a565b8160400135826060013511156119cc5760405162461bcd60e51b8152602060048201526019602482015278757365724d6178696d756d203e2073616c654d6178696d756d60381b604482015260640161087a565b816060013582608001351115611a245760405162461bcd60e51b815260206004820152601d60248201527f70757263686173654d696e696d756d203e20757365724d6178696d756d000000604482015260640161087a565b60c0820135611a3b60e084013560a08501356133dd565b10611a585760405162461bcd60e51b815260040161087a906133f0565b611a606125ad565b8260cd611a6d82826135dd565b505060ce54611a7b906107cb565b60da80546001600160a01b0319166001600160a01b03929092169190911790556040517ff19e3240beb82d0dfa0a35ed50201f0ac38ea92b9b29450527293aa8ccd0979b90611acc9060cd90613865565b60405180910390a1505050565b60ca8054611ae690613365565b80601f0160208091040260200160405190810160405280929190818152602001828054611b1290613365565b8015611b5f5780601f10611b3457610100808354040283529160200191611b5f565b820191906000526020600020905b815481529060010190602001808311611b4257829003601f168201915b505050505081565b60d4546000908103611b7b57506000919050565b60da5460d4546001600160a01b03918216841891600091611b9b9161388e565b9050611ba7818361388e565b6001600160a01b0316949350505050565b60cd5460405147916000916001600160a01b039091169083908381818185875af1925050503d8060008114611c09576040519150601f19603f3d011682016040523d82523d6000602084013e611c0e565b606091505b5050905080611c525760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161087a565b6040518281527f3b381fdfc0e2729a70e8b26ae2397e9014f703a8235b557f5581c4ed47280fd29060200160405180910390a15050565b83838383333214611cd35760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161087a565b60ce54611cfd578215611cf85760405162461bcd60e51b815260040161087a906138b4565b611dba565b60ce546040516301c3753f60e01b815230916301c3753f91611d2c9190339089908990899089906004016138f5565b602060405180830381865afa158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d9190613971565b1515600114611dba5760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161087a565b60d2544211611e065760405162461bcd60e51b81526020600482015260186024820152771cd85b19481a185cc81b9bdd081cdd185c9d1959081e595d60421b604482015260640161087a565b60d3544210611e485760405162461bcd60e51b815260206004820152600e60248201526d1cd85b19481a185cc8195b99195960921b604482015260640161087a565b60cf5460d85410611e945760405162461bcd60e51b81526020600482015260166024820152751cd85b1948189d5e481b1a5b5a5d081c995858da195960521b604482015260640161087a565b611e9d33611b67565b60d254611eaa9042613352565b11611eeb5760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161087a565b60cb54600160a01b900460ff16611f445760405162461bcd60e51b815260206004820152601860248201527f6e6174697665207061796d656e74732064697361626c65640000000000000000604482015260640161087a565b600260015403611f965760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161087a565b600260015560cb54600090611fb89034906012906001600160a01b0316612053565b9050611fc5818a8a612607565b611fcf8134612875565b50506001805550505050505050565b6097546040516371d4ed8d60e11b81526001600160a01b038381166004830152600092169063e3a9db1a90602401602060405180830381865afa158015612029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204d9190613323565b92915050565b600061206083600a613a72565b6120698361138e565b6120739086613a7e565b61207d9190613a9d565b90505b9392505050565b838383833332146120d15760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161087a565b60ce546120fb5782156120f65760405162461bcd60e51b815260040161087a906138b4565b6121b8565b60ce546040516301c3753f60e01b815230916301c3753f9161212a9190339089908990899089906004016138f5565b602060405180830381865afa158015612147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216b9190613971565b15156001146121b85760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161087a565b60d25442116122045760405162461bcd60e51b81526020600482015260186024820152771cd85b19481a185cc81b9bdd081cdd185c9d1959081e595d60421b604482015260640161087a565b60d35442106122465760405162461bcd60e51b815260206004820152600e60248201526d1cd85b19481a185cc8195b99195960921b604482015260640161087a565b60cf5460d854106122925760405162461bcd60e51b81526020600482015260166024820152751cd85b1948189d5e481b1a5b5a5d081c995858da195960521b604482015260640161087a565b61229b33611b67565b60d2546122a89042613352565b116122e95760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161087a565b6001600160a01b038a8116600090815260cc6020908152604091829020825180840190935254928316808352600160a01b90930460ff16908201528b9161236a5760405162461bcd60e51b815260206004820152601560248201527434b73b30b634b2103830bcb6b2b73a103a37b5b2b760591b604482015260640161087a565b6002600154036123bc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161087a565b60026001556001600160a01b038c8116600090815260cc60209081526040808320815180830190925254938416808252600160a01b90940460ff1691810182905292612409918f91612053565b9050612416818d8d612607565b612421818f8f61295f565b505060018055505050505050505050505050565b61243d6125ad565b6001600160a01b0381166124a25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161087a565b6124ab8161255b565b50565b6000826124bb8584612a68565b14949350505050565b6040516001600160a01b03831660248201526044810182905261252790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612ab5565b505050565b600054610100900460ff166125535760405162461bcd60e51b815260040161087a90613ab1565b61138c612b87565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6065546001600160a01b0316331461138c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161087a565b60d05481156126d157600161261f8160008587613afc565b61262891613b26565b60f81c146126675760405162461bcd60e51b815260206004820152600c60248201526b756e6b6e6f776e206461746160a01b604482015260640161087a565b602182146126b75760405162461bcd60e51b815260206004820152601760248201527f64617461206c656e67746820213d203333206279746573000000000000000000604482015260640161087a565b6126c5602160018486613afc565b6126ce91613b56565b90505b33600090815260d9602052604090205481906126ed90866133dd565b111561273b5760405162461bcd60e51b815260206004820152601b60248201527f7075726368617365206578636565647320796f7572206c696d69740000000000604482015260640161087a565b60cf5460d85461274b90866133dd565b11156127995760405162461bcd60e51b815260206004820152601b60248201527f707572636861736520657863656564732073616c65206c696d69740000000000604482015260640161087a565b60d1548410156127e45760405162461bcd60e51b8152602060048201526016602482015275707572636861736520756e646572206d696e696d756d60501b604482015260640161087a565b600160d660000160008282546127fa91906133dd565b909155505033600090815260d96020526040812054900361283157600160d6600101600082825461282b91906133dd565b90915550505b8360d6600201600082825461284691906133dd565b909155505033600090815260d960205260408120805486929061286a9084906133dd565b909155505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000015612900576127106128ca7f000000000000000000000000000000000000000000000000000000000000000084613a7e565b6128d49190613a9d565b90506129007f000000000000000000000000000000000000000000000000000000000000000082612c47565b60cd54612916906001600160a01b031682612c47565b6040805184815260208101849052808201839052905160009133917ef93dbdb72854b6b6fb35433086556f2635fc83c37080c667496fecfa650fb49181900360600190a3505050565b60007f0000000000000000000000000000000000000000000000000000000000000000156129f5576127106129b47f000000000000000000000000000000000000000000000000000000000000000084613a7e565b6129be9190613a9d565b90506129f56001600160a01b038416337f000000000000000000000000000000000000000000000000000000000000000084612cac565b612a163330612a048486613352565b6001600160a01b038716929190612cac565b604080518581526020810184905280820183905290516001600160a01b0385169133917ef93dbdb72854b6b6fb35433086556f2635fc83c37080c667496fecfa650fb49181900360600190a350505050565b600081815b8451811015612aad57612a9982868381518110612a8c57612a8c6137af565b6020026020010151612ce4565b915080612aa5816137e2565b915050612a6d565b509392505050565b6000612b0a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d109092919063ffffffff16565b8051909150156125275780806020019051810190612b289190613971565b6125275760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161087a565b600054610100900460ff16612bae5760405162461bcd60e51b815260040161087a90613ab1565b604051612bba90612e24565b604051809103906000f080158015612bd6573d6000803e3d6000fd5b50609780546001600160a01b0319166001600160a01b039290921691821790556040805163204a7f0760e21b81529051638129fc1c9160048082019260009290919082900301818387803b158015612c2d57600080fd5b505af1158015612c41573d6000803e3d6000fd5b50505050565b60975460405163f340fa0160e01b81526001600160a01b0384811660048301529091169063f340fa019083906024016000604051808303818588803b158015612c8f57600080fd5b505af1158015612ca3573d6000803e3d6000fd5b50505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052612c419085906323b872dd60e01b906084016124f0565b6000818310612d00576000828152602084905260409020612080565b5060009182526020526040902090565b606061207d8484600085856001600160a01b0385163b612d725760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161087a565b600080866001600160a01b03168587604051612d8e9190613b74565b60006040518083038185875af1925050503d8060008114612dcb576040519150601f19603f3d011682016040523d82523d6000602084013e612dd0565b606091505b5091509150612de0828286612deb565b979650505050505050565b60608315612dfa575081612080565b825115612e0a5782518084602001fd5b8160405162461bcd60e51b815260040161087a91906131f9565b61071380613b9183390190565b6001600160a01b03811681146124ab57600080fd5b8035612e5181612e31565b919050565b60008083601f840112612e6857600080fd5b5081356001600160401b03811115612e7f57600080fd5b602083019150836020828501011115612e9757600080fd5b9250929050565b60008083601f840112612eb057600080fd5b5081356001600160401b03811115612ec757600080fd5b6020830191508360208260051b8501011115612e9757600080fd5b60008060008060008060808789031215612efb57600080fd5b863595506020870135612f0d81612e31565b945060408701356001600160401b0380821115612f2957600080fd5b612f358a838b01612e56565b90965094506060890135915080821115612f4e57600080fd5b50612f5b89828a01612e9e565b979a9699509497509295939492505050565b600060208284031215612f7f57600080fd5b813561208081612e31565b600060208284031215612f9c57600080fd5b5035919050565b60006101208284031215612fb657600080fd5b50919050565b80151581146124ab57600080fd5b8035612e5181612fbc565b6000806000806000806000806000806000806101008d8f031215612ff857600080fd5b6130018d612e46565b9b506001600160401b0360208e0135111561301b57600080fd5b61302b8e60208f01358f01612fa3565b9a506001600160401b0360408e0135111561304557600080fd5b6130558e60408f01358f01612e56565b909a50985061306660608e01612fca565b975061307460808e01612e46565b96506001600160401b0360a08e0135111561308e57600080fd5b61309e8e60a08f01358f01612e9e565b90965094506001600160401b0360c08e013511156130bb57600080fd5b6130cb8e60c08f01358f01612e9e565b90945092506001600160401b0360e08e013511156130e857600080fd5b6130f88e60e08f01358f01612e9e565b81935080925050509295989b509295989b509295989b565b60005b8381101561312b578181015183820152602001613113565b50506000910152565b6000815180845261314c816020860160208601613110565b601f01601f19169290920160200192915050565b600061012060018060a01b038c1683528a60208401528960408401528860608401528760808401528660a08401528560c08401528460e0840152806101008401526131ad81840185613134565b9c9b505050505050505050505050565b6000602082840312156131cf57600080fd5b81356001600160401b038111156131e557600080fd5b6131f184828501612fa3565b949350505050565b6020815260006120806020830184613134565b6000806000806040858703121561322257600080fd5b84356001600160401b038082111561323957600080fd5b61324588838901612e56565b9096509450602087013591508082111561325e57600080fd5b5061326b87828801612e9e565b95989497509550505050565b60008060006060848603121561328c57600080fd5b833592506020840135915060408401356132a581612e31565b809150509250925092565b600080600080600080608087890312156132c957600080fd5b86356132d481612e31565b95506020870135945060408701356001600160401b0380821115612f2957600080fd5b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b60006020828403121561333557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561204d5761204d61333c565b600181811c9082168061337957607f821691505b602082108103612fb657634e487b7160e01b600052602260045260246000fd5b60208082526024908201527f65646974696e672073616c654d6178696d756d2061667465722073616c6520736040820152631d185c9d60e21b606082015260800190565b8082018082111561204d5761204d61333c565b6020808252602b908201527f73616c65206d757374206265206f70656e20666f72206174206c65617374206d60408201526a6178517565756554696d6560a81b606082015260800190565b60ff811681146124ab57600080fd5b60006020828403121561345c57600080fd5b81516120808161343b565b6000813561204d81612e31565b6000808335601e1984360301811261348b57600080fd5b8301803591506001600160401b038211156134a557600080fd5b602001915036819003821315612e9757600080fd5b634e487b7160e01b600052604160045260246000fd5b601f82111561252757600081815260208120601f850160051c810160208610156134f75750805b601f850160051c820191505b8181101561351657828155600101613503565b505050505050565b6001600160401b03831115613535576135356134ba565b613549836135438354613365565b836134d0565b6000601f84116001811461357d57600085156135655750838201355b600019600387901b1c1916600186901b1783556107c4565b600083815260209020601f19861690835b828110156135ae578685013582556020948501946001909201910161358e565b50868210156135cb5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6136066135e983613467565b82546001600160a01b0319166001600160a01b0391909116178255565b6020820135600182015560408201356002820155606082013560038201556080820135600482015560a0820135600582015560c0820135600682015560e0820135600782015561365a610100830183613474565b612c4181836008860161351e565b6000815461367581613365565b80855260206001838116801561369257600181146136ac576136da565b60ff1985168884015283151560051b8801830195506136da565b866000528260002060005b858110156136d25781548a82018601529083019084016136b7565b890184019650505b505050505092915050565b600061012061370c846136ff85546001600160a01b031690565b6001600160a01b03169052565b60018301546020850152600283015460408501526003830154606085015260048301546080850152600583015460a0850152600683015460c0850152600783015460e0850152806101008501526131f181850160088501613668565b60808152600061377b60808301876136e5565b828103602084015261378d8187613668565b6001600160a01b03959095166040840152505090151560609091015292915050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156137d757600080fd5b81356120808161343b565b6000600182016137f4576137f461333c565b5060010190565b805169ffffffffffffffffffff81168114612e5157600080fd5b600080600080600060a0868803121561382d57600080fd5b613836866137fb565b9450602086015193506040860151925060608601519150613859608087016137fb565b90509295509295909350565b60208152600061208060208301846136e5565b634e487b7160e01b600052601260045260246000fd5b60006001600160a01b03838116806138a8576138a8613878565b92169190910492915050565b60208082526021908201527f64617461206e6f74207065726d6974746564206f6e207075626c69632073616c6040820152606560f81b606082015260800190565b8681526001600160a01b03861660208201526080604082018190528101849052838560a0830137600060a08583018101829052601f19601f8701168301838103820160608501529081018490526001600160fb1b0384111561395657600080fd5b8360051b808660c08401370160c00198975050505050505050565b60006020828403121561398357600080fd5b815161208081612fbc565b600181815b808511156139c95781600019048211156139af576139af61333c565b808516156139bc57918102915b93841c9390800290613993565b509250929050565b6000826139e05750600161204d565b816139ed5750600061204d565b8160018114613a035760028114613a0d57613a29565b600191505061204d565b60ff841115613a1e57613a1e61333c565b50506001821b61204d565b5060208310610133831016604e8410600b8410161715613a4c575081810a61204d565b613a56838361398e565b8060001904821115613a6a57613a6a61333c565b029392505050565b600061208083836139d1565b6000816000190483118215151615613a9857613a9861333c565b500290565b600082613aac57613aac613878565b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008085851115613b0c57600080fd5b83861115613b1957600080fd5b5050820193919092039150565b6001600160f81b03198135818116916001851015613b4e5780818660010360031b1b83161692505b505092915050565b8035602083101561204d57600019602084900360031b1b1692915050565b60008251613b86818460208701613110565b919091019291505056fe608060405234801561001057600080fd5b506106f3806100206000396000f3fe6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100c1578063e3a9db1a146100ee578063f2fde38b14610132578063f340fa011461015257600080fd5b806351cff8d914610075578063715018a6146100975780638129fc1c146100ac575b600080fd5b34801561008157600080fd5b50610095610090366004610627565b610165565b005b3480156100a357600080fd5b506100956101dc565b3480156100b857600080fd5b506100956101f0565b3480156100cd57600080fd5b506033546040516001600160a01b0390911681526020015b60405180910390f35b3480156100fa57600080fd5b50610124610109366004610627565b6001600160a01b031660009081526065602052604090205490565b6040519081526020016100e5565b34801561013e57600080fd5b5061009561014d366004610627565b610306565b610095610160366004610627565b61037c565b61016d6103ee565b6001600160a01b03811660008181526065602052604081208054919055906101959082610448565b816001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516101d091815260200190565b60405180910390a25050565b6101e46103ee565b6101ee6000610566565b565b600054610100900460ff16158080156102105750600054600160ff909116105b8061022a5750303b15801561022a575060005460ff166001145b6102925760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156102b5576000805461ff0019166101001790555b6102bd6105b8565b8015610303576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b61030e6103ee565b6001600160a01b0381166103735760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610289565b61030381610566565b6103846103ee565b6001600160a01b0381166000908152606560205260408120805434928392916103ae90849061064b565b90915550506040518181526001600160a01b038316907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4906020016101d0565b6033546001600160a01b031633146101ee5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610289565b804710156104985760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610289565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146104e5576040519150601f19603f3d011682016040523d82523d6000602084013e6104ea565b606091505b50509050806105615760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610289565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166105df5760405162461bcd60e51b815260040161028990610672565b6101ee600054610100900460ff166106095760405162461bcd60e51b815260040161028990610672565b6101ee33610566565b6001600160a01b038116811461030357600080fd5b60006020828403121561063957600080fd5b813561064481610612565b9392505050565b8082018082111561066c57634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212209185c34304b45b06a76f2d335fdc829aa5e371973f70ea0e52939b95d388451264736f6c63430008100033a264697066735822122056b695f889598471e0b975942b5edd8f8c2a379f94fa5083a84256709015769e64736f6c63430008100033000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099c4a6e4dde61bc1dc1a8a8c9609ddfa9126817c
Deployed Bytecode
0x6080604052600436106101b75760003560e01c80638dbc8343116100ec578063cc8f91821161008a578063e6064de311610064578063e6064de31461057c578063ea5176451461059c578063f2fde38b146105bc578063ffa1ad74146105dc57600080fd5b8063cc8f918214610529578063e2982c211461053c578063e49248d51461055c57600080fd5b8063a9e0c9c3116100c6578063a9e0c9c314610491578063ab803a76146104b1578063b4bd9e2714610267578063c3b88b42146104c657600080fd5b80638dbc8343146103a657806392a85fde14610435578063a04748f61461045757600080fd5b8063621aa9251161015957806375f620ac1161013357806375f620ac1461031e57806379502c551461033e578063826b90f2146103685780638da5cb5b1461038857600080fd5b8063621aa925146102b1578063669ad092146102e9578063715018a61461030957600080fd5b8063311d5c6211610195578063311d5c621461023257806331b3eb941461024757806347535d7b146102675780634cc233a81461027b57600080fd5b806301c3753f146101bc5780631be19560146101f15780632ddbd13a14610213575b600080fd5b3480156101c857600080fd5b506101dc6101d7366004612ee2565b61060b565b60405190151581526020015b60405180910390f35b3480156101fd57600080fd5b5061021161020c366004612f6d565b61069a565b005b34801561021f57600080fd5b5060d8545b6040519081526020016101e8565b34801561023e57600080fd5b50610224600881565b34801561025357600080fd5b50610211610262366004612f6d565b610769565b34801561027357600080fd5b5060006101dc565b34801561028757600080fd5b50610224610296366004612f6d565b6001600160a01b0316600090815260d9602052604090205490565b3480156102bd57600080fd5b506102d16102cc366004612f8a565b6107cb565b6040516001600160a01b0390911681526020016101e8565b3480156102f557600080fd5b50610211610304366004612fd5565b6107e1565b34801561031557600080fd5b5061021161137a565b34801561032a57600080fd5b50610224610339366004612f6d565b61138e565b34801561034a57600080fd5b50610353611534565b6040516101e899989796959493929190613160565b34801561037457600080fd5b506102116103833660046131bd565b6115f7565b34801561039457600080fd5b506065546001600160a01b03166102d1565b3480156103b257600080fd5b5061040e6103c1366004612f6d565b604080518082018252600080825260209182018190526001600160a01b03938416815260cc82528290208251808401909352549283168252600160a01b90920460ff169181019190915290565b6040805182516001600160a01b0316815260209283015160ff1692810192909252016101e8565b34801561044157600080fd5b5061044a611ad9565b6040516101e891906131f9565b34801561046357600080fd5b5060d65460d75460d85461047692919083565b604080519384526020840192909252908201526060016101e8565b34801561049d57600080fd5b506102246104ac366004612f6d565b611b67565b3480156104bd57600080fd5b50610211611bb8565b3480156104d257600080fd5b506105086104e1366004612f6d565b60cc602052600090815260409020546001600160a01b03811690600160a01b900460ff1682565b604080516001600160a01b03909316835260ff9091166020830152016101e8565b61021161053736600461320c565b611c89565b34801561054857600080fd5b50610224610557366004612f6d565b611fde565b34801561056857600080fd5b50610224610577366004613277565b612053565b34801561058857600080fd5b5060cb546102d1906001600160a01b031681565b3480156105a857600080fd5b506102116105b73660046132b0565b612087565b3480156105c857600080fd5b506102116105d7366004612f6d565b612435565b3480156105e857600080fd5b5061044a604051806040016040528060038152602001620322e360ec1b81525081565b600080868686604051602001610623939291906132f7565b60405160208183030381529060405280519060200120905061067b8484808060200260200160405190810160405280939291908181526020018383602002808284376000920191909152508c92508591506124ae9050565b1561068a576001915050610690565b60009150505b9695505050505050565b6040516370a0823160e01b81523060048201526000906001600160a01b038316906370a0823190602401602060405180830381865afa1580156106e1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906107059190613323565b60cd54909150610722906001600160a01b038481169116836124c4565b816001600160a01b03167ff4a44a7f605c4971a27bcecb448108e6328b7fad34fab5bff4f69377294b826d8260405161075d91815260200190565b60405180910390a25050565b6097546040516351cff8d960e01b81526001600160a01b038381166004830152909116906351cff8d990602401600060405180830381600087803b1580156107b057600080fd5b505af11580156107c4573d6000803e3d6000fd5b5050505050565b6000816107d9600143613352565b401892915050565b600054610100900460ff16158080156108015750600054600160ff909116105b8061081b5750303b15801561081b575060005460ff166001145b6108835760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156108a6576000805461ff0019166101001790555b604080516101208101825260cd80546001600160a01b0316825260ce54602083015260cf549282019290925260d054606082015260d154608082015260d25460a082015260d35460c082015260d45460e082015260d580548f936000939290916101008401919061091690613365565b80601f016020809104026020016040519081016040528092919081815260200182805461094290613365565b801561098f5780601f106109645761010080835404028352916020019161098f565b820191906000526020600020905b81548152906001019060200180831161097257829003601f168201915b50505091909252505060da54919250506001600160a01b031615610a33578060c001514210610a005760405162461bcd60e51b815260206004820152601a60248201527f73616c65206973206f7665723a2063616e6e6f74207570617465000000000000604482015260640161087a565b8060a00151421115610a33578160400135816040015114610a335760405162461bcd60e51b815260040161087a90613399565b63f48657008260a001351115610a8b5760405162461bcd60e51b815260206004820152601f60248201527f7374617274203e203431303234343438303020284a616e203120323130302900604482015260640161087a565b63f48657008260c001351115610ae35760405162461bcd60e51b815260206004820152601d60248201527f656e64203e203431303234343438303020284a616e2031203231303029000000604482015260640161087a565b62093a808260e001351115610b3a5760405162461bcd60e51b815260206004820181905260248201527f6d61782071756575652074696d65203e20363034383030202831207765656b29604482015260640161087a565b6000610b496020840184612f6d565b6001600160a01b031603610b995760405162461bcd60e51b8152602060048201526017602482015276726563697069656e74203d3d206164647265737328302960481b604482015260640161087a565b6000826040013511610be05760405162461bcd60e51b815260206004820152601060248201526f073616c654d6178696d756d203d3d20360841b604482015260640161087a565b6000826060013511610c275760405162461bcd60e51b815260206004820152601060248201526f0757365724d6178696d756d203d3d20360841b604482015260640161087a565b816040013582606001351115610c7b5760405162461bcd60e51b8152602060048201526019602482015278757365724d6178696d756d203e2073616c654d6178696d756d60381b604482015260640161087a565b816060013582608001351115610cd35760405162461bcd60e51b815260206004820152601d60248201527f70757263686173654d696e696d756d203e20757365724d6178696d756d000000604482015260640161087a565b60c0820135610cea60e084013560a08501356133dd565b10610d075760405162461bcd60e51b815260040161087a906133f0565b610d0f61252c565b878614610d5e5760405162461bcd60e51b815260206004820152601b60248201527f746f6b656e20616e64206f7261636c65206c656e6774687320213d0000000000604482015260640161087a565b878414610dad5760405162461bcd60e51b815260206004820152601d60248201527f746f6b656e20616e6420646563696d616c73206c656e6774687320213d000000604482015260640161087a565b6001600160a01b038a16610df85760405162461bcd60e51b815260206004820152601260248201527106e6174697665206f7261636c65203d3d20360741b604482015260640161087a565b60088a6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610e38573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610e5c919061344a565b60ff1614610eac5760405162461bcd60e51b815260206004820152601b60248201527f6e6174697665206f7261636c6520646563696d616c7320213d20380000000000604482015260640161087a565b8d60cd610eb982826135dd565b5060ca9050610ec98d8f8361351e565b508960cb60006101000a8154816001600160a01b0302191690836001600160a01b031602179055508a60cb60146101000a81548160ff0219169083151502179055507fb08510a4a112663ff701fcf43686a47fd456cb1a471dd63d662b73612cf700b360cd60ca60cb60009054906101000a90046001600160a01b03168e604051610f579493929190613768565b60405180910390a160005b888110156112ed5760008a8a83818110610f7e57610f7e6137af565b9050602002016020810190610f939190612f6d565b6001600160a01b031603610fde5760405162461bcd60e51b815260206004820152601260248201527107061796d656e7420746f6b656e203d3d20360741b604482015260640161087a565b6000888883818110610ff257610ff26137af565b90506020020160208101906110079190612f6d565b6001600160a01b0316036110515760405162461bcd60e51b81526020600482015260116024820152700746f6b656e206f7261636c65203d3d203607c1b604482015260640161087a565b6008888883818110611065576110656137af565b905060200201602081019061107a9190612f6d565b6001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156110b7573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906110db919061344a565b60ff161461112b5760405162461bcd60e51b815260206004820152601a60248201527f746f6b656e206f7261636c6520646563696d616c7320213d2038000000000000604482015260640161087a565b6040518060400160405280898984818110611148576111486137af565b905060200201602081019061115d9190612f6d565b6001600160a01b0316815260200187878481811061117d5761117d6137af565b905060200201602081019061119291906137c5565b60ff16905260cc60008c8c858181106111ad576111ad6137af565b90506020020160208101906111c29190612f6d565b6001600160a01b039081168252602080830193909352604090910160002083518154949093015160ff16600160a01b026001600160a81b031990941692909116919091179190911790557f1573dfedb5172e215558f8ffa409a71a5e42c596c15c482a04ff548914ebfa778a8a8381811061123f5761123f6137af565b90506020020160208101906112549190612f6d565b60cc60008d8d8681811061126a5761126a6137af565b905060200201602081019061127f9190612f6d565b6001600160a01b03166001600160a01b031681526020019081526020016000206040516112d39291906001600160a01b0392831681529054918216602082015260a09190911c60ff16604082015260600190565b60405180910390a1806112e5816137e2565b915050610f62565b5060ce546112fa906107cb565b60da80546001600160a01b0319166001600160a01b03929092169190911790556113238f61255b565b5050801561136b576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50505050505050505050505050565b6113826125ad565b61138c600061255b565b565b600080600080600080866001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa1580156113d5573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113f99190613815565b94509450945094509450600084136114445760405162461bcd60e51b815260206004820152600e60248201526d6e6567617469766520707269636560901b604482015260640161087a565b60008169ffffffffffffffffffff161161148e5760405162461bcd60e51b815260206004820152600b60248201526a0616e73776572203d3d20360ac1b604482015260640161087a565b600082116114d35760405162461bcd60e51b8152602060048201526012602482015271726f756e64206e6f7420636f6d706c65746560701b604482015260640161087a565b8469ffffffffffffffffffff168169ffffffffffffffffffff1610156115295760405162461bcd60e51b815260206004820152600b60248201526a7374616c6520707269636560a81b604482015260640161087a565b509195945050505050565b60cd805460ce5460cf5460d05460d15460d25460d35460d45460d580546001600160a01b0390991699979896979596949593949293919261157490613365565b80601f01602080910402602001604051908101604052809291908181526020018280546115a090613365565b80156115ed5780601f106115c2576101008083540402835291602001916115ed565b820191906000526020600020905b8154815290600101906020018083116115d057829003601f168201915b5050505050905089565b604080516101208101825260cd80546001600160a01b0316825260ce54602083015260cf549282019290925260d054606082015260d154608082015260d25460a082015260d35460c082015260d45460e082015260d5805484936000939290916101008401919061166790613365565b80601f016020809104026020016040519081016040528092919081815260200182805461169390613365565b80156116e05780601f106116b5576101008083540402835291602001916116e0565b820191906000526020600020905b8154815290600101906020018083116116c357829003601f168201915b50505091909252505060da54919250506001600160a01b031615611784578060c0015142106117515760405162461bcd60e51b815260206004820152601a60248201527f73616c65206973206f7665723a2063616e6e6f74207570617465000000000000604482015260640161087a565b8060a001514211156117845781604001358160400151146117845760405162461bcd60e51b815260040161087a90613399565b63f48657008260a0013511156117dc5760405162461bcd60e51b815260206004820152601f60248201527f7374617274203e203431303234343438303020284a616e203120323130302900604482015260640161087a565b63f48657008260c0013511156118345760405162461bcd60e51b815260206004820152601d60248201527f656e64203e203431303234343438303020284a616e2031203231303029000000604482015260640161087a565b62093a808260e00135111561188b5760405162461bcd60e51b815260206004820181905260248201527f6d61782071756575652074696d65203e20363034383030202831207765656b29604482015260640161087a565b600061189a6020840184612f6d565b6001600160a01b0316036118ea5760405162461bcd60e51b8152602060048201526017602482015276726563697069656e74203d3d206164647265737328302960481b604482015260640161087a565b60008260400135116119315760405162461bcd60e51b815260206004820152601060248201526f073616c654d6178696d756d203d3d20360841b604482015260640161087a565b60008260600135116119785760405162461bcd60e51b815260206004820152601060248201526f0757365724d6178696d756d203d3d20360841b604482015260640161087a565b8160400135826060013511156119cc5760405162461bcd60e51b8152602060048201526019602482015278757365724d6178696d756d203e2073616c654d6178696d756d60381b604482015260640161087a565b816060013582608001351115611a245760405162461bcd60e51b815260206004820152601d60248201527f70757263686173654d696e696d756d203e20757365724d6178696d756d000000604482015260640161087a565b60c0820135611a3b60e084013560a08501356133dd565b10611a585760405162461bcd60e51b815260040161087a906133f0565b611a606125ad565b8260cd611a6d82826135dd565b505060ce54611a7b906107cb565b60da80546001600160a01b0319166001600160a01b03929092169190911790556040517ff19e3240beb82d0dfa0a35ed50201f0ac38ea92b9b29450527293aa8ccd0979b90611acc9060cd90613865565b60405180910390a1505050565b60ca8054611ae690613365565b80601f0160208091040260200160405190810160405280929190818152602001828054611b1290613365565b8015611b5f5780601f10611b3457610100808354040283529160200191611b5f565b820191906000526020600020905b815481529060010190602001808311611b4257829003601f168201915b505050505081565b60d4546000908103611b7b57506000919050565b60da5460d4546001600160a01b03918216841891600091611b9b9161388e565b9050611ba7818361388e565b6001600160a01b0316949350505050565b60cd5460405147916000916001600160a01b039091169083908381818185875af1925050503d8060008114611c09576040519150601f19603f3d011682016040523d82523d6000602084013e611c0e565b606091505b5050905080611c525760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b604482015260640161087a565b6040518281527f3b381fdfc0e2729a70e8b26ae2397e9014f703a8235b557f5581c4ed47280fd29060200160405180910390a15050565b83838383333214611cd35760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161087a565b60ce54611cfd578215611cf85760405162461bcd60e51b815260040161087a906138b4565b611dba565b60ce546040516301c3753f60e01b815230916301c3753f91611d2c9190339089908990899089906004016138f5565b602060405180830381865afa158015611d49573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611d6d9190613971565b1515600114611dba5760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161087a565b60d2544211611e065760405162461bcd60e51b81526020600482015260186024820152771cd85b19481a185cc81b9bdd081cdd185c9d1959081e595d60421b604482015260640161087a565b60d3544210611e485760405162461bcd60e51b815260206004820152600e60248201526d1cd85b19481a185cc8195b99195960921b604482015260640161087a565b60cf5460d85410611e945760405162461bcd60e51b81526020600482015260166024820152751cd85b1948189d5e481b1a5b5a5d081c995858da195960521b604482015260640161087a565b611e9d33611b67565b60d254611eaa9042613352565b11611eeb5760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161087a565b60cb54600160a01b900460ff16611f445760405162461bcd60e51b815260206004820152601860248201527f6e6174697665207061796d656e74732064697361626c65640000000000000000604482015260640161087a565b600260015403611f965760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161087a565b600260015560cb54600090611fb89034906012906001600160a01b0316612053565b9050611fc5818a8a612607565b611fcf8134612875565b50506001805550505050505050565b6097546040516371d4ed8d60e11b81526001600160a01b038381166004830152600092169063e3a9db1a90602401602060405180830381865afa158015612029573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061204d9190613323565b92915050565b600061206083600a613a72565b6120698361138e565b6120739086613a7e565b61207d9190613a9d565b90505b9392505050565b838383833332146120d15760405162461bcd60e51b81526020600482015260146024820152734d75737420627579207769746820616e20454f4160601b604482015260640161087a565b60ce546120fb5782156120f65760405162461bcd60e51b815260040161087a906138b4565b6121b8565b60ce546040516301c3753f60e01b815230916301c3753f9161212a9190339089908990899089906004016138f5565b602060405180830381865afa158015612147573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061216b9190613971565b15156001146121b85760405162461bcd60e51b8152602060048201526019602482015278626164206d65726b6c652070726f6f6620666f722073616c6560381b604482015260640161087a565b60d25442116122045760405162461bcd60e51b81526020600482015260186024820152771cd85b19481a185cc81b9bdd081cdd185c9d1959081e595d60421b604482015260640161087a565b60d35442106122465760405162461bcd60e51b815260206004820152600e60248201526d1cd85b19481a185cc8195b99195960921b604482015260640161087a565b60cf5460d854106122925760405162461bcd60e51b81526020600482015260166024820152751cd85b1948189d5e481b1a5b5a5d081c995858da195960521b604482015260640161087a565b61229b33611b67565b60d2546122a89042613352565b116122e95760405162461bcd60e51b81526020600482015260116024820152701b9bdd081e5bdd5c881d1d5c9b881e595d607a1b604482015260640161087a565b6001600160a01b038a8116600090815260cc6020908152604091829020825180840190935254928316808352600160a01b90930460ff16908201528b9161236a5760405162461bcd60e51b815260206004820152601560248201527434b73b30b634b2103830bcb6b2b73a103a37b5b2b760591b604482015260640161087a565b6002600154036123bc5760405162461bcd60e51b815260206004820152601f60248201527f5265656e7472616e637947756172643a207265656e7472616e742063616c6c00604482015260640161087a565b60026001556001600160a01b038c8116600090815260cc60209081526040808320815180830190925254938416808252600160a01b90940460ff1691810182905292612409918f91612053565b9050612416818d8d612607565b612421818f8f61295f565b505060018055505050505050505050505050565b61243d6125ad565b6001600160a01b0381166124a25760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b606482015260840161087a565b6124ab8161255b565b50565b6000826124bb8584612a68565b14949350505050565b6040516001600160a01b03831660248201526044810182905261252790849063a9059cbb60e01b906064015b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b031990931692909217909152612ab5565b505050565b600054610100900460ff166125535760405162461bcd60e51b815260040161087a90613ab1565b61138c612b87565b606580546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b6065546001600160a01b0316331461138c5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e6572604482015260640161087a565b60d05481156126d157600161261f8160008587613afc565b61262891613b26565b60f81c146126675760405162461bcd60e51b815260206004820152600c60248201526b756e6b6e6f776e206461746160a01b604482015260640161087a565b602182146126b75760405162461bcd60e51b815260206004820152601760248201527f64617461206c656e67746820213d203333206279746573000000000000000000604482015260640161087a565b6126c5602160018486613afc565b6126ce91613b56565b90505b33600090815260d9602052604090205481906126ed90866133dd565b111561273b5760405162461bcd60e51b815260206004820152601b60248201527f7075726368617365206578636565647320796f7572206c696d69740000000000604482015260640161087a565b60cf5460d85461274b90866133dd565b11156127995760405162461bcd60e51b815260206004820152601b60248201527f707572636861736520657863656564732073616c65206c696d69740000000000604482015260640161087a565b60d1548410156127e45760405162461bcd60e51b8152602060048201526016602482015275707572636861736520756e646572206d696e696d756d60501b604482015260640161087a565b600160d660000160008282546127fa91906133dd565b909155505033600090815260d96020526040812054900361283157600160d6600101600082825461282b91906133dd565b90915550505b8360d6600201600082825461284691906133dd565b909155505033600090815260d960205260408120805486929061286a9084906133dd565b909155505050505050565b60007f000000000000000000000000000000000000000000000000000000000000000015612900576127106128ca7f000000000000000000000000000000000000000000000000000000000000000084613a7e565b6128d49190613a9d565b90506129007f00000000000000000000000099c4a6e4dde61bc1dc1a8a8c9609ddfa9126817c82612c47565b60cd54612916906001600160a01b031682612c47565b6040805184815260208101849052808201839052905160009133917ef93dbdb72854b6b6fb35433086556f2635fc83c37080c667496fecfa650fb49181900360600190a3505050565b60007f0000000000000000000000000000000000000000000000000000000000000000156129f5576127106129b47f000000000000000000000000000000000000000000000000000000000000000084613a7e565b6129be9190613a9d565b90506129f56001600160a01b038416337f00000000000000000000000099c4a6e4dde61bc1dc1a8a8c9609ddfa9126817c84612cac565b612a163330612a048486613352565b6001600160a01b038716929190612cac565b604080518581526020810184905280820183905290516001600160a01b0385169133917ef93dbdb72854b6b6fb35433086556f2635fc83c37080c667496fecfa650fb49181900360600190a350505050565b600081815b8451811015612aad57612a9982868381518110612a8c57612a8c6137af565b6020026020010151612ce4565b915080612aa5816137e2565b915050612a6d565b509392505050565b6000612b0a826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b0316612d109092919063ffffffff16565b8051909150156125275780806020019051810190612b289190613971565b6125275760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b606482015260840161087a565b600054610100900460ff16612bae5760405162461bcd60e51b815260040161087a90613ab1565b604051612bba90612e24565b604051809103906000f080158015612bd6573d6000803e3d6000fd5b50609780546001600160a01b0319166001600160a01b039290921691821790556040805163204a7f0760e21b81529051638129fc1c9160048082019260009290919082900301818387803b158015612c2d57600080fd5b505af1158015612c41573d6000803e3d6000fd5b50505050565b60975460405163f340fa0160e01b81526001600160a01b0384811660048301529091169063f340fa019083906024016000604051808303818588803b158015612c8f57600080fd5b505af1158015612ca3573d6000803e3d6000fd5b50505050505050565b6040516001600160a01b0380851660248301528316604482015260648101829052612c419085906323b872dd60e01b906084016124f0565b6000818310612d00576000828152602084905260409020612080565b5060009182526020526040902090565b606061207d8484600085856001600160a01b0385163b612d725760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015260640161087a565b600080866001600160a01b03168587604051612d8e9190613b74565b60006040518083038185875af1925050503d8060008114612dcb576040519150601f19603f3d011682016040523d82523d6000602084013e612dd0565b606091505b5091509150612de0828286612deb565b979650505050505050565b60608315612dfa575081612080565b825115612e0a5782518084602001fd5b8160405162461bcd60e51b815260040161087a91906131f9565b61071380613b9183390190565b6001600160a01b03811681146124ab57600080fd5b8035612e5181612e31565b919050565b60008083601f840112612e6857600080fd5b5081356001600160401b03811115612e7f57600080fd5b602083019150836020828501011115612e9757600080fd5b9250929050565b60008083601f840112612eb057600080fd5b5081356001600160401b03811115612ec757600080fd5b6020830191508360208260051b8501011115612e9757600080fd5b60008060008060008060808789031215612efb57600080fd5b863595506020870135612f0d81612e31565b945060408701356001600160401b0380821115612f2957600080fd5b612f358a838b01612e56565b90965094506060890135915080821115612f4e57600080fd5b50612f5b89828a01612e9e565b979a9699509497509295939492505050565b600060208284031215612f7f57600080fd5b813561208081612e31565b600060208284031215612f9c57600080fd5b5035919050565b60006101208284031215612fb657600080fd5b50919050565b80151581146124ab57600080fd5b8035612e5181612fbc565b6000806000806000806000806000806000806101008d8f031215612ff857600080fd5b6130018d612e46565b9b506001600160401b0360208e0135111561301b57600080fd5b61302b8e60208f01358f01612fa3565b9a506001600160401b0360408e0135111561304557600080fd5b6130558e60408f01358f01612e56565b909a50985061306660608e01612fca565b975061307460808e01612e46565b96506001600160401b0360a08e0135111561308e57600080fd5b61309e8e60a08f01358f01612e9e565b90965094506001600160401b0360c08e013511156130bb57600080fd5b6130cb8e60c08f01358f01612e9e565b90945092506001600160401b0360e08e013511156130e857600080fd5b6130f88e60e08f01358f01612e9e565b81935080925050509295989b509295989b509295989b565b60005b8381101561312b578181015183820152602001613113565b50506000910152565b6000815180845261314c816020860160208601613110565b601f01601f19169290920160200192915050565b600061012060018060a01b038c1683528a60208401528960408401528860608401528760808401528660a08401528560c08401528460e0840152806101008401526131ad81840185613134565b9c9b505050505050505050505050565b6000602082840312156131cf57600080fd5b81356001600160401b038111156131e557600080fd5b6131f184828501612fa3565b949350505050565b6020815260006120806020830184613134565b6000806000806040858703121561322257600080fd5b84356001600160401b038082111561323957600080fd5b61324588838901612e56565b9096509450602087013591508082111561325e57600080fd5b5061326b87828801612e9e565b95989497509550505050565b60008060006060848603121561328c57600080fd5b833592506020840135915060408401356132a581612e31565b809150509250925092565b600080600080600080608087890312156132c957600080fd5b86356132d481612e31565b95506020870135945060408701356001600160401b0380821115612f2957600080fd5b6bffffffffffffffffffffffff198460601b168152818360148301376000910160140190815292915050565b60006020828403121561333557600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b8181038181111561204d5761204d61333c565b600181811c9082168061337957607f821691505b602082108103612fb657634e487b7160e01b600052602260045260246000fd5b60208082526024908201527f65646974696e672073616c654d6178696d756d2061667465722073616c6520736040820152631d185c9d60e21b606082015260800190565b8082018082111561204d5761204d61333c565b6020808252602b908201527f73616c65206d757374206265206f70656e20666f72206174206c65617374206d60408201526a6178517565756554696d6560a81b606082015260800190565b60ff811681146124ab57600080fd5b60006020828403121561345c57600080fd5b81516120808161343b565b6000813561204d81612e31565b6000808335601e1984360301811261348b57600080fd5b8301803591506001600160401b038211156134a557600080fd5b602001915036819003821315612e9757600080fd5b634e487b7160e01b600052604160045260246000fd5b601f82111561252757600081815260208120601f850160051c810160208610156134f75750805b601f850160051c820191505b8181101561351657828155600101613503565b505050505050565b6001600160401b03831115613535576135356134ba565b613549836135438354613365565b836134d0565b6000601f84116001811461357d57600085156135655750838201355b600019600387901b1c1916600186901b1783556107c4565b600083815260209020601f19861690835b828110156135ae578685013582556020948501946001909201910161358e565b50868210156135cb5760001960f88860031b161c19848701351681555b505060018560011b0183555050505050565b6136066135e983613467565b82546001600160a01b0319166001600160a01b0391909116178255565b6020820135600182015560408201356002820155606082013560038201556080820135600482015560a0820135600582015560c0820135600682015560e0820135600782015561365a610100830183613474565b612c4181836008860161351e565b6000815461367581613365565b80855260206001838116801561369257600181146136ac576136da565b60ff1985168884015283151560051b8801830195506136da565b866000528260002060005b858110156136d25781548a82018601529083019084016136b7565b890184019650505b505050505092915050565b600061012061370c846136ff85546001600160a01b031690565b6001600160a01b03169052565b60018301546020850152600283015460408501526003830154606085015260048301546080850152600583015460a0850152600683015460c0850152600783015460e0850152806101008501526131f181850160088501613668565b60808152600061377b60808301876136e5565b828103602084015261378d8187613668565b6001600160a01b03959095166040840152505090151560609091015292915050565b634e487b7160e01b600052603260045260246000fd5b6000602082840312156137d757600080fd5b81356120808161343b565b6000600182016137f4576137f461333c565b5060010190565b805169ffffffffffffffffffff81168114612e5157600080fd5b600080600080600060a0868803121561382d57600080fd5b613836866137fb565b9450602086015193506040860151925060608601519150613859608087016137fb565b90509295509295909350565b60208152600061208060208301846136e5565b634e487b7160e01b600052601260045260246000fd5b60006001600160a01b03838116806138a8576138a8613878565b92169190910492915050565b60208082526021908201527f64617461206e6f74207065726d6974746564206f6e207075626c69632073616c6040820152606560f81b606082015260800190565b8681526001600160a01b03861660208201526080604082018190528101849052838560a0830137600060a08583018101829052601f19601f8701168301838103820160608501529081018490526001600160fb1b0384111561395657600080fd5b8360051b808660c08401370160c00198975050505050505050565b60006020828403121561398357600080fd5b815161208081612fbc565b600181815b808511156139c95781600019048211156139af576139af61333c565b808516156139bc57918102915b93841c9390800290613993565b509250929050565b6000826139e05750600161204d565b816139ed5750600061204d565b8160018114613a035760028114613a0d57613a29565b600191505061204d565b60ff841115613a1e57613a1e61333c565b50506001821b61204d565b5060208310610133831016604e8410600b8410161715613a4c575081810a61204d565b613a56838361398e565b8060001904821115613a6a57613a6a61333c565b029392505050565b600061208083836139d1565b6000816000190483118215151615613a9857613a9861333c565b500290565b600082613aac57613aac613878565b500490565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b606082015260800190565b60008085851115613b0c57600080fd5b83861115613b1957600080fd5b5050820193919092039150565b6001600160f81b03198135818116916001851015613b4e5780818660010360031b1b83161692505b505092915050565b8035602083101561204d57600019602084900360031b1b1692915050565b60008251613b86818460208701613110565b919091019291505056fe608060405234801561001057600080fd5b506106f3806100206000396000f3fe6080604052600436106100705760003560e01c80638da5cb5b1161004e5780638da5cb5b146100c1578063e3a9db1a146100ee578063f2fde38b14610132578063f340fa011461015257600080fd5b806351cff8d914610075578063715018a6146100975780638129fc1c146100ac575b600080fd5b34801561008157600080fd5b50610095610090366004610627565b610165565b005b3480156100a357600080fd5b506100956101dc565b3480156100b857600080fd5b506100956101f0565b3480156100cd57600080fd5b506033546040516001600160a01b0390911681526020015b60405180910390f35b3480156100fa57600080fd5b50610124610109366004610627565b6001600160a01b031660009081526065602052604090205490565b6040519081526020016100e5565b34801561013e57600080fd5b5061009561014d366004610627565b610306565b610095610160366004610627565b61037c565b61016d6103ee565b6001600160a01b03811660008181526065602052604081208054919055906101959082610448565b816001600160a01b03167f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d5826040516101d091815260200190565b60405180910390a25050565b6101e46103ee565b6101ee6000610566565b565b600054610100900460ff16158080156102105750600054600160ff909116105b8061022a5750303b15801561022a575060005460ff166001145b6102925760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b60648201526084015b60405180910390fd5b6000805460ff1916600117905580156102b5576000805461ff0019166101001790555b6102bd6105b8565b8015610303576000805461ff0019169055604051600181527f7f26b83ff96e1f2b6a682f133852f6798a09c465da95921460cefb38474024989060200160405180910390a15b50565b61030e6103ee565b6001600160a01b0381166103735760405162461bcd60e51b815260206004820152602660248201527f4f776e61626c653a206e6577206f776e657220697320746865207a65726f206160448201526564647265737360d01b6064820152608401610289565b61030381610566565b6103846103ee565b6001600160a01b0381166000908152606560205260408120805434928392916103ae90849061064b565b90915550506040518181526001600160a01b038316907f2da466a7b24304f47e87fa2e1e5a81b9831ce54fec19055ce277ca2f39ba42c4906020016101d0565b6033546001600160a01b031633146101ee5760405162461bcd60e51b815260206004820181905260248201527f4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65726044820152606401610289565b804710156104985760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a20696e73756666696369656e742062616c616e63650000006044820152606401610289565b6000826001600160a01b03168260405160006040518083038185875af1925050503d80600081146104e5576040519150601f19603f3d011682016040523d82523d6000602084013e6104ea565b606091505b50509050806105615760405162461bcd60e51b815260206004820152603a60248201527f416464726573733a20756e61626c6520746f2073656e642076616c75652c207260448201527f6563697069656e74206d617920686176652072657665727465640000000000006064820152608401610289565b505050565b603380546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a35050565b600054610100900460ff166105df5760405162461bcd60e51b815260040161028990610672565b6101ee600054610100900460ff166106095760405162461bcd60e51b815260040161028990610672565b6101ee33610566565b6001600160a01b038116811461030357600080fd5b60006020828403121561063957600080fd5b813561064481610612565b9392505050565b8082018082111561066c57634e487b7160e01b600052601160045260246000fd5b92915050565b6020808252602b908201527f496e697469616c697a61626c653a20636f6e7472616374206973206e6f74206960408201526a6e697469616c697a696e6760a81b60608201526080019056fea26469706673582212209185c34304b45b06a76f2d335fdc829aa5e371973f70ea0e52939b95d388451264736f6c63430008100033a264697066735822122056b695f889598471e0b975942b5edd8f8c2a379f94fa5083a84256709015769e64736f6c63430008100033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000000000000000000000000000000000000000000000000000000000000000000099c4a6e4dde61bc1dc1a8a8c9609ddfa9126817c
-----Decoded View---------------
Arg [0] : _feeBips (uint256): 0
Arg [1] : _feeRecipient (address): 0x99c4a6E4ddE61bC1dC1A8a8C9609DdFA9126817c
-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [1] : 00000000000000000000000099c4a6e4dde61bc1dc1a8a8c9609ddfa9126817c
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.