PendleSYsThUSDAdapter

Description:

Decentralized Finance (DeFi) protocol contract providing Swap, Liquidity, Yield, Factory functionality.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

{{
  "language": "Solidity",
  "sources": {
    "src/pendleSYsThUSDAdapter.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/*
▗▄▄▄▖▗▖ ▗▖ ▗▄▖ ▗▄▄▖ ▗▖ ▗▖ ▗▄▖
  █  ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌
  █  ▐▛▀▜▌▐▛▀▜▌▐▛▀▚▖▐▌ ▐▌▐▛▀▜▌
  █  ▐▌ ▐▌▐▌ ▐▌▐▌ ▐▌▐▙█▟▌▐▌ ▐▌

visit : https://tharwa.finance
*/
import {IThUSDSwap} from "src/interfaces/IThUSDSwap.sol";
/* ─── OpenZeppelin v5 ─────────────────────────────────────────────────────── */
import {IERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol";
import {SafeERC20} from "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol";
/* ─── Pendle SY Public ───────────────────────────────────────────────────── */
import {IStandardizedYieldAdapter} from "src/interfaces/IStandardizedYieldAdapter.sol";

/* ─── Tharwa Staked Version ──────────────────────────────────────────────── */
/// @title Pendle SY Adapter for Staked Tharwa USD (sThUSD)
/// @notice An adapter of Staked Tharwa USD (sThUSD) for Pendle Finance standardized yield tokens
contract PendleSYsThUSDAdapter is IStandardizedYieldAdapter {
    using SafeERC20 for IERC20;
    // in the sTHUSD erc4626 vault:
    //  asset (principal) == PIVOT_TOKEN = thUSD
    //  yield token = sThUSD
    //  allowed deposit tokens (supported by ThUsdSwap) = [USDC, DAI, USDT, (thUSD)]
    //  allowed redeem tokens = [thUSD]

    /// @notice Underlying asset of the ERC4616 vault, which is the PIVOT_TOKEN in pendle world
    address public immutable ThUSD;

    /// @notice Swapper contract that converts stable coins to thUSD
    IThUSDSwap public immutable ThUsdSwap;

    // stable coins supported by ThUsdSwap
    address internal immutable _DAI;
    address internal immutable _USDC;
    address internal immutable _USDT;

    /**
     * @dev Scaling factor to convert between 6-decimal and 18-decimal tokens
     * 10^12 = 10^(18-6) for converting between 6-decimal and 18-decimal tokens
     */
    uint256 private constant SCALING_FACTOR = 1e12;

    ////////////////////////////////

    error UnsupportedToken();

    ////////////////////////////////

    constructor(address thUsd_, address thUsdSwap_, address usdc_, address dai_, address usdt_) {
        ThUSD = thUsd_;

        _DAI = dai_;
        _USDC = usdc_;
        _USDT = usdt_;

        ThUsdSwap = IThUSDSwap(thUsdSwap_);

        IERC20(usdc_).forceApprove(thUsdSwap_, type(uint256).max);
        IERC20(dai_).forceApprove(thUsdSwap_, type(uint256).max);
        IERC20(usdt_).forceApprove(thUsdSwap_, type(uint256).max);
    }

    /**
     * @notice Retrieves the address of the pivot token.
     * @return pivotToken The address of the pivot token.
     */
    function PIVOT_TOKEN() external view returns (address pivotToken) {
        return ThUSD;
    }

    /**
     * @notice Converts a specified amount of an input token to pivotToken.
     * @dev This function should expect the token has already been transferred to the adapter.
     * @param tokenIn The address of the input token. Must be a supported token.
     * @param amountTokenIn The amount of the input token to convert.
     * @return amountOut The amount of the pivot token.
     */
    function convertToDeposit(address tokenIn, uint256 amountTokenIn) external returns (uint256 amountOut) {
        amountOut = amountTokenIn;

        if (tokenIn == _DAI) {
            ThUsdSwap.swapDAI(amountTokenIn);
        } else if (tokenIn == _USDC) {
            ThUsdSwap.swapUSDC(amountTokenIn);
            amountOut = amountOut * SCALING_FACTOR;
        } else if (tokenIn == _USDT) {
            ThUsdSwap.swapUSDT(amountTokenIn);
            amountOut = amountOut * SCALING_FACTOR;
        } else if (tokenIn != ThUSD) {
            revert UnsupportedToken();
        }
        IERC20(ThUSD).safeTransfer(msg.sender, amountOut);

        return amountOut;
    }

    /**
     * @notice Converts pivotToken to the token requested for redemption.
     * @dev This function should expect pivotToken has already been transferred to the adapter.
     * @param tokenOut The address of the output token.
     * @param amountPivotTokenIn The amount of pivot token to convert.
     * @return amountOut The amount of the output token out.
     */
    function convertToRedeem(address tokenOut, uint256 amountPivotTokenIn) external returns (uint256 amountOut) {
        if (tokenOut != ThUSD) {
            revert UnsupportedToken();
        }
        // The only token out supported is the pivot token, as the swapper doesn't swap back from thusd to stablecoins
        // So this function receives ThUSD and transfers the same amount out ...
        IERC20(ThUSD).safeTransfer(msg.sender, amountPivotTokenIn);
        return amountPivotTokenIn;
    }

    /**
     * @notice Previews the conversion of a specified amount of an input token to pivotToken.
     * @param tokenIn The address of the input token.
     * @param amountTokenIn The amount of the input token to convert.
     * @return amountOut The estimated amount of the pivot token.
     */
    function previewConvertToDeposit(address tokenIn, uint256 amountTokenIn) external view returns (uint256 amountOut) {
        // for USDC and USDT, we convert 6-decimal to 18-decimal, but for the others, it's 1:1
        if (tokenIn == _USDC || tokenIn == _USDT) {
            return amountTokenIn * SCALING_FACTOR;
        } else if (tokenIn == _DAI || tokenIn == ThUSD) {
            return amountTokenIn;
        } else {
            return 0;
        }
    }

    /**
     * @notice Previews the conversion of pivot token to the amount requested for redemption.
     * @param tokenOut The address of the output token.
     * @param amountPivotTokenIn The amount of pivot token to convert.
     * @return amountOut The estimated amount of the output token out.
     */
    function previewConvertToRedeem(address tokenOut, uint256 amountPivotTokenIn)
        external
        view
        returns (uint256 amountOut)
    {
        if (tokenOut != ThUSD) {
            return 0;
        }
        return amountPivotTokenIn;
    }

    /// @notice Retrieves the list of tokens supported for deposits by the adapter.
    /// @dev No need to return the PIVOT_TOKEN here
    /// @return tokens An array of addresses of tokens supported for deposits.
    function getAdapterTokensDeposit() external view returns (address[] memory tokens) {
        tokens = new address[](3);
        tokens[0] = _DAI;
        tokens[1] = _USDC;
        tokens[2] = _USDT;
        return tokens;
    }

    /// @notice Retrieves the list of tokens supported for redemptions by the adapter.
    /// @dev No need to return the PIVOT_TOKEN here, so we have to return an empty list
    /// @return tokens An array of addresses of tokens supported for redemptions.
    function getAdapterTokensRedeem() external view returns (address[] memory tokens) {
        return tokens;
    }
}
"
    },
    "src/interfaces/IThUSDSwap.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/**
 * @title ThUSDSwap
 * @dev Interface for the thUSDSwap contract that allows swapping between stablecoins and thUSD at 1:1 value ratio
 */
interface IThUSDSwap {
    /* errors */
    /// @notice Error thrown when a zero amount is provided for a swap
    error AmountZero();

    /// @notice Error thrown when there's not enough thUSD liquidity to fulfill a swap
    error InsufficientLiquidity();

    /**
     * @notice Returns the current thUSD balance of the contract
     * @return The amount of thUSD tokens held by the contract
     */
    function getThUSD() external view returns (uint256);

    /* swap functions */
    /**
     * @notice Swap USDC (6 decimals) for thUSD (18 decimals) at a 1:1 value
     * @param usdcAmount Amount of USDC to swap (units with 6 decimals)
     */
    function swapUSDC(uint256 usdcAmount) external;

    /**
     * @notice Swap USDT (6 decimals) for thUSD (18 decimals) at a 1:1 value
     * @param usdtAmount Amount of USDT to swap (units with 6 decimals)
     */
    function swapUSDT(uint256 usdtAmount) external;

    /**
     * @notice Swap DAI (18 decimals) for thUSD (18 decimals) at a 1:1 value
     * @param daiAmount Amount of DAI to swap (units with 18 decimals)
     */
    function swapDAI(uint256 daiAmount) external;
}
"
    },
    "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (token/ERC20/IERC20.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-20 standard as defined in the ERC.
 */
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);
}
"
    },
    "lib/openzeppelin-contracts/contracts/token/ERC20/utils/SafeERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (token/ERC20/utils/SafeERC20.sol)

pragma solidity ^0.8.20;

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

/**
 * @title SafeERC20
 * @dev Wrappers around ERC-20 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 {
    /**
     * @dev An operation with an ERC-20 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 Variant of {safeTransfer} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransfer(IERC20 token, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(token, abi.encodeCall(token.transfer, (to, value)));
    }

    /**
     * @dev Variant of {safeTransferFrom} that returns a bool instead of reverting if the operation is not successful.
     */
    function trySafeTransferFrom(IERC20 token, address from, address to, uint256 value) internal returns (bool) {
        return _callOptionalReturnBool(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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * IMPORTANT: If the token implements ERC-7674 (ERC-20 with temporary allowance), and if the "client"
     * smart contract uses ERC-7674 to set temporary allowances, then the "client" smart contract should avoid using
     * this function. Performing a {safeIncreaseAllowance} or {safeDecreaseAllowance} operation on a token contract
     * that has a non-zero temporary allowance (for that particular owner-spender) will result in unexpected behavior.
     */
    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.
     *
     * NOTE: If the token implements ERC-7674, this function will not modify any temporary allowance. This function
     * only sets the "standard" allowance. Any temporary allowance will remain active, in addition to the value being
     * set here.
     */
    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 Performs an {ERC1363} transferAndCall, with a fallback to the simple {ERC20} transfer if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            safeTransfer(token, to, value);
        } else if (!token.transferAndCall(to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} transferFromAndCall, with a fallback to the simple {ERC20} transferFrom if the target
     * has no code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * Reverts if the returned value is other than `true`.
     */
    function transferFromAndCallRelaxed(
        IERC1363 token,
        address from,
        address to,
        uint256 value,
        bytes memory data
    ) internal {
        if (to.code.length == 0) {
            safeTransferFrom(token, from, to, value);
        } else if (!token.transferFromAndCall(from, to, value, data)) {
            revert SafeERC20FailedOperation(address(token));
        }
    }

    /**
     * @dev Performs an {ERC1363} approveAndCall, with a fallback to the simple {ERC20} approve if the target has no
     * code. This can be used to implement an {ERC721}-like safe transfer that rely on {ERC1363} checks when
     * targeting contracts.
     *
     * NOTE: When the recipient address (`to`) has no code (i.e. is an EOA), this function behaves as {forceApprove}.
     * Opposedly, when the recipient address (`to`) has code, this function only attempts to call {ERC1363-approveAndCall}
     * once without retrying, and relies on the returned value to be true.
     *
     * Reverts if the returned value is other than `true`.
     */
    function approveAndCallRelaxed(IERC1363 token, address to, uint256 value, bytes memory data) internal {
        if (to.code.length == 0) {
            forceApprove(token, to, value);
        } else if (!token.approveAndCall(to, value, data)) {
            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 {_callOptionalReturnBool} that reverts if call fails to meet the requirements.
     */
    function _callOptionalReturn(IERC20 token, bytes memory data) private {
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            let success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            // bubble errors
            if iszero(success) {
                let ptr := mload(0x40)
                returndatacopy(ptr, 0, returndatasize())
                revert(ptr, returndatasize())
            }
            returnSize := returndatasize()
            returnValue := mload(0)
        }

        if (returnSize == 0 ? address(token).code.length == 0 : returnValue != 1) {
            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 silently catches all reverts and returns a bool instead.
     */
    function _callOptionalReturnBool(IERC20 token, bytes memory data) private returns (bool) {
        bool success;
        uint256 returnSize;
        uint256 returnValue;
        assembly ("memory-safe") {
            success := call(gas(), token, 0, add(data, 0x20), mload(data), 0, 0x20)
            returnSize := returndatasize()
            returnValue := mload(0)
        }
        return success && (returnSize == 0 ? address(token).code.length > 0 : returnValue == 1);
    }
}
"
    },
    "src/interfaces/IStandardizedYieldAdapter.sol": {
      "content": "// SPDX-License-Identifier: GPL-3.0-or-later
pragma solidity ^0.8.0;

/**
 */

interface IStandardizedYieldAdapter {
    /**
     * @notice Retrieves the address of the pivot token.
     * @return pivotToken The address of the pivot token.
     */
    function PIVOT_TOKEN() external view returns (address pivotToken);

    /**
     * @notice Converts a specified amount of an input token to pivotToken.
     * @dev This function should expect the token has already been transferred to the adapter.
     * @param tokenIn The address of the input token.
     * @param amountTokenIn The amount of the input token to convert.
     * @return amountOut The amount of the pivot token.
     */
    function convertToDeposit(address tokenIn, uint256 amountTokenIn) external returns (uint256 amountOut);

    /**
     * @notice Converts pivotToken to the token requested for redemption.
     * @dev This function should expect pivotToken has already been transferred to the adapter.
     * @param tokenOut The address of the output token.
     * @param amountPivotTokenIn The amount of pivot token to convert.
     * @return amountOut The amount of the output token out.
     */
    function convertToRedeem(address tokenOut, uint256 amountPivotTokenIn) external returns (uint256 amountOut);

    /**
     * @notice Previews the conversion of a specified amount of an input token to pivotToken.
     * @param tokenIn The address of the input token.
     * @param amountTokenIn The amount of the input token to convert.
     * @return amountOut The estimated amount of the pivot token.
     */
    function previewConvertToDeposit(address tokenIn, uint256 amountTokenIn) external view returns (uint256 amountOut);

    /**
     * @notice Previews the conversion of pivot token to the amount requested for redemption.
     * @param tokenOut The address of the output token.
     * @param amountPivotTokenIn The amount of pivot token to convert.
     * @return amountOut The estimated amount of the output token out.
     */
    function previewConvertToRedeem(address tokenOut, uint256 amountPivotTokenIn)
        external
        view
        returns (uint256 amountOut);

    /**
     * @notice Retrieves the list of tokens supported for deposits by the adapter.
     * @return tokens An array of addresses of tokens supported for deposits.
     */
    function getAdapterTokensDeposit() external view returns (address[] memory tokens);

    /**
     * @notice Retrieves the list of tokens supported for redemptions by the adapter.
     * @return tokens An array of addresses of tokens supported for redemptions.
     */
    function getAdapterTokensRedeem() external view returns (address[] memory tokens);
}
"
    },
    "lib/openzeppelin-contracts/contracts/interfaces/IERC1363.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC1363.sol)

pragma solidity >=0.6.2;

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

/**
 * @title IERC1363
 * @dev Interface of the ERC-1363 standard as defined in the https://eips.ethereum.org/EIPS/eip-1363[ERC-1363].
 *
 * Defines an extension interface for ERC-20 tokens that supports executing code on a recipient contract
 * after `transfer` or `transferFrom`, or code on a spender contract after `approve`, in a single transaction.
 */
interface IERC1363 is IERC20, IERC165 {
    /*
     * Note: the ERC-165 identifier for this interface is 0xb0202a11.
     * 0xb0202a11 ===
     *   bytes4(keccak256('transferAndCall(address,uint256)')) ^
     *   bytes4(keccak256('transferAndCall(address,uint256,bytes)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256)')) ^
     *   bytes4(keccak256('transferFromAndCall(address,address,uint256,bytes)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256)')) ^
     *   bytes4(keccak256('approveAndCall(address,uint256,bytes)'))
     */

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from the caller's account to `to`
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferAndCall(address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value) external returns (bool);

    /**
     * @dev Moves a `value` amount of tokens from `from` to `to` using the allowance mechanism
     * and then calls {IERC1363Receiver-onTransferReceived} on `to`.
     * @param from The address which you want to send tokens from.
     * @param to The address which you want to transfer to.
     * @param value The amount of tokens to be transferred.
     * @param data Additional data with no specified format, sent in call to `to`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function transferFromAndCall(address from, address to, uint256 value, bytes calldata data) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value) external returns (bool);

    /**
     * @dev Sets a `value` amount of tokens as the allowance of `spender` over the
     * caller's tokens and then calls {IERC1363Spender-onApprovalReceived} on `spender`.
     * @param spender The address which will spend the funds.
     * @param value The amount of tokens to be spent.
     * @param data Additional data with no specified format, sent in call to `spender`.
     * @return A boolean value indicating whether the operation succeeded unless throwing.
     */
    function approveAndCall(address spender, uint256 value, bytes calldata data) external returns (bool);
}
"
    },
    "lib/openzeppelin-contracts/contracts/interfaces/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC20.sol)

pragma solidity >=0.4.16;

import {IERC20} from "../token/ERC20/IERC20.sol";
"
    },
    "lib/openzeppelin-contracts/contracts/interfaces/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (interfaces/IERC165.sol)

pragma solidity >=0.4.16;

import {IERC165} from "../utils/introspection/IERC165.sol";
"
    },
    "lib/openzeppelin-contracts/contracts/utils/introspection/IERC165.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.4.0) (utils/introspection/IERC165.sol)

pragma solidity >=0.4.16;

/**
 * @dev Interface of the ERC-165 standard, as defined in the
 * https://eips.ethereum.org/EIPS/eip-165[ERC].
 *
 * Implementers can declare support of contract interfaces, which can then be
 * queried by others ({ERC165Checker}).
 *
 * For an implementation, see {ERC165}.
 */
interface IERC165 {
    /**
     * @dev Returns true if this contract implements the interface defined by
     * `interfaceId`. See the corresponding
     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[ERC section]
     * to learn more about how these ids are created.
     *
     * This function call must use less than 30 000 gas.
     */
    function supportsInterface(bytes4 interfaceId) external view returns (bool);
}
"
    }
  },
  "settings": {
    "remappings": [
      "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
      "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
      "forge-std/=lib/forge-std/src/",
      "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
      "openzeppelin-contracts/=lib/openzeppelin-contracts/"
    ],
    "optimizer": {
      "enabled": false,
      "runs": 200
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "ipfs",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "prague",
    "viaIR": false
  }
}}

Tags:
ERC20, ERC165, DeFi, Swap, Liquidity, Yield, Factory|addr:0xf81eef6e6a2c0b3c271f6b2ca9c689fd487ce328|verified:true|block:23745601|tx:0xe502b6dee822f15b4e473b852c9b5ce5947113397419ad8d9ae3efe435a99d65|first_check:1762515747

Submitted on: 2025-11-07 12:42:28

Comments

Log in to comment.

No comments yet.