Contract 0xf72B5bC0a05f15CaDB6731e59C7D99C1bFbB2FAb 1

Contract Overview

Balance:
0 Ether

Token:
Txn Hash
Method
Block
From
To
Value
0x42deeae116be9dabaa49203aceb60d8b38d28f20356b29d6f1dd59270fd0c1c2Submit122308522022-05-01 13:53:40102 days 4 hrs ago0xc0fe0635e56c708f22d941c4d29bc4dd226b5c18 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00417024 49.‍59856028
0x4b183feb109a9f1b4cff0eca91f64e328c7ebd51fc954c196a01dd6a14a9b47eSubmit122308412022-05-01 13:33:37102 days 5 hrs ago0xc0fe0635e56c708f22d941c4d29bc4dd226b5c18 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00264204 31.‍42304019
0x5176bfe2fbd5f44aee59b1689afc71a762aaf9cf02a56d0811dace7ec5a6176cSubmit122308412022-05-01 13:33:37102 days 5 hrs ago0xc0fe0635e56c708f22d941c4d29bc4dd226b5c18 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00264204 31.‍42304019
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66bSubmit122077702022-04-20 14:22:15113 days 4 hrs ago0xf88101a4b1fbcb5adecdb8f5208fa298ef39b4f2 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍07772284 465.‍280858
0x11734ee211e4c83fa62a7616d0157d6a233b084e206947c95f4de94272414d23Submit122076382022-04-20 12:09:56113 days 6 hrs ago0x36f7ac1b9cd50deb6ceca7cea64e124b563b469b IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍06262897 374.‍92280455
0x77aa7fb1c4154c27c8050d396fea8a05bf18ff95a0e786d2bdf45a52e0d682ebSubmit122063152022-04-19 19:03:08113 days 23 hrs ago0x36f7ac1b9cd50deb6ceca7cea64e124b563b469b IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00583514 34.‍93155892
0x16b95b3123ae6514ca8e46918600894514fde8df8e60b3ff0aefc31a38c8dcd6Withdraw122060902022-04-19 16:44:10114 days 2 hrs ago0x36f7ac1b9cd50deb6ceca7cea64e124b563b469b IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00575873 75.‍19899052
0xa2790fe1f2da61833d47279996a65b23788b295eae57e425e79aa0bcbab9c72eSubmit122060422022-04-19 16:21:20114 days 2 hrs ago0x36f7ac1b9cd50deb6ceca7cea64e124b563b469b IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍02693696 161.‍25576559
0x740b14108223bbbf9117cb7f570ec98cf2d9b182ccf45445b55ace2e19bef455Submit122040392022-04-18 15:38:44115 days 3 hrs ago0xf88101a4b1fbcb5adecdb8f5208fa298ef39b4f2 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍02900804 173.‍65408654
0xd1933877533409cf04c6c4df0235e0e121c38267c631a1c3398b54ccc65b6cc3Submit122039342022-04-18 14:21:44115 days 4 hrs ago0xf88101a4b1fbcb5adecdb8f5208fa298ef39b4f2 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍02699025 161.‍57478104
0x9e094994602546429cd8a78fad11567a4f22de2bef6028a01729cc15e3158c0dSubmit121994832022-04-16 13:24:11117 days 5 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00033801 2.‍00000001
0x69fea41ddc25a5811b4d5a2c5d135f921e36763a1765a20a3cfc9c269f7729a6Submit121994562022-04-16 13:10:14117 days 5 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00042254 2.‍50000002
0x6e1fff9c015ed4f3a40e6a7e84f3c44dc13a96a23f44c93db6b067a4dbc065beSubmit121992632022-04-16 11:25:08117 days 7 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00042251 2.‍50000001
0x10a3f38ab816d6e6a2779a0866ae3f9ec92fd7bd618beff2e591cdaa05d44b10Submit121989352022-04-16 8:31:33117 days 10 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00033806 2
0x11816348a3ac557eb124b54d3364c48aea3d8479755f26eb0490164884b3f952Submit121978362022-04-15 22:52:26117 days 20 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00040926 2.‍45000001
0x80ea60761bf43dc3b5321dabe71f731940ab279989bbf3f18474a5fe3b6daa94Submit121978082022-04-15 22:35:25117 days 20 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00033409 2.‍00000001
0x9b760688e0e3da5d8653f4a2fd5f382b258e7c96b887e438b686e0d1b7b31064Submit121978032022-04-15 22:32:35117 days 20 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00014934 2.‍50000001
0xb9e5df4b0c4187c88e7418582870003a0a1e670fc8c7f7c7c1ce53ba0138e92aSubmit121978032022-04-15 22:32:35117 days 20 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00033409 2.‍00000001
0x86e48175ffecb4325a5e9cb6b9501aa4deb74c99b942e7e82e2b06e17c1a63e7Submit121971582022-04-15 16:35:56118 days 2 hrs ago0x08c3e4527f0aa14d36ae09654e0e6df3ec652fd1 IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00033409 2.‍00000004
0xc644c5243fa48df36dd706baa76fb7e8c40d6cf665554af403e442a7fc083ac6Submit121969412022-04-15 14:53:51118 days 3 hrs ago0x8ef311dbce5adeedfa77db4250735b8a09444e2c IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00016796 2.‍50000328
0xef29d43991d3c59f662eb7c876efefed0d22fa660767698aaa123244efe401f9Submit121968682022-04-15 14:11:28118 days 4 hrs ago0xd71f12fb050751ea24898455d447e51aee489bce IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00038004 2.‍50003266
0xf3c6308b4adf9e60fa364c8a8b6a793af31c9b112fae05e770ffde753d4bfce9Submit121968622022-04-15 14:09:00118 days 4 hrs ago0xd71f12fb050751ea24898455d447e51aee489bce IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00014934 2.‍50003678
0x7302b3ce29ae48d6bbf6baddb4f25512e5a900a22056f8001e44beea92de8aacSubmit121968622022-04-15 14:09:00118 days 4 hrs ago0xd71f12fb050751ea24898455d447e51aee489bce IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00014934 2.‍50003678
0x74489c8197806bf2c03f35bd84b0ee78a53a930dd48fc919f55b8fc25d3ad458Submit121968622022-04-15 14:09:00118 days 4 hrs ago0xd71f12fb050751ea24898455d447e51aee489bce IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00041761 2.‍50003678
0x81caf8858bd52595a5fac926667a16f764e81bdeea708c5e5bb81745cc2b61b7Submit121962422022-04-15 8:58:05118 days 9 hrs ago0x09625ea58e5bdfde62c6b720793dc7323fe9fcee IN  0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0 Ether0.‍00022996 3.‍42278212
[ Download CSV Export 
Latest 25 internal transaction
Parent Txn Hash Block From To Value
0x42deeae116be9dabaa49203aceb60d8b38d28f20356b29d6f1dd59270fd0c1c2122308522022-05-01 13:53:40102 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x42deeae116be9dabaa49203aceb60d8b38d28f20356b29d6f1dd59270fd0c1c2122308522022-05-01 13:53:40102 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x42deeae116be9dabaa49203aceb60d8b38d28f20356b29d6f1dd59270fd0c1c2122308522022-05-01 13:53:40102 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0xff0b6374bfe05e62c84f3e0d6941a5866a25cec20 Ether
0x42deeae116be9dabaa49203aceb60d8b38d28f20356b29d6f1dd59270fd0c1c2122308522022-05-01 13:53:40102 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x42deeae116be9dabaa49203aceb60d8b38d28f20356b29d6f1dd59270fd0c1c2122308522022-05-01 13:53:40102 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x4b183feb109a9f1b4cff0eca91f64e328c7ebd51fc954c196a01dd6a14a9b47e122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x4b183feb109a9f1b4cff0eca91f64e328c7ebd51fc954c196a01dd6a14a9b47e122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x4b183feb109a9f1b4cff0eca91f64e328c7ebd51fc954c196a01dd6a14a9b47e122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0xff0b6374bfe05e62c84f3e0d6941a5866a25cec20 Ether
0x4b183feb109a9f1b4cff0eca91f64e328c7ebd51fc954c196a01dd6a14a9b47e122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x4b183feb109a9f1b4cff0eca91f64e328c7ebd51fc954c196a01dd6a14a9b47e122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x5176bfe2fbd5f44aee59b1689afc71a762aaf9cf02a56d0811dace7ec5a6176c122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x5176bfe2fbd5f44aee59b1689afc71a762aaf9cf02a56d0811dace7ec5a6176c122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x5176bfe2fbd5f44aee59b1689afc71a762aaf9cf02a56d0811dace7ec5a6176c122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0xff0b6374bfe05e62c84f3e0d6941a5866a25cec20 Ether
0x5176bfe2fbd5f44aee59b1689afc71a762aaf9cf02a56d0811dace7ec5a6176c122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x5176bfe2fbd5f44aee59b1689afc71a762aaf9cf02a56d0811dace7ec5a6176c122308412022-05-01 13:33:37102 days 5 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0xff0b6374bfe05e62c84f3e0d6941a5866a25cec20 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0x00000000000000000000000000000000000000040 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0xff0b6374bfe05e62c84f3e0d6941a5866a25cec20 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
0x0dda1015a9d91ffb56a59802f2cb89092836ba36ce7527dca21a77310bbfe66b122077702022-04-20 14:22:15113 days 4 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xd40eefcfab888c9159a61221def03bf77773fc190 Ether
0x11734ee211e4c83fa62a7616d0157d6a233b084e206947c95f4de94272414d23122076382022-04-20 12:09:56113 days 6 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0xff0b6374bfe05e62c84f3e0d6941a5866a25cec20 Ether
0x11734ee211e4c83fa62a7616d0157d6a233b084e206947c95f4de94272414d23122076382022-04-20 12:09:56113 days 6 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab0x00000000000000000000000000000000000000040 Ether
0x11734ee211e4c83fa62a7616d0157d6a233b084e206947c95f4de94272414d23122076382022-04-20 12:09:56113 days 6 hrs ago 0xf72b5bc0a05f15cadb6731e59c7d99c1bfbb2fab 0xa60100d5e12e9f83c1b04997314cf11685a618ff0 Ether
[ Download CSV Export 
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.12

Optimization Enabled:
N/A

Other Settings:
MIT license

Contract Source Code (Vyper language format)

# @version 0.2.12
# @author skozin <[email protected]>
# @licence MIT
from vyper.interfaces import ERC20


interface BridgeConnector:
    def forward_beth(terra_address: bytes32, amount: uint256, extra_data: Bytes[1024]): nonpayable
    def forward_ust(terra_address: bytes32, amount: uint256, extra_data: Bytes[1024]): nonpayable
    def adjust_amount(amount: uint256, decimals: uint256) -> uint256: view


interface RewardsLiquidator:
    def liquidate(ust_recipient: address) -> uint256: nonpayable


interface Mintable:
    def mint(owner: address, amount: uint256): nonpayable
    def burn(owner: address, amount: uint256): nonpayable


interface Lido:
    def sharesOf(owner: address) -> uint256: view
    def getPooledEthByShares(shares_amount: uint256) -> uint256: view


event Deposited:
    sender: indexed(address)
    amount: uint256
    terra_address: bytes32


event Withdrawn:
    recipient: indexed(address)
    amount: uint256


event RewardsCollected:
    steth_amount: uint256
    ust_amount: uint256


event AdminChanged:
    new_admin: address


event BridgeConnectorUpdated:
    bridge_connector: address


event RewardsLiquidatorUpdated:
    rewards_liquidator: address


event LiquidationsAdminUpdated:
    liquidations_admin: address


event AnchorRewardsDistributorUpdated:
    anchor_rewards_distributor: bytes32


BETH_DECIMALS: constant(uint256) = 18

# no rewards liquidations for 5m since previous liquidation (TESTNET ONLY)
NO_LIQUIDATION_INTERVAL: constant(uint256) = 60 * 5
# only admin can liquidate rewards for the first 2m after that (TESTNET ONLY)
RESTRICTED_LIQUIDATION_INTERVAL: constant(uint256) = NO_LIQUIDATION_INTERVAL + 60 * 2

admin: public(address)

beth_token: public(address)
steth_token: public(address)
bridge_connector: public(address)
rewards_liquidator: public(address)
anchor_rewards_distributor: public(bytes32)

liquidations_admin: public(address)
last_liquidation_time: public(uint256)
last_liquidation_shares_balance: public(uint256)
last_liquidation_steth_balance: public(uint256)
last_liquidation_shares_steth_rate: public(uint256)


@external
def __init__(beth_token: address, steth_token: address, admin: address):
    self.beth_token = beth_token
    self.steth_token = steth_token
    self.admin = admin
    self.last_liquidation_shares_steth_rate = Lido(steth_token).getPooledEthByShares(10**18)
    log AdminChanged(admin)


@external
def change_admin(new_admin: address):
    assert msg.sender == self.admin
    self.admin = new_admin
    log AdminChanged(new_admin)


@internal
def _set_bridge_connector(_bridge_connector: address):
    self.bridge_connector = _bridge_connector
    log BridgeConnectorUpdated(_bridge_connector)


@external
def set_bridge_connector(_bridge_connector: address):
    assert msg.sender == self.admin
    self._set_bridge_connector(_bridge_connector)


@internal
def _set_rewards_liquidator(_rewards_liquidator: address):
    self.rewards_liquidator = _rewards_liquidator
    log RewardsLiquidatorUpdated(_rewards_liquidator)


@external
def set_rewards_liquidator(_rewards_liquidator: address):
    assert msg.sender == self.admin
    self._set_rewards_liquidator(_rewards_liquidator)


@internal
def _set_liquidations_admin(_liquidations_admin: address):
    self.liquidations_admin = _liquidations_admin
    log LiquidationsAdminUpdated(_liquidations_admin)


@external
def set_liquidations_admin(_liquidations_admin: address):
    assert msg.sender == self.admin
    self._set_liquidations_admin(_liquidations_admin)


@internal
def _set_anchor_rewards_distributor(_anchor_rewards_distributor: bytes32):
    self.anchor_rewards_distributor = _anchor_rewards_distributor
    log AnchorRewardsDistributorUpdated(_anchor_rewards_distributor)


@external
def set_anchor_rewards_distributor(_anchor_rewards_distributor: bytes32):
    assert msg.sender == self.admin
    self._set_anchor_rewards_distributor(_anchor_rewards_distributor)


@external
def configure(
    _bridge_connector: address,
    _rewards_liquidator: address,
    _liquidations_admin: address,
    _anchor_rewards_distributor: bytes32,
):
    assert msg.sender == self.admin
    self._set_bridge_connector(_bridge_connector)
    self._set_rewards_liquidator(_rewards_liquidator)
    self._set_liquidations_admin(_liquidations_admin)
    self._set_anchor_rewards_distributor(_anchor_rewards_distributor)


@internal
@view
def _get_rate(_is_withdraw_rate: bool) -> uint256:
    steth_balance: uint256 = ERC20(self.steth_token).balanceOf(self)
    beth_supply: uint256 = ERC20(self.beth_token).totalSupply()
    if steth_balance >= beth_supply:
        return 10**18
    elif _is_withdraw_rate:
        return (steth_balance * 10**18) / beth_supply
    elif steth_balance == 0:
        return 10**18
    else:
        return (beth_supply * 10**18) / steth_balance


@external
@view
def get_rate() -> uint256:
    """
    @dev How much bETH one receives for depositing one stETH, and how much bETH one needs
         to provide to withdraw one stETH, 10**18 being the 1:1 rate.
    """
    return self._get_rate(False)


@external
def submit(_amount: uint256, _terra_address: bytes32, _extra_data: Bytes[1024]):
    connector: address = self.bridge_connector

    beth_rate: uint256 = self._get_rate(False)
    beth_amount: uint256 = (_amount * beth_rate) / 10**18
    # the bridge might not support full precision amounts
    beth_amount = BridgeConnector(connector).adjust_amount(beth_amount, BETH_DECIMALS)

    steth_amount_adj: uint256 = (beth_amount * 10**18) / beth_rate
    assert steth_amount_adj <= _amount

    ERC20(self.steth_token).transferFrom(msg.sender, self, steth_amount_adj)
    Mintable(self.beth_token).mint(connector, beth_amount)
    BridgeConnector(connector).forward_beth(_terra_address, beth_amount, _extra_data)

    log Deposited(msg.sender, steth_amount_adj, _terra_address)


@external
def withdraw(_amount: uint256, _recipient: address = msg.sender):
    steth_rate: uint256 = self._get_rate(True)
    steth_amount: uint256 = (_amount * steth_rate) / 10**18

    Mintable(self.beth_token).burn(msg.sender, _amount)
    ERC20(self.steth_token).transfer(_recipient, steth_amount)

    log Withdrawn(_recipient, _amount)


@external
def collect_rewards() -> uint256:
    time_since_last_liquidation: uint256 = block.timestamp - self.last_liquidation_time

    if msg.sender == self.liquidations_admin:
        assert time_since_last_liquidation > NO_LIQUIDATION_INTERVAL
    else:
        assert time_since_last_liquidation > RESTRICTED_LIQUIDATION_INTERVAL

    steth_token: address = self.steth_token
    shares_balance: uint256 = Lido(steth_token).sharesOf(self)
    last_liquidation_shares_balance: uint256 = self.last_liquidation_shares_balance

    non_reward_balance_change: int256 = 0

    if shares_balance >= last_liquidation_shares_balance:
        non_reward_balance_change = convert(
            (shares_balance - last_liquidation_shares_balance) * self.last_liquidation_shares_steth_rate / 10**18, 
            int256
        )
    else:
        non_reward_balance_change = -1 * convert(
            (last_liquidation_shares_balance - shares_balance) * self.last_liquidation_shares_steth_rate / 10**18, 
            int256
        )

    steth_balance: uint256 = ERC20(steth_token).balanceOf(self)

    # -non_reward_balance_change cannot be greater than self.last_liquidation_steth_balance
    steth_base_balance: uint256 = convert(
        convert(self.last_liquidation_steth_balance, int256) + non_reward_balance_change,
        uint256
    )

    self.last_liquidation_shares_balance = shares_balance
    self.last_liquidation_steth_balance = steth_balance
    self.last_liquidation_time = block.timestamp
    self.last_liquidation_shares_steth_rate = Lido(steth_token).getPooledEthByShares(10**18)

    if steth_balance <= steth_base_balance:
        log RewardsCollected(0, 0)
        return 0

    steth_to_sell: uint256 = steth_balance - steth_base_balance

    connector: address = self.bridge_connector
    liquidator: address = self.rewards_liquidator

    ERC20(steth_token).transfer(liquidator, steth_to_sell)
    ust_amount: uint256 = RewardsLiquidator(liquidator).liquidate(connector)
    BridgeConnector(connector).forward_ust(self.anchor_rewards_distributor, ust_amount, b"")

    log RewardsCollected(steth_to_sell, ust_amount)

    return ust_amount

Contract ABI

[{"name":"Deposited","inputs":[{"name":"sender","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false},{"name":"terra_address","type":"bytes32","indexed":false}],"anonymous":false,"type":"event"},{"name":"Withdrawn","inputs":[{"name":"recipient","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"RewardsCollected","inputs":[{"name":"steth_amount","type":"uint256","indexed":false},{"name":"ust_amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AdminChanged","inputs":[{"name":"new_admin","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"BridgeConnectorUpdated","inputs":[{"name":"bridge_connector","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"RewardsLiquidatorUpdated","inputs":[{"name":"rewards_liquidator","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"LiquidationsAdminUpdated","inputs":[{"name":"liquidations_admin","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"AnchorRewardsDistributorUpdated","inputs":[{"name":"anchor_rewards_distributor","type":"bytes32","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"beth_token","type":"address"},{"name":"steth_token","type":"address"},{"name":"admin","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"change_admin","inputs":[{"name":"new_admin","type":"address"}],"outputs":[],"gas":38895},{"stateMutability":"nonpayable","type":"function","name":"set_bridge_connector","inputs":[{"name":"_bridge_connector","type":"address"}],"outputs":[],"gas":39378},{"stateMutability":"nonpayable","type":"function","name":"set_rewards_liquidator","inputs":[{"name":"_rewards_liquidator","type":"address"}],"outputs":[],"gas":39438},{"stateMutability":"nonpayable","type":"function","name":"set_liquidations_admin","inputs":[{"name":"_liquidations_admin","type":"address"}],"outputs":[],"gas":39498},{"stateMutability":"nonpayable","type":"function","name":"set_anchor_rewards_distributor","inputs":[{"name":"_anchor_rewards_distributor","type":"bytes32"}],"outputs":[],"gas":39458},{"stateMutability":"nonpayable","type":"function","name":"configure","inputs":[{"name":"_bridge_connector","type":"address"},{"name":"_rewards_liquidator","type":"address"},{"name":"_liquidations_admin","type":"address"},{"name":"_anchor_rewards_distributor","type":"bytes32"}],"outputs":[],"gas":150287},{"stateMutability":"view","type":"function","name":"get_rate","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":10540},{"stateMutability":"nonpayable","type":"function","name":"submit","inputs":[{"name":"_amount","type":"uint256"},{"name":"_terra_address","type":"bytes32"},{"name":"_extra_data","type":"bytes"}],"outputs":[],"gas":40021},{"stateMutability":"nonpayable","type":"function","name":"withdraw","inputs":[{"name":"_amount","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"withdraw","inputs":[{"name":"_amount","type":"uint256"},{"name":"_recipient","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"collect_rewards","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":179920},{"stateMutability":"view","type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2688},{"stateMutability":"view","type":"function","name":"beth_token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2718},{"stateMutability":"view","type":"function","name":"steth_token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2748},{"stateMutability":"view","type":"function","name":"bridge_connector","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2778},{"stateMutability":"view","type":"function","name":"rewards_liquidator","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2808},{"stateMutability":"view","type":"function","name":"anchor_rewards_distributor","inputs":[],"outputs":[{"name":"","type":"bytes32"}],"gas":2838},{"stateMutability":"view","type":"function","name":"liquidations_admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2868},{"stateMutability":"view","type":"function","name":"last_liquidation_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2898},{"stateMutability":"view","type":"function","name":"last_liquidation_shares_balance","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2928},{"stateMutability":"view","type":"function","name":"last_liquidation_steth_balance","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2958},{"stateMutability":"view","type":"function","name":"last_liquidation_shares_steth_rate","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":2988}]

6060610ffe610140396020610ffe60c03960c05160a01c1561002057600080fd5b60206020610ffe0160c03960c05160a01c1561003b57600080fd5b60206040610ffe0160c03960c05160a01c1561005657600080fd5b61014051600155610160516002556101805160005560206102206024637a28fb886101a052670de0b6b3a76400006101c0526101bc610160515afa61009a57600080fd5b601f3d116100a757600080fd5b60005061022051600a55610180516101a0527f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c60206101a0a1610fe656600436101561000d57610c80565b600035601c52600051341561002157600080fd5b63158686b58114156100815760043560a01c1561003d57600080fd5b600054331461004b57600080fd5b600435600055600435610140527f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c6020610140a1005b6358e46d898114156100c45760043560a01c1561009d57600080fd5b60005433146100ab57600080fd5b600435610140526101405160065801610c86565b600050005b63fb9fa0e48114156101075760043560a01c156100e057600080fd5b60005433146100ee57600080fd5b600435610140526101405160065801610cca565b600050005b6310be5c3281141561014a5760043560a01c1561012357600080fd5b600054331461013157600080fd5b600435610140526101405160065801610d0e565b600050005b6353cade0281141561017d57600054331461016457600080fd5b600435610140526101405160065801610d52565b600050005b639f498a0f8114156102255760043560a01c1561019957600080fd5b60243560a01c156101a957600080fd5b60443560a01c156101b957600080fd5b60005433146101c757600080fd5b600435610140526101405160065801610c86565b600050602435610140526101405160065801610cca565b600050604435610140526101405160065801610d0e565b600050606435610140526101405160065801610d52565b600050005b63533178e5811415610255576000610140526101405160065801610d96565b6101a0526101a05160005260206000f35b639e63798d8114156105c8576104206044356004016101403761040060443560040135111561028357600080fd5b600354610580526101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610280516102a0516102c0516102e05161030051610320516103405161036051610380516103a0516103c0516103e05161040051610420516104405161046051610480516104a0516104c0516104e05161050051610520516105405161056051610580516105a05160006105c0526105c05160065801610d96565b610620526105a05261058052610560526105405261052052610500526104e0526104c0526104a05261048052610460526104405261042052610400526103e0526103c0526103a05261038052610360526103405261032052610300526102e0526102c0526102a05261028052610260526102405261022052610200526101e0526101c0526101a052610180526101605261014052610620516105a0526004356105a05180820282158284830414176103e457600080fd5b80905090509050670de0b6b3a7640000808204905090506105c0526020610680604463d775b5f26105e0526105c051610600526012610620526105fc610580515afa61042f57600080fd5b601f3d1161043c57600080fd5b600050610680516105c0526105c051670de0b6b3a7640000808202821582848304141761046857600080fd5b809050905090506105a051808061047e57600080fd5b8204905090506105e0526004356105e051111561049a57600080fd5b60206106c060646323b872dd61060052336106205230610640526105e0516106605261061c60006002545af16104cf57600080fd5b601f3d116104dc57600080fd5b6000506106c0506001543b6104f057600080fd5b6000600060446340c10f196106005261058051610620526105c0516106405261061c60006001545af161052257600080fd5b610580513b61053057600080fd5b60006000610484606063f217dfa761060052602435610620526105c0516106405280610660526101408080516020018084610620018284600060045af161057657600080fd5b50505061061c90506000610580515af161058f57600080fd5b6105e0516106005260243561062052337fd7eda976cf4919f13172eb15bb39c64cecb7172258c741dab31d14c855eff4026040610600a2005b632e1a7d4d8114156105de57336101405261060e565b62f714ce8114156106095760243560a01c156105f957600080fd5b602060246101403760005061060e565b610729565b61014051610160516001610180526101805160065801610d96565b6101e05261016052610140526101e0516101605260043561016051808202821582848304141761065857600080fd5b80905090509050670de0b6b3a764000080820490509050610180526001543b61068057600080fd5b600060006044639dc29fac6101a052336101c0526004356101e0526101bc60006001545af16106ae57600080fd5b6020610240604463a9059cbb6101a052610140516101c052610180516101e0526101bc60006002545af16106e157600080fd5b601f3d116106ee57600080fd5b600050610240506004356101a052610140517f7084f5476618d8e60b11ef0d7d3f06914655adb8793e28ff7f018d4c76d505d560206101a0a2005b63526e735f811415610b7657426007548082101561074657600080fd5b80820390509050610140526006543314156107715761012c610140511161076c57600080fd5b610782565b6101a4610140511161078257600080fd5b600254610160526020610220602463f5eb42dc6101a052306101c0526101bc610160515afa6107b057600080fd5b601f3d116107bd57600080fd5b60005061022051610180526008546101a05260006101c0526101a0516101805110151561084757610180516101a051808210156107f957600080fd5b80820390509050600a54808202821582848304141761081757600080fd5b80905090509050670de0b6b3a764000080820490509050600160ff1b811061083e57600080fd5b6101c0526108f2565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6101a051610180518082101561087d57600080fd5b80820390509050600a54808202821582848304141761089b57600080fd5b80905090509050670de0b6b3a764000080820490509050600160ff1b81106108c257600080fd5b808202600160ff1b82186108d557600080fd5b82158284830514176108e657600080fd5b809050905090506101c0525b602061028060246370a0823161020052306102205261021c610160515afa61091957600080fd5b601f3d1161092657600080fd5b600050610280516101e052600954600160ff1b811061094457600080fd5b6101c0518082018281126000831216838212156000841215161761096757600080fd5b80905090509050600081121561097c57600080fd5b61020052610180516008556101e0516009554260075560206102a06024637a28fb8861022052670de0b6b3a76400006102405261023c610160515afa6109c157600080fd5b601f3d116109ce57600080fd5b6000506102a051600a55610200516101e051111515610a25576000610220526000610240527f86116443bd63d647e9aa2e093f847ef30ee2a359ffcba4bdf4bb7eb0929cce8b6040610220a1600060005260206000f35b6101e0516102005180821015610a3a57600080fd5b808203905090506102205260035461024052600454610260526020610320604463a9059cbb61028052610260516102a052610220516102c05261029c6000610160515af1610a8757600080fd5b601f3d11610a9457600080fd5b6000506103205060206103206024632f8655686102a052610240516102c0526102bc6000610260515af1610ac757600080fd5b601f3d11610ad457600080fd5b6000506103205161028052610240513b610aed57600080fd5b6000600061048460606370a1ee1f6102e05260055461030052610280516103205280610340526040368261030001376102fc90506000610240515af1610b3257600080fd5b610220516102a052610280516102c0527f86116443bd63d647e9aa2e093f847ef30ee2a359ffcba4bdf4bb7eb0929cce8b60406102a0a16102805160005260206000f35b63f851a440811415610b8e5760005460005260206000f35b636efe832b811415610ba65760015460005260206000f35b63ed7245c8811415610bbe5760025460005260206000f35b6339c2175c811415610bd65760035460005260206000f35b6310f961b3811415610bee5760045460005260206000f35b63e592208d811415610c065760055460005260206000f35b63eb148d57811415610c1e5760065460005260206000f35b63c62fb68a811415610c365760075460005260206000f35b63dad4ed0e811415610c4e5760085460005260206000f35b631e001159811415610c665760095460005260206000f35b639d39ca03811415610c7e57600a5460005260206000f35b505b60006000fd5b61016052610140526101405160035561014051610180527f4187ca45b68bf3dcf85b4b0cbb5e547a5e494c46eb51db0c86a3333ffef0a4a06020610180a161016051565b61016052610140526101405160045561014051610180527f27bd3f3220b16491d1431b29c1ac94e051121c2215b2cc1d9b5103740ad574776020610180a161016051565b61016052610140526101405160065561014051610180527f9135c4106091e82c9b783570516eee90714441a0d39fcecdeb215f9ba3e635346020610180a161016051565b61016052610140526101405160055561014051610180527fd1f809e95b949f75a8f7f758b635614d6815fd1ce251b8f41b0a4609c3140ef16020610180a161016051565b6101605261014052602061022060246370a082316101a052306101c0526101bc6002545afa610dc457600080fd5b601f3d11610dd157600080fd5b6000506102205161018052602061022060046318160ddd6101c0526101dc6001545afa610dfd57600080fd5b601f3d11610e0a57600080fd5b600050610220516101a0526101a05161018051101515610e3d57670de0b6b3a76400006000526000516101605156610eff565b6101405115610e935761018051670de0b6b3a76400008082028215828483041417610e6757600080fd5b809050905090506101a0518080610e7d57600080fd5b8204905090506000526000516101605156610eff565b610180511515610eb657670de0b6b3a76400006000526000516101605156610eff565b6101a051670de0b6b3a76400008082028215828483041417610ed757600080fd5b80905090509050610180518080610eed57600080fd5b82049050905060005260005161016051565b005b6100e5610fe6036100e56000396100e5610fe6036000f3000000000000000000000000a60100d5e12e9f83c1b04997314cf11685a618ff000000000000000000000000d40eefcfab888c9159a61221def03bf77773fc1900000000000000000000000002139137fdd974181a49268d7b0ae888634e5469

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

000000000000000000000000a60100d5e12e9f83c1b04997314cf11685a618ff000000000000000000000000d40eefcfab888c9159a61221def03bf77773fc1900000000000000000000000002139137fdd974181a49268d7b0ae888634e5469

-----Decoded View---------------
Arg [0] : beth_token (address): 0xa60100d5e12e9f83c1b04997314cf11685a618ff
Arg [1] : steth_token (address): 0xd40eefcfab888c9159a61221def03bf77773fc19
Arg [2] : admin (address): 0x02139137fdd974181a49268d7b0ae888634e5469

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000a60100d5e12e9f83c1b04997314cf11685a618ff
Arg [1] : 000000000000000000000000d40eefcfab888c9159a61221def03bf77773fc19
Arg [2] : 00000000000000000000000002139137fdd974181a49268d7b0ae888634e5469


Block Transaction Difficulty Gas Used Reward
Block Uncle Number Difficulty Gas Used Reward
Loading

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.