Holesky Testnet

Contract

0x7c94b2A7CF101548B7F28396e789528F4DBD25CE

Overview

ETH Balance

0 ETH

Multichain Info

N/A
Transaction Hash
Method
Block
From
To

There are no matching entries

Please try again later

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Voting Adapter

Compiler Version
vyper:0.3.7

Optimization Enabled:
N/A

Other Settings:
default evmVersion, GNU GPLv3 license

Contract Source Code (Vyper language format)

# @version 0.3.7

"""
@title Voting Adapter
@author Lido Finance
@license GPL-3.0
@notice Used to allow voting with tokens under vesting
"""

from vyper.interfaces import ERC20


interface IDelegation:
    def setDelegate(
        _id: bytes32,
        _delegate: address,
    ): nonpayable


interface IVoting:
    def vote(
        _voteId: uint256,
        _supports: bool,
        _executesIfDecided_deprecated: bool,
    ): nonpayable
    def assignDelegate(
        _delegate: address,
    ): nonpayable
    def unassignDelegate(): nonpayable

event ERC20Recovered:
    token: address
    amount: uint256


event ETHRecovered:
    amount: uint256


event OwnerChanged:
    owner: address


VOTING_CONTRACT_ADDR: immutable(address)
SNAPSHOT_DELEGATE_CONTRACT_ADDR: immutable(address)

owner: public(address)


@external
def __init__(
    voting_addr: address,
    snapshot_delegate_addr: address,
    owner: address,
):
    """
    @notice Initialize source contract implementation.
    @param voting_addr Address of the Voting contract
    @param snapshot_delegate_addr Address of the Shapshot Delegate contract
    @param owner Address to recover tokens and ether to
    """
    assert owner != empty(address), "zero owner"
    assert voting_addr != empty(address), "zero voting_addr"
    assert snapshot_delegate_addr != empty(
        address
    ), "zero snapshot_delegate_addr"
    self.owner = owner
    VOTING_CONTRACT_ADDR = voting_addr
    SNAPSHOT_DELEGATE_CONTRACT_ADDR = snapshot_delegate_addr


@external
@view
def encode_aragon_vote_calldata(voteId: uint256, supports: bool) -> Bytes[1000]:
    """
    @notice Encode calldata for use in VestingEscrow. Returns type is Bytes[1000] to be compatible with up to 30 args
    @param voteId Id of the vote
    @param supports Support flag true - yea, false - nay
    """
    return _abi_encode(voteId, supports)


@external
def aragon_vote(abi_encoded_params: Bytes[1000]):
    """
    @notice Cast vote on Aragon voting
    @param abi_encoded_params Abi encoded data for call. Can be obtained from encode_aragon_vote_calldata
    """
    vote_id: uint256 = empty(uint256)
    supports: bool = empty(bool)
    vote_id, supports = _abi_decode(abi_encoded_params, (uint256, bool))
    IVoting(VOTING_CONTRACT_ADDR).vote(
        vote_id, supports, False
    )  # dev: third arg is deprecated


@external
@view
def encode_snapshot_set_delegate_calldata(delegate: address) -> Bytes[1000]:
    """
    @notice Encode calldata for use in VestingEscrow. Returns type is Bytes[1000] to be compatible with up to 30 args
    @param delegate Address of the delegate
    """
    return _abi_encode(delegate)


@external
def snapshot_set_delegate(abi_encoded_params: Bytes[1000]):
    """
    @notice Delegate Snapshot voting power of all available tokens
    @param abi_encoded_params Abi encoded data for call. Can be obtained from encode_snapshot_set_delegate_calldata
    """
    delegate: address = empty(address)
    delegate = _abi_decode(abi_encoded_params, (address))
    IDelegation(SNAPSHOT_DELEGATE_CONTRACT_ADDR).setDelegate(
        empty(bytes32), delegate
    )  # dev: null id allows voting at any snapshot space


@external
@view
def encode_delegate_calldata(delegate: address) -> Bytes[1000]:
    """
    @notice Encode calldata for use in VestingEscrow. Returns type is Bytes[1000] to be compatible with up to 30 args
    @param delegate Address of the delegate
    """
    return _abi_encode(delegate)


@external
def delegate(abi_encoded_params: Bytes[1000]):
    """
    @notice Delegate voting power of all available tokens
    @param abi_encoded_params Abi encoded data for call. Can be obtained from encode_delegate_calldata
    """
    delegate: address = empty(address)
    delegate = _abi_decode(abi_encoded_params, (address))
    if delegate == empty(address):
        IVoting(VOTING_CONTRACT_ADDR).unassignDelegate()
    else:
        IVoting(VOTING_CONTRACT_ADDR).assignDelegate(delegate)


@external
@view
def voting_contract_addr() -> address:
    return VOTING_CONTRACT_ADDR


@external
@view
def snapshot_delegate_contract_addr() -> address:
    return SNAPSHOT_DELEGATE_CONTRACT_ADDR


@external
def change_owner(owner: address):
    """
    @notice Change contract owner.
    @param owner Address of the new owner. Must be non-zero.
    """
    self._check_sender_is_owner()
    assert owner != empty(address), "zero owner address"

    self.owner = owner
    log OwnerChanged(owner)


@external
def recover_erc20(token: address, amount: uint256):
    """
    @notice Recover ERC20 tokens to owner
    @param token Address of the ERC20 token to be recovered
    """
    if amount != 0:
        assert ERC20(token).transfer(
            self.owner, amount, default_return_value=True
        ), "transfer failed"
        log ERC20Recovered(token, amount)


@external
def recover_ether():
    """
    @notice Recover Ether to owner
    """
    amount: uint256 = self.balance
    if amount != 0:
        self._safe_send_ether(self.owner, amount)
        log ETHRecovered(amount)


@internal
def _check_sender_is_owner():
    assert msg.sender == self.owner, "msg.sender not owner"


@internal
def _safe_send_ether(_to: address, _value: uint256):
    """
    @notice Overcome 2300 gas limit on simple send
    """
    _response: Bytes[32] = raw_call(
        _to, empty(bytes32), value=_value, max_outsize=32
    )
    if len(_response) > 0:
        assert convert(_response, bool), "ETH transfer failed"

Contract ABI

[{"name":"ERC20Recovered","inputs":[{"name":"token","type":"address","indexed":false},{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"ETHRecovered","inputs":[{"name":"amount","type":"uint256","indexed":false}],"anonymous":false,"type":"event"},{"name":"OwnerChanged","inputs":[{"name":"owner","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[{"name":"voting_addr","type":"address"},{"name":"snapshot_delegate_addr","type":"address"},{"name":"owner","type":"address"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"encode_aragon_vote_calldata","inputs":[{"name":"voteId","type":"uint256"},{"name":"supports","type":"bool"}],"outputs":[{"name":"","type":"bytes"}]},{"stateMutability":"nonpayable","type":"function","name":"aragon_vote","inputs":[{"name":"abi_encoded_params","type":"bytes"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"encode_snapshot_set_delegate_calldata","inputs":[{"name":"delegate","type":"address"}],"outputs":[{"name":"","type":"bytes"}]},{"stateMutability":"nonpayable","type":"function","name":"snapshot_set_delegate","inputs":[{"name":"abi_encoded_params","type":"bytes"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"encode_delegate_calldata","inputs":[{"name":"delegate","type":"address"}],"outputs":[{"name":"","type":"bytes"}]},{"stateMutability":"nonpayable","type":"function","name":"delegate","inputs":[{"name":"abi_encoded_params","type":"bytes"}],"outputs":[]},{"stateMutability":"view","type":"function","name":"voting_contract_addr","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"view","type":"function","name":"snapshot_delegate_contract_addr","inputs":[],"outputs":[{"name":"","type":"address"}]},{"stateMutability":"nonpayable","type":"function","name":"change_owner","inputs":[{"name":"owner","type":"address"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"recover_erc20","inputs":[{"name":"token","type":"address"},{"name":"amount","type":"uint256"}],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"recover_ether","inputs":[],"outputs":[]},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}]}]

602061095a6000396000518060a01c61095557604052602061097a6000396000518060a01c61095557606052602061099a6000396000518060a01c6109555760805234610955576080516100aa57600a60a0527f7a65726f206f776e65720000000000000000000000000000000000000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b60405161010e57601060a0527f7a65726f20766f74696e675f616464720000000000000000000000000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b60605161017257601b60a0527f7a65726f20736e617073686f745f64656c65676174655f61646472000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b6080516000556040516107bc526060516107dc526107bc610198610000396107fc610000f36003361161000c57610678565b60003560e01c346107aa57636038c001811861009a57604436106107aa576024358060011c6107aa5760405260208060c05260043560805260405160a052604060605260608160c001815180825260208301602083018281848460045afa505050508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905060c0f35b63412f3121811861014c57604436106107aa576004356004016103e88135116107aa57803580604052602082018181606037505050604036610460376040604051186107aa57606080516104605260208101518060011c6107aa57610480525060206107bc60003960005163df133bca6104a052610460516104c052610480516104e052600061050052803b156107aa5760006104a060646104bc6000855af1610149573d600060003e3d6000fd5b50005b630c4a0d0781186101c457602436106107aa576004358060a01c6107aa5760405260208060a052604051608052602060605260608160a00181518082526020830160208301815181525050508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905060a0f35b63862e6970811861026257604436106107aa576004356004016103e88135116107aa578035806040526020820181816060375050506000610460526020604051186107aa576060518060a01c6107aa576104605260206107dc60003960005163bd86e5086104805260006104a052610460516104c052803b156107aa576000610480604461049c6000855af161025f573d600060003e3d6000fd5b50005b63b2ac5c0381186102da57602436106107aa576004358060a01c6107aa5760405260208060a052604051608052602060605260608160a00181518082526020830160208301815181525050508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905060a0f35b630ccfac9e81186103ba57604436106107aa576004356004016103e88135116107aa578035806040526020820181816060375050506000610460526020604051186107aa576060518060a01c6107aa5761046052610460516103755760206107bc600039600051630bf9c3af61048052803b156107aa576000610480600461049c6000855af161036f573d600060003e3d6000fd5b506103b8565b60206107bc600039600051630a107d3e61048052610460516104a052803b156107aa576000610480602461049c6000855af16103b6573d600060003e3d6000fd5b505b005b63bdd2198d81186103e157600436106107aa5760206107bc60003960005160405260206040f35b63b4d10efe811861040857600436106107aa5760206107dc60003960005160405260206040f35b63253c8bd481186104c957602436106107aa576004358060a01c6107aa5760805261043161067e565b60805161049557601260a0527f7a65726f206f776e65722061646472657373000000000000000000000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b6080516000557fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3660805160a052602060a0a1005b6323a50d3c81186105ef57604436106107aa576004358060a01c6107aa57604052602435156105ed5760405163a9059cbb60605260005460805260243560a052602060606044607c6000855af1610525573d600060003e3d6000fd5b3d61053b57803b156107aa57600160c052610552565b60203d106107aa576060518060011c6107aa5760c0525b60c09050516105ba57600f60e0527f7472616e73666572206661696c656400000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b7f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799960405160605260243560805260406060a15b005b6364461346811861065757600436106107aa574761012052610120511561065557600054604052610120516060526106256106e7565b7f0296f2c4dbc8c0e53c0ffab63f84aeebd5c28aa143475a37346bf15ac003f32761012051610140526020610140a15b005b638da5cb5b811861067657600436106107aa5760005460405260206040f35b505b60006000fd5b6000543318156106e55760146040527f6d73672e73656e646572206e6f74206f776e657200000000000000000000000060605260405060405180606001601f826000031636823750506308c379a06000526020602052601f19601f6040510116604401601cfd5b565b600060c05260c050602061010060c05160e06060516040515af1610710573d600060003e3d6000fd5b3d602081183d602010021860e05260e080518060805260208201805160a052505050608051156107a85760a05160805160200360031b1c6107a857601360c0527f455448207472616e73666572206661696c65640000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b565b600080fda165767970657283000307000b005b600080fd000000000000000000000000da7d2573df555002503f29aa4003e398d28cc00f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e92329ec7ddb11d25e25b3c21eebf11f15eb325d

Deployed Bytecode

0x6003361161000c57610678565b60003560e01c346107aa57636038c001811861009a57604436106107aa576024358060011c6107aa5760405260208060c05260043560805260405160a052604060605260608160c001815180825260208301602083018281848460045afa505050508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905060c0f35b63412f3121811861014c57604436106107aa576004356004016103e88135116107aa57803580604052602082018181606037505050604036610460376040604051186107aa57606080516104605260208101518060011c6107aa57610480525060206107bc60003960005163df133bca6104a052610460516104c052610480516104e052600061050052803b156107aa5760006104a060646104bc6000855af1610149573d600060003e3d6000fd5b50005b630c4a0d0781186101c457602436106107aa576004358060a01c6107aa5760405260208060a052604051608052602060605260608160a00181518082526020830160208301815181525050508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905060a0f35b63862e6970811861026257604436106107aa576004356004016103e88135116107aa578035806040526020820181816060375050506000610460526020604051186107aa576060518060a01c6107aa576104605260206107dc60003960005163bd86e5086104805260006104a052610460516104c052803b156107aa576000610480604461049c6000855af161025f573d600060003e3d6000fd5b50005b63b2ac5c0381186102da57602436106107aa576004358060a01c6107aa5760405260208060a052604051608052602060605260608160a00181518082526020830160208301815181525050508051806020830101601f82600003163682375050601f19601f82516020010116905090508101905060a0f35b630ccfac9e81186103ba57604436106107aa576004356004016103e88135116107aa578035806040526020820181816060375050506000610460526020604051186107aa576060518060a01c6107aa5761046052610460516103755760206107bc600039600051630bf9c3af61048052803b156107aa576000610480600461049c6000855af161036f573d600060003e3d6000fd5b506103b8565b60206107bc600039600051630a107d3e61048052610460516104a052803b156107aa576000610480602461049c6000855af16103b6573d600060003e3d6000fd5b505b005b63bdd2198d81186103e157600436106107aa5760206107bc60003960005160405260206040f35b63b4d10efe811861040857600436106107aa5760206107dc60003960005160405260206040f35b63253c8bd481186104c957602436106107aa576004358060a01c6107aa5760805261043161067e565b60805161049557601260a0527f7a65726f206f776e65722061646472657373000000000000000000000000000060c05260a05060a0518060c001601f826000031636823750506308c379a06060526020608052601f19601f60a0510116604401607cfd5b6080516000557fa2ea9883a321a3e97b8266c2b078bfeec6d50c711ed71f874a90d500ae2eaf3660805160a052602060a0a1005b6323a50d3c81186105ef57604436106107aa576004358060a01c6107aa57604052602435156105ed5760405163a9059cbb60605260005460805260243560a052602060606044607c6000855af1610525573d600060003e3d6000fd5b3d61053b57803b156107aa57600160c052610552565b60203d106107aa576060518060011c6107aa5760c0525b60c09050516105ba57600f60e0527f7472616e73666572206661696c656400000000000000000000000000000000006101005260e05060e0518061010001601f826000031636823750506308c379a060a052602060c052601f19601f60e051011660440160bcfd5b7f505b28e6941631badc363841ecbf8e1214b9379c643936458e87be718e15799960405160605260243560805260406060a15b005b6364461346811861065757600436106107aa574761012052610120511561065557600054604052610120516060526106256106e7565b7f0296f2c4dbc8c0e53c0ffab63f84aeebd5c28aa143475a37346bf15ac003f32761012051610140526020610140a15b005b638da5cb5b811861067657600436106107aa5760005460405260206040f35b505b60006000fd5b6000543318156106e55760146040527f6d73672e73656e646572206e6f74206f776e657200000000000000000000000060605260405060405180606001601f826000031636823750506308c379a06000526020602052601f19601f6040510116604401601cfd5b565b600060c05260c050602061010060c05160e06060516040515af1610710573d600060003e3d6000fd5b3d602081183d602010021860e05260e080518060805260208201805160a052505050608051156107a85760a05160805160200360031b1c6107a857601360c0527f455448207472616e73666572206661696c65640000000000000000000000000060e05260c05060c0518060e001601f826000031636823750506308c379a0608052602060a052601f19601f60c0510116604401609cfd5b565b600080fda165767970657283000307000b000000000000000000000000da7d2573df555002503f29aa4003e398d28cc00f0000000000000000000000000000000000000000000000000000000000000001

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

000000000000000000000000da7d2573df555002503f29aa4003e398d28cc00f0000000000000000000000000000000000000000000000000000000000000001000000000000000000000000e92329ec7ddb11d25e25b3c21eebf11f15eb325d

-----Decoded View---------------
Arg [0] : voting_addr (address): 0xdA7d2573Df555002503F29aA4003e398d28cc00f
Arg [1] : snapshot_delegate_addr (address): 0x0000000000000000000000000000000000000001
Arg [2] : owner (address): 0xE92329EC7ddB11D25e25b3c21eeBf11f15eB325d

-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000da7d2573df555002503f29aa4003e398d28cc00f
Arg [1] : 0000000000000000000000000000000000000000000000000000000000000001
Arg [2] : 000000000000000000000000e92329ec7ddb11d25e25b3c21eebf11f15eb325d


Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits

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