Cryo Explorer Ethereum Mainnet

Address Contract Verified

Address 0x40653625c8EAe9320B0d95d6C25356e752BDb9De
Balance 0 ETH
Nonce 1
Code Size 1055 bytes
Indexed Transactions 0
External Etherscan · Sourcify

Contract Bytecode

1055 bytes
0x60806040526004361061001e5760003560e01c80635e3245d914610023575b600080fd5b610036610031366004610271565b610038565b005b7f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc26001600160a01b031663d0e30db0886040518263ffffffff1660e01b81526004016000604051808303818588803b15801561009357600080fd5b505af11580156100a7573d6000803e3d6000fd5b5050505050600087346100ba9190610315565b60405163095ea7b360e01b81526001600160a01b037f0000000000000000000000001bf463463dd6747230ee1bf9428376ebf1e2c23a81166004830152602482018b90529192507f000000000000000000000000c02aaa39b223fe8d0a0e5c4f27ead9083c756cc29091169063095ea7b3906044016020604051808303816000875af115801561014e573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610172919061033a565b5060405163202f390560e11b81526001600160a01b037f0000000000000000000000001bf463463dd6747230ee1bf9428376ebf1e2c23a169063405e720a9083906101cf908d908d908d908d908d908d908d908d9060040161038c565b6000604051808303818588803b1580156101e857600080fd5b505af11580156101fc573d6000803e3d6000fd5b5050505050505050505050505050565b80356001600160a01b038116811461022357600080fd5b919050565b60008083601f84011261023a57600080fd5b50813567ffffffffffffffff81111561025257600080fd5b60208301915083602082850101111561026a57600080fd5b9250929050565b60008060008060008060008060c0898b03121561028d57600080fd5b6102968961020c565b975060208901359650604089013595506102b260608a0161020c565b9450608089013567ffffffffffffffff808211156102cf57600080fd5b6102db8c838d01610228565b909650945060a08b01359150808211156102f457600080fd5b506103018b828c01610228565b999c989b5096995094979396929594505050565b60008282101561033557634e487b7160e01b600052601160045260246000fd5b500390565b60006020828403121561034c57600080fd5b8151801515811461035c57600080fd5b9392505050565b81835281816020850137506000828201602090810191909152601f909101601f19169091010190565b6001600160a01b03898116825260208201899052604082018890528616606082015260c0608082018190526000906103c79083018688610363565b82810360a08401526103da818587610363565b9b9a505050505050505050505056fea2646970667358221220916d3744bd9c6b94a00bddc4cc31c2598a3053b24641a4337eb22e8ed4a8c20364736f6c634300080d0033

Verified Source Code Full Match

Compiler: v0.8.13+commit.abaa5c0e EVM: london Optimization: Yes (200 runs)
Wrapper.sol 43 lines
pragma solidity 0.8.13;

import "solmate/tokens/ERC20.sol";

interface IVault {
    function bridge(
        address receiver_,
        uint256 amount_,
        uint256 msgGasLimit_,
        address connector_,
        bytes calldata execPayload_,
        bytes calldata options_
    ) external payable;
}

interface IWeth {
    function deposit() external payable;
    function withdraw(uint256 amount) external;
}

contract Wrapper {
    address immutable weth;
    IVault immutable vault;

    constructor(address _weth, address _vault) {
        weth = _weth;
        vault = IVault(_vault);
    }

    function wrapAndBridge(
        address receiver_,
        uint256 amount_,
        uint256 msgGasLimit_,
        address connector_,
        bytes calldata execPayload_,
        bytes calldata options_
    ) external payable {
        IWeth(weth).deposit{value: amount_}();
        uint256 fees = msg.value - amount_;
        ERC20(weth).approve(address(vault), amount_);
        vault.bridge{value: fees}(receiver_, amount_, msgGasLimit_, connector_, execPayload_, options_);
    }
}
ERC20.sol 206 lines
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

/// @notice Modern and gas efficient ERC20 + EIP-2612 implementation.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/tokens/ERC20.sol)
/// @author Modified from Uniswap (https://github.com/Uniswap/uniswap-v2-core/blob/master/contracts/UniswapV2ERC20.sol)
/// @dev Do not manually set balances without updating totalSupply, as the sum of all user balances must not exceed it.
abstract contract ERC20 {
    /*//////////////////////////////////////////////////////////////
                                 EVENTS
    //////////////////////////////////////////////////////////////*/

    event Transfer(address indexed from, address indexed to, uint256 amount);

    event Approval(address indexed owner, address indexed spender, uint256 amount);

    /*//////////////////////////////////////////////////////////////
                            METADATA STORAGE
    //////////////////////////////////////////////////////////////*/

    string public name;

    string public symbol;

    uint8 public immutable decimals;

    /*//////////////////////////////////////////////////////////////
                              ERC20 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 public totalSupply;

    mapping(address => uint256) public balanceOf;

    mapping(address => mapping(address => uint256)) public allowance;

    /*//////////////////////////////////////////////////////////////
                            EIP-2612 STORAGE
    //////////////////////////////////////////////////////////////*/

    uint256 internal immutable INITIAL_CHAIN_ID;

    bytes32 internal immutable INITIAL_DOMAIN_SEPARATOR;

    mapping(address => uint256) public nonces;

    /*//////////////////////////////////////////////////////////////
                               CONSTRUCTOR
    //////////////////////////////////////////////////////////////*/

    constructor(
        string memory _name,
        string memory _symbol,
        uint8 _decimals
    ) {
        name = _name;
        symbol = _symbol;
        decimals = _decimals;

        INITIAL_CHAIN_ID = block.chainid;
        INITIAL_DOMAIN_SEPARATOR = computeDomainSeparator();
    }

    /*//////////////////////////////////////////////////////////////
                               ERC20 LOGIC
    //////////////////////////////////////////////////////////////*/

    function approve(address spender, uint256 amount) public virtual returns (bool) {
        allowance[msg.sender][spender] = amount;

        emit Approval(msg.sender, spender, amount);

        return true;
    }

    function transfer(address to, uint256 amount) public virtual returns (bool) {
        balanceOf[msg.sender] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(msg.sender, to, amount);

        return true;
    }

    function transferFrom(
        address from,
        address to,
        uint256 amount
    ) public virtual returns (bool) {
        uint256 allowed = allowance[from][msg.sender]; // Saves gas for limited approvals.

        if (allowed != type(uint256).max) allowance[from][msg.sender] = allowed - amount;

        balanceOf[from] -= amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(from, to, amount);

        return true;
    }

    /*//////////////////////////////////////////////////////////////
                             EIP-2612 LOGIC
    //////////////////////////////////////////////////////////////*/

    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) public virtual {
        require(deadline >= block.timestamp, "PERMIT_DEADLINE_EXPIRED");

        // Unchecked because the only math done is incrementing
        // the owner's nonce which cannot realistically overflow.
        unchecked {
            address recoveredAddress = ecrecover(
                keccak256(
                    abi.encodePacked(
                        "\x19\x01",
                        DOMAIN_SEPARATOR(),
                        keccak256(
                            abi.encode(
                                keccak256(
                                    "Permit(address owner,address spender,uint256 value,uint256 nonce,uint256 deadline)"
                                ),
                                owner,
                                spender,
                                value,
                                nonces[owner]++,
                                deadline
                            )
                        )
                    )
                ),
                v,
                r,
                s
            );

            require(recoveredAddress != address(0) && recoveredAddress == owner, "INVALID_SIGNER");

            allowance[recoveredAddress][spender] = value;
        }

        emit Approval(owner, spender, value);
    }

    function DOMAIN_SEPARATOR() public view virtual returns (bytes32) {
        return block.chainid == INITIAL_CHAIN_ID ? INITIAL_DOMAIN_SEPARATOR : computeDomainSeparator();
    }

    function computeDomainSeparator() internal view virtual returns (bytes32) {
        return
            keccak256(
                abi.encode(
                    keccak256("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"),
                    keccak256(bytes(name)),
                    keccak256("1"),
                    block.chainid,
                    address(this)
                )
            );
    }

    /*//////////////////////////////////////////////////////////////
                        INTERNAL MINT/BURN LOGIC
    //////////////////////////////////////////////////////////////*/

    function _mint(address to, uint256 amount) internal virtual {
        totalSupply += amount;

        // Cannot overflow because the sum of all user
        // balances can't exceed the max uint256 value.
        unchecked {
            balanceOf[to] += amount;
        }

        emit Transfer(address(0), to, amount);
    }

    function _burn(address from, uint256 amount) internal virtual {
        balanceOf[from] -= amount;

        // Cannot underflow because a user's balance
        // will never be larger than the total supply.
        unchecked {
            totalSupply -= amount;
        }

        emit Transfer(from, address(0), amount);
    }
}

Write Contract 1 functions

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

wrapAndBridge 0x5e3245d9
address receiver_
uint256 amount_
uint256 msgGasLimit_
address connector_
bytes execPayload_
bytes options_

Recent Transactions

No transactions found for this address