Contract 0xd78FC1F568411Aa87a8D7C4CDe638cde6E597a46

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x9cc364b137da3423b6b87aa276d9afc2fed515c3ca1f609efaf4d5b54ed7fd03Exchange_multipl...275765142022-09-30 10:02:266 hrs 11 mins ago0xe39b28c0d2a66bf632271f9a94e0d060fe4737de IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00009489
0xa5a49b24ed207c2308309745634299b607190655644ae4ff8b5665eac8cfa38bExchange_multipl...275724862022-09-30 9:37:006 hrs 36 mins ago0x966b33df08c5260562279ce7511dec649dd09cbe IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00007052
0x476f7bca0d7b113939bac31458ca560fd5d12029bbe8b0741bc48617492810ddExchange_multipl...275413592022-09-30 6:35:089 hrs 38 mins ago0x1e121993b4a8bc79d18a4c409db84c100fff25f5 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00154454
0x3e6b1a689692725ae606a4f90622582efe99f3a5aef0759241b658f4a6c2b744Exchange_multipl...275371352022-09-30 6:05:5710 hrs 7 mins ago0x1e121993b4a8bc79d18a4c409db84c100fff25f5 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00168365
0x0c4f7761ef8d7a21d902f7346f41b0af54c86e7667b80d7bfd08bf1fe0ec402cExchange_multipl...275357142022-09-30 5:56:2310 hrs 17 mins ago0x1e121993b4a8bc79d18a4c409db84c100fff25f5 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00170145
0x5d9d146d065740b659549c869793e6f0bce9b5761a65278dad0bce31633e08edExchange_multipl...274993722022-09-30 0:38:5615 hrs 34 mins ago0xa2bc795a3bd9d65eb4439bd54787550c8deb7661 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00129874
0x0af9338e62fb7335b6d7f95b26775c2a259cd6777c9463f8e4ace23e8291572eExchange_multipl...274985172022-09-30 0:34:3015 hrs 39 mins ago0xc8484d4a6baaaa7c31f411b1362145da109f9b50 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00136062
0xb0920cd748d5711d9a316ddcaa18ade90aa9601c14afd99932c032fdcf19688bExchange_multipl...274075262022-09-29 11:56:381 day 4 hrs ago0xe222a6f5103fdfda1754e13c2a7e8ce790cf17d7 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00132725
0x5a5bdd1ea5bdb05a70d025bb20cfa3452fcd74a4552807d41e6878fbc5a4057eExchange_multipl...274070042022-09-29 11:52:541 day 4 hrs ago0xe222a6f5103fdfda1754e13c2a7e8ce790cf17d7 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.0013422
0x88b2c5cd65b970ba61a8c8ba2589b4172ed7b9f5652dcb3deb78b74d132e9ce5Exchange_multipl...272289182022-09-28 14:02:262 days 2 hrs ago0xe39b28c0d2a66bf632271f9a94e0d060fe4737de IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00007574
0x5ccd2afdb0cf7d48e04fb97347e7373b4fde437944b15a774205c08f0ee4fd68Exchange_multipl...271826542022-09-28 10:05:482 days 6 hrs ago0xe39b28c0d2a66bf632271f9a94e0d060fe4737de IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00154902
0x6e4cfd57740df832d5465e2fa3ba016c11e005d8e903934f9e58a8d0eef227f5Exchange_multipl...271724312022-09-28 9:10:342 days 7 hrs ago0xe39b28c0d2a66bf632271f9a94e0d060fe4737de IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00174646
0x0db4a35e6e01a5a6499854523560cf39d7dcef83712c8207235b5ed136e07ba8Exchange_multipl...271677152022-09-28 8:45:502 days 7 hrs ago0x8db95a8e959d30720c32faf1d0d6f35baaca82a7 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460.00041 ETH0.00201465
0x127ace6e936490f30c51f6808e1589f1a45bb3d00c01e66fae946282873b4b98Exchange_multipl...271676282022-09-28 8:45:192 days 7 hrs ago0xecd3845e9abea119aff7df432e845a1c1d53a127 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460.00041 ETH0.00202018
0x8596a52f980d76206453ca9e4e31aeb42d2d8e161de8a846fd7e18103ab1f45eExchange_multipl...271179332022-09-28 4:20:582 days 11 hrs ago0xa8d34cf200abd25b9cb61573aa0b8d09d9ca3a66 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460.0002345 ETH0.0019709
0x7dea996b8e66db16b79d847be85e6e30d00e287df9ef51e3d0265fbbf69981d2Exchange_multipl...270460282022-09-27 18:45:162 days 21 hrs ago0x687c121cc556038a1d44fd6ffcad6eb32245e54b IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00413722
0x08148dfced606faf824d8728010085b35c9cb68897a7814dec51388cfbdb9379Exchange_multipl...269941892022-09-27 13:14:093 days 2 hrs ago0x7638c88e4e5c60ea908568136c3458ab3a794929 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00180752
0x6195d4da23c084907d053f675176469cfcd9e7082322b8f2143d1c608fdaadd6Exchange_multipl...269931522022-09-27 13:07:343 days 3 hrs ago0xdafc555a97b358bc09fccf4c0e583c1ec5838b16 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00179099
0x296a07b3cfc1589b3182ed947062c4437c2b036905fd4fcbb995785fc0a31d8bExchange_multipl...269201082022-09-27 4:16:433 days 11 hrs ago0x09fa38eba245bb68354b8950fa2fe71f02863393 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00006248
0x52f2585d3d597debf1dd2c1103fc07710271c9f28b796945d422d8495b005eeaExchange_multipl...269179512022-09-27 3:56:373 days 12 hrs ago0xbd16fc670c45692877db780532b88058387b619e IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00169912
0x641d1244571ffd0b9b174a97fbbef6b8e3b75277aef0d9e4a22b98f1f7971c3aExchange_multipl...269000242022-09-27 1:50:173 days 14 hrs ago0xdafc555a97b358bc09fccf4c0e583c1ec5838b16 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00111085
0x6bd753d4e35cd8ee92d568a4b0410e07103728399bf96503b7ef0118fe33b2ceExchange_multipl...266520472022-09-25 19:47:134 days 20 hrs ago0x7bdfe11c4981dd4c33e1aa62457b8773253791b3 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00030207
0x7971e746a2e2756760f95ee646862252d79da00f7ecfe63efd02d2a9643e6136Exchange_multipl...266516042022-09-25 19:43:334 days 20 hrs ago0x7bdfe11c4981dd4c33e1aa62457b8773253791b3 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00045443
0x1a292d7617deb6cc450bf45ab5b8b05169e2e92c5abd754d42eb5a7e72c6267fExchange_multipl...266268362022-09-25 16:37:094 days 23 hrs ago0x7bdfe11c4981dd4c33e1aa62457b8773253791b3 IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00120777
0xcd86f9cdf6473d00bbdf20cc9dac4b3727b67a531fead393f46aa4263b8b94a6Exchange_multipl...264354042022-09-24 17:47:355 days 22 hrs ago0xe39b28c0d2a66bf632271f9a94e0d060fe4737de IN  0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH0.00008696
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0x7f90122bf0700f9e7e1f688fe926940e8839f3530 ETH
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90 ETH
0x568192af3b2d041396d581229b8f5b346530d7a0415c77b66281ecde597ad9b4276064772022-09-30 13:28:212 hrs 45 mins ago 0xb82b43c4c0abf41dfc342571c330964ff576a9b3 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0x7f90122bf0700f9e7e1f688fe926940e8839f3530 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90 ETH
0x934b19ee221228c0e7feab150bd62d7208e6fc495faf087010e32684647fdd9d276042222022-09-30 13:12:083 hrs 1 min ago 0xb82b43c4c0abf41dfc342571c330964ff576a9b3 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0x7f90122bf0700f9e7e1f688fe926940e8839f3530 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb90 ETH
0xd1daf00323d12b87be5e933e4d5ac45c1b9e81edb7ad3d0b35bd9382c443d9ab276041282022-09-30 13:11:303 hrs 2 mins ago 0xb82b43c4c0abf41dfc342571c330964ff576a9b3 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460 ETH
0xb4b8496ca32fc322f79ed6f6477248ad5da6c052b62f2a0ffc0e4636b17e1bdb276005672022-09-30 12:51:323 hrs 22 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a460x00000000000000000000000000000000000000040 ETH
0xb4b8496ca32fc322f79ed6f6477248ad5da6c052b62f2a0ffc0e4636b17e1bdb276005672022-09-30 12:51:323 hrs 22 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0xb4b8496ca32fc322f79ed6f6477248ad5da6c052b62f2a0ffc0e4636b17e1bdb276005672022-09-30 12:51:323 hrs 22 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0xff970a61a04b1ca14834a43f5de4533ebddb5cc80 ETH
0xb4b8496ca32fc322f79ed6f6477248ad5da6c052b62f2a0ffc0e4636b17e1bdb276005672022-09-30 12:51:323 hrs 22 mins ago 0xd78fc1f568411aa87a8d7c4cde638cde6e597a46 0x7f90122bf0700f9e7e1f688fe926940e8839f3530 ETH
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.3.1

Optimization Enabled:
N/A

Other Settings:
, MIT license

Contract Source Code (Vyper language format)

# @version 0.3.1
"""
@title Curve Registry Exchange Contract
@license MIT
@author Curve.Fi
@notice Find pools, query exchange rates and perform swaps
"""

from vyper.interfaces import ERC20


interface AddressProvider:
    def admin() -> address: view
    def get_registry() -> address: view
    def get_address(idx: uint256) -> address: view

interface Registry:
    def address_provider() -> address: view
    def get_A(_pool: address) -> uint256: view
    def get_fees(_pool: address) -> uint256[2]: view
    def get_coin_indices(_pool: address, _from: address, _to: address) -> (int128, int128, bool): view
    def get_n_coins(_pool: address) -> uint256[2]: view
    def get_balances(_pool: address) -> uint256[MAX_COINS]: view
    def get_underlying_balances(_pool: address) -> uint256[MAX_COINS]: view
    def get_rates(_pool: address) -> uint256[MAX_COINS]: view
    def get_decimals(_pool: address) -> uint256[MAX_COINS]: view
    def get_underlying_decimals(_pool: address) -> uint256[MAX_COINS]: view
    def find_pool_for_coins(_from: address, _to: address, i: uint256) -> address: view
    def get_lp_token(_pool: address) -> address: view
    def is_meta(_pool: address) -> bool: view

interface CryptoRegistry:
    def get_coin_indices(_pool: address, _from: address, _to: address) -> (uint256, uint256): view

interface CurvePool:
    def exchange(i: int128, j: int128, dx: uint256, min_dy: uint256): payable
    def exchange_underlying(i: int128, j: int128, dx: uint256, min_dy: uint256): payable
    def get_dy(i: int128, j: int128, amount: uint256) -> uint256: view
    def get_dy_underlying(i: int128, j: int128, amount: uint256) -> uint256: view
    def coins(i: uint256) -> address: view

interface CryptoPool:
    def exchange(i: uint256, j: uint256, dx: uint256, min_dy: uint256): payable
    def exchange_underlying(i: uint256, j: uint256, dx: uint256, min_dy: uint256): payable
    def get_dy(i: uint256, j: uint256, amount: uint256) -> uint256: view
    def get_dy_underlying(i: uint256, j: uint256, amount: uint256) -> uint256: view

interface CryptoPoolETH:
    def exchange(i: uint256, j: uint256, dx: uint256, min_dy: uint256, use_eth: bool): payable

interface PolygonMetaZap:
    def exchange_underlying(pool: address, i: int128, j: int128, dx: uint256, min_dy: uint256): nonpayable

interface BasePool2Coins:
    def add_liquidity(amounts: uint256[2], min_mint_amount: uint256): nonpayable
    def calc_token_amount(amounts: uint256[2], is_deposit: bool) -> uint256: view
    def remove_liquidity_one_coin(token_amount: uint256, i: int128, min_amount: uint256): nonpayable
    def calc_withdraw_one_coin(token_amount: uint256, i: int128,) -> uint256: view

interface BasePool3Coins:
    def add_liquidity(amounts: uint256[3], min_mint_amount: uint256): nonpayable
    def calc_token_amount(amounts: uint256[3], is_deposit: bool) -> uint256: view
    def remove_liquidity_one_coin(token_amount: uint256, i: int128, min_amount: uint256): nonpayable
    def calc_withdraw_one_coin(token_amount: uint256, i: int128,) -> uint256: view

interface BaseLendingPool3Coins:
    def add_liquidity(amounts: uint256[3], min_mint_amount: uint256, use_underlying: bool): nonpayable
    def calc_token_amount(amounts: uint256[3], is_deposit: bool) -> uint256: view
    def remove_liquidity_one_coin(token_amount: uint256, i: int128, min_amount: uint256, use_underlying: bool) -> uint256: nonpayable
    def calc_withdraw_one_coin(token_amount: uint256, i: int128,) -> uint256: view

interface Calculator:
    def get_dx(n_coins: uint256, balances: uint256[MAX_COINS], amp: uint256, fee: uint256,
               rates: uint256[MAX_COINS], precisions: uint256[MAX_COINS],
               i: int128, j: int128, dx: uint256) -> uint256: view
    def get_dy(n_coins: uint256, balances: uint256[MAX_COINS], amp: uint256, fee: uint256,
               rates: uint256[MAX_COINS], precisions: uint256[MAX_COINS],
               i: int128, j: int128, dx: uint256[CALC_INPUT_SIZE]) -> uint256[CALC_INPUT_SIZE]: view


event TokenExchange:
    buyer: indexed(address)
    receiver: indexed(address)
    pool: indexed(address)
    token_sold: address
    token_bought: address
    amount_sold: uint256
    amount_bought: uint256


ETH_ADDRESS: constant(address) = 0xEeeeeEeeeEeEeeEeEeEeeEEEeeeeEeeeeeeeEEeE
WETH_ADDRESS: constant(address) = 0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2
MAX_COINS: constant(int128) = 8
CALC_INPUT_SIZE: constant(uint256) = 100
EMPTY_POOL_LIST: constant(address[8]) = [
    ZERO_ADDRESS,
    ZERO_ADDRESS,
    ZERO_ADDRESS,
    ZERO_ADDRESS,
    ZERO_ADDRESS,
    ZERO_ADDRESS,
    ZERO_ADDRESS,
    ZERO_ADDRESS,
]


address_provider: AddressProvider
registry: public(address)
factory_registry: public(address)
crypto_registry: public(address)

default_calculator: public(address)
is_killed: public(bool)
pool_calculator: HashMap[address, address]

is_approved: HashMap[address, HashMap[address, bool]]
base_coins: HashMap[address, address[2]]


@external
def __init__(_address_provider: address, _calculator: address):
    """
    @notice Constructor function
    """
    self.address_provider = AddressProvider(_address_provider)
    self.registry = AddressProvider(_address_provider).get_registry()
    self.factory_registry = AddressProvider(_address_provider).get_address(3)
    self.crypto_registry = AddressProvider(_address_provider).get_address(5)
    self.default_calculator = _calculator


@external
@payable
def __default__():
    pass


@view
@internal
def _get_exchange_amount(
    _registry: address,
    _pool: address,
    _from: address,
    _to: address,
    _amount: uint256
) -> uint256:
    """
    @notice Get the current number of coins received in an exchange
    @param _registry Registry address
    @param _pool Pool address
    @param _from Address of coin to be sent
    @param _to Address of coin to be received
    @param _amount Quantity of `_from` to be sent
    @return Quantity of `_to` to be received
    """
    i: int128 = 0
    j: int128 = 0
    is_underlying: bool = False
    i, j, is_underlying = Registry(_registry).get_coin_indices(_pool, _from, _to) # dev: no market

    if is_underlying and (_registry == self.registry or Registry(_registry).is_meta(_pool)):
        return CurvePool(_pool).get_dy_underlying(i, j, _amount)

    return CurvePool(_pool).get_dy(i, j, _amount)


@view
@internal
def _get_crypto_exchange_amount(
    _registry: address,
    _pool: address,
    _from: address,
    _to: address,
    _amount: uint256
) -> uint256:
    """
    @notice Get the current number of coins received in an exchange
    @param _registry Registry address
    @param _pool Pool address
    @param _from Address of coin to be sent
    @param _to Address of coin to be received
    @param _amount Quantity of `_from` to be sent
    @return Quantity of `_to` to be received
    """
    i: uint256 = 0
    j: uint256 = 0
    i, j = CryptoRegistry(_registry).get_coin_indices(_pool, _from, _to) # dev: no market

    return CryptoPool(_pool).get_dy(i, j, _amount)


@internal
def _exchange(
    _registry: address,
    _pool: address,
    _from: address,
    _to: address,
    _amount: uint256,
    _expected: uint256,
    _sender: address,
    _receiver: address,
) -> uint256:

    assert not self.is_killed

    eth_amount: uint256 = 0
    received_amount: uint256 = 0

    i: int128 = 0
    j: int128 = 0
    is_underlying: bool = False
    i, j, is_underlying = Registry(_registry).get_coin_indices(_pool, _from, _to)  # dev: no market
    if is_underlying and _registry == self.factory_registry:
        if Registry(_registry).is_meta(_pool):
            base_coins: address[2] = self.base_coins[_pool]
            if base_coins == empty(address[2]):
                base_coins = [CurvePool(_pool).coins(0), CurvePool(_pool).coins(1)]
                self.base_coins[_pool] = base_coins

            # we only need to use exchange underlying if the input or output is not in the base coins
            is_underlying = _from not in base_coins or _to not in base_coins
        else:
            # not a metapool so no underlying exchange method
            is_underlying = False

    # perform / verify input transfer
    if _from == ETH_ADDRESS:
        eth_amount = _amount
    else:
        response: Bytes[32] = raw_call(
            _from,
            _abi_encode(
                _sender,
                self,
                _amount,
                method_id=method_id("transferFrom(address,address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    # approve input token
    if _from != ETH_ADDRESS and not self.is_approved[_from][_pool]:
        response: Bytes[32] = raw_call(
            _from,
            _abi_encode(
                _pool,
                MAX_UINT256,
                method_id=method_id("approve(address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)
        self.is_approved[_from][_pool] = True

    # perform coin exchange
    if is_underlying:
        CurvePool(_pool).exchange_underlying(i, j, _amount, _expected, value=eth_amount)
    else:
        CurvePool(_pool).exchange(i, j, _amount, _expected, value=eth_amount)

    # perform output transfer
    if _to == ETH_ADDRESS:
        received_amount = self.balance
        raw_call(_receiver, b"", value=self.balance)
    else:
        received_amount = ERC20(_to).balanceOf(self)
        response: Bytes[32] = raw_call(
            _to,
            _abi_encode(
                _receiver,
                received_amount,
                method_id=method_id("transfer(address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    log TokenExchange(_sender, _receiver, _pool, _from, _to, _amount, received_amount)

    return received_amount


@internal
def _crypto_exchange(
    _pool: address,
    _from: address,
    _to: address,
    _amount: uint256,
    _expected: uint256,
    _sender: address,
    _receiver: address,
) -> uint256:

    assert not self.is_killed

    initial: address = _from
    target: address = _to

    if _from == ETH_ADDRESS:
        initial = WETH_ADDRESS
    if _to == ETH_ADDRESS:
        target = WETH_ADDRESS

    eth_amount: uint256 = 0
    received_amount: uint256 = 0

    i: uint256 = 0
    j: uint256 = 0
    i, j = CryptoRegistry(self.crypto_registry).get_coin_indices(_pool, initial, target)  # dev: no market

    # perform / verify input transfer
    if _from == ETH_ADDRESS:
        eth_amount = _amount
    else:
        response: Bytes[32] = raw_call(
            _from,
            _abi_encode(
                _sender,
                self,
                _amount,
                method_id=method_id("transferFrom(address,address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    # approve input token
    if not self.is_approved[_from][_pool]:
        response: Bytes[32] = raw_call(
            _from,
            _abi_encode(
                _pool,
                MAX_UINT256,
                method_id=method_id("approve(address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)
        self.is_approved[_from][_pool] = True

    # perform coin exchange
    if ETH_ADDRESS in [_from, _to]:
        CryptoPoolETH(_pool).exchange(i, j, _amount, _expected, True, value=eth_amount)
    else:
        CryptoPool(_pool).exchange(i, j, _amount, _expected)

    # perform output transfer
    if _to == ETH_ADDRESS:
        received_amount = self.balance
        raw_call(_receiver, b"", value=self.balance)
    else:
        received_amount = ERC20(_to).balanceOf(self)
        response: Bytes[32] = raw_call(
            _to,
            _abi_encode(
                _receiver,
                received_amount,
                method_id=method_id("transfer(address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    log TokenExchange(_sender, _receiver, _pool, _from, _to, _amount, received_amount)

    return received_amount



@payable
@external
@nonreentrant("lock")
def exchange_with_best_rate(
    _from: address,
    _to: address,
    _amount: uint256,
    _expected: uint256,
    _receiver: address = msg.sender,
) -> uint256:
    """
    @notice Perform an exchange using the pool that offers the best rate
    @dev Prior to calling this function, the caller must approve
         this contract to transfer `_amount` coins from `_from`
         Does NOT check rates in factory-deployed pools
    @param _from Address of coin being sent
    @param _to Address of coin being received
    @param _amount Quantity of `_from` being sent
    @param _expected Minimum quantity of `_from` received
           in order for the transaction to succeed
    @param _receiver Address to transfer the received tokens to
    @return uint256 Amount received
    """
    if _from == ETH_ADDRESS:
        assert _amount == msg.value, "Incorrect ETH amount"
    else:
        assert msg.value == 0, "Incorrect ETH amount"

    registry: address = self.registry
    best_pool: address = ZERO_ADDRESS
    max_dy: uint256 = 0
    for i in range(65536):
        pool: address = Registry(registry).find_pool_for_coins(_from, _to, i)
        if pool == ZERO_ADDRESS:
            break
        dy: uint256 = self._get_exchange_amount(registry, pool, _from, _to, _amount)
        if dy > max_dy:
            best_pool = pool
            max_dy = dy

    return self._exchange(registry, best_pool, _from, _to, _amount, _expected, msg.sender, _receiver)


@payable
@external
@nonreentrant("lock")
def exchange(
    _pool: address,
    _from: address,
    _to: address,
    _amount: uint256,
    _expected: uint256,
    _receiver: address = msg.sender,
) -> uint256:
    """
    @notice Perform an exchange using a specific pool
    @dev Prior to calling this function, the caller must approve
         this contract to transfer `_amount` coins from `_from`
         Works for both regular and factory-deployed pools
    @param _pool Address of the pool to use for the swap
    @param _from Address of coin being sent
    @param _to Address of coin being received
    @param _amount Quantity of `_from` being sent
    @param _expected Minimum quantity of `_from` received
           in order for the transaction to succeed
    @param _receiver Address to transfer the received tokens to
    @return uint256 Amount received
    """
    if _from == ETH_ADDRESS:
        assert _amount == msg.value, "Incorrect ETH amount"
    else:
        assert msg.value == 0, "Incorrect ETH amount"

    if Registry(self.crypto_registry).get_lp_token(_pool) != ZERO_ADDRESS:
        return self._crypto_exchange(_pool, _from, _to, _amount, _expected, msg.sender, _receiver)

    registry: address = self.registry
    if Registry(registry).get_lp_token(_pool) == ZERO_ADDRESS:
        registry = self.factory_registry
    return self._exchange(registry, _pool, _from, _to, _amount, _expected, msg.sender, _receiver)


@external
@payable
def exchange_multiple(
    _route: address[9],
    _swap_params: uint256[3][4],
    _amount: uint256,
    _expected: uint256,
    _pools: address[4]=[ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS],
    _receiver: address=msg.sender
) -> uint256:
    """
    @notice Perform up to four swaps in a single transaction
    @dev Routing and swap params must be determined off-chain. This
         functionality is designed for gas efficiency over ease-of-use.
    @param _route Array of [initial token, pool, token, pool, token, ...]
                  The array is iterated until a pool address of 0x00, then the last
                  given token is transferred to `_receiver`
    @param _swap_params Multidimensional array of [i, j, swap type] where i and j are the correct
                        values for the n'th pool in `_route`. The swap type should be 1 for
                        a stableswap `exchange`, 2 for stableswap `exchange_underlying`, 3
                        for a cryptoswap `exchange`, 4 for a cryptoswap `exchange_underlying`,
                        5 for Polygon factory metapools `exchange_underlying`, 6-8 for
                        underlying coin -> LP token "exchange" (actually `add_liquidity`), 9 and 10
                        for LP token -> underlying coin "exchange" (actually `remove_liquidity_one_coin`)
    @param _amount The amount of `_route[0]` token being sent.
    @param _expected The minimum amount received after the final swap.
    @param _pools Array of pools for swaps via zap contracts. This parameter is only needed for
                  Polygon meta-factories underlying swaps.
    @param _receiver Address to transfer the final output token to.
    @return Received amount of the final output token
    """
    input_token: address = _route[0]
    amount: uint256 = _amount
    output_token: address = ZERO_ADDRESS

    # validate / transfer initial token
    if input_token == ETH_ADDRESS:
        assert msg.value == amount
    else:
        assert msg.value == 0
        response: Bytes[32] = raw_call(
            input_token,
            _abi_encode(
                msg.sender,
                self,
                amount,
                method_id=method_id("transferFrom(address,address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    for i in range(1,5):
        # 4 rounds of iteration to perform up to 4 swaps
        swap: address = _route[i*2-1]
        pool: address = _pools[i-1] # Only for Polygon meta-factories underlying swap (swap_type == 4)
        output_token = _route[i*2]
        params: uint256[3] = _swap_params[i-1]  # i, j, swap type

        if not self.is_approved[input_token][swap]:
            # approve the pool to transfer the input token
            response: Bytes[32] = raw_call(
                input_token,
                _abi_encode(
                    swap,
                    MAX_UINT256,
                    method_id=method_id("approve(address,uint256)"),
                ),
                max_outsize=32,
            )
            if len(response) != 0:
                assert convert(response, bool)
            self.is_approved[input_token][swap] = True

        eth_amount: uint256 = 0
        if input_token == ETH_ADDRESS:
            eth_amount = amount
        # perform the swap according to the swap type
        if params[2] == 1:
            CurvePool(swap).exchange(convert(params[0], int128), convert(params[1], int128), amount, 0, value=eth_amount)
        elif params[2] == 2:
            CurvePool(swap).exchange_underlying(convert(params[0], int128), convert(params[1], int128), amount, 0, value=eth_amount)
        elif params[2] == 3:
            if input_token == ETH_ADDRESS or output_token == ETH_ADDRESS:
                CryptoPoolETH(swap).exchange(params[0], params[1], amount, 0, True, value=eth_amount)
            else:
                CryptoPool(swap).exchange(params[0], params[1], amount, 0)
        elif params[2] == 4:
            CryptoPool(swap).exchange_underlying(params[0], params[1], amount, 0, value=eth_amount)
        elif params[2] == 5:
            PolygonMetaZap(swap).exchange_underlying(pool, convert(params[0], int128), convert(params[1], int128), amount, 0)
        elif params[2] == 6:
            _amounts: uint256[2] = [0, 0]
            _amounts[params[0]] = amount
            BasePool2Coins(swap).add_liquidity(_amounts, 0)
        elif params[2] == 7:
            _amounts: uint256[3] = [0, 0, 0]
            _amounts[params[0]] = amount
            BasePool3Coins(swap).add_liquidity(_amounts, 0)
        elif params[2] == 8:
            _amounts: uint256[3] = [0, 0, 0]
            _amounts[params[0]] = amount
            BaseLendingPool3Coins(swap).add_liquidity(_amounts, 0, True) # aave on Polygon
        elif params[2] == 9:
            # The number of coins doesn't matter here
            BasePool3Coins(swap).remove_liquidity_one_coin(amount, convert(params[1], int128), 0)
        elif params[2] == 10:
            # The number of coins doesn't matter here
            BaseLendingPool3Coins(swap).remove_liquidity_one_coin(amount, convert(params[1], int128), 0, True) # aave on Polygon
        else:
            raise "Bad swap type"

        # update the amount received
        if output_token == ETH_ADDRESS:
            amount = self.balance
        else:
            amount = ERC20(output_token).balanceOf(self)

        # sanity check, if the routing data is incorrect we will have a 0 balance and that is bad
        assert amount != 0, "Received nothing"

        # check if this was the last swap
        if i == 4 or _route[i*2+1] == ZERO_ADDRESS:
            break
        # if there is another swap, the output token becomes the input for the next round
        input_token = output_token

    # validate the final amount received
    assert amount >= _expected

    # transfer the final token to the receiver
    if output_token == ETH_ADDRESS:
        raw_call(_receiver, b"", value=amount)
    else:
        response: Bytes[32] = raw_call(
            output_token,
            _abi_encode(
                _receiver,
                amount,
                method_id=method_id("transfer(address,uint256)"),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    return amount


@view
@external
def get_best_rate(
    _from: address, _to: address, _amount: uint256, _exclude_pools: address[8] = EMPTY_POOL_LIST
) -> (address, uint256):
    """
    @notice Find the pool offering the best rate for a given swap.
    @dev Checks rates for regular and factory pools
    @param _from Address of coin being sent
    @param _to Address of coin being received
    @param _amount Quantity of `_from` being sent
    @param _exclude_pools A list of up to 8 addresses which shouldn't be returned
    @return Pool address, amount received
    """
    best_pool: address = ZERO_ADDRESS
    max_dy: uint256 = 0

    initial: address = _from
    target: address = _to
    if _from == ETH_ADDRESS:
        initial = WETH_ADDRESS
    if _to == ETH_ADDRESS:
        target = WETH_ADDRESS

    registry: address = self.crypto_registry
    for i in range(65536):
        pool: address = Registry(registry).find_pool_for_coins(initial, target, i)
        if pool == ZERO_ADDRESS:
            if i == 0:
                # we only check for stableswap pools if we did not find any crypto pools
                break
            return best_pool, max_dy
        elif pool in _exclude_pools:
            continue
        dy: uint256 = self._get_crypto_exchange_amount(registry, pool, initial, target, _amount)
        if dy > max_dy:
            best_pool = pool
            max_dy = dy

    registry = self.registry
    for i in range(65536):
        pool: address = Registry(registry).find_pool_for_coins(_from, _to, i)
        if pool == ZERO_ADDRESS:
            break
        elif pool in _exclude_pools:
            continue
        dy: uint256 = self._get_exchange_amount(registry, pool, _from, _to, _amount)
        if dy > max_dy:
            best_pool = pool
            max_dy = dy

    registry = self.factory_registry
    for i in range(65536):
        pool: address = Registry(registry).find_pool_for_coins(_from, _to, i)
        if pool == ZERO_ADDRESS:
            break
        elif pool in _exclude_pools:
            continue
        if ERC20(pool).totalSupply() == 0:
            # ignore pools without TVL as the call to `get_dy` will revert
            continue
        dy: uint256 = self._get_exchange_amount(registry, pool, _from, _to, _amount)
        if dy > max_dy:
            best_pool = pool
            max_dy = dy

    return best_pool, max_dy


@view
@external
def get_exchange_amount(_pool: address, _from: address, _to: address, _amount: uint256) -> uint256:
    """
    @notice Get the current number of coins received in an exchange
    @dev Works for both regular and factory-deployed pools
    @param _pool Pool address
    @param _from Address of coin to be sent
    @param _to Address of coin to be received
    @param _amount Quantity of `_from` to be sent
    @return Quantity of `_to` to be received
    """

    registry: address = self.crypto_registry
    if Registry(registry).get_lp_token(_pool) != ZERO_ADDRESS:
        initial: address = _from
        target: address = _to
        if _from == ETH_ADDRESS:
            initial = WETH_ADDRESS
        if _to == ETH_ADDRESS:
            target = WETH_ADDRESS
        return self._get_crypto_exchange_amount(registry, _pool, initial, target, _amount)

    registry = self.registry
    if Registry(registry).get_lp_token(_pool) == ZERO_ADDRESS:
        registry = self.factory_registry
    return self._get_exchange_amount(registry, _pool, _from, _to, _amount)


@view
@external
def get_input_amount(_pool: address, _from: address, _to: address, _amount: uint256) -> uint256:
    """
    @notice Get the current number of coins required to receive the given amount in an exchange
    @param _pool Pool address
    @param _from Address of coin to be sent
    @param _to Address of coin to be received
    @param _amount Quantity of `_to` to be received
    @return Quantity of `_from` to be sent
    """
    registry: address = self.registry

    i: int128 = 0
    j: int128 = 0
    is_underlying: bool = False
    i, j, is_underlying = Registry(registry).get_coin_indices(_pool, _from, _to)
    amp: uint256 = Registry(registry).get_A(_pool)
    fee: uint256 = Registry(registry).get_fees(_pool)[0]

    balances: uint256[MAX_COINS] = empty(uint256[MAX_COINS])
    rates: uint256[MAX_COINS] = empty(uint256[MAX_COINS])
    decimals: uint256[MAX_COINS] = empty(uint256[MAX_COINS])
    n_coins: uint256 = Registry(registry).get_n_coins(_pool)[convert(is_underlying, uint256)]
    if is_underlying:
        balances = Registry(registry).get_underlying_balances(_pool)
        decimals = Registry(registry).get_underlying_decimals(_pool)
        for x in range(MAX_COINS):
            if x == n_coins:
                break
            rates[x] = 10**18
    else:
        balances = Registry(registry).get_balances(_pool)
        decimals = Registry(registry).get_decimals(_pool)
        rates = Registry(registry).get_rates(_pool)

    for x in range(MAX_COINS):
        if x == n_coins:
            break
        decimals[x] = 10 ** (18 - decimals[x])

    calculator: address = self.pool_calculator[_pool]
    if calculator == ZERO_ADDRESS:
        calculator = self.default_calculator
    return Calculator(calculator).get_dx(n_coins, balances, amp, fee, rates, decimals, i, j, _amount)


@view
@external
def get_exchange_amounts(
    _pool: address,
    _from: address,
    _to: address,
    _amounts: uint256[CALC_INPUT_SIZE]
) -> uint256[CALC_INPUT_SIZE]:
    """
    @notice Get the current number of coins required to receive the given amount in an exchange
    @param _pool Pool address
    @param _from Address of coin to be sent
    @param _to Address of coin to be received
    @param _amounts Quantity of `_to` to be received
    @return Quantity of `_from` to be sent
    """
    registry: address = self.registry

    i: int128 = 0
    j: int128 = 0
    is_underlying: bool = False
    balances: uint256[MAX_COINS] = empty(uint256[MAX_COINS])
    rates: uint256[MAX_COINS] = empty(uint256[MAX_COINS])
    decimals: uint256[MAX_COINS] = empty(uint256[MAX_COINS])

    amp: uint256 = Registry(registry).get_A(_pool)
    fee: uint256 = Registry(registry).get_fees(_pool)[0]
    i, j, is_underlying = Registry(registry).get_coin_indices(_pool, _from, _to)
    n_coins: uint256 = Registry(registry).get_n_coins(_pool)[convert(is_underlying, uint256)]

    if is_underlying:
        balances = Registry(registry).get_underlying_balances(_pool)
        decimals = Registry(registry).get_underlying_decimals(_pool)
        for x in range(MAX_COINS):
            if x == n_coins:
                break
            rates[x] = 10**18
    else:
        balances = Registry(registry).get_balances(_pool)
        decimals = Registry(registry).get_decimals(_pool)
        rates = Registry(registry).get_rates(_pool)

    for x in range(MAX_COINS):
        if x == n_coins:
            break
        decimals[x] = 10 ** (18 - decimals[x])

    calculator: address = self.pool_calculator[_pool]
    if calculator == ZERO_ADDRESS:
        calculator = self.default_calculator
    return Calculator(calculator).get_dy(n_coins, balances, amp, fee, rates, decimals, i, j, _amounts)


@view
@external
def get_exchange_multiple_amount(
    _route: address[9],
    _swap_params: uint256[3][4],
    _amount: uint256,
    _pools: address[4]=[ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS, ZERO_ADDRESS]
) -> uint256:
    """
    @notice Get the current number the final output tokens received in an exchange
    @dev Routing and swap params must be determined off-chain. This
         functionality is designed for gas efficiency over ease-of-use.
    @param _route Array of [initial token, pool, token, pool, token, ...]
                  The array is iterated until a pool address of 0x00, then the last
                  given token is transferred to `_receiver`
    @param _swap_params Multidimensional array of [i, j, swap type] where i and j are the correct
                        values for the n'th pool in `_route`. The swap type should be 1 for
                        a stableswap `exchange`, 2 for stableswap `exchange_underlying`, 3
                        for a cryptoswap `exchange`, 4 for a cryptoswap `exchange_underlying`,
                        5 for Polygon factory metapools `exchange_underlying`, 6-8 for
                        underlying coin -> LP token "exchange" (actually `add_liquidity`), 9 and 10
                        for LP token -> underlying coin "exchange" (actually `remove_liquidity_one_coin`)
    @param _amount The amount of `_route[0]` token to be sent.
    @param _pools Array of pools for swaps via zap contracts. This parameter is only needed for
                  Polygon meta-factories underlying swaps.
    @return Expected amount of the final output token
    """
    amount: uint256 = _amount

    for i in range(1,5):
        # 4 rounds of iteration to perform up to 4 swaps
        swap: address = _route[i*2-1]
        pool: address = _pools[i-1] # Only for Polygon meta-factories underlying swap (swap_type == 4)
        params: uint256[3] = _swap_params[i-1]  # i, j, swap type

        # Calc output amount according to the swap type
        if params[2] == 1:
            amount = CurvePool(swap).get_dy(convert(params[0], int128), convert(params[1], int128), amount)
        elif params[2] == 2:
            amount = CurvePool(swap).get_dy_underlying(convert(params[0], int128), convert(params[1], int128), amount)
        elif params[2] == 3:
            amount = CryptoPool(swap).get_dy(params[0], params[1], amount)
        elif params[2] == 4:
            amount = CryptoPool(swap).get_dy_underlying(params[0], params[1], amount)
        elif params[2] == 5:
            amount = CurvePool(pool).get_dy_underlying(convert(params[0], int128), convert(params[1], int128), amount)
        elif params[2] == 6:
            _amounts: uint256[2] = [0, 0]
            _amounts[params[0]] = amount
            amount = BasePool2Coins(swap).calc_token_amount(_amounts, True)
        elif params[2] in [7, 8]:
            _amounts: uint256[3] = [0, 0, 0]
            _amounts[params[0]] = amount
            amount = BasePool3Coins(swap).calc_token_amount(_amounts, True)
        elif params[2] in [9, 10]:
            # The number of coins doesn't matter here
            amount = BasePool3Coins(swap).calc_withdraw_one_coin(amount, convert(params[1], int128))
        else:
            raise "Bad swap type"

        # check if this was the last swap
        if i == 4 or _route[i*2+1] == ZERO_ADDRESS:
            break

    return amount


@view
@external
def get_calculator(_pool: address) -> address:
    """
    @notice Set calculator contract
    @dev Used to calculate `get_dy` for a pool
    @param _pool Pool address
    @return `CurveCalc` address
    """
    calculator: address = self.pool_calculator[_pool]
    if calculator == ZERO_ADDRESS:
        return self.default_calculator
    else:
        return calculator


@external
def update_registry_address() -> bool:
    """
    @notice Update registry address
    @dev The registry address is kept in storage to reduce gas costs.
         If a new registry is deployed this function should be called
         to update the local address from the address provider.
    @return bool success
    """
    address_provider: address = self.address_provider.address
    self.registry = AddressProvider(address_provider).get_registry()
    self.factory_registry = AddressProvider(address_provider).get_address(3)
    self.crypto_registry = AddressProvider(address_provider).get_address(5)

    return True


@external
def set_calculator(_pool: address, _calculator: address) -> bool:
    """
    @notice Set calculator contract
    @dev Used to calculate `get_dy` for a pool
    @param _pool Pool address
    @param _calculator `CurveCalc` address
    @return bool success
    """
    assert msg.sender == self.address_provider.admin()  # dev: admin-only function

    self.pool_calculator[_pool] = _calculator

    return True


@external
def set_default_calculator(_calculator: address) -> bool:
    """
    @notice Set default calculator contract
    @dev Used to calculate `get_dy` for a pool
    @param _calculator `CurveCalc` address
    @return bool success
    """
    assert msg.sender == self.address_provider.admin()  # dev: admin-only function

    self.default_calculator = _calculator

    return True


@external
def claim_balance(_token: address) -> bool:
    """
    @notice Transfer an ERC20 or ETH balance held by this contract
    @dev The entire balance is transferred to the owner
    @param _token Token address
    @return bool success
    """
    assert msg.sender == self.address_provider.admin()  # dev: admin-only function

    if _token == ETH_ADDRESS:
        raw_call(msg.sender, b"", value=self.balance)
    else:
        amount: uint256 = ERC20(_token).balanceOf(self)
        response: Bytes[32] = raw_call(
            _token,
            concat(
                method_id("transfer(address,uint256)"),
                convert(msg.sender, bytes32),
                convert(amount, bytes32),
            ),
            max_outsize=32,
        )
        if len(response) != 0:
            assert convert(response, bool)

    return True


@external
def set_killed(_is_killed: bool) -> bool:
    """
    @notice Kill or unkill the contract
    @param _is_killed Killed status of the contract
    @return bool success
    """
    assert msg.sender == self.address_provider.admin()  # dev: admin-only function
    self.is_killed = _is_killed

    return True

Contract ABI

[{"name":"TokenExchange","inputs":[{"name":"buyer","type":"address","indexed":true},{"name":"receiver","type":"address","indexed":true},{"name":"pool","type":"address","indexed":true},{"name":"token_sold","type":"address","indexed":false},{"name":"token_bought","type":"address","indexed":false},{"name":"amount_sold","type":"uint256","indexed":false},{"name":"amount_bought","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_address_provider","type":"address"},{"name":"_calculator","type":"address"}],"outputs":[]},{"stateMutability":"payable","type":"fallback"},{"stateMutability":"payable","type":"function","name":"exchange_with_best_rate","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":1019563733},{"stateMutability":"payable","type":"function","name":"exchange_with_best_rate","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":1019563733},{"stateMutability":"payable","type":"function","name":"exchange","inputs":[{"name":"_pool","type":"address"},{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":427142},{"stateMutability":"payable","type":"function","name":"exchange","inputs":[{"name":"_pool","type":"address"},{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":427142},{"stateMutability":"payable","type":"function","name":"exchange_multiple","inputs":[{"name":"_route","type":"address[9]"},{"name":"_swap_params","type":"uint256[3][4]"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":313422},{"stateMutability":"payable","type":"function","name":"exchange_multiple","inputs":[{"name":"_route","type":"address[9]"},{"name":"_swap_params","type":"uint256[3][4]"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"},{"name":"_pools","type":"address[4]"}],"outputs":[{"name":"","type":"uint256"}],"gas":313422},{"stateMutability":"payable","type":"function","name":"exchange_multiple","inputs":[{"name":"_route","type":"address[9]"},{"name":"_swap_params","type":"uint256[3][4]"},{"name":"_amount","type":"uint256"},{"name":"_expected","type":"uint256"},{"name":"_pools","type":"address[4]"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}],"gas":313422},{"stateMutability":"view","type":"function","name":"get_best_rate","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"gas":3002213116},{"stateMutability":"view","type":"function","name":"get_best_rate","inputs":[{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"},{"name":"_exclude_pools","type":"address[8]"}],"outputs":[{"name":"","type":"address"},{"name":"","type":"uint256"}],"gas":3002213116},{"stateMutability":"view","type":"function","name":"get_exchange_amount","inputs":[{"name":"_pool","type":"address"},{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":30596},{"stateMutability":"view","type":"function","name":"get_input_amount","inputs":[{"name":"_pool","type":"address"},{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":34701},{"stateMutability":"view","type":"function","name":"get_exchange_amounts","inputs":[{"name":"_pool","type":"address"},{"name":"_from","type":"address"},{"name":"_to","type":"address"},{"name":"_amounts","type":"uint256[100]"}],"outputs":[{"name":"","type":"uint256[100]"}],"gas":38286},{"stateMutability":"view","type":"function","name":"get_exchange_multiple_amount","inputs":[{"name":"_route","type":"address[9]"},{"name":"_swap_params","type":"uint256[3][4]"},{"name":"_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}],"gas":21184},{"stateMutability":"view","type":"function","name":"get_exchange_multiple_amount","inputs":[{"name":"_route","type":"address[9]"},{"name":"_swap_params","type":"uint256[3][4]"},{"name":"_amount","type":"uint256"},{"name":"_pools","type":"address[4]"}],"outputs":[{"name":"","type":"uint256"}],"gas":21184},{"stateMutability":"view","type":"function","name":"get_calculator","inputs":[{"name":"_pool","type":"address"}],"outputs":[{"name":"","type":"address"}],"gas":5215},{"stateMutability":"nonpayable","type":"function","name":"update_registry_address","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":115368},{"stateMutability":"nonpayable","type":"function","name":"set_calculator","inputs":[{"name":"_pool","type":"address"},{"name":"_calculator","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":40695},{"stateMutability":"nonpayable","type":"function","name":"set_default_calculator","inputs":[{"name":"_calculator","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":40459},{"stateMutability":"nonpayable","type":"function","name":"claim_balance","inputs":[{"name":"_token","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":41823},{"stateMutability":"nonpayable","type":"function","name":"set_killed","inputs":[{"name":"_is_killed","type":"bool"}],"outputs":[{"name":"","type":"bool"}],"gas":40519},{"stateMutability":"view","type":"function","name":"registry","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2970},{"stateMutability":"view","type":"function","name":"factory_registry","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3000},{"stateMutability":"view","type":"function","name":"crypto_registry","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3030},{"stateMutability":"view","type":"function","name":"default_calculator","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3060},{"stateMutability":"view","type":"function","name":"is_killed","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":3090}]

60206148866080396080518060a01c6148815760e05260206020614886016080396080518060a01c614881576101005260e05160015563a262904b610120526020610120600461013c60e0515afa61005c573d600060003e3d6000fd5b601f3d111561488157610120518060a01c6148815760025563493f4f74610120526003610140526020610120602461013c60e0515afa6100a1573d600060003e3d6000fd5b601f3d111561488157610120518060a01c6148815760035563493f4f74610120526005610140526020610120602461013c60e0515afa6100e6573d600060003e3d6000fd5b601f3d111561488157610120518060a01c614881576004556101005160055561486956600436101561000d57613905565b60046000601c376000516310e5e303811861002c57336103e052610047565b639f69a6a681186102cf576084358060a01c61475a576103e0525b6004358060a01c61475a576103a0526024358060a01c61475a576103c05260005461475a57600160005573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6103a05118610113573460443514610190576014610400527f496e636f72726563742045544820616d6f756e740000000000000000000000006104205261040050610400518061042001818260206001820306601f82010390500336823750506308c379a06103c05260206103e0526104005160206001820306601f82010390506044016103dcfd610190565b3415610190576014610400527f496e636f72726563742045544820616d6f756e740000000000000000000000006104205261040050610400518061042001818260206001820306601f82010390500336823750506308c379a06103c05260206103e0526104005160206001820306601f82010390506044016103dcfd5b6002546104005260403661042037610460600062010000818352015b636982eb0b6104a0526103a0516104c0526103c0516104e052610460516105005260206104a060646104bc610400515afa6101ec573d600060003e3d6000fd5b601f3d111561475a576104a0518060a01c61475a5761048052610480516102125761027a565b6104005160e05261048051610100526103a051610120526103c05161014052604435610160526102436104c0613907565b6104c0516104a052610440516104a051111561026a5761048051610420526104a051610440525b81516001018083528114156101ac575b50506104005160e05261042051610100526103a051610120526103c051610140526040604461016037336101a0526103e0516101c0526102bb610460613b53565b610460516104805260206104806000600055f35b634798ce5b81186102e45733610400526102ff565b631a4c1ca381186105875760a4358060a01c61475a57610400525b6004358060a01c61475a576103a0526024358060a01c61475a576103c0526044358060a01c61475a576103e05260005461475a57600160005573eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6103c051186103da573460643514610457576014610420527f496e636f72726563742045544820616d6f756e740000000000000000000000006104405261042050610420518061044001818260206001820306601f82010390500336823750506308c379a06103e0526020610400526104205160206001820306601f82010390506044016103fcfd610457565b3415610457576014610420527f496e636f72726563742045544820616d6f756e740000000000000000000000006104405261042050610420518061044001818260206001820306601f82010390500336823750506308c379a06103e0526020610400526104205160206001820306601f82010390506044016103fcfd5b60006337951049610420526103a051610440526020610420602461043c6004545afa610488573d600060003e3d6000fd5b601f3d111561475a5761042051146104e3576103a05160e0526103c051610100526103e0516101205260406064610140373361018052610400516101a0526104d1610460614202565b61046051610480526020610480610580565b600254610420526337951049610440526103a051610460526020610440602461045c610420515afa61051a573d600060003e3d6000fd5b601f3d111561475a576104405161053357600354610420525b6104205160e0526103a051610100526103c051610120526103e051610140526040606461016037336101a052610400516101c052610572610440613b53565b610440516104605260206104605b6000600055f35b63353ca42481186105b4576000610200526000610220526000610240526000610260523361028052610665565b639db4f7aa8118610609576102e4358060a01c61475a5761020052610304358060a01c61475a5761022052610324358060a01c61475a5761024052610344358060a01c61475a57610260523361028052610665565b630651cb3581186111d8576102e4358060a01c61475a5761020052610304358060a01c61475a5761022052610324358060a01c61475a5761024052610344358060a01c61475a5761026052610364358060a01c61475a57610280525b6004358060a01c61475a5760e0526024358060a01c61475a57610100526044358060a01c61475a57610120526064358060a01c61475a57610140526084358060a01c61475a576101605260a4358060a01c61475a576101805260c4358060a01c61475a576101a05260e4358060a01c61475a576101c052610104358060a01c61475a576101e05260e0516102a0526102a4356102c05260006102e05273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6102a0511861072e576102c051341861475a576107d2565b3461475a576323b872dd610344526004336103645230610384526102c0516103a452606001610340526103405060206104006103405161036060006102a0515af161077e573d600060003e3d6000fd5b6103e060203d8082116107915781610793565b805b905090508152805160200180610300828460045afa90505050600061030051146107d257610320516103005181816020036008021c905090501561475a575b61030060016004818352015b60e061030051600280820282158284830414171561475a5790509050600180821061475a5780820390509050600981101561475a5760200201516103205261020061030051600180821061475a5780820390509050600481101561475a5760200201516103405260e061030051600280820282158284830414171561475a5790509050600981101561475a5760200201516102e052606061030051600180821061475a5780820390509050026101240180356103605260208101356103805260408101356103a0525060086102a05160a05260805260406080206103205160a0526080526040608020546109aa5763095ea7b361040452600461032051610424527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61044452604001610400526104005060206104a06104005161042060006102a0515af1610932573d600060003e3d6000fd5b61048060203d8082116109455781610947565b805b9050905081528051602001806103c0828460045afa9050505060006103c05114610986576103e0516103c05181816020036008021c905090501561475a575b600160086102a05160a05260805260406080206103205160a0526080526040608020555b60006103c05273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6102a051186109d7576102c0516103c0525b60016103a05118610a4957633df021246103e0526103605180607f1c61475a57610400526103805180607f1c61475a57610420526102c05161044052600061046052610320513b1561475a576000600060846103fc6103c051610320515af1610f71573d600060003e3d6000fd610f71565b60026103a05118610abb5763a6417ed66103e0526103605180607f1c61475a57610400526103805180607f1c61475a57610420526102c05161044052600061046052610320513b1561475a576000600060846103fc6103c051610320515af1610f71573d600060003e3d6000fd610f71565b60036103a05118610bbc5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6102a05118610aeb576001610b06565b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6102e051145b610b5f57635b41b9086103e052610360516104005261038051610420526102c05161044052600061046052610320513b1561475a576000600060846103fc6000610320515af1610f71573d600060003e3d6000fd610f71565b63394747c56103e052610360516104005261038051610420526102c05161044052600061046052600161048052610320513b1561475a576000600060a46103fc6103c051610320515af1610f71573d600060003e3d6000fd610f71565b60046103a05118610c1e576365b2489b6103e052610360516104005261038051610420526102c05161044052600061046052610320513b1561475a576000600060846103fc6103c051610320515af1610f71573d600060003e3d6000fd610f71565b60056103a05118610c9657637981c43e6103e05261034051610400526103605180607f1c61475a57610420526103805180607f1c61475a57610440526102c05161046052600061048052610320513b1561475a576000600060a46103fc6000610320515af1610f71573d600060003e3d6000fd610f71565b60066103a05118610d135760006103e0526000610400526102c0516103e061036051600281101561475a576020020152630b4c7e4d610420526103e051610440526104005161046052600061048052610320513b1561475a5760006000606461043c6000610320515af1610f71573d600060003e3d6000fd610f71565b60076103a05118610d9e5760006103e0526000610400526000610420526102c0516103e061036051600381101561475a576020020152634515cef3610440526103e051610460526104005161048052610420516104a05260006104c052610320513b1561475a5760006000608461045c6000610320515af1610f71573d600060003e3d6000fd610f71565b60086103a05118610e2f5760006103e0526000610400526000610420526102c0516103e061036051600381101561475a576020020152632b6e993a610440526103e051610460526104005161048052610420516104a05260006104c05260016104e052610320513b1561475a576000600060a461045c6000610320515af1610f71573d600060003e3d6000fd610f71565b60096103a05118610e8f57631a4d01d26103e0526102c051610400526103805180607f1c61475a5761042052600061044052610320513b1561475a576000600060646103fc6000610320515af1610f71573d600060003e3d6000fd610f71565b600a6103a05118610efa5763517a55a36103e0526102c051610400526103805180607f1c61475a576104205260006104405260016104605260206103e060846103fc6000610320515af1610ee8573d600060003e3d6000fd5b601f3d111561475a576103e050610f71565b600d6103e0527f4261642073776170207479706500000000000000000000000000000000000000610400526103e0506103e0518061040001818260206001820306601f82010390500336823750506308c379a06103a05260206103c0526103e05160206001820306601f82010390506044016103bcfd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6102e05118610f9957476102c052610fd8565b6370a082316103e052306104005260206103e060246103fc6102e0515afa610fc6573d600060003e3d6000fd5b601f3d111561475a576103e0516102c0525b60006102c051141561105b5760106103e0527f5265636569766564206e6f7468696e6700000000000000000000000000000000610400526103e0506103e0518061040001818260206001820306601f82010390500336823750506308c379a06103a05260206103c0526103e05160206001820306601f82010390506044016103bcfd5b6004610300511861106d5760016110ab565b60e061030051600280820282158284830414171561475a57905090506001818183011061475a5780820190509050600981101561475a576020020151155b156110b5576110cd565b6102e0516102a05281516001018083528114156107de575b50506102c4356102c0511061475a5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6102e0511861112c576000610300526103005060006000610300516103206102c051610280515af16111c9573d600060003e3d6000fd6111c9565b63a9059cbb61034452600461028051610364526102c05161038452604001610340526103405060206103e06103405161036060006102e0515af1611175573d600060003e3d6000fd5b6103c060203d808211611188578161118a565b805b905090508152805160200180610300828460045afa90505050600061030051146111c957610320516103005181816020036008021c905090501561475a575b6102c051610300526020610300f35b634e21df7581186112185760006103a05260006103c05260006103e05260006104005260006104205260006104405260006104605260006104805261129f565b63488de9af8118611776576064358060a01c61475a576103a0526084358060a01c61475a576103c05260a4358060a01c61475a576103e05260c4358060a01c61475a576104005260e4358060a01c61475a5761042052610104358060a01c61475a5761044052610124358060a01c61475a5761046052610144358060a01c61475a57610480525b6004358060a01c61475a57610360526024358060a01c61475a57610380523461475a576040366104a037610360516104e052610380516105005273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61036051186113115773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26104e0525b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61038051186113495773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610500525b60045461052052610540600062010000818352015b636982eb0b610580526104e0516105a052610500516105c052610540516105e0526020610580606461059c610520515afa61139e573d600060003e3d6000fd5b601f3d111561475a57610580518060a01c61475a576105605261056051156114165760006105805261058060c060006008818352015b60c0516020026103a0015161056051186113f15760018352611401565b81516001018083528114156113d4575b50505061058051156114405761149856611440565b61054051611423576114a8565b5050506104a051610580526104c0516105a0526040610580611774565b6105205160e05261056051610100526104e051610120526105005161014052604435610160526114716105a0613a9f565b6105a051610580526104c05161058051111561149857610560516104a052610580516104c0525b815160010180835281141561135e575b505060025461052052610540600062010000818352015b636982eb0b61058052610360516105a052610380516105c052610540516105e0526020610580606461059c610520515afa6114ff573d600060003e3d6000fd5b601f3d111561475a57610580518060a01c61475a576105605261056051156115e35760006105805261058060c060006008818352015b60c0516020026103a0015161056051186115525760018352611562565b8151600101808352811415611535575b505050610580511561157b576115d35661157b566115e3565b6105205160e052610560516101005261036051610120526103805161014052604435610160526115ac6105a0613907565b6105a051610580526104c0516105805111156115d357610560516104a052610580516104c0525b81516001018083528114156114bf575b505060035461052052610540600062010000818352015b636982eb0b61058052610360516105a052610380516105c052610540516105e0526020610580606461059c610520515afa61163a573d600060003e3d6000fd5b601f3d111561475a57610580518060a01c61475a5761056052610560511561175c5760006105805261058060c060006008818352015b60c0516020026103a00151610560511861168d576001835261169d565b8151600101808352811415611670575b50505061058051156116b65761174c566116b65661175c565b6318160ddd610580526020610580600461059c610560515afa6116de573d600060003e3d6000fd5b601f3d111561475a57610580516116f45761174c565b6105205160e052610560516101005261036051610120526103805161014052604435610160526117256105a0613907565b6105a051610580526104c05161058051111561174c57610560516104a052610580516104c0525b81516001018083528114156115fa575b50506104a051610540526104c0516105605260406105405bf35b633973e8348118611952576004358060a01c61475a57610360526024358060a01c61475a57610380526044358060a01c61475a576103a0523461475a576004546103c052600063379510496103e052610360516104005260206103e060246103fc6103c0515afa6117ec573d600060003e3d6000fd5b601f3d111561475a576103e051146118c15761038051610420526103a0516104405273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61038051186118465773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610420525b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6103a0511861187e5773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc2610440525b6103c05160e052610360516101005261042051610120526104405161014052606435610160526118af610460613a9f565b61046051610480526020610480611950565b6002546103c05263379510496103e052610360516104005260206103e060246103fc6103c0515afa6118f8573d600060003e3d6000fd5b601f3d111561475a576103e051611911576003546103c0525b6103c05160e052610360516101005261038051610120526103a05161014052606435610160526119426103e0613907565b6103e0516104005260206104005bf35b637fa5a6548118611fc7576004358060a01c61475a5760e0526024358060a01c61475a57610100526044358060a01c61475a57610120523461475a57600254610140526060366101603763eb85226d6101c05260e0516101e0526101005161020052610120516102205260606101c060646101dc610140515afa6119db573d600060003e3d6000fd5b605f3d111561475a576101c080518060801d81607f1d1861475a576101605260208101518060801d81607f1d1861475a576101805260408101518060011c61475a576101a052506355b30b196101e05260e0516102005260206101e060246101fc610140515afa611a51573d600060003e3d6000fd5b601f3d111561475a576101e0516101c052637cdb72b06102005260e051610220526040610200602461021c610140515afa611a91573d600060003e3d6000fd5b603f3d111561475a57610200516101e052610300366102003760206101a0510263940494f16105205260e051610540526040610520602461053c610140515afa611ae0573d600060003e3d6000fd5b603f3d111561475a576105200151610500526101a051611c85576392e3cc2d6105205260e05161054052610100610520602461053c610140515afa611b2a573d600060003e3d6000fd5b60ff3d111561475a5761052080516102005260208101516102205260408101516102405260608101516102605260808101516102805260a08101516102a05260c08101516102c05260e08101516102e052506352b515556105205260e05161054052610100610520602461053c610140515afa611bac573d600060003e3d6000fd5b60ff3d111561475a5761052080516104005260208101516104205260408101516104405260608101516104605260808101516104805260a08101516104a05260c08101516104c05260e08101516104e0525063ce99e45a6105205260e05161054052610100610520602461053c610140515afa611c2e573d600060003e3d6000fd5b60ff3d111561475a5761052080516103005260208101516103205260408101516103405260608101516103605260808101516103805260a08101516103a05260c08101516103c05260e08101516103e05250611dd8565b6359f4f3516105205260e05161054052610100610520602461053c610140515afa611cb5573d600060003e3d6000fd5b60ff3d111561475a5761052080516102005260208101516102205260408101516102405260608101516102605260808101516102805260a08101516102a05260c08101516102c05260e08101516102e05250634cb088f16105205260e05161054052610100610520602461053c610140515afa611d37573d600060003e3d6000fd5b60ff3d111561475a5761052080516104005260208101516104205260408101516104405260608101516104605260808101516104805260a08101516104a05260c08101516104c05260e08101516104e0525061052060006008818352015b610500516105205118611da757611dd5565b670de0b6b3a764000061030061052051600881101561475a5760200201528151600101808352811415611d95575b50505b61052060006008818352015b610500516105205118611df657611e70565b604e601261040061052051600881101561475a57602002015180821061475a5780820390509050101561475a57601261040061052051600881101561475a57602002015180821061475a5780820390509050600a0a61040061052051600881101561475a5760200201528151600101808352811415611de4575b5050600760e05160a0526080526040608020546105205261052051611e9757600554610520525b63ca3878906105405261050051610560526102005161058052610220516105a052610240516105c052610260516105e05261028051610600526102a051610620526102c051610640526102e051610660526101c051610680526101e0516106a052610300516106c052610320516106e0526103405161070052610360516107205261038051610740526103a051610760526103c051610780526103e0516107a052610400516107c052610420516107e0526104405161080052610460516108205261048051610840526104a051610860526104c051610880526104e0516108a052610160516108c052610180516108e0526064356109005260206105406103c461055c610520515afa611faf573d600060003e3d6000fd5b601f3d111561475a5761054051610920526020610920f35b634be9ae428118612d25576004358060a01c61475a5760e0526024358060a01c61475a57610100526044358060a01c61475a57610120523461475a576002546101405261036036610160376355b30b196104e05260e0516105005260206104e060246104fc610140515afa612041573d600060003e3d6000fd5b601f3d111561475a576104e0516104c052637cdb72b06105005260e051610520526040610500602461051c610140515afa612081573d600060003e3d6000fd5b603f3d111561475a57610500516104e05263eb85226d6105005260e05161052052610100516105405261012051610560526060610500606461051c610140515afa6120d1573d600060003e3d6000fd5b605f3d111561475a5761050080518060801d81607f1d1861475a576101605260208101518060801d81607f1d1861475a576101805260408101518060011c61475a576101a0525060206101a0510263940494f16105205260e051610540526040610520602461053c610140515afa61214e573d600060003e3d6000fd5b603f3d111561475a576105200151610500526101a0516122f3576392e3cc2d6105205260e05161054052610100610520602461053c610140515afa612198573d600060003e3d6000fd5b60ff3d111561475a5761052080516101c05260208101516101e05260408101516102005260608101516102205260808101516102405260a08101516102605260c08101516102805260e08101516102a052506352b515556105205260e05161054052610100610520602461053c610140515afa61221a573d600060003e3d6000fd5b60ff3d111561475a5761052080516103c05260208101516103e05260408101516104005260608101516104205260808101516104405260a08101516104605260c08101516104805260e08101516104a0525063ce99e45a6105205260e05161054052610100610520602461053c610140515afa61229c573d600060003e3d6000fd5b60ff3d111561475a5761052080516102c05260208101516102e05260408101516103005260608101516103205260808101516103405260a08101516103605260c08101516103805260e08101516103a05250612446565b6359f4f3516105205260e05161054052610100610520602461053c610140515afa612323573d600060003e3d6000fd5b60ff3d111561475a5761052080516101c05260208101516101e05260408101516102005260608101516102205260808101516102405260a08101516102605260c08101516102805260e08101516102a05250634cb088f16105205260e05161054052610100610520602461053c610140515afa6123a5573d600060003e3d6000fd5b60ff3d111561475a5761052080516103c05260208101516103e05260408101516104005260608101516104205260808101516104405260a08101516104605260c08101516104805260e08101516104a0525061052060006008818352015b61050051610520511861241557612443565b670de0b6b3a76400006102c061052051600881101561475a5760200201528151600101808352811415612403575b50505b61052060006008818352015b610500516105205118612464576124de565b604e60126103c061052051600881101561475a57602002015180821061475a5780820390509050101561475a5760126103c061052051600881101561475a57602002015180821061475a5780820390509050600a0a6103c061052051600881101561475a5760200201528151600101808352811415612452575b5050600760e05160a052608052604060802054610520526105205161250557600554610520525b63138f41f16105405261050051610560526101c051610580526101e0516105a052610200516105c052610220516105e0526102405161060052610260516106205261028051610640526102a051610660526104c051610680526104e0516106a0526102c0516106c0526102e0516106e052610300516107005261032051610720526103405161074052610360516107605261038051610780526103a0516107a0526103c0516107c0526103e0516107e052610400516108005261042051610820526104405161084052610460516108605261048051610880526104a0516108a052610160516108c052610180516108e052606435610900526084356109205260a4356109405260c4356109605260e43561098052610104356109a052610124356109c052610144356109e05261016435610a005261018435610a20526101a435610a40526101c435610a60526101e435610a805261020435610aa05261022435610ac05261024435610ae05261026435610b005261028435610b20526102a435610b40526102c435610b60526102e435610b805261030435610ba05261032435610bc05261034435610be05261036435610c005261038435610c20526103a435610c40526103c435610c60526103e435610c805261040435610ca05261042435610cc05261044435610ce05261046435610d005261048435610d20526104a435610d40526104c435610d60526104e435610d805261050435610da05261052435610dc05261054435610de05261056435610e005261058435610e20526105a435610e40526105c435610e60526105e435610e805261060435610ea05261062435610ec05261064435610ee05261066435610f005261068435610f20526106a435610f40526106c435610f60526106e435610f805261070435610fa05261072435610fc05261074435610fe052610764356110005261078435611020526107a435611040526107c435611060526107e43561108052610804356110a052610824356110c052610844356110e052610864356111005261088435611120526108a435611140526108c435611160526108e43561118052610904356111a052610924356111c052610944356111e052610964356112005261098435611220526109a435611240526109c435611260526109e43561128052610a04356112a052610a24356112c052610a44356112e052610a643561130052610a843561132052610aa43561134052610ac43561136052610ae43561138052610b04356113a052610b24356113c052610b44356113e052610b643561140052610b843561142052610ba43561144052610bc43561146052610be43561148052610c04356114a052610c24356114c052610c44356114e052610c643561150052610c843561152052610ca43561154052610cc43561156052610c8061054061102461055c610520515afa612932573d600060003e3d6000fd5b610c7f3d111561475a5761054080516115805260208101516115a05260408101516115c05260608101516115e05260808101516116005260a08101516116205260c08101516116405260e081015161166052610100810151611680526101208101516116a0526101408101516116c0526101608101516116e052610180810151611700526101a0810151611720526101c0810151611740526101e081015161176052610200810151611780526102208101516117a0526102408101516117c0526102608101516117e052610280810151611800526102a0810151611820526102c0810151611840526102e081015161186052610300810151611880526103208101516118a0526103408101516118c0526103608101516118e052610380810151611900526103a0810151611920526103c0810151611940526103e081015161196052610400810151611980526104208101516119a0526104408101516119c0526104608101516119e052610480810151611a00526104a0810151611a20526104c0810151611a40526104e0810151611a6052610500810151611a8052610520810151611aa052610540810151611ac052610560810151611ae052610580810151611b00526105a0810151611b20526105c0810151611b40526105e0810151611b6052610600810151611b8052610620810151611ba052610640810151611bc052610660810151611be052610680810151611c00526106a0810151611c20526106c0810151611c40526106e0810151611c6052610700810151611c8052610720810151611ca052610740810151611cc052610760810151611ce052610780810151611d00526107a0810151611d20526107c0810151611d40526107e0810151611d6052610800810151611d8052610820810151611da052610840810151611dc052610860810151611de052610880810151611e00526108a0810151611e20526108c0810151611e40526108e0810151611e6052610900810151611e8052610920810151611ea052610940810151611ec052610960810151611ee052610980810151611f00526109a0810151611f20526109c0810151611f40526109e0810151611f6052610a00810151611f8052610a20810151611fa052610a40810151611fc052610a60810151611fe052610a8081015161200052610aa081015161202052610ac081015161204052610ae081015161206052610b0081015161208052610b208101516120a052610b408101516120c052610b608101516120e052610b8081015161210052610ba081015161212052610bc081015161214052610be081015161216052610c0081015161218052610c208101516121a052610c408101516121c052610c608101516121e05250610c80611580f35b637b3d22cf8118612d4d57600061020052600061022052600061024052600061026052612d99565b63e6eabf2381186133ec576102c4358060a01c61475a57610200526102e4358060a01c61475a5761022052610304358060a01c61475a5761024052610324358060a01c61475a57610260525b6004358060a01c61475a5760e0526024358060a01c61475a57610100526044358060a01c61475a57610120526064358060a01c61475a57610140526084358060a01c61475a576101605260a4358060a01c61475a576101805260c4358060a01c61475a576101a05260e4358060a01c61475a576101c052610104358060a01c61475a576101e0523461475a576102a435610280526102a060016004818352015b60e06102a051600280820282158284830414171561475a5790509050600180821061475a5780820390509050600981101561475a5760200201516102c0526102006102a051600180821061475a5780820390509050600481101561475a5760200201516102e05260606102a051600180821061475a578082039050905002610124018035610300526020810135610320526040810135610340525060016103405118612f4557635e0d443f610360526103005180607f1c61475a57610380526103205180607f1c61475a576103a052610280516103c0526020610360606461037c6102c0515afa612f2f573d600060003e3d6000fd5b601f3d111561475a576103605161028052613371565b60026103405118612fb6576307211ef7610360526103005180607f1c61475a57610380526103205180607f1c61475a576103a052610280516103c0526020610360606461037c6102c0515afa612fa0573d600060003e3d6000fd5b601f3d111561475a576103605161028052613371565b600361034051186130175763556d6e9f610360526103005161038052610320516103a052610280516103c0526020610360606461037c6102c0515afa613001573d600060003e3d6000fd5b601f3d111561475a576103605161028052613371565b60046103405118613078576385f11d1e610360526103005161038052610320516103a052610280516103c0526020610360606461037c6102c0515afa613062573d600060003e3d6000fd5b601f3d111561475a576103605161028052613371565b600561034051186130e9576307211ef7610360526103005180607f1c61475a57610380526103205180607f1c61475a576103a052610280516103c0526020610360606461037c6102e0515afa6130d3573d600060003e3d6000fd5b601f3d111561475a576103605161028052613371565b6006610340511861316d576000610360526000610380526102805161036061030051600281101561475a57602002015263ed8e84f36103a052610360516103c052610380516103e05260016104005260206103a060646103bc6102c0515afa613157573d600060003e3d6000fd5b601f3d111561475a576103a05161028052613371565b60076103805260086103a05260006103605261036060c060006002818352015b60c051602002610380015161034051186131aa57600183526131ba565b815160010180835281141561318d575b505050610360516132ee57600961038052600a6103a05260006103605261036060c060006002818352015b60c051602002610380015161034051186132025760018352613212565b81516001018083528114156131e5575b5050506103605161329857600d610360527f42616420737761702074797065000000000000000000000000000000000000006103805261036050610360518061038001818260206001820306601f82010390500336823750506308c379a0610320526020610340526103605160206001820306601f820103905060440161033cfd613371565b63cc2b27d76103c052610280516103e0526103205180607f1c61475a576104005260206103c060446103dc6102c0515afa6132d8573d600060003e3d6000fd5b601f3d111561475a576103c05161028052613371565b60006103c05260006103e052600061040052610280516103c061030051600381101561475a576020020152633883e119610420526103c051610440526103e05161046052610400516104805260016104a0526020610420608461043c6102c0515afa61335f573d600060003e3d6000fd5b601f3d111561475a5761042051610280525b60046102a051186133835760016133c1565b60e06102a051600280820282158284830414171561475a57905090506001818183011061475a5780820190509050600981101561475a576020020151155b156133cb576133db565b8151600101808352811415612e39575b5050610280516102a05260206102a0f35b635d7dc8258118613451576004358060a01c61475a5760e0523461475a57600760e05160a05260805260406080205461010052610100511561343e576101005161012052602061012061344f5661344f565b60055461012052602061012061344f565bf35b634bbc5b1f811861353d573461475a5760015460e05263a262904b610100526020610100600461011c60e0515afa61348e573d600060003e3d6000fd5b601f3d111561475a57610100518060a01c61475a5760025563493f4f74610100526003610120526020610100602461011c60e0515afa6134d3573d600060003e3d6000fd5b601f3d111561475a57610100518060a01c61475a5760035563493f4f74610100526005610120526020610100602461011c60e0515afa613518573d600060003e3d6000fd5b601f3d111561475a57610100518060a01c61475a576004556001610100526020610100f35b63188c7ee581186135c6576004358060a01c61475a5760e0526024358060a01c61475a57610100523461475a5763f851a440610120526020610120600461013c6001545afa613591573d600060003e3d6000fd5b601f3d111561475a5761012051331861475a5761010051600760e05160a0526080526040608020556001610120526020610120f35b63da3fb2ab8118613631576004358060a01c61475a5760e0523461475a5763f851a440610100526020610100600461011c6001545afa61360b573d600060003e3d6000fd5b601f3d111561475a5761010051331861475a5760e0516005556001610100526020610100f35b63752d53c6811861380c576004358060a01c61475a5760e0523461475a5763f851a440610100526020610100600461011c6001545afa613676573d600060003e3d6000fd5b601f3d111561475a5761010051331861475a5773eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee60e051186136d25760006101005261010050600060006101005161012047335af16137ff573d600060003e3d6000fd6137ff565b6370a082316101205230610140526020610120602461013c60e0515afa6136fe573d600060003e3d6000fd5b601f3d111561475a57610120516101005260006004610160527fa9059cbb00000000000000000000000000000000000000000000000000000000610180526101606004806020846101a00101826020850160045afa505080518201915050336020826101a0010152602081019050610100516020826101a0010152602081019050806101a0526101a0505060206102406101a0516101c0600060e0515af16137ab573d600060003e3d6000fd5b61022060203d8082116137be57816137c0565b805b905090508152805160200180610120828460045afa90505050600061012051146137ff57610140516101205181816020036008021c905090501561475a575b6001610100526020610100f35b6390b229978118613877576004358060011c61475a5760e0523461475a5763f851a440610100526020610100600461011c6001545afa613851573d600060003e3d6000fd5b601f3d111561475a5761010051331861475a5760e0516006556001610100526020610100f35b637b1039998118613893573461475a5760025460e052602060e0f35b63f7cbf4c681186138af573461475a5760035460e052602060e0f35b63f3b8f82981186138cb573461475a5760045460e052602060e0f35b633b359fc881186138e7573461475a5760055460e052602060e0f35b639c868ac08118613903573461475a5760065460e052602060e0f35b505b005b6060366101803763eb85226d6101e05261010051610200526101205161022052610140516102405260606101e060646101fc60e0515afa61394d573d600060003e3d6000fd5b605f3d111561475a576101e080518060801d81607f1d1861475a576101805260208101518060801d81607f1d1861475a576101a05260408101518060011c61475a576101c052506101c0516139a35760006139f2565b60025460e051186139b55760016139f2565b63e4d332a96102a052610100516102c05260206102a060246102bc60e0515afa6139e4573d600060003e3d6000fd5b601f3d111561475a576102a0515b15613a4c576307211ef76102e05261018051610300526101a05161032052610160516103405260206102e060646102fc610100515afa613a37573d600060003e3d6000fd5b601f3d111561475a576102e051815250613a9d565b635e0d443f6101e05261018051610200526101a05161022052610160516102405260206101e060646101fc610100515afa613a8c573d600060003e3d6000fd5b601f3d111561475a576101e0518152505b565b6040366101803763eb85226d6101c052610100516101e0526101205161020052610140516102205260406101c060646101dc60e0515afa613ae5573d600060003e3d6000fd5b603f3d111561475a576101c080516101805260208101516101a0525063556d6e9f6101c052610180516101e0526101a05161020052610160516102205260206101c060646101dc610100515afa613b41573d600060003e3d6000fd5b601f3d111561475a576101c051815250565b60065461475a5760a0366101e03763eb85226d61028052610100516102a052610120516102c052610140516102e0526060610280606461029c60e0515afa613ba0573d600060003e3d6000fd5b605f3d111561475a5761028080518060801d81607f1d1861475a576102205260208101518060801d81607f1d1861475a576102405260408101518060011c61475a57610260525061026051613bf6576000613bfe565b60035460e051145b15613dca5763e4d332a961028052610100516102a0526020610280602461029c60e0515afa613c32573d600060003e3d6000fd5b601f3d111561475a5761028051613c4e57600061026052613dca565b60096101005160a052608052604060802080546102c05260018101546102e052506102c051613d275763c6610657610300526000610320526020610300602461031c610100515afa613ca5573d600060003e3d6000fd5b601f3d111561475a57610300518060a01c61475a576102c05263c6610657610340526001610360526020610340602461035c610100515afa613cec573d600060003e3d6000fd5b601f3d111561475a57610340518060a01c61475a576102e05260096101005160a05260805260406080206102c05181556102e0516001820155505b60006103405261034060c060006002818352015b60c0516020026102c001516101205118613d585760018352613d68565b8151600101808352811415613d3b575b5050506103405115613dc25760006103605261036060c060006002818352015b60c0516020026102c001516101405118613da55760018352613db5565b8151600101808352811415613d88575b5050506103605115613dc5565b60015b610260525b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee6101205118613df557610160516101e052613e97565b6323b872dd6102c45260046101a0516102e452306103045261016051610324526060016102c0526102c05060206103806102c0516102e06000610120515af1613e43573d600060003e3d6000fd5b61036060203d808211613e565781613e58565b805b905090508152805160200180610280828460045afa9050505060006102805114613e97576102a0516102805181816020036008021c905090501561475a575b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee610120511415613ebd576000613ee0565b60086101205160a05260805260406080206101005160a052608052604060802054155b15613fc35763095ea7b36102c4526004610100516102e4527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610304526040016102c0526102c05060206103606102c0516102e06000610120515af1613f4b573d600060003e3d6000fd5b61034060203d808211613f5e5781613f60565b805b905090508152805160200180610280828460045afa9050505060006102805114613f9f576102a0516102805181816020036008021c905090501561475a575b600160086101205160a05260805260406080206101005160a0526080526040608020555b6102605161402457633df0212461028052610220516102a052610240516102c052610160516102e0526101805161030052610100513b1561475a5760006000608461029c6101e051610100515af1614079573d600060003e3d6000fd614079565b63a6417ed661028052610220516102a052610240516102c052610160516102e0526101805161030052610100513b1561475a5760006000608461029c6101e051610100515af1614079573d600060003e3d6000fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61014051186140cb5747610200526000610280526102805060006000610280516102a0476101c0515af16141a6573d600060003e3d6000fd6141a6565b6370a0823161028052306102a0526020610280602461029c610140515afa6140f8573d600060003e3d6000fd5b601f3d111561475a57610280516102005263a9059cbb6102c45260046101c0516102e45261020051610304526040016102c0526102c05060206103606102c0516102e06000610140515af1614152573d600060003e3d6000fd5b61034060203d8082116141655781614167565b805b905090508152805160200180610280828460045afa90505050600061028051146141a6576102a0516102805181816020036008021c905090501561475a575b610100516101c0516101a0517fbd3eb7bcfdd1721a4eb4f00d0df3ed91bd6f17222f82b2d7bce519d8cab3fe466101205161028052610140516102a052610160516102c052610200516102e0526080610280a461020051815250565b60065461475a57610100516101c052610120516101e05273eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61010051186142515773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26101c0525b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61012051186142895773c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26101e0525b6080366102003763eb85226d6102805260e0516102a0526101c0516102c0526101e0516102e0526040610280606461029c6004545afa6142ce573d600060003e3d6000fd5b603f3d111561475a576102808051610240526020810151610260525073eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61010051186143155761014051610200526143b7565b6323b872dd6102c4526004610180516102e452306103045261014051610324526060016102c0526102c05060206103806102c0516102e06000610100515af1614363573d600060003e3d6000fd5b61036060203d8082116143765781614378565b805b905090508152805160200180610280828460045afa90505050600061028051146143b7576102a0516102805181816020036008021c905090501561475a575b60086101005160a052608052604060802060e05160a0526080526040608020546144b75763095ea7b36102c452600460e0516102e4527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610304526040016102c0526102c05060206103606102c0516102e06000610100515af1614440573d600060003e3d6000fd5b61034060203d8082116144535781614455565b805b905090508152805160200180610280828460045afa9050505060006102805114614494576102a0516102805181816020036008021c905090501561475a575b600160086101005160a052608052604060802060e05160a0526080526040608020555b610100516102a052610120516102c05260006102805261028060c060006002818352015b60c0516020026102a0015173eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee186145095760018352614519565b81516001018083528114156144db575b5050506102805161457957635b41b90861028052610240516102a052610260516102c052610140516102e052610160516103005260e0513b1561475a5760006000608461029c600060e0515af16145d2573d600060003e3d6000fd6145d2565b63394747c56102e052610240516103005261026051610320526101405161034052610160516103605260016103805260e0513b1561475a576000600060a46102fc6102005160e0515af16145d2573d600060003e3d6000fd5b73eeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee61012051186146245747610220526000610280526102805060006000610280516102a0476101a0515af16146ff573d600060003e3d6000fd6146ff565b6370a0823161028052306102a0526020610280602461029c610120515afa614651573d600060003e3d6000fd5b601f3d111561475a57610280516102205263a9059cbb6102c45260046101a0516102e45261022051610304526040016102c0526102c05060206103606102c0516102e06000610120515af16146ab573d600060003e3d6000fd5b61034060203d8082116146be57816146c0565b805b905090508152805160200180610280828460045afa90505050600061028051146146ff576102a0516102805181816020036008021c905090501561475a575b60e0516101a051610180517fbd3eb7bcfdd1721a4eb4f00d0df3ed91bd6f17222f82b2d7bce519d8cab3fe466101005161028052610120516102a052610140516102c052610220516102e0526080610280a461022051815250565b600080fd5b61010a6148690361010a60003961010a614869036000f35b600080fd0000000000000000000000000000000022d53366457f9d5e68ec105046fc43830000000000000000000000000000000000000000000000000000000000000000

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

0000000000000000000000000000000022d53366457f9d5e68ec105046fc43830000000000000000000000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _address_provider (address): 0x0000000022d53366457f9d5e68ec105046fc4383
Arg [1] : _calculator (address): 0x0000000000000000000000000000000000000000

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 0000000000000000000000000000000022d53366457f9d5e68ec105046fc4383
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000000


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.