LzXdaoBridger

Description:

Smart contract deployed on Ethereum with Factory features.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Vyper",
  "sources": {
    "contracts/bridgers/IBridger.vyi": {
      "content": "# pragma version ~=0.4.0
"""
@title Curve Bridge Adapter
@license MIT
@author CurveFi
@notice Interface mainly used for bridging Curve emissions to L2s and collected fees to Ethereum.
"""

from ethereum.ercs import IERC20


@external
@payable
def bridge(_token: IERC20, _to: address, _amount: uint256, _min_amount: uint256=0) -> uint256:
    """
    @notice Bridge `_token`
    @param _token The ERC20 asset to bridge
    @param _to The receiver on `_chain_id`
    @param _amount The amount of `_token` to deposit, 2^256-1 for the whole balance
    @param _min_amount Minimum amount when to bridge
    @return Bridged amount
    """
    ...


@view
@external
def check(_account: address) -> bool:
    """
    @notice Check if `_account` may bridge via `transmit_emissions`
    @param _account The account to check
    """
    ...


@view
@external
def cost() -> uint256:
    """
    @notice Cost in ETH to bridge, not all chains are supported
    """
    ...
",
      "sha256sum": "6f706ae0fccd481df984cada3477305aa5cc727b755c74568316fe7fe3af9898"
    },
    "contracts/bridgers/LzXdaoBridger.vy": {
      "content": "# @version 0.4.3
"""
@title LzXdaoBridger
@custom:version 0.0.1
@author Curve.Fi
@license Copyright (c) Curve.Fi, 2020-2024 - all rights reserved
@notice Curve Xdao Layer Zero bridge wrapper
"""

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

from ethereum.ercs import IERC20
import IBridger

implements: IBridger


interface Bridge:
    def bridge(_receiver: address, _amount: uint256, _refund: address): payable
    def quote() -> uint256: view


CRV20: constant(address) = 0xD533a949740bb3306d119CC777fa900bA034cd52
BRIDGE: public(immutable(Bridge))

DESTINATION_CHAIN_ID: public(immutable(uint256))


@deploy
def __init__(_bridge: Bridge, _chain_id: uint256):
    """
    @param _bridge Layer Zero Bridge of CRV
    @param _chain_id Chain ID to bridge to (actual, not LZ)
    """
    BRIDGE = _bridge
    DESTINATION_CHAIN_ID = _chain_id

    assert extcall IERC20(CRV20).approve(BRIDGE.address, max_value(uint256))


@external
@payable
def bridge(_token: IERC20, _to: address, _amount: uint256, _min_amount: uint256=0) -> uint256:
    """
    @notice Bridge `_token` through XDAO Layer Zero
    @param _token The ERC20 asset to bridge
    @param _to The receiver on `_chain_id`
    @param _amount The amount of `_token` to deposit, 2^256-1 for the whole balance
    @param _min_amount Minimum amount when to bridge
    @return Bridged amount
    """
    amount: uint256 = _amount
    if amount == max_value(uint256):
        amount = min(staticcall _token.balanceOf(msg.sender), staticcall _token.allowance(msg.sender, self))
    assert amount >= _min_amount, "Amount too small"

    assert extcall _token.transferFrom(msg.sender, self, amount)

    extcall BRIDGE.bridge(_to, amount, msg.sender, value=self.balance)
    return amount


@view
@external
def cost() -> uint256:
    """
    @notice Cost in ETH to bridge
    """
    return staticcall BRIDGE.quote()


@view
@external
def check(_account: address) -> bool:
    """
    @notice Check if `_account` is allowed to bridge
    @param _account The account to check
    """
    return True
",
      "sha256sum": "d87b8434f1641bffd2a38dbe45f89db2b2610dd207e6df5691e0e0ddd117d68c"
    }
  },
  "settings": {
    "outputSelection": {
      "contracts/bridgers/LzXdaoBridger.vy": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "abi"
      ]
    },
    "search_paths": [
      "."
    ]
  },
  "compiler_version": "v0.4.3+commit.bff19ea2",
  "integrity": "80b0d1204582903d9678bbc48da44642f2cc0d7e8b7d9efe28fbcc9462849298"
}}

Tags:
Factory|addr:0xf992b9d0d3cd3d91bdeb4b428330ec4e9daaa5a9|verified:true|block:23440074|tx:0x98268a5f9f57f9c143541f1a93d470c6d4cfaefeb6af9268bec031bea366d72a|first_check:1758807183

Submitted on: 2025-09-25 15:33:04

Comments

Log in to comment.

No comments yet.