Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Loading...
Loading
Contract Source Code Verified (Exact Match) This is an ERC-5202 Blueprint contract
Contract Name:
CurveTricryptoOptimizedWETH
Compiler Version
vyper:0.3.10
Contract Source Code (Vyper language format)
# pragma version 0.3.10 # pragma optimize gas # pragma evm-version paris """ @title CurveTricryptoOptimizedWETH @author Curve.Fi @license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved @notice A Curve AMM pool for 3 unpegged assets (e.g. ETH, BTC, USD). @dev All prices in the AMM are with respect to the first token in the pool. Supports native token transfers. """ from vyper.interfaces import ERC20 implements: ERC20 # <--------------------- AMM contract is also the LP token. # --------------------------------- Interfaces ------------------------------- interface Math: def geometric_mean(_x: uint256[N_COINS]) -> uint256: view def wad_exp(_power: int256) -> uint256: view def cbrt(x: uint256) -> uint256: view def reduction_coefficient( x: uint256[N_COINS], fee_gamma: uint256 ) -> uint256: view def newton_D( ANN: uint256, gamma: uint256, x_unsorted: uint256[N_COINS], K0_prev: uint256 ) -> uint256: view def get_y( ANN: uint256, gamma: uint256, x: uint256[N_COINS], D: uint256, i: uint256, ) -> uint256[2]: view def get_p( _xp: uint256[N_COINS], _D: uint256, _A_gamma: uint256[2], ) -> uint256[N_COINS-1]: view interface WETH: def deposit(): payable def withdraw(_amount: uint256): nonpayable interface Factory: def admin() -> address: view def fee_receiver() -> address: view def views_implementation() -> address: view interface Views: def calc_token_amount( amounts: uint256[N_COINS], deposit: bool, swap: address ) -> uint256: view def get_dy( i: uint256, j: uint256, dx: uint256, swap: address ) -> uint256: view def get_dx( i: uint256, j: uint256, dy: uint256, swap: address ) -> uint256: view # ------------------------------- Events ------------------------------------- event Transfer: sender: indexed(address) receiver: indexed(address) value: uint256 event Approval: owner: indexed(address) spender: indexed(address) value: uint256 event TokenExchange: buyer: indexed(address) sold_id: uint256 tokens_sold: uint256 bought_id: uint256 tokens_bought: uint256 fee: uint256 packed_price_scale: uint256 event AddLiquidity: provider: indexed(address) token_amounts: uint256[N_COINS] fee: uint256 token_supply: uint256 packed_price_scale: uint256 event RemoveLiquidity: provider: indexed(address) token_amounts: uint256[N_COINS] token_supply: uint256 event RemoveLiquidityOne: provider: indexed(address) token_amount: uint256 coin_index: uint256 coin_amount: uint256 approx_fee: uint256 packed_price_scale: uint256 event CommitNewParameters: deadline: indexed(uint256) mid_fee: uint256 out_fee: uint256 fee_gamma: uint256 allowed_extra_profit: uint256 adjustment_step: uint256 ma_time: uint256 event NewParameters: mid_fee: uint256 out_fee: uint256 fee_gamma: uint256 allowed_extra_profit: uint256 adjustment_step: uint256 ma_time: uint256 event RampAgamma: initial_A: uint256 future_A: uint256 initial_gamma: uint256 future_gamma: uint256 initial_time: uint256 future_time: uint256 event StopRampA: current_A: uint256 current_gamma: uint256 time: uint256 event ClaimAdminFee: admin: indexed(address) tokens: uint256 # ----------------------- Storage/State Variables ---------------------------- WETH20: public(immutable(address)) N_COINS: constant(uint256) = 3 PRECISION: constant(uint256) = 10**18 # <------- The precision to convert to. A_MULTIPLIER: constant(uint256) = 10000 packed_precisions: uint256 MATH: public(immutable(Math)) coins: public(immutable(address[N_COINS])) factory: public(address) price_scale_packed: uint256 # <------------------------ Internal price scale. price_oracle_packed: uint256 # <------- Price target given by moving average. last_prices_packed: uint256 last_prices_timestamp: public(uint256) initial_A_gamma: public(uint256) initial_A_gamma_time: public(uint256) future_A_gamma: public(uint256) future_A_gamma_time: public(uint256) # <------ Time when ramping is finished. # This value is 0 (default) when pool is first deployed, and only gets # populated by block.timestamp + future_time in `ramp_A_gamma` when the # ramping process is initiated. After ramping is finished # (i.e. self.future_A_gamma_time < block.timestamp), the variable is left # and not set to 0. balances: public(uint256[N_COINS]) D: public(uint256) xcp_profit: public(uint256) xcp_profit_a: public(uint256) # <--- Full profit at last claim of admin fees. virtual_price: public(uint256) # <------ Cached (fast to read) virtual price. # The cached `virtual_price` is also used internally. # -------------- Params that affect how price_scale get adjusted ------------- packed_rebalancing_params: public(uint256) # <---------- Contains rebalancing # parameters allowed_extra_profit, adjustment_step, and ma_time. future_packed_rebalancing_params: uint256 # ---------------- Fee params that determine dynamic fees -------------------- packed_fee_params: public(uint256) # <---- Packs mid_fee, out_fee, fee_gamma. future_packed_fee_params: uint256 ADMIN_FEE: public(constant(uint256)) = 5 * 10**9 # <----- 50% of earned fees. MIN_FEE: constant(uint256) = 5 * 10**5 # <-------------------------- 0.5 BPS. MAX_FEE: constant(uint256) = 10 * 10**9 NOISE_FEE: constant(uint256) = 10**5 # <---------------------------- 0.1 BPS. # ----------------------- Admin params --------------------------------------- admin_actions_deadline: public(uint256) ADMIN_ACTIONS_DELAY: constant(uint256) = 3 * 86400 MIN_RAMP_TIME: constant(uint256) = 86400 MIN_A: constant(uint256) = N_COINS**N_COINS * A_MULTIPLIER / 100 MAX_A: constant(uint256) = 1000 * A_MULTIPLIER * N_COINS**N_COINS MAX_A_CHANGE: constant(uint256) = 10 MIN_GAMMA: constant(uint256) = 10**10 MAX_GAMMA: constant(uint256) = 5 * 10**16 PRICE_SIZE: constant(uint128) = 256 / (N_COINS - 1) PRICE_MASK: constant(uint256) = 2**PRICE_SIZE - 1 # ----------------------- ERC20 Specific vars -------------------------------- name: public(immutable(String[64])) symbol: public(immutable(String[32])) decimals: public(constant(uint8)) = 18 version: public(constant(String[8])) = "v2.0.0" balanceOf: public(HashMap[address, uint256]) allowance: public(HashMap[address, HashMap[address, uint256]]) totalSupply: public(uint256) nonces: public(HashMap[address, uint256]) EIP712_TYPEHASH: constant(bytes32) = keccak256( "EIP712Domain(string name,string version,uint256 chainId,address verifyingContract,bytes32 salt)" ) EIP2612_TYPEHASH: constant(bytes32) = keccak256( "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)" ) VERSION_HASH: constant(bytes32) = keccak256(version) NAME_HASH: immutable(bytes32) CACHED_CHAIN_ID: immutable(uint256) salt: public(immutable(bytes32)) CACHED_DOMAIN_SEPARATOR: immutable(bytes32) # ----------------------- Contract ------------------------------------------- @external def __init__( _name: String[64], _symbol: String[32], _coins: address[N_COINS], _math: address, _weth: address, _salt: bytes32, packed_precisions: uint256, packed_A_gamma: uint256, packed_fee_params: uint256, packed_rebalancing_params: uint256, packed_prices: uint256, ): WETH20 = _weth MATH = Math(_math) self.factory = msg.sender name = _name symbol = _symbol coins = _coins self.packed_precisions = packed_precisions # <------- Precisions of coins # are calculated as 10**(18 - coin.decimals()). self.initial_A_gamma = packed_A_gamma # <------------------- A and gamma. self.future_A_gamma = packed_A_gamma self.packed_rebalancing_params = packed_rebalancing_params # <-- Contains # rebalancing params: allowed_extra_profit, adjustment_step, # and ma_exp_time. self.packed_fee_params = packed_fee_params # <-------------- Contains Fee # params: mid_fee, out_fee and fee_gamma. self.price_scale_packed = packed_prices self.price_oracle_packed = packed_prices self.last_prices_packed = packed_prices self.last_prices_timestamp = block.timestamp self.xcp_profit_a = 10**18 # Cache DOMAIN_SEPARATOR. If chain.id is not CACHED_CHAIN_ID, then # DOMAIN_SEPARATOR will be re-calculated each time `permit` is called. # Otherwise, it will always use CACHED_DOMAIN_SEPARATOR. # see: `_domain_separator()` for its implementation. NAME_HASH = keccak256(name) salt = _salt CACHED_CHAIN_ID = chain.id CACHED_DOMAIN_SEPARATOR = keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) log Transfer(empty(address), self, 0) # <------- Fire empty transfer from # 0x0 to self for indexers to catch. # ------------------- Token transfers in and out of the AMM ------------------ @payable @external def __default__(): if msg.value > 0: assert WETH20 in coins @internal def _transfer_in( _coin: address, dx: uint256, dy: uint256, mvalue: uint256, callbacker: address, callback_sig: bytes32, sender: address, receiver: address, use_eth: bool ): """ @notice Transfers `_coin` from `sender` to `self` and calls `callback_sig` if it is not empty. @dev The callback sig must have the following args: sender: address receiver: address coin: address dx: uint256 dy: uint256 @params _coin address of the coin to transfer in. @params dx amount of `_coin` to transfer into the pool. @params dy amount of `_coin` to transfer out of the pool. @params mvalue msg.value if the transfer is ETH, 0 otherwise. @params callbacker address to call `callback_sig` on. @params callback_sig signature of the callback function. @params sender address to transfer `_coin` from. @params receiver address to transfer `_coin` to. @params use_eth True if the transfer is ETH, False otherwise. """ if use_eth and _coin == WETH20: assert mvalue == dx # dev: incorrect eth amount else: assert mvalue == 0 # dev: nonzero eth amount if callback_sig == empty(bytes32): assert ERC20(_coin).transferFrom( sender, self, dx, default_return_value=True ) else: # --------- This part of the _transfer_in logic is only accessible # by _exchange. # First call callback logic and then check if pool # gets dx amounts of _coins[i], revert otherwise. b: uint256 = ERC20(_coin).balanceOf(self) raw_call( callbacker, concat( slice(callback_sig, 0, 4), _abi_encode(sender, receiver, _coin, dx, dy) ) ) assert ERC20(_coin).balanceOf(self) - b == dx # dev: callback didn't give us coins # ^------ note: dx cannot # be 0, so the contract MUST receive some _coin. if _coin == WETH20: WETH(WETH20).withdraw(dx) # <--------- if WETH was transferred in # previous step and `not use_eth`, withdraw WETH to ETH. @internal def _transfer_out( _coin: address, _amount: uint256, use_eth: bool, receiver: address ): """ @notice Transfer a single token from the pool to receiver. @dev This function is called by `remove_liquidity` and `remove_liquidity_one` and `_exchange` methods. @params _coin Address of the token to transfer out @params _amount Amount of token to transfer out @params use_eth Whether to transfer ETH or not @params receiver Address to send the tokens to """ if use_eth and _coin == WETH20: raw_call(receiver, b"", value=_amount) else: if _coin == WETH20: WETH(WETH20).deposit(value=_amount) assert ERC20(_coin).transfer( receiver, _amount, default_return_value=True ) # -------------------------- AMM Main Functions ------------------------------ @payable @external @nonreentrant("lock") def exchange( i: uint256, j: uint256, dx: uint256, min_dy: uint256, use_eth: bool = False, receiver: address = msg.sender ) -> uint256: """ @notice Exchange using wrapped native token by default @param i Index value for the input coin @param j Index value for the output coin @param dx Amount of input coin being swapped in @param min_dy Minimum amount of output coin to receive @param use_eth True if the input coin is native token, False otherwise @param receiver Address to send the output coin to. Default is msg.sender @return uint256 Amount of tokens at index j received by the `receiver """ return self._exchange( msg.sender, msg.value, i, j, dx, min_dy, use_eth, receiver, empty(address), empty(bytes32) ) @payable @external @nonreentrant('lock') def exchange_underlying( i: uint256, j: uint256, dx: uint256, min_dy: uint256, receiver: address = msg.sender ) -> uint256: """ @notice Exchange using native token transfers. @param i Index value for the input coin @param j Index value for the output coin @param dx Amount of input coin being swapped in @param min_dy Minimum amount of output coin to receive @param receiver Address to send the output coin to. Default is msg.sender @return uint256 Amount of tokens at index j received by the `receiver """ return self._exchange( msg.sender, msg.value, i, j, dx, min_dy, True, receiver, empty(address), empty(bytes32) ) @external @nonreentrant('lock') def exchange_extended( i: uint256, j: uint256, dx: uint256, min_dy: uint256, use_eth: bool, sender: address, receiver: address, cb: bytes32 ) -> uint256: """ @notice Exchange with callback method. @dev This method does not allow swapping in native token, but does allow swaps that transfer out native token from the pool. @dev Does not allow flashloans @dev One use-case is to reduce the number of redundant ERC20 token transfers in zaps. @param i Index value for the input coin @param j Index value for the output coin @param dx Amount of input coin being swapped in @param min_dy Minimum amount of output coin to receive @param use_eth True if output is native token, False otherwise @param sender Address to transfer input coin from @param receiver Address to send the output coin to @param cb Callback signature @return uint256 Amount of tokens at index j received by the `receiver` """ assert cb != empty(bytes32) # dev: No callback specified return self._exchange( sender, 0, i, j, dx, min_dy, use_eth, receiver, msg.sender, cb ) # callbacker should never be self ------------------^ @payable @external @nonreentrant("lock") def add_liquidity( amounts: uint256[N_COINS], min_mint_amount: uint256, use_eth: bool = False, receiver: address = msg.sender ) -> uint256: """ @notice Adds liquidity into the pool. @param amounts Amounts of each coin to add. @param min_mint_amount Minimum amount of LP to mint. @param use_eth True if native token is being added to the pool. @param receiver Address to send the LP tokens to. Default is msg.sender @return uint256 Amount of LP tokens received by the `receiver """ A_gamma: uint256[2] = self._A_gamma() xp: uint256[N_COINS] = self.balances amountsp: uint256[N_COINS] = empty(uint256[N_COINS]) xx: uint256[N_COINS] = empty(uint256[N_COINS]) d_token: uint256 = 0 d_token_fee: uint256 = 0 old_D: uint256 = 0 assert amounts[0] + amounts[1] + amounts[2] > 0 # dev: no coins to add # --------------------- Get prices, balances ----------------------------- precisions: uint256[N_COINS] = self._unpack(self.packed_precisions) packed_price_scale: uint256 = self.price_scale_packed price_scale: uint256[N_COINS-1] = self._unpack_prices(packed_price_scale) # -------------------------------------- Update balances and calculate xp. xp_old: uint256[N_COINS] = xp for i in range(N_COINS): bal: uint256 = xp[i] + amounts[i] xp[i] = bal self.balances[i] = bal xx = xp xp[0] *= precisions[0] xp_old[0] *= precisions[0] for i in range(1, N_COINS): xp[i] = unsafe_div(xp[i] * price_scale[i-1] * precisions[i], PRECISION) xp_old[i] = unsafe_div( xp_old[i] * unsafe_mul(price_scale[i-1], precisions[i]), PRECISION ) # ---------------- transferFrom token into the pool ---------------------- for i in range(N_COINS): if amounts[i] > 0: if coins[i] == WETH20: self._transfer_in( coins[i], amounts[i], 0, # <----------------------------------- msg.value, # | No callbacks empty(address), # <----------------------| for empty(bytes32), # <----------------------| add_liquidity. msg.sender, # | empty(address), # <----------------------- use_eth ) else: self._transfer_in( coins[i], amounts[i], 0, 0, # <----------------- mvalue = 0 if coin is not WETH20. empty(address), empty(bytes32), msg.sender, empty(address), False # <-------- use_eth is False if coin is not WETH20. ) amountsp[i] = xp[i] - xp_old[i] # -------------------- Calculate LP tokens to mint ----------------------- if self.future_A_gamma_time > block.timestamp: # <--- A_gamma is ramping. # ----- Recalculate the invariant if A or gamma are undergoing a ramp. old_D = MATH.newton_D(A_gamma[0], A_gamma[1], xp_old, 0) else: old_D = self.D D: uint256 = MATH.newton_D(A_gamma[0], A_gamma[1], xp, 0) token_supply: uint256 = self.totalSupply if old_D > 0: d_token = token_supply * D / old_D - token_supply else: d_token = self.get_xcp(D) # <------------------------- Making initial # virtual price equal to 1. assert d_token > 0 # dev: nothing minted if old_D > 0: d_token_fee = ( self._calc_token_fee(amountsp, xp) * d_token / 10**10 + 1 ) d_token -= d_token_fee token_supply += d_token self.mint(receiver, d_token) packed_price_scale = self.tweak_price(A_gamma, xp, D, 0) else: self.D = D self.virtual_price = 10**18 self.xcp_profit = 10**18 self.xcp_profit_a = 10**18 self.mint(receiver, d_token) assert d_token >= min_mint_amount, "Slippage" log AddLiquidity( receiver, amounts, d_token_fee, token_supply, packed_price_scale ) self._claim_admin_fees() # <--------------------------- Claim admin fees. return d_token @external @nonreentrant("lock") def remove_liquidity( _amount: uint256, min_amounts: uint256[N_COINS], use_eth: bool = False, receiver: address = msg.sender, claim_admin_fees: bool = True, ) -> uint256[N_COINS]: """ @notice This withdrawal method is very safe, does no complex math since tokens are withdrawn in balanced proportions. No fees are charged. @param _amount Amount of LP tokens to burn @param min_amounts Minimum amounts of tokens to withdraw @param use_eth Whether to withdraw ETH or not @param receiver Address to send the withdrawn tokens to @param claim_admin_fees If True, call self._claim_admin_fees(). Default is True. @return uint256[3] Amount of pool tokens received by the `receiver` """ amount: uint256 = _amount balances: uint256[N_COINS] = self.balances d_balances: uint256[N_COINS] = empty(uint256[N_COINS]) if claim_admin_fees: self._claim_admin_fees() # <------ We claim fees so that the DAO gets # paid before withdrawal. In emergency cases, set it to False. # -------------------------------------------------------- Burn LP tokens. total_supply: uint256 = self.totalSupply # <------ Get totalSupply before self.burnFrom(msg.sender, _amount) # ---- reducing it with self.burnFrom. # There are two cases for withdrawing tokens from the pool. # Case 1. Withdrawal does not empty the pool. # In this situation, D is adjusted proportional to the amount of # LP tokens burnt. ERC20 tokens transferred is proportional # to : (AMM balance * LP tokens in) / LP token total supply # Case 2. Withdrawal empties the pool. # In this situation, all tokens are withdrawn and the invariant # is reset. if amount == total_supply: # <----------------------------------- Case 2. for i in range(N_COINS): d_balances[i] = balances[i] self.balances[i] = 0 # <------------------------- Empty the pool. else: # <-------------------------------------------------------- Case 1. amount -= 1 # <---- To prevent rounding errors, favor LPs a tiny bit. for i in range(N_COINS): d_balances[i] = balances[i] * amount / total_supply assert d_balances[i] >= min_amounts[i] self.balances[i] = balances[i] - d_balances[i] balances[i] = d_balances[i] # <-- Now it's the amounts going out. D: uint256 = self.D self.D = D - unsafe_div(D * amount, total_supply) # <----------- Reduce D # proportional to the amount of tokens leaving. Since withdrawals are # balanced, this is a simple subtraction. If amount == total_supply, # D will be 0. # ---------------------------------- Transfers --------------------------- for i in range(N_COINS): self._transfer_out(coins[i], d_balances[i], use_eth, receiver) log RemoveLiquidity(msg.sender, balances, total_supply - _amount) return d_balances @external @nonreentrant("lock") def remove_liquidity_one_coin( token_amount: uint256, i: uint256, min_amount: uint256, use_eth: bool = False, receiver: address = msg.sender ) -> uint256: """ @notice Withdraw liquidity in a single token. Involves fees (lower than swap fees). @dev This operation also involves an admin fee claim. @param token_amount Amount of LP tokens to burn @param i Index of the token to withdraw @param min_amount Minimum amount of token to withdraw. @param use_eth Whether to withdraw ETH or not @param receiver Address to send the withdrawn tokens to @return Amount of tokens at index i received by the `receiver` """ A_gamma: uint256[2] = self._A_gamma() dy: uint256 = 0 D: uint256 = 0 p: uint256 = 0 xp: uint256[N_COINS] = empty(uint256[N_COINS]) approx_fee: uint256 = 0 # ---------------------------- Claim admin fees before removing liquidity. self._claim_admin_fees() # ------------------------------------------------------------------------ dy, D, xp, approx_fee = self._calc_withdraw_one_coin( A_gamma, token_amount, i, (self.future_A_gamma_time > block.timestamp), # <------- During ramps ) # we need to update D. assert dy >= min_amount, "Slippage" # ------------------------- Transfers ------------------------------------ self.balances[i] -= dy self.burnFrom(msg.sender, token_amount) self._transfer_out(coins[i], dy, use_eth, receiver) packed_price_scale: uint256 = self.tweak_price(A_gamma, xp, D, 0) # Safe to use D from _calc_withdraw_one_coin here ---^ log RemoveLiquidityOne( msg.sender, token_amount, i, dy, approx_fee, packed_price_scale ) return dy @external @nonreentrant("lock") def claim_admin_fees(): """ @notice Claim admin fees. Callable by anyone. """ self._claim_admin_fees() # -------------------------- Packing functions ------------------------------- @internal @view def _pack(x: uint256[3]) -> uint256: """ @notice Packs 3 integers with values <= 10**18 into a uint256 @param x The uint256[3] to pack @return uint256 Integer with packed values """ return (x[0] << 128) | (x[1] << 64) | x[2] @internal @view def _unpack(_packed: uint256) -> uint256[3]: """ @notice Unpacks a uint256 into 3 integers (values must be <= 10**18) @param val The uint256 to unpack @return uint256[3] A list of length 3 with unpacked integers """ return [ (_packed >> 128) & 18446744073709551615, (_packed >> 64) & 18446744073709551615, _packed & 18446744073709551615, ] @internal @view def _pack_prices(prices_to_pack: uint256[N_COINS-1]) -> uint256: """ @notice Packs N_COINS-1 prices into a uint256. @param prices_to_pack The prices to pack @return uint256 An integer that packs prices """ packed_prices: uint256 = 0 p: uint256 = 0 for k in range(N_COINS - 1): packed_prices = packed_prices << PRICE_SIZE p = prices_to_pack[N_COINS - 2 - k] assert p < PRICE_MASK packed_prices = p | packed_prices return packed_prices @internal @view def _unpack_prices(_packed_prices: uint256) -> uint256[2]: """ @notice Unpacks N_COINS-1 prices from a uint256. @param _packed_prices The packed prices @return uint256[2] Unpacked prices """ unpacked_prices: uint256[N_COINS-1] = empty(uint256[N_COINS-1]) packed_prices: uint256 = _packed_prices for k in range(N_COINS - 1): unpacked_prices[k] = packed_prices & PRICE_MASK packed_prices = packed_prices >> PRICE_SIZE return unpacked_prices # ---------------------- AMM Internal Functions ------------------------------- @internal def _exchange( sender: address, mvalue: uint256, i: uint256, j: uint256, dx: uint256, min_dy: uint256, use_eth: bool, receiver: address, callbacker: address, callback_sig: bytes32 ) -> uint256: assert i != j # dev: coin index out of range assert dx > 0 # dev: do not exchange 0 coins A_gamma: uint256[2] = self._A_gamma() xp: uint256[N_COINS] = self.balances precisions: uint256[N_COINS] = self._unpack(self.packed_precisions) dy: uint256 = 0 y: uint256 = xp[j] # <----------------- if j > N_COINS, this will revert. x0: uint256 = xp[i] # <--------------- if i > N_COINS, this will revert. xp[i] = x0 + dx self.balances[i] = xp[i] packed_price_scale: uint256 = self.price_scale_packed price_scale: uint256[N_COINS - 1] = self._unpack_prices( packed_price_scale ) xp[0] *= precisions[0] for k in range(1, N_COINS): xp[k] = unsafe_div( xp[k] * price_scale[k - 1] * precisions[k], PRECISION ) # <-------- Safu to do unsafe_div here since PRECISION is not zero. prec_i: uint256 = precisions[i] # ----------- Update invariant if A, gamma are undergoing ramps --------- t: uint256 = self.future_A_gamma_time if t > block.timestamp: x0 *= prec_i if i > 0: x0 = unsafe_div(x0 * price_scale[i - 1], PRECISION) x1: uint256 = xp[i] # <------------------ Back up old value in xp ... xp[i] = x0 # | self.D = MATH.newton_D(A_gamma[0], A_gamma[1], xp, 0) # | xp[i] = x1 # <-------------------------------------- ... and restore. # ----------------------- Calculate dy and fees -------------------------- D: uint256 = self.D prec_j: uint256 = precisions[j] y_out: uint256[2] = MATH.get_y(A_gamma[0], A_gamma[1], xp, D, j) dy = xp[j] - y_out[0] xp[j] -= dy dy -= 1 if j > 0: dy = dy * PRECISION / price_scale[j - 1] dy /= prec_j fee: uint256 = unsafe_div(self._fee(xp) * dy, 10**10) dy -= fee # <--------------------- Subtract fee from the outgoing amount. assert dy >= min_dy, "Slippage" y -= dy self.balances[j] = y # <----------- Update pool balance of outgoing coin. y *= prec_j if j > 0: y = unsafe_div(y * price_scale[j - 1], PRECISION) xp[j] = y # <------------------------------------------------- Update xp. # ---------------------- Do Transfers in and out ------------------------- ########################## TRANSFER IN <------- self._transfer_in( coins[i], dx, dy, mvalue, callbacker, callback_sig, # <-------- Callback method is called here. sender, receiver, use_eth, ) ########################## -------> TRANSFER OUT self._transfer_out(coins[j], dy, use_eth, receiver) # ------ Tweak price_scale with good initial guess for newton_D ---------- packed_price_scale = self.tweak_price(A_gamma, xp, 0, y_out[1]) log TokenExchange(sender, i, dx, j, dy, fee, packed_price_scale) return dy @internal def tweak_price( A_gamma: uint256[2], _xp: uint256[N_COINS], new_D: uint256, K0_prev: uint256 = 0, ) -> uint256: """ @notice Tweaks price_oracle, last_price and conditionally adjusts price_scale. This is called whenever there is an unbalanced liquidity operation: _exchange, add_liquidity, or remove_liquidity_one_coin. @dev Contains main liquidity rebalancing logic, by tweaking `price_scale`. @param A_gamma Array of A and gamma parameters. @param _xp Array of current balances. @param new_D New D value. @param K0_prev Initial guess for `newton_D`. """ # ---------------------------- Read storage ------------------------------ rebalancing_params: uint256[3] = self._unpack( self.packed_rebalancing_params ) # <---------- Contains: allowed_extra_profit, adjustment_step, ma_time. price_oracle: uint256[N_COINS - 1] = self._unpack_prices( self.price_oracle_packed ) last_prices: uint256[N_COINS - 1] = self._unpack_prices( self.last_prices_packed ) packed_price_scale: uint256 = self.price_scale_packed price_scale: uint256[N_COINS - 1] = self._unpack_prices( packed_price_scale ) total_supply: uint256 = self.totalSupply old_xcp_profit: uint256 = self.xcp_profit old_virtual_price: uint256 = self.virtual_price last_prices_timestamp: uint256 = self.last_prices_timestamp # ----------------------- Update MA if needed ---------------------------- if last_prices_timestamp < block.timestamp: # The moving average price oracle is calculated using the last_price # of the trade at the previous block, and the price oracle logged # before that trade. This can happen only once per block. # ------------------ Calculate moving average params ----------------- alpha: uint256 = MATH.wad_exp( -convert( unsafe_div( (block.timestamp - last_prices_timestamp) * 10**18, rebalancing_params[2] # <----------------------- ma_time. ), int256, ) ) for k in range(N_COINS - 1): # ----------------- We cap state price that goes into the EMA with # 2 x price_scale. price_oracle[k] = unsafe_div( min(last_prices[k], 2 * price_scale[k]) * (10**18 - alpha) + price_oracle[k] * alpha, # ^-------- Cap spot price into EMA. 10**18 ) self.price_oracle_packed = self._pack_prices(price_oracle) self.last_prices_timestamp = block.timestamp # <---- Store timestamp. # price_oracle is used further on to calculate its vector # distance from price_scale. This distance is used to calculate # the amount of adjustment to be done to the price_scale. # ------------------ If new_D is set to 0, calculate it ------------------ D_unadjusted: uint256 = new_D if new_D == 0: # <--------------------------- _exchange sets new_D to 0. D_unadjusted = MATH.newton_D(A_gamma[0], A_gamma[1], _xp, K0_prev) # ----------------------- Calculate last_prices -------------------------- last_prices = MATH.get_p(_xp, D_unadjusted, A_gamma) for k in range(N_COINS - 1): last_prices[k] = unsafe_div(last_prices[k] * price_scale[k], 10**18) self.last_prices_packed = self._pack_prices(last_prices) # ---------- Update profit numbers without price adjustment first -------- xp: uint256[N_COINS] = empty(uint256[N_COINS]) xp[0] = unsafe_div(D_unadjusted, N_COINS) for k in range(N_COINS - 1): xp[k + 1] = D_unadjusted * 10**18 / (N_COINS * price_scale[k]) # ------------------------- Update xcp_profit ---------------------------- xcp_profit: uint256 = 10**18 virtual_price: uint256 = 10**18 if old_virtual_price > 0: xcp: uint256 = MATH.geometric_mean(xp) virtual_price = 10**18 * xcp / total_supply xcp_profit = unsafe_div( old_xcp_profit * virtual_price, old_virtual_price ) # <---------------- Safu to do unsafe_div as old_virtual_price > 0. # If A and gamma are not undergoing ramps (t < block.timestamp), # ensure new virtual_price is not less than old virtual_price, # else the pool suffers a loss. if self.future_A_gamma_time < block.timestamp: assert virtual_price > old_virtual_price, "Loss" self.xcp_profit = xcp_profit # ------------ Rebalance liquidity if there's enough profits to adjust it: if virtual_price * 2 - 10**18 > xcp_profit + 2 * rebalancing_params[0]: # allowed_extra_profit --------^ # ------------------- Get adjustment step ---------------------------- # Calculate the vector distance between price_scale and # price_oracle. norm: uint256 = 0 ratio: uint256 = 0 for k in range(N_COINS - 1): ratio = unsafe_div(price_oracle[k] * 10**18, price_scale[k]) # unsafe_div because we did safediv before ----^ if ratio > 10**18: ratio = unsafe_sub(ratio, 10**18) else: ratio = unsafe_sub(10**18, ratio) norm = unsafe_add(norm, ratio**2) norm = isqrt(norm) # <-------------------- isqrt is not in base 1e18. adjustment_step: uint256 = max( rebalancing_params[1], unsafe_div(norm, 5) ) # ^------------------------------------- adjustment_step. if norm > adjustment_step: # <---------- We only adjust prices if the # vector distance between price_oracle and price_scale is # large enough. This check ensures that no rebalancing # occurs if the distance is low i.e. the pool prices are # pegged to the oracle prices. # ------------------------------------- Calculate new price scale. p_new: uint256[N_COINS - 1] = empty(uint256[N_COINS - 1]) for k in range(N_COINS - 1): p_new[k] = unsafe_div( price_scale[k] * unsafe_sub(norm, adjustment_step) + adjustment_step * price_oracle[k], norm ) # <- norm is non-zero and gt adjustment_step; unsafe = safe # ---------------- Update stale xp (using price_scale) with p_new. xp = _xp for k in range(N_COINS - 1): xp[k + 1] = unsafe_div(_xp[k + 1] * p_new[k], price_scale[k]) # unsafe_div because we did safediv before ----^ # ------------------------------------------ Update D with new xp. D: uint256 = MATH.newton_D(A_gamma[0], A_gamma[1], xp, 0) for k in range(N_COINS): frac: uint256 = xp[k] * 10**18 / D # <----- Check validity of assert (frac > 10**16 - 1) and (frac < 10**20 + 1) # p_new. xp[0] = D / N_COINS for k in range(N_COINS - 1): xp[k + 1] = D * 10**18 / (N_COINS * p_new[k]) # <---- Convert # xp to real prices. # ---------- Calculate new virtual_price using new xp and D. Reuse # `old_virtual_price` (but it has new virtual_price). old_virtual_price = unsafe_div( 10**18 * MATH.geometric_mean(xp), total_supply ) # <----- unsafe_div because we did safediv before (if vp>1e18) # ---------------------------- Proceed if we've got enough profit. if ( old_virtual_price > 10**18 and 2 * old_virtual_price - 10**18 > xcp_profit ): packed_price_scale = self._pack_prices(p_new) self.D = D self.virtual_price = old_virtual_price self.price_scale_packed = packed_price_scale return packed_price_scale # --------- price_scale was not adjusted. Update the profit counter and D. self.D = D_unadjusted self.virtual_price = virtual_price return packed_price_scale @internal def _claim_admin_fees(): """ @notice Claims admin fees and sends it to fee_receiver set in the factory. """ A_gamma: uint256[2] = self._A_gamma() xcp_profit: uint256 = self.xcp_profit # <---------- Current pool profits. xcp_profit_a: uint256 = self.xcp_profit_a # <- Profits at previous claim. total_supply: uint256 = self.totalSupply # Do not claim admin fees if: # 1. insufficient profits accrued since last claim, and # 2. there are less than 10**18 (or 1 unit of) lp tokens, else it can lead # to manipulated virtual prices. if xcp_profit <= xcp_profit_a or total_supply < 10**18: return # Claim tokens belonging to the admin here. This is done by 'gulping' # pool tokens that have accrued as fees, but not accounted in pool's # `self.balances` yet: pool balances only account for incoming and # outgoing tokens excluding fees. Following 'gulps' fees: for i in range(N_COINS): if coins[i] == WETH20: self.balances[i] = self.balance else: self.balances[i] = ERC20(coins[i]).balanceOf(self) # If the pool has made no profits, `xcp_profit == xcp_profit_a` # and the pool gulps nothing in the previous step. vprice: uint256 = self.virtual_price # Admin fees are calculated as follows. # 1. Calculate accrued profit since last claim. `xcp_profit` # is the current profits. `xcp_profit_a` is the profits # at the previous claim. # 2. Take out admin's share, which is hardcoded at 5 * 10**9. # (50% => half of 100% => 10**10 / 2 => 5 * 10**9). # 3. Since half of the profits go to rebalancing the pool, we # are left with half; so divide by 2. fees: uint256 = unsafe_div( unsafe_sub(xcp_profit, xcp_profit_a) * ADMIN_FEE, 2 * 10**10 ) # ------------------------------ Claim admin fees by minting admin's share # of the pool in LP tokens. receiver: address = Factory(self.factory).fee_receiver() if receiver != empty(address) and fees > 0: frac: uint256 = vprice * 10**18 / (vprice - fees) - 10**18 claimed: uint256 = self.mint_relative(receiver, frac) xcp_profit -= fees * 2 self.xcp_profit = xcp_profit log ClaimAdminFee(receiver, claimed) # ------------------------------------------- Recalculate D b/c we gulped. D: uint256 = MATH.newton_D(A_gamma[0], A_gamma[1], self.xp(), 0) self.D = D # ------------------- Recalculate virtual_price following admin fee claim. # In this instance we do not check if current virtual price is greater # than old virtual price, since the claim process can result # in a small decrease in pool's value. self.virtual_price = 10**18 * self.get_xcp(D) / self.totalSupply self.xcp_profit_a = xcp_profit # <------------ Cache last claimed profit. @internal @view def xp() -> uint256[N_COINS]: result: uint256[N_COINS] = self.balances packed_prices: uint256 = self.price_scale_packed precisions: uint256[N_COINS] = self._unpack(self.packed_precisions) result[0] *= precisions[0] for i in range(1, N_COINS): p: uint256 = (packed_prices & PRICE_MASK) * precisions[i] result[i] = result[i] * p / PRECISION packed_prices = packed_prices >> PRICE_SIZE return result @view @internal def _A_gamma() -> uint256[2]: t1: uint256 = self.future_A_gamma_time A_gamma_1: uint256 = self.future_A_gamma gamma1: uint256 = A_gamma_1 & 2**128 - 1 A1: uint256 = A_gamma_1 >> 128 if block.timestamp < t1: # --------------- Handle ramping up and down of A -------------------- A_gamma_0: uint256 = self.initial_A_gamma t0: uint256 = self.initial_A_gamma_time t1 -= t0 t0 = block.timestamp - t0 t2: uint256 = t1 - t0 A1 = ((A_gamma_0 >> 128) * t2 + A1 * t0) / t1 gamma1 = ((A_gamma_0 & 2**128 - 1) * t2 + gamma1 * t0) / t1 return [A1, gamma1] @internal @view def _fee(xp: uint256[N_COINS]) -> uint256: fee_params: uint256[3] = self._unpack(self.packed_fee_params) f: uint256 = MATH.reduction_coefficient(xp, fee_params[2]) return unsafe_div( fee_params[0] * f + fee_params[1] * (10**18 - f), 10**18 ) @internal @view def get_xcp(D: uint256) -> uint256: x: uint256[N_COINS] = empty(uint256[N_COINS]) x[0] = D / N_COINS packed_prices: uint256 = self.price_scale_packed # <-- No precisions here # because we don't switch to "real" units. for i in range(1, N_COINS): x[i] = D * 10**18 / (N_COINS * (packed_prices & PRICE_MASK)) packed_prices = packed_prices >> PRICE_SIZE return MATH.geometric_mean(x) @view @internal def _calc_token_fee(amounts: uint256[N_COINS], xp: uint256[N_COINS]) -> uint256: # fee = sum(amounts_i - avg(amounts)) * fee' / sum(amounts) fee: uint256 = unsafe_div( unsafe_mul(self._fee(xp), N_COINS), unsafe_mul(4, unsafe_sub(N_COINS, 1)) ) S: uint256 = 0 for _x in amounts: S += _x avg: uint256 = unsafe_div(S, N_COINS) Sdiff: uint256 = 0 for _x in amounts: if _x > avg: Sdiff += unsafe_sub(_x, avg) else: Sdiff += unsafe_sub(avg, _x) return fee * Sdiff / S + NOISE_FEE @internal @view def _calc_withdraw_one_coin( A_gamma: uint256[2], token_amount: uint256, i: uint256, update_D: bool, ) -> (uint256, uint256, uint256[N_COINS], uint256): token_supply: uint256 = self.totalSupply assert token_amount <= token_supply # dev: token amount more than supply assert i < N_COINS # dev: coin out of range xx: uint256[N_COINS] = self.balances precisions: uint256[N_COINS] = self._unpack(self.packed_precisions) xp: uint256[N_COINS] = precisions D0: uint256 = 0 # -------------------------- Calculate D0 and xp ------------------------- price_scale_i: uint256 = PRECISION * precisions[0] packed_prices: uint256 = self.price_scale_packed xp[0] *= xx[0] for k in range(1, N_COINS): p: uint256 = (packed_prices & PRICE_MASK) if i == k: price_scale_i = p * xp[i] xp[k] = unsafe_div(xp[k] * xx[k] * p, PRECISION) packed_prices = packed_prices >> PRICE_SIZE if update_D: # <-------------- D is updated if pool is undergoing a ramp. D0 = MATH.newton_D(A_gamma[0], A_gamma[1], xp, 0) else: D0 = self.D D: uint256 = D0 # -------------------------------- Fee Calc ------------------------------ # Charge fees on D. Roughly calculate xp[i] after withdrawal and use that # to calculate fee. Precision is not paramount here: we just want a # behavior where the higher the imbalance caused the more fee the AMM # charges. # xp is adjusted assuming xp[0] ~= xp[1] ~= x[2], which is usually not the # case. We charge self._fee(xp), where xp is an imprecise adjustment post # withdrawal in one coin. If the withdraw is too large: charge max fee by # default. This is because the fee calculation will otherwise underflow. xp_imprecise: uint256[N_COINS] = xp xp_correction: uint256 = xp[i] * N_COINS * token_amount / token_supply fee: uint256 = self._unpack(self.packed_fee_params)[1] # <- self.out_fee. if xp_correction < xp_imprecise[i]: xp_imprecise[i] -= xp_correction fee = self._fee(xp_imprecise) dD: uint256 = unsafe_div(token_amount * D, token_supply) D_fee: uint256 = fee * dD / (2 * 10**10) + 1 # <------- Actual fee on D. # --------- Calculate `approx_fee` (assuming balanced state) in ith token. # -------------------------------- We only need this for fee in the event. approx_fee: uint256 = N_COINS * D_fee * xx[i] / D # ------------------------------------------------------------------------ D -= (dD - D_fee) # <----------------------------------- Charge fee on D. # --------------------------------- Calculate `y_out`` with `(D - D_fee)`. y: uint256 = MATH.get_y(A_gamma[0], A_gamma[1], xp, D, i)[0] dy: uint256 = (xp[i] - y) * PRECISION / price_scale_i xp[i] = y return dy, D, xp, approx_fee # ------------------------ ERC20 functions ----------------------------------- @internal def _approve(_owner: address, _spender: address, _value: uint256): self.allowance[_owner][_spender] = _value log Approval(_owner, _spender, _value) @internal def _transfer(_from: address, _to: address, _value: uint256): assert _to not in [self, empty(address)] self.balanceOf[_from] -= _value self.balanceOf[_to] += _value log Transfer(_from, _to, _value) @view @internal def _domain_separator() -> bytes32: if chain.id != CACHED_CHAIN_ID: return keccak256( _abi_encode( EIP712_TYPEHASH, NAME_HASH, VERSION_HASH, chain.id, self, salt, ) ) return CACHED_DOMAIN_SEPARATOR @external def transferFrom(_from: address, _to: address, _value: uint256) -> bool: """ @dev Transfer tokens from one address to another. @param _from address The address which you want to send tokens from @param _to address The address which you want to transfer to @param _value uint256 the amount of tokens to be transferred @return bool True on successul transfer. Reverts otherwise. """ _allowance: uint256 = self.allowance[_from][msg.sender] if _allowance != max_value(uint256): self._approve(_from, msg.sender, _allowance - _value) self._transfer(_from, _to, _value) return True @external def transfer(_to: address, _value: uint256) -> bool: """ @dev Transfer token for a specified address @param _to The address to transfer to. @param _value The amount to be transferred. @return bool True on successful transfer. Reverts otherwise. """ self._transfer(msg.sender, _to, _value) return True @external def approve(_spender: address, _value: uint256) -> bool: """ @notice Allow `_spender` to transfer up to `_value` amount of tokens from the caller's account. @dev Non-zero to non-zero approvals are allowed, but should be used cautiously. The methods increaseAllowance + decreaseAllowance are available to prevent any front-running that may occur. @param _spender The account permitted to spend up to `_value` amount of caller's funds. @param _value The amount of tokens `_spender` is allowed to spend. @return bool Success """ self._approve(msg.sender, _spender, _value) return True @external def increaseAllowance(_spender: address, _add_value: uint256) -> bool: """ @notice Increase the allowance granted to `_spender`. @dev This function will never overflow, and instead will bound allowance to max_value(uint256). This has the potential to grant an infinite approval. @param _spender The account to increase the allowance of. @param _add_value The amount to increase the allowance by. @return bool Success """ cached_allowance: uint256 = self.allowance[msg.sender][_spender] allowance: uint256 = unsafe_add(cached_allowance, _add_value) if allowance < cached_allowance: # <-------------- Check for an overflow. allowance = max_value(uint256) if allowance != cached_allowance: self._approve(msg.sender, _spender, allowance) return True @external def decreaseAllowance(_spender: address, _sub_value: uint256) -> bool: """ @notice Decrease the allowance granted to `_spender`. @dev This function will never underflow, and instead will bound allowance to 0. @param _spender The account to decrease the allowance of. @param _sub_value The amount to decrease the allowance by. @return bool Success. """ cached_allowance: uint256 = self.allowance[msg.sender][_spender] allowance: uint256 = unsafe_sub(cached_allowance, _sub_value) if cached_allowance < allowance: # <------------- Check for an underflow. allowance = 0 if allowance != cached_allowance: self._approve(msg.sender, _spender, allowance) return True @external def permit( _owner: address, _spender: address, _value: uint256, _deadline: uint256, _v: uint8, _r: bytes32, _s: bytes32, ) -> bool: """ @notice Permit `_spender` to spend up to `_value` amount of `_owner`'s tokens via a signature. @dev In the event of a chain fork, replay attacks are prevented as domain separator is recalculated. However, this is only if the resulting chains update their chainId. @param _owner The account which generated the signature and is granting an allowance. @param _spender The account which will be granted an allowance. @param _value The approval amount. @param _deadline The deadline by which the signature must be submitted. @param _v The last byte of the ECDSA signature. @param _r The first 32 bytes of the ECDSA signature. @param _s The second 32 bytes of the ECDSA signature. @return bool Success. """ assert _owner != empty(address) # dev: invalid owner assert block.timestamp <= _deadline # dev: permit expired nonce: uint256 = self.nonces[_owner] digest: bytes32 = keccak256( concat( b"\x19\x01", self._domain_separator(), keccak256( _abi_encode( EIP2612_TYPEHASH, _owner, _spender, _value, nonce, _deadline ) ), ) ) assert ecrecover(digest, _v, _r, _s) == _owner # dev: invalid signature self.nonces[_owner] = unsafe_add(nonce, 1) # <-- Unsafe add is safe here. self._approve(_owner, _spender, _value) return True @internal def mint(_to: address, _value: uint256) -> bool: """ @dev Mint an amount of the token and assigns it to an account. This encapsulates the modification of balances such that the proper events are emitted. @param _to The account that will receive the created tokens. @param _value The amount that will be created. @return bool Success. """ self.totalSupply += _value self.balanceOf[_to] += _value log Transfer(empty(address), _to, _value) return True @internal def mint_relative(_to: address, frac: uint256) -> uint256: """ @dev Increases supply by factor of (1 + frac/1e18) and mints it for _to @param _to The account that will receive the created tokens. @param frac The fraction of the current supply to mint. @return uint256 Amount of tokens minted. """ supply: uint256 = self.totalSupply d_supply: uint256 = supply * frac / 10**18 if d_supply > 0: self.totalSupply = supply + d_supply self.balanceOf[_to] += d_supply log Transfer(empty(address), _to, d_supply) return d_supply @internal def burnFrom(_to: address, _value: uint256) -> bool: """ @dev Burn an amount of the token from a given account. @param _to The account whose tokens will be burned. @param _value The amount that will be burned. @return bool Success. """ self.totalSupply -= _value self.balanceOf[_to] -= _value log Transfer(_to, empty(address), _value) return True # ------------------------- AMM View Functions ------------------------------- @external @view def fee_receiver() -> address: """ @notice Returns the address of the admin fee receiver. @return address Fee receiver. """ return Factory(self.factory).fee_receiver() @external @view def calc_token_amount(amounts: uint256[N_COINS], deposit: bool) -> uint256: """ @notice Calculate LP tokens minted or to be burned for depositing or removing `amounts` of coins @dev Includes fee. @param amounts Amounts of tokens being deposited or withdrawn @param deposit True if it is a deposit action, False if withdrawn. @return uint256 Amount of LP tokens deposited or withdrawn. """ view_contract: address = Factory(self.factory).views_implementation() return Views(view_contract).calc_token_amount(amounts, deposit, self) @external @view def get_dy(i: uint256, j: uint256, dx: uint256) -> uint256: """ @notice Get amount of coin[j] tokens received for swapping in dx amount of coin[i] @dev Includes fee. @param i index of input token. Check pool.coins(i) to get coin address at ith index @param j index of output token @param dx amount of input coin[i] tokens @return uint256 Exact amount of output j tokens for dx amount of i input tokens. """ view_contract: address = Factory(self.factory).views_implementation() return Views(view_contract).get_dy(i, j, dx, self) @external @view def get_dx(i: uint256, j: uint256, dy: uint256) -> uint256: """ @notice Get amount of coin[i] tokens to input for swapping out dy amount of coin[j] @dev This is an approximate method, and returns estimates close to the input amount. Expensive to call on-chain. @param i index of input token. Check pool.coins(i) to get coin address at ith index @param j index of output token @param dy amount of input coin[j] tokens received @return uint256 Approximate amount of input i tokens to get dy amount of j tokens. """ view_contract: address = Factory(self.factory).views_implementation() return Views(view_contract).get_dx(i, j, dy, self) @external @view @nonreentrant("lock") def lp_price() -> uint256: """ @notice Calculates the current price of the LP token w.r.t coin at the 0th index @return uint256 LP price. """ price_oracle: uint256[N_COINS-1] = self._unpack_prices( self.price_oracle_packed ) return ( 3 * self.virtual_price * MATH.cbrt(price_oracle[0] * price_oracle[1]) ) / 10**24 @external @view @nonreentrant("lock") def get_virtual_price() -> uint256: """ @notice Calculates the current virtual price of the pool LP token. @dev Not to be confused with `self.virtual_price` which is a cached virtual price. @return uint256 Virtual Price. """ return 10**18 * self.get_xcp(self.D) / self.totalSupply @external @view @nonreentrant("lock") def price_oracle(k: uint256) -> uint256: """ @notice Returns the oracle price of the coin at index `k` w.r.t the coin at index 0. @dev The oracle is an exponential moving average, with a periodicity determined by `self.ma_time`. The aggregated prices are cached state prices (dy/dx) calculated AFTER the latest trade. @param k The index of the coin. @return uint256 Price oracle value of kth coin. """ price_oracle: uint256 = self._unpack_prices(self.price_oracle_packed)[k] price_scale: uint256 = self._unpack_prices(self.price_scale_packed)[k] last_prices_timestamp: uint256 = self.last_prices_timestamp if last_prices_timestamp < block.timestamp: # <------------ Update moving # average if needed. last_prices: uint256 = self._unpack_prices(self.last_prices_packed)[k] ma_time: uint256 = self._unpack(self.packed_rebalancing_params)[2] alpha: uint256 = MATH.wad_exp( -convert( (block.timestamp - last_prices_timestamp) * 10**18 / ma_time, int256, ) ) # ---- We cap state price that goes into the EMA with 2 x price_scale. return ( min(last_prices, 2 * price_scale) * (10**18 - alpha) + price_oracle * alpha ) / 10**18 return price_oracle @external @view def last_prices(k: uint256) -> uint256: """ @notice Returns last price of the coin at index `k` w.r.t the coin at index 0. @dev last_prices returns the quote by the AMM for an infinitesimally small swap after the last trade. It is not equivalent to the last traded price, and is computed by taking the partial differential of `x` w.r.t `y`. The derivative is calculated in `get_p` and then multiplied with price_scale to give last_prices. @param k The index of the coin. @return uint256 Last logged price of coin. """ return self._unpack_prices(self.last_prices_packed)[k] @external @view def price_scale(k: uint256) -> uint256: """ @notice Returns the price scale of the coin at index `k` w.r.t the coin at index 0. @dev Price scale determines the price band around which liquidity is concentrated. @param k The index of the coin. @return uint256 Price scale of coin. """ return self._unpack_prices(self.price_scale_packed)[k] @external @view def fee() -> uint256: """ @notice Returns the fee charged by the pool at current state. @dev Not to be confused with the fee charged at liquidity action, since there the fee is calculated on `xp` AFTER liquidity is added or removed. @return uint256 fee bps. """ return self._fee(self.xp()) @view @external def calc_withdraw_one_coin(token_amount: uint256, i: uint256) -> uint256: """ @notice Calculates output tokens with fee @param token_amount LP Token amount to burn @param i token in which liquidity is withdrawn @return uint256 Amount of ith tokens received for burning token_amount LP tokens. """ return self._calc_withdraw_one_coin( self._A_gamma(), token_amount, i, (self.future_A_gamma_time > block.timestamp) )[0] @external @view def calc_token_fee( amounts: uint256[N_COINS], xp: uint256[N_COINS] ) -> uint256: """ @notice Returns the fee charged on the given amounts for add_liquidity. @param amounts The amounts of coins being added to the pool. @param xp The current balances of the pool multiplied by coin precisions. @return uint256 Fee charged. """ return self._calc_token_fee(amounts, xp) @view @external def A() -> uint256: """ @notice Returns the current pool amplification parameter. @return uint256 A param. """ return self._A_gamma()[0] @view @external def gamma() -> uint256: """ @notice Returns the current pool gamma parameter. @return uint256 gamma param. """ return self._A_gamma()[1] @view @external def mid_fee() -> uint256: """ @notice Returns the current mid fee @return uint256 mid_fee value. """ return self._unpack(self.packed_fee_params)[0] @view @external def out_fee() -> uint256: """ @notice Returns the current out fee @return uint256 out_fee value. """ return self._unpack(self.packed_fee_params)[1] @view @external def fee_gamma() -> uint256: """ @notice Returns the current fee gamma @return uint256 fee_gamma value. """ return self._unpack(self.packed_fee_params)[2] @view @external def allowed_extra_profit() -> uint256: """ @notice Returns the current allowed extra profit @return uint256 allowed_extra_profit value. """ return self._unpack(self.packed_rebalancing_params)[0] @view @external def adjustment_step() -> uint256: """ @notice Returns the current adjustment step @return uint256 adjustment_step value. """ return self._unpack(self.packed_rebalancing_params)[1] @view @external def ma_time() -> uint256: """ @notice Returns the current moving average time in seconds @dev To get time in seconds, the parameter is multipled by ln(2) One can expect off-by-one errors here. @return uint256 ma_time value. """ return self._unpack(self.packed_rebalancing_params)[2] * 694 / 1000 @view @external def precisions() -> uint256[N_COINS]: # <-------------- For by view contract. """ @notice Returns the precisions of each coin in the pool. @return uint256[3] precisions of coins. """ return self._unpack(self.packed_precisions) @external @view def fee_calc(xp: uint256[N_COINS]) -> uint256: # <----- For by view contract. """ @notice Returns the fee charged by the pool at current state. @param xp The current balances of the pool multiplied by coin precisions. @return uint256 Fee value. """ return self._fee(xp) @view @external def DOMAIN_SEPARATOR() -> bytes32: """ @notice EIP712 domain separator. @return bytes32 Domain Separator set for the current chain. """ return self._domain_separator() # ------------------------- AMM Admin Functions ------------------------------ @external def ramp_A_gamma( future_A: uint256, future_gamma: uint256, future_time: uint256 ): """ @notice Initialise Ramping A and gamma parameter values linearly. @dev Only accessible by factory admin, and only @param future_A The future A value. @param future_gamma The future gamma value. @param future_time The timestamp at which the ramping will end. """ assert msg.sender == Factory(self.factory).admin() # dev: only owner assert block.timestamp > self.initial_A_gamma_time + (MIN_RAMP_TIME - 1) # dev: ramp undergoing assert future_time > block.timestamp + MIN_RAMP_TIME - 1 # dev: insufficient time A_gamma: uint256[2] = self._A_gamma() initial_A_gamma: uint256 = A_gamma[0] << 128 initial_A_gamma = initial_A_gamma | A_gamma[1] assert future_A > MIN_A - 1 assert future_A < MAX_A + 1 assert future_gamma > MIN_GAMMA - 1 assert future_gamma < MAX_GAMMA + 1 ratio: uint256 = 10**18 * future_A / A_gamma[0] assert ratio < 10**18 * MAX_A_CHANGE + 1 assert ratio > 10**18 / MAX_A_CHANGE - 1 ratio = 10**18 * future_gamma / A_gamma[1] assert ratio < 10**18 * MAX_A_CHANGE + 1 assert ratio > 10**18 / MAX_A_CHANGE - 1 self.initial_A_gamma = initial_A_gamma self.initial_A_gamma_time = block.timestamp future_A_gamma: uint256 = future_A << 128 future_A_gamma = future_A_gamma | future_gamma self.future_A_gamma_time = future_time self.future_A_gamma = future_A_gamma log RampAgamma( A_gamma[0], future_A, A_gamma[1], future_gamma, block.timestamp, future_time, ) @external def stop_ramp_A_gamma(): """ @notice Stop Ramping A and gamma parameters immediately. @dev Only accessible by factory admin. """ assert msg.sender == Factory(self.factory).admin() # dev: only owner A_gamma: uint256[2] = self._A_gamma() current_A_gamma: uint256 = A_gamma[0] << 128 current_A_gamma = current_A_gamma | A_gamma[1] self.initial_A_gamma = current_A_gamma self.future_A_gamma = current_A_gamma self.initial_A_gamma_time = block.timestamp self.future_A_gamma_time = block.timestamp # ------ Now (block.timestamp < t1) is always False, so we return saved A. log StopRampA(A_gamma[0], A_gamma[1], block.timestamp) @external def commit_new_parameters( _new_mid_fee: uint256, _new_out_fee: uint256, _new_fee_gamma: uint256, _new_allowed_extra_profit: uint256, _new_adjustment_step: uint256, _new_ma_time: uint256, ): """ @notice Commit new parameters. @dev Only accessible by factory admin. @param _new_mid_fee The new mid fee. @param _new_out_fee The new out fee. @param _new_fee_gamma The new fee gamma. @param _new_allowed_extra_profit The new allowed extra profit. @param _new_adjustment_step The new adjustment step. @param _new_ma_time The new ma time. ma_time is time_in_seconds/ln(2). """ assert msg.sender == Factory(self.factory).admin() # dev: only owner assert self.admin_actions_deadline == 0 # dev: active action _deadline: uint256 = block.timestamp + ADMIN_ACTIONS_DELAY self.admin_actions_deadline = _deadline # ----------------------------- Set fee params --------------------------- new_mid_fee: uint256 = _new_mid_fee new_out_fee: uint256 = _new_out_fee new_fee_gamma: uint256 = _new_fee_gamma current_fee_params: uint256[3] = self._unpack(self.packed_fee_params) if new_out_fee < MAX_FEE + 1: assert new_out_fee > MIN_FEE - 1 # dev: fee is out of range else: new_out_fee = current_fee_params[1] if new_mid_fee > MAX_FEE: new_mid_fee = current_fee_params[0] assert new_mid_fee <= new_out_fee # dev: mid-fee is too high if new_fee_gamma < 10**18: assert new_fee_gamma > 0 # dev: fee_gamma out of range [1 .. 10**18] else: new_fee_gamma = current_fee_params[2] self.future_packed_fee_params = self._pack( [new_mid_fee, new_out_fee, new_fee_gamma] ) # ----------------- Set liquidity rebalancing parameters ----------------- new_allowed_extra_profit: uint256 = _new_allowed_extra_profit new_adjustment_step: uint256 = _new_adjustment_step new_ma_time: uint256 = _new_ma_time current_rebalancing_params: uint256[3] = self._unpack(self.packed_rebalancing_params) if new_allowed_extra_profit > 10**18: new_allowed_extra_profit = current_rebalancing_params[0] if new_adjustment_step > 10**18: new_adjustment_step = current_rebalancing_params[1] if new_ma_time < 872542: # <----- Calculated as: 7 * 24 * 60 * 60 / ln(2) assert new_ma_time > 86 # dev: MA time should be longer than 60/ln(2) else: new_ma_time = current_rebalancing_params[2] self.future_packed_rebalancing_params = self._pack( [new_allowed_extra_profit, new_adjustment_step, new_ma_time] ) # ---------------------------------- LOG --------------------------------- log CommitNewParameters( _deadline, new_mid_fee, new_out_fee, new_fee_gamma, new_allowed_extra_profit, new_adjustment_step, new_ma_time, ) @external @nonreentrant("lock") def apply_new_parameters(): """ @notice Apply committed parameters. @dev Only callable after admin_actions_deadline. """ assert block.timestamp >= self.admin_actions_deadline # dev: insufficient time assert self.admin_actions_deadline != 0 # dev: no active action self.admin_actions_deadline = 0 packed_fee_params: uint256 = self.future_packed_fee_params self.packed_fee_params = packed_fee_params packed_rebalancing_params: uint256 = self.future_packed_rebalancing_params self.packed_rebalancing_params = packed_rebalancing_params rebalancing_params: uint256[3] = self._unpack(packed_rebalancing_params) fee_params: uint256[3] = self._unpack(packed_fee_params) log NewParameters( fee_params[0], fee_params[1], fee_params[2], rebalancing_params[0], rebalancing_params[1], rebalancing_params[2], ) @external def revert_new_parameters(): """ @notice Revert committed parameters @dev Only accessible by factory admin. Setting admin_actions_deadline to 0 ensures a revert in apply_new_parameters. """ assert msg.sender == Factory(self.factory).admin() # dev: only owner self.admin_actions_deadline = 0
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"name":"Transfer","inputs":[{"name":"sender","type":"address","indexed":true},{"name":"receiver","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Approval","inputs":[{"name":"owner","type":"address","indexed":true},{"name":"spender","type":"address","indexed":true},{"name":"value","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchange","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"sold_id","type":"uint256","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"uint256","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false},{"name":"fee","type":"uint256","indexed":false},{"name":"packed_price_scale","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"fee","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false},{"name":"packed_price_scale","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amount","type":"uint256","indexed":false},{"name":"coin_index","type":"uint256","indexed":false},{"name":"coin_amount","type":"uint256","indexed":false},{"name":"approx_fee","type":"uint256","indexed":false},{"name":"packed_price_scale","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewParameters","inputs":[{"name":"deadline","type":"uint256","indexed":true},{"name":"mid_fee","type":"uint256","indexed":false},{"name":"out_fee","type":"uint256","indexed":false},{"name":"fee_gamma","type":"uint256","indexed":false},{"name":"allowed_extra_profit","type":"uint256","indexed":false},{"name":"adjustment_step","type":"uint256","indexed":false},{"name":"ma_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewParameters","inputs":[{"name":"mid_fee","type":"uint256","indexed":false},{"name":"out_fee","type":"uint256","indexed":false},{"name":"fee_gamma","type":"uint256","indexed":false},{"name":"allowed_extra_profit","type":"uint256","indexed":false},{"name":"adjustment_step","type":"uint256","indexed":false},{"name":"ma_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampAgamma","inputs":[{"name":"initial_A","type":"uint256","indexed":false},{"name":"future_A","type":"uint256","indexed":false},{"name":"initial_gamma","type":"uint256","indexed":false},{"name":"future_gamma","type":"uint256","indexed":false},{"name":"initial_time","type":"uint256","indexed":false},{"name":"future_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"name":"current_A","type":"uint256","indexed":false},{"name":"current_gamma","type":"uint256","indexed":false},{"name":"time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"ClaimAdminFee","inputs":[{"name":"admin","type":"address","indexed":true},{"name":"tokens","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_coins","type":"address[3]"},{"name":"_math","type":"address"},{"name":"_weth","type":"address"},{"name":"_salt","type":"bytes32"},{"name":"packed_precisions","type":"uint256"},{"name":"packed_A_gamma","type":"uint256"},{"name":"packed_fee_params","type":"uint256"},{"name":"packed_rebalancing_params","type":"uint256"},{"name":"packed_prices","type":"uint256"}],"outputs":[]},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"function","name":"exchange","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"exchange","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"},{"name":"use_eth","type":"bool"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"exchange","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"},{"name":"use_eth","type":"bool"},{"name":"receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"exchange_underlying","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"exchange_underlying","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"},{"name":"receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange_extended","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"},{"name":"use_eth","type":"bool"},{"name":"sender","type":"address"},{"name":"receiver","type":"address"},{"name":"cb","type":"bytes32"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"add_liquidity","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"min_mint_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"add_liquidity","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"min_mint_amount","type":"uint256"},{"name":"use_eth","type":"bool"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"payable","type":"function","name":"add_liquidity","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"min_mint_amount","type":"uint256"},{"name":"use_eth","type":"bool"},{"name":"receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_amount","type":"uint256"},{"name":"min_amounts","type":"uint256[3]"}],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_amount","type":"uint256"},{"name":"min_amounts","type":"uint256[3]"},{"name":"use_eth","type":"bool"}],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_amount","type":"uint256"},{"name":"min_amounts","type":"uint256[3]"},{"name":"use_eth","type":"bool"},{"name":"receiver","type":"address"}],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_amount","type":"uint256"},{"name":"min_amounts","type":"uint256[3]"},{"name":"use_eth","type":"bool"},{"name":"receiver","type":"address"},{"name":"claim_admin_fees","type":"bool"}],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"token_amount","type":"uint256"},{"name":"i","type":"uint256"},{"name":"min_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"token_amount","type":"uint256"},{"name":"i","type":"uint256"},{"name":"min_amount","type":"uint256"},{"name":"use_eth","type":"bool"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"token_amount","type":"uint256"},{"name":"i","type":"uint256"},{"name":"min_amount","type":"uint256"},{"name":"use_eth","type":"bool"},{"name":"receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"claim_admin_fees","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"transferFrom","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"transfer","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"approve","inputs":[{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"increaseAllowance","inputs":[{"name":"_spender","type":"address"},{"name":"_add_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"decreaseAllowance","inputs":[{"name":"_spender","type":"address"},{"name":"_sub_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"permit","inputs":[{"name":"_owner","type":"address"},{"name":"_spender","type":"address"},{"name":"_value","type":"uint256"},{"name":"_deadline","type":"uint256"},{"name":"_v","type":"uint8"},{"name":"_r","type":"bytes32"},{"name":"_s","type":"bytes32"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"view","type":"function","name":"fee_receiver","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"calc_token_amount","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"deposit","type":"bool"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_dy","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_dx","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"lp_price","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"price_oracle","inputs":[{"name":"k","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"last_prices","inputs":[{"name":"k","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"price_scale","inputs":[{"name":"k","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_withdraw_one_coin","inputs":[{"name":"token_amount","type":"uint256"},{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_token_fee","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"xp","type":"uint256[3]"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"mid_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"out_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"fee_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"allowed_extra_profit","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"adjustment_step","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"precisions","inputs":[],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"view","type":"function","name":"fee_calc","inputs":[{"name":"xp","type":"uint256[3]"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"DOMAIN_SEPARATOR","inputs":[],"outputs":[{"name":"","type":"bytes32"}]},{"stateMutability":"nonpayable","type":"function","name":"ramp_A_gamma","inputs":[{"name":"future_A","type":"uint256"},{"name":"future_gamma","type":"uint256"},{"name":"future_time","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"stop_ramp_A_gamma","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"commit_new_parameters","inputs":[{"name":"_new_mid_fee","type":"uint256"},{"name":"_new_out_fee","type":"uint256"},{"name":"_new_fee_gamma","type":"uint256"},{"name":"_new_allowed_extra_profit","type":"uint256"},{"name":"_new_adjustment_step","type":"uint256"},{"name":"_new_ma_time","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"apply_new_parameters","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"revert_new_parameters","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"WETH20","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"MATH","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"coins","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"factory","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"last_prices_timestamp","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"initial_A_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"initial_A_gamma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"future_A_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"future_A_gamma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"balances","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"D","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"xcp_profit","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"xcp_profit_a","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"packed_rebalancing_params","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"packed_fee_params","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ADMIN_FEE","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"admin_actions_deadline","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"name","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"symbol","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"decimals","inputs":[],"outputs":[{"name":"","type":"uint8"}]},{"stateMutability":"view","type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"string"}]},{"stateMutability":"view","type":"function","name":"balanceOf","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"allowance","inputs":[{"name":"arg0","type":"address"},{"name":"arg1","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"nonces","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"salt","inputs":[],"outputs":[{"name":"","type":"bytes32"}]}]
Contract Creation Code
6158fb3d81600a3d39f3fe710061573c5150346103405760206158f860003960005160406020826158f801600039600051116103405760206020826158f8016000396000510180826158f8016040395050602061591860003960005160206020826158f801600039600051116103405760206020826158f8016000396000510180826158f80160a039505060206159386000396000518060a01c6103405760e05260206159586000396000518060a01c610340576101005260206159786000396000518060a01c610340576101205260206159986000396000518060a01c610340576101405260206159b86000396000518060a01c61034057610160526101605161559c52610140516155bc5233600255602060405101600081601f0160051c6003811161034057801561014157905b8060051b604001518160051b60a00161559c0152600101818118610122575b505050602060a05101600081601f0160051c6002811161034057801561018357905b8060051b60a001518160051b6101000161559c0152600101818118610163575b50505060e0516155dc52610100516155fc526101205161561c5260206159f86000396000516001556020615a186000396000516007556020615a186000396000516009556020615a586000396000516012556020615a386000396000516014556020615a786000396000516003556020615a786000396000516004556020615a7860003960005160055542600655670de0b6b3a7640000601055602061563c5101600081601f0160051c6003811161034057801561025d57905b8060051b60a00161559c01518160051b610180015260010181811861023d575b5050506101808051602082012090506156dc5260206159d860003960005161571c52466156fc527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726101a0526156dc516101c0527fd61c1033330c368dfc371f5b1e7133f4794e104642e5a3c87aba7a6a3441c8ff6101e0524661020052306102205261571c516102405260c06101805261018080516020820120905061573c523060007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000610180526020610180a361559c6103456100003961575c610000f35b600080fd60003560e01c60026049820660011b61550a01601e39600051565b6317e26cd18118610038573461550557602061559c60403960206040f35b63226840fb8118612ac657346155055760025463f851a440604052602060406004605c845afa61006d573d600060003e3d6000fd5b60203d10615505576040518060a01c615505576080526080905051331861550557600060165500612ac6565b63ed6c154681186100b757346155055760206155bc60403960206040f35b6309c3da6a8118612ac65734615505576012546040526100d76060612fea565b6060604081019050516102b68102816102b68204186155055790506103e88104905060c052602060c0f3612ac6565b63c66106578118612ac657602436103417615505576020600435600281116155055760051b60400161559c0160403960206040f3612ac6565b63c45a01558118612ac657346155055760025460405260206040f3612ac6565b636112c747811861017b57346155055760065460405260206040f35b6306fdde0381186101d4573461550557602080604052806040016020602061563c600039600051018061563c8339508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b631da3d2388118612ac65760c436103417615505576084358060011c615505576104005260a4358060a01c6155055761042052600161044052611a2956612ac6565b63204fe3d58118612ac657346155055760075460405260206040f3612ac6565b63e89876ff8118612ac657346155055760085460405260206040f3612ac6565b63f30cfad5811861027257346155055760095460405260206040f35b630f529ba28118612ac6573461550557600e5460405260206040f3612ac6565b63f9ed959781186102ae573461550557600a5460405260206040f35b630b7b594b81186102ca57346155055760105460405260206040f35b63ecb586a58118612ac657608436103417615505576000610400523361042052600161044052611a2956612ac6565b634903b0d1811861032657602436103417615505576004356002811161550557600b015460405260206040f35b63f446c1d08118612ac65734615505576020610343610120612e91565b610120f3612ac6565b637ba1a74d8118612ac6573461550557600f5460405260206040f3612ac6565b630c46b72a811861038857346155055760115460405260206040f35b635cecb5f78118612ac65760c3361115615505576084358060011c615505576105e05260a4358060a01c61550557610600525b6000546002146155055760026000556103d5610660612e91565b61066080516106205260208101516106405250600b5461066052600c5461068052600d546106a052610120366106c037600435602435808201828110615505579050905060443580820182811061550557905090501561550557600154604052610440610840612fea565b61084080516107e0526020810151610800526040810151610820525060035461084052610840516040526104756108a0613026565b6108a080516108605260208101516108805250610660516108a052610680516108c0526106a0516108e05260006003905b806109005261090051600281116155055760051b610660015161090051600281116155055760051b600401358082018281106155055790509050610920526109205161090051600281116155055760051b610660015261092051610900516002811161550557600b01556001018181186104a6575050610660516107205261068051610740526106a05161076052610660516107e0518082028115838383041417156155055790509050610660526108a0516107e05180820281158383830414171561550557905090506108a052600160028101905b8061090052670de0b6b3a764000061090051600281116155055760051b61066001516109005160018103818111615505579050600181116155055760051b6108600151808202811583838304141715615505579050905061090051600281116155055760051b6107e0015180820281158383830414171561550557905090500461090051600281116155055760051b6106600152670de0b6b3a764000061090051600281116155055760051b6108a0015161090051600281116155055760051b6107e001516109005160018103818111615505579050600181116155055760051b61086001510280820281158383830414171561550557905090500461090051600281116155055760051b6108a0015260010181811861057c57505060006003905b806109005261090051600281116155055760051b60040135156107de57602061559c600039600051602061090051600281116155055760051b60400161559c016000396000511861074857602061090051600281116155055760051b60400161559c0160403961090051600281116155055760051b6004013560605260006080523460a05260403660c03733610100526000610120526105e05161014052610793612b1f56610793565b602061090051600281116155055760051b60400161559c0160403961090051600281116155055760051b60040135606052608036608037336101005260403661012037610793612b1f565b61090051600281116155055760051b610660015161090051600281116155055760051b6108a00151808203828111615505579050905061090051600281116155055760051b6106c001525b60010181811861069e57505042600a54116107ff57600e546107c052610870565b60206155bc600039600051637b12e00961090052610620516109205261064051610940526108a051610960526108c051610980526108e0516109a05260006109c052602061090060c461091c845afa61085d573d600060003e3d6000fd5b60203d10615505576109009050516107c0525b60206155bc600039600051637b12e00961092052610620516109405261064051610960526106605161098052610680516109a0526106a0516109c05260006109e052602061092060c461093c845afa6108ce573d600060003e3d6000fd5b60203d106155055761092090505161090052601954610920526107c0511561093857610920516109005180820281158383830414171561550557905090506107c0518015615505578082049050905061092051808203828111615505579050905061078052610953565b6109005160405261094a6109406145d2565b61094051610780525b6107805115615505576107c05115610a75576106c0516101e0526106e051610200526107005161022052610660516102405261068051610260526106a051610280526109a06109406146c4565b610940516107805180820281158383830414171561550557905090506402540be40081049050600181018181106155055790506107a052610780516107a05180820382811161550557905090506107805261092051610780518082018281106155055790509050610920526106005160405261078051606052610a246109406147f3565b610940506106205160e0526106405161010052610660516101205261068051610140526106a05161016052610900516101805260006101a052610a686109406131f4565b6109405161084052610abe565b61090051600e55670de0b6b3a7640000601155670de0b6b3a7640000600f55670de0b6b3a76400006010556106005160405261078051606052610ab96109406147f3565b610940505b606435610780511015610b31576008610940527f536c6970706167650000000000000000000000000000000000000000000000006109605261094050610940518061096001601f826000031636823750506308c379a061090052602061092052601f19601f61094051011660440161091cfd5b610600517fe1b60455bd9e33720b547f60e4e0cfbf1252d0f2ee0147d53029945f39fe3c1a60606004610940376107a0516109a052610920516109c052610840516109e05260c0610940a2610b84614a3d565b60206107806003600055f3612ac6565b633dd654788118610bb057346155055760125460405260206040f35b633644e5158118612ac65734615505576020610bcd610120615470565b610120f3612ac6565b63e36164058118610bf257346155055760145460405260206040f35b6337ed3a7a8118612ac6576064361034176155055760025463e31593d8606052602060606004607c845afa610c2c573d600060003e3d6000fd5b60203d10615505576060518060a01c6155055760a05260a090505160405260206040516399bf0b76606052606060046080373060e052602060606084607c845afa610c7c573d600060003e3d6000fd5b60203d106155055760609050f3612ac6565b634469ed148118610cad57346155055764012a05f20060405260206040f35b6323b872dd8118612ac657606436103417615505576004358060a01c6155055760c0526024358060a01c6155055760e052601860c051602052600052604060002080336020526000526040600020905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114610d565760c05160405233606052610100516044358082038281116155055790509050608052610d5661537b565b60c05160405260e051606052604435608052610d706153d4565b6001610120526020610120f3612ac6565b63405e28f88118610d9d57346155055760165460405260206040f35b63a457c2d78118612ac657604436103417615505576004358060a01c6155055760c05260183360205260005260406000208060c051602052600052604060002090505460e05260243560e05103610100526101005160e0511015610e02576000610100525b60e0516101005114610e27573360405260c05160605261010051608052610e2761537b565b6001610120526020610120f3612ac6565b6395d89b418118610e91573461550557602080604052806040016020602061569c600039600051018061569c8339508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b63bb7b8b808118610ef957346155055760005460021461550557600e54604052610ebc6101606145d2565b61016051670de0b6b3a7640000810281670de0b6b3a764000082041861550557905060195480156155055780820490509050610180526020610180f35b63a3f7cdd58118612ac657602436103417615505576020600354604052610f2060e0613026565b60e0600435600181116155055760051b81019050f3612ac6565b63313ce5678118612ac6573461550557601260405260206040f3612ac6565b6354fd4d508118612ac657346155055760208060805260066040527f76322e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f3612ac6565b6370a08231811861101957602436103417615505576004358060a01c61550557604052601760405160205260005260406000205460605260206060f35b63244c7c2e8118612ac657346155055760025463f851a440610120526020610120600461013c845afa611051573d600060003e3d6000fd5b60203d1061550557610120518060a01c6155055761016052610160905051331861550557611080610160612e91565b610160805161012052602081015161014052506101205160801b610160526101405161016051176101605261016051600755610160516009554260085542600a557f5f0e7fba3d100c9e19446e1c92fe436f0a9a22fe99669360e4fdd6d3de2fc2846101205161018052610140516101a052426101c0526060610180a100612ac6565b63dd62ed3e811861115f57604436103417615505576004358060a01c615505576040526024358060a01c615505576060526018604051602052600052604060002080606051602052600052604060002090505460805260206080f35b63a9059cbb8118612ac657604436103417615505576004358060a01c6155055760c0523360405260c05160605260243560805261119a6153d4565b600160e052602060e0f3612ac6565b6318160ddd8118612ac657346155055760195460405260206040f3612ac6565b637ecebe00811460033611161561120c57602436103417615505576004358060a01c61550557604052601a60405160205260005260406000205460605260206060f35b635e2480728118612ac6576064361034176155055760025463f851a440610120526020610120600461013c845afa611249573d600060003e3d6000fd5b60203d1061550557610120518060a01c61550557610160526101609050513318615505576008546201517f81018181106155055790504211156155055742620151808101818110615505579050600181038181116155055790506044351115615505576112b7610160612e91565b610160805161012052602081015161014052506101205160801b6101605261014051610160511761016052610a8c6004351061550557631017df8060043511615505576402540be400602435106155055766b1a2bc2ec500006024351161550557600435670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050610120518015615505578082049050905061018052678ac7230489e8000061018051116155055767016345785d8a0000610180511061550557602435670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050610140518015615505578082049050905061018052678ac7230489e8000061018051116155055767016345785d8a0000610180511061550557610160516007554260085560043560801b6101a0526024356101a051176101a052604435600a556101a0516009557fe35f0559b0642164e286b30df2077ec3a05426617a25db7578fd20ba39a6cd05610120516101c0526004356101e05261014051610200526024356102205242610240526044356102605260c06101c0a100612ac6565b63bfa0b133811861146f573461550557602061571c60403960206040f35b635918901781186114ac5760243610341761550557602060055460405261149660e0613026565b60e0600435600181116155055760051b81019050f35b6372d4f0e28118612ac657346155055760206014546040526114ce6060612fea565b6060604081019050f3612ac6565b635b41b9088118612ac6576083361115615505576000610aa05233610ac05261156856612ac6565b63394747c58118612ac65760a3361115615505576084358060011c61550557610aa05233610ac05261156856612ac6565b63ce7d650381186115b75760c3361115615505576084358060011c61550557610aa05260a4358060a01c61550557610ac0525b6000546002146155055760026000556020336105e05234610600526080600461062037610aa0516106a052610ac0516106c0526040366106e0376115ad610ae0613e3f565b610ae06003600055f35b63687276538118612ac65760243610341761550557600054600214615505576004546040526115e7610100613026565b610100600435600181116155055760051b810190505160e052600354604052611611610120613026565b610120600435600181116155055760051b81019050516101005260065461012052426101205110156117de5760055460405261164e610160613026565b610160600435600181116155055760051b810190505161014052601254604052611679610180612fea565b610180604081019050516101605260206155bc6000396000516381d18d876101a05242610120518082038281116155055790509050670de0b6b3a7640000810281670de0b6b3a764000082041861550557905061016051801561550557808204905090508060ff1c615505577f80000000000000000000000000000000000000000000000000000000000000008114615505576000036101c05260206101a060246101bc845afa61172f573d600060003e3d6000fd5b60203d10615505576101a09050516101805261014051610100518060011b818160011c18615505579050808281188284100218905090506101805180670de0b6b3a764000003670de0b6b3a76400008111615505579050808202811583838304141715615505579050905060e0516101805180820281158383830414171561550557905090508082018281106155055790509050670de0b6b3a7640000810490506101a05260206101a06117e3565b602060e05bf3612ac6565b6365b2489b8118612ac65760833611156155055733610aa05261182f56612ac6565b63e2ad025a8118612ac65760a3361115615505576084358060a01c61550557610aa0525b6000546002146155055760026000556020336105e0523461060052608060046106203760016106a052610aa0516106c0526040366106e037611872610ac0613e3f565b610ac06003600055f3612ac6565b63dd96994f8118612ac65761010436103417615505576084358060011c61550557610aa05260a4358060a01c61550557610ac05260c4358060a01c61550557610ae05260005460021461550557600260005560e43515615505576020610ac0516105e0526000610600526080600461062037610aa0516106a052610ae0516106c052336106e05260e43561070052611919610b00613e3f565b610b006003600055f3612ac6565b634515cef38118612ac65760833611156155055760006105e05233610600526103bb56612ac6565b632b6e993a811861197c5760a3361115615505576084358060011c615505576105e05233610600526103bb565b638f15b6b58118612ac657608436103417615505576064358060011c61550557610660523361068052611d6956612ac6565b63fce647368118612ac65760a436103417615505576084358060011c61550557610400523361042052600161044052611a2956612ac6565b635cd347808118612ac65760e436103417615505576084358060011c615505576104005260a4358060a01c615505576104205260c4358060011c61550557610440525b60005460021461550557600260005560043561046052600b5461048052600c546104a052600d546104c0526060366104e0376104405115611a6c57611a6c614a3d565b6019546105405233604052600435606052611a88610560614db4565b61056050610540516104605118611aef5760006003905b806105605261056051600281116155055760051b610480015161056051600281116155055760051b6104e001526000610560516002811161550557600b0155600101818118611a9f575050611c07565b61046051600181038181116155055790506104605260006003905b806105605261056051600281116155055760051b6104800151610460518082028115838383041417156155055790509050610540518015615505578082049050905061056051600281116155055760051b6104e0015261056051600281116155055760051b6024013561056051600281116155055760051b6104e00151106155055761056051600281116155055760051b610480015161056051600281116155055760051b6104e001518082038281116155055790509050610560516002811161550557600b015561056051600281116155055760051b6104e0015161056051600281116155055760051b6104800152600101818118611b0a5750505b600e5461056052610560516105405161056051610460518082028115838383041417156155055790509050048082038281116155055790509050600e5560006003905b8061058052602061058051600281116155055760051b60400161559c0160403961058051600281116155055760051b6104e00151606052610400516080526104205160a052611c97612d7c565b600101818118611c4a575050337fd6cc314a0b1e3b2579f8e64248e82434072e8271290eef8ad0886709304195f561048051610580526104a0516105a0526104c0516105c0526105405160043580820382811161550557905090506105e0526080610580a260606104e06003600055f3612ac6565b63f1dc3cc98118612ac657606436103417615505576000610660523361068052611d6956612ac6565b6307329bcd8118611f8e5760a436103417615505576064358060011c61550557610660526084358060a01c61550557610680525b600054600214615505576002600055611d836106e0612e91565b6106e080516106a05260208101516106c0525060e0366106e037611da5614a3d565b6106a0516101e0526106c05161020052604060046102203742600a541161026052611dd16107c0614e29565b6107c080516106e052602081015161070052604081018051610740526020810151610760526040810151610780525060a08101516107a052506044356106e0511015611e7d5760086107c0527f536c6970706167650000000000000000000000000000000000000000000000006107e0526107c0506107c051806107e001601f826000031636823750506308c379a06107805260206107a052601f19601f6107c051011660440161079cfd5b6024356002811161550557600b0180546106e051808203828111615505579050905081555033604052600435606052611eb76107c0614db4565b6107c0506020602435600281116155055760051b60400161559c016040396106e051606052610660516080526106805160a052611ef2612d7c565b6106a05160e0526106c05161010052610740516101205261076051610140526107805161016052610700516101805260006101a052611f326107e06131f4565b6107e0516107c052337fe200e24d4a4c7cd367dd9befe394dc8a14e6d58c88ff5e2f512d65a9e0aa9c5c604060046107e0376106e051610820526107a051610840526107c0516108605260a06107e0a260206106e06003600055f35b633883e1198118612ac657608436103417615505576064358060011c6155055760405260025463e31593d8608052602060806004609c845afa611fd6573d600060003e3d6000fd5b60203d10615505576080518060a01c6155055760c05260c09050516060526020606051638585c4b16080526060600460a0376040516101005230610120526020608060a4609c845afa61202e573d600060003e3d6000fd5b60203d106155055760809050f3612ac6565b63c93f49e8811861206e573461550557600054600214615505576002600055612067614a3d565b6003600055005b63395093518118612ac657604436103417615505576004358060a01c6155055760c05260183360205260005260406000208060c051602052600052604060002090505460e05260243560e051016101005260e0516101005110156120f2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100525b60e0516101005114612117573360405260c0516060526101005160805261211761537b565b6001610120526020610120f3612ac6565b63095ea7b38118612ac657604436103417615505576004358060a01c6155055760c0523360405260c05160605260243560805261216361537b565b600160e052602060e0f3612ac6565b63d505accf8118612ac65760e436103417615505576004358060a01c61550557610120526024358060a01c61550557610140526084358060081c6155055761016052610120511561550557606435421161550557601a6101205160205260005260406000205461018052600060026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c080516020820183610320018151815250508083019250505061222f610200615470565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120516000610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186155055760016101805101601a61012051602052600052604060002055610120516040526101405160605260443560805261232e61537b565b60016101c05260206101c0f3612ac6565b63cab4d3db8118612ac6573461550557602060025463cab4d3db604052602060406004605c845afa612376573d600060003e3d6000fd5b60203d10615505576040518060a01c6155055760805260809050f3612ac6565b63556d6e9f811861242e576064361034176155055760025463e31593d8606052602060606004607c845afa6123d0573d600060003e3d6000fd5b60203d10615505576060518060a01c6155055760a05260a09050516040526020604051633bb1f8c1606052606060046080373060e052602060606084607c845afa612420573d600060003e3d6000fd5b60203d106155055760609050f35b6354f0f7d5811861250957346155055760005460021461550557600454604052612459610120613026565b610120805160e052602081015161010052506011546003810281600382041861550557905060206155bc60003960005163f42c56c26101205260e051610100518082028115838383041417156155055790509050610140526020610120602461013c845afa6124cd573d600060003e3d6000fd5b60203d1061550557610120905051808202811583838304141715615505579050905069d3c21bcecceda100000081049050610160526020610160f35b634711a4f88118612ac65760c4361034176155055760025463f851a44060a052602060a0600460bc845afa612543573d600060003e3d6000fd5b60203d106155055760a0518060a01c6155055760e05260e090505133186155055760165461550557426203f480810181811061550557905060a05260a0516016556060600460c03760145460405261259c610180612fea565b610180805161012052602081015161014052604081015161016052506402540be40060e05111156125d3576101405160e0526125e0565b6207a12060e05110615505575b6402540be40160c051106125f6576101205160c0525b60e05160c0511161550557670de0b6b3a763ffff61010051111561262157610160516101005261262b565b6101005115615505575b60c05160405260e05160605261010051608052612649610180615365565b610180516015556060606461018037601254604052612669610240612fea565b61024080516101e05260208101516102005260408101516102205250670de0b6b3a764000161018051106126a0576101e051610180525b670de0b6b3a76400016101a051106126bb57610200516101a0525b620d505d6101c05111156126d657610220516101c0526126e2565b60576101c05110615505575b610180516040526101a0516060526101c051608052612702610240615365565b6102405160135560a0517fec36b92a482408f90e07357ca20c8cfaca85affe765903cb242e377fafb166af60c0516102405260e051610260526101005161028052610180516102a0526101a0516102c0526101c0516102e05260c0610240a200612ac6565b63ddca3f438118612ac657346155055760206127846101e0614917565b6101e080516102605260208101516102805260408101516102a0525061026051606052610280516080526102a05160a0526127c0610240613088565b610240f3612ac6565b634fb08c5e8118612ac6576044361034176155055760206127eb610660612e91565b61066080516107605260208101516107805250604060046107a03742600a54116107e052610760516101e05261078051610200526107a051610220526107c051610240526107e051610260526128426106a0614e29565b6106a0f3612ac6565b63cde699fa8118612ac65760c436103417615505576020606060046101e037606060646102403761287d6103406146c4565b610340f3612ac6565b63b137392981186128ae57346155055760206128a3610120612e91565b610120602081019050f35b63ee8de6758118612ac657346155055760206014546040526128d06060612fea565b6060602081019050f3612ac6565b6392526c0c8118612ac657346155055760206014546040526129006060612fea565b6060f3612ac6565b6349fe9e778118612ac6573461550557602060125460405261292a6060612fea565b6060f3612ac6565b63083812e58118612ac657346155055760206012546040526129546060612fea565b6060602081019050f3612ac6565b633620604b8118612ac657346155055760606001546040526129846060612fea565b6060f3612ac6565b63572e56258118612ac657606436103417615505576020606060046060376129b56101e0613088565b6101e0f3612ac6565b632a7dd7cd8118612ac657346155055760005460021461550557600260005560165442106155055760165415615505576000601655601554606052606051601455601354608052608051601255608051604052612a1c610100612fea565b610100805160a052602081015160c052604081015160e05250606051604052612a46610160612fea565b610160805161010052602081015161012052604081015161014052507fa32137411fc7c20db359079cd84af0e2cad58cd7a182a8a5e23e08e554e88bf061010051610160526101205161018052610140516101a05260a0516101c05260c0516101e05260e0516102005260c0610160a1600360005500612ac656612ac6565b5b3415612b1d57602061559c600039600051600060405260006003905b60208160051b60400161559c016000396000518318612b05576001604052612b10565b600101818118612ae2575b5050604051905015615505575b005b61014051612b2e576000612b3f565b602061559c60003960005160405118155b612d6e5760a0516155055760e051612bcf576040516323b872dd610160526101005161018052306101a0526060516101c0526020610160606461017c6000855af1612b8f573d600060003e3d6000fd5b3d612ba657803b156155055760016101e052612bbf565b60203d1061550557610160518060011c615505576101e0525b6101e09050511561550557612d15565b6040516370a0823161018052306101a0526020610180602461019c845afa612bfc573d600060003e3d6000fd5b60203d10615505576101809050516101605260c0515a600060e0516101805261018080516101c05260046101a0526101a09050805160208201836102c001815181525050808301925050506101005161020052610120516102205260405161024052606051610260526080516102805260a06101e0526101e0805160208201836102c0018281848460045afa50505080830192505050806102a0526102a05050600060006102a0516102c060008686f190509050612cbf573d600060003e3d6000fd5b6060516040516370a0823161018052306101a0526020610180602461019c845afa612cef573d600060003e3d6000fd5b60203d106155055761018090505161016051808203828111615505579050905018615505575b602061559c60003960005160405118612d7a57602061559c600039600051632e1a7d4d6101605260605161018052803b15615505576000610160602461017c6000855af1612d68573d600060003e3d6000fd5b50612d7a565b60605160a05118615505575b565b608051612d8a576000612d9b565b602061559c60003960005160405118155b612e5e57602061559c60003960005160405118612deb57602061559c60003960005163d0e30db060c052803b1561550557600060c0600460dc606051855af1612de9573d600060003e3d6000fd5b505b60405163a9059cbb60c05260a05160e05260605161010052602060c0604460dc6000855af1612e1f573d600060003e3d6000fd5b3d612e3657803b1561550557600161012052612e4e565b60203d106155055760c0518060011c61550557610120525b6101209050511561550557612e8f565b60a0516060515a600060c05260c0506000600060c05160e0858786f1905090509050612e8f573d600060003e3d6000fd5b565b600a546040526009546060526fffffffffffffffffffffffffffffffff6060511660805260605160801c60a052604051421015612fda5760075460c05260085460e05260405160e05180820382811161550557905090506040524260e051808203828111615505579050905060e05260405160e05180820382811161550557905090506101005260c05160801c61010051808202811583838304141715615505579050905060a05160e051808202811583838304141715615505579050905080820182811061550557905090506040518015615505578082049050905060a0526fffffffffffffffffffffffffffffffff60c0511661010051808202811583838304141715615505579050905060805160e05180820281158383830414171561550557905090508082018281106155055790509050604051801561550557808204905090506080525b60a0518152608051602082015250565b67ffffffffffffffff60405160801c16815267ffffffffffffffff60405160401c16602082015267ffffffffffffffff60405116604082015250565b60403660603760405160a05260006002905b8060c0526fffffffffffffffffffffffffffffffff60a0511660c051600181116155055760051b6060015260a05160801c60a0526001018181186130385750506060518152608051602082015250565b601454604052613099610120612fea565b610120805160c052602081015160e0526040810151610100525060206155bc60003960005163fa18042d61014052606051610160526080516101805260a0516101a052610100516101c0526020610140608461015c845afa613100573d600060003e3d6000fd5b60203d106155055761014090505161012052670de0b6b3a764000060c05161012051808202811583838304141715615505579050905060e0516101205180670de0b6b3a764000003670de0b6b3a764000081116155055790508082028115838383041417156155055790509050808201828110615505579050905004815250565b60403660803760006002905b8060c05260805160801b60805260c0518060010360018111615505579050600181116155055760051b6040015160a0526ffffffffffffffffffffffffffffffffe60a051116155055760805160a0511760805260010181811861318d575050608051815250565b601254604052613205610220612fea565b61022080516101c05260208101516101e05260408101516102005250600454604052613232610260613026565b610260805161022052602081015161024052506005546040526132566102a0613026565b6102a0805161026052602081015161028052506003546102a0526102a051604052613282610300613026565b61030080516102c05260208101516102e0525060195461030052600f54610320526011546103405260065461036052426103605110156134775760206155bc6000396000516381d18d876103a0526102005142610360518082038281116155055790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050048060ff1c615505577f80000000000000000000000000000000000000000000000000000000000000008114615505576000036103c05260206103a060246103bc845afa613358573d600060003e3d6000fd5b60203d10615505576103a09050516103805260006002905b806103a052670de0b6b3a76400006103a051600181116155055760051b61026001516103a051600181116155055760051b6102c001518060011b818160011c18615505579050808281188284100218905090506103805180670de0b6b3a764000003670de0b6b3a7640000811161550557905080820281158383830414171561550557905090506103a051600181116155055760051b61022001516103805180820281158383830414171561550557905090508082018281106155055790509050046103a051600181116155055760051b6102200152600101818118613370575050610220516040526102405160605261346b6103a0613181565b6103a051600455426006555b6101805161038052610180516134f95760206155bc600039600051637b12e0096103a05260e0516103c052610100516103e0526101205161040052610140516104205261016051610440526101a0516104605260206103a060c46103bc845afa6134e6573d600060003e3d6000fd5b60203d10615505576103a0905051610380525b60206155bc60003960005163754b76b36103a052610120516103c052610140516103e0526101605161040052610380516104205260e05161044052610100516104605260406103a060c46103bc845afa613558573d600060003e3d6000fd5b60403d10615505576103a090508051610260526020810151610280525060006002905b806103a052670de0b6b3a76400006103a051600181116155055760051b61026001516103a051600181116155055760051b6102c001518082028115838383041417156155055790509050046103a051600181116155055760051b610260015260010181811861357b57505061026051604052610280516060526135ff6103a0613181565b6103a0516005556060366103a037600361038051046103a05260006002905b806104005261038051670de0b6b3a7640000810281670de0b6b3a764000082041861550557905061040051600181116155055760051b6102c0015160038102816003820418615505579050801561550557808204905090506104005160018101818110615505579050600281116155055760051b6103a0015260010181811861361e575050670de0b6b3a764000061040052670de0b6b3a76400006104205261034051156137f95760206155bc60003960005163bad1dc26610460526103a051610480526103c0516104a0526103e0516104c0526020610460606461047c845afa61370e573d600060003e3d6000fd5b60203d10615505576104609050516104405261044051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506103005180156155055780820490509050610420526103405161032051610420518082028115838383041417156155055790509050046104005242600a5410156137f9576103405161042051116137f9576004610460527f4c6f7373000000000000000000000000000000000000000000000000000000006104805261046050610460518061048001601f826000031636823750506308c379a061042052602061044052601f19601f61046051011660440161043cfd5b61040051600f55610400516101c0518060011b818160011c186155055790508082018281106155055790509050610420518060011b818160011c18615505579050670de0b6b3a764000081038181116155055790501115613e27576040366104403760006002905b806104805261048051600181116155055760051b6102c0015161048051600181116155055760051b6102200151670de0b6b3a7640000810281670de0b6b3a76400008204186155055790500461046052670de0b6b3a76400016104605110156138db5761046051670de0b6b3a764000003610460526138ee565b670de0b6b3a76400006104605103610460525b610460516fffffffffffffffffffffffffffffffff8111615505576002810a9050610440510161044052600101818118613861575050610440518060b5710100000000000000000000000000000000008210613951578160801c91508060401b90505b6901000000000000000000821061396f578160401c91508060201b90505b650100000000008210613989578160201c91508060101b90505b630100000082106139a1578160101c91508060081b90505b620100008201810260121c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c90508083048082811882841002189050905090509050610440526101e05160056104405104808281188284110218905090506104805261048051610440511115613e27576040366104a03760006002905b806104e052610440516104e051600181116155055760051b6102c001516104805161044051038082028115838383041417156155055790509050610480516104e051600181116155055760051b610220015180820281158383830414171561550557905090508082018281106155055790509050046104e051600181116155055760051b6104a00152600101818118613a43575050610120516103a052610140516103c052610160516103e05260006002905b806104e0526104e051600181116155055760051b6102c001516104e05160018101818110615505579050600281116155055760051b61012001516104e051600181116155055760051b6104a001518082028115838383041417156155055790509050046104e05160018101818110615505579050600281116155055760051b6103a00152600101818118613af657505060206155bc600039600051637b12e0096105005260e0516105205261010051610540526103a051610560526103c051610580526103e0516105a05260006105c052602061050060c461051c845afa613be3573d600060003e3d6000fd5b60203d10615505576105009050516104e05260006003905b806105005261050051600281116155055760051b6103a00151670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506104e0518015615505578082049050905061052052662386f26fc10000610520511015613c60576000613c71565b68056bc75e2d631000006105205111155b1561550557600101818118613bfb5750506104e0516003810490506103a05260006002905b80610500526104e051670de0b6b3a7640000810281670de0b6b3a764000082041861550557905061050051600181116155055760051b6104a0015160038102816003820418615505579050801561550557808204905090506105005160018101818110615505579050600281116155055760051b6103a00152600101818118613c965750506103005160206155bc60003960005163bad1dc26610500526103a051610520526103c051610540526103e051610560526020610500606461051c845afa613d67573d600060003e3d6000fd5b60203d1061550557610500905051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790500461034052670de0b6b3a7640001610340511015613db2576000613de0565b61040051610340518060011b818160011c18615505579050670de0b6b3a76400008103818111615505579050115b15613e27576104a0516040526104c051606052613dfe610500613181565b610500516102a0526104e051600e55610340516011556102a0516003556102a051815250613e3d565b61038051600e55610420516011556102a0518152505b565b61064051610620511461550557610660511561550557613e60610760612e91565b61076080516107205260208101516107405250600b5461076052600c5461078052600d546107a052600154604052613e99610820612fea565b61082080516107c05260208101516107e0526040810151610800525060006108205261064051600281116155055760051b61076001516108405261062051600281116155055760051b6107600151610860526108605161066051808201828110615505579050905061062051600281116155055760051b610760015261062051600281116155055760051b6107600151610620516002811161550557600b01556003546108805261088051604052613f526108e0613026565b6108e080516108a05260208101516108c05250610760516107c051808202811583838304141715615505579050905061076052600160028101905b806108e052670de0b6b3a76400006108e051600281116155055760051b61076001516108e05160018103818111615505579050600181116155055760051b6108a0015180820281158383830414171561550557905090506108e051600281116155055760051b6107c001518082028115838383041417156155055790509050046108e051600281116155055760051b6107600152600101818118613f8d57505061062051600281116155055760051b6107c001516108e052600a54610900524261090051111561418057610860516108e05180820281158383830414171561550557905090506108605261062051156140c857670de0b6b3a7640000610860516106205160018103818111615505579050600181116155055760051b6108a00151808202811583838304141715615505579050905004610860525b61062051600281116155055760051b6107600151610920526108605161062051600281116155055760051b610760015260206155bc600039600051637b12e0096109405261072051610960526107405161098052610760516109a052610780516109c0526107a0516109e0526000610a0052602061094060c461095c845afa614156573d600060003e3d6000fd5b60203d1061550557610940905051600e556109205161062051600281116155055760051b61076001525b600e546109205261064051600281116155055760051b6107c001516109405260206155bc600039600051634a2ab3be6109a052610720516109c052610740516109e05261076051610a005261078051610a20526107a051610a405261092051610a605261064051610a805260406109a060e46109bc845afa614207573d600060003e3d6000fd5b60403d10615505576109a090508051610960526020810151610980525061064051600281116155055760051b61076001516109605180820382811161550557905090506108205261064051600281116155055760051b61076001805161082051808203828111615505579050905081525061082051600181038181116155055790506108205261064051156142eb5761082051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506106405160018103818111615505579050600181116155055760051b6108a0015180156155055780820490509050610820525b610820516109405180156155055780820490509050610820526402540be40061076051606052610780516080526107a05160a05261432a6109c0613088565b6109c051610820518082028115838383041417156155055790509050046109a052610820516109a051808203828111615505579050905061082052610680516108205110156143d95760086109c0527f536c6970706167650000000000000000000000000000000000000000000000006109e0526109c0506109c051806109e001601f826000031636823750506308c379a06109805260206109a052601f19601f6109c051011660440161099cfd5b610840516108205180820382811161550557905090506108405261084051610640516002811161550557600b01556108405161094051808202811583838304141715615505579050905061084052610640511561447857670de0b6b3a7640000610840516106405160018103818111615505579050600181116155055760051b6108a00151808202811583838304141715615505579050905004610840525b6108405161064051600281116155055760051b6107600152602061062051600281116155055760051b60400161559c0160403961066051606052610820516080526106005160a0526106e05160c0526107005160e0526105e051610100526106c051610120526106a051610140526144ee612b1f565b602061064051600281116155055760051b60400161559c01604039610820516060526106a0516080526106c05160a052614526612d7c565b6107205160e0526107405161010052610760516101205261078051610140526107a05161016052600061018052610980516101a0526145666109c06131f4565b6109c051610880526105e0517f143f1f8e861fbdeddd5b46e844b7d3ac7b86a122f36e8c463859ee6811b1f29c610620516109c052610660516109e05261064051610a005261082051610a20526109a051610a405261088051610a605260c06109c0a261082051815250565b60603660603760405160038104905060605260035460c052600160028101905b8060e052604051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506fffffffffffffffffffffffffffffffff60c05116600381028160038204186155055790508015615505578082049050905060e051600281116155055760051b6060015260c05160801c60c0526001018181186145f257505060206155bc60003960005163bad1dc2660e052606051610100526080516101205260a05161014052602060e0606460fc845afa6146b2573d600060003e3d6000fd5b60203d106155055760e0905051815250565b600361024051606052610260516080526102805160a0526146e66102c0613088565b6102c0510260031c6102a05260006102c05260006003905b8060051b6101e001516102e0526102c0516102e05180820182811061550557905090506102c0526001018181186146fe57505060036102c051046102e05260006103005260006003905b8060051b6101e00151610320526102e05161032051116147865761030051610320516102e051038082018281106155055790509050610300526147a6565b610300516102e05161032051038082018281106155055790509050610300525b6001018181186147485750506102a0516103005180820281158383830414171561550557905090506102c05180156155055780820490509050620186a08101818110615505579050815250565b6019546060518082018281106155055790509050601955601760405160205260005260406000208054606051808201828110615505579050905081555060405160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a36001815250565b6019546080526080516060518082028115838383041417156155055790509050670de0b6b3a76400008104905060a05260a0511561490f5760805160a051808201828110615505579050905060195560176040516020526000526040600020805460a051808201828110615505579050905081555060405160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60a05160c052602060c0a35b60a051815250565b600b54606052600c54608052600d5460a05260035460c052600154604052614940610140612fea565b610140805160e0526020810151610100526040810151610120525060605160e0518082028115838383041417156155055790509050606052600160028101905b80610140526fffffffffffffffffffffffffffffffff60c0511661014051600281116155055760051b60e0015180820281158383830414171561550557905090506101605261014051600281116155055760051b60600151610160518082028115838383041417156155055790509050670de0b6b3a76400008104905061014051600281116155055760051b6060015260c05160801c60c0526001018181186149805750506060518152608051602082015260a051604082015250565b614a486101e0612e91565b6101e080516101a05260208101516101c05250600f546101e0526010546102005260195461022052610200516101e0511115614a9257670de0b6b3a763ffff610220511115614a95565b60015b15614a9f57614db2565b60006003905b8061024052602061559c600039600051602061024051600281116155055760051b60400161559c0160003960005118614aee5747610240516002811161550557600b0155614b55565b602061024051600281116155055760051b60400161559c016000396000516370a082316102605230610280526020610260602461027c845afa614b36573d600060003e3d6000fd5b60203d1061550557610260905051610240516002811161550557600b01555b600101818118614aa5575050601154610240526404a817c800610200516101e0510364012a05f20081028164012a05f200820418615505579050046102605260025463cab4d3db6102a05260206102a060046102bc845afa614bbc573d600060003e3d6000fd5b60203d10615505576102a0518060a01c615505576102e0526102e0905051610280526102805115614bf257610260511515614bf5565b60005b15614cdd5761024051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506102405161026051808203828111615505579050905080156155055780820490509050670de0b6b3a764000081038181116155055790506102a052610280516040526102a051606052614c706102e0614868565b6102e0516102c0526101e051610260518060011b818160011c1861550557905080820382811161550557905090506101e0526101e051600f55610280517f6059a38198b1dc42b3791087d1ff0fbd72b3179553c25f678cd246f52ffaaf596102c0516102e05260206102e0a25b60206155bc600039600051637b12e009610320526101a051610340526101c05161036052614d0c6102c0614917565b6102c080516103805260208101516103a05260408101516103c0525060006103e052602061032060c461033c845afa614d4a573d600060003e3d6000fd5b60203d10615505576103209050516102a0526102a051600e556102a051604052614d756102c06145d2565b6102c051670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050601954801561550557808204905090506011556101e0516010555b565b6019546060518082038281116155055790509050601955601760405160205260005260406000208054606051808203828111615505579050905081555060006040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a36001815250565b60195461028052610280516102205111615505576002610240511161550557600b546102a052600c546102c052600d546102e052600154604052614e6e610360612fea565b6103608051610300526020810151610320526040810151610340525061030051610360526103205161038052610340516103a05260006103c05261030051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506103e05260035461040052610360516102a051808202811583838304141715615505579050905061036052600160028101905b80610420526fffffffffffffffffffffffffffffffff610400511661044052610420516102405118614f5a576104405161024051600281116155055760051b610360015180820281158383830414171561550557905090506103e0525b670de0b6b3a764000061042051600281116155055760051b610360015161042051600281116155055760051b6102a0015180820281158383830414171561550557905090506104405180820281158383830414171561550557905090500461042051600281116155055760051b61036001526104005160801c61040052600101818118614efd57505061026051614ff757600e546103c052615068565b60206155bc600039600051637b12e009610420526101e0516104405261020051610460526103605161048052610380516104a0526103a0516104c05260006104e052602061042060c461043c845afa615055573d600060003e3d6000fd5b60203d10615505576104209050516103c0525b6103c05161042052610360516104405261038051610460526103a0516104805261024051600281116155055760051b61036001516003810281600382041861550557905061022051808202811583838304141715615505579050905061028051801561550557808204905090506104a0526014546040526150ea6104e0612fea565b6104e0602081019050516104c05261024051600281116155055760051b61044001516104a05110156151695761024051600281116155055760051b6104400180516104a051808203828111615505579050905081525061044051606052610460516080526104805160a0526151606104e0613088565b6104e0516104c0525b6102805161022051610420518082028115838383041417156155055790509050046104e0526104c0516104e05180820281158383830414171561550557905090506404a817c800810490506001810181811061550557905061050052610500516003810281600382041861550557905061024051600281116155055760051b6102a001518082028115838383041417156155055790509050610420518015615505578082049050905061052052610420516104e05161050051808203828111615505579050905080820382811161550557905090506104205260206155bc600039600051634a2ab3be610560526101e05161058052610200516105a052610360516105c052610380516105e0526103a0516106005261042051610620526102405161064052604061056060e461057c845afa6152aa573d600060003e3d6000fd5b60403d10615505576105609050516105405261024051600281116155055760051b6103600151610540518082038281116155055790509050670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506103e05180156155055780820490509050610560526105405161024051600281116155055760051b6103600152610560518152610420516020820152604081016103605181526103805160208201526103a0516040820152506105205160a082015250565b60805160605160401b60405160801b1717815250565b608051601860405160205260005260406000208060605160205260005260406000209050556060516040517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560805160a052602060a0a3565b6060513081146153e6578015156153e9565b60005b90501561550557601760405160205260005260406000208054608051808203828111615505579050905081555060176060516020526000526040600020805460805180820182811061550557905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b60206156fc60003960005146146154fa577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647260605260206156dc6080397fd61c1033330c368dfc371f5b1e7133f4794e104642e5a3c87aba7a6a3441c8ff60a0524660c0523060e052602061571c6101003960c06040526040805160208201209050815250615503565b602061573c8239505b565b600080fd2ac51535298c001a1927288629082ac527c90c8e296215042ac51d352ac51d0c023611a92ac52ac517e92ac50fdc013f02f92ac52ac519e60f59188014512ac5015f029229322ac52ac52ac521722ac5021611032396036c0d812ac514dc0f3a233f2ac528de2ac50256180b2ac500992ac529be276721280e38034c0bd620402ac52ac50106194f0b9419ae2ac511c9284b8419559c8118921901c0a16576797065728300030a0017
Deployed Bytecode
0xfe710061573c5150346103405760206158f860003960005160406020826158f801600039600051116103405760206020826158f8016000396000510180826158f8016040395050602061591860003960005160206020826158f801600039600051116103405760206020826158f8016000396000510180826158f80160a039505060206159386000396000518060a01c6103405760e05260206159586000396000518060a01c610340576101005260206159786000396000518060a01c610340576101205260206159986000396000518060a01c610340576101405260206159b86000396000518060a01c61034057610160526101605161559c52610140516155bc5233600255602060405101600081601f0160051c6003811161034057801561014157905b8060051b604001518160051b60a00161559c0152600101818118610122575b505050602060a05101600081601f0160051c6002811161034057801561018357905b8060051b60a001518160051b6101000161559c0152600101818118610163575b50505060e0516155dc52610100516155fc526101205161561c5260206159f86000396000516001556020615a186000396000516007556020615a186000396000516009556020615a586000396000516012556020615a386000396000516014556020615a786000396000516003556020615a786000396000516004556020615a7860003960005160055542600655670de0b6b3a7640000601055602061563c5101600081601f0160051c6003811161034057801561025d57905b8060051b60a00161559c01518160051b610180015260010181811861023d575b5050506101808051602082012090506156dc5260206159d860003960005161571c52466156fc527fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726101a0526156dc516101c0527fd61c1033330c368dfc371f5b1e7133f4794e104642e5a3c87aba7a6a3441c8ff6101e0524661020052306102205261571c516102405260c06101805261018080516020820120905061573c523060007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef6000610180526020610180a361559c6103456100003961575c610000f35b600080fd60003560e01c60026049820660011b61550a01601e39600051565b6317e26cd18118610038573461550557602061559c60403960206040f35b63226840fb8118612ac657346155055760025463f851a440604052602060406004605c845afa61006d573d600060003e3d6000fd5b60203d10615505576040518060a01c615505576080526080905051331861550557600060165500612ac6565b63ed6c154681186100b757346155055760206155bc60403960206040f35b6309c3da6a8118612ac65734615505576012546040526100d76060612fea565b6060604081019050516102b68102816102b68204186155055790506103e88104905060c052602060c0f3612ac6565b63c66106578118612ac657602436103417615505576020600435600281116155055760051b60400161559c0160403960206040f3612ac6565b63c45a01558118612ac657346155055760025460405260206040f3612ac6565b636112c747811861017b57346155055760065460405260206040f35b6306fdde0381186101d4573461550557602080604052806040016020602061563c600039600051018061563c8339508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b631da3d2388118612ac65760c436103417615505576084358060011c615505576104005260a4358060a01c6155055761042052600161044052611a2956612ac6565b63204fe3d58118612ac657346155055760075460405260206040f3612ac6565b63e89876ff8118612ac657346155055760085460405260206040f3612ac6565b63f30cfad5811861027257346155055760095460405260206040f35b630f529ba28118612ac6573461550557600e5460405260206040f3612ac6565b63f9ed959781186102ae573461550557600a5460405260206040f35b630b7b594b81186102ca57346155055760105460405260206040f35b63ecb586a58118612ac657608436103417615505576000610400523361042052600161044052611a2956612ac6565b634903b0d1811861032657602436103417615505576004356002811161550557600b015460405260206040f35b63f446c1d08118612ac65734615505576020610343610120612e91565b610120f3612ac6565b637ba1a74d8118612ac6573461550557600f5460405260206040f3612ac6565b630c46b72a811861038857346155055760115460405260206040f35b635cecb5f78118612ac65760c3361115615505576084358060011c615505576105e05260a4358060a01c61550557610600525b6000546002146155055760026000556103d5610660612e91565b61066080516106205260208101516106405250600b5461066052600c5461068052600d546106a052610120366106c037600435602435808201828110615505579050905060443580820182811061550557905090501561550557600154604052610440610840612fea565b61084080516107e0526020810151610800526040810151610820525060035461084052610840516040526104756108a0613026565b6108a080516108605260208101516108805250610660516108a052610680516108c0526106a0516108e05260006003905b806109005261090051600281116155055760051b610660015161090051600281116155055760051b600401358082018281106155055790509050610920526109205161090051600281116155055760051b610660015261092051610900516002811161550557600b01556001018181186104a6575050610660516107205261068051610740526106a05161076052610660516107e0518082028115838383041417156155055790509050610660526108a0516107e05180820281158383830414171561550557905090506108a052600160028101905b8061090052670de0b6b3a764000061090051600281116155055760051b61066001516109005160018103818111615505579050600181116155055760051b6108600151808202811583838304141715615505579050905061090051600281116155055760051b6107e0015180820281158383830414171561550557905090500461090051600281116155055760051b6106600152670de0b6b3a764000061090051600281116155055760051b6108a0015161090051600281116155055760051b6107e001516109005160018103818111615505579050600181116155055760051b61086001510280820281158383830414171561550557905090500461090051600281116155055760051b6108a0015260010181811861057c57505060006003905b806109005261090051600281116155055760051b60040135156107de57602061559c600039600051602061090051600281116155055760051b60400161559c016000396000511861074857602061090051600281116155055760051b60400161559c0160403961090051600281116155055760051b6004013560605260006080523460a05260403660c03733610100526000610120526105e05161014052610793612b1f56610793565b602061090051600281116155055760051b60400161559c0160403961090051600281116155055760051b60040135606052608036608037336101005260403661012037610793612b1f565b61090051600281116155055760051b610660015161090051600281116155055760051b6108a00151808203828111615505579050905061090051600281116155055760051b6106c001525b60010181811861069e57505042600a54116107ff57600e546107c052610870565b60206155bc600039600051637b12e00961090052610620516109205261064051610940526108a051610960526108c051610980526108e0516109a05260006109c052602061090060c461091c845afa61085d573d600060003e3d6000fd5b60203d10615505576109009050516107c0525b60206155bc600039600051637b12e00961092052610620516109405261064051610960526106605161098052610680516109a0526106a0516109c05260006109e052602061092060c461093c845afa6108ce573d600060003e3d6000fd5b60203d106155055761092090505161090052601954610920526107c0511561093857610920516109005180820281158383830414171561550557905090506107c0518015615505578082049050905061092051808203828111615505579050905061078052610953565b6109005160405261094a6109406145d2565b61094051610780525b6107805115615505576107c05115610a75576106c0516101e0526106e051610200526107005161022052610660516102405261068051610260526106a051610280526109a06109406146c4565b610940516107805180820281158383830414171561550557905090506402540be40081049050600181018181106155055790506107a052610780516107a05180820382811161550557905090506107805261092051610780518082018281106155055790509050610920526106005160405261078051606052610a246109406147f3565b610940506106205160e0526106405161010052610660516101205261068051610140526106a05161016052610900516101805260006101a052610a686109406131f4565b6109405161084052610abe565b61090051600e55670de0b6b3a7640000601155670de0b6b3a7640000600f55670de0b6b3a76400006010556106005160405261078051606052610ab96109406147f3565b610940505b606435610780511015610b31576008610940527f536c6970706167650000000000000000000000000000000000000000000000006109605261094050610940518061096001601f826000031636823750506308c379a061090052602061092052601f19601f61094051011660440161091cfd5b610600517fe1b60455bd9e33720b547f60e4e0cfbf1252d0f2ee0147d53029945f39fe3c1a60606004610940376107a0516109a052610920516109c052610840516109e05260c0610940a2610b84614a3d565b60206107806003600055f3612ac6565b633dd654788118610bb057346155055760125460405260206040f35b633644e5158118612ac65734615505576020610bcd610120615470565b610120f3612ac6565b63e36164058118610bf257346155055760145460405260206040f35b6337ed3a7a8118612ac6576064361034176155055760025463e31593d8606052602060606004607c845afa610c2c573d600060003e3d6000fd5b60203d10615505576060518060a01c6155055760a05260a090505160405260206040516399bf0b76606052606060046080373060e052602060606084607c845afa610c7c573d600060003e3d6000fd5b60203d106155055760609050f3612ac6565b634469ed148118610cad57346155055764012a05f20060405260206040f35b6323b872dd8118612ac657606436103417615505576004358060a01c6155055760c0526024358060a01c6155055760e052601860c051602052600052604060002080336020526000526040600020905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114610d565760c05160405233606052610100516044358082038281116155055790509050608052610d5661537b565b60c05160405260e051606052604435608052610d706153d4565b6001610120526020610120f3612ac6565b63405e28f88118610d9d57346155055760165460405260206040f35b63a457c2d78118612ac657604436103417615505576004358060a01c6155055760c05260183360205260005260406000208060c051602052600052604060002090505460e05260243560e05103610100526101005160e0511015610e02576000610100525b60e0516101005114610e27573360405260c05160605261010051608052610e2761537b565b6001610120526020610120f3612ac6565b6395d89b418118610e91573461550557602080604052806040016020602061569c600039600051018061569c8339508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b63bb7b8b808118610ef957346155055760005460021461550557600e54604052610ebc6101606145d2565b61016051670de0b6b3a7640000810281670de0b6b3a764000082041861550557905060195480156155055780820490509050610180526020610180f35b63a3f7cdd58118612ac657602436103417615505576020600354604052610f2060e0613026565b60e0600435600181116155055760051b81019050f3612ac6565b63313ce5678118612ac6573461550557601260405260206040f3612ac6565b6354fd4d508118612ac657346155055760208060805260066040527f76322e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f3612ac6565b6370a08231811861101957602436103417615505576004358060a01c61550557604052601760405160205260005260406000205460605260206060f35b63244c7c2e8118612ac657346155055760025463f851a440610120526020610120600461013c845afa611051573d600060003e3d6000fd5b60203d1061550557610120518060a01c6155055761016052610160905051331861550557611080610160612e91565b610160805161012052602081015161014052506101205160801b610160526101405161016051176101605261016051600755610160516009554260085542600a557f5f0e7fba3d100c9e19446e1c92fe436f0a9a22fe99669360e4fdd6d3de2fc2846101205161018052610140516101a052426101c0526060610180a100612ac6565b63dd62ed3e811861115f57604436103417615505576004358060a01c615505576040526024358060a01c615505576060526018604051602052600052604060002080606051602052600052604060002090505460805260206080f35b63a9059cbb8118612ac657604436103417615505576004358060a01c6155055760c0523360405260c05160605260243560805261119a6153d4565b600160e052602060e0f3612ac6565b6318160ddd8118612ac657346155055760195460405260206040f3612ac6565b637ecebe00811460033611161561120c57602436103417615505576004358060a01c61550557604052601a60405160205260005260406000205460605260206060f35b635e2480728118612ac6576064361034176155055760025463f851a440610120526020610120600461013c845afa611249573d600060003e3d6000fd5b60203d1061550557610120518060a01c61550557610160526101609050513318615505576008546201517f81018181106155055790504211156155055742620151808101818110615505579050600181038181116155055790506044351115615505576112b7610160612e91565b610160805161012052602081015161014052506101205160801b6101605261014051610160511761016052610a8c6004351061550557631017df8060043511615505576402540be400602435106155055766b1a2bc2ec500006024351161550557600435670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050610120518015615505578082049050905061018052678ac7230489e8000061018051116155055767016345785d8a0000610180511061550557602435670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050610140518015615505578082049050905061018052678ac7230489e8000061018051116155055767016345785d8a0000610180511061550557610160516007554260085560043560801b6101a0526024356101a051176101a052604435600a556101a0516009557fe35f0559b0642164e286b30df2077ec3a05426617a25db7578fd20ba39a6cd05610120516101c0526004356101e05261014051610200526024356102205242610240526044356102605260c06101c0a100612ac6565b63bfa0b133811861146f573461550557602061571c60403960206040f35b635918901781186114ac5760243610341761550557602060055460405261149660e0613026565b60e0600435600181116155055760051b81019050f35b6372d4f0e28118612ac657346155055760206014546040526114ce6060612fea565b6060604081019050f3612ac6565b635b41b9088118612ac6576083361115615505576000610aa05233610ac05261156856612ac6565b63394747c58118612ac65760a3361115615505576084358060011c61550557610aa05233610ac05261156856612ac6565b63ce7d650381186115b75760c3361115615505576084358060011c61550557610aa05260a4358060a01c61550557610ac0525b6000546002146155055760026000556020336105e05234610600526080600461062037610aa0516106a052610ac0516106c0526040366106e0376115ad610ae0613e3f565b610ae06003600055f35b63687276538118612ac65760243610341761550557600054600214615505576004546040526115e7610100613026565b610100600435600181116155055760051b810190505160e052600354604052611611610120613026565b610120600435600181116155055760051b81019050516101005260065461012052426101205110156117de5760055460405261164e610160613026565b610160600435600181116155055760051b810190505161014052601254604052611679610180612fea565b610180604081019050516101605260206155bc6000396000516381d18d876101a05242610120518082038281116155055790509050670de0b6b3a7640000810281670de0b6b3a764000082041861550557905061016051801561550557808204905090508060ff1c615505577f80000000000000000000000000000000000000000000000000000000000000008114615505576000036101c05260206101a060246101bc845afa61172f573d600060003e3d6000fd5b60203d10615505576101a09050516101805261014051610100518060011b818160011c18615505579050808281188284100218905090506101805180670de0b6b3a764000003670de0b6b3a76400008111615505579050808202811583838304141715615505579050905060e0516101805180820281158383830414171561550557905090508082018281106155055790509050670de0b6b3a7640000810490506101a05260206101a06117e3565b602060e05bf3612ac6565b6365b2489b8118612ac65760833611156155055733610aa05261182f56612ac6565b63e2ad025a8118612ac65760a3361115615505576084358060a01c61550557610aa0525b6000546002146155055760026000556020336105e0523461060052608060046106203760016106a052610aa0516106c0526040366106e037611872610ac0613e3f565b610ac06003600055f3612ac6565b63dd96994f8118612ac65761010436103417615505576084358060011c61550557610aa05260a4358060a01c61550557610ac05260c4358060a01c61550557610ae05260005460021461550557600260005560e43515615505576020610ac0516105e0526000610600526080600461062037610aa0516106a052610ae0516106c052336106e05260e43561070052611919610b00613e3f565b610b006003600055f3612ac6565b634515cef38118612ac65760833611156155055760006105e05233610600526103bb56612ac6565b632b6e993a811861197c5760a3361115615505576084358060011c615505576105e05233610600526103bb565b638f15b6b58118612ac657608436103417615505576064358060011c61550557610660523361068052611d6956612ac6565b63fce647368118612ac65760a436103417615505576084358060011c61550557610400523361042052600161044052611a2956612ac6565b635cd347808118612ac65760e436103417615505576084358060011c615505576104005260a4358060a01c615505576104205260c4358060011c61550557610440525b60005460021461550557600260005560043561046052600b5461048052600c546104a052600d546104c0526060366104e0376104405115611a6c57611a6c614a3d565b6019546105405233604052600435606052611a88610560614db4565b61056050610540516104605118611aef5760006003905b806105605261056051600281116155055760051b610480015161056051600281116155055760051b6104e001526000610560516002811161550557600b0155600101818118611a9f575050611c07565b61046051600181038181116155055790506104605260006003905b806105605261056051600281116155055760051b6104800151610460518082028115838383041417156155055790509050610540518015615505578082049050905061056051600281116155055760051b6104e0015261056051600281116155055760051b6024013561056051600281116155055760051b6104e00151106155055761056051600281116155055760051b610480015161056051600281116155055760051b6104e001518082038281116155055790509050610560516002811161550557600b015561056051600281116155055760051b6104e0015161056051600281116155055760051b6104800152600101818118611b0a5750505b600e5461056052610560516105405161056051610460518082028115838383041417156155055790509050048082038281116155055790509050600e5560006003905b8061058052602061058051600281116155055760051b60400161559c0160403961058051600281116155055760051b6104e00151606052610400516080526104205160a052611c97612d7c565b600101818118611c4a575050337fd6cc314a0b1e3b2579f8e64248e82434072e8271290eef8ad0886709304195f561048051610580526104a0516105a0526104c0516105c0526105405160043580820382811161550557905090506105e0526080610580a260606104e06003600055f3612ac6565b63f1dc3cc98118612ac657606436103417615505576000610660523361068052611d6956612ac6565b6307329bcd8118611f8e5760a436103417615505576064358060011c61550557610660526084358060a01c61550557610680525b600054600214615505576002600055611d836106e0612e91565b6106e080516106a05260208101516106c0525060e0366106e037611da5614a3d565b6106a0516101e0526106c05161020052604060046102203742600a541161026052611dd16107c0614e29565b6107c080516106e052602081015161070052604081018051610740526020810151610760526040810151610780525060a08101516107a052506044356106e0511015611e7d5760086107c0527f536c6970706167650000000000000000000000000000000000000000000000006107e0526107c0506107c051806107e001601f826000031636823750506308c379a06107805260206107a052601f19601f6107c051011660440161079cfd5b6024356002811161550557600b0180546106e051808203828111615505579050905081555033604052600435606052611eb76107c0614db4565b6107c0506020602435600281116155055760051b60400161559c016040396106e051606052610660516080526106805160a052611ef2612d7c565b6106a05160e0526106c05161010052610740516101205261076051610140526107805161016052610700516101805260006101a052611f326107e06131f4565b6107e0516107c052337fe200e24d4a4c7cd367dd9befe394dc8a14e6d58c88ff5e2f512d65a9e0aa9c5c604060046107e0376106e051610820526107a051610840526107c0516108605260a06107e0a260206106e06003600055f35b633883e1198118612ac657608436103417615505576064358060011c6155055760405260025463e31593d8608052602060806004609c845afa611fd6573d600060003e3d6000fd5b60203d10615505576080518060a01c6155055760c05260c09050516060526020606051638585c4b16080526060600460a0376040516101005230610120526020608060a4609c845afa61202e573d600060003e3d6000fd5b60203d106155055760809050f3612ac6565b63c93f49e8811861206e573461550557600054600214615505576002600055612067614a3d565b6003600055005b63395093518118612ac657604436103417615505576004358060a01c6155055760c05260183360205260005260406000208060c051602052600052604060002090505460e05260243560e051016101005260e0516101005110156120f2577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610100525b60e0516101005114612117573360405260c0516060526101005160805261211761537b565b6001610120526020610120f3612ac6565b63095ea7b38118612ac657604436103417615505576004358060a01c6155055760c0523360405260c05160605260243560805261216361537b565b600160e052602060e0f3612ac6565b63d505accf8118612ac65760e436103417615505576004358060a01c61550557610120526024358060a01c61550557610140526084358060081c6155055761016052610120511561550557606435421161550557601a6101205160205260005260406000205461018052600060026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c080516020820183610320018151815250508083019250505061222f610200615470565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120516000610240526101a0516101c052610160516101e052604060a461020037602061024060806101c060015afa5061024051186155055760016101805101601a61012051602052600052604060002055610120516040526101405160605260443560805261232e61537b565b60016101c05260206101c0f3612ac6565b63cab4d3db8118612ac6573461550557602060025463cab4d3db604052602060406004605c845afa612376573d600060003e3d6000fd5b60203d10615505576040518060a01c6155055760805260809050f3612ac6565b63556d6e9f811861242e576064361034176155055760025463e31593d8606052602060606004607c845afa6123d0573d600060003e3d6000fd5b60203d10615505576060518060a01c6155055760a05260a09050516040526020604051633bb1f8c1606052606060046080373060e052602060606084607c845afa612420573d600060003e3d6000fd5b60203d106155055760609050f35b6354f0f7d5811861250957346155055760005460021461550557600454604052612459610120613026565b610120805160e052602081015161010052506011546003810281600382041861550557905060206155bc60003960005163f42c56c26101205260e051610100518082028115838383041417156155055790509050610140526020610120602461013c845afa6124cd573d600060003e3d6000fd5b60203d1061550557610120905051808202811583838304141715615505579050905069d3c21bcecceda100000081049050610160526020610160f35b634711a4f88118612ac65760c4361034176155055760025463f851a44060a052602060a0600460bc845afa612543573d600060003e3d6000fd5b60203d106155055760a0518060a01c6155055760e05260e090505133186155055760165461550557426203f480810181811061550557905060a05260a0516016556060600460c03760145460405261259c610180612fea565b610180805161012052602081015161014052604081015161016052506402540be40060e05111156125d3576101405160e0526125e0565b6207a12060e05110615505575b6402540be40160c051106125f6576101205160c0525b60e05160c0511161550557670de0b6b3a763ffff61010051111561262157610160516101005261262b565b6101005115615505575b60c05160405260e05160605261010051608052612649610180615365565b610180516015556060606461018037601254604052612669610240612fea565b61024080516101e05260208101516102005260408101516102205250670de0b6b3a764000161018051106126a0576101e051610180525b670de0b6b3a76400016101a051106126bb57610200516101a0525b620d505d6101c05111156126d657610220516101c0526126e2565b60576101c05110615505575b610180516040526101a0516060526101c051608052612702610240615365565b6102405160135560a0517fec36b92a482408f90e07357ca20c8cfaca85affe765903cb242e377fafb166af60c0516102405260e051610260526101005161028052610180516102a0526101a0516102c0526101c0516102e05260c0610240a200612ac6565b63ddca3f438118612ac657346155055760206127846101e0614917565b6101e080516102605260208101516102805260408101516102a0525061026051606052610280516080526102a05160a0526127c0610240613088565b610240f3612ac6565b634fb08c5e8118612ac6576044361034176155055760206127eb610660612e91565b61066080516107605260208101516107805250604060046107a03742600a54116107e052610760516101e05261078051610200526107a051610220526107c051610240526107e051610260526128426106a0614e29565b6106a0f3612ac6565b63cde699fa8118612ac65760c436103417615505576020606060046101e037606060646102403761287d6103406146c4565b610340f3612ac6565b63b137392981186128ae57346155055760206128a3610120612e91565b610120602081019050f35b63ee8de6758118612ac657346155055760206014546040526128d06060612fea565b6060602081019050f3612ac6565b6392526c0c8118612ac657346155055760206014546040526129006060612fea565b6060f3612ac6565b6349fe9e778118612ac6573461550557602060125460405261292a6060612fea565b6060f3612ac6565b63083812e58118612ac657346155055760206012546040526129546060612fea565b6060602081019050f3612ac6565b633620604b8118612ac657346155055760606001546040526129846060612fea565b6060f3612ac6565b63572e56258118612ac657606436103417615505576020606060046060376129b56101e0613088565b6101e0f3612ac6565b632a7dd7cd8118612ac657346155055760005460021461550557600260005560165442106155055760165415615505576000601655601554606052606051601455601354608052608051601255608051604052612a1c610100612fea565b610100805160a052602081015160c052604081015160e05250606051604052612a46610160612fea565b610160805161010052602081015161012052604081015161014052507fa32137411fc7c20db359079cd84af0e2cad58cd7a182a8a5e23e08e554e88bf061010051610160526101205161018052610140516101a05260a0516101c05260c0516101e05260e0516102005260c0610160a1600360005500612ac656612ac6565b5b3415612b1d57602061559c600039600051600060405260006003905b60208160051b60400161559c016000396000518318612b05576001604052612b10565b600101818118612ae2575b5050604051905015615505575b005b61014051612b2e576000612b3f565b602061559c60003960005160405118155b612d6e5760a0516155055760e051612bcf576040516323b872dd610160526101005161018052306101a0526060516101c0526020610160606461017c6000855af1612b8f573d600060003e3d6000fd5b3d612ba657803b156155055760016101e052612bbf565b60203d1061550557610160518060011c615505576101e0525b6101e09050511561550557612d15565b6040516370a0823161018052306101a0526020610180602461019c845afa612bfc573d600060003e3d6000fd5b60203d10615505576101809050516101605260c0515a600060e0516101805261018080516101c05260046101a0526101a09050805160208201836102c001815181525050808301925050506101005161020052610120516102205260405161024052606051610260526080516102805260a06101e0526101e0805160208201836102c0018281848460045afa50505080830192505050806102a0526102a05050600060006102a0516102c060008686f190509050612cbf573d600060003e3d6000fd5b6060516040516370a0823161018052306101a0526020610180602461019c845afa612cef573d600060003e3d6000fd5b60203d106155055761018090505161016051808203828111615505579050905018615505575b602061559c60003960005160405118612d7a57602061559c600039600051632e1a7d4d6101605260605161018052803b15615505576000610160602461017c6000855af1612d68573d600060003e3d6000fd5b50612d7a565b60605160a05118615505575b565b608051612d8a576000612d9b565b602061559c60003960005160405118155b612e5e57602061559c60003960005160405118612deb57602061559c60003960005163d0e30db060c052803b1561550557600060c0600460dc606051855af1612de9573d600060003e3d6000fd5b505b60405163a9059cbb60c05260a05160e05260605161010052602060c0604460dc6000855af1612e1f573d600060003e3d6000fd5b3d612e3657803b1561550557600161012052612e4e565b60203d106155055760c0518060011c61550557610120525b6101209050511561550557612e8f565b60a0516060515a600060c05260c0506000600060c05160e0858786f1905090509050612e8f573d600060003e3d6000fd5b565b600a546040526009546060526fffffffffffffffffffffffffffffffff6060511660805260605160801c60a052604051421015612fda5760075460c05260085460e05260405160e05180820382811161550557905090506040524260e051808203828111615505579050905060e05260405160e05180820382811161550557905090506101005260c05160801c61010051808202811583838304141715615505579050905060a05160e051808202811583838304141715615505579050905080820182811061550557905090506040518015615505578082049050905060a0526fffffffffffffffffffffffffffffffff60c0511661010051808202811583838304141715615505579050905060805160e05180820281158383830414171561550557905090508082018281106155055790509050604051801561550557808204905090506080525b60a0518152608051602082015250565b67ffffffffffffffff60405160801c16815267ffffffffffffffff60405160401c16602082015267ffffffffffffffff60405116604082015250565b60403660603760405160a05260006002905b8060c0526fffffffffffffffffffffffffffffffff60a0511660c051600181116155055760051b6060015260a05160801c60a0526001018181186130385750506060518152608051602082015250565b601454604052613099610120612fea565b610120805160c052602081015160e0526040810151610100525060206155bc60003960005163fa18042d61014052606051610160526080516101805260a0516101a052610100516101c0526020610140608461015c845afa613100573d600060003e3d6000fd5b60203d106155055761014090505161012052670de0b6b3a764000060c05161012051808202811583838304141715615505579050905060e0516101205180670de0b6b3a764000003670de0b6b3a764000081116155055790508082028115838383041417156155055790509050808201828110615505579050905004815250565b60403660803760006002905b8060c05260805160801b60805260c0518060010360018111615505579050600181116155055760051b6040015160a0526ffffffffffffffffffffffffffffffffe60a051116155055760805160a0511760805260010181811861318d575050608051815250565b601254604052613205610220612fea565b61022080516101c05260208101516101e05260408101516102005250600454604052613232610260613026565b610260805161022052602081015161024052506005546040526132566102a0613026565b6102a0805161026052602081015161028052506003546102a0526102a051604052613282610300613026565b61030080516102c05260208101516102e0525060195461030052600f54610320526011546103405260065461036052426103605110156134775760206155bc6000396000516381d18d876103a0526102005142610360518082038281116155055790509050670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050048060ff1c615505577f80000000000000000000000000000000000000000000000000000000000000008114615505576000036103c05260206103a060246103bc845afa613358573d600060003e3d6000fd5b60203d10615505576103a09050516103805260006002905b806103a052670de0b6b3a76400006103a051600181116155055760051b61026001516103a051600181116155055760051b6102c001518060011b818160011c18615505579050808281188284100218905090506103805180670de0b6b3a764000003670de0b6b3a7640000811161550557905080820281158383830414171561550557905090506103a051600181116155055760051b61022001516103805180820281158383830414171561550557905090508082018281106155055790509050046103a051600181116155055760051b6102200152600101818118613370575050610220516040526102405160605261346b6103a0613181565b6103a051600455426006555b6101805161038052610180516134f95760206155bc600039600051637b12e0096103a05260e0516103c052610100516103e0526101205161040052610140516104205261016051610440526101a0516104605260206103a060c46103bc845afa6134e6573d600060003e3d6000fd5b60203d10615505576103a0905051610380525b60206155bc60003960005163754b76b36103a052610120516103c052610140516103e0526101605161040052610380516104205260e05161044052610100516104605260406103a060c46103bc845afa613558573d600060003e3d6000fd5b60403d10615505576103a090508051610260526020810151610280525060006002905b806103a052670de0b6b3a76400006103a051600181116155055760051b61026001516103a051600181116155055760051b6102c001518082028115838383041417156155055790509050046103a051600181116155055760051b610260015260010181811861357b57505061026051604052610280516060526135ff6103a0613181565b6103a0516005556060366103a037600361038051046103a05260006002905b806104005261038051670de0b6b3a7640000810281670de0b6b3a764000082041861550557905061040051600181116155055760051b6102c0015160038102816003820418615505579050801561550557808204905090506104005160018101818110615505579050600281116155055760051b6103a0015260010181811861361e575050670de0b6b3a764000061040052670de0b6b3a76400006104205261034051156137f95760206155bc60003960005163bad1dc26610460526103a051610480526103c0516104a0526103e0516104c0526020610460606461047c845afa61370e573d600060003e3d6000fd5b60203d10615505576104609050516104405261044051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506103005180156155055780820490509050610420526103405161032051610420518082028115838383041417156155055790509050046104005242600a5410156137f9576103405161042051116137f9576004610460527f4c6f7373000000000000000000000000000000000000000000000000000000006104805261046050610460518061048001601f826000031636823750506308c379a061042052602061044052601f19601f61046051011660440161043cfd5b61040051600f55610400516101c0518060011b818160011c186155055790508082018281106155055790509050610420518060011b818160011c18615505579050670de0b6b3a764000081038181116155055790501115613e27576040366104403760006002905b806104805261048051600181116155055760051b6102c0015161048051600181116155055760051b6102200151670de0b6b3a7640000810281670de0b6b3a76400008204186155055790500461046052670de0b6b3a76400016104605110156138db5761046051670de0b6b3a764000003610460526138ee565b670de0b6b3a76400006104605103610460525b610460516fffffffffffffffffffffffffffffffff8111615505576002810a9050610440510161044052600101818118613861575050610440518060b5710100000000000000000000000000000000008210613951578160801c91508060401b90505b6901000000000000000000821061396f578160401c91508060201b90505b650100000000008210613989578160201c91508060101b90505b630100000082106139a1578160101c91508060081b90505b620100008201810260121c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c9050808184040160011c90508083048082811882841002189050905090509050610440526101e05160056104405104808281188284110218905090506104805261048051610440511115613e27576040366104a03760006002905b806104e052610440516104e051600181116155055760051b6102c001516104805161044051038082028115838383041417156155055790509050610480516104e051600181116155055760051b610220015180820281158383830414171561550557905090508082018281106155055790509050046104e051600181116155055760051b6104a00152600101818118613a43575050610120516103a052610140516103c052610160516103e05260006002905b806104e0526104e051600181116155055760051b6102c001516104e05160018101818110615505579050600281116155055760051b61012001516104e051600181116155055760051b6104a001518082028115838383041417156155055790509050046104e05160018101818110615505579050600281116155055760051b6103a00152600101818118613af657505060206155bc600039600051637b12e0096105005260e0516105205261010051610540526103a051610560526103c051610580526103e0516105a05260006105c052602061050060c461051c845afa613be3573d600060003e3d6000fd5b60203d10615505576105009050516104e05260006003905b806105005261050051600281116155055760051b6103a00151670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506104e0518015615505578082049050905061052052662386f26fc10000610520511015613c60576000613c71565b68056bc75e2d631000006105205111155b1561550557600101818118613bfb5750506104e0516003810490506103a05260006002905b80610500526104e051670de0b6b3a7640000810281670de0b6b3a764000082041861550557905061050051600181116155055760051b6104a0015160038102816003820418615505579050801561550557808204905090506105005160018101818110615505579050600281116155055760051b6103a00152600101818118613c965750506103005160206155bc60003960005163bad1dc26610500526103a051610520526103c051610540526103e051610560526020610500606461051c845afa613d67573d600060003e3d6000fd5b60203d1061550557610500905051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790500461034052670de0b6b3a7640001610340511015613db2576000613de0565b61040051610340518060011b818160011c18615505579050670de0b6b3a76400008103818111615505579050115b15613e27576104a0516040526104c051606052613dfe610500613181565b610500516102a0526104e051600e55610340516011556102a0516003556102a051815250613e3d565b61038051600e55610420516011556102a0518152505b565b61064051610620511461550557610660511561550557613e60610760612e91565b61076080516107205260208101516107405250600b5461076052600c5461078052600d546107a052600154604052613e99610820612fea565b61082080516107c05260208101516107e0526040810151610800525060006108205261064051600281116155055760051b61076001516108405261062051600281116155055760051b6107600151610860526108605161066051808201828110615505579050905061062051600281116155055760051b610760015261062051600281116155055760051b6107600151610620516002811161550557600b01556003546108805261088051604052613f526108e0613026565b6108e080516108a05260208101516108c05250610760516107c051808202811583838304141715615505579050905061076052600160028101905b806108e052670de0b6b3a76400006108e051600281116155055760051b61076001516108e05160018103818111615505579050600181116155055760051b6108a0015180820281158383830414171561550557905090506108e051600281116155055760051b6107c001518082028115838383041417156155055790509050046108e051600281116155055760051b6107600152600101818118613f8d57505061062051600281116155055760051b6107c001516108e052600a54610900524261090051111561418057610860516108e05180820281158383830414171561550557905090506108605261062051156140c857670de0b6b3a7640000610860516106205160018103818111615505579050600181116155055760051b6108a00151808202811583838304141715615505579050905004610860525b61062051600281116155055760051b6107600151610920526108605161062051600281116155055760051b610760015260206155bc600039600051637b12e0096109405261072051610960526107405161098052610760516109a052610780516109c0526107a0516109e0526000610a0052602061094060c461095c845afa614156573d600060003e3d6000fd5b60203d1061550557610940905051600e556109205161062051600281116155055760051b61076001525b600e546109205261064051600281116155055760051b6107c001516109405260206155bc600039600051634a2ab3be6109a052610720516109c052610740516109e05261076051610a005261078051610a20526107a051610a405261092051610a605261064051610a805260406109a060e46109bc845afa614207573d600060003e3d6000fd5b60403d10615505576109a090508051610960526020810151610980525061064051600281116155055760051b61076001516109605180820382811161550557905090506108205261064051600281116155055760051b61076001805161082051808203828111615505579050905081525061082051600181038181116155055790506108205261064051156142eb5761082051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506106405160018103818111615505579050600181116155055760051b6108a0015180156155055780820490509050610820525b610820516109405180156155055780820490509050610820526402540be40061076051606052610780516080526107a05160a05261432a6109c0613088565b6109c051610820518082028115838383041417156155055790509050046109a052610820516109a051808203828111615505579050905061082052610680516108205110156143d95760086109c0527f536c6970706167650000000000000000000000000000000000000000000000006109e0526109c0506109c051806109e001601f826000031636823750506308c379a06109805260206109a052601f19601f6109c051011660440161099cfd5b610840516108205180820382811161550557905090506108405261084051610640516002811161550557600b01556108405161094051808202811583838304141715615505579050905061084052610640511561447857670de0b6b3a7640000610840516106405160018103818111615505579050600181116155055760051b6108a00151808202811583838304141715615505579050905004610840525b6108405161064051600281116155055760051b6107600152602061062051600281116155055760051b60400161559c0160403961066051606052610820516080526106005160a0526106e05160c0526107005160e0526105e051610100526106c051610120526106a051610140526144ee612b1f565b602061064051600281116155055760051b60400161559c01604039610820516060526106a0516080526106c05160a052614526612d7c565b6107205160e0526107405161010052610760516101205261078051610140526107a05161016052600061018052610980516101a0526145666109c06131f4565b6109c051610880526105e0517f143f1f8e861fbdeddd5b46e844b7d3ac7b86a122f36e8c463859ee6811b1f29c610620516109c052610660516109e05261064051610a005261082051610a20526109a051610a405261088051610a605260c06109c0a261082051815250565b60603660603760405160038104905060605260035460c052600160028101905b8060e052604051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506fffffffffffffffffffffffffffffffff60c05116600381028160038204186155055790508015615505578082049050905060e051600281116155055760051b6060015260c05160801c60c0526001018181186145f257505060206155bc60003960005163bad1dc2660e052606051610100526080516101205260a05161014052602060e0606460fc845afa6146b2573d600060003e3d6000fd5b60203d106155055760e0905051815250565b600361024051606052610260516080526102805160a0526146e66102c0613088565b6102c0510260031c6102a05260006102c05260006003905b8060051b6101e001516102e0526102c0516102e05180820182811061550557905090506102c0526001018181186146fe57505060036102c051046102e05260006103005260006003905b8060051b6101e00151610320526102e05161032051116147865761030051610320516102e051038082018281106155055790509050610300526147a6565b610300516102e05161032051038082018281106155055790509050610300525b6001018181186147485750506102a0516103005180820281158383830414171561550557905090506102c05180156155055780820490509050620186a08101818110615505579050815250565b6019546060518082018281106155055790509050601955601760405160205260005260406000208054606051808201828110615505579050905081555060405160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a36001815250565b6019546080526080516060518082028115838383041417156155055790509050670de0b6b3a76400008104905060a05260a0511561490f5760805160a051808201828110615505579050905060195560176040516020526000526040600020805460a051808201828110615505579050905081555060405160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60a05160c052602060c0a35b60a051815250565b600b54606052600c54608052600d5460a05260035460c052600154604052614940610140612fea565b610140805160e0526020810151610100526040810151610120525060605160e0518082028115838383041417156155055790509050606052600160028101905b80610140526fffffffffffffffffffffffffffffffff60c0511661014051600281116155055760051b60e0015180820281158383830414171561550557905090506101605261014051600281116155055760051b60600151610160518082028115838383041417156155055790509050670de0b6b3a76400008104905061014051600281116155055760051b6060015260c05160801c60c0526001018181186149805750506060518152608051602082015260a051604082015250565b614a486101e0612e91565b6101e080516101a05260208101516101c05250600f546101e0526010546102005260195461022052610200516101e0511115614a9257670de0b6b3a763ffff610220511115614a95565b60015b15614a9f57614db2565b60006003905b8061024052602061559c600039600051602061024051600281116155055760051b60400161559c0160003960005118614aee5747610240516002811161550557600b0155614b55565b602061024051600281116155055760051b60400161559c016000396000516370a082316102605230610280526020610260602461027c845afa614b36573d600060003e3d6000fd5b60203d1061550557610260905051610240516002811161550557600b01555b600101818118614aa5575050601154610240526404a817c800610200516101e0510364012a05f20081028164012a05f200820418615505579050046102605260025463cab4d3db6102a05260206102a060046102bc845afa614bbc573d600060003e3d6000fd5b60203d10615505576102a0518060a01c615505576102e0526102e0905051610280526102805115614bf257610260511515614bf5565b60005b15614cdd5761024051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506102405161026051808203828111615505579050905080156155055780820490509050670de0b6b3a764000081038181116155055790506102a052610280516040526102a051606052614c706102e0614868565b6102e0516102c0526101e051610260518060011b818160011c1861550557905080820382811161550557905090506101e0526101e051600f55610280517f6059a38198b1dc42b3791087d1ff0fbd72b3179553c25f678cd246f52ffaaf596102c0516102e05260206102e0a25b60206155bc600039600051637b12e009610320526101a051610340526101c05161036052614d0c6102c0614917565b6102c080516103805260208101516103a05260408101516103c0525060006103e052602061032060c461033c845afa614d4a573d600060003e3d6000fd5b60203d10615505576103209050516102a0526102a051600e556102a051604052614d756102c06145d2565b6102c051670de0b6b3a7640000810281670de0b6b3a7640000820418615505579050601954801561550557808204905090506011556101e0516010555b565b6019546060518082038281116155055790509050601955601760405160205260005260406000208054606051808203828111615505579050905081555060006040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a36001815250565b60195461028052610280516102205111615505576002610240511161550557600b546102a052600c546102c052600d546102e052600154604052614e6e610360612fea565b6103608051610300526020810151610320526040810151610340525061030051610360526103205161038052610340516103a05260006103c05261030051670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506103e05260035461040052610360516102a051808202811583838304141715615505579050905061036052600160028101905b80610420526fffffffffffffffffffffffffffffffff610400511661044052610420516102405118614f5a576104405161024051600281116155055760051b610360015180820281158383830414171561550557905090506103e0525b670de0b6b3a764000061042051600281116155055760051b610360015161042051600281116155055760051b6102a0015180820281158383830414171561550557905090506104405180820281158383830414171561550557905090500461042051600281116155055760051b61036001526104005160801c61040052600101818118614efd57505061026051614ff757600e546103c052615068565b60206155bc600039600051637b12e009610420526101e0516104405261020051610460526103605161048052610380516104a0526103a0516104c05260006104e052602061042060c461043c845afa615055573d600060003e3d6000fd5b60203d10615505576104209050516103c0525b6103c05161042052610360516104405261038051610460526103a0516104805261024051600281116155055760051b61036001516003810281600382041861550557905061022051808202811583838304141715615505579050905061028051801561550557808204905090506104a0526014546040526150ea6104e0612fea565b6104e0602081019050516104c05261024051600281116155055760051b61044001516104a05110156151695761024051600281116155055760051b6104400180516104a051808203828111615505579050905081525061044051606052610460516080526104805160a0526151606104e0613088565b6104e0516104c0525b6102805161022051610420518082028115838383041417156155055790509050046104e0526104c0516104e05180820281158383830414171561550557905090506404a817c800810490506001810181811061550557905061050052610500516003810281600382041861550557905061024051600281116155055760051b6102a001518082028115838383041417156155055790509050610420518015615505578082049050905061052052610420516104e05161050051808203828111615505579050905080820382811161550557905090506104205260206155bc600039600051634a2ab3be610560526101e05161058052610200516105a052610360516105c052610380516105e0526103a0516106005261042051610620526102405161064052604061056060e461057c845afa6152aa573d600060003e3d6000fd5b60403d10615505576105609050516105405261024051600281116155055760051b6103600151610540518082038281116155055790509050670de0b6b3a7640000810281670de0b6b3a76400008204186155055790506103e05180156155055780820490509050610560526105405161024051600281116155055760051b6103600152610560518152610420516020820152604081016103605181526103805160208201526103a0516040820152506105205160a082015250565b60805160605160401b60405160801b1717815250565b608051601860405160205260005260406000208060605160205260005260406000209050556060516040517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560805160a052602060a0a3565b6060513081146153e6578015156153e9565b60005b90501561550557601760405160205260005260406000208054608051808203828111615505579050905081555060176060516020526000526040600020805460805180820182811061550557905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b60206156fc60003960005146146154fa577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac5647260605260206156dc6080397fd61c1033330c368dfc371f5b1e7133f4794e104642e5a3c87aba7a6a3441c8ff60a0524660c0523060e052602061571c6101003960c06040526040805160208201209050815250615503565b602061573c8239505b565b600080fd2ac51535298c001a1927288629082ac527c90c8e296215042ac51d352ac51d0c023611a92ac52ac517e92ac50fdc013f02f92ac52ac519e60f59188014512ac5015f029229322ac52ac52ac521722ac5021611032396036c0d812ac514dc0f3a233f2ac528de2ac50256180b2ac500992ac529be276721280e38034c0bd620402ac52ac50106194f0b9419ae2ac511c9284b8419559c8118921901c0a16576797065728300030a0017
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
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.