Contract 0x0000000022D53366457F9d5E68Ec105046FC4383

Txn Hash Method
Block
From
To
Value [Txn Fee]
0x26d44be9d0fe30db1d3fe4356ce6a38c833c56930e601947b709a66be275ea860x60206108161653192022-11-15 6:43:1518 days 6 hrs ago0x07a3458ad662fbcdd4fca0b1b37be6a5b1bcd7ac IN  Create: Vyper_contract0 CELO0.0002822035
[ Download CSV Export 
Parent Txn Hash Block From To Value
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Vyper_contract

Compiler Version
vyper:0.2.7

Optimization Enabled:
N/A

Other Settings:
, MIT license

Contract Source Code (Vyper language format)

# @version 0.2.7
"""
@title Curve Registry Address Provider
@license MIT
@author Curve.Fi
"""

event NewAddressIdentifier:
    id: indexed(uint256)
    addr: address
    description: String[64]

event AddressModified:
    id: indexed(uint256)
    new_address: address
    version: uint256

event CommitNewAdmin:
    deadline: indexed(uint256)
    admin: indexed(address)

event NewAdmin:
    admin: indexed(address)


struct AddressInfo:
    addr: address
    is_active: bool
    version: uint256
    last_modified: uint256
    description: String[64]


registry: address
admin: public(address)
transfer_ownership_deadline: public(uint256)
future_admin: public(address)

queue_length: uint256
get_id_info: public(HashMap[uint256, AddressInfo])


@external
def __init__(_admin: address):
    self.admin = _admin
    self.queue_length = 1
    self.get_id_info[0].description = "Main Registry"


@view
@external
def get_registry() -> address:
    """
    @notice Get the address of the main registry contract
    @dev This is a gas-efficient way of calling `AddressProvider.get_address(0)`
    @return address main registry contract
    """
    return self.registry


@view
@external
def max_id() -> uint256:
    """
    @notice Get the highest ID set within the address provider
    @return uint256 max ID
    """
    return self.queue_length - 1


@view
@external
def get_address(_id: uint256) -> address:
    """
    @notice Fetch the address associated with `_id`
    @dev Returns ZERO_ADDRESS if `_id` has not been defined, or has been unset
    @param _id Identifier to fetch an address for
    @return Current address associated to `_id`
    """
    return self.get_id_info[_id].addr


@external
def add_new_id(_address: address, _description: String[64]) -> uint256:
    """
    @notice Add a new identifier to the registry
    @dev ID is auto-incremented
    @param _address Initial address to assign to new identifier
    @param _description Human-readable description of the identifier
    @return uint256 identifier
    """
    assert msg.sender == self.admin  # dev: admin-only function
    assert _address.is_contract  # dev: not a contract

    id: uint256 = self.queue_length
    self.get_id_info[id] = AddressInfo({
        addr: _address,
        is_active: True,
        version: 1,
        last_modified: block.timestamp,
        description: _description
    })
    self.queue_length = id + 1

    log NewAddressIdentifier(id, _address, _description)

    return id


@external
def set_address(_id: uint256, _address: address) -> bool:
    """
    @notice Set a new address for an existing identifier
    @param _id Identifier to set the new address for
    @param _address Address to set
    @return bool success
    """
    assert msg.sender == self.admin  # dev: admin-only function
    assert _address.is_contract  # dev: not a contract
    assert self.queue_length > _id  # dev: id does not exist

    version: uint256 = self.get_id_info[_id].version + 1

    self.get_id_info[_id].addr = _address
    self.get_id_info[_id].is_active = True
    self.get_id_info[_id].version = version
    self.get_id_info[_id].last_modified = block.timestamp

    if _id == 0:
        self.registry = _address

    log AddressModified(_id, _address, version)

    return True


@external
def unset_address(_id: uint256) -> bool:
    """
    @notice Unset an existing identifier
    @dev An identifier cannot ever be removed, it can only have the
         address unset so that it returns ZERO_ADDRESS
    @param _id Identifier to unset
    @return bool success
    """
    assert msg.sender == self.admin  # dev: admin-only function
    assert self.get_id_info[_id].is_active  # dev: not active

    self.get_id_info[_id].is_active = False
    self.get_id_info[_id].addr = ZERO_ADDRESS
    self.get_id_info[_id].last_modified = block.timestamp

    if _id == 0:
        self.registry = ZERO_ADDRESS

    log AddressModified(_id, ZERO_ADDRESS, self.get_id_info[_id].version)

    return True


@external
def commit_transfer_ownership(_new_admin: address) -> bool:
    """
    @notice Initiate a transfer of contract ownership
    @dev Once initiated, the actual transfer may be performed three days later
    @param _new_admin Address of the new owner account
    @return bool success
    """
    assert msg.sender == self.admin  # dev: admin-only function
    assert self.transfer_ownership_deadline == 0  # dev: transfer already active

    deadline: uint256 = block.timestamp + 3*86400
    self.transfer_ownership_deadline = deadline
    self.future_admin = _new_admin

    log CommitNewAdmin(deadline, _new_admin)

    return True


@external
def apply_transfer_ownership() -> bool:
    """
    @notice Finalize a transfer of contract ownership
    @dev May only be called by the current owner, three days after a
         call to `commit_transfer_ownership`
    @return bool success
    """
    assert msg.sender == self.admin  # dev: admin-only function
    assert self.transfer_ownership_deadline != 0  # dev: transfer not active
    assert block.timestamp >= self.transfer_ownership_deadline  # dev: now < deadline

    new_admin: address = self.future_admin
    self.admin = new_admin
    self.transfer_ownership_deadline = 0

    log NewAdmin(new_admin)

    return True


@external
def revert_transfer_ownership() -> bool:
    """
    @notice Revert a transfer of contract ownership
    @dev May only be called by the current owner
    @return bool success
    """
    assert msg.sender == self.admin  # dev: admin-only function

    self.transfer_ownership_deadline = 0

    return True

Contract ABI

[{"name":"NewAddressIdentifier","inputs":[{"type":"uint256","name":"id","indexed":true},{"type":"address","name":"addr","indexed":false},{"type":"string","name":"description","indexed":false}],"anonymous":false,"type":"event"},{"name":"AddressModified","inputs":[{"type":"uint256","name":"id","indexed":true},{"type":"address","name":"new_address","indexed":false},{"type":"uint256","name":"version","indexed":false}],"anonymous":false,"type":"event"},{"name":"CommitNewAdmin","inputs":[{"type":"uint256","name":"deadline","indexed":true},{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"name":"NewAdmin","inputs":[{"type":"address","name":"admin","indexed":true}],"anonymous":false,"type":"event"},{"outputs":[],"inputs":[{"type":"address","name":"_admin"}],"stateMutability":"nonpayable","type":"constructor"},{"name":"get_registry","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1061},{"name":"max_id","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1258},{"name":"get_address","outputs":[{"type":"address","name":""}],"inputs":[{"type":"uint256","name":"_id"}],"stateMutability":"view","type":"function","gas":1308},{"name":"add_new_id","outputs":[{"type":"uint256","name":""}],"inputs":[{"type":"address","name":"_address"},{"type":"string","name":"_description"}],"stateMutability":"nonpayable","type":"function","gas":291275},{"name":"set_address","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"uint256","name":"_id"},{"type":"address","name":"_address"}],"stateMutability":"nonpayable","type":"function","gas":182430},{"name":"unset_address","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"uint256","name":"_id"}],"stateMutability":"nonpayable","type":"function","gas":101348},{"name":"commit_transfer_ownership","outputs":[{"type":"bool","name":""}],"inputs":[{"type":"address","name":"_new_admin"}],"stateMutability":"nonpayable","type":"function","gas":74048},{"name":"apply_transfer_ownership","outputs":[{"type":"bool","name":""}],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":60125},{"name":"revert_transfer_ownership","outputs":[{"type":"bool","name":""}],"inputs":[],"stateMutability":"nonpayable","type":"function","gas":21400},{"name":"admin","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1331},{"name":"transfer_ownership_deadline","outputs":[{"type":"uint256","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1361},{"name":"future_admin","outputs":[{"type":"address","name":""}],"inputs":[],"stateMutability":"view","type":"function","gas":1391},{"name":"get_id_info","outputs":[{"type":"address","name":"addr"},{"type":"bool","name":"is_active"},{"type":"uint256","name":"version"},{"type":"uint256","name":"last_modified"},{"type":"string","name":"description"}],"inputs":[{"type":"uint256","name":"arg0"}],"stateMutability":"view","type":"function","gas":12168}]

602061089561014039602061089560c03960c05160a01c1561002057600080fd5b610140516001556001600455600d610160527f4d61696e20526567697374727900000000000000000000000000000000000000610180526101608060046005600060e05260c052604060c02060c052602060c0200160c052602060c020602082510161012060006002818352015b826101205160200211156100a1576100c3565b61012051602002850151610120518501555b815160010180835281141561008e575b50505050505061087d56341561000a57600080fd5b6004361015610018576107a9565b600035601c5263a262904b600051141561003a5760005460005260206000f350005b630c6d784f600051141561006c5760045460018082101561005a57600080fd5b8082039050905060005260206000f350005b63493f4f74600051141561009e57600560043560e05260c052604060c02060c052602060c0205460005260206000f350005b63168f957960005114156102735760043560a01c156100bc57600080fd5b60606024356004016101403760406024356004013511156100dc57600080fd5b60015433146100ea57600080fd5b60006004353b116100fa57600080fd5b6004546101c05260056101c05160e05260c052604060c02060c052602060c02060043581556001600182015560016002820155426003820155610140806004830160c052602060c020602082510161012060006003818352015b8261012051602002111561016757610189565b61012051602002850151610120518501555b8151600101808352811415610154575b505050505050506101c05160018181830110156101a557600080fd5b808201905090506004556004356102205260406101e0526101e051610240526101408051602001806101e051610220018284600060045af16101e657600080fd5b50506101e05161022001518060206101e051610220010101818260206001820306601f820103905003368237505060206101e051610220015160206001820306601f82010390506101e05101016101e0526101c0517f5b0f9b31dc08c19adcc0181c1b97ad54a84487faf0a4fdcb88c8681724298af96101e051610220a26101c05160005260206000f350005b636a84cad060005114156103c45760243560a01c1561029157600080fd5b600154331461029f57600080fd5b60006024353b116102af57600080fd5b600435600454116102bf57600080fd5b6002600560043560e05260c052604060c02060c052602060c020015460018181830110156102ec57600080fd5b8082019050905061014052602435600560043560e05260c052604060c02060c052602060c0205560016001600560043560e05260c052604060c02060c052602060c0200155610140516002600560043560e05260c052604060c02060c052602060c0200155426003600560043560e05260c052604060c02060c052602060c0200155600435151561037e576024356000555b6024356101605261014051610180526004357fe7a6334c4f573efdf292d404d59adacec345f4f7c76495a034008edda0acef476040610160a2600160005260206000f350005b635eec0daa60005114156104c75760015433146103e057600080fd5b6001600560043560e05260c052604060c02060c052602060c020015461040557600080fd5b60006001600560043560e05260c052604060c02060c052602060c02001556000600560043560e05260c052604060c02060c052602060c02055426003600560043560e05260c052604060c02060c052602060c0200155600435151561046a5760006000555b6000610140526002600560043560e05260c052604060c02060c052602060c0200154610160526004357fe7a6334c4f573efdf292d404d59adacec345f4f7c76495a034008edda0acef476040610140a2600160005260206000f350005b636b441a4060005114156105665760043560a01c156104e557600080fd5b60015433146104f357600080fd5b6002541561050057600080fd5b426203f48081818301101561051457600080fd5b808201905090506101405261014051600255600435600355600435610140517f181aa3aa17d4cbf99265dd4443eba009433d3cde79d60164fde1d1a192beb93560006000a3600160005260206000f350005b636a1c05ae60005114156105ea57600154331461058257600080fd5b60006002541861059157600080fd5b6002544210156105a057600080fd5b60035461014052610140516001556000600255610140517f71614071b88dee5e0b2ae578a9dd7b2ebbe9ae832ba419dc0242cd065a290b6c60006000a2600160005260206000f350005b6386fbf193600051141561061857600154331461060657600080fd5b6000600255600160005260206000f350005b63f851a44060005114156106345760015460005260206000f350005b63e0a0b58660005114156106505760025460005260206000f350005b6317f7182a600051141561066c5760035460005260206000f350005b6392668ecb60005114156107a857600560043560e05260c052604060c0206101408060a081808560c052602060c0205481525050602082019150818060018660c052602060c020015481525050602082019150818060028660c052602060c020015481525050602082019150818060038660c052602060c0200154815250506020820191508082528083018060048660c052602060c020018060c052602060c02082602082540161012060006003818352015b8261012051602002111561073257610754565b61012051850154610120516020028501525b815160010180835281141561071f575b5050505050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f820103905090509050810190508090509050905060c05260c051610140f39050005b5b60006000fd5b6100ce61087d036100ce6000396100ce61087d036000f300000000000000000000000056bc95ded2bef162131905dfd600f2b9f1b380a4

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

00000000000000000000000056bc95ded2bef162131905dfd600f2b9f1b380a4

-----Decoded View---------------
Arg [0] : _admin (address): 0x56bc95ded2bef162131905dfd600f2b9f1b380a4

-----Encoded View---------------
1 Constructor Arguments found :
Arg [0] : 00000000000000000000000056bc95ded2bef162131905dfd600f2b9f1b380a4


Block Transaction Gas Used Reward
Age Block Fee Address BC Fee Address Voting Power Jailed Incoming
Block Uncle Number Difficulty Gas Used Reward
Loading
Make sure to use the "Vote Down" button for any spammy posts, and the "Vote Up" for interesting conversations.