Contract 0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c 5

 
Txn Hash Method
Block
From
To
Value [Txn Fee]
0x528734f1c765fc25b6e5de6b599e047378d7a98742329c5b278141b79b8367d6Add_liquidity579963362023-03-20 17:26:3217 hrs 27 mins ago0x3335334f2b19664e645bebe033857dc4f07561dd IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.011629513525
0x7888cfbcb5ee997594305501bc03244c029c30a7ab5069bd456c4d97e46571e1Add_liquidity579911872023-03-20 15:42:4619 hrs 11 mins ago0x7b9f9977587ce12a1a7bc2319302ca31b194fe14 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.013904310419
0x5e12ec5e10cee897db4354bcb6915fa9f8834f07d39b2b6e139ae54aeff1b13eRemove_liquidity...579874222023-03-20 14:29:4320 hrs 24 mins ago0x07e2febec9e8bfc203ad1608c70b44841b4397f3 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.017825347441
0x0fe435b98c9e256718dba3a692e4364351a1667277a053b531ef4dafb7245c00Remove_liquidity...579867952023-03-20 14:18:3220 hrs 35 mins ago0xacbfd0b900f0d3928784e010bee424cf11d0418f IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.01724791325
0x46f16c137b5df881c9ce90d439f78f1fe8c0807527b11a7b2953ad22b18ea14fAdd_liquidity579786382023-03-20 11:28:4723 hrs 25 mins ago0x2600dbecad4e4e7328f01efcb5fdced07d904bfa IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.009758181514
0x190b7addc35aad1e5bc4f4fc298de7c67b2c0dd7f4e061679ef94282253d0426Remove_liquidity...579363702023-03-19 19:57:001 day 14 hrs ago0x74e2515cc035b7fd8f78f9642f3bd8854f572405 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.017840737389
0x2b6562cf3c1b6925adb964987ef8569eff0019ee3796b05aaa95179b3468b70fAdd_liquidity579355612023-03-19 19:42:091 day 15 hrs ago0xabd7bae4a5116dd834c3c76d24023f28c41ce42f IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.023976342298
0x424d35ef20a0634df39fba5c79f395b5328462be89cab3a8c68e5784049519e5Add_liquidity579185682023-03-19 13:54:281 day 20 hrs ago0x3335334f2b19664e645bebe033857dc4f07561dd IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.011473833678
0xc60b00ae551b6dbc1dab657af6915c591b6100d5abf88d06aa27689e363d6a63Add_liquidity579185422023-03-19 13:53:541 day 21 hrs ago0x3335334f2b19664e645bebe033857dc4f07561dd IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.011473833678
0x9f68c20d0f4a31250a5c1db668fb39939b419a306a5878ed282081bc14668628Remove_liquidity...579105442023-03-19 11:23:031 day 23 hrs ago0x66a534935e25c59b9a181efcd6889a1f834cb8c8 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.016627760109
0x3eaaeddda6029fcd0611c9420571a61d8e5a3608d88aec0eaf1a2a7364b3c2deRemove_liquidity...578859312023-03-19 1:25:032 days 9 hrs ago0xc4f55c93adf2295740202e77d29c6d058ddc2a72 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.025759147216
0x0d10fc2eb91bdc33d5ec10fdd5503be6c0860307bd82489221eeaae31b4cfe11Add_liquidity578858742023-03-19 1:22:532 days 9 hrs ago0xc4f55c93adf2295740202e77d29c6d058ddc2a72 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.016032314605
0x7514d1f4819edf472af4e11eec11edbe05dfd75a77dcf79704437cf73c7c39ddAdd_liquidity578777062023-03-18 22:10:282 days 12 hrs ago0x26ee9901fe70c60d87bcc1c3e893364c85297711 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.019013001153
0x70ae7582a064b1e6b9ca01c3a62e63c7c17f5c934bdb70a03fbc0ad242c03043Add_liquidity578698422023-03-18 19:25:592 days 15 hrs ago0x34225c420ba0152da42eaf58c6d30621a65c9969 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.053832569774
0x65bc1902460d44c56c0c71abe78bd9ab11e321dc059d9aa51bb1cf5dd4547665Add_liquidity578682012023-03-18 18:51:452 days 16 hrs ago0x8d19e840f25d1dec5db67edcb5ddaabdbbb7f2d2 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.045048716097
0x5c9ad4a004ebb5d2118ca15ad775fb3a6124d5e9f98b39c2982668f83979daccAdd_liquidity578667422023-03-18 18:19:392 days 16 hrs ago0xabd7bae4a5116dd834c3c76d24023f28c41ce42f IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.084853731841
0x923d3d92de5c91536e4dbe6114858ddc49146192f123e4087c356b2b653794e9Remove_liquidity...578528242023-03-18 13:55:282 days 20 hrs ago0xb0aee40fab84fa5a9cca2a0963266d5f3cb855c8 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.040144493126
0x728aedd2730e2fef0e4ab72bc777de591c786aa95380b2b0c74f97ec8575adeeAdd_liquidity578280022023-03-18 6:13:183 days 4 hrs ago0xdd722d79ba5e1e8e360c0c41dd9f20463a411589 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.021044191897
0xab11ec872917661083e9ec666c4f96ce3455dcc040f8df868fd175d571999421Remove_liquidity...577548732023-03-17 6:35:154 days 4 hrs ago0x4da8d626f0d3c014b9bf5c4009b31857e989e17b IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.074741370349
0xc7b0de5ba316194199696d1c86003960b5410349d747a36000e1d678e09085ddAdd_liquidity577256752023-03-16 19:56:374 days 14 hrs ago0xc6f2c0221e6bf5f08bf5c0a348424e107600a3a4 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.017907054815
0xb9a4153630ca6649872cc60d49c458966f92cb32cc0bef31a4c90fb9b8ed448eAdd_liquidity576968112023-03-16 10:29:005 days 24 mins ago0xb1cafeff95700a25e37b479f5c52e4c4eb1bb536 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.013484607218
0xbbace371aa2d254bd0c392e67bf2bba6d82db8658f391488879176bf97a99a8bAdd_liquidity576964002023-03-16 10:22:205 days 31 mins ago0xb1cafeff95700a25e37b479f5c52e4c4eb1bb536 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.013848503855
0x0c166c435d1201cb67083eda12fcddf9ba003189ad621fbd6fe7649ceb207a2fAdd_liquidity576953292023-03-16 10:03:395 days 50 mins ago0xb1cafeff95700a25e37b479f5c52e4c4eb1bb536 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.013453393991
0x7b15f70f241b36bb192aa2b26303747b92d04faf02e44b1a85bdfcb7a412fae8Remove_liquidity...576731812023-03-16 3:03:375 days 7 hrs ago0x59aea385a0c8af2e1174818a0c2d7d53651d8550 IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.027579247935
0x6cc9e3d63a3d7b5f71050730eab7a7d76e5201b70dc8357d8048132cfa77d686Add_liquidity576499342023-03-15 19:09:215 days 15 hrs ago0xabd7bae4a5116dd834c3c76d24023f28c41ce42f IN  0x78d51eb71a62c081550efcc0a9f9ea94b2ef081c0 FTM0.128763845323
[ Download CSV Export 
Latest 1 internal transaction
Parent Txn Hash Block From To Value
0x0bf993d527df0d37e496c9c12c9e09e1d92214ed312d12df6d8181cce4481a6d169891362021-09-13 7:59:32554 days 2 hrs ago 0x745748bcfd8f9c2de519a71d789be8a63dd7d66c  Contract Creation0 FTM
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.16

Optimization Enabled:
N/A

Other Settings:
None license

Contract Source Code (Vyper language format)

# @version 0.2.16
"""
@title "Zap" Depositer for USD permissionless factory metapools
@author Curve.Fi
@license Copyright (c) Curve.Fi, 2021 - all rights reserved
"""

interface ERC20:
    def approve(_spender: address, _amount: uint256): nonpayable
    def balanceOf(_owner: address) -> uint256: view

interface CurveMeta:
    def add_liquidity(amounts: uint256[N_COINS], min_mint_amount: uint256, _receiver: address) -> uint256: nonpayable
    def remove_liquidity(_amount: uint256, min_amounts: uint256[N_COINS]): nonpayable
    def remove_liquidity_one_coin(_token_amount: uint256, i: int128, min_amount: uint256, _receiver: address) -> uint256: nonpayable
    def remove_liquidity_imbalance(amounts: uint256[N_COINS], max_burn_amount: uint256) -> uint256: nonpayable
    def calc_withdraw_one_coin(_token_amount: uint256, i: int128) -> uint256: view
    def calc_token_amount(amounts: uint256[N_COINS], deposit: bool) -> uint256: view
    def coins(i: uint256) -> address: view

interface CurveBase:
    def add_liquidity(amounts: uint256[BASE_N_COINS], min_mint_amount: uint256): nonpayable
    def remove_liquidity(_amount: uint256, min_amounts: uint256[BASE_N_COINS]): nonpayable
    def remove_liquidity_one_coin(_token_amount: uint256, i: int128, min_amount: uint256): nonpayable
    def remove_liquidity_imbalance(amounts: uint256[BASE_N_COINS], max_burn_amount: uint256): nonpayable
    def calc_withdraw_one_coin(_token_amount: uint256, i: int128) -> uint256: view
    def calc_token_amount(amounts: uint256[BASE_N_COINS], deposit: bool) -> uint256: view
    def coins(i: uint256) -> address: view
    def fee() -> uint256: view


BASE_N_COINS: constant(int128) = 2
BASE_POOL: constant(address) = 0x27E611FD27b276ACbd5Ffd632E5eAEBEC9761E40
BASE_LP_TOKEN: constant(address) = 0x27E611FD27b276ACbd5Ffd632E5eAEBEC9761E40
BASE_COINS: constant(address[BASE_N_COINS]) = [0x8D11eC38a3EB5E956B052f67Da8Bdc9bef8Abf3E, 0x04068DA6C83AFCFA0e13ba15A6696662335D5B75]

N_COINS: constant(int128) = 2
MAX_COIN: constant(int128) = N_COINS-1
N_ALL_COINS: constant(int128) = N_COINS + BASE_N_COINS - 1

FEE_DENOMINATOR: constant(uint256) = 10 ** 10
FEE_IMPRECISION: constant(uint256) = 100 * 10 ** 8  # % of the fee


# coin -> pool -> is approved to transfer?
is_approved: HashMap[address, HashMap[address, bool]]


@external
def __init__():
    """
    @notice Contract constructor
    """
    for coin in BASE_COINS:
        ERC20(coin).approve(BASE_POOL, MAX_UINT256)


@external
def add_liquidity(
    _pool: address,
    _deposit_amounts: uint256[N_ALL_COINS],
    _min_mint_amount: uint256,
    _receiver: address = msg.sender,
) -> uint256:
    """
    @notice Wrap underlying coins and deposit them into `_pool`
    @param _pool Address of the pool to deposit into
    @param _deposit_amounts List of amounts of underlying coins to deposit
    @param _min_mint_amount Minimum amount of LP tokens to mint from the deposit
    @param _receiver Address that receives the LP tokens
    @return Amount of LP tokens received by depositing
    """
    meta_amounts: uint256[N_COINS] = empty(uint256[N_COINS])
    base_amounts: uint256[BASE_N_COINS] = empty(uint256[BASE_N_COINS])
    deposit_base: bool = False
    base_coins: address[BASE_N_COINS] = BASE_COINS

    if _deposit_amounts[0] != 0:
        coin: address = CurveMeta(_pool).coins(0)
        if not self.is_approved[coin][_pool]:
            ERC20(coin).approve(_pool, MAX_UINT256)
            self.is_approved[coin][_pool] = True
        response: Bytes[32] = raw_call(
            coin,
            _abi_encode(
                msg.sender,
                self,
                _deposit_amounts[0],
                method_id=method_id("transferFrom(address,address,uint256)"),
            ),
            max_outsize=32
        )
        if len(response) != 0:
            assert convert(response, bool)
        # hand fee on transfer
        meta_amounts[0] = ERC20(coin).balanceOf(self)

    for i in range(1, N_ALL_COINS):
        amount: uint256 = _deposit_amounts[i]
        if amount == 0:
            continue
        deposit_base = True
        base_idx: uint256 = i - 1
        coin: address = base_coins[base_idx]

        response: Bytes[32] = raw_call(
            coin,
            _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)

        # Handle potential transfer fees (i.e. Tether/renBTC)
        base_amounts[base_idx] = ERC20(coin).balanceOf(self)

    # Deposit to the base pool
    if deposit_base:
        coin: address = BASE_LP_TOKEN
        CurveBase(BASE_POOL).add_liquidity(base_amounts, 0)
        meta_amounts[MAX_COIN] = ERC20(coin).balanceOf(self)
        if not self.is_approved[coin][_pool]:
            ERC20(coin).approve(_pool, MAX_UINT256)
            self.is_approved[coin][_pool] = True

    # Deposit to the meta pool
    return CurveMeta(_pool).add_liquidity(meta_amounts, _min_mint_amount, _receiver)


@external
def remove_liquidity(
    _pool: address,
    _burn_amount: uint256,
    _min_amounts: uint256[N_ALL_COINS],
    _receiver: address = msg.sender
) -> uint256[N_ALL_COINS]:
    """
    @notice Withdraw and unwrap coins from the pool
    @dev Withdrawal amounts are based on current deposit ratios
    @param _pool Address of the pool to deposit into
    @param _burn_amount Quantity of LP tokens to burn in the withdrawal
    @param _min_amounts Minimum amounts of underlying coins to receive
    @param _receiver Address that receives the LP tokens
    @return List of amounts of underlying coins that were withdrawn
    """
    response: Bytes[32] = raw_call(
        _pool,
        _abi_encode(
            msg.sender,
            self,
            _burn_amount,
            method_id=method_id("transferFrom(address,address,uint256)"),
        ),
        max_outsize=32
    )
    if len(response) != 0:
        assert convert(response, bool)

    min_amounts_base: uint256[BASE_N_COINS] = empty(uint256[BASE_N_COINS])
    amounts: uint256[N_ALL_COINS] = empty(uint256[N_ALL_COINS])

    # Withdraw from meta
    meta_received: uint256[N_COINS] = empty(uint256[N_COINS])
    CurveMeta(_pool).remove_liquidity(_burn_amount, [_min_amounts[0], convert(0, uint256)])

    coins: address[N_COINS] = empty(address[N_COINS])
    for i in range(N_COINS):
        coin: address = CurveMeta(_pool).coins(i)
        coins[i] = coin
        # Handle fee on transfer for the first coin
        meta_received[i] = ERC20(coin).balanceOf(self)

    # Withdraw from base
    for i in range(BASE_N_COINS):
        min_amounts_base[i] = _min_amounts[MAX_COIN+i]
    CurveBase(BASE_POOL).remove_liquidity(meta_received[MAX_COIN], min_amounts_base)

    # Transfer all coins out
    response = raw_call(
        coins[0],  # metapool coin 0
        _abi_encode(
            _receiver,
            meta_received[0],
            method_id=method_id("transfer(address,uint256)"),
        ),
        max_outsize=32
    )
    if len(response) != 0:
        assert convert(response, bool)

    amounts[0] = meta_received[0]

    base_coins: address[BASE_N_COINS] = BASE_COINS
    for i in range(1, N_ALL_COINS):
        coin: address = base_coins[i-1]
        # handle potential fee on transfer
        amounts[i] = ERC20(coin).balanceOf(self)
        response = raw_call(
            coin,
            _abi_encode(
                _receiver,
                amounts[i],
                method_id=method_id("transfer(address,uint256)"),
            ),
            max_outsize=32
        )
        if len(response) != 0:
            assert convert(response, bool)


    return amounts


@external
def remove_liquidity_one_coin(
    _pool: address,
    _burn_amount: uint256,
    i: int128,
    _min_amount: uint256,
    _receiver: address=msg.sender
) -> uint256:
    """
    @notice Withdraw and unwrap a single coin from the pool
    @param _pool Address of the pool to deposit into
    @param _burn_amount Amount of LP tokens to burn in the withdrawal
    @param i Index value of the coin to withdraw
    @param _min_amount Minimum amount of underlying coin to receive
    @param _receiver Address that receives the LP tokens
    @return Amount of underlying coin received
    """
    response: Bytes[32] = raw_call(
        _pool,
        _abi_encode(
            msg.sender,
            self,
            _burn_amount,
            method_id=method_id("transferFrom(address,address,uint256)"),
        ),
        max_outsize=32
    )
    if len(response) != 0:
        assert convert(response, bool)


    coin_amount: uint256 = 0
    if i == 0:
        coin_amount = CurveMeta(_pool).remove_liquidity_one_coin(_burn_amount, i, _min_amount, _receiver)
    else:
        base_coins: address[BASE_N_COINS] = BASE_COINS
        coin: address = base_coins[i - MAX_COIN]
        # Withdraw a base pool coin
        coin_amount = CurveMeta(_pool).remove_liquidity_one_coin(_burn_amount, MAX_COIN, 0, self)
        CurveBase(BASE_POOL).remove_liquidity_one_coin(coin_amount, i-MAX_COIN, _min_amount)
        coin_amount = ERC20(coin).balanceOf(self)
        response = raw_call(
            coin,
            _abi_encode(
                _receiver,
                coin_amount,
                method_id=method_id("transfer(address,uint256)"),
            ),
            max_outsize=32
        )
        if len(response) != 0:
            assert convert(response, bool)


    return coin_amount


@external
def remove_liquidity_imbalance(
    _pool: address,
    _amounts: uint256[N_ALL_COINS],
    _max_burn_amount: uint256,
    _receiver: address=msg.sender
) -> uint256:
    """
    @notice Withdraw coins from the pool in an imbalanced amount
    @param _pool Address of the pool to deposit into
    @param _amounts List of amounts of underlying coins to withdraw
    @param _max_burn_amount Maximum amount of LP token to burn in the withdrawal
    @param _receiver Address that receives the LP tokens
    @return Actual amount of the LP token burned in the withdrawal
    """
    fee: uint256 = CurveBase(BASE_POOL).fee() * BASE_N_COINS / (4 * (BASE_N_COINS - 1))
    fee += fee * FEE_IMPRECISION / FEE_DENOMINATOR  # Overcharge to account for imprecision

    # Transfer the LP token in
    response: Bytes[32] = raw_call(
        _pool,
        _abi_encode(
            msg.sender,
            self,
            _max_burn_amount,
            method_id=method_id("transferFrom(address,address,uint256)"),
        ),
        max_outsize=32
    )
    if len(response) != 0:
        assert convert(response, bool)

    withdraw_base: bool = False
    amounts_base: uint256[BASE_N_COINS] = empty(uint256[BASE_N_COINS])
    amounts_meta: uint256[N_COINS] = empty(uint256[N_COINS])

    # determine amounts to withdraw from base pool
    for i in range(BASE_N_COINS):
        amount: uint256 = _amounts[MAX_COIN + i]
        if amount != 0:
            amounts_base[i] = amount
            withdraw_base = True

    # determine amounts to withdraw from metapool
    amounts_meta[0] = _amounts[0]
    if withdraw_base:
        amounts_meta[MAX_COIN] = CurveBase(BASE_POOL).calc_token_amount(amounts_base, False)
        amounts_meta[MAX_COIN] += amounts_meta[MAX_COIN] * fee / FEE_DENOMINATOR + 1

    # withdraw from metapool and return the remaining LP tokens
    burn_amount: uint256 = CurveMeta(_pool).remove_liquidity_imbalance(amounts_meta, _max_burn_amount)
    response = raw_call(
        _pool,
        _abi_encode(
            msg.sender,
            _max_burn_amount - burn_amount,
            method_id=method_id("transfer(address,uint256)"),
        ),
        max_outsize=32
    )
    if len(response) != 0:
        assert convert(response, bool)


    # withdraw from base pool
    if withdraw_base:
        CurveBase(BASE_POOL).remove_liquidity_imbalance(amounts_base, amounts_meta[MAX_COIN])
        coin: address = BASE_LP_TOKEN
        leftover: uint256 = ERC20(coin).balanceOf(self)

        if leftover > 0:
            # if some base pool LP tokens remain, re-deposit them for the caller
            if not self.is_approved[coin][_pool]:
                ERC20(coin).approve(_pool, MAX_UINT256)
                self.is_approved[coin][_pool] = True
            burn_amount -= CurveMeta(_pool).add_liquidity([convert(0, uint256), leftover], 0, msg.sender)

        # transfer withdrawn base pool tokens to caller
        base_coins: address[BASE_N_COINS] = BASE_COINS
        for i in range(BASE_N_COINS):
            response = raw_call(
                base_coins[i],
                _abi_encode(
                    _receiver,
                    ERC20(base_coins[i]).balanceOf(self),  # handle potential transfer fees
                    method_id=method_id("transfer(address,uint256)"),
                ),
                max_outsize=32
            )
            if len(response) != 0:
                assert convert(response, bool)


    # transfer withdrawn metapool tokens to caller
    if _amounts[0] > 0:
        coin: address = CurveMeta(_pool).coins(0)
        response = raw_call(
            coin,
            _abi_encode(
                _receiver,
                ERC20(coin).balanceOf(self),  # handle potential fees
                method_id=method_id("transfer(address,uint256)"),
            ),
            max_outsize=32
        )
        if len(response) != 0:
            assert convert(response, bool)


    return burn_amount


@view
@external
def calc_withdraw_one_coin(_pool: address, _token_amount: uint256, i: int128) -> uint256:
    """
    @notice Calculate the amount received when withdrawing and unwrapping a single coin
    @param _pool Address of the pool to deposit into
    @param _token_amount Amount of LP tokens to burn in the withdrawal
    @param i Index value of the underlying coin to withdraw
    @return Amount of coin received
    """
    if i < MAX_COIN:
        return CurveMeta(_pool).calc_withdraw_one_coin(_token_amount, i)
    else:
        _base_tokens: uint256 = CurveMeta(_pool).calc_withdraw_one_coin(_token_amount, MAX_COIN)
        return CurveBase(BASE_POOL).calc_withdraw_one_coin(_base_tokens, i-MAX_COIN)


@view
@external
def calc_token_amount(_pool: address, _amounts: uint256[N_ALL_COINS], _is_deposit: bool) -> uint256:
    """
    @notice Calculate addition or reduction in token supply from a deposit or withdrawal
    @dev This calculation accounts for slippage, but not fees.
         Needed to prevent front-running, not for precise calculations!
    @param _pool Address of the pool to deposit into
    @param _amounts Amount of each underlying coin being deposited
    @param _is_deposit set True for deposits, False for withdrawals
    @return Expected amount of LP tokens received
    """
    meta_amounts: uint256[N_COINS] = empty(uint256[N_COINS])
    base_amounts: uint256[BASE_N_COINS] = empty(uint256[BASE_N_COINS])

    meta_amounts[0] = _amounts[0]
    for i in range(BASE_N_COINS):
        base_amounts[i] = _amounts[i + MAX_COIN]

    base_tokens: uint256 = CurveBase(BASE_POOL).calc_token_amount(base_amounts, _is_deposit)
    meta_amounts[MAX_COIN] = base_tokens

    return CurveMeta(_pool).calc_token_amount(meta_amounts, _is_deposit)

Contract Security Audit

Contract ABI

[{"stateMutability":"nonpayable","type":"constructor","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"_pool","type":"address"},{"name":"_deposit_amounts","type":"uint256[3]"},{"name":"_min_mint_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"add_liquidity","inputs":[{"name":"_pool","type":"address"},{"name":"_deposit_amounts","type":"uint256[3]"},{"name":"_min_mint_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_pool","type":"address"},{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[3]"}],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity","inputs":[{"name":"_pool","type":"address"},{"name":"_burn_amount","type":"uint256"},{"name":"_min_amounts","type":"uint256[3]"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256[3]"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_pool","type":"address"},{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_min_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_one_coin","inputs":[{"name":"_pool","type":"address"},{"name":"_burn_amount","type":"uint256"},{"name":"i","type":"int128"},{"name":"_min_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"_pool","type":"address"},{"name":"_amounts","type":"uint256[3]"},{"name":"_max_burn_amount","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"remove_liquidity_imbalance","inputs":[{"name":"_pool","type":"address"},{"name":"_amounts","type":"uint256[3]"},{"name":"_max_burn_amount","type":"uint256"},{"name":"_receiver","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"calc_withdraw_one_coin","inputs":[{"name":"_pool","type":"address"},{"name":"_token_amount","type":"uint256"},{"name":"i","type":"int128"}],"outputs":[{"name":"","type":"uint256"}],"gas":5753},{"stateMutability":"view","type":"function","name":"calc_token_amount","inputs":[{"name":"_pool","type":"address"},{"name":"_amounts","type":"uint256[3]"},{"name":"_is_deposit","type":"bool"}],"outputs":[{"name":"","type":"uint256"}],"gas":6289}]

738d11ec38a3eb5e956b052f67da8bdc9bef8abf3e610180527304068da6c83afcfa0e13ba15a6696662335d5b756101a05261016060006002818352015b60206101605102610180015161014052610140513b15611baf5760006000604463095ea7b36101c0527327e611fd27b276acbd5ffd632e5eaebec9761e406101e0527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610200526101dc6000610140515af115611baf575b815160010180835281141561003d575b5050611b9756600436101561000d57611ac0565b600035601c5260005134611ac65763a318517981141561003157336101405261005c565b63e07a10368114156100575760a43560a01c611ac657602060a46101403760005061005c565b6105f3565b60043560a01c611ac65760a03661016037738d11ec38a3eb5e956b052f67da8bdc9bef8abf3e610200527304068da6c83afcfa0e13ba15a6696662335d5b75610220526000602435181561029b5760206102e0602463c66106576102605260006102805261027c6004355afa15611ac657601f3d1115611ac6576000506102e0516102405260006102405160e05260c052604060c02060043560e05260c052604060c0205461017d57610240513b15611ac65760006000604463095ea7b361026052600435610280527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6102a05261027c6000610240515af115611ac657600160006102405160e05260c052604060c02060043560e05260c052604060c020555b6323b872dd6102c45260046102e4808080338152505060208101905080803081525050602081019050808060243581525050606090509050016102c0526102c08051602001806103608284600060045af115611ac65750506020610420610360516103806000610240515af115611ac65760203d808211156101ff5780610201565b815b90509050610400526104008051602001806102608284600060045af115611ac65750506000610260511815610263576102608060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b602061034060246370a082316102c052306102e0526102dc610240515afa15611ac657601f3d1115611ac65760005061034051610160525b61024060016002818352015b6024610240516003811015611ac657602002013561026052610260516102cc57610433565b60016101e052610240516001808210611ac6578082039050905061028052610200610280516002811015611ac65760200201516102a0526323b872dd6103245260046103448080803381525050602081019050808030815250506020810190508080610260518152505060609050905001610320526103208051602001806103c08284600060045af115611ac657505060206104806103c0516103e060006102a0515af115611ac65760203d808211156103865780610388565b815b90509050610460526104608051602001806102c08284600060045af115611ac657505060006102c05118156103ea576102c08060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b60206103a060246370a0823161032052306103405261033c6102a0515afa15611ac657601f3d1115611ac6576000506103a0516101a0610280516002811015611ac65760200201525b81516001018083528114156102a7575b50506101e0511561059c577327e611fd27b276acbd5ffd632e5eaebec9761e40610240527327e611fd27b276acbd5ffd632e5eaebec9761e403b15611ac657600060006064630b4c7e4d610260526101a051610280526101c0516102a05260006102c05261027c60007327e611fd27b276acbd5ffd632e5eaebec9761e405af115611ac65760206102e060246370a0823161026052306102805261027c610240515afa15611ac657601f3d1115611ac6576000506102e0516101805260006102405160e05260c052604060c02060043560e05260c052604060c0205461059b57610240513b15611ac65760006000604463095ea7b361026052600435610280527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6102a05261027c6000610240515af115611ac657600160006102405160e05260c052604060c02060043560e05260c052604060c020555b5b60206103206084630c3e4b5461024052610160516102605261018051610280526084356102a052610140516102c05261025c60006004355af115611ac657601f3d1115611ac6576000506103205160005260206000f35b638fa892a6811415610609573361014052610634565b6311d4b6aa81141561062f5760a43560a01c611ac657602060a461014037600050610634565b610b86565b60043560a01c611ac6576323b872dd6101c45260046101e4808080338152505060208101905080803081525050602081019050808060243581525050606090509050016101c0526101c08051602001806102608284600060045af115611ac657505060206103206102605161028060006004355af115611ac65760203d808211156106bf57806106c1565b815b90509050610300526103008051602001806101608284600060045af115611ac65750506000610160511815610723576101608060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b60e0366101c0376004353b15611ac657600060006064635b36389c6102c0526024356102e05260006102a052604435610300526102a051610320526102dc60006004355af115611ac6576040366102a0376102e060006002818352015b60206103a0602463c6610657610320526102e0516103405261033c6004355afa15611ac657601f3d1115611ac6576000506103a05161030052610300516102a06102e0516002811015611ac657602002015260206103a060246370a0823161032052306103405261033c610300515afa15611ac657601f3d1115611ac6576000506103a0516102606102e0516002811015611ac65760200201525b8151600101808352811415610780575b50506102e060006002818352015b604460016102e0518181830110611ac657808201905090506003811015611ac65760200201356101c06102e0516002811015611ac65760200201525b8151600101808352811415610839575b50507327e611fd27b276acbd5ffd632e5eaebec9761e403b15611ac657600060006064635b36389c6102e05261028051610300526101c051610320526101e051610340526102fc60007327e611fd27b276acbd5ffd632e5eaebec9761e405af115611ac65763a9059cbb6102e4526004610304808080610140518152505060208101905080806102605181525050604090509050016102e0526102e08051602001806103608284600060045af115611ac657505060206104006103605161038060006102a0515af115611ac65760203d808211156109635780610965565b815b905090506103e0526103e08051602001806101608284600060045af115611ac657505060006101605118156109c7576101608060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b6102605161020052738d11ec38a3eb5e956b052f67da8bdc9bef8abf3e6102e0527304068da6c83afcfa0e13ba15a6696662335d5b756103005261032060016002818352015b6102e0610320516001808210611ac657808203905090506002811015611ac65760200201516103405260206103e060246370a0823161036052306103805261037c610340515afa15611ac657601f3d1115611ac6576000506103e051610200610320516003811015611ac657602002015263a9059cbb61036452600461038480808061014051815250506020810190508080610200610320516003811015611ac65760200201518152505060409050905001610360526103608051602001806103e08284600060045af115611ac657505060206104806103e0516104006000610340515af115611ac65760203d80821115610b085780610b0a565b815b90509050610460526104608051602001806101608284600060045af115611ac65750506000610160511815610b6c576101608060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b5b8151600101808352811415610a0d575b50506060610200f35b6329ed2862811415610b9c573361014052610bc7565b631e700cbb811415610bc25760843560a01c611ac6576020608461014037600050610bc7565b610f6c565b60043560a01c611ac65760443580607f1d8160801d1415611ac657809050506323b872dd6101c45260046101e4808080338152505060208101905080803081525050602081019050808060243581525050606090509050016101c0526101c08051602001806102608284600060045af115611ac657505060206103206102605161028060006004355af115611ac65760203d80821115610c675780610c69565b815b90509050610300526103008051602001806101608284600060045af115611ac65750506000610160511815610ccb576101608060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b60006101c052604435610d205760206102c0608463081579a56101e052606060246102003761014051610260526101fc60006004355af115611ac657601f3d1115611ac6576000506102c0516101c052610f5f565b738d11ec38a3eb5e956b052f67da8bdc9bef8abf3e6101e0527304068da6c83afcfa0e13ba15a6696662335d5b75610200526101e0604435600180820380607f1d8160801d1415611ac657809050905090506002811015611ac6576020020151610220526020610320608463081579a5610240526024356102605260016102805260006102a052306102c05261025c60006004355af115611ac657601f3d1115611ac657600050610320516101c0527327e611fd27b276acbd5ffd632e5eaebec9761e403b15611ac657600060006064631a4d01d2610240526101c05161026052604435600180820380607f1d8160801d1415611ac65780905090509050610280526064356102a05261025c60007327e611fd27b276acbd5ffd632e5eaebec9761e405af115611ac65760206102c060246370a0823161024052306102605261025c610220515afa15611ac657601f3d1115611ac6576000506102c0516101c05263a9059cbb610244526004610264808080610140518152505060208101905080806101c0518152505060409050905001610240526102408051602001806102c08284600060045af115611ac657505060206103606102c0516102e06000610220515af115611ac65760203d80821115610efa5780610efc565b815b90509050610340526103408051602001806101608284600060045af115611ac65750506000610160511815610f5e576101608060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b5b6101c05160005260206000f35b6343d532a7811415610f82573361014052610fad565b636755b454811415610fa85760a43560a01c611ac657602060a461014037600050610fad565b61185e565b60043560a01c611ac65760206101e0600463ddca3f436101805261019c7327e611fd27b276acbd5ffd632e5eaebec9761e405afa15611ac657601f3d1115611ac6576000506101e0516002808202821582848304141715611ac65780905090509050600480820490509050610160526101608051610160516402540be400808202821582848304141715611ac657809050905090506402540be400808204905090508181830110611ac657808201905090508152506323b872dd6101e4526004610204808080338152505060208101905080803081525050602081019050808060843581525050606090509050016101e0526101e08051602001806102808284600060045af115611ac65750506020610340610280516102a060006004355af115611ac65760203d808211156110e357806110e5565b815b90509050610320526103208051602001806101808284600060045af115611ac65750506000610180511815611147576101808060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b60a0366101e03761028060006002818352015b60246001610280518181830110611ac657808201905090506003811015611ac65760200201356102a05260006102a05118156111b0576102a051610200610280516002811015611ac657602002015260016101e0525b5b815160010180835281141561115a575b5050602435610240526101e05115611283576020610340606463ed8e84f361028052610200516102a052610220516102c05260006102e05261029c7327e611fd27b276acbd5ffd632e5eaebec9761e405afa15611ac657601f3d1115611ac657600050610340516102605261026080516102605161016051808202821582848304141715611ac657809050905090506402540be4008082049050905060018181830110611ac657808201905090508181830110611ac657808201905090508152505b6020610360606463e31032736102a052610240516102c052610260516102e052608435610300526102bc60006004355af115611ac657601f3d1115611ac657600050610360516102805263a9059cbb6102a45260046102c48080803381525050602081019050808060843561028051808210611ac6578082039050905081525050604090509050016102a0526102a08051602001806103208284600060045af115611ac657505060206103c06103205161034060006004355af115611ac65760203d808211156113535780611355565b815b905090506103a0526103a08051602001806101808284600060045af115611ac657505060006101805118156113b7576101808060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b6101e05115611702577327e611fd27b276acbd5ffd632e5eaebec9761e403b15611ac65760006000606463e31032736102a052610200516102c052610220516102e05261026051610300526102bc60007327e611fd27b276acbd5ffd632e5eaebec9761e405af115611ac6577327e611fd27b276acbd5ffd632e5eaebec9761e406102a052602061036060246370a082316102e05230610300526102fc6102a0515afa15611ac657601f3d1115611ac657600050610360516102c05260006102c05111156115825760006102a05160e05260c052604060c02060043560e05260c052604060c0205461151b576102a0513b15611ac65760006000604463095ea7b36102e052600435610300527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610320526102fc60006102a0515af115611ac657600160006102a05160e05260c052604060c02060043560e05260c052604060c020555b610280805160206103e06084630c3e4b546103005260006102e0526102e051610320526102c05161034052600061036052336103805261031c60006004355af115611ac657601f3d1115611ac6576000506103e051808210611ac657808203905090508152505b738d11ec38a3eb5e956b052f67da8bdc9bef8abf3e6102e0527304068da6c83afcfa0e13ba15a6696662335d5b756103005261032060006002818352015b63a9059cbb6103e45260046104048080806101405181525050602081019050808060206103c060246370a0823161034052306103605261035c6102e0610320516002811015611ac65760200201515afa15611ac657601f3d1115611ac6576000506103c05181525050604090509050016103e0526103e08051602001806104608284600060045af115611ac657505060206105006104605161048060006102e0610320516002811015611ac65760200201515af115611ac65760203d8082111561168a578061168c565b815b905090506104e0526104e08051602001806101808284600060045af115611ac657505060006101805118156116ee576101808060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b5b81516001018083528114156115c0575b50505b60006024351115611851576020610340602463c66106576102c05260006102e0526102dc6004355afa15611ac657601f3d1115611ac657600050610340516102a05263a9059cbb61036452600461038480808061014051815250506020810190508080602061034060246370a082316102c052306102e0526102dc6102a0515afa15611ac657601f3d1115611ac657600050610340518152505060409050905001610360526103608051602001806103e08284600060045af115611ac657505060206104806103e05161040060006102a0515af115611ac65760203d808211156117ec57806117ee565b815b90509050610460526104608051602001806101808284600060045af115611ac65750506000610180511815611850576101808060200151600082518060209013611ac65780919012611ac657806020036101000a820490509050905015611ac6575b5b6102805160005260206000f35b6341b028f38114156119875760043560a01c611ac65760443580607f1d8160801d1415611ac65780905050600160443512156118d65760206101e0604463cc2b27d761014052604060246101603761015c6004355afa15611ac657601f3d1115611ac6576000506101e05160005260206000f3611985565b6020610200604463cc2b27d7610160526024356101805260016101a05261017c6004355afa15611ac657601f3d1115611ac65760005061020051610140526020610200604463cc2b27d7610160526101405161018052604435600180820380607f1d8160801d1415611ac657809050905090506101a05261017c7327e611fd27b276acbd5ffd632e5eaebec9761e405afa15611ac657601f3d1115611ac6576000506102005160005260206000f35b005b6343bff3cc811415611abe5760043560a01c611ac65760843560011c611ac65760803661014037602435610140526101c060006002818352015b60246101c05160018181830110611ac657808201905090506003811015611ac65760200201356101806101c0516002811015611ac65760200201525b81516001018083528114156119c1575b505060206102a0606463ed8e84f36101e05261018051610200526101a05161022052608435610240526101fc7327e611fd27b276acbd5ffd632e5eaebec9761e405afa15611ac657601f3d1115611ac6576000506102a0516101c0526101c0516101605260206102a0606463ed8e84f36101e05261014051610200526101605161022052608435610240526101fc6004355afa15611ac657601f3d1115611ac6576000506102a05160005260206000f35b505b60006000fd5b600080fd5b6100cc611b97036100cc6000396100cc611b97036000f35b600080fd

Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Validator ID :
0 FTM

Amount Staked
0

Amount Delegated
0

Staking Total
0

Staking Start Epoch
0

Staking Start Time
0

Proof of Importance
0

Origination Score
0

Validation Score
0

Active
0

Online
0

Downtime
0 s
Address Amount claimed Rewards Created On Epoch Created On
Block Uncle Number Difficulty Gas Used Reward
Loading
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.