S Price: $0.73931 (-3.03%)

Contract

0x24ae0218D9e33B27bBB8Ad7C55b2bE5A1083F14d

Overview

S Balance

Sonic LogoSonic LogoSonic Logo0 S

S Value

$0.00

Multichain Info

No addresses found
Transaction Hash
Method
Block
From
To
Multicall100213572025-02-25 9:36:3522 hrs ago1740476195IN
0x24ae0218...A1083F14d
0 S0.0876021855

Parent Transaction Hash Block From To
View All Internal Transactions
Loading...
Loading

Contract Source Code Verified (Exact Match)

Contract Name:
YelayLiteVault

Compiler Version
v0.8.28+commit.7893614a

Optimization Enabled:
Yes with 10000 runs

Other Settings:
cancun EvmVersion
File 1 of 13 : YelayLiteVault.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {Proxy} from "@openzeppelin/contracts/proxy/Proxy.sol";
import {Multicall} from "@openzeppelin/contracts/utils/Multicall.sol";

import {LibOwner} from "src/libraries/LibOwner.sol";
import {LibFunds, ERC20} from "src/libraries/LibFunds.sol";
import {LibErrors} from "src/libraries/LibErrors.sol";

import {IOwnerFacet} from "src/interfaces/IOwnerFacet.sol";
import {ISwapper} from "src/interfaces/ISwapper.sol";

contract YelayLiteVault is Proxy, Multicall {
    constructor(
        address _owner,
        address _ownerFacet,
        address underlyingAsset,
        address yieldExtractor,
        string memory uri
    ) {
        LibOwner.OwnerStorage storage s = LibOwner._getOwnerStorage();
        // set owner
        s.owner = _owner;

        // set OwnerFacet selectors
        s.selectorToFacet[IOwnerFacet.owner.selector] = _ownerFacet;
        s.selectorToFacet[IOwnerFacet.pendingOwner.selector] = _ownerFacet;
        s.selectorToFacet[IOwnerFacet.transferOwnership.selector] = _ownerFacet;
        s.selectorToFacet[IOwnerFacet.acceptOwnership.selector] = _ownerFacet;
        s.selectorToFacet[IOwnerFacet.setSelectorToFacets.selector] = _ownerFacet;
        s.selectorToFacet[IOwnerFacet.selectorToFacet.selector] = _ownerFacet;

        // set Multicall selector
        s.selectorToFacet[Multicall.multicall.selector] = address(this);

        LibFunds.FundsStorage storage sF = LibFunds._getFundsStorage();
        sF.underlyingAsset = ERC20(underlyingAsset);
        sF.yieldExtractor = yieldExtractor;

        LibFunds.ERC1155Storage storage sT = LibFunds._getERC1155Storage();
        sT._uri = uri;
    }

    function _implementation() internal view override returns (address) {
        LibOwner.OwnerStorage storage s = LibOwner._getOwnerStorage();
        address facet = s.selectorToFacet[msg.sig];
        require(facet != address(0), LibErrors.InvalidSelector(msg.sig));
        return facet;
    }

    receive() external payable {}
}

File 2 of 13 : Proxy.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.0) (proxy/Proxy.sol)

pragma solidity ^0.8.20;

/**
 * @dev This abstract contract provides a fallback function that delegates all calls to another contract using the EVM
 * instruction `delegatecall`. We refer to the second contract as the _implementation_ behind the proxy, and it has to
 * be specified by overriding the virtual {_implementation} function.
 *
 * Additionally, delegation to the implementation can be triggered manually through the {_fallback} function, or to a
 * different contract through the {_delegate} function.
 *
 * The success and return data of the delegated call will be returned back to the caller of the proxy.
 */
abstract contract Proxy {
    /**
     * @dev Delegates the current call to `implementation`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _delegate(address implementation) internal virtual {
        assembly {
            // Copy msg.data. We take full control of memory in this inline assembly
            // block because it will not return to Solidity code. We overwrite the
            // Solidity scratch pad at memory position 0.
            calldatacopy(0, 0, calldatasize())

            // Call the implementation.
            // out and outsize are 0 because we don't know the size yet.
            let result := delegatecall(gas(), implementation, 0, calldatasize(), 0, 0)

            // Copy the returned data.
            returndatacopy(0, 0, returndatasize())

            switch result
            // delegatecall returns 0 on error.
            case 0 {
                revert(0, returndatasize())
            }
            default {
                return(0, returndatasize())
            }
        }
    }

    /**
     * @dev This is a virtual function that should be overridden so it returns the address to which the fallback
     * function and {_fallback} should delegate.
     */
    function _implementation() internal view virtual returns (address);

    /**
     * @dev Delegates the current call to the address returned by `_implementation()`.
     *
     * This function does not return to its internal call site, it will return directly to the external caller.
     */
    function _fallback() internal virtual {
        _delegate(_implementation());
    }

    /**
     * @dev Fallback function that delegates calls to the address returned by `_implementation()`. Will run if no other
     * function in the contract matches the call data.
     */
    fallback() external payable virtual {
        _fallback();
    }
}

File 3 of 13 : Address.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Address.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Collection of functions related to the address type
 */
library Address {
    /**
     * @dev There's no code at `target` (it is not a contract).
     */
    error AddressEmptyCode(address target);

    /**
     * @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 Errors.InsufficientBalance(address(this).balance, amount);
        }

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

    /**
     * @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
     * {Errors.FailedCall} 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 Errors.InsufficientBalance(address(this).balance, value);
        }
        (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 {Errors.FailedCall}) 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 {Errors.FailedCall} 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 {Errors.FailedCall}.
     */
    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
            assembly ("memory-safe") {
                let returndata_size := mload(returndata)
                revert(add(32, returndata), returndata_size)
            }
        } else {
            revert Errors.FailedCall();
        }
    }
}

File 4 of 13 : Context.sol
// 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;
    }
}

File 5 of 13 : Errors.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (utils/Errors.sol)

pragma solidity ^0.8.20;

/**
 * @dev Collection of common custom errors used in multiple contracts
 *
 * IMPORTANT: Backwards compatibility is not guaranteed in future versions of the library.
 * It is recommended to avoid relying on the error API for critical functionality.
 *
 * _Available since v5.1._
 */
library Errors {
    /**
     * @dev The ETH balance of the account is not enough to perform the operation.
     */
    error InsufficientBalance(uint256 balance, uint256 needed);

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

    /**
     * @dev The deployment failed.
     */
    error FailedDeployment();

    /**
     * @dev A necessary precompile is missing.
     */
    error MissingPrecompile(address);
}

File 6 of 13 : Multicall.sol
// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.0.1) (utils/Multicall.sol)

pragma solidity ^0.8.20;

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

/**
 * @dev Provides a function to batch together multiple calls in a single external call.
 *
 * Consider any assumption about calldata validation performed by the sender may be violated if it's not especially
 * careful about sending transactions invoking {multicall}. For example, a relay address that filters function
 * selectors won't filter calls nested within a {multicall} operation.
 *
 * NOTE: Since 5.0.1 and 4.9.4, this contract identifies non-canonical contexts (i.e. `msg.sender` is not {_msgSender}).
 * If a non-canonical context is identified, the following self `delegatecall` appends the last bytes of `msg.data`
 * to the subcall. This makes it safe to use with {ERC2771Context}. Contexts that don't affect the resolution of
 * {_msgSender} are not propagated to subcalls.
 */
abstract contract Multicall is Context {
    /**
     * @dev Receives and executes a batch of function calls on this contract.
     * @custom:oz-upgrades-unsafe-allow-reachable delegatecall
     */
    function multicall(bytes[] calldata data) external virtual returns (bytes[] memory results) {
        bytes memory context = msg.sender == _msgSender()
            ? new bytes(0)
            : msg.data[msg.data.length - _contextSuffixLength():];

        results = new bytes[](data.length);
        for (uint256 i = 0; i < data.length; i++) {
            results[i] = Address.functionDelegateCall(address(this), bytes.concat(data[i], context));
        }
        return results;
    }
}

File 7 of 13 : ERC20.sol
// 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);
    }
}

File 8 of 13 : SafeTransferLib.sol
// SPDX-License-Identifier: AGPL-3.0-only
pragma solidity >=0.8.0;

import {ERC20} from "../tokens/ERC20.sol";

/// @notice Safe ETH and ERC20 transfer library that gracefully handles missing return values.
/// @author Solmate (https://github.com/transmissions11/solmate/blob/main/src/utils/SafeTransferLib.sol)
/// @dev Use with caution! Some functions in this library knowingly create dirty bits at the destination of the free memory pointer.
library SafeTransferLib {
    /*//////////////////////////////////////////////////////////////
                             ETH OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferETH(address to, uint256 amount) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Transfer the ETH and store if it succeeded or not.
            success := call(gas(), to, amount, 0, 0, 0, 0)
        }

        require(success, "ETH_TRANSFER_FAILED");
    }

    /*//////////////////////////////////////////////////////////////
                            ERC20 OPERATIONS
    //////////////////////////////////////////////////////////////*/

    function safeTransferFrom(
        ERC20 token,
        address from,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x23b872dd00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(from, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "from" argument.
            mstore(add(freeMemoryPointer, 36), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 68), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            // We use 100 because the length of our calldata totals up like so: 4 + 32 * 3.
            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
            success := call(gas(), token, 0, freeMemoryPointer, 100, 0, 32)

            // Set success to whether the call reverted, if not we check it either
            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
                success := iszero(or(iszero(extcodesize(token)), returndatasize())) 
            }
        }

        require(success, "TRANSFER_FROM_FAILED");
    }

    function safeTransfer(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0xa9059cbb00000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
            success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)

            // Set success to whether the call reverted, if not we check it either
            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
                success := iszero(or(iszero(extcodesize(token)), returndatasize())) 
            }
        }

        require(success, "TRANSFER_FAILED");
    }

    function safeApprove(
        ERC20 token,
        address to,
        uint256 amount
    ) internal {
        bool success;

        /// @solidity memory-safe-assembly
        assembly {
            // Get a pointer to some free memory.
            let freeMemoryPointer := mload(0x40)

            // Write the abi-encoded calldata into memory, beginning with the function selector.
            mstore(freeMemoryPointer, 0x095ea7b300000000000000000000000000000000000000000000000000000000)
            mstore(add(freeMemoryPointer, 4), and(to, 0xffffffffffffffffffffffffffffffffffffffff)) // Append and mask the "to" argument.
            mstore(add(freeMemoryPointer, 36), amount) // Append the "amount" argument. Masking not required as it's a full 32 byte type.

            // We use 68 because the length of our calldata totals up like so: 4 + 32 * 2.
            // We use 0 and 32 to copy up to 32 bytes of return data into the scratch space.
            success := call(gas(), token, 0, freeMemoryPointer, 68, 0, 32)

            // Set success to whether the call reverted, if not we check it either
            // returned exactly 1 (can't just be non-zero data), or had no return data and token has code.
            if and(iszero(and(eq(mload(0), 1), gt(returndatasize(), 31))), success) {
                success := iszero(or(iszero(extcodesize(token)), returndatasize())) 
            }
        }

        require(success, "APPROVE_FAILED");
    }
}

File 9 of 13 : IOwnerFacet.sol
// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

struct SelectorsToFacet {
    address facet;
    bytes4[] selectors;
}

interface IOwnerFacet {
    /**
     * @dev Returns the address of the current owner.
     * @return The address of the current owner.
     */
    function owner() external view returns (address);

    /**
     * @dev Returns the address of the pending owner.
     * @return The address of the pending owner.
     */
    function pendingOwner() external view returns (address);

    /**
     * @dev Sets the mapping of function selectors to facet addresses.
     * @param arr An array of SelectorsToFacet structs containing the selectors and their corresponding facet addresses.
     */
    function setSelectorToFacets(SelectorsToFacet[] calldata arr) external;

    /**
     * @dev Returns the facet address for a given function selector.
     * @param selector The function selector.
     * @return The address of the facet.
     */
    function selectorToFacet(bytes4 selector) external view returns (address);

    /**
     * @dev Initiates the transfer of ownership to a new owner.
     * @param newOwner The address of the new owner.
     */
    function transferOwnership(address newOwner) external;

    /**
     * @dev Accepts the transfer of ownership.
     */
    function acceptOwnership() external;
}

File 10 of 13 : ISwapper.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

struct SwapArgs {
    address tokenIn;
    address swapTarget;
    bytes swapCallData;
}

struct ExchangeArgs {
    address exchange;
    bool allowed;
}

interface ISwapper {
    /**
     * @notice Swaps tokens according to the provided swap arguments.
     * @param swapArgs The swap arguments.
     * @param tokenOut The token to be received.
     * @return tokenOutAmount The amount of tokenOut received.
     */
    function swap(SwapArgs[] memory swapArgs, address tokenOut) external returns (uint256 tokenOutAmount);

    /**
     * @notice Updates the exchange allowlist.
     * @param exchangeArgs The exchange arguments.
     */
    function updateExchangeAllowlist(ExchangeArgs[] calldata exchangeArgs) external;
}

File 11 of 13 : LibErrors.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

library LibErrors {
    // ===================== OwnerFacet ================================
    /**
     * @dev The caller account is not authorized to perform an operation.
     * @param account The address of the unauthorized account.
     */
    error OwnableUnauthorizedAccount(address account);

    /**
     * @dev The function selector is invalid.
     * @param selector The invalid function selector.
     */
    error InvalidSelector(bytes4 selector);

    // ===================== ClientsFacet ================================
    /**
     * @dev The owner address is already used by some client.
     */
    error ClientOwnerReserved();

    /**
     * @dev The caller is not the client owner.
     */
    error NotClientOwner();

    /**
     * @dev The project ID is out of bounds.
     */
    error OutOfBoundProjectId();

    /**
     * @dev The project is already active.
     */
    error ProjectActive();

    /**
     * @dev The client name is empty.
     */
    error ClientNameEmpty();

    /**
     * @dev The client name is empty.
     */
    error ReservedProjectsIsZero();

    /**
     * @dev The client name is already taken.
     */
    error ClientNameTaken();

    // ===================== FundsFacet ================================
    /**
     * @dev The project is inactive.
     */
    error ProjectInactive();

    /**
     * @dev The function can only be called in a view context.
     */
    error OnlyView();

    /**
     * @dev Compounding the underlying asset is forbidden.
     */
    error CompoundUnderlyingForbidden();

    /**
     * @dev Position migration is forbidden.
     */
    error PositionMigrationForbidden();

    /**
     * @dev There is not enough underlying assets in YelayLiteVault to cover redeem.
     */
    error NotEnoughInternalFunds();

    /**
     * @dev Redeem doesn't pass minimum asset amount
     */
    error MinRedeem();

    // ===================== SwapWrapper ================================
    /**
     * @dev The token is not WETH.
     */
    error NotWeth();

    /**
     * @dev No ETH available.
     */
    error NoEth();

    // ===================== ManagementFacet ================================
    /**
     * @dev The assets were not withdrawn from strategy.
     */
    error StrategyNotEmpty();

    /**
     * @dev The strategy is already registered.
     */
    error StrategyRegistered();

    /**
     * @dev The strategy is already active.
     */
    error StrategyActive();

    // ===================== LibPausable ================================
    /**
     * @dev The function is paused.
     * @param selector The function selector that is paused.
     */
    error Paused(bytes4 selector);

    // ===================== Swapper ================================

    /**
     * @notice Used when trying to do a swap via an exchange that is not allowed to execute a swap.
     * @param exchange Exchange used.
     */
    error ExchangeNotAllowed(address exchange);

    /**
     * @notice Used when there is nothing to swap.
     * @param tokenIn The token that was intended to be swapped.
     */
    error NothingToSwap(address tokenIn);

    /**
     * @notice Used when nothing was swapped.
     * @param tokenOut The token that was intended to be received.
     */
    error NothingSwapped(address tokenOut);
}

File 12 of 13 : LibFunds.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {ERC20} from "@solmate/utils/SafeTransferLib.sol";

library LibFunds {
    /**
     * @custom:storage-location erc7201:yelay-vault.storage.FundsFacet
     * @custom:member underlyingBalance The balance of the underlying asset held by the vault excluding assets in strategies.
     * @custom:member lastTotalAssetsUpdateInterval The interval for updating the last total assets on deposit.
     * @custom:member lastTotalAssets The last total assets value for yield calculation.
     * @custom:member lastTotalAssetsTimestamp The timestamp of the last total assets update.
     * @custom:member underlyingAsset The underlying asset.
     * @custom:member yieldExtractor The address of the yield extractor.
     */
    struct FundsStorage {
        uint192 underlyingBalance;
        uint64 lastTotalAssetsUpdateInterval;
        uint192 lastTotalAssets;
        uint64 lastTotalAssetsTimestamp;
        ERC20 underlyingAsset;
        address yieldExtractor;
    }

    // keccak256(abi.encode(uint256(keccak256("yelay-vault.storage.FundsFacet")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant FundsStorageLocation = 0xe9f6622f42b3306a25789276a3506ebaae4fda2335fb5bfa8bfd419c0dde8100;

    function _getFundsStorage() internal pure returns (FundsStorage storage $) {
        assembly {
            $.slot := FundsStorageLocation
        }
    }

    /// @custom:storage-location erc7201:openzeppelin.storage.ERC1155
    struct ERC1155Storage {
        mapping(uint256 id => mapping(address account => uint256)) _balances;
        mapping(address account => mapping(address operator => bool)) _operatorApprovals;
        // Used as the URI for all token types by relying on ID substitution, e.g. https://token-cdn-domain/{id}.json
        string _uri;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.ERC1155")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant ERC1155StorageLocation = 0x88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c4500;

    function _getERC1155Storage() internal pure returns (ERC1155Storage storage $) {
        assembly {
            $.slot := ERC1155StorageLocation
        }
    }
}

File 13 of 13 : LibOwner.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.28;

import {LibErrors} from "src/libraries/LibErrors.sol";

library LibOwner {
    /**
     * @custom:storage-location erc7201:yelay-vault.storage.OwnerFacet
     * @custom:member owner The owner of the contract.
     * @custom:member pendingOwner The address pending to become the owner.
     * @custom:member selectorToFacet Mapping from selector to facet address.
     */
    struct OwnerStorage {
        address owner;
        address pendingOwner;
        mapping(bytes4 => address) selectorToFacet;
    }

    // keccak256(abi.encode(uint256(keccak256("yelay-vault.storage.OwnerFacet")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant OWNER_STORAGE_LOCATION = 0x52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d000;

    function _getOwnerStorage() internal pure returns (OwnerStorage storage $) {
        assembly {
            $.slot := OWNER_STORAGE_LOCATION
        }
    }

    /**
     * @dev Reverts if the caller is not the owner.
     */
    function onlyOwner() internal view {
        OwnerStorage storage s = _getOwnerStorage();
        require(s.owner == msg.sender, LibErrors.OwnableUnauthorizedAccount(msg.sender));
    }
}

Settings
{
  "evmVersion": "cancun",
  "optimizer": {
    "enabled": true,
    "runs": 10000
  },
  "outputSelection": {
    "*": {
      "*": [
        "evm.bytecode",
        "evm.deployedBytecode",
        "devdoc",
        "userdoc",
        "metadata",
        "abi"
      ]
    }
  },
  "libraries": {}
}

Contract Security Audit

Contract ABI

[{"inputs":[{"internalType":"address","name":"_owner","type":"address"},{"internalType":"address","name":"_ownerFacet","type":"address"},{"internalType":"address","name":"underlyingAsset","type":"address"},{"internalType":"address","name":"yieldExtractor","type":"address"},{"internalType":"string","name":"uri","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"target","type":"address"}],"name":"AddressEmptyCode","type":"error"},{"inputs":[],"name":"FailedCall","type":"error"},{"inputs":[{"internalType":"bytes4","name":"selector","type":"bytes4"}],"name":"InvalidSelector","type":"error"},{"stateMutability":"payable","type":"fallback"},{"inputs":[{"internalType":"bytes[]","name":"data","type":"bytes[]"}],"name":"multicall","outputs":[{"internalType":"bytes[]","name":"results","type":"bytes[]"}],"stateMutability":"nonpayable","type":"function"},{"stateMutability":"payable","type":"receive"}]

608060405234801561000f575f5ffd5b50604051610b2c380380610b2c83398101604081905261002e916102c1565b7f52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d00080546001600160a01b038781166001600160a01b03199283161783557f52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d0026020527fdf9de6333d9b6b511bfa8cbeeb3dc3be2d90cffd880d526ea09513bc0192581b805488831690841681179091557f25889e79057dc7bb2aaaafe872d794c918590f29df30e45a7fe78157ceec028780548416821790557fcc66d551a758fa48896748037c88a02e72d5395a955e0faaaa1746a7a34d8b7480548416821790557ff4eb4b4ea3404cb493ae9c5e4fa3f42b15406c4f07222a7cf62c0f5c4399d5c180548416821790557fc2bd986c8cfafde8d72d49c626f14926513cc9222f335a5df0a5e57703629b2c80548416821790557f3dbfc9200cdb6c8836b85e5aec9446156ca9c14f7d1ea4dd2afe0d779c91e2d7805484169091179055631592ca1b60e31b5f527f3ffab8aa0162aaced716a171d45904e42c38e1f5cb92c6a1989e98f67686480480548316301790557fe9f6622f42b3306a25789276a3506ebaae4fda2335fb5bfa8bfd419c0dde810280548783169084161790557fe9f6622f42b3306a25789276a3506ebaae4fda2335fb5bfa8bfd419c0dde81038054918616919092161790557fe9f6622f42b3306a25789276a3506ebaae4fda2335fb5bfa8bfd419c0dde81007f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c45007f88be536d5240c274a3b1d3a1be54482fd9caa294f08c62a7cde569f49a3c45026102848582610437565b5050505050505050506104f1565b80516001600160a01b03811681146102a8575f5ffd5b919050565b634e487b7160e01b5f52604160045260245ffd5b5f5f5f5f5f60a086880312156102d5575f5ffd5b6102de86610292565b94506102ec60208701610292565b93506102fa60408701610292565b925061030860608701610292565b60808701519092506001600160401b03811115610323575f5ffd5b8601601f81018813610333575f5ffd5b80516001600160401b0381111561034c5761034c6102ad565b604051601f8201601f19908116603f011681016001600160401b038111828210171561037a5761037a6102ad565b6040528181528282016020018a1015610391575f5ffd5b8160208401602083015e5f602083830101528093505050509295509295909350565b600181811c908216806103c757607f821691505b6020821081036103e557634e487b7160e01b5f52602260045260245ffd5b50919050565b601f82111561043257805f5260205f20601f840160051c810160208510156104105750805b601f840160051c820191505b8181101561042f575f815560010161041c565b50505b505050565b81516001600160401b03811115610450576104506102ad565b6104648161045e84546103b3565b846103eb565b6020601f821160018114610496575f831561047f5750848201515b5f19600385901b1c1916600184901b17845561042f565b5f84815260208120601f198516915b828110156104c557878501518255602094850194600190920191016104a5565b50848210156104e257868401515f19600387901b60f8161c191681555b50505050600190811b01905550565b61062e806104fe5f395ff3fe608060405260043610610021575f3560e01c8063ac9650d81461003257610028565b3661002857005b610030610067565b005b34801561003d575f5ffd5b5061005161004c3660046103c4565b610079565b60405161005e9190610435565b60405180910390f35b61007761007261015f565b610253565b565b604080515f8152602081019091526060908267ffffffffffffffff8111156100a3576100a36104f5565b6040519080825280602002602001820160405280156100d657816020015b60608152602001906001900390816100c15790505b5091505f5b8381101561015757610132308686848181106100f9576100f9610522565b905060200281019061010b919061054f565b8560405160200161011e939291906105ce565b604051602081830303815290604052610271565b83828151811061014457610144610522565b60209081029190910101526001016100db565b505092915050565b5f80357fffffffff00000000000000000000000000000000000000000000000000000000168082527f52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d00260205260408220547f52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d0009173ffffffffffffffffffffffffffffffffffffffff909116908161024c576040517f12ba286f0000000000000000000000000000000000000000000000000000000081527fffffffff0000000000000000000000000000000000000000000000000000000090911660048201526024015b60405180910390fd5b5092915050565b365f5f375f5f365f845af43d5f5f3e80801561026d573d5ff35b3d5ffd5b60605f5f8473ffffffffffffffffffffffffffffffffffffffff168460405161029a91906105ed565b5f60405180830381855af49150503d805f81146102d2576040519150601f19603f3d011682016040523d82523d5f602084013e6102d7565b606091505b50915091506102e78583836102f0565b95945050505050565b6060826103055761030082610382565b61037b565b8151158015610329575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610378576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610243565b50805b9392505050565b8051156103925780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f602083850312156103d5575f5ffd5b823567ffffffffffffffff8111156103eb575f5ffd5b8301601f810185136103fb575f5ffd5b803567ffffffffffffffff811115610411575f5ffd5b8560208260051b8401011115610425575f5ffd5b6020919091019590945092505050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b828110156104e9577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0878603018452815180518087528060208301602089015e5f6020828901015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168801019650505060208201915060208401935060018101905061045b565b50929695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610582575f5ffd5b83018035915067ffffffffffffffff82111561059c575f5ffd5b6020019150368190038213156105b0575f5ffd5b9250929050565b5f81518060208401855e5f93019283525090919050565b828482375f8382015f81526105e381856105b7565b9695505050505050565b5f61037b82846105b756fea26469706673582212207c645c5bd3985ed7a118ecc0e40cd4937ac3061ebeb4fdb98d6b5a58af2c541c64736f6c634300081c00330000000000000000000000001892e547f4e1ba76f82a09c16c9f774744de1ff300000000000000000000000047f9f04db109d25aeba42b0d45e6f0aee852b916000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000001892e547f4e1ba76f82a09c16c9f774744de1ff300000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002968747470733a2f2f6c6974652e79656c61792e696f2f736f6e69632f6d657461646174612f7b69647d0000000000000000000000000000000000000000000000

Deployed Bytecode

0x608060405260043610610021575f3560e01c8063ac9650d81461003257610028565b3661002857005b610030610067565b005b34801561003d575f5ffd5b5061005161004c3660046103c4565b610079565b60405161005e9190610435565b60405180910390f35b61007761007261015f565b610253565b565b604080515f8152602081019091526060908267ffffffffffffffff8111156100a3576100a36104f5565b6040519080825280602002602001820160405280156100d657816020015b60608152602001906001900390816100c15790505b5091505f5b8381101561015757610132308686848181106100f9576100f9610522565b905060200281019061010b919061054f565b8560405160200161011e939291906105ce565b604051602081830303815290604052610271565b83828151811061014457610144610522565b60209081029190910101526001016100db565b505092915050565b5f80357fffffffff00000000000000000000000000000000000000000000000000000000168082527f52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d00260205260408220547f52b130868e76fc87849159cef46eb9bb0156aa8877197d318e4437829044d0009173ffffffffffffffffffffffffffffffffffffffff909116908161024c576040517f12ba286f0000000000000000000000000000000000000000000000000000000081527fffffffff0000000000000000000000000000000000000000000000000000000090911660048201526024015b60405180910390fd5b5092915050565b365f5f375f5f365f845af43d5f5f3e80801561026d573d5ff35b3d5ffd5b60605f5f8473ffffffffffffffffffffffffffffffffffffffff168460405161029a91906105ed565b5f60405180830381855af49150503d805f81146102d2576040519150601f19603f3d011682016040523d82523d5f602084013e6102d7565b606091505b50915091506102e78583836102f0565b95945050505050565b6060826103055761030082610382565b61037b565b8151158015610329575073ffffffffffffffffffffffffffffffffffffffff84163b155b15610378576040517f9996b31500000000000000000000000000000000000000000000000000000000815273ffffffffffffffffffffffffffffffffffffffff85166004820152602401610243565b50805b9392505050565b8051156103925780518082602001fd5b6040517fd6bda27500000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f5f602083850312156103d5575f5ffd5b823567ffffffffffffffff8111156103eb575f5ffd5b8301601f810185136103fb575f5ffd5b803567ffffffffffffffff811115610411575f5ffd5b8560208260051b8401011115610425575f5ffd5b6020919091019590945092505050565b5f602082016020835280845180835260408501915060408160051b8601019250602086015f5b828110156104e9577fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc0878603018452815180518087528060208301602089015e5f6020828901015260207fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe0601f8301168801019650505060208201915060208401935060018101905061045b565b50929695505050505050565b7f4e487b71000000000000000000000000000000000000000000000000000000005f52604160045260245ffd5b7f4e487b71000000000000000000000000000000000000000000000000000000005f52603260045260245ffd5b5f5f83357fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe1843603018112610582575f5ffd5b83018035915067ffffffffffffffff82111561059c575f5ffd5b6020019150368190038213156105b0575f5ffd5b9250929050565b5f81518060208401855e5f93019283525090919050565b828482375f8382015f81526105e381856105b7565b9695505050505050565b5f61037b82846105b756fea26469706673582212207c645c5bd3985ed7a118ecc0e40cd4937ac3061ebeb4fdb98d6b5a58af2c541c64736f6c634300081c0033

Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)

0000000000000000000000001892e547f4e1ba76f82a09c16c9f774744de1ff300000000000000000000000047f9f04db109d25aeba42b0d45e6f0aee852b916000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda029130000000000000000000000001892e547f4e1ba76f82a09c16c9f774744de1ff300000000000000000000000000000000000000000000000000000000000000a0000000000000000000000000000000000000000000000000000000000000002968747470733a2f2f6c6974652e79656c61792e696f2f736f6e69632f6d657461646174612f7b69647d0000000000000000000000000000000000000000000000

-----Decoded View---------------
Arg [0] : _owner (address): 0x1892e547F4E1bA76F82a09C16C9F774744De1ff3
Arg [1] : _ownerFacet (address): 0x47f9f04DB109D25aEBA42b0d45E6f0Aee852B916
Arg [2] : underlyingAsset (address): 0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913
Arg [3] : yieldExtractor (address): 0x1892e547F4E1bA76F82a09C16C9F774744De1ff3
Arg [4] : uri (string): https://lite.yelay.io/sonic/metadata/{id}

-----Encoded View---------------
8 Constructor Arguments found :
Arg [0] : 0000000000000000000000001892e547f4e1ba76f82a09c16c9f774744de1ff3
Arg [1] : 00000000000000000000000047f9f04db109d25aeba42b0d45e6f0aee852b916
Arg [2] : 000000000000000000000000833589fcd6edb6e08f4c7c32d4f71b54bda02913
Arg [3] : 0000000000000000000000001892e547f4e1ba76f82a09c16c9f774744de1ff3
Arg [4] : 00000000000000000000000000000000000000000000000000000000000000a0
Arg [5] : 0000000000000000000000000000000000000000000000000000000000000029
Arg [6] : 68747470733a2f2f6c6974652e79656c61792e696f2f736f6e69632f6d657461
Arg [7] : 646174612f7b69647d0000000000000000000000000000000000000000000000


Block Transaction Gas Used Reward
view all blocks produced

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

Validator Index Block Amount
View All Withdrawals

Transaction Hash Block Value Eth2 PubKey Valid
View All Deposits
[ 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.