More Info
Private Name Tags
ContractCreator
TokenTracker
Latest 20 from a total of 20 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
Withdraw | 14163305 | 1029 days ago | IN | 0 ETH | 0.0528059 | ||||
Withdraw | 14163219 | 1029 days ago | IN | 0 ETH | 0.04323558 | ||||
Rebalance | 14163215 | 1029 days ago | IN | 0 ETH | 0.04396058 | ||||
Rebalance | 14131833 | 1034 days ago | IN | 0 ETH | 0.07863854 | ||||
Rebalance | 14125729 | 1035 days ago | IN | 0 ETH | 0.0731354 | ||||
Rebalance | 14123318 | 1035 days ago | IN | 0 ETH | 0.0849629 | ||||
Rebalance | 14112672 | 1037 days ago | IN | 0 ETH | 0.07038122 | ||||
Rebalance | 14105483 | 1038 days ago | IN | 0 ETH | 0.10184334 | ||||
Rebalance | 14098230 | 1039 days ago | IN | 0 ETH | 0.10445908 | ||||
Rebalance | 14092986 | 1040 days ago | IN | 0 ETH | 0.07790186 | ||||
Rebalance | 14092463 | 1040 days ago | IN | 0 ETH | 0.09088322 | ||||
Rebalance | 14090825 | 1040 days ago | IN | 0 ETH | 0.12269033 | ||||
Rebalance | 14089482 | 1040 days ago | IN | 0 ETH | 0.14790907 | ||||
Rebalance | 14086635 | 1041 days ago | IN | 0 ETH | 0.08449051 | ||||
Rebalance | 14084682 | 1041 days ago | IN | 0 ETH | 0.11883889 | ||||
Rebalance | 14083999 | 1041 days ago | IN | 0 ETH | 0.10092522 | ||||
Rebalance | 14083617 | 1041 days ago | IN | 0 ETH | 0.12290026 | ||||
Rebalance | 14080099 | 1042 days ago | IN | 0 ETH | 0.07438547 | ||||
Deposit | 14080034 | 1042 days ago | IN | 0 ETH | 0.02027184 | ||||
Deposit | 14079868 | 1042 days ago | IN | 0 ETH | 0.02977941 |
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
14163305 | 1029 days ago | 0.17982402 ETH | ||||
14163305 | 1029 days ago | 0.17982402 ETH | ||||
14163219 | 1029 days ago | 0.18108754 ETH | ||||
14163219 | 1029 days ago | 0.18108754 ETH | ||||
14163215 | 1029 days ago | 0.00183368 ETH | ||||
14163215 | 1029 days ago | 0.00183368 ETH | ||||
14131833 | 1034 days ago | 0.00574401 ETH | ||||
14131833 | 1034 days ago | 0.00574401 ETH | ||||
14125729 | 1035 days ago | 0.01353992 ETH | ||||
14125729 | 1035 days ago | 0.01353992 ETH | ||||
14112672 | 1037 days ago | 0.00816523 ETH | ||||
14112672 | 1037 days ago | 0.00816523 ETH | ||||
14105483 | 1038 days ago | 0.18084422 ETH | ||||
14105483 | 1038 days ago | 0.18084422 ETH | ||||
14098230 | 1039 days ago | 0.00692669 ETH | ||||
14098230 | 1039 days ago | 0.00692669 ETH | ||||
14092986 | 1040 days ago | 0.00444421 ETH | ||||
14092986 | 1040 days ago | 0.00444421 ETH | ||||
14092463 | 1040 days ago | 0.00344001 ETH | ||||
14092463 | 1040 days ago | 0.00344001 ETH | ||||
14090825 | 1040 days ago | 0.00261639 ETH | ||||
14090825 | 1040 days ago | 0.00261639 ETH | ||||
14089482 | 1040 days ago | 0.00311364 ETH | ||||
14089482 | 1040 days ago | 0.00311364 ETH | ||||
14086635 | 1041 days ago | 0.0034781 ETH |
Loading...
Loading
This contract may be a proxy contract. Click on More Options and select Is this a proxy? to confirm and enable the "Read as Proxy" & "Write as Proxy" tabs.
Contract Name:
AloeBlend
Compiler Version
v0.8.10+commit.fc410830
Optimization Enabled:
Yes with 800 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity)
/** *Submitted for verification at Etherscan.io on 2022-01-26 */ // Verified using https://dapp.tools // hevm: flattened sources of contracts/AloeBlend.sol // SPDX-License-Identifier: AGPL-3.0-only AND MIT AND GPL-2.0-or-later pragma solidity >=0.5.0 >=0.8.0 >=0.8.0 <0.9.0 >=0.8.10 <0.9.0; ////// lib/solmate/src/tokens/ERC20.sol /* pragma solidity >=0.8.0; */ /// @notice Modern and gas efficient ERC20 + EIP-2612 implementation. /// @author Solmate (https://github.com/Rari-Capital/solmate/blob/main/src/tokens/ERC20.sol) /// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol) /// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it. abstract contract ERC20 { /*/////////////////////////////////////////////////////////////// EVENTS //////////////////////////////////////////////////////////////*/ event Transfer(address indexed from, address indexed to, uint256 amount); event Approval(address indexed owner, address indexed spender, uint256 amount); /*/////////////////////////////////////////////////////////////// METADATA STORAGE //////////////////////////////////////////////////////////////*/ string public name; string public symbol; uint8 public immutable decimals; /*/////////////////////////////////////////////////////////////// ERC20 STORAGE //////////////////////////////////////////////////////////////*/ uint256 public totalSupply; mapping(address => uint256) public balanceOf; mapping(address => mapping(address => uint256)) public allowance; /*/////////////////////////////////////////////////////////////// EIP-2612 STORAGE //////////////////////////////////////////////////////////////*/ bytes32 public constant PERMIT_TYPEHASH = keccak256("Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"); uint256 internal immutable INITIAL_CHAIN_ID; bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR; mapping(address => uint256) public nonces; /*/////////////////////////////////////////////////////////////// CONSTRUCTOR //////////////////////////////////////////////////////////////*/ constructor( string memory _name, string memory _symbol, uint8 _decimals ) { name = _name; symbol = _symbol; decimals = _decimals; INITIAL_CHAIN_ID = block.chainid; INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator(); } /*/////////////////////////////////////////////////////////////// ERC20 LOGIC //////////////////////////////////////////////////////////////*/ function approve(address spender, uint256 amount) public virtual returns (bool) { allowance[msg.sender][spender] = amount; emit Approval(msg.sender, spender, amount); return true; } function transfer(address to, uint256 amount) public virtual returns (bool) { balanceOf[msg.sender] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(msg.sender, to, amount); return true; } function transferFrom( address from, address to, uint256 amount ) public virtual returns (bool) { uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals. if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount; balanceOf[from] -= amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(from, to, amount); return true; } /*/////////////////////////////////////////////////////////////// EIP-2612 LOGIC //////////////////////////////////////////////////////////////*/ function permit( address owner, address spender, uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s ) public virtual { require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED"); // Unchecked because the only math done is incrementing // the owner's nonce which cannot realistically overflow. unchecked { bytes32 digest = keccak256( abi.encodePacked( "\x19\x01", DOMAIN_SEPARATOR(), keccak256(abi.encode(PERMIT_TYPEHASH, owner, spender, value, nonces[owner]++, deadline)) ) ); address recoveredAddress = ecrecover(digest, v, r, s); require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER"); allowance[recoveredAddress][spender] = value; } emit Approval(owner, spender, value); } function DOMAIN_SEPARATOR() public view virtual returns (bytes32) { return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator(); } function computeDomainSeparator() internal view virtual returns (bytes32) { return keccak256( abi.encode( keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"), keccak256(bytes(name)), keccak256("1"), block.chainid, address(this) ) ); } /*/////////////////////////////////////////////////////////////// INTERNAL MINT/BURN LOGIC //////////////////////////////////////////////////////////////*/ function _mint(address to, uint256 amount) internal virtual { totalSupply += amount; // Cannot overflow because the sum of all user // balances can't exceed the max uint256 value. unchecked { balanceOf[to] += amount; } emit Transfer(address(0), to, amount); } function _burn(address from, uint256 amount) internal virtual { balanceOf[from] -= amount; // Cannot underflow because a user's balance // will never be larger than the total supply. unchecked { totalSupply -= amount; } emit Transfer(from, address(0), amount); } } ////// contracts/AloeBlendERC20.sol /* pragma solidity ^0.8.10; */ /* import "@rari-capital/solmate/src/tokens/ERC20.sol"; */ contract AloeBlendERC20 is ERC20 { // solhint-disable no-empty-blocks constructor(string memory _name) ERC20(_name, "ALOE-BLEND", 18) {} } ////// lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol /* pragma solidity ^0.8.0; */ /** * @dev Interface of the ERC20 standard as defined in the EIP. */ interface IERC20 { /** * @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 `recipient`. * * Returns a boolean value indicating whether the operation succeeded. * * Emits a {Transfer} event. */ function transfer(address recipient, 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 `sender` to `recipient` 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 sender, address recipient, uint256 amount ) external returns (bool); /** * @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); } ////// lib/openzeppelin-contracts/contracts/utils/Address.sol /* pragma solidity ^0.8.0; */ /** * @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 * ==== */ function isContract(address account) internal view returns (bool) { // This method relies on extcodesize, which returns 0 for contracts in // construction, since the code is only stored at the end of the // constructor execution. uint256 size; assembly { size := extcodesize(account) } return size > 0; } /** * @dev Replacement for Solidity's `transfer`: sends `amount` wei to * `recipient`, forwarding all available gas and reverting on errors. * * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost * of certain opcodes, possibly making contracts go over the 2300 gas limit * imposed by `transfer`, making them unable to receive funds via * `transfer`. {sendValue} removes this limitation. * * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more]. * * IMPORTANT: because control is transferred to `recipient`, care must be * taken to not create reentrancy vulnerabilities. Consider using * {ReentrancyGuard} or the * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern]. */ function sendValue(address payable recipient, uint256 amount) internal { require(address(this).balance >= amount, "Address: insufficient balance"); (bool success, ) = recipient.call{value: amount}(""); require(success, "Address: unable to send value, recipient may have reverted"); } /** * @dev Performs a Solidity function call using a low level `call`. A * plain `call` is an unsafe replacement for a function call: use this * function instead. * * If `target` reverts with a revert reason, it is bubbled up by this * function (like regular Solidity function calls). * * Returns the raw returned data. To convert to the expected return value, * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`]. * * Requirements: * * - `target` must be a contract. * - calling `target` with `data` must not revert. * * _Available since v3.1._ */ function functionCall(address target, bytes memory data) internal returns (bytes memory) { return functionCall(target, data, "Address: low-level call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with * `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCall( address target, bytes memory data, string memory errorMessage ) internal returns (bytes memory) { return functionCallWithValue(target, data, 0, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but also transferring `value` wei to `target`. * * Requirements: * * - the calling contract must have an ETH balance of at least `value`. * - the called Solidity function must be `payable`. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value ) internal returns (bytes memory) { return functionCallWithValue(target, data, value, "Address: low-level call with value failed"); } /** * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but * with `errorMessage` as a fallback revert reason when `target` reverts. * * _Available since v3.1._ */ function functionCallWithValue( address target, bytes memory data, uint256 value, string memory errorMessage ) internal returns (bytes memory) { require(address(this).balance >= value, "Address: insufficient balance for call"); require(isContract(target), "Address: call to non-contract"); (bool success, bytes memory returndata) = target.call{value: value}(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) { return functionStaticCall(target, data, "Address: low-level static call failed"); } /** * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`], * but performing a static call. * * _Available since v3.3._ */ function functionStaticCall( address target, bytes memory data, string memory errorMessage ) internal view returns (bytes memory) { require(isContract(target), "Address: static call to non-contract"); (bool success, bytes memory returndata) = target.staticcall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev 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) { require(isContract(target), "Address: delegate call to non-contract"); (bool success, bytes memory returndata) = target.delegatecall(data); return verifyCallResult(success, returndata, errorMessage); } /** * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the * revert reason using the provided one. * * _Available since v4.3._ */ function verifyCallResult( bool success, bytes memory returndata, string memory errorMessage ) internal pure returns (bytes memory) { if (success) { return returndata; } else { // Look for revert reason and bubble it up if present if (returndata.length > 0) { // The easiest way to bubble the revert reason is using memory via assembly assembly { let returndata_size := mload(returndata) revert(add(32, returndata), returndata_size) } } else { revert(errorMessage); } } } } ////// lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol /* pragma solidity ^0.8.0; */ /* import "../IERC20.sol"; */ /* import "../../../utils/Address.sol"; */ /** * @title SafeERC20 * @dev Wrappers around ERC20 operations that throw on failure (when the token * contract returns false). Tokens that return no value (and instead revert or * throw on failure) are also supported, non-reverting calls are assumed to be * successful. * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract, * which allows you to call the safe operations as `token.safeTransfer(...)`, etc. */ library SafeERC20 { using Address for address; function safeTransfer( IERC20 token, address to, uint256 value ) internal { _callOptionalReturn(token, abi.encodeWithSelector(token.transfer.selector, to, value)); } 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)); } function safeIncreaseAllowance( IERC20 token, address spender, uint256 value ) internal { uint256 newAllowance = token.allowance(address(this), spender) + value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } function safeDecreaseAllowance( IERC20 token, address spender, uint256 value ) internal { unchecked { uint256 oldAllowance = token.allowance(address(this), spender); require(oldAllowance >= value, "SafeERC20: decreased allowance below zero"); uint256 newAllowance = oldAllowance - value; _callOptionalReturn(token, abi.encodeWithSelector(token.approve.selector, spender, newAllowance)); } } /** * @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"); if (returndata.length > 0) { // Return data is optional require(abi.decode(returndata, (bool)), "SafeERC20: ERC20 operation did not succeed"); } } } ////// lib/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; } ////// lib/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 ); } ////// lib/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); } ////// lib/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); } ////// lib/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); } ////// lib/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 /// 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. /// observationIndex The index of the last oracle observation that was written, /// observationCardinality The current maximum number of observations stored in the pool, /// observationCardinalityNext The next maximum number of observations, to be updated when the observation. /// 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 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, /// liquidityNet how much liquidity changes when the pool price crosses the tick, /// feeGrowthOutside0X128 the fee growth on the other side of the tick from the current tick in token0, /// feeGrowthOutside1X128 the fee growth on the other side of the tick from the current tick in token1, /// tickCumulativeOutside the cumulative tick value on the other side of the tick from the current tick /// secondsPerLiquidityOutsideX128 the seconds spent per liquidity on the other side of the tick from the current tick, /// secondsOutside the seconds spent on the other side of the tick from the current tick, /// 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, /// Returns feeGrowthInside0LastX128 fee growth of token0 inside the tick range as of the last mint/burn/poke, /// Returns feeGrowthInside1LastX128 fee growth of token1 inside the tick range as of the last mint/burn/poke, /// Returns tokensOwed0 the computed amount of token0 owed to the position as of the last mint/burn/poke, /// Returns 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, /// Returns tickCumulative the tick multiplied by seconds elapsed for the life of the pool as of the observation timestamp, /// Returns secondsPerLiquidityCumulativeX128 the seconds per in range liquidity for the life of the pool as of the observation timestamp, /// Returns 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 ); } ////// lib/v3-core/contracts/interfaces/IUniswapV3Pool.sol /* pragma solidity >=0.5.0; */ /* import './pool/IUniswapV3PoolImmutables.sol'; */ /* import './pool/IUniswapV3PoolState.sol'; */ /* import './pool/IUniswapV3PoolDerivedState.sol'; */ /* import './pool/IUniswapV3PoolActions.sol'; */ /* import './pool/IUniswapV3PoolOwnerActions.sol'; */ /* import './pool/IUniswapV3PoolEvents.sol'; */ /// @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, IUniswapV3PoolEvents { } ////// lib/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol /* pragma solidity >=0.5.0; */ /// @title Callback for IUniswapV3PoolActions#mint /// @notice Any contract that calls IUniswapV3PoolActions#mint must implement this interface interface IUniswapV3MintCallback { /// @notice Called to `msg.sender` after minting liquidity to a position from IUniswapV3Pool#mint. /// @dev In the implementation you must pay the pool tokens owed for the minted liquidity. /// The caller of this method must be checked to be a UniswapV3Pool deployed by the canonical UniswapV3Factory. /// @param amount0Owed The amount of token0 due to the pool for the minted liquidity /// @param amount1Owed The amount of token1 due to the pool for the minted liquidity /// @param data Any data passed through by the caller via the IUniswapV3PoolActions#mint call function uniswapV3MintCallback( uint256 amount0Owed, uint256 amount1Owed, bytes calldata data ) external; } ////// contracts/UniswapHelper.sol /* pragma solidity ^0.8.10; */ /* import "@openzeppelin/contracts/token/ERC20/IERC20.sol"; */ /* import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; */ /* import "@uniswap/v3-core/contracts/interfaces/callback/IUniswapV3MintCallback.sol"; */ /* import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; */ contract UniswapHelper is IUniswapV3MintCallback { using SafeERC20 for IERC20; /// @notice The Uniswap pair in which the vault will manage positions IUniswapV3Pool public immutable UNI_POOL; /// @notice The first token of the Uniswap pair IERC20 public immutable TOKEN0; /// @notice The second token of the Uniswap pair IERC20 public immutable TOKEN1; /// @dev The Uniswap pair's tick spacing int24 internal immutable TICK_SPACING; constructor(IUniswapV3Pool _pool) { UNI_POOL = _pool; TOKEN0 = IERC20(_pool.token0()); TOKEN1 = IERC20(_pool.token1()); TICK_SPACING = _pool.tickSpacing(); } /// @dev Callback for Uniswap V3 pool. function uniswapV3MintCallback( uint256 _amount0, uint256 _amount1, bytes calldata ) external { require(msg.sender == address(UNI_POOL)); if (_amount0 != 0) TOKEN0.safeTransfer(msg.sender, _amount0); if (_amount1 != 0) TOKEN1.safeTransfer(msg.sender, _amount1); } } ////// contracts/interfaces/IAloeBlendActions.sol /* pragma solidity ^0.8.10; */ interface IAloeBlendActions { /** * @notice Deposits tokens in proportion to the vault's current holdings * @dev These tokens sit in the vault and are not used as liquidity * until the next rebalance. Also note it's not necessary to check * if user manipulated price to deposit cheaper, as the value of range * orders can only by manipulated higher. * @param amount0Max Max amount of TOKEN0 to deposit * @param amount1Max Max amount of TOKEN1 to deposit * @param amount0Min Ensure `amount0` is greater than this * @param amount1Min Ensure `amount1` is greater than this * @return shares Number of shares minted * @return amount0 Amount of TOKEN0 deposited * @return amount1 Amount of TOKEN1 deposited */ function deposit( uint256 amount0Max, uint256 amount1Max, uint256 amount0Min, uint256 amount1Min ) external returns ( uint256 shares, uint256 amount0, uint256 amount1 ); /** * @notice Withdraws tokens in proportion to the vault's current holdings * @param shares Shares burned by sender * @param amount0Min Revert if resulting `amount0` is smaller than this * @param amount1Min Revert if resulting `amount1` is smaller than this * @return amount0 Amount of token0 sent to recipient * @return amount1 Amount of token1 sent to recipient */ function withdraw( uint256 shares, uint256 amount0Min, uint256 amount1Min ) external returns (uint256 amount0, uint256 amount1); /** * @notice Rebalances vault to maintain 50/50 inventory ratio * @dev `rewardToken` may be something other than token0 or token1, in which case the available maintenance budget * is equal to the contract's balance. Also note that this will revert unless both silos report that removal of * `rewardToken` is allowed. For example, a Compound silo would block removal of its cTokens. * @param rewardToken The ERC20 token in which the reward should be denominated. If `rewardToken` is the 0 address, * no reward will be given. Otherwise, the reward is based on (a) time elapsed since primary position last moved * and (b) the contract's estimate of how much each unit of gas costs. Since (b) is fully determined by past * contract interactions and is known to all participants, (a) creates a Dutch Auction for calling this function. */ function rebalance(address rewardToken) external; } ////// contracts/interfaces/IAloeBlendDerivedState.sol /* pragma solidity ^0.8.10; */ interface IAloeBlendDerivedState { /** * @notice Calculates the rebalance urgency. Caller's reward is proportional to this value. * @return urgency How badly the vault wants its `rebalance()` function to be called */ function getRebalanceUrgency() external view returns (uint32 urgency); /** * @notice Estimate's the vault's liabilities to users -- in other words, how much would be paid out if all * holders redeemed their shares at once. * @dev Underestimates the true payout unless both silos and Uniswap positions have just been poked. Also * assumes that the maximum amount will accrue to the maintenance budget during the next `rebalance()`. If * it takes less than that for the budget to reach capacity, then the values reported here may increase after * calling `rebalance()`. * @return inventory0 The amount of token0 underlying all shares * @return inventory1 The amount of token1 underlying all shares */ function getInventory() external view returns (uint256 inventory0, uint256 inventory1); } ////// contracts/interfaces/IAloeBlendEvents.sol /* pragma solidity ^0.8.10; */ interface IAloeBlendEvents { /** * @notice Emitted every time someone deposits to the vault * @param sender The address that deposited to the vault * @param shares The shares that were minted and sent to `sender` * @param amount0 The amount of token0 that `sender` paid in exchange for `shares` * @param amount1 The amount of token1 that `sender` paid in exchange for `shares` */ event Deposit(address indexed sender, uint256 shares, uint256 amount0, uint256 amount1); /** * @notice Emitted every time someone withdraws from the vault * @param sender The address that withdrew from the vault * @param shares The shares that were taken from `sender` and burned * @param amount0 The amount of token0 that `sender` received in exchange for `shares` * @param amount1 The amount of token1 that `sender` received in exchange for `shares` */ event Withdraw(address indexed sender, uint256 shares, uint256 amount0, uint256 amount1); /** * @notice Emitted every time the vault is rebalanced. Contains general vault data. * @param ratio The ratio of value held as token0 to total value, * i.e. `inventory0 / (inventory0 + inventory1 / price)` * @param shares The total outstanding shares held by depositers * @param inventory0 The amount of token0 underlying all shares * @param inventory1 The amount of token1 underlying all shares */ event Rebalance(uint256 ratio, uint256 shares, uint256 inventory0, uint256 inventory1); /** * @notice Emitted every time the primary Uniswap position is recentered * @param lower The lower bound of the new primary Uniswap position * @param upper The upper bound of the new primary Uniswap position */ event Recenter(int24 lower, int24 upper); /** * @notice Emitted every time the vault is rebalanced. Contains incentivization data. * @param token The ERC20 token in which caller rewards were denominated * @param amount The amount of `token` that was sent to caller * @param urgency The rebalance urgency when this payout occurred */ event Reward(address token, uint256 amount, uint32 urgency); } ////// contracts/interfaces/ISilo.sol /* pragma solidity ^0.8.10; */ interface ISilo { /// @notice A descriptive name for the silo (ex: Compound USDC Silo) function name() external view returns (string memory); /// @notice A place to update the silo's internal state /// @dev After this has been called, balances reported by `balanceOf` MUST be correct function poke() external; /// @notice Deposits `amount` of the underlying token function deposit(uint256 amount) external; /// @notice Withdraws EXACTLY `amount` of the underlying token function withdraw(uint256 amount) external; /// @notice Reports how much of the underlying token `account` has stored /// @dev Must never overestimate `balance`. Should give the exact, correct value after `poke` is called function balanceOf(address account) external view returns (uint256 balance); /** * @notice Whether the given token is irrelevant to the silo's strategy (`shouldAllow = true`) or * is required for proper management (`shouldAllow = false`). ex: Compound silos shouldn't allow * removal of cTokens, but the may allow removal of COMP rewards. * @dev Removed tokens are used to help incentivize rebalances for the Blend vault that uses the silo. So * if you want something like COMP rewards to go to Blend *users* instead, you'd have to implement a * trading function as part of `poke()` to convert COMP to the underlying token. */ function shouldAllowRemovalOf(address token) external view returns (bool shouldAllow); } ////// contracts/interfaces/IVolatilityOracle.sol /* pragma solidity ^0.8.10; */ /* import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; */ interface IVolatilityOracle { /** * @notice Accesses the most recently stored metadata for a given Uniswap pool * @dev These values may or may not have been initialized and may or may not be * up to date. `tickSpacing` will be non-zero if they've been initialized. * @param pool The Uniswap pool for which metadata should be retrieved * @return maxSecondsAgo The age of the oldest observation in the pool's oracle * @return gamma0 The pool fee minus the protocol fee on token0, scaled by 1e6 * @return gamma1 The pool fee minus the protocol fee on token1, scaled by 1e6 * @return tickSpacing The pool's tick spacing */ function cachedPoolMetadata(IUniswapV3Pool pool) external view returns ( uint32 maxSecondsAgo, uint24 gamma0, uint24 gamma1, int24 tickSpacing ); /** * @notice Accesses any of the 25 most recently stored fee growth structs * @dev The full array (idx=0,1,2...24) has data that spans *at least* 24 hours * @param pool The Uniswap pool for which fee growth should be retrieved * @param idx The index into the storage array * @return feeGrowthGlobal0X128 Total pool revenue in token0, as of timestamp * @return feeGrowthGlobal1X128 Total pool revenue in token1, as of timestamp * @return timestamp The time at which snapshot was taken and stored */ function feeGrowthGlobals(IUniswapV3Pool pool, uint256 idx) external view returns ( uint256 feeGrowthGlobal0X128, uint256 feeGrowthGlobal1X128, uint32 timestamp ); /** * @notice Returns indices that the contract will use to access `feeGrowthGlobals` * @param pool The Uniswap pool for which array indices should be fetched * @return read The index that was closest to 24 hours old last time `estimate24H` was called * @return write The index that was written to last time `estimate24H` was called */ function feeGrowthGlobalsIndices(IUniswapV3Pool pool) external view returns (uint8 read, uint8 write); /** * @notice Updates cached metadata for a Uniswap pool. Must be called at least once * in order for volatility to be determined. Should also be called whenever * protocol fee changes * @param pool The Uniswap pool to poke */ function cacheMetadataFor(IUniswapV3Pool pool) external; /** * @notice Provides multiple estimates of IV using all stored `feeGrowthGlobals` entries for `pool` * @dev This is not meant to be used on-chain, and it doesn't contribute to the oracle's knowledge. * Please use `estimate24H` instead. * @param pool The pool to use for volatility estimate * @return IV The array of volatility estimates, scaled by 1e18 */ function lens(IUniswapV3Pool pool) external returns (uint256[25] memory IV); /** * @notice Estimates 24-hour implied volatility for a Uniswap pool. * @param pool The pool to use for volatility estimate * @return IV The estimated volatility, scaled by 1e18 */ function estimate24H(IUniswapV3Pool pool) external returns (uint256 IV); } ////// contracts/interfaces/IAloeBlendImmutables.sol /* pragma solidity ^0.8.10; */ /* import "./ISilo.sol"; */ /* import "./IVolatilityOracle.sol"; */ // solhint-disable func-name-mixedcase interface IAloeBlendImmutables { /// @notice The nominal time (in seconds) that the primary Uniswap position should stay in one place before /// being recentered function RECENTERING_INTERVAL() external view returns (uint24); /// @notice The minimum width (in ticks) of the primary Uniswap position function MIN_WIDTH() external view returns (int24); /// @notice The maximum width (in ticks) of the primary Uniswap position function MAX_WIDTH() external view returns (int24); /// @notice The maintenance budget buffer multiplier /// @dev The vault will attempt to build up a maintenance budget equal to the average cost of rebalance /// incentivization, multiplied by K. function K() external view returns (uint8); /// @notice If the maintenance budget drops below [its maximum size ➗ this value], `maintenanceIsSustainable` will /// become false. During the next rebalance, this will cause the primary Uniswap position to expand to its maximum /// width -- de-risking the vault until it has time to rebuild the maintenance budget. function L() external view returns (uint8); /// @notice The number of standard deviations (from volatilityOracle) to +/- from mean when choosing /// range for primary Uniswap position function B() external view returns (uint8); /// @notice The constraint factor for new gas price observations. The new observation cannot be less than (1 - 1/D) /// times the previous average. function D() external view returns (uint8); /// @notice The denominator applied to all earnings to determine what portion goes to maintenance budget /// @dev For example, if this is 10, then *at most* 1/10th of all revenue will be added to the maintenance budget. function MAINTENANCE_FEE() external view returns (uint8); /// @notice The percentage of funds (in basis points) that will be left in the contract after the primary Uniswap /// position is recentered. If your share of the pool is <<< than this, withdrawals will be more gas efficient. /// Also makes it less gassy to place limit orders. function FLOAT_PERCENTAGE() external view returns (uint256); /// @notice The volatility oracle used to decide position width function volatilityOracle() external view returns (IVolatilityOracle); /// @notice The silo where excess token0 is stored to earn yield function silo0() external view returns (ISilo); /// @notice The silo where excess token1 is stored to earn yield function silo1() external view returns (ISilo); } ////// contracts/interfaces/IAloeBlendState.sol /* pragma solidity ^0.8.10; */ /* import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; */ interface IAloeBlendState { /** * @notice A variety of key parameters used frequently in the vault's code, stored in a single slot to save gas * @dev If lower and upper bounds of a Uniswap position are equal, then the vault hasn't deposited liquidity to it * @return primaryLower The primary position's lower tick bound * @return primaryUpper The primary position's upper tick bound * @return limitLower The limit order's lower tick bound * @return limitUpper The limit order's upper tick bound * @return recenterTimestamp The `block.timestamp` from the last time the primary position moved * @return maxRebalanceGas The (approximate) maximum amount of gas that has ever been used to `rebalance()` this vault * @return maintenanceIsSustainable Whether `maintenanceBudget0` or `maintenanceBudget1` has filled up according to `K` * @return locked Whether the vault is currently locked to reentrancy */ function packedSlot() external view returns ( int24 primaryLower, int24 primaryUpper, int24 limitLower, int24 limitUpper, uint48 recenterTimestamp, uint32 maxRebalanceGas, bool maintenanceIsSustainable, bool locked ); /// @notice The amount of token0 that was in silo0 last time maintenanceBudget0 was updated function silo0Basis() external view returns (uint256); /// @notice The amount of token1 that was in silo1 last time maintenanceBudget1 was updated function silo1Basis() external view returns (uint256); /// @notice The amount of token0 available for `rebalance()` rewards function maintenanceBudget0() external view returns (uint256); /// @notice The amount of token1 available for `rebalance()` rewards function maintenanceBudget1() external view returns (uint256); /** * @notice The contract's opinion on the fair value of 1e4 units of gas, denominated in `_token` * @dev The value reported here is an average over 14 samples. Nominally there is 1 sample per day, but actual * timing isn't stored. Please do not use this as more than a low fidelity approximation/proxy for truth. * @param token The ERC20 token for which the average gas price should be retrieved * @return gasPrice The amount of `_token` that may motivate expenditure of 1e4 units of gas */ function gasPrices(address token) external view returns (uint256 gasPrice); } ////// contracts/interfaces/IAloeBlend.sol /* pragma solidity ^0.8.10; */ /* import "./IAloeBlendActions.sol"; */ /* import "./IAloeBlendDerivedState.sol"; */ /* import "./IAloeBlendEvents.sol"; */ /* import "./IAloeBlendImmutables.sol"; */ /* import "./IAloeBlendState.sol"; */ // solhint-disable no-empty-blocks /// @title Aloe Blend vault interface /// @dev The interface is broken up into many smaller pieces interface IAloeBlend is IAloeBlendActions, IAloeBlendDerivedState, IAloeBlendEvents, IAloeBlendImmutables, IAloeBlendState { } ////// contracts/interfaces/IFactory.sol /* pragma solidity ^0.8.10; */ /* import "./IAloeBlend.sol"; */ /* import "./ISilo.sol"; */ /* import "./IVolatilityOracle.sol"; */ interface IFactory { /// @notice The address of the volatility oracle function volatilityOracle() external view returns (IVolatilityOracle); /// @notice Reports the vault's address (if one exists for the chosen parameters) function getVault( IUniswapV3Pool pool, ISilo silo0, ISilo silo1 ) external view returns (IAloeBlend); /// @notice Reports whether the given vault was deployed by this factory function didCreateVault(IAloeBlend vault) external view returns (bool); /// @notice Creates a new Blend vault for the given pool + silo combination function createVault( IUniswapV3Pool pool, ISilo silo0, ISilo silo1 ) external returns (IAloeBlend); } ////// contracts/libraries/FullMath.sol /* pragma solidity ^0.8.10; */ /// @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) { // Handle division by zero require(denominator != 0); // 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)) } // Short circuit 256 by 256 division // This saves gas when a * b is small, at the cost of making the // large case a bit more expensive. Depending on your use case you // may want to remove this short circuit and always go through the // 512 bit path. if (prod1 == 0) { assembly { result := div(prod0, denominator) } return result; } /////////////////////////////////////////////// // 512 by 256 division. /////////////////////////////////////////////// // Handle overflow, the result must be < 2**256 require(prod1 < denominator); // Make division exact by subtracting the remainder from [prod1 prod0] // Compute remainder using mulmod // Note mulmod(_, _, 0) == 0 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. unchecked { // https://ethereum.stackexchange.com/a/96646 uint256 twos = (type(uint256).max - denominator + 1) & 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 // If denominator is zero the inverse starts with 2 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 // If denominator is zero, inv is now 128 // 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) { result = mulDiv(a, b, denominator); if (mulmod(a, b, denominator) > 0) { require(result < type(uint256).max); result++; } } } ////// contracts/libraries/Silo.sol /* pragma solidity ^0.8.10; */ /* import "@openzeppelin/contracts/utils/Address.sol"; */ /* import "contracts/interfaces/ISilo.sol"; */ library Silo { using Address for address; function delegate_poke(ISilo silo) internal { address(silo).functionDelegateCall(abi.encodeWithSelector(silo.poke.selector)); } function delegate_deposit(ISilo silo, uint256 amount) internal { address(silo).functionDelegateCall(abi.encodeWithSelector(silo.deposit.selector, amount)); } function delegate_withdraw(ISilo silo, uint256 amount) internal { address(silo).functionDelegateCall(abi.encodeWithSelector(silo.withdraw.selector, amount)); } } ////// contracts/libraries/TickMath.sol /* pragma solidity ^0.8.10; */ /// @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 { /// @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) { uint256 absTick = tick < 0 ? uint256(-int256(tick)) : uint256(int256(tick)); require(absTick <= uint256(uint24(MAX_TICK)), "T"); uint256 ratio = absTick & 0x1 != 0 ? 0xfffcb933bd6fad37aa2d162d1a594001 : 0x100000000000000000000000000000000; unchecked { 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) { // second inequality must be < because the price can never reach the price at the max tick require(sqrtPriceX96 >= MIN_SQRT_RATIO && sqrtPriceX96 < MAX_SQRT_RATIO, "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; } /// @notice Rounds down to the nearest tick where tick % tickSpacing == 0 /// @param tick The tick to round /// @param tickSpacing The tick spacing to round to /// @return the floored tick /// @dev Ensure tick +/- tickSpacing does not overflow or underflow int24 function floor(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod >= 0) return tick - mod; return tick - mod - tickSpacing; } } /// @notice Rounds up to the nearest tick where tick % tickSpacing == 0 /// @param tick The tick to round /// @param tickSpacing The tick spacing to round to /// @return the ceiled tick /// @dev Ensure tick +/- tickSpacing does not overflow or underflow int24 function ceil(int24 tick, int24 tickSpacing) internal pure returns (int24) { int24 mod = tick % tickSpacing; unchecked { if (mod > 0) return tick - mod + tickSpacing; return tick - mod; } } } ////// contracts/libraries/FixedPoint128.sol /* pragma solidity ^0.8.10; */ /// @title FixedPoint128 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) library FixedPoint128 { uint256 internal constant Q128 = 0x100000000000000000000000000000000; } ////// contracts/libraries/FixedPoint96.sol /* pragma solidity ^0.8.10; */ /// @title FixedPoint96 /// @notice A library for handling binary fixed point numbers, see https://en.wikipedia.org/wiki/Q_(number_format) library FixedPoint96 { uint8 internal constant RESOLUTION = 96; uint256 internal constant Q96 = 0x1000000000000000000000000; } ////// contracts/libraries/LiquidityAmounts.sol /* pragma solidity ^0.8.10; */ /* import "./FixedPoint96.sol"; */ /* import "./FullMath.sol"; */ /// @title Liquidity amount functions /// @notice Provides functions for computing liquidity amounts from token amounts and prices library LiquidityAmounts { /// @notice Downcasts uint256 to uint128 /// @param x The uint258 to be downcasted /// @return y The passed value, downcasted to uint128 function toUint128(uint256 x) private pure returns (uint128 y) { require((y = uint128(x)) == x); } /// @notice Computes the amount of liquidity received for a given amount of token0 and price range /// @dev Calculates amount0 * (sqrt(upper) * sqrt(lower)) / (sqrt(upper) - sqrt(lower)) /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount0 The amount0 being sent in /// @return liquidity The amount of returned liquidity function getLiquidityForAmount0( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); uint256 intermediate = FullMath.mulDiv(sqrtRatioAX96, sqrtRatioBX96, FixedPoint96.Q96); liquidity = toUint128(FullMath.mulDiv(amount0, intermediate, sqrtRatioBX96 - sqrtRatioAX96)); } /// @notice Computes the amount of liquidity received for a given amount of token1 and price range /// @dev Calculates amount1 / (sqrt(upper) - sqrt(lower)). /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount1 The amount1 being sent in /// @return liquidity The amount of returned liquidity function getLiquidityForAmount1( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); liquidity = toUint128(FullMath.mulDiv(amount1, FixedPoint96.Q96, sqrtRatioBX96 - sqrtRatioAX96)); } /// @notice Computes the maximum amount of liquidity received for a given amount of token0, token1, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param amount0 The amount of token0 being sent in /// @param amount1 The amount of token1 being sent in /// @return liquidity The maximum amount of liquidity received function getLiquidityForAmounts( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint256 amount0, uint256 amount1 ) internal pure returns (uint128 liquidity) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { liquidity = getLiquidityForAmount0(sqrtRatioAX96, sqrtRatioBX96, amount0); } else if (sqrtRatioX96 < sqrtRatioBX96) { uint128 liquidity0 = getLiquidityForAmount0(sqrtRatioX96, sqrtRatioBX96, amount0); uint128 liquidity1 = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioX96, amount1); liquidity = liquidity0 < liquidity1 ? liquidity0 : liquidity1; } else { liquidity = getLiquidityForAmount1(sqrtRatioAX96, sqrtRatioBX96, amount1); } } /// @notice Computes the amount of token0 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0. Will fit in a uint224 if you need it to function getAmount0ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); amount0 = FullMath.mulDiv( uint256(liquidity) << FixedPoint96.RESOLUTION, sqrtRatioBX96 - sqrtRatioAX96, sqrtRatioBX96 ) / sqrtRatioAX96; } /// @notice Computes the amount of token1 for a given amount of liquidity and a price range /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount1 The amount of token1. Will fit in a uint192 if you need it to function getAmount1ForLiquidity( uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); amount1 = FullMath.mulDiv(liquidity, sqrtRatioBX96 - sqrtRatioAX96, FixedPoint96.Q96); } /// @notice Computes the token0 and token1 value for a given amount of liquidity, the current /// pool prices and the prices at the tick boundaries /// @param sqrtRatioX96 A sqrt price representing the current pool prices /// @param sqrtRatioAX96 A sqrt price representing the first tick boundary /// @param sqrtRatioBX96 A sqrt price representing the second tick boundary /// @param liquidity The liquidity being valued /// @return amount0 The amount of token0 /// @return amount1 The amount of token1 function getAmountsForLiquidity( uint160 sqrtRatioX96, uint160 sqrtRatioAX96, uint160 sqrtRatioBX96, uint128 liquidity ) internal pure returns (uint256 amount0, uint256 amount1) { if (sqrtRatioAX96 > sqrtRatioBX96) (sqrtRatioAX96, sqrtRatioBX96) = (sqrtRatioBX96, sqrtRatioAX96); if (sqrtRatioX96 <= sqrtRatioAX96) { amount0 = getAmount0ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } else if (sqrtRatioX96 < sqrtRatioBX96) { amount0 = getAmount0ForLiquidity(sqrtRatioX96, sqrtRatioBX96, liquidity); amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioX96, liquidity); } else { amount1 = getAmount1ForLiquidity(sqrtRatioAX96, sqrtRatioBX96, liquidity); } } } ////// contracts/libraries/Uniswap.sol /* pragma solidity ^0.8.10; */ /* import "@uniswap/v3-core/contracts/interfaces/IUniswapV3Pool.sol"; */ /* import "./FixedPoint128.sol"; */ /* import "./LiquidityAmounts.sol"; */ /* import "./TickMath.sol"; */ library Uniswap { struct Position { // The pool the position is in IUniswapV3Pool pool; // Lower tick of the position int24 lower; // Upper tick of the position int24 upper; } /// @dev Do zero-burns to poke the Uniswap pools so earned fees are updated function poke(Position memory position) internal { if (position.lower == position.upper) return; (uint128 liquidity, , , , ) = info(position); if (liquidity != 0) { position.pool.burn(position.lower, position.upper, 0); } } /// @dev Deposits liquidity in a range on the Uniswap pool. function deposit(Position memory position, uint128 liquidity) internal returns (uint256 amount0, uint256 amount1) { if (liquidity != 0) { (amount0, amount1) = position.pool.mint(address(this), position.lower, position.upper, liquidity, ""); } } /// @dev Withdraws all liquidity and collects all fees function withdraw(Position memory position, uint128 liquidity) internal returns ( uint256 burned0, uint256 burned1, uint256 earned0, uint256 earned1 ) { if (liquidity != 0) { (burned0, burned1) = position.pool.burn(position.lower, position.upper, liquidity); } // Collect all owed tokens including earned fees (uint256 collected0, uint256 collected1) = position.pool.collect( address(this), position.lower, position.upper, type(uint128).max, type(uint128).max ); unchecked { earned0 = collected0 - burned0; earned1 = collected1 - burned1; } } /** * @notice Amounts of TOKEN0 and TOKEN1 held in vault's position. Includes * owed fees, except those accrued since last poke. */ function collectableAmountsAsOfLastPoke(Position memory position, uint160 sqrtPriceX96) internal view returns ( uint256, uint256, uint128 ) { if (position.lower == position.upper) return (0, 0, 0); (uint128 liquidity, , , uint128 earnable0, uint128 earnable1) = info(position); (uint256 burnable0, uint256 burnable1) = amountsForLiquidity(position, sqrtPriceX96, liquidity); return (burnable0 + earnable0, burnable1 + earnable1, liquidity); } /// @dev Wrapper around `IUniswapV3Pool.positions()`. function info(Position memory position) internal view returns ( uint128, // liquidity uint256, // feeGrowthInside0LastX128 uint256, // feeGrowthInside1LastX128 uint128, // tokensOwed0 uint128 // tokensOwed1 ) { return position.pool.positions(keccak256(abi.encodePacked(address(this), position.lower, position.upper))); } /// @dev Wrapper around `LiquidityAmounts.getAmountsForLiquidity()`. function amountsForLiquidity( Position memory position, uint160 sqrtPriceX96, uint128 liquidity ) internal pure returns (uint256, uint256) { return LiquidityAmounts.getAmountsForLiquidity( sqrtPriceX96, TickMath.getSqrtRatioAtTick(position.lower), TickMath.getSqrtRatioAtTick(position.upper), liquidity ); } /// @dev Wrapper around `LiquidityAmounts.getLiquidityForAmounts()`. function liquidityForAmounts( Position memory position, uint160 sqrtPriceX96, uint256 amount0, uint256 amount1 ) internal pure returns (uint128) { return LiquidityAmounts.getLiquidityForAmounts( sqrtPriceX96, TickMath.getSqrtRatioAtTick(position.lower), TickMath.getSqrtRatioAtTick(position.upper), amount0, amount1 ); } /// @dev Wrapper around `LiquidityAmounts.getLiquidityForAmount0()`. function liquidityForAmount0(Position memory position, uint256 amount0) internal pure returns (uint128) { return LiquidityAmounts.getLiquidityForAmount0( TickMath.getSqrtRatioAtTick(position.lower), TickMath.getSqrtRatioAtTick(position.upper), amount0 ); } /// @dev Wrapper around `LiquidityAmounts.getLiquidityForAmount1()`. function liquidityForAmount1(Position memory position, uint256 amount1) internal pure returns (uint128) { return LiquidityAmounts.getLiquidityForAmount1( TickMath.getSqrtRatioAtTick(position.lower), TickMath.getSqrtRatioAtTick(position.upper), amount1 ); } } ////// lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol /* pragma solidity ^0.8.0; */ /* import "../IERC20.sol"; */ /** * @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); } ////// contracts/AloeBlend.sol /* pragma solidity ^0.8.10; */ /* import "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; */ /* import "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol"; */ /* import "contracts/libraries/FullMath.sol"; */ /* import "contracts/libraries/TickMath.sol"; */ /* import "contracts/libraries/Silo.sol"; */ /* import "contracts/libraries/Uniswap.sol"; */ /* import {IFactory} from "./interfaces/IFactory.sol"; */ /* import {IAloeBlend, IAloeBlendActions, IAloeBlendDerivedState, IAloeBlendEvents, IAloeBlendImmutables, IAloeBlendState} from "./interfaces/IAloeBlend.sol"; */ /* import {IVolatilityOracle} from "./interfaces/IVolatilityOracle.sol"; */ /* import "./AloeBlendERC20.sol"; */ /* import "./UniswapHelper.sol"; */ /* # ### ##### # ####### *###* ### ######### ######## ##### ########### ########### ######## ############ ############ ######## ########### *############## ########### ######## ################# ############ ### ################# ############ ################## ############# #################* *#############* ############## ############# ##################################### ############### ####****** #######################* ################ ################# *############################* ############## ###################################### ######## ################* **######* ### ### */ uint256 constant Q96 = 2**96; contract AloeBlend is AloeBlendERC20, UniswapHelper, IAloeBlend { using SafeERC20 for IERC20; using Uniswap for Uniswap.Position; using Silo for ISilo; /// @inheritdoc IAloeBlendImmutables uint24 public constant RECENTERING_INTERVAL = 24 hours; // aim to recenter once per day /// @inheritdoc IAloeBlendImmutables int24 public constant MIN_WIDTH = 402; // 1% of inventory in primary Uniswap position /// @inheritdoc IAloeBlendImmutables int24 public constant MAX_WIDTH = 27728; // 50% of inventory in primary Uniswap position /// @inheritdoc IAloeBlendImmutables uint8 public constant K = 20; // maintenance budget should cover at least 20 rebalances /// @inheritdoc IAloeBlendImmutables uint8 public constant L = 4; // if maintenance budget drops below 1/4th of its max value, consider it unsustainable /// @inheritdoc IAloeBlendImmutables uint8 public constant B = 2; // primary Uniswap position should cover 95% (2 std. dev.) of trading activity /// @inheritdoc IAloeBlendImmutables uint8 public constant D = 10; // new gas price observations must not be less than [avg - avg/10] /// @inheritdoc IAloeBlendImmutables uint8 public constant MAINTENANCE_FEE = 10; // 1/10th of earnings from primary Uniswap position /// @inheritdoc IAloeBlendImmutables uint256 public constant FLOAT_PERCENTAGE = 500; // 5% of inventory sits in contract to cheapen small withdrawals /// @dev The minimum tick that can serve as a position boundary in the Uniswap pool int24 private immutable MIN_TICK; /// @dev The maximum tick that can serve as a position boundary in the Uniswap pool int24 private immutable MAX_TICK; /// @inheritdoc IAloeBlendImmutables IVolatilityOracle public immutable volatilityOracle; /// @inheritdoc IAloeBlendImmutables ISilo public immutable silo0; /// @inheritdoc IAloeBlendImmutables ISilo public immutable silo1; struct PackedSlot { // The primary position's lower tick bound int24 primaryLower; // The primary position's upper tick bound int24 primaryUpper; // The limit order's lower tick bound int24 limitLower; // The limit order's upper tick bound int24 limitUpper; // The `block.timestamp` from the last time the primary position moved uint48 recenterTimestamp; // The (approximate) maximum amount of gas that has ever been used to `rebalance()` this vault uint32 maxRebalanceGas; // Whether `maintenanceBudget0` or `maintenanceBudget1` is filled up bool maintenanceIsSustainable; // Whether the vault is currently locked to reentrancy bool locked; } /// @inheritdoc IAloeBlendState PackedSlot public packedSlot; /// @inheritdoc IAloeBlendState uint256 public silo0Basis; /// @inheritdoc IAloeBlendState uint256 public silo1Basis; /// @inheritdoc IAloeBlendState uint256 public maintenanceBudget0; /// @inheritdoc IAloeBlendState uint256 public maintenanceBudget1; /// @inheritdoc IAloeBlendState mapping(address => uint256) public gasPrices; /// @dev Stores 14 samples of the gas price for each token, scaled by 1e4 and divided by 14. The sum over each /// array is equal to the value reported by `gasPrices` mapping(address => uint256[14]) private gasPriceArrays; /// @dev The index of `gasPriceArrays[address]` in which the next gas price measurement will be stored mapping(address => uint8) private gasPriceIdxs; /// @dev Required for some silos receive() external payable {} constructor( IUniswapV3Pool _uniPool, ISilo _silo0, ISilo _silo1 ) AloeBlendERC20( // ex: Aloe Blend USDC/WETH string( abi.encodePacked( "Aloe Blend ", IERC20Metadata(_uniPool.token0()).symbol(), "/", IERC20Metadata(_uniPool.token1()).symbol() ) ) ) UniswapHelper(_uniPool) { MIN_TICK = TickMath.ceil(TickMath.MIN_TICK, TICK_SPACING); MAX_TICK = TickMath.floor(TickMath.MAX_TICK, TICK_SPACING); volatilityOracle = IFactory(msg.sender).volatilityOracle(); silo0 = _silo0; silo1 = _silo1; packedSlot.recenterTimestamp = uint48(block.timestamp); } /// @inheritdoc IAloeBlendActions function deposit( uint256 amount0Max, uint256 amount1Max, uint256 amount0Min, uint256 amount1Min ) external returns ( uint256 shares, uint256 amount0, uint256 amount1 ) { require(amount0Max != 0 || amount1Max != 0, "Aloe: 0 deposit"); // Reentrancy guard is embedded in `_loadPackedSlot` to save gas (Uniswap.Position memory primary, Uniswap.Position memory limit, , , ) = _loadPackedSlot(); packedSlot.locked = true; // Poke all assets primary.poke(); limit.poke(); silo0.delegate_poke(); silo1.delegate_poke(); (uint160 sqrtPriceX96, , , , , , ) = UNI_POOL.slot0(); (uint256 inventory0, uint256 inventory1, ) = _getInventory(primary, limit, sqrtPriceX96, true); (shares, amount0, amount1) = _computeLPShares( totalSupply, inventory0, inventory1, amount0Max, amount1Max, sqrtPriceX96 ); require(shares != 0, "Aloe: 0 shares"); require(amount0 >= amount0Min, "Aloe: amount0 too low"); require(amount1 >= amount1Min, "Aloe: amount1 too low"); // Pull in tokens from sender TOKEN0.safeTransferFrom(msg.sender, address(this), amount0); TOKEN1.safeTransferFrom(msg.sender, address(this), amount1); // Mint shares _mint(msg.sender, shares); emit Deposit(msg.sender, shares, amount0, amount1); packedSlot.locked = false; } /// @inheritdoc IAloeBlendActions function withdraw( uint256 shares, uint256 amount0Min, uint256 amount1Min ) external returns (uint256 amount0, uint256 amount1) { require(shares != 0, "Aloe: 0 shares"); // Reentrancy guard is embedded in `_loadPackedSlot` to save gas (Uniswap.Position memory primary, Uniswap.Position memory limit, , , ) = _loadPackedSlot(); packedSlot.locked = true; // Poke silos to ensure reported balances are correct silo0.delegate_poke(); silo1.delegate_poke(); uint256 _totalSupply = totalSupply; uint256 a; uint256 b; uint256 c; uint256 d; // Compute user's portion of token0 from contract + silo0 c = _balance0(); a = silo0Basis; b = silo0.balanceOf(address(this)); a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE amount0 = FullMath.mulDiv(c + b - a, shares, _totalSupply); // Withdraw from silo0 if contract balance can't cover what user is owed if (amount0 > c) { c = a + amount0 - c; silo0.delegate_withdraw(c); maintenanceBudget0 += a; silo0Basis = b - c; } // Compute user's portion of token1 from contract + silo1 c = _balance1(); a = silo1Basis; b = silo1.balanceOf(address(this)); a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE amount1 = FullMath.mulDiv(c + b - a, shares, _totalSupply); // Withdraw from silo1 if contract balance can't cover what user is owed if (amount1 > c) { c = a + amount1 - c; silo1.delegate_withdraw(c); maintenanceBudget1 += a; silo1Basis = b - c; } // Withdraw user's portion of the primary position { (uint128 liquidity, , , , ) = primary.info(); (a, b, c, d) = primary.withdraw(uint128(FullMath.mulDiv(liquidity, shares, _totalSupply))); amount0 += a; amount1 += b; a = c / MAINTENANCE_FEE; b = d / MAINTENANCE_FEE; amount0 += FullMath.mulDiv(c - a, shares, _totalSupply); amount1 += FullMath.mulDiv(d - b, shares, _totalSupply); maintenanceBudget0 += a; maintenanceBudget1 += b; } // Withdraw user's portion of the limit order if (limit.lower != limit.upper) { (uint128 liquidity, , , , ) = limit.info(); (a, b, c, d) = limit.withdraw(uint128(FullMath.mulDiv(liquidity, shares, _totalSupply))); amount0 += a + FullMath.mulDiv(c, shares, _totalSupply); amount1 += b + FullMath.mulDiv(d, shares, _totalSupply); } // Check constraints require(amount0 >= amount0Min, "Aloe: amount0 too low"); require(amount1 >= amount1Min, "Aloe: amount1 too low"); // Transfer tokens TOKEN0.safeTransfer(msg.sender, amount0); TOKEN1.safeTransfer(msg.sender, amount1); // Burn shares _burn(msg.sender, shares); emit Withdraw(msg.sender, shares, amount0, amount1); packedSlot.locked = false; } struct RebalanceCache { uint160 sqrtPriceX96; uint224 priceX96; int24 tick; } /// @inheritdoc IAloeBlendActions function rebalance(address rewardToken) external { uint32 gas = uint32(gasleft()); // Reentrancy guard is embedded in `_loadPackedSlot` to save gas ( Uniswap.Position memory primary, Uniswap.Position memory limit, uint48 recenterTimestamp, uint32 maxRebalanceGas, bool maintenanceIsSustainable ) = _loadPackedSlot(); packedSlot.locked = true; // Populate rebalance cache RebalanceCache memory cache; (cache.sqrtPriceX96, cache.tick, , , , , ) = UNI_POOL.slot0(); cache.priceX96 = uint224(FullMath.mulDiv(cache.sqrtPriceX96, cache.sqrtPriceX96, Q96)); uint32 urgency = _getRebalanceUrgency(recenterTimestamp); // Poke silos to ensure reported balances are correct silo0.delegate_poke(); silo1.delegate_poke(); // Check inventory (uint256 inventory0, uint256 inventory1, InventoryDetails memory d) = _getInventory( primary, limit, cache.sqrtPriceX96, false ); // Remove the limit order if it exists if (d.limitLiquidity != 0) limit.withdraw(d.limitLiquidity); // Compute inventory ratio to determine what happens next uint256 ratio = FullMath.mulDiv( 10_000, inventory0, inventory0 + FullMath.mulDiv(inventory1, Q96, cache.priceX96) ); if (ratio < 4900) { // Attempt to sell token1 for token0. Choose limit order bounds below the market price. Disable // incentive if removing & replacing in the same spot limit.upper = TickMath.floor(cache.tick, TICK_SPACING); if (d.limitLiquidity != 0 && limit.lower == limit.upper - TICK_SPACING) urgency = 0; limit.lower = limit.upper - TICK_SPACING; // Choose amount1 such that ratio will be 50/50 once the limit order is pushed through (division by 2 // is a good approximation for small tickSpacing). Also have to constrain to fluid1 since we're not // yet withdrawing from primary Uniswap position uint256 amount1 = (inventory1 - FullMath.mulDiv(inventory0, cache.priceX96, Q96)) >> 1; if (amount1 > d.fluid1) amount1 = d.fluid1; // If contract balance is insufficient, withdraw from silo1. That still may not be enough, so reassign // `amount1` to the actual available amount unchecked { uint256 balance1 = _balance1(); if (balance1 < amount1) amount1 = balance1 + _silo1Withdraw(amount1 - balance1); } // Place a new limit order limit.deposit(limit.liquidityForAmount1(amount1)); } else if (ratio > 5100) { // Attempt to sell token0 for token1. Choose limit order bounds above the market price. Disable // incentive if removing & replacing in the same spot limit.lower = TickMath.ceil(cache.tick, TICK_SPACING); if (d.limitLiquidity != 0 && limit.upper == limit.lower + TICK_SPACING) urgency = 0; limit.upper = limit.lower + TICK_SPACING; // Choose amount0 such that ratio will be 50/50 once the limit order is pushed through (division by 2 // is a good approximation for small tickSpacing). Also have to constrain to fluid0 since we're not // yet withdrawing from primary Uniswap position uint256 amount0 = (inventory0 - FullMath.mulDiv(inventory1, Q96, cache.priceX96)) >> 1; if (amount0 > d.fluid0) amount0 = d.fluid0; // If contract balance is insufficient, withdraw from silo0. That still may not be enough, so reassign // `amount0` to the actual available amount unchecked { uint256 balance0 = _balance0(); if (balance0 < amount0) amount0 = balance0 + _silo0Withdraw(amount0 - balance0); } // Place a new limit order limit.deposit(limit.liquidityForAmount0(amount0)); } else { // Zero-out the limit struct to indicate that it's inactive delete limit; // Recenter the primary position primary = _recenter(cache, primary, d.primaryLiquidity, inventory0, inventory1, maintenanceIsSustainable); recenterTimestamp = uint48(block.timestamp); } gas = uint32(21000 + gas - gasleft()); if (gas > maxRebalanceGas) maxRebalanceGas = gas; maintenanceIsSustainable = _rewardCaller(rewardToken, urgency, gas, maxRebalanceGas, maintenanceIsSustainable); emit Rebalance(ratio, totalSupply, inventory0, inventory1); packedSlot = PackedSlot( primary.lower, primary.upper, limit.lower, limit.upper, recenterTimestamp, maxRebalanceGas, maintenanceIsSustainable, false ); } /** * @notice Recenters the primary Uniswap position around the current tick. Deposits leftover funds into the silos. * @dev This function assumes that the limit order has no liquidity (never existed or already exited) * @param _cache The rebalance cache, populated with sqrtPriceX96, priceX96, and tick * @param _primary The existing primary Uniswap position * @param _primaryLiquidity The amount of liquidity currently in `_primary` * @param _inventory0 The amount of token0 underlying all LP tokens. MUST BE <= THE TRUE VALUE. No overestimates! * @param _inventory1 The amount of token1 underlying all LP tokens. MUST BE <= THE TRUE VALUE. No overestimates! * @param _maintenanceIsSustainable Whether `maintenanceBudget0` or `maintenanceBudget1` has filled up according to * `K` -- if false, position width is maximized rather than scaling with volatility * @return Uniswap.Position memory `_primary` updated with new lower and upper tick bounds */ function _recenter( RebalanceCache memory _cache, Uniswap.Position memory _primary, uint128 _primaryLiquidity, uint256 _inventory0, uint256 _inventory1, bool _maintenanceIsSustainable ) private returns (Uniswap.Position memory) { // Exit primary Uniswap position unchecked { (, , uint256 earned0, uint256 earned1) = _primary.withdraw(_primaryLiquidity); maintenanceBudget0 += earned0 / MAINTENANCE_FEE; maintenanceBudget1 += earned1 / MAINTENANCE_FEE; } // Decide primary position width... int24 w = _maintenanceIsSustainable ? _computeNextPositionWidth(volatilityOracle.estimate24H(UNI_POOL)) : MAX_WIDTH; w = w >> 1; // ...and compute amounts that should be placed inside (uint256 amount0, uint256 amount1) = _computeMagicAmounts(_inventory0, _inventory1, w); // If contract balance (leaving out the float) is insufficient, withdraw from silos int256 balance0; int256 balance1; unchecked { balance0 = int256(_balance0()) - int256(FullMath.mulDiv(_inventory0, FLOAT_PERCENTAGE, 10_000)); balance1 = int256(_balance1()) - int256(FullMath.mulDiv(_inventory1, FLOAT_PERCENTAGE, 10_000)); if (balance0 < int256(amount0)) { _inventory0 = 0; // reuse var to avoid stack too deep. now a flag, 0 means we withdraw from silo0 amount0 = uint256(balance0 + int256(_silo0Withdraw(uint256(int256(amount0) - balance0)))); } if (balance1 < int256(amount1)) { _inventory1 = 0; // reuse var to avoid stack too deep. now a flag, 0 means we withdraw from silo1 amount1 = uint256(balance1 + int256(_silo1Withdraw(uint256(int256(amount1) - balance1)))); } } // Update primary position's ticks unchecked { _primary.lower = TickMath.floor(_cache.tick - w, TICK_SPACING); _primary.upper = TickMath.ceil(_cache.tick + w, TICK_SPACING); if (_primary.lower < MIN_TICK) _primary.lower = MIN_TICK; if (_primary.upper > MAX_TICK) _primary.upper = MAX_TICK; } // Place some liquidity in Uniswap (amount0, amount1) = _primary.deposit(_primary.liquidityForAmounts(_cache.sqrtPriceX96, amount0, amount1)); // Place excess into silos if (_inventory0 != 0) { silo0.delegate_deposit(uint256(balance0) - amount0); silo0Basis += uint256(balance0) - amount0; } if (_inventory1 != 0) { silo1.delegate_deposit(uint256(balance1) - amount1); silo1Basis += uint256(balance1) - amount1; } emit Recenter(_primary.lower, _primary.upper); return _primary; } /** * @notice Sends some `_rewardToken` to `msg.sender` as a reward for calling rebalance * @param _rewardToken The ERC20 token in which the reward should be denominated. If `rewardToken` is the 0 * address, no reward will be given. * @param _urgency How critical it is that rebalance gets called right now. Nominal value is 100_000 * @param _gasUsed How much gas was used for core rebalance logic * @param _maxRebalanceGas The (approximate) maximum amount of gas that's ever been used for `rebalance()` * @param _maintenanceIsSustainable Whether the most recently-used maintenance budget was filled up after the * last rebalance * @return bool If `_rewardToken` is token0 or token1, return whether the maintenance budget will remain full * after sending reward. If `_rewardToken` is something else, return previous _maintenanceIsSustainable value */ function _rewardCaller( address _rewardToken, uint32 _urgency, uint32 _gasUsed, uint32 _maxRebalanceGas, bool _maintenanceIsSustainable ) private returns (bool) { // Short-circuit if the caller doesn't want to be rewarded if (_rewardToken == address(0)) { emit Reward(address(0), 0, _urgency); return _maintenanceIsSustainable; } // Otherwise, do math uint256 rewardPerGas = gasPrices[_rewardToken]; // extra factor of 1e4 uint256 reward = FullMath.mulDiv(rewardPerGas * _gasUsed, _urgency, 1e9); if (_rewardToken == address(TOKEN0)) { uint256 budget = maintenanceBudget0; if (reward > budget || rewardPerGas == 0) reward = budget; budget -= reward; uint256 maxBudget = FullMath.mulDiv(rewardPerGas * K, _maxRebalanceGas, 1e4); maintenanceBudget0 = budget > maxBudget ? maxBudget : budget; if (budget > maxBudget) _maintenanceIsSustainable = true; else if (budget < maxBudget / L) _maintenanceIsSustainable = false; } else if (_rewardToken == address(TOKEN1)) { uint256 budget = maintenanceBudget1; if (reward > budget || rewardPerGas == 0) reward = budget; budget -= reward; uint256 maxBudget = FullMath.mulDiv(rewardPerGas * K, _maxRebalanceGas, 1e4); maintenanceBudget1 = budget > maxBudget ? maxBudget : budget; if (budget > maxBudget) _maintenanceIsSustainable = true; else if (budget < maxBudget / L) _maintenanceIsSustainable = false; } else { uint256 budget = IERC20(_rewardToken).balanceOf(address(this)); if (reward > budget || rewardPerGas == 0) reward = budget; require(silo0.shouldAllowRemovalOf(_rewardToken) && silo1.shouldAllowRemovalOf(_rewardToken)); } IERC20(_rewardToken).safeTransfer(msg.sender, reward); _pushGasPrice(_rewardToken, FullMath.mulDiv(1e4, reward, _gasUsed)); emit Reward(_rewardToken, reward, _urgency); return _maintenanceIsSustainable; } /** * @notice Attempts to withdraw `_amount` from silo0. If `_amount` is more than what's available, withdraw the * maximum amount. * @dev This reads and writes from/to `maintenanceBudget0`, so use sparingly * @param _amount The desired amount of token0 to withdraw from silo0 * @return uint256 The actual amount of token0 that was withdrawn */ function _silo0Withdraw(uint256 _amount) private returns (uint256) { unchecked { uint256 a = silo0Basis; uint256 b = silo0.balanceOf(address(this)); a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE if (_amount > b - a) _amount = b - a; silo0.delegate_withdraw(a + _amount); maintenanceBudget0 += a; silo0Basis = b - a - _amount; return _amount; } } /** * @notice Attempts to withdraw `_amount` from silo1. If `_amount` is more than what's available, withdraw the * maximum amount. * @dev This reads and writes from/to `maintenanceBudget1`, so use sparingly * @param _amount The desired amount of token1 to withdraw from silo1 * @return uint256 The actual amount of token1 that was withdrawn */ function _silo1Withdraw(uint256 _amount) private returns (uint256) { unchecked { uint256 a = silo1Basis; uint256 b = silo1.balanceOf(address(this)); a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE if (_amount > b - a) _amount = b - a; silo1.delegate_withdraw(a + _amount); maintenanceBudget1 += a; silo1Basis = b - a - _amount; return _amount; } } /** * @dev Assumes that `_gasPrice` represents the fair value of 1e4 units of gas, denominated in `_token`. * Updates the contract's gas price oracle accordingly, including incrementing the array index. * @param _token The ERC20 token for which average gas price should be updated * @param _gasPrice The amount of `_token` necessary to incentivize expenditure of 1e4 units of gas */ function _pushGasPrice(address _token, uint256 _gasPrice) private { uint256[14] storage array = gasPriceArrays[_token]; uint8 idx = gasPriceIdxs[_token]; unchecked { // New entry cannot be lower than 90% of the previous average uint256 average = gasPrices[_token]; uint256 minimum = average - average / D; if (_gasPrice < minimum) _gasPrice = minimum; _gasPrice /= 14; gasPrices[_token] = average + _gasPrice - array[idx]; array[idx] = _gasPrice; gasPriceIdxs[_token] = (idx + 1) % 14; } } // ⬇️⬇️⬇️⬇️ VIEW FUNCTIONS ⬇️⬇️⬇️⬇️ ------------------------------------------------------------------------------ /// @dev Unpacks `packedSlot` from storage, ensuring that `_packedSlot.locked == false` function _loadPackedSlot() private view returns ( Uniswap.Position memory, Uniswap.Position memory, uint48, uint32, bool ) { PackedSlot memory _packedSlot = packedSlot; require(!_packedSlot.locked); return ( Uniswap.Position(UNI_POOL, _packedSlot.primaryLower, _packedSlot.primaryUpper), Uniswap.Position(UNI_POOL, _packedSlot.limitLower, _packedSlot.limitUpper), _packedSlot.recenterTimestamp, _packedSlot.maxRebalanceGas, _packedSlot.maintenanceIsSustainable ); } /// @inheritdoc IAloeBlendDerivedState function getRebalanceUrgency() external view returns (uint32 urgency) { urgency = _getRebalanceUrgency(packedSlot.recenterTimestamp); } /** * @notice Reports how badly the vault wants its `rebalance()` function to be called. Proportional to time * elapsed since the primary position last moved. * @dev Since `RECENTERING_INTERVAL` is 86400 seconds, urgency is guaranteed to be nonzero unless the primary * position is moved more than once in a single block. * @param _recenterTimestamp The `block.timestamp` from the last time the primary position moved * @return urgency How badly the vault wants its `rebalance()` function to be called */ function _getRebalanceUrgency(uint48 _recenterTimestamp) private view returns (uint32 urgency) { urgency = uint32(FullMath.mulDiv(100_000, block.timestamp - _recenterTimestamp, RECENTERING_INTERVAL)); } /// @inheritdoc IAloeBlendDerivedState function getInventory() external view returns (uint256 inventory0, uint256 inventory1) { (Uniswap.Position memory primary, Uniswap.Position memory limit, , , ) = _loadPackedSlot(); (uint160 sqrtPriceX96, , , , , , ) = UNI_POOL.slot0(); (inventory0, inventory1, ) = _getInventory(primary, limit, sqrtPriceX96, false); } struct InventoryDetails { // The amount of token0 available to limit order, i.e. everything *not* in the primary position uint256 fluid0; // The amount of token1 available to limit order, i.e. everything *not* in the primary position uint256 fluid1; // The liquidity present in the primary position. Note that this may be higher than what the // vault deposited since someone may designate this contract as a `mint()` recipient uint128 primaryLiquidity; // The liquidity present in the limit order. Note that this may be higher than what the // vault deposited since someone may designate this contract as a `mint()` recipient uint128 limitLiquidity; } /** * @notice Estimate's the vault's liabilities to users -- in other words, how much would be paid out if all * holders redeemed their LP tokens at once. * @dev Underestimates the true payout unless both silos and Uniswap positions have just been poked. Also... * if _overestimate is false * Assumes that the maximum amount will accrue to the maintenance budget during the next `rebalance()`. If it * takes less than that for the budget to reach capacity, then the values reported here may increase after * calling `rebalance()`. * if _overestimate is true * Assumes that nothing will accrue to the maintenance budget during the next `rebalance()`. So the values * reported here may decrease after calling `rebalance()`, i.e. this becomes an overestimate rather than an * underestimate. * @param _primary The primary position * @param _limit The limit order; if inactive, `_limit.lower` should equal `_limit.upper` * @param _sqrtPriceX96 The current sqrt(price) of the Uniswap pair from `slot0()` * @param _overestimate Whether to error on the side of overestimating or underestimating * @return inventory0 The amount of token0 underlying all LP tokens * @return inventory1 The amount of token1 underlying all LP tokens * @return d A struct containing details that may be relevant to other functions. We return it here to avoid * reloading things from external storage (saves gas). */ function _getInventory( Uniswap.Position memory _primary, Uniswap.Position memory _limit, uint160 _sqrtPriceX96, bool _overestimate ) private view returns ( uint256 inventory0, uint256 inventory1, InventoryDetails memory d ) { uint256 a; uint256 b; // Limit order if (_limit.lower != _limit.upper) { (d.limitLiquidity, , , a, b) = _limit.info(); (d.fluid0, d.fluid1) = _limit.amountsForLiquidity(_sqrtPriceX96, d.limitLiquidity); // Earnings from limit order don't get added to maintenance budget d.fluid0 += a; d.fluid1 += b; } // token0 from contract + silo0 a = silo0Basis; b = silo0.balanceOf(address(this)); a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE d.fluid0 += _balance0() + b - (_overestimate ? 0 : a); // token1 from contract + silo1 a = silo1Basis; b = silo1.balanceOf(address(this)); a = b > a ? (b - a) / MAINTENANCE_FEE : 0; // interest / MAINTENANCE_FEE d.fluid1 += _balance1() + b - (_overestimate ? 0 : a); // Primary position; limit order is placed without touching this, so its amounts aren't included in `fluid` if (_primary.lower != _primary.upper) { (d.primaryLiquidity, , , a, b) = _primary.info(); (inventory0, inventory1) = _primary.amountsForLiquidity(_sqrtPriceX96, d.primaryLiquidity); inventory0 += d.fluid0 + a - (_overestimate ? 0 : a / MAINTENANCE_FEE); inventory1 += d.fluid1 + b - (_overestimate ? 0 : b / MAINTENANCE_FEE); } else { inventory0 = d.fluid0; inventory1 = d.fluid1; } } /// @dev The amount of token0 in the contract that's not in maintenanceBudget0 function _balance0() private view returns (uint256) { return TOKEN0.balanceOf(address(this)) - maintenanceBudget0; } /// @dev The amount of token1 in the contract that's not in maintenanceBudget1 function _balance1() private view returns (uint256) { return TOKEN1.balanceOf(address(this)) - maintenanceBudget1; } // ⬆️⬆️⬆️⬆️ VIEW FUNCTIONS ⬆️⬆️⬆️⬆️ ------------------------------------------------------------------------------ // ⬇️⬇️⬇️⬇️ PURE FUNCTIONS ⬇️⬇️⬇️⬇️ ------------------------------------------------------------------------------ /// @dev Computes position width based on volatility. Doesn't revert function _computeNextPositionWidth(uint256 _sigma) internal pure returns (int24) { if (_sigma <= 9.9491783619e15) return MIN_WIDTH; // \frac{1e18}{B} (1 - \frac{1}{1.0001^(MIN_WIDTH / 2)}) if (_sigma >= 3.7500454036e17) return MAX_WIDTH; // \frac{1e18}{B} (1 - \frac{1}{1.0001^(MAX_WIDTH / 2)}) _sigma *= B; // scale by a constant factor to increase confidence unchecked { uint160 ratio = uint160((Q96 * 1e18) / (1e18 - _sigma)); return TickMath.getTickAtSqrtRatio(ratio); } } /// @dev Computes amounts that should be placed in primary Uniswap position to maintain 50/50 inventory ratio. /// Doesn't revert as long as MIN_WIDTH <= _halfWidth * 2 <= MAX_WIDTH function _computeMagicAmounts( uint256 _inventory0, uint256 _inventory1, int24 _halfWidth ) internal pure returns (uint256 amount0, uint256 amount1) { // the fraction of total inventory (X96) that should be put into primary Uniswap order to mimic Uniswap v2 uint96 magic = uint96(Q96 - TickMath.getSqrtRatioAtTick(-_halfWidth)); amount0 = FullMath.mulDiv(_inventory0, magic, Q96); amount1 = FullMath.mulDiv(_inventory1, magic, Q96); } /// @dev Computes the largest possible `amount0` and `amount1` such that they match the current inventory ratio, /// but are not greater than `_amount0Max` and `_amount1Max` respectively. May revert if the following are true: /// _totalSupply * _amount0Max / _inventory0 > type(uint256).max /// _totalSupply * _amount1Max / _inventory1 > type(uint256).max /// This is okay because it only blocks deposit (not withdraw). Can also workaround by depositing smaller amounts function _computeLPShares( uint256 _totalSupply, uint256 _inventory0, uint256 _inventory1, uint256 _amount0Max, uint256 _amount1Max, uint160 _sqrtPriceX96 ) internal pure returns ( uint256 shares, uint256 amount0, uint256 amount1 ) { // If total supply > 0, pool can't be empty assert(_totalSupply == 0 || _inventory0 != 0 || _inventory1 != 0); if (_totalSupply == 0) { // For first deposit, enforce 50/50 ratio manually uint224 priceX96 = uint224(FullMath.mulDiv(_sqrtPriceX96, _sqrtPriceX96, Q96)); amount0 = FullMath.mulDiv(_amount1Max, Q96, priceX96); if (amount0 < _amount0Max) { amount1 = _amount1Max; shares = amount1; } else { amount0 = _amount0Max; amount1 = FullMath.mulDiv(amount0, priceX96, Q96); shares = amount0; } } else if (_inventory0 == 0) { amount1 = _amount1Max; shares = FullMath.mulDiv(amount1, _totalSupply, _inventory1); } else if (_inventory1 == 0) { amount0 = _amount0Max; shares = FullMath.mulDiv(amount0, _totalSupply, _inventory0); } else { // The branches of this ternary are logically identical, but must be separate to avoid overflow bool cond = _inventory0 < _inventory1 ? FullMath.mulDiv(_amount1Max, _inventory0, _inventory1) < _amount0Max : _amount1Max < FullMath.mulDiv(_amount0Max, _inventory1, _inventory0); if (cond) { amount1 = _amount1Max; amount0 = FullMath.mulDiv(amount1, _inventory0, _inventory1); shares = FullMath.mulDiv(amount1, _totalSupply, _inventory1); } else { amount0 = _amount0Max; amount1 = FullMath.mulDiv(amount0, _inventory1, _inventory0); shares = FullMath.mulDiv(amount0, _totalSupply, _inventory0); } } } }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"contract IUniswapV3Pool","name":"_uniPool","type":"address"},{"internalType":"contract ISilo","name":"_silo0","type":"address"},{"internalType":"contract ISilo","name":"_silo1","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"owner","type":"address"},{"indexed":true,"internalType":"address","name":"spender","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Approval","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Deposit","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"uint256","name":"ratio","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inventory0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"inventory1","type":"uint256"}],"name":"Rebalance","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"int24","name":"lower","type":"int24"},{"indexed":false,"internalType":"int24","name":"upper","type":"int24"}],"name":"Recenter","type":"event"},{"anonymous":false,"inputs":[{"indexed":false,"internalType":"address","name":"token","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"},{"indexed":false,"internalType":"uint32","name":"urgency","type":"uint32"}],"name":"Reward","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"from","type":"address"},{"indexed":true,"internalType":"address","name":"to","type":"address"},{"indexed":false,"internalType":"uint256","name":"amount","type":"uint256"}],"name":"Transfer","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"sender","type":"address"},{"indexed":false,"internalType":"uint256","name":"shares","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount0","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"amount1","type":"uint256"}],"name":"Withdraw","type":"event"},{"inputs":[],"name":"B","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"D","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DOMAIN_SEPARATOR","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"FLOAT_PERCENTAGE","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"K","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"L","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAINTENANCE_FEE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_WIDTH","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_WIDTH","outputs":[{"internalType":"int24","name":"","type":"int24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PERMIT_TYPEHASH","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"RECENTERING_INTERVAL","outputs":[{"internalType":"uint24","name":"","type":"uint24"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN0","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"TOKEN1","outputs":[{"internalType":"contract IERC20","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UNI_POOL","outputs":[{"internalType":"contract IUniswapV3Pool","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"},{"internalType":"address","name":"","type":"address"}],"name":"allowance","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"approve","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"balanceOf","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"amount0Max","type":"uint256"},{"internalType":"uint256","name":"amount1Max","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"name":"deposit","outputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"gasPrices","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getInventory","outputs":[{"internalType":"uint256","name":"inventory0","type":"uint256"},{"internalType":"uint256","name":"inventory1","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"getRebalanceUrgency","outputs":[{"internalType":"uint32","name":"urgency","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maintenanceBudget0","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maintenanceBudget1","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"name","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"nonces","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"packedSlot","outputs":[{"internalType":"int24","name":"primaryLower","type":"int24"},{"internalType":"int24","name":"primaryUpper","type":"int24"},{"internalType":"int24","name":"limitLower","type":"int24"},{"internalType":"int24","name":"limitUpper","type":"int24"},{"internalType":"uint48","name":"recenterTimestamp","type":"uint48"},{"internalType":"uint32","name":"maxRebalanceGas","type":"uint32"},{"internalType":"bool","name":"maintenanceIsSustainable","type":"bool"},{"internalType":"bool","name":"locked","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"owner","type":"address"},{"internalType":"address","name":"spender","type":"address"},{"internalType":"uint256","name":"value","type":"uint256"},{"internalType":"uint256","name":"deadline","type":"uint256"},{"internalType":"uint8","name":"v","type":"uint8"},{"internalType":"bytes32","name":"r","type":"bytes32"},{"internalType":"bytes32","name":"s","type":"bytes32"}],"name":"permit","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"rewardToken","type":"address"}],"name":"rebalance","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"silo0","outputs":[{"internalType":"contract ISilo","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"silo0Basis","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"silo1","outputs":[{"internalType":"contract ISilo","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"silo1Basis","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"symbol","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"totalSupply","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transfer","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"from","type":"address"},{"internalType":"address","name":"to","type":"address"},{"internalType":"uint256","name":"amount","type":"uint256"}],"name":"transferFrom","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"uint256","name":"_amount0","type":"uint256"},{"internalType":"uint256","name":"_amount1","type":"uint256"},{"internalType":"bytes","name":"","type":"bytes"}],"name":"uniswapV3MintCallback","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"volatilityOracle","outputs":[{"internalType":"contract IVolatilityOracle","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"shares","type":"uint256"},{"internalType":"uint256","name":"amount0Min","type":"uint256"},{"internalType":"uint256","name":"amount1Min","type":"uint256"}],"name":"withdraw","outputs":[{"internalType":"uint256","name":"amount0","type":"uint256"},{"internalType":"uint256","name":"amount1","type":"uint256"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]
Contract Creation Code
6102006040523480156200001257600080fd5b5060405162005e1838038062005e188339810160408190526200003591620006a5565b82836001600160a01b0316630dfe16816040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000075573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906200009b9190620006f9565b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620000d9573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405262000103919081019062000769565b846001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000142573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001689190620006f9565b6001600160a01b03166395d89b416040518163ffffffff1660e01b8152600401600060405180830381865afa158015620001a6573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f19168201604052620001d0919081019062000769565b604051602001620001e392919062000821565b604051602081830303815290604052806040518060400160405280600a815260200169105313d14b509311539160b21b8152506012826000908051906020019062000230929190620005e6565b50815162000246906001906020850190620005e6565b5060ff81166080524660a0526200025c620004e5565b60c052505050506001600160a01b03811660e081905260408051630dfe168160e01b81529051630dfe1681916004808201926020929091908290030181865afa158015620002ae573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002d49190620006f9565b6001600160a01b0316610100816001600160a01b031681525050806001600160a01b031663d21220a76040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200032d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003539190620006f9565b6001600160a01b0316610120816001600160a01b031681525050806001600160a01b031663d0c93a7c6040518163ffffffff1660e01b8152600401602060405180830381865afa158015620003ac573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620003d2919062000878565b60020b6101408160020b8152505050620003ff620d89e719610140516200058160201b620020d71760201c565b60020b610160526200042e62000419620d89e7196200089d565b61014051620005b660201b620021061760201c565b60020b61018052604080516355b13a4f60e01b8152905133916355b13a4f9160048083019260209291908290030181865afa15801562000472573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620004989190620006f9565b6001600160a01b039081166101a0529182166101c052166101e052506006805465ffffffffffff60601b19166c010000000000000000000000004265ffffffffffff1602179055620009e1565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516200051991906200090c565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b600080620005908385620009b0565b905060008160020b1315620005ab57830382019050620005b0565b830390505b92915050565b600080620005c58385620009b0565b905060008160020b12620005dd5783039050620005b0565b90920303919050565b828054620005f490620008cf565b90600052602060002090601f01602090048101928262000618576000855562000663565b82601f106200063357805160ff191683800117855562000663565b8280016001018555821562000663579182015b828111156200066357825182559160200191906001019062000646565b506200067192915062000675565b5090565b5b8082111562000671576000815560010162000676565b6001600160a01b0381168114620006a257600080fd5b50565b600080600060608486031215620006bb57600080fd5b8351620006c8816200068c565b6020850151909350620006db816200068c565b6040850151909250620006ee816200068c565b809150509250925092565b6000602082840312156200070c57600080fd5b815162000719816200068c565b9392505050565b634e487b7160e01b600052604160045260246000fd5b60005b838110156200075357818101518382015260200162000739565b8381111562000763576000848401525b50505050565b6000602082840312156200077c57600080fd5b81516001600160401b03808211156200079457600080fd5b818401915084601f830112620007a957600080fd5b815181811115620007be57620007be62000720565b604051601f8201601f19908116603f01168101908382118183101715620007e957620007e962000720565b816040528281528760208487010111156200080357600080fd5b6200081683602083016020880162000736565b979650505050505050565b6a020b637b290213632b732160ad1b8152600083516200084981600b85016020880162000736565b602f60f81b600b9184019182015283516200086c81600c84016020880162000736565b01600c01949350505050565b6000602082840312156200088b57600080fd5b81518060020b81146200071957600080fd5b60008160020b627fffff19811415620008c657634e487b7160e01b600052601160045260246000fd5b60000392915050565b600181811c90821680620008e457607f821691505b602082108114156200090657634e487b7160e01b600052602260045260246000fd5b50919050565b600080835481600182811c9150808316806200092957607f831692505b60208084108214156200094a57634e487b7160e01b86526022600452602486fd5b8180156200096157600181146200097357620009a2565b60ff19861689528489019650620009a2565b60008a81526020902060005b868110156200099a5781548b8201529085019083016200097f565b505084890196505b509498975050505050505050565b60008260020b80620009d257634e487b7160e01b600052601260045260246000fd5b808360020b0791505092915050565b60805160a05160c05160e05161010051610120516101405161016051610180516101a0516101c0516101e05161525c62000bbc6000396000818161092801528181610b96015281816113220152818161177d0152818161193a01528181611a090152818161259b0152818161297f01528181612a280152818161303201526133fa01526000818161058601528181610b64015281816112f001528181611753015281816117e0015281816118c0015281816124a801528181612bbc01528181612c6501528181612fce01526133690152600081816104f40152612d73015260008181612f3f0152612f71015260008181612eea0152612f15015260008181610c5301528181610c9801528181610cdf01528181610db101528181610df601528181610e3d01528181612e7c0152612eb50152600081816105520152818161152701528181611c9f01528181611e4a015281816128eb01526132370152600081816104a8015281816114f201528181611c6b01528181611e1001528181612b6f01526131770152600081816106ab01528181610a99015281816113530152818161163001528181611dd301528181612220015281816122720152612d47015260006115f5015260006115c00152600061044a015261525c6000f3fe6080604052600436106102bf5760003560e01c8063819b71c81161016e578063c3bd5945116100cb578063d5ffb4e51161007f578063da3848db11610064578063da3848db1461080e578063dd62ed3e146108de578063e035814d1461091657600080fd5b8063d5ffb4e5146107cd578063d785598e146107f857600080fd5b8063d0c9bdb4116100b0578063d0c9bdb414610763578063d34879971461078d578063d505accf146107ad57600080fd5b8063c3bd594514610737578063c620033f1461074d57600080fd5b80639f13f76d11610122578063a9059cbb11610107578063a9059cbb14610702578063a932492f14610722578063ad1383f81461032657600080fd5b80639f13f76d146106cd578063a41fe49f146106e257600080fd5b806388a9f8bb1161015357806388a9f8bb1461066e57806395d89b41146106845780639b1475581461069957600080fd5b8063819b71c81461062f57806383db382d1461064557600080fd5b806332e7c5bf1161021c5780635ee04d78116101d057806370a08231116101b557806370a08231146105a85780637ecebe00146105d55780637f86d13c1461060257600080fd5b80635ee04d781461054057806362d7d45e1461057457600080fd5b8063443ec74d11610201578063443ec74d1461049657806355b13a4f146104e25780635d7f850c1461051657600080fd5b806332e7c5bf1461046c5780633644e5151461048157600080fd5b806321c28191116102735780632505c3d9116102585780632505c3d9146103c957806330adf81f14610404578063313ce5671461043857600080fd5b806321c281911461038757806323b872dd146103a957600080fd5b80630f529ba2116102a45780630f529ba2146103265780631304fd581461034d57806318160ddd1461037157600080fd5b806306fdde03146102cb578063095ea7b3146102f657600080fd5b366102c657005b600080fd5b3480156102d757600080fd5b506102e061094a565b6040516102ed91906149f0565b60405180910390f35b34801561030257600080fd5b50610316610311366004614a3b565b6109d8565b60405190151581526020016102ed565b34801561033257600080fd5b5061033b600a81565b60405160ff90911681526020016102ed565b34801561035957600080fd5b5061036360095481565b6040519081526020016102ed565b34801561037d57600080fd5b5061036360025481565b34801561039357600080fd5b506103a76103a2366004614a67565b610a45565b005b3480156103b557600080fd5b506103166103c4366004614a84565b61115d565b3480156103d557600080fd5b506103e96103e4366004614ac5565b611251565b604080519384526020840192909252908201526060016102ed565b34801561041057600080fd5b506103637f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b34801561044457600080fd5b5061033b7f000000000000000000000000000000000000000000000000000000000000000081565b34801561047857600080fd5b5061033b600281565b34801561048d57600080fd5b506103636115bc565b3480156104a257600080fd5b506104ca7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016102ed565b3480156104ee57600080fd5b506104ca7f000000000000000000000000000000000000000000000000000000000000000081565b34801561052257600080fd5b5061052b611617565b604080519283526020830191909152016102ed565b34801561054c57600080fd5b506104ca7f000000000000000000000000000000000000000000000000000000000000000081565b34801561058057600080fd5b506104ca7f000000000000000000000000000000000000000000000000000000000000000081565b3480156105b457600080fd5b506103636105c3366004614a67565b60036020526000908152604090205481565b3480156105e157600080fd5b506103636105f0366004614a67565b60056020526000908152604090205481565b34801561060e57600080fd5b5061036361061d366004614a67565b600b6020526000908152604090205481565b34801561063b57600080fd5b5061036360085481565b34801561065157600080fd5b5061065b61019281565b60405160029190910b81526020016102ed565b34801561067a57600080fd5b506103636101f481565b34801561069057600080fd5b506102e06116d2565b3480156106a557600080fd5b506104ca7f000000000000000000000000000000000000000000000000000000000000000081565b3480156106d957600080fd5b5061033b600481565b3480156106ee57600080fd5b5061052b6106fd366004614af7565b6116df565b34801561070e57600080fd5b5061031661071d366004614a3b565b611d32565b34801561072e57600080fd5b5061033b601481565b34801561074357600080fd5b50610363600a5481565b34801561075957600080fd5b5061065b616c5081565b34801561076f57600080fd5b50610778611daa565b60405163ffffffff90911681526020016102ed565b34801561079957600080fd5b506103a76107a8366004614b23565b611dc8565b3480156107b957600080fd5b506103a76107c8366004614bb2565b611e77565b3480156107d957600080fd5b506107e46201518081565b60405162ffffff90911681526020016102ed565b34801561080457600080fd5b5061036360075481565b34801561081a57600080fd5b5060065461088590600281810b9163010000008104820b9166010000000000008204810b916901000000000000000000810490910b9065ffffffffffff600160601b8204169063ffffffff600160901b8204169060ff600160b01b8204811691600160b81b90041688565b604080516002998a0b815297890b602089015295880b958701959095529290950b606085015265ffffffffffff16608084015263ffffffff90931660a083015291151560c082015290151560e0820152610100016102ed565b3480156108ea57600080fd5b506103636108f9366004614c23565b600460209081526000928352604080842090915290825290205481565b34801561092257600080fd5b506104ca7f000000000000000000000000000000000000000000000000000000000000000081565b6000805461095790614c5c565b80601f016020809104026020016040519081016040528092919081815260200182805461098390614c5c565b80156109d05780601f106109a5576101008083540402835291602001916109d0565b820191906000526020600020905b8154815290600101906020018083116109b357829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610a339086815260200190565b60405180910390a35060015b92915050565b60005a90506000806000806000610a5a612132565b6006805460ff60b81b1916600160b81b1790556040805160608101825260008082526020820181905291810191909152949950929750909550935091507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b199190614cb9565b5050505060029190910b6040840152506001600160a01b0316808252610b449080600160601b6122d8565b6001600160e01b031660208201526000610b5d85612385565b9050610b917f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166123a9565b610bc37f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166123a9565b6000806000610bd98a8a876000015160006123ea565b92509250925080606001516001600160801b0316600014610c09576060810151610c04908a9061275b565b505050505b6000610c3d61271085610c2e86600160601b8b602001516001600160e01b03166122d8565b610c389088614d63565b6122d8565b9050611324811015610d9d57610c7786604001517f0000000000000000000000000000000000000000000000000000000000000000612106565b60020b60408b015260608201516001600160801b031615801590610cd357507f00000000000000000000000000000000000000000000000000000000000000008a60400151610cc69190614d7b565b60020b8a6020015160020b145b15610cdd57600094505b7f00000000000000000000000000000000000000000000000000000000000000008a60400151610d0d9190614d7b565b60020b6020808c0191909152860151600090600190610d3b9087906001600160e01b0316600160601b6122d8565b610d459086614dc3565b901c90508260200151811115610d5c575060208201515b6000610d666128c7565b905081811015610d8057610d7b818303612961565b810191505b50610d95610d8e8c83612a63565b8c90612a88565b505050610f1c565b6113ec811115610ee557610dd586604001517f00000000000000000000000000000000000000000000000000000000000000006120d7565b60020b60208b015260608201516001600160801b031615801590610e3157507f00000000000000000000000000000000000000000000000000000000000000008a60200151610e249190614dda565b60020b8a6040015160020b145b15610e3b57600094505b7f00000000000000000000000000000000000000000000000000000000000000008a60200151610e6b9190614dda565b60020b60408b01526020860151600090600190610e98908690600160601b906001600160e01b03166122d8565b610ea29087614dc3565b8451911c9150811115610eb3575081515b6000610ebd612b4b565b905081811015610ed757610ed2818303612b9e565b810191505b50610d95610d8e8c83612ca0565b60408051606081018252600080825260208201819052918101919091529950610f16868c846040015187878c612cc5565b9a504298505b5a610f298d615208614e21565b63ffffffff16610f399190614dc3565b9b508763ffffffff168c63ffffffff161115610f53578b97505b610f608d868e8b8b6130d9565b6002546040805184815260208101929092528101869052606081018590529097507f802a0d65ee1ffb3e6af96deafe1fc3e6402b2672a2f4b79d1b23c4a06c998f349060800160405180910390a16040518061010001604052808c6020015160020b81526020018c6040015160020b81526020018b6020015160020b81526020018b6040015160020b81526020018a65ffffffffffff1681526020018963ffffffff168152602001881515815260200160001515815250600660008201518160000160006101000a81548162ffffff021916908360020b62ffffff16021790555060208201518160000160036101000a81548162ffffff021916908360020b62ffffff16021790555060408201518160000160066101000a81548162ffffff021916908360020b62ffffff16021790555060608201518160000160096101000a81548162ffffff021916908360020b62ffffff160217905550608082015181600001600c6101000a81548165ffffffffffff021916908365ffffffffffff16021790555060a08201518160000160126101000a81548163ffffffff021916908363ffffffff16021790555060c08201518160000160166101000a81548160ff02191690831515021790555060e08201518160000160176101000a81548160ff02191690831515021790555090505050505050505050505050505050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146111b9576111948382614dc3565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906111e1908490614dc3565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061123c9087815260200190565b60405180910390a360019150505b9392505050565b600080808615158061126257508515155b6112b35760405162461bcd60e51b815260206004820152600f60248201527f416c6f653a2030206465706f736974000000000000000000000000000000000060448201526064015b60405180910390fd5b6000806112be612132565b50506006805460ff60b81b1916600160b81b1790555090925090506112e2826134fd565b6112eb816134fd565b61131d7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166123a9565b61134f7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166123a9565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156113af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d39190614cb9565b50505050505090506000806113eb85858560016123ea565b509150915061140060025483838f8f886135c0565b91995097509550876114455760405162461bcd60e51b815260206004820152600e60248201526d416c6f653a20302073686172657360901b60448201526064016112aa565b898710156114955760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743020746f6f206c6f77000000000000000000000060448201526064016112aa565b888610156114e55760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743120746f6f206c6f77000000000000000000000060448201526064016112aa565b61151a6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633308a613706565b61154f6001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016333089613706565b6115593389613789565b604080518981526020810189905290810187905233907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e9060600160405180910390a250506006805460ff60b81b19169055509398929750909550909350505050565b60007f000000000000000000000000000000000000000000000000000000000000000046146115f2576115ed6137f5565b905090565b507f000000000000000000000000000000000000000000000000000000000000000090565b600080600080611625612132565b5050509150915060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190614cb9565b50505050505090506116c583838360006123ea565b5090969095509350505050565b6001805461095790614c5c565b600080846117205760405162461bcd60e51b815260206004820152600e60248201526d416c6f653a20302073686172657360901b60448201526064016112aa565b60008061172b612132565b50506006805460ff60b81b1916600160b81b1790555090925090506117786001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000166123a9565b6117aa7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166123a9565b60025460008080806117ba612b4b565b6007546040516370a0823160e01b81523060048201529095509092506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190614e49565b925083831161185b576000611871565b600a6118678585614dc3565b6118719190614e78565b9350611892846118818585614d63565b61188b9190614dc3565b8d876122d8565b98508189111561190c57816118a78a86614d63565b6118b19190614dc3565b91506118e66001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168361388f565b83600960008282546118f89190614d63565b9091555061190890508284614dc3565b6007555b6119146128c7565b6008546040516370a0823160e01b81523060048201529095509092506001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401602060405180830381865afa158015611981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a59190614e49565b92508383116119b55760006119cb565b600a6119c18585614dc3565b6119cb9190614e78565b93506119db846118818585614d63565b975081881115611a5557816119f08986614d63565b6119fa9190614dc3565b9150611a2f6001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000168361388f565b83600a6000828254611a419190614d63565b90915550611a5190508284614dc3565b6008555b6000611a6088613909565b505050509050611a84611a7d826001600160801b03168f896122d8565b899061275b565b92975090955093509150611a98858b614d63565b9950611aa4848a614d63565b9850611ab1600a84614e78565b9450611abe600a83614e78565b9350611ad4611acd8685614dc3565b8e886122d8565b611ade908b614d63565b9950611aed611acd8584614dc3565b611af7908a614d63565b98508460096000828254611b0b9190614d63565b9250508190555083600a6000828254611b249190614d63565b9250508190555050856040015160020b866020015160020b14611bbe576000611b4c87613909565b505050509050611b70611b69826001600160801b03168f896122d8565b889061275b565b92975090955093509150611b85838e886122d8565b611b8f9086614d63565b611b99908b614d63565b9950611ba6828e886122d8565b611bb09085614d63565b611bba908a614d63565b9850505b8a891015611c0e5760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743020746f6f206c6f77000000000000000000000060448201526064016112aa565b89881015611c5e5760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743120746f6f206c6f77000000000000000000000060448201526064016112aa565b611c926001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338b6139f1565b611cc66001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016338a6139f1565b611cd0338d613a21565b604080518d8152602081018b905290810189905233907f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca949060600160405180910390a250506006805460ff60b81b191690555094989397509295505050505050565b33600090815260036020526040812080548391908390611d53908490614dc3565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a339086815260200190565b6006546000906115ed90600160601b900465ffffffffffff16612385565b336001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001614611dfd57600080fd5b8315611e3757611e376001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633866139f1565b8215611e7157611e716001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001633856139f1565b50505050565b42841015611ec75760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016112aa565b6000611ed16115bc565b6001600160a01b0389811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938c166060840152608083018b905260a083019390935260c08083018a90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015611fea573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906120205750886001600160a01b0316816001600160a01b0316145b61206c5760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016112aa565b6001600160a01b0390811660009081526004602090815260408083208b8516808552908352928190208a905551898152919350918a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6000806120e48385614e8c565b905060008160020b13156120fd57830382019050610a3f565b90920392915050565b6000806121138385614e8c565b905060008160020b126121295783039050610a3f565b90920303919050565b604080516060810182526000808252602082018190529181019190915260408051606081018252600080825260208201819052918101919091526040805161010081018252600654600281810b835263010000008204810b602084015266010000000000008204810b938301939093526901000000000000000000810490920b606082015265ffffffffffff600160601b830416608082015263ffffffff600160901b83041660a082015260ff600160b01b83048116151560c0830152600160b81b90920490911615801560e0830152600091829182919061221357600080fd5b60405180606001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001826000015160020b8152602001826020015160020b81525060405180606001604052807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03168152602001836040015160020b8152602001836060015160020b81525082608001518360a001518460c0015195509550955095509550509091929394565b6000816122e457600080fd5b60008060001985870985870292508281108382030391505080600014156123105750829004905061124a565b83811061231c57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000610a3f620186a06123a065ffffffffffff851642614dc3565b620151806122d8565b6040805160048152602481019091526020810180516001600160e01b0316630302f06b60e31b1790526123e6906001600160a01b03831690613a95565b5050565b60408051608081018252600080825260208201819052918101829052606081018290528190600080876040015160020b886020015160020b1461248d5761243088613909565b6001600160801b03948516606089018190529185169650909316935061245b928b92508a9150613aba565b602085015280845282908490612472908390614d63565b905250602083018051829190612489908390614d63565b9052505b6007546040516370a0823160e01b81523060048201529092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156124f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251b9190614e49565b905081811161252b576000612541565b600a6125378383614dc3565b6125419190614e78565b91508561254e5781612551565b60005b8161255a612b4b565b6125649190614d63565b61256e9190614dc3565b8351849061257d908390614d63565b9052506008546040516370a0823160e01b81523060048201529092507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156125ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260e9190614e49565b905081811161261e576000612634565b600a61262a8383614dc3565b6126349190614e78565b9150856126415781612644565b60005b8161264d6128c7565b6126579190614d63565b6126619190614dc3565b836020018181516126729190614d63565b905250604089015160208a0151600291820b910b146127425761269489613909565b6001600160801b0394851660408901819052918516965090931693506126bf928c92508a9150613aba565b9095509350856126d9576126d4600a83614e78565b6126dc565b60005b83516126e9908490614d63565b6126f39190614dc3565b6126fd9086614d63565b9450856127145761270f600a82614e78565b612717565b60005b8184602001516127279190614d63565b6127319190614dc3565b61273b9085614d63565b935061274f565b8251602084015190955093505b50509450945094915050565b60008080806001600160801b038516156128055785516020870151604080890151905163a34123a760e01b8152600292830b6004820152910b60248201526001600160801b03871660448201526001600160a01b039091169063a34123a79060640160408051808303816000875af11580156127db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ff9190614eae565b90945092505b8551602087015160408089015190516309e3d67b60e31b8152306004820152600292830b6024820152910b60448201526001600160801b0360648201819052608482015260009182916001600160a01b0390911690634f1eb3d89060a40160408051808303816000875af1158015612881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a59190614ee9565b96999598506001600160801b039081168a900397509095168790039450505050565b600a546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a08231906024015b602060405180830381865afa158015612933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129579190614e49565b6115ed9190614dc3565b6008546040516370a0823160e01b81523060048201526000919082907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa1580156129ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129f29190614e49565b9050818111612a02576000612a09565b600a828203045b9150818103841115612a1b5781810393505b612a506001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683860161388f565b600a805483019055038290036008555090565b600061124a612a758460200151613aed565b612a828560400151613aed565b84613e40565b6000806001600160801b03831615612b4457835160208501516040808701519051633c8a7d8d60e01b8152306004820152600292830b6024820152910b60448201526001600160801b038516606482015260a06084820152600060a48201526001600160a01b0390911690633c8a7d8d9060c40160408051808303816000875af1158015612b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3e9190614eae565b90925090505b9250929050565b6009546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000000000000000000000000000000000000000000016906370a0823190602401612916565b6007546040516370a0823160e01b81523060048201526000919082907f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316906370a0823190602401602060405180830381865afa158015612c0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c2f9190614e49565b9050818111612c3f576000612c46565b600a828203045b9150818103841115612c585781810393505b612c8d6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001683860161388f565b6009805483019055038290036007555090565b600061124a612cb28460200151613aed565b612cbf8560400151613aed565b84613e91565b604080516060810182526000808252602082018190529181018290529080612ced888861275b565b935093505050600a60ff168281612d0657612d06614e62565b60098054929091049091019055600a805491819004909101905550600082612d3057616c50612de7565b60405163b168197d60e01b81526001600160a01b037f000000000000000000000000000000000000000000000000000000000000000081166004830152612de7917f00000000000000000000000000000000000000000000000000000000000000009091169063b168197d906024016020604051808303816000875af1158015612dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612de29190614e49565b613ee8565b60020b60011d9050600080612dfd878785613f62565b91509150600080612e13896101f46127106122d8565b612e1b612b4b565b039150612e2d886101f46127106122d8565b612e356128c7565b03905083821215612e545760009850612e4f828503612b9e565b820193505b82811215612e705760009750612e6b818403612961565b810192505b612ea0858d60400151037f0000000000000000000000000000000000000000000000000000000000000000612106565b60020b60208c015260408c0151612ed99086017f00000000000000000000000000000000000000000000000000000000000000006120d7565b600290810b60408d015260208c01517f0000000000000000000000000000000000000000000000000000000000000000820b910b1215612f3d577f000000000000000000000000000000000000000000000000000000000000000060020b60208c01525b7f000000000000000000000000000000000000000000000000000000000000000060020b8b6040015160020b1315612f99577f000000000000000000000000000000000000000000000000000000000000000060020b60408c01525b8b51612fac90610d8e908d908787613fd7565b9094509250881561301557612ff4612fc48584614dc3565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690613ffe565b612ffe8483614dc3565b6007600082825461300f9190614d63565b90915550505b8715613079576130586130288483614dc3565b6001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690613ffe565b6130628382614dc3565b600860008282546130739190614d63565b90915550505b7fe73e1a034909b10f2cbe101ce0618d683b1485c1c2da61474bdbebce08bcaf1a8b602001518c604001516040516130c1929190600292830b8152910b602082015260400190565b60405180910390a150989a9950505050505050505050565b60006001600160a01b03861661313557604080516000808252602082015263ffffffff87168183015290517faf945aff5cea2d4d4f891882674c81bcdaeb15609c6d7bc80875dbc4ee83e4ee9181900360600190a150806134f4565b6001600160a01b0386166000908152600b60205260408120549061317361316263ffffffff881684614f1c565b8863ffffffff16633b9aca006122d8565b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b0316141561323557600954808211806131be575082155b156131c7578091505b6131d18282614dc3565b905060006131f26131e3601486614f1c565b8863ffffffff166127106122d8565b90508082116132015781613203565b805b60095580821115613217576001955061322e565b613222600482614e78565b82101561322e57600095505b5050613470565b7f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316886001600160a01b031614156132c857600a548082118061327e575082155b15613287578091505b6132918282614dc3565b905060006132a36131e3601486614f1c565b90508082116132b257816132b4565b805b600a5580821115613217576001955061322e565b6040516370a0823160e01b81523060048201526000906001600160a01b038a16906370a0823190602401602060405180830381865afa15801561330f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133339190614e49565b905080821180613341575082155b1561334a578091505b60405163026c7dfb60e31b81526001600160a01b038a811660048301527f00000000000000000000000000000000000000000000000000000000000000001690631363efd890602401602060405180830381865afa1580156133b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133d49190614f3b565b8015613465575060405163026c7dfb60e31b81526001600160a01b038a811660048301527f00000000000000000000000000000000000000000000000000000000000000001690631363efd890602401602060405180830381865afa158015613441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134659190614f3b565b61346e57600080fd5b505b6134846001600160a01b03891633836139f1565b6134a08861349b612710848a63ffffffff166122d8565b61401d565b604080516001600160a01b038a1681526020810183905263ffffffff89168183015290517faf945aff5cea2d4d4f891882674c81bcdaeb15609c6d7bc80875dbc4ee83e4ee9181900360600190a183925050505b95945050505050565b806040015160020b816020015160020b14156135165750565b600061352182613909565b505050509050806001600160801b03166000146123e65781516020830151604080850151905163a34123a760e01b8152600292830b6004820152910b6024820152600060448201526001600160a01b039091169063a34123a79060640160408051808303816000875af115801561359c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e719190614eae565b600080808815806135d057508715155b806135da57508615155b6135e6576135e6614f56565b8861365b5760006136056001600160a01b03861680600160601b6122d8565b905061361f86600160601b836001600160e01b03166122d8565b92508683101561363457859150819350613655565b86925061364f83826001600160e01b0316600160601b6122d8565b91508293505b506136fa565b8761367457508361366d818a896122d8565b92506136fa565b866136875785915061366d828a8a6122d8565b60008789106136a25761369b87898b6122d8565b86106136b0565b866136ae878b8b6122d8565b105b905080156136da578591506136c6828a8a6122d8565b92506136d3828b8a6122d8565b93506136f8565b8692506136e883898b6122d8565b91506136f5838b8b6122d8565b93505b505b96509650969350505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611e719085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526140f1565b806002600082825461379b9190614d63565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516138279190614f6c565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6040516024810182905261390490632e1a7d4d60e01b906044015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001600160a01b03841690613a95565b505050565b600080600080600085600001516001600160a01b031663514ea4bf308860200151896040015160405160200161396a9392919060609390931b6bffffffffffffffffffffffff1916835260e891821b6014840152901b6017820152601a0190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161399e91815260200190565b60a060405180830381865afa1580156139bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139df9190615008565b939a9299509097509550909350915050565b6040516001600160a01b03831660248201526044810182905261390490849063a9059cbb60e01b9060640161373a565b6001600160a01b03821660009081526003602052604081208054839290613a49908490614dc3565b90915550506002805482900390556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016137e9565b606061124a8383604051806060016040528060278152602001615200602791396141d6565b600080613ae184613ace8760200151613aed565b613adb8860400151613aed565b866142c1565b91509150935093915050565b60008060008360020b12613b04578260020b613b11565b8260020b613b119061505f565b9050613b20620d89e71961507c565b62ffffff16811115613b585760405162461bcd60e51b81526020600482015260016024820152601560fa1b60448201526064016112aa565b600060018216613b7957700100000000000000000000000000000000613b8b565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615613bbf576ffff97272373d413259a46990580e213a0260801c5b6004821615613bde576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615613bfd576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615613c1c576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615613c3b576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615613c5a576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615613c79576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613c99576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613cb9576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613cd9576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615613cf9576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615613d19576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615613d39576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615613d59576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615613d79576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613d9a576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613dba576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613dd9576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615613df6576b048a170391f7dc42444e8fa20260801c5b60008460020b1315613e17578060001981613e1357613e13614e62565b0490505b640100000000810615613e2b576001613e2e565b60005b60ff16602082901c0192505050919050565b6000826001600160a01b0316846001600160a01b03161115613e60579192915b613e89613e8483600160601b613e76888861509f565b6001600160a01b03166122d8565b61435d565b949350505050565b6000826001600160a01b0316846001600160a01b03161115613eb1579192915b6000613ed4856001600160a01b0316856001600160a01b0316600160601b6122d8565b90506134f4613e848483613e76898961509f565b6000662358b99a116be08211613f015750610192919050565b67053448a4815102008210613f195750616c50919050565b613f24600283614f1c565b91506000670de0b6b3a7640000839003730de0b6b3a764000000000000000000000000000081613f5657613f56614e62565b04905061124a81614378565b60008080613f77613f728561507c565b613aed565b613f8e906001600160a01b0316600160601b614dc3565b9050613fad86826bffffffffffffffffffffffff16600160601b6122d8565b9250613fcc85826bffffffffffffffffffffffff16600160601b6122d8565b915050935093915050565b60006134f484613fea8760200151613aed565b613ff78860400151613aed565b86866146bf565b604051602481018290526139049063b6b55f2560e01b906044016138aa565b6001600160a01b0382166000908152600c60209081526040808320600d835281842054600b90935292205460ff90911690600a8104810380851015614060578094505b600e85049450838360ff16600e811061407b5761407b6150c7565b01546001600160a01b0387166000908152600b60205260409020838701919091039055848460ff8516600e81106140b4576140b46150c7565b0155600e60ff60018501166001600160a01b03979097166000908152600d60205260409020805460ff19169190970660ff16179095555050505050565b6000614146826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147779092919063ffffffff16565b80519091501561390457808060200190518101906141649190614f3b565b6139045760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016112aa565b6060833b61424c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016112aa565b600080856001600160a01b03168560405161426791906150dd565b600060405180830381855af49150503d80600081146142a2576040519150601f19603f3d011682016040523d82523d6000602084013e6142a7565b606091505b50915091506142b7828286614786565b9695505050505050565b600080836001600160a01b0316856001600160a01b031611156142e2579293925b846001600160a01b0316866001600160a01b03161161430d576143068585856147bf565b9150614354565b836001600160a01b0316866001600160a01b03161015614346576143328685856147bf565b915061433f85878561483b565b9050614354565b61435185858561483b565b90505b94509492505050565b806001600160801b038116811461437357600080fd5b919050565b60006401000276a36001600160a01b038316108015906143b4575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b6143e45760405162461bcd60e51b81526020600482015260016024820152602960f91b60448201526064016112aa565b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c9790881196179094179092171790911717176080811061448c57614482607f82614dc3565b83901c915061449d565b61449781607f614dc3565b83901b91505b600060406144ac6080846150f9565b901b9050828302607f1c92508260801c80603f1b8217915083811c935050828302607f1c92508260801c80603e1b8217915083811c935050828302607f1c92508260801c80603d1b8217915083811c935050828302607f1c92508260801c80603c1b8217915083811c935050828302607f1c92508260801c80603b1b8217915083811c935050828302607f1c92508260801c80603a1b8217915083811c935050828302607f1c92508260801c8060391b8217915083811c935050828302607f1c92508260801c8060381b8217915083811c935050828302607f1c92508260801c8060371b8217915083811c935050828302607f1c92508260801c8060361b8217915083811c935050828302607f1c92508260801c8060351b8217915083811c935050828302607f1c92508260801c8060341b8217915083811c935050828302607f1c92508260801c8060331b8217915083811c935050828302607f1c92508260801c8060321b8217915050600081693627a301d71055774c8561462f9190615138565b90506000608061464f6f028f6481ab7f045a5af012a19d003aaa846150f9565b901d905060006080614671846fdb2df09e81959a81455e260799a0632f6151bf565b901d90508060020b8260020b146146b057886001600160a01b031661469582613aed565b6001600160a01b031611156146aa57816146b2565b806146b2565b815b9998505050505050505050565b6000836001600160a01b0316856001600160a01b031611156146df579293925b846001600160a01b0316866001600160a01b03161161470a57614703858585613e91565b90506134f4565b836001600160a01b0316866001600160a01b0316101561476c576000614731878686613e91565b90506000614740878986613e40565b9050806001600160801b0316826001600160801b0316106147615780614763565b815b925050506134f4565b6142b7858584613e40565b6060613e898484600085614885565b6060831561479557508161124a565b8251156147a55782518084602001fd5b8160405162461bcd60e51b81526004016112aa91906149f0565b6000826001600160a01b0316846001600160a01b031611156147df579192915b6001600160a01b0384166148317bffffffffffffffffffffffffffffffff000000000000000000000000606085901b16614819878761509f565b6001600160a01b0316866001600160a01b03166122d8565b613e899190614e78565b6000826001600160a01b0316846001600160a01b0316111561485b579192915b613e896001600160801b038316614872868661509f565b6001600160a01b0316600160601b6122d8565b6060824710156148fd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016112aa565b843b61494b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016112aa565b600080866001600160a01b0316858760405161496791906150dd565b60006040518083038185875af1925050503d80600081146149a4576040519150601f19603f3d011682016040523d82523d6000602084013e6149a9565b606091505b50915091506149b9828286614786565b979650505050505050565b60005b838110156149df5781810151838201526020016149c7565b83811115611e715750506000910152565b6020815260008251806020840152614a0f8160408501602087016149c4565b601f01601f19169190910160400192915050565b6001600160a01b0381168114614a3857600080fd5b50565b60008060408385031215614a4e57600080fd5b8235614a5981614a23565b946020939093013593505050565b600060208284031215614a7957600080fd5b813561124a81614a23565b600080600060608486031215614a9957600080fd5b8335614aa481614a23565b92506020840135614ab481614a23565b929592945050506040919091013590565b60008060008060808587031215614adb57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060608486031215614b0c57600080fd5b505081359360208301359350604090920135919050565b60008060008060608587031215614b3957600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115614b5f57600080fd5b818701915087601f830112614b7357600080fd5b813581811115614b8257600080fd5b886020828501011115614b9457600080fd5b95989497505060200194505050565b60ff81168114614a3857600080fd5b600080600080600080600060e0888a031215614bcd57600080fd5b8735614bd881614a23565b96506020880135614be881614a23565b955060408801359450606088013593506080880135614c0681614ba3565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614c3657600080fd5b8235614c4181614a23565b91506020830135614c5181614a23565b809150509250929050565b600181811c90821680614c7057607f821691505b60208210811415614c9157634e487b7160e01b600052602260045260246000fd5b50919050565b805161ffff8116811461437357600080fd5b8051801515811461437357600080fd5b600080600080600080600060e0888a031215614cd457600080fd5b8751614cdf81614a23565b8097505060208801518060020b8114614cf757600080fd5b9550614d0560408901614c97565b9450614d1360608901614c97565b9350614d2160808901614c97565b925060a0880151614d3181614ba3565b9150614d3f60c08901614ca9565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b60008219821115614d7657614d76614d4d565b500190565b60008160020b8360020b6000811281627fffff1901831281151615614da257614da2614d4d565b81627fffff018313811615614db957614db9614d4d565b5090039392505050565b600082821015614dd557614dd5614d4d565b500390565b60008160020b8360020b6000821282627fffff03821381151615614e0057614e00614d4d565b82627fffff19038212811615614e1857614e18614d4d565b50019392505050565b600063ffffffff808316818516808303821115614e4057614e40614d4d565b01949350505050565b600060208284031215614e5b57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082614e8757614e87614e62565b500490565b60008260020b80614e9f57614e9f614e62565b808360020b0791505092915050565b60008060408385031215614ec157600080fd5b505080516020909101519092909150565b80516001600160801b038116811461437357600080fd5b60008060408385031215614efc57600080fd5b614f0583614ed2565b9150614f1360208401614ed2565b90509250929050565b6000816000190483118215151615614f3657614f36614d4d565b500290565b600060208284031215614f4d57600080fd5b61124a82614ca9565b634e487b7160e01b600052600160045260246000fd5b600080835481600182811c915080831680614f8857607f831692505b6020808410821415614fa857634e487b7160e01b86526022600452602486fd5b818015614fbc5760018114614fcd57614ffa565b60ff19861689528489019650614ffa565b60008a81526020902060005b86811015614ff25781548b820152908501908301614fd9565b505084890196505b509498975050505050505050565b600080600080600060a0868803121561502057600080fd5b61502986614ed2565b9450602086015193506040860151925061504560608701614ed2565b915061505360808701614ed2565b90509295509295909350565b6000600160ff1b82141561507557615075614d4d565b5060000390565b60008160020b627fffff1981141561509657615096614d4d565b60000392915050565b60006001600160a01b03838116908316818110156150bf576150bf614d4d565b039392505050565b634e487b7160e01b600052603260045260246000fd5b600082516150ef8184602087016149c4565b9190910192915050565b60008083128015600160ff1b85018412161561511757615117614d4d565b836001600160ff1b0301831381161561513257615132614d4d565b50500390565b60006001600160ff1b0360008413600084138583048511828216161561516057615160614d4d565b600160ff1b600087128281168783058912161561517f5761517f614d4d565b6000871292508782058712848416161561519b5761519b614d4d565b878505871281841616156151b1576151b1614d4d565b505050929093029392505050565b6000808212826001600160ff1b03038413811516156151e0576151e0614d4d565b600160ff1b83900384128116156151f9576151f9614d4d565b5050019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209803ba6c5392bde5618d81bbb74d963906844c27cdaef43c2fd36f4a23e9e5f564736f6c634300080a003300000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b3
Deployed Bytecode
0x6080604052600436106102bf5760003560e01c8063819b71c81161016e578063c3bd5945116100cb578063d5ffb4e51161007f578063da3848db11610064578063da3848db1461080e578063dd62ed3e146108de578063e035814d1461091657600080fd5b8063d5ffb4e5146107cd578063d785598e146107f857600080fd5b8063d0c9bdb4116100b0578063d0c9bdb414610763578063d34879971461078d578063d505accf146107ad57600080fd5b8063c3bd594514610737578063c620033f1461074d57600080fd5b80639f13f76d11610122578063a9059cbb11610107578063a9059cbb14610702578063a932492f14610722578063ad1383f81461032657600080fd5b80639f13f76d146106cd578063a41fe49f146106e257600080fd5b806388a9f8bb1161015357806388a9f8bb1461066e57806395d89b41146106845780639b1475581461069957600080fd5b8063819b71c81461062f57806383db382d1461064557600080fd5b806332e7c5bf1161021c5780635ee04d78116101d057806370a08231116101b557806370a08231146105a85780637ecebe00146105d55780637f86d13c1461060257600080fd5b80635ee04d781461054057806362d7d45e1461057457600080fd5b8063443ec74d11610201578063443ec74d1461049657806355b13a4f146104e25780635d7f850c1461051657600080fd5b806332e7c5bf1461046c5780633644e5151461048157600080fd5b806321c28191116102735780632505c3d9116102585780632505c3d9146103c957806330adf81f14610404578063313ce5671461043857600080fd5b806321c281911461038757806323b872dd146103a957600080fd5b80630f529ba2116102a45780630f529ba2146103265780631304fd581461034d57806318160ddd1461037157600080fd5b806306fdde03146102cb578063095ea7b3146102f657600080fd5b366102c657005b600080fd5b3480156102d757600080fd5b506102e061094a565b6040516102ed91906149f0565b60405180910390f35b34801561030257600080fd5b50610316610311366004614a3b565b6109d8565b60405190151581526020016102ed565b34801561033257600080fd5b5061033b600a81565b60405160ff90911681526020016102ed565b34801561035957600080fd5b5061036360095481565b6040519081526020016102ed565b34801561037d57600080fd5b5061036360025481565b34801561039357600080fd5b506103a76103a2366004614a67565b610a45565b005b3480156103b557600080fd5b506103166103c4366004614a84565b61115d565b3480156103d557600080fd5b506103e96103e4366004614ac5565b611251565b604080519384526020840192909252908201526060016102ed565b34801561041057600080fd5b506103637f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c981565b34801561044457600080fd5b5061033b7f000000000000000000000000000000000000000000000000000000000000001281565b34801561047857600080fd5b5061033b600281565b34801561048d57600080fd5b506103636115bc565b3480156104a257600080fd5b506104ca7f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4881565b6040516001600160a01b0390911681526020016102ed565b3480156104ee57600080fd5b506104ca7f00000000000000000000000000000000007476b17d4ae5919ce21f34ee45626181565b34801561052257600080fd5b5061052b611617565b604080519283526020830191909152016102ed565b34801561054c57600080fd5b506104ca7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc281565b34801561058057600080fd5b506104ca7f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f81565b3480156105b457600080fd5b506103636105c3366004614a67565b60036020526000908152604090205481565b3480156105e157600080fd5b506103636105f0366004614a67565b60056020526000908152604090205481565b34801561060e57600080fd5b5061036361061d366004614a67565b600b6020526000908152604090205481565b34801561063b57600080fd5b5061036360085481565b34801561065157600080fd5b5061065b61019281565b60405160029190910b81526020016102ed565b34801561067a57600080fd5b506103636101f481565b34801561069057600080fd5b506102e06116d2565b3480156106a557600080fd5b506104ca7f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564081565b3480156106d957600080fd5b5061033b600481565b3480156106ee57600080fd5b5061052b6106fd366004614af7565b6116df565b34801561070e57600080fd5b5061031661071d366004614a3b565b611d32565b34801561072e57600080fd5b5061033b601481565b34801561074357600080fd5b50610363600a5481565b34801561075957600080fd5b5061065b616c5081565b34801561076f57600080fd5b50610778611daa565b60405163ffffffff90911681526020016102ed565b34801561079957600080fd5b506103a76107a8366004614b23565b611dc8565b3480156107b957600080fd5b506103a76107c8366004614bb2565b611e77565b3480156107d957600080fd5b506107e46201518081565b60405162ffffff90911681526020016102ed565b34801561080457600080fd5b5061036360075481565b34801561081a57600080fd5b5060065461088590600281810b9163010000008104820b9166010000000000008204810b916901000000000000000000810490910b9065ffffffffffff600160601b8204169063ffffffff600160901b8204169060ff600160b01b8204811691600160b81b90041688565b604080516002998a0b815297890b602089015295880b958701959095529290950b606085015265ffffffffffff16608084015263ffffffff90931660a083015291151560c082015290151560e0820152610100016102ed565b3480156108ea57600080fd5b506103636108f9366004614c23565b600460209081526000928352604080842090915290825290205481565b34801561092257600080fd5b506104ca7f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b381565b6000805461095790614c5c565b80601f016020809104026020016040519081016040528092919081815260200182805461098390614c5c565b80156109d05780601f106109a5576101008083540402835291602001916109d0565b820191906000526020600020905b8154815290600101906020018083116109b357829003601f168201915b505050505081565b3360008181526004602090815260408083206001600160a01b038716808552925280832085905551919290917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92590610a339086815260200190565b60405180910390a35060015b92915050565b60005a90506000806000806000610a5a612132565b6006805460ff60b81b1916600160b81b1790556040805160608101825260008082526020820181905291810191909152949950929750909550935091507f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f56406001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa158015610af5573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610b199190614cb9565b5050505060029190910b6040840152506001600160a01b0316808252610b449080600160601b6122d8565b6001600160e01b031660208201526000610b5d85612385565b9050610b917f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f6001600160a01b03166123a9565b610bc37f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b36001600160a01b03166123a9565b6000806000610bd98a8a876000015160006123ea565b92509250925080606001516001600160801b0316600014610c09576060810151610c04908a9061275b565b505050505b6000610c3d61271085610c2e86600160601b8b602001516001600160e01b03166122d8565b610c389088614d63565b6122d8565b9050611324811015610d9d57610c7786604001517f000000000000000000000000000000000000000000000000000000000000000a612106565b60020b60408b015260608201516001600160801b031615801590610cd357507f000000000000000000000000000000000000000000000000000000000000000a8a60400151610cc69190614d7b565b60020b8a6020015160020b145b15610cdd57600094505b7f000000000000000000000000000000000000000000000000000000000000000a8a60400151610d0d9190614d7b565b60020b6020808c0191909152860151600090600190610d3b9087906001600160e01b0316600160601b6122d8565b610d459086614dc3565b901c90508260200151811115610d5c575060208201515b6000610d666128c7565b905081811015610d8057610d7b818303612961565b810191505b50610d95610d8e8c83612a63565b8c90612a88565b505050610f1c565b6113ec811115610ee557610dd586604001517f000000000000000000000000000000000000000000000000000000000000000a6120d7565b60020b60208b015260608201516001600160801b031615801590610e3157507f000000000000000000000000000000000000000000000000000000000000000a8a60200151610e249190614dda565b60020b8a6040015160020b145b15610e3b57600094505b7f000000000000000000000000000000000000000000000000000000000000000a8a60200151610e6b9190614dda565b60020b60408b01526020860151600090600190610e98908690600160601b906001600160e01b03166122d8565b610ea29087614dc3565b8451911c9150811115610eb3575081515b6000610ebd612b4b565b905081811015610ed757610ed2818303612b9e565b810191505b50610d95610d8e8c83612ca0565b60408051606081018252600080825260208201819052918101919091529950610f16868c846040015187878c612cc5565b9a504298505b5a610f298d615208614e21565b63ffffffff16610f399190614dc3565b9b508763ffffffff168c63ffffffff161115610f53578b97505b610f608d868e8b8b6130d9565b6002546040805184815260208101929092528101869052606081018590529097507f802a0d65ee1ffb3e6af96deafe1fc3e6402b2672a2f4b79d1b23c4a06c998f349060800160405180910390a16040518061010001604052808c6020015160020b81526020018c6040015160020b81526020018b6020015160020b81526020018b6040015160020b81526020018a65ffffffffffff1681526020018963ffffffff168152602001881515815260200160001515815250600660008201518160000160006101000a81548162ffffff021916908360020b62ffffff16021790555060208201518160000160036101000a81548162ffffff021916908360020b62ffffff16021790555060408201518160000160066101000a81548162ffffff021916908360020b62ffffff16021790555060608201518160000160096101000a81548162ffffff021916908360020b62ffffff160217905550608082015181600001600c6101000a81548165ffffffffffff021916908365ffffffffffff16021790555060a08201518160000160126101000a81548163ffffffff021916908363ffffffff16021790555060c08201518160000160166101000a81548160ff02191690831515021790555060e08201518160000160176101000a81548160ff02191690831515021790555090505050505050505050505050505050565b6001600160a01b038316600090815260046020908152604080832033845290915281205460001981146111b9576111948382614dc3565b6001600160a01b03861660009081526004602090815260408083203384529091529020555b6001600160a01b038516600090815260036020526040812080548592906111e1908490614dc3565b90915550506001600160a01b03808516600081815260036020526040908190208054870190555190918716907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef9061123c9087815260200190565b60405180910390a360019150505b9392505050565b600080808615158061126257508515155b6112b35760405162461bcd60e51b815260206004820152600f60248201527f416c6f653a2030206465706f736974000000000000000000000000000000000060448201526064015b60405180910390fd5b6000806112be612132565b50506006805460ff60b81b1916600160b81b1790555090925090506112e2826134fd565b6112eb816134fd565b61131d7f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f6001600160a01b03166123a9565b61134f7f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b36001600160a01b03166123a9565b60007f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f56406001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa1580156113af573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906113d39190614cb9565b50505050505090506000806113eb85858560016123ea565b509150915061140060025483838f8f886135c0565b91995097509550876114455760405162461bcd60e51b815260206004820152600e60248201526d416c6f653a20302073686172657360901b60448201526064016112aa565b898710156114955760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743020746f6f206c6f77000000000000000000000060448201526064016112aa565b888610156114e55760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743120746f6f206c6f77000000000000000000000060448201526064016112aa565b61151a6001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481633308a613706565b61154f6001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216333089613706565b6115593389613789565b604080518981526020810189905290810187905233907f36af321ec8d3c75236829c5317affd40ddb308863a1236d2d277a4025cccee1e9060600160405180910390a250506006805460ff60b81b19169055509398929750909550909350505050565b60007f000000000000000000000000000000000000000000000000000000000000000146146115f2576115ed6137f5565b905090565b507f57f5f49f856f0a7999c65a9d1ff3537bbdb3f2f38e8b0d91729304346a29374e90565b600080600080611625612132565b5050509150915060007f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f56406001600160a01b0316633850c7bd6040518163ffffffff1660e01b815260040160e060405180830381865afa15801561168c573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906116b09190614cb9565b50505050505090506116c583838360006123ea565b5090969095509350505050565b6001805461095790614c5c565b600080846117205760405162461bcd60e51b815260206004820152600e60248201526d416c6f653a20302073686172657360901b60448201526064016112aa565b60008061172b612132565b50506006805460ff60b81b1916600160b81b1790555090925090506117786001600160a01b037f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f166123a9565b6117aa7f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b36001600160a01b03166123a9565b60025460008080806117ba612b4b565b6007546040516370a0823160e01b81523060048201529095509092506001600160a01b037f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f16906370a0823190602401602060405180830381865afa158015611827573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061184b9190614e49565b925083831161185b576000611871565b600a6118678585614dc3565b6118719190614e78565b9350611892846118818585614d63565b61188b9190614dc3565b8d876122d8565b98508189111561190c57816118a78a86614d63565b6118b19190614dc3565b91506118e66001600160a01b037f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f168361388f565b83600960008282546118f89190614d63565b9091555061190890508284614dc3565b6007555b6119146128c7565b6008546040516370a0823160e01b81523060048201529095509092506001600160a01b037f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b316906370a0823190602401602060405180830381865afa158015611981573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906119a59190614e49565b92508383116119b55760006119cb565b600a6119c18585614dc3565b6119cb9190614e78565b93506119db846118818585614d63565b975081881115611a5557816119f08986614d63565b6119fa9190614dc3565b9150611a2f6001600160a01b037f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b3168361388f565b83600a6000828254611a419190614d63565b90915550611a5190508284614dc3565b6008555b6000611a6088613909565b505050509050611a84611a7d826001600160801b03168f896122d8565b899061275b565b92975090955093509150611a98858b614d63565b9950611aa4848a614d63565b9850611ab1600a84614e78565b9450611abe600a83614e78565b9350611ad4611acd8685614dc3565b8e886122d8565b611ade908b614d63565b9950611aed611acd8584614dc3565b611af7908a614d63565b98508460096000828254611b0b9190614d63565b9250508190555083600a6000828254611b249190614d63565b9250508190555050856040015160020b866020015160020b14611bbe576000611b4c87613909565b505050509050611b70611b69826001600160801b03168f896122d8565b889061275b565b92975090955093509150611b85838e886122d8565b611b8f9086614d63565b611b99908b614d63565b9950611ba6828e886122d8565b611bb09085614d63565b611bba908a614d63565b9850505b8a891015611c0e5760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743020746f6f206c6f77000000000000000000000060448201526064016112aa565b89881015611c5e5760405162461bcd60e51b815260206004820152601560248201527f416c6f653a20616d6f756e743120746f6f206c6f77000000000000000000000060448201526064016112aa565b611c926001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816338b6139f1565b611cc66001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216338a6139f1565b611cd0338d613a21565b604080518d8152602081018b905290810189905233907f02f25270a4d87bea75db541cdfe559334a275b4a233520ed6c0a2429667cca949060600160405180910390a250506006805460ff60b81b191690555094989397509295505050505050565b33600090815260036020526040812080548391908390611d53908490614dc3565b90915550506001600160a01b038316600081815260036020526040908190208054850190555133907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef90610a339086815260200190565b6006546000906115ed90600160601b900465ffffffffffff16612385565b336001600160a01b037f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f56401614611dfd57600080fd5b8315611e3757611e376001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb481633866139f1565b8215611e7157611e716001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc21633856139f1565b50505050565b42841015611ec75760405162461bcd60e51b815260206004820152601760248201527f5045524d49545f444541444c494e455f4558504952454400000000000000000060448201526064016112aa565b6000611ed16115bc565b6001600160a01b0389811660008181526005602090815260409182902080546001810190915582517f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c98184015280840194909452938c166060840152608083018b905260a083019390935260c08083018a90528151808403909101815260e08301909152805192019190912061190160f01b6101008301526101028201929092526101228101919091526101420160408051601f198184030181528282528051602091820120600080855291840180845281905260ff88169284019290925260608301869052608083018590529092509060019060a0016020604051602081039080840390855afa158015611fea573d6000803e3d6000fd5b5050604051601f1901519150506001600160a01b038116158015906120205750886001600160a01b0316816001600160a01b0316145b61206c5760405162461bcd60e51b815260206004820152600e60248201527f494e56414c49445f5349474e455200000000000000000000000000000000000060448201526064016112aa565b6001600160a01b0390811660009081526004602090815260408083208b8516808552908352928190208a905551898152919350918a16917f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b925910160405180910390a350505050505050565b6000806120e48385614e8c565b905060008160020b13156120fd57830382019050610a3f565b90920392915050565b6000806121138385614e8c565b905060008160020b126121295783039050610a3f565b90920303919050565b604080516060810182526000808252602082018190529181019190915260408051606081018252600080825260208201819052918101919091526040805161010081018252600654600281810b835263010000008204810b602084015266010000000000008204810b938301939093526901000000000000000000810490920b606082015265ffffffffffff600160601b830416608082015263ffffffff600160901b83041660a082015260ff600160b01b83048116151560c0830152600160b81b90920490911615801560e0830152600091829182919061221357600080fd5b60405180606001604052807f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f56406001600160a01b03168152602001826000015160020b8152602001826020015160020b81525060405180606001604052807f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f56406001600160a01b03168152602001836040015160020b8152602001836060015160020b81525082608001518360a001518460c0015195509550955095509550509091929394565b6000816122e457600080fd5b60008060001985870985870292508281108382030391505080600014156123105750829004905061124a565b83811061231c57600080fd5b60008486880960026001871981018816978890046003810283188082028403028082028403028082028403028082028403028082028403029081029092039091026000889003889004909101858311909403939093029303949094049190911702949350505050565b6000610a3f620186a06123a065ffffffffffff851642614dc3565b620151806122d8565b6040805160048152602481019091526020810180516001600160e01b0316630302f06b60e31b1790526123e6906001600160a01b03831690613a95565b5050565b60408051608081018252600080825260208201819052918101829052606081018290528190600080876040015160020b886020015160020b1461248d5761243088613909565b6001600160801b03948516606089018190529185169650909316935061245b928b92508a9150613aba565b602085015280845282908490612472908390614d63565b905250602083018051829190612489908390614d63565b9052505b6007546040516370a0823160e01b81523060048201529092507f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f6001600160a01b0316906370a0823190602401602060405180830381865afa1580156124f7573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061251b9190614e49565b905081811161252b576000612541565b600a6125378383614dc3565b6125419190614e78565b91508561254e5781612551565b60005b8161255a612b4b565b6125649190614d63565b61256e9190614dc3565b8351849061257d908390614d63565b9052506008546040516370a0823160e01b81523060048201529092507f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b36001600160a01b0316906370a0823190602401602060405180830381865afa1580156125ea573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061260e9190614e49565b905081811161261e576000612634565b600a61262a8383614dc3565b6126349190614e78565b9150856126415781612644565b60005b8161264d6128c7565b6126579190614d63565b6126619190614dc3565b836020018181516126729190614d63565b905250604089015160208a0151600291820b910b146127425761269489613909565b6001600160801b0394851660408901819052918516965090931693506126bf928c92508a9150613aba565b9095509350856126d9576126d4600a83614e78565b6126dc565b60005b83516126e9908490614d63565b6126f39190614dc3565b6126fd9086614d63565b9450856127145761270f600a82614e78565b612717565b60005b8184602001516127279190614d63565b6127319190614dc3565b61273b9085614d63565b935061274f565b8251602084015190955093505b50509450945094915050565b60008080806001600160801b038516156128055785516020870151604080890151905163a34123a760e01b8152600292830b6004820152910b60248201526001600160801b03871660448201526001600160a01b039091169063a34123a79060640160408051808303816000875af11580156127db573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906127ff9190614eae565b90945092505b8551602087015160408089015190516309e3d67b60e31b8152306004820152600292830b6024820152910b60448201526001600160801b0360648201819052608482015260009182916001600160a01b0390911690634f1eb3d89060a40160408051808303816000875af1158015612881573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906128a59190614ee9565b96999598506001600160801b039081168a900397509095168790039450505050565b600a546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc216906370a08231906024015b602060405180830381865afa158015612933573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129579190614e49565b6115ed9190614dc3565b6008546040516370a0823160e01b81523060048201526000919082907f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b36001600160a01b0316906370a0823190602401602060405180830381865afa1580156129ce573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906129f29190614e49565b9050818111612a02576000612a09565b600a828203045b9150818103841115612a1b5781810393505b612a506001600160a01b037f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b31683860161388f565b600a805483019055038290036008555090565b600061124a612a758460200151613aed565b612a828560400151613aed565b84613e40565b6000806001600160801b03831615612b4457835160208501516040808701519051633c8a7d8d60e01b8152306004820152600292830b6024820152910b60448201526001600160801b038516606482015260a06084820152600060a48201526001600160a01b0390911690633c8a7d8d9060c40160408051808303816000875af1158015612b1a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612b3e9190614eae565b90925090505b9250929050565b6009546040516370a0823160e01b8152306004820152600091906001600160a01b037f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb4816906370a0823190602401612916565b6007546040516370a0823160e01b81523060048201526000919082907f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f6001600160a01b0316906370a0823190602401602060405180830381865afa158015612c0b573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612c2f9190614e49565b9050818111612c3f576000612c46565b600a828203045b9150818103841115612c585781810393505b612c8d6001600160a01b037f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f1683860161388f565b6009805483019055038290036007555090565b600061124a612cb28460200151613aed565b612cbf8560400151613aed565b84613e91565b604080516060810182526000808252602082018190529181018290529080612ced888861275b565b935093505050600a60ff168281612d0657612d06614e62565b60098054929091049091019055600a805491819004909101905550600082612d3057616c50612de7565b60405163b168197d60e01b81526001600160a01b037f00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f564081166004830152612de7917f00000000000000000000000000000000007476b17d4ae5919ce21f34ee4562619091169063b168197d906024016020604051808303816000875af1158015612dbe573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190612de29190614e49565b613ee8565b60020b60011d9050600080612dfd878785613f62565b91509150600080612e13896101f46127106122d8565b612e1b612b4b565b039150612e2d886101f46127106122d8565b612e356128c7565b03905083821215612e545760009850612e4f828503612b9e565b820193505b82811215612e705760009750612e6b818403612961565b810192505b612ea0858d60400151037f000000000000000000000000000000000000000000000000000000000000000a612106565b60020b60208c015260408c0151612ed99086017f000000000000000000000000000000000000000000000000000000000000000a6120d7565b600290810b60408d015260208c01517ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2761a820b910b1215612f3d577ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff2761a60020b60208c01525b7f00000000000000000000000000000000000000000000000000000000000d89e660020b8b6040015160020b1315612f99577f00000000000000000000000000000000000000000000000000000000000d89e660020b60408c01525b8b51612fac90610d8e908d908787613fd7565b9094509250881561301557612ff4612fc48584614dc3565b6001600160a01b037f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f1690613ffe565b612ffe8483614dc3565b6007600082825461300f9190614d63565b90915550505b8715613079576130586130288483614dc3565b6001600160a01b037f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b31690613ffe565b6130628382614dc3565b600860008282546130739190614d63565b90915550505b7fe73e1a034909b10f2cbe101ce0618d683b1485c1c2da61474bdbebce08bcaf1a8b602001518c604001516040516130c1929190600292830b8152910b602082015260400190565b60405180910390a150989a9950505050505050505050565b60006001600160a01b03861661313557604080516000808252602082015263ffffffff87168183015290517faf945aff5cea2d4d4f891882674c81bcdaeb15609c6d7bc80875dbc4ee83e4ee9181900360600190a150806134f4565b6001600160a01b0386166000908152600b60205260408120549061317361316263ffffffff881684614f1c565b8863ffffffff16633b9aca006122d8565b90507f000000000000000000000000a0b86991c6218b36c1d19d4a2e9eb0ce3606eb486001600160a01b0316886001600160a01b0316141561323557600954808211806131be575082155b156131c7578091505b6131d18282614dc3565b905060006131f26131e3601486614f1c565b8863ffffffff166127106122d8565b90508082116132015781613203565b805b60095580821115613217576001955061322e565b613222600482614e78565b82101561322e57600095505b5050613470565b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b0316886001600160a01b031614156132c857600a548082118061327e575082155b15613287578091505b6132918282614dc3565b905060006132a36131e3601486614f1c565b90508082116132b257816132b4565b805b600a5580821115613217576001955061322e565b6040516370a0823160e01b81523060048201526000906001600160a01b038a16906370a0823190602401602060405180830381865afa15801561330f573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133339190614e49565b905080821180613341575082155b1561334a578091505b60405163026c7dfb60e31b81526001600160a01b038a811660048301527f000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f1690631363efd890602401602060405180830381865afa1580156133b0573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906133d49190614f3b565b8015613465575060405163026c7dfb60e31b81526001600160a01b038a811660048301527f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b31690631363efd890602401602060405180830381865afa158015613441573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906134659190614f3b565b61346e57600080fd5b505b6134846001600160a01b03891633836139f1565b6134a08861349b612710848a63ffffffff166122d8565b61401d565b604080516001600160a01b038a1681526020810183905263ffffffff89168183015290517faf945aff5cea2d4d4f891882674c81bcdaeb15609c6d7bc80875dbc4ee83e4ee9181900360600190a183925050505b95945050505050565b806040015160020b816020015160020b14156135165750565b600061352182613909565b505050509050806001600160801b03166000146123e65781516020830151604080850151905163a34123a760e01b8152600292830b6004820152910b6024820152600060448201526001600160a01b039091169063a34123a79060640160408051808303816000875af115801561359c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190611e719190614eae565b600080808815806135d057508715155b806135da57508615155b6135e6576135e6614f56565b8861365b5760006136056001600160a01b03861680600160601b6122d8565b905061361f86600160601b836001600160e01b03166122d8565b92508683101561363457859150819350613655565b86925061364f83826001600160e01b0316600160601b6122d8565b91508293505b506136fa565b8761367457508361366d818a896122d8565b92506136fa565b866136875785915061366d828a8a6122d8565b60008789106136a25761369b87898b6122d8565b86106136b0565b866136ae878b8b6122d8565b105b905080156136da578591506136c6828a8a6122d8565b92506136d3828b8a6122d8565b93506136f8565b8692506136e883898b6122d8565b91506136f5838b8b6122d8565b93505b505b96509650969350505050565b6040516001600160a01b0380851660248301528316604482015260648101829052611e719085906323b872dd60e01b906084015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526140f1565b806002600082825461379b9190614d63565b90915550506001600160a01b0382166000818152600360209081526040808320805486019055518481527fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef91015b60405180910390a35050565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60006040516138279190614f6c565b6040805191829003822060208301939093528101919091527fc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc660608201524660808201523060a082015260c00160405160208183030381529060405280519060200120905090565b6040516024810182905261390490632e1a7d4d60e01b906044015b60408051601f198184030181529190526020810180516001600160e01b03167fffffffff00000000000000000000000000000000000000000000000000000000909316929092179091526001600160a01b03841690613a95565b505050565b600080600080600085600001516001600160a01b031663514ea4bf308860200151896040015160405160200161396a9392919060609390931b6bffffffffffffffffffffffff1916835260e891821b6014840152901b6017820152601a0190565b604051602081830303815290604052805190602001206040518263ffffffff1660e01b815260040161399e91815260200190565b60a060405180830381865afa1580156139bb573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906139df9190615008565b939a9299509097509550909350915050565b6040516001600160a01b03831660248201526044810182905261390490849063a9059cbb60e01b9060640161373a565b6001600160a01b03821660009081526003602052604081208054839290613a49908490614dc3565b90915550506002805482900390556040518181526000906001600160a01b038416907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef906020016137e9565b606061124a8383604051806060016040528060278152602001615200602791396141d6565b600080613ae184613ace8760200151613aed565b613adb8860400151613aed565b866142c1565b91509150935093915050565b60008060008360020b12613b04578260020b613b11565b8260020b613b119061505f565b9050613b20620d89e71961507c565b62ffffff16811115613b585760405162461bcd60e51b81526020600482015260016024820152601560fa1b60448201526064016112aa565b600060018216613b7957700100000000000000000000000000000000613b8b565b6ffffcb933bd6fad37aa2d162d1a5940015b70ffffffffffffffffffffffffffffffffff1690506002821615613bbf576ffff97272373d413259a46990580e213a0260801c5b6004821615613bde576ffff2e50f5f656932ef12357cf3c7fdcc0260801c5b6008821615613bfd576fffe5caca7e10e4e61c3624eaa0941cd00260801c5b6010821615613c1c576fffcb9843d60f6159c9db58835c9266440260801c5b6020821615613c3b576fff973b41fa98c081472e6896dfb254c00260801c5b6040821615613c5a576fff2ea16466c96a3843ec78b326b528610260801c5b6080821615613c79576ffe5dee046a99a2a811c461f1969c30530260801c5b610100821615613c99576ffcbe86c7900a88aedcffc83b479aa3a40260801c5b610200821615613cb9576ff987a7253ac413176f2b074cf7815e540260801c5b610400821615613cd9576ff3392b0822b70005940c7a398e4b70f30260801c5b610800821615613cf9576fe7159475a2c29b7443b29c7fa6e889d90260801c5b611000821615613d19576fd097f3bdfd2022b8845ad8f792aa58250260801c5b612000821615613d39576fa9f746462d870fdf8a65dc1f90e061e50260801c5b614000821615613d59576f70d869a156d2a1b890bb3df62baf32f70260801c5b618000821615613d79576f31be135f97d08fd981231505542fcfa60260801c5b62010000821615613d9a576f09aa508b5b7a84e1c677de54f3e99bc90260801c5b62020000821615613dba576e5d6af8dedb81196699c329225ee6040260801c5b62040000821615613dd9576d2216e584f5fa1ea926041bedfe980260801c5b62080000821615613df6576b048a170391f7dc42444e8fa20260801c5b60008460020b1315613e17578060001981613e1357613e13614e62565b0490505b640100000000810615613e2b576001613e2e565b60005b60ff16602082901c0192505050919050565b6000826001600160a01b0316846001600160a01b03161115613e60579192915b613e89613e8483600160601b613e76888861509f565b6001600160a01b03166122d8565b61435d565b949350505050565b6000826001600160a01b0316846001600160a01b03161115613eb1579192915b6000613ed4856001600160a01b0316856001600160a01b0316600160601b6122d8565b90506134f4613e848483613e76898961509f565b6000662358b99a116be08211613f015750610192919050565b67053448a4815102008210613f195750616c50919050565b613f24600283614f1c565b91506000670de0b6b3a7640000839003730de0b6b3a764000000000000000000000000000081613f5657613f56614e62565b04905061124a81614378565b60008080613f77613f728561507c565b613aed565b613f8e906001600160a01b0316600160601b614dc3565b9050613fad86826bffffffffffffffffffffffff16600160601b6122d8565b9250613fcc85826bffffffffffffffffffffffff16600160601b6122d8565b915050935093915050565b60006134f484613fea8760200151613aed565b613ff78860400151613aed565b86866146bf565b604051602481018290526139049063b6b55f2560e01b906044016138aa565b6001600160a01b0382166000908152600c60209081526040808320600d835281842054600b90935292205460ff90911690600a8104810380851015614060578094505b600e85049450838360ff16600e811061407b5761407b6150c7565b01546001600160a01b0387166000908152600b60205260409020838701919091039055848460ff8516600e81106140b4576140b46150c7565b0155600e60ff60018501166001600160a01b03979097166000908152600d60205260409020805460ff19169190970660ff16179095555050505050565b6000614146826040518060400160405280602081526020017f5361666545524332303a206c6f772d6c6576656c2063616c6c206661696c6564815250856001600160a01b03166147779092919063ffffffff16565b80519091501561390457808060200190518101906141649190614f3b565b6139045760405162461bcd60e51b815260206004820152602a60248201527f5361666545524332303a204552433230206f7065726174696f6e20646964206e60448201527f6f7420737563636565640000000000000000000000000000000000000000000060648201526084016112aa565b6060833b61424c5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a2064656c65676174652063616c6c20746f206e6f6e2d636f60448201527f6e7472616374000000000000000000000000000000000000000000000000000060648201526084016112aa565b600080856001600160a01b03168560405161426791906150dd565b600060405180830381855af49150503d80600081146142a2576040519150601f19603f3d011682016040523d82523d6000602084013e6142a7565b606091505b50915091506142b7828286614786565b9695505050505050565b600080836001600160a01b0316856001600160a01b031611156142e2579293925b846001600160a01b0316866001600160a01b03161161430d576143068585856147bf565b9150614354565b836001600160a01b0316866001600160a01b03161015614346576143328685856147bf565b915061433f85878561483b565b9050614354565b61435185858561483b565b90505b94509492505050565b806001600160801b038116811461437357600080fd5b919050565b60006401000276a36001600160a01b038316108015906143b4575073fffd8963efd1fc6a506488495d951d5263988d266001600160a01b038316105b6143e45760405162461bcd60e51b81526020600482015260016024820152602960f91b60448201526064016112aa565b77ffffffffffffffffffffffffffffffffffffffff00000000602083901b166001600160801b03811160071b81811c67ffffffffffffffff811160061b90811c63ffffffff811160051b90811c61ffff811160041b90811c60ff8111600390811b91821c600f811160021b90811c918211600190811b92831c9790881196179094179092171790911717176080811061448c57614482607f82614dc3565b83901c915061449d565b61449781607f614dc3565b83901b91505b600060406144ac6080846150f9565b901b9050828302607f1c92508260801c80603f1b8217915083811c935050828302607f1c92508260801c80603e1b8217915083811c935050828302607f1c92508260801c80603d1b8217915083811c935050828302607f1c92508260801c80603c1b8217915083811c935050828302607f1c92508260801c80603b1b8217915083811c935050828302607f1c92508260801c80603a1b8217915083811c935050828302607f1c92508260801c8060391b8217915083811c935050828302607f1c92508260801c8060381b8217915083811c935050828302607f1c92508260801c8060371b8217915083811c935050828302607f1c92508260801c8060361b8217915083811c935050828302607f1c92508260801c8060351b8217915083811c935050828302607f1c92508260801c8060341b8217915083811c935050828302607f1c92508260801c8060331b8217915083811c935050828302607f1c92508260801c8060321b8217915050600081693627a301d71055774c8561462f9190615138565b90506000608061464f6f028f6481ab7f045a5af012a19d003aaa846150f9565b901d905060006080614671846fdb2df09e81959a81455e260799a0632f6151bf565b901d90508060020b8260020b146146b057886001600160a01b031661469582613aed565b6001600160a01b031611156146aa57816146b2565b806146b2565b815b9998505050505050505050565b6000836001600160a01b0316856001600160a01b031611156146df579293925b846001600160a01b0316866001600160a01b03161161470a57614703858585613e91565b90506134f4565b836001600160a01b0316866001600160a01b0316101561476c576000614731878686613e91565b90506000614740878986613e40565b9050806001600160801b0316826001600160801b0316106147615780614763565b815b925050506134f4565b6142b7858584613e40565b6060613e898484600085614885565b6060831561479557508161124a565b8251156147a55782518084602001fd5b8160405162461bcd60e51b81526004016112aa91906149f0565b6000826001600160a01b0316846001600160a01b031611156147df579192915b6001600160a01b0384166148317bffffffffffffffffffffffffffffffff000000000000000000000000606085901b16614819878761509f565b6001600160a01b0316866001600160a01b03166122d8565b613e899190614e78565b6000826001600160a01b0316846001600160a01b0316111561485b579192915b613e896001600160801b038316614872868661509f565b6001600160a01b0316600160601b6122d8565b6060824710156148fd5760405162461bcd60e51b815260206004820152602660248201527f416464726573733a20696e73756666696369656e742062616c616e636520666f60448201527f722063616c6c000000000000000000000000000000000000000000000000000060648201526084016112aa565b843b61494b5760405162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e747261637400000060448201526064016112aa565b600080866001600160a01b0316858760405161496791906150dd565b60006040518083038185875af1925050503d80600081146149a4576040519150601f19603f3d011682016040523d82523d6000602084013e6149a9565b606091505b50915091506149b9828286614786565b979650505050505050565b60005b838110156149df5781810151838201526020016149c7565b83811115611e715750506000910152565b6020815260008251806020840152614a0f8160408501602087016149c4565b601f01601f19169190910160400192915050565b6001600160a01b0381168114614a3857600080fd5b50565b60008060408385031215614a4e57600080fd5b8235614a5981614a23565b946020939093013593505050565b600060208284031215614a7957600080fd5b813561124a81614a23565b600080600060608486031215614a9957600080fd5b8335614aa481614a23565b92506020840135614ab481614a23565b929592945050506040919091013590565b60008060008060808587031215614adb57600080fd5b5050823594602084013594506040840135936060013592509050565b600080600060608486031215614b0c57600080fd5b505081359360208301359350604090920135919050565b60008060008060608587031215614b3957600080fd5b8435935060208501359250604085013567ffffffffffffffff80821115614b5f57600080fd5b818701915087601f830112614b7357600080fd5b813581811115614b8257600080fd5b886020828501011115614b9457600080fd5b95989497505060200194505050565b60ff81168114614a3857600080fd5b600080600080600080600060e0888a031215614bcd57600080fd5b8735614bd881614a23565b96506020880135614be881614a23565b955060408801359450606088013593506080880135614c0681614ba3565b9699959850939692959460a0840135945060c09093013592915050565b60008060408385031215614c3657600080fd5b8235614c4181614a23565b91506020830135614c5181614a23565b809150509250929050565b600181811c90821680614c7057607f821691505b60208210811415614c9157634e487b7160e01b600052602260045260246000fd5b50919050565b805161ffff8116811461437357600080fd5b8051801515811461437357600080fd5b600080600080600080600060e0888a031215614cd457600080fd5b8751614cdf81614a23565b8097505060208801518060020b8114614cf757600080fd5b9550614d0560408901614c97565b9450614d1360608901614c97565b9350614d2160808901614c97565b925060a0880151614d3181614ba3565b9150614d3f60c08901614ca9565b905092959891949750929550565b634e487b7160e01b600052601160045260246000fd5b60008219821115614d7657614d76614d4d565b500190565b60008160020b8360020b6000811281627fffff1901831281151615614da257614da2614d4d565b81627fffff018313811615614db957614db9614d4d565b5090039392505050565b600082821015614dd557614dd5614d4d565b500390565b60008160020b8360020b6000821282627fffff03821381151615614e0057614e00614d4d565b82627fffff19038212811615614e1857614e18614d4d565b50019392505050565b600063ffffffff808316818516808303821115614e4057614e40614d4d565b01949350505050565b600060208284031215614e5b57600080fd5b5051919050565b634e487b7160e01b600052601260045260246000fd5b600082614e8757614e87614e62565b500490565b60008260020b80614e9f57614e9f614e62565b808360020b0791505092915050565b60008060408385031215614ec157600080fd5b505080516020909101519092909150565b80516001600160801b038116811461437357600080fd5b60008060408385031215614efc57600080fd5b614f0583614ed2565b9150614f1360208401614ed2565b90509250929050565b6000816000190483118215151615614f3657614f36614d4d565b500290565b600060208284031215614f4d57600080fd5b61124a82614ca9565b634e487b7160e01b600052600160045260246000fd5b600080835481600182811c915080831680614f8857607f831692505b6020808410821415614fa857634e487b7160e01b86526022600452602486fd5b818015614fbc5760018114614fcd57614ffa565b60ff19861689528489019650614ffa565b60008a81526020902060005b86811015614ff25781548b820152908501908301614fd9565b505084890196505b509498975050505050505050565b600080600080600060a0868803121561502057600080fd5b61502986614ed2565b9450602086015193506040860151925061504560608701614ed2565b915061505360808701614ed2565b90509295509295909350565b6000600160ff1b82141561507557615075614d4d565b5060000390565b60008160020b627fffff1981141561509657615096614d4d565b60000392915050565b60006001600160a01b03838116908316818110156150bf576150bf614d4d565b039392505050565b634e487b7160e01b600052603260045260246000fd5b600082516150ef8184602087016149c4565b9190910192915050565b60008083128015600160ff1b85018412161561511757615117614d4d565b836001600160ff1b0301831381161561513257615132614d4d565b50500390565b60006001600160ff1b0360008413600084138583048511828216161561516057615160614d4d565b600160ff1b600087128281168783058912161561517f5761517f614d4d565b6000871292508782058712848416161561519b5761519b614d4d565b878505871281841616156151b1576151b1614d4d565b505050929093029392505050565b6000808212826001600160ff1b03038413811516156151e0576151e0614d4d565b600160ff1b83900384128116156151f9576151f9614d4d565b5050019056fe416464726573733a206c6f772d6c6576656c2064656c65676174652063616c6c206661696c6564a26469706673582212209803ba6c5392bde5618d81bbb74d963906844c27cdaef43c2fd36f4a23e9e5f564736f6c634300080a0033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b3
-----Decoded View---------------
Arg [0] : _uniPool (address): 0x88e6A0c2dDD26FEEb64F039a2c41296FcB3f5640
Arg [1] : _silo0 (address): 0x723bFE564661536FDFfa3E9e060135928d3bf18F
Arg [2] : _silo1 (address): 0xbA9aD27Ed23b5E002e831514E69554815a5820b3
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 00000000000000000000000088e6a0c2ddd26feeb64f039a2c41296fcb3f5640
Arg [1] : 000000000000000000000000723bfe564661536fdffa3e9e060135928d3bf18f
Arg [2] : 000000000000000000000000ba9ad27ed23b5e002e831514e69554815a5820b3
Loading...
Loading
Loading...
Loading
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.