POL Price: $0.698667 (+0.56%)
 

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
am3crv LP Burner

Compiler Version
vyper:0.3.7

Optimization Enabled:
N/A

Other Settings:
None license

Contract Source Code (Vyper language format)

# @version 0.3.7
"""
@title am3crv LP Burner
@notice LP tokens
"""


interface ERC20:
    def transfer(_to: address, _value: uint256) -> bool: nonpayable
    def transferFrom(_from: address, _to: address, _value: uint256) -> bool: nonpayable
    def balanceOf(_owner: address) -> uint256: view
    def decimals() -> uint256: view

interface StableSwap:
    def remove_liquidity_one_coin(
        _token_amount: uint256,
        i: int128,
        _min_amount: uint256,
        _use_underlying: bool
    ) -> uint256: nonpayable
    def get_virtual_price() -> uint256: view


BPS: constant(uint256) = 10000

SWAP: immutable(StableSwap)
PROXY: constant(address) = 0x774D1Dba98cfBD1F2Bc3A1F59c494125e07C48F9
USDC: immutable(ERC20)
slippage: public(uint256)

owner: public(address)


@external
def __init__():
    """
    @notice Contract constructor
    """
    SWAP = StableSwap(0x445FE580eF8d70FF569aB36e80c647af338db351)
    USDC = ERC20(0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174)
    self.owner = msg.sender

    self.slippage = 50  # .5%, 0.995


@internal
def _burn(_coin: address, _amount: uint256):
    min_amount: uint256 = _amount * SWAP.get_virtual_price() / 10 ** 18
    min_amount /= 10 ** 12  # 18 - 6, usdc decimals

    min_amount -= min_amount * self.slippage / BPS

    SWAP.remove_liquidity_one_coin(_amount, 1, 0, True)
    amount: uint256 = USDC.balanceOf(self)
    USDC.transfer(PROXY, amount)


@external
def burn(_coin: address) -> bool:
    """
    @notice Convert `_coin` by removing liquidity and transfer to another burner
    @param _coin Address of the coin being converted
    @return bool success
    """
    # transfer coins from caller
    amount: uint256 = ERC20(_coin).balanceOf(msg.sender)
    if amount != 0:
        ERC20(_coin).transferFrom(msg.sender, self, amount)

    # get actual balance in case of pre-existing balance
    amount = ERC20(_coin).balanceOf(self)

    if amount != 0:
        self._burn(_coin, amount)

    return True


@external
def burn_amount(_coin: address, _amount_to_burn: uint256):
    """
    @notice Burn a specific quantity of `_coin`
    @dev Useful when the total amount to burn is so large that it fails from slippage
    @param _coin Address of the coin being converted
    @param _amount_to_burn Amount of the coin to burn
    """
    amount: uint256 = ERC20(_coin).balanceOf(PROXY)
    if amount != 0:
        ERC20(_coin).transferFrom(PROXY, self, amount)

    amount = ERC20(_coin).balanceOf(self)
    assert amount >= _amount_to_burn, "Insufficient balance"

    self._burn(_coin, _amount_to_burn)


@external
def recover_balance(_coin: address) -> bool:
    """
    @notice Recover ERC20 tokens from this contract
    @dev Tokens are sent to the recovery address
    @param _coin Token address
    @return bool success
    """
    assert msg.sender == self.owner  # dev: only owner

    amount: uint256 = ERC20(_coin).balanceOf(self)
    response: Bytes[32] = raw_call(
        _coin,
        _abi_encode(PROXY, amount, method_id=method_id("transfer(address,uint256)")),
        max_outsize=32,
    )
    if len(response) != 0:
        assert convert(response, bool)

    return True


@external
def set_slippage(_slippage: uint256):
    """
    @notice Set default slippage parameter
    @param _slippage Slippage value in bps
    """
    assert msg.sender == self.owner  # dev: only owner
    assert _slippage <= BPS  # dev: slippage too high
    self.slippage = _slippage


@external
def set_owner(_owner: address):
    """
    @notice Set owner
    @param _owner New owner address
    """
    assert msg.sender == self.owner  # dev: only owner
    self.owner = _owner

Contract Security Audit

Contract ABI

[{"stateMutability":"nonpayable","type":"constructor","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"burn","inputs":[{"name":"_coin","type":"address"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"burn_amount","inputs":[{"name":"_coin","type":"address"},{"name":"_amount_to_burn","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"recover_balance","inputs":[{"name":"_coin","type":"address"}],"outputs":[{"name":"","type":"bool"}]},{"stateMutability":"nonpayable","type":"function","name":"set_slippage","inputs":[{"name":"_slippage","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"set_owner","inputs":[{"name":"_owner","type":"address"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"slippage","inputs":[],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}]}]

346106b05773445fe580ef8d70ff569ab36e80c647af338db35161065e52732791bca1f2de4661ed88a30c99a7a9449aa8417461067e5233600155603260005561065e6100516100003961069e610000f36003361161000c576104a1565b60003560e01c3461064c576389afcb448118610149576024361061064c576004358060a01c61064c5761014052610140516370a0823161018052336101a0526020610180602461019c845afa610067573d600060003e3d6000fd5b60203d1061064c576101809050516101605261016051156100dd57610140516323b872dd61018052336101a052306101c052610160516101e0526020610180606461019c6000855af16100bf573d600060003e3d6000fd5b60203d1061064c57610180518060011c61064c576102005261020050505b610140516370a0823161018052306101a0526020610180602461019c845afa61010b573d600060003e3d6000fd5b60203d1061064c5761018090505161016052610160511561013c57610140516040526101605160605261013c6104a7565b6001610180526020610180f35b637afb0ed18118610301576044361061064c576004358060a01c61064c5761014052610140516370a082316101805273774d1dba98cfbd1f2bc3a1f59c494125e07c48f96101a0526020610180602461019c845afa6101ad573d600060003e3d6000fd5b60203d1061064c5761018090505161016052610160511561023757610140516323b872dd6101805273774d1dba98cfbd1f2bc3a1f59c494125e07c48f96101a052306101c052610160516101e0526020610180606461019c6000855af1610219573d600060003e3d6000fd5b60203d1061064c57610180518060011c61064c576102005261020050505b610140516370a0823161018052306101a0526020610180602461019c845afa610265573d600060003e3d6000fd5b60203d1061064c57610180905051610160526024356101605110156102ea576014610180527f496e73756666696369656e742062616c616e63650000000000000000000000006101a0526101805061018051806101a001601f826000031636823750506308c379a061014052602061016052601f19601f61018051011660440161015cfd5b610140516040526024356060526102ff6104a7565b005b63db2f5f798118610400576024361061064c576004358060a01c61064c57604052600154331861064c576040516370a082316080523060a052602060806024609c845afa610354573d600060003e3d6000fd5b60203d1061064c57608090505160605263a9059cbb60c452600473774d1dba98cfbd1f2bc3a1f59c494125e07c48f960e4526060516101045260400160c05260c050602061016060c05160e060006040515af16103b6573d600060003e3d6000fd5b3d602081183d60201002186101405261014080518060805260208201805160a052505050608051156103f55760a05160805160200360031b1c1561064c575b600160c052602060c0f35b638edd69ec811861042f576024361061064c57600154331861064c576127106004351161064c57600435600055005b637cb97b2b8118610461576024361061064c576004358060a01c61064c57604052600154331861064c57604051600155005b633e032a3b8118610480576004361061064c5760005460405260206040f35b638da5cb5b811861049f576004361061064c5760015460405260206040f35b505b60006000fd5b606051602061065e60003960005163bb7b8b8060a052602060a0600460bc845afa6104d7573d600060003e3d6000fd5b60203d1061064c5760a090505180820281158383830414171561064c5790509050670de0b6b3a76400008104905060805260805164e8d4a510008104905060805260805160805160005480820281158383830414171561064c57905090506127108104905080820382811161064c5790509050608052602061065e60003960005163517a55a360a05260605160c052600160e052600061010052600161012052602060a0608460bc6000855af1610593573d600060003e3d6000fd5b60203d1061064c5760a05050602061067e6000396000516370a0823160c0523060e052602060c0602460dc845afa6105d0573d600060003e3d6000fd5b60203d1061064c5760c090505160a052602061067e60003960005163a9059cbb60c05273774d1dba98cfbd1f2bc3a1f59c494125e07c48f960e05260a05161010052602060c0604460dc6000855af161062e573d600060003e3d6000fd5b60203d1061064c5760c0518060011c61064c57610120526101205050565b600080fda165767970657283000307000b005b600080fd

Deployed Bytecode

0x6003361161000c576104a1565b60003560e01c3461064c576389afcb448118610149576024361061064c576004358060a01c61064c5761014052610140516370a0823161018052336101a0526020610180602461019c845afa610067573d600060003e3d6000fd5b60203d1061064c576101809050516101605261016051156100dd57610140516323b872dd61018052336101a052306101c052610160516101e0526020610180606461019c6000855af16100bf573d600060003e3d6000fd5b60203d1061064c57610180518060011c61064c576102005261020050505b610140516370a0823161018052306101a0526020610180602461019c845afa61010b573d600060003e3d6000fd5b60203d1061064c5761018090505161016052610160511561013c57610140516040526101605160605261013c6104a7565b6001610180526020610180f35b637afb0ed18118610301576044361061064c576004358060a01c61064c5761014052610140516370a082316101805273774d1dba98cfbd1f2bc3a1f59c494125e07c48f96101a0526020610180602461019c845afa6101ad573d600060003e3d6000fd5b60203d1061064c5761018090505161016052610160511561023757610140516323b872dd6101805273774d1dba98cfbd1f2bc3a1f59c494125e07c48f96101a052306101c052610160516101e0526020610180606461019c6000855af1610219573d600060003e3d6000fd5b60203d1061064c57610180518060011c61064c576102005261020050505b610140516370a0823161018052306101a0526020610180602461019c845afa610265573d600060003e3d6000fd5b60203d1061064c57610180905051610160526024356101605110156102ea576014610180527f496e73756666696369656e742062616c616e63650000000000000000000000006101a0526101805061018051806101a001601f826000031636823750506308c379a061014052602061016052601f19601f61018051011660440161015cfd5b610140516040526024356060526102ff6104a7565b005b63db2f5f798118610400576024361061064c576004358060a01c61064c57604052600154331861064c576040516370a082316080523060a052602060806024609c845afa610354573d600060003e3d6000fd5b60203d1061064c57608090505160605263a9059cbb60c452600473774d1dba98cfbd1f2bc3a1f59c494125e07c48f960e4526060516101045260400160c05260c050602061016060c05160e060006040515af16103b6573d600060003e3d6000fd5b3d602081183d60201002186101405261014080518060805260208201805160a052505050608051156103f55760a05160805160200360031b1c1561064c575b600160c052602060c0f35b638edd69ec811861042f576024361061064c57600154331861064c576127106004351161064c57600435600055005b637cb97b2b8118610461576024361061064c576004358060a01c61064c57604052600154331861064c57604051600155005b633e032a3b8118610480576004361061064c5760005460405260206040f35b638da5cb5b811861049f576004361061064c5760015460405260206040f35b505b60006000fd5b606051602061065e60003960005163bb7b8b8060a052602060a0600460bc845afa6104d7573d600060003e3d6000fd5b60203d1061064c5760a090505180820281158383830414171561064c5790509050670de0b6b3a76400008104905060805260805164e8d4a510008104905060805260805160805160005480820281158383830414171561064c57905090506127108104905080820382811161064c5790509050608052602061065e60003960005163517a55a360a05260605160c052600160e052600061010052600161012052602060a0608460bc6000855af1610593573d600060003e3d6000fd5b60203d1061064c5760a05050602061067e6000396000516370a0823160c0523060e052602060c0602460dc845afa6105d0573d600060003e3d6000fd5b60203d1061064c5760c090505160a052602061067e60003960005163a9059cbb60c05273774d1dba98cfbd1f2bc3a1f59c494125e07c48f960e05260a05161010052602060c0604460dc6000855af161062e573d600060003e3d6000fd5b60203d1061064c5760c0518060011c61064c57610120526101205050565b600080fda165767970657283000307000b000000000000000000000000445fe580ef8d70ff569ab36e80c647af338db3510000000000000000000000002791bca1f2de4661ed88a30c99a7a9449aa84174

Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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