ETH Price: $1,949.35 (-1.92%)
 

Overview

ETH Balance

0 ETH

Eth Value

$0.00

Token Holdings

More Info

Private Name Tags

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Zap In245097872026-02-22 3:42:2311 hrs ago1771731743IN
0x67725119...0Dfd89c00
0.1 ETH0.000014440.03438218
Zap In245077122026-02-21 20:44:4718 hrs ago1771706687IN
0x67725119...0Dfd89c00
0 ETH0.000049710.04978067
Zap In245063782026-02-21 16:16:3522 hrs ago1771690595IN
0x67725119...0Dfd89c00
0 ETH0.000048880.04918462
Zap In245062752026-02-21 15:55:5923 hrs ago1771689359IN
0x67725119...0Dfd89c00
0 ETH0.000045480.04576217
Zap In245062572026-02-21 15:52:2323 hrs ago1771689143IN
0x67725119...0Dfd89c00
0 ETH0.000045960.04624358
Zap In245051952026-02-21 12:19:3526 hrs ago1771676375IN
0x67725119...0Dfd89c00
0.3 ETH0.000017510.04245011
Zap In245027342026-02-21 4:05:2335 hrs ago1771646723IN
0x67725119...0Dfd89c00
0.1 ETH0.000014320.03410488
Zap In244996582026-02-20 17:48:4745 hrs ago1771609727IN
0x67725119...0Dfd89c00
0 ETH0.002020422.10498698
Zap In244979002026-02-20 11:55:352 days ago1771588535IN
0x67725119...0Dfd89c00
0.00021056 ETH0.00002070.05018839
Zap In244973322026-02-20 10:01:232 days ago1771581683IN
0x67725119...0Dfd89c00
0 ETH0.001927572.04858985
Zap In244922162026-02-19 16:53:472 days ago1771520027IN
0x67725119...0Dfd89c00
0 ETH0.000107410.1118856
Zap In244901082026-02-19 9:50:473 days ago1771494647IN
0x67725119...0Dfd89c00
0 ETH0.000131310.13397695
Zap In244871612026-02-18 23:58:473 days ago1771459127IN
0x67725119...0Dfd89c00
0.0032 ETH0.000017190.04348969
Zap In244852332026-02-18 17:31:593 days ago1771435919IN
0x67725119...0Dfd89c00
0 ETH0.002114772.12566752
Zap In244703832026-02-16 15:49:115 days ago1771256951IN
0x67725119...0Dfd89c00
0 ETH0.000169730.17490753
Zap In244667332026-02-16 3:36:356 days ago1771212995IN
0x67725119...0Dfd89c00
0 ETH0.000067180.06963319
Zap In244667032026-02-16 3:30:356 days ago1771212635IN
0x67725119...0Dfd89c00
0 ETH0.000132840.13297249
Zap In244650942026-02-15 22:08:116 days ago1771193291IN
0x67725119...0Dfd89c00
0 ETH0.000058390.05842256
Zap In244645972026-02-15 20:28:476 days ago1771187327IN
0x67725119...0Dfd89c00
0 ETH0.000041840.041859
Zap In244612832026-02-15 9:23:237 days ago1771147403IN
0x67725119...0Dfd89c00
0.00274 ETH0.000061890.15
Zap In244612232026-02-15 9:11:237 days ago1771146683IN
0x67725119...0Dfd89c00
0 ETH0.000035280.03591561
Zap In244567232026-02-14 18:07:477 days ago1771092467IN
0x67725119...0Dfd89c00
0 ETH0.000054740.0570144
Zap In244508872026-02-13 22:36:598 days ago1771022219IN
0x67725119...0Dfd89c00
0 ETH0.000055020.05542868
Zap In244495252026-02-13 18:02:598 days ago1771005779IN
0x67725119...0Dfd89c00
0 ETH0.000122570.12251395
Zap In244430162026-02-12 20:15:239 days ago1770927323IN
0x67725119...0Dfd89c00
0 ETH0.001051291.07026457
View all transactions

Latest 25 internal transactions (View All)

Advanced mode:
Parent Transaction Hash Method Block
From
To
Submit245097872026-02-22 3:42:2311 hrs ago1771731743
0x67725119...0Dfd89c00
0.1 ETH
Submit245051952026-02-21 12:19:3526 hrs ago1771676375
0x67725119...0Dfd89c00
0.3 ETH
Submit245027342026-02-21 4:05:2335 hrs ago1771646723
0x67725119...0Dfd89c00
0.1 ETH
Submit244979002026-02-20 11:55:352 days ago1771588535
0x67725119...0Dfd89c00
0.00021056 ETH
Submit244871612026-02-18 23:58:473 days ago1771459127
0x67725119...0Dfd89c00
0.0032 ETH
Submit244612832026-02-15 9:23:237 days ago1771147403
0x67725119...0Dfd89c00
0.00274 ETH
Submit243855222026-02-04 19:18:3517 days ago1770232715
0x67725119...0Dfd89c00
6.8 ETH
Submit243821502026-02-04 7:59:3518 days ago1770191975
0x67725119...0Dfd89c00
1.3 ETH
Submit243782022026-02-03 18:45:1118 days ago1770144311
0x67725119...0Dfd89c00
0.252 ETH
Submit243593792026-02-01 3:38:1121 days ago1769917091
0x67725119...0Dfd89c00
0.009 ETH
Submit243590552026-02-01 2:33:2321 days ago1769913203
0x67725119...0Dfd89c00
3.53 ETH
Submit243423542026-01-29 18:38:2323 days ago1769711903
0x67725119...0Dfd89c00
0.0234 ETH
Submit243423442026-01-29 18:36:2323 days ago1769711783
0x67725119...0Dfd89c00
0.0134 ETH
Submit243369182026-01-29 0:26:3524 days ago1769646395
0x67725119...0Dfd89c00
3.03168824 ETH
Submit243334142026-01-28 12:43:4725 days ago1769604227
0x67725119...0Dfd89c00
0.035 ETH
Submit243031402026-01-24 7:24:2329 days ago1769239463
0x67725119...0Dfd89c00
0.50076 ETH
Submit242981142026-01-23 14:35:1130 days ago1769178911
0x67725119...0Dfd89c00
0.01292942 ETH
Submit242958502026-01-23 6:59:2330 days ago1769151563
0x67725119...0Dfd89c00
4.809 ETH
Submit242946922026-01-23 3:05:4730 days ago1769137547
0x67725119...0Dfd89c00
34.92 ETH
Submit242933242026-01-22 22:31:1130 days ago1769121071
0x67725119...0Dfd89c00
0.001 ETH
Submit242774212026-01-20 17:15:3532 days ago1768929335
0x67725119...0Dfd89c00
4.68839921 ETH
Submit242460642026-01-16 8:22:4737 days ago1768551767
0x67725119...0Dfd89c00
0.191 ETH
Submit242003032026-01-09 23:06:2343 days ago1767999983
0x67725119...0Dfd89c00
0.03081755 ETH
Submit241797202026-01-07 2:08:4746 days ago1767751727
0x67725119...0Dfd89c00
0.007 ETH
Submit241767092026-01-06 16:04:1146 days ago1767715451
0x67725119...0Dfd89c00
0.049 ETH
View All Internal Transactions
Loading...
Loading
Loading...
Loading
Cross-Chain Transactions

Block Transaction Difficulty Gas Used Reward
View All Blocks Produced

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
ERC4626ZapInWithNativeToken

Compiler Version
v0.8.26+commit.8a97fa7a

Optimization Enabled:
Yes with 1000000 runs

Other Settings:
cancun EvmVersion, BSL 1.1 license
// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.26;

import {Address} from "@openzeppelin/contracts/utils/Address.sol";
import {ERC4626ZapInAllowance} from "./ERC4626ZapInAllowance.sol";
import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
import {ReentrancyGuard} from "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";
import {ReferralPlasmaVault} from "../vaults/extensions/ReferralPlasmaVault.sol";

/// @notice Structure representing a single function call in the zap-in process
/// @dev Used to execute multiple operations in a single transaction
struct Call {
    /// @notice Target contract address to call
    address target;
    /// @notice Encoded function call data
    bytes data;
    uint256 nativeTokenAmount;
}

/// @notice Input data structure for the zapIn function
/// @dev Contains all necessary parameters for executing a zap-in operation
struct ZapInData {
    /// @notice Address of the target ERC4626 vault to deposit into
    address vault;
    /// @notice Address that will receive the vault shares
    address receiver;
    /// @notice Minimum amount of tokens that must be deposited
    uint256 minAmountToDeposit;
    /// @notice List of token addresses that should be refunded to the sender if any remain after the operation
    address[] assetsToRefundToSender;
    /// @notice Array of calls to be executed as part of the zap-in process
    Call[] calls;
}

/// @title ERC4626ZapInWithNativeToken
/// @notice Facilitates complex zap-in operations for ERC4626 vault deposits
/// @dev Handles token approvals, multiple contract interactions, and deposits in a single transaction
contract ERC4626ZapInWithNativeToken is ReentrancyGuard, Ownable {
    using Address for address;
    using SafeERC20 for IERC4626;

    /// @notice Thrown when minAmountToDeposit is zero
    error MinAmountToDepositIsZero();
    /// @notice Thrown when ERC4626 address is zero
    error ERC4626VaultIsZero();
    /// @notice Thrown when no calls are provided in the zap-in data
    error NoCalls();
    /// @notice Thrown when the resulting deposit asset balance is less than minAmountToDeposit
    error InsufficientDepositAssetBalance();
    /// @notice Thrown when receiver address is zero
    error ReceiverIsZero();
    /// @notice Thrown when referral contract address is zero
    error ReferralContractAddressIsZero();
    /// @notice Address of the ZapInAllowance contract that handles token transfers
    /// @dev Immutable contract address created in constructor
    address public immutable ZAP_IN_ALLOWANCE_CONTRACT;
    address public referralContractAddress;

    /// @notice Address of the current user performing a zap-in operation
    /// @dev This is set during the zapIn function execution and cleared afterwards
    address public currentZapSender;

    constructor() Ownable(msg.sender) {
        ZAP_IN_ALLOWANCE_CONTRACT = address(new ERC4626ZapInAllowance(address(this)));
    }

    /// @notice Executes a zap-in operation without referral code
    /// @dev Convenience function that calls the main zapIn function with a zero referral code
    /// @param zapInData_ Struct containing all necessary parameters for the zap-in operation
    /// @return results Array of bytes containing the results of each call executed during the zap-in process
    /// @custom:security This function is protected by reentrancy guard and tracks the zap sender
    /// @custom:gas This function may consume significant gas due to multiple external calls and token transfers
    function zapIn(ZapInData calldata zapInData_) public payable returns (bytes[] memory results) {
        return zapIn(zapInData_, bytes32(0));
    }

    /// @notice Executes a complex zap-in operation with multiple steps
    /// @dev Performs a series of calls, then deposits resulting tokens into a ERC4626
    /// @param zapInData_ Struct containing all necessary parameters for the zap-in operation
    /// @return results Array of bytes containing the results of each call
    function zapIn(
        ZapInData calldata zapInData_,
        bytes32 referralCode_
    ) public payable nonReentrant trackZapSender returns (bytes[] memory results) {
        if (zapInData_.minAmountToDeposit == 0) {
            revert MinAmountToDepositIsZero();
        }

        if (zapInData_.vault == address(0)) {
            revert ERC4626VaultIsZero();
        }

        uint256 callsLength = zapInData_.calls.length;

        if (callsLength == 0) {
            revert NoCalls();
        }

        if (zapInData_.receiver == address(0)) {
            revert ReceiverIsZero();
        }

        results = new bytes[](callsLength);
        for (uint256 i; i < callsLength; i++) {
            if (zapInData_.calls[i].nativeTokenAmount > 0) {
                results[i] = zapInData_.calls[i].target.functionCallWithValue(
                    zapInData_.calls[i].data,
                    zapInData_.calls[i].nativeTokenAmount
                );
            } else {
                results[i] = zapInData_.calls[i].target.functionCall(zapInData_.calls[i].data);
            }
        }

        IERC4626 vault = IERC4626(zapInData_.vault);
        uint256 depositAssetBalance = IERC4626(vault.asset()).balanceOf(address(this));

        if (depositAssetBalance < zapInData_.minAmountToDeposit) {
            revert InsufficientDepositAssetBalance();
        }

        if (referralContractAddress != address(0) && referralCode_ != bytes32(0)) {
            ReferralPlasmaVault(referralContractAddress).emitReferralForZapIn(currentZapSender, referralCode_);
        }

        vault.deposit(depositAssetBalance, zapInData_.receiver);

        uint256 assetsToRefundToSenderLength = zapInData_.assetsToRefundToSender.length;
        address asset;
        uint256 balance;

        for (uint256 i; i < assetsToRefundToSenderLength; ++i) {
            asset = zapInData_.assetsToRefundToSender[i];
            balance = IERC4626(asset).balanceOf(address(this));
            if (balance > 0) {
                IERC4626(asset).safeTransfer(currentZapSender, balance);
            }
        }

        uint256 nativeTokenBalance = address(this).balance;

        if (nativeTokenBalance > 0) {
            Address.sendValue(payable(currentZapSender), nativeTokenBalance);
        }

        return results;
    }

    /// @notice Tracks the sender of the current zap-in operation
    /// @dev Sets currentZapSender at the start of operation and clears it afterwards
    /// @custom:security This modifier ensures proper tracking of the operation initiator
    modifier trackZapSender() {
        currentZapSender = msg.sender;
        _;
        currentZapSender = address(0);
    }

    /// @notice Sets the referral contract address and renounces ownership
    /// @dev This function can only be called once by the owner. After setting the referral contract address,
    ///      the ownership is permanently renounced, making the contract immutable for future changes.
    /// @param referralContractAddress_ The address of the ReferralPlasmaVault contract to be used for referral tracking
    /// @custom:security This function permanently renounces ownership after execution, ensuring the referral address cannot be changed
    /// @custom:access Only the contract owner can call this function, and only once
    /// @custom:effect After execution, the contract becomes ownerless and the referral address is permanently set
    function setReferralContractAddress(address referralContractAddress_) external onlyOwner {
        if (referralContractAddress_ == address(0)) {
            revert ReferralContractAddressIsZero();
        }
        referralContractAddress = referralContractAddress_;
        renounceOwnership();
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/Address.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error AddressInsufficientBalance(address account);

    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @dev A call to an address target failed. The target may have reverted.
     */
    error FailedInnerCall();

    /**
     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to
     * `recipient`, forwarding all available gas and reverting on errors.
     *
     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost
     * of certain opcodes, possibly making contracts go over the 2300 gas limit
     * imposed by `transfer`, making them unable to receive funds via
     * `transfer`. {sendValue} removes this limitation.
     *
     * https://consensys.net/diligence/blog/2019/09/stop-using-soliditys-transfer-now/[Learn more].
     *
     * IMPORTANT: because control is transferred to `recipient`, care must be
     * taken to not create reentrancy vulnerabilities. Consider using
     * {ReentrancyGuard} or the
     * https://solidity.readthedocs.io/en/v0.8.20/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].
     */
    function sendValue(address payable recipient, uint256 amount) internal {
        if (address(this).balance < amount) {
            revert AddressInsufficientBalance(address(this));
        }

        (bool success, ) = recipient.call{value: amount}("");
        if (!success) {
            revert FailedInnerCall();
        }
    }

    /**
     * @dev Performs a Solidity function call using a low level `call`. A
     * plain `call` is an unsafe replacement for a function call: use this
     * function instead.
     *
     * If `target` reverts with a revert reason or custom error, it is bubbled
     * up by this function (like regular Solidity function calls). However, if
     * the call reverted with no returned reason, this function reverts with a
     * {FailedInnerCall} error.
     *
     * Returns the raw returned data. To convert to the expected return value,
     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].
     *
     * Requirements:
     *
     * - `target` must be a contract.
     * - calling `target` with `data` must not revert.
     */
    function functionCall(address target, bytes memory data) internal returns (bytes memory) {
        return functionCallWithValue(target, data, 0);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but also transferring `value` wei to `target`.
     *
     * Requirements:
     *
     * - the calling contract must have an ETH balance of at least `value`.
     * - the called Solidity function must be `payable`.
     */
    function functionCallWithValue(address target, bytes memory data, uint256 value) internal returns (bytes memory) {
        if (address(this).balance < value) {
            revert AddressInsufficientBalance(address(this));
        }
        (bool success, bytes memory returndata) = target.call{value: value}(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a static call.
     */
    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {
        (bool success, bytes memory returndata) = target.staticcall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],
     * but performing a delegate call.
     */
    function functionDelegateCall(address target, bytes memory data) internal returns (bytes memory) {
        (bool success, bytes memory returndata) = target.delegatecall(data);
        return verifyCallResultFromTarget(target, success, returndata);
    }

    /**
     * @dev Tool to verify that a low level call to smart-contract was successful, and reverts if the target
     * was not a contract or bubbling up the revert reason (falling back to {FailedInnerCall}) in case of an
     * unsuccessful call.
     */
    function verifyCallResultFromTarget(
        address target,
        bool success,
        bytes memory returndata
    ) internal view returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            // only check if target is a contract if the call was successful and the return data is empty
            // otherwise we already know that it was a contract
            if (returndata.length == 0 && target.code.length == 0) {
                revert AddressEmptyCode(target);
            }
            return returndata;
        }
    }

    /**
     * @dev Tool to verify that a low level call was successful, and reverts if it wasn't, either by bubbling the
     * revert reason or with a default {FailedInnerCall} error.
     */
    function verifyCallResult(bool success, bytes memory returndata) internal pure returns (bytes memory) {
        if (!success) {
            _revert(returndata);
        } else {
            return returndata;
        }
    }

    /**
     * @dev Reverts with returndata if present. Otherwise reverts with {FailedInnerCall}.
     */
    function _revert(bytes memory returndata) private pure {
        // Look for revert reason and bubble it up if present
        if (returndata.length > 0) {
            // The easiest way to bubble the revert reason is using memory via assembly
            /// @solidity memory-safe-assembly
            assembly {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert FailedInnerCall();
        }
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.26;

import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";

interface IERC4626ZapIn {
    /// @notice Returns the address of the current user performing a zap-in operation
    function currentZapSender() external view returns (address);
}

/// @title ERC4626ZapInAllowance
/// @notice Helper contract for handling token allowances in ERC4626 zap-in operations
/// @dev This contract acts as an intermediary for token transfers in the zap-in process
contract ERC4626ZapInAllowance {
    using SafeERC20 for IERC20;

    /// @notice Address of the ERC4626ZapIn contract
    address public immutable ERC4626_ZAP_IN;

    error NotERC4626ZapIn();
    error AmountIsZero();
    error AssetIsZero();
    error CurrentZapSenderIsZero();
    error EthTransfersNotAccepted();

    /// @notice Emitted when assets are fetched from a user
    /// @param from Address from which the assets are fetched
    /// @param asset Address of the token being fetched
    /// @param amount Amount of tokens being fetched
    event AssetsTransferred(address indexed from, address indexed asset, uint256 amount);

    /// @notice Constructs the ERC4626ZapInAllowance contract
    /// @param erc4626ZapIn_ Address of the ERC4626ZapIn contract
    constructor(address erc4626ZapIn_) {
        ERC4626_ZAP_IN = erc4626ZapIn_;
    }

    /// @notice Fetches approved tokens from a user to the ERC4626ZapIn contract
    /// @param asset_ Address of the token to fetch
    /// @param amount_ Amount of tokens to fetch
    /// @return success True if the transfer was successful
    function transferApprovedAssets(address asset_, uint256 amount_) external onlyERC4626ZapIn returns (bool success) {
        if (amount_ == 0) {
            revert AmountIsZero();
        }

        if (asset_ == address(0)) {
            revert AssetIsZero();
        }

        address currentZapSender = IERC4626ZapIn(ERC4626_ZAP_IN).currentZapSender();

        if (currentZapSender == address(0)) {
            revert CurrentZapSenderIsZero();
        }

        IERC20(asset_).safeTransferFrom(currentZapSender, ERC4626_ZAP_IN, amount_);

        emit AssetsTransferred(currentZapSender, asset_, amount_);
        return true;
    }

    receive() external payable {
        revert EthTransfersNotAccepted();
    }

    fallback() external payable {
        revert EthTransfersNotAccepted();
    }

    modifier onlyERC4626ZapIn() {
        if (msg.sender != ERC4626_ZAP_IN) {
            revert NotERC4626ZapIn();
        }
        _;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC4626.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";
import {IERC20Metadata} from "../token/ERC20/extensions/IERC20Metadata.sol";

/**
 * @dev Interface of the ERC4626 "Tokenized Vault Standard", as defined in
 * https://eips.ethereum.org/EIPS/eip-4626[ERC-4626].
 */
interface IERC4626 is IERC20, IERC20Metadata {
    event Deposit(address indexed sender, address indexed owner, uint256 assets, uint256 shares);

    event Withdraw(
        address indexed sender,
        address indexed receiver,
        address indexed owner,
        uint256 assets,
        uint256 shares
    );

    /**
     * @dev Returns the address of the underlying token used for the Vault for accounting, depositing, and withdrawing.
     *
     * - MUST be an ERC-20 token contract.
     * - MUST NOT revert.
     */
    function asset() external view returns (address assetTokenAddress);

    /**
     * @dev Returns the total amount of the underlying asset that is “managed” by Vault.
     *
     * - SHOULD include any compounding that occurs from yield.
     * - MUST be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT revert.
     */
    function totalAssets() external view returns (uint256 totalManagedAssets);

    /**
     * @dev Returns the amount of shares that the Vault would exchange for the amount of assets provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToShares(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Returns the amount of assets that the Vault would exchange for the amount of shares provided, in an ideal
     * scenario where all the conditions are met.
     *
     * - MUST NOT be inclusive of any fees that are charged against assets in the Vault.
     * - MUST NOT show any variations depending on the caller.
     * - MUST NOT reflect slippage or other on-chain conditions, when performing the actual exchange.
     * - MUST NOT revert.
     *
     * NOTE: This calculation MAY NOT reflect the “per-user” price-per-share, and instead should reflect the
     * “average-user’s” price-per-share, meaning what the average user should expect to see when exchanging to and
     * from.
     */
    function convertToAssets(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be deposited into the Vault for the receiver,
     * through a deposit call.
     *
     * - MUST return a limited value if receiver is subject to some deposit limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of assets that may be deposited.
     * - MUST NOT revert.
     */
    function maxDeposit(address receiver) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their deposit at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of Vault shares that would be minted in a deposit
     *   call in the same transaction. I.e. deposit should return the same or more shares as previewDeposit if called
     *   in the same transaction.
     * - MUST NOT account for deposit limits like those returned from maxDeposit and should always act as though the
     *   deposit would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewDeposit SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewDeposit(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Mints shares Vault shares to receiver by depositing exactly amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   deposit execution, and are accounted for during deposit.
     * - MUST revert if all of assets cannot be deposited (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function deposit(uint256 assets, address receiver) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of the Vault shares that can be minted for the receiver, through a mint call.
     * - MUST return a limited value if receiver is subject to some mint limit.
     * - MUST return 2 ** 256 - 1 if there is no limit on the maximum amount of shares that may be minted.
     * - MUST NOT revert.
     */
    function maxMint(address receiver) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their mint at the current block, given
     * current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of assets that would be deposited in a mint call
     *   in the same transaction. I.e. mint should return the same or fewer assets as previewMint if called in the
     *   same transaction.
     * - MUST NOT account for mint limits like those returned from maxMint and should always act as though the mint
     *   would be accepted, regardless if the user has enough tokens approved, etc.
     * - MUST be inclusive of deposit fees. Integrators should be aware of the existence of deposit fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewMint SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by minting.
     */
    function previewMint(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Mints exactly shares Vault shares to receiver by depositing amount of underlying tokens.
     *
     * - MUST emit the Deposit event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the mint
     *   execution, and are accounted for during mint.
     * - MUST revert if all of shares cannot be minted (due to deposit limit being reached, slippage, the user not
     *   approving enough underlying tokens to the Vault contract, etc).
     *
     * NOTE: most implementations will require pre-approval of the Vault with the Vault’s underlying asset token.
     */
    function mint(uint256 shares, address receiver) external returns (uint256 assets);

    /**
     * @dev Returns the maximum amount of the underlying asset that can be withdrawn from the owner balance in the
     * Vault, through a withdraw call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxWithdraw(address owner) external view returns (uint256 maxAssets);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their withdrawal at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no fewer than the exact amount of Vault shares that would be burned in a withdraw
     *   call in the same transaction. I.e. withdraw should return the same or fewer shares as previewWithdraw if
     *   called
     *   in the same transaction.
     * - MUST NOT account for withdrawal limits like those returned from maxWithdraw and should always act as though
     *   the withdrawal would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToShares and previewWithdraw SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by depositing.
     */
    function previewWithdraw(uint256 assets) external view returns (uint256 shares);

    /**
     * @dev Burns shares from owner and sends exactly assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   withdraw execution, and are accounted for during withdraw.
     * - MUST revert if all of assets cannot be withdrawn (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * Note that some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function withdraw(uint256 assets, address receiver, address owner) external returns (uint256 shares);

    /**
     * @dev Returns the maximum amount of Vault shares that can be redeemed from the owner balance in the Vault,
     * through a redeem call.
     *
     * - MUST return a limited value if owner is subject to some withdrawal limit or timelock.
     * - MUST return balanceOf(owner) if owner is not subject to any withdrawal limit or timelock.
     * - MUST NOT revert.
     */
    function maxRedeem(address owner) external view returns (uint256 maxShares);

    /**
     * @dev Allows an on-chain or off-chain user to simulate the effects of their redeemption at the current block,
     * given current on-chain conditions.
     *
     * - MUST return as close to and no more than the exact amount of assets that would be withdrawn in a redeem call
     *   in the same transaction. I.e. redeem should return the same or more assets as previewRedeem if called in the
     *   same transaction.
     * - MUST NOT account for redemption limits like those returned from maxRedeem and should always act as though the
     *   redemption would be accepted, regardless if the user has enough shares, etc.
     * - MUST be inclusive of withdrawal fees. Integrators should be aware of the existence of withdrawal fees.
     * - MUST NOT revert.
     *
     * NOTE: any unfavorable discrepancy between convertToAssets and previewRedeem SHOULD be considered slippage in
     * share price or some other type of condition, meaning the depositor will lose assets by redeeming.
     */
    function previewRedeem(uint256 shares) external view returns (uint256 assets);

    /**
     * @dev Burns exactly shares from owner and sends assets of underlying tokens to receiver.
     *
     * - MUST emit the Withdraw event.
     * - MAY support an additional flow in which the underlying tokens are owned by the Vault contract before the
     *   redeem execution, and are accounted for during redeem.
     * - MUST revert if all of shares cannot be redeemed (due to withdrawal limit being reached, slippage, the owner
     *   not having enough shares, etc).
     *
     * NOTE: some implementations will require pre-requesting to the Vault before a withdrawal may be performed.
     * Those methods should be performed separately.
     */
    function redeem(uint256 shares, address receiver, address owner) external returns (uint256 assets);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (utils/ReentrancyGuard.sol)

pragma solidity ^0.8.20;

/**
 * @dev Contract module that helps prevent reentrant calls to a function.
 *
 * Inheriting from `ReentrancyGuard` will make the {nonReentrant} modifier
 * available, which can be applied to functions to make sure there are no nested
 * (reentrant) calls to them.
 *
 * Note that because there is a single `nonReentrant` guard, functions marked as
 * `nonReentrant` may not call one another. This can be worked around by making
 * those functions `private`, and then adding `external` `nonReentrant` entry
 * points to them.
 *
 * TIP: If you would like to learn more about reentrancy and alternative ways
 * to protect against it, check out our blog post
 * https://blog.openzeppelin.com/reentrancy-after-istanbul/[Reentrancy After Istanbul].
 */
abstract contract ReentrancyGuard {
    // Booleans are more expensive than uint256 or any type that takes up a full
    // word because each write operation emits an extra SLOAD to first read the
    // slot's contents, replace the bits taken up by the boolean, and then write
    // back. This is the compiler's defense against contract upgrades and
    // pointer aliasing, and it cannot be disabled.

    // The values being non-zero value makes deployment a bit more expensive,
    // but in exchange the refund on every call to nonReentrant will be lower in
    // amount. Since refunds are capped to a percentage of the total
    // transaction's gas, it is best to keep them low in cases like this one, to
    // increase the likelihood of the full refund coming into effect.
    uint256 private constant NOT_ENTERED = 1;
    uint256 private constant ENTERED = 2;

    uint256 private _status;

    /**
     * @dev Unauthorized reentrant call.
     */
    error ReentrancyGuardReentrantCall();

    constructor() {
        _status = NOT_ENTERED;
    }

    /**
     * @dev Prevents a contract from calling itself, directly or indirectly.
     * Calling a `nonReentrant` function from another `nonReentrant`
     * function is not supported. It is possible to prevent this from happening
     * by making the `nonReentrant` function external, and making it call a
     * `private` function that does the actual work.
     */
    modifier nonReentrant() {
        _nonReentrantBefore();
        _;
        _nonReentrantAfter();
    }

    function _nonReentrantBefore() private {
        // On the first call to nonReentrant, _status will be NOT_ENTERED
        if (_status == ENTERED) {
            revert ReentrancyGuardReentrantCall();
        }

        // Any calls to nonReentrant after this point will fail
        _status = ENTERED;
    }

    function _nonReentrantAfter() private {
        // By storing the original value once again, a refund is triggered (see
        // https://eips.ethereum.org/EIPS/eip-2200)
        _status = NOT_ENTERED;
    }

    /**
     * @dev Returns true if the reentrancy guard is currently set to "entered", which indicates there is a
     * `nonReentrant` function in the call stack.
     */
    function _reentrancyGuardEntered() internal view returns (bool) {
        return _status == ENTERED;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";
import {IERC20Permit} from "../extensions/IERC20Permit.sol";
import {Address} from "../../../utils/Address.sol";

/**
 * @title SafeERC20
 * @dev Wrappers around ERC20 operations that throw on failure (when the token
 * contract returns false). Tokens that return no value (and instead revert or
 * throw on failure) are also supported, non-reverting calls are assumed to be
 * successful.
 * To use this library you can add a `using SafeERC20 for IERC20;` statement to your contract,
 * which allows you to call the safe operations as `token.safeTransfer(...)`, etc.
 */
library SafeERC20 {
    using Address for address;

    /**
     * @dev An operation with an ERC20 token failed.
     */
    error SafeERC20FailedOperation(address token);

    /**
     * @dev Indicates a failed `decreaseAllowance` request.
     */
    error SafeERC20FailedDecreaseAllowance(address spender, uint256 currentAllowance, uint256 requestedDecrease);

    /**
     * @dev Transfer `value` amount of `token` from the calling contract to `to`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeTransfer(IERC20 token, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Transfer `value` amount of `token` from `from` to `to`, spending the approval given by `from` to the
     * calling contract. If `token` returns no value, non-reverting calls are assumed to be successful.
     */
    function safeTransferFrom(IERC20 token, address from, address to, uint256 value) internal {
        _callOptionalReturn(token, abi.encodeCall(token.transferFrom, (from, to, value)));
    }

    /**
     * @dev Increase the calling contract's allowance toward `spender` by `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful.
     */
    function safeIncreaseAllowance(IERC20 token, address spender, uint256 value) internal {
        uint256 oldAllowance = token.allowance(address(this), spender);
        forceApprove(token, spender, oldAllowance + value);
    }

    /**
     * @dev Decrease the calling contract's allowance toward `spender` by `requestedDecrease`. If `token` returns no
     * value, non-reverting calls are assumed to be successful.
     */
    function safeDecreaseAllowance(IERC20 token, address spender, uint256 requestedDecrease) internal {
        unchecked {
            uint256 currentAllowance = token.allowance(address(this), spender);
            if (currentAllowance < requestedDecrease) {
                revert SafeERC20FailedDecreaseAllowance(spender, currentAllowance, requestedDecrease);
            }
            forceApprove(token, spender, currentAllowance - requestedDecrease);
        }
    }

    /**
     * @dev Set the calling contract's allowance toward `spender` to `value`. If `token` returns no value,
     * non-reverting calls are assumed to be successful. Meant to be used with tokens that require the approval
     * to be set to zero before setting it to a non-zero value, such as USDT.
     */
    function forceApprove(IERC20 token, address spender, uint256 value) internal {
        bytes memory approvalCall = abi.encodeCall(token.approve, (spender, value));

        if (!_callOptionalReturnBool(token, approvalCall)) {
            _callOptionalReturn(token, abi.encodeCall(token.approve, (spender, 0)));
            _callOptionalReturn(token, approvalCall);
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We use {Address-functionCall} to perform this call, which verifies that
        // the target address contains contract code and also asserts for success in the low-level call.

        bytes memory returndata = address(token).functionCall(data);
        if (returndata.length != 0 && !abi.decode(returndata, (bool))) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Imitates a Solidity high-level call (i.e. a regular function call to a contract), relaxing the requirement
     * on the return value: the return value is optional (but if data is returned, it must not be false).
     * @param token The token targeted by the call.
     * @param data The call data (encoded using abi.encode or one of its variants).
     *
     * This is a variant of {_callOptionalReturn} that silents catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        // We need to perform a low level call here, to bypass Solidity's return data size checking mechanism, since
        // we're implementing it ourselves. We cannot use {Address-functionCall} here since this should return false
        // and not revert is the subcall reverts.

        (bool success, bytes memory returndata) = address(token).call(data);
        return success && (returndata.length == 0 || abi.decode(returndata, (bool))) && address(token).code.length > 0;
    }
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (access/Ownable.sol)

pragma solidity ^0.8.20;

import {Context} from "../utils/Context.sol";

/**
 * @dev Contract module which provides a basic access control mechanism, where
 * there is an account (an owner) that can be granted exclusive access to
 * specific functions.
 *
 * The initial owner is set to the address provided by the deployer. This can
 * later be changed with {transferOwnership}.
 *
 * This module is used through inheritance. It will make available the modifier
 * `onlyOwner`, which can be applied to your functions to restrict their use to
 * the owner.
 */
abstract contract Ownable is Context {
    address private _owner;

    /**
     * @dev The caller account is not authorized to perform an operation.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The owner is not a valid owner account. (eg. `address(0)`)
     */
    error OwnableInvalidOwner(address owner);

    event OwnershipTransferred(address indexed previousOwner, address indexed newOwner);

    /**
     * @dev Initializes the contract setting the address provided by the deployer as the initial owner.
     */
    constructor(address initialOwner) {
        if (initialOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(initialOwner);
    }

    /**
     * @dev Throws if called by any account other than the owner.
     */
    modifier onlyOwner() {
        _checkOwner();
        _;
    }

    /**
     * @dev Returns the address of the current owner.
     */
    function owner() public view virtual returns (address) {
        return _owner;
    }

    /**
     * @dev Throws if the sender is not the owner.
     */
    function _checkOwner() internal view virtual {
        if (owner() != _msgSender()) {
            revert OwnableUnauthorizedAccount(_msgSender());
        }
    }

    /**
     * @dev Leaves the contract without owner. It will not be possible to call
     * `onlyOwner` functions. Can only be called by the current owner.
     *
     * NOTE: Renouncing ownership will leave the contract without an owner,
     * thereby disabling any functionality that is only available to the owner.
     */
    function renounceOwnership() public virtual onlyOwner {
        _transferOwnership(address(0));
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Can only be called by the current owner.
     */
    function transferOwnership(address newOwner) public virtual onlyOwner {
        if (newOwner == address(0)) {
            revert OwnableInvalidOwner(address(0));
        }
        _transferOwnership(newOwner);
    }

    /**
     * @dev Transfers ownership of the contract to a new account (`newOwner`).
     * Internal function without access restriction.
     */
    function _transferOwnership(address newOwner) internal virtual {
        address oldOwner = _owner;
        _owner = newOwner;
        emit OwnershipTransferred(oldOwner, newOwner);
    }
}

// SPDX-License-Identifier: BUSL-1.1
pragma solidity 0.8.26;

import {IERC4626} from "@openzeppelin/contracts/interfaces/IERC4626.sol";
import {IERC20} from "@openzeppelin/contracts/interfaces/IERC20.sol";
import {SafeERC20} from "@openzeppelin/contracts/token/ERC20/utils/SafeERC20.sol";
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol";

/// @title ReferralPlasmaVault
/// @notice Extension contract that adds referral functionality to ERC4626 vaults
/// @dev This contract acts as a wrapper around ERC4626 vaults, enabling referral tracking
/// while maintaining the standard vault deposit functionality. It uses SafeERC20 for
/// secure token transfers and approvals.
contract ReferralPlasmaVault is Ownable {
    using SafeERC20 for IERC20;

    address public zapInAddress;

    error NotZapIn();
    error ZapInAddressIsZero();

    /// @notice Emitted when a deposit is made with a referral code
    /// @param referrer The address that initiated the deposit with referral
    /// @param referralCode The unique identifier for the referral
    event ReferralEvent(address indexed referrer, bytes32 referralCode);

    modifier onlyZapIn() {
        if (msg.sender != zapInAddress) {
            revert NotZapIn();
        }
        _;
    }

    constructor() Ownable(msg.sender) {}

    /// @notice Deposits assets into a vault and tracks the referral
    /// @dev This function:
    ///     1. Transfers assets from the caller to this contract
    ///     2. Approves the vault to spend the assets
    ///     3. Deposits the assets into the vault
    ///     4. Emits a referral event with the caller as referrer
    /// @param vault_ The address of the ERC4626 vault to deposit into
    /// @param assets_ The amount of assets to deposit
    /// @param receiver_ The address that will receive the vault shares
    /// @param referralCode_ The unique identifier for the referral
    /// @return The amount of vault shares minted to the receiver
    function deposit(
        address vault_,
        uint256 assets_,
        address receiver_,
        bytes32 referralCode_
    ) external returns (uint256) {
        address assetAddress = IERC4626(vault_).asset();
        IERC20(assetAddress).safeTransferFrom(msg.sender, address(this), assets_);
        IERC20(assetAddress).forceApprove(vault_, assets_);

        emit ReferralEvent(msg.sender, referralCode_);
        return IERC4626(vault_).deposit(assets_, receiver_);
    }

    /// @notice Emits a referral event for zap-in operations
    /// @dev This function is called by the zap-in contract to emit referral events when users
    ///      perform zap-in operations with referral codes. It allows the referral system to track
    ///      successful zap-in transactions that include referral information.
    /// @param referrer The address of the user who initiated the zap-in operation with referral
    /// @param referralCode_ The unique referral code associated with the zap-in operation
    /// @custom:access Only the authorized zap-in contract can call this function
    /// @custom:security Protected by onlyZapIn modifier to prevent unauthorized referral event emission
    /// @custom:event Emits ReferralEvent with the referrer address and referral code for tracking
    function emitReferralForZapIn(address referrer, bytes32 referralCode_) external onlyZapIn {
        emit ReferralEvent(referrer, referralCode_);
    }

    /// @notice Sets the authorized zap-in contract address and renounces ownership
    /// @dev This function can only be called once by the owner. After setting the zap-in address,
    ///      the ownership is permanently renounced, making the contract immutable for future changes.
    ///      This ensures that only the designated zap-in contract can emit referral events.
    /// @param zapInAddress_ The address of the authorized zap-in contract that can emit referral events
    /// @custom:security This function permanently renounces ownership after execution, ensuring the zap-in address cannot be changed
    /// @custom:access Only the contract owner can call this function, and only once
    /// @custom:effect After execution, the contract becomes ownerless and the zap-in address is permanently set
    /// @custom:validation Reverts if the provided address is zero
    function setZapInAddress(address zapInAddress_) external onlyOwner {
        if (zapInAddress_ == address(0)) {
            revert ZapInAddressIsZero();
        }
        zapInAddress = zapInAddress_;
        renounceOwnership();
    }
}

File 9 of 13 : IERC20.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (interfaces/IERC20.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../token/ERC20/IERC20.sol";

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 standard as defined in the EIP.
 */
interface IERC20 {
    /**
     * @dev Emitted when `value` tokens are moved from one account (`from`) to
     * another (`to`).
     *
     * Note that `value` may be zero.
     */
    event Transfer(address indexed from, address indexed to, uint256 value);

    /**
     * @dev Emitted when the allowance of a `spender` for an `owner` is set by
     * a call to {approve}. `value` is the new allowance.
     */
    event Approval(address indexed owner, address indexed spender, uint256 value);

    /**
     * @dev Returns the value of tokens in existence.
     */
    function totalSupply() external view returns (uint256);

    /**
     * @dev Returns the value of tokens owned by `account`.
     */
    function balanceOf(address account) external view returns (uint256);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transfer(address to, uint256 value) external returns (bool);

    /**
     * @dev Returns the remaining number of tokens that `spender` will be
     * allowed to spend on behalf of `owner` through {transferFrom}. This is
     * zero by default.
     *
     * This value changes when {approve} or {transferFrom} are called.
     */
    function allowance(address owner, address spender) external view returns (uint256);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * IMPORTANT: Beware that changing an allowance with this method brings the risk
     * that someone may use both the old and the new allowance by unfortunate
     * transaction ordering. One possible solution to mitigate this race
     * condition is to first reduce the spender's allowance to 0 and set the
     * desired value afterwards:
     * https://github.com/ethereum/EIPs/issues/20#issuecomment-263524729
     *
     * Emits an {Approval} event.
     */
    function approve(address spender, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the
     * allowance mechanism. `value` is then deducted from the caller's
     * allowance.
     *
     * Returns a boolean value indicating whether the operation succeeded.
     *
     * Emits a {Transfer} event.
     */
    function transferFrom(address from, address to, uint256 value) external returns (bool);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Metadata.sol)

pragma solidity ^0.8.20;

import {IERC20} from "../IERC20.sol";

/**
 * @dev Interface for the optional metadata functions from the ERC20 standard.
 */
interface IERC20Metadata is IERC20 {
    /**
     * @dev Returns the name of the token.
     */
    function name() external view returns (string memory);

    /**
     * @dev Returns the symbol of the token.
     */
    function symbol() external view returns (string memory);

    /**
     * @dev Returns the decimals places of the token.
     */
    function decimals() external view returns (uint8);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (token/ERC20/extensions/IERC20Permit.sol)

pragma solidity ^0.8.20;

/**
 * @dev Interface of the ERC20 Permit extension allowing approvals to be made via signatures, as defined in
 * https://eips.ethereum.org/EIPS/eip-2612[EIP-2612].
 *
 * Adds the {permit} method, which can be used to change an account's ERC20 allowance (see {IERC20-allowance}) by
 * presenting a message signed by the account. By not relying on {IERC20-approve}, the token holder account doesn't
 * need to send a transaction, and thus is not required to hold Ether at all.
 *
 * ==== Security Considerations
 *
 * There are two important considerations concerning the use of `permit`. The first is that a valid permit signature
 * expresses an allowance, and it should not be assumed to convey additional meaning. In particular, it should not be
 * considered as an intention to spend the allowance in any specific way. The second is that because permits have
 * built-in replay protection and can be submitted by anyone, they can be frontrun. A protocol that uses permits should
 * take this into consideration and allow a `permit` call to fail. Combining these two aspects, a pattern that may be
 * generally recommended is:
 *
 * ```solidity
 * function doThingWithPermit(..., uint256 value, uint256 deadline, uint8 v, bytes32 r, bytes32 s) public {
 *     try token.permit(msg.sender, address(this), value, deadline, v, r, s) {} catch {}
 *     doThing(..., value);
 * }
 *
 * function doThing(..., uint256 value) public {
 *     token.safeTransferFrom(msg.sender, address(this), value);
 *     ...
 * }
 * ```
 *
 * Observe that: 1) `msg.sender` is used as the owner, leaving no ambiguity as to the signer intent, and 2) the use of
 * `try/catch` allows the permit to fail and makes the code tolerant to frontrunning. (See also
 * {SafeERC20-safeTransferFrom}).
 *
 * Additionally, note that smart contract wallets (such as Argent or Safe) are not able to produce permit signatures, so
 * contracts should have entry points that don't rely on permit.
 */
interface IERC20Permit {
    /**
     * @dev Sets `value` as the allowance of `spender` over ``owner``'s tokens,
     * given ``owner``'s signed approval.
     *
     * IMPORTANT: The same issues {IERC20-approve} has related to transaction
     * ordering also apply here.
     *
     * Emits an {Approval} event.
     *
     * Requirements:
     *
     * - `spender` cannot be the zero address.
     * - `deadline` must be a timestamp in the future.
     * - `v`, `r` and `s` must be a valid `secp256k1` signature from `owner`
     * over the EIP712-formatted function arguments.
     * - the signature must use ``owner``'s current nonce (see {nonces}).
     *
     * For more information on the signature format, see the
     * https://eips.ethereum.org/EIPS/eip-2612#specification[relevant EIP
     * section].
     *
     * CAUTION: See Security Considerations above.
     */
    function permit(
        address owner,
        address spender,
        uint256 value,
        uint256 deadline,
        uint8 v,
        bytes32 r,
        bytes32 s
    ) external;

    /**
     * @dev Returns the current nonce for `owner`. This value must be
     * included whenever a signature is generated for {permit}.
     *
     * Every successful call to {permit} increases ``owner``'s nonce by one. This
     * prevents a signature from being used multiple times.
     */
    function nonces(address owner) external view returns (uint256);

    /**
     * @dev Returns the domain separator used in the encoding of the signature for {permit}, as defined by {EIP712}.
     */
    // solhint-disable-next-line func-name-mixedcase
    function DOMAIN_SEPARATOR() external view returns (bytes32);
}

// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Context.sol)

pragma solidity ^0.8.20;

/**
 * @dev Provides information about the current execution context, including the
 * sender of the transaction and its data. While these are generally available
 * via msg.sender and msg.data, they should not be accessed in such a direct
 * manner, since when dealing with meta-transactions the account sending and
 * paying for execution may not be the actual sender (as far as an application
 * is concerned).
 *
 * This contract is only required for intermediate, library-like contracts.
 */
abstract contract Context {
    function _msgSender() internal view virtual returns (address) {
        return msg.sender;
    }

    function _msgData() internal view virtual returns (bytes calldata) {
        return msg.data;
    }

    function _contextSuffixLength() internal view virtual returns (uint256) {
        return 0;
    }
}

Settings
{
  "remappings": [
    "@openzeppelin/=node_modules/@openzeppelin/",
    "@uniswap/v3-core/=node_modules/@uniswap/v3-core/",
    "eth-gas-reporter/=node_modules/eth-gas-reporter/",
    "ds-test/=lib/forge-std/lib/ds-test/src/",
    "forge-std/=lib/forge-std/src/",
    "foundry-random/=lib/foundry-random/src/",
    "@ethereum-vault-connector/=node_modules/ethereum-vault-connector/",
    "@pendle/core-v2/=node_modules/@pendle/core-v2/",
    "@chainlink/=node_modules/@chainlink/",
    "@eth-optimism/=node_modules/@eth-optimism/",
    "@morpho-org/=node_modules/@morpho-org/",
    "@prb/test/=lib/foundry-random/lib/prb-test/src/",
    "@scroll-tech/=node_modules/@scroll-tech/",
    "CramBit/=lib/foundry-random/lib/CramBit/",
    "base64-sol/=node_modules/base64-sol/",
    "crambit/=lib/foundry-random/lib/CramBit/src/",
    "ethereum-vault-connector/=node_modules/ethereum-vault-connector/",
    "foundry-random/=lib/foundry-random/src/",
    "openzeppelin/=node_modules/ethereum-vault-connector/lib/openzeppelin-contracts/contracts/",
    "prb-test/=lib/foundry-random/lib/prb-test/src/",
    "solidity-bytes-utils/=lib/foundry-random/lib/solidity-bytes-utils/contracts/",
    "src/=lib/foundry-random/src/"
  ],
  "optimizer": {
    "enabled": true,
    "runs": 1000000
  },
  "metadata": {
    "useLiteralContent": false,
    "bytecodeHash": "ipfs",
    "appendCBOR": true
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "evmVersion": "cancun",
  "viaIR": false
}

Contract Security Audit

Contract ABI

API
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"AddressInsufficientBalance","type":"error"},{"inputs":[],"name":"ERC4626VaultIsZero","type":"error"},{"inputs":[],"name":"FailedInnerCall","type":"error"},{"inputs":[],"name":"InsufficientDepositAssetBalance","type":"error"},{"inputs":[],"name":"MinAmountToDepositIsZero","type":"error"},{"inputs":[],"name":"NoCalls","type":"error"},{"inputs":[{"internalType":"address","name":"owner","type":"address"}],"name":"OwnableInvalidOwner","type":"error"},{"inputs":[{"internalType":"address","name":"account","type":"address"}],"name":"OwnableUnauthorizedAccount","type":"error"},{"inputs":[],"name":"ReceiverIsZero","type":"error"},{"inputs":[],"name":"ReentrancyGuardReentrantCall","type":"error"},{"inputs":[],"name":"ReferralContractAddressIsZero","type":"error"},{"inputs":[{"internalType":"address","name":"token","type":"address"}],"name":"SafeERC20FailedOperation","type":"error"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"previousOwner","type":"address"},{"indexed":true,"internalType":"address","name":"newOwner","type":"address"}],"name":"OwnershipTransferred","type":"event"},{"inputs":[],"name":"ZAP_IN_ALLOWANCE_CONTRACT","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"currentZapSender","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"referralContractAddress","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"renounceOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"referralContractAddress_","type":"address"}],"name":"setReferralContractAddress","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"newOwner","type":"address"}],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmountToDeposit","type":"uint256"},{"internalType":"address[]","name":"assetsToRefundToSender","type":"address[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"nativeTokenAmount","type":"uint256"}],"internalType":"struct Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct ZapInData","name":"zapInData_","type":"tuple"},{"internalType":"bytes32","name":"referralCode_","type":"bytes32"}],"name":"zapIn","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"},{"inputs":[{"components":[{"internalType":"address","name":"vault","type":"address"},{"internalType":"address","name":"receiver","type":"address"},{"internalType":"uint256","name":"minAmountToDeposit","type":"uint256"},{"internalType":"address[]","name":"assetsToRefundToSender","type":"address[]"},{"components":[{"internalType":"address","name":"target","type":"address"},{"internalType":"bytes","name":"data","type":"bytes"},{"internalType":"uint256","name":"nativeTokenAmount","type":"uint256"}],"internalType":"struct Call[]","name":"calls","type":"tuple[]"}],"internalType":"struct ZapInData","name":"zapInData_","type":"tuple"}],"name":"zapIn","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"payable","type":"function"}]

60a060405234801561000f575f80fd5b5060015f55338061003957604051631e4fbdf760e01b81525f600482015260240160405180910390fd5b6100428161008b565b5030604051610050906100dc565b6001600160a01b039091168152602001604051809103905ff080158015610079573d5f803e3d5ffd5b506001600160a01b03166080526100e9565b600180546001600160a01b038381166001600160a01b0319831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b6107ea806114af83390190565b6080516113ae6101015f395f61015e01526113ae5ff3fe608060405260043610610093575f3560e01c8063b02b7e9511610066578063d2e09caf1161004c578063d2e09caf14610193578063ea22c61f146101b2578063f2fde38b146101de575f80fd5b8063b02b7e951461014d578063bbb12b5414610180575f80fd5b80632d79a5521461009757806347cd8e04146100ed578063715018a61461010d5780638da5cb5b14610123575b5f80fd5b3480156100a2575f80fd5b506002546100c39073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101006100fb366004611037565b6101fd565b6040516100e49190611079565b348015610118575f80fd5b50610121610a5c565b005b34801561012e575f80fd5b5060015473ffffffffffffffffffffffffffffffffffffffff166100c3565b348015610158575f80fd5b506100c37f000000000000000000000000000000000000000000000000000000000000000081565b61010061018e366004611139565b610a6f565b34801561019e575f80fd5b506101216101ad366004611194565b610a7b565b3480156101bd575f80fd5b506003546100c39073ffffffffffffffffffffffffffffffffffffffff1681565b3480156101e9575f80fd5b506101216101f8366004611194565b610b1b565b6060610207610b80565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317905560408301355f0361026e576040517f97493d1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61027c6020850185611194565b73ffffffffffffffffffffffffffffffffffffffff16036102c9576040517fe3d5de4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6102d760808501856111af565b90509050805f03610314576040517fc42f653100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6103256040860160208701611194565b73ffffffffffffffffffffffffffffffffffffffff1603610372576040517f0e3c5d7c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8067ffffffffffffffff81111561038b5761038b61121a565b6040519080825280602002602001820160405280156103be57816020015b60608152602001906001900390816103a95790505b5091505f5b8181101561061b575f6103d960808701876111af565b838181106103e9576103e9611247565b90506020028101906103fb9190611274565b6040013511156105285761050661041560808701876111af565b8381811061042557610425611247565b90506020028101906104379190611274565b6104459060208101906112b0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506104869250505060808801886111af565b8481811061049657610496611247565b90506020028101906104a89190611274565b604001356104b960808901896111af565b858181106104c9576104c9611247565b90506020028101906104db9190611274565b6104e9906020810190611194565b73ffffffffffffffffffffffffffffffffffffffff169190610bc1565b83828151811061051857610518611247565b6020026020010181905250610613565b6105f561053860808701876111af565b8381811061054857610548611247565b905060200281019061055a9190611274565b6105689060208101906112b0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506105a99250505060808801886111af565b848181106105b9576105b9611247565b90506020028101906105cb9190611274565b6105d9906020810190611194565b73ffffffffffffffffffffffffffffffffffffffff1690610c82565b83828151811061060757610607611247565b60200260200101819052505b6001016103c3565b505f61062a6020860186611194565b90505f8173ffffffffffffffffffffffffffffffffffffffff166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610676573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069a9190611311565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015610704573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610728919061132c565b90508560400135811015610768576040517fbbc98cbf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025473ffffffffffffffffffffffffffffffffffffffff161580159061078e57508415155b1561081d576002546003546040517f4779ee5d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260248101889052911690634779ee5d906044015f604051808303815f87803b158015610806575f80fd5b505af1158015610818573d5f803e3d5ffd5b505050505b73ffffffffffffffffffffffffffffffffffffffff8216636e553f658261084a60408a0160208b01611194565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925273ffffffffffffffffffffffffffffffffffffffff1660248201526044016020604051808303815f875af11580156108b8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108dc919061132c565b505f6108eb60608801886111af565b905090505f805f5b838110156109f35761090860608b018b6111af565b8281811061091857610918611247565b905060200201602081019061092d9190611194565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290935073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610998573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109bc919061132c565b915081156109eb576003546109eb9073ffffffffffffffffffffffffffffffffffffffff858116911684610c8f565b6001016108f3565b50478015610a1e57600354610a1e9073ffffffffffffffffffffffffffffffffffffffff1682610d21565b50505050505050600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055610a5660015f55565b92915050565b610a64610df3565b610a6d5f610e46565b565b6060610a56825f6101fd565b610a83610df3565b73ffffffffffffffffffffffffffffffffffffffff8116610ad0576040517f22cdca5200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316179055610b18610a5c565b50565b610b23610df3565b73ffffffffffffffffffffffffffffffffffffffff8116610b77576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b610b1881610e46565b60025f5403610bbb576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025f55565b606081471015610bff576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610b6e565b5f808573ffffffffffffffffffffffffffffffffffffffff168486604051610c279190611343565b5f6040518083038185875af1925050503d805f8114610c61576040519150601f19603f3d011682016040523d82523d5f602084013e610c66565b606091505b5091509150610c76868383610ebc565b925050505b9392505050565b6060610c7b83835f610bc1565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610d1c908490610f4b565b505050565b80471015610d5d576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610b6e565b5f8273ffffffffffffffffffffffffffffffffffffffff16826040515f6040518083038185875af1925050503d805f8114610db3576040519150601f19603f3d011682016040523d82523d5f602084013e610db8565b606091505b5050905080610d1c576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015473ffffffffffffffffffffffffffffffffffffffff163314610a6d576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610b6e565b6001805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b606082610ed157610ecc82610fdf565b610c7b565b8151158015610ef5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610f44576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610b6e565b5080610c7b565b5f610f6c73ffffffffffffffffffffffffffffffffffffffff841683610c82565b905080515f14158015610f90575080806020019051810190610f8e9190611359565b155b15610d1c576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610b6e565b805115610fef5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60a08284031215611031575f80fd5b50919050565b5f8060408385031215611048575f80fd5b823567ffffffffffffffff81111561105e575f80fd5b61106a85828601611021565b95602094909401359450505050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b8281101561112d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0878603018452815180518087528060208301602089015e5f6020828901015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168801019650505060208201915060208401935060018101905061109f565b50929695505050505050565b5f60208284031215611149575f80fd5b813567ffffffffffffffff81111561115f575f80fd5b61116b84828501611021565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b18575f80fd5b5f602082840312156111a4575f80fd5b8135610c7b81611173565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126111e2575f80fd5b83018035915067ffffffffffffffff8211156111fc575f80fd5b6020019150600581901b3603821315611213575f80fd5b9250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126112a6575f80fd5b9190910192915050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126112e3575f80fd5b83018035915067ffffffffffffffff8211156112fd575f80fd5b602001915036819003821315611213575f80fd5b5f60208284031215611321575f80fd5b8151610c7b81611173565b5f6020828403121561133c575f80fd5b5051919050565b5f82518060208501845e5f920191825250919050565b5f60208284031215611369575f80fd5b81518015158114610c7b575f80fdfea264697066735822122038ba6b8b221d476673b8a23fc887d1b8d044c274ee1bbf87f2f13686876badf864736f6c634300081a003360a0604052348015600e575f80fd5b506040516107ea3803806107ea833981016040819052602b91603b565b6001600160a01b03166080526066565b5f60208284031215604a575f80fd5b81516001600160a01b0381168114605f575f80fd5b9392505050565b6080516107586100925f395f818160a60152818161013a0152818161021a015261031101526107585ff3fe60806040526004361061002c575f3560e01c806329fd1dae14610095578063f738a98c146100f257610063565b36610063576040517f442a291100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b6040517f442a291100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b3480156100a0575f80fd5b506100c87f000000000000000000000000000000000000000000000000000000000000000081565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b3480156100fd575f80fd5b5061011161010c3660046106a8565b610121565b60405190151581526020016100e9565b5f3373ffffffffffffffffffffffffffffffffffffffff7f00000000000000000000000000000000000000000000000000000000000000001614610191576040517f9225609b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b815f036101ca576040517f43ad20fc00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b73ffffffffffffffffffffffffffffffffffffffff8316610217576040517f503445e600000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663ea22c61f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610281573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906102a591906106d2565b905073ffffffffffffffffffffffffffffffffffffffff81166102f4576040517f906881be00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b61033673ffffffffffffffffffffffffffffffffffffffff8516827f0000000000000000000000000000000000000000000000000000000000000000866103a7565b8373ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff167f25ef7d872fb28420f2742ec1315586f64c03bcabef574ff293e5663c52dcdcf78560405161039591815260200190565b60405180910390a35060019392505050565b6040805173ffffffffffffffffffffffffffffffffffffffff85811660248301528416604482015260648082018490528251808303909101815260849091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167f23b872dd0000000000000000000000000000000000000000000000000000000017905261043c908590610442565b50505050565b5f61046373ffffffffffffffffffffffffffffffffffffffff8416836104e0565b905080515f1415801561048757508080602001905181019061048591906106ed565b155b156104db576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff841660048201526024015b60405180910390fd5b505050565b60606104ed83835f6104f4565b9392505050565b606081471015610532576040517fcd7860590000000000000000000000000000000000000000000000000000000081523060048201526024016104d2565b5f808573ffffffffffffffffffffffffffffffffffffffff16848660405161055a919061070c565b5f6040518083038185875af1925050503d805f8114610594576040519150601f19603f3d011682016040523d82523d5f602084013e610599565b606091505b50915091506105a98683836105b3565b9695505050505050565b6060826105c8576105c382610642565b6104ed565b81511580156105ec575073ffffffffffffffffffffffffffffffffffffffff84163b155b1561063b576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff851660048201526024016104d2565b50806104ed565b8051156106525780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b50565b73ffffffffffffffffffffffffffffffffffffffff81168114610684575f80fd5b5f80604083850312156106b9575f80fd5b82356106c481610687565b946020939093013593505050565b5f602082840312156106e2575f80fd5b81516104ed81610687565b5f602082840312156106fd575f80fd5b815180151581146104ed575f80fd5b5f82518060208501845e5f92019182525091905056fea264697066735822122098ecd444da3c37253c3985c77b586869ac41e80a2cc124642ebec9b12969de0764736f6c634300081a0033

Deployed Bytecode

0x608060405260043610610093575f3560e01c8063b02b7e9511610066578063d2e09caf1161004c578063d2e09caf14610193578063ea22c61f146101b2578063f2fde38b146101de575f80fd5b8063b02b7e951461014d578063bbb12b5414610180575f80fd5b80632d79a5521461009757806347cd8e04146100ed578063715018a61461010d5780638da5cb5b14610123575b5f80fd5b3480156100a2575f80fd5b506002546100c39073ffffffffffffffffffffffffffffffffffffffff1681565b60405173ffffffffffffffffffffffffffffffffffffffff90911681526020015b60405180910390f35b6101006100fb366004611037565b6101fd565b6040516100e49190611079565b348015610118575f80fd5b50610121610a5c565b005b34801561012e575f80fd5b5060015473ffffffffffffffffffffffffffffffffffffffff166100c3565b348015610158575f80fd5b506100c37f0000000000000000000000008e50d9b464d9281ac80dd60e0eeda8f0185be35a81565b61010061018e366004611139565b610a6f565b34801561019e575f80fd5b506101216101ad366004611194565b610a7b565b3480156101bd575f80fd5b506003546100c39073ffffffffffffffffffffffffffffffffffffffff1681565b3480156101e9575f80fd5b506101216101f8366004611194565b610b1b565b6060610207610b80565b600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000163317905560408301355f0361026e576040517f97493d1700000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f61027c6020850185611194565b73ffffffffffffffffffffffffffffffffffffffff16036102c9576040517fe3d5de4900000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6102d760808501856111af565b90509050805f03610314576040517fc42f653100000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f6103256040860160208701611194565b73ffffffffffffffffffffffffffffffffffffffff1603610372576040517f0e3c5d7c00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8067ffffffffffffffff81111561038b5761038b61121a565b6040519080825280602002602001820160405280156103be57816020015b60608152602001906001900390816103a95790505b5091505f5b8181101561061b575f6103d960808701876111af565b838181106103e9576103e9611247565b90506020028101906103fb9190611274565b6040013511156105285761050661041560808701876111af565b8381811061042557610425611247565b90506020028101906104379190611274565b6104459060208101906112b0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506104869250505060808801886111af565b8481811061049657610496611247565b90506020028101906104a89190611274565b604001356104b960808901896111af565b858181106104c9576104c9611247565b90506020028101906104db9190611274565b6104e9906020810190611194565b73ffffffffffffffffffffffffffffffffffffffff169190610bc1565b83828151811061051857610518611247565b6020026020010181905250610613565b6105f561053860808701876111af565b8381811061054857610548611247565b905060200281019061055a9190611274565b6105689060208101906112b0565b8080601f0160208091040260200160405190810160405280939291908181526020018383808284375f920191909152506105a99250505060808801886111af565b848181106105b9576105b9611247565b90506020028101906105cb9190611274565b6105d9906020810190611194565b73ffffffffffffffffffffffffffffffffffffffff1690610c82565b83828151811061060757610607611247565b60200260200101819052505b6001016103c3565b505f61062a6020860186611194565b90505f8173ffffffffffffffffffffffffffffffffffffffff166338d52e0f6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610676573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061069a9190611311565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015273ffffffffffffffffffffffffffffffffffffffff91909116906370a0823190602401602060405180830381865afa158015610704573d5f803e3d5ffd5b505050506040513d601f19601f82011682018060405250810190610728919061132c565b90508560400135811015610768576040517fbbc98cbf00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025473ffffffffffffffffffffffffffffffffffffffff161580159061078e57508415155b1561081d576002546003546040517f4779ee5d00000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff918216600482015260248101889052911690634779ee5d906044015f604051808303815f87803b158015610806575f80fd5b505af1158015610818573d5f803e3d5ffd5b505050505b73ffffffffffffffffffffffffffffffffffffffff8216636e553f658261084a60408a0160208b01611194565b6040517fffffffff0000000000000000000000000000000000000000000000000000000060e085901b168152600481019290925273ffffffffffffffffffffffffffffffffffffffff1660248201526044016020604051808303815f875af11580156108b8573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906108dc919061132c565b505f6108eb60608801886111af565b905090505f805f5b838110156109f35761090860608b018b6111af565b8281811061091857610918611247565b905060200201602081019061092d9190611194565b6040517f70a0823100000000000000000000000000000000000000000000000000000000815230600482015290935073ffffffffffffffffffffffffffffffffffffffff8416906370a0823190602401602060405180830381865afa158015610998573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906109bc919061132c565b915081156109eb576003546109eb9073ffffffffffffffffffffffffffffffffffffffff858116911684610c8f565b6001016108f3565b50478015610a1e57600354610a1e9073ffffffffffffffffffffffffffffffffffffffff1682610d21565b50505050505050600380547fffffffffffffffffffffffff0000000000000000000000000000000000000000169055610a5660015f55565b92915050565b610a64610df3565b610a6d5f610e46565b565b6060610a56825f6101fd565b610a83610df3565b73ffffffffffffffffffffffffffffffffffffffff8116610ad0576040517f22cdca5200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b600280547fffffffffffffffffffffffff00000000000000000000000000000000000000001673ffffffffffffffffffffffffffffffffffffffff8316179055610b18610a5c565b50565b610b23610df3565b73ffffffffffffffffffffffffffffffffffffffff8116610b77576040517f1e4fbdf70000000000000000000000000000000000000000000000000000000081525f60048201526024015b60405180910390fd5b610b1881610e46565b60025f5403610bbb576040517f3ee5aeb500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60025f55565b606081471015610bff576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610b6e565b5f808573ffffffffffffffffffffffffffffffffffffffff168486604051610c279190611343565b5f6040518083038185875af1925050503d805f8114610c61576040519150601f19603f3d011682016040523d82523d5f602084013e610c66565b606091505b5091509150610c76868383610ebc565b925050505b9392505050565b6060610c7b83835f610bc1565b6040805173ffffffffffffffffffffffffffffffffffffffff8416602482015260448082018490528251808303909101815260649091019091526020810180517bffffffffffffffffffffffffffffffffffffffffffffffffffffffff167fa9059cbb00000000000000000000000000000000000000000000000000000000179052610d1c908490610f4b565b505050565b80471015610d5d576040517fcd786059000000000000000000000000000000000000000000000000000000008152306004820152602401610b6e565b5f8273ffffffffffffffffffffffffffffffffffffffff16826040515f6040518083038185875af1925050503d805f8114610db3576040519150601f19603f3d011682016040523d82523d5f602084013e610db8565b606091505b5050905080610d1c576040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60015473ffffffffffffffffffffffffffffffffffffffff163314610a6d576040517f118cdaa7000000000000000000000000000000000000000000000000000000008152336004820152602401610b6e565b6001805473ffffffffffffffffffffffffffffffffffffffff8381167fffffffffffffffffffffffff0000000000000000000000000000000000000000831681179093556040519116919082907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0905f90a35050565b606082610ed157610ecc82610fdf565b610c7b565b8151158015610ef5575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610f44576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610b6e565b5080610c7b565b5f610f6c73ffffffffffffffffffffffffffffffffffffffff841683610c82565b905080515f14158015610f90575080806020019051810190610f8e9190611359565b155b15610d1c576040517f5274afe700000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff84166004820152602401610b6e565b805115610fef5780518082602001fd5b6040517f1425ea4200000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f60a08284031215611031575f80fd5b50919050565b5f8060408385031215611048575f80fd5b823567ffffffffffffffff81111561105e575f80fd5b61106a85828601611021565b95602094909401359450505050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b8281101561112d577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0878603018452815180518087528060208301602089015e5f6020828901015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168801019650505060208201915060208401935060018101905061109f565b50929695505050505050565b5f60208284031215611149575f80fd5b813567ffffffffffffffff81111561115f575f80fd5b61116b84828501611021565b949350505050565b73ffffffffffffffffffffffffffffffffffffffff81168114610b18575f80fd5b5f602082840312156111a4575f80fd5b8135610c7b81611173565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126111e2575f80fd5b83018035915067ffffffffffffffff8211156111fc575f80fd5b6020019150600581901b3603821315611213575f80fd5b9250929050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f82357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa18336030181126112a6575f80fd5b9190910192915050565b5f8083357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe18436030181126112e3575f80fd5b83018035915067ffffffffffffffff8211156112fd575f80fd5b602001915036819003821315611213575f80fd5b5f60208284031215611321575f80fd5b8151610c7b81611173565b5f6020828403121561133c575f80fd5b5051919050565b5f82518060208501845e5f920191825250919050565b5f60208284031215611369575f80fd5b81518015158114610c7b575f80fdfea264697066735822122038ba6b8b221d476673b8a23fc887d1b8d044c274ee1bbf87f2f13686876badf864736f6c634300081a0033

Block Uncle Number Difficulty Gas Used Reward
View All Uncles
Loading...
Loading
Loading...
Loading
Loading...
Loading
[ Download: CSV Export  ]
[ 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.