Cryo Explorer Ethereum Mainnet

Address Contract Partially Verified

Address 0x306A45a1478A000dC701A6e1f7a569afb8D9DCD6
Balance 0 ETH
Nonce 260
Code Size 2516 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

2516 bytes
0x5f3560e01c60026011820660011b6109b201601e395f51565b6354fd4d50811861009657346109ae5760208060805260056040527f312e302e3200000000000000000000000000000000000000000000000000000060605260408160800181518152602082015160208201528051806020830101601f825f03163682375050601f19601f8251602001011690509050810190506080f35b63c781c66881186100b257346109ae5760045460405260206040f35b63234091948118610855576064361034176109ae57336060526106e356610855565b63f81c6c3e81186100ef57346109ae575f5460405260206040f35b63e5ea47b8811861085557346109ae5760095433186109ae577f5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c6008546040523360605260406040a13360085500610855565b63087ca57f811861016f576024361034176109ae5760016004356020525f5260405f205460405260206040f35b63e10a16b8811861035f5760433611156109ae5760016004356020525f5260405f20546101805261018051156109ae576004546101a052604060046102003760406101e0526101e08051602082012090506101c0527f602d3d8160093d39f3363d3d373d3d3d363d7300000000000000000000000000610200526101a05160601b610213527f5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000610227526101c051603661020034f580156109ae576101e0526004356040526101c051606052610246610220610859565b610220516102005260066004356020525f5260405f2054610220526101e05160056004356020525f5260405f20610220517fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109ae57810190505561022051600181018181106109ae57905060066004356020525f5260405f2055600160076101e0516020525f5260405f20556101e05163c350a1b561024052610180516102605260043561028052610200516102a052803b156109ae575f610240606461025c5f855af1610319573d5f5f3e3d5ffd5b50336004356101a0517fba28410b4fffd5fd249e330e29cf9634734b5fbee13030072e5d27f5620c6f54602435610240526101e051610260526040610240a460206101e0f35b635ecb9e148118610855576024361034176109ae576004358060a01c6109ae5760405260085433186109ae576040515f557fe385116766307e81d4427b03f1ac50c300b2f6a5df7b3c67eeb7eaaab12f08055f60605260405160805260406060a100610855565b63cb24f20881186103f3576024361034176109ae5760026004356020525f5260405f205460405260206040f35b63f5de12488118610855576044361034176109ae5760056004356020525f5260405f206024357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff81146109ae57810190505460405260206040f3610855565b634fea34918118610855576024361034176109ae5760036004356020525f5260405f205460405260206040f3610855565b6338f3121481186104b0576024361034176109ae5760066004356020525f5260405f205460405260206040f35b6337f4d74e8118610855576084361034176109ae576024358060a01c6109ae576040526044358060a01c6109ae576060526064358060a01c6109ae5760805260085433186109ae576004357fe87ba74791c653828b2867358bf912b3fdcdcae676d023aae8a79292f00101db60405160a05260605160c05260805160e052606060a0a260405160016004356020525f5260405f205560605160026004356020525f5260405f205560805160036004356020525f5260405f205500610855565b634b92037981186105aa576024361034176109ae576004358060a01c6109ae5760405260076040516020525f5260405f205460605260206060f35b638da5cb5b811861085557346109ae5760085460405260206040f3610855565b631ec0cdc1811861085557346109ae5760095460405260206040f3610855565b6311bfb9568118610855576024361034176109ae576004358060a01c6109ae57604052604051634d47fc85606052602060606004607c845afa61062f573d5f5f3e3d5ffd5b60203d106109ae576060518060a01c6109ae5760a05260a090505163c23697a860c0523360e052602060c0602460dc845afa61066d573d5f5f3e3d5ffd5b60203d106109ae5760c0518060011c6109ae5761010052610100905051156109ae57604051630c33d05a606052803b156109ae575f60606004607c5f855af16106b8573d5f5f3e3d5ffd5b5000610855565b63e3e340698118610855576084361034176109ae576064358060a01c6109ae576060525b6024358060a01c6109ae5760405260016004356020525f5260405f2054608052608051156109ae575f5463f9754c9361014052608030610160528061018052636be320d260a452600460405160c45260443560e4526060516101045260600160a05260a0816101600160208251018082828560045afa50508051806020830101601f825f03163682375050601f19601f8251602001011690509050810190505f6101a0526004356101c05250803b156109ae575f61014061012461015c5f855af16107b0573d5f5f3e3d5ffd5b5000610855565b634cd69da08118610855576024361034176109ae576004358060a01c6109ae5760405260085433186109ae577fcdfeee65e4d0a88d6e47c5d034c34b03d52f1e6ffc56906257fc93d993ca04c460045460605260405160805260406060a160405160045500610855565b636b441a408118610855576024361034176109ae576004358060a01c6109ae5760405260085433186109ae57604051600955005b5f5ffd5b60026040516020525f5260405f205460805260036040516020525f5260405f20548060601b905060a052608051156109ae5760a051156109ae575f7f602d3d8160093d39f3363d3d373d3d3d363d730000000000000000000000000081610100015260138101905060a0518161010001526014810190507f5af43d82803e903d91602b57fd5bf30000000000000000000000000000000000816101000152600f810190508060e05260e0905080516020820120905060c0525f7fff000000000000000000000000000000000000000000000000000000000000008161012001526001810190506080518060601b905081610120015260148101905060605181610120015260208101905060c0518161012001526020810190508061010052610100905080516020820120905060e05273ffffffffffffffffffffffffffffffffffffffff60e051168060a01c6109ae57815250565b5f80fd04520018085505ea00d4056f0855085505ca0855082106bf07b703c6048308550142

Verified Source Code Partial Match

Compiler: v0.3.10+commit.91361694
RootLiquidityGaugeFactory.vy 217 lines
# pragma version 0.3.10
"""
@title Root Liquidity Gauge Factory
@license MIT
@author Curve Finance
@custom:version 1.0.2
"""

version: public(constant(String[8])) = "1.0.2"


interface Bridger:
    def check(_addr: address) -> bool: view

interface RootGauge:
    def bridger() -> Bridger: view
    def initialize(_bridger: Bridger, _chain_id: uint256, _child: address): nonpayable
    def transmit_emissions(): nonpayable

interface CallProxy:
    def anyCall(
        _to: address, _data: Bytes[1024], _fallback: address, _to_chain_id: uint256
    ): nonpayable

event ChildUpdated:
    _chain_id: indexed(uint256)
    _new_bridger: Bridger
    _new_factory: address
    _new_implementation: address

event DeployedGauge:
    _implementation: indexed(address)
    _chain_id: indexed(uint256)
    _deployer: indexed(address)
    _salt: bytes32
    _gauge: RootGauge

event TransferOwnership:
    _old_owner: address
    _new_owner: address

event UpdateCallProxy:
    _old_call_proxy: CallProxy
    _new_call_proxy: CallProxy

event UpdateImplementation:
    _old_implementation: address
    _new_implementation: address


call_proxy: public(CallProxy)
get_bridger: public(HashMap[uint256, Bridger])
get_child_factory: public(HashMap[uint256, address])
get_child_implementation: public(HashMap[uint256, address])
get_implementation: public(address)

get_gauge: public(HashMap[uint256, RootGauge[max_value(uint256)]])
get_gauge_count: public(HashMap[uint256, uint256])
is_valid_gauge: public(HashMap[RootGauge, bool])

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


@external
def __init__(_call_proxy: CallProxy, _owner: address):
    self.call_proxy = _call_proxy
    log UpdateCallProxy(empty(CallProxy), _call_proxy)

    self.owner = _owner
    log TransferOwnership(empty(address), _owner)


@external
def transmit_emissions(_gauge: RootGauge):
    """
    @notice Call `transmit_emissions` on a root gauge
    @dev Entrypoint to request emissions for a child gauge.
        The way that gauges work, this can also be called on the root
        chain without a request.
    """
    # in most cases this will return True
    # for special bridges *cough cough Multichain, we can only do
    # one bridge per tx, therefore this will verify msg.sender in [tx.origin, self.call_proxy]
    assert _gauge.bridger().check(msg.sender)
    _gauge.transmit_emissions()


@internal
def _get_child(_chain_id: uint256, salt: bytes32) -> address:
    """
    @dev zkSync address derivation is ignored, so need to set child address through a vote manually
    """
    child_factory: address = self.get_child_factory[_chain_id]
    child_impl: bytes20 = convert(self.get_child_implementation[_chain_id], bytes20)

    assert child_factory != empty(address)  # dev: child factory not set
    assert child_impl != empty(bytes20)  # dev: child implementation not set

    gauge_codehash: bytes32 = keccak256(
        concat(0x602d3d8160093d39f3363d3d373d3d3d363d73, child_impl, 0x5af43d82803e903d91602b57fd5bf3))
    digest: bytes32 = keccak256(concat(0xFF, convert(child_factory, bytes20), salt, gauge_codehash))
    return convert(convert(digest, uint256) & convert(max_value(uint160), uint256), address)


@payable
@external
def deploy_gauge(_chain_id: uint256, _salt: bytes32) -> RootGauge:
    """
    @notice Deploy a root liquidity gauge
    @param _chain_id The chain identifier of the counterpart child gauge
    @param _salt A value to deterministically deploy a gauge
    """
    bridger: Bridger = self.get_bridger[_chain_id]
    assert bridger != empty(Bridger)  # dev: chain id not supported

    implementation: address = self.get_implementation
    salt: bytes32 = keccak256(_abi_encode(_chain_id, _salt))
    gauge: RootGauge = RootGauge(create_minimal_proxy_to(
        implementation,
        value=msg.value,
        salt=salt,
    ))
    child: address = self._get_child(_chain_id, salt)

    idx: uint256 = self.get_gauge_count[_chain_id]
    self.get_gauge[_chain_id][idx] = gauge
    self.get_gauge_count[_chain_id] = idx + 1
    self.is_valid_gauge[gauge] = True

    gauge.initialize(bridger, _chain_id, child)

    log DeployedGauge(implementation, _chain_id, msg.sender, _salt, gauge)
    return gauge


@external
def deploy_child_gauge(_chain_id: uint256, _lp_token: address, _salt: bytes32, _manager: address = msg.sender):
    bridger: Bridger = self.get_bridger[_chain_id]
    assert bridger != empty(Bridger)  # dev: chain id not supported

    self.call_proxy.anyCall(
        self,
        _abi_encode(
            _lp_token,
            _salt,
            _manager,
            method_id=method_id("deploy_gauge(address,bytes32,address)")
        ),
        empty(address),
        _chain_id
    )


@external
def set_child(_chain_id: uint256, _bridger: Bridger, _child_factory: address, _child_impl: address):
    """
    @notice Set the bridger for `_chain_id`
    @param _chain_id The chain identifier to set the bridger for
    @param _bridger The bridger contract to use
    @param _child_factory Address of factory on L2 (needed in price derivation)
    @param _child_impl Address of gauge implementation on L2 (needed in price derivation)
    """
    assert msg.sender == self.owner  # dev: only owner

    log ChildUpdated(_chain_id, _bridger, _child_factory, _child_impl)
    self.get_bridger[_chain_id] = _bridger
    self.get_child_factory[_chain_id] = _child_factory
    self.get_child_implementation[_chain_id] = _child_impl


@external
def set_implementation(_implementation: address):
    """
    @notice Set the implementation
    @dev Changing implementation require change on all child factories
    @param _implementation The address of the implementation to use
    """
    assert msg.sender == self.owner  # dev: only owner

    log UpdateImplementation(self.get_implementation, _implementation)
    self.get_implementation = _implementation


@external
def set_call_proxy(_call_proxy: CallProxy):
    """
    @notice Set CallProxy
    @param _call_proxy Contract to use for inter-chain communication
    """
    assert msg.sender == self.owner

    self.call_proxy = _call_proxy
    log UpdateCallProxy(empty(CallProxy), _call_proxy)


@external
def commit_transfer_ownership(_future_owner: address):
    """
    @notice Transfer ownership to `_future_owner`
    @param _future_owner The account to commit as the future owner
    """
    assert msg.sender == self.owner  # dev: only owner

    self.future_owner = _future_owner


@external
def accept_transfer_ownership():
    """
    @notice Accept the transfer of ownership
    @dev Only the committed future owner can call this function
    """
    assert msg.sender == self.future_owner  # dev: only future owner

    log TransferOwnership(self.owner, msg.sender)
    self.owner = msg.sender

Read Contract

call_proxy 0xf81c6c3e → address
future_owner 0x1ec0cdc1 → address
get_bridger 0x087ca57f → address
get_child_factory 0xcb24f208 → address
get_child_implementation 0x4fea3491 → address
get_gauge 0xf5de1248 → address
get_gauge_count 0x38f31214 → uint256
get_implementation 0xc781c668 → address
is_valid_gauge 0x4b920379 → bool
owner 0x8da5cb5b → address
version 0x54fd4d50 → string

Write Contract 9 functions

These functions modify contract state and require a wallet transaction to execute.

accept_transfer_ownership 0xe5ea47b8
No parameters
commit_transfer_ownership 0x6b441a40
address _future_owner
deploy_child_gauge 0x23409194
uint256 _chain_id
address _lp_token
bytes32 _salt
deploy_child_gauge 0xe3e34069
uint256 _chain_id
address _lp_token
bytes32 _salt
address _manager
deploy_gauge 0xe10a16b8
uint256 _chain_id
bytes32 _salt
returns: address
set_call_proxy 0x5ecb9e14
address _call_proxy
set_child 0x37f4d74e
uint256 _chain_id
address _bridger
address _child_factory
address _child_impl
set_implementation 0x4cd69da0
address _implementation
transmit_emissions 0x11bfb956
address _gauge

Recent Transactions

No transactions found for this address