ETH Price: $2,920.54 (-9.89%)
Gas: 19 Gwei

Contract

0x0199429171bcE183048dccf1d5546Ca519EA9717
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Value
0x63095ea7192769552024-02-21 15:35:11134 days ago1708529711IN
 Create: Curve Optimism Bridge Wrapper
0 ETH0.0148251940.97362165

View more zero value Internal Transactions in Advanced View mode

Advanced mode:
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
Curve Optimism Bridge Wrapper

Compiler Version
vyper:0.3.1

Optimization Enabled:
N/A

Other Settings:
None license

Contract Source Code (Vyper language format)

# @version 0.3.1
"""
@title Curve Optimism Bridge Wrapper
"""
from vyper.interfaces import ERC20


event UpdateTokenMapping:
    _l1_token: indexed(address)
    _old_l2_token: address
    _new_l2_token: address

event TransferOwnership:
    _old_owner: address
    _new_owner: address


CRV20: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52
L2_CRV20: constant(address) = 0x331B9182088e2A7d6D3Fe4742AbA1fB231aEcc56
OPTIMISM_L1_BRIDGE: constant(address) = 0x34C0bD5877A5Ee7099D0f5688D65F4bB9158BDE2


# l1_token -> l2_token
l2_token: public(HashMap[address, address])

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


@external
def __init__():
    assert ERC20(CRV20).approve(OPTIMISM_L1_BRIDGE, MAX_UINT256)
    self.l2_token[CRV20] = L2_CRV20

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


@external
def bridge(_token: address, _to: address, _amount: uint256):
    """
    @notice Bridge a token to Optimism mainnet using the L1 Standard Bridge
    @param _token The token to bridge
    @param _to The address to deposit the token to on L2
    @param _amount The amount of the token to deposit
    """
    assert ERC20(_token).transferFrom(msg.sender, self, _amount)

    l2_token: address = L2_CRV20
    if _token != CRV20:
        l2_token = self.l2_token[_token]
        assert l2_token != ZERO_ADDRESS  # dev: token not mapped

    raw_call(
        OPTIMISM_L1_BRIDGE,
        _abi_encode(
            _token,
            l2_token,
            _to,
            _amount,
            convert(200_000, uint256),
            b"",
            method_id=method_id("depositERC20To(address,address,address,uint256,uint32,bytes)")
        )
    )


@view
@external
def check(_account: address) -> bool:
    """
    @notice Dummy method to check if caller is allowed to bridge
    @param _account The account to check
    """
    return True


@view
@external
def cost() -> uint256:
    """
    @notice Cost in ETH to bridge
    """
    return 0


@external
def set_l2_token(_l1_token: address, _l2_token: address):
    """
    @notice Set the mapping of L1 token -> L2 token for depositing
    @param _l1_token The l1 token address
    @param _l2_token The l2 token address
    """
    assert msg.sender == self.owner
    assert _l1_token != CRV20  # dev: cannot reset mapping for CRV20

    amount: uint256 = 0
    if _l2_token != ZERO_ADDRESS:
        amount = MAX_UINT256
    assert ERC20(_l1_token).approve(OPTIMISM_L1_BRIDGE, amount)

    log UpdateTokenMapping(_l1_token, self.l2_token[_l1_token], _l2_token)
    self.l2_token[_l1_token] = _l2_token


@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

Contract Security Audit

Contract ABI

[{"name":"UpdateTokenMapping","inputs":[{"name":"_l1_token","type":"address","indexed":true},{"name":"_old_l2_token","type":"address","indexed":false},{"name":"_new_l2_token","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"name":"TransferOwnership","inputs":[{"name":"_old_owner","type":"address","indexed":false},{"name":"_new_owner","type":"address","indexed":false}],"anonymous":false,"type":"event"},{"stateMutability":"nonpayable","type":"constructor","inputs":[],"outputs":[]},{"stateMutability":"nonpayable","type":"function","name":"bridge","inputs":[{"name":"_token","type":"address"},{"name":"_to","type":"address"},{"name":"_amount","type":"uint256"}],"outputs":[],"gas":13778},{"stateMutability":"view","type":"function","name":"check","inputs":[{"name":"_account","type":"address"}],"outputs":[{"name":"","type":"bool"}],"gas":541},{"stateMutability":"view","type":"function","name":"cost","inputs":[],"outputs":[{"name":"","type":"uint256"}],"gas":420},{"stateMutability":"nonpayable","type":"function","name":"set_l2_token","inputs":[{"name":"_l1_token","type":"address"},{"name":"_l2_token","type":"address"}],"outputs":[],"gas":45723},{"stateMutability":"nonpayable","type":"function","name":"commit_transfer_ownership","inputs":[{"name":"_future_owner","type":"address"}],"outputs":[],"gas":37725},{"stateMutability":"nonpayable","type":"function","name":"accept_transfer_ownership","inputs":[],"outputs":[],"gas":41804},{"stateMutability":"view","type":"function","name":"l2_token","inputs":[{"name":"arg0","type":"address"}],"outputs":[{"name":"","type":"address"}],"gas":2906},{"stateMutability":"view","type":"function","name":"owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2670},{"stateMutability":"view","type":"function","name":"future_owner","inputs":[],"outputs":[{"name":"","type":"address"}],"gas":2700}]

63095ea7b360e0527334c0bd5877a5ee7099d0f5688d65f4bb9158bde2610100527fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff61012052602060e0604460fc600073d533a949740bb3306d119cc777fa900ba034cd525af1610075573d600060003e3d6000fd5b601f3d11156105405760e051156105405773331b9182088e2a7d6d3fe4742aba1fb231aecc56600073d533a949740bb3306d119cc777fa900ba034cd5260a052608052604060802055336001557f5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c600060e0523361010052604060e0a161052856600436101561000d57610426565b60046000601c376000513461042c57638712175981186101d1576004358060a01c61042c5760e0526024358060a01c61042c57610100526323b872dd6101205233610140523061016052604435610180526020610120606461013c600060e0515af161007e573d600060003e3d6000fd5b601f3d111561042c57610120511561042c5773331b9182088e2a7d6d3fe4742aba1fb231aecc566101205273d533a949740bb3306d119cc777fa900ba034cd5260e051146100e757600060e05160a052608052604060802054610120526000610120511461042c575b63838b25206101645260046101848060c060e0518252602082019150610120518252602082019150610100518252602082019150604435825260208201915062030d408252602082019150808252600061014052610140818401808280516020018083828460045afa905050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f82010390509050905090508101905090509050016101605261016050600060006101605161018060007334c0bd5877a5ee7099d0f5688d65f4bb9158bde25af16101cf573d600060003e3d6000fd5b005b63c23697a881186101f7576004358060a01c61042c5760e0526001610100526020610100f35b6313faede6811861020d57600060e052602060e0f35b6354808c61811861034c576004358060a01c61042c5760e0526024358060a01c61042c5761010052600154331861042c5773d533a949740bb3306d119cc777fa900ba034cd5260e0511461042c5760006101205260006101005114610292577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610120525b63095ea7b3610140527334c0bd5877a5ee7099d0f5688d65f4bb9158bde26101605261012051610180526020610140604461015c600060e0515af16102dc573d600060003e3d6000fd5b601f3d111561042c57610140511561042c5760e0517f2069a26c43c36ffaabe0c2d19bf65e55dd03abecdc449f5cc9663491e97f709d600060e05160a0526080526040608020546101405261010051610160526040610140a261010051600060e05160a052608052604060802055005b636b441a408118610376576004358060a01c61042c5760e052600154331861042c5760e051600255005b63e5ea47b881186103c157600254331861042c577f5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c60015460e0523361010052604060e0a133600155005b6323f40db481186103f6576004358060a01c61042c5760e052600060e05160a052608052604060802054610100526020610100f35b638da5cb5b811861040d5760015460e052602060e0f35b631ec0cdc181186104245760025460e052602060e0f35b505b60006000fd5b600080fd5b6100f7610528036100f76000396100f7610528036000f35b600080fd

Deployed Bytecode

0x600436101561000d57610426565b60046000601c376000513461042c57638712175981186101d1576004358060a01c61042c5760e0526024358060a01c61042c57610100526323b872dd6101205233610140523061016052604435610180526020610120606461013c600060e0515af161007e573d600060003e3d6000fd5b601f3d111561042c57610120511561042c5773331b9182088e2a7d6d3fe4742aba1fb231aecc566101205273d533a949740bb3306d119cc777fa900ba034cd5260e051146100e757600060e05160a052608052604060802054610120526000610120511461042c575b63838b25206101645260046101848060c060e0518252602082019150610120518252602082019150610100518252602082019150604435825260208201915062030d408252602082019150808252600061014052610140818401808280516020018083828460045afa905050508051806020830101818260206001820306601f8201039050033682375050805160200160206001820306601f82010390509050905090508101905090509050016101605261016050600060006101605161018060007334c0bd5877a5ee7099d0f5688d65f4bb9158bde25af16101cf573d600060003e3d6000fd5b005b63c23697a881186101f7576004358060a01c61042c5760e0526001610100526020610100f35b6313faede6811861020d57600060e052602060e0f35b6354808c61811861034c576004358060a01c61042c5760e0526024358060a01c61042c5761010052600154331861042c5773d533a949740bb3306d119cc777fa900ba034cd5260e0511461042c5760006101205260006101005114610292577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff610120525b63095ea7b3610140527334c0bd5877a5ee7099d0f5688d65f4bb9158bde26101605261012051610180526020610140604461015c600060e0515af16102dc573d600060003e3d6000fd5b601f3d111561042c57610140511561042c5760e0517f2069a26c43c36ffaabe0c2d19bf65e55dd03abecdc449f5cc9663491e97f709d600060e05160a0526080526040608020546101405261010051610160526040610140a261010051600060e05160a052608052604060802055005b636b441a408118610376576004358060a01c61042c5760e052600154331861042c5760e051600255005b63e5ea47b881186103c157600254331861042c577f5c486528ec3e3f0ea91181cff8116f02bfa350e03b8b6f12e00765adbb5af85c60015460e0523361010052604060e0a133600155005b6323f40db481186103f6576004358060a01c61042c5760e052600060e05160a052608052604060802054610100526020610100f35b638da5cb5b811861040d5760015460e052602060e0f35b631ec0cdc181186104245760025460e052602060e0f35b505b60006000fd5b600080fd

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading
[ Download: CSV Export  ]

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.