EOSpectraPTFeed

Description:

Proxy contract enabling upgradeable smart contract patterns. Delegates calls to an implementation contract.

Blockchain: Ethereum

Source Code: View Code On The Blockchain

Solidity Source Code:

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

import { ISpectraPT } from "./interfaces/spectra/ISpectraPT.sol";
import { EOBase } from "./EOBase.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { IEOSpectraPTFeed } from "./interfaces/IEOSpectraPTFeed.sol";
import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
import { DecimalConverter } from "./libraries/DecimalsConverter.sol";

/**
 * @title EOSpectraPTFeed
 * @author EO
 * @notice Spectra PT feed oracle, based on selected discount type.
 */
contract EOSpectraPTFeed is IEOSpectraPTFeed, EOBase, Initializable {
    using DecimalConverter for uint256;

    /**
     * @notice The number of seconds in a year.
     */
    uint256 internal constant _SECONDS_PER_YEAR = 365 days;

    /**
     * @notice The constant value of 1.
     */
    uint256 internal constant _ONE = 1e18;

    /**
     * @notice The unit precision of the PT token.
     */
    uint256 internal _ptScale;

    /**
     * @notice The decimals precision of the underlying token.
     */
    uint8 public underlyingDecimals;

    /**
     * @notice The decimals precision of the price feed.
     */
    uint8 public decimals;

    /**
     * @notice The address of the PT token.
     */
    address public ptToken;

    /**
     * @notice The maturity of the discount.
     */
    uint256 public maturity;

    /**
     * @notice The initial implied APY, 100% = 1e18
     */
    uint256 public initialImpliedAPY;

    /**
     * @notice The type of the discount.
     * @dev LINEAR(0)
     */
    DiscountType public discountType;

    /**
     * @notice The description of the price feed.
     */
    string public description;

    /**
     * @notice The initialization timestamp of this feed.
     */
    uint256 public startTime;

    /**
     * @notice The gap for the upgradeable contract.
     */
    uint256[50] private _gap;

    /**
     * @custom:oz-upgrades-unsafe-allow constructor
     */
    constructor() {
        _disableInitializers();
    }

    /**
     * @notice Initialize the price feed.
     * @param ptToken_ The address of the PT token.
     * @param description_ The description of the price feed.
     * @param initialImpliedAPY_ The initial implied APY.
     * @param discountType_ The type of the discount.
     * @param decimals_ The decimals of the price feed, if 0 - use the underlying decimals
     */
    function initialize(
        address ptToken_,
        string memory description_,
        uint256 initialImpliedAPY_,
        DiscountType discountType_,
        uint8 decimals_
    )
        external
        initializer
    {
        _initializeSpectraPTFeed(ptToken_, description_, initialImpliedAPY_, discountType_, decimals_);
    }

    /**
     * @notice Returns latest round data in configured decimals
     * @dev Returns zero for roundId, startedAt and answeredInRound.
     * @return roundId The round id, returns 0
     * @return answer The answer, returns the rate according to the discountType
     * @return startedAt The started at, returns 0
     * @return updatedAt The updated at, returns current block timestamp
     * @return answeredInRound The answered in round, returns 0
     */
    function latestRoundData() public view virtual override returns (uint80, int256, uint256, uint256, uint80) {
        uint256 priceWithDiscount = _getPriceWithDiscount();
        uint256 price = priceWithDiscount.convertDecimals(underlyingDecimals, decimals);

        return (0, int256(price), 0, block.timestamp, 0);
    }

    /**
     * @notice Internal initializer to support multiple inheritance initialization
     * @dev Should be called only from within another initializer
     */
    function _initializeSpectraPTFeed(
        address ptToken_,
        string memory description_,
        uint256 initialImpliedAPY_,
        DiscountType discountType_,
        uint8 decimals_
    )
        internal
        onlyInitializing
    {
        if (ptToken_ == address(0)) revert PTTokenAddressIsZero();

        _ptScale = 10 ** ISpectraPT(ptToken_).decimals();

        underlyingDecimals = IERC20Metadata(ISpectraPT(ptToken_).underlying()).decimals();
        ptToken = ptToken_;
        maturity = ISpectraPT(ptToken_).maturity();
        discountType = discountType_;
        initialImpliedAPY = initialImpliedAPY_;
        description = description_;
        decimals = decimals_ == 0 ? underlyingDecimals : decimals_;
        startTime = block.timestamp;

        uint256 price = _getPriceWithDiscount();

        // the check is necessary to avoid deployment of the feed with a price being 0
        // slither-disable-next-line incorrect-equality
        if (price == 0) revert PriceMustBeGreaterThanZero();
    }

    /**
     * @notice Get the discount for a given future PT value.
     * @return The price with discount applied, with decimals equal to underlying decimals
     */
    function _getPriceWithDiscount() internal view returns (uint256) {
        uint256 futurePTValue = ISpectraPT(ptToken).convertToUnderlying(_ptScale);

        if (discountType == DiscountType.LINEAR) {
            uint256 currentTimestamp = block.timestamp;

            if (currentTimestamp >= maturity) {
                return futurePTValue;
            }

            uint256 duration = maturity - startTime;
            uint256 termAdjustedInitialImpliedAPY = (initialImpliedAPY * duration) / _SECONDS_PER_YEAR;

            uint256 anchor = (futurePTValue * _ONE) / (_ONE + termAdjustedInitialImpliedAPY);
            uint256 drift = ((futurePTValue - anchor) * (currentTimestamp - startTime)) / duration;
            uint256 price = anchor + drift;
            return price;
        } else {
            revert InvalidDiscountType();
        }
    }
}
"
    },
    "src/interfaces/spectra/ISpectraPT.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

interface ISpectraPT {
    function maturity() external view returns (uint256);

    function decimals() external view returns (uint8);

    function convertToUnderlying(uint256 amount) external view returns (uint256);

    function underlying() external view returns (address);
}
"
    },
    "src/EOBase.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

import { AggregatorV2V3Interface } from "./interfaces/AggregatorV2V3Interface.sol";

/**
 * @title EOBase
 * @author EO
 * @notice Base contract for EO contracts
 */
abstract contract EOBase is AggregatorV2V3Interface {
    /**
     * @notice Returns the latest answer
     * @return The latest answer
     */
    function latestAnswer() external view returns (int256) {
        (, int256 answer,,,) = latestRoundData();
        return answer;
    }

    /**
     * @notice Returns the latest update timestamp
     * @return The latest update timestamp
     */
    function latestTimestamp() external view returns (uint256) {
        (,,, uint256 updatedAt,) = latestRoundData();
        return updatedAt;
    }

    /**
     * @notice Returns the latest round ID
     * @return The latest round ID
     */
    function latestRound() external view returns (uint256) {
        (uint80 roundId,,,,) = latestRoundData();
        return uint256(roundId);
    }

    /**
     * @notice Returns the answer of the latest round
     * @param roundId The round ID (ignored)
     * @return The answer of the latest round
     */
    function getAnswer(uint256 roundId) external view returns (int256) {
        (, int256 answer,,,) = getRoundData(uint80(roundId));
        return answer;
    }

    /**
     * @notice Returns the update timestamp of the latest round
     * @param roundId The round ID (ignored)
     * @return The update timestamp of the latest round
     */
    function getTimestamp(uint256 roundId) external view returns (uint256) {
        (,,, uint256 updatedAt,) = getRoundData(uint80(roundId));
        return updatedAt;
    }

    /**
     * @notice Returns the minimum updated at, default to updatedAt in latestRoundData
     * @dev This method is valuable for complex feeds, where other feeds rates are involved into computation
     * and since updatedAt in latestRoundData is the latest updatedAt among the feeds, it may not reflect the data
     * freshness, so this method shows the earliest updatedAt among the feeds, and reflects the data freshness
     * @return The minimum updated at among the feeds used to compute the final rate
     */
    function minUpdatedAt() external view virtual returns (uint256) {
        (,,, uint256 updatedAt,) = latestRoundData();
        return updatedAt;
    }

    /**
     * @notice Returns the latest round data
     * @return roundId The latest round ID, optional
     * @return answer The latest answer
     * @return startedAt The timestamp when the round started, optional
     * @return updatedAt The timestamp of the latest update
     * @return answeredInRound The round ID in which the answer was computed, optional
     */
    function latestRoundData()
        public
        view
        virtual
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

    /**
     * @notice Returns the latest round data
     * @param roundId The round ID, is ignored
     * @return roundId The round ID of   the latest round data
     * @return answer The answer of the latest round data
     * @return startedAt The started at of the latest round data
     * @return updatedAt The updated at of the latest round data
     * @return answeredInRound The round ID in which the answer was computed of the latest round data
     */
    function getRoundData(uint80)
        public
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)
    {
        return latestRoundData();
    }
}
"
    },
    "lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/Initializable.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.3.0) (proxy/utils/Initializable.sol)

pragma solidity ^0.8.20;

/**
 * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed
 * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an
 * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer
 * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.
 *
 * The initialization functions use a version number. Once a version number is used, it is consumed and cannot be
 * reused. This mechanism prevents re-execution of each "step" but allows the creation of new initialization steps in
 * case an upgrade adds a module that needs to be initialized.
 *
 * For example:
 *
 * [.hljs-theme-light.nopadding]
 * ```solidity
 * contract MyToken is ERC20Upgradeable {
 *     function initialize() initializer public {
 *         __ERC20_init("MyToken", "MTK");
 *     }
 * }
 *
 * contract MyTokenV2 is MyToken, ERC20PermitUpgradeable {
 *     function initializeV2() reinitializer(2) public {
 *         __ERC20Permit_init("MyToken");
 *     }
 * }
 * ```
 *
 * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as
 * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.
 *
 * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure
 * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.
 *
 * [CAUTION]
 * ====
 * Avoid leaving a contract uninitialized.
 *
 * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation
 * contract, which may impact the proxy. To prevent the implementation contract from being used, you should invoke
 * the {_disableInitializers} function in the constructor to automatically lock it when it is deployed:
 *
 * [.hljs-theme-light.nopadding]
 * ```
 * /// @custom:oz-upgrades-unsafe-allow constructor
 * constructor() {
 *     _disableInitializers();
 * }
 * ```
 * ====
 */
abstract contract Initializable {
    /**
     * @dev Storage of the initializable contract.
     *
     * It's implemented on a custom ERC-7201 namespace to reduce the risk of storage collisions
     * when using with upgradeable contracts.
     *
     * @custom:storage-location erc7201:openzeppelin.storage.Initializable
     */
    struct InitializableStorage {
        /**
         * @dev Indicates that the contract has been initialized.
         */
        uint64 _initialized;
        /**
         * @dev Indicates that the contract is in the process of being initialized.
         */
        bool _initializing;
    }

    // keccak256(abi.encode(uint256(keccak256("openzeppelin.storage.Initializable")) - 1)) & ~bytes32(uint256(0xff))
    bytes32 private constant INITIALIZABLE_STORAGE = 0xf0c57e16840df040f15088dc2f81fe391c3923bec73e23a9662efc9c229c6a00;

    /**
     * @dev The contract is already initialized.
     */
    error InvalidInitialization();

    /**
     * @dev The contract is not initializing.
     */
    error NotInitializing();

    /**
     * @dev Triggered when the contract has been initialized or reinitialized.
     */
    event Initialized(uint64 version);

    /**
     * @dev A modifier that defines a protected initializer function that can be invoked at most once. In its scope,
     * `onlyInitializing` functions can be used to initialize parent contracts.
     *
     * Similar to `reinitializer(1)`, except that in the context of a constructor an `initializer` may be invoked any
     * number of times. This behavior in the constructor can be useful during testing and is not expected to be used in
     * production.
     *
     * Emits an {Initialized} event.
     */
    modifier initializer() {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        // Cache values to avoid duplicated sloads
        bool isTopLevelCall = !$._initializing;
        uint64 initialized = $._initialized;

        // Allowed calls:
        // - initialSetup: the contract is not in the initializing state and no previous version was
        //                 initialized
        // - construction: the contract is initialized at version 1 (no reinitialization) and the
        //                 current contract is just being deployed
        bool initialSetup = initialized == 0 && isTopLevelCall;
        bool construction = initialized == 1 && address(this).code.length == 0;

        if (!initialSetup && !construction) {
            revert InvalidInitialization();
        }
        $._initialized = 1;
        if (isTopLevelCall) {
            $._initializing = true;
        }
        _;
        if (isTopLevelCall) {
            $._initializing = false;
            emit Initialized(1);
        }
    }

    /**
     * @dev A modifier that defines a protected reinitializer function that can be invoked at most once, and only if the
     * contract hasn't been initialized to a greater version before. In its scope, `onlyInitializing` functions can be
     * used to initialize parent contracts.
     *
     * A reinitializer may be used after the original initialization step. This is essential to configure modules that
     * are added through upgrades and that require initialization.
     *
     * When `version` is 1, this modifier is similar to `initializer`, except that functions marked with `reinitializer`
     * cannot be nested. If one is invoked in the context of another, execution will revert.
     *
     * Note that versions can jump in increments greater than 1; this implies that if multiple reinitializers coexist in
     * a contract, executing them in the right order is up to the developer or operator.
     *
     * WARNING: Setting the version to 2**64 - 1 will prevent any future reinitialization.
     *
     * Emits an {Initialized} event.
     */
    modifier reinitializer(uint64 version) {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing || $._initialized >= version) {
            revert InvalidInitialization();
        }
        $._initialized = version;
        $._initializing = true;
        _;
        $._initializing = false;
        emit Initialized(version);
    }

    /**
     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the
     * {initializer} and {reinitializer} modifiers, directly or indirectly.
     */
    modifier onlyInitializing() {
        _checkInitializing();
        _;
    }

    /**
     * @dev Reverts if the contract is not in an initializing state. See {onlyInitializing}.
     */
    function _checkInitializing() internal view virtual {
        if (!_isInitializing()) {
            revert NotInitializing();
        }
    }

    /**
     * @dev Locks the contract, preventing any future reinitialization. This cannot be part of an initializer call.
     * Calling this in the constructor of a contract will prevent that contract from being initialized or reinitialized
     * to any version. It is recommended to use this to lock implementation contracts that are designed to be called
     * through proxies.
     *
     * Emits an {Initialized} event the first time it is successfully executed.
     */
    function _disableInitializers() internal virtual {
        // solhint-disable-next-line var-name-mixedcase
        InitializableStorage storage $ = _getInitializableStorage();

        if ($._initializing) {
            revert InvalidInitialization();
        }
        if ($._initialized != type(uint64).max) {
            $._initialized = type(uint64).max;
            emit Initialized(type(uint64).max);
        }
    }

    /**
     * @dev Returns the highest version that has been initialized. See {reinitializer}.
     */
    function _getInitializedVersion() internal view returns (uint64) {
        return _getInitializableStorage()._initialized;
    }

    /**
     * @dev Returns `true` if the contract is currently initializing. See {onlyInitializing}.
     */
    function _isInitializing() internal view returns (bool) {
        return _getInitializableStorage()._initializing;
    }

    /**
     * @dev Pointer to storage slot. Allows integrators to override it with a custom storage location.
     *
     * NOTE: Consider following the ERC-7201 formula to derive storage locations.
     */
    function _initializableStorageSlot() internal pure virtual returns (bytes32) {
        return INITIALIZABLE_STORAGE;
    }

    /**
     * @dev Returns a pointer to the storage namespace.
     */
    // solhint-disable-next-line var-name-mixedcase
    function _getInitializableStorage() private pure returns (InitializableStorage storage $) {
        bytes32 slot = _initializableStorageSlot();
        assembly {
            $.slot := slot
        }
    }
}
"
    },
    "src/interfaces/IEOSpectraPTFeed.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**
 * @title IEOSpectraPTFeed
 * @author EO
 * @notice Interface for Spectra PT feed oracle, based on selected discount type.
 */
interface IEOSpectraPTFeed {
    /**
     * @notice The type of the discount
     * @dev LINEAR: 0
     */
    enum DiscountType {
        LINEAR
    }

    /**
     * @notice Error thrown when the PT token address is zero.
     */
    error PTTokenAddressIsZero();

    /**
     * @notice Error thrown when the discount type is invalid.
     */
    error InvalidDiscountType();

    /**
     * @notice Error thrown when the price is zero.
     */
    error PriceMustBeGreaterThanZero();

    function initialize(
        address ptToken_,
        string memory description_,
        uint256 initialImpliedAPY_,
        DiscountType discountType_,
        uint8 decimals_
    )
        external;
}
"
    },
    "lib/openzeppelin-contracts/contracts/token/ERC20/extensions/IERC20Metadata.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.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 ERC-20 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);
}
"
    },
    "src/libraries/DecimalsConverter.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**
 * @title DecimalConverter
 * @author EO
 * @notice Library to convert amount from/to exact decimals
 */
library DecimalConverter {
    /**
     * @notice Converts a value from fromDecimals decimals to toDecimals decimals
     * @param amount The value to convert
     * @param fromDecimals Original number of decimals
     * @param toDecimals Target number of decimals
     * @return The converted value
     */
    function convertDecimals(uint256 amount, uint8 fromDecimals, uint8 toDecimals) internal pure returns (uint256) {
        if (fromDecimals == toDecimals) {
            return amount;
        } else if (fromDecimals < toDecimals) {
            return amount * (10 ** (toDecimals - fromDecimals));
        } else {
            return amount / (10 ** (fromDecimals - toDecimals));
        }
    }

    /**
     * @notice Converts to 18 decimals from a given decimal
     * @param amount The value to convert
     * @param fromDecimals Original number of decimals
     * @return The converted value
     */
    function to18Decimals(uint256 amount, uint8 fromDecimals) internal pure returns (uint256) {
        return convertDecimals(amount, fromDecimals, 18);
    }

    /**
     * @notice Returns the multipliers for the conversion
     * @param fromDecimals Original number of decimals
     * @param toDecimals Target number of decimals
     * @return numerator The numerator multiplier
     * @return denominator The denominator multiplier
     */
    function getMultipliers(
        uint8 fromDecimals,
        uint8 toDecimals
    )
        internal
        pure
        returns (uint256 numerator, uint256 denominator)
    {
        if (fromDecimals == toDecimals) {
            return (1, 1);
        } else if (fromDecimals < toDecimals) {
            return (10 ** (toDecimals - fromDecimals), 1);
        } else {
            return (1, 10 ** (fromDecimals - toDecimals));
        }
    }
}
"
    },
    "src/interfaces/AggregatorV2V3Interface.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

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

/**
 * @title AggregatorV2V3Interface
 * @author EO
 * @notice Interface for the AggregatorV2V3 contract
 */
interface AggregatorV2V3Interface is MinimalAggregatorV3Interface {
    /**
     * @notice Returns the latest answer
     * @return The latest answer
     */
    function latestAnswer() external view returns (int256);

    /**
     * @notice Returns the latest update timestamp
     * @return The latest update timestamp
     */
    function latestTimestamp() external view returns (uint256);

    /**
     * @notice Returns the latest round ID
     * @return The latest round ID
     */
    function latestRound() external view returns (uint256);

    /**
     * @notice Returns the answer of the latest round
     * @param roundId The round ID (ignored)
     * @return The answer of the latest round
     */
    function getAnswer(uint256 roundId) external view returns (int256);

    /**
     * @notice Returns the update timestamp of the latest round
     * @param roundId The round ID (ignored)
     * @return The update timestamp of the latest round
     */
    function getTimestamp(uint256 roundId) external view returns (uint256);

    /**
     * @notice Returns the latest round data
     * @return roundId The latest round ID, optional
     * @return answer The latest answer
     * @return startedAt The timestamp when the round started, optional
     * @return updatedAt The timestamp of the latest update
     * @return answeredInRound The round ID in which the answer was computed, optional
     */
    function latestRoundData()
        external
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);

    /**
     * @notice Returns the latest round data
     * @param roundId The round ID, is ignored
     * @return roundId The round ID of   the latest round data
     * @return answer The answer of the latest round data
     * @return startedAt The started at of the latest round data
     * @return updatedAt The updated at of the latest round data
     * @return answeredInRound The round ID in which the answer was computed of the latest round data
     */
    function getRoundData(uint80)
        external
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
"
    },
    "lib/openzeppelin-contracts/contracts/token/ERC20/IERC20.sol": {
      "content": "// SPDX-License-Identifier: MIT
// OpenZeppelin Contracts (last updated v5.1.0) (token/ERC20/IERC20.sol)

pragma solidity ^0.8.20;

/**
 * @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);
}
"
    },
    "src/interfaces/MinimalAggregatorV3Interface.sol": {
      "content": "// SPDX-License-Identifier: MIT
pragma solidity 0.8.25;

/**
 * @title MinimalAggregatorV3Interface
 * @author EO
 * @notice Interface for price feed oracle
 */
interface MinimalAggregatorV3Interface {
    /**
     * @notice Returns feed decimals
     * @return The decimals of the feed.
     */
    function decimals() external view returns (uint8);

    /**
     * @notice Returns the latest round data
     * @return roundId The latest round ID, optional
     * @return answer The latest answer
     * @return startedAt The timestamp when the round started, optional
     * @return updatedAt The timestamp of the latest update
     * @return answeredInRound The round ID in which the answer was computed, optional
     */
    function latestRoundData()
        external
        view
        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
"
    }
  },
  "settings": {
    "remappings": [
      "@openzeppelin/contracts/=lib/openzeppelin-contracts/contracts/",
      "@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
      "@openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
      "@maverick/v2-common/=lib/maverickprotocol-v2-common/",
      "forge-std/=lib/forge-std/src/",
      "@eoracle/=lib/target-contracts/src/",
      "@spectra-core/=lib/spectra-core/",
      "lib/spectra-core/:openzeppelin-contracts-upgradeable/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/",
      "lib/spectra-core/:openzeppelin-contracts/=lib/spectra-core/lib/openzeppelin-contracts/contracts/",
      "ds-test/=lib/spectra-core/lib/forge-std/lib/ds-test/src/",
      "erc4626-tests/=lib/openzeppelin-contracts/lib/erc4626-tests/",
      "halmos-cheatcodes/=lib/openzeppelin-contracts/lib/halmos-cheatcodes/src/",
      "openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
      "openzeppelin-contracts/=lib/openzeppelin-contracts/",
      "openzeppelin-erc20-basic/=lib/spectra-core/lib/openzeppelin-contracts/contracts/token/ERC20/",
      "openzeppelin-erc20-extensions/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/extensions/",
      "openzeppelin-erc20/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/token/ERC20/",
      "openzeppelin-foundry-upgrades/=lib/openzeppelin-foundry-upgrades/src/",
      "openzeppelin-math/=lib/spectra-core/lib/openzeppelin-contracts/contracts/utils/math/",
      "openzeppelin-proxy/=lib/spectra-core/lib/openzeppelin-contracts-upgradeable/contracts/proxy/utils/",
      "openzeppelin-utils/=lib/spectra-core/lib/openzeppelin-contracts/contracts/utils/",
      "spectra-core/=lib/spectra-core/"
    ],
    "optimizer": {
      "enabled": true,
      "runs": 100
    },
    "metadata": {
      "useLiteralContent": false,
      "bytecodeHash": "none",
      "appendCBOR": true
    },
    "outputSelection": {
      "*": {
        "*": [
          "evm.bytecode",
          "evm.deployedBytecode",
          "devdoc",
          "userdoc",
          "metadata",
          "abi"
        ]
      }
    },
    "evmVersion": "cancun",
    "viaIR": true
  }
}}

Tags:
ERC20, Proxy, Upgradeable, Factory, Oracle|addr:0x3335e37bcb462ec0ca041007b35e993e82c20d07|verified:true|block:23675989|tx:0x88a861bf7798d5306f04b03d3e69bf945aa849ed8027977194fe32fdb56793d0|first_check:1761658953

Submitted on: 2025-10-28 14:42:35

Comments

Log in to comment.

No comments yet.