Contract 0x382B995932683452C4103d4CB284aDDA38d9903d

Contract Overview

Balance:
0 Ether
Txn Hash
Method
Block
From
To
Value
0xd525e24f8c0307e40b969b55220708f612f0644d08065c51129344fc16a54576Petrify_impl122092412022-04-21 11:36:57160 days 20 hrs ago0x02139137fdd974181a49268d7b0ae888634e5469 IN  0x382b995932683452c4103d4cb284adda38d9903d0 Ether0.0130005300
0x0372887f7f60e1096bae861f7bb6c8300d48c28d7707612219c6c460f0aae1940x611b4a56122092392022-04-21 11:35:37160 days 20 hrs ago0x02139137fdd974181a49268d7b0ae888634e5469 IN  Create: Vyper_contract0 Ether0.4675815300
[ Download CSV Export 
Latest 8 internal transactions
Parent Txn Hash Block From To Value
0x4280ceb132d9cc4be441df546c157465558e36a369c6114c7b3c567c3b285575125520502022-07-08 16:04:4882 days 16 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0x97d208c7717d2715913606402e49afb3f2ae6d1932747fe8e5af5a4b831d7efe125231512022-07-04 11:01:1286 days 21 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0xb8b28c69f7b5e7eb7bc3d5c5531ecdfa5ddf9a9f016619be3e6bb7eb335f1a19122950022022-05-24 18:24:21127 days 14 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0x54d42706b7a9291f7aa091f2661e4a5ba78d38913ae65f1915148f0b18264ff7122108732022-04-22 9:34:59159 days 22 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0x4887c071bd52c1500563c29912c499ca81d46d5e91da4cd9e241f07eb18eae77122093982022-04-21 13:50:29160 days 18 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0xaa25e268dd4a7eb7cee90a92e7e235a24f015952f8061ccde316026d69418922122092472022-04-21 11:40:59160 days 20 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0xae1f7e8d7bfb7574f145013fe5377e98bb9b644abef7ca1846d896b8f05f360d122092452022-04-21 11:39:37160 days 20 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 Ether
0x6e333a95a9ab10e412c5a5709563afe58fac6930a2c3852d950f1cda5f6e7e98122092442022-04-21 11:38:07160 days 20 hrs ago 0xd7fe7881cd50fc155bc310224352a812214e1e50 0x382b995932683452c4103d4cb284adda38d9903d0 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 InsuranceConnector:
    def total_shares_burnt() -> uint256: view


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


interface Lido:
    def submit(referral: address) -> uint256: payable
    def totalSupply() -> uint256: view
    def getTotalShares() -> uint256: view
    def sharesOf(owner: address) -> uint256: view
    def getPooledEthByShares(shares_amount: uint256) -> uint256: view


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


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


event RewardsCollected:
    steth_amount: uint256
    ust_amount: uint256


event AdminChanged:
    new_admin: address


event EmergencyAdminChanged:
    new_emergency_admin: address


event BridgeConnectorUpdated:
    bridge_connector: address


event RewardsLiquidatorUpdated:
    rewards_liquidator: address


event InsuranceConnectorUpdated:
    insurance_connector: address


event LiquidationConfigUpdated:
    liquidations_admin: address
    no_liquidation_interval: uint256
    restricted_liquidation_interval: uint256


event AnchorRewardsDistributorUpdated:
    anchor_rewards_distributor: bytes32


event VersionIncremented:
    new_version: uint256


event OperationsStopped:
    pass


event OperationsResumed:
    pass


BETH_DECIMALS: constant(uint256) = 18

# A constant used in `_can_deposit_or_withdraw` when comparing Lido share prices.
#
# Due to integer rounding, Lido.getPooledEthByShares(10**18) may return slightly
# different numbers even if there were no oracle reports between two calls. This
# might happen if someone submits ETH before the second call. It can be mathematically
# proven that this difference won't be more than 10 wei given that Lido holds at least
# 0.1 ETH and the share price is of the same order of magnitude as the amount of ETH
# held. Both of these conditions are true if Lido operates normally—and if it doesn't,
# it's desirable for AnchorVault operations to be suspended. See:
#
# https://github.com/lidofinance/lido-dao/blob/eb33eb8/contracts/0.4.24/Lido.sol#L445
# https://github.com/lidofinance/lido-dao/blob/eb33eb8/contracts/0.4.24/StETH.sol#L288
#
STETH_SHARE_PRICE_MAX_ERROR: constant(uint256) = 10

# Aragon Agent contract of the Lido DAO
LIDO_DAO_AGENT: constant(address) = 0x02139137FdD974181a49268D7b0AE888634E5469

# WARNING: since this contract is behind a proxy, don't change the order of the variables
# and don't remove variables during the code upgrades. You can only append new variables
# to the end of the list.

admin: public(address)

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

liquidations_admin: public(address)
no_liquidation_interval: public(uint256)
restricted_liquidation_interval: public(uint256)

last_liquidation_time: public(uint256)
last_liquidation_share_price: public(uint256)
last_liquidation_shares_burnt: public(uint256)

# The contract version. Used to mark backwards-incompatible changes to the contract
# logic, including installing delegates with an incompatible API. Can be changed both
# in `_initialize_vX` after implementation code changes and by calling `bump_version`
# after installing a new delegate.
#
# The following functions revert unless the value of the `_expected_version` argument
# matches the one stored in this state variable:
#
# * `submit`
# * `withdraw`
#
# It's recommended for any external code interacting with this contract, both onchain
# and offchain, to have the current version set as a configurable parameter to make
# sure any incompatible change to the contract logic won't produce unexpected results,
# reverting the transactions instead until the compatibility is manually checked and
# the configured version is updated.
#
version: public(uint256)

emergency_admin: public(address)
operations_allowed: public(bool)

# this slot was used previously; make sure to reset the value if re-using
unused_do_not_remove: uint256


@internal
def _assert_version(_expected_version: uint256):
    assert _expected_version == self.version, "unexpected contract version"


@internal
def _assert_not_stopped():
    assert self.operations_allowed, "contract stopped"


@internal
def _assert_admin(addr: address):
    assert addr == self.admin # dev: unauthorized


@internal
def _assert_dao_governance(addr: address):
    assert addr == LIDO_DAO_AGENT # dev: unauthorized


@external
def initialize(beth_token: address, steth_token: address, admin: address, emergency_admin: address):
    assert self.beth_token == ZERO_ADDRESS # dev: already initialized
    assert self.version == 0 # dev: already initialized

    assert beth_token != ZERO_ADDRESS # dev: invalid bETH address
    assert steth_token != ZERO_ADDRESS # dev: invalid stETH address

    # assert ERC20(beth_token).totalSupply() == 0 # dev: non-zero bETH total supply

    self.beth_token = beth_token
    self.steth_token = steth_token
    # we're explicitly allowing zero admin address for ossification
    self.admin = admin
    self.last_liquidation_share_price = Lido(steth_token).getPooledEthByShares(10**18)
    self.emergency_admin = emergency_admin
    self.version = 3

    log AdminChanged(admin)
    log EmergencyAdminChanged(emergency_admin)
    log VersionIncremented(3)


@external
def petrify_impl():
    """
    @dev Prevents initialization of an implementation sitting behind a proxy.
    """
    assert self.version == 0 # dev: already initialized
    self.version = MAX_UINT256


@external
def emergency_stop():
    """
    @dev Performs emergency stop of the contract. Can only be called
    by the current emergency admin or by the current admin.

    While contract is in the stopped state, the following functions revert:

    * `submit`
    * `withdraw`
    * `collect_rewards`

    See `resume`, `set_emergency_admin`.
    """
    assert msg.sender == self.emergency_admin or msg.sender == self.admin # dev: unauthorized
    self._assert_not_stopped()
    self.operations_allowed = False
    log OperationsStopped()


@external
def resume():
    """
    @dev Resumes normal operations of the contract. Can only be called
    by the Lido DAO governance contract.

    See `emergency_stop`.
    """
    self._assert_dao_governance(msg.sender)
    assert not self.operations_allowed # dev: not stopped
    self.operations_allowed = True
    log OperationsResumed()


@external
def change_admin(new_admin: address):
    """
    @dev Changes the admin address. Can only be called by the current admin address.

    Setting the admin to zero ossifies the contract, i.e. makes it irreversibly non-administrable.
    """
    self._assert_admin(msg.sender)
    # we're explicitly allowing zero admin address for ossification
    self.admin = new_admin
    log AdminChanged(new_admin)


@external
def set_emergency_admin(new_emergency_admin: address):
    """
    @dev Sets the address allowed to perform an emergency stop and having no other privileges.

    Can only be called by the Lido DAO governance contract.

    See `emergency_stop`, `resume`.
    """
    self._assert_dao_governance(msg.sender)
    # we're explicitly allowing zero address
    self.emergency_admin = new_emergency_admin
    log EmergencyAdminChanged(new_emergency_admin)


@external
def bump_version():
    """
    @dev Increments contract version. Can only be called by the current admin address.

    Due to the usage of replaceable delegates, contract version cannot be compiled to
    the AnchorVault implementation as a constant. Instead, the governance should call
    this function when backwards-incompatible changes are made to the contract or its
    delegates.
    """
    self._assert_admin(msg.sender)
    new_version: uint256 = self.version + 1
    self.version = new_version
    log VersionIncremented(new_version)


@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):
    """
    @dev Sets the bridge connector contract: an adapter contract for communicating
         with the Terra bridge.

    Can only be called by the current admin address.
    """
    self._assert_admin(msg.sender)
    self._set_bridge_connector(_bridge_connector)


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


@external
def set_rewards_liquidator(_rewards_liquidator: address):
    """
    @dev Sets the rewards liquidator contract: a contract for selling stETH rewards to UST.

    Can only be called by the current admin address.
    """
    self._assert_admin(msg.sender)
    self._set_rewards_liquidator(_rewards_liquidator)


@internal
def _set_insurance_connector(_insurance_connector: address):
    self.insurance_connector = _insurance_connector
    log InsuranceConnectorUpdated(_insurance_connector)


@external
def set_insurance_connector(_insurance_connector: address):
    """
    @dev Sets the insurance connector contract: a contract for obtaining the total number of
         shares burnt for the purpose of insurance/cover application from the Lido protocol.

    Can only be called by the current admin address.
    """
    self._assert_admin(msg.sender)
    self._set_insurance_connector(_insurance_connector)


@internal
def _set_liquidation_config(
    _liquidations_admin: address,
    _no_liquidation_interval: uint256,
    _restricted_liquidation_interval: uint256
):
    assert _restricted_liquidation_interval >= _no_liquidation_interval

    self.liquidations_admin = _liquidations_admin
    self.no_liquidation_interval = _no_liquidation_interval
    self.restricted_liquidation_interval = _restricted_liquidation_interval

    log LiquidationConfigUpdated(
        _liquidations_admin,
        _no_liquidation_interval,
        _restricted_liquidation_interval
    )


@external
def set_liquidation_config(
    _liquidations_admin: address,
    _no_liquidation_interval: uint256,
    _restricted_liquidation_interval: uint256,
):
    """
    @dev Sets the liquidation config consisting of liquidation admin, the address that is allowed
         to sell stETH rewards to UST during after the no-liquidation interval ends and before
         the restricted liquidation interval ends, as well as both intervals.

    Can only be called by the current admin address.
    """
    self._assert_admin(msg.sender)
    self._set_liquidation_config(
        _liquidations_admin,
        _no_liquidation_interval,
        _restricted_liquidation_interval
    )


@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):
    """
    @dev Sets the Terra-side UST rewards distributor contract allowing Terra-side bETH holders
         to claim their staking rewards in the UST form.

    Can only be called by the current admin address.
    """
    self._assert_admin(msg.sender)
    self._set_anchor_rewards_distributor(_anchor_rewards_distributor)


@external
def configure(
    _bridge_connector: address,
    _rewards_liquidator: address,
    _insurance_connector: address,
    _liquidations_admin: address,
    _no_liquidation_interval: uint256,
    _restricted_liquidation_interval: uint256,
    _anchor_rewards_distributor: bytes32,
):
    """
    @dev A shortcut function for setting all admin-configurable settings at once.

    Can only be called by the current admin address.
    """
    self._assert_admin(msg.sender)
    self._set_bridge_connector(_bridge_connector)
    self._set_rewards_liquidator(_rewards_liquidator)
    self._set_insurance_connector(_insurance_connector)
    self._set_liquidation_config(
        _liquidations_admin,
        _no_liquidation_interval,
        _restricted_liquidation_interval
    )
    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.

    This rate is normally 10**18 (1:1) but might be different after severe penalties inflicted
    on the Lido validators.
    """
    return self._get_rate(False)


@pure
@internal
def _diff_abs(new: uint256, old: uint256) -> uint256:
    if new > old :
        return new - old
    else:
        return old - new


@view
@internal
def _can_deposit_or_withdraw() -> bool:
    share_price: uint256 = Lido(self.steth_token).getPooledEthByShares(10**18)
    return self._diff_abs(share_price, self.last_liquidation_share_price) <= STETH_SHARE_PRICE_MAX_ERROR


@view
@external
def can_deposit_or_withdraw() -> bool:
    """
    @dev Whether deposits and withdrawals are enabled.

    Deposits and withdrawals are disabled if stETH token has rebased (e.g. Lido
    oracle reported Beacon chain rewards/penalties or insurance was applied) but
    vault rewards accrued since the last rewards sell operation are not sold to
    UST yet. Normally, this period should not last more than a couple of minutes
    each 24h.
    """
    return self.operations_allowed and self._can_deposit_or_withdraw()


@external
@payable
def submit(
    _amount: uint256,
    _terra_address: bytes32,
    _extra_data: Bytes[1024],
    _expected_version: uint256
) -> (uint256, uint256):
    """
    @dev Locks the `_amount` of provided ETH or stETH tokens in return for bETH tokens
         minted to the `_terra_address` address on the Terra blockchain.

    When ETH is provided, it will be deposited to Lido and converted to stETH first.
    In this case, transaction value must be the same as `_amount` argument.

    To provide stETH, set the transavtion value to zero and approve this contract for spending
    the `_amount` of stETH on your behalf.

    The call fails if `AnchorVault.can_deposit_or_withdraw()` is false.

    The conversion rate from stETH to bETH should normally be 1 but might be different after
    severe penalties inflicted on the Lido validators. You can obtain the current conversion
    rate by calling `AnchorVault.get_rate()`.
    """
    self._assert_not_stopped()
    self._assert_version(_expected_version)
    assert self._can_deposit_or_withdraw() # dev: share price changed

    steth_token: address = self.steth_token
    steth_amount: uint256 = _amount

    if msg.value != 0:
        assert msg.value == _amount # dev: unexpected ETH amount sent
        shares_minted: uint256 = Lido(steth_token).submit(self, value=_amount)
        steth_amount = Lido(steth_token).getPooledEthByShares(shares_minted)

    connector: address = self.bridge_connector

    beth_rate: uint256 = self._get_rate(False)
    beth_amount: uint256 = (steth_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 <= steth_amount # dev: invalid adjusted amount

    if msg.value == 0:
        ERC20(steth_token).transferFrom(msg.sender, self, steth_amount_adj)
    elif steth_amount_adj < steth_amount:
        ERC20(steth_token).transfer(msg.sender, steth_amount - 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, beth_amount)

    return (steth_amount_adj, beth_amount)


@external
def withdraw(
    _beth_amount: uint256,
    _expected_version: uint256,
    _recipient: address = msg.sender
) -> uint256:
    """
    @dev Burns the `_beth_amount` of provided Ethereum-side bETH tokens in return for stETH
         tokens transferred to the `_recipient` Ethereum address.

    To withdraw Terra-side bETH, you should firstly transfer the tokens to the Ethereum
    blockchain.

    The call fails if `AnchorVault.can_deposit_or_withdraw()` returns false.

    The conversion rate from stETH to bETH should normally be 1 but might be different after
    severe penalties inflicted on the Lido validators. You can obtain the current conversion
    rate by calling `AnchorVault.get_rate()`.
    """
    self._assert_not_stopped()
    self._assert_version(_expected_version)
    assert self._can_deposit_or_withdraw() # dev: share price changed

    steth_rate: uint256 = self._get_rate(True)
    steth_amount: uint256 = (_beth_amount * steth_rate) / 10**18

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

    log Withdrawn(_recipient, _beth_amount, steth_amount)

    return steth_amount


@external
def collect_rewards() -> uint256:
    """
    @dev Sells stETH rewards and transfers them to the distributor contract in the
         Terra blockchain.
    """
    self._assert_not_stopped()

    time_since_last_liquidation: uint256 = block.timestamp - self.last_liquidation_time

    if msg.sender == self.liquidations_admin:
        assert time_since_last_liquidation > self.no_liquidation_interval # dev: too early to sell
    else:
        assert time_since_last_liquidation > self.restricted_liquidation_interval # dev: too early to sell

    # The code below sells all rewards accrued by stETH held in the vault to UST
    # and forwards the outcome to the rewards distributor contract in Terra.
    #
    # To calculate the amount of rewards, we need to take the amount of stETH shares
    # the vault holds and determine how these shares' price increased since the last
    # rewards sell operation. We know that each shares that was transferred to the
    # vault since then was worth the same amount of stETH because the vault reverts
    # any deposits and withdrawals if the current share price is different from the
    # one actual at the last rewards sell time (see `can_deposit_or_withdraw` fn).
    #
    # When calculating the difference in share price, we need to account for possible
    # insurance applications that might have occured since the last rewards sell operation.
    # Insurance is applied by burning stETH shares, and the resulting price increase of
    # a single share shouldn't be considered as rewards and should recover bETH/stETH
    # peg instead:
    #
    # rewards = vault_shares_bal * (new_share_price - prev_share_price)
    #
    # new_share_price = new_total_ether / new_total_shares
    # new_total_ether = prev_total_ether + d_ether_io + d_rewards
    # new_total_shares = prev_total_shares + d_shares_io - d_shares_insurance_burnt
    #
    # rewards_corrected = vault_shares_bal * (new_share_price_corrected - prev_share_price)
    # new_share_price_corrected = new_total_ether / new_total_shares_corrected
    # new_total_shares_corrected = prev_total_shares + d_shares_io
    # new_share_price_corrected = new_total_ether / (new_total_shares + d_shares_insurance_burnt)

    steth_token: address = self.steth_token
    total_pooled_eth: uint256 = Lido(steth_token).totalSupply()
    total_shares: uint256 = Lido(steth_token).getTotalShares()

    share_price: uint256 = (10**18 * total_pooled_eth) / total_shares
    shares_burnt: uint256 = InsuranceConnector(self.insurance_connector).total_shares_burnt()

    prev_share_price: uint256 = self.last_liquidation_share_price
    prev_shares_burnt: uint256 = self.last_liquidation_shares_burnt

    self.last_liquidation_time = block.timestamp
    self.last_liquidation_share_price = share_price
    self.last_liquidation_shares_burnt = shares_burnt

    shares_burnt_since: uint256 = shares_burnt - prev_shares_burnt
    share_price_corrected: uint256 = (10**18 * total_pooled_eth) / (total_shares + shares_burnt_since)
    shares_balance: uint256 = Lido(steth_token).sharesOf(self)

    if share_price_corrected <= prev_share_price or shares_balance == 0:
        log RewardsCollected(0, 0)
        return 0

    steth_to_sell: uint256 = shares_balance * (share_price_corrected - prev_share_price) / 10**18

    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},{"name":"beth_amount_received","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"Withdrawn","inputs":[{"name":"recipient","type":"address","indexed":true},{"name":"amount","type":"uint256","indexed":false},{"name":"steth_amount_received","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":"EmergencyAdminChanged","inputs":[{"name":"new_emergency_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":"InsuranceConnectorUpdated","inputs":[{"name":"insurance_connector","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"LiquidationConfigUpdated","inputs":[{"name":"liquidations_admin","type":"address","indexed":false},{"name":"no_liquidation_interval","type":"uint256","indexed":false},{"name":"restricted_liquidation_interval","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"AnchorRewardsDistributorUpdated","inputs":[{"name":"anchor_rewards_distributor","type":"bytes32","indexed":false}],"anonymous":false,"type":"event"},{"name":"VersionIncremented","inputs":[{"name":"new_version","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"OperationsStopped","inputs":[],"anonymous":false,"type":"event"},{"name":"OperationsResumed","inputs":[],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"function","name":"initialize","inputs":[{"name":"beth_token","type":"address"},{"name":"steth_token","type":"address"},{"name":"admin","type":"address"},{"name":"emergency_admin","type":"address"}],"outputs":[],"gas":221704},{"stateMutability":"nonpayable","type":"function","name":"petrify_impl","inputs":[],"outputs":[],"gas":37470},{"stateMutability":"nonpayable","type":"function","name":"emergency_stop","inputs":[],"outputs":[],"gas":27928},{"stateMutability":"nonpayable","type":"function","name":"resume","inputs":[],"outputs":[],"gas":38745},{"stateMutability":"nonpayable","type":"function","name":"change_admin","inputs":[{"name":"new_admin","type":"address"}],"outputs":[],"gas":39375},{"stateMutability":"nonpayable","type":"function","name":"set_emergency_admin","inputs":[{"name":"new_emergency_admin","type":"address"}],"outputs":[],"gas":37305},{"stateMutability":"nonpayable","type":"function","name":"bump_version","inputs":[],"outputs":[],"gas":41617},{"stateMutability":"nonpayable","type":"function","name":"set_bridge_connector","inputs":[{"name":"_bridge_connector","type":"address"}],"outputs":[],"gas":40092},{"stateMutability":"nonpayable","type":"function","name":"set_rewards_liquidator","inputs":[{"name":"_rewards_liquidator","type":"address"}],"outputs":[],"gas":40152},{"stateMutability":"nonpayable","type":"function","name":"set_insurance_connector","inputs":[{"name":"_insurance_connector","type":"address"}],"outputs":[],"gas":40212},{"stateMutability":"nonpayable","type":"function","name":"set_liquidation_config","inputs":[{"name":"_liquidations_admin","type":"address"},{"name":"_no_liquidation_interval","type":"uint256"},{"name":"_restricted_liquidation_interval","type":"uint256"}],"outputs":[],"gas":111639},{"stateMutability":"nonpayable","type":"function","name":"set_anchor_rewards_distributor","inputs":[{"name":"_anchor_rewards_distributor","type":"bytes32"}],"outputs":[],"gas":40232},{"stateMutability":"nonpayable","type":"function","name":"configure","inputs":[{"name":"_bridge_connector","type":"address"},{"name":"_rewards_liquidator","type":"address"},{"name":"_insurance_connector","type":"address"},{"name":"_liquidations_admin","type":"address"},{"name":"_no_liquidation_interval","type":"uint256"},{"name":"_restricted_liquidation_interval","type":"uint256"},{"name":"_anchor_rewards_distributor","type":"bytes32"}],"outputs":[],"gas":260141},{"stateMutability":"view","type":"function","name":"get_rate","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":10960},{"stateMutability":"view","type":"function","name":"can_deposit_or_withdraw","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":12394},{"stateMutability":"payable","type":"function","name":"submit","inputs":[{"name":"_amount","type":"uint256"},{"name":"_terra_address","type":"bytes32"},{"name":"_extra_data","type":"bytes"},{"name":"_expected_version","type":"uint256"}],"outputs":[{"name":"","type":"uint256"},{"name":"","type":"uint256"}],"gas":96446},{"stateMutability":"nonpayable","type":"function","name":"withdraw","inputs":[{"name":"_beth_amount","type":"uint256"},{"name":"_expected_version","type":"uint256"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"withdraw","inputs":[{"name":"_beth_amount","type":"uint256"},{"name":"_expected_version","type":"uint256"},{"name":"_recipient","type":"address"}],"outputs":[{"name":"","type":"uint256"}]},{"stateMutability":"nonpayable","type":"function","name":"collect_rewards","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":154715},{"stateMutability":"view","type":"function","name":"admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2928},{"stateMutability":"view","type":"function","name":"beth_token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2958},{"stateMutability":"view","type":"function","name":"steth_token","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2988},{"stateMutability":"view","type":"function","name":"bridge_connector","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3018},{"stateMutability":"view","type":"function","name":"rewards_liquidator","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3048},{"stateMutability":"view","type":"function","name":"insurance_connector","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3078},{"stateMutability":"view","type":"function","name":"anchor_rewards_distributor","inputs":[],"outputs":[{"name":"","type":"bytes32"}],"gas":3108},{"stateMutability":"view","type":"function","name":"liquidations_admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3138},{"stateMutability":"view","type":"function","name":"no_liquidation_interval","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3168},{"stateMutability":"view","type":"function","name":"restricted_liquidation_interval","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3198},{"stateMutability":"view","type":"function","name":"last_liquidation_time","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3228},{"stateMutability":"view","type":"function","name":"last_liquidation_share_price","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3258},{"stateMutability":"view","type":"function","name":"last_liquidation_shares_burnt","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3288},{"stateMutability":"view","type":"function","name":"version","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":3318},{"stateMutability":"view","type":"function","name":"emergency_admin","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":3348},{"stateMutability":"view","type":"function","name":"operations_allowed","inputs":[],"outputs":[{"name":"","type":"bool"}],"gas":3378}]

611b4a56600436101561000d5761163d565b600035601c526000516316bf60c181141561084b576104206044356004016101403761040060443560040135111561004457600080fd5b6101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610280516102a0516102c0516102e05161030051610320516103405161036051610380516103a0516103c0516103e05161040051610420516104405161046051610480516104a0516104c0516104e05161050051610520516105405161056051600658016116a4565b610560526105405261052052610500526104e0526104c0526104a05261048052610460526104405261042052610400526103e0526103c0526103a05261038052610360526103405261032052610300526102e0526102c0526102a05261028052610260526102405261022052610200526101e0526101c0526101a0526101805261016052610140526000506101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610280516102a0516102c0516102e05161030051610320516103405161036051610380516103a0516103c0516103e05161040051610420516104405161046051610480516104a0516104c0516104e05161050051610520516105405161056051606435610580526105805160065801611643565b610560526105405261052052610500526104e0526104c0526104a05261048052610460526104405261042052610400526103e0526103c0526103a05261038052610360526103405261032052610300526102e0526102c0526102a05261028052610260526102405261022052610200526101e0526101c0526101a0526101805261016052610140526000506101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610280516102a0516102c0516102e05161030051610320516103405161036051610380516103a0516103c0516103e05161040051610420516104405161046051610480516104a0516104c0516104e0516105005161052051610540516105605160065801611ab4565b61058052610560526105405261052052610500526104e0526104c0526104a05261048052610460526104405261042052610400526103e0526103c0526103a05261038052610360526103405261032052610300526102e0526102c0526102a05261028052610260526102405261022052610200526101e0526101c0526101a052610180526101605261014052610580516103b157600080fd5b600254610580526004356105a052600034181561045b5760043534146103d657600080fd5b6020610660602463a1903eab6105e05230610600526105fc600435610580515af161040057600080fd5b601f3d1161040d57600080fd5b600050610660516105c05260206106606024637a28fb886105e0526105c051610600526105fc610580515afa61044257600080fd5b601f3d1161044f57600080fd5b600050610660516105a0525b6003546105c0526101405161016051610180516101a0516101c0516101e05161020051610220516102405161026051610280516102a0516102c0516102e05161030051610320516103405161036051610380516103a0516103c0516103e05161040051610420516104405161046051610480516104a0516104c0516104e05161050051610520516105405161056051610580516105a0516105c0516105e05160006106005261060051600658016118d9565b610660526105e0526105c0526105a05261058052610560526105405261052052610500526104e0526104c0526104a05261048052610460526104405261042052610400526103e0526103c0526103a05261038052610360526103405261032052610300526102e0526102c0526102a05261028052610260526102405261022052610200526101e0526101c0526101a052610180526101605261014052610660516105e0526105a0516105e05180820282158284830414176105cd57600080fd5b80905090509050670de0b6b3a7640000808204905090506106005260206106c0604463d775b5f261062052610600516106405260126106605261063c6105c0515afa61061857600080fd5b601f3d1161062557600080fd5b6000506106c0516106005261060051670de0b6b3a7640000808202821582848304141761065157600080fd5b809050905090506105e051808061066757600080fd5b820490509050610620526105a05161062051111561068457600080fd5b3415156106da57602061070060646323b872dd6106405233610660523061068052610620516106a05261065c6000610580515af16106c157600080fd5b601f3d116106ce57600080fd5b60005061070050610746565b6105a0516106205110156107465760206106e0604463a9059cbb6106405233610660526105a051610620518082101561071257600080fd5b808203905090506106805261065c6000610580515af161073157600080fd5b601f3d1161073e57600080fd5b6000506106e0505b6001543b61075357600080fd5b6000600060446340c10f19610640526105c05161066052610600516106805261065c60006001545af161078557600080fd5b6105c0513b61079357600080fd5b60006000610484606063f217dfa761064052602435610660526106005161068052806106a0526101408080516020018084610660018284600060045af16107d957600080fd5b50505061065c905060006105c0515af16107f257600080fd5b6106205161064052602435610660526106005161068052337f4eef3d1efb11f00508d9b7bb632ddcfa6da9d7105bd39f404bdd7362e6c59dbc6060610640a2610680610620518152610600518160200152506040610680f35b341561085657600080fd5b63f8c8765e8114156109c75760043560a01c1561087257600080fd5b60243560a01c1561088257600080fd5b60443560a01c1561089257600080fd5b60643560a01c156108a257600080fd5b600154156108af57600080fd5b600d54156108bc57600080fd5b6000600435186108cb57600080fd5b6000602435186108da57600080fd5b60043560015560243560025560443560005560206101c06024637a28fb8861014052670de0b6b3a76400006101605261015c6024355afa61091a57600080fd5b601f3d1161092757600080fd5b6000506101c051600b55606435600e556003600d55604435610140527f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c6020610140a1606435610140527fd3c7e5e6273b3cc3b9600955b3410a3ae332289b94214bbcfc86917b964788986020610140a16003610140527ff73acc556a1d660743d2620891cf4da23bb8ef34b2dea9987e7e10b8f3fdbe6f6020610140a1005b639161b226811415610a0657600d54156109e057600080fd5b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff600d55005b63b1d1f2b9811415610a6b57600e54331415610a23576001610a29565b60005433145b610a3257600080fd5b600658016116a4565b6000506000600f557f32e75a3e90c56add4ff50566ccb325e0ff7c6a12624569042cc6b088e430cb4d60006000a1005b63046f7da2811415610ac6573361014052610140516006580161171b565b600050600f5415610a9957600080fd5b6001600f557fce33decda06914c187ad6ac1fe22aea60b979d15269474e726bc1db8e0db308b60006000a1005b63158686b5811415610b2d5760043560a01c15610ae257600080fd5b336101405261014051600658016116fc565b600050600435600055600435610140527f7ce7ec0b50378fb6c0186ffb5f48325f6593fcb4ca4386f21861af3129188f5c6020610140a1005b6380b6d802811415610b945760043560a01c15610b4957600080fd5b3361014052610140516006580161171b565b600050600435600e55600435610140527fd3c7e5e6273b3cc3b9600955b3410a3ae332289b94214bbcfc86917b964788986020610140a1005b63808c6803811415610c0c57336101405261014051600658016116fc565b600050600d546001818183011015610bc957600080fd5b808201905090506101405261014051600d5561014051610160527ff73acc556a1d660743d2620891cf4da23bb8ef34b2dea9987e7e10b8f3fdbe6f6020610160a1005b6358e46d89811415610c565760043560a01c15610c2857600080fd5b336101405261014051600658016116fc565b60005060043561014052610140516006580161174c565b600050005b63fb9fa0e4811415610ca05760043560a01c15610c7257600080fd5b336101405261014051600658016116fc565b600050600435610140526101405160065801611790565b600050005b63622a25d6811415610cea5760043560a01c15610cbc57600080fd5b336101405261014051600658016116fc565b6000506004356101405261014051600658016117d4565b600050005b63925d6d6c811415610d4a5760043560a01c15610d0657600080fd5b336101405261014051600658016116fc565b60005060043561014052602435610160526044356101805261018051610160516101405160065801611818565b600050005b6353cade02811415610d8457336101405261014051600658016116fc565b600050600435610140526101405160065801611895565b600050005b633404d394811415610e705760043560a01c15610da057600080fd5b60243560a01c15610db057600080fd5b60443560a01c15610dc057600080fd5b60643560a01c15610dd057600080fd5b336101405261014051600658016116fc565b60005060043561014052610140516006580161174c565b600050602435610140526101405160065801611790565b6000506044356101405261014051600658016117d4565b600050606435610140526084356101605260a4356101805261018051610160516101405160065801611818565b60005060c435610140526101405160065801611895565b600050005b63533178e5811415610ea05760006101405261014051600658016118d9565b6101a0526101a05160005260206000f35b63263c1a78811415610ede57600f5415610ed2576101405160065801611ab4565b610160526101405261016051610ed5565b60005b60005260206000f35b63441a3e70811415610ef4573361014052610f25565b630ad58d2f811415610f205760443560a01c15610f1057600080fd5b6020604461014037600050610f25565b6110a8565b61014051600658016116a4565b6101405260005061014051602435610160526101605160065801611643565b610140526000506101405160065801611ab4565b610160526101405261016051610f7a57600080fd5b610140516101605160016101805261018051600658016118d9565b6101e05261016052610140526101e05161016052600435610160518082028215828483041417610fc457600080fd5b80905090509050670de0b6b3a764000080820490509050610180526001543b610fec57600080fd5b600060006044639dc29fac6101a052336101c0526004356101e0526101bc60006001545af161101a57600080fd5b6020610240604463a9059cbb6101a052610140516101c052610180516101e0526101bc60006002545af161104d57600080fd5b601f3d1161105a57600080fd5b600050610240506004356101a052610180516101c052610140517f92ccf450a286a957af52509bc1c9939d1a6a481783e142e41e2499f0bb66ebc660406101a0a26101805160005260206000f35b63526e735f8114156114bb57600658016116a4565b60005042600a54808210156110d157600080fd5b80820390509050610140526007543314156110fc5760085461014051116110f757600080fd5b61110d565b600954610140511161110d57600080fd5b60025461016052602061020060046318160ddd6101a0526101bc610160515afa61113657600080fd5b601f3d1161114357600080fd5b60005061020051610180526020610220600463d5002f2e6101c0526101dc610160515afa61117057600080fd5b601f3d1161117d57600080fd5b600050610220516101a052670de0b6b3a76400006101805180820282158284830414176111a957600080fd5b809050905090506101a05180806111bf57600080fd5b8204905090506101c0526020610260600463d2dce03d6102005261021c6005545afa6111ea57600080fd5b601f3d116111f757600080fd5b600050610260516101e052600b5461020052600c546102205242600a556101c051600b556101e051600c556101e051610220518082101561123757600080fd5b8082039050905061024052670de0b6b3a764000061018051808202821582848304141761126357600080fd5b809050905090506101a0516102405181818301101561128157600080fd5b80820190509050808061129357600080fd5b820490509050610260526020610320602463f5eb42dc6102a052306102c0526102bc610160515afa6112c457600080fd5b601f3d116112d157600080fd5b600050610320516102805261020051610260511115156112f25760016112f8565b61028051155b1561133b5760006102a05260006102c0527f86116443bd63d647e9aa2e093f847ef30ee2a359ffcba4bdf4bb7eb0929cce8b60406102a0a1600060005260206000f35b6102805161026051610200518082101561135457600080fd5b80820390509050808202821582848304141761136f57600080fd5b80905090509050670de0b6b3a7640000808204905090506102a0526003546102c0526004546102e05260206103a0604463a9059cbb610300526102e051610320526102a0516103405261031c6000610160515af16113cc57600080fd5b601f3d116113d957600080fd5b6000506103a05060206103a06024632f865568610320526102c0516103405261033c60006102e0515af161140c57600080fd5b601f3d1161141957600080fd5b6000506103a051610300526102c0513b61143257600080fd5b6000600061048460606370a1ee1f6103605260065461038052610300516103a052806103c05260403682610380013761037c905060006102c0515af161147757600080fd5b6102a0516103205261030051610340527f86116443bd63d647e9aa2e093f847ef30ee2a359ffcba4bdf4bb7eb0929cce8b6040610320a16103005160005260206000f35b63f851a4408114156114d35760005460005260206000f35b636efe832b8114156114eb5760015460005260206000f35b63ed7245c88114156115035760025460005260206000f35b6339c2175c81141561151b5760035460005260206000f35b6310f961b38114156115335760045460005260206000f35b633a4d42bb81141561154b5760055460005260206000f35b63e592208d8114156115635760065460005260206000f35b63eb148d5781141561157b5760075460005260206000f35b63568d13d78114156115935760085460005260206000f35b6364d43a828114156115ab5760095460005260206000f35b63c62fb68a8114156115c357600a5460005260206000f35b63a6fca03e8114156115db57600b5460005260206000f35b6348f3b77a8114156115f357600c5460005260206000f35b6354fd4d5081141561160b57600d5460005260206000f35b63680c778381141561162357600e5460005260206000f35b63a26747b081141561163b57600f5460005260206000f35b505b60006000fd5b6101605261014052600d546101405114151561169e576308c379a06101805260206101a052601b6101c0527f756e657870656374656420636f6e74726163742076657273696f6e00000000006101e0526101c050606461019cfd5b61016051565b61014052600f5415156116f6576308c379a06101605260206101805260106101a0527f636f6e74726163742073746f70706564000000000000000000000000000000006101c0526101a050606461017cfd5b61014051565b6101605261014052600054610140511461171557600080fd5b61016051565b61016052610140527302139137fdd974181a49268d7b0ae888634e5469610140511461174657600080fd5b61016051565b61016052610140526101405160035561014051610180527f4187ca45b68bf3dcf85b4b0cbb5e547a5e494c46eb51db0c86a3333ffef0a4a06020610180a161016051565b61016052610140526101405160045561014051610180527f27bd3f3220b16491d1431b29c1ac94e051121c2215b2cc1d9b5103740ad574776020610180a161016051565b61016052610140526101405160055561014051610180527fad18220a832c13ada5be2c453853f842358b52dcfc19194df59686ad09c1cc306020610180a161016051565b6101a0526101405261016052610180526101605161018051101561183b57600080fd5b610140516007556101605160085561018051600955610140516101c052610160516101e05261018051610200527fd1210ad6cf9390e75738392c65c12d6c4cce7b5a2f573faaa1668d81b8d970f960606101c0a16101a051565b61016052610140526101405160065561014051610180527fd1f809e95b949f75a8f7f758b635614d6815fd1ce251b8f41b0a4609c3140ef16020610180a161016051565b6101605261014052602061022060246370a082316101a052306101c0526101bc6002545afa61190757600080fd5b601f3d1161191457600080fd5b6000506102205161018052602061022060046318160ddd6101c0526101dc6001545afa61194057600080fd5b601f3d1161194d57600080fd5b600050610220516101a0526101a0516101805110151561198057670de0b6b3a76400006000526000516101605156611a42565b61014051156119d65761018051670de0b6b3a764000080820282158284830414176119aa57600080fd5b809050905090506101a05180806119c057600080fd5b8204905090506000526000516101605156611a42565b6101805115156119f957670de0b6b3a76400006000526000516101605156611a42565b6101a051670de0b6b3a76400008082028215828483041417611a1a57600080fd5b80905090509050610180518080611a3057600080fd5b82049050905060005260005161016051565b005b61018052610140526101605261016051610140511115611a8a57610140516101605180821015611a7357600080fd5b808203905090506000526000516101805156611ab2565b610160516101405180821015611a9f57600080fd5b8082039050905060005260005161018051565b005b6101405260206102006024637a28fb8861018052670de0b6b3a76400006101a05261019c6002545afa611ae657600080fd5b601f3d11611af357600080fd5b6000506102005161016052600a61014051610160516101605161018052600b546101a0526101a0516101805160065801611a44565b61020052610160526101405261020051111560005260005161014051565b610004611b4a03610004600039610004611b4a036000f3

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.