Overview
ETH Balance
18.684168793010598883 ETH
Eth Value
$62,792.77 (@ $3,360.75/ETH)Token Holdings
More Info
Private Name Tags
ContractCreator
Latest 25 from a total of 13,673 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Stake | 21249831 | 1 hr ago | IN | 0 ETH | 0.00112286 | ||||
Claim Fees | 21249824 | 1 hr ago | IN | 0 ETH | 0.00072659 | ||||
Stake | 21249271 | 3 hrs ago | IN | 0 ETH | 0.00169103 | ||||
Enter Cycle | 21249257 | 3 hrs ago | IN | 0.0105105 ETH | 0.00339029 | ||||
Claim Rewards | 21247202 | 10 hrs ago | IN | 0 ETH | 0.00137458 | ||||
Claim Fees | 21245464 | 15 hrs ago | IN | 0 ETH | 0.00076439 | ||||
Enter Cycle | 21245365 | 16 hrs ago | IN | 0.0105525 ETH | 0.00423384 | ||||
Claim Fees | 21244754 | 18 hrs ago | IN | 0 ETH | 0.00172336 | ||||
Enter Cycle | 21242963 | 24 hrs ago | IN | 0.010542 ETH | 0.00182603 | ||||
Claim Fees | 21241881 | 27 hrs ago | IN | 0 ETH | 0.00065786 | ||||
Claim Fees | 21241581 | 28 hrs ago | IN | 0 ETH | 0.00062173 | ||||
Claim Fees | 21239503 | 35 hrs ago | IN | 0 ETH | 0.00074 | ||||
Enter Cycle | 21239100 | 37 hrs ago | IN | 0.0105315 ETH | 0.00312657 | ||||
Claim Fees | 21238488 | 39 hrs ago | IN | 0 ETH | 0.00140363 | ||||
Enter Cycle | 21236877 | 44 hrs ago | IN | 0.010521 ETH | 0.00491473 | ||||
Enter Cycle | 21236872 | 44 hrs ago | IN | 0.0105105 ETH | 0.00499512 | ||||
Enter Cycle | 21236867 | 44 hrs ago | IN | 0.0105105 ETH | 0.01076862 | ||||
Claim Fees | 21236167 | 46 hrs ago | IN | 0 ETH | 0.00206613 | ||||
Claim Rewards | 21235896 | 47 hrs ago | IN | 0 ETH | 0.00127702 | ||||
Claim Fees | 21235843 | 2 days ago | IN | 0 ETH | 0.00112454 | ||||
Claim Fees | 21234753 | 2 days ago | IN | 0 ETH | 0.00095272 | ||||
Stake | 21233272 | 2 days ago | IN | 0 ETH | 0.00121155 | ||||
Claim Fees | 21233239 | 2 days ago | IN | 0 ETH | 0.00092349 | ||||
Stake | 21231426 | 2 days ago | IN | 0 ETH | 0.00255471 | ||||
Claim Rewards | 21230681 | 2 days ago | IN | 0 ETH | 0.00177212 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
21249824 | 1 hr ago | 0.00609877 ETH | ||||
21249257 | 3 hrs ago | 0.0005005 ETH | ||||
21249257 | 3 hrs ago | 0.0025025 ETH | ||||
21249257 | 3 hrs ago | 0.0001001 ETH | ||||
21249257 | 3 hrs ago | 0.00038038 ETH | ||||
21249257 | 3 hrs ago | 0.00002002 ETH | ||||
21245464 | 15 hrs ago | 0.01123476 ETH | ||||
21245365 | 16 hrs ago | 0.0005525 ETH | ||||
21245365 | 16 hrs ago | 0.0025 ETH | ||||
21245365 | 16 hrs ago | 0.0001 ETH | ||||
21245365 | 16 hrs ago | 0.00038 ETH | ||||
21245365 | 16 hrs ago | 0.00002 ETH | ||||
21244754 | 18 hrs ago | 0.00145436 ETH | ||||
21242963 | 24 hrs ago | 0.000502 ETH | ||||
21242963 | 24 hrs ago | 0.00251 ETH | ||||
21242963 | 24 hrs ago | 0.0001004 ETH | ||||
21242963 | 24 hrs ago | 0.00038152 ETH | ||||
21242963 | 24 hrs ago | 0.00002008 ETH | ||||
21241881 | 27 hrs ago | 0.00040532 ETH | ||||
21241581 | 28 hrs ago | 0.01144799 ETH | ||||
21239503 | 35 hrs ago | 0.02114117 ETH | ||||
21239100 | 37 hrs ago | 0.0005015 ETH | ||||
21239100 | 37 hrs ago | 0.0025075 ETH | ||||
21239100 | 37 hrs ago | 0.0001003 ETH | ||||
21239100 | 37 hrs ago | 0.00038114 ETH |
Loading...
Loading
Contract Source Code Verified (Exact Match)
Contract Name:
Q
Compiler Version
v0.8.25+commit.b61c2a91
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2024-05-27 */ // File: contracts/interfaces/ISwapRouterMinimal.sol pragma solidity ^0.8.23; interface ISwapRouterMinimal { struct ExactOutputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountOut; uint256 amountInMaximum; uint160 sqrtPriceLimitX96; } struct ExactInputSingleParams { address tokenIn; address tokenOut; uint24 fee; address recipient; uint256 deadline; uint256 amountIn; uint256 amountOutMinimum; uint160 sqrtPriceLimitX96; } function exactInputSingle(ExactInputSingleParams calldata params) external payable returns (uint256 amountOut); function exactOutputSingle(ExactOutputSingleParams calldata params) external payable returns (uint256 amountOut); } // File: contracts/interfaces/IWETH9Minimal.sol pragma solidity ^0.8.23; interface IWETH9Minimal { function approve(address guy, uint256 wad) external returns(bool); function deposit() external payable; } // File: @uniswap/v3-periphery/contracts/libraries/PoolAddress.sol pragma solidity >=0.5.0; /// @title Provides functions for deriving a pool address from the factory, tokens, and the fee library PoolAddress { bytes32 internal constant POOL_INIT_CODE_HASH = 0xe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b54; /// @notice The identifying key of the pool struct PoolKey { address token0; address token1; uint24 fee; } /// @notice Returns PoolKey: the ordered tokens with the matched fee levels /// @param tokenA The first token of a pool, unsorted /// @param tokenB The second token of a pool, unsorted /// @param fee The fee level of the pool /// @return Poolkey The pool details with ordered token0 and token1 assignments function getPoolKey( address tokenA, address tokenB, uint24 fee ) internal pure returns (PoolKey memory) { if (tokenA > tokenB) (tokenA, tokenB) = (tokenB, tokenA); return PoolKey({token0: tokenA, token1: tokenB, fee: fee}); } /// @notice Deterministically computes the pool address given the factory and PoolKey /// @param factory The Uniswap V3 factory contract address /// @param key The PoolKey /// @return pool The contract address of the V3 pool function computeAddress(address factory, PoolKey memory key) internal pure returns (address pool) { require(key.token0 < key.token1); pool = address( uint160( uint256( keccak256( abi.encodePacked( hex'ff', factory, keccak256(abi.encode(key.token0, key.token1, key.fee)), POOL_INIT_CODE_HASH ) ) ) ) ); } } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolEvents.sol pragma solidity >=0.5.0; /// @title Events emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolEvents { /// @notice Emitted exactly once by a pool when #initialize is first called on the pool /// @dev Mint/Burn/Swap cannot be emitted by the pool before Initialize /// @param sqrtPriceX96 The initial sqrt price of the pool, as a Q64.96 /// @param tick The initial tick of the pool, i.e. log base 1.0001 of the starting price of the pool event Initialize(uint160 sqrtPriceX96, int24 tick); /// @notice Emitted when liquidity is minted for a given position /// @param sender The address that minted the liquidity /// @param owner The owner of the position and recipient of any minted liquidity /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity minted to the position range /// @param amount0 How much token0 was required for the minted liquidity /// @param amount1 How much token1 was required for the minted liquidity event Mint( address sender, address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted when fees are collected by the owner of a position /// @dev Collect events may be emitted with zero amount0 and amount1 when the caller chooses not to collect fees /// @param owner The owner of the position for which fees are collected /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount0 The amount of token0 fees collected /// @param amount1 The amount of token1 fees collected event Collect( address indexed owner, address recipient, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount0, uint128 amount1 ); /// @notice Emitted when a position's liquidity is removed /// @dev Does not withdraw any fees earned by the liquidity position, which must be withdrawn via #collect /// @param owner The owner of the position for which liquidity is removed /// @param tickLower The lower tick of the position /// @param tickUpper The upper tick of the position /// @param amount The amount of liquidity to remove /// @param amount0 The amount of token0 withdrawn /// @param amount1 The amount of token1 withdrawn event Burn( address indexed owner, int24 indexed tickLower, int24 indexed tickUpper, uint128 amount, uint256 amount0, uint256 amount1 ); /// @notice Emitted by the pool for any swaps between token0 and token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the output of the swap /// @param amount0 The delta of the token0 balance of the pool /// @param amount1 The delta of the token1 balance of the pool /// @param sqrtPriceX96 The sqrt(price) of the pool after the swap, as a Q64.96 /// @param liquidity The liquidity of the pool after the swap /// @param tick The log base 1.0001 of price of the pool after the swap event Swap( address indexed sender, address indexed recipient, int256 amount0, int256 amount1, uint160 sqrtPriceX96, uint128 liquidity, int24 tick ); /// @notice Emitted by the pool for any flashes of token0/token1 /// @param sender The address that initiated the swap call, and that received the callback /// @param recipient The address that received the tokens from flash /// @param amount0 The amount of token0 that was flashed /// @param amount1 The amount of token1 that was flashed /// @param paid0 The amount of token0 paid for the flash, which can exceed the amount0 plus the fee /// @param paid1 The amount of token1 paid for the flash, which can exceed the amount1 plus the fee event Flash( address indexed sender, address indexed recipient, uint256 amount0, uint256 amount1, uint256 paid0, uint256 paid1 ); /// @notice Emitted by the pool for increases to the number of observations that can be stored /// @dev observationCardinalityNext is not the observation cardinality until an observation is written at the index /// just before a mint/swap/burn. /// @param observationCardinalityNextOld The previous value of the next observation cardinality /// @param observationCardinalityNextNew The updated value of the next observation cardinality event IncreaseObservationCardinalityNext( uint16 observationCardinalityNextOld, uint16 observationCardinalityNextNew ); /// @notice Emitted when the protocol fee is changed by the pool /// @param feeProtocol0Old The previous value of the token0 protocol fee /// @param feeProtocol1Old The previous value of the token1 protocol fee /// @param feeProtocol0New The updated value of the token0 protocol fee /// @param feeProtocol1New The updated value of the token1 protocol fee event SetFeeProtocol(uint8 feeProtocol0Old, uint8 feeProtocol1Old, uint8 feeProtocol0New, uint8 feeProtocol1New); /// @notice Emitted when the collected protocol fees are withdrawn by the factory owner /// @param sender The address that collects the protocol fees /// @param recipient The address that receives the collected protocol fees /// @param amount0 The amount of token0 protocol fees that is withdrawn /// @param amount0 The amount of token1 protocol fees that is withdrawn event CollectProtocol(address indexed sender, address indexed recipient, uint128 amount0, uint128 amount1); } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolErrors.sol pragma solidity >=0.5.0; /// @title Errors emitted by a pool /// @notice Contains all events emitted by the pool interface IUniswapV3PoolErrors { error LOK(); error TLU(); error TLM(); error TUM(); error AI(); error M0(); error M1(); error AS(); error IIA(); error L(); error F0(); error F1(); } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolOwnerActions.sol pragma solidity >=0.5.0; /// @title Permissioned pool actions /// @notice Contains pool methods that may only be called by the factory owner interface IUniswapV3PoolOwnerActions { /// @notice Set the denominator of the protocol's % share of the fees /// @param feeProtocol0 new protocol fee for token0 of the pool /// @param feeProtocol1 new protocol fee for token1 of the pool function setFeeProtocol(uint8 feeProtocol0, uint8 feeProtocol1) external; /// @notice Collect the protocol fee accrued to the pool /// @param recipient The address to which collected protocol fees should be sent /// @param amount0Requested The maximum amount of token0 to send, can be 0 to collect fees in only token1 /// @param amount1Requested The maximum amount of token1 to send, can be 0 to collect fees in only token0 /// @return amount0 The protocol fee collected in token0 /// @return amount1 The protocol fee collected in token1 function collectProtocol( address recipient, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolActions.sol pragma solidity >=0.5.0; /// @title Permissionless pool actions /// @notice Contains pool methods that can be called by anyone interface IUniswapV3PoolActions { /// @notice Sets the initial price for the pool /// @dev Price is represented as a sqrt(amountToken1/amountToken0) Q64.96 value /// @param sqrtPriceX96 the initial sqrt price of the pool as a Q64.96 function initialize(uint160 sqrtPriceX96) external; /// @notice Adds liquidity for the given recipient/tickLower/tickUpper position /// @dev The caller of this method receives a callback in the form of IUniswapV3MintCallback#uniswapV3MintCallback /// in which they must pay any token0 or token1 owed for the liquidity. The amount of token0/token1 due depends /// on tickLower, tickUpper, the amount of liquidity, and the current price. /// @param recipient The address for which the liquidity will be created /// @param tickLower The lower tick of the position in which to add liquidity /// @param tickUpper The upper tick of the position in which to add liquidity /// @param amount The amount of liquidity to mint /// @param data Any data that should be passed through to the callback /// @return amount0 The amount of token0 that was paid to mint the given amount of liquidity. Matches the value in the callback /// @return amount1 The amount of token1 that was paid to mint the given amount of liquidity. Matches the value in the callback function mint( address recipient, int24 tickLower, int24 tickUpper, uint128 amount, bytes calldata data ) external returns (uint256 amount0, uint256 amount1); /// @notice Collects tokens owed to a position /// @dev Does not recompute fees earned, which must be done either via mint or burn of any amount of liquidity. /// Collect must be called by the position owner. To withdraw only token0 or only token1, amount0Requested or /// amount1Requested may be set to zero. To withdraw all tokens owed, caller may pass any value greater than the /// actual tokens owed, e.g. type(uint128).max. Tokens owed may be from accumulated swap fees or burned liquidity. /// @param recipient The address which should receive the fees collected /// @param tickLower The lower tick of the position for which to collect fees /// @param tickUpper The upper tick of the position for which to collect fees /// @param amount0Requested How much token0 should be withdrawn from the fees owed /// @param amount1Requested How much token1 should be withdrawn from the fees owed /// @return amount0 The amount of fees collected in token0 /// @return amount1 The amount of fees collected in token1 function collect( address recipient, int24 tickLower, int24 tickUpper, uint128 amount0Requested, uint128 amount1Requested ) external returns (uint128 amount0, uint128 amount1); /// @notice Burn liquidity from the sender and account tokens owed for the liquidity to the position /// @dev Can be used to trigger a recalculation of fees owed to a position by calling with an amount of 0 /// @dev Fees must be collected separately via a call to #collect /// @param tickLower The lower tick of the position for which to burn liquidity /// @param tickUpper The upper tick of the position for which to burn liquidity /// @param amount How much liquidity to burn /// @return amount0 The amount of token0 sent to the recipient /// @return amount1 The amount of token1 sent to the recipient function burn( int24 tickLower, int24 tickUpper, uint128 amount ) external returns (uint256 amount0, uint256 amount1); /// @notice Swap token0 for token1, or token1 for token0 /// @dev The caller of this method receives a callback in the form of IUniswapV3SwapCallback#uniswapV3SwapCallback /// @param recipient The address to receive the output of the swap /// @param zeroForOne The direction of the swap, true for token0 to token1, false for token1 to token0 /// @param amountSpecified The amount of the swap, which implicitly configures the swap as exact input (positive), or exact output (negative) /// @param sqrtPriceLimitX96 The Q64.96 sqrt price limit. If zero for one, the price cannot be less than this /// value after the swap. If one for zero, the price cannot be greater than this value after the swap /// @param data Any data to be passed through to the callback /// @return amount0 The delta of the balance of token0 of the pool, exact when negative, minimum when positive /// @return amount1 The delta of the balance of token1 of the pool, exact when negative, minimum when positive function swap( address recipient, bool zeroForOne, int256 amountSpecified, uint160 sqrtPriceLimitX96, bytes calldata data ) external returns (int256 amount0, int256 amount1); /// @notice Receive token0 and/or token1 and pay it back, plus a fee, in the callback /// @dev The caller of this method receives a callback in the form of IUniswapV3FlashCallback#uniswapV3FlashCallback /// @dev Can be used to donate underlying tokens pro-rata to currently in-range liquidity providers by calling /// with 0 amount{0,1} and sending the donation amount(s) from the callback /// @param recipient The address which will receive the token0 and token1 amounts /// @param amount0 The amount of token0 to send /// @param amount1 The amount of token1 to send /// @param data Any data to be passed through to the callback function flash( address recipient, uint256 amount0, uint256 amount1, bytes calldata data ) external; /// @notice Increase the maximum number of price and liquidity observations that this pool will store /// @dev This method is no-op if the pool already has an observationCardinalityNext greater than or equal to /// the input observationCardinalityNext. /// @param observationCardinalityNext The desired minimum number of observations for the pool to store function increaseObservationCardinalityNext(uint16 observationCardinalityNext) external; } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolDerivedState.sol pragma solidity >=0.5.0; /// @title Pool state that is not stored /// @notice Contains view functions to provide information about the pool that is computed rather than stored on the /// blockchain. The functions here may have variable gas costs. interface IUniswapV3PoolDerivedState { /// @notice Returns the cumulative tick and liquidity as of each timestamp `secondsAgo` from the current block timestamp /// @dev To get a time weighted average tick or liquidity-in-range, you must call this with two values, one representing /// the beginning of the period and another for the end of the period. E.g., to get the last hour time-weighted average tick, /// you must call it with secondsAgos = [3600, 0]. /// @dev The time weighted average tick represents the geometric time weighted average price of the pool, in /// log base sqrt(1.0001) of token1 / token0. The TickMath library can be used to go from a tick value to a ratio. /// @param secondsAgos From how long ago each cumulative tick and liquidity value should be returned /// @return tickCumulatives Cumulative tick values as of each `secondsAgos` from the current block timestamp /// @return secondsPerLiquidityCumulativeX128s Cumulative seconds per liquidity-in-range value as of each `secondsAgos` from the current block /// timestamp function observe(uint32[] calldata secondsAgos) external view returns (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s); /// @notice Returns a snapshot of the tick cumulative, seconds per liquidity and seconds inside a tick range /// @dev Snapshots must only be compared to other snapshots, taken over a period for which a position existed. /// I.e., snapshots cannot be compared if a position is not held for the entire period between when the first /// snapshot is taken and the second snapshot is taken. /// @param tickLower The lower tick of the range /// @param tickUpper The upper tick of the range /// @return tickCumulativeInside The snapshot of the tick accumulator for the range /// @return secondsPerLiquidityInsideX128 The snapshot of seconds per liquidity for the range /// @return secondsInside The snapshot of seconds per liquidity for the range function snapshotCumulativesInside(int24 tickLower, int24 tickUpper) external view returns ( int56 tickCumulativeInside, uint160 secondsPerLiquidityInsideX128, uint32 secondsInside ); } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolState.sol pragma solidity >=0.5.0; /// @title Pool state that can change /// @notice These methods compose the pool's state, and can change with any frequency including multiple times /// per transaction interface IUniswapV3PoolState { /// @notice The 0th storage slot in the pool stores many values, and is exposed as a single method to save gas /// when accessed externally. /// @return sqrtPriceX96 The current price of the pool as a sqrt(token1/token0) Q64.96 value /// @return tick The current tick of the pool, i.e. according to the last tick transition that was run. /// This value may not always be equal to SqrtTickMath.getTickAtSqrtRatio(sqrtPriceX96) if the price is on a tick /// boundary. /// @return observationIndex The index of the last oracle observation that was written, /// @return observationCardinality The current maximum number of observations stored in the pool, /// @return observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// @return feeProtocol The protocol fee for both tokens of the pool. /// Encoded as two 4 bit values, where the protocol fee of token1 is shifted 4 bits and the protocol fee of token0 /// is the lower 4 bits. Used as the denominator of a fraction of the swap fee, e.g. 4 means 1/4th of the swap fee. /// unlocked Whether the pool is currently locked to reentrancy function slot0() external view returns ( uint160 sqrtPriceX96, int24 tick, uint16 observationIndex, uint16 observationCardinality, uint16 observationCardinalityNext, uint8 feeProtocol, bool unlocked ); /// @notice The fee growth as a Q128.128 fees of token0 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal0X128() external view returns (uint256); /// @notice The fee growth as a Q128.128 fees of token1 collected per unit of liquidity for the entire life of the pool /// @dev This value can overflow the uint256 function feeGrowthGlobal1X128() external view returns (uint256); /// @notice The amounts of token0 and token1 that are owed to the protocol /// @dev Protocol fees will never exceed uint128 max in either token function protocolFees() external view returns (uint128 token0, uint128 token1); /// @notice The currently in range liquidity available to the pool /// @dev This value has no relationship to the total liquidity across all ticks /// @return The liquidity at the current price of the pool function liquidity() external view returns (uint128); /// @notice Look up information about a specific tick in the pool /// @param tick The tick to look up /// @return liquidityGross the total amount of position liquidity that uses the pool either as tick lower or /// tick upper /// @return liquidityNet how much liquidity changes when the pool price crosses the tick, /// @return feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// @return feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// @return tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// @return secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// @return secondsOutside the seconds spent on the other side of the tick from the current tick, /// @return initialized Set to true if the tick is initialized, i.e. liquidityGross is greater than 0, otherwise equal to false. /// Outside values can only be used if the tick is initialized, i.e. if liquidityGross is greater than 0. /// In addition, these values are only relative and must be used only in comparison to previous snapshots for /// a specific position. function ticks(int24 tick) external view returns ( uint128 liquidityGross, int128 liquidityNet, uint256 feeGrowthOutside0X128, uint256 feeGrowthOutside1X128, int56 tickCumulativeOutside, uint160 secondsPerLiquidityOutsideX128, uint32 secondsOutside, bool initialized ); /// @notice Returns 256 packed tick initialized boolean values. See TickBitmap for more information function tickBitmap(int16 wordPosition) external view returns (uint256); /// @notice Returns the information about a position by the position's key /// @param key The position's key is a hash of a preimage composed by the owner, tickLower and tickUpper /// @return liquidity The amount of liquidity in the position, /// @return feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// @return feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// @return tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// @return tokensOwed1 the computed amount of token1 owed to the position as of the last mint/burn/poke function positions(bytes32 key) external view returns ( uint128 liquidity, uint256 feeGrowthInside0LastX128, uint256 feeGrowthInside1LastX128, uint128 tokensOwed0, uint128 tokensOwed1 ); /// @notice Returns data about a specific observation index /// @param index The element of the observations array to fetch /// @dev You most likely want to use #observe() instead of this method to get an observation as of some amount of time /// ago, rather than at a specific index in the array. /// @return blockTimestamp The timestamp of the observation, /// @return tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// @return secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// @return initialized whether the observation has been initialized and the values are safe to use function observations(uint256 index) external view returns ( uint32 blockTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, bool initialized ); } // File: @uniswap/v3-core/contracts/interfaces/pool/IUniswapV3PoolImmutables.sol pragma solidity >=0.5.0; /// @title Pool state that never changes /// @notice These parameters are fixed for a pool forever, i.e., the methods will always return the same values interface IUniswapV3PoolImmutables { /// @notice The contract that deployed the pool, which must adhere to the IUniswapV3Factory interface /// @return The contract address function factory() external view returns (address); /// @notice The first of the two tokens of the pool, sorted by address /// @return The token contract address function token0() external view returns (address); /// @notice The second of the two tokens of the pool, sorted by address /// @return The token contract address function token1() external view returns (address); /// @notice The pool's fee in hundredths of a bip, i.e. 1e-6 /// @return The fee function fee() external view returns (uint24); /// @notice The pool tick spacing /// @dev Ticks can only be used at multiples of this value, minimum of 1 and always positive /// e.g.: a tickSpacing of 3 means ticks can be initialized every 3rd tick, i.e., ..., -6, -3, 0, 3, 6, ... /// This value is an int24 to avoid casting even though it is always positive. /// @return The tick spacing function tickSpacing() external view returns (int24); /// @notice The maximum amount of position liquidity that can use any tick in the range /// @dev This parameter is enforced per tick to prevent liquidity from overflowing a uint128 at any point, and /// also prevents out-of-range liquidity from being used to prevent adding in-range liquidity to a pool /// @return The max amount of liquidity per tick function maxLiquidityPerTick() external view returns (uint128); } // File: @uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol pragma solidity >=0.5.0; /// @title The interface for a Uniswap V3 Pool /// @notice A Uniswap pool facilitates swapping and automated market making between any two assets that strictly conform /// to the ERC20 specification /// @dev The pool interface is broken up into many smaller pieces interface IUniswapV3Pool is IUniswapV3PoolImmutables, IUniswapV3PoolState, IUniswapV3PoolDerivedState, IUniswapV3PoolActions, IUniswapV3PoolOwnerActions, IUniswapV3PoolErrors, IUniswapV3PoolEvents { } // File: @uniswap/v3-core/contracts/libraries/TickMath.sol pragma solidity ^0.8.0; /// @title Math library for computing sqrt prices from ticks and vice versa /// @notice Computes sqrt price for ticks of size 1.0001, i.e. sqrt(1.0001^tick) as fixed point Q64.96 numbers. Supports /// prices between 2**-128 and 2**128 library TickMath { error T(); error R(); /// @dev The minimum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**-128 int24 internal constant MIN_TICK = -887272; /// @dev The maximum tick that may be passed to #getSqrtRatioAtTick computed from log base 1.0001 of 2**128 int24 internal constant MAX_TICK = -MIN_TICK; /// @dev The minimum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MIN_TICK) uint160 internal constant MIN_SQRT_RATIO = 4295128739; /// @dev The maximum value that can be returned from #getSqrtRatioAtTick. Equivalent to getSqrtRatioAtTick(MAX_TICK) uint160 internal constant MAX_SQRT_RATIO = 1461446703485210103287273052203988822378723970342; /// @notice Calculates sqrt(1.0001^tick) * 2^96 /// @dev Throws if |tick| > max tick /// @param tick The input tick for the above formula /// @return sqrtPriceX96 A Fixed point Q64.96 number representing the sqrt of the ratio of the two assets (token1/token0) /// at the given tick function getSqrtRatioAtTick(int24 tick) internal pure returns (uint160 sqrtPriceX96) { unchecked { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); if (absTick > uint256(int256(MAX_TICK))) revert T(); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; if (absTick & 0x2 != 0) ratio = (ratio * 0xfff97272373d413259a46990580e213a) >> 128; if (absTick & 0x4 != 0) ratio = (ratio * 0xfff2e50f5f656932ef12357cf3c7fdcc) >> 128; if (absTick & 0x8 != 0) ratio = (ratio * 0xffe5caca7e10e4e61c3624eaa0941cd0) >> 128; if (absTick & 0x10 != 0) ratio = (ratio * 0xffcb9843d60f6159c9db58835c926644) >> 128; if (absTick & 0x20 != 0) ratio = (ratio * 0xff973b41fa98c081472e6896dfb254c0) >> 128; if (absTick & 0x40 != 0) ratio = (ratio * 0xff2ea16466c96a3843ec78b326b52861) >> 128; if (absTick & 0x80 != 0) ratio = (ratio * 0xfe5dee046a99a2a811c461f1969c3053) >> 128; if (absTick & 0x100 != 0) ratio = (ratio * 0xfcbe86c7900a88aedcffc83b479aa3a4) >> 128; if (absTick & 0x200 != 0) ratio = (ratio * 0xf987a7253ac413176f2b074cf7815e54) >> 128; if (absTick & 0x400 != 0) ratio = (ratio * 0xf3392b0822b70005940c7a398e4b70f3) >> 128; if (absTick & 0x800 != 0) ratio = (ratio * 0xe7159475a2c29b7443b29c7fa6e889d9) >> 128; if (absTick & 0x1000 != 0) ratio = (ratio * 0xd097f3bdfd2022b8845ad8f792aa5825) >> 128; if (absTick & 0x2000 != 0) ratio = (ratio * 0xa9f746462d870fdf8a65dc1f90e061e5) >> 128; if (absTick & 0x4000 != 0) ratio = (ratio * 0x70d869a156d2a1b890bb3df62baf32f7) >> 128; if (absTick & 0x8000 != 0) ratio = (ratio * 0x31be135f97d08fd981231505542fcfa6) >> 128; if (absTick & 0x10000 != 0) ratio = (ratio * 0x9aa508b5b7a84e1c677de54f3e99bc9) >> 128; if (absTick & 0x20000 != 0) ratio = (ratio * 0x5d6af8dedb81196699c329225ee604) >> 128; if (absTick & 0x40000 != 0) ratio = (ratio * 0x2216e584f5fa1ea926041bedfe98) >> 128; if (absTick & 0x80000 != 0) ratio = (ratio * 0x48a170391f7dc42444e8fa2) >> 128; if (tick > 0) ratio = type(uint256).max / ratio; // this divides by 1<<32 rounding up to go from a Q128.128 to a Q128.96. // we then downcast because we know the result always fits within 160 bits due to our tick input constraint // we round up in the division so getTickAtSqrtRatio of the output price is always consistent sqrtPriceX96 = uint160((ratio >> 32) + (ratio % (1 << 32) == 0 ? 0 : 1)); } } /// @notice Calculates the greatest tick value such that getRatioAtTick(tick) <= ratio /// @dev Throws in case sqrtPriceX96 < MIN_SQRT_RATIO, as MIN_SQRT_RATIO is the lowest value getRatioAtTick may /// ever return. /// @param sqrtPriceX96 The sqrt ratio for which to compute the tick as a Q64.96 /// @return tick The greatest tick for which the ratio is less than or equal to the input ratio function getTickAtSqrtRatio(uint160 sqrtPriceX96) internal pure returns (int24 tick) { unchecked { // second inequality must be < because the price can never reach the price at the max tick if (!(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO)) revert R(); uint256 ratio = uint256(sqrtPriceX96) << 32; uint256 r = ratio; uint256 msb = 0; assembly { let f := shl(7, gt(r, 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(6, gt(r, 0xFFFFFFFFFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(5, gt(r, 0xFFFFFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(4, gt(r, 0xFFFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(3, gt(r, 0xFF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(2, gt(r, 0xF)) msb := or(msb, f) r := shr(f, r) } assembly { let f := shl(1, gt(r, 0x3)) msb := or(msb, f) r := shr(f, r) } assembly { let f := gt(r, 0x1) msb := or(msb, f) } if (msb >= 128) r = ratio >> (msb - 127); else r = ratio << (127 - msb); int256 log_2 = (int256(msb) - 128) << 64; assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(63, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(62, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(61, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(60, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(59, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(58, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(57, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(56, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(55, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(54, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(53, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(52, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(51, f)) r := shr(f, r) } assembly { r := shr(127, mul(r, r)) let f := shr(128, r) log_2 := or(log_2, shl(50, f)) } int256 log_sqrt10001 = log_2 * 255738958999603826347141; // 128.128 number int24 tickLow = int24((log_sqrt10001 - 3402992956809132418596140100660247210) >> 128); int24 tickHi = int24((log_sqrt10001 + 291339464771989622907027621153398088495) >> 128); tick = tickLow == tickHi ? tickLow : getSqrtRatioAtTick(tickHi) <= sqrtPriceX96 ? tickHi : tickLow; } } } // File: @uniswap/v3-core/contracts/libraries/FullMath.sol pragma solidity ^0.8.0; /// @title Contains 512-bit math functions /// @notice Facilitates multiplication and division that can have overflow of an intermediate value without any loss of precision /// @dev Handles "phantom overflow" i.e., allows multiplication and division where an intermediate value overflows 256 bits library FullMath { /// @notice Calculates floor(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result /// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv function mulDiv( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = a * b // Compute the product mod 2**256 and mod 2**256 - 1 // then use the Chinese Remainder Theorem to reconstruct // the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2**256 + prod0 uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(a, b, not(0)) prod0 := mul(a, b) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division if (prod1 == 0) { require(denominator > 0); assembly { result := div(prod0, denominator) } return result; } // Make sure the result is less than 2**256. // Also prevents denominator == 0 require(denominator > prod1); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod uint256 remainder; assembly { remainder := mulmod(a, b, denominator) } // Subtract 256 bit number from 512 bit number assembly { prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator // Compute largest power of two divisor of denominator. // Always >= 1. uint256 twos = (0 - denominator) & denominator; // Divide denominator by power of two assembly { denominator := div(denominator, twos) } // Divide [prod1 prod0] by the factors of two assembly { prod0 := div(prod0, twos) } // Shift in bits from prod1 into prod0. For this we need // to flip `twos` such that it is 2**256 / twos. // If twos is zero, then it becomes one assembly { twos := add(div(sub(0, twos), twos), 1) } prod0 |= prod1 * twos; // Invert denominator mod 2**256 // Now that denominator is an odd number, it has an inverse // modulo 2**256 such that denominator * inv = 1 mod 2**256. // Compute the inverse by starting with a seed that is correct // correct for four bits. That is, denominator * inv = 1 mod 2**4 uint256 inv = (3 * denominator) ^ 2; // Now use Newton-Raphson iteration to improve the precision. // Thanks to Hensel's lifting lemma, this also works in modular // arithmetic, doubling the correct bits in each step. inv *= 2 - denominator * inv; // inverse mod 2**8 inv *= 2 - denominator * inv; // inverse mod 2**16 inv *= 2 - denominator * inv; // inverse mod 2**32 inv *= 2 - denominator * inv; // inverse mod 2**64 inv *= 2 - denominator * inv; // inverse mod 2**128 inv *= 2 - denominator * inv; // inverse mod 2**256 // Because the division is now exact we can divide by multiplying // with the modular inverse of denominator. This will give us the // correct result modulo 2**256. Since the precoditions guarantee // that the outcome is less than 2**256, this is the final result. // We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inv; return result; } } /// @notice Calculates ceil(a×b÷denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 /// @param a The multiplicand /// @param b The multiplier /// @param denominator The divisor /// @return result The 256-bit result function mulDivRoundingUp( uint256 a, uint256 b, uint256 denominator ) internal pure returns (uint256 result) { unchecked { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } } // File: @uniswap/v3-periphery/contracts/libraries/OracleLibrary.sol pragma solidity >=0.5.0 <0.9.0; /// @title Oracle library /// @notice Provides functions to integrate with V3 pool oracle library OracleLibrary { /// @notice Calculates time-weighted means of tick and liquidity for a given Uniswap V3 pool /// @param pool Address of the pool that we want to observe /// @param secondsAgo Number of seconds in the past from which to calculate the time-weighted means /// @return arithmeticMeanTick The arithmetic mean tick from (block.timestamp - secondsAgo) to block.timestamp /// @return harmonicMeanLiquidity The harmonic mean liquidity from (block.timestamp - secondsAgo) to block.timestamp function consult(address pool, uint32 secondsAgo) internal view returns (int24 arithmeticMeanTick, uint128 harmonicMeanLiquidity) { require(secondsAgo != 0, 'BP'); uint32[] memory secondsAgos = new uint32[](2); secondsAgos[0] = secondsAgo; secondsAgos[1] = 0; (int56[] memory tickCumulatives, uint160[] memory secondsPerLiquidityCumulativeX128s) = IUniswapV3Pool(pool) .observe(secondsAgos); int56 tickCumulativesDelta = tickCumulatives[1] - tickCumulatives[0]; uint160 secondsPerLiquidityCumulativesDelta = secondsPerLiquidityCumulativeX128s[1] - secondsPerLiquidityCumulativeX128s[0]; arithmeticMeanTick = int24(tickCumulativesDelta / int56(uint56(secondsAgo))); // Always round to negative infinity if (tickCumulativesDelta < 0 && (tickCumulativesDelta % int56(uint56(secondsAgo)) != 0)) arithmeticMeanTick--; // We are multiplying here instead of shifting to ensure that harmonicMeanLiquidity doesn't overflow uint128 uint192 secondsAgoX160 = uint192(secondsAgo) * type(uint160).max; harmonicMeanLiquidity = uint128(secondsAgoX160 / (uint192(secondsPerLiquidityCumulativesDelta) << 32)); } /// @notice Given a tick and a token amount, calculates the amount of token received in exchange /// @param tick Tick value used to calculate the quote /// @param baseAmount Amount of token to be converted /// @param baseToken Address of an ERC20 token contract used as the baseAmount denomination /// @param quoteToken Address of an ERC20 token contract used as the quoteAmount denomination /// @return quoteAmount Amount of quoteToken received for baseAmount of baseToken function getQuoteAtTick( int24 tick, uint128 baseAmount, address baseToken, address quoteToken ) internal pure returns (uint256 quoteAmount) { uint160 sqrtRatioX96 = TickMath.getSqrtRatioAtTick(tick); // Calculate quoteAmount with better precision if it doesn't overflow when multiplied by itself if (sqrtRatioX96 <= type(uint128).max) { uint256 ratioX192 = uint256(sqrtRatioX96) * sqrtRatioX96; quoteAmount = baseToken < quoteToken ? FullMath.mulDiv(ratioX192, baseAmount, 1 << 192) : FullMath.mulDiv(1 << 192, baseAmount, ratioX192); } else { uint256 ratioX128 = FullMath.mulDiv(sqrtRatioX96, sqrtRatioX96, 1 << 64); quoteAmount = baseToken < quoteToken ? FullMath.mulDiv(ratioX128, baseAmount, 1 << 128) : FullMath.mulDiv(1 << 128, baseAmount, ratioX128); } } /// @notice Given a pool, it returns the number of seconds ago of the oldest stored observation /// @param pool Address of Uniswap V3 pool that we want to observe /// @return secondsAgo The number of seconds ago of the oldest observation stored for the pool function getOldestObservationSecondsAgo(address pool) internal view returns (uint32 secondsAgo) { (, , uint16 observationIndex, uint16 observationCardinality, , , ) = IUniswapV3Pool(pool).slot0(); require(observationCardinality > 0, 'NI'); (uint32 observationTimestamp, , , bool initialized) = IUniswapV3Pool(pool).observations( (observationIndex + 1) % observationCardinality ); // The next index might not be initialized if the cardinality is in the process of increasing // In this case the oldest observation is always in index 0 if (!initialized) { (observationTimestamp, , , ) = IUniswapV3Pool(pool).observations(0); } unchecked { secondsAgo = uint32(block.timestamp) - observationTimestamp; } } /// @notice Given a pool, it returns the tick value as of the start of the current block /// @param pool Address of Uniswap V3 pool /// @return The tick that the pool was in at the start of the current block function getBlockStartingTickAndLiquidity(address pool) internal view returns (int24, uint128) { (, int24 tick, uint16 observationIndex, uint16 observationCardinality, , , ) = IUniswapV3Pool(pool).slot0(); // 2 observations are needed to reliably calculate the block starting tick require(observationCardinality > 1, 'NEO'); // If the latest observation occurred in the past, then no tick-changing trades have happened in this block // therefore the tick in `slot0` is the same as at the beginning of the current block. // We don't need to check if this observation is initialized - it is guaranteed to be. ( uint32 observationTimestamp, int56 tickCumulative, uint160 secondsPerLiquidityCumulativeX128, ) = IUniswapV3Pool(pool).observations(observationIndex); if (observationTimestamp != uint32(block.timestamp)) { return (tick, IUniswapV3Pool(pool).liquidity()); } uint256 prevIndex = (uint256(observationIndex) + observationCardinality - 1) % observationCardinality; ( uint32 prevObservationTimestamp, int56 prevTickCumulative, uint160 prevSecondsPerLiquidityCumulativeX128, bool prevInitialized ) = IUniswapV3Pool(pool).observations(prevIndex); require(prevInitialized, 'ONI'); uint32 delta = observationTimestamp - prevObservationTimestamp; tick = int24((tickCumulative - int56(uint56(prevTickCumulative))) / int56(uint56(delta))); uint128 liquidity = uint128( (uint192(delta) * type(uint160).max) / (uint192(secondsPerLiquidityCumulativeX128 - prevSecondsPerLiquidityCumulativeX128) << 32) ); return (tick, liquidity); } /// @notice Information for calculating a weighted arithmetic mean tick struct WeightedTickData { int24 tick; uint128 weight; } /// @notice Given an array of ticks and weights, calculates the weighted arithmetic mean tick /// @param weightedTickData An array of ticks and weights /// @return weightedArithmeticMeanTick The weighted arithmetic mean tick /// @dev Each entry of `weightedTickData` should represents ticks from pools with the same underlying pool tokens. If they do not, /// extreme care must be taken to ensure that ticks are comparable (including decimal differences). /// @dev Note that the weighted arithmetic mean tick corresponds to the weighted geometric mean price. function getWeightedArithmeticMeanTick(WeightedTickData[] memory weightedTickData) internal pure returns (int24 weightedArithmeticMeanTick) { // Accumulates the sum of products between each tick and its weight int256 numerator; // Accumulates the sum of the weights uint256 denominator; // Products fit in 152 bits, so it would take an array of length ~2**104 to overflow this logic for (uint256 i; i < weightedTickData.length; i++) { numerator += weightedTickData[i].tick * int256(uint256(weightedTickData[i].weight)); denominator += weightedTickData[i].weight; } weightedArithmeticMeanTick = int24(numerator / int256(denominator)); // Always round to negative infinity if (numerator < 0 && (numerator % int256(denominator) != 0)) weightedArithmeticMeanTick--; } /// @notice Returns the "synthetic" tick which represents the price of the first entry in `tokens` in terms of the last /// @dev Useful for calculating relative prices along routes. /// @dev There must be one tick for each pairwise set of tokens. /// @param tokens The token contract addresses /// @param ticks The ticks, representing the price of each token pair in `tokens` /// @return syntheticTick The synthetic tick, representing the relative price of the outermost tokens in `tokens` function getChainedPrice(address[] memory tokens, int24[] memory ticks) internal pure returns (int256 syntheticTick) { require(tokens.length - 1 == ticks.length, 'DL'); for (uint256 i = 1; i <= ticks.length; i++) { // check the tokens for address sort order, then accumulate the // ticks into the running synthetic tick, ensuring that intermediate tokens "cancel out" tokens[i - 1] < tokens[i] ? syntheticTick += ticks[i - 1] : syntheticTick -= ticks[i - 1]; } } } // File: contracts/QBuyBurn.sol pragma solidity ^0.8.24; contract QBuyBurn { uint256 public i_initialTimestamp; uint256 constant i_periodDuration = 1 days; uint256 public firstCycleReceivedEther; uint256 public globalCountForDays; uint256 public collectedAmount; address immutable Q; address immutable Q_WETH9_Pool; address constant UNISWAP_V3_FACTORY = 0x1F98431c8aD98523631AE4a59f267346ea31F984; address constant WETH9 = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2; address constant BURN_ADDRESS = 0x000000000000000000000000000000000000dEaD; address constant SWAP_ROUTER = 0xE592427A0AEce92De3Edee1F18E0157C05861564; mapping(uint256 => bool) public feeAlreadyDistributed; uint24 constant poolFee = 10000; receive() external payable { if(block.timestamp < i_initialTimestamp + 1 days) { firstCycleReceivedEther += msg.value; } else { collectedAmount += msg.value; } } constructor(address _qAddress) { i_initialTimestamp = block.timestamp; Q_WETH9_Pool = computePoolAddress(WETH9, _qAddress, poolFee); Q = _qAddress; } function burnToken(uint256 amountToBurn, uint256 deadline) public { require(msg.sender == tx.origin, "Use EOA!"); require(isContract(Q_WETH9_Pool), "Pool does not exist!"); require(block.timestamp > i_initialTimestamp + 1 days, "Early burn!"); require(amountToBurn >= 0.1 ether, "Min 0.1 ETH"); uint256 theFiftiethPart = (firstCycleReceivedEther / 50); uint256 amountToCompare = collectedAmount; uint256 currentCycle = getCurrentCycle(); uint256 amountETH; uint256 callerPercent; if(globalCountForDays < 50 && !feeAlreadyDistributed[currentCycle]) { amountToCompare = collectedAmount + theFiftiethPart; require(amountToCompare >= amountToBurn, "Insufficient funds!"); if(collectedAmount >= amountToBurn) { collectedAmount -= amountToBurn; amountToBurn += theFiftiethPart; } else { if(amountToBurn > theFiftiethPart) { if(collectedAmount >= amountToBurn - theFiftiethPart) { collectedAmount -= amountToBurn - theFiftiethPart; } } else { amountToBurn = theFiftiethPart; } } globalCountForDays ++; feeAlreadyDistributed[currentCycle] = true; } else { require(amountToCompare >= amountToBurn, "Insufficient funds!"); collectedAmount -= amountToBurn; } callerPercent = amountToBurn / 100; amountETH = amountToBurn - callerPercent; uint256 amountOutExpected = _getQuote(uint128(amountETH)); uint256 minTokenAmount = (amountOutExpected * 90) / 100; require(minTokenAmount > 0, "Min > 0"); _swap(minTokenAmount, amountETH, deadline); (bool success,) = payable(msg.sender).call{value: callerPercent}(""); require(success, "Transfer failed."); } function _swap(uint256 amountOutMinimum, uint256 amountIn, uint256 deadline) private { ISwapRouterMinimal.ExactInputSingleParams memory params = ISwapRouterMinimal.ExactInputSingleParams({ tokenIn: WETH9, tokenOut: Q, fee: poolFee, recipient: BURN_ADDRESS, deadline: deadline, amountIn: amountIn, amountOutMinimum: amountOutMinimum, sqrtPriceLimitX96: 0 }); ISwapRouterMinimal(SWAP_ROUTER).exactInputSingle{value: amountIn}(params); } function _getQuote(uint128 amountIn) public view returns(uint256 amountOut) { (int24 tick, ) = OracleLibrary.consult(Q_WETH9_Pool, 1); amountOut = OracleLibrary.getQuoteAtTick(tick, amountIn, WETH9, Q); } function isContract(address _addr) private view returns (bool) { uint32 size; assembly { size := extcodesize(_addr) } return (size > 0); } function computePoolAddress(address tokenA, address tokenB, uint24 fee) public pure returns (address pool) { (address token0, address token1) = tokenA < tokenB ? (tokenA, tokenB) : (tokenB, tokenA); PoolAddress.PoolKey memory key = PoolAddress.PoolKey({token0: token0, token1: token1, fee: fee}); pool = PoolAddress.computeAddress(UNISWAP_V3_FACTORY, key); return pool; } function getCurrentCycle() public view returns (uint256) { return (block.timestamp - i_initialTimestamp) / i_periodDuration; } } // File: @openzeppelin/contracts/utils/Counters.sol // OpenZeppelin Contracts v4.4.1 (utils/Counters.sol) pragma solidity ^0.8.0; /** * @title Counters * @author Matt Condon (@shrugs) * @dev Provides counters that can only be incremented, decremented or reset. This can be used e.g. to track the number * of elements in a mapping, issuing ERC721 ids, or counting request ids. * * Include with `using Counters for Counters.Counter;` */ library Counters { struct Counter { // This variable should never be directly accessed by users of the library: interactions must be restricted to // the library's function. As of Solidity v0.5.2, this cannot be enforced, though there is a proposal to add // this feature: see https://github.com/ethereum/solidity/issues/4637 uint256 _value; // default: 0 } function current(Counter storage counter) internal view returns (uint256) { return counter._value; } function increment(Counter storage counter) internal { unchecked { counter._value += 1; } } function decrement(Counter storage counter) internal { uint256 value = counter._value; require(value > 0, "Counter: decrement overflow"); unchecked { counter._value = value - 1; } } function reset(Counter storage counter) internal { counter._value = 0; } } // File: @openzeppelin/contracts/interfaces/IERC5267.sol // OpenZeppelin Contracts (last updated v4.9.0) (interfaces/IERC5267.sol) pragma solidity ^0.8.0; interface IERC5267 { /** * @dev MAY be emitted to signal that the domain could have changed. */ event EIP712DomainChanged(); /** * @dev returns the fields and values that describe the domain separator used by this contract for EIP-712 * signature. */ function eip712Domain() external view returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ); } // File: @openzeppelin/contracts/utils/StorageSlot.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/StorageSlot.sol) // This file was procedurally generated from scripts/generate/templates/StorageSlot.js. pragma solidity ^0.8.0; /** * @dev Library for reading and writing primitive types to specific storage slots. * * Storage slots are often used to avoid storage conflict when dealing with upgradeable contracts. * This library helps with reading and writing to such slots without the need for inline assembly. * * The functions in this library return Slot structs that contain a `value` member that can be used to read or write. * * Example usage to set ERC1967 implementation slot: * ```solidity * contract ERC1967 { * bytes32 internal constant _IMPLEMENTATION_SLOT = 0x360894a13ba1a3210667c828492db98dca3e2076cc3735a920a3ca505d382bbc; * * function _getImplementation() internal view returns (address) { * return StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value; * } * * function _setImplementation(address newImplementation) internal { * require(Address.isContract(newImplementation), "ERC1967: new implementation is not a contract"); * StorageSlot.getAddressSlot(_IMPLEMENTATION_SLOT).value = newImplementation; * } * } * ``` * * _Available since v4.1 for `address`, `bool`, `bytes32`, `uint256`._ * _Available since v4.9 for `string`, `bytes`._ */ library StorageSlot { struct AddressSlot { address value; } struct BooleanSlot { bool value; } struct Bytes32Slot { bytes32 value; } struct Uint256Slot { uint256 value; } struct StringSlot { string value; } struct BytesSlot { bytes value; } /** * @dev Returns an `AddressSlot` with member `value` located at `slot`. */ function getAddressSlot(bytes32 slot) internal pure returns (AddressSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BooleanSlot` with member `value` located at `slot`. */ function getBooleanSlot(bytes32 slot) internal pure returns (BooleanSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Bytes32Slot` with member `value` located at `slot`. */ function getBytes32Slot(bytes32 slot) internal pure returns (Bytes32Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `Uint256Slot` with member `value` located at `slot`. */ function getUint256Slot(bytes32 slot) internal pure returns (Uint256Slot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` with member `value` located at `slot`. */ function getStringSlot(bytes32 slot) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `StringSlot` representation of the string storage pointer `store`. */ function getStringSlot(string storage store) internal pure returns (StringSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } /** * @dev Returns an `BytesSlot` with member `value` located at `slot`. */ function getBytesSlot(bytes32 slot) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := slot } } /** * @dev Returns an `BytesSlot` representation of the bytes storage pointer `store`. */ function getBytesSlot(bytes storage store) internal pure returns (BytesSlot storage r) { /// @solidity memory-safe-assembly assembly { r.slot := store.slot } } } // File: @openzeppelin/contracts/utils/ShortStrings.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/ShortStrings.sol) pragma solidity ^0.8.8; // | string | 0xAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA | // | length | 0x BB | type ShortString is bytes32; /** * @dev This library provides functions to convert short memory strings * into a `ShortString` type that can be used as an immutable variable. * * Strings of arbitrary length can be optimized using this library if * they are short enough (up to 31 bytes) by packing them with their * length (1 byte) in a single EVM word (32 bytes). Additionally, a * fallback mechanism can be used for every other case. * * Usage example: * * ```solidity * contract Named { * using ShortStrings for *; * * ShortString private immutable _name; * string private _nameFallback; * * constructor(string memory contractName) { * _name = contractName.toShortStringWithFallback(_nameFallback); * } * * function name() external view returns (string memory) { * return _name.toStringWithFallback(_nameFallback); * } * } * ``` */ library ShortStrings { // Used as an identifier for strings longer than 31 bytes. bytes32 private constant _FALLBACK_SENTINEL = 0x00000000000000000000000000000000000000000000000000000000000000FF; error StringTooLong(string str); error InvalidShortString(); /** * @dev Encode a string of at most 31 chars into a `ShortString`. * * This will trigger a `StringTooLong` error is the input string is too long. */ function toShortString(string memory str) internal pure returns (ShortString) { bytes memory bstr = bytes(str); if (bstr.length > 31) { revert StringTooLong(str); } return ShortString.wrap(bytes32(uint256(bytes32(bstr)) | bstr.length)); } /** * @dev Decode a `ShortString` back to a "normal" string. */ function toString(ShortString sstr) internal pure returns (string memory) { uint256 len = byteLength(sstr); // using `new string(len)` would work locally but is not memory safe. string memory str = new string(32); /// @solidity memory-safe-assembly assembly { mstore(str, len) mstore(add(str, 0x20), sstr) } return str; } /** * @dev Return the length of a `ShortString`. */ function byteLength(ShortString sstr) internal pure returns (uint256) { uint256 result = uint256(ShortString.unwrap(sstr)) & 0xFF; if (result > 31) { revert InvalidShortString(); } return result; } /** * @dev Encode a string into a `ShortString`, or write it to storage if it is too long. */ function toShortStringWithFallback(string memory value, string storage store) internal returns (ShortString) { if (bytes(value).length < 32) { return toShortString(value); } else { StorageSlot.getStringSlot(store).value = value; return ShortString.wrap(_FALLBACK_SENTINEL); } } /** * @dev Decode a string that was encoded to `ShortString` or written to storage using {setWithFallback}. */ function toStringWithFallback(ShortString value, string storage store) internal pure returns (string memory) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return toString(value); } else { return store; } } /** * @dev Return the length of a string that was encoded to `ShortString` or written to storage using {setWithFallback}. * * WARNING: This will return the "byte length" of the string. This may not reflect the actual length in terms of * actual characters as the UTF-8 encoding of a single character can span over multiple bytes. */ function byteLengthWithFallback(ShortString value, string storage store) internal view returns (uint256) { if (ShortString.unwrap(value) != _FALLBACK_SENTINEL) { return byteLength(value); } else { return bytes(store).length; } } } // File: @openzeppelin/contracts/utils/math/SignedMath.sol // OpenZeppelin Contracts (last updated v4.8.0) (utils/math/SignedMath.sol) pragma solidity ^0.8.0; /** * @dev Standard signed math utilities missing in the Solidity language. */ library SignedMath { /** * @dev Returns the largest of two signed numbers. */ function max(int256 a, int256 b) internal pure returns (int256) { return a > b ? a : b; } /** * @dev Returns the smallest of two signed numbers. */ function min(int256 a, int256 b) internal pure returns (int256) { return a < b ? a : b; } /** * @dev Returns the average of two signed numbers without overflow. * The result is rounded towards zero. */ function average(int256 a, int256 b) internal pure returns (int256) { // Formula from the book "Hacker's Delight" int256 x = (a & b) + ((a ^ b) >> 1); return x + (int256(uint256(x) >> 255) & (a ^ b)); } /** * @dev Returns the absolute unsigned value of a signed value. */ function abs(int256 n) internal pure returns (uint256) { unchecked { // must be unchecked in order to support `n = type(int256).min` return uint256(n >= 0 ? n : -n); } } } // File: @openzeppelin/contracts/utils/math/Math.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/math/Math.sol) pragma solidity ^0.8.0; /** * @dev Standard math utilities missing in the Solidity language. */ library Math { enum Rounding { Down, // Toward negative infinity Up, // Toward infinity Zero // Toward zero } /** * @dev Returns the largest of two numbers. */ function max(uint256 a, uint256 b) internal pure returns (uint256) { return a > b ? a : b; } /** * @dev Returns the smallest of two numbers. */ function min(uint256 a, uint256 b) internal pure returns (uint256) { return a < b ? a : b; } /** * @dev Returns the average of two numbers. The result is rounded towards * zero. */ function average(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b) / 2 can overflow. return (a & b) + (a ^ b) / 2; } /** * @dev Returns the ceiling of the division of two numbers. * * This differs from standard division with `/` in that it rounds up instead * of rounding down. */ function ceilDiv(uint256 a, uint256 b) internal pure returns (uint256) { // (a + b - 1) / b can overflow on addition, so we distribute. return a == 0 ? 0 : (a - 1) / b + 1; } /** * @notice Calculates floor(x * y / denominator) with full precision. Throws if result overflows a uint256 or denominator == 0 * @dev Original credit to Remco Bloemen under MIT license (https://xn--2-umb.com/21/muldiv) * with further edits by Uniswap Labs also under MIT license. */ function mulDiv(uint256 x, uint256 y, uint256 denominator) internal pure returns (uint256 result) { unchecked { // 512-bit multiply [prod1 prod0] = x * y. Compute the product mod 2^256 and mod 2^256 - 1, then use // use the Chinese Remainder Theorem to reconstruct the 512 bit result. The result is stored in two 256 // variables such that product = prod1 * 2^256 + prod0. uint256 prod0; // Least significant 256 bits of the product uint256 prod1; // Most significant 256 bits of the product assembly { let mm := mulmod(x, y, not(0)) prod0 := mul(x, y) prod1 := sub(sub(mm, prod0), lt(mm, prod0)) } // Handle non-overflow cases, 256 by 256 division. if (prod1 == 0) { // Solidity will revert if denominator == 0, unlike the div opcode on its own. // The surrounding unchecked block does not change this fact. // See https://docs.soliditylang.org/en/latest/control-structures.html#checked-or-unchecked-arithmetic. return prod0 / denominator; } // Make sure the result is less than 2^256. Also prevents denominator == 0. require(denominator > prod1, "Math: mulDiv overflow"); /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Make division exact by subtracting the remainder from [prod1 prod0]. uint256 remainder; assembly { // Compute remainder using mulmod. remainder := mulmod(x, y, denominator) // Subtract 256 bit number from 512 bit number. prod1 := sub(prod1, gt(remainder, prod0)) prod0 := sub(prod0, remainder) } // Factor powers of two out of denominator and compute largest power of two divisor of denominator. Always >= 1. // See https://cs.stackexchange.com/q/138556/92363. // Does not overflow because the denominator cannot be zero at this stage in the function. uint256 twos = denominator & (~denominator + 1); assembly { // Divide denominator by twos. denominator := div(denominator, twos) // Divide [prod1 prod0] by twos. prod0 := div(prod0, twos) // Flip twos such that it is 2^256 / twos. If twos is zero, then it becomes one. twos := add(div(sub(0, twos), twos), 1) } // Shift in bits from prod1 into prod0. prod0 |= prod1 * twos; // Invert denominator mod 2^256. Now that denominator is an odd number, it has an inverse modulo 2^256 such // that denominator * inv = 1 mod 2^256. Compute the inverse by starting with a seed that is correct for // four bits. That is, denominator * inv = 1 mod 2^4. uint256 inverse = (3 * denominator) ^ 2; // Use the Newton-Raphson iteration to improve the precision. Thanks to Hensel's lifting lemma, this also works // in modular arithmetic, doubling the correct bits in each step. inverse *= 2 - denominator * inverse; // inverse mod 2^8 inverse *= 2 - denominator * inverse; // inverse mod 2^16 inverse *= 2 - denominator * inverse; // inverse mod 2^32 inverse *= 2 - denominator * inverse; // inverse mod 2^64 inverse *= 2 - denominator * inverse; // inverse mod 2^128 inverse *= 2 - denominator * inverse; // inverse mod 2^256 // Because the division is now exact we can divide by multiplying with the modular inverse of denominator. // This will give us the correct result modulo 2^256. Since the preconditions guarantee that the outcome is // less than 2^256, this is the final result. We don't need to compute the high bits of the result and prod1 // is no longer required. result = prod0 * inverse; return result; } } /** * @notice Calculates x * y / denominator with full precision, following the selected rounding direction. */ function mulDiv(uint256 x, uint256 y, uint256 denominator, Rounding rounding) internal pure returns (uint256) { uint256 result = mulDiv(x, y, denominator); if (rounding == Rounding.Up && mulmod(x, y, denominator) > 0) { result += 1; } return result; } /** * @dev Returns the square root of a number. If the number is not a perfect square, the value is rounded down. * * Inspired by Henry S. Warren, Jr.'s "Hacker's Delight" (Chapter 11). */ function sqrt(uint256 a) internal pure returns (uint256) { if (a == 0) { return 0; } // For our first guess, we get the biggest power of 2 which is smaller than the square root of the target. // // We know that the "msb" (most significant bit) of our target number `a` is a power of 2 such that we have // `msb(a) <= a < 2*msb(a)`. This value can be written `msb(a)=2**k` with `k=log2(a)`. // // This can be rewritten `2**log2(a) <= a < 2**(log2(a) + 1)` // → `sqrt(2**k) <= sqrt(a) < sqrt(2**(k+1))` // → `2**(k/2) <= sqrt(a) < 2**((k+1)/2) <= 2**(k/2 + 1)` // // Consequently, `2**(log2(a) / 2)` is a good first approximation of `sqrt(a)` with at least 1 correct bit. uint256 result = 1 << (log2(a) >> 1); // At this point `result` is an estimation with one bit of precision. We know the true value is a uint128, // since it is the square root of a uint256. Newton's method converges quadratically (precision doubles at // every iteration). We thus need at most 7 iteration to turn our partial result with one bit of precision // into the expected uint128 result. unchecked { result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; result = (result + a / result) >> 1; return min(result, a / result); } } /** * @notice Calculates sqrt(a), following the selected rounding direction. */ function sqrt(uint256 a, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = sqrt(a); return result + (rounding == Rounding.Up && result * result < a ? 1 : 0); } } /** * @dev Return the log in base 2, rounded down, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 128; } if (value >> 64 > 0) { value >>= 64; result += 64; } if (value >> 32 > 0) { value >>= 32; result += 32; } if (value >> 16 > 0) { value >>= 16; result += 16; } if (value >> 8 > 0) { value >>= 8; result += 8; } if (value >> 4 > 0) { value >>= 4; result += 4; } if (value >> 2 > 0) { value >>= 2; result += 2; } if (value >> 1 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 2, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log2(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log2(value); return result + (rounding == Rounding.Up && 1 << result < value ? 1 : 0); } } /** * @dev Return the log in base 10, rounded down, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >= 10 ** 64) { value /= 10 ** 64; result += 64; } if (value >= 10 ** 32) { value /= 10 ** 32; result += 32; } if (value >= 10 ** 16) { value /= 10 ** 16; result += 16; } if (value >= 10 ** 8) { value /= 10 ** 8; result += 8; } if (value >= 10 ** 4) { value /= 10 ** 4; result += 4; } if (value >= 10 ** 2) { value /= 10 ** 2; result += 2; } if (value >= 10 ** 1) { result += 1; } } return result; } /** * @dev Return the log in base 10, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log10(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log10(value); return result + (rounding == Rounding.Up && 10 ** result < value ? 1 : 0); } } /** * @dev Return the log in base 256, rounded down, of a positive value. * Returns 0 if given 0. * * Adding one to the result gives the number of pairs of hex symbols needed to represent `value` as a hex string. */ function log256(uint256 value) internal pure returns (uint256) { uint256 result = 0; unchecked { if (value >> 128 > 0) { value >>= 128; result += 16; } if (value >> 64 > 0) { value >>= 64; result += 8; } if (value >> 32 > 0) { value >>= 32; result += 4; } if (value >> 16 > 0) { value >>= 16; result += 2; } if (value >> 8 > 0) { result += 1; } } return result; } /** * @dev Return the log in base 256, following the selected rounding direction, of a positive value. * Returns 0 if given 0. */ function log256(uint256 value, Rounding rounding) internal pure returns (uint256) { unchecked { uint256 result = log256(value); return result + (rounding == Rounding.Up && 1 << (result << 3) < value ? 1 : 0); } } } // File: @openzeppelin/contracts/utils/Strings.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/Strings.sol) pragma solidity ^0.8.0; /** * @dev String operations. */ library Strings { bytes16 private constant _SYMBOLS = "0123456789abcdef"; uint8 private constant _ADDRESS_LENGTH = 20; /** * @dev Converts a `uint256` to its ASCII `string` decimal representation. */ function toString(uint256 value) internal pure returns (string memory) { unchecked { uint256 length = Math.log10(value) + 1; string memory buffer = new string(length); uint256 ptr; /// @solidity memory-safe-assembly assembly { ptr := add(buffer, add(32, length)) } while (true) { ptr--; /// @solidity memory-safe-assembly assembly { mstore8(ptr, byte(mod(value, 10), _SYMBOLS)) } value /= 10; if (value == 0) break; } return buffer; } } /** * @dev Converts a `int256` to its ASCII `string` decimal representation. */ function toString(int256 value) internal pure returns (string memory) { return string(abi.encodePacked(value < 0 ? "-" : "", toString(SignedMath.abs(value)))); } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation. */ function toHexString(uint256 value) internal pure returns (string memory) { unchecked { return toHexString(value, Math.log256(value) + 1); } } /** * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length. */ function toHexString(uint256 value, uint256 length) internal pure returns (string memory) { bytes memory buffer = new bytes(2 * length + 2); buffer[0] = "0"; buffer[1] = "x"; for (uint256 i = 2 * length + 1; i > 1; --i) { buffer[i] = _SYMBOLS[value & 0xf]; value >>= 4; } require(value == 0, "Strings: hex length insufficient"); return string(buffer); } /** * @dev Converts an `address` with fixed length of 20 bytes to its not checksummed ASCII `string` hexadecimal representation. */ function toHexString(address addr) internal pure returns (string memory) { return toHexString(uint256(uint160(addr)), _ADDRESS_LENGTH); } /** * @dev Returns true if the two strings are equal. */ function equal(string memory a, string memory b) internal pure returns (bool) { return keccak256(bytes(a)) == keccak256(bytes(b)); } } // File: @openzeppelin/contracts/utils/cryptography/ECDSA.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/ECDSA.sol) pragma solidity ^0.8.0; /** * @dev Elliptic Curve Digital Signature Algorithm (ECDSA) operations. * * These functions can be used to verify that a message was signed by the holder * of the private keys of a given address. */ library ECDSA { enum RecoverError { NoError, InvalidSignature, InvalidSignatureLength, InvalidSignatureS, InvalidSignatureV // Deprecated in v4.8 } function _throwError(RecoverError error) private pure { if (error == RecoverError.NoError) { return; // no error: do nothing } else if (error == RecoverError.InvalidSignature) { revert("ECDSA: invalid signature"); } else if (error == RecoverError.InvalidSignatureLength) { revert("ECDSA: invalid signature length"); } else if (error == RecoverError.InvalidSignatureS) { revert("ECDSA: invalid signature 's' value"); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature` or error string. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. * * Documentation for signature generation: * - with https://web3js.readthedocs.io/en/v1.3.4/web3-eth-accounts.html#sign[Web3.js] * - with https://docs.ethers.io/v5/api/signer/#Signer-signMessage[ethers] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes memory signature) internal pure returns (address, RecoverError) { if (signature.length == 65) { bytes32 r; bytes32 s; uint8 v; // ecrecover takes the signature parameters, and the only way to get them // currently is to use assembly. /// @solidity memory-safe-assembly assembly { r := mload(add(signature, 0x20)) s := mload(add(signature, 0x40)) v := byte(0, mload(add(signature, 0x60))) } return tryRecover(hash, v, r, s); } else { return (address(0), RecoverError.InvalidSignatureLength); } } /** * @dev Returns the address that signed a hashed message (`hash`) with * `signature`. This address can then be used for verification purposes. * * The `ecrecover` EVM opcode allows for malleable (non-unique) signatures: * this function rejects them by requiring the `s` value to be in the lower * half order, and the `v` value to be either 27 or 28. * * IMPORTANT: `hash` _must_ be the result of a hash operation for the * verification to be secure: it is possible to craft signatures that * recover to arbitrary addresses for non-hashed data. A safe way to ensure * this is by receiving a hash of the original message (which may otherwise * be too long), and then calling {toEthSignedMessageHash} on it. */ function recover(bytes32 hash, bytes memory signature) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, signature); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `r` and `vs` short-signature fields separately. * * See https://eips.ethereum.org/EIPS/eip-2098[EIP-2098 short signatures] * * _Available since v4.3._ */ function tryRecover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address, RecoverError) { bytes32 s = vs & bytes32(0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff); uint8 v = uint8((uint256(vs) >> 255) + 27); return tryRecover(hash, v, r, s); } /** * @dev Overload of {ECDSA-recover} that receives the `r and `vs` short-signature fields separately. * * _Available since v4.2._ */ function recover(bytes32 hash, bytes32 r, bytes32 vs) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, r, vs); _throwError(error); return recovered; } /** * @dev Overload of {ECDSA-tryRecover} that receives the `v`, * `r` and `s` signature fields separately. * * _Available since v4.3._ */ function tryRecover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address, RecoverError) { // EIP-2 still allows signature malleability for ecrecover(). Remove this possibility and make the signature // unique. Appendix F in the Ethereum Yellow paper (https://ethereum.github.io/yellowpaper/paper.pdf), defines // the valid range for s in (301): 0 < s < secp256k1n ÷ 2 + 1, and for v in (302): v ∈ {27, 28}. Most // signatures from current libraries generate a unique signature with an s-value in the lower half order. // // If your library generates malleable signatures, such as s-values in the upper range, calculate a new s-value // with 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141 - s1 and flip v from 27 to 28 or // vice versa. If your library also generates signatures with 0/1 for v instead 27/28, add 27 to v to accept // these malleable signatures as well. if (uint256(s) > 0x7FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF5D576E7357A4501DDFE92F46681B20A0) { return (address(0), RecoverError.InvalidSignatureS); } // If the signature is valid (and not malleable), return the signer address address signer = ecrecover(hash, v, r, s); if (signer == address(0)) { return (address(0), RecoverError.InvalidSignature); } return (signer, RecoverError.NoError); } /** * @dev Overload of {ECDSA-recover} that receives the `v`, * `r` and `s` signature fields separately. */ function recover(bytes32 hash, uint8 v, bytes32 r, bytes32 s) internal pure returns (address) { (address recovered, RecoverError error) = tryRecover(hash, v, r, s); _throwError(error); return recovered; } /** * @dev Returns an Ethereum Signed Message, created from a `hash`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes32 hash) internal pure returns (bytes32 message) { // 32 is the length in bytes of hash, // enforced by the type signature above /// @solidity memory-safe-assembly assembly { mstore(0x00, "\x19Ethereum Signed Message:\n32") mstore(0x1c, hash) message := keccak256(0x00, 0x3c) } } /** * @dev Returns an Ethereum Signed Message, created from `s`. This * produces hash corresponding to the one signed with the * https://eth.wiki/json-rpc/API#eth_sign[`eth_sign`] * JSON-RPC method as part of EIP-191. * * See {recover}. */ function toEthSignedMessageHash(bytes memory s) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19Ethereum Signed Message:\n", Strings.toString(s.length), s)); } /** * @dev Returns an Ethereum Signed Typed Data, created from a * `domainSeparator` and a `structHash`. This produces hash corresponding * to the one signed with the * https://eips.ethereum.org/EIPS/eip-712[`eth_signTypedData`] * JSON-RPC method as part of EIP-712. * * See {recover}. */ function toTypedDataHash(bytes32 domainSeparator, bytes32 structHash) internal pure returns (bytes32 data) { /// @solidity memory-safe-assembly assembly { let ptr := mload(0x40) mstore(ptr, "\x19\x01") mstore(add(ptr, 0x02), domainSeparator) mstore(add(ptr, 0x22), structHash) data := keccak256(ptr, 0x42) } } /** * @dev Returns an Ethereum Signed Data with intended validator, created from a * `validator` and `data` according to the version 0 of EIP-191. * * See {recover}. */ function toDataWithIntendedValidatorHash(address validator, bytes memory data) internal pure returns (bytes32) { return keccak256(abi.encodePacked("\x19\x00", validator, data)); } } // File: @openzeppelin/contracts/utils/cryptography/EIP712.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/cryptography/EIP712.sol) pragma solidity ^0.8.8; /** * @dev https://eips.ethereum.org/EIPS/eip-712[EIP 712] is a standard for hashing and signing of typed structured data. * * The encoding specified in the EIP is very generic, and such a generic implementation in Solidity is not feasible, * thus this contract does not implement the encoding itself. Protocols need to implement the type-specific encoding * they need in their contracts using a combination of `abi.encode` and `keccak256`. * * This contract implements the EIP 712 domain separator ({_domainSeparatorV4}) that is used as part of the encoding * scheme, and the final step of the encoding to obtain the message digest that is then signed via ECDSA * ({_hashTypedDataV4}). * * The implementation of the domain separator was designed to be as efficient as possible while still properly updating * the chain id to protect against replay attacks on an eventual fork of the chain. * * NOTE: This contract implements the version of the encoding known as "v4", as implemented by the JSON RPC method * https://docs.metamask.io/guide/signing-data.html[`eth_signTypedDataV4` in MetaMask]. * * NOTE: In the upgradeable version of this contract, the cached values will correspond to the address, and the domain * separator of the implementation contract. This will cause the `_domainSeparatorV4` function to always rebuild the * separator from the immutable values, which is cheaper than accessing a cached version in cold storage. * * _Available since v3.4._ * * @custom:oz-upgrades-unsafe-allow state-variable-immutable state-variable-assignment */ abstract contract EIP712 is IERC5267 { using ShortStrings for *; bytes32 private constant _TYPE_HASH = keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); // Cache the domain separator as an immutable value, but also store the chain id that it corresponds to, in order to // invalidate the cached domain separator if the chain id changes. bytes32 private immutable _cachedDomainSeparator; uint256 private immutable _cachedChainId; address private immutable _cachedThis; bytes32 private immutable _hashedName; bytes32 private immutable _hashedVersion; ShortString private immutable _name; ShortString private immutable _version; string private _nameFallback; string private _versionFallback; /** * @dev Initializes the domain separator and parameter caches. * * The meaning of `name` and `version` is specified in * https://eips.ethereum.org/EIPS/eip-712#definition-of-domainseparator[EIP 712]: * * - `name`: the user readable name of the signing domain, i.e. the name of the DApp or the protocol. * - `version`: the current major version of the signing domain. * * NOTE: These parameters cannot be changed except through a xref:learn::upgrading-smart-contracts.adoc[smart * contract upgrade]. */ constructor(string memory name, string memory version) { _name = name.toShortStringWithFallback(_nameFallback); _version = version.toShortStringWithFallback(_versionFallback); _hashedName = keccak256(bytes(name)); _hashedVersion = keccak256(bytes(version)); _cachedChainId = block.chainid; _cachedDomainSeparator = _buildDomainSeparator(); _cachedThis = address(this); } /** * @dev Returns the domain separator for the current chain. */ function _domainSeparatorV4() internal view returns (bytes32) { if (address(this) == _cachedThis && block.chainid == _cachedChainId) { return _cachedDomainSeparator; } else { return _buildDomainSeparator(); } } function _buildDomainSeparator() private view returns (bytes32) { return keccak256(abi.encode(_TYPE_HASH, _hashedName, _hashedVersion, block.chainid, address(this))); } /** * @dev Given an already https://eips.ethereum.org/EIPS/eip-712#definition-of-hashstruct[hashed struct], this * function returns the hash of the fully encoded EIP712 message for this domain. * * This hash can be used together with {ECDSA-recover} to obtain the signer of a message. For example: * * ```solidity * bytes32 digest = _hashTypedDataV4(keccak256(abi.encode( * keccak256("Mail(address to,string contents)"), * mailTo, * keccak256(bytes(mailContents)) * ))); * address signer = ECDSA.recover(digest, signature); * ``` */ function _hashTypedDataV4(bytes32 structHash) internal view virtual returns (bytes32) { return ECDSA.toTypedDataHash(_domainSeparatorV4(), structHash); } /** * @dev See {EIP-5267}. * * _Available since v4.9._ */ function eip712Domain() public view virtual override returns ( bytes1 fields, string memory name, string memory version, uint256 chainId, address verifyingContract, bytes32 salt, uint256[] memory extensions ) { return ( hex"0f", // 01111 _name.toStringWithFallback(_nameFallback), _version.toStringWithFallback(_versionFallback), block.chainid, address(this), bytes32(0), new uint256[](0) ); } } // File: @openzeppelin/contracts/utils/Address.sol // OpenZeppelin Contracts (last updated v4.9.0) (utils/Address.sol) pragma solidity ^0.8.1; /** * @dev Collection of functions related to the address type */ library Address { /** * @dev Returns true if `account` is a contract. * * [IMPORTANT] * ==== * It is unsafe to assume that an address for which this function returns * false is an externally-owned account (EOA) and not a contract. * * Among others, `isContract` will return false for the following * types of addresses: * * - an externally-owned account * - a contract in construction * - an address where a contract will be created * - an address where a contract lived, but was destroyed * * Furthermore, `isContract` will also return true if the target contract within * the same transaction is already scheduled for destruction by `SELFDESTRUCT`, * which only has an effect at the end of a transaction. * ==== * * [IMPORTANT] * ==== * You shouldn't rely on `isContract` to protect against flash loan attacks! * * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract * constructor. * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize/address.code.length, which returns 0 // for contracts in construction, since the code is only stored at the end // of the constructor execution. return account.code.length > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.8.0/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) { return functionDelegateCall(target, data, "Address: low-level delegate call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a delegate call. * * _Available since v3.4._ */ function functionDelegateCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResultFromTarget(target, success, returndata, errorMessage); } /** * @dev Tool to verify that a low level call to smart-contract was successful, and revert (either by bubbling * the revert reason or using the provided one) in case of unsuccessful call or if target was not a contract. * * _Available since v4.8._ */ function verifyCallResultFromTarget( address target, bool success, bytes memory returndata, string memory errorMessage ) internal view returns (bytes memory) { if (success) { if (returndata.length == 0) { // only check isContract if the call was successful and the return data is empty // otherwise we already know that it was a contract require(isContract(target), "Address: call to non-contract"); } return returndata; } else { _revert(returndata, errorMessage); } } /** * @dev Tool to verify that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason or using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { _revert(returndata, errorMessage); } } function _revert(bytes memory returndata, string memory errorMessage) private pure { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly /// @solidity memory-safe-assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Permit.sol // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/IERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612]. * * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't * need to send a transaction, and thus is not required to hold Ether at all. * * ==== Security Considerations * * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be * considered as an intention to spend the allowance in any specific way. The second is that because permits have * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be * generally recommended is: * * ```solidity * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public { * try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {} * doThing(..., value); * } * * function doThing(..., uint256 value) public { * token.safeTransferFrom(msg.sender, address(this), value); * ... * } * ``` * * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also * {SafeERC20-safeTransferFrom}). * * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so * contracts should have entry points that don't rely on permit. */ interface IERC20Permit { /** * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens, * given ``owner``'s signed approval. * * IMPORTANT: The same issues {IERC20-approve} has related to transaction * ordering also apply here. * * Emits an {Approval} event. * * Requirements: * * - `spender` cannot be the zero address. * - `deadline` must be a timestamp in the future. * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner` * over the EIP712-formatted function arguments. * - the signature must use ``owner``'s current nonce (see {nonces}). * * For more information on the signature format, see the * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP * section]. * * CAUTION: See Security Considerations above. */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) external; /** * @dev Returns the current nonce for `owner`. This value must be * included whenever a signature is generated for {permit}. * * Every successful call to {permit} increases ``owner``'s nonce by one. This * prevents a signature from being used multiple times. */ function nonces(address owner) external view returns (uint256); /** * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}. */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view returns (bytes32); } // File: @openzeppelin/contracts/token/ERC20/IERC20.sol // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/IERC20.sol) pragma solidity ^0.8.0; /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @dev Emitted when `value` tokens are moved from one account (`from`) to * another (`to`). * * Note that `value` may be zero. */ event Transfer(address indexed from, address indexed to, uint256 value); /** * @dev Emitted when the allowance of a `spender` for an `owner` is set by * a call to {approve}. `value` is the new allowance. */ event Approval(address indexed owner, address indexed spender, uint256 value); /** * @dev Returns the amount of tokens in existence. */ function totalSupply() external view returns (uint256); /** * @dev Returns the amount of tokens owned by `account`. */ function balanceOf(address account) external view returns (uint256); /** * @dev Moves `amount` tokens from the caller's account to `to`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address to, uint256 amount) external returns (bool); /** * @dev Returns the remaining number of tokens that `spender` will be * allowed to spend on behalf of `owner` through {transferFrom}. This is * zero by default. * * This value changes when {approve} or {transferFrom} are called. */ function allowance(address owner, address spender) external view returns (uint256); /** * @dev Sets `amount` as the allowance of `spender` over the caller's tokens. * * Returns a boolean value indicating whether the operation succeeded. * * IMPORTANT: Beware that changing an allowance with this method brings the risk * that someone may use both the old and the new allowance by unfortunate * transaction ordering. One possible solution to mitigate this race * condition is to first reduce the spender's allowance to 0 and set the * desired value afterwards: * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729 * * Emits an {Approval} event. */ function approve(address spender, uint256 amount) external returns (bool); /** * @dev Moves `amount` tokens from `from` to `to` using the * allowance mechanism. `amount` is then deducted from the caller's * allowance. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transferFrom(address from, address to, uint256 amount) external returns (bool); } // File: @openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol // OpenZeppelin Contracts v4.4.1 (token/ERC20/extensions/IERC20Metadata.sol) pragma solidity ^0.8.0; /** * @dev Interface for the optional metadata functions from the ERC20 standard. * * _Available since v4.1._ */ interface IERC20Metadata is IERC20 { /** * @dev Returns the name of the token. */ function name() external view returns (string memory); /** * @dev Returns the symbol of the token. */ function symbol() external view returns (string memory); /** * @dev Returns the decimals places of the token. */ function decimals() external view returns (uint8); } // File: @openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol // OpenZeppelin Contracts (last updated v4.9.3) (token/ERC20/utils/SafeERC20.sol) pragma solidity ^0.8.0; /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; /** * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeTransfer(IERC20 token, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } /** * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful. */ function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transferFrom.selector, from, to, value)); } /** * @dev Deprecated. This function has issues similar to the ones found in * {IERC20-approve}, and its usage is discouraged. * * Whenever possible, use {safeIncreaseAllowance} and * {safeDecreaseAllowance} instead. */ function safeApprove(IERC20 token, address spender, uint256 value) internal { // safeApprove should only be called when setting an initial allowance, // or when resetting it to zero. To increase and decrease it, use // 'safeIncreaseAllowance' and 'safeDecreaseAllowance' require( (value == 0) || (token.allowance(address(this), spender) == 0), "SafeERC20: approve from non-zero to non-zero allowance" ); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, value)); } /** * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal { uint256 oldAllowance = token.allowance(address(this), spender); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance + value)); } /** * @dev Decrease the calling contract's allowance toward `spender` by `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. */ function safeDecreaseAllowance(IERC20 token, address spender, uint256 value) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, oldAllowance - value)); } } /** * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value, * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval * to be set to zero before setting it to a non-zero value, such as USDT. */ function forceApprove(IERC20 token, address spender, uint256 value) internal { bytes memory approvalCall = abi.encodeWithSelector(token.approve.selector, spender, value); if (!_callOptionalReturnBool(token, approvalCall)) { _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, 0)); _callOptionalReturn(token, approvalCall); } } /** * @dev Use a ERC-2612 signature to set the `owner` approval toward `spender` on `token`. * Revert on invalid signature. */ function safePermit( IERC20Permit token, address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) internal { uint256 nonceBefore = token.nonces(owner); token.permit(owner, spender, value, deadline, v, r, s); uint256 nonceAfter = token.nonces(owner); require(nonceAfter == nonceBefore + 1, "SafeERC20: permit did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). */ function _callOptionalReturn(IERC20 token, bytes memory data) private { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that // the target address contains contract code and also asserts for success in the low-level call. bytes memory returndata = address(token).functionCall(data, "SafeERC20: low-level call failed"); require(returndata.length == 0 || abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } /** * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement * on the return value: the return value is optional (but if data is returned, it must not be false). * @param token The token targeted by the call. * @param data The call data (encoded using abi.encode or one of its variants). * * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead. */ function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) { // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false // and not revert is the subcall reverts. (bool success, bytes memory returndata) = address(token).call(data); return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && Address.isContract(address(token)); } } // File: @openzeppelin/contracts/utils/Context.sol // OpenZeppelin Contracts (last updated v4.9.4) (utils/Context.sol) pragma solidity ^0.8.0; /** * @dev Provides information about the current execution context, including the * sender of the transaction and its data. While these are generally available * via msg.sender and msg.data, they should not be accessed in such a direct * manner, since when dealing with meta-transactions the account sending and * paying for execution may not be the actual sender (as far as an application * is concerned). * * This contract is only required for intermediate, library-like contracts. */ abstract contract Context { function _msgSender() internal view virtual returns (address) { return msg.sender; } function _msgData() internal view virtual returns (bytes calldata) { return msg.data; } function _contextSuffixLength() internal view virtual returns (uint256) { return 0; } } // File: @openzeppelin/contracts/token/ERC20/ERC20.sol // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/ERC20.sol) pragma solidity ^0.8.0; /** * @dev Implementation of the {IERC20} interface. * * This implementation is agnostic to the way tokens are created. This means * that a supply mechanism has to be added in a derived contract using {_mint}. * For a generic mechanism see {ERC20PresetMinterPauser}. * * TIP: For a detailed writeup see our guide * https://forum.openzeppelin.com/t/how-to-implement-erc20-supply-mechanisms/226[How * to implement supply mechanisms]. * * The default value of {decimals} is 18. To change this, you should override * this function so it returns a different value. * * We have followed general OpenZeppelin Contracts guidelines: functions revert * instead returning `false` on failure. This behavior is nonetheless * conventional and does not conflict with the expectations of ERC20 * applications. * * Additionally, an {Approval} event is emitted on calls to {transferFrom}. * This allows applications to reconstruct the allowance for all accounts just * by listening to said events. Other implementations of the EIP may not emit * these events, as it isn't required by the specification. * * Finally, the non-standard {decreaseAllowance} and {increaseAllowance} * functions have been added to mitigate the well-known issues around setting * allowances. See {IERC20-approve}. */ contract ERC20 is Context, IERC20, IERC20Metadata { mapping(address => uint256) private _balances; mapping(address => mapping(address => uint256)) private _allowances; uint256 private _totalSupply; string private _name; string private _symbol; /** * @dev Sets the values for {name} and {symbol}. * * All two of these values are immutable: they can only be set once during * construction. */ constructor(string memory name_, string memory symbol_) { _name = name_; _symbol = symbol_; } /** * @dev Returns the name of the token. */ function name() public view virtual override returns (string memory) { return _name; } /** * @dev Returns the symbol of the token, usually a shorter version of the * name. */ function symbol() public view virtual override returns (string memory) { return _symbol; } /** * @dev Returns the number of decimals used to get its user representation. * For example, if `decimals` equals `2`, a balance of `505` tokens should * be displayed to a user as `5.05` (`505 / 10 ** 2`). * * Tokens usually opt for a value of 18, imitating the relationship between * Ether and Wei. This is the default value returned by this function, unless * it's overridden. * * NOTE: This information is only used for _display_ purposes: it in * no way affects any of the arithmetic of the contract, including * {IERC20-balanceOf} and {IERC20-transfer}. */ function decimals() public view virtual override returns (uint8) { return 18; } /** * @dev See {IERC20-totalSupply}. */ function totalSupply() public view virtual override returns (uint256) { return _totalSupply; } /** * @dev See {IERC20-balanceOf}. */ function balanceOf(address account) public view virtual override returns (uint256) { return _balances[account]; } /** * @dev See {IERC20-transfer}. * * Requirements: * * - `to` cannot be the zero address. * - the caller must have a balance of at least `amount`. */ function transfer(address to, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _transfer(owner, to, amount); return true; } /** * @dev See {IERC20-allowance}. */ function allowance(address owner, address spender) public view virtual override returns (uint256) { return _allowances[owner][spender]; } /** * @dev See {IERC20-approve}. * * NOTE: If `amount` is the maximum `uint256`, the allowance is not updated on * `transferFrom`. This is semantically equivalent to an infinite approval. * * Requirements: * * - `spender` cannot be the zero address. */ function approve(address spender, uint256 amount) public virtual override returns (bool) { address owner = _msgSender(); _approve(owner, spender, amount); return true; } /** * @dev See {IERC20-transferFrom}. * * Emits an {Approval} event indicating the updated allowance. This is not * required by the EIP. See the note at the beginning of {ERC20}. * * NOTE: Does not update the allowance if the current allowance * is the maximum `uint256`. * * Requirements: * * - `from` and `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. * - the caller must have allowance for ``from``'s tokens of at least * `amount`. */ function transferFrom(address from, address to, uint256 amount) public virtual override returns (bool) { address spender = _msgSender(); _spendAllowance(from, spender, amount); _transfer(from, to, amount); return true; } /** * @dev Atomically increases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. */ function increaseAllowance(address spender, uint256 addedValue) public virtual returns (bool) { address owner = _msgSender(); _approve(owner, spender, allowance(owner, spender) + addedValue); return true; } /** * @dev Atomically decreases the allowance granted to `spender` by the caller. * * This is an alternative to {approve} that can be used as a mitigation for * problems described in {IERC20-approve}. * * Emits an {Approval} event indicating the updated allowance. * * Requirements: * * - `spender` cannot be the zero address. * - `spender` must have allowance for the caller of at least * `subtractedValue`. */ function decreaseAllowance(address spender, uint256 subtractedValue) public virtual returns (bool) { address owner = _msgSender(); uint256 currentAllowance = allowance(owner, spender); require(currentAllowance >= subtractedValue, "ERC20: decreased allowance below zero"); unchecked { _approve(owner, spender, currentAllowance - subtractedValue); } return true; } /** * @dev Moves `amount` of tokens from `from` to `to`. * * This internal function is equivalent to {transfer}, and can be used to * e.g. implement automatic token fees, slashing mechanisms, etc. * * Emits a {Transfer} event. * * Requirements: * * - `from` cannot be the zero address. * - `to` cannot be the zero address. * - `from` must have a balance of at least `amount`. */ function _transfer(address from, address to, uint256 amount) internal virtual { require(from != address(0), "ERC20: transfer from the zero address"); require(to != address(0), "ERC20: transfer to the zero address"); _beforeTokenTransfer(from, to, amount); uint256 fromBalance = _balances[from]; require(fromBalance >= amount, "ERC20: transfer amount exceeds balance"); unchecked { _balances[from] = fromBalance - amount; // Overflow not possible: the sum of all balances is capped by totalSupply, and the sum is preserved by // decrementing then incrementing. _balances[to] += amount; } emit Transfer(from, to, amount); _afterTokenTransfer(from, to, amount); } /** @dev Creates `amount` tokens and assigns them to `account`, increasing * the total supply. * * Emits a {Transfer} event with `from` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. */ function _mint(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: mint to the zero address"); _beforeTokenTransfer(address(0), account, amount); _totalSupply += amount; unchecked { // Overflow not possible: balance + amount is at most totalSupply + amount, which is checked above. _balances[account] += amount; } emit Transfer(address(0), account, amount); _afterTokenTransfer(address(0), account, amount); } /** * @dev Destroys `amount` tokens from `account`, reducing the * total supply. * * Emits a {Transfer} event with `to` set to the zero address. * * Requirements: * * - `account` cannot be the zero address. * - `account` must have at least `amount` tokens. */ function _burn(address account, uint256 amount) internal virtual { require(account != address(0), "ERC20: burn from the zero address"); _beforeTokenTransfer(account, address(0), amount); uint256 accountBalance = _balances[account]; require(accountBalance >= amount, "ERC20: burn amount exceeds balance"); unchecked { _balances[account] = accountBalance - amount; // Overflow not possible: amount <= accountBalance <= totalSupply. _totalSupply -= amount; } emit Transfer(account, address(0), amount); _afterTokenTransfer(account, address(0), amount); } /** * @dev Sets `amount` as the allowance of `spender` over the `owner` s tokens. * * This internal function is equivalent to `approve`, and can be used to * e.g. set automatic allowances for certain subsystems, etc. * * Emits an {Approval} event. * * Requirements: * * - `owner` cannot be the zero address. * - `spender` cannot be the zero address. */ function _approve(address owner, address spender, uint256 amount) internal virtual { require(owner != address(0), "ERC20: approve from the zero address"); require(spender != address(0), "ERC20: approve to the zero address"); _allowances[owner][spender] = amount; emit Approval(owner, spender, amount); } /** * @dev Updates `owner` s allowance for `spender` based on spent `amount`. * * Does not update the allowance amount in case of infinite allowance. * Revert if not enough allowance is available. * * Might emit an {Approval} event. */ function _spendAllowance(address owner, address spender, uint256 amount) internal virtual { uint256 currentAllowance = allowance(owner, spender); if (currentAllowance != type(uint256).max) { require(currentAllowance >= amount, "ERC20: insufficient allowance"); unchecked { _approve(owner, spender, currentAllowance - amount); } } } /** * @dev Hook that is called before any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * will be transferred to `to`. * - when `from` is zero, `amount` tokens will be minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens will be burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _beforeTokenTransfer(address from, address to, uint256 amount) internal virtual {} /** * @dev Hook that is called after any transfer of tokens. This includes * minting and burning. * * Calling conditions: * * - when `from` and `to` are both non-zero, `amount` of ``from``'s tokens * has been transferred to `to`. * - when `from` is zero, `amount` tokens have been minted for `to`. * - when `to` is zero, `amount` of ``from``'s tokens have been burned. * - `from` and `to` are never both zero. * * To learn more about hooks, head to xref:ROOT:extending-contracts.adoc#using-hooks[Using Hooks]. */ function _afterTokenTransfer(address from, address to, uint256 amount) internal virtual {} } // File: @openzeppelin/contracts/token/ERC20/extensions/ERC20Permit.sol // OpenZeppelin Contracts (last updated v4.9.4) (token/ERC20/extensions/ERC20Permit.sol) pragma solidity ^0.8.0; /** * @dev Implementation 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. * * _Available since v3.4._ */ abstract contract ERC20Permit is ERC20, IERC20Permit, EIP712 { using Counters for Counters.Counter; mapping(address => Counters.Counter) private _nonces; // solhint-disable-next-line var-name-mixedcase bytes32 private constant _PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); /** * @dev In previous versions `_PERMIT_TYPEHASH` was declared as `immutable`. * However, to ensure consistency with the upgradeable transpiler, we will continue * to reserve a slot. * @custom:oz-renamed-from _PERMIT_TYPEHASH */ // solhint-disable-next-line var-name-mixedcase bytes32 private _PERMIT_TYPEHASH_DEPRECATED_SLOT; /** * @dev Initializes the {EIP712} domain separator using the `name` parameter, and setting `version` to `"1"`. * * It's a good idea to use the same `name` that is defined as the ERC20 token name. */ constructor(string memory name) EIP712(name, "1") {} /** * @inheritdoc IERC20Permit */ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual override { require(block.timestamp <= deadline, "ERC20Permit: expired deadline"); bytes32 structHash = keccak256(abi.encode(_PERMIT_TYPEHASH, owner, spender, value, _useNonce(owner), deadline)); bytes32 hash = _hashTypedDataV4(structHash); address signer = ECDSA.recover(hash, v, r, s); require(signer == owner, "ERC20Permit: invalid signature"); _approve(owner, spender, value); } /** * @inheritdoc IERC20Permit */ function nonces(address owner) public view virtual override returns (uint256) { return _nonces[owner].current(); } /** * @inheritdoc IERC20Permit */ // solhint-disable-next-line func-name-mixedcase function DOMAIN_SEPARATOR() external view override returns (bytes32) { return _domainSeparatorV4(); } /** * @dev "Consume a nonce": return the current value and increment. * * _Available since v4.1._ */ function _useNonce(address owner) internal virtual returns (uint256 current) { Counters.Counter storage nonce = _nonces[owner]; current = nonce.current(); nonce.increment(); } } // File: @openzeppelin/contracts/token/ERC20/extensions/draft-ERC20Permit.sol // OpenZeppelin Contracts (last updated v4.9.0) (token/ERC20/extensions/draft-ERC20Permit.sol) pragma solidity ^0.8.0; // EIP-2612 is Final as of 2022-11-01. This file is deprecated. // File: contracts/QERC20.sol pragma solidity ^0.8.24; contract QERC20 is ERC20Permit { address immutable owner; constructor() ERC20("Q Token", "Q") ERC20Permit("Q Token") { owner = msg.sender; } function mintReward(address account, uint256 amount) external { require(msg.sender == owner, "Q: Incorrect caller"); require(super.totalSupply() < 120000000000000000000000000, "Q: Already minted"); _mint(account, amount); } } // File: @openzeppelin/contracts/metatx/ERC2771Context.sol // OpenZeppelin Contracts (last updated v4.9.4) (metatx/ERC2771Context.sol) pragma solidity ^0.8.9; /** * @dev Context variant with ERC2771 support. * * WARNING: The usage of `delegatecall` in this contract is dangerous and may result in context corruption. * Any forwarded request to this contract triggering a `delegatecall` to itself will result in an invalid {_msgSender} * recovery. */ abstract contract ERC2771Context is Context { /// @custom:oz-upgrades-unsafe-allow state-variable-immutable address private immutable _trustedForwarder; /// @custom:oz-upgrades-unsafe-allow constructor constructor(address trustedForwarder) { _trustedForwarder = trustedForwarder; } function isTrustedForwarder(address forwarder) public view virtual returns (bool) { return forwarder == _trustedForwarder; } function _msgSender() internal view virtual override returns (address) { uint256 calldataLength = msg.data.length; uint256 contextSuffixLength = _contextSuffixLength(); if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) { return address(bytes20(msg.data[calldataLength - contextSuffixLength:])); } else { return super._msgSender(); } } function _msgData() internal view virtual override returns (bytes calldata) { uint256 calldataLength = msg.data.length; uint256 contextSuffixLength = _contextSuffixLength(); if (isTrustedForwarder(msg.sender) && calldataLength >= contextSuffixLength) { return msg.data[:calldataLength - contextSuffixLength]; } else { return super._msgData(); } } /** * @dev ERC-2771 specifies the context as being a single address (20 bytes). */ function _contextSuffixLength() internal view virtual override returns (uint256) { return 20; } } // File: contracts/Q.sol pragma solidity ^0.8.24; contract Q is ERC2771Context { using SafeERC20 for QERC20; /** * Used to minimise division remainder when earned fees are calculated. */ uint256 constant SCALING_FACTOR = 1e40; /** * Contract creation timestamp. * Initialized in constructor. */ uint256 immutable i_initialTimestamp; /** * Length of a reward distribution cycle. * Initialized in contstructor to 1 day. */ uint256 immutable i_periodDuration; /** * Helper variable to store pending stake amount. */ uint256 public pendingStake; /** * Index (0-based) of the current cycle. * * Updated upon cycle setup that is triggered by contract interraction * (account burn tokens, claims fees, claims rewards, stakes or unstakes). */ uint256 public currentCycle; /** * Helper variable to store the index of the last active cycle. */ uint256 public lastStartedCycle; /** * Stores the index of the penultimate active cycle plus one. */ uint256 public previousStartedCycle; /** * Helper variable to store the index of the last active cycle. */ uint256 public currentStartedCycle; /** * Stores the amount of stake that will be subracted from the total * stake once a new cycle starts. */ uint256 public pendingStakeWithdrawal; /** * Diminisher of burned ether effectivness when calculating reward. */ uint256 public currentBurnDecrease; /** * Registration fee for the current started cycle. */ uint256 public currentRegistrationFee; /** * Total amount of ether burned through calling {enterCycle}. */ uint256 public totalNativeBurned; /** * Number of times {enterCycle} has been called during current started cycle. */ uint256 public cycleInteractions; /** * 3,8% of protocol fees are added to the devFee funds. */ address immutable devFee; /** * 1% of protocol fees are sent to the buy and burn of DXN contract. */ address immutable dxnBuyAndBurn; /** * 25% of protocol fees are sent to the buy and burn of Q contract. */ address public immutable qBuyAndBurn; /** * 0,2% of protocol fees are sent to the NXD DSV contract. */ address public immutable nxdDSV; /** * Q Reward Token contract. * Initialized in constructor. */ QERC20 public immutable qToken; /** * The amount of entries an account has during given cycle. * Resets during a new cycle when an account performs an action * that updates its stats. */ mapping(address => uint256) public accCycleEntries; /** * The total amount of entries across all accounts per cycle. */ mapping(uint256 => uint256) public cycleTotalEntries; /** * The last cycle in which an account has burned. */ mapping(address => uint256) public lastActiveCycle; /** * Current unclaimed rewards and staked amounts per account. */ mapping(address => uint256) public accRewards; /** * The fee amount the account can withdraw. */ mapping(address => uint256) public accAccruedFees; /** * Total token rewards allocated per cycle. */ mapping(uint256 => uint256) public rewardPerCycle; /** * Total unclaimed token reward and stake. * * Updated when a new cycle starts and when an account claims rewards, stakes or unstakes externally owned tokens. */ mapping(uint256 => uint256) public summedCycleStakes; /** * The last cycle in which the account had its fees updated. */ mapping(address => uint256) public lastFeeUpdateCycle; /** * The total amount of accrued fees per cycle. */ mapping(uint256 => uint256) public cycleAccruedFees; /** * Sum of previous total cycle accrued fees divided by cycle stake. */ mapping(uint256 => uint256) public cycleFeesPerStakeSummed; /** * Amount an account has staked and is locked during given cycle. */ mapping(address => mapping(uint256 => uint256)) public accStakeCycle; /** * Stake amount an account can currently withdraw. */ mapping(address => uint256) public accWithdrawableStake; /** * Cycle in which an account's stake is locked and begins generating fees. */ mapping(address => uint256) public accFirstStake; /** * Same as accFirstStake, but stores the second stake seperately * in case the account stakes in two consecutive active cycles. */ mapping(address => uint256) public accSecondStake; /** * Returns whether an AI miner has registered or not. */ mapping(address => bool) public isAIMinerRegistered; /** * Deposited ether balance for a given AI miner and cycle. */ mapping(address => mapping(uint256 => uint256)) public aiMinerBalancePerCycle; /** * Lowest registered AI miner balance in a given cycle. */ mapping(uint256 => uint256) public lowestCycleBalance; /** * Total amount of burned ether spent on {enterCycle} transactions. */ mapping(uint256 => uint256) public nativeBurnedPerCycle; /** * @dev Emitted when `account` claims an amount of `fees` in native token * through {claimFees} in `cycle`. */ event FeesClaimed( uint256 indexed cycle, address indexed account, uint256 fees ); /** * @dev Emitted when `account` stakes `amount` Q tokens through * {stake} in `cycle`. */ event Staked( uint256 indexed cycle, address indexed account, uint256 amount ); /** * @dev Emitted when `account` unstakes `amount` Q tokens through * {unstake} in `cycle`. */ event Unstaked( uint256 indexed cycle, address indexed account, uint256 amount ); /** * @dev Emitted when `account` claims `amount` Q * token rewards through {claimRewards} in `cycle`. */ event RewardsClaimed( uint256 indexed cycle, address indexed account, uint256 reward ); /** * @dev Emitted when calling {enterCycle} marking the new current `cycle`, * `calculatedCycleReward` and `summedCycleStakes`. */ event NewCycleStarted( uint256 indexed cycle, uint256 summedCycleStakes ); /** * @dev Emitted when calling {enterCycle} */ event CycleEntry( address indexed userAddress, uint256 entryMultiplier ); /** * @dev Emitted when calling {registerAIMiner} */ event NewAIRegistered( address indexed aiMiner, string name, uint256 currentRegistrationFee ); /** * @dev Emitted when calling {addFundsForAIMiner} */ event AddFundsForMiner( address indexed user, address indexed aiMiner, uint256 amount, uint256 cycle ); /** * Minimal reentrancy lock using transient storage. */ modifier nonReentrant { assembly { if tload(0) { revert(0, 0) } tstore(0, 1) } _; // Unlocks the guard, making the pattern composable. // After the function exits, it can be called again, even in the same transaction. assembly { tstore(0, 0) } } /** * @dev Checks that the caller has sent an amount that is equal or greater * than the sum of the protocol fee * The change is sent back to the caller. * */ modifier gasWrapper() { uint256 startGas = gasleft(); _; uint256 gasConsumed = startGas - gasleft() + 30892; uint256 burnedAmount = gasConsumed * block.basefee; nativeBurnedPerCycle[currentCycle] += burnedAmount; totalNativeBurned += burnedAmount; } /** * @param forwarder forwarder contract address. */ constructor( address forwarder, address _devFee, address _dxnBuyAndBurn, address _nxdDSV, address[] memory AIRegisteredAddresses ) ERC2771Context(forwarder) payable { devFee = _devFee; nxdDSV = _nxdDSV; qToken = new QERC20(); dxnBuyAndBurn = _dxnBuyAndBurn; qBuyAndBurn = address(new QBuyBurn(address(qToken))); i_initialTimestamp = block.timestamp; i_periodDuration = 1 days; currentRegistrationFee = 10 ether; uint256 stakerRegistrationFees = msg.value * 75 / 100; cycleAccruedFees[0] = stakerRegistrationFees; setAiMintersAddresses(AIRegisteredAddresses); sendViaCall(payable(qBuyAndBurn), msg.value - stakerRegistrationFees); } /** * Initializer function for marking as registered * those AI miners that have done so inside the * Q payment contract. */ function setAiMintersAddresses(address[] memory AIAddresses) internal { uint256 numberOfAIs = AIAddresses.length; for(uint256 i=0; i < numberOfAIs; i++) { isAIMinerRegistered[AIAddresses[i]] = true; } } /** * Entry point for the Q daily auction. * * @param aiMiner designated AI miner * @param entryMultiplier multiplies the number of entries */ function enterCycle( address aiMiner, uint256 entryMultiplier ) external payable nonReentrant() gasWrapper() { require(totalNativeBurned <= 1_200_000 ether, "Q: Endgame reached"); require(entryMultiplier <= 100, "Q: Max 100"); require(entryMultiplier > 0, "Q: Min 1"); require(isAIMinerRegistered[aiMiner], "Q: Not registered"); calculateCycle(); uint256 currentCycleMem = currentCycle; endCycle(currentCycleMem); setUpNewCycle(currentCycleMem); uint256 protocolFee = calculateProtocolFee(entryMultiplier); require(msg.value >= protocolFee, "Q: Value < fee"); address user = _msgSender(); updateStats(user, currentCycleMem); updateStats(aiMiner, currentCycleMem); calculateCycleEntries(entryMultiplier, currentCycleMem, aiMiner, user); lastActiveCycle[user] = currentCycle; lastActiveCycle[aiMiner] = currentCycle; cycleInteractions++; distributeFees(protocolFee, currentCycleMem); if(msg.value > protocolFee) { sendViaCall(payable(msg.sender), msg.value - protocolFee); } emit CycleEntry(user, entryMultiplier); } /** * Allows anyone to register as an AI miner if the * corresponding registration fee is paid. */ function registerAIMiner(string calldata name) external payable { uint256 registrationFee = currentRegistrationFee; require(msg.value >= registrationFee); address aiMiner = _msgSender(); require(!isAIMinerRegistered[aiMiner], "Q: AI registered"); isAIMinerRegistered[aiMiner] = true; if(msg.value > registrationFee) { sendViaCall(payable(msg.sender), msg.value - registrationFee); } distributeFees(registrationFee, currentStartedCycle); emit NewAIRegistered(aiMiner, name, registrationFee); } /** * @dev Mints newly accrued account rewards and transfers the entire * allocated amount to the transaction sender address. */ function claimRewards(uint256 claimAmount) external nonReentrant() { calculateCycle(); uint256 currentCycleMem = currentCycle; endCycle(currentCycleMem); address user = _msgSender(); updateStats(user, currentCycleMem); uint256 reward = accRewards[user] - accWithdrawableStake[user]; require(reward > 0, "Q: No rewards"); require(claimAmount <= reward, "Q: Exceeds rewards"); accRewards[user] -= claimAmount; if (lastStartedCycle == currentStartedCycle) { pendingStakeWithdrawal += claimAmount; } else { summedCycleStakes[currentCycleMem] = summedCycleStakes[currentCycleMem] - claimAmount; } qToken.mintReward(user, claimAmount); emit RewardsClaimed(currentCycleMem, user, claimAmount); } /** * @dev Transfers newly accrued fees to sender's address. */ function claimFees(uint256 claimAmount) external nonReentrant() { calculateCycle(); uint256 currentCycleMem = currentCycle; address user = _msgSender(); endCycle(currentCycleMem); updateStats(user, currentCycleMem); uint256 fees = accAccruedFees[user]; require(fees > 0, "Q: Amount is zero"); require(claimAmount <= fees, "Q: Claim amount exceeds fees"); accAccruedFees[user] -= claimAmount; sendViaCall(payable(user), claimAmount); emit FeesClaimed(currentCycleMem, user, claimAmount); } /** * @dev Stakes the given amount and increases the share of the daily allocated fees. * The tokens are transfered from sender account to this contract. * To receive the tokens back, the unstake function must be called by the same account address. * * @param amount token amount to be staked (in wei). */ function stake(uint256 amount) external nonReentrant() { calculateCycle(); uint256 currentCycleMem = currentCycle; address user = _msgSender(); endCycle(currentCycleMem); updateStats(user, currentCycleMem); require(amount > 0, "Q: Amount is zero"); require(currentCycleMem == currentStartedCycle, "Q: Only stake during active cycle"); pendingStake += amount; uint256 cycleToSet = currentCycleMem + 1; if (lastStartedCycle == currentStartedCycle) { cycleToSet = lastStartedCycle + 1; } if ( (cycleToSet != accFirstStake[user] && cycleToSet != accSecondStake[user]) ) { if (accFirstStake[user] == 0) { accFirstStake[user] = cycleToSet; } else if (accSecondStake[user] == 0) { accSecondStake[user] = cycleToSet; } } accStakeCycle[user][cycleToSet] += amount; qToken.safeTransferFrom(user, address(this), amount); emit Staked(cycleToSet, user, amount); } /** * @dev Unstakes the given amount and decreases the share of the daily allocated fees. * If the balance is availabe, the tokens are transfered from this contract to the sender account. * * @param amount token amount to be unstaked (in wei). */ function unstake(uint256 amount) external nonReentrant() { calculateCycle(); uint256 currentCycleMem = currentCycle; address user = _msgSender(); endCycle(currentCycleMem); updateStats(user, currentCycleMem); require(amount > 0, "Q: Amount is zero"); require( amount <= accWithdrawableStake[user], "Q: Amount greater than withdrawable stake" ); if (lastStartedCycle == currentStartedCycle) { pendingStakeWithdrawal += amount; } else { summedCycleStakes[currentCycleMem] -= amount; } accWithdrawableStake[user] -= amount; accRewards[user] -= amount; qToken.safeTransfer(user, amount); emit Unstaked(currentCycleMem, user, amount); } /** * @dev Returns the index of the cycle at the current block time. */ function getCurrentCycle() public view returns (uint256) { return (block.timestamp - i_initialTimestamp) / i_periodDuration; } /** * Calculates the multiplier applied to a cycle entry * where "miner" is the designated AI miner. */ function getAIMinerRankMultiplier(address miner, uint256 cycle) internal view returns(uint256 multiplier) { uint256 lastStartedCycleMem = lastStartedCycle; uint256 lastStartedCycleBalance = aiMinerBalancePerCycle[miner][lastStartedCycleMem]; if(lastStartedCycleBalance != 0 && cycle != 0) { multiplier = lastStartedCycleBalance * 2 / lowestCycleBalance[lastStartedCycleMem]; } else { multiplier = 1; } } /** * Calculates the protocol fee for entering the current cycle. */ function calculateProtocolFee(uint256 entryMultiplier) internal view returns(uint256 protocolFee) { protocolFee = (0.01 ether * entryMultiplier * (1000 + cycleInteractions)) / 1000; } /** * If the current registration fee is not 5 ether, * the fee gets updated for the new started cycle. */ function calculateRegisterFee() internal { if(currentRegistrationFee > 5 ether) { uint256 newRegistrationFee = (currentRegistrationFee * 10000) / 10020; if(newRegistrationFee < 5 ether) { currentRegistrationFee = 5 ether; } else { currentRegistrationFee = newRegistrationFee; } } } /** * Based on the protocol fee, the corresponding allocations are * sent to each of the predefined addresses. */ function distributeFees(uint256 fees, uint256 cycle) internal { cycleAccruedFees[cycle] += fees * 70 / 100; sendViaCall(payable(nxdDSV), fees * 2 / 1000); sendViaCall(payable(devFee), fees * 38 / 1000); sendViaCall(payable(dxnBuyAndBurn), fees / 100); sendViaCall(payable(qBuyAndBurn), fees * 25 / 100); } /** * Increase the ether balance of a given AI miner - this action * counts towards ranking the AI miners and establishing * a multiplier when choosing a certain miner to enter the cycle with. */ function addFundsForAIMiner(address aiMiner) external payable { uint256 cycle = currentStartedCycle; uint256 currentBalancePlusValue = aiMinerBalancePerCycle[aiMiner][cycle] + msg.value; require(currentBalancePlusValue >= 0.1 ether, "Q: Min. threshold balance not met"); aiMinerBalancePerCycle[aiMiner][cycle] += msg.value; uint256 currentCycleLowestBalance = lowestCycleBalance[cycle]; if(currentBalancePlusValue < currentCycleLowestBalance || currentCycleLowestBalance == 0) { lowestCycleBalance[cycle] = currentBalancePlusValue; } distributeFees(msg.value, cycle); emit AddFundsForMiner(msg.sender, aiMiner, msg.value, cycle); } /** * Calculates entries to be added to the total of entries of the current cycle * and of the entrant. */ function calculateCycleEntries(uint256 batchWeight, uint256 cycle, address aiMiner, address user) internal { uint256 multiplier = getAIMinerRankMultiplier(aiMiner, cycle); if(multiplier > 1) { batchWeight *= multiplier; } cycleTotalEntries[cycle] += batchWeight * 100; accCycleEntries[user] += batchWeight * 95; accCycleEntries[aiMiner] += batchWeight * 5; } /** * @dev Updates the index of the cycle. */ function calculateCycle() internal { uint256 calculatedCycle = getCurrentCycle(); if (calculatedCycle > currentCycle) { currentCycle = calculatedCycle; } } /** * @dev Updates the global helper variables related to fee distribution. */ function endCycle(uint256 cycle) internal { if (cycle != currentStartedCycle) { previousStartedCycle = lastStartedCycle; lastStartedCycle = currentStartedCycle; } uint256 lastStartedCycleMem = lastStartedCycle; if ( cycle > lastStartedCycleMem && cycleFeesPerStakeSummed[lastStartedCycleMem + 1] == 0 ) { calculateCycleReward(lastStartedCycleMem); uint256 feePerStake = (cycleAccruedFees[lastStartedCycleMem] * SCALING_FACTOR) / summedCycleStakes[lastStartedCycleMem]; cycleFeesPerStakeSummed[lastStartedCycleMem + 1] = cycleFeesPerStakeSummed[previousStartedCycle + 1] + feePerStake; } } /** * Calculates the Q reward amount to be distributed to * the entrants of the specified cycle. */ function calculateCycleReward(uint256 cycle) internal { uint256 reward = nativeBurnedPerCycle[cycle] * 100 - nativeBurnedPerCycle[cycle] * currentBurnDecrease / 200; rewardPerCycle[cycle] = reward; summedCycleStakes[cycle] += reward; if(currentBurnDecrease < 19999) { currentBurnDecrease++; } } /** * @dev Updates the global state related to starting a new cycle along * with helper state variables used in computation of staking rewards. */ function setUpNewCycle(uint256 cycle) internal { if (cycle != currentStartedCycle) { calculateRegisterFee(); currentStartedCycle = cycle; cycleInteractions = 0; summedCycleStakes[cycle] += summedCycleStakes[lastStartedCycle]; if (pendingStake != 0) { summedCycleStakes[cycle] += pendingStake; pendingStake = 0; } if (pendingStakeWithdrawal != 0) { summedCycleStakes[cycle] -= pendingStakeWithdrawal; pendingStakeWithdrawal = 0; } emit NewCycleStarted( cycle, summedCycleStakes[cycle] ); } } /** * @dev Updates various helper state variables used to compute token rewards * and fees distribution for a given account. * * @param account the address of the account to make the updates for. */ function updateStats(address account, uint256 cycle) internal { if ( cycle > lastActiveCycle[account] && accCycleEntries[account] != 0 ) { uint256 lastCycleAccReward = ((accCycleEntries[account] * rewardPerCycle[lastActiveCycle[account]]) / cycleTotalEntries[lastActiveCycle[account]]); accRewards[account] += lastCycleAccReward; accCycleEntries[account] = 0; } uint256 lastStartedCyclePlusOne = lastStartedCycle + 1; if ( cycle > lastStartedCycle && lastFeeUpdateCycle[account] != lastStartedCyclePlusOne ) { accAccruedFees[account] = accAccruedFees[account] + ( (accRewards[account] * (cycleFeesPerStakeSummed[lastStartedCyclePlusOne] - cycleFeesPerStakeSummed[lastFeeUpdateCycle[account]] ) ) ) / SCALING_FACTOR; lastFeeUpdateCycle[account] = lastStartedCyclePlusOne; } if ( accFirstStake[account] != 0 && cycle > accFirstStake[account] ) { uint256 unlockedFirstStake = accStakeCycle[account][accFirstStake[account]]; accRewards[account] += unlockedFirstStake; accWithdrawableStake[account] += unlockedFirstStake; if (lastStartedCyclePlusOne > accFirstStake[account]) { accAccruedFees[account] = accAccruedFees[account] + ( (accStakeCycle[account][accFirstStake[account]] * (cycleFeesPerStakeSummed[lastStartedCyclePlusOne] - cycleFeesPerStakeSummed[accFirstStake[account]] ) ) ) / SCALING_FACTOR; } accStakeCycle[account][accFirstStake[account]] = 0; accFirstStake[account] = 0; if (accSecondStake[account] != 0) { if (cycle > accSecondStake[account]) { uint256 unlockedSecondStake = accStakeCycle[account][accSecondStake[account]]; accRewards[account] += unlockedSecondStake; accWithdrawableStake[account] += unlockedSecondStake; if (lastStartedCyclePlusOne > accSecondStake[account]) { accAccruedFees[account] = accAccruedFees[account] + ( (accStakeCycle[account][accSecondStake[account]] * (cycleFeesPerStakeSummed[lastStartedCyclePlusOne] - cycleFeesPerStakeSummed[accSecondStake[account]] ) ) ) / SCALING_FACTOR; } accStakeCycle[account][accSecondStake[account]] = 0; accSecondStake[account] = 0; } else { accFirstStake[account] = accSecondStake[account]; accSecondStake[account] = 0; } } } } /** * Recommended method to use to send native coins. * * @param to receiving address. * @param amount in wei. */ function sendViaCall(address payable to, uint256 amount) internal { (bool sent, ) = to.call{value: amount}(""); require(sent, "Q: Failed to send amount"); } receive() external payable {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"forwarder","type":"address"},{"internalType":"address","name":"_devFee","type":"address"},{"internalType":"address","name":"_dxnBuyAndBurn","type":"address"},{"internalType":"address","name":"_nxdDSV","type":"address"},{"internalType":"address[]","name":"AIRegisteredAddresses","type":"address[]"}],"stateMutability":"payable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"user","type":"address"},{"indexed":true,"internalType":"address","name":"aiMiner","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"cycle","type":"uint256"}],"name":"AddFundsForMiner","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"userAddress","type":"address"},{"indexed":false,"internalType":"uint256","name":"entryMultiplier","type":"uint256"}],"name":"CycleEntry","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"fees","type":"uint256"}],"name":"FeesClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"aiMiner","type":"address"},{"indexed":false,"internalType":"string","name":"name","type":"string"},{"indexed":false,"internalType":"uint256","name":"currentRegistrationFee","type":"uint256"}],"name":"NewAIRegistered","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"summedCycleStakes","type":"uint256"}],"name":"NewCycleStarted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"reward","type":"uint256"}],"name":"RewardsClaimed","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Staked","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"cycle","type":"uint256"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Unstaked","type":"event"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accAccruedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accCycleEntries","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accFirstStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accRewards","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accSecondStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"accStakeCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accWithdrawableStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"aiMiner","type":"address"}],"name":"addFundsForAIMiner","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"uint256","name":"","type":"uint256"}],"name":"aiMinerBalancePerCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimAmount","type":"uint256"}],"name":"claimFees","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"claimAmount","type":"uint256"}],"name":"claimRewards","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"currentBurnDecrease","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentRegistrationFee","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentStartedCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cycleAccruedFees","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cycleFeesPerStakeSummed","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"cycleInteractions","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"cycleTotalEntries","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"aiMiner","type":"address"},{"internalType":"uint256","name":"entryMultiplier","type":"uint256"}],"name":"enterCycle","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[],"name":"getCurrentCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"isAIMinerRegistered","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"forwarder","type":"address"}],"name":"isTrustedForwarder","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastActiveCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"lastFeeUpdateCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"lastStartedCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"lowestCycleBalance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"nativeBurnedPerCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"nxdDSV","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingStake","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"pendingStakeWithdrawal","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"previousStartedCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"qBuyAndBurn","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"qToken","outputs":[{"internalType":"contract QERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"string","name":"name","type":"string"}],"name":"registerAIMiner","outputs":[],"stateMutability":"payable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"rewardPerCycle","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"stake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"summedCycleStakes","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalNativeBurned","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"unstake","outputs":[],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
61018060405260405161581b38038061581b83398101604081905261002391610293565b6001600160a01b0380861660805284811660e0528216610140526040516100499061024a565b604051809103905ff080158015610062573d5f803e3d5ffd5b506001600160a01b039081166101608190529084166101005260405161008790610257565b6001600160a01b039091168152602001604051809103905ff0801580156100b0573d5f803e3d5ffd5b506001600160a01b0316610120524260a0526201518060c052678ac7230489e800006007555f60646100e334604b6103aa565b6100ed91906103c7565b5f805260126020527f7e7fa33969761a458e04f477e039a608702b4f924981d6653935a8319a08ad7b819055905061012482610146565b6101205161013b9061013683346103e6565b6101a7565b50505050505061040d565b80515f5b818110156101a257600160185f858481518110610169576101696103f9565b6020908102919091018101516001600160a01b031682528101919091526040015f20805460ff191691151591909117905560010161014a565b505050565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f81146101f0576040519150601f19603f3d011682016040523d82523d5f602084013e6101f5565b606091505b50509050806101a25760405162461bcd60e51b815260206004820152601860248201527f513a204661696c656420746f2073656e6420616d6f756e740000000000000000604482015260640160405180910390fd5b6115e480612b3383390190565b6117048061411783390190565b80516001600160a01b038116811461027a575f80fd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f805f805f60a086880312156102a7575f80fd5b6102b086610264565b945060206102bf818801610264565b94506102cd60408801610264565b93506102db60608801610264565b60808801519093506001600160401b03808211156102f7575f80fd5b818901915089601f83011261030a575f80fd5b81518181111561031c5761031c61027f565b8060051b604051601f19603f830116810181811085821117156103415761034161027f565b60405291825284820192508381018501918c83111561035e575f80fd5b938501935b828510156103835761037485610264565b84529385019392850192610363565b8096505050505050509295509295909350565b634e487b7160e01b5f52601160045260245ffd5b80820281158282048414176103c1576103c1610396565b92915050565b5f826103e157634e487b7160e01b5f52601260045260245ffd5b500490565b818103818111156103c1576103c1610396565b634e487b7160e01b5f52603260045260245ffd5b60805160a05160c05160e051610100516101205161014051610160516126a861048b5f395f81816103510152818161090801528181610e2001526111ba01525f81816103060152611e0e01525f81816105390152611eab01525f611e7c01525f611e4a01525f61135001525f61137401525f610e9501526126a85ff3fe6080604052600436106101cd575f3560e01c80630962ef79146101d85780630ece2154146101f957806310019b3c1461023757806312ce57081461026d5780631ed6380f1461028057806328720db8146102ab5780632e17de78146102d657806337c679f7146102f55780633a5abead14610340578063436091c1146103735780634afdbdfa14610388578063572b6c051461039d5780635f5080b4146103cc578063633bf03d146103e157806368f05769146103f65780637bad72eb1461040b5780637f36ba08146104205780638796c3361461044b578063a694fc3a1461045e578063a707140b1461047d578063aabbb1bd146104a8578063ac68a748146104de578063adc0f686146104fd578063b68b5e8c14610528578063bab2f5521461055b578063bc71329014610570578063be26ed7f1461059b578063bebc9dfc146105af578063c4235ae9146105da578063ce09c18a14610605578063d4432e4e14610633578063d98de91f14610647578063db80a28c14610672578063dfcdc32f1461069d578063e3c7fa2c146106c8578063e60c90c4146106db578063ed725e8314610706578063f1b371e214610731578063f51b229414610746578063fa845ca91461075b575f80fd5b366101d457005b5f80fd5b3480156101e3575f80fd5b506101f76101f23660046123cb565b610786565b005b348015610204575f80fd5b506102246102133660046123cb565b60126020525f908152604090205481565b6040519081526020015b60405180910390f35b348015610242575f80fd5b506102246102513660046123fd565b601960209081525f928352604080842090915290825290205481565b6101f761027b3660046123fd565b6109b9565b34801561028b575f80fd5b5061022461029a366004612425565b60156020525f908152604090205481565b3480156102b6575f80fd5b506102246102c53660046123cb565b601b6020525f908152604090205481565b3480156102e1575f80fd5b506101f76102f03660046123cb565b610ca0565b348015610300575f80fd5b506103287f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161022e565b34801561034b575f80fd5b506103287f000000000000000000000000000000000000000000000000000000000000000081565b34801561037e575f80fd5b5061022460025481565b348015610393575f80fd5b5061022460075481565b3480156103a8575f80fd5b506103bc6103b7366004612425565b610e93565b604051901515815260200161022e565b3480156103d7575f80fd5b5061022460035481565b3480156103ec575f80fd5b5061022460085481565b348015610401575f80fd5b5061022460055481565b348015610416575f80fd5b5061022460065481565b34801561042b575f80fd5b5061022461043a3660046123cb565b600b6020525f908152604090205481565b6101f7610459366004612445565b610ec5565b348015610469575f80fd5b506101f76104783660046123cb565b610fca565b348015610488575f80fd5b50610224610497366004612425565b60116020525f908152604090205481565b3480156104b3575f80fd5b506102246104c23660046123fd565b601460209081525f928352604080842090915290825290205481565b3480156104e9575f80fd5b506101f76104f83660046123cb565b61121e565b348015610508575f80fd5b506102246105173660046123cb565b600f6020525f908152604090205481565b348015610533575f80fd5b506103287f000000000000000000000000000000000000000000000000000000000000000081565b348015610566575f80fd5b5061022460015481565b34801561057b575f80fd5b5061022461058a366004612425565b600e6020525f908152604090205481565b3480156105a6575f80fd5b5061022461134d565b3480156105ba575f80fd5b506102246105c93660046123cb565b60136020525f908152604090205481565b3480156105e5575f80fd5b506102246105f43660046123cb565b60106020525f908152604090205481565b348015610610575f80fd5b506103bc61061f366004612425565b60186020525f908152604090205460ff1681565b34801561063e575f80fd5b506102245f5481565b348015610652575f80fd5b506102246106613660046123cb565b601a6020525f908152604090205481565b34801561067d575f80fd5b5061022461068c366004612425565b60176020525f908152604090205481565b3480156106a8575f80fd5b506102246106b7366004612425565b600a6020525f908152604090205481565b6101f76106d6366004612425565b6113a8565b3480156106e6575f80fd5b506102246106f5366004612425565b60166020525f908152604090205481565b348015610711575f80fd5b50610224610720366004612425565b600d6020525f908152604090205481565b34801561073c575f80fd5b5061022460045481565b348015610751575f80fd5b5061022460095481565b348015610766575f80fd5b50610224610775366004612425565b600c6020525f908152604090205481565b5f5c15610791575f80fd5b60015f5d61079d6114fa565b6001546107a981611518565b5f6107b26115f6565b90506107be8183611646565b6001600160a01b0381165f90815260156020908152604080832054600d9092528220546107eb91906124c4565b90505f81116108315760405162461bcd60e51b815260206004820152600d60248201526c513a204e6f207265776172647360981b60448201526064015b60405180910390fd5b808411156108765760405162461bcd60e51b8152602060048201526012602482015271513a2045786365656473207265776172647360701b6044820152606401610828565b6001600160a01b0382165f908152600d60205260408120805486929061089d9084906124c4565b9091555050600454600254036108c9578360055f8282546108be91906124d7565b909155506108f19050565b5f838152601060205260409020546108e29085906124c4565b5f848152601060205260409020555b604051634d24848760e11b81526001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639a49090e9061093f90859088906004016124ea565b5f604051808303815f87803b158015610956575f80fd5b505af1158015610968573d5f803e3d5ffd5b50505050816001600160a01b0316837f3300bdb359cfb956935bca32e9db727413eab1ca84341f2e36caea85bb796968866040516109a891815260200190565b60405180910390a35050505f805d50565b5f5c156109c4575f80fd5b60015f5d5f5a905069fe1c215e8f838e0000006008541115610a1d5760405162461bcd60e51b8152602060048201526012602482015271144e88115b9919d85b59481c995858da195960721b6044820152606401610828565b6064821115610a5b5760405162461bcd60e51b815260206004820152600a6024820152690513a204d6178203130360b41b6044820152606401610828565b5f8211610a955760405162461bcd60e51b8152602060048201526008602482015267513a204d696e203160c01b6044820152606401610828565b6001600160a01b0383165f9081526018602052604090205460ff16610af05760405162461bcd60e51b8152602060048201526011602482015270144e88139bdd081c9959da5cdd195c9959607a1b6044820152606401610828565b610af86114fa565b600154610b0481611518565b610b0d81611bd1565b5f610b1784611cc9565b905080341015610b5a5760405162461bcd60e51b815260206004820152600e60248201526d513a2056616c7565203c2066656560901b6044820152606401610828565b5f610b636115f6565b9050610b6f8184611646565b610b798684611646565b610b8585848884611d08565b6001546001600160a01b038083165f908152600c60205260408082208490559189168152908120919091556009805491610bbe83612503565b9190505550610bcd8284611dcf565b81341115610be857610be833610be384346124c4565b611ed7565b806001600160a01b03167ffa46cc39fc3a7bafc0f46b0272961643c81ac5016927080d397f7f0055d856fd86604051610c2391815260200190565b60405180910390a25050505f5a610c3a90836124c4565b610c46906178ac6124d7565b90505f610c53488361251b565b905080601b5f60015481526020019081526020015f205f828254610c7791906124d7565b925050819055508060085f828254610c8f91906124d7565b925050819055505050505f805d5050565b5f5c15610cab575f80fd5b60015f5d610cb76114fa565b6001545f610cc36115f6565b9050610cce82611518565b610cd88183611646565b5f8311610cf75760405162461bcd60e51b815260040161082890612532565b6001600160a01b0381165f90815260156020526040902054831115610d705760405162461bcd60e51b815260206004820152602960248201527f513a20416d6f756e742067726561746572207468616e20776974686472617761604482015268626c65207374616b6560b81b6064820152608401610828565b60045460025403610d97578260055f828254610d8c91906124d7565b90915550610dba9050565b5f8281526010602052604081208054859290610db49084906124c4565b90915550505b6001600160a01b0381165f9081526015602052604081208054859290610de19084906124c4565b90915550506001600160a01b0381165f908152600d602052604081208054859290610e0d9084906124c4565b90915550610e4790506001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168285611f71565b806001600160a01b0316827f37375b03d8924bd8f076f11f8411b9962aa5c02fb489021507bc6bb6f850e36585604051610e8391815260200190565b60405180910390a350505f805d50565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0390811691161490565b60075434811115610ed4575f80fd5b5f610edd6115f6565b6001600160a01b0381165f9081526018602052604090205490915060ff1615610f3b5760405162461bcd60e51b815260206004820152601060248201526f144e881052481c9959da5cdd195c995960821b6044820152606401610828565b6001600160a01b0381165f908152601860205260409020805460ff1916600117905534821015610f7357610f7333610be384346124c4565b610f7f82600454611dcf565b806001600160a01b03167f692d99e6f9b3cb9e93a6d75f83ec4e52e60504a0763720ab8e639060da38b932858585604051610fbc9392919061255d565b60405180910390a250505050565b5f5c15610fd5575f80fd5b60015f5d610fe16114fa565b6001545f610fed6115f6565b9050610ff882611518565b6110028183611646565b5f83116110215760405162461bcd60e51b815260040161082890612532565b600454821461107c5760405162461bcd60e51b815260206004820152602160248201527f513a204f6e6c79207374616b6520647572696e6720616374697665206379636c6044820152606560f81b6064820152608401610828565b825f8082825461108c91906124d7565b909155505f905061109e8360016124d7565b9050600454600254036110bc576002546110b99060016124d7565b90505b6001600160a01b0382165f9081526016602052604090205481148015906110fa57506001600160a01b0382165f908152601760205260409020548114155b15611175576001600160a01b0382165f90815260166020526040812054900361113c576001600160a01b0382165f908152601660205260409020819055611175565b6001600160a01b0382165f908152601760205260408120549003611175576001600160a01b0382165f9081526017602052604090208190555b6001600160a01b0382165f908152601460209081526040808320848452909152812080548692906111a79084906124d7565b909155506111e290506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016833087611fc7565b816001600160a01b0316817f18dcd430020e4d4899772fd94a8b40451dc5044dfb70bc46b532eeae431c864f866040516109a891815260200190565b5f5c15611229575f80fd5b60015f5d6112356114fa565b6001545f6112416115f6565b905061124c82611518565b6112568183611646565b6001600160a01b0381165f908152600e60205260409020548061128b5760405162461bcd60e51b815260040161082890612532565b808411156112da5760405162461bcd60e51b815260206004820152601c60248201527b513a20436c61696d20616d6f756e742065786365656473206665657360201b6044820152606401610828565b6001600160a01b0382165f908152600e6020526040812080548692906113019084906124c4565b9091555061131190508285611ed7565b816001600160a01b0316837f2227733fc4c8a9034cb58087dcf6995128b9c0233b038b03366aaf30c92b92d6866040516109a891815260200190565b5f7f00000000000000000000000000000000000000000000000000000000000000006113997f0000000000000000000000000000000000000000000000000000000000000000426124c4565b6113a39190612594565b905090565b6004546001600160a01b0382165f9081526019602090815260408083208484529091528120546113d99034906124d7565b905067016345785d8a000081101561143d5760405162461bcd60e51b815260206004820152602160248201527f513a204d696e2e207468726573686f6c642062616c616e6365206e6f74206d656044820152601d60fa1b6064820152608401610828565b6001600160a01b0383165f9081526019602090815260408083208584529091528120805434929061146f9084906124d7565b90915550505f828152601a60205260409020548082108061148e575080155b156114a4575f838152601a602052604090208290555b6114ae3484611dcf565b60408051348152602081018590526001600160a01b0386169133917f031820cb503f016de565e43728c74cb9df7177ba8789df22781cab0a4ec10dc0910160405180910390a350505050565b5f61150361134d565b90506001548111156115155760018190555b50565b600454811461152e576002805460035560045490555b600254808211801561155a575060135f6115498360016124d7565b81526020019081526020015f20545f145b156115f25761156881611fff565b5f81815260106020908152604080832054601290925282205461159b906b1d6329f1c35ca4bfabb9f56160281b9061251b565b6115a59190612594565b90508060135f60035460016115ba91906124d7565b81526020019081526020015f20546115d291906124d7565b60135f6115e08560016124d7565b815260208101919091526040015f2055505b5050565b5f36601461160333610e93565b801561160f5750808210155b1561163e575f3661162083856124c4565b61162b9282906125b3565b611634916125da565b60601c9250505090565b339250505090565b6001600160a01b0382165f908152600c60205260409020548111801561168257506001600160a01b0382165f908152600a602052604090205415155b15611722576001600160a01b0382165f818152600c60209081526040808320548352600b825280832054600f835281842054948452600a909252822054919290916116cd919061251b565b6116d79190612594565b6001600160a01b0384165f908152600d60205260408120805492935083929091906117039084906124d7565b9091555050506001600160a01b0382165f908152600a60205260408120555b5f600254600161173291906124d7565b90506002548211801561175c57506001600160a01b0383165f908152601160205260409020548114155b1561181c576001600160a01b0383165f9081526011602090815260408083205483526013909152808220548383529120546b1d6329f1c35ca4bfabb9f56160281b916117a7916124c4565b6001600160a01b0385165f908152600d60205260409020546117c9919061251b565b6117d39190612594565b6001600160a01b0384165f908152600e60205260409020546117f591906124d7565b6001600160a01b0384165f908152600e602090815260408083209390935560119052208190555b6001600160a01b0383165f908152601660205260409020541580159061185857506001600160a01b0383165f9081526016602052604090205482115b15611bcc576001600160a01b0383165f81815260146020908152604080832060168352818420548452825280832054938352600d909152812080548392906118a19084906124d7565b90915550506001600160a01b0384165f90815260156020526040812080548392906118cd9084906124d7565b90915550506001600160a01b0384165f908152601660205260409020548211156119b0576001600160a01b0384165f9081526016602090815260408083205483526013909152808220548483529120546b1d6329f1c35ca4bfabb9f56160281b91611937916124c4565b6001600160a01b0386165f9081526014602090815260408083206016835281842054845290915290205461196b919061251b565b6119759190612594565b6001600160a01b0385165f908152600e602052604090205461199791906124d7565b6001600160a01b0385165f908152600e60205260409020555b6001600160a01b0384165f81815260146020908152604080832060168352818420805485529083528184208490559383529282905560179052205415611bca576001600160a01b0384165f90815260176020526040902054831115611b9e576001600160a01b0384165f81815260146020908152604080832060178352818420548452825280832054938352600d90915281208054839290611a539084906124d7565b90915550506001600160a01b0385165f9081526015602052604081208054839290611a7f9084906124d7565b90915550506001600160a01b0385165f90815260176020526040902054831115611b62576001600160a01b0385165f9081526017602090815260408083205483526013909152808220548583529120546b1d6329f1c35ca4bfabb9f56160281b91611ae9916124c4565b6001600160a01b0387165f90815260146020908152604080832060178352818420548452909152902054611b1d919061251b565b611b279190612594565b6001600160a01b0386165f908152600e6020526040902054611b4991906124d7565b6001600160a01b0386165f908152600e60205260409020555b506001600160a01b0384165f81815260146020908152604080832060178084528285208054865291845291842084905593835290529055611bca565b6001600160a01b0384165f90815260176020818152604080842080546016845291852091909155919052555b505b505050565b600454811461151557611be26120a4565b60048190555f600981905560025481526010602052604080822054838352908220805491929091611c149084906124d7565b90915550505f5415611c49575f8054828252601060205260408220805491929091611c409084906124d7565b90915550505f80555b60055415611c7b576005545f8281526010602052604081208054909190611c719084906124c4565b90915550505f6005555b807f2ee63a65823306caa71f76a6f1fbc130f9932419aca12e4bc61488794c0fe84260105f8481526020019081526020015f2054604051611cbe91815260200190565b60405180910390a250565b5f6103e86009546103e8611cdd91906124d7565b611cee84662386f26fc1000061251b565b611cf8919061251b565b611d029190612594565b92915050565b5f611d1383856120fb565b90506001811115611d2b57611d28818661251b565b94505b611d3685606461251b565b5f858152600b602052604081208054909190611d539084906124d7565b90915550611d64905085605f61251b565b6001600160a01b0383165f908152600a602052604081208054909190611d8b9084906124d7565b90915550611d9c905085600561251b565b6001600160a01b0384165f908152600a602052604081208054909190611dc39084906124d7565b90915550505050505050565b6064611ddc83604661251b565b611de69190612594565b5f8281526012602052604081208054909190611e039084906124d7565b90915550611e4590507f00000000000000000000000000000000000000000000000000000000000000006103e8611e3b85600261251b565b610be39190612594565b611e777f00000000000000000000000000000000000000000000000000000000000000006103e8611e3b85602661251b565b611ea67f0000000000000000000000000000000000000000000000000000000000000000610be3606485612594565b6115f27f00000000000000000000000000000000000000000000000000000000000000006064611e3b85601961251b565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611f20576040519150601f19603f3d011682016040523d82523d5f602084013e611f25565b606091505b5050905080611bcc5760405162461bcd60e51b8152602060048201526018602482015277144e8811985a5b1959081d1bc81cd95b9908185b5bdd5b9d60421b6044820152606401610828565b611bcc8363a9059cbb60e01b8484604051602401611f909291906124ea565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261216e565b6040516001600160a01b0380851660248301528316604482015260648101829052611bca9085906323b872dd60e01b90608401611f90565b6006545f828152601b6020526040812054909160c89161201f919061251b565b6120299190612594565b5f838152601b602052604090205461204290606461251b565b61204c91906124c4565b5f838152600f60209081526040808320849055601090915281208054929350839290919061207b9084906124d7565b9091555050600654614e1f11156115f25760068054905f61209b83612503565b91905055505050565b674563918244f4000060075411156120f9575f6127246007546127106120ca919061251b565b6120d49190612594565b9050674563918244f400008110156120f557674563918244f4000060075550565b6007555b565b6002546001600160a01b0383165f908152601960209081526040808320848452909152812054909190801580159061213257508315155b15612161575f828152601a602052604090205461215082600261251b565b61215a9190612594565b9250612166565b600192505b505092915050565b5f6121c2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122419092919063ffffffff16565b905080515f14806121e25750808060200190518101906121e29190612608565b611bcc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610828565b606061224f84845f85612257565b949350505050565b6060824710156122b85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610828565b5f80866001600160a01b031685876040516122d39190612627565b5f6040518083038185875af1925050503d805f811461230d576040519150601f19603f3d011682016040523d82523d5f602084013e612312565b606091505b50915091506123238783838761232e565b979650505050505050565b6060831561239c5782515f03612395576001600160a01b0385163b6123955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610828565b508161224f565b61224f83838151156123b15781518083602001fd5b8060405162461bcd60e51b8152600401610828919061263d565b5f602082840312156123db575f80fd5b5035919050565b80356001600160a01b03811681146123f8575f80fd5b919050565b5f806040838503121561240e575f80fd5b612417836123e2565b946020939093013593505050565b5f60208284031215612435575f80fd5b61243e826123e2565b9392505050565b5f8060208385031215612456575f80fd5b82356001600160401b038082111561246c575f80fd5b818501915085601f83011261247f575f80fd5b81358181111561248d575f80fd5b86602082850101111561249e575f80fd5b60209290920196919550909350505050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115611d0257611d026124b0565b80820180821115611d0257611d026124b0565b6001600160a01b03929092168252602082015260400190565b5f60018201612514576125146124b0565b5060010190565b8082028115828204841417611d0257611d026124b0565b602080825260119082015270513a20416d6f756e74206973207a65726f60781b604082015260600190565b60408152826040820152828460608301375f606084830101525f6060601f19601f8601168301019050826020830152949350505050565b5f826125ae57634e487b7160e01b5f52601260045260245ffd5b500490565b5f80858511156125c1575f80fd5b838611156125cd575f80fd5b5050820193919092039150565b6001600160601b031981358181169160148510156121665760149490940360031b84901b1690921692915050565b5f60208284031215612618575f80fd5b8151801515811461243e575f80fd5b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fea264697066735822122085460eab68e9de9774f82431c6f4ebc1f46dc8465fa59728222a7158bd1a8d4964736f6c63430008190033610180604052348015610010575f80fd5b506040518060400160405280600781526020016628902a37b5b2b760c91b81525080604051806040016040528060018152602001603160f81b8152506040518060400160405280600781526020016628902a37b5b2b760c91b815250604051806040016040528060018152602001605160f81b81525081600390816100959190610271565b5060046100a28282610271565b506100b291508390506005610161565b610120526100c1816006610161565b61014052815160208084019190912060e052815190820120610100524660a05261014d60e05161010051604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201529081019290925260608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b60805250503060c052503361016052610388565b5f60208351101561017c5761017583610193565b905061018d565b816101878482610271565b5060ff90505b92915050565b5f80829050601f815111156101c6578260405163305a27a960e01b81526004016101bd9190610330565b60405180910390fd5b80516101d182610365565b179392505050565b634e487b7160e01b5f52604160045260245ffd5b600181811c9082168061020157607f821691505b60208210810361021f57634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561026c57805f5260205f20601f840160051c8101602085101561024a5750805b601f840160051c820191505b81811015610269575f8155600101610256565b50505b505050565b81516001600160401b0381111561028a5761028a6101d9565b61029e8161029884546101ed565b84610225565b602080601f8311600181146102d1575f84156102ba5750858301515b5f19600386901b1c1916600185901b178555610328565b5f85815260208120601f198616915b828110156102ff578886015182559484019460019091019084016102e0565b508582101561031c57878501515f19600388901b60f8161c191681555b505060018460011b0185555b505050505050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f83011684010191505092915050565b8051602080830151919081101561021f575f1960209190910360031b1b16919050565b60805160a05160c05160e051610100516101205161014051610160516112016103e35f395f6103da01525f61037101525f61034601525f610abb01525f610a9301525f6109ee01525f610a1801525f610a4201526112015ff3fe608060405234801561000f575f80fd5b50600436106100ce575f3560e01c806306fdde03146100d2578063095ea7b3146100f057806318160ddd1461011357806323b872dd14610125578063313ce567146101385780633644e51514610147578063395093511461014f57806370a08231146101625780637ecebe001461018a57806384b0196e1461019d57806395d89b41146101b85780639a49090e146101c0578063a457c2d7146101d5578063a9059cbb146101e8578063d505accf146101fb578063dd62ed3e1461020e575b5f80fd5b6100da610221565b6040516100e79190610f63565b60405180910390f35b6101036100fe366004610f97565b6102b1565b60405190151581526020016100e7565b6002545b6040519081526020016100e7565b610103610133366004610fbf565b6102ca565b604051601281526020016100e7565b6101176102ed565b61010361015d366004610f97565b6102fb565b610117610170366004610ff8565b6001600160a01b03165f9081526020819052604090205490565b610117610198366004610ff8565b61031c565b6101a5610339565b6040516100e79796959493929190611011565b6100da6103c0565b6101d36101ce366004610f97565b6103cf565b005b6101036101e3366004610f97565b6104a6565b6101036101f6366004610f97565b610520565b6101d36102093660046110a8565b61052d565b61011761021c366004611115565b61068e565b60606003805461023090611146565b80601f016020809104026020016040519081016040528092919081815260200182805461025c90611146565b80156102a75780601f1061027e576101008083540402835291602001916102a7565b820191905f5260205f20905b81548152906001019060200180831161028a57829003601f168201915b5050505050905090565b5f336102be8185856106b8565b60019150505b92915050565b5f336102d78582856107db565b6102e2858585610853565b506001949350505050565b5f6102f66109e2565b905090565b5f336102be81858561030d838361068e565b6103179190611178565b6106b8565b6001600160a01b0381165f908152600760205260408120546102c4565b5f6060808280808361036c7f00000000000000000000000000000000000000000000000000000000000000006005610b0b565b6103977f00000000000000000000000000000000000000000000000000000000000000006006610b0b565b604080515f80825260208201909252600f60f81b9b939a50919850469750309650945092509050565b60606004805461023090611146565b336001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016146104425760405162461bcd60e51b8152602060048201526013602482015272289d1024b731b7b93932b1ba1031b0b63632b960691b60448201526064015b60405180910390fd5b6a6342fd08f00f637800000061045760025490565b106104985760405162461bcd60e51b8152602060048201526011602482015270144e88105b1c9958591e481b5a5b9d1959607a1b6044820152606401610439565b6104a28282610bb4565b5050565b5f33816104b3828661068e565b9050838110156105135760405162461bcd60e51b815260206004820152602560248201527f45524332303a2064656372656173656420616c6c6f77616e63652062656c6f77604482015264207a65726f60d81b6064820152608401610439565b6102e282868684036106b8565b5f336102be818585610853565b8342111561057d5760405162461bcd60e51b815260206004820152601d60248201527f45524332305065726d69743a206578706972656420646561646c696e650000006044820152606401610439565b5f7f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98888886105ab8c610c5e565b6040805160208101969096526001600160a01b0394851690860152929091166060840152608083015260a082015260c0810186905260e0016040516020818303038152906040528051906020012090505f61060582610c85565b90505f61061482878787610cb1565b9050896001600160a01b0316816001600160a01b0316146106775760405162461bcd60e51b815260206004820152601e60248201527f45524332305065726d69743a20696e76616c6964207369676e617475726500006044820152606401610439565b6106828a8a8a6106b8565b50505050505050505050565b6001600160a01b039182165f90815260016020908152604080832093909416825291909152205490565b6001600160a01b03831661071a5760405162461bcd60e51b8152602060048201526024808201527f45524332303a20617070726f76652066726f6d20746865207a65726f206164646044820152637265737360e01b6064820152608401610439565b6001600160a01b03821661077b5760405162461bcd60e51b815260206004820152602260248201527f45524332303a20617070726f766520746f20746865207a65726f206164647265604482015261737360f01b6064820152608401610439565b6001600160a01b038381165f8181526001602090815260408083209487168084529482529182902085905590518481527f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a3505050565b5f6107e6848461068e565b90505f19811461084d57818110156108405760405162461bcd60e51b815260206004820152601d60248201527f45524332303a20696e73756666696369656e7420616c6c6f77616e63650000006044820152606401610439565b61084d84848484036106b8565b50505050565b6001600160a01b0383166108b75760405162461bcd60e51b815260206004820152602560248201527f45524332303a207472616e736665722066726f6d20746865207a65726f206164604482015264647265737360d81b6064820152608401610439565b6001600160a01b0382166109195760405162461bcd60e51b815260206004820152602360248201527f45524332303a207472616e7366657220746f20746865207a65726f206164647260448201526265737360e81b6064820152608401610439565b6001600160a01b0383165f90815260208190526040902054818110156109905760405162461bcd60e51b815260206004820152602660248201527f45524332303a207472616e7366657220616d6f756e7420657863656564732062604482015265616c616e636560d01b6064820152608401610439565b6001600160a01b038481165f81815260208181526040808320878703905593871680835291849020805487019055925185815290925f805160206111ac833981519152910160405180910390a361084d565b5f306001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016148015610a3a57507f000000000000000000000000000000000000000000000000000000000000000046145b15610a6457507f000000000000000000000000000000000000000000000000000000000000000090565b6102f6604080517f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60208201527f0000000000000000000000000000000000000000000000000000000000000000918101919091527f000000000000000000000000000000000000000000000000000000000000000060608201524660808201523060a08201525f9060c00160405160208183030381529060405280519060200120905090565b606060ff8314610b2557610b1e83610cd7565b90506102c4565b818054610b3190611146565b80601f0160208091040260200160405190810160405280929190818152602001828054610b5d90611146565b8015610ba85780601f10610b7f57610100808354040283529160200191610ba8565b820191905f5260205f20905b815481529060010190602001808311610b8b57829003601f168201915b505050505090506102c4565b6001600160a01b038216610c0a5760405162461bcd60e51b815260206004820152601f60248201527f45524332303a206d696e7420746f20746865207a65726f2061646472657373006044820152606401610439565b8060025f828254610c1b9190611178565b90915550506001600160a01b0382165f81815260208181526040808320805486019055518481525f805160206111ac833981519152910160405180910390a35050565b6001600160a01b0381165f9081526007602052604090208054600181018255905b50919050565b5f6102c4610c916109e2565b8360405161190160f01b8152600281019290925260228201526042902090565b5f805f610cc087878787610d14565b91509150610ccd81610dc7565b5095945050505050565b60605f610ce383610f0e565b6040805160208082528183019092529192505f91906020820181803683375050509182525060208101929092525090565b5f806fa2a8918ca85bafe22016d0b997e4df60600160ff1b03831115610d3f57505f90506003610dbe565b604080515f8082526020820180845289905260ff881692820192909252606081018690526080810185905260019060a0016020604051602081039080840390855afa158015610d90573d5f803e3d5ffd5b5050604051601f1901519150506001600160a01b038116610db8575f60019250925050610dbe565b91505f90505b94509492505050565b5f816004811115610dda57610dda611197565b03610de25750565b6001816004811115610df657610df6611197565b03610e3e5760405162461bcd60e51b815260206004820152601860248201527745434453413a20696e76616c6964207369676e617475726560401b6044820152606401610439565b6002816004811115610e5257610e52611197565b03610e9f5760405162461bcd60e51b815260206004820152601f60248201527f45434453413a20696e76616c6964207369676e6174757265206c656e677468006044820152606401610439565b6003816004811115610eb357610eb3611197565b03610f0b5760405162461bcd60e51b815260206004820152602260248201527f45434453413a20696e76616c6964207369676e6174757265202773272076616c604482015261756560f01b6064820152608401610439565b50565b5f60ff8216601f8111156102c457604051632cd44ac360e21b815260040160405180910390fd5b5f81518084528060208401602086015e5f602082860101526020601f19601f83011685010191505092915050565b602081525f610f756020830184610f35565b9392505050565b80356001600160a01b0381168114610f92575f80fd5b919050565b5f8060408385031215610fa8575f80fd5b610fb183610f7c565b946020939093013593505050565b5f805f60608486031215610fd1575f80fd5b610fda84610f7c565b9250610fe860208501610f7c565b9150604084013590509250925092565b5f60208284031215611008575f80fd5b610f7582610f7c565b60ff60f81b881681525f602060e0602084015261103160e084018a610f35565b8381036040850152611043818a610f35565b606085018990526001600160a01b038816608086015260a0850187905284810360c0860152855180825260208088019350909101905f5b818110156110965783518352928401929184019160010161107a565b50909c9b505050505050505050505050565b5f805f805f805f60e0888a0312156110be575f80fd5b6110c788610f7c565b96506110d560208901610f7c565b95506040880135945060608801359350608088013560ff811681146110f8575f80fd5b9699959850939692959460a0840135945060c09093013592915050565b5f8060408385031215611126575f80fd5b61112f83610f7c565b915061113d60208401610f7c565b90509250929050565b600181811c9082168061115a57607f821691505b602082108103610c7f57634e487b7160e01b5f52602260045260245ffd5b808201808211156102c457634e487b7160e01b5f52601160045260245ffd5b634e487b7160e01b5f52602160045260245ffdfeddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3efa2646970667358221220c22e871721421ab8743f1837744003fc3fc896fa7d8b1c452a9c5a133c6d1f0864736f6c6343000819003360c060405234801561000f575f80fd5b5060405161170438038061170483398101604081905261002e916101e1565b425f5561005273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc282612710610069565b6001600160a01b0390811660a0521660805261020e565b5f805f846001600160a01b0316866001600160a01b03161061008c57848661008f565b85855b604080516060810182526001600160a01b0380851682528316602082015262ffffff88169181019190915291935091506100dd731f98431c8ad98523631ae4a59f267346ea31f984826100e8565b979650505050505050565b5f81602001516001600160a01b0316825f01516001600160a01b03161061010d575f80fd5b815160208084015160408086015181516001600160a01b0395861681860152949092168482015262ffffff90911660608085019190915281518085038201815260808501909252815191909201207fff0000000000000000000000000000000000000000000000000000000000000060a08401529085901b6001600160601b03191660a183015260b58201527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d582015260f50160408051601f1981840301815291905280516020909101209392505050565b5f602082840312156101f1575f80fd5b81516001600160a01b0381168114610207575f80fd5b9392505050565b60805160a0516114c761023d5f395f81816102c4015261063001525f818161067501526107c701526114c75ff3fe608060405260043610610078575f3560e01c806309c2bc96146100cc57806355ecf5a81461010f578063802c6ee5146101465780638225b247146101695780638bd95563146101885780638fe075961461019c578063b70872e6146101bb578063bdc639bc146101d0578063be26ed7f146101e5575f80fd5b366100c8575f5461008c9062015180610fe4565b4210156100af573460015f8282546100a49190610fe4565b909155506100c69050565b3460035f8282546100c09190610fe4565b90915550505b005b5f80fd5b3480156100d7575f80fd5b506100fa6100e6366004610ffd565b60046020525f908152604090205460ff1681565b60405190151581526020015b60405180910390f35b34801561011a575f80fd5b5061012e61012936600461102b565b6101f9565b6040516001600160a01b039091168152602001610106565b348015610151575f80fd5b5061015b60035481565b604051908152602001610106565b348015610174575f80fd5b506100c661018336600461107a565b610283565b348015610193575f80fd5b5061015b5f5481565b3480156101a7575f80fd5b5061015b6101b636600461109a565b610629565b3480156101c6575f80fd5b5061015b60015481565b3480156101db575f80fd5b5061015b60025481565b3480156101f0575f80fd5b5061015b610699565b5f805f846001600160a01b0316866001600160a01b03161061021c57848661021f565b85855b915091505f6040518060600160405280846001600160a01b03168152602001836001600160a01b031681526020018662ffffff168152509050610276731f98431c8ad98523631ae4a59f267346ea31f984826106ba565b93505050505b9392505050565b3332146102c25760405162461bcd60e51b815260206004820152600860248201526755736520454f412160c01b60448201526064015b60405180910390fd5b7f00000000000000000000000000000000000000000000000000000000000000003b63ffffffff1661032d5760405162461bcd60e51b8152602060048201526014602482015273506f6f6c20646f6573206e6f742065786973742160601b60448201526064016102b9565b5f5461033c9062015180610fe4565b42116103785760405162461bcd60e51b815260206004820152600b60248201526a4561726c79206275726e2160a81b60448201526064016102b9565b67016345785d8a00008210156103be5760405162461bcd60e51b815260206004820152600b60248201526a09ad2dc40605c62408aa8960ab1b60448201526064016102b9565b5f60326001546103ce91906110d4565b6003549091505f6103dd610699565b90505f80603260025410801561040157505f8381526004602052604090205460ff16155b156104db57846003546104149190610fe4565b9350868410156104365760405162461bcd60e51b81526004016102b9906110e7565b8660035410610467578660035f8282546104509190611114565b9091555061046090508588610fe4565b96506104aa565b848711156104a6576104798588611114565b600354106104a15761048b8588611114565b60035f82825461049b9190611114565b90915550505b6104aa565b8496505b60028054905f6104b983611127565b90915550505f838152600460205260409020805460ff19166001179055610512565b868410156104fb5760405162461bcd60e51b81526004016102b9906110e7565b8660035f82825461050c9190611114565b90915550505b61051d6064886110d4565b90506105298188611114565b91505f61053583610629565b90505f606461054583605a61113f565b61054f91906110d4565b90505f811161058a5760405162461bcd60e51b815260206004820152600760248201526604d696e203e20360cc1b60448201526064016102b9565b61059581858a61079b565b6040515f90339085908381818185875af1925050503d805f81146105d4576040519150601f19603f3d011682016040523d82523d5f602084013e6105d9565b606091505b505090508061061d5760405162461bcd60e51b815260206004820152601060248201526f2a3930b739b332b9103330b4b632b21760811b60448201526064016102b9565b50505050505050505050565b5f806106567f000000000000000000000000000000000000000000000000000000000000000060016108d7565b50905061027c818473c02aaa39b223fe8d0a0e5c4f27ead9083c756cc27f0000000000000000000000000000000000000000000000000000000000000000610b10565b5f620151805f54426106ab9190611114565b6106b591906110d4565b905090565b5f81602001516001600160a01b0316825f01516001600160a01b0316106106df575f80fd5b815160208084015160408086015181516001600160a01b0395861681860152949092168482015262ffffff90911660608085019190915281518085038201815260808501909252815191909201206001600160f81b031960a08401529085901b6001600160601b03191660a183015260b58201527fe34f199b19b2b4f47f68442619d555527d244f78a3297ea89325f843f87b8b5460d582015260f50160408051601f1981840301815291905280516020909101209392505050565b604080516101008101825273c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166020830190815261271083850190815261dead606085019081526080850187815260a0860189815260c087018b81525f60e08901908152985163414bf38960e01b8152885188166004820152955187166024870152935162ffffff1660448601529151851660648501525160848401525160a48301525160c482015292511660e48301529073e592427a0aece92de3edee1f18e0157c058615649063414bf3899085906101040160206040518083038185885af11580156108ab573d5f803e3d5ffd5b50505050506040513d601f19601f820116820180604052508101906108d09190611156565b5050505050565b5f808263ffffffff165f036109135760405162461bcd60e51b8152602060048201526002602482015261042560f41b60448201526064016102b9565b6040805160028082526060820183525f9260208301908036833701905050905083815f8151811061094657610946611181565b602002602001019063ffffffff16908163ffffffff16815250505f8160018151811061097457610974611181565b602002602001019063ffffffff16908163ffffffff16815250505f80866001600160a01b031663883bdbfd846040518263ffffffff1660e01b81526004016109bc9190611195565b5f60405180830381865afa1580156109d6573d5f803e3d5ffd5b505050506040513d5f823e601f3d908101601f191682016040526109fd91908101906112a5565b915091505f825f81518110610a1457610a14611181565b602002602001015183600181518110610a2f57610a2f611181565b6020026020010151610a419190611368565b90505f825f81518110610a5657610a56611181565b602002602001015183600181518110610a7157610a71611181565b6020026020010151610a839190611395565b9050610a9563ffffffff8916836113bc565b96505f8260060b128015610aba5750610ab463ffffffff8916836113f8565b60060b15155b15610acd5786610ac981611419565b9750505b5f610ae56001600160a01b0363ffffffff8b1661143a565b9050610b01600160201b600160c01b03602084901b168261146c565b96505050505050509250929050565b5f80610b1b86610c16565b90506001600160801b036001600160a01b03821611610ba0575f610b486001600160a01b0383168061113f565b9050836001600160a01b0316856001600160a01b031610610b8057610b7b600160c01b876001600160801b031683610f26565b610b98565b610b9881876001600160801b0316600160c01b610f26565b925050610c0d565b5f610bb96001600160a01b03831680600160401b610f26565b9050836001600160a01b0316856001600160a01b031610610bf157610bec600160801b876001600160801b031683610f26565b610c09565b610c0981876001600160801b0316600160801b610f26565b9250505b50949350505050565b5f805f8360020b12610c2b578260020b610c32565b8260020b5f035b9050620d89e8811115610c58576040516315e4079d60e11b815260040160405180910390fd5b5f816001165f03610c6d57600160801b610c7f565b6ffffcb933bd6fad37aa2d162d1a5940015b6001600160881b031690506002821615610ca9576ffff97272373d413259a46990580e213a0260801c5b6004821615610cc8576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615610ce7576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615610d06576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615610d25576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615610d44576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615610d63576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615610d83576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615610da3576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615610dc3576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615610de3576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615610e03576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615610e23576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615610e43576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615610e63576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615610e84576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615610ea4576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615610ec3576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615610ee0576b048a170391f7dc42444e8fa20260801c5b5f8460020b1315610eff57805f1981610efb57610efb6110c0565b0490505b600160201b810615610f12576001610f14565b5f5b60ff16602082901c0192505050919050565b5f80805f19858709858702925082811083820303915050805f03610f5a575f8411610f4f575f80fd5b50829004905061027c565b808411610f65575f80fd5b5f848688095f868103871696879004966002600389028118808a02820302808a02820302808a02820302808a02820302808a02820302808a02909103029181900381900460010186841190950394909402919094039290920491909117919091029150509392505050565b634e487b7160e01b5f52601160045260245ffd5b80820180821115610ff757610ff7610fd0565b92915050565b5f6020828403121561100d575f80fd5b5035919050565b6001600160a01b0381168114611028575f80fd5b50565b5f805f6060848603121561103d575f80fd5b833561104881611014565b9250602084013561105881611014565b9150604084013562ffffff8116811461106f575f80fd5b809150509250925092565b5f806040838503121561108b575f80fd5b50508035926020909101359150565b5f602082840312156110aa575f80fd5b81356001600160801b038116811461027c575f80fd5b634e487b7160e01b5f52601260045260245ffd5b5f826110e2576110e26110c0565b500490565b602080825260139082015272496e73756666696369656e742066756e64732160681b604082015260600190565b81810381811115610ff757610ff7610fd0565b5f6001820161113857611138610fd0565b5060010190565b8082028115828204841417610ff757610ff7610fd0565b5f60208284031215611166575f80fd5b5051919050565b634e487b7160e01b5f52604160045260245ffd5b634e487b7160e01b5f52603260045260245ffd5b602080825282518282018190525f9190848201906040850190845b818110156111d257835163ffffffff16835292840192918401916001016111b0565b50909695505050505050565b604051601f8201601f191681016001600160401b03811182821017156112065761120661116d565b604052919050565b5f6001600160401b038211156112265761122661116d565b5060051b60200190565b5f82601f83011261123f575f80fd5b8151602061125461124f8361120e565b6111de565b8083825260208201915060208460051b870101935086841115611275575f80fd5b602086015b8481101561129a57805161128d81611014565b835291830191830161127a565b509695505050505050565b5f80604083850312156112b6575f80fd5b82516001600160401b03808211156112cc575f80fd5b818501915085601f8301126112df575f80fd5b815160206112ef61124f8361120e565b82815260059290921b8401810191818101908984111561130d575f80fd5b948201945b838610156113395785518060060b811461132a575f80fd5b82529482019490820190611312565b91880151919650909350505080821115611351575f80fd5b5061135e85828601611230565b9150509250929050565b600682810b9082900b03667fffffffffffff198112667fffffffffffff82131715610ff757610ff7610fd0565b6001600160a01b038281168282160390808211156113b5576113b5610fd0565b5092915050565b5f8160060b8360060b806113d2576113d26110c0565b667fffffffffffff1982145f19821416156113ef576113ef610fd0565b90059392505050565b5f8260060b8061140a5761140a6110c0565b808360060b0791505092915050565b5f8160020b627fffff19810361143157611431610fd0565b5f190192915050565b6001600160c01b0382811682821681810283169291811582850482141761146357611463610fd0565b50505092915050565b5f6001600160c01b0383811680611485576114856110c0565b9216919091049291505056fea264697066735822122043b7cbc864d2a2bc0e7cf6b8e190075c230a223b9a7de607cd250c85d679014164736f6c63430008190033000000000000000000000000b2b5841dbef766d4b521221732f9b618fcf34a87000000000000000000000000783223a9851566db1a4eeba72fa1329ea3144b8d0000000000000000000000008ff4596cdad4f8b1e1efac1592a5b7b586bc5ef3000000000000000000000000ab4549f042a27ab278ecee098fe9e89a8d6594e900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000040000000000000000000000001a7d2cdb3cdacbd5f7878180a559f71d2c99fa88000000000000000000000000d5de40a4f4af13e4f56e2d27fc1ba8ae499c2d4c0000000000000000000000009f047b13bb8f80d1ac34ea6d92a881a395476edc0000000000000000000000002bb0c6dd8779ee5b58607c2ccc0b0e0eaed527dd
Deployed Bytecode
0x6080604052600436106101cd575f3560e01c80630962ef79146101d85780630ece2154146101f957806310019b3c1461023757806312ce57081461026d5780631ed6380f1461028057806328720db8146102ab5780632e17de78146102d657806337c679f7146102f55780633a5abead14610340578063436091c1146103735780634afdbdfa14610388578063572b6c051461039d5780635f5080b4146103cc578063633bf03d146103e157806368f05769146103f65780637bad72eb1461040b5780637f36ba08146104205780638796c3361461044b578063a694fc3a1461045e578063a707140b1461047d578063aabbb1bd146104a8578063ac68a748146104de578063adc0f686146104fd578063b68b5e8c14610528578063bab2f5521461055b578063bc71329014610570578063be26ed7f1461059b578063bebc9dfc146105af578063c4235ae9146105da578063ce09c18a14610605578063d4432e4e14610633578063d98de91f14610647578063db80a28c14610672578063dfcdc32f1461069d578063e3c7fa2c146106c8578063e60c90c4146106db578063ed725e8314610706578063f1b371e214610731578063f51b229414610746578063fa845ca91461075b575f80fd5b366101d457005b5f80fd5b3480156101e3575f80fd5b506101f76101f23660046123cb565b610786565b005b348015610204575f80fd5b506102246102133660046123cb565b60126020525f908152604090205481565b6040519081526020015b60405180910390f35b348015610242575f80fd5b506102246102513660046123fd565b601960209081525f928352604080842090915290825290205481565b6101f761027b3660046123fd565b6109b9565b34801561028b575f80fd5b5061022461029a366004612425565b60156020525f908152604090205481565b3480156102b6575f80fd5b506102246102c53660046123cb565b601b6020525f908152604090205481565b3480156102e1575f80fd5b506101f76102f03660046123cb565b610ca0565b348015610300575f80fd5b506103287f000000000000000000000000ab4549f042a27ab278ecee098fe9e89a8d6594e981565b6040516001600160a01b03909116815260200161022e565b34801561034b575f80fd5b506103287f000000000000000000000000aca40632c51c2a03209d2714b88aa0f1456a210181565b34801561037e575f80fd5b5061022460025481565b348015610393575f80fd5b5061022460075481565b3480156103a8575f80fd5b506103bc6103b7366004612425565b610e93565b604051901515815260200161022e565b3480156103d7575f80fd5b5061022460035481565b3480156103ec575f80fd5b5061022460085481565b348015610401575f80fd5b5061022460055481565b348015610416575f80fd5b5061022460065481565b34801561042b575f80fd5b5061022461043a3660046123cb565b600b6020525f908152604090205481565b6101f7610459366004612445565b610ec5565b348015610469575f80fd5b506101f76104783660046123cb565b610fca565b348015610488575f80fd5b50610224610497366004612425565b60116020525f908152604090205481565b3480156104b3575f80fd5b506102246104c23660046123fd565b601460209081525f928352604080842090915290825290205481565b3480156104e9575f80fd5b506101f76104f83660046123cb565b61121e565b348015610508575f80fd5b506102246105173660046123cb565b600f6020525f908152604090205481565b348015610533575f80fd5b506103287f00000000000000000000000067a2afa58ee0a32d0d33384e9fe204086d29ccfa81565b348015610566575f80fd5b5061022460015481565b34801561057b575f80fd5b5061022461058a366004612425565b600e6020525f908152604090205481565b3480156105a6575f80fd5b5061022461134d565b3480156105ba575f80fd5b506102246105c93660046123cb565b60136020525f908152604090205481565b3480156105e5575f80fd5b506102246105f43660046123cb565b60106020525f908152604090205481565b348015610610575f80fd5b506103bc61061f366004612425565b60186020525f908152604090205460ff1681565b34801561063e575f80fd5b506102245f5481565b348015610652575f80fd5b506102246106613660046123cb565b601a6020525f908152604090205481565b34801561067d575f80fd5b5061022461068c366004612425565b60176020525f908152604090205481565b3480156106a8575f80fd5b506102246106b7366004612425565b600a6020525f908152604090205481565b6101f76106d6366004612425565b6113a8565b3480156106e6575f80fd5b506102246106f5366004612425565b60166020525f908152604090205481565b348015610711575f80fd5b50610224610720366004612425565b600d6020525f908152604090205481565b34801561073c575f80fd5b5061022460045481565b348015610751575f80fd5b5061022460095481565b348015610766575f80fd5b50610224610775366004612425565b600c6020525f908152604090205481565b5f5c15610791575f80fd5b60015f5d61079d6114fa565b6001546107a981611518565b5f6107b26115f6565b90506107be8183611646565b6001600160a01b0381165f90815260156020908152604080832054600d9092528220546107eb91906124c4565b90505f81116108315760405162461bcd60e51b815260206004820152600d60248201526c513a204e6f207265776172647360981b60448201526064015b60405180910390fd5b808411156108765760405162461bcd60e51b8152602060048201526012602482015271513a2045786365656473207265776172647360701b6044820152606401610828565b6001600160a01b0382165f908152600d60205260408120805486929061089d9084906124c4565b9091555050600454600254036108c9578360055f8282546108be91906124d7565b909155506108f19050565b5f838152601060205260409020546108e29085906124c4565b5f848152601060205260409020555b604051634d24848760e11b81526001600160a01b037f000000000000000000000000aca40632c51c2a03209d2714b88aa0f1456a21011690639a49090e9061093f90859088906004016124ea565b5f604051808303815f87803b158015610956575f80fd5b505af1158015610968573d5f803e3d5ffd5b50505050816001600160a01b0316837f3300bdb359cfb956935bca32e9db727413eab1ca84341f2e36caea85bb796968866040516109a891815260200190565b60405180910390a35050505f805d50565b5f5c156109c4575f80fd5b60015f5d5f5a905069fe1c215e8f838e0000006008541115610a1d5760405162461bcd60e51b8152602060048201526012602482015271144e88115b9919d85b59481c995858da195960721b6044820152606401610828565b6064821115610a5b5760405162461bcd60e51b815260206004820152600a6024820152690513a204d6178203130360b41b6044820152606401610828565b5f8211610a955760405162461bcd60e51b8152602060048201526008602482015267513a204d696e203160c01b6044820152606401610828565b6001600160a01b0383165f9081526018602052604090205460ff16610af05760405162461bcd60e51b8152602060048201526011602482015270144e88139bdd081c9959da5cdd195c9959607a1b6044820152606401610828565b610af86114fa565b600154610b0481611518565b610b0d81611bd1565b5f610b1784611cc9565b905080341015610b5a5760405162461bcd60e51b815260206004820152600e60248201526d513a2056616c7565203c2066656560901b6044820152606401610828565b5f610b636115f6565b9050610b6f8184611646565b610b798684611646565b610b8585848884611d08565b6001546001600160a01b038083165f908152600c60205260408082208490559189168152908120919091556009805491610bbe83612503565b9190505550610bcd8284611dcf565b81341115610be857610be833610be384346124c4565b611ed7565b806001600160a01b03167ffa46cc39fc3a7bafc0f46b0272961643c81ac5016927080d397f7f0055d856fd86604051610c2391815260200190565b60405180910390a25050505f5a610c3a90836124c4565b610c46906178ac6124d7565b90505f610c53488361251b565b905080601b5f60015481526020019081526020015f205f828254610c7791906124d7565b925050819055508060085f828254610c8f91906124d7565b925050819055505050505f805d5050565b5f5c15610cab575f80fd5b60015f5d610cb76114fa565b6001545f610cc36115f6565b9050610cce82611518565b610cd88183611646565b5f8311610cf75760405162461bcd60e51b815260040161082890612532565b6001600160a01b0381165f90815260156020526040902054831115610d705760405162461bcd60e51b815260206004820152602960248201527f513a20416d6f756e742067726561746572207468616e20776974686472617761604482015268626c65207374616b6560b81b6064820152608401610828565b60045460025403610d97578260055f828254610d8c91906124d7565b90915550610dba9050565b5f8281526010602052604081208054859290610db49084906124c4565b90915550505b6001600160a01b0381165f9081526015602052604081208054859290610de19084906124c4565b90915550506001600160a01b0381165f908152600d602052604081208054859290610e0d9084906124c4565b90915550610e4790506001600160a01b037f000000000000000000000000aca40632c51c2a03209d2714b88aa0f1456a2101168285611f71565b806001600160a01b0316827f37375b03d8924bd8f076f11f8411b9962aa5c02fb489021507bc6bb6f850e36585604051610e8391815260200190565b60405180910390a350505f805d50565b7f000000000000000000000000b2b5841dbef766d4b521221732f9b618fcf34a876001600160a01b0390811691161490565b60075434811115610ed4575f80fd5b5f610edd6115f6565b6001600160a01b0381165f9081526018602052604090205490915060ff1615610f3b5760405162461bcd60e51b815260206004820152601060248201526f144e881052481c9959da5cdd195c995960821b6044820152606401610828565b6001600160a01b0381165f908152601860205260409020805460ff1916600117905534821015610f7357610f7333610be384346124c4565b610f7f82600454611dcf565b806001600160a01b03167f692d99e6f9b3cb9e93a6d75f83ec4e52e60504a0763720ab8e639060da38b932858585604051610fbc9392919061255d565b60405180910390a250505050565b5f5c15610fd5575f80fd5b60015f5d610fe16114fa565b6001545f610fed6115f6565b9050610ff882611518565b6110028183611646565b5f83116110215760405162461bcd60e51b815260040161082890612532565b600454821461107c5760405162461bcd60e51b815260206004820152602160248201527f513a204f6e6c79207374616b6520647572696e6720616374697665206379636c6044820152606560f81b6064820152608401610828565b825f8082825461108c91906124d7565b909155505f905061109e8360016124d7565b9050600454600254036110bc576002546110b99060016124d7565b90505b6001600160a01b0382165f9081526016602052604090205481148015906110fa57506001600160a01b0382165f908152601760205260409020548114155b15611175576001600160a01b0382165f90815260166020526040812054900361113c576001600160a01b0382165f908152601660205260409020819055611175565b6001600160a01b0382165f908152601760205260408120549003611175576001600160a01b0382165f9081526017602052604090208190555b6001600160a01b0382165f908152601460209081526040808320848452909152812080548692906111a79084906124d7565b909155506111e290506001600160a01b037f000000000000000000000000aca40632c51c2a03209d2714b88aa0f1456a210116833087611fc7565b816001600160a01b0316817f18dcd430020e4d4899772fd94a8b40451dc5044dfb70bc46b532eeae431c864f866040516109a891815260200190565b5f5c15611229575f80fd5b60015f5d6112356114fa565b6001545f6112416115f6565b905061124c82611518565b6112568183611646565b6001600160a01b0381165f908152600e60205260409020548061128b5760405162461bcd60e51b815260040161082890612532565b808411156112da5760405162461bcd60e51b815260206004820152601c60248201527b513a20436c61696d20616d6f756e742065786365656473206665657360201b6044820152606401610828565b6001600160a01b0382165f908152600e6020526040812080548692906113019084906124c4565b9091555061131190508285611ed7565b816001600160a01b0316837f2227733fc4c8a9034cb58087dcf6995128b9c0233b038b03366aaf30c92b92d6866040516109a891815260200190565b5f7f00000000000000000000000000000000000000000000000000000000000151806113997f0000000000000000000000000000000000000000000000000000000066548ebb426124c4565b6113a39190612594565b905090565b6004546001600160a01b0382165f9081526019602090815260408083208484529091528120546113d99034906124d7565b905067016345785d8a000081101561143d5760405162461bcd60e51b815260206004820152602160248201527f513a204d696e2e207468726573686f6c642062616c616e6365206e6f74206d656044820152601d60fa1b6064820152608401610828565b6001600160a01b0383165f9081526019602090815260408083208584529091528120805434929061146f9084906124d7565b90915550505f828152601a60205260409020548082108061148e575080155b156114a4575f838152601a602052604090208290555b6114ae3484611dcf565b60408051348152602081018590526001600160a01b0386169133917f031820cb503f016de565e43728c74cb9df7177ba8789df22781cab0a4ec10dc0910160405180910390a350505050565b5f61150361134d565b90506001548111156115155760018190555b50565b600454811461152e576002805460035560045490555b600254808211801561155a575060135f6115498360016124d7565b81526020019081526020015f20545f145b156115f25761156881611fff565b5f81815260106020908152604080832054601290925282205461159b906b1d6329f1c35ca4bfabb9f56160281b9061251b565b6115a59190612594565b90508060135f60035460016115ba91906124d7565b81526020019081526020015f20546115d291906124d7565b60135f6115e08560016124d7565b815260208101919091526040015f2055505b5050565b5f36601461160333610e93565b801561160f5750808210155b1561163e575f3661162083856124c4565b61162b9282906125b3565b611634916125da565b60601c9250505090565b339250505090565b6001600160a01b0382165f908152600c60205260409020548111801561168257506001600160a01b0382165f908152600a602052604090205415155b15611722576001600160a01b0382165f818152600c60209081526040808320548352600b825280832054600f835281842054948452600a909252822054919290916116cd919061251b565b6116d79190612594565b6001600160a01b0384165f908152600d60205260408120805492935083929091906117039084906124d7565b9091555050506001600160a01b0382165f908152600a60205260408120555b5f600254600161173291906124d7565b90506002548211801561175c57506001600160a01b0383165f908152601160205260409020548114155b1561181c576001600160a01b0383165f9081526011602090815260408083205483526013909152808220548383529120546b1d6329f1c35ca4bfabb9f56160281b916117a7916124c4565b6001600160a01b0385165f908152600d60205260409020546117c9919061251b565b6117d39190612594565b6001600160a01b0384165f908152600e60205260409020546117f591906124d7565b6001600160a01b0384165f908152600e602090815260408083209390935560119052208190555b6001600160a01b0383165f908152601660205260409020541580159061185857506001600160a01b0383165f9081526016602052604090205482115b15611bcc576001600160a01b0383165f81815260146020908152604080832060168352818420548452825280832054938352600d909152812080548392906118a19084906124d7565b90915550506001600160a01b0384165f90815260156020526040812080548392906118cd9084906124d7565b90915550506001600160a01b0384165f908152601660205260409020548211156119b0576001600160a01b0384165f9081526016602090815260408083205483526013909152808220548483529120546b1d6329f1c35ca4bfabb9f56160281b91611937916124c4565b6001600160a01b0386165f9081526014602090815260408083206016835281842054845290915290205461196b919061251b565b6119759190612594565b6001600160a01b0385165f908152600e602052604090205461199791906124d7565b6001600160a01b0385165f908152600e60205260409020555b6001600160a01b0384165f81815260146020908152604080832060168352818420805485529083528184208490559383529282905560179052205415611bca576001600160a01b0384165f90815260176020526040902054831115611b9e576001600160a01b0384165f81815260146020908152604080832060178352818420548452825280832054938352600d90915281208054839290611a539084906124d7565b90915550506001600160a01b0385165f9081526015602052604081208054839290611a7f9084906124d7565b90915550506001600160a01b0385165f90815260176020526040902054831115611b62576001600160a01b0385165f9081526017602090815260408083205483526013909152808220548583529120546b1d6329f1c35ca4bfabb9f56160281b91611ae9916124c4565b6001600160a01b0387165f90815260146020908152604080832060178352818420548452909152902054611b1d919061251b565b611b279190612594565b6001600160a01b0386165f908152600e6020526040902054611b4991906124d7565b6001600160a01b0386165f908152600e60205260409020555b506001600160a01b0384165f81815260146020908152604080832060178084528285208054865291845291842084905593835290529055611bca565b6001600160a01b0384165f90815260176020818152604080842080546016845291852091909155919052555b505b505050565b600454811461151557611be26120a4565b60048190555f600981905560025481526010602052604080822054838352908220805491929091611c149084906124d7565b90915550505f5415611c49575f8054828252601060205260408220805491929091611c409084906124d7565b90915550505f80555b60055415611c7b576005545f8281526010602052604081208054909190611c719084906124c4565b90915550505f6005555b807f2ee63a65823306caa71f76a6f1fbc130f9932419aca12e4bc61488794c0fe84260105f8481526020019081526020015f2054604051611cbe91815260200190565b60405180910390a250565b5f6103e86009546103e8611cdd91906124d7565b611cee84662386f26fc1000061251b565b611cf8919061251b565b611d029190612594565b92915050565b5f611d1383856120fb565b90506001811115611d2b57611d28818661251b565b94505b611d3685606461251b565b5f858152600b602052604081208054909190611d539084906124d7565b90915550611d64905085605f61251b565b6001600160a01b0383165f908152600a602052604081208054909190611d8b9084906124d7565b90915550611d9c905085600561251b565b6001600160a01b0384165f908152600a602052604081208054909190611dc39084906124d7565b90915550505050505050565b6064611ddc83604661251b565b611de69190612594565b5f8281526012602052604081208054909190611e039084906124d7565b90915550611e4590507f000000000000000000000000ab4549f042a27ab278ecee098fe9e89a8d6594e96103e8611e3b85600261251b565b610be39190612594565b611e777f000000000000000000000000783223a9851566db1a4eeba72fa1329ea3144b8d6103e8611e3b85602661251b565b611ea67f0000000000000000000000008ff4596cdad4f8b1e1efac1592a5b7b586bc5ef3610be3606485612594565b6115f27f00000000000000000000000067a2afa58ee0a32d0d33384e9fe204086d29ccfa6064611e3b85601961251b565b5f826001600160a01b0316826040515f6040518083038185875af1925050503d805f8114611f20576040519150601f19603f3d011682016040523d82523d5f602084013e611f25565b606091505b5050905080611bcc5760405162461bcd60e51b8152602060048201526018602482015277144e8811985a5b1959081d1bc81cd95b9908185b5bdd5b9d60421b6044820152606401610828565b611bcc8363a9059cbb60e01b8484604051602401611f909291906124ea565b60408051601f198184030181529190526020810180516001600160e01b03166001600160e01b03199093169290921790915261216e565b6040516001600160a01b0380851660248301528316604482015260648101829052611bca9085906323b872dd60e01b90608401611f90565b6006545f828152601b6020526040812054909160c89161201f919061251b565b6120299190612594565b5f838152601b602052604090205461204290606461251b565b61204c91906124c4565b5f838152600f60209081526040808320849055601090915281208054929350839290919061207b9084906124d7565b9091555050600654614e1f11156115f25760068054905f61209b83612503565b91905055505050565b674563918244f4000060075411156120f9575f6127246007546127106120ca919061251b565b6120d49190612594565b9050674563918244f400008110156120f557674563918244f4000060075550565b6007555b565b6002546001600160a01b0383165f908152601960209081526040808320848452909152812054909190801580159061213257508315155b15612161575f828152601a602052604090205461215082600261251b565b61215a9190612594565b9250612166565b600192505b505092915050565b5f6121c2826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166122419092919063ffffffff16565b905080515f14806121e25750808060200190518101906121e29190612608565b611bcc5760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e6044820152691bdd081cdd58d8d9595960b21b6064820152608401610828565b606061224f84845f85612257565b949350505050565b6060824710156122b85760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f6044820152651c8818d85b1b60d21b6064820152608401610828565b5f80866001600160a01b031685876040516122d39190612627565b5f6040518083038185875af1925050503d805f811461230d576040519150601f19603f3d011682016040523d82523d5f602084013e612312565b606091505b50915091506123238783838761232e565b979650505050505050565b6060831561239c5782515f03612395576001600160a01b0385163b6123955760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e74726163740000006044820152606401610828565b508161224f565b61224f83838151156123b15781518083602001fd5b8060405162461bcd60e51b8152600401610828919061263d565b5f602082840312156123db575f80fd5b5035919050565b80356001600160a01b03811681146123f8575f80fd5b919050565b5f806040838503121561240e575f80fd5b612417836123e2565b946020939093013593505050565b5f60208284031215612435575f80fd5b61243e826123e2565b9392505050565b5f8060208385031215612456575f80fd5b82356001600160401b038082111561246c575f80fd5b818501915085601f83011261247f575f80fd5b81358181111561248d575f80fd5b86602082850101111561249e575f80fd5b60209290920196919550909350505050565b634e487b7160e01b5f52601160045260245ffd5b81810381811115611d0257611d026124b0565b80820180821115611d0257611d026124b0565b6001600160a01b03929092168252602082015260400190565b5f60018201612514576125146124b0565b5060010190565b8082028115828204841417611d0257611d026124b0565b602080825260119082015270513a20416d6f756e74206973207a65726f60781b604082015260600190565b60408152826040820152828460608301375f606084830101525f6060601f19601f8601168301019050826020830152949350505050565b5f826125ae57634e487b7160e01b5f52601260045260245ffd5b500490565b5f80858511156125c1575f80fd5b838611156125cd575f80fd5b5050820193919092039150565b6001600160601b031981358181169160148510156121665760149490940360031b84901b1690921692915050565b5f60208284031215612618575f80fd5b8151801515811461243e575f80fd5b5f82518060208501845e5f920191825250919050565b602081525f82518060208401528060208501604085015e5f604082850101526040601f19601f8301168401019150509291505056fea264697066735822122085460eab68e9de9774f82431c6f4ebc1f46dc8465fa59728222a7158bd1a8d4964736f6c63430008190033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000b2b5841dbef766d4b521221732f9b618fcf34a87000000000000000000000000783223a9851566db1a4eeba72fa1329ea3144b8d0000000000000000000000008ff4596cdad4f8b1e1efac1592a5b7b586bc5ef3000000000000000000000000ab4549f042a27ab278ecee098fe9e89a8d6594e900000000000000000000000000000000000000000000000000000000000000a000000000000000000000000000000000000000000000000000000000000000040000000000000000000000001a7d2cdb3cdacbd5f7878180a559f71d2c99fa88000000000000000000000000d5de40a4f4af13e4f56e2d27fc1ba8ae499c2d4c0000000000000000000000009f047b13bb8f80d1ac34ea6d92a881a395476edc0000000000000000000000002bb0c6dd8779ee5b58607c2ccc0b0e0eaed527dd
-----Decoded View---------------
Arg [0] : forwarder (address): 0xB2b5841DBeF766d4b521221732F9B618fCf34A87
Arg [1] : _devFee (address): 0x783223a9851566db1a4EEBa72Fa1329Ea3144B8d
Arg [2] : _dxnBuyAndBurn (address): 0x8ff4596Cdad4F8B1e1eFaC1592a5B7b586BC5eF3
Arg [3] : _nxdDSV (address): 0xAB4549F042A27Ab278eceE098Fe9E89a8d6594E9
Arg [4] : AIRegisteredAddresses (address[]): 0x1a7D2Cdb3CDaCBD5F7878180a559F71d2c99fA88,0xd5De40a4f4af13E4f56e2D27FC1ba8AE499C2D4c,0x9F047b13bB8F80D1ac34EA6d92A881A395476EDC,0x2BB0c6dd8779EE5B58607C2ccc0B0e0EAeD527DD
-----Encoded View---------------
10 Constructor Arguments found :
Arg [0] : 000000000000000000000000b2b5841dbef766d4b521221732f9b618fcf34a87
Arg [1] : 000000000000000000000000783223a9851566db1a4eeba72fa1329ea3144b8d
Arg [2] : 0000000000000000000000008ff4596cdad4f8b1e1efac1592a5b7b586bc5ef3
Arg [3] : 000000000000000000000000ab4549f042a27ab278ecee098fe9e89a8d6594e9
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000004
Arg [6] : 0000000000000000000000001a7d2cdb3cdacbd5f7878180a559f71d2c99fa88
Arg [7] : 000000000000000000000000d5de40a4f4af13e4f56e2d27fc1ba8ae499c2d4c
Arg [8] : 0000000000000000000000009f047b13bb8f80d1ac34ea6d92a881a395476edc
Arg [9] : 0000000000000000000000002bb0c6dd8779ee5b58607c2ccc0b0e0eaed527dd
Deployed Bytecode Sourcemap
146969:26664:0:-:0;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;158927:878;;;;;;;;;;-1:-1:-1;158927:878:0;;;;;:::i;:::-;;:::i;:::-;;150954:51;;;;;;;;;;-1:-1:-1;150954:51:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;345:25:1;;;333:2;318:18;150954:51:0;;;;;;;;152066:77;;;;;;;;;;-1:-1:-1;152066:77:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;156731:1306;;;;;;:::i;:::-;;:::i;151412:55::-;;;;;;;;;;-1:-1:-1;151412:55:0;;;;;:::i;:::-;;;;;;;;;;;;;;152384;;;;;;;;;;-1:-1:-1;152384:55:0;;;;;:::i;:::-;;;;;;;;;;;;;;162335:864;;;;;;;;;;-1:-1:-1;162335:864:0;;;;;:::i;:::-;;:::i;149397:31::-;;;;;;;;;;;;;;;;;;-1:-1:-1;;;;;1173:32:1;;;1155:51;;1143:2;1128:18;149397:31:0;1009:203:1;149524:30:0;;;;;;;;;;;;;;;147938:31;;;;;;;;;;;;;;;;148621:37;;;;;;;;;;;;;;;;145666:138;;;;;;;;;;-1:-1:-1;145666:138:0;;;;;:::i;:::-;;:::i;:::-;;;1605:14:1;;1598:22;1580:41;;1568:2;1553:18;145666:138:0;1440:187:1;148063:35:0;;;;;;;;;;;;;;;;148752:32;;;;;;;;;;;;;;;;148367:37;;;;;;;;;;;;;;;;148504:34;;;;;;;;;;;;;;;;149899:52;;;;;;;;;;-1:-1:-1;149899:52:0;;;;;:::i;:::-;;;;;;;;;;;;;;158167:599;;;;;;:::i;:::-;;:::i;160883:1161::-;;;;;;;;;;-1:-1:-1;160883:1161:0;;;;;:::i;:::-;;:::i;150822:53::-;;;;;;;;;;-1:-1:-1;150822:53:0;;;;;:::i;:::-;;;;;;;;;;;;;;151261:68;;;;;;;;;;-1:-1:-1;151261:68:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;159894:633;;;;;;;;;;-1:-1:-1;159894:633:0;;;;;:::i;:::-;;:::i;150422:49::-;;;;;;;;;;-1:-1:-1;150422:49:0;;;;;:::i;:::-;;;;;;;;;;;;;;149270:36;;;;;;;;;;;;;;;147815:27;;;;;;;;;;;;;;;;150297:49;;;;;;;;;;-1:-1:-1;150297:49:0;;;;;:::i;:::-;;;;;;;;;;;;;;163296:140;;;;;;;;;;;;;:::i;151105:58::-;;;;;;;;;;-1:-1:-1;151105:58:0;;;;;:::i;:::-;;;;;;;;;;;;;;150676:52;;;;;;;;;;-1:-1:-1;150676:52:0;;;;;:::i;:::-;;;;;;;;;;;;;;151924:51;;;;;;;;;;-1:-1:-1;151924:51:0;;;;;:::i;:::-;;;;;;;;;;;;;;;;147549:27;;;;;;;;;;;;;;;;152231:53;;;;;;;;;;-1:-1:-1;152231:53:0;;;;;:::i;:::-;;;;;;;;;;;;;;151789:49;;;;;;;;;;-1:-1:-1;151789:49:0;;;;;:::i;:::-;;;;;;;;;;;;;;149751:50;;;;;;;;;;-1:-1:-1;149751:50:0;;;;;:::i;:::-;;;;;;;;;;;;;;165607:753;;;;;;:::i;:::-;;:::i;151574:48::-;;;;;;;;;;-1:-1:-1;151574:48:0;;;;;:::i;:::-;;;;;;;;;;;;;;150176:45;;;;;;;;;;-1:-1:-1;150176:45:0;;;;;:::i;:::-;;;;;;;;;;;;;;148194:34;;;;;;;;;;;;;;;;148894:32;;;;;;;;;;;;;;;;150033:50;;;;;;;;;;-1:-1:-1;150033:50:0;;;;;:::i;:::-;;;;;;;;;;;;;;158927:878;154438:1;154432:8;154429:28;;;154438:1;;154443:12;154429:28;154481:1;154438;154471:12;159028:16:::1;:14;:16::i;:::-;159081:12;::::0;159106:25:::1;159081:12:::0;159106:8:::1;:25::i;:::-;159144:12;159159;:10;:12::i;:::-;159144:27;;159182:34;159194:4;159200:15;159182:11;:34::i;:::-;-1:-1:-1::0;;;;;159265:26:0;::::1;159229:14;159265:26:::0;;;:20:::1;:26;::::0;;;;;;;;159246:10:::1;:16:::0;;;;;;:45:::1;::::0;159265:26;159246:45:::1;:::i;:::-;159229:62;;159319:1;159310:6;:10;159302:36;;;::::0;-1:-1:-1;;;159302:36:0;;2696:2:1;159302:36:0::1;::::0;::::1;2678:21:1::0;2735:2;2715:18;;;2708:30;-1:-1:-1;;;2754:18:1;;;2747:43;2807:18;;159302:36:0::1;;;;;;;;;159372:6;159357:11;:21;;159349:52;;;::::0;-1:-1:-1;;;159349:52:0;;3038:2:1;159349:52:0::1;::::0;::::1;3020:21:1::0;3077:2;3057:18;;;3050:30;-1:-1:-1;;;3096:18:1;;;3089:48;3154:18;;159349:52:0::1;2836:342:1::0;159349:52:0::1;-1:-1:-1::0;;;;;159414:16:0;::::1;;::::0;;;:10:::1;:16;::::0;;;;:31;;159434:11;;159414:16;:31:::1;::::0;159434:11;;159414:31:::1;:::i;:::-;::::0;;;-1:-1:-1;;159480:19:0::1;::::0;159460:16:::1;::::0;:39;159456:227:::1;;159542:11;159516:22;;:37;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;159456:227:0::1;::::0;-1:-1:-1;159456:227:0::1;;159623:34;::::0;;;:17:::1;:34;::::0;;;;;:48:::1;::::0;159660:11;;159623:48:::1;:::i;:::-;159586:34;::::0;;;:17:::1;:34;::::0;;;;:85;159456:227:::1;159695:36;::::0;-1:-1:-1;;;159695:36:0;;-1:-1:-1;;;;;159695:6:0::1;:17;::::0;::::1;::::0;:36:::1;::::0;159713:4;;159719:11;;159695:36:::1;;;:::i;:::-;;;;;;;;;;;;;;;;;;::::0;::::1;;;;;;;;;;;;::::0;::::1;;;;;;;;;159779:4;-1:-1:-1::0;;;;;159747:50:0::1;159762:15;159747:50;159785:11;159747:50;;;;345:25:1::0;;333:2;318:18;;199:177;159747:50:0::1;;;;;;;;159017:788;;;154704:1:::0;;154694:12;158927:878;:::o;156731:1306::-;154438:1;154432:8;154429:28;;;154438:1;;154443:12;154429:28;154481:1;154438;154471:12;154962:16:::1;154981:9;154962:28;;156944:15:::2;156923:17;;:36;;156915:67;;;::::0;-1:-1:-1;;;156915:67:0;;3794:2:1;156915:67:0::2;::::0;::::2;3776:21:1::0;3833:2;3813:18;;;3806:30;-1:-1:-1;;;3852:18:1;;;3845:48;3910:18;;156915:67:0::2;3592:342:1::0;156915:67:0::2;157020:3;157001:15;:22;;156993:45;;;::::0;-1:-1:-1;;;156993:45:0;;4141:2:1;156993:45:0::2;::::0;::::2;4123:21:1::0;4180:2;4160:18;;;4153:30;-1:-1:-1;;;4199:18:1;;;4192:40;4249:18;;156993:45:0::2;3939:334:1::0;156993:45:0::2;157075:1;157057:15;:19;157049:40;;;::::0;-1:-1:-1;;;157049:40:0;;4480:2:1;157049:40:0::2;::::0;::::2;4462:21:1::0;4519:1;4499:18;;;4492:29;-1:-1:-1;;;4537:18:1;;;4530:38;4585:18;;157049:40:0::2;4278:331:1::0;157049:40:0::2;-1:-1:-1::0;;;;;157110:28:0;::::2;;::::0;;;:19:::2;:28;::::0;;;;;::::2;;157102:58;;;::::0;-1:-1:-1;;;157102:58:0;;4816:2:1;157102:58:0::2;::::0;::::2;4798:21:1::0;4855:2;4835:18;;;4828:30;-1:-1:-1;;;4874:18:1;;;4867:47;4931:18;;157102:58:0::2;4614:341:1::0;157102:58:0::2;157173:16;:14;:16::i;:::-;157226:12;::::0;157251:25:::2;157226:12:::0;157251:8:::2;:25::i;:::-;157287:30;157301:15;157287:13;:30::i;:::-;157330:19;157352:37;157373:15;157352:20;:37::i;:::-;157330:59;;157421:11;157408:9;:24;;157400:51;;;::::0;-1:-1:-1;;;157400:51:0;;5162:2:1;157400:51:0::2;::::0;::::2;5144:21:1::0;5201:2;5181:18;;;5174:30;-1:-1:-1;;;5220:18:1;;;5213:44;5274:18;;157400:51:0::2;4960:338:1::0;157400:51:0::2;157464:12;157479;:10;:12::i;:::-;157464:27;;157502:34;157514:4;157520:15;157502:11;:34::i;:::-;157547:37;157559:7;157568:15;157547:11;:37::i;:::-;157597:70;157619:15;157636;157653:7;157662:4;157597:21;:70::i;:::-;157704:12;::::0;-1:-1:-1;;;;;157680:21:0;;::::2;;::::0;;;:15:::2;:21;::::0;;;;;:36;;;157727:24;;::::2;::::0;;;;;:39;;;;157779:17:::2;:19:::0;;;::::2;::::0;::::2;:::i;:::-;;;;;;157811:44;157826:11;157839:15;157811:14;:44::i;:::-;157883:11;157871:9;:23;157868:113;;;157912:57;157932:10;157945:23;157957:11:::0;157945:9:::2;:23;:::i;:::-;157912:11;:57::i;:::-;158007:4;-1:-1:-1::0;;;;;157996:33:0::2;;158013:15;157996:33;;;;345:25:1::0;;333:2;318:18;;199:177;157996:33:0::2;;;;;;;;156904:1133;;;155013:19:::1;155046:9;155035:20;::::0;:8;:20:::1;:::i;:::-;:28;::::0;155058:5:::1;155035:28;:::i;:::-;155013:50:::0;-1:-1:-1;155074:20:0::1;155097:27;155111:13;155013:50:::0;155097:27:::1;:::i;:::-;155074:50;;155175:12;155137:20;:34;155158:12;;155137:34;;;;;;;;;;;;:50;;;;;;;:::i;:::-;;;;;;;;155219:12;155198:17;;:33;;;;;;;:::i;:::-;;;;;;;;154951:288;;;154704:1:::0;;154694:12;156731:1306;;:::o;162335:864::-;154438:1;154432:8;154429:28;;;154438:1;;154443:12;154429:28;154481:1;154438;154471:12;162426:16:::1;:14;:16::i;:::-;162479:12;::::0;162453:23:::1;162517:12;:10;:12::i;:::-;162502:27;;162542:25;162551:15;162542:8;:25::i;:::-;162578:34;162590:4;162596:15;162578:11;:34::i;:::-;162650:1;162641:6;:10;162633:40;;;;-1:-1:-1::0;;;162633:40:0::1;;;;;;;:::i;:::-;-1:-1:-1::0;;;;;162716:26:0;::::1;;::::0;;;:20:::1;:26;::::0;;;;;162706:36;::::1;;162684:127;;;::::0;-1:-1:-1;;;162684:127:0;;6164:2:1;162684:127:0::1;::::0;::::1;6146:21:1::0;6203:2;6183:18;;;6176:30;6242:34;6222:18;;;6215:62;-1:-1:-1;;;6293:18:1;;;6286:39;6342:19;;162684:127:0::1;5962:405:1::0;162684:127:0::1;162848:19;;162828:16;;:39:::0;162824:181:::1;;162910:6;162884:22;;:32;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;162824:181:0::1;::::0;-1:-1:-1;162824:181:0::1;;162949:34;::::0;;;:17:::1;:34;::::0;;;;:44;;162987:6;;162949:34;:44:::1;::::0;162987:6;;162949:44:::1;:::i;:::-;::::0;;;-1:-1:-1;;162824:181:0::1;-1:-1:-1::0;;;;;163017:26:0;::::1;;::::0;;;:20:::1;:26;::::0;;;;:36;;163047:6;;163017:26;:36:::1;::::0;163047:6;;163017:36:::1;:::i;:::-;::::0;;;-1:-1:-1;;;;;;;163064:16:0;::::1;;::::0;;;:10:::1;:16;::::0;;;;:26;;163084:6;;163064:16;:26:::1;::::0;163084:6;;163064:26:::1;:::i;:::-;::::0;;;-1:-1:-1;163103:33:0::1;::::0;-1:-1:-1;;;;;;163103:6:0::1;:19;163123:4:::0;163129:6;163103:19:::1;:33::i;:::-;163178:4;-1:-1:-1::0;;;;;163152:39:0::1;163161:15;163152:39;163184:6;163152:39;;;;345:25:1::0;;333:2;318:18;;199:177;163152:39:0::1;;;;;;;;162415:784;;154704:1:::0;;154694:12;162335:864;:::o;145666:138::-;145779:17;-1:-1:-1;;;;;145766:30:0;;;;;;;145666:138::o;158167:599::-;158268:22;;158309:9;:28;-1:-1:-1;158309:28:0;158301:37;;;;;;158351:15;158369:12;:10;:12::i;:::-;-1:-1:-1;;;;;158401:28:0;;;;;;:19;:28;;;;;;158351:30;;-1:-1:-1;158401:28:0;;158400:29;158392:58;;;;-1:-1:-1;;;158392:58:0;;6574:2:1;158392:58:0;;;6556:21:1;6613:2;6593:18;;;6586:30;-1:-1:-1;;;6632:18:1;;;6625:46;6688:18;;158392:58:0;6372:340:1;158392:58:0;-1:-1:-1;;;;;158463:28:0;;;;;;:19;:28;;;;;:35;;-1:-1:-1;;158463:35:0;158494:4;158463:35;;;158514:9;:27;-1:-1:-1;158511:120:0;;;158558:61;158578:10;158591:27;158603:15;158591:9;:27;:::i;158558:61::-;158643:52;158658:15;158675:19;;158643:14;:52::i;:::-;158727:7;-1:-1:-1;;;;;158711:47:0;;158736:4;;158742:15;158711:47;;;;;;;;:::i;:::-;;;;;;;;158231:535;;158167:599;;:::o;160883:1161::-;154438:1;154432:8;154429:28;;;154438:1;;154443:12;154429:28;154481:1;154438;154471:12;160972:16:::1;:14;:16::i;:::-;161025:12;::::0;160999:23:::1;161063:12;:10;:12::i;:::-;161048:27;;161088:25;161097:15;161088:8;:25::i;:::-;161124:34;161136:4;161142:15;161124:11;:34::i;:::-;161188:1;161179:6;:10;161171:40;;;;-1:-1:-1::0;;;161171:40:0::1;;;;;;;:::i;:::-;161249:19;;161230:15;:38;161222:84;;;::::0;-1:-1:-1;;;161222:84:0;;7387:2:1;161222:84:0::1;::::0;::::1;7369:21:1::0;7426:2;7406:18;;;7399:30;7465:34;7445:18;;;7438:62;-1:-1:-1;;;7516:18:1;;;7509:31;7557:19;;161222:84:0::1;7185:397:1::0;161222:84:0::1;161335:6;161319:12;::::0;:22:::1;;;;;;;:::i;:::-;::::0;;;-1:-1:-1;161354:18:0::1;::::0;-1:-1:-1;161375:19:0::1;:15:::0;161393:1:::1;161375:19;:::i;:::-;161354:40;;161429:19;;161409:16;;:39:::0;161405:105:::1;;161478:16;::::0;:20:::1;::::0;161497:1:::1;161478:20;:::i;:::-;161465:33;;161405:105;-1:-1:-1::0;;;;;161555:19:0;::::1;;::::0;;;:13:::1;:19;::::0;;;;;161541:33;::::1;::::0;::::1;::::0;:88:::1;;-1:-1:-1::0;;;;;;161609:20:0;::::1;;::::0;;;:14:::1;:20;::::0;;;;;161595:34;::::1;;161541:88;161522:348;;;-1:-1:-1::0;;;;;161661:19:0;::::1;;::::0;;;:13:::1;:19;::::0;;;;;:24;;161657:202:::1;;-1:-1:-1::0;;;;;161706:19:0;::::1;;::::0;;;:13:::1;:19;::::0;;;;:32;;;161657:202:::1;;;-1:-1:-1::0;;;;;161764:20:0;::::1;;::::0;;;:14:::1;:20;::::0;;;;;:25;;161760:99:::1;;-1:-1:-1::0;;;;;161810:20:0;::::1;;::::0;;;:14:::1;:20;::::0;;;;:33;;;161760:99:::1;-1:-1:-1::0;;;;;161882:19:0;::::1;;::::0;;;:13:::1;:19;::::0;;;;;;;:31;;;;;;;;:41;;161917:6;;161882:19;:41:::1;::::0;161917:6;;161882:41:::1;:::i;:::-;::::0;;;-1:-1:-1;161936:52:0::1;::::0;-1:-1:-1;;;;;;161936:6:0::1;:23;161960:4:::0;161974::::1;161981:6:::0;161936:23:::1;:52::i;:::-;162023:4;-1:-1:-1::0;;;;;162004:32:0::1;162011:10;162004:32;162029:6;162004:32;;;;345:25:1::0;;333:2;318:18;;199:177;159894:633:0;154438:1;154432:8;154429:28;;;154438:1;;154443:12;154429:28;154481:1;154438;154471:12;159992:16:::1;:14;:16::i;:::-;160045:12;::::0;160019:23:::1;160083:12;:10;:12::i;:::-;160068:27;;160108:25;160117:15;160108:8;:25::i;:::-;160144:34;160156:4;160162:15;160144:11;:34::i;:::-;-1:-1:-1::0;;;;;160206:20:0;::::1;160191:12;160206:20:::0;;;:14:::1;:20;::::0;;;;;160245:8;160237:38:::1;;;;-1:-1:-1::0;;;160237:38:0::1;;;;;;;:::i;:::-;160309:4;160294:11;:19;;160286:60;;;::::0;-1:-1:-1;;;160286:60:0;;7789:2:1;160286:60:0::1;::::0;::::1;7771:21:1::0;7828:2;7808:18;;;7801:30;-1:-1:-1;;;7847:18:1;;;7840:58;7915:18;;160286:60:0::1;7587:352:1::0;160286:60:0::1;-1:-1:-1::0;;;;;160359:20:0;::::1;;::::0;;;:14:::1;:20;::::0;;;;:35;;160383:11;;160359:20;:35:::1;::::0;160383:11;;160359:35:::1;:::i;:::-;::::0;;;-1:-1:-1;160407:39:0::1;::::0;-1:-1:-1;160427:4:0;160434:11;160407::::1;:39::i;:::-;160501:4;-1:-1:-1::0;;;;;160472:47:0::1;160484:15;160472:47;160507:11;160472:47;;;;345:25:1::0;;333:2;318:18;;199:177;163296:140:0;163344:7;163412:16;163372:36;163390:18;163372:15;:36;:::i;:::-;163371:57;;;;:::i;:::-;163364:64;;163296:140;:::o;165607:753::-;165696:19;;-1:-1:-1;;;;;165760:31:0;;165680:13;165760:31;;;:22;:31;;;;;;;;:38;;;;;;;;;:50;;165801:9;;165760:50;:::i;:::-;165726:84;;165858:9;165831:23;:36;;165823:82;;;;-1:-1:-1;;;165823:82:0;;8368:2:1;165823:82:0;;;8350:21:1;8407:2;8387:18;;;8380:30;8446:34;8426:18;;;8419:62;-1:-1:-1;;;8497:18:1;;;8490:31;8538:19;;165823:82:0;8166:397:1;165823:82:0;-1:-1:-1;;;;;165918:31:0;;;;;;:22;:31;;;;;;;;:38;;;;;;;;:51;;165960:9;;165918:31;:51;;165960:9;;165918:51;:::i;:::-;;;;-1:-1:-1;;165982:33:0;166018:25;;;:18;:25;;;;;;166057:51;;;;:98;;-1:-1:-1;166125:30:0;;166057:98;166054:181;;;166172:25;;;;:18;:25;;;;;:51;;;166054:181;166247:32;166262:9;166273:5;166247:14;:32::i;:::-;166297:55;;;166335:9;8742:25:1;;8798:2;8783:18;;8776:34;;;-1:-1:-1;;;;;166297:55:0;;;166314:10;;166297:55;;8715:18:1;166297:55:0;;;;;;;165669:691;;;165607:753;:::o;167001:220::-;167047:23;167073:17;:15;:17::i;:::-;167047:43;;167133:12;;167115:15;:30;167111:93;;;167162:12;:30;;;167111:93;167036:185;167001:220::o;167325:788::-;167391:19;;167382:5;:28;167378:153;;167450:16;;;167427:20;:39;167500:19;;167481:38;;167378:153;167573:16;;167620:27;;;:97;;;;-1:-1:-1;167664:23:0;:48;167688:23;:19;167710:1;167688:23;:::i;:::-;167664:48;;;;;;;;;;;;167716:1;167664:53;167620:97;167602:504;;;167744:41;167765:19;167744:20;:41::i;:::-;167814:19;167913:38;;;:17;:38;;;;;;;;;167837:16;:37;;;;;;:54;;-1:-1:-1;;;147169:4:0;167837:54;:::i;:::-;167836:115;;;;:::i;:::-;167814:137;;168083:11;168031:23;:49;168055:20;;168078:1;168055:24;;;;:::i;:::-;168031:49;;;;;;;;;;;;:63;;;;:::i;:::-;167980:23;:48;168004:23;:19;168026:1;168004:23;:::i;:::-;167980:48;;;;;;;;;;;-1:-1:-1;167980:48:0;:114;-1:-1:-1;167602:504:0;167367:746;167325:788;:::o;145812:437::-;145874:7;145919:8;146886:2;146012:30;146031:10;146012:18;:30::i;:::-;:71;;;;;146064:19;146046:14;:37;;146012:71;146008:234;;;146123:8;;146132:36;146149:19;146132:14;:36;:::i;:::-;146123:47;;;;;:::i;:::-;146115:56;;;:::i;:::-;146107:65;;146100:72;;;;145812:437;:::o;146008:234::-;127457:10;146205:25;;;;145812:437;:::o;169850:3404::-;-1:-1:-1;;;;;169951:24:0;;;;;;:15;:24;;;;;;169943:32;;:79;;;;-1:-1:-1;;;;;;169993:24:0;;;;;;:15;:24;;;;;;:29;;169943:79;169924:404;;;-1:-1:-1;;;;;170190:24:0;;170051:26;170190:24;;;:15;:24;;;;;;;;;170172:43;;:17;:43;;;;;;170109:14;:40;;;;;;170082:24;;;:15;:24;;;;;;170051:26;;170172:43;;170082:67;;170109:40;170082:67;:::i;:::-;170081:134;;;;:::i;:::-;-1:-1:-1;;;;;170231:19:0;;;;;;:10;:19;;;;;:41;;170051:165;;-1:-1:-1;170051:165:0;;170231:19;;;:41;;170051:165;;170231:41;:::i;:::-;;;;-1:-1:-1;;;;;;;;170288:24:0;;170315:1;170288:24;;;:15;:24;;;;;:28;169924:404;170340:31;170374:16;;170393:1;170374:20;;;;:::i;:::-;170340:54;;170431:16;;170423:5;:24;:95;;;;-1:-1:-1;;;;;;170464:27:0;;;;;;:18;:27;;;;;;:54;;;170423:95;170405:615;;;-1:-1:-1;;;;;170809:27:0;;170785:52;170809:27;;;:18;:27;;;;;;;;;170785:52;;:23;:52;;;;;;;170704:48;;;;;;-1:-1:-1;;;147169:4:0;170704:133;;;:::i;:::-;-1:-1:-1;;;;;170655:19:0;;;;;;:10;:19;;;;;;:209;;;;:::i;:::-;170631:309;;;;:::i;:::-;-1:-1:-1;;;;;170588:23:0;;;;;;:14;:23;;;;;;:352;;;;:::i;:::-;-1:-1:-1;;;;;170545:23:0;;;;;;:14;:23;;;;;;;;:395;;;;170955:18;:27;;;:53;;;170405:615;-1:-1:-1;;;;;171050:22:0;;;;;;:13;:22;;;;;;:27;;;;:74;;-1:-1:-1;;;;;;171102:22:0;;;;;;:13;:22;;;;;;171094:30;;171050:74;171032:2215;;;-1:-1:-1;;;;;171180:22:0;;171151:26;171180:22;;;:13;:22;;;;;;;;171203:13;:22;;;;;;171180:46;;;;;;;;171243:19;;;:10;:19;;;;;:41;;171180:46;;171151:26;171243:41;;171180:46;;171243:41;:::i;:::-;;;;-1:-1:-1;;;;;;;171299:29:0;;;;;;:20;:29;;;;;:51;;171332:18;;171299:29;:51;;171332:18;;171299:51;:::i;:::-;;;;-1:-1:-1;;;;;;;171395:22:0;;;;;;:13;:22;;;;;;171369:48;;171365:491;;;-1:-1:-1;;;;;171713:22:0;;171689:47;171713:22;;;:13;:22;;;;;;;;;171689:47;;:23;:47;;;;;;;171608:48;;;;;;-1:-1:-1;;;147169:4:0;171608:128;;;:::i;:::-;-1:-1:-1;;;;;171532:22:0;;;;;;:13;:22;;;;;;;;171555:13;:22;;;;;;171532:46;;;;;;;;:231;;;;:::i;:::-;171508:332;;;;:::i;:::-;-1:-1:-1;;;;;171464:23:0;;;;;;:14;:23;;;;;;:376;;;;:::i;:::-;-1:-1:-1;;;;;171438:23:0;;;;;;:14;:23;;;;;:402;171365:491;-1:-1:-1;;;;;171872:22:0;;171921:1;171872:22;;;:13;:22;;;;;;;;171895:13;:22;;;;;;;171872:46;;;;;;;;:50;;;171937:22;;;:26;;;;171984:14;:23;;;;:28;171980:1256;;-1:-1:-1;;;;;172045:23:0;;;;;;:14;:23;;;;;;172037:31;;172033:1188;;;-1:-1:-1;;;;;172123:22:0;;172093:27;172123:22;;;:13;:22;;;;;;;;172146:14;:23;;;;;;172123:47;;;;;;;;172193:19;;;:10;:19;;;;;:42;;172123:47;;172093:27;172193:42;;172123:47;;172193:42;:::i;:::-;;;;-1:-1:-1;;;;;;;172258:29:0;;;;;;:20;:29;;;;;:52;;172291:19;;172258:29;:52;;172291:19;;172258:52;:::i;:::-;;;;-1:-1:-1;;;;;;;172385:23:0;;;;;;:14;:23;;;;;;172359:49;;172355:574;;;-1:-1:-1;;;;;172745:23:0;;172721:48;172745:23;;;:14;:23;;;;;;;;;172721:48;;:23;:48;;;;;;;172632;;;;;;-1:-1:-1;;;147169:4:0;172632:137;;;:::i;:::-;-1:-1:-1;;;;;172547:22:0;;;;;;:13;:22;;;;;;;;172570:14;:23;;;;;;172547:47;;;;;;;;:257;;;;:::i;:::-;172515:390;;;;:::i;:::-;-1:-1:-1;;;;;172463:23:0;;;;;;:14;:23;;;;;;:442;;;;:::i;:::-;-1:-1:-1;;;;;172437:23:0;;;;;;:14;:23;;;;;:468;172355:574;-1:-1:-1;;;;;;172953:22:0;;173003:1;172953:22;;;:13;:22;;;;;;;;172976:14;:23;;;;;;;;172953:47;;;;;;;;:51;;;173027:23;;;;;:27;;172033:1188;;;-1:-1:-1;;;;;173128:23:0;;;;;;:14;:23;;;;;;;;;;173103:13;:22;;;;;:48;;;;173174:23;;;:27;172033:1188;171136:2111;171032:2215;169912:3342;169850:3404;;:::o;168813:793::-;168884:19;;168875:5;:28;168871:728;;168920:22;:20;:22::i;:::-;168959:19;:27;;;169023:1;169003:17;:21;;;169087:16;;169069:35;;:17;:35;;;;;;;169041:24;;;;;;:63;;169069:35;;169041:24;;:63;;169069:35;;169041:63;:::i;:::-;;;;-1:-1:-1;;169137:12:0;;:17;169133:133;;169203:12;;;169175:24;;;:17;:24;;;;;:40;;169203:12;;169175:24;;:40;;169203:12;;169175:40;:::i;:::-;;;;-1:-1:-1;;169249:1:0;169234:16;;169133:133;169298:22;;:27;169294:163;;169374:22;;169346:24;;;;:17;:24;;;;;:50;;:24;;;:50;;169374:22;;169346:50;:::i;:::-;;;;-1:-1:-1;;169440:1:0;169415:22;:26;169294:163;169524:5;169490:97;169548:17;:24;169566:5;169548:24;;;;;;;;;;;;169490:97;;;;345:25:1;;333:2;318:18;;199:177;169490:97:0;;;;;;;;168813:793;:::o;164146:198::-;164223:19;164332:4;164310:17;;164302:4;:25;;;;:::i;:::-;164270:28;164283:15;164270:10;:28;:::i;:::-;:58;;;;:::i;:::-;164269:67;;;;:::i;:::-;164255:81;164146:198;-1:-1:-1;;164146:198:0:o;166498:432::-;166616:18;166637:40;166662:7;166671:5;166637:24;:40::i;:::-;166616:61;;166704:1;166691:10;:14;166688:71;;;166722:25;166737:10;166722:25;;:::i;:::-;;;166688:71;166799:17;:11;166813:3;166799:17;:::i;:::-;166771:24;;;;:17;:24;;;;;:45;;:24;;;:45;;;;;:::i;:::-;;;;-1:-1:-1;166852:16:0;;-1:-1:-1;166852:11:0;166866:2;166852:16;:::i;:::-;-1:-1:-1;;;;;166827:21:0;;;;;;:15;:21;;;;;:41;;:21;;;:41;;;;;:::i;:::-;;;;-1:-1:-1;166907:15:0;;-1:-1:-1;166907:11:0;166921:1;166907:15;:::i;:::-;-1:-1:-1;;;;;166879:24:0;;;;;;:15;:24;;;;;:43;;:24;;;:43;;;;;:::i;:::-;;;;-1:-1:-1;;;;;;;166498:432:0:o;165017:357::-;165129:3;165117:9;:4;165124:2;165117:9;:::i;:::-;:15;;;;:::i;:::-;165090:23;;;;:16;:23;;;;;:42;;:23;;;:42;;;;;:::i;:::-;;;;-1:-1:-1;165145:45:0;;-1:-1:-1;165165:6:0;165185:4;165174:8;:4;165181:1;165174:8;:::i;:::-;:15;;;;:::i;165145:45::-;165201:46;165221:6;165242:4;165230:9;:4;165237:2;165230:9;:::i;165201:46::-;165258:47;165278:13;165294:10;165301:3;165294:4;:10;:::i;165258:47::-;165316:50;165336:11;165362:3;165350:9;:4;165357:2;165350:9;:::i;173412:179::-;173490:9;173505:2;-1:-1:-1;;;;;173505:7:0;173520:6;173505:26;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;173489:42;;;173550:4;173542:41;;;;-1:-1:-1;;;173542:41:0;;9903:2:1;173542:41:0;;;9885:21:1;9942:2;9922:18;;;9915:30;-1:-1:-1;;;9961:18:1;;;9954:54;10025:18;;173542:41:0;9701:348:1;120568:177:0;120651:86;120671:5;120701:23;;;120726:2;120730:5;120678:58;;;;;;;;;:::i;:::-;;;;-1:-1:-1;;120678:58:0;;;;;;;;;;;;;;-1:-1:-1;;;;;120678:58:0;-1:-1:-1;;;;;;120678:58:0;;;;;;;;;;120651:19;:86::i;120990:205::-;121118:68;;-1:-1:-1;;;;;10312:15:1;;;121118:68:0;;;10294:34:1;10364:15;;10344:18;;;10337:43;10396:18;;;10389:34;;;121091:96:0;;121111:5;;-1:-1:-1;;;121141:27:0;10229:18:1;;121118:68:0;10054:375:1;168245:389:0;168409:19;;168312:14;168379:27;;;:20;:27;;;;;;168312:14;;168431:3;;168379:49;;168409:19;168379:49;:::i;:::-;:55;;;;:::i;:::-;168329:27;;;;:20;:27;;;;;;:33;;168359:3;168329:33;:::i;:::-;:105;;;;:::i;:::-;168447:21;;;;:14;:21;;;;;;;;:30;;;168488:17;:24;;;;;:34;;168312:122;;-1:-1:-1;168312:122:0;;168488:24;;168447:21;168488:34;;168312:122;;168488:34;:::i;:::-;;;;-1:-1:-1;;168550:19:0;;168572:5;-1:-1:-1;168547:80:0;;;168594:19;:21;;;:19;:21;;;:::i;:::-;;;;;;168299:335;168245:389;:::o;164482:390::-;164562:7;164537:22;;:32;164534:331;;;164586:26;164650:5;164616:22;;164641:5;164616:30;;;;:::i;:::-;164615:40;;;;:::i;:::-;164586:69;;164694:7;164673:18;:28;164670:184;;;164747:7;164722:22;:32;167036:185;167001:220::o;164670:184::-;164795:22;:43;164534:331;164482:390::o;163571:481::-;163718:16;;-1:-1:-1;;;;;163779:29:0;;163657:18;163779:29;;;:22;:29;;;;;;;;:50;;;;;;;;;163657:18;;163718:16;163845:28;;;;;:42;;-1:-1:-1;163877:10:0;;;163845:42;163842:203;;;163947:39;;;;:18;:39;;;;;;163917:27;:23;163943:1;163917:27;:::i;:::-;:69;;;;:::i;:::-;163904:82;;163842:203;;;164032:1;164019:14;;163842:203;163677:375;;163571:481;;;;:::o;124914:649::-;125338:23;125364:69;125392:4;125364:69;;;;;;;;;;;;;;;;;125372:5;-1:-1:-1;;;;;125364:27:0;;;:69;;;;;:::i;:::-;125338:95;;125452:10;:17;125473:1;125452:22;:56;;;;125489:10;125478:30;;;;;;;;;;;;:::i;:::-;125444:111;;;;-1:-1:-1;;;125444:111:0;;10918:2:1;125444:111:0;;;10900:21:1;10957:2;10937:18;;;10930:30;10996:34;10976:18;;;10969:62;-1:-1:-1;;;11047:18:1;;;11040:40;11097:19;;125444:111:0;10716:406:1;106743:229:0;106880:12;106912:52;106934:6;106942:4;106948:1;106951:12;106912:21;:52::i;:::-;106905:59;106743:229;-1:-1:-1;;;;106743:229:0:o;107829:455::-;107999:12;108057:5;108032:21;:30;;108024:81;;;;-1:-1:-1;;;108024:81:0;;11329:2:1;108024:81:0;;;11311:21:1;11368:2;11348:18;;;11341:30;11407:34;11387:18;;;11380:62;-1:-1:-1;;;11458:18:1;;;11451:36;11504:19;;108024:81:0;11127:402:1;108024:81:0;108117:12;108131:23;108158:6;-1:-1:-1;;;;;108158:11:0;108177:5;108184:4;108158:31;;;;;;:::i;:::-;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;108116:73;;;;108207:69;108234:6;108242:7;108251:10;108263:12;108207:26;:69::i;:::-;108200:76;107829:455;-1:-1:-1;;;;;;;107829:455:0:o;110402:644::-;110587:12;110616:7;110612:427;;;110644:10;:17;110665:1;110644:22;110640:290;;-1:-1:-1;;;;;104283:19:0;;;110854:60;;;;-1:-1:-1;;;110854:60:0;;12042:2:1;110854:60:0;;;12024:21:1;12081:2;12061:18;;;12054:30;12120:31;12100:18;;;12093:59;12169:18;;110854:60:0;11840:353:1;110854:60:0;-1:-1:-1;110951:10:0;110944:17;;110612:427;110994:33;111002:10;111014:12;111749:17;;:21;111745:388;;111981:10;111975:17;112038:15;112025:10;112021:2;112017:19;112010:44;111745:388;112108:12;112101:20;;-1:-1:-1;;;112101:20:0;;;;;;;;:::i;14:180:1:-;73:6;126:2;114:9;105:7;101:23;97:32;94:52;;;142:1;139;132:12;94:52;-1:-1:-1;165:23:1;;14:180;-1:-1:-1;14:180:1:o;381:173::-;449:20;;-1:-1:-1;;;;;498:31:1;;488:42;;478:70;;544:1;541;534:12;478:70;381:173;;;:::o;559:254::-;627:6;635;688:2;676:9;667:7;663:23;659:32;656:52;;;704:1;701;694:12;656:52;727:29;746:9;727:29;:::i;:::-;717:39;803:2;788:18;;;;775:32;;-1:-1:-1;;;559:254:1:o;818:186::-;877:6;930:2;918:9;909:7;905:23;901:32;898:52;;;946:1;943;936:12;898:52;969:29;988:9;969:29;:::i;:::-;959:39;818:186;-1:-1:-1;;;818:186:1:o;1632:592::-;1703:6;1711;1764:2;1752:9;1743:7;1739:23;1735:32;1732:52;;;1780:1;1777;1770:12;1732:52;1807:23;;-1:-1:-1;;;;;1879:14:1;;;1876:34;;;1906:1;1903;1896:12;1876:34;1944:6;1933:9;1929:22;1919:32;;1989:7;1982:4;1978:2;1974:13;1970:27;1960:55;;2011:1;2008;2001:12;1960:55;2051:2;2038:16;2077:2;2069:6;2066:14;2063:34;;;2093:1;2090;2083:12;2063:34;2138:7;2133:2;2124:6;2120:2;2116:15;2112:24;2109:37;2106:57;;;2159:1;2156;2149:12;2106:57;2190:2;2182:11;;;;;2212:6;;-1:-1:-1;1632:592:1;;-1:-1:-1;;;;1632:592:1:o;2229:127::-;2290:10;2285:3;2281:20;2278:1;2271:31;2321:4;2318:1;2311:15;2345:4;2342:1;2335:15;2361:128;2428:9;;;2449:11;;;2446:37;;;2463:18;;:::i;3183:125::-;3248:9;;;3269:10;;;3266:36;;;3282:18;;:::i;3313:274::-;-1:-1:-1;;;;;3505:32:1;;;;3487:51;;3569:2;3554:18;;3547:34;3475:2;3460:18;;3313:274::o;5303:135::-;5342:3;5363:17;;;5360:43;;5383:18;;:::i;:::-;-1:-1:-1;5430:1:1;5419:13;;5303:135::o;5443:168::-;5516:9;;;5547;;5564:15;;;5558:22;;5544:37;5534:71;;5585:18;;:::i;5616:341::-;5818:2;5800:21;;;5857:2;5837:18;;;5830:30;-1:-1:-1;;;5891:2:1;5876:18;;5869:47;5948:2;5933:18;;5616:341::o;6717:463::-;6904:2;6893:9;6886:21;6943:6;6938:2;6927:9;6923:18;6916:34;7000:6;6992;6987:2;6976:9;6972:18;6959:48;7056:1;7051:2;7042:6;7031:9;7027:22;7023:31;7016:42;6867:4;7126:2;7119;7115:7;7110:2;7102:6;7098:15;7094:29;7083:9;7079:45;7075:54;7067:62;;7167:6;7160:4;7149:9;7145:20;7138:36;6717:463;;;;;;:::o;7944:217::-;7984:1;8010;8000:132;;8054:10;8049:3;8045:20;8042:1;8035:31;8089:4;8086:1;8079:15;8117:4;8114:1;8107:15;8000:132;-1:-1:-1;8146:9:1;;7944:217::o;8821:331::-;8926:9;8937;8979:8;8967:10;8964:24;8961:44;;;9001:1;8998;8991:12;8961:44;9030:6;9020:8;9017:20;9014:40;;;9050:1;9047;9040:12;9014:40;-1:-1:-1;;9076:23:1;;;9121:25;;;;;-1:-1:-1;8821:331:1:o;9157:329::-;-1:-1:-1;;;;;;9278:19:1;;9357:11;;;;9388:2;9380:11;;9377:103;;;9450:2;9446:12;;;;9443:1;9439:20;9435:29;;;9427:38;9423:47;;;;9157:329;-1:-1:-1;;9157:329:1:o;10434:277::-;10501:6;10554:2;10542:9;10533:7;10529:23;10525:32;10522:52;;;10570:1;10567;10560:12;10522:52;10602:9;10596:16;10655:5;10648:13;10641:21;10634:5;10631:32;10621:60;;10677:1;10674;10667:12;11534:301;11663:3;11701:6;11695:13;11747:6;11740:4;11732:6;11728:17;11723:3;11717:37;11809:1;11773:16;;11798:13;;;-1:-1:-1;11773:16:1;11534:301;-1:-1:-1;11534:301:1:o;12198:418::-;12347:2;12336:9;12329:21;12310:4;12379:6;12373:13;12422:6;12417:2;12406:9;12402:18;12395:34;12481:6;12476:2;12468:6;12464:15;12459:2;12448:9;12444:18;12438:50;12537:1;12532:2;12523:6;12512:9;12508:22;12504:31;12497:42;12607:2;12600;12596:7;12591:2;12583:6;12579:15;12575:29;12564:9;12560:45;12556:54;12548:62;;;12198:418;;;;:::o
Swarm Source
ipfs://43b7cbc864d2a2bc0e7cf6b8e190075c230a223b9a7de607cd250c85d6790141
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|---|---|---|---|---|
ETH | Ether (ETH) | 100.00% | $3,362.76 | 18.6842 | $62,830.3 |
Loading...
Loading
[ Download: CSV Export ]
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.