Contract 0xb755b949c126c04e0348dd881a5cf55d424742b2 2

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x2e69cbb1b1c3092676ef02333d55b39dfba692d11c9af4237b32e4d9a6865055Claim_admin_fees200988822022-09-21 11:21:104 days 59 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00649897525
0x3787066e0126af74a736f4b9be3bcdabb7bad8483b2a77f72bba82574352ee36Claim_admin_fees198626392022-09-14 11:10:3411 days 1 hr ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00642832525
0x51f4e0ff98b99868792fcd9aa1c0c5a93ac0a17085b201b62d9a25969dd6bb7dClaim_admin_fees196389102022-09-07 12:36:3017 days 23 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.006714325
0x8d9d6a85a02afb73344552ec1bc9aeb2063bd51162ff857e70e28c570e833678Claim_admin_fees196388822022-09-07 12:35:3417 days 23 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.006783425
0xb4adb6c8bff319077d7051384c82ce1b4c38e3c3fff3b98422b495881fe74e7bClaim_admin_fees196365282022-09-07 10:56:1218 days 1 hr ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.006783425
0x51b846911da5b22ce6b4f64aa410d0307795ed833cbdf8d6fc8804cbe6fb3b2cClaim_admin_fees193576242022-08-31 12:22:5224 days 23 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668552525
0x0b3136e3a64ec3bab7a6b98b69013aed641f89976069448258a01a78d1eff1b5Claim_admin_fees193575872022-08-31 12:21:3824 days 23 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668362525
0xe3b6a635f13641df9c08227291664bb30c166f3f912042d032aaaead9d628032Claim_admin_fees193575002022-08-31 12:18:4125 days 1 min ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668362525
0xbb02d2fbd3283f8687543dbb7a7d9b618d7fa6da84d35acca3cd4cfa837a347fClaim_admin_fees190609252022-08-24 13:43:3631 days 22 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668337525
0xba59c32c4778aa739363a8322e652fe5fffbc21b8d7787f4ef3259e31a63f5d7Claim_admin_fees190608162022-08-24 13:39:5831 days 22 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.006574225
0x42a40437c1f6e84dfc2d821b4b9834738854e39cc039278c2c1bc85612cee2e7Claim_admin_fees187637322022-08-17 14:22:5038 days 21 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.0067855525
0xc8d2df0727a52875843ea8403e812efa1b7ec740b01b5af19753eab96ac9f44fClaim_admin_fees184589132022-08-10 11:28:1346 days 52 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00722242525
0xa647a99675179eef989b010919a2229f60b5b0b64333b547db489c7d9b115d19Claim_admin_fees184588672022-08-10 11:26:4146 days 53 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00661337525
0xc90f72792dcf4612d761d541b41b5b321ddde2856266d52267009101ffdc2747Claim_admin_fees181590282022-08-03 11:25:0753 days 55 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00661577525
0xbd8ca58290a359c492d18f612f806f2a5d5b5bccc47fbd6ac739956cbc070546Claim_admin_fees181589992022-08-03 11:24:0953 days 56 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668577525
0xc1e3da695050612cb685d12955634f85bcff603ed6cf40bb6c77a696a0b3204dClaim_admin_fees178679642022-07-27 12:28:2959 days 23 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668552525
0xb977dad90cca286b83156ab491639a4136cc72ecb6732dca959572b5d6b3423eClaim_admin_fees178679332022-07-27 12:27:2759 days 23 hrs ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00668617525
0x758e694acd6727e0e5f945e241f20fba1e12aac376394390002fc6f551737e05Claim_admin_fees175728852022-07-20 12:12:1267 days 8 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00669725
0xa2f1b5a73628e327ee14e86d9ecfac557c90eb0813e9a839f89845a4275e2232Claim_admin_fees175728592022-07-20 12:11:1967 days 9 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.0067691525
0xb65ce5f754540428f9fbcbe4484d3c514f05730ba535b4a53181a45af66e5e2dClaim_admin_fees175725482022-07-20 12:00:5267 days 19 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.0066972525
0x102df3333db78eaf9fbc29e6e04037e597fbaaeabe8aa1c44de67a3e48704ab7Claim_admin_fees175725222022-07-20 12:00:0067 days 20 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.00669725
0xec83c18faa26c18e7bc84e4d7b3fa715f67f65384b56cc39e91debf18c2bf2d2Claim_admin_fees175724902022-07-20 11:58:5667 days 21 mins ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.006769825
0x3bc53375d84e4c2f5e63b00fcc18a0a71326398780a884bd315dcf1505990a81Claim_admin_fees172704232022-07-13 11:19:5474 days 1 hr ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.03202525 125
0x58780271b7bf06751bae6f0269b1eebce8069f1868d85d34b51e195c3c55a496Claim_admin_fees172703792022-07-13 11:18:2774 days 1 hr ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.0064050525
0xdbc4b3fd13c115fd57c67d58ddb4227a950845660d0e367aba3a72d77d587516Claim_admin_fees172703652022-07-13 11:17:5874 days 1 hr ago0x8c73d39b2da2dd1a10cc16502bc7c8d768ec74c9 IN  0xb755b949c126c04e0348dd881a5cf55d424742b20 AVAX0.0205022480
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.15

Optimization Enabled:
N/A

Other Settings:
, None license

Contract Source Code (Vyper language format)

# @version 0.2.15
# (c) Curve.Fi, 2021
# Pool for 3Crv(USD)/BTC/ETH or similar
from vyper.interfaces import ERC20

interface CurveToken:
    def totalSupply() -> uint256: view
    def mint(_to: address, _value: uint256) -> bool: nonpayable
    def mint_relative(_to: address, frac: uint256) -> uint256: nonpayable
    def burnFrom(_to: address, _value: uint256) -> bool: nonpayable


interface Math:
    def geometric_mean(unsorted_x: uint256[N_COINS]) -> uint256: view
    def reduction_coefficient(x: uint256[N_COINS], fee_gamma: uint256) -> uint256: view
    def newton_D(ANN: uint256, gamma: uint256, x_unsorted: uint256[N_COINS]) -> uint256: view
    def newton_y(ANN: uint256, gamma: uint256, x: uint256[N_COINS], D: uint256, i: uint256) -> uint256: view
    def halfpow(power: uint256, precision: uint256) -> uint256: view
    def sqrt_int(x: uint256) -> uint256: view


interface Views:
    def get_dy(i: uint256, j: uint256, dx: uint256) -> uint256: view
    def calc_token_amount(amounts: uint256[N_COINS], deposit: bool) -> uint256: view


# Events
event TokenExchange:
    buyer: indexed(address)
    sold_id: uint256
    tokens_sold: uint256
    bought_id: uint256
    tokens_bought: uint256

event AddLiquidity:
    provider: indexed(address)
    token_amounts: uint256[N_COINS]
    fee: uint256
    token_supply: uint256

event RemoveLiquidity:
    provider: indexed(address)
    token_amounts: uint256[N_COINS]
    token_supply: uint256

event RemoveLiquidityOne:
    provider: indexed(address)
    token_amount: uint256
    coin_index: uint256
    coin_amount: uint256

event CommitNewAdmin:
    deadline: indexed(uint256)
    admin: indexed(address)

event NewAdmin:
    admin: indexed(address)

event CommitNewParameters:
    deadline: indexed(uint256)
    admin_fee: uint256
    mid_fee: uint256
    out_fee: uint256
    fee_gamma: uint256
    allowed_extra_profit: uint256
    adjustment_step: uint256
    ma_half_time: uint256

event NewParameters:
    admin_fee: uint256
    mid_fee: uint256
    out_fee: uint256
    fee_gamma: uint256
    allowed_extra_profit: uint256
    adjustment_step: uint256
    ma_half_time: uint256

event RampAgamma:
    initial_A: uint256
    future_A: uint256
    initial_gamma: uint256
    future_gamma: uint256
    initial_time: uint256
    future_time: uint256

event StopRampA:
    current_A: uint256
    current_gamma: uint256
    time: uint256

event ClaimAdminFee:
    admin: indexed(address)
    tokens: uint256


N_COINS: constant(int128) = 3  # <- change
PRECISION: constant(uint256) = 10 ** 18  # The precision to convert to
A_MULTIPLIER: constant(uint256) = 10000

# These addresses are replaced by the deployer
math: constant(address) = 0x06Ce8086965234400FDecAb190B115C2C0717047
token: constant(address) = 0x1daB6560494B04473A0BE3E7D83CF3Fdf3a51828
views: constant(address) = 0x3Fd1A0ae6a996b8f972f0089A4820f05c611Ec17
coins: constant(address[N_COINS]) = [
    0x1337BedC9D22ecbe766dF105c9623922A27963EC,
    0x686bEF2417b6Dc32C50a3cBfbCC3bb60E1e9a15D,
    0x53f7c5869a859F0AeC3D334ee8B4Cf01E3492f21,
]

price_scale_packed: uint256   # Internal price scale
price_oracle_packed: uint256  # Price target given by MA

last_prices_packed: uint256
last_prices_timestamp: public(uint256)

initial_A_gamma: public(uint256)
future_A_gamma: public(uint256)
initial_A_gamma_time: public(uint256)
future_A_gamma_time: public(uint256)

allowed_extra_profit: public(uint256)  # 2 * 10**12 - recommended value
future_allowed_extra_profit: public(uint256)

fee_gamma: public(uint256)
future_fee_gamma: public(uint256)

adjustment_step: public(uint256)
future_adjustment_step: public(uint256)

ma_half_time: public(uint256)
future_ma_half_time: public(uint256)

mid_fee: public(uint256)
out_fee: public(uint256)
admin_fee: public(uint256)
future_mid_fee: public(uint256)
future_out_fee: public(uint256)
future_admin_fee: public(uint256)

balances: public(uint256[N_COINS])
D: public(uint256)

owner: public(address)
future_owner: public(address)

xcp_profit: public(uint256)
xcp_profit_a: public(uint256)  # Full profit at last claim of admin fees
virtual_price: public(uint256)  # Cached (fast to read) virtual price also used internally
not_adjusted: bool

is_killed: public(bool)
kill_deadline: public(uint256)
transfer_ownership_deadline: public(uint256)
admin_actions_deadline: public(uint256)

reward_receiver: public(address)
admin_fee_receiver: public(address)

KILL_DEADLINE_DT: constant(uint256) = 2 * 30 * 86400
ADMIN_ACTIONS_DELAY: constant(uint256) = 3 * 86400
MIN_RAMP_TIME: constant(uint256) = 86400

MAX_ADMIN_FEE: constant(uint256) = 10 * 10 ** 9
MIN_FEE: constant(uint256) = 5 * 10 ** 5  # 0.5 bps
MAX_FEE: constant(uint256) = 10 * 10 ** 9
MIN_A: constant(uint256) = N_COINS**N_COINS * A_MULTIPLIER / 100
MAX_A: constant(uint256) = 1000 * A_MULTIPLIER * N_COINS**N_COINS
MAX_A_CHANGE: constant(uint256) = 10
MIN_GAMMA: constant(uint256) = 10**10
MAX_GAMMA: constant(uint256) = 5 * 10**16
NOISE_FEE: constant(uint256) = 10**5  # 0.1 bps

PRICE_SIZE: constant(int128) = 256 / (N_COINS-1)
PRICE_MASK: constant(uint256) = 2**PRICE_SIZE - 1

# This must be changed for different N_COINS
# For example:
# N_COINS = 3 -> 1  (10**18 -> 10**18)
# N_COINS = 4 -> 10**8  (10**18 -> 10**10)
# PRICE_PRECISION_MUL: constant(uint256) = 1
PRECISIONS: constant(uint256[N_COINS]) = [
    1,
    10000000000,
    1,
]

INF_COINS: constant(uint256) = 15

# Avalanche extras. Not needed on Ethereum! XXX
AVA_REWARDS: constant(address) = 0x01D83Fe6A10D2f2B7AF17034343746188272cAc9
WAVAX: constant(address) = 0xB31f66AA3C1e785363F0875A1B74E27b85FD66c7


@external
def __init__(
    owner: address,
    admin_fee_receiver: address,
    A: uint256,
    gamma: uint256,
    mid_fee: uint256,
    out_fee: uint256,
    allowed_extra_profit: uint256,
    fee_gamma: uint256,
    adjustment_step: uint256,
    admin_fee: uint256,
    ma_half_time: uint256,
    initial_prices: uint256[N_COINS-1]
):
    self.owner = owner

    # Pack A and gamma:
    # shifted A + gamma
    A_gamma: uint256 = shift(A, 128)
    A_gamma = bitwise_or(A_gamma, gamma)
    self.initial_A_gamma = A_gamma
    self.future_A_gamma = A_gamma

    self.mid_fee = mid_fee
    self.out_fee = out_fee
    self.allowed_extra_profit = allowed_extra_profit
    self.fee_gamma = fee_gamma
    self.adjustment_step = adjustment_step
    self.admin_fee = admin_fee

    # Packing prices
    packed_prices: uint256 = 0
    for k in range(N_COINS-1):
        packed_prices = shift(packed_prices, PRICE_SIZE)
        p: uint256 = initial_prices[N_COINS-2 - k]  # / PRICE_PRECISION_MUL
        assert p < PRICE_MASK
        packed_prices = bitwise_or(p, packed_prices)

    self.price_scale_packed = packed_prices
    self.price_oracle_packed = packed_prices
    self.last_prices_packed = packed_prices
    self.last_prices_timestamp = block.timestamp
    self.ma_half_time = ma_half_time

    self.xcp_profit_a = 10**18

    self.kill_deadline = block.timestamp + KILL_DEADLINE_DT

    self.admin_fee_receiver = admin_fee_receiver


@internal
@view
def _packed_view(k: uint256, p: uint256) -> uint256:
    assert k < N_COINS-1
    return bitwise_and(
        shift(p, -PRICE_SIZE * convert(k, int256)),
        PRICE_MASK
    )  # * PRICE_PRECISION_MUL


@external
@view
def price_oracle(k: uint256) -> uint256:
    return self._packed_view(k, self.price_oracle_packed)


@external
@view
def price_scale(k: uint256) -> uint256:
    return self._packed_view(k, self.price_scale_packed)


@external
@view
def last_prices(k: uint256) -> uint256:
    return self._packed_view(k, self.last_prices_packed)


@external
@view
def token() -> address:
    return token


@external
@view
def coins(i: uint256) -> address:
    _coins: address[N_COINS] = coins
    return _coins[i]


@internal
@view
def xp() -> uint256[N_COINS]:
    result: uint256[N_COINS] = self.balances
    packed_prices: uint256 = self.price_scale_packed

    precisions: uint256[N_COINS] = PRECISIONS

    result[0] *= PRECISIONS[0]
    for i in range(1, N_COINS):
        p: uint256 = bitwise_and(packed_prices, PRICE_MASK) * precisions[i]  # * PRICE_PRECISION_MUL
        result[i] = result[i] * p / PRECISION
        packed_prices = shift(packed_prices, -PRICE_SIZE)

    return result


@view
@internal
def _A_gamma() -> uint256[2]:
    t1: uint256 = self.future_A_gamma_time

    A_gamma_1: uint256 = self.future_A_gamma
    gamma1: uint256 = bitwise_and(A_gamma_1, 2**128-1)
    A1: uint256 = shift(A_gamma_1, -128)

    if block.timestamp < t1:
        # handle ramping up and down of A
        A_gamma_0: uint256 = self.initial_A_gamma
        t0: uint256 = self.initial_A_gamma_time

        # Less readable but more compact way of writing and converting to uint256
        # gamma0: uint256 = bitwise_and(A_gamma_0, 2**128-1)
        # A0: uint256 = shift(A_gamma_0, -128)
        # A1 = A0 + (A1 - A0) * (block.timestamp - t0) / (t1 - t0)
        # gamma1 = gamma0 + (gamma1 - gamma0) * (block.timestamp - t0) / (t1 - t0)

        t1 -= t0
        t0 = block.timestamp - t0
        t2: uint256 = t1 - t0

        A1 = (shift(A_gamma_0, -128) * t2 + A1 * t0) / t1
        gamma1 = (bitwise_and(A_gamma_0, 2**128-1) * t2 + gamma1 * t0) / t1

    return [A1, gamma1]


@view
@external
def A() -> uint256:
    return self._A_gamma()[0]


@view
@external
def gamma() -> uint256:
    return self._A_gamma()[1]


@internal
@view
def _fee(xp: uint256[N_COINS]) -> uint256:
    f: uint256 = Math(math).reduction_coefficient(xp, self.fee_gamma)
    return (self.mid_fee * f + self.out_fee * (10**18 - f)) / 10**18


@external
@view
def fee() -> uint256:
    return self._fee(self.xp())


@external
@view
def fee_calc(xp: uint256[N_COINS]) -> uint256:
    return self._fee(xp)


@internal
@view
def get_xcp(D: uint256) -> uint256:
    x: uint256[N_COINS] = empty(uint256[N_COINS])
    x[0] = D / N_COINS
    packed_prices: uint256 = self.price_scale_packed
    # No precisions here because we don't switch to "real" units

    for i in range(1, N_COINS):
        x[i] = D * 10**18 / (N_COINS * bitwise_and(packed_prices, PRICE_MASK))  # ... * PRICE_PRECISION_MUL)
        packed_prices = shift(packed_prices, -PRICE_SIZE)

    return Math(math).geometric_mean(x)


@external
@view
def get_virtual_price() -> uint256:
    return 10**18 * self.get_xcp(self.D) / CurveToken(token).totalSupply()


@internal
def _claim_admin_fees():
    A_gamma: uint256[2] = self._A_gamma()

    xcp_profit: uint256 = self.xcp_profit
    xcp_profit_a: uint256 = self.xcp_profit_a

    # Gulp here
    _coins: address[N_COINS] = coins
    for i in range(N_COINS):
        self.balances[i] = ERC20(_coins[i]).balanceOf(self)

    vprice: uint256 = self.virtual_price

    if xcp_profit > xcp_profit_a:
        fees: uint256 = (xcp_profit - xcp_profit_a) * self.admin_fee / (2 * 10**10)
        if fees > 0:
            receiver: address = self.admin_fee_receiver
            if receiver != ZERO_ADDRESS:
                frac: uint256 = vprice * 10**18 / (vprice - fees) - 10**18
                claimed: uint256 = CurveToken(token).mint_relative(receiver, frac)
                xcp_profit -= fees*2
                self.xcp_profit = xcp_profit
                log ClaimAdminFee(receiver, claimed)

    total_supply: uint256 = CurveToken(token).totalSupply()

    # Recalculate D b/c we gulped
    D: uint256 = Math(math).newton_D(A_gamma[0], A_gamma[1], self.xp())
    self.D = D

    self.virtual_price = 10**18 * self.get_xcp(D) / total_supply

    if xcp_profit > xcp_profit_a:
        self.xcp_profit_a = xcp_profit

    # push wAVAX rewards into the reward receiver
    receiver: address = self.reward_receiver
    if receiver != ZERO_ADDRESS:
        response: Bytes[32] = raw_call(
            AVA_REWARDS,
            concat(
                method_id("claimRewards(address[],uint256,address)"),
                convert(32 * 3, bytes32),
                convert(MAX_UINT256, bytes32),
                convert(self, bytes32),
                convert(2, bytes32),
                convert(coins[1], bytes32),
                convert(coins[2], bytes32),
            ),
            max_outsize=32
        )
        # can do if amount > 0, but here we try to save space rather than anything else
        # assert might be needed for some tokens - removed one to save bytespace
        ERC20(WAVAX).transfer(receiver, convert(response, uint256))


@internal
def tweak_price(A_gamma: uint256[2],
                _xp: uint256[N_COINS], i: uint256, p_i: uint256,
                new_D: uint256):
    price_oracle: uint256[N_COINS-1] = empty(uint256[N_COINS-1])
    last_prices: uint256[N_COINS-1] = empty(uint256[N_COINS-1])
    price_scale: uint256[N_COINS-1] = empty(uint256[N_COINS-1])
    xp: uint256[N_COINS] = empty(uint256[N_COINS])
    p_new: uint256[N_COINS-1] = empty(uint256[N_COINS-1])

    # Update MA if needed
    packed_prices: uint256 = self.price_oracle_packed
    for k in range(N_COINS-1):
        price_oracle[k] = bitwise_and(packed_prices, PRICE_MASK)  # * PRICE_PRECISION_MUL
        packed_prices = shift(packed_prices, -PRICE_SIZE)

    last_prices_timestamp: uint256 = self.last_prices_timestamp
    packed_prices = self.last_prices_packed
    for k in range(N_COINS-1):
        last_prices[k] = bitwise_and(packed_prices, PRICE_MASK)   # * PRICE_PRECISION_MUL
        packed_prices = shift(packed_prices, -PRICE_SIZE)

    if last_prices_timestamp < block.timestamp:
        # MA update required
        ma_half_time: uint256 = self.ma_half_time
        alpha: uint256 = Math(math).halfpow((block.timestamp - last_prices_timestamp) * 10**18 / ma_half_time, 10**10)
        packed_prices = 0
        for k in range(N_COINS-1):
            price_oracle[k] = (last_prices[k] * (10**18 - alpha) + price_oracle[k] * alpha) / 10**18
        for k in range(N_COINS-1):
            packed_prices = shift(packed_prices, PRICE_SIZE)
            p: uint256 = price_oracle[N_COINS-2 - k]  # / PRICE_PRECISION_MUL
            assert p < PRICE_MASK
            packed_prices = bitwise_or(p, packed_prices)
        self.price_oracle_packed = packed_prices
        self.last_prices_timestamp = block.timestamp

    D_unadjusted: uint256 = new_D  # Withdrawal methods know new D already
    if new_D == 0:
        # We will need this a few times (35k gas)
        D_unadjusted = Math(math).newton_D(A_gamma[0], A_gamma[1], _xp)
    packed_prices = self.price_scale_packed
    for k in range(N_COINS-1):
        price_scale[k] = bitwise_and(packed_prices, PRICE_MASK)  # * PRICE_PRECISION_MUL
        packed_prices = shift(packed_prices, -PRICE_SIZE)

    if p_i > 0:
        # Save the last price
        if i > 0:
            last_prices[i-1] = p_i
        else:
            # If 0th price changed - change all prices instead
            for k in range(N_COINS-1):
                last_prices[k] = last_prices[k] * 10**18 / p_i
    else:
        # calculate real prices
        # it would cost 70k gas for a 3-token pool. Sad. How do we do better?
        __xp: uint256[N_COINS] = _xp
        dx_price: uint256 = __xp[0] / 10**6
        __xp[0] += dx_price
        for k in range(N_COINS-1):
            last_prices[k] = price_scale[k] * dx_price / (_xp[k+1] - Math(math).newton_y(A_gamma[0], A_gamma[1], __xp, D_unadjusted, k+1))

    packed_prices = 0
    for k in range(N_COINS-1):
        packed_prices = shift(packed_prices, PRICE_SIZE)
        p: uint256 = last_prices[N_COINS-2 - k]  # / PRICE_PRECISION_MUL
        assert p < PRICE_MASK
        packed_prices = bitwise_or(p, packed_prices)
    self.last_prices_packed = packed_prices

    total_supply: uint256 = CurveToken(token).totalSupply()
    old_xcp_profit: uint256 = self.xcp_profit
    old_virtual_price: uint256 = self.virtual_price

    # Update profit numbers without price adjustment first
    xp[0] = D_unadjusted / N_COINS
    for k in range(N_COINS-1):
        xp[k+1] = D_unadjusted * 10**18 / (N_COINS * price_scale[k])
    xcp_profit: uint256 = 10**18
    virtual_price: uint256 = 10**18

    if old_virtual_price > 0:
        xcp: uint256 = Math(math).geometric_mean(xp)
        virtual_price = 10**18 * xcp / total_supply
        xcp_profit = old_xcp_profit * virtual_price / old_virtual_price

        t: uint256 = self.future_A_gamma_time
        if virtual_price < old_virtual_price and t == 0:
            raise "Loss"
        if t == 1:
            self.future_A_gamma_time = 0

    self.xcp_profit = xcp_profit

    needs_adjustment: bool = self.not_adjusted
    # if not needs_adjustment and (virtual_price-10**18 > (xcp_profit-10**18)/2 + self.allowed_extra_profit):
    # (re-arrange for gas efficiency)
    if not needs_adjustment and (virtual_price * 2 - 10**18 > xcp_profit + 2*self.allowed_extra_profit):
        needs_adjustment = True
        self.not_adjusted = True

    if needs_adjustment:
        adjustment_step: uint256 = self.adjustment_step
        norm: uint256 = 0

        for k in range(N_COINS-1):
            ratio: uint256 = price_oracle[k] * 10**18 / price_scale[k]
            if ratio > 10**18:
                ratio -= 10**18
            else:
                ratio = 10**18 - ratio
            norm += ratio**2

        if norm > adjustment_step ** 2 and old_virtual_price > 0:
            norm = Math(math).sqrt_int(norm / 10**18)  # Need to convert to 1e18 units!

            for k in range(N_COINS-1):
                p_new[k] = (price_scale[k] * (norm - adjustment_step) + adjustment_step * price_oracle[k]) / norm

            # Calculate balances*prices
            xp = _xp
            for k in range(N_COINS-1):
                xp[k+1] = _xp[k+1] * p_new[k] / price_scale[k]

            # Calculate "extended constant product" invariant xCP and virtual price
            D: uint256 = Math(math).newton_D(A_gamma[0], A_gamma[1], xp)
            xp[0] = D / N_COINS
            for k in range(N_COINS-1):
                xp[k+1] = D * 10**18 / (N_COINS * p_new[k])
            # We reuse old_virtual_price here but it's not old anymore
            old_virtual_price = 10**18 * Math(math).geometric_mean(xp) / total_supply

            # Proceed if we've got enough profit
            # if (old_virtual_price > 10**18) and (2 * (old_virtual_price - 10**18) > xcp_profit - 10**18):
            if (old_virtual_price > 10**18) and (2 * old_virtual_price - 10**18 > xcp_profit):
                packed_prices = 0
                for k in range(N_COINS-1):
                    packed_prices = shift(packed_prices, PRICE_SIZE)
                    p: uint256 = p_new[N_COINS-2 - k]  # / PRICE_PRECISION_MUL
                    assert p < PRICE_MASK
                    packed_prices = bitwise_or(p, packed_prices)
                self.price_scale_packed = packed_prices
                self.D = D
                self.virtual_price = old_virtual_price

                return

            else:
                self.not_adjusted = False

    # If we are here, the price_scale adjustment did not happen
    # Still need to update the profit counter and D
    self.D = D_unadjusted
    self.virtual_price = virtual_price

    # Automatic claiming of admin fees when gas is cheap
    self._claim_admin_fees()


@external
@nonreentrant('lock')
def exchange(i: uint256, j: uint256, dx: uint256, min_dy: uint256) -> uint256:
    assert not self.is_killed  # dev: the pool is killed
    assert i != j  # dev: coin index out of range
    assert i < N_COINS  # dev: coin index out of range
    assert j < N_COINS  # dev: coin index out of range
    assert dx > 0  # dev: do not exchange 0 coins

    A_gamma: uint256[2] = self._A_gamma()
    xp: uint256[N_COINS] = self.balances
    ix: uint256 = j
    p: uint256 = 0
    dy: uint256 = 0

    if True:  # scope to reduce size of memory when making internal calls later
        _coins: address[N_COINS] = coins
        ERC20(_coins[i]).transferFrom(msg.sender, self, dx)

        y: uint256 = xp[j]
        x0: uint256 = xp[i]
        xp[i] = x0 + dx
        self.balances[i] = xp[i]

        price_scale: uint256[N_COINS-1] = empty(uint256[N_COINS-1])
        packed_prices: uint256 = self.price_scale_packed
        for k in range(N_COINS-1):
            price_scale[k] = bitwise_and(packed_prices, PRICE_MASK)  # * PRICE_PRECISION_MUL
            packed_prices = shift(packed_prices, -PRICE_SIZE)

        precisions: uint256[N_COINS] = PRECISIONS
        xp[0] *= PRECISIONS[0]
        for k in range(1, N_COINS):
            xp[k] = xp[k] * price_scale[k-1] * precisions[k] / PRECISION

        prec_i: uint256 = precisions[i]

        # In case ramp is happening
        if True:
            t: uint256 = self.future_A_gamma_time
            if t > 0:
                x0 *= prec_i
                if i > 0:
                    x0 = x0 * price_scale[i-1] / PRECISION
                x1: uint256 = xp[i]  # Back up old value in xp
                xp[i] = x0
                self.D = Math(math).newton_D(A_gamma[0], A_gamma[1], xp)
                xp[i] = x1  # And restore
                if block.timestamp >= t:
                    self.future_A_gamma_time = 1

        prec_j: uint256 = precisions[j]

        dy = xp[j] - Math(math).newton_y(A_gamma[0], A_gamma[1], xp, self.D, j)
        # Not defining new "y" here to have less variables / make subsequent calls cheaper
        xp[j] -= dy
        dy -= 1

        if j > 0:
            dy = dy * PRECISION / price_scale[j-1]
        dy /= prec_j

        dy -= self._fee(xp) * dy / 10**10
        assert dy >= min_dy, "Slippage"
        y -= dy

        self.balances[j] = y
        # assert might be needed for some tokens - removed one to save bytespace
        ERC20(_coins[j]).transfer(msg.sender, dy)

        y *= prec_j
        if j > 0:
            y = y * price_scale[j-1] / PRECISION
        xp[j] = y

        # Calculate price
        if dx > 10**5 and dy > 10**5:
            _dx: uint256 = dx * prec_i
            _dy: uint256 = dy * prec_j
            if i != 0 and j != 0:
                p = bitwise_and(
                    shift(self.last_prices_packed, -PRICE_SIZE * convert(i-1, int256)),
                    PRICE_MASK
                ) * _dx / _dy  # * PRICE_PRECISION_MUL
            elif i == 0:
                p = _dx * 10**18 / _dy
            else:  # j == 0
                p = _dy * 10**18 / _dx
                ix = i

    self.tweak_price(A_gamma, xp, ix, p, 0)

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

    return dy


@external
@view
def get_dy(i: uint256, j: uint256, dx: uint256) -> uint256:
    return Views(views).get_dy(i, j, dx)


@view
@internal
def _calc_token_fee(amounts: uint256[N_COINS], xp: uint256[N_COINS]) -> uint256:
    # fee = sum(amounts_i - avg(amounts)) * fee' / sum(amounts)
    fee: uint256 = self._fee(xp) * N_COINS / (4 * (N_COINS-1))
    S: uint256 = 0
    for _x in amounts:
        S += _x
    avg: uint256 = S / N_COINS
    Sdiff: uint256 = 0
    for _x in amounts:
        if _x > avg:
            Sdiff += _x - avg
        else:
            Sdiff += avg - _x
    return fee * Sdiff / S + NOISE_FEE


@external
@view
def calc_token_fee(amounts: uint256[N_COINS], xp: uint256[N_COINS]) -> uint256:
    return self._calc_token_fee(amounts, xp)


@external
@nonreentrant('lock')
def add_liquidity(amounts: uint256[N_COINS], min_mint_amount: uint256):
    assert not self.is_killed  # dev: the pool is killed

    A_gamma: uint256[2] = self._A_gamma()

    _coins: address[N_COINS] = coins

    xp: uint256[N_COINS] = self.balances
    amountsp: uint256[N_COINS] = empty(uint256[N_COINS])
    xx: uint256[N_COINS] = empty(uint256[N_COINS])
    d_token: uint256 = 0
    d_token_fee: uint256 = 0
    old_D: uint256 = 0
    ix: uint256 = INF_COINS

    if True:  # Scope to avoid having extra variables in memory later
        xp_old: uint256[N_COINS] = xp

        for i in range(N_COINS):
            bal: uint256 = xp[i] + amounts[i]
            xp[i] = bal
            self.balances[i] = bal
        xx = xp

        precisions: uint256[N_COINS] = PRECISIONS
        packed_prices: uint256 = self.price_scale_packed
        xp[0] *= PRECISIONS[0]
        xp_old[0] *= PRECISIONS[0]
        for i in range(1, N_COINS):
            price_scale: uint256 = bitwise_and(packed_prices, PRICE_MASK) * precisions[i]  # * PRICE_PRECISION_MUL
            xp[i] = xp[i] * price_scale / PRECISION
            xp_old[i] = xp_old[i] * price_scale / PRECISION
            packed_prices = shift(packed_prices, -PRICE_SIZE)

        for i in range(N_COINS):
            if amounts[i] > 0:
                # assert might be needed for some tokens - removed one to save bytespace
                ERC20(_coins[i]).transferFrom(msg.sender, self, amounts[i])
                amountsp[i] = xp[i] - xp_old[i]
                if ix == INF_COINS:
                    ix = i
                else:
                    ix = INF_COINS-1
        assert ix != INF_COINS  # dev: no coins to add

        t: uint256 = self.future_A_gamma_time
        if t > 0:
            old_D = Math(math).newton_D(A_gamma[0], A_gamma[1], xp_old)
            if block.timestamp >= t:
                self.future_A_gamma_time = 1
        else:
            old_D = self.D

    D: uint256 = Math(math).newton_D(A_gamma[0], A_gamma[1], xp)

    token_supply: uint256 = CurveToken(token).totalSupply()
    if old_D > 0:
        d_token = token_supply * D / old_D - token_supply
    else:
        d_token = self.get_xcp(D)  # making initial virtual price equal to 1
    assert d_token > 0  # dev: nothing minted

    if old_D > 0:
        d_token_fee = self._calc_token_fee(amountsp, xp) * d_token / 10**10 + 1
        d_token -= d_token_fee
        token_supply += d_token
        CurveToken(token).mint(msg.sender, d_token)

        # Calculate price
        # p_i * (dx_i - dtoken / token_supply * xx_i) = sum{k!=i}(p_k * (dtoken / token_supply * xx_k - dx_k))
        # Only ix is nonzero
        p: uint256 = 0
        if d_token > 10**5:
            if ix < N_COINS:
                S: uint256 = 0
                last_prices: uint256[N_COINS-1] = empty(uint256[N_COINS-1])
                packed_prices: uint256 = self.last_prices_packed
                precisions: uint256[N_COINS] = PRECISIONS
                for k in range(N_COINS-1):
                    last_prices[k] = bitwise_and(packed_prices, PRICE_MASK)  # * PRICE_PRECISION_MUL
                    packed_prices = shift(packed_prices, -PRICE_SIZE)
                for i in range(N_COINS):
                    if i != ix:
                        if i == 0:
                            S += xx[0] * PRECISIONS[0]
                        else:
                            S += xx[i] * last_prices[i-1] * precisions[i] / PRECISION
                S = S * d_token / token_supply
                p = S * PRECISION / (amounts[ix] * precisions[ix] - d_token * xx[ix] * precisions[ix] / token_supply)

        self.tweak_price(A_gamma, xp, ix, p, D)

    else:
        self.D = D
        self.virtual_price = 10**18
        self.xcp_profit = 10**18
        CurveToken(token).mint(msg.sender, d_token)

    assert d_token >= min_mint_amount, "Slippage"

    log AddLiquidity(msg.sender, amounts, d_token_fee, token_supply)


@external
@nonreentrant('lock')
def remove_liquidity(_amount: uint256, min_amounts: uint256[N_COINS]):
    """
    This withdrawal method is very safe, does no complex math
    """
    _coins: address[N_COINS] = coins
    total_supply: uint256 = CurveToken(token).totalSupply()
    CurveToken(token).burnFrom(msg.sender, _amount)
    balances: uint256[N_COINS] = self.balances
    amount: uint256 = _amount - 1  # Make rounding errors favoring other LPs a tiny bit

    for i in range(N_COINS):
        d_balance: uint256 = balances[i] * amount / total_supply
        assert d_balance >= min_amounts[i]
        self.balances[i] = balances[i] - d_balance
        balances[i] = d_balance  # now it's the amounts going out
        # assert might be needed for some tokens - removed one to save bytespace
        ERC20(_coins[i]).transfer(msg.sender, d_balance)

    D: uint256 = self.D
    self.D = D - D * amount / total_supply

    log RemoveLiquidity(msg.sender, balances, total_supply - _amount)


@view
@external
def calc_token_amount(amounts: uint256[N_COINS], deposit: bool) -> uint256:
    return Views(views).calc_token_amount(amounts, deposit)


@internal
@view
def _calc_withdraw_one_coin(A_gamma: uint256[2], token_amount: uint256, i: uint256, update_D: bool,
                            calc_price: bool) -> (uint256, uint256, uint256, uint256[N_COINS]):
    token_supply: uint256 = CurveToken(token).totalSupply()
    assert token_amount <= token_supply  # dev: token amount more than supply
    assert i < N_COINS  # dev: coin out of range

    xx: uint256[N_COINS] = self.balances
    xp: uint256[N_COINS] = PRECISIONS
    D0: uint256 = 0

    price_scale_i: uint256 = PRECISION * PRECISIONS[0]
    if True:  # To remove packed_prices from memory
        packed_prices: uint256 = self.price_scale_packed
        xp[0] *= xx[0]
        for k in range(1, N_COINS):
            p: uint256 = bitwise_and(packed_prices, PRICE_MASK)  # * PRICE_PRECISION_MUL
            if i == k:
                price_scale_i = p * xp[i]
            xp[k] = xp[k] * xx[k] * p / PRECISION
            packed_prices = shift(packed_prices, -PRICE_SIZE)

    if update_D:
        D0 = Math(math).newton_D(A_gamma[0], A_gamma[1], xp)
    else:
        D0 = self.D

    D: uint256 = D0

    # Charge the fee on D, not on y, e.g. reducing invariant LESS than charging the user
    fee: uint256 = self._fee(xp)
    dD: uint256 = token_amount * D / token_supply
    D -= (dD - (fee * dD / (2 * 10**10) + 1))
    y: uint256 = Math(math).newton_y(A_gamma[0], A_gamma[1], xp, D, i)
    dy: uint256 = (xp[i] - y) * PRECISION / price_scale_i
    xp[i] = y

    # Price calc
    p: uint256 = 0
    if calc_price and dy > 10**5 and token_amount > 10**5:
        # p_i = dD / D0 * sum'(p_k * x_k) / (dy - dD / D0 * y0)
        S: uint256 = 0
        precisions: uint256[N_COINS] = PRECISIONS
        last_prices: uint256[N_COINS-1] = empty(uint256[N_COINS-1])
        packed_prices: uint256 = self.last_prices_packed
        for k in range(N_COINS-1):
            last_prices[k] = bitwise_and(packed_prices, PRICE_MASK)  # * PRICE_PRECISION_MUL
            packed_prices = shift(packed_prices, -PRICE_SIZE)
        for k in range(N_COINS):
            if k != i:
                if k == 0:
                    S += xx[0] * PRECISIONS[0]
                else:
                    S += xx[k] * last_prices[k-1] * precisions[k] / PRECISION
        S = S * dD / D0
        p = S * PRECISION / (dy * precisions[i] - dD * xx[i] * precisions[i] / D0)

    return dy, p, D, xp


@view
@external
def calc_withdraw_one_coin(token_amount: uint256, i: uint256) -> uint256:
    return self._calc_withdraw_one_coin(self._A_gamma(), token_amount, i, True, False)[0]


@external
@nonreentrant('lock')
def remove_liquidity_one_coin(token_amount: uint256, i: uint256, min_amount: uint256):
    assert not self.is_killed  # dev: the pool is killed

    A_gamma: uint256[2] = self._A_gamma()

    dy: uint256 = 0
    D: uint256 = 0
    p: uint256 = 0
    xp: uint256[N_COINS] = empty(uint256[N_COINS])
    future_A_gamma_time: uint256 = self.future_A_gamma_time
    dy, p, D, xp = self._calc_withdraw_one_coin(A_gamma, token_amount, i, (future_A_gamma_time > 0), True)
    assert dy >= min_amount, "Slippage"

    if block.timestamp >= future_A_gamma_time:
        self.future_A_gamma_time = 1

    self.balances[i] -= dy
    CurveToken(token).burnFrom(msg.sender, token_amount)
    _coins: address[N_COINS] = coins
    # assert might be needed for some tokens - removed one to save bytespace
    ERC20(_coins[i]).transfer(msg.sender, dy)

    self.tweak_price(A_gamma, xp, i, p, D)


    log RemoveLiquidityOne(msg.sender, token_amount, i, dy)


@external
@nonreentrant('lock')
def claim_admin_fees():
    self._claim_admin_fees()


# Admin parameters
@external
def ramp_A_gamma(future_A: uint256, future_gamma: uint256, future_time: uint256):
    assert msg.sender == self.owner  # dev: only owner
    assert block.timestamp > self.initial_A_gamma_time + (MIN_RAMP_TIME-1)
    assert future_time > block.timestamp + (MIN_RAMP_TIME-1)  # dev: insufficient time

    A_gamma: uint256[2] = self._A_gamma()
    initial_A_gamma: uint256 = shift(A_gamma[0], 128)
    initial_A_gamma = bitwise_or(initial_A_gamma, A_gamma[1])

    assert future_A > MIN_A-1
    assert future_A < MAX_A+1
    assert future_gamma > MIN_GAMMA-1
    assert future_gamma < MAX_GAMMA+1

    ratio: uint256 = 10**18 * future_A / A_gamma[0]
    assert ratio < 10**18 * MAX_A_CHANGE + 1
    assert ratio > 10**18 / MAX_A_CHANGE - 1

    ratio = 10**18 * future_gamma / A_gamma[1]
    assert ratio < 10**18 * MAX_A_CHANGE + 1
    assert ratio > 10**18 / MAX_A_CHANGE - 1

    self.initial_A_gamma = initial_A_gamma
    self.initial_A_gamma_time = block.timestamp

    future_A_gamma: uint256 = shift(future_A, 128)
    future_A_gamma = bitwise_or(future_A_gamma, future_gamma)
    self.future_A_gamma_time = future_time
    self.future_A_gamma = future_A_gamma

    log RampAgamma(A_gamma[0], future_A, A_gamma[1], future_gamma, block.timestamp, future_time)


@external
def stop_ramp_A_gamma():
    assert msg.sender == self.owner  # dev: only owner

    A_gamma: uint256[2] = self._A_gamma()
    current_A_gamma: uint256 = shift(A_gamma[0], 128)
    current_A_gamma = bitwise_or(current_A_gamma, A_gamma[1])
    self.initial_A_gamma = current_A_gamma
    self.future_A_gamma = current_A_gamma
    self.initial_A_gamma_time = block.timestamp
    self.future_A_gamma_time = block.timestamp
    # now (block.timestamp < t1) is always False, so we return saved A

    log StopRampA(A_gamma[0], A_gamma[1], block.timestamp)


@external
def commit_new_parameters(
    _new_mid_fee: uint256,
    _new_out_fee: uint256,
    _new_admin_fee: uint256,
    _new_fee_gamma: uint256,
    _new_allowed_extra_profit: uint256,
    _new_adjustment_step: uint256,
    _new_ma_half_time: uint256,
    ):
    assert msg.sender == self.owner  # dev: only owner
    assert self.admin_actions_deadline == 0  # dev: active action

    new_mid_fee: uint256 = _new_mid_fee
    new_out_fee: uint256 = _new_out_fee
    new_admin_fee: uint256 = _new_admin_fee
    new_fee_gamma: uint256 = _new_fee_gamma
    new_allowed_extra_profit: uint256 = _new_allowed_extra_profit
    new_adjustment_step: uint256 = _new_adjustment_step
    new_ma_half_time: uint256 = _new_ma_half_time

    # Fees
    if new_out_fee < MAX_FEE+1:
        assert new_out_fee > MIN_FEE-1  # dev: fee is out of range
    else:
        new_out_fee = self.out_fee
    if new_mid_fee > MAX_FEE:
        new_mid_fee = self.mid_fee
    assert new_mid_fee <= new_out_fee  # dev: mid-fee is too high
    if new_admin_fee > MAX_ADMIN_FEE:
        new_admin_fee = self.admin_fee

    # AMM parameters
    if new_fee_gamma < 10**18:
        assert new_fee_gamma > 0  # dev: fee_gamma out of range [1 .. 10**18]
    else:
        new_fee_gamma = self.fee_gamma
    if new_allowed_extra_profit > 10**18:
        new_allowed_extra_profit = self.allowed_extra_profit
    if new_adjustment_step > 10**18:
        new_adjustment_step = self.adjustment_step

    # MA
    if new_ma_half_time < 7*86400:
        assert new_ma_half_time > 0  # dev: MA time should be longer than 1 second
    else:
        new_ma_half_time = self.ma_half_time

    _deadline: uint256 = block.timestamp + ADMIN_ACTIONS_DELAY
    self.admin_actions_deadline = _deadline

    self.future_admin_fee = new_admin_fee
    self.future_mid_fee = new_mid_fee
    self.future_out_fee = new_out_fee
    self.future_fee_gamma = new_fee_gamma
    self.future_allowed_extra_profit = new_allowed_extra_profit
    self.future_adjustment_step = new_adjustment_step
    self.future_ma_half_time = new_ma_half_time

    log CommitNewParameters(_deadline, new_admin_fee, new_mid_fee, new_out_fee,
                            new_fee_gamma,
                            new_allowed_extra_profit, new_adjustment_step,
                            new_ma_half_time)


@external
@nonreentrant('lock')
def apply_new_parameters():
    assert msg.sender == self.owner  # dev: only owner
    assert block.timestamp >= self.admin_actions_deadline  # dev: insufficient time
    assert self.admin_actions_deadline != 0  # dev: no active action

    self.admin_actions_deadline = 0

    admin_fee: uint256 = self.future_admin_fee
    if self.admin_fee != admin_fee:
        self._claim_admin_fees()
        self.admin_fee = admin_fee

    mid_fee: uint256 = self.future_mid_fee
    self.mid_fee = mid_fee
    out_fee: uint256 = self.future_out_fee
    self.out_fee = out_fee
    fee_gamma: uint256 = self.future_fee_gamma
    self.fee_gamma = fee_gamma
    allowed_extra_profit: uint256 = self.future_allowed_extra_profit
    self.allowed_extra_profit = allowed_extra_profit
    adjustment_step: uint256 = self.future_adjustment_step
    self.adjustment_step = adjustment_step
    ma_half_time: uint256 = self.future_ma_half_time
    self.ma_half_time = ma_half_time

    log NewParameters(admin_fee, mid_fee, out_fee,
                      fee_gamma,
                      allowed_extra_profit, adjustment_step,
                      ma_half_time)


@external
def revert_new_parameters():
    assert msg.sender == self.owner  # dev: only owner

    self.admin_actions_deadline = 0


@external
def commit_transfer_ownership(_owner: address):
    assert msg.sender == self.owner  # dev: only owner
    assert self.transfer_ownership_deadline == 0  # dev: active transfer

    _deadline: uint256 = block.timestamp + ADMIN_ACTIONS_DELAY
    self.transfer_ownership_deadline = _deadline
    self.future_owner = _owner

    log CommitNewAdmin(_deadline, _owner)


@external
def apply_transfer_ownership():
    assert msg.sender == self.owner  # dev: only owner
    assert block.timestamp >= self.transfer_ownership_deadline  # dev: insufficient time
    assert self.transfer_ownership_deadline != 0  # dev: no active transfer

    self.transfer_ownership_deadline = 0
    _owner: address = self.future_owner
    self.owner = _owner

    log NewAdmin(_owner)


@external
def revert_transfer_ownership():
    assert msg.sender == self.owner  # dev: only owner

    self.transfer_ownership_deadline = 0


@external
def kill_me():
    assert msg.sender == self.owner  # dev: only owner
    assert self.kill_deadline > block.timestamp  # dev: deadline has passed
    self.is_killed = True


@external
def unkill_me():
    assert msg.sender == self.owner  # dev: only owner
    self.is_killed = False


@external
def set_reward_receiver(_reward_receiver: address):
    assert msg.sender == self.owner  # dev: only owner
    self.reward_receiver = _reward_receiver


@external
def set_admin_fee_receiver(_admin_fee_receiver: address):
    assert msg.sender == self.owner  # dev: only owner
    self.admin_fee_receiver = _admin_fee_receiver

Contract ABI

[{"name":"TokenExchange","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"sold_id","type":"uint256","indexed":false},{"name":"tokens_sold","type":"uint256","indexed":false},{"name":"bought_id","type":"uint256","indexed":false},{"name":"tokens_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"fee","type":"uint256","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidity","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amounts","type":"uint256[3]","indexed":false},{"name":"token_supply","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RemoveLiquidityOne","inputs":[{"name":"provider","type":"address","indexed":true},{"name":"token_amount","type":"uint256","indexed":false},{"name":"coin_index","type":"uint256","indexed":false},{"name":"coin_amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"name":"deadline","type":"uint256","indexed":true},{"name":"admin","type":"address","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"name":"admin","type":"address","indexed":true}],"anonymous":false,"type":"event"},{"name":"CommitNewParameters","inputs":[{"name":"deadline","type":"uint256","indexed":true},{"name":"admin_fee","type":"uint256","indexed":false},{"name":"mid_fee","type":"uint256","indexed":false},{"name":"out_fee","type":"uint256","indexed":false},{"name":"fee_gamma","type":"uint256","indexed":false},{"name":"allowed_extra_profit","type":"uint256","indexed":false},{"name":"adjustment_step","type":"uint256","indexed":false},{"name":"ma_half_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"NewParameters","inputs":[{"name":"admin_fee","type":"uint256","indexed":false},{"name":"mid_fee","type":"uint256","indexed":false},{"name":"out_fee","type":"uint256","indexed":false},{"name":"fee_gamma","type":"uint256","indexed":false},{"name":"allowed_extra_profit","type":"uint256","indexed":false},{"name":"adjustment_step","type":"uint256","indexed":false},{"name":"ma_half_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RampAgamma","inputs":[{"name":"initial_A","type":"uint256","indexed":false},{"name":"future_A","type":"uint256","indexed":false},{"name":"initial_gamma","type":"uint256","indexed":false},{"name":"future_gamma","type":"uint256","indexed":false},{"name":"initial_time","type":"uint256","indexed":false},{"name":"future_time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"StopRampA","inputs":[{"name":"current_A","type":"uint256","indexed":false},{"name":"current_gamma","type":"uint256","indexed":false},{"name":"time","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"ClaimAdminFee","inputs":[{"name":"admin","type":"address","indexed":true},{"name":"tokens","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"owner","type":"address"},{"name":"admin_fee_receiver","type":"address"},{"name":"A","type":"uint256"},{"name":"gamma","type":"uint256"},{"name":"mid_fee","type":"uint256"},{"name":"out_fee","type":"uint256"},{"name":"allowed_extra_profit","type":"uint256"},{"name":"fee_gamma","type":"uint256"},{"name":"adjustment_step","type":"uint256"},{"name":"admin_fee","type":"uint256"},{"name":"ma_half_time","type":"uint256"},{"name":"initial_prices","type":"uint256[2]"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"price_oracle","inputs":[{"name":"k","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":3271},{"stateMutability":"view","type":"function","name":"price_scale","inputs":[{"name":"k","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":3301},{"stateMutability":"view","type":"function","name":"last_prices","inputs":[{"name":"k","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":3331},{"stateMutability":"view","type":"function","name":"token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":378},{"stateMutability":"view","type":"function","name":"coins","inputs":[{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"address"}],"gas":492},{"stateMutability":"view","type":"function","name":"A","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":507},{"stateMutability":"view","type":"function","name":"gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":11901},{"stateMutability":"view","type":"function","name":"fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":21391},{"stateMutability":"view","type":"function","name":"fee_calc","inputs":[{"name":"xp","type":"uint256[3]"}],"outputs":[{"name":"","type":"uint256"}],"gas":11006},{"stateMutability":"view","type":"function","name":"get_virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":11492},{"stateMutability":"nonpayable","type":"function","name":"exchange","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"},{"name":"min_dy","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":1410215},{"stateMutability":"view","type":"function","name":"get_dy","inputs":[{"name":"i","type":"uint256"},{"name":"j","type":"uint256"},{"name":"dx","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":3032},{"stateMutability":"view","type":"function","name":"calc_token_fee","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"xp","type":"uint256[3]"}],"outputs":[{"name":"","type":"uint256"}],"gas":26492},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"min_mint_amount","type":"uint256"}],"outputs":[],"gas":1421774},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_amount","type":"uint256"},{"name":"min_amounts","type":"uint256[3]"}],"outputs":[],"gas":225587},{"stateMutability":"view","type":"function","name":"calc_token_amount","inputs":[{"name":"amounts","type":"uint256[3]"},{"name":"deposit","type":"bool"}],"outputs":[{"name":"","type":"uint256"}],"gas":3339},{"stateMutability":"view","type":"function","name":"calc_withdraw_one_coin","inputs":[{"name":"token_amount","type":"uint256"},{"name":"i","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":13342},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"token_amount","type":"uint256"},{"name":"i","type":"uint256"},{"name":"min_amount","type":"uint256"}],"outputs":[],"gas":1337120},{"stateMutability":"nonpayable","type":"function","name":"claim_admin_fees","inputs":[],"outputs":[],"gas":403671},{"stateMutability":"nonpayable","type":"function","name":"ramp_A_gamma","inputs":[{"name":"future_A","type":"uint256"},{"name":"future_gamma","type":"uint256"},{"name":"future_time","type":"uint256"}],"outputs":[],"gas":163012},{"stateMutability":"nonpayable","type":"function","name":"stop_ramp_A_gamma","inputs":[],"outputs":[],"gas":157157},{"stateMutability":"nonpayable","type":"function","name":"commit_new_parameters","inputs":[{"name":"_new_mid_fee","type":"uint256"},{"name":"_new_out_fee","type":"uint256"},{"name":"_new_admin_fee","type":"uint256"},{"name":"_new_fee_gamma","type":"uint256"},{"name":"_new_allowed_extra_profit","type":"uint256"},{"name":"_new_adjustment_step","type":"uint256"},{"name":"_new_ma_half_time","type":"uint256"}],"outputs":[],"gas":306100},{"stateMutability":"nonpayable","type":"function","name":"apply_new_parameters","inputs":[],"outputs":[],"gas":697301},{"stateMutability":"nonpayable","type":"function","name":"revert_new_parameters","inputs":[],"outputs":[],"gas":23132},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"_owner","type":"address"}],"outputs":[],"gas":77170},{"stateMutability":"nonpayable","type":"function","name":"apply_transfer_ownership","inputs":[],"outputs":[],"gas":65847},{"stateMutability":"nonpayable","type":"function","name":"revert_transfer_ownership","inputs":[],"outputs":[],"gas":23222},{"stateMutability":"nonpayable","type":"function","name":"kill_me","inputs":[],"outputs":[],"gas":40445},{"stateMutability":"nonpayable","type":"function","name":"unkill_me","inputs":[],"outputs":[],"gas":23282},{"stateMutability":"nonpayable","type":"function","name":"set_reward_receiver","inputs":[{"name":"_reward_receiver","type":"address"}],"outputs":[],"gas":38415},{"stateMutability":"nonpayable","type":"function","name":"set_admin_fee_receiver","inputs":[{"name":"_admin_fee_receiver","type":"address"}],"outputs":[],"gas":38445},{"stateMutability":"view","type":"function","name":"last_prices_timestamp","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3318},{"stateMutability":"view","type":"function","name":"initial_A_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3348},{"stateMutability":"view","type":"function","name":"future_A_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3378},{"stateMutability":"view","type":"function","name":"initial_A_gamma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3408},{"stateMutability":"view","type":"function","name":"future_A_gamma_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3438},{"stateMutability":"view","type":"function","name":"allowed_extra_profit","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3468},{"stateMutability":"view","type":"function","name":"future_allowed_extra_profit","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3498},{"stateMutability":"view","type":"function","name":"fee_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3528},{"stateMutability":"view","type":"function","name":"future_fee_gamma","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3558},{"stateMutability":"view","type":"function","name":"adjustment_step","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3588},{"stateMutability":"view","type":"function","name":"future_adjustment_step","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3618},{"stateMutability":"view","type":"function","name":"ma_half_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3648},{"stateMutability":"view","type":"function","name":"future_ma_half_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3678},{"stateMutability":"view","type":"function","name":"mid_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3708},{"stateMutability":"view","type":"function","name":"out_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3738},{"stateMutability":"view","type":"function","name":"admin_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3768},{"stateMutability":"view","type":"function","name":"future_mid_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3798},{"stateMutability":"view","type":"function","name":"future_out_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3828},{"stateMutability":"view","type":"function","name":"future_admin_fee","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3858},{"stateMutability":"view","type":"function","name":"balances","inputs":[{"name":"arg0","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":3933},{"stateMutability":"view","type":"function","name":"D","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3918},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3948},{"stateMutability":"view","type":"function","name":"future_owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3978},{"stateMutability":"view","type":"function","name":"xcp_profit","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":4008},{"stateMutability":"view","type":"function","name":"xcp_profit_a","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":4038},{"stateMutability":"view","type":"function","name":"virtual_price","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":4068},{"stateMutability":"view","type":"function","name":"is_killed","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":4098},{"stateMutability":"view","type":"function","name":"kill_deadline","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":4128},{"stateMutability":"view","type":"function","name":"transfer_ownership_deadline","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":4158},{"stateMutability":"view","type":"function","name":"admin_actions_deadline","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":4188},{"stateMutability":"view","type":"function","name":"reward_receiver","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":4218},{"stateMutability":"view","type":"function","name":"admin_fee_receiver","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":4248}]

6101a06156e86101403960206156e860c03960c05160a01c6156e357602060206156e80160c03960c05160a01c6156e357610140516020556101805160801b6102e0526101a0516102e051176102e0526102e051600a556102e051600b556101c0516016556101e05160175561020051600e5561022051601055610240516012556102605160185560006103005261032060006002818352015b6103005160801b610300526102a06001610320518082106156e3578082039050905060028110156156e3576020020151610340526fffffffffffffffffffffffffffffffff6103405110156156e357610300516103405117610300525b8151600101808352811415610099575b50506103005160065561030051600755610300516008554260095561028051601455670de0b6b3a764000060235542624f1a0081818301106156e3578082019050905060275561016051602b556156cb56600436101561000d57612ef2565b600035601c526000513461556e576368727653811415610057576004356101405260075461016052610160516101405160065801612ef8565b6101c0526101c05160005260206000f35b63a3f7cdd5811415610093576004356101405260065461016052610160516101405160065801612ef8565b6101c0526101c05160005260206000f35b63591890178114156100cf576004356101405260085461016052610160516101405160065801612ef8565b6101c0526101c05160005260206000f35b63fc0c546a8114156100f957731dab6560494b04473a0be3e7d83cf3fdf3a5182860005260206000f35b63c661065781141561016d57731337bedc9d22ecbe766df105c9623922a27963ec6101405273686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d610160527353f7c5869a859f0aec3d334ee8b4cf01e3492f2161018052610140600435600381101561556e57602002015160005260206000f35b63f446c1d081141561019757600658016130f1565b61014052610160526101405160005260206000f35b63b13739298114156101c457600658016130f1565b61014052610160526101406020015160005260206000f35b63ddca3f4381141561026f5760065801612f96565b61014052610160526101805261014080516101a05280602001516101c05280604001516101e052506101405161016051610180516101a0516101c0516101e0516101a051610200526101c051610220526101e05161024052610240516102205161020051600658016132b1565b6102a0526101e0526101c0526101a0526101805261016052610140526102a05160005260206000f35b63572e56258114156102bc57600480356101405280602001356101605280604001356101805250610180516101605161014051600658016132b1565b6101e0526101e05160005260206000f35b63bb7b8b8081141561035957670de0b6b3a7640000601f546101405261014051600658016133a2565b6101a0526101a05180820282158284830414171561556e5780905090509050602061022060046318160ddd6101c0526101dc731dab6560494b04473a0be3e7d83cf3fdf3a518285afa1561556e57601f3d111561556e576000506102205180801561556e5782049050905060005260206000f35b635b41b908811415610e6a5760005461556e57600160005560265461556e57602435600435181561556e576003600435101561556e576003602435101561556e576000604435111561556e576101405161016051600658016130f1565b610180526101a052610160526101405261018080516101405280602001516101605250601c80546101805260018101546101a05260028101546101c052506024356101e05260403661020037600115610d6957731337bedc9d22ecbe766df105c9623922a27963ec6102405273686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d610260527353f7c5869a859f0aec3d334ee8b4cf01e3492f2161028052602061036060646323b872dd6102a052336102c052306102e052604435610300526102bc6000610240600435600381101561556e5760200201515af11561556e57601f3d111561556e5760005061036050610180602435600381101561556e5760200201516102a052610180600435600381101561556e5760200201516102c0526102c051604435818183011061556e5780820190509050610180600435600381101561556e576020020152610180600435600381101561556e5760200201516001600435600381101561556e5702601c01556040366102e0376006546103205261034060006002818352015b6fffffffffffffffffffffffffffffffff61032051166102e061034051600281101561556e5760200201526103205160801c610320525b8151600101808352811415610541575b50506001610340526402540be400610360526001610380526101808051600180820282158284830414171561556e57809050905090508152506103a060016002818352015b6101806103a051600381101561556e5760200201516102e06103a051600180821061556e5780820390509050600281101561556e57602002015180820282158284830414171561556e57809050905090506103406103a051600381101561556e57602002015180820282158284830414171561556e5780905090509050670de0b6b3a7640000808204905090506101806103a051600381101561556e5760200201525b81516001018083528114156105cd575b5050610340600435600381101561556e5760200201516103a0526001156107fa57600d546103c05260006103c05111156107f9576102c080516103a05180820282158284830414171561556e578090509050905081525060006004351115610736576102c0516102e0600435600180821061556e5780820390509050600281101561556e57602002015180820282158284830414171561556e5780905090509050670de0b6b3a7640000808204905090506102c0525b610180600435600381101561556e5760200201516103e0526102c051610180600435600381101561556e576020020152602061050060a463c7fab708610400526101405161042052610160516104405261018051610460526101a051610480526101c0516104a05261041c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e5760005061050051601f556103e051610180600435600381101561556e5760200201526103c05142106107f8576001600d555b5b5b610340602435600381101561556e5760200201516103c052610180602435600381101561556e576020020151602061052060e46336bc88556103e0526101405161040052610160516104205261018051610440526101a051610460526101c05161048052601f546104a0526024356104c0526103fc7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506105205180821061556e578082039050905061022052610180602435600381101561556e576020020180516102205180821061556e57808203905090508152506102208051600180821061556e5780820390509050815250600060243511156109545761022051670de0b6b3a764000080820282158284830414171561556e57809050905090506102e0602435600180821061556e5780820390509050600281101561556e57602002015180801561556e57820490509050610220525b61022080516103c05180801561556e5782049050905081525061022080516101406103e0525b6103e0515160206103e051016103e0526103e06103e051101561099c5761097a565b61018051610400526101a051610420526101c05161044052610440516104205161040051600658016132b1565b6104a0526103c06103e0525b6103e0515260206103e051036103e0526101406103e051106109f6576109d5565b6104a0516102205180820282158284830414171561556e57809050905090506402540be4008082049050905080821061556e5780820390509050815250606435610220511015610a85576308c379a06103e0526020610400526008610420527f536c697070616765000000000000000000000000000000000000000000000000610440526104205060646103fcfd5b6102a080516102205180821061556e57808203905090508152506102a0516001602435600381101561556e5702601c01556020610480604463a9059cbb6103e052336104005261022051610420526103fc6000610240602435600381101561556e5760200201515af11561556e57601f3d111561556e57600050610480506102a080516103c05180820282158284830414171561556e578090509050905081525060006024351115610b85576102a0516102e0602435600180821061556e5780820390509050600281101561556e57602002015180820282158284830414171561556e5780905090509050670de0b6b3a7640000808204905090506102a0525b6102a051610180602435600381101561556e576020020152620186a06044351115610bb857620186a06102205111610bbb565b60005b15610d68576044356103a05180820282158284830414171561556e57809050905090506103e052610220516103c05180820282158284830414171561556e57809050905090506104005260006004351815610c1c5760006024351415610c1f565b60005b15610ce0576fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff80600435600180821061556e5780820390509050600160ff1b81101561556e5780820282158284830514171561556e57809050905090506000811215610ca257600854816000031c610ca8565b600854811b5b9050166103e05180820282158284830414171561556e57809050905090506104005180801561556e5782049050905061020052610d67565b600435610d25576103e051670de0b6b3a764000080820282158284830414171561556e57809050905090506104005180801561556e5782049050905061020052610d66565b61040051670de0b6b3a764000080820282158284830414171561556e57809050905090506103e05180801561556e57820490509050610200526004356101e0525b5b5b5b6101405161016051610180516101a0516101c0516101e05161020051610220516101405161024052610160516102605261018051610280526101a0516102a0526101c0516102c0526101e0516102e052610200516103005260006103205261032051610300516102e0516102c0516102a05161028051610260516102405160065801613b6b565b61022052610200526101e0526101c0526101a052610180526101605261014052600050600435610240526044356102605260243561028052610220516102a052337fb2e76ae99761dc136e598d4a629bb347eccb9532a5f8bbd72e18467c3c34cc986080610240a261022051600052600060005560206000f35b63556d6e9f811415610ec6576020610200606463556d6e9f61014052606060046101603761015c733fd1a0ae6a996b8f972f0089a4820f05c611ec175afa1561556e57601f3d111561556e576000506102005160005260206000f35b63cde699fa811415610f3a57600480356101405280602001356101605280604001356101805250606480356101a05280602001356101c05280604001356101e052506101e0516101c0516101a05161018051610160516101405160065801614b73565b610240526102405160005260206000f35b634515cef3811415611b925760015461556e57600160015560265461556e576101405161016051600658016130f1565b610180526101a052610160526101405261018080516101405280602001516101605250731337bedc9d22ecbe766df105c9623922a27963ec6101805273686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d6101a0527353f7c5869a859f0aec3d334ee8b4cf01e3492f216101c052601c80546101e052600181015461020052600281015461022052506101203661024037600f610360526001156113f2576101e05161038052610200516103a052610220516103c0526103e060006003818352015b6101e06103e051600381101561556e57602002015160046103e051600381101561556e576020020135818183011061556e578082019050905061040052610400516101e06103e051600381101561556e5760200201526104005160016103e051600381101561556e5702601c01555b815160010180835281141561102c575b50506101e0516102a052610200516102c052610220516102e05260016103e0526402540be40061040052600161042052600654610440526101e08051600180820282158284830414171561556e57809050905090508152506103808051600180820282158284830414171561556e578090509050905081525061046060016002818352015b6fffffffffffffffffffffffffffffffff61044051166103e061046051600381101561556e57602002015180820282158284830414171561556e5780905090509050610480526101e061046051600381101561556e5760200201516104805180820282158284830414171561556e5780905090509050670de0b6b3a7640000808204905090506101e061046051600381101561556e57602002015261038061046051600381101561556e5760200201516104805180820282158284830414171561556e5780905090509050670de0b6b3a76400008082049050905061038061046051600381101561556e5760200201526104405160801c610440525b8151600101808352811415611130575b505061046060006003818352015b6000600461046051600381101561556e576020020135111561133757602061054060646323b872dd61048052336104a052306104c052600461046051600381101561556e5760200201356104e05261049c600061018061046051600381101561556e5760200201515af11561556e57601f3d111561556e57600050610540506101e061046051600381101561556e57602002015161038061046051600381101561556e57602002015180821061556e578082039050905061024061046051600381101561556e576020020152600f61036051141561132f576104605161036052611336565b600e610360525b5b5b815160010180835281141561124a575b5050600f61036051181561556e57600d546104605260006104605111156113e957602061058060a463c7fab70861048052610140516104a052610160516104c052610380516104e0526103a051610500526103c0516105205261049c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e5760005061058051610340526104605142106113e4576001600d555b6113f1565b601f54610340525b5b60206104a060a463c7fab7086103a052610140516103c052610160516103e0526101e05161040052610200516104205261022051610440526103bc7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506104a05161038052602061042060046318160ddd6103c0526103dc731dab6560494b04473a0be3e7d83cf3fdf3a518285afa1561556e57601f3d111561556e57600050610420516103a05260006103405111156114f7576103a0516103805180820282158284830414171561556e57809050905090506103405180801561556e578204905090506103a05180821061556e57808203905090506103005261156c565b6101406103c0525b6103c0515160206103c051016103c0526103c06103c0511015611521576114ff565b610380516103e0526103e051600658016133a2565b610440526103a06103c0525b6103c0515260206103c051036103c0526101406103c0511061156357611542565b61044051610300525b600061030051111561556e576000610340511115611a8b576101406103c0525b6103c0515160206103c051016103c0526103c06103c05110156115ae5761158c565b610240516103e052610260516104005261028051610420526101e051610440526102005161046052610220516104805261048051610460516104405161042051610400516103e05160065801614b73565b6104e0526103a06103c0525b6103c0515260206103c051036103c0526101406103c0511061162c5761160b565b6104e0516103005180820282158284830414171561556e57809050905090506402540be400808204905090506001818183011061556e57808201905090506103205261030080516103205180821061556e57808203905090508152506103a0805161030051818183011061556e5780820190509050815250602061046060446340c10f196103c052336103e05261030051610400526103dc6000731dab6560494b04473a0be3e7d83cf3fdf3a518285af11561556e57601f3d111561556e576000506104605060006103c052620186a06103005111156119c75760036103605110156119c6576060366103e037600854610440526001610460526402540be4006104805260016104a0526104c060006002818352015b6fffffffffffffffffffffffffffffffff61044051166104006104c051600281101561556e5760200201526104405160801c610440525b8151600101808352811415611742575b50506104c060006003818352015b610360516104c051181561188e576104c0516117e7576103e080516102a051600180820282158284830414171561556e5780905090509050818183011061556e578082019050905081525061188d565b6103e080516102a06104c051600381101561556e5760200201516104006104c051600180821061556e5780820390509050600281101561556e57602002015180820282158284830414171561556e57809050905090506104606104c051600381101561556e57602002015180820282158284830414171561556e5780905090509050670de0b6b3a764000080820490509050818183011061556e57808201905090508152505b5b5b8151600101808352811415611797575b50506103e0516103005180820282158284830414171561556e57809050905090506103a05180801561556e578204905090506103e0526103e051670de0b6b3a764000080820282158284830414171561556e5780905090509050600461036051600381101561556e57602002013561046061036051600381101561556e57602002015180820282158284830414171561556e5780905090509050610300516102a061036051600381101561556e57602002015180820282158284830414171561556e578090509050905061046061036051600381101561556e57602002015180820282158284830414171561556e57809050905090506103a05180801561556e5782049050905080821061556e578082039050905080801561556e578204905090506103c0525b5b6101406103e0525b6103e0515160206103e051016103e0526103e06103e05110156119f1576119cf565b610140516104005261016051610420526101e0516104405261020051610460526102205161048052610360516104a0526103c0516104c052610380516104e0526104e0516104c0516104a051610480516104605161044051610420516104005160065801613b6b565b6103c06103e0525b6103e0515260206103e051036103e0526101406103e05110611a8357611a62565b600050611af9565b61038051601f55670de0b6b3a7640000602455670de0b6b3a7640000602255602061046060446340c10f196103c052336103e05261030051610400526103dc6000731dab6560494b04473a0be3e7d83cf3fdf3a518285af11561556e57601f3d111561556e57600050610460505b606435610300511015611b4b576308c379a06103c05260206103e0526008610400527f536c697070616765000000000000000000000000000000000000000000000000610420526104005060646103dcfd5b606060046103c03761032051610420526103a05161044052337f96b486485420b963edd3fdec0b0195730035600feb7de6f544383d7950fa97ee60a06103c0a26000600155005b63ecb586a5811415611e865760025461556e576001600255731337bedc9d22ecbe766df105c9623922a27963ec6101405273686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d610160527353f7c5869a859f0aec3d334ee8b4cf01e3492f2161018052602061022060046318160ddd6101c0526101dc731dab6560494b04473a0be3e7d83cf3fdf3a518285afa1561556e57601f3d111561556e57600050610220516101a052602061026060446379cc67906101c052336101e052600435610200526101dc6000731dab6560494b04473a0be3e7d83cf3fdf3a518285af11561556e57601f3d111561556e5760005061026050601c80546101c05260018101546101e05260028101546102005250600435600180821061556e57808203905090506102205261024060006003818352015b6101c061024051600381101561556e5760200201516102205180820282158284830414171561556e57809050905090506101a05180801561556e5782049050905061026052602461024051600381101561556e576020020135610260511061556e576101c061024051600381101561556e5760200201516102605180821061556e5780820390509050600161024051600381101561556e5702601c0155610260516101c061024051600381101561556e5760200201526020610320604463a9059cbb61028052336102a052610260516102c05261029c600061014061024051600381101561556e5760200201515af11561556e57601f3d111561556e57600050610320505b8151600101808352811415611cc3575b5050601f546102405261024051610240516102205180820282158284830414171561556e57809050905090506101a05180801561556e5782049050905080821061556e5780820390509050601f556101c051610260526101e05161028052610200516102a0526101a05160043580821061556e57808203905090506102c052337fd6cc314a0b1e3b2579f8e64248e82434072e8271290eef8ad0886709304195f56080610260a26000600255005b633883e119811415611f065760643560011c61556e5760206102206084633883e11961014052600480356101605280602001356101805280604001356101a052506064356101c05261015c733fd1a0ae6a996b8f972f0089a4820f05c611ec175afa1561556e57601f3d111561556e576000506102205160005260206000f35b634fb08c5e81141561202457600658016130f1565b610140526101605261014080516101805280602001516101a052506101405161016051610180516101a051610180516101c0526101a0516101e0526040600461020037600161024052600061026052610260516102405161022051610200516101e0516101c05160065801614d81565b6102c0526102e052610300526103205261034052610360526101a0526101805261016052610140526102c08080808051610380525050602081019050808080516103a0525050602081019050808080516103c05250506020810190508080808080516103e05250506020810190508080805161040052505060208101905080808051610420525050505050506103805160005260206000f35b63f1dc3cc98114156124465760035461556e57600160035560265461556e576101405161016051600658016130f1565b610180526101a05261016052610140526101808051610140528060200151610160525060c03661018037600d54610240526101405161016051610180516101a0516101c0516101e05161020051610220516102405161014051610260526101605161028052604060046102a037600061024051116102e052600161030052610300516102e0516102c0516102a051610280516102605160065801614d81565b61036052610380526103a0526103c0526103e052610400526102405261022052610200526101e0526101c0526101a05261018052610160526101405261036080808080516104205250506020810190508080805161044052505060208101905080808051610460525050602081019050808080808051610480525050602081019050808080516104a0525050602081019050808080516104c05250505050505061042080516101805280602001516101c05280604001516101a0528060600180516101e052806020015161020052806040015161022052505060443561018051101561221e576308c379a06102605260206102805260086102a0527f536c6970706167650000000000000000000000000000000000000000000000006102c0526102a050606461027cfd5b61024051421061222e576001600d555b6001602435600381101561556e5702601c0180546101805180821061556e5780820390509050815550602061030060446379cc67906102605233610280526004356102a05261027c6000731dab6560494b04473a0be3e7d83cf3fdf3a518285af11561556e57601f3d111561556e5760005061030050731337bedc9d22ecbe766df105c9623922a27963ec6102605273686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d610280527353f7c5869a859f0aec3d334ee8b4cf01e3492f216102a0526020610360604463a9059cbb6102c052336102e05261018051610300526102dc6000610260602435600381101561556e5760200201515af11561556e57601f3d111561556e57600050610360506101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610280516102a051610140516102c052610160516102e0526101e0516103005261020051610320526102205161034052602435610360526101c051610380526101a0516103a0526103a05161038051610360516103405161032051610300516102e0516102c05160065801613b6b565b6102a05261028052610260526102405261022052610200526101e0526101c0526101a052610180526101605261014052600050604060046102c0376101805161030052337f5ad056f2e28a8cec232015406b843668c1e36cda598127ec3b8c59b8c72773a060606102c0a26000600355005b63c93f49e88114156124715760045461556e576001600455600658016134cb565b6000506000600455005b635e2480728114156126865760205433141561556e57600c546201517f818183011061556e578082019050905042111561556e57426201517f818183011061556e5780820190509050604435111561556e576101405161016051600658016130f1565b610180526101a0526101605261014052610180805161014052806020015161016052506101405160801b6101805261016051610180511761018052610a8b600435111561556e57631017df81600435101561556e576402540be3ff602435111561556e5766b1a2bc2ec50001602435101561556e57670de0b6b3a764000060043580820282158284830414171561556e57809050905090506101405180801561556e578204905090506101a052678ac7230489e800016101a051101561556e5767016345785d89ffff6101a051111561556e57670de0b6b3a764000060243580820282158284830414171561556e57809050905090506101605180801561556e578204905090506101a052678ac7230489e800016101a051101561556e5767016345785d89ffff6101a051111561556e5761018051600a5542600c5560043560801b6101c0526024356101c051176101c052604435600d556101c051600b55610140516101e052600435610200526101605161022052602435610240524261026052604435610280527fe35f0559b0642164e286b30df2077ec3a05426617a25db7578fd20ba39a6cd0560c06101e0a1005b63244c7c2e81141561273c5760205433141561556e576101405161016051600658016130f1565b610180526101a0526101605261014052610180805161014052806020015161016052506101405160801b610180526101605161018051176101805261018051600a5561018051600b5542600c5542600d55610140516101a052610160516101c052426101e0527f5f0e7fba3d100c9e19446e1c92fe436f0a9a22fe99669360e4fdd6d3de2fc28460606101a0a1005b63a43c33518114156129085760205433141561556e5760295461556e5760e06004610140376402540be401610160511015612784576207a11f61016051111561556e5761278c565b601754610160525b6402540be4006101405111156127a457601654610140525b61016051610140511161556e576402540be4006101805111156127c957601854610180525b670de0b6b3a76400006101a05110156127ed5760006101a051111561556e576127f5565b6010546101a0525b670de0b6b3a76400006101c051111561281057600e546101c0525b670de0b6b3a76400006101e051111561282b576012546101e0525b62093a8061020051101561284a57600061020051111561556e57612852565b601454610200525b426203f480818183011061556e5780820190509050610220526102205160295561018051601b556101405160195561016051601a556101a0516011556101c051600f556101e051601355610200516015556101805161024052610140516102605261016051610280526101a0516102a0526101c0516102c0526101e0516102e0526102005161030052610220517f913fde9a37e1f8ab67876a4d0ce80790d764fcfc5692f4529526df9c6bdde55360e0610240a2005b632a7dd7cd811415612a2d5760055461556e57600160055560205433141561556e57602954421061556e576000602954181561556e576000602955601b54610140526101405160185418156129735761014051600658016134cb565b61014052600050610140516018555b6019546101605261016051601655601a5461018052610180516017556011546101a0526101a051601055600f546101c0526101c051600e556013546101e0526101e05160125560155461020052610200516014556101405161022052610160516102405261018051610260526101a051610280526101c0516102a0526101e0516102c052610200516102e0527f1c65bbdc939f346e5d6f0bde1f072819947438d4fc7b182cc59c2f6dc550408760e0610220a16000600555005b63226840fb811415612a4a5760205433141561556e576000602955005b636b441a40811415612ac65760043560a01c61556e5760205433141561556e5760285461556e57426203f480818183011061556e57808201905090506101405261014051602855600435602155600435610140517f181aa3aa17d4cbf99265dd4443eba009433d3cde79d60164fde1d1a192beb93560006000a3005b636a1c05ae811415612b2f5760205433141561556e57602854421061556e576000602854181561556e5760006028556021546101405261014051602055610140517f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60006000a2005b6386fbf193811415612b4c5760205433141561556e576000602855005b63e3698853811415612b735760205433141561556e5742602754111561556e576001602655005b633046f972811415612b905760205433141561556e576000602655005b63c51b8861811415612bb85760043560a01c61556e5760205433141561556e57600435602a55005b637242e524811415612be05760043560a01c61556e5760205433141561556e57600435602b55005b636112c747811415612bf85760095460005260206000f35b63204fe3d5811415612c1057600a5460005260206000f35b63f30cfad5811415612c2857600b5460005260206000f35b63e89876ff811415612c4057600c5460005260206000f35b63f9ed9597811415612c5857600d5460005260206000f35b6349fe9e77811415612c7057600e5460005260206000f35b63727ced57811415612c8857600f5460005260206000f35b6372d4f0e2811415612ca05760105460005260206000f35b63d7c3dcbe811415612cb85760115460005260206000f35b63083812e5811415612cd05760125460005260206000f35b634ea12c7d811415612ce85760135460005260206000f35b63662b6274811415612d005760145460005260206000f35b630c5e23d4811415612d185760155460005260206000f35b6392526c0c811415612d305760165460005260206000f35b63ee8de675811415612d485760175460005260206000f35b63fee3f7f9811415612d605760185460005260206000f35b637cf9aedc811415612d785760195460005260206000f35b637d1b060c811415612d9057601a5460005260206000f35b63e3824462811415612da857601b5460005260206000f35b634903b0d1811415612dd0576001600435600381101561556e5702601c015460005260206000f35b630f529ba2811415612de857601f5460005260206000f35b638da5cb5b811415612e005760205460005260206000f35b631ec0cdc1811415612e185760215460005260206000f35b637ba1a74d811415612e305760225460005260206000f35b630b7b594b811415612e485760235460005260206000f35b630c46b72a811415612e605760245460005260206000f35b639c868ac0811415612e785760265460005260206000f35b632a426896811415612e905760275460005260206000f35b63e0a0b586811415612ea85760285460005260206000f35b63405e28f8811415612ec05760295460005260206000f35b63b618ba62811415612ed857602a5460005260206000f35b636e42e4d2811415612ef057602b5460005260206000f35b505b60006000fd5b610180526101405261016052600261014051101561556e576fffffffffffffffffffffffffffffffff7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff8061014051600160ff1b81101561556e5780820282158284830514171561556e57809050905090506000811215612f805761016051816000031c612f87565b61016051811b5b90501660005260005161018051565b61014052601c80546101605260018101546101805260028101546101a052506006546101c05260016101e0526402540be400610200526001610220526101608051600180820282158284830414171561556e578090509050905081525061024060016002818352015b6fffffffffffffffffffffffffffffffff6101c051166101e061024051600381101561556e57602002015180820282158284830414171561556e57809050905090506102605261016061024051600381101561556e5760200201516102605180820282158284830414171561556e5780905090509050670de0b6b3a76400008082049050905061016061024051600381101561556e5760200201526101c05160801c6101c0525b8151600101808352811415612fff575b50506060610240525b600061024051116130cf576130eb565b60206102405103610160015160206102405103610240526130bf565b61014051565b61014052600d5461016052600b54610180526fffffffffffffffffffffffffffffffff61018051166101a0526101805160801c6101c0526101605142101561326857600a546101e052600c546102005261016080516102005180821061556e5780820390509050815250426102005180821061556e578082039050905061020052610160516102005180821061556e5780820390509050610220526101e05160801c6102205180820282158284830414171561556e57809050905090506101c0516102005180820282158284830414171561556e5780905090509050818183011061556e57808201905090506101605180801561556e578204905090506101c0526fffffffffffffffffffffffffffffffff6101e051166102205180820282158284830414171561556e57809050905090506101a0516102005180820282158284830414171561556e5780905090509050818183011061556e57808201905090506101605180801561556e578204905090506101a0525b6101c051610200526101a0516102205260406101e0525b60006101e0511161328f576132ab565b60206101e05103610200015160206101e051036101e05261327f565b61014051565b6101a05261014052610160526101805260206102c0608463fa18042d6101e052610140516102005261016051610220526101805161024052601054610260526101fc7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506102c0516101c0526016546101c05180820282158284830414171561556e5780905090509050601754670de0b6b3a76400006101c05180821061556e578082039050905080820282158284830414171561556e5780905090509050818183011061556e5780820190509050670de0b6b3a7640000808204905090506000526000516101a051565b61016052610140526060366101803761014051600380820490509050610180526006546101e05261020060016002818352015b61014051670de0b6b3a764000080820282158284830414171561556e578090509050905060036fffffffffffffffffffffffffffffffff6101e0511680820282158284830414171561556e578090509050905080801561556e5782049050905061018061020051600381101561556e5760200201526101e05160801c6101e0525b81516001018083528114156133d5575b505060206102c0606463bad1dc266102005261018051610220526101a051610240526101c0516102605261021c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506102c05160005260005161016051565b61014052610140516101605161018051600658016130f1565b6101a0526101c0526101805261016052610140526101a0805161016052806020015161018052506022546101a0526023546101c052731337bedc9d22ecbe766df105c9623922a27963ec6101e05273686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d610200527353f7c5869a859f0aec3d334ee8b4cf01e3492f216102205261024060006003818352015b60206102e060246370a0823161026052306102805261027c6101e061024051600381101561556e5760200201515afa1561556e57601f3d111561556e576000506102e051600161024051600381101561556e5702601c01555b8151600101808352811415613570575b5050602454610240526101c0516101a0511115613777576101a0516101c05180821061556e578082039050905060185480820282158284830414171561556e57809050905090506404a817c8008082049050905061026052600061026051111561377657602b546102805260006102805118156137755761024051670de0b6b3a764000080820282158284830414171561556e5780905090509050610240516102605180821061556e578082039050905080801561556e57820490509050670de0b6b3a764000080821061556e57808203905090506102a05260206103806044636962f8456102e05261028051610300526102a051610320526102fc6000731dab6560494b04473a0be3e7d83cf3fdf3a518285af11561556e57601f3d111561556e57600050610380516102c0526101a0805161026051600280820282158284830414171561556e578090509050905080821061556e57808203905090508152506101a0516022556102c0516102e052610280517f6059a38198b1dc42b3791087d1ff0fbd72b3179553c25f678cd246f52ffaaf5960206102e0a25b5b5b60206102e060046318160ddd6102805261029c731dab6560494b04473a0be3e7d83cf3fdf3a518285afa1561556e57601f3d111561556e576000506102e05161026052602061040060a463c7fab70861030052610160516103205261018051610340526101405161016051610180516101a0516101c0516101e051610200516102205161024051610260516102805160065801612f96565b6102a0526102c0526102e05261028052610260526102405261022052610200526101e0526101c0526101a0526101805261016052610140526102a080516103605280602001516103805280604001516103a0525061031c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e57600050610400516102805261028051601f55670de0b6b3a76400006101405161016051610180516101a0516101c0516101e0516102005161022051610240516102605161028051610280516102a0526102a051600658016133a2565b6103005261028052610260526102405261022052610200526101e0526101c0526101a0526101805261016052610140526103005180820282158284830414171561556e57809050905090506102605180801561556e578204905090506024556101c0516101a051111561395c576101a0516023555b602a546102a05260006102a0511815613b655760006004610320527f3111e7b3000000000000000000000000000000000000000000000000000000006103405261032060048060208461038001018260208501600060045af150508051820191505060606020826103800101526020810190507fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff60208261038001015260208101905030602082610380010152602081019050600260208261038001015260208101905073686bef2417b6dc32c50a3cbfbcc3bb60e1e9a15d6020826103800101526020810190507353f7c5869a859f0aec3d334ee8b4cf01e3492f21602082610380010152602081019050806103805261038090508051602001806104a08284600060045af11561556e57505060206105e06104a0516104c060007301d83fe6a10d2f2b7af17034343746188272cac95af11561556e5760203d80821115613ac55780613ac7565b815b905090506105c0526105c08051602001806102c08284600060045af11561556e57505060206103c0604463a9059cbb610320526102a051610340526102c0806020015160008251806020901361556e578091901261556e57806020036101000a82049050905090506103605261033c600073b31f66aa3c1e785363f0875a1b74e27b85fd66c75af11561556e57601f3d111561556e576000506103c0505b61014051565b610240526101405261016052610180526101a0526101c0526101e052610200526102205261016036610260376007546103c0526103e060006002818352015b6fffffffffffffffffffffffffffffffff6103c051166102606103e051600281101561556e5760200201526103c05160801c6103c0525b8151600101808352811415613baa575b50506009546103e0526008546103c05261040060006002818352015b6fffffffffffffffffffffffffffffffff6103c051166102a061040051600281101561556e5760200201526103c05160801c6103c0525b8151600101808352811415613c0d575b5050426103e0511015613e55576014546104005260206104e0604463571bae3f61044052426103e05180821061556e5780820390509050670de0b6b3a764000080820282158284830414171561556e57809050905090506104005180801561556e57820490509050610460526402540be4006104805261045c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506104e0516104205260006103c05261044060006002818352015b6102a061044051600281101561556e576020020151670de0b6b3a76400006104205180821061556e578082039050905080820282158284830414171561556e578090509050905061026061044051600281101561556e5760200201516104205180820282158284830414171561556e5780905090509050818183011061556e5780820190509050670de0b6b3a76400008082049050905061026061044051600281101561556e5760200201525b8151600101808352811415613d0f575b505061044060006002818352015b6103c05160801b6103c05261026060016104405180821061556e5780820390509050600281101561556e576020020151610460526fffffffffffffffffffffffffffffffff61046051101561556e576103c05161046051176103c0525b8151600101808352811415613dda575b50506103c051600755426009555b610220516104005261022051613ed157602061052060a463c7fab708610420526101405161044052610160516104605261018051610480526101a0516104a0526101c0516104c05261043c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e5760005061052051610400525b6006546103c05261042060006002818352015b6fffffffffffffffffffffffffffffffff6103c051166102e061042051600281101561556e5760200201526103c05160801c6103c0525b8151600101808352811415613ee4575b50506000610200511115613ff35760006101e0511115613f7357610200516102a06101e051600180821061556e5780820390509050600281101561556e576020020152613fee565b61042060006002818352015b6102a061042051600281101561556e576020020151670de0b6b3a764000080820282158284830414171561556e57809050905090506102005180801561556e578204905090506102a061042051600281101561556e5760200201525b8151600101808352811415613f7f575b50505b61416a565b61018051610420526101a051610440526101c0516104605261042051620f42408082049050905061048052610420805161048051818183011061556e57808201905090508152506104a060006002818352015b6102e06104a051600281101561556e5760200201516104805180820282158284830414171561556e57809050905090506101806104a0516001818183011061556e5780820190509050600381101561556e576020020151602061060060e46336bc88556104c052610140516104e052610160516105005261042051610520526104405161054052610460516105605261040051610580526104a0516001818183011061556e57808201905090506105a0526104dc7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506106005180821061556e578082039050905080801561556e578204905090506102a06104a051600281101561556e5760200201525b8151600101808352811415614046575b50505b60006103c05261042060006002818352015b6103c05160801b6103c0526102a060016104205180821061556e5780820390509050600281101561556e576020020151610440526fffffffffffffffffffffffffffffffff61044051101561556e576103c05161044051176103c0525b815160010180835281141561417c575b50506103c05160085560206104a060046318160ddd6104405261045c731dab6560494b04473a0be3e7d83cf3fdf3a518285afa1561556e57601f3d111561556e576000506104a051610420526022546104405260245461046052610400516003808204905090506103205261048060006002818352015b61040051670de0b6b3a764000080820282158284830414171561556e578090509050905060036102e061048051600281101561556e57602002015180820282158284830414171561556e578090509050905080801561556e57820490509050610320610480516001818183011061556e5780820190509050600381101561556e5760200201525b8151600101808352811415614260575b5050670de0b6b3a764000061048052670de0b6b3a76400006104a05260006104605111156144665760206105a0606463bad1dc266104e0526103205161050052610340516105205261036051610540526104fc7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506105a0516104c052670de0b6b3a76400006104c05180820282158284830414171561556e57809050905090506104205180801561556e578204905090506104a052610440516104a05180820282158284830414171561556e57809050905090506104605180801561556e5782049050905061048052600d546104e052610460516104a0511015614406576104e05115614409565b60005b15614453576308c379a0610500526020610520526004610540527f4c6f7373000000000000000000000000000000000000000000000000000000006105605261054050606461051cfd5b60016104e0511415614465576000600d555b5b610480516022556025546104c0526104c0516144e657610480516002600e5480820282158284830414171561556e5780905090509050818183011061556e57808201905090506104a051600280820282158284830414171561556e5780905090509050670de0b6b3a764000080821061556e5780820390509050116144e9565b60005b156144fa5760016104c05260016025555b6104c05115614b00576012546104e05260006105005261052060006002818352015b61026061052051600281101561556e576020020151670de0b6b3a764000080820282158284830414171561556e57809050905090506102e061052051600281101561556e57602002015180801561556e5782049050905061054052670de0b6b3a76400006105405111156145ae576105408051670de0b6b3a764000080821061556e57808203905090508152506145ce565b670de0b6b3a76400006105405180821061556e5780820390509050610540525b610500805170010000000000000000000000000000000061054051101561556e576002610540510a818183011061556e57808201905090508152505b815160010180835281141561451c575b50507001000000000000000000000000000000006104e051101561556e5760026104e0510a6105005111156146555760006104605111614658565b60005b15614aff5760206105a06024634e60b1416105205261050051670de0b6b3a7640000808204905090506105405261053c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506105a0516105005261052060006002818352015b6102e061052051600281101561556e576020020151610500516104e05180821061556e578082039050905080820282158284830414171561556e57809050905090506104e05161026061052051600281101561556e57602002015180820282158284830414171561556e5780905090509050818183011061556e57808201905090506105005180801561556e5782049050905061038061052051600281101561556e5760200201525b81516001018083528114156146c4575b505061018051610320526101a051610340526101c0516103605261052060006002818352015b610180610520516001818183011061556e5780820190509050600381101561556e57602002015161038061052051600281101561556e57602002015180820282158284830414171561556e57809050905090506102e061052051600281101561556e57602002015180801561556e57820490509050610320610520516001818183011061556e5780820190509050600381101561556e5760200201525b81516001018083528114156147a3575b5050602061064060a463c7fab7086105405261014051610560526101605161058052610320516105a052610340516105c052610360516105e05261055c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506106405161052052610520516003808204905090506103205261054060006002818352015b61052051670de0b6b3a764000080820282158284830414171561556e5780905090509050600361038061054051600281101561556e57602002015180820282158284830414171561556e578090509050905080801561556e57820490509050610320610540516001818183011061556e5780820190509050600381101561556e5760200201525b81516001018083528114156148da575b5050670de0b6b3a76400006020610600606463bad1dc266105405261032051610560526103405161058052610360516105a05261055c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506106005180820282158284830414171561556e57809050905090506104205180801561556e5782049050905061046052670de0b6b3a7640000610460511115614a50576104805160026104605180820282158284830414171561556e5780905090509050670de0b6b3a764000080821061556e578082039050905011614a53565b60005b15614af85760006103c05261054060006002818352015b6103c05160801b6103c05261038060016105405180821061556e5780820390509050600281101561556e576020020151610560526fffffffffffffffffffffffffffffffff61056051101561556e576103c05161056051176103c0525b8151600101808352811415614a6a575b50506103c05160065561052051601f55610460516024556102405156614afe565b60006025555b5b5b61040051601f556104a0516024556101406104e0525b6104e0515160206104e051016104e0526104e06104e0511015614b3857614b16565b600658016134cb565b6104c06104e0525b6104e0515260206104e051036104e0526101406104e05110614b6a57614b49565b60005061024051565b610200526101405261016052610180526101a0526101c0526101e0526101405161016051610180516101a0516101c0516101e05161020051610220516101a051610240526101c051610260526101e05161028052610280516102605161024051600658016132b1565b6102e05261022052610200526101e0526101c0526101a0526101805261016052610140526102e051600380820282158284830414171561556e57809050905090506008808204905090506102205260006102405261028060006003818352015b60206102805102610140015161026052610240805161026051818183011061556e57808201905090508152505b8151600101808352811415614c3c575b505061024051600380820490509050610260526000610280526102c060006003818352015b60206102c0510261014001516102a052610260516102a0511115614cef5761028080516102a0516102605180821061556e5780820390509050818183011061556e5780820190509050815250614d1e565b6102808051610260516102a05180821061556e5780820390509050818183011061556e57808201905090508152505b5b8151600101808352811415614c9e575b5050610220516102805180820282158284830414171561556e57809050905090506102405180801561556e57820490509050620186a0818183011061556e578082019050905060005260005161020051565b610200526101405261016052610180526101a0526101c0526101e05260206102a060046318160ddd6102405261025c731dab6560494b04473a0be3e7d83cf3fdf3a518285afa1561556e57601f3d111561556e576000506102a0516102205261022051610180511161556e5760036101a051101561556e57601c8054610240526001810154610260526002810154610280525060016102a0526402540be4006102c05260016102e052600061030052670de0b6b3a764000061032052600115614f7757600654610340526102a080516102405180820282158284830414171561556e578090509050905081525061036060016002818352015b6fffffffffffffffffffffffffffffffff610340511661038052610360516101a0511415614ed757610380516102a06101a051600381101561556e57602002015180820282158284830414171561556e5780905090509050610320525b6102a061036051600381101561556e57602002015161024061036051600381101561556e57602002015180820282158284830414171561556e57809050905090506103805180820282158284830414171561556e5780905090509050670de0b6b3a7640000808204905090506102a061036051600381101561556e5760200201526103405160801c610340525b8151600101808352811415614e7a575b50505b6101c05115614ff057602061044060a463c7fab70861034052610140516103605261016051610380526102a0516103a0526102c0516103c0526102e0516103e05261035c7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e576000506104405161030052614ff8565b601f54610300525b6103005161034052610140610380525b6103805151602061038051016103805261038061038051101561502a57615008565b6102a0516103a0526102c0516103c0526102e0516103e0526103e0516103c0516103a051600658016132b1565b61044052610360610380525b61038051526020610380510361038052610140610380511061508457615063565b6104405161036052610180516103405180820282158284830414171561556e57809050905090506102205180801561556e5782049050905061038052610340805161038051610360516103805180820282158284830414171561556e57809050905090506404a817c800808204905090506001818183011061556e578082019050905080821061556e578082039050905080821061556e5780820390509050815250602061050060e46336bc88556103c052610140516103e05261016051610400526102a051610420526102c051610440526102e0516104605261034051610480526101a0516104a0526103dc7306ce8086965234400fdecab190b115c2c07170475afa1561556e57601f3d111561556e57600050610500516103a0526102a06101a051600381101561556e5760200201516103a05180821061556e5780820390509050670de0b6b3a764000080820282158284830414171561556e57809050905090506103205180801561556e578204905090506103c0526103a0516102a06101a051600381101561556e57602002015260006103e0526101e0511561524957620186a06103c051111561524157620186a06101805111615244565b60005b61524c565b60005b5b156154fc576000610400526001610420526402540be40061044052600161046052604036610480376008546104c0526104e060006002818352015b6fffffffffffffffffffffffffffffffff6104c051166104806104e051600281101561556e5760200201526104c05160801c6104c0525b8151600101808352811415615288575b50506104e060006003818352015b6101a0516104e05118156153d4576104e05161532d57610400805161024051600180820282158284830414171561556e5780905090509050818183011061556e57808201905090508152506153d3565b61040080516102406104e051600381101561556e5760200201516104806104e051600180821061556e5780820390509050600281101561556e57602002015180820282158284830414171561556e57809050905090506104206104e051600381101561556e57602002015180820282158284830414171561556e5780905090509050670de0b6b3a764000080820490509050818183011061556e57808201905090508152505b5b5b81516001018083528114156152dd575b5050610400516103805180820282158284830414171561556e57809050905090506103005180801561556e578204905090506104005261040051670de0b6b3a764000080820282158284830414171561556e57809050905090506103c0516104206101a051600381101561556e57602002015180820282158284830414171561556e5780905090509050610380516102406101a051600381101561556e57602002015180820282158284830414171561556e57809050905090506104206101a051600381101561556e57602002015180820282158284830414171561556e57809050905090506103005180801561556e5782049050905080821061556e578082039050905080801561556e578204905090506103e0525b6104c06103c05181526103e0518160200152610340518160400152806060016102a05181526102c05181602001526102e0518160400152505060c0610580525b6000610580511161554c57615568565b602061058051036104c00151602061058051036105805261553c565b61020051565b600080fd5b6101586156cb036101586000396101586156cb036000f35b600080fd000000000000000000000000babe61887f1de2713c6f97e567623453d3c79f67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a09a000000000000000000000000000000000000000000000000000000abb66cef00000000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000000000000000000000000000000000000001c9c380000000000000000000000000000000000000000000000000000001d1a94a20000000000000000000000000000000000000000000000000000001c6bf5263400000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000012a05f2000000000000000000000000000000000000000000000000000000000000000258000000000000000000000000000000000000000000000a532fe32aaf06a3be730000000000000000000000000000000000000000000000b71cc2f8ebaef5dca8

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

000000000000000000000000babe61887f1de2713c6f97e567623453d3c79f67000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000001a09a000000000000000000000000000000000000000000000000000000abb66cef00000000000000000000000000000000000000000000000000000000000004c4b400000000000000000000000000000000000000000000000000000000001c9c380000000000000000000000000000000000000000000000000000001d1a94a20000000000000000000000000000000000000000000000000000001c6bf5263400000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000012a05f2000000000000000000000000000000000000000000000000000000000000000258000000000000000000000000000000000000000000000a532fe32aaf06a3be730000000000000000000000000000000000000000000000b71cc2f8ebaef5dca8

-----Decoded View---------------
Arg [0] : owner (address): 0xbabe61887f1de2713c6f97e567623453d3c79f67
Arg [1] : admin_fee_receiver (address): 0x0000000000000000000000000000000000000000
Arg [2] : A (uint256): 1706400
Arg [3] : gamma (uint256): 11800000000000
Arg [4] : mid_fee (uint256): 5000000
Arg [5] : out_fee (uint256): 30000000
Arg [6] : allowed_extra_profit (uint256): 2000000000000
Arg [7] : fee_gamma (uint256): 500000000000000
Arg [8] : adjustment_step (uint256): 1000000000000000
Arg [9] : admin_fee (uint256): 5000000000
Arg [10] : ma_half_time (uint256): 600
Arg [11] : initial_prices (uint256[2]): 48758195235485059890803,3377826657958528146600

-----Encoded View---------------
13 Constructor Arguments found :
Arg [0] : 000000000000000000000000babe61887f1de2713c6f97e567623453d3c79f67
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000
Arg [2] : 00000000000000000000000000000000000000000000000000000000001a09a0
Arg [3] : 00000000000000000000000000000000000000000000000000000abb66cef000
Arg [4] : 00000000000000000000000000000000000000000000000000000000004c4b40
Arg [5] : 0000000000000000000000000000000000000000000000000000000001c9c380
Arg [6] : 000000000000000000000000000000000000000000000000000001d1a94a2000
Arg [7] : 0000000000000000000000000000000000000000000000000001c6bf52634000
Arg [8] : 00000000000000000000000000000000000000000000000000038d7ea4c68000
Arg [9] : 000000000000000000000000000000000000000000000000000000012a05f200
Arg [10] : 0000000000000000000000000000000000000000000000000000000000000258
Arg [11] : 000000000000000000000000000000000000000000000a532fe32aaf06a3be73
Arg [12] : 0000000000000000000000000000000000000000000000b71cc2f8ebaef5dca8


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.