{"file_path":"lib/capped-oracle-feed/src/CappedOracleFeed.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.28;\n\nimport {MinAggregatorV3Interface} from \"./interfaces/MinAggregatorV3Interface.sol\";\n\n/**\n * @title  CappedOracleFeed\n * @notice A Chainlink-compatible oracle wrapper that enforces a maximum price cap.\n * @dev    Wraps an existing Chainlink price feed and ensures the reported price\n *         never exceeds `maxPrice`.\n *\n *         Implements MinAggregatorV3Interface (decimals, latestRoundData).\n *         Methods like description(), version(), and getRoundData() are intentionally omitted.\n *\n *         Decimals are validated against the source at deployment and assumed stable\n *         thereafter — restricted to 8 (Chainlink standard for USD pairs).\n *         Both `source` and `maxPrice` are immutable — once deployed, the cap cannot\n *         be changed.\n */\ncontract CappedOracleFeed is MinAggregatorV3Interface {\n    error InvalidSource();\n    error InvalidDecimals();\n    error InvalidMaxPrice();\n\n    MinAggregatorV3Interface public immutable source;\n    int256 public immutable maxPrice;\n\n    constructor(address _source, int256 _maxPrice) {\n        if (_source == address(0)) revert InvalidSource();\n        if (MinAggregatorV3Interface(_source).decimals() != 8) revert InvalidDecimals();\n        if (_maxPrice <= 0) revert InvalidMaxPrice();\n\n        source = MinAggregatorV3Interface(_source);\n        maxPrice = _maxPrice;\n    }\n\n    /// @notice Returns the full round data from the source feed with a capped price.\n    /// @dev    All fields except `answer` are passed through unchanged from the source.\n    ///         When the cap applies, `answer` is synthetic while round metadata reflects the source round.\n    ///         Staleness and validity checks are intentionally omitted — consumers should apply their own.\n    function latestRoundData()\n        external\n        view\n        override\n        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound)\n    {\n        (roundId, answer, startedAt, updatedAt, answeredInRound) = source.latestRoundData();\n        if (answer > maxPrice) answer = maxPrice;\n    }\n\n    /// @notice Returns the number of decimals used by this oracle.\n    /// @return 8 (Chainlink standard for USD pairs)\n    function decimals() external pure override returns (uint8) {\n        return 8;\n    }\n}\n","deployed_bytecode":"0x608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063313ce5671461004e57806367e828bf1461006c578063e38d6b5c1461008a578063feaf968c146100a8575b5f5ffd5b6100566100ca565b604051610063919061022e565b60405180910390f35b6100746100d2565b60405161008191906102c1565b60405180910390f35b6100926100f6565b60405161009f91906102f2565b60405180910390f35b6100b061011a565b6040516100c1959493929190610347565b60405180910390f35b5f6008905090565b7f0000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d81565b7f0000000000000000000000000000000000000000000000000000000005f5e10081565b5f5f5f5f5f7f0000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d73ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610188573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101ac919061041a565b80955081965082975083985084995050505050507f0000000000000000000000000000000000000000000000000000000005f5e10084131561020c577f0000000000000000000000000000000000000000000000000000000005f5e10093505b9091929394565b5f60ff82169050919050565b61022881610213565b82525050565b5f6020820190506102415f83018461021f565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f61028961028461027f84610247565b610266565b610247565b9050919050565b5f61029a8261026f565b9050919050565b5f6102ab82610290565b9050919050565b6102bb816102a1565b82525050565b5f6020820190506102d45f8301846102b2565b92915050565b5f819050919050565b6102ec816102da565b82525050565b5f6020820190506103055f8301846102e3565b92915050565b5f69ffffffffffffffffffff82169050919050565b6103298161030b565b82525050565b5f819050919050565b6103418161032f565b82525050565b5f60a08201905061035a5f830188610320565b61036760208301876102e3565b6103746040830186610338565b6103816060830185610338565b61038e6080830184610320565b9695505050505050565b5f5ffd5b6103a58161030b565b81146103af575f5ffd5b50565b5f815190506103c08161039c565b92915050565b6103cf816102da565b81146103d9575f5ffd5b50565b5f815190506103ea816103c6565b92915050565b6103f98161032f565b8114610403575f5ffd5b50565b5f81519050610414816103f0565b92915050565b5f5f5f5f5f60a0868803121561043357610432610398565b5b5f610440888289016103b2565b9550506020610451888289016103dc565b945050604061046288828901610406565b935050606061047388828901610406565b9250506080610484888289016103b2565b915050929550929590935056fea2646970667358221220c75e2d5a6a1ce23d9c565d216b9a5ee66ed05e271fc9a9144acc495f42bb8c3664736f6c63430008220033","optimization_enabled":false,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"prague","libraries":{},"metadata":{"appendCBOR":true,"bytecodeHash":"ipfs","useLiteralContent":false},"optimizer":{"enabled":false,"runs":200},"outputSelection":{"*":{"":["*"],"*":["*"]}},"remappings":["capped-oracle-feed/=lib/capped-oracle-feed/src/","forge-std/=lib/forge-std/src/"],"viaIR":false},"optimization_runs":null,"sourcify_repo_url":null,"decoded_constructor_args":[["0x3E7d1eAB13ad0104d2750B8863b489D65364e32D",{"internalType":"address","name":"_source","type":"address"}],["100000000",{"internalType":"int256","name":"_maxPrice","type":"int256"}]],"compiler_version":"v0.8.34+commit.80d5c536","is_verified_via_verifier_alliance":false,"verified_at":"2026-08-04T21:26:39.399517Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x60c060405234801561000f575f5ffd5b506040516107e63803806107e68339818101604052810190610031919061024c565b5f73ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1603610096576040517f8154374b00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b60088273ffffffffffffffffffffffffffffffffffffffff1663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100e1573d5f5f3e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061010591906102c0565b60ff161461013f576040517fd25598a000000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b5f8113610178576040517f7c2401bb00000000000000000000000000000000000000000000000000000000815260040160405180910390fd5b8173ffffffffffffffffffffffffffffffffffffffff1660808173ffffffffffffffffffffffffffffffffffffffff16815250508060a0818152505050506102eb565b5f5ffd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6101e8826101bf565b9050919050565b6101f8816101de565b8114610202575f5ffd5b50565b5f81519050610213816101ef565b92915050565b5f819050919050565b61022b81610219565b8114610235575f5ffd5b50565b5f8151905061024681610222565b92915050565b5f5f60408385031215610262576102616101bb565b5b5f61026f85828601610205565b925050602061028085828601610238565b9150509250929050565b5f60ff82169050919050565b61029f8161028a565b81146102a9575f5ffd5b50565b5f815190506102ba81610296565b92915050565b5f602082840312156102d5576102d46101bb565b5b5f6102e2848285016102ac565b91505092915050565b60805160a0516104c761031f5f395f818160f8015281816101c201526101ea01525f818160d4015261012101526104c75ff3fe608060405234801561000f575f5ffd5b506004361061004a575f3560e01c8063313ce5671461004e57806367e828bf1461006c578063e38d6b5c1461008a578063feaf968c146100a8575b5f5ffd5b6100566100ca565b604051610063919061022e565b60405180910390f35b6100746100d2565b60405161008191906102c1565b60405180910390f35b6100926100f6565b60405161009f91906102f2565b60405180910390f35b6100b061011a565b6040516100c1959493929190610347565b60405180910390f35b5f6008905090565b7f000000000000000000000000000000000000000000000000000000000000000081565b7f000000000000000000000000000000000000000000000000000000000000000081565b5f5f5f5f5f7f000000000000000000000000000000000000000000000000000000000000000073ffffffffffffffffffffffffffffffffffffffff1663feaf968c6040518163ffffffff1660e01b815260040160a060405180830381865afa158015610188573d5f5f3e3d5ffd5b505050506040513d601f19601f820116820180604052508101906101ac919061041a565b80955081965082975083985084995050505050507f000000000000000000000000000000000000000000000000000000000000000084131561020c577f000000000000000000000000000000000000000000000000000000000000000093505b9091929394565b5f60ff82169050919050565b61022881610213565b82525050565b5f6020820190506102415f83018461021f565b92915050565b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f819050919050565b5f61028961028461027f84610247565b610266565b610247565b9050919050565b5f61029a8261026f565b9050919050565b5f6102ab82610290565b9050919050565b6102bb816102a1565b82525050565b5f6020820190506102d45f8301846102b2565b92915050565b5f819050919050565b6102ec816102da565b82525050565b5f6020820190506103055f8301846102e3565b92915050565b5f69ffffffffffffffffffff82169050919050565b6103298161030b565b82525050565b5f819050919050565b6103418161032f565b82525050565b5f60a08201905061035a5f830188610320565b61036760208301876102e3565b6103746040830186610338565b6103816060830185610338565b61038e6080830184610320565b9695505050505050565b5f5ffd5b6103a58161030b565b81146103af575f5ffd5b50565b5f815190506103c08161039c565b92915050565b6103cf816102da565b81146103d9575f5ffd5b50565b5f815190506103ea816103c6565b92915050565b6103f98161032f565b8114610403575f5ffd5b50565b5f81519050610414816103f0565b92915050565b5f5f5f5f5f60a0868803121561043357610432610398565b5b5f610440888289016103b2565b9550506020610451888289016103dc565b945050604061046288828901610406565b935050606061047388828901610406565b9250506080610484888289016103b2565b915050929550929590935056fea2646970667358221220c75e2d5a6a1ce23d9c565d216b9a5ee66ed05e271fc9a9144acc495f42bb8c3664736f6c634300082200330000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d0000000000000000000000000000000000000000000000000000000005f5e100","name":"CappedOracleFeed","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":false,"language":"solidity","evm_version":"prague","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"lib/capped-oracle-feed/src/interfaces/MinAggregatorV3Interface.sol","source_code":"// SPDX-License-Identifier: AGPL-3.0\npragma solidity ^0.8.0;\n\n/// @notice Minimal subset of Chainlink's AggregatorV3Interface.\n///         See https://github.com/smartcontractkit/chainlink-local/blob/main/src/data-feeds/interfaces/AggregatorV3Interface.sol\ninterface MinAggregatorV3Interface {\n    function decimals() external view returns (uint8);\n\n    function latestRoundData()\n        external\n        view\n        returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"_source","type":"address"},{"internalType":"int256","name":"_maxPrice","type":"int256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"InvalidDecimals","type":"error"},{"inputs":[],"name":"InvalidMaxPrice","type":"error"},{"inputs":[],"name":"InvalidSource","type":"error"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"roundId","type":"uint80"},{"internalType":"int256","name":"answer","type":"int256"},{"internalType":"uint256","name":"startedAt","type":"uint256"},{"internalType":"uint256","name":"updatedAt","type":"uint256"},{"internalType":"uint80","name":"answeredInRound","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"maxPrice","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"source","outputs":[{"internalType":"contract MinAggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x0000000000000000000000003e7d1eab13ad0104d2750b8863b489d65364e32d0000000000000000000000000000000000000000000000000000000005f5e100"}