ETH Price: $3,924.44 (+5.50%)

Contract

0x95e0A2a90De52C0f03Ba17A0b218442f4f42A78e
Transaction Hash
Method
Block
From
To
Approve1288666802024-12-04 17:08:5719 hrs ago1733332137IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000005990630.00010421
Add_liquidity1288666502024-12-04 17:07:5719 hrs ago1733332077IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000007510630.00100421
Exchange1288666232024-12-04 17:07:0319 hrs ago1733332023IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000006385240.00100428
Approve1288447332024-12-04 4:57:2331 hrs ago1733288243IN
0x95e0A2a9...f4f42A78e
0 ETH0.000000176010.0010007
Add_liquidity1288447122024-12-04 4:56:4131 hrs ago1733288201IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002967980.0010007
Remove_liquidity...1287926782024-12-03 0:02:132 days ago1733184133IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002999130.00100073
Add_liquidity1287507512024-12-02 0:44:393 days ago1733100279IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000001207990.00010058
Approve1287347682024-12-01 15:51:533 days ago1733068313IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000017906280.00010047
Add_liquidity1287347542024-12-01 15:51:253 days ago1733068285IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000019622790.00100047
Remove_liquidity...1287319952024-12-01 14:19:273 days ago1733062767IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000010564620.00100047
Remove_liquidity...1287319942024-12-01 14:19:253 days ago1733062765IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000012057970.00100047
Add_liquidity1287079422024-12-01 0:57:414 days ago1733014661IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002737630.00100533
Remove_liquidity...1286813522024-11-30 10:11:215 days ago1732961481IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002117060.0010009
Remove_liquidity...1286686742024-11-30 3:08:455 days ago1732936125IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000001956790.00100571
Approve1286616672024-11-29 23:15:115 days ago1732922111IN
0x95e0A2a9...f4f42A78e
0 ETH0.000000114680.0010011
Add_liquidity1286616512024-11-29 23:14:395 days ago1732922079IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002282820.00100111
Remove_liquidity...1286510982024-11-29 17:22:535 days ago1732900973IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002816210.0010007
Approve1285955722024-11-28 10:32:017 days ago1732789921IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000027774280.00110031
Add_liquidity1285955532024-11-28 10:31:237 days ago1732789883IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000031013050.0010005
Approve1285885492024-11-28 6:37:557 days ago1732775875IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000001411520.0010025
Add_liquidity1285885392024-11-28 6:37:357 days ago1732775855IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002764950.0010025
Approve1285869662024-11-28 5:45:097 days ago1732772709IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000000844520.00010225
Approve1285869612024-11-28 5:44:597 days ago1732772699IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000000864870.00010226
Approve1285869422024-11-28 5:44:217 days ago1732772661IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000000906870.00010224
Add_liquidity1285869232024-11-28 5:43:437 days ago1732772623IN
0x95e0A2a9...f4f42A78e
0 ETH0.0000002395040.00100225
View all transactions

Latest 1 internal transaction

Advanced mode:
Parent Transaction Hash Block From To
1218761932024-06-25 21:32:43162 days ago1719351163  Contract Creation0 ETH

Loading...
Loading

Similar Match Source Code
This contract matches the deployed Bytecode of the Source Code for Contract 0x635742dC...c042EAfBd
The constructor portion of the code might be different and could alter the actual behaviour of the contract
This is an ERC-5202 Blueprint contract

Contract Name:
CurveStableSwapNG

Compiler Version
vyper:0.3.10

Optimization Enabled:
N/A

Other Settings:
None license

Contract Source Code (Vyper language format)

# pragma version 0.3.10
# pragma optimize codesize
# pragma evm-version paris
"""
@title CurveStableSwapNG
@author Curve.Fi
@license Copyright (c) Curve.Fi, 2020-2023 - all rights reserved
@notice Stableswap implementation for up to 8 coins with no rehypothecation,
        i.e. the AMM does not deposit tokens into other contracts. The Pool contract also
        records exponential moving averages for coins relative to coin 0.
@dev Asset Types:
        0. Standard ERC20 token with no additional features.
                          Note: Users are advised to do careful due-diligence on
                                ERC20 tokens that they interact with, as this
                                contract cannot differentiate between harmless and
                                malicious ERC20 tokens.
        1. Oracle - token with rate oracle (e.g. wstETH)
                    Note: Oracles may be controlled externally by an EOA. Users
                          are advised to proceed with caution.
        2. Rebasing - token with rebase (e.g. stETH).
                      Note: Users and Integrators are advised to understand how
                            the AMM contract works with rebasing balances.
        3. ERC4626 - token with convertToAssets method (e.g. sDAI).
                     Note: Some ERC4626 implementations may be susceptible to
                           Donation/Inflation attacks. Users are advised to
                           proceed with caution.
        NOTE: Pool Cannot support tokens with multiple asset types: e.g. ERC4626
              with fees are not supported.
     Supports:
        1. ERC20 support for return True/revert, return True/False, return None
        2. ERC20 tokens can have arbitrary decimals (<=18).
        3. ERC20 tokens that rebase (either positive or fee on transfer)
        4. ERC20 tokens that have a rate oracle (e.g. wstETH, cbETH, sDAI, etc.)
           Note: Oracle precision _must_ be 10**18.
        5. ERC4626 tokens with arbitrary precision (<=18) of Vault token and underlying
           asset.
     Additional features include:
        1. Adds price oracles based on AMM State Price (and _not_ last traded price).
        2. Adds TVL oracle based on D.
        3. `exchange_received`: swaps that expect an ERC20 transfer to have occurred
           prior to executing the swap.
           Note: a. If pool contains rebasing tokens and one of the `asset_types` is 2 (Rebasing)
                    then calling `exchange_received` will REVERT.
                 b. If pool contains rebasing token and `asset_types` does not contain 2 (Rebasing)
                    then this is an incorrect implementation and rebases can be
                    stolen.
        4. Adds `get_dx`: Similar to `get_dy` which returns an expected output
           of coin[j] for given `dx` amount of coin[i], `get_dx` returns expected
           input of coin[i] for an output amount of coin[j].
        5. Fees are dynamic: AMM will charge a higher fee if pool depegs. This can cause very
                             slight discrepancies between calculated fees and realised fees.
"""

from vyper.interfaces import ERC20
from vyper.interfaces import ERC20Detailed
from vyper.interfaces import ERC4626

implements: ERC20

# ------------------------------- Interfaces ---------------------------------

interface Factory:
    def fee_receiver() -> address: view
    def admin() -> address: view
    def views_implementation() -> address: view

interface ERC1271:
    def isValidSignature(_hash: bytes32, _signature: Bytes[65]) -> bytes32: view

interface StableSwapViews:
    def get_dx(i: int128, j: int128, dy: uint256, pool: address) -> uint256: view
    def get_dy(i: int128, j: int128, dx: uint256, pool: address) -> uint256: view
    def dynamic_fee(i: int128, j: int128, pool: address) -> uint256: view
    def calc_token_amount(
        _amounts: DynArray[uint256, MAX_COINS],
        _is_deposit: bool,
        _pool: 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: int128
    tokens_sold: uint256
    bought_id: int128
    tokens_bought: uint256

event TokenExchangeUnderlying:
    buyer: indexed(address)
    sold_id: int128
    tokens_sold: uint256
    bought_id: int128
    tokens_bought: uint256

event AddLiquidity:
    provider: indexed(address)
    token_amounts: DynArray[uint256, MAX_COINS]
    fees: DynArray[uint256, MAX_COINS]
    invariant: uint256
    token_supply: uint256

event RemoveLiquidity:
    provider: indexed(address)
    token_amounts: DynArray[uint256, MAX_COINS]
    fees: DynArray[uint256, MAX_COINS]
    token_supply: uint256

event RemoveLiquidityOne:
    provider: indexed(address)
    token_id: int128
    token_amount: uint256
    coin_amount: uint256
    token_supply: uint256

event RemoveLiquidityImbalance:
    provider: indexed(address)
    token_amounts: DynArray[uint256, MAX_COINS]
    fees: DynArray[uint256, MAX_COINS]
    invariant: uint256
    token_supply: uint256

event RampA:
    old_A: uint256
    new_A: uint256
    initial_time: uint256
    future_time: uint256

event StopRampA:
    A: uint256
    t: uint256

event ApplyNewFee:
    fee: uint256
    offpeg_fee_multiplier: uint256

event SetNewMATime:
    ma_exp_time: uint256
    D_ma_time: uint256


MAX_COINS: constant(uint256) = 8  # max coins is 8 in the factory
MAX_COINS_128: constant(int128) = 8

# ---------------------------- Pool Variables --------------------------------

N_COINS: public(immutable(uint256))
N_COINS_128: immutable(int128)
PRECISION: constant(uint256) = 10 ** 18

factory: immutable(Factory)
coins: public(immutable(DynArray[address, MAX_COINS]))
asset_types: immutable(DynArray[uint8, MAX_COINS])
pool_contains_rebasing_tokens: immutable(bool)
stored_balances: DynArray[uint256, MAX_COINS]

# Fee specific vars
FEE_DENOMINATOR: constant(uint256) = 10 ** 10
fee: public(uint256)  # fee * 1e10
offpeg_fee_multiplier: public(uint256)  # * 1e10
admin_fee: public(constant(uint256)) = 5000000000
MAX_FEE: constant(uint256) = 5 * 10 ** 9

# ---------------------- Pool Amplification Parameters -----------------------

A_PRECISION: constant(uint256) = 100
MAX_A: constant(uint256) = 10 ** 6
MAX_A_CHANGE: constant(uint256) = 10

initial_A: public(uint256)
future_A: public(uint256)
initial_A_time: public(uint256)
future_A_time: public(uint256)

# ---------------------------- Admin Variables -------------------------------

MIN_RAMP_TIME: constant(uint256) = 86400
admin_balances: public(DynArray[uint256, MAX_COINS])

# ----------------------- Oracle Specific vars -------------------------------

rate_multipliers: immutable(DynArray[uint256, MAX_COINS])
# [bytes4 method_id][bytes8 <empty>][bytes20 oracle]
rate_oracles: immutable(DynArray[uint256, MAX_COINS])

# For ERC4626 tokens, we need:
call_amount: immutable(DynArray[uint256, MAX_COINS])
scale_factor: immutable(DynArray[uint256, MAX_COINS])

last_prices_packed: DynArray[uint256, MAX_COINS]  #  packing: last_price, ma_price
last_D_packed: uint256                            #  packing: last_D, ma_D
ma_exp_time: public(uint256)
D_ma_time: public(uint256)
ma_last_time: public(uint256)                     # packing: ma_last_time_p, ma_last_time_D
# ma_last_time has a distinction for p and D because p is _not_ updated if
# users remove_liquidity, but D is.

# shift(2**32 - 1, 224)
ORACLE_BIT_MASK: constant(uint256) = (2**32 - 1) * 256**28

# --------------------------- ERC20 Specific Vars ----------------------------

name: public(immutable(String[64]))
symbol: public(immutable(String[32]))
decimals: public(constant(uint8)) = 18
version: public(constant(String[8])) = "v7.0.0"

balanceOf: public(HashMap[address, uint256])
allowance: public(HashMap[address, HashMap[address, uint256]])
total_supply: uint256
nonces: public(HashMap[address, uint256])

# keccak256("isValidSignature(bytes32,bytes)")[:4] << 224
ERC1271_MAGIC_VAL: constant(bytes32) = 0x1626ba7e00000000000000000000000000000000000000000000000000000000
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)


# ------------------------------ AMM Setup -----------------------------------


@external
def __init__(
    _name: String[32],
    _symbol: String[10],
    _A: uint256,
    _fee: uint256,
    _offpeg_fee_multiplier: uint256,
    _ma_exp_time: uint256,
    _coins: DynArray[address, MAX_COINS],
    _rate_multipliers: DynArray[uint256, MAX_COINS],
    _asset_types: DynArray[uint8, MAX_COINS],
    _method_ids: DynArray[bytes4, MAX_COINS],
    _oracles: DynArray[address, MAX_COINS],
):
    """
    @notice Initialize the pool contract
    @param _name Name of the new plain pool.
    @param _symbol Symbol for the new plain pool.
    @param _A Amplification co-efficient - a lower value here means
              less tolerance for imbalance within the pool's assets.
              Suggested values include:
               * Uncollateralized algorithmic stablecoins: 5-10
               * Non-redeemable, collateralized assets: 100
               * Redeemable assets: 200-400
    @param _fee Trade fee, given as an integer with 1e10 precision. The
                the maximum is 1% (100000000).
                50% of the fee is distributed to veCRV holders.
    @param _offpeg_fee_multiplier A multiplier that determines how much to increase
                                  Fees by when assets in the AMM depeg. Example value: 20000000000
    @param _ma_exp_time Averaging window of oracle. Set as time_in_seconds / ln(2)
                        Example: for 10 minute EMA, _ma_exp_time is 600 / ln(2) ~= 866
    @param _coins List of addresses of the coins being used in the pool.
    @param _rate_multipliers An array of: [10 ** (36 - _coins[n].decimals()), ... for n in range(N_COINS)]
    @param _asset_types Array of uint8 representing tokens in pool
    @param _method_ids Array of first four bytes of the Keccak-256 hash of the function signatures
                       of the oracle addresses that gives rate oracles.
                       Calculated as: keccak(text=event_signature.replace(" ", ""))[:4]
    @param _oracles Array of rate oracle addresses.
    """

    coins = _coins
    asset_types = _asset_types
    pool_contains_rebasing_tokens = 2 in asset_types
    __n_coins: uint256 = len(_coins)
    N_COINS = __n_coins
    N_COINS_128 = convert(__n_coins, int128)

    rate_multipliers = _rate_multipliers

    factory = Factory(msg.sender)

    A: uint256 = unsafe_mul(_A, A_PRECISION)
    self.initial_A = A
    self.future_A = A
    self.fee = _fee
    self.offpeg_fee_multiplier = _offpeg_fee_multiplier

    assert _ma_exp_time != 0
    self.ma_exp_time = _ma_exp_time
    self.D_ma_time = 62324  # <--------- 12 hours default on contract start.
    self.ma_last_time = self.pack_2(block.timestamp, block.timestamp)

    #  ------------------- initialize storage for DynArrays ------------------

    _call_amount: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    _scale_factor: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    _rate_oracles: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    for i in range(N_COINS_128, bound=MAX_COINS_128):

        if i < N_COINS_128 - 1:
            self.last_prices_packed.append(self.pack_2(10**18, 10**18))

        _rate_oracles.append(convert(_method_ids[i], uint256) * 2**224 | convert(_oracles[i], uint256))
        self.stored_balances.append(0)
        self.admin_balances.append(0)

        if _asset_types[i] == 3:

            _call_amount.append(10**convert(ERC20Detailed(_coins[i]).decimals(), uint256))
            _underlying_asset: address = ERC4626(_coins[i]).asset()
            _scale_factor.append(10**(18 - convert(ERC20Detailed(_underlying_asset).decimals(), uint256)))

        else:

            _call_amount.append(0)
            _scale_factor.append(0)

    call_amount = _call_amount
    scale_factor = _scale_factor
    rate_oracles = _rate_oracles

    # ----------------------------- ERC20 stuff ------------------------------

    name = _name
    symbol = _symbol

    # EIP712 related params -----------------
    NAME_HASH = keccak256(name)
    salt = block.prevhash
    CACHED_CHAIN_ID = chain.id
    CACHED_DOMAIN_SEPARATOR = keccak256(
        _abi_encode(
            EIP712_TYPEHASH,
            NAME_HASH,
            VERSION_HASH,
            chain.id,
            self,
            salt,
        )
    )

    # ------------------------ Fire a transfer event -------------------------

    log Transfer(empty(address), msg.sender, 0)


# ------------------ Token transfers in and out of the AMM -------------------


@internal
def _transfer_in(
    coin_idx: int128,
    dx: uint256,
    sender: address,
    expect_optimistic_transfer: bool,
) -> uint256:
    """
    @notice Contains all logic to handle ERC20 token transfers.
    @param coin_idx Index of the coin to transfer in.
    @param dx amount of `_coin` to transfer into the pool.
    @param sender address to transfer `_coin` from.
    @param receiver address to transfer `_coin` to.
    @param expect_optimistic_transfer True if contract expects an optimistic coin transfer
    """
    _dx: uint256 = ERC20(coins[coin_idx]).balanceOf(self)

    # ------------------------- Handle Transfers -----------------------------

    if expect_optimistic_transfer:

        _dx = _dx - self.stored_balances[coin_idx]
        assert _dx >= dx

    else:

        assert dx > 0  # dev : do not transferFrom 0 tokens into the pool
        assert ERC20(coins[coin_idx]).transferFrom(
            sender, self, dx, default_return_value=True
        )

        _dx = ERC20(coins[coin_idx]).balanceOf(self) - _dx

    # --------------------------- Store transferred in amount ---------------------------

    self.stored_balances[coin_idx] += _dx

    return _dx


@internal
def _transfer_out(_coin_idx: int128, _amount: uint256, receiver: address):
    """
    @notice Transfer a single token from the pool to receiver.
    @dev This function is called by `remove_liquidity` and
         `remove_liquidity_one_coin`, `_exchange`, `_withdraw_admin_fees` and
         `remove_liquidity_imbalance` methods.
    @param _coin_idx Index of the token to transfer out
    @param _amount Amount of token to transfer out
    @param receiver Address to send the tokens to
    """
    assert receiver != empty(address)  # dev: do not send tokens to zero_address

    if not pool_contains_rebasing_tokens:

        # we need not cache balanceOf pool before swap out
        self.stored_balances[_coin_idx] -= _amount
        assert ERC20(coins[_coin_idx]).transfer(
            receiver, _amount, default_return_value=True
        )

    else:

        # cache balances pre and post to account for fee on transfers etc.
        coin_balance: uint256 = ERC20(coins[_coin_idx]).balanceOf(self)
        assert ERC20(coins[_coin_idx]).transfer(
            receiver, _amount, default_return_value=True
        )
        self.stored_balances[_coin_idx] = coin_balance - _amount


# -------------------------- AMM Special Methods -----------------------------


@view
@internal
def _stored_rates() -> DynArray[uint256, MAX_COINS]:
    """
    @notice Gets rate multipliers for each coin.
    @dev If the coin has a rate oracle that has been properly initialised,
         this method queries that rate by static-calling an external
         contract.
    """
    rates: DynArray[uint256, MAX_COINS] = rate_multipliers

    for i in range(N_COINS_128, bound=MAX_COINS_128):

        if asset_types[i] == 1 and not rate_oracles[i] == 0:

            # NOTE: fetched_rate is assumed to be 10**18 precision
            oracle_response: Bytes[32] = raw_call(
                convert(rate_oracles[i] % 2**160, address),
                _abi_encode(rate_oracles[i] & ORACLE_BIT_MASK),
                max_outsize=32,
                is_static_call=True,
            )
            assert len(oracle_response) == 32
            fetched_rate: uint256 = convert(oracle_response, uint256)

            rates[i] = unsafe_div(rates[i] * fetched_rate, PRECISION)

        elif asset_types[i] == 3:  # ERC4626

            # fetched_rate: uint256 = ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i]
            # here: call_amount has ERC4626 precision, but the returned value is scaled up to 18
            # using scale_factor which is (18 - n) if underlying asset has n decimals.
            rates[i] = unsafe_div(
                rates[i] * ERC4626(coins[i]).convertToAssets(call_amount[i]) * scale_factor[i],
                PRECISION
            )  # 1e18 precision

    return rates


@view
@internal
def _balances() -> DynArray[uint256, MAX_COINS]:
    """
    @notice Calculates the pool's balances _excluding_ the admin's balances.
    @dev If the pool contains rebasing tokens, this method ensures LPs keep all
            rebases and admin only claims swap fees. This also means that, since
            admin's balances are stored in an array and not inferred from read balances,
            the fees in the rebasing token that the admin collects is immune to
            slashing events.
    """
    result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    balances_i: uint256 = 0

    for i in range(N_COINS_128, bound=MAX_COINS_128):

        if pool_contains_rebasing_tokens:
            # Read balances by gulping to account for rebases
            balances_i = ERC20(coins[i]).balanceOf(self) - self.admin_balances[i]
        else:
            # Use cached balances
            balances_i = self.stored_balances[i] - self.admin_balances[i]

        result.append(balances_i)

    return result


# -------------------------- AMM Main Functions ------------------------------


@external
@nonreentrant('lock')
def exchange(
    i: int128,
    j: int128,
    _dx: uint256,
    _min_dy: uint256,
    _receiver: address = msg.sender,
) -> uint256:
    """
    @notice Perform an exchange between two coins
    @dev Index values can be found via the `coins` public getter method
    @param i Index value for the coin to send
    @param j Index value of the coin to receive
    @param _dx Amount of `i` being exchanged
    @param _min_dy Minimum amount of `j` to receive
    @param _receiver Address that receives `j`
    @return Actual amount of `j` received
    """
    return self._exchange(
        msg.sender,
        i,
        j,
        _dx,
        _min_dy,
        _receiver,
        False
    )


@external
@nonreentrant('lock')
def exchange_received(
    i: int128,
    j: int128,
    _dx: uint256,
    _min_dy: uint256,
    _receiver: address = msg.sender,
) -> uint256:
    """
    @notice Perform an exchange between two coins without transferring token in
    @dev The contract swaps tokens based on a change in balance of coin[i]. The
         dx = ERC20(coin[i]).balanceOf(self) - self.stored_balances[i]. Users of
         this method are dex aggregators, arbitrageurs, or other users who do not
         wish to grant approvals to the contract: they would instead send tokens
         directly to the contract and call `exchange_received`.
         Note: This is disabled if pool contains rebasing tokens.
    @param i Index value for the coin to send
    @param j Index value of the coin to receive
    @param _dx Amount of `i` being exchanged
    @param _min_dy Minimum amount of `j` to receive
    @param _receiver Address that receives `j`
    @return Actual amount of `j` received
    """
    assert not pool_contains_rebasing_tokens  # dev: exchange_received not supported if pool contains rebasing tokens
    return self._exchange(
        msg.sender,
        i,
        j,
        _dx,
        _min_dy,
        _receiver,
        True,  # <--------------------------------------- swap optimistically.
    )


@external
@nonreentrant('lock')
def add_liquidity(
    _amounts: DynArray[uint256, MAX_COINS],
    _min_mint_amount: uint256,
    _receiver: address = msg.sender
) -> uint256:
    """
    @notice Deposit coins into the pool
    @param _amounts List of amounts of coins to deposit
    @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit
    @param _receiver Address that owns the minted LP tokens
    @return Amount of LP tokens received by depositing
    """
    assert _receiver != empty(address)  # dev: do not send LP tokens to zero_address

    amp: uint256 = self._A()
    old_balances: DynArray[uint256, MAX_COINS] = self._balances()
    rates: DynArray[uint256, MAX_COINS] = self._stored_rates()

    # Initial invariant
    D0: uint256 = self.get_D_mem(rates, old_balances, amp)

    total_supply: uint256 = self.total_supply
    new_balances: DynArray[uint256, MAX_COINS] = old_balances

    # -------------------------- Do Transfers In -----------------------------

    for i in range(N_COINS_128, bound=MAX_COINS_128):

        if _amounts[i] > 0:

            new_balances[i] += self._transfer_in(
                i,
                _amounts[i],
                msg.sender,
                False,  # expect_optimistic_transfer
            )

        else:

            assert total_supply != 0  # dev: initial deposit requires all coins

    # ------------------------------------------------------------------------

    # Invariant after change
    D1: uint256 = self.get_D_mem(rates, new_balances, amp)
    assert D1 > D0

    # We need to recalculate the invariant accounting for fees
    # to calculate fair user's share
    fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    mint_amount: uint256 = 0

    if total_supply > 0:

        ideal_balance: uint256 = 0
        difference: uint256 = 0
        new_balance: uint256 = 0

        ys: uint256 = unsafe_div(D0 + D1, N_COINS)
        xs: uint256 = 0
        _dynamic_fee_i: uint256 = 0

        # Only account for fees if we are not the first to deposit
        base_fee: uint256 = unsafe_div(
            unsafe_mul(self.fee, N_COINS),
            unsafe_mul(4, unsafe_sub(N_COINS, 1))
        )

        for i in range(N_COINS_128, bound=MAX_COINS_128):

            ideal_balance = D1 * old_balances[i] / D0
            difference = 0
            new_balance = new_balances[i]

            if ideal_balance > new_balance:
                difference = unsafe_sub(ideal_balance, new_balance)
            else:
                difference = unsafe_sub(new_balance, ideal_balance)

            # fee[i] = _dynamic_fee(i, j) * difference / FEE_DENOMINATOR
            xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION)
            _dynamic_fee_i = self._dynamic_fee(xs, ys, base_fee)
            fees.append(unsafe_div(_dynamic_fee_i * difference, FEE_DENOMINATOR))
            self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR)
            new_balances[i] -= fees[i]

        xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, new_balances)
        D1 = self.get_D(xp, amp)  # <--------------- Reuse D1 for new D value.
        mint_amount = unsafe_div(total_supply * (D1 - D0), D0)
        self.upkeep_oracles(xp, amp, D1)

    else:

        mint_amount = D1  # Take the dust if there was any

        # (re)instantiate D oracle if totalSupply is zero.
        self.last_D_packed = self.pack_2(D1, D1)

        # Update D ma time:
        ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time)
        if ma_last_time_unpacked[1] < block.timestamp:
            ma_last_time_unpacked[1] = block.timestamp
            self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1])

    assert mint_amount >= _min_mint_amount, "Slippage screwed you"

    # Mint pool tokens
    total_supply += mint_amount
    self.balanceOf[_receiver] += mint_amount
    self.total_supply = total_supply
    log Transfer(empty(address), _receiver, mint_amount)

    log AddLiquidity(msg.sender, _amounts, fees, D1, total_supply)

    return mint_amount


@external
@nonreentrant('lock')
def remove_liquidity_one_coin(
    _burn_amount: uint256,
    i: int128,
    _min_received: uint256,
    _receiver: address = msg.sender,
) -> uint256:
    """
    @notice Withdraw a single coin from the pool
    @param _burn_amount Amount of LP tokens to burn in the withdrawal
    @param i Index value of the coin to withdraw
    @param _min_received Minimum amount of coin to receive
    @param _receiver Address that receives the withdrawn coins
    @return Amount of coin received
    """
    assert _burn_amount > 0  # dev: do not remove 0 LP tokens
    dy: uint256 = 0
    fee: uint256 = 0
    xp: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    amp: uint256 = empty(uint256)
    D: uint256 = empty(uint256)

    dy, fee, xp, amp, D = self._calc_withdraw_one_coin(_burn_amount, i)
    assert dy >= _min_received, "Not enough coins removed"

    self.admin_balances[i] += unsafe_div(fee * admin_fee, FEE_DENOMINATOR)

    self._burnFrom(msg.sender, _burn_amount)

    self._transfer_out(i, dy, _receiver)

    log RemoveLiquidityOne(msg.sender, i, _burn_amount, dy, self.total_supply)

    self.upkeep_oracles(xp, amp, D)

    return dy


@external
@nonreentrant('lock')
def remove_liquidity_imbalance(
    _amounts: DynArray[uint256, MAX_COINS],
    _max_burn_amount: uint256,
    _receiver: address = msg.sender
) -> uint256:
    """
    @notice Withdraw coins from the pool in an imbalanced amount
    @param _amounts List of amounts of underlying coins to withdraw
    @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal
    @param _receiver Address that receives the withdrawn coins
    @return Actual amount of the LP token burned in the withdrawal
    """
    amp: uint256 = self._A()
    rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
    old_balances: DynArray[uint256, MAX_COINS] = self._balances()
    D0: uint256 = self.get_D_mem(rates, old_balances, amp)
    new_balances: DynArray[uint256, MAX_COINS] = old_balances

    for i in range(N_COINS_128, bound=MAX_COINS_128):

        if _amounts[i] != 0:
            new_balances[i] -= _amounts[i]
            self._transfer_out(i, _amounts[i], _receiver)

    D1: uint256 = self.get_D_mem(rates, new_balances, amp)
    base_fee: uint256 = unsafe_div(
        unsafe_mul(self.fee, N_COINS),
        unsafe_mul(4, unsafe_sub(N_COINS, 1))
    )
    ys: uint256 = unsafe_div((D0 + D1), N_COINS)

    fees: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    dynamic_fee: uint256 = 0
    xs: uint256 = 0
    ideal_balance: uint256 = 0
    difference: uint256 = 0
    new_balance: uint256 = 0

    for i in range(N_COINS_128, bound=MAX_COINS_128):

        ideal_balance = D1 * old_balances[i] / D0
        difference = 0
        new_balance = new_balances[i]

        if ideal_balance > new_balance:
            difference = unsafe_sub(ideal_balance, new_balance)
        else:
            difference = unsafe_sub(new_balance, ideal_balance)

        xs = unsafe_div(rates[i] * (old_balances[i] + new_balance), PRECISION)
        dynamic_fee = self._dynamic_fee(xs, ys, base_fee)
        fees.append(unsafe_div(dynamic_fee * difference, FEE_DENOMINATOR))

        self.admin_balances[i] += unsafe_div(fees[i] * admin_fee, FEE_DENOMINATOR)
        new_balances[i] -= fees[i]

    D1 = self.get_D_mem(rates, new_balances, amp)  # dev: reuse D1 for new D.
    self.upkeep_oracles(self._xp_mem(rates, new_balances), amp, D1)

    total_supply: uint256 = self.total_supply
    burn_amount: uint256 = unsafe_div((D0 - D1) * total_supply, D0) + 1
    assert burn_amount > 1  # dev: zero tokens burned
    assert burn_amount <= _max_burn_amount, "Slippage screwed you"

    self._burnFrom(msg.sender, burn_amount)

    log RemoveLiquidityImbalance(
        msg.sender,
        _amounts,
        fees,
        D1,
        total_supply - burn_amount
    )

    return burn_amount


@external
@nonreentrant('lock')
def remove_liquidity(
    _burn_amount: uint256,
    _min_amounts: DynArray[uint256, MAX_COINS],
    _receiver: address = msg.sender,
    _claim_admin_fees: bool = True,
) -> DynArray[uint256, MAX_COINS]:
    """
    @notice Withdraw coins from the pool
    @dev Withdrawal amounts are based on current deposit ratios
    @param _burn_amount Quantity of LP tokens to burn in the withdrawal
    @param _min_amounts Minimum amounts of underlying coins to receive
    @param _receiver Address that receives the withdrawn coins
    @return List of amounts of coins that were withdrawn
    """
    total_supply: uint256 = self.total_supply
    assert _burn_amount > 0  # dev: invalid burn amount
    assert len(_min_amounts) == N_COINS  # dev: invalid array length for _min_amounts

    amounts: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    balances: DynArray[uint256, MAX_COINS] = self._balances()

    value: uint256 = 0
    for i in range(N_COINS_128, bound=MAX_COINS_128):

        value = unsafe_div(balances[i] * _burn_amount, total_supply)
        assert value >= _min_amounts[i], "Withdrawal resulted in fewer coins than expected"
        amounts.append(value)
        self._transfer_out(i, value, _receiver)

    self._burnFrom(msg.sender, _burn_amount)  # <---- Updates self.total_supply

    # --------------------------- Upkeep D_oracle ----------------------------

    ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time)
    last_D_packed_current: uint256 = self.last_D_packed
    old_D: uint256 = last_D_packed_current & (2**128 - 1)

    self.last_D_packed = self.pack_2(
        old_D - unsafe_div(old_D * _burn_amount, total_supply),  # new_D = proportionally reduce D.
        self._calc_moving_average(
            last_D_packed_current,
            self.D_ma_time,
            ma_last_time_unpacked[1]
        )
    )

    if ma_last_time_unpacked[1] < block.timestamp:
        ma_last_time_unpacked[1] = block.timestamp
        self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1])

    # ------------------------------- Log event ------------------------------

    log RemoveLiquidity(
        msg.sender,
        amounts,
        empty(DynArray[uint256, MAX_COINS]),
        unsafe_sub(total_supply, _burn_amount)
    )

    # ------- Withdraw admin fees if _claim_admin_fees is set to True --------
    if _claim_admin_fees:
        self._withdraw_admin_fees()

    return amounts


@external
@nonreentrant('lock')
def withdraw_admin_fees():
    """
    @notice Claim admin fees. Callable by anyone.
    """
    self._withdraw_admin_fees()


# ------------------------ AMM Internal Functions ----------------------------


@view
@internal
def _dynamic_fee(xpi: uint256, xpj: uint256, _fee: uint256) -> uint256:

    _offpeg_fee_multiplier: uint256 = self.offpeg_fee_multiplier
    if _offpeg_fee_multiplier <= FEE_DENOMINATOR:
        return _fee

    xps2: uint256 = (xpi + xpj) ** 2
    return unsafe_div(
        unsafe_mul(_offpeg_fee_multiplier, _fee),
        unsafe_add(
            unsafe_sub(_offpeg_fee_multiplier, FEE_DENOMINATOR) * 4 * xpi * xpj / xps2,
            FEE_DENOMINATOR
        )
    )


@internal
def __exchange(
    x: uint256,
    _xp: DynArray[uint256, MAX_COINS],
    rates: DynArray[uint256, MAX_COINS],
    i: int128,
    j: int128,
) -> uint256:

    amp: uint256 = self._A()
    D: uint256 = self.get_D(_xp, amp)
    y: uint256 = self.get_y(i, j, x, _xp, amp, D)

    dy: uint256 = _xp[j] - y - 1  # -1 just in case there were some rounding errors
    dy_fee: uint256 = unsafe_div(
        dy * self._dynamic_fee(
            unsafe_div(_xp[i] + x, 2), unsafe_div(_xp[j] + y, 2), self.fee
        ),
        FEE_DENOMINATOR
    )

    # Convert all to real units
    dy = (dy - dy_fee) * PRECISION / rates[j]

    self.admin_balances[j] += unsafe_div(
        unsafe_div(dy_fee * admin_fee, FEE_DENOMINATOR) * PRECISION,
        rates[j]
    )

    # Calculate and store state prices:
    xp: DynArray[uint256, MAX_COINS] = _xp
    xp[i] = x
    xp[j] = y
    # D is not changed because we did not apply a fee
    self.upkeep_oracles(xp, amp, D)

    return dy


@internal
def _exchange(
    sender: address,
    i: int128,
    j: int128,
    _dx: uint256,
    _min_dy: uint256,
    receiver: address,
    expect_optimistic_transfer: bool
) -> uint256:

    assert i != j  # dev: coin index out of range
    assert _dx > 0  # dev: do not exchange 0 coins

    rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
    old_balances: DynArray[uint256, MAX_COINS] = self._balances()
    xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, old_balances)

    # --------------------------- Do Transfer in -----------------------------

    # `dx` is whatever the pool received after ERC20 transfer:
    dx: uint256 = self._transfer_in(
        i,
        _dx,
        sender,
        expect_optimistic_transfer
    )

    # ------------------------------- Exchange -------------------------------

    x: uint256 = xp[i] + unsafe_div(dx * rates[i], PRECISION)
    dy: uint256 = self.__exchange(x, xp, rates, i, j)
    assert dy >= _min_dy, "Exchange resulted in fewer coins than expected"

    # --------------------------- Do Transfer out ----------------------------

    self._transfer_out(j, dy, receiver)

    # ------------------------------------------------------------------------

    log TokenExchange(msg.sender, i, dx, j, dy)

    return dy


@internal
def _withdraw_admin_fees():
    fee_receiver: address = factory.fee_receiver()
    if fee_receiver == empty(address):
        return  # Do nothing.

    admin_balances: DynArray[uint256, MAX_COINS] = self.admin_balances
    for i in range(N_COINS_128, bound=MAX_COINS_128):

        if admin_balances[i] > 0:

            self._transfer_out(i, admin_balances[i], fee_receiver)
            admin_balances[i] = 0

    self.admin_balances = admin_balances


# --------------------------- AMM Math Functions -----------------------------


@view
@internal
def get_y(
    i: int128,
    j: int128,
    x: uint256,
    xp: DynArray[uint256, MAX_COINS],
    _amp: uint256,
    _D: uint256
) -> uint256:
    """
    Calculate x[j] if one makes x[i] = x

    Done by solving quadratic equation iteratively.
    x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
    x_1**2 + b*x_1 = c

    x_1 = (x_1**2 + c) / (2*x_1 + b)
    """
    # x in the input is converted to the same price/precision

    assert i != j       # dev: same coin
    assert j >= 0       # dev: j below zero
    assert j < N_COINS_128  # dev: j above N_COINS

    # should be unreachable, but good for safety
    assert i >= 0
    assert i < N_COINS_128

    amp: uint256 = _amp
    D: uint256 = _D

    S_: uint256 = 0
    _x: uint256 = 0
    y_prev: uint256 = 0
    c: uint256 = D
    Ann: uint256 = amp * N_COINS

    for _i in range(MAX_COINS_128):

        if _i == N_COINS_128:
            break

        if _i == i:
            _x = x
        elif _i != j:
            _x = xp[_i]
        else:
            continue

        S_ += _x
        c = c * D / (_x * N_COINS)

    c = c * D * A_PRECISION / (Ann * N_COINS)
    b: uint256 = S_ + D * A_PRECISION / Ann  # - D
    y: uint256 = D

    for _i in range(255):
        y_prev = y
        y = (y*y + c) / (2 * y + b - D)
        # Equality with the precision of 1
        if y > y_prev:
            if y - y_prev <= 1:
                return y
        else:
            if y_prev - y <= 1:
                return y
    raise


@pure
@internal
def get_D(_xp: DynArray[uint256, MAX_COINS], _amp: uint256) -> uint256:
    """
    D invariant calculation in non-overflowing integer operations
    iteratively

    A * sum(x_i) * n**n + D = A * D * n**n + D**(n+1) / (n**n * prod(x_i))

    Converging solution:
    D[j+1] = (A * n**n * sum(x_i) - D[j]**(n+1) / (n**n prod(x_i))) / (A * n**n - 1)
    """
    S: uint256 = 0
    for x in _xp:
        S += x
    if S == 0:
        return 0

    D: uint256 = S
    Ann: uint256 = _amp * N_COINS

    for i in range(255):

        D_P: uint256 = D
        for x in _xp:
            D_P = D_P * D / x
        D_P /= pow_mod256(N_COINS, N_COINS)
        Dprev: uint256 = D

        # (Ann * S / A_PRECISION + D_P * N_COINS) * D / ((Ann - A_PRECISION) * D / A_PRECISION + (N_COINS + 1) * D_P)
        D = (
            (unsafe_div(Ann * S, A_PRECISION) + D_P * N_COINS) * D
            /
            (
                unsafe_div((Ann - A_PRECISION) * D, A_PRECISION) +
                unsafe_add(N_COINS, 1) * D_P
            )
        )

        # Equality with the precision of 1
        if D > Dprev:
            if D - Dprev <= 1:
                return D
        else:
            if Dprev - D <= 1:
                return D
    # convergence typically occurs in 4 rounds or less, this should be unreachable!
    # if it does happen the pool is borked and LPs can withdraw via `remove_liquidity`
    raise


@pure
@internal
def get_y_D(
    A: uint256,
    i: int128,
    xp: DynArray[uint256, MAX_COINS],
    D: uint256
) -> uint256:
    """
    Calculate x[i] if one reduces D from being calculated for xp to D

    Done by solving quadratic equation iteratively.
    x_1**2 + x_1 * (sum' - (A*n**n - 1) * D / (A * n**n)) = D ** (n + 1) / (n ** (2 * n) * prod' * A)
    x_1**2 + b*x_1 = c

    x_1 = (x_1**2 + c) / (2*x_1 + b)
    """
    # x in the input is converted to the same price/precision

    assert i >= 0  # dev: i below zero
    assert i < N_COINS_128  # dev: i above N_COINS

    S_: uint256 = 0
    _x: uint256 = 0
    y_prev: uint256 = 0
    c: uint256 = D
    Ann: uint256 = A * N_COINS

    for _i in range(MAX_COINS_128):

        if _i == N_COINS_128:
            break

        if _i != i:
            _x = xp[_i]
        else:
            continue
        S_ += _x
        c = c * D / (_x * N_COINS)

    c = c * D * A_PRECISION / (Ann * N_COINS)
    b: uint256 = S_ + D * A_PRECISION / Ann
    y: uint256 = D

    for _i in range(255):
        y_prev = y
        y = (y*y + c) / (2 * y + b - D)
        # Equality with the precision of 1
        if y > y_prev:
            if y - y_prev <= 1:
                return y
        else:
            if y_prev - y <= 1:
                return y
    raise


@view
@internal
def _A() -> uint256:
    """
    Handle ramping A up or down
    """
    t1: uint256 = self.future_A_time
    A1: uint256 = self.future_A

    if block.timestamp < t1:
        A0: uint256 = self.initial_A
        t0: uint256 = self.initial_A_time
        # Expressions in uint256 cannot have negative numbers, thus "if"
        if A1 > A0:
            return A0 + unsafe_sub(A1, A0) * (block.timestamp - t0) / (t1 - t0)
        else:
            return A0 - unsafe_sub(A0, A1) * (block.timestamp - t0) / (t1 - t0)

    else:  # when t1 == 0 or block.timestamp >= t1
        return A1


@pure
@internal
def _xp_mem(
    _rates: DynArray[uint256, MAX_COINS],
    _balances: DynArray[uint256, MAX_COINS]
) -> DynArray[uint256, MAX_COINS]:

    result: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    for i in range(N_COINS_128, bound=MAX_COINS_128):
        result.append(unsafe_div(_rates[i] * _balances[i], PRECISION))
    return result


@view
@internal
def get_D_mem(
    _rates: DynArray[uint256, MAX_COINS],
    _balances: DynArray[uint256, MAX_COINS],
    _amp: uint256
) -> uint256:
    xp: DynArray[uint256, MAX_COINS] = self._xp_mem(_rates, _balances)
    return self.get_D(xp, _amp)


@view
@internal
def _calc_withdraw_one_coin(
    _burn_amount: uint256,
    i: int128
) -> (
    uint256,
    uint256,
    DynArray[uint256, MAX_COINS],
    uint256,
    uint256
):
    # First, need to calculate
    # * Get current D
    # * Solve Eqn against y_i for D - _token_amount
    amp: uint256 = self._A()
    rates: DynArray[uint256, MAX_COINS] = self._stored_rates()
    xp: DynArray[uint256, MAX_COINS] = self._xp_mem(rates, self._balances())
    D0: uint256 = self.get_D(xp, amp)

    total_supply: uint256 = self.total_supply
    D1: uint256 = D0 - _burn_amount * D0 / total_supply
    new_y: uint256 = self.get_y_D(amp, i, xp, D1)

    base_fee: uint256 = unsafe_div(
        unsafe_mul(self.fee, N_COINS),
        unsafe_mul(4, unsafe_sub(N_COINS, 1))
    )
    xp_reduced: DynArray[uint256, MAX_COINS] = xp
    ys: uint256 = unsafe_div((D0 + D1), unsafe_mul(2, N_COINS))

    dx_expected: uint256 = 0
    xp_j: uint256 = 0
    xavg: uint256 = 0
    dynamic_fee: uint256 = 0

    for j in range(MAX_COINS_128):

        if j == N_COINS_128:
            break

        dx_expected = 0
        xp_j = xp[j]

        if j == i:
            dx_expected = xp_j * D1 / D0 - new_y
            xavg = unsafe_div((xp_j + new_y), 2)
        else:
            dx_expected = xp_j - xp_j * D1 / D0
            xavg = xp_j

        dynamic_fee = self._dynamic_fee(xavg, ys, base_fee)
        xp_reduced[j] = xp_j - unsafe_div(dynamic_fee * dx_expected, FEE_DENOMINATOR)

    dy: uint256 = xp_reduced[i] - self.get_y_D(amp, i, xp_reduced, D1)
    dy_0: uint256 = (xp[i] - new_y) * PRECISION / rates[i]  # w/o fees
    dy = unsafe_div((dy - 1) * PRECISION, rates[i])  # Withdraw less to account for rounding errors

    # update xp with new_y for p calculations.
    xp[i] = new_y

    return dy, dy_0 - dy, xp, amp, D1


# -------------------------- AMM Price Methods -------------------------------

@pure
@internal
def pack_2(p1: uint256, p2: uint256) -> uint256:
    assert p1 < 2**128
    assert p2 < 2**128
    return p1 | (p2 << 128)


@pure
@internal
def unpack_2(packed: uint256) -> uint256[2]:
    return [packed & (2**128 - 1), packed >> 128]


@internal
@pure
def _get_p(
    xp: DynArray[uint256, MAX_COINS],
    amp: uint256,
    D: uint256,
) -> DynArray[uint256, MAX_COINS]:

    # dx_0 / dx_1 only, however can have any number of coins in pool
    ANN: uint256 = unsafe_mul(amp, N_COINS)
    Dr: uint256 = unsafe_div(D, pow_mod256(N_COINS, N_COINS))

    for i in range(N_COINS_128, bound=MAX_COINS_128):
        Dr = Dr * D / xp[i]

    p: DynArray[uint256, MAX_COINS] = empty(DynArray[uint256, MAX_COINS])
    xp0_A: uint256 = unsafe_div(ANN * xp[0], A_PRECISION)

    for i in range(1, MAX_COINS):

        if i == N_COINS:
            break

        p.append(10**18 * (xp0_A + unsafe_div(Dr * xp[0], xp[i])) / (xp0_A + Dr))

    return p


@internal
def upkeep_oracles(xp: DynArray[uint256, MAX_COINS], amp: uint256, D: uint256):
    """
    @notice Upkeeps price and D oracles.
    """
    ma_last_time_unpacked: uint256[2] = self.unpack_2(self.ma_last_time)
    last_prices_packed_current: DynArray[uint256, MAX_COINS] = self.last_prices_packed
    last_prices_packed_new: DynArray[uint256, MAX_COINS] = last_prices_packed_current

    spot_price: DynArray[uint256, MAX_COINS] = self._get_p(xp, amp, D)

    # -------------------------- Upkeep price oracle -------------------------

    for i in range(MAX_COINS):

        if i == N_COINS - 1:
            break

        if spot_price[i] != 0:

            # Update packed prices -----------------
            last_prices_packed_new[i] = self.pack_2(
                min(spot_price[i], 2 * 10**18),  # <----- Cap spot value by 2.
                self._calc_moving_average(
                    last_prices_packed_current[i],
                    self.ma_exp_time,
                    ma_last_time_unpacked[0],  # index 0 is ma_last_time for prices
                )
            )

    self.last_prices_packed = last_prices_packed_new

    # ---------------------------- Upkeep D oracle ---------------------------

    last_D_packed_current: uint256 = self.last_D_packed
    self.last_D_packed = self.pack_2(
        D,
        self._calc_moving_average(
            last_D_packed_current,
            self.D_ma_time,
            ma_last_time_unpacked[1],  # index 1 is ma_last_time for D
        )
    )

    # Housekeeping: Update ma_last_time for p and D oracles ------------------
    for i in range(2):
        if ma_last_time_unpacked[i] < block.timestamp:
            ma_last_time_unpacked[i] = block.timestamp

    self.ma_last_time = self.pack_2(ma_last_time_unpacked[0], ma_last_time_unpacked[1])


@internal
@view
def _calc_moving_average(
    packed_value: uint256,
    averaging_window: uint256,
    ma_last_time: uint256
) -> uint256:

    last_spot_value: uint256 = packed_value & (2**128 - 1)
    last_ema_value: uint256 = (packed_value >> 128)

    if ma_last_time < block.timestamp:  # calculate new_ema_value and return that.
        alpha: uint256 = self.exp(
            -convert(
                unsafe_div(unsafe_mul(unsafe_sub(block.timestamp, ma_last_time), 10**18), averaging_window), int256
            )
        )
        return unsafe_div(last_spot_value * (10**18 - alpha) + last_ema_value * alpha, 10**18)

    return last_ema_value


@view
@external
def last_price(i: uint256) -> uint256:
    return self.last_prices_packed[i] & (2**128 - 1)


@view
@external
def ema_price(i: uint256) -> uint256:
    return (self.last_prices_packed[i] >> 128)


@external
@view
def get_p(i: uint256) -> uint256:
    """
    @notice Returns the AMM State price of token
    @dev if i = 0, it will return the state price of coin[1].
    @param i index of state price (0 for coin[1], 1 for coin[2], ...)
    @return uint256 The state price quoted by the AMM for coin[i+1]
    """
    amp: uint256 = self._A()
    xp: DynArray[uint256, MAX_COINS] = self._xp_mem(
        self._stored_rates(), self._balances()
    )
    D: uint256 = self.get_D(xp, amp)
    return self._get_p(xp, amp, D)[i]


@external
@view
@nonreentrant('lock')
def price_oracle(i: uint256) -> uint256:
    return self._calc_moving_average(
        self.last_prices_packed[i],
        self.ma_exp_time,
        self.ma_last_time & (2**128 - 1)
    )


@external
@view
@nonreentrant('lock')
def D_oracle() -> uint256:
    return self._calc_moving_average(
        self.last_D_packed,
        self.D_ma_time,
        self.ma_last_time >> 128
    )


# ----------------------------- Math Utils -----------------------------------


@internal
@pure
def exp(x: int256) -> uint256:
    """
    @dev Calculates the natural exponential function of a signed integer with
         a precision of 1e18.
    @notice Note that this function consumes about 810 gas units. The implementation
            is inspired by Remco Bloemen's implementation under the MIT license here:
            https://xn--2-umb.com/22/exp-ln.
    @dev This implementation is derived from Snekmate, which is authored
         by pcaversaccio (Snekmate), distributed under the AGPL-3.0 license.
         https://github.com/pcaversaccio/snekmate
    @param x The 32-byte variable.
    @return int256 The 32-byte calculation result.
    """
    value: int256 = x

    # If the result is `< 0.5`, we return zero. This happens when we have the following:
    # "x <= floor(log(0.5e18) * 1e18) ~ -42e18".
    if (x <= -41446531673892822313):
        return empty(uint256)

    # When the result is "> (2 ** 255 - 1) / 1e18" we cannot represent it as a signed integer.
    # This happens when "x >= floor(log((2 ** 255 - 1) / 1e18) * 1e18) ~ 135".
    assert x < 135305999368893231589, "wad_exp overflow"

    # `x` is now in the range "(-42, 136) * 1e18". Convert to "(-42, 136) * 2 ** 96" for higher
    # intermediate precision and a binary base. This base conversion is a multiplication with
    # "1e18 / 2 ** 96 = 5 ** 18 / 2 ** 78".
    value = unsafe_div(x << 78, 5 ** 18)

    # Reduce the range of `x` to "(-½ ln 2, ½ ln 2) * 2 ** 96" by factoring out powers of two
    # so that "exp(x) = exp(x') * 2 ** k", where `k` is a signer integer. Solving this gives
    # "k = round(x / log(2))" and "x' = x - k * log(2)". Thus, `k` is in the range "[-61, 195]".
    k: int256 = unsafe_add(unsafe_div(value << 96, 54916777467707473351141471128), 2 ** 95) >> 96
    value = unsafe_sub(value, unsafe_mul(k, 54916777467707473351141471128))

    # Evaluate using a "(6, 7)"-term rational approximation. Since `p` is monic,
    # we will multiply by a scaling factor later.
    y: int256 = unsafe_add(unsafe_mul(unsafe_add(value, 1346386616545796478920950773328), value) >> 96, 57155421227552351082224309758442)
    p: int256 = unsafe_add(unsafe_mul(unsafe_add(unsafe_mul(unsafe_sub(unsafe_add(y, value), 94201549194550492254356042504812), y) >> 96,\
                           28719021644029726153956944680412240), value), 4385272521454847904659076985693276 << 96)

    # We leave `p` in the "2 ** 192" base so that we do not have to scale it up
    # again for the division.
    q: int256 = unsafe_add(unsafe_mul(unsafe_sub(value, 2855989394907223263936484059900), value) >> 96, 50020603652535783019961831881945)
    q = unsafe_sub(unsafe_mul(q, value) >> 96, 533845033583426703283633433725380)
    q = unsafe_add(unsafe_mul(q, value) >> 96, 3604857256930695427073651918091429)
    q = unsafe_sub(unsafe_mul(q, value) >> 96, 14423608567350463180887372962807573)
    q = unsafe_add(unsafe_mul(q, value) >> 96, 26449188498355588339934803723976023)

    # The polynomial `q` has no zeros in the range because all its roots are complex.
    # No scaling is required, as `p` is already "2 ** 96" too large. Also,
    # `r` is in the range "(0.09, 0.25) * 2**96" after the division.
    r: int256 = unsafe_div(p, q)

    # To finalise the calculation, we have to multiply `r` by:
    #   - the scale factor "s = ~6.031367120",
    #   - the factor "2 ** k" from the range reduction, and
    #   - the factor "1e18 / 2 ** 96" for the base conversion.
    # We do this all at once, with an intermediate result in "2**213" base,
    # so that the final right shift always gives a positive value.

    # Note that to circumvent Vyper's safecast feature for the potentially
    # negative parameter value `r`, we first convert `r` to `bytes32` and
    # subsequently to `uint256`. Remember that the EVM default behaviour is
    # to use two's complement representation to handle signed integers.
    return unsafe_mul(convert(convert(r, bytes32), uint256), 3822833074963236453042738258902158003155416615667) >> convert(unsafe_sub(195, k), uint256)


# ---------------------------- ERC20 Utils -----------------------------------

@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


@internal
def _transfer(_from: address, _to: address, _value: uint256):
    # # NOTE: vyper does not allow underflows
    # #       so the following subtraction would revert on insufficient balance
    self.balanceOf[_from] -= _value
    self.balanceOf[_to] += _value

    log Transfer(_from, _to, _value)


@internal
def _burnFrom(_from: address, _burn_amount: uint256):

    self.total_supply -= _burn_amount
    self.balanceOf[_from] -= _burn_amount
    log Transfer(_from, empty(address), _burn_amount)


@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.
    """
    self._transfer(msg.sender, _to, _value)
    return True


@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
    """
    self._transfer(_from, _to, _value)

    _allowance: uint256 = self.allowance[_from][msg.sender]
    if _allowance != max_value(uint256):
        _new_allowance: uint256 = _allowance - _value
        self.allowance[_from][msg.sender] = _new_allowance
        log Approval(_from, msg.sender, _new_allowance)

    return True


@external
def approve(_spender : address, _value : uint256) -> bool:
    """
    @notice Approve the passed address to transfer the specified amount of
            tokens on behalf of msg.sender
    @dev Beware that changing an allowance via this method brings the risk that
         someone may use both the old and new allowance by unfortunate transaction
         ordering: https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
    @param _spender The address which will transfer the funds
    @param _value The amount of tokens that may be transferred
    @return bool success
    """
    self.allowance[msg.sender][_spender] = _value

    log Approval(msg.sender, _spender, _value)
    return True


@external
def permit(
    _owner: address,
    _spender: address,
    _value: uint256,
    _deadline: uint256,
    _v: uint8,
    _r: bytes32,
    _s: bytes32
) -> bool:
    """
    @notice Approves spender by owner's signature to expend owner's tokens.
        See https://eips.ethereum.org/EIPS/eip-2612.
    @dev Inspired by https://github.com/yearn/yearn-vaults/blob/main/contracts/Vault.vy#L753-L793
    @dev Supports smart contract wallets which implement ERC1271
        https://eips.ethereum.org/EIPS/eip-1271
    @param _owner The address which is a source of funds and has signed the Permit.
    @param _spender The address which is allowed to spend the funds.
    @param _value The amount of tokens to be spent.
    @param _deadline The timestamp after which the Permit is no longer valid.
    @param _v The bytes[64] of the valid secp256k1 signature of permit by owner
    @param _r The bytes[0:32] of the valid secp256k1 signature of permit by owner
    @param _s The bytes[32:64] of the valid secp256k1 signature of permit by owner
    @return True, if transaction completes successfully
    """
    assert _owner != empty(address)
    assert block.timestamp <= _deadline

    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))
        )
    )

    if _owner.is_contract:
        sig: Bytes[65] = concat(_abi_encode(_r, _s), slice(convert(_v, bytes32), 31, 1))
        # reentrancy not a concern since this is a staticcall
        assert ERC1271(_owner).isValidSignature(digest, sig) == ERC1271_MAGIC_VAL
    else:
        assert ecrecover(digest, convert(_v, uint256), convert(_r, uint256), convert(_s, uint256)) == _owner

    self.allowance[_owner][_spender] = _value
    self.nonces[_owner] = unsafe_add(nonce, 1)

    log Approval(_owner, _spender, _value)
    return True


@view
@external
def DOMAIN_SEPARATOR() -> bytes32:
    """
    @notice EIP712 domain separator.
    @return bytes32 Domain Separator set for the current chain.
    """
    return self._domain_separator()


# ------------------------- AMM View Functions -------------------------------


@view
@external
def get_dx(i: int128, j: int128, dy: uint256) -> uint256:
    """
    @notice Calculate the current input dx given output dy
    @dev Index values can be found via the `coins` public getter method
    @param i Index value for the coin to send
    @param j Index value of the coin to receive
    @param dy Amount of `j` being received after exchange
    @return Amount of `i` predicted
    """
    return StableSwapViews(factory.views_implementation()).get_dx(i, j, dy, self)


@view
@external
def get_dy(i: int128, j: int128, dx: uint256) -> uint256:
    """
    @notice Calculate the current output dy given input dx
    @dev Index values can be found via the `coins` public getter method
    @param i Index value for the coin to send
    @param j Index value of the coin to receive
    @param dx Amount of `i` being exchanged
    @return Amount of `j` predicted
    """
    return StableSwapViews(factory.views_implementation()).get_dy(i, j, dx, self)


@view
@external
def calc_withdraw_one_coin(_burn_amount: uint256, i: int128) -> uint256:
    """
    @notice Calculate the amount received when withdrawing a single coin
    @param _burn_amount Amount of LP tokens to burn in the withdrawal
    @param i Index value of the coin to withdraw
    @return Amount of coin received
    """
    return self._calc_withdraw_one_coin(_burn_amount, i)[0]


@view
@external
@nonreentrant('lock')
def totalSupply() -> uint256:
    """
    @notice The total supply of pool LP tokens
    @return self.total_supply, 18 decimals.
    """
    return self.total_supply


@view
@external
@nonreentrant('lock')
def get_virtual_price() -> uint256:
    """
    @notice The current virtual price of the pool LP token
    @dev Useful for calculating profits.
         The method may be vulnerable to donation-style attacks if implementation
         contains rebasing tokens. For integrators, caution is advised.
    @return LP token virtual price normalized to 1e18
    """
    amp: uint256 = self._A()
    xp: DynArray[uint256, MAX_COINS] = self._xp_mem(
        self._stored_rates(), self._balances()
    )
    D: uint256 = self.get_D(xp, amp)
    # D is in the units similar to DAI (e.g. converted to precision 1e18)
    # When balanced, D = n * x_u - total virtual value of the portfolio
    return D * PRECISION / self.total_supply


@view
@external
def calc_token_amount(
    _amounts: DynArray[uint256, MAX_COINS],
    _is_deposit: bool
) -> uint256:
    """
    @notice Calculate addition or reduction in token supply from a deposit or withdrawal
    @param _amounts Amount of each coin being deposited
    @param _is_deposit set True for deposits, False for withdrawals
    @return Expected amount of LP tokens received
    """
    return StableSwapViews(factory.views_implementation()).calc_token_amount(_amounts, _is_deposit, self)


@view
@external
def A() -> uint256:
    return unsafe_div(self._A(), A_PRECISION)


@view
@external
def A_precise() -> uint256:
    return self._A()


@view
@external
def balances(i: uint256) -> uint256:
    """
    @notice Get the current balance of a coin within the
            pool, less the accrued admin fees
    @param i Index value for the coin to query balance of
    @return Token balance
    """
    return self._balances()[i]


@view
@external
def get_balances() -> DynArray[uint256, MAX_COINS]:
    return self._balances()


@view
@external
def stored_rates() -> DynArray[uint256, MAX_COINS]:
    return self._stored_rates()


@view
@external
def dynamic_fee(i: int128, j: int128) -> uint256:
    """
    @notice Return the fee for swapping between `i` and `j`
    @param i Index value for the coin to send
    @param j Index value of the coin to receive
    @return Swap fee expressed as an integer with 1e10 precision
    """
    return StableSwapViews(factory.views_implementation()).dynamic_fee(i, j, self)


# --------------------------- AMM Admin Functions ----------------------------


@external
def ramp_A(_future_A: uint256, _future_time: uint256):
    assert msg.sender == factory.admin()  # dev: only owner
    assert block.timestamp >= self.initial_A_time + MIN_RAMP_TIME
    assert _future_time >= block.timestamp + MIN_RAMP_TIME  # dev: insufficient time

    _initial_A: uint256 = self._A()
    _future_A_p: uint256 = _future_A * A_PRECISION

    assert _future_A > 0 and _future_A < MAX_A
    if _future_A_p < _initial_A:
        assert _future_A_p * MAX_A_CHANGE >= _initial_A
    else:
        assert _future_A_p <= _initial_A * MAX_A_CHANGE

    self.initial_A = _initial_A
    self.future_A = _future_A_p
    self.initial_A_time = block.timestamp
    self.future_A_time = _future_time

    log RampA(_initial_A, _future_A_p, block.timestamp, _future_time)


@external
def stop_ramp_A():
    assert msg.sender == factory.admin()  # dev: only owner

    current_A: uint256 = self._A()
    self.initial_A = current_A
    self.future_A = current_A
    self.initial_A_time = block.timestamp
    self.future_A_time = block.timestamp
    # now (block.timestamp < t1) is always False, so we return saved A

    log StopRampA(current_A, block.timestamp)


@external
def set_new_fee(_new_fee: uint256, _new_offpeg_fee_multiplier: uint256):

    assert msg.sender == factory.admin()

    # set new fee:
    assert _new_fee <= MAX_FEE
    self.fee = _new_fee

    # set new offpeg_fee_multiplier:
    assert _new_offpeg_fee_multiplier * _new_fee <= MAX_FEE * FEE_DENOMINATOR  # dev: offpeg multiplier exceeds maximum
    self.offpeg_fee_multiplier = _new_offpeg_fee_multiplier

    log ApplyNewFee(_new_fee, _new_offpeg_fee_multiplier)


@external
def set_ma_exp_time(_ma_exp_time: uint256, _D_ma_time: uint256):
    """
    @notice Set the moving average window of the price oracles.
    @param _ma_exp_time Moving average window for the price oracle. It is time_in_seconds / ln(2).
    @param _D_ma_time Moving average window for the D oracle. It is time_in_seconds / ln(2).
    """
    assert msg.sender == factory.admin()  # dev: only owner
    assert unsafe_mul(_ma_exp_time, _D_ma_time) > 0  # dev: 0 in input values

    self.ma_exp_time = _ma_exp_time
    self.D_ma_time = _D_ma_time

    log SetNewMATime(_ma_exp_time, _D_ma_time)

Contract Security Audit

Contract ABI

[{"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":"int128","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"int128","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"TokenExchangeUnderlying","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"sold_id","type":"int128","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"int128","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[]","indexed":false},{"name":"fees","type":"uint256[]","indexed":false},{"name":"invariant","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[]","indexed":false},{"name":"fees","type":"uint256[]","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_id","type":"int128","indexed":false},{"name":"token_amount","type":"uint256","indexed":false},{"name":"coin_amount","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityImbalance","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[]","indexed":false},{"name":"fees","type":"uint256[]","indexed":false},{"name":"invariant","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampA","inputs":[{"name":"old_A","type":"uint256","indexed":false},{"name":"new_A","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":"A","type":"uint256","indexed":false},{"name":"t","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"ApplyNewFee","inputs":[{"name":"fee","type":"uint256","indexed":false},{"name":"offpeg_fee_multiplier","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"SetNewMATime","inputs":[{"name":"ma_exp_time","type":"uint256","indexed":false},{"name":"D_ma_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_name","type":"string"},{"name":"_symbol","type":"string"},{"name":"_A","type":"uint256"},{"name":"_fee","type":"uint256"},{"name":"_offpeg_fee_multiplier","type":"uint256"},{"name":"_ma_exp_time","type":"uint256"},{"name":"_coins","type":"address[]"},{"name":"_rate_multipliers","type":"uint256[]"},{"name":"_asset_types","type":"uint8[]"},{"name":"_method_ids","type":"bytes4[]"},{"name":"_oracles","type":"address[]"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"exchange","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange_received","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"exchange_received","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"_dx","type":"uint256"},{"name":"_min_dy","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_min_mint_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_min_mint_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_min_received","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_min_received","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_max_burn_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_max_burn_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[]"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[]"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[]"},{"name":"_receiver","type":"address"},{"name":"_claim_admin_fees","type":"bool"}],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"nonpayable","type":"function","name":"withdraw_admin_fees","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"last_price","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ema_price","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_p","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"price_oracle","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"D_oracle","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"transfer","inputs":[{"name":"_to","type":"address"},{"name":"_value","type":"uint256"}],"outputs":[{"name":"","type":"bool"}]},{"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":"approve","inputs":[{"name":"_spender","type":"address"},{"name":"_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":"DOMAIN_SEPARATOR","inputs":[],"outputs":[{"name":"","type":"bytes32"}]},{"stateMutability":"view","type":"function","name":"get_dx","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_dy","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"},{"name":"dx","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_withdraw_one_coin","inputs":[{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"totalSupply","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_token_amount","inputs":[{"name":"_amounts","type":"uint256[]"},{"name":"_is_deposit","type":"bool"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"A_precise","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"balances","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"get_balances","inputs":[],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"stored_rates","inputs":[],"outputs":[{"name":"","type":"uint256[]"}]},{"stateMutability":"view","type":"function","name":"dynamic_fee","inputs":[{"name":"i","type":"int128"},{"name":"j","type":"int128"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"ramp_A","inputs":[{"name":"_future_A","type":"uint256"},{"name":"_future_time","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"stop_ramp_A","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_new_fee","inputs":[{"name":"_new_fee","type":"uint256"},{"name":"_new_offpeg_fee_multiplier","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_ma_exp_time","inputs":[{"name":"_ma_exp_time","type":"uint256"},{"name":"_D_ma_time","type":"uint256"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"N_COINS","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"coins","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"offpeg_fee_multiplier","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"admin_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"initial_A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"future_A","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"initial_A_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"future_A_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"admin_balances","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ma_exp_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"D_ma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"ma_last_time","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":"nonces","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"salt","inputs":[],"outputs":[{"name":"","type":"bytes32"}]}]

Deployed Bytecode

0x60003560e01c6005600560068306026153c801601b39600051600760078260ff16848460181c0260181c06028260081c61ffff160160193950600051818160181c14600336111661004f57612a15565b8060fe163610348260011602176153c3578060081c61ffff16565b602061559160403960206040f35b602060043560206155f16000396000518110156153c35760051b6080016155910160403960206040f35b600a5460405260206040f35b600b5460405260206040f35b64012a05f20060405260206040f35b600c5460405260206040f35b600d5460405260206040f35b600e5460405260206040f35b600f5460405260206040f35b6004356010548110156153c3576011015460405260206040f35b60235460405260206040f35b60245460405260206040f35b60255460405260206040f35b6020806040528060400160206020615cd16000396000510180615cd18339508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b6020806040528060400160206020615d316000396000510180615d318339508051806020830101601f82600003163682375050601f19601f825160200101169050810190506040f35b601260405260206040f35b60208060805260066040527f76372e302e30000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f82600003163682375050601f19601f8251602001011690509050810190506080f35b6004358060a01c6153c357604052602660405160205260005260406000205460605260206060f35b6004358060a01c6153c3576040526024358060a01c6153c3576060526027604051602052600052604060002080606051602052600052604060002090505460805260206080f35b6004358060a01c6153c357604052602960405160205260005260406000205460605260206060f35b6020615db160403960206040f35b3361136052610302565b6084358060a01c6153c357611360525b60043580600f0b81186153c3576113205260243580600f0b81186153c357611340526000546002146153c3576002600055602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526000610e805261036b6113806145d5565b6113806003600055f35b336113605261038f565b6084358060a01c6153c357611360525b60043580600f0b81186153c3576113205260243580600f0b81186153c357611340526000546002146153c357600260005560206158316000396000516153c357602033610dc05261132051610de05261134051610e005260406044610e203761136051610e60526001610e80526104076113806145d5565b6113806003600055f35b33610a805261042b565b6044358060a01c6153c357610a80525b60043560040160088135116153c357803560208160051b018083610960375050506000546002146153c3576002600055610a8051156153c35761046f610ac0613370565b610ac051610aa052610482610be0613177565b610be0805160208160051b0180610ac0828560045afa505050506104a7610d00612e1e565b610d00805160208160051b0180610be0828560045afa50505050610be05160208160051b01806103c082610be060045afa505050610ac05160208160051b01806104e082610ac060045afa505050610aa05161060052610508610d20614884565b610d2051610d0052602854610d2052610ac05160208160051b0180610d4082610ac060045afa505050600060206155b1600039600051600881116153c35780156105eb57905b80610e6052610e6051610960518110156153c35760051b6109800151156105d657610e6051610d40518110156153c35760051b610d60018051610e6051604052610e6051610960518110156153c35760051b610980015160605233608052600060a0526105bc610e80612a5c565b610e80518082018281106153c357905090508152506105e0565b610d2051156153c3575b60010181811861054e575b5050610be05160208160051b01806103c082610be060045afa505050610d405160208160051b01806104e082610d4060045afa505050610aa05161060052610634610e80614884565b610e8051610e6052610d0051610e605111156153c3576000610e80526000610fa052610d2051156109d757606036610fc0376020615591600039600051610d0051610e60518082018281106153c35790509050046110205260403661104037600160206155916000396000510360021b6020615591600039600051600a54020461108052600060206155b1600039600051600881116153c35780156108dc57905b806110a052610e60516110a051610ac0518110156153c35760051b610ae001518082028115838383041417156153c35790509050610d005180156153c35780820490509050610fc0526000610fe0526110a051610d40518110156153c35760051b610d6001516110005261100051610fc0511161075e57610fc0516110005103610fe05261076c565b61100051610fc05103610fe0525b670de0b6b3a76400006110a051610be0518110156153c35760051b610c0001516110a051610ac0518110156153c35760051b610ae00151611000518082018281106153c357905090508082028115838383041417156153c3579050905004611040526110405160405261102051606052611080516080526107ee6110c0613a1b565b6110c05161106052610e8051600781116153c3576402540be40061106051610fe0518082028115838383041417156153c35790509050048160051b610ea0015260018101610e8052506110a0516010548110156153c35760110180546402540be4006110a051610e80518110156153c35760051b610ea0015164012a05f20081028164012a05f2008204186153c3579050048082018281106153c357905090508155506110a051610d40518110156153c35760051b610d600180516110a051610e80518110156153c35760051b610ea001518082038281116153c357905090508152506001018181186106d5575b5050610be05160208160051b0180604082610be060045afa505050610d405160208160051b018061016082610d4060045afa50505061091c6111c06132b8565b6111c0805160208160051b01806110a0828560045afa505050506110a05160208160051b01806040826110a060045afa505050610aa051610160526109626111c061347b565b6111c051610e6052610d0051610d2051610e6051610d00518082038281116153c357905090508082028115838383041417156153c3579050905004610fa0526110a05160208160051b0180610340826110a060045afa505050610aa05161046052610e605161048052610a5261403956610a52565b610e6051610fa052610e6051604052610e60516060526109f8610fc0612a1b565b610fc051602255602554604052610a10611000613adb565b6110006040610fc060408360045afa505042610fe0511015610a525742610fe052610fc051604052610fe051606052610a4a611000612a1b565b611000516025555b602435610fa0511015610ac5576014610fc0527f536c697070616765207363726577656420796f75000000000000000000000000610fe052610fc050610fc05180610fe001601f826000031636823750506308c379a0610f80526020610fa052601f19601f610fc0510116604401610f9cfd5b610d2051610fa0518082018281106153c35790509050610d20526026610a805160205260005260406000208054610fa0518082018281106153c35790509050815550610d2051602855610a805160007fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef610fa051610fc0526020610fc0a3337f189c623b666b1b45b83d7178f39b8c087cb09774317ca2f53c2d3c3726f222a2608080610fc05280610fc0016000610960518083528060051b600082600881116153c3578015610baf57905b8060051b61098001518160051b602088010152600101818118610b91575b5050820160200191505090508101905080610fe05280610fc0016000610e80518083528060051b600082600881116153c3578015610c0757905b8060051b610ea001518160051b602088010152600101818118610be9575b50508201602001915050905081019050610e605161100052610d205161102052610fc0a26020610fa06003600055f35b33610b0052610c51565b6064358060a01c6153c357610b00525b60243580600f0b81186153c357610ae0526000546002146153c3576002600055600435156153c357606036610b20376000610c80526000610ca0526004356103c052610ae0516103e052610ca6610cc0614bd6565b610cc08051610b20526020810151610b405260408101805160208160051b0180610b60828560045afa50505050610160810151610c8052610180810151610ca05250604435610b20511015610d5b576018610cc0527f4e6f7420656e6f75676820636f696e732072656d6f7665640000000000000000610ce052610cc050610cc05180610ce001601f826000031636823750506308c379a0610c80526020610ca052601f19601f610cc0510116604401610c9cfd5b610ae0516010548110156153c35760110180546402540be400610b405164012a05f20081028164012a05f2008204186153c3579050048082018281106153c3579050905081555033604052600435606052610db46150c6565b610ae051604052610b2051606052610b0051608052610dd1612c34565b337f6f48129db1f37ccb9cc5dd7e119cb32750cabdf75b48375d730d26ce3659bbe1610ae051610cc052600435610ce052610b2051610d0052602854610d20526080610cc0a2610b605160208160051b018061034082610b6060045afa505050610c805161046052610ca05161048052610e49614039565b6020610b206003600055f35b33610a8052610e6f565b6044358060a01c6153c357610a80525b60043560040160088135116153c357803560208160051b018083610960375050506000546002146153c3576002600055610eaa610ac0613370565b610ac051610aa052610ebd610be0612e1e565b610be0805160208160051b0180610ac0828560045afa50505050610ee2610d00613177565b610d00805160208160051b0180610be0828560045afa50505050610ac05160208160051b01806103c082610ac060045afa505050610be05160208160051b01806104e082610be060045afa505050610aa05161060052610f43610d20614884565b610d2051610d0052610be05160208160051b0180610d2082610be060045afa505050600060206155b1600039600051600881116153c357801561101e57905b80610e4052610e4051610960518110156153c35760051b61098001511561101357610e4051610d20518110156153c35760051b610d40018051610e4051610960518110156153c35760051b61098001518082038281116153c35790509050815250610e4051604052610e4051610960518110156153c35760051b6109800151606052610a8051608052611013612c34565b600101818118610f82575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa05161060052611067610e60614884565b610e6051610e4052600160206155916000396000510360021b6020615591600039600051600a540204610e60526020615591600039600051610d0051610e40518082018281106153c3579050905004610e80526000610ea0526000610fc052608036610fe037600060206155b1600039600051600881116153c35780156112f157905b8061106052610e405161106051610be0518110156153c35760051b610c0001518082028115838383041417156153c35790509050610d005180156153c357808204905090506110005260006110205261106051610d20518110156153c35760051b610d400151611040526110405161100051116111735761100051611040510361102052611181565b611040516110005103611020525b670de0b6b3a764000061106051610ac0518110156153c35760051b610ae0015161106051610be0518110156153c35760051b610c000151611040518082018281106153c357905090508082028115838383041417156153c3579050905004610fe052610fe051604052610e8051606052610e6051608052611203611080613a1b565b61108051610fc052610ea051600781116153c3576402540be400610fc051611020518082028115838383041417156153c35790509050048160051b610ec0015260018101610ea05250611060516010548110156153c35760110180546402540be40061106051610ea0518110156153c35760051b610ec0015164012a05f20081028164012a05f2008204186153c3579050048082018281106153c3579050905081555061106051610d20518110156153c35760051b610d4001805161106051610ea0518110156153c35760051b610ec001518082038281116153c357905090508152506001018181186110ea575b5050610ac05160208160051b01806103c082610ac060045afa505050610d205160208160051b01806104e082610d2060045afa505050610aa0516106005261133a611060614884565b61106051610e4052610ac05160208160051b0180604082610ac060045afa505050610d205160208160051b018061016082610d2060045afa5050506113806110606132b8565b611060805160208160051b0180611180828560045afa50505050610aa0516112a052610e40516112c05261016061034061016061118060045afa506113c3614039565b60285461106052610d0051610d0051610e40518082038281116153c35790509050611060518082028115838383041417156153c3579050905004600181018181106153c357905061108052600261108051106153c35760243561108051111561148c5760146110a0527f536c697070616765207363726577656420796f750000000000000000000000006110c0526110a0506110a051806110c001601f826000031636823750506308c379a061106052602061108052601f19601f6110a051011660440161107cfd5b336040526110805160605261149f6150c6565b337f3631c28b1f9dd213e0319fb167b554d76b6c283a41143eb400a0d1adb1af17556080806110a052806110a0016000610960518083528060051b600082600881116153c357801561150b57905b8060051b61098001518160051b6020880101526001018181186114ed575b50508201602001915050905081019050806110c052806110a0016000610ea0518083528060051b600082600881116153c357801561156357905b8060051b610ec001518160051b602088010152600101818118611545575b50508201602001915050905081019050610e40516110e05261106051611080518082038281116153c35790509050611100526110a0a260206110806003600055f35b336103c05260016103e0526115ee565b6044358060a01c6153c3576103c05260016103e0526115ee565b6044358060a01c6153c3576103c0526064358060011c6153c3576103e0525b60243560040160088135116153c357803560208160051b0180836102a0375050506000546002146153c357600260005560285461040052600435156153c35760206155916000396000516102a051186153c357600061042052611652610660613177565b610660805160208160051b0180610540828560045afa50505050600061066052600060206155b1600039600051600881116153c35780156117c157905b80610680526104005161068051610540518110156153c35760051b61056001516004358082028115838383041417156153c357905090500461066052610680516102a0518110156153c35760051b6102c001516106605110156117775760306106a0527f5769746864726177616c20726573756c74656420696e20666577657220636f696106c0527f6e73207468616e206578706563746564000000000000000000000000000000006106e0526106a0506106a051806106c001601f826000031636823750506308c379a061066052602061068052601f19601f6106a051011660440161067cfd5b61042051600781116153c357610660518160051b610440015260018101610420525061068051604052610660516060526103c0516080526117b6612c34565b60010181811861168f575b5050336040526004356060526117d56150c6565b6025546040526117e66106c0613adb565b6106c0604061068060408360045afa50506022546106c0526fffffffffffffffffffffffffffffffff6106c051166106e0526106e051610400516106e0516004358082028115838383041417156153c35790509050048082038281116153c35790509050610740526106c05161012052602454610140526106a05161016052611870610700613f2e565b610700516107605260406040604061074060045afa50611891610720612a1b565b61072051602255426106a05110156118c957426106a052610680516040526106a0516060526118c1610700612a1b565b610700516025555b337f347ad828e58cbe534d8f6b67985d791360756b18f0d95fd9f197a66cc46480ea6060806107005280610700016000610420518083528060051b600082600881116153c357801561193557905b8060051b61044001518160051b602088010152600101818118611917575b5050820160200191505090508101905080610720528061070001600060008252600060006000600881116153c357801561198257905b60008160051b60208701015260010181811861196b575b505081016020019050905081019050600435610400510361074052610700a26103e051156119b2576119b2615136565b6020806107005280610700016000610420518083528060051b600082600881116153c35780156119fc57905b8060051b61044001518160051b6020880101526001018181186119de575b505082016020019150509050810190506107006003600055f35b6000546002146153c3576002600055611a2d615136565b6003600055005b6fffffffffffffffffffffffffffffffff6004356019548110156153c357601a01541660405260206040f35b6004356019548110156153c357601a015460801c60405260206040f35b611a886103e0613370565b6103e0516103c052611a9b610500612e1e565b610500805160208160051b0180610860828560045afa50505050611ac0610620613177565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa50611af56107406132b8565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c05161016052611b3b61052061347b565b610520516105005260206103e05160208160051b01806040826103e060045afa5050506103c051610160526105005161018052611b79610520613b00565b61052060043581518110156153c35760051b60208201019050f35b6000546002146153c35760206004356019548110156153c357601a015461012052602354610140526fffffffffffffffffffffffffffffffff6025541661016052611be0610200613f2e565b610200f35b6000546002146153c3576020602254610120526024546101405260255460801c61016052611c14610200613f2e565b610200f35b6004358060a01c6153c35760c0523360405260c051606052602435608052611c3f615343565b600160e052602060e0f35b6004358060a01c6153c35760c0526024358060a01c6153c35760e05260c05160405260e051606052604435608052611c80615343565b602760c051602052600052604060002080336020526000526040600020905054610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101005114611d3f57610100516044358082038281116153c357905090506101205261012051602760c0516020526000526040600020803360205260005260406000209050553360c0517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92561012051610140526020610140a35b6001610120526020610120f35b6004358060a01c6153c3576040526024356027336020526000526040600020806040516020526000526040600020905055604051337f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560243560605260206060a3600160605260206060f35b6004358060a01c6153c357610120526024358060a01c6153c357610140526084358060081c6153c3576101605261012051156153c35760643542116153c35760296101205160205260005260406000205461018052600060026101c0527f19010000000000000000000000000000000000000000000000000000000000006101e0526101c0805160208201836103200181518152505080830192505050611e606102006152ae565b610200518161032001526020810190507f6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c961024052610120516102605261014051610280526044356102a052610180516102c0526064356102e05260c061022052610220805160208201209050816103200152602081019050806103005261030090508051602082012090506101a052610120513b1561202e576000604060a46102603760406102405261024080516020820183610320018281848460045afa50505080830192505050610160516102a0526102a0601f810180516102e0525060016102c0526102c09050805160208201836103200181518152505080830192505050806103005261030090506020815101806101c0828460045afa5050507f1626ba7e0000000000000000000000000000000000000000000000000000000061012051631626ba7e6102405260406101a051610260528061028052806102600160206101c051018082826101c060045afa50508051806020830101601f82600003163682375050601f19601f82516020010116905081015050602061024060c461025c845afa612016573d600060003e3d6000fd5b60203d106153c357610240905051186153c35761206f565b610120516000610240526101a0516101c052610160516101e05260a4356102005260c43561022052602061024060806101c060015afa5061024051186153c3575b6044356027610120516020526000526040600020806101405160205260005260406000209050556001610180510160296101205160205260005260406000205561014051610120517f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b9256044356101c05260206101c0a360016101c05260206101c0f35b60206120ff6101206152ae565b610120f35b60043580600f0b81186153c35760405260243580600f0b81186153c357606052602060206155d160003960005163e31593d8608052602060806004609c845afa612153573d600060003e3d6000fd5b60203d106153c3576080518060a01c6153c35760c05260c09050516383aa796a60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa6121aa573d600060003e3d6000fd5b60203d106153c35760e09050f35b60043580600f0b81186153c35760405260243580600f0b81186153c357606052602060206155d160003960005163e31593d8608052602060806004609c845afa612207573d600060003e3d6000fd5b60203d106153c3576080518060a01c6153c35760c05260c0905051630c601c2c60e0526040516101005260605161012052604435610140523061016052602060e0608460fc845afa61225e573d600060003e3d6000fd5b60203d106153c35760e09050f35b60243580600f0b81186153c357610ae05260206004356103c052610ae0516103e052612299610b00614bd6565b610b00f35b6000546002146153c35760285460405260206040f35b6000546002146153c3576122c96103e0613370565b6103e0516103c0526122dc610500612e1e565b610500805160208160051b0180610860828560045afa50505050612301610620613177565b610620805160208160051b0180610980828560045afa50505050610240604061024061086060045afa506123366107406132b8565b610740805160208160051b01806103e0828560045afa505050506103e05160208160051b01806040826103e060045afa5050506103c0516101605261237c61052061347b565b610520516105005261050051670de0b6b3a7640000810281670de0b6b3a76400008204186153c357905060285480156153c35780820490509050610520526020610520f35b60043560040160088135116153c357803560208160051b0180836040375050506024358060011c6153c35761016052602060206155d160003960005163e31593d8610180526020610180600461019c845afa612422573d600060003e3d6000fd5b60203d106153c357610180518060a01c6153c3576101c0526101c090505163fb79eb276101e05260608061020052806102000160006040518083528060051b600082600881116153c357801561249157905b8060051b606001518160051b602088010152600101818118612474575b50508201602001915050905081019050610160516102205230610240525060206101e06101846101fc845afa6124cc573d600060003e3d6000fd5b60203d106153c3576101e09050f35b60646124e760c0613370565b60c0510460e052602060e0f35b602061250060c0613370565b60c0f35b60206125116101e0613177565b6101e060043581518110156153c35760051b60208201019050f35b6020806103005261253e6101e0613177565b6101e08161030001600082518083528060051b600082600881116153c357801561258357905b8060051b6020880101518160051b602088010152600101818118612564575b505082016020019150509050905081019050610300f35b602080610360526125ac610240612e1e565b6102408161036001600082518083528060051b600082600881116153c35780156125f157905b8060051b6020880101518160051b6020880101526001018181186125d2575b505082016020019150509050905081019050610360f35b60043580600f0b81186153c35760405260243580600f0b81186153c357606052602060206155d160003960005163e31593d8608052602060806004609c845afa612657573d600060003e3d6000fd5b60203d106153c3576080518060a01c6153c35760c05260c090505163a63530bd60e05260405161010052606051610120523061014052602060e0606460fc845afa6126a7573d600060003e3d6000fd5b60203d106153c35760e09050f35b60206155d160003960005163f851a44060c052602060c0600460dc845afa6126e2573d600060003e3d6000fd5b60203d106153c35760c0518060a01c6153c3576101005261010090505133186153c357600e546201518081018181106153c357905042106153c357426201518081018181106153c3579050602435106153c35761273f60e0613370565b60e05160c052600435606481028160648204186153c357905060e0526004351561277157620f423f6004351115612774565b60005b156153c35760c05160e051106127a45760c051600a810281600a8204186153c357905060e051116153c3576127c0565b60c05160e051600a810281600a8204186153c3579050106153c3575b60c051600c5560e051600d5542600e55602435600f557fa2b71ec6df949300b59aab36b55e189697b750119dd349fcfa8c0f779e83c25460c0516101005260e051610120524261014052602435610160526080610100a1005b60206155d160003960005163f851a44060c052602060c0600460dc845afa612846573d600060003e3d6000fd5b60203d106153c35760c0518060a01c6153c3576101005261010090505133186153c35761287360e0613370565b60e05160c05260c051600c5560c051600d5542600e5542600f557f46e22fb3709ad289f62ce63d469248536dbc78d82b84a3d7e74ad606dc20193860c05160e0524261010052604060e0a1005b60206155d160003960005163f851a440604052602060406004605c845afa6128ed573d600060003e3d6000fd5b60203d106153c3576040518060a01c6153c357608052608090505133186153c35764012a05f200600435116153c357600435600a556802b5e3af16b18800006024356004358082028115838383041417156153c35790509050116153c357602435600b557f750d10a7f37466ce785ee6bcb604aac543358db42afbcc332a3c12a49c80bf6d6040600460403760406040a1005b60206155d160003960005163f851a440604052602060406004605c845afa6129ad573d600060003e3d6000fd5b60203d106153c3576040518060a01c6153c357608052608090505133186153c35760243560043502156153c3576004356023556024356024557f68dc4e067dff1862b896b7a0faf55f97df1a60d0aaa79481b69d675f2026a28c6040600460403760406040a1005b60006000fd5b6fffffffffffffffffffffffffffffffff604051116153c3576fffffffffffffffffffffffffffffffff606051116153c35760605160801b60405117815250565b602060405160206155f16000396000518110156153c35760051b608001615591016000396000516370a0823160e0523061010052602060e0602460fc845afa612aaa573d600060003e3d6000fd5b60203d106153c35760e090505160c05260a051612bd557606051156153c357602060405160206155f16000396000518110156153c35760051b608001615591016000396000516323b872dd60e05260805161010052306101205260605161014052602060e0606460fc6000855af1612b27573d600060003e3d6000fd5b3d612b3e57803b156153c357600161016052612b56565b60203d106153c35760e0518060011c6153c357610160525b610160905051156153c357602060405160206155f16000396000518110156153c35760051b608001615591016000396000516370a0823160e0523061010052602060e0602460fc845afa612baf573d600060003e3d6000fd5b60203d106153c35760e090505160c0518082038281116153c3579050905060c052612c06565b60c0516040516001548110156153c357600201548082038281116153c3579050905060c05260605160c051106153c3575b6040516001548110156153c357600201805460c0518082018281106153c3579050905081555060c051815250565b608051156153c3576020615831600039600051612d07576040516001548110156153c35760020180546060518082038281116153c35790509050815550602060405160206155f16000396000518110156153c35760051b6080016155910160003960005163a9059cbb60a05260805160c05260605160e052602060a0604460bc6000855af1612cc8573d600060003e3d6000fd5b3d612cdf57803b156153c357600161010052612cf7565b60203d106153c35760a0518060011c6153c357610100525b610100905051156153c357612e1c565b602060405160206155f16000396000518110156153c35760051b608001615591016000396000516370a0823160c0523060e052602060c0602460dc845afa612d54573d600060003e3d6000fd5b60203d106153c35760c090505160a052602060405160206155f16000396000518110156153c35760051b6080016155910160003960005163a9059cbb60c05260805160e05260605161010052602060c0604460dc6000855af1612dbc573d600060003e3d6000fd5b3d612dd357803b156153c357600161012052612deb565b60203d106153c35760c0518060011c6153c357610120525b610120905051156153c35760a0516060518082038281116153c357905090506040516001548110156153c357600201555b565b602061585160003960005160208160051b01806158516040395050600060206155b1600039600051600881116153c357801561315c57905b8061016052600160206101605160206157116000396000518110156153c35760051b6101a0016155910160003960005118612ebb5760206101605160206159716000396000518110156153c35760051b61040001615591016000396000511515612ebe565b60005b612ffe57600360206101605160206157116000396000518110156153c35760051b6101a001615591016000396000511861315157670de0b6b3a7640000610160516040518110156153c35760051b6060015160206101605160206155f16000396000518110156153c35760051b608001615591016000396000516307a2d13a610180526020610160516020615a916000396000518110156153c35760051b61052001615591016101a0396020610180602461019c845afa612f84573d600060003e3d6000fd5b60203d106153c3576101809050518082028115838383041417156153c357905090506020610160516020615bb16000396000518110156153c35760051b61064001615591016000396000518082028115838383041417156153c3579050905004610160516040518110156153c35760051b60600152613151565b60206101605160206159716000396000518110156153c35760051b610400016155910160003960005173ffffffffffffffffffffffffffffffffffffffff811690508060a01c6153c3575a7fffffffff0000000000000000000000000000000000000000000000000000000060206101605160206159716000396000518110156153c35760051b6104000161559101600039600051166101e05260206101c0526101c05060206102206101c0516101e08585fa905090506130c4573d600060003e3d6000fd5b3d602081183d60201002186102005261020080516101805260208101516101a05250602061018051186153c3576101a0516101805160200360031b1c6101c052670de0b6b3a7640000610160516040518110156153c35760051b606001516101c0518082028115838383041417156153c3579050905004610160516040518110156153c35760051b606001525b600101818118612e56575b505060405160208160051b01808382604060045afa50505050565b6000604052600061016052600060206155b1600039600051600881116153c357801561329d57905b806101805260206158316000396000516131ee57610180516001548110156153c35760020154610180516010548110156153c357601101548082038281116153c3579050905061016052613273565b60206101805160206155f16000396000518110156153c35760051b608001615591016000396000516370a082316101a052306101c05260206101a060246101bc845afa613240573d600060003e3d6000fd5b60203d106153c3576101a0905051610180516010548110156153c357601101548082038281116153c35790509050610160525b604051600781116153c357610160518160051b60600152600181016040525060010181811861319f575b505060405160208160051b01808382604060045afa50505050565b600061028052600060206155b1600039600051600881116153c357801561335357905b806103a05261028051600781116153c357670de0b6b3a76400006103a0516040518110156153c35760051b606001516103a051610160518110156153c35760051b61018001518082028115838383041417156153c35790509050048160051b6102a001526001810161028052506001018181186132db575b50506102805160208160051b0180838261028060045afa50505050565b600f54604052600d5460605260405142106133945760605181525061347956613479565b600c54608052600e5460a0526080516060511161341657608051606051608051034260a0518082038281116153c357905090508082028115838383041417156153c3579050905060405160a0518082038281116153c3579050905080156153c357808204905090508082038281116153c3579050905081525061347956613479565b608051608051606051034260a0518082038281116153c357905090508082028115838383041417156153c3579050905060405160a0518082038281116153c3579050905080156153c357808204905090508082018281106153c357905090508152505b565b6000610180526000604051600881116153c35780156134c757905b8060051b606001516101a052610180516101a0518082018281106153c3579050905061018052600101818118613496575b5050610180516134db576000815250613702565b610180516101a0526101605160206155916000396000518082028115838383041417156153c357905090506101c052600060ff905b806101e0526101a051610200526000604051600881116153c357801561357a57905b8060051b6060015161022052610200516101a0518082028115838383041417156153c357905090506102205180156153c3578082049050905061020052600101818118613532575b505061020051602061559160003960005160206155916000396000510a80156153c35780820490509050610200526101a0516102205260646101c051610180518082028115838383041417156153c35790509050046102005160206155916000396000518082028115838383041417156153c357905090508082018281106153c357905090506101a0518082028115838383041417156153c3579050905060646101c051606481038181116153c35790506101a0518082028115838383041417156153c35790509050046001602061559160003960005101610200518082028115838383041417156153c357905090508082018281106153c3579050905080156153c357808204905090506101a052610220516101a051116136c5576001610220516101a0518082038281116153c35790509050116136f0576101a0518352505050613702566136f0565b60016101a051610220518082038281116153c35790509050116136f0576101a0518352505050613702565b60010181811861351057505060006000fd5b565b606051604051146153c3576000606051126153c35760206155b160003960005160605112156153c3576000604051126153c35760206155b160003960005160405112156153c3576101c051610200526101e0516102205260603661024037610220516102a0526102005160206155916000396000518082028115838383041417156153c357905090506102c05260006008905b806102e05260206155b16000396000516102e051186137b557613871565b6040516102e051186137cd57608051610260526137fb565b6060516102e05114613866576102e05160a0518110156153c35760051b60c00151610260526137fb56613866565b61024051610260518082018281106153c35790509050610240526102a051610220518082028115838383041417156153c357905090506102605160206155916000396000518082028115838383041417156153c3579050905080156153c357808204905090506102a0525b600101818118613797575b50506102a051610220518082028115838383041417156153c35790509050606481028160648204186153c35790506102c05160206155916000396000518082028115838383041417156153c3579050905080156153c357808204905090506102a0526102405161022051606481028160648204186153c35790506102c05180156153c357808204905090508082018281106153c357905090506102e0526102205161030052600060ff905b8061032052610300516102805261030051610300518082028115838383041417156153c357905090506102a0518082018281106153c35790509050610300518060011b818160011c186153c35790506102e0518082018281106153c35790509050610220518082038281116153c3579050905080156153c35780820490509050610300526102805161030051116139dc57600161028051610300518082038281116153c3579050905011613a0757610300518352505050613a1956613a07565b600161030051610280518082038281116153c3579050905011613a0757610300518352505050613a19565b60010181811861391c57505060006000fd5b565b600b5460a0526402540be40060a05111613a3a57608051815250613ad9565b6040516060518082018281106153c357905090506fffffffffffffffffffffffffffffffff81116153c3576002810a905060c0526402540be4006402540be40060a051038060021b818160021c186153c35790506040518082028115838383041417156153c357905090506060518082028115838383041417156153c3579050905060c05180156153c357808204905090500160805160a05102048152505b565b6fffffffffffffffffffffffffffffffff60405116815260405160801c602082015250565b602061559160003960005161016051026101a052602061559160003960005160206155916000396000510a61018051046101c052600060206155b1600039600051600881116153c3578015613ba357905b806101e0526101c051610180518082028115838383041417156153c357905090506101e0516040518110156153c35760051b6060015180156153c357808204905090506101c052600101818118613b51575b505060006101e05260646101a051604051156153c357600060051b606001518082028115838383041417156153c357905090500461030052600160078101905b806103205260206155916000396000516103205118613c0157613cbc565b6101e051600781116153c35761030051610320516040518110156153c35760051b606001516101c051604051156153c357600060051b606001518082028115838383041417156153c35790509050048082018281106153c35790509050670de0b6b3a7640000810281670de0b6b3a76400008204186153c3579050610300516101c0518082018281106153c3579050905080156153c357808204905090508160051b6102000152600181016101e05250600101818118613be3575b50506101e05160208160051b018083826101e060045afa50505050565b6040516060527ffffffffffffffffffffffffffffffffffffffffffffffffdc0d0570925a462d760405113613d12576000815250613f2c565b680755bf798b4a1bf1e46040511315613d825760106080527f7761645f657870206f766572666c6f770000000000000000000000000000000060a0526080506080518060a001601f826000031636823750506308c379a06040526020606052601f19601f6080510116604401605cfd5b6503782dace9d9604051604e1b056060526b8000000000000000000000006bb17217f7d1cf79abc9e3b39860605160601b050160601d6080526bb17217f7d1cf79abc9e3b39860805102606051036060526d02d16720577bd19bf614176fe9ea6060516c10fe68e7fd37d0007b713f7650606051010260601d0160a05279d835ebba824c98fb31b83b2ca45c0000000000000000000000006060516e0587f503bb6ea29d25fcb74019645060a0516d04a4fd9f2a8b96949216d2255a6c60605160a05101030260601d01020160c0526d0277594991cfc85f6e2461837cd96060516c240c330e9fb2d9cbaf0fd5aafc606051030260601d0160e0526d1a521255e34f6a5061b25ef1c9c460605160e0510260601d0360e0526db1bbb201f443cf962f1a1d3db4a560605160e0510260601d0160e0526e02c72388d9f74f51a9331fed693f1560605160e0510260601d0360e0526e05180bb14799ab47a8a8cb2a527d5760605160e0510260601d0160e05260e05160c051056101005274029d9dc38563c32e5c2f6dc192ee70ef65f9978af3610100510260805160c303600081126153c3571c8152505b565b6fffffffffffffffffffffffffffffffff6101205116610180526101205160801c6101a0524261016051101561402f5761014051670de0b6b3a764000061016051420302048060ff1c6153c3577f800000000000000000000000000000000000000000000000000000000000000081146153c357600003604052613fb36101e0613cd9565b6101e0516101c052670de0b6b3a7640000610180516101c05180670de0b6b3a764000003670de0b6b3a764000081116153c35790508082028115838383041417156153c357905090506101a0516101c0518082028115838383041417156153c357905090508082018281106153c3579050905004815250614037565b6101a0518152505b565b60255460405261404a6104e0613adb565b6104e060406104a060408360045afa505060195460208160051b01600081601f0160051c600981116153c357801561409757905b80601901548160051b6104e0015260010181811861407e575b505050506104e05160208160051b0180610600826104e060045afa5050506103405160208160051b018060408261034060045afa505050610460516101605261048051610180526140e9610840613b00565b610840805160208160051b0180610720828560045afa5050505060006008905b80610840526020615591600039600051600181038181116153c3579050610840511861413457614203565b61084051610720518110156153c35760051b6107400151156141f85761084051610720518110156153c35760051b6107400151671bc16d674ec80000818118671bc16d674ec800008310021890506108a052610840516104e0518110156153c35760051b610500015161012052602354610140526104a051610160526141bb610860613f2e565b610860516108c0526040604060406108a060045afa506141dc610880612a1b565b6108805161084051610600518110156153c35760051b61062001525b600101818118614109575b50506106005160208160051b01600081601f0160051c600981116153c357801561424257905b8060051b61060001518160190155600101818118614229575b5050505060225461084052610480516108a0526108405161012052602454610140526104c05161016052614277610860613f2e565b610860516108c0526040604060406108a060045afa50614298610880612a1b565b6108805160225560006002905b80610860524261086051600181116153c35760051b6104a0015110156142db574261086051600181116153c35760051b6104a001525b6001018181186142a55750506104a0516040526104c051606052614300610860612a1b565b61086051602555565b614314610c20613370565b610c2051610c00526109805160208160051b018060408261098060045afa505050610c005161016052614348610c4061347b565b610c4051610c2052610bc051604052610be051606052610960516080526109805160208160051b018060a08261098060045afa505050610c00516101c052610c20516101e052614399610c60613704565b610c6051610c4052610be051610980518110156153c35760051b6109a00151610c40518082038281116153c35790509050600181038181116153c3579050610c60526402540be400610c6051610bc051610980518110156153c35760051b6109a00151610960518082018281106153c3579050905060011c604052610be051610980518110156153c35760051b6109a00151610c40518082018281106153c3579050905060011c606052600a54608052614454610ca0613a1b565b610ca0518082028115838383041417156153c3579050905004610c8052610c6051610c80518082038281116153c35790509050670de0b6b3a7640000810281670de0b6b3a76400008204186153c3579050610be051610aa0518110156153c35760051b610ac0015180156153c35780820490509050610c6052610be0516010548110156153c3576011018054610be051610aa0518110156153c35760051b610ac001516402540be400610c805164012a05f20081028164012a05f2008204186153c357905004670de0b6b3a7640000810281670de0b6b3a76400008204186153c3579050048082018281106153c357905090508155506109805160208160051b0180610ca08261098060045afa50505061096051610bc051610ca0518110156153c35760051b610cc00152610c4051610be051610ca0518110156153c35760051b610cc00152610ca05160208160051b018061034082610ca060045afa505050610c005161046052610c2051610480526145cc614039565b610c6051815250565b610e0051610de051146153c357610e2051156153c3576145f6610fc0612e1e565b610fc0805160208160051b0180610ea0828560045afa5050505061461b6110e0613177565b6110e0805160208160051b0180610fc0828560045afa50505050610ea05160208160051b0180604082610ea060045afa505050610fc05160208160051b018061016082610fc060045afa5050506146736112006132b8565b611200805160208160051b01806110e0828560045afa50505050610de051604052610e2051606052610dc051608052610e805160a0526146b4611220612a5c565b6112205161120052610de0516110e0518110156153c35760051b6111000151670de0b6b3a764000061120051610de051610ea0518110156153c35760051b610ec001518082028115838383041417156153c35790509050048082018281106153c357905090506112205261122051610960526110e05160208160051b0180610980826110e060045afa505050610ea05160208160051b0180610aa082610ea060045afa505050610de051610bc052610e0051610be052614775611260614309565b6112605161124052610e405161124051101561481657602e611260527f45786368616e676520726573756c74656420696e20666577657220636f696e73611280527f207468616e2065787065637465640000000000000000000000000000000000006112a05261126050611260518061128001601f826000031636823750506308c379a061122052602061124052601f19601f61126051011660440161123cfd5b610e005160405261124051606052610e6051608052614833612c34565b337f8b3e96f2b889fa771c53c981b40daf005f63f637f1869f707052d15a3dd97140610de051611260526112005161128052610e00516112a052611240516112c0526080611260a261124051815250565b6103c05160208160051b01806040826103c060045afa5050506104e05160208160051b0180610160826104e060045afa5050506148c26107406132b8565b610740805160208160051b0180610620828560045afa505050506106205160208160051b018060408261062060045afa505050610600516101605261490861074061347b565b61074051815250565b6000606051126153c35760206155b160003960005160605112156153c3576060366101c0376101a0516102205260405160206155916000396000518082028115838383041417156153c357905090506102405260006008905b806102605260206155b1600039600051610260511861498857614a2c565b6060516102605114614a2157610260516080518110156153c35760051b60a001516101e0526149b656614a21565b6101c0516101e0518082018281106153c357905090506101c052610220516101a0518082028115838383041417156153c357905090506101e05160206155916000396000518082028115838383041417156153c3579050905080156153c35780820490509050610220525b60010181811861496a575b5050610220516101a0518082028115838383041417156153c35790509050606481028160648204186153c35790506102405160206155916000396000518082028115838383041417156153c3579050905080156153c35780820490509050610220526101c0516101a051606481028160648204186153c35790506102405180156153c357808204905090508082018281106153c35790509050610260526101a05161028052600060ff905b806102a052610280516102005261028051610280518082028115838383041417156153c35790509050610220518082018281106153c35790509050610280518060011b818160011c186153c3579050610260518082018281106153c357905090506101a0518082038281116153c3579050905080156153c3578082049050905061028052610200516102805111614b9757600161020051610280518082038281116153c3579050905011614bc257610280518352505050614bd456614bc2565b600161028051610200518082038281116153c3579050905011614bc257610280518352505050614bd4565b600101818118614ad757505060006000fd5b565b614be1610420613370565b6104205161040052614bf4610540612e1e565b610540805160208160051b0180610420828560045afa505050506104205160208160051b01806108a08261042060045afa505050614c33610660613177565b610660805160208160051b01806109c0828560045afa5050505061024060406102406108a060045afa50614c686107806132b8565b610780805160208160051b0180610540828560045afa505050506105405160208160051b018060408261054060045afa5050506104005161016052614cae61068061347b565b610680516106605260285461068052610660516103c051610660518082028115838383041417156153c357905090506106805180156153c357808204905090508082038281116153c357905090506106a052610400516040526103e0516060526105405160208160051b018060808261054060045afa5050506106a0516101a052614d3a6106e0614911565b6106e0516106c052600160206155916000396000510360021b6020615591600039600051600a5402046106e0526105405160208160051b01806107008261054060045afa505050602061559160003960005160011b610660516106a0518082018281106153c3579050905004610820526080366108403760006008905b806108c05260206155b16000396000516108c05118614dd557614f33565b6000610840526108c051610540518110156153c35760051b6105600151610860526103e0516108c05118614e6857610860516106a0518082028115838383041417156153c357905090506106605180156153c357808204905090506106c0518082038281116153c3579050905061084052610860516106c0518082018281106153c3579050905060011c61088052614eb4565b61086051610860516106a0518082028115838383041417156153c357905090506106605180156153c357808204905090508082038281116153c357905090506108405261086051610880525b61088051604052610820516060526106e051608052614ed46108e0613a1b565b6108e0516108a052610860516402540be4006108a051610840518082028115838383041417156153c35790509050048082038281116153c357905090506108c051610700518110156153c35760051b6107200152600101818118614db7575b50506103e051610700518110156153c35760051b6107200151610400516040526103e0516060526107005160208160051b018060808261070060045afa5050506106a0516101a052614f866108e0614911565b6108e0518082038281116153c357905090506108c0526103e051610540518110156153c35760051b61056001516106c0518082038281116153c35790509050670de0b6b3a7640000810281670de0b6b3a76400008204186153c35790506103e051610420518110156153c35760051b610440015180156153c357808204905090506108e0526103e051610420518110156153c35760051b61044001516108c051600181038181116153c3579050670de0b6b3a7640000810281670de0b6b3a76400008204186153c3579050046108c0526106c0516103e051610540518110156153c35760051b61056001526108c05181526108e0516108c0518082038281116153c3579050905060208201526105405160208160051b016040830181818361054060045afa50505050610400516101608201526106a05161018082015250565b6028546060518082038281116153c357905090506028556026604051602052600052604060002080546060518082038281116153c3579050905081555060006040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60605160805260206080a3565b60206155d160003960005163cab4d3db610160526020610160600461017c845afa615166573d600060003e3d6000fd5b60203d106153c357610160518060a01c6153c3576101a0526101a09050516101405261014051615195576152ac565b60105460208160051b01600081601f0160051c600981116153c35780156151d157905b80601001548160051b61016001526001018181186151b8575b50505050600060206155b1600039600051600881116153c357801561526857905b806102805261028051610160518110156153c35760051b61018001511561525d576102805160405261028051610160518110156153c35760051b610180015160605261014051608052615243612c34565b600061028051610160518110156153c35760051b61018001525b6001018181186151f2575b50506101605160208160051b01600081601f0160051c600981116153c35780156152a757905b8060051b6101600151816010015560010181811861528e575b505050505b565b6020615d916000396000514614615338577fd87cd6ef79d4e2b95e15ce8abf732db51ec771f1ca2edccf22a46c729ac564726060526020615d716080397f1c54f243822e0e9a0a377610b81577e771b3efe79964e76636b0d5d10247950d60a0524660c0523060e0526020615db16101003960c06040526040805160208201209050815250615341565b6020615dd18239505b565b6026604051602052600052604060002080546080518082038281116153c357905090508155506026606051602052600052604060002080546080518082018281106153c357905090508155506060516040517fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60805160a052602060a0a3565b600080fd0299552109065754410a809453e60d1cfc54870c0081556007076c54db0ad40ddb8c15a5652081066c00e1059c4258c4011f053931ab521a342554fd4d5001d40576a9cd3e2608455e604cd215b585b72df5de0411651a4d01d20c376567df02ca21046529357750006a05e2e7d26400f925ec0238621a7d25fd0684b1259a0518160ddd229e05a9059cbb1c194570a0823102432530c540851a1605ddca3f4300a2055e0d443f21b86506fdde03013705a7256d09041b85c66106570078258edfdd5f00ae05ddc1f59d02f2a5cc2b27d7226c4590d208371a60253644e51520f205313ce56701c905081579a50c41851ddc3b01012b05d505accf1db8e5bfa0b13302da0595d89b410180051be913a50113057706db750e5565fee3f7f900ba05095ea7b31d4c4514f05979252c0565bbea6b298045907a016b1be505b4b577ad00d5054903b0d125042523b872dd1c4a65687276531b94252969e04a15cfa5551a65882819051405228800ed055409491a00c905015c283828c0454a6e32c60e5f857ecebe0002b2257e3db030037585dd62ed3e026b45bb7b8b8022b4053c157e6426b54576a2f0f024f4053df0212402e885f446c1d024db053db06dd823c165afb43012037fa5000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000020000000000000000000000005eee3091f747e60a045a2e715a4c71e600e31f6e0000000000000000000000000000000000000000000000000000000000000002000000000000000000000000c52d7f23a2e460248db6ee192cb23dd12bddcbf600000000000000000000000069420f9e38a4e60a62224c489be4bf7a94402496000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000de0b6b3a76400000000000000000000000000000000000000000000000000000de0b6b3a764000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000156372765553442f4d4f4e4559204375727665204c5000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000964666d6372765553440000000000000000000000000000000000000000000000e1702ff3d66f425a50cfaae93938a6cc864fc58d44d3c97e70619c861345a7fc000000000000000000000000000000000000000000000000000000000000000a9da6241791cf922ffcd1476bf1e0bb025d857e467a72dc431b34715b97ea8b0d6aeb32df99de9bdc79f347d162672598b1cf825e1aead7bb48da009278805cf1

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ Download: CSV Export  ]
[ Download: CSV Export  ]

A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.