POL Price: $0.718363 (-2.36%)
 

Overview

POL Balance

Polygon PoS Chain LogoPolygon PoS Chain LogoPolygon PoS Chain Logo0 POL

POL Value

$0.00

Token Holdings

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Set_receiver226328742021-12-17 13:30:011084 days ago1639747801IN
Curve.fi: amToken Burner
0 POL0.0008633430

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

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.3.0

Optimization Enabled:
N/A

Other Settings:
MIT license

Contract Source Code (Vyper language format)

# @version 0.3.0
"""
@title amToken Burner
@notice Converts amToken lending coins to USDC and transfers to `ChildBurner`
"""

from vyper.interfaces import ERC20


interface LendingPool:
    def withdraw(_underlying_asset: address, _amount: uint256, _receiver: address): nonpayable

interface aToken:
    def UNDERLYING_ASSET_ADDRESS() -> address: view

interface RegistrySwap:
    def exchange_with_best_rate(
        _from: address,
        _to: address,
        _amount: uint256,
        _expected: uint256,
        _receiver: address,
    ) -> uint256: payable

interface AddressProvider:
    def get_address(_id: uint256) -> address: view


receiver: public(address)
is_killed: public(bool)

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

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

ADDRESS_PROVIDER: constant(address) = 0x0000000022D53366457F9d5E68Ec105046FC4383
AAVE_LENDING_POOL: constant(address) = 0x8dFf5E27EA6b7AC08EbFdf9eB090F32ee9a30fcf
USDC: constant(address) = 0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174


@external
def __init__(_receiver: address, _owner: address):
    """
    @notice Contract constructor
    @param _receiver Address that converted tokens are transferred to.
                     Should be set to the `ChildBurner` deployment.
    @param _owner Owner address. Can kill the contract and recover tokens.
    """
    self.receiver = _receiver
    self.owner = _owner


@external
def burn(_coin: address) -> bool:
    """
    @notice Unwrap `_coin` and transfer to the receiver
    @param _coin Address of the coin being unwrapped
    @return bool success
    """
    assert not self.is_killed  # dev: is killed

    # transfer coins from caller
    amount: uint256 = ERC20(_coin).balanceOf(msg.sender)
    ERC20(_coin).transferFrom(msg.sender, self, amount)

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

    # unwrap aTokens for underlying asset and transfer to receiver
    underlying: address = aToken(_coin).UNDERLYING_ASSET_ADDRESS()
    if underlying == USDC:
        LendingPool(AAVE_LENDING_POOL).withdraw(underlying, amount, self.receiver)
    else:
        registry_swap: address = AddressProvider(ADDRESS_PROVIDER).get_address(2)
        LendingPool(AAVE_LENDING_POOL).withdraw(underlying, amount, self)
        if not self.is_approved[registry_swap][underlying]:
            response: Bytes[32] = raw_call(
                underlying,
                _abi_encode(registry_swap, MAX_UINT256, method_id=method_id("approve(address,uint256)")),
                max_outsize=32,
            )
            if len(response) != 0:
                assert convert(response, bool)
            self.is_approved[registry_swap][underlying] = True

        # get actual balance in case of transfer fee or pre-existing balance
        amount = ERC20(underlying).balanceOf(self)
        RegistrySwap(registry_swap).exchange_with_best_rate(underlying, USDC, amount, 0, self.receiver)

    return True


@external
def recover_balance(_coin: address) -> bool:
    """
    @notice Recover ERC20 tokens from this contract
    @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(msg.sender, amount, method_id=method_id("transfer(address,uint256)")),
        max_outsize=32,
    )
    if len(response) != 0:
        assert convert(response, bool)

    return True


@external
def set_receiver(_receiver: address):
    assert msg.sender == self.owner
    self.receiver = _receiver


@external
def set_killed(_is_killed: bool) -> bool:
    """
    @notice Set killed status for this contract
    @dev When killed, the `burn` function cannot be called
    @param _is_killed Killed status
    @return bool success
    """
    assert msg.sender == self.owner  # dev: only owner
    self.is_killed = _is_killed

    return True


@external
def commit_transfer_ownership(_future_owner: address) -> bool:
    """
    @notice Commit a transfer of ownership
    @dev Must be accepted by the new owner via `accept_transfer_ownership`
    @param _future_owner New owner address
    @return bool success
    """
    assert msg.sender == self.owner  # dev: only owner
    self.future_owner = _future_owner

    return True


@external
def accept_transfer_ownership() -> bool:
    """
    @notice Accept a transfer of ownership
    @return bool success
    """
    assert msg.sender == self.future_owner  # dev: only owner
    self.owner = msg.sender

    return True

Contract Security Audit

Contract ABI

[{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"_receiver","type":"address"},{"name":"_owner","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"burn","inputs":[{"name":"_coin","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":72069},{"stateMutability":"nonpayable","type":"function","name":"recover_balance","inputs":[{"name":"_coin","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":12531},{"stateMutability":"nonpayable","type":"function","name":"set_receiver","inputs":[{"name":"_receiver","type":"address"}],"outputs":[],"gas":37702},{"stateMutability":"nonpayable","type":"function","name":"set_killed","inputs":[{"name":"_is_killed","type":"bool"}],"outputs":[{"name":"","type":"bool"}],"gas":37875},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"_future_owner","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":37905},{"stateMutability":"nonpayable","type":"function","name":"accept_transfer_ownership","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":37774},{"stateMutability":"view","type":"function","name":"receiver","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2706},{"stateMutability":"view","type":"function","name":"is_killed","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":2736},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2766},{"stateMutability":"view","type":"function","name":"future_owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2796}]

602061070760c03960c0518060a01c6107025780905061014052602060206107070160c03960c0518060a01c610702578090506101605261014051600055610160516002556106ea56600436101561000d57610696565b60046000601c376000513461069c576389afcb4481141561042b576004358060a01c61069c578090506101405260015461069c576370a0823161018052336101a0526020610180602461019c610140515afa1561069c57601f3d111561069c5761018051610160526323b872dd61018052336101a052306101c052610160516101e0526020610180606461019c6000610140515af11561069c57601f3d111561069c57610180506370a0823161018052306101a0526020610180602461019c610140515afa1561069c57601f3d111561069c57610180516101605263b16a19de6101a05260206101a060046101bc610140515afa1561069c57601f3d111561069c576101a0518060a01c61069c5780905061018052732791bca1f2de4661ed88a30c99a7a9449aa841746101805114156101a8576369328dec6101a052610180516101c052610160516101e05260005461020052738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf3b1561069c576000600060646101bc6000738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf5af11561069c5761041e565b63493f4f746101c05260026101e05260206101c060246101dc6f22d53366457f9d5e68ec105046fc43835afa1561069c57601f3d111561069c576101c0518060a01c61069c578090506101a0526369328dec6101c052610180516101e05261016051610200523061022052738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf3b1561069c576000600060646101dc6000738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf5af11561069c5760046101a05160e05260c052604060c0206101805160e05260c052604060c020546103865763095ea7b36102045260046101a051610224527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61024452604001610200526102008051602001806102808284600060045af11561069c5750506020610320610280516102a06000610180515af11561069c5760203d808211156102fe5780610300565b815b90509050610300526103008051602001806101c08284600060045af11561069c57505060006101c0511815610362576101c0806020015160008251806020901361069c578091901261069c57806020036101000a82049050905090501561069c575b600160046101a05160e05260c052604060c0206101805160e05260c052604060c020555b6370a082316101c052306101e05260206101c060246101dc610180515afa1561069c57601f3d111561069c576101c05161016052639f69a6a66101c052610180516101e052732791bca1f2de4661ed88a30c99a7a9449aa841746102005261016051610220526000610240526000546102605260206101c060a46101dc60006101a0515af11561069c57601f3d111561069c576101c0505b60016101a05260206101a0f35b63db2f5f7981141561055c576004358060a01c61069c578090506101405260025433141561069c576370a0823161018052306101a0526020610180602461019c610140515afa1561069c57601f3d111561069c57610180516101605263a9059cbb6101c4526004336101e45261016051610204526040016101c0526101c08051602001806102408284600060045af11561069c57505060206102e0610240516102606000610140515af11561069c5760203d808211156104eb57806104ed565b815b905090506102c0526102c08051602001806101808284600060045af11561069c575050600061018051181561054f57610180806020015160008251806020901361069c578091901261069c57806020036101000a82049050905090501561069c575b60016101c05260206101c0f35b63d1dd6f5681141561058d576004358060a01c61069c578090506101405260025433141561069c5761014051600055005b6390b229978114156105c9576004358060011c61069c578090506101405260025433141561069c57610140516001556001610160526020610160f35b636b441a40811415610605576004358060a01c61069c578090506101405260025433141561069c57610140516003556001610160526020610160f35b63e5ea47b881141561062c5760035433141561069c57336002556001610140526020610140f35b63f7260d3e81141561064657600054610140526020610140f35b639c868ac081141561066057600154610140526020610140f35b638da5cb5b81141561067a57600254610140526020610140f35b631ec0cdc181141561069457600354610140526020610140f35b505b60006000fd5b600080fd5b6100496106ea036100496000396100496106ea036000f35b600080fd000000000000000000000000d6930b7f661257da36f93160149b0317352375940000000000000000000000007eeac6cddbd1d0b8af061742d41877d7f707289a

Deployed Bytecode

0x600436101561000d57610696565b60046000601c376000513461069c576389afcb4481141561042b576004358060a01c61069c578090506101405260015461069c576370a0823161018052336101a0526020610180602461019c610140515afa1561069c57601f3d111561069c5761018051610160526323b872dd61018052336101a052306101c052610160516101e0526020610180606461019c6000610140515af11561069c57601f3d111561069c57610180506370a0823161018052306101a0526020610180602461019c610140515afa1561069c57601f3d111561069c57610180516101605263b16a19de6101a05260206101a060046101bc610140515afa1561069c57601f3d111561069c576101a0518060a01c61069c5780905061018052732791bca1f2de4661ed88a30c99a7a9449aa841746101805114156101a8576369328dec6101a052610180516101c052610160516101e05260005461020052738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf3b1561069c576000600060646101bc6000738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf5af11561069c5761041e565b63493f4f746101c05260026101e05260206101c060246101dc6f22d53366457f9d5e68ec105046fc43835afa1561069c57601f3d111561069c576101c0518060a01c61069c578090506101a0526369328dec6101c052610180516101e05261016051610200523061022052738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf3b1561069c576000600060646101dc6000738dff5e27ea6b7ac08ebfdf9eb090f32ee9a30fcf5af11561069c5760046101a05160e05260c052604060c0206101805160e05260c052604060c020546103865763095ea7b36102045260046101a051610224527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61024452604001610200526102008051602001806102808284600060045af11561069c5750506020610320610280516102a06000610180515af11561069c5760203d808211156102fe5780610300565b815b90509050610300526103008051602001806101c08284600060045af11561069c57505060006101c0511815610362576101c0806020015160008251806020901361069c578091901261069c57806020036101000a82049050905090501561069c575b600160046101a05160e05260c052604060c0206101805160e05260c052604060c020555b6370a082316101c052306101e05260206101c060246101dc610180515afa1561069c57601f3d111561069c576101c05161016052639f69a6a66101c052610180516101e052732791bca1f2de4661ed88a30c99a7a9449aa841746102005261016051610220526000610240526000546102605260206101c060a46101dc60006101a0515af11561069c57601f3d111561069c576101c0505b60016101a05260206101a0f35b63db2f5f7981141561055c576004358060a01c61069c578090506101405260025433141561069c576370a0823161018052306101a0526020610180602461019c610140515afa1561069c57601f3d111561069c57610180516101605263a9059cbb6101c4526004336101e45261016051610204526040016101c0526101c08051602001806102408284600060045af11561069c57505060206102e0610240516102606000610140515af11561069c5760203d808211156104eb57806104ed565b815b905090506102c0526102c08051602001806101808284600060045af11561069c575050600061018051181561054f57610180806020015160008251806020901361069c578091901261069c57806020036101000a82049050905090501561069c575b60016101c05260206101c0f35b63d1dd6f5681141561058d576004358060a01c61069c578090506101405260025433141561069c5761014051600055005b6390b229978114156105c9576004358060011c61069c578090506101405260025433141561069c57610140516001556001610160526020610160f35b636b441a40811415610605576004358060a01c61069c578090506101405260025433141561069c57610140516003556001610160526020610160f35b63e5ea47b881141561062c5760035433141561069c57336002556001610140526020610140f35b63f7260d3e81141561064657600054610140526020610140f35b639c868ac081141561066057600154610140526020610140f35b638da5cb5b81141561067a57600254610140526020610140f35b631ec0cdc181141561069457600354610140526020610140f35b505b60006000fd5b600080fd

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

000000000000000000000000d6930b7f661257da36f93160149b0317352375940000000000000000000000007eeac6cddbd1d0b8af061742d41877d7f707289a

-----Decoded View---------------
Arg [0] : _receiver (address): 0xd6930b7f661257DA36F93160149b031735237594
Arg [1] : _owner (address): 0x7EeAC6CDdbd1D0B8aF061742D41877D7F707289a

-----Encoded View---------------
2 Constructor Arguments found :
Arg [0] : 000000000000000000000000d6930b7f661257da36f93160149b031735237594
Arg [1] : 0000000000000000000000007eeac6cddbd1d0b8af061742d41877d7f707289a


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
[ Download: CSV Export  ]

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