{"file_path":"contracts/feeds/CustomAggregatorV3CompatibleFeedAdjusted.sol","creation_status":"success","source_code":"// SPDX-License-Identifier: MIT\npragma solidity 0.8.9;\n\nimport \"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol\";\n\n/**\n * @title CustomAggregatorV3CompatibleFeedAdjusted\n * @notice AggregatorV3 compatible proxy-feed that adjusts the price\n * of an underlying chainlink compatible feed by a given signed percentage.\n * Positive adjustmentPercentage raises the reported price.\n * Negative adjustmentPercentage lowers the reported price.\n * @author RedDuck Software\n */\ncontract CustomAggregatorV3CompatibleFeedAdjusted is AggregatorV3Interface {\n    /**\n     * @notice the underlying chainlink compatible feed\n     */\n    AggregatorV3Interface public immutable underlyingFeed;\n\n    /**\n     * @notice the adjustment percentage (signed).\n     * Expressed in 10 ** decimals() precision.\n     * Example: 10 ** decimals() = 1%, -(10 ** decimals()) = -1%\n     * Positive values raise the reported price.\n     * Negative values lower the reported price.\n     */\n    int256 public immutable adjustmentPercentage;\n\n    /**\n     * @notice constructor\n     * @param _underlyingFeed the underlying chainlink compatible feed\n     * @param _adjustmentPercentage signed adjustment percentage in 10 ** decimals() precision\n     */\n    constructor(address _underlyingFeed, int256 _adjustmentPercentage) {\n        require(_underlyingFeed != address(0), \"CAA: !underlying feed\");\n        underlyingFeed = AggregatorV3Interface(_underlyingFeed);\n\n        int256 maxPct = int256(100 * (10**decimals()));\n        require(\n            _adjustmentPercentage >= -maxPct && _adjustmentPercentage <= maxPct,\n            \"CAA: invalid adjustment\"\n        );\n\n        adjustmentPercentage = _adjustmentPercentage;\n    }\n\n    /**\n     * @inheritdoc AggregatorV3Interface\n     */\n    function latestRoundData()\n        external\n        view\n        returns (\n            uint80 roundId,\n            int256 answer,\n            uint256 startedAt,\n            uint256 updatedAt,\n            uint80 answeredInRound\n        )\n    {\n        (\n            roundId,\n            answer,\n            startedAt,\n            updatedAt,\n            answeredInRound\n        ) = underlyingFeed.latestRoundData();\n\n        answer = _calculateAdjustedAnswer(answer);\n    }\n\n    /**\n     * @inheritdoc AggregatorV3Interface\n     */\n    function version() external view returns (uint256) {\n        return underlyingFeed.version();\n    }\n\n    /**\n     * @inheritdoc AggregatorV3Interface\n     */\n    function getRoundData(uint80 _roundId)\n        public\n        view\n        returns (\n            uint80 roundId,\n            int256 answer,\n            uint256 startedAt,\n            uint256 updatedAt,\n            uint80 answeredInRound\n        )\n    {\n        (\n            roundId,\n            answer,\n            startedAt,\n            updatedAt,\n            answeredInRound\n        ) = underlyingFeed.getRoundData(_roundId);\n        answer = _calculateAdjustedAnswer(answer);\n    }\n\n    /**\n     * @inheritdoc AggregatorV3Interface\n     */\n    function decimals() public view returns (uint8) {\n        return underlyingFeed.decimals();\n    }\n\n    /**\n     * @inheritdoc AggregatorV3Interface\n     */\n    function description() public view returns (string memory) {\n        if (adjustmentPercentage == 0) return underlyingFeed.description();\n        string memory suffix = adjustmentPercentage > 0\n            ? \" PriceRaised\"\n            : \" PriceLowered\";\n        return string(abi.encodePacked(underlyingFeed.description(), suffix));\n    }\n\n    /**\n     * @dev calculates the adjusted answer\n     * @param _answer the answer to adjust\n     * @return the adjusted answer\n     */\n    function _calculateAdjustedAnswer(int256 _answer)\n        internal\n        view\n        returns (int256)\n    {\n        require(_answer >= 0, \"CAA: !_answer\");\n\n        int256 adjustment = (_answer * adjustmentPercentage) /\n            int256(100 * 10**decimals());\n\n        return _answer + adjustment;\n    }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b506004361061007d5760003560e01c80637284e4161161005b5780637284e416146100f657806384323cf71461010b5780639a6fc8f514610132578063feaf968c1461017c57600080fd5b8063313ce5671461008257806342867f64146100a157806354fd4d50146100e0575b600080fd5b61008a610184565b60405160ff90911681526020015b60405180910390f35b6100c87f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc81565b6040516001600160a01b039091168152602001610098565b6100e861021c565b604051908152602001610098565b6100fe6102af565b6040516100989190610705565b6100e87fffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc3cba0081565b610145610140366004610753565b6104a3565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a001610098565b610145610571565b60007f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc6001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156101df57600080fd5b505afa1580156101f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102179190610770565b905090565b60007f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc6001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561027757600080fd5b505afa15801561028b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102179190610793565b60607fffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc3cba0061036b577f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc6001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b15801561032f57600080fd5b505afa158015610343573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261021791908101906107c2565b6000807fffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc3cba00136103bf576040518060400160405280600d81526020016c08141c9a58d9531bddd95c9959609a1b8152506103e5565b6040518060400160405280600c81526020016b08141c9a58d954985a5cd95960a21b8152505b90507f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc6001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b15801561044057600080fd5b505afa158015610454573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261047c91908101906107c2565b8160405160200161048e92919061086f565b60405160208183030381529060405291505090565b604051639a6fc8f560e01b815269ffffffffffffffffffff8216600482015260009081908190819081906001600160a01b037f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc1690639a6fc8f59060240160a06040518083038186803b15801561051957600080fd5b505afa15801561052d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610551919061089e565b93985091965094509250905061056684610628565b935091939590929450565b60008060008060007f0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbc6001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156105d257600080fd5b505afa1580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a919061089e565b93985091965094509250905061061f84610628565b93509091929394565b60008082121561066e5760405162461bcd60e51b815260206004820152600d60248201526c21a0a09d1010afb0b739bbb2b960991b604482015260640160405180910390fd5b6000610678610184565b61068390600a6109f2565b61068e906064610a01565b6106b87fffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc3cba0085610a20565b6106c29190610aa5565b90506106ce8184610ae1565b9392505050565b60005b838110156106f05781810151838201526020016106d8565b838111156106ff576000848401525b50505050565b60208152600082518060208401526107248160408501602087016106d5565b601f01601f19169190910160400192915050565b69ffffffffffffffffffff8116811461075057600080fd5b50565b60006020828403121561076557600080fd5b81356106ce81610738565b60006020828403121561078257600080fd5b815160ff811681146106ce57600080fd5b6000602082840312156107a557600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156107d457600080fd5b815167ffffffffffffffff808211156107ec57600080fd5b818401915084601f83011261080057600080fd5b815181811115610812576108126107ac565b604051601f8201601f19908116603f0116810190838211818310171561083a5761083a6107ac565b8160405282815287602084870101111561085357600080fd5b6108648360208301602088016106d5565b979650505050505050565b600083516108818184602088016106d5565b8351908301906108958183602088016106d5565b01949350505050565b600080600080600060a086880312156108b657600080fd5b85516108c181610738565b8095505060208601519350604086015192506060860151915060808601516108e881610738565b809150509295509295909350565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561094757816000190482111561092d5761092d6108f6565b8085161561093a57918102915b93841c9390800290610911565b509250929050565b60008261095e575060016109ec565b8161096b575060006109ec565b8160018114610981576002811461098b576109a7565b60019150506109ec565b60ff84111561099c5761099c6108f6565b50506001821b6109ec565b5060208310610133831016604e8410600b84101617156109ca575081810a6109ec565b6109d4838361090c565b80600019048211156109e8576109e86108f6565b0290505b92915050565b60006106ce60ff84168361094f565b6000816000190483118215151615610a1b57610a1b6108f6565b500290565b60006001600160ff1b0381841382841380821686840486111615610a4657610a466108f6565b600160ff1b6000871282811687830589121615610a6557610a656108f6565b60008712925087820587128484161615610a8157610a816108f6565b87850587128184161615610a9757610a976108f6565b505050929093029392505050565b600082610ac257634e487b7160e01b600052601260045260246000fd5b600160ff1b821460001984141615610adc57610adc6108f6565b500590565b600080821280156001600160ff1b0384900385131615610b0357610b036108f6565b600160ff1b8390038412811615610b1c57610b1c6108f6565b5050019056fea26469706673582212200b76a67778c5fe05ee074f4c69f379886adc553aa5ab811e58a0dec001eef32364736f6c63430008090033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"metadata":{"useLiteralContent":true},"optimizer":{"enabled":true,"runs":200}},"optimization_runs":200,"sourcify_repo_url":null,"decoded_constructor_args":[["0x6B593a5FAbb90F36e125562Db833f761d274fcBC",{"internalType":"address","name":"_underlyingFeed","type":"address"}],["-600000000",{"internalType":"int256","name":"_adjustmentPercentage","type":"int256"}]],"compiler_version":"0.8.9+commit.e5eed63a","is_verified_via_verifier_alliance":true,"verified_at":"2026-07-06T03:20:03.753720Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x60c06040523480156200001157600080fd5b5060405162000f4338038062000f438339810160408190526200003491620001b7565b6001600160a01b038216620000905760405162461bcd60e51b815260206004820152601560248201527f4341413a2021756e6465726c79696e672066656564000000000000000000000060448201526064015b60405180910390fd5b6001600160a01b0382166080526000620000a962000139565b620000b690600a62000308565b620000c390606462000320565b9050620000d08162000342565b8212158015620000e05750808213155b6200012e5760405162461bcd60e51b815260206004820152601760248201527f4341413a20696e76616c69642061646a7573746d656e74000000000000000000604482015260640162000087565b5060a0525062000387565b60006080516001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156200017757600080fd5b505afa1580156200018c573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001b2919062000362565b905090565b60008060408385031215620001cb57600080fd5b82516001600160a01b0381168114620001e357600080fd5b6020939093015192949293505050565b634e487b7160e01b600052601160045260246000fd5b600181815b808511156200024a5781600019048211156200022e576200022e620001f3565b808516156200023c57918102915b93841c93908002906200020e565b509250929050565b600082620002635750600162000302565b81620002725750600062000302565b81600181146200028b57600281146200029657620002b6565b600191505062000302565b60ff841115620002aa57620002aa620001f3565b50506001821b62000302565b5060208310610133831016604e8410600b8410161715620002db575081810a62000302565b620002e7838362000209565b8060001904821115620002fe57620002fe620001f3565b0290505b92915050565b60006200031960ff84168362000252565b9392505050565b60008160001904831182151516156200033d576200033d620001f3565b500290565b6000600160ff1b8214156200035b576200035b620001f3565b5060000390565b6000602082840312156200037557600080fd5b815160ff811681146200031957600080fd5b60805160a051610b58620003eb60003960008181610110015281816102b301528181610370015261069301526000818160a60152818161018801528181610220015281816102d8015281816103e9015281816104d7015261057b0152610b586000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637284e4161161005b5780637284e416146100f657806384323cf71461010b5780639a6fc8f514610132578063feaf968c1461017c57600080fd5b8063313ce5671461008257806342867f64146100a157806354fd4d50146100e0575b600080fd5b61008a610184565b60405160ff90911681526020015b60405180910390f35b6100c87f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b039091168152602001610098565b6100e861021c565b604051908152602001610098565b6100fe6102af565b6040516100989190610705565b6100e87f000000000000000000000000000000000000000000000000000000000000000081565b610145610140366004610753565b6104a3565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a001610098565b610145610571565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663313ce5676040518163ffffffff1660e01b815260040160206040518083038186803b1580156101df57600080fd5b505afa1580156101f3573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102179190610770565b905090565b60007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166354fd4d506040518163ffffffff1660e01b815260040160206040518083038186803b15801561027757600080fd5b505afa15801561028b573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102179190610793565b60607f000000000000000000000000000000000000000000000000000000000000000061036b577f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b15801561032f57600080fd5b505afa158015610343573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261021791908101906107c2565b6000807f0000000000000000000000000000000000000000000000000000000000000000136103bf576040518060400160405280600d81526020016c08141c9a58d9531bddd95c9959609a1b8152506103e5565b6040518060400160405280600c81526020016b08141c9a58d954985a5cd95960a21b8152505b90507f00000000000000000000000000000000000000000000000000000000000000006001600160a01b0316637284e4166040518163ffffffff1660e01b815260040160006040518083038186803b15801561044057600080fd5b505afa158015610454573d6000803e3d6000fd5b505050506040513d6000823e601f3d908101601f1916820160405261047c91908101906107c2565b8160405160200161048e92919061086f565b60405160208183030381529060405291505090565b604051639a6fc8f560e01b815269ffffffffffffffffffff8216600482015260009081908190819081906001600160a01b037f00000000000000000000000000000000000000000000000000000000000000001690639a6fc8f59060240160a06040518083038186803b15801561051957600080fd5b505afa15801561052d573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610551919061089e565b93985091965094509250905061056684610628565b935091939590929450565b60008060008060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b031663feaf968c6040518163ffffffff1660e01b815260040160a06040518083038186803b1580156105d257600080fd5b505afa1580156105e6573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061060a919061089e565b93985091965094509250905061061f84610628565b93509091929394565b60008082121561066e5760405162461bcd60e51b815260206004820152600d60248201526c21a0a09d1010afb0b739bbb2b960991b604482015260640160405180910390fd5b6000610678610184565b61068390600a6109f2565b61068e906064610a01565b6106b87f000000000000000000000000000000000000000000000000000000000000000085610a20565b6106c29190610aa5565b90506106ce8184610ae1565b9392505050565b60005b838110156106f05781810151838201526020016106d8565b838111156106ff576000848401525b50505050565b60208152600082518060208401526107248160408501602087016106d5565b601f01601f19169190910160400192915050565b69ffffffffffffffffffff8116811461075057600080fd5b50565b60006020828403121561076557600080fd5b81356106ce81610738565b60006020828403121561078257600080fd5b815160ff811681146106ce57600080fd5b6000602082840312156107a557600080fd5b5051919050565b634e487b7160e01b600052604160045260246000fd5b6000602082840312156107d457600080fd5b815167ffffffffffffffff808211156107ec57600080fd5b818401915084601f83011261080057600080fd5b815181811115610812576108126107ac565b604051601f8201601f19908116603f0116810190838211818310171561083a5761083a6107ac565b8160405282815287602084870101111561085357600080fd5b6108648360208301602088016106d5565b979650505050505050565b600083516108818184602088016106d5565b8351908301906108958183602088016106d5565b01949350505050565b600080600080600060a086880312156108b657600080fd5b85516108c181610738565b8095505060208601519350604086015192506060860151915060808601516108e881610738565b809150509295509295909350565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561094757816000190482111561092d5761092d6108f6565b8085161561093a57918102915b93841c9390800290610911565b509250929050565b60008261095e575060016109ec565b8161096b575060006109ec565b8160018114610981576002811461098b576109a7565b60019150506109ec565b60ff84111561099c5761099c6108f6565b50506001821b6109ec565b5060208310610133831016604e8410600b84101617156109ca575081810a6109ec565b6109d4838361090c565b80600019048211156109e8576109e86108f6565b0290505b92915050565b60006106ce60ff84168361094f565b6000816000190483118215151615610a1b57610a1b6108f6565b500290565b60006001600160ff1b0381841382841380821686840486111615610a4657610a466108f6565b600160ff1b6000871282811687830589121615610a6557610a656108f6565b60008712925087820587128484161615610a8157610a816108f6565b87850587128184161615610a9757610a976108f6565b505050929093029392505050565b600082610ac257634e487b7160e01b600052601260045260246000fd5b600160ff1b821460001984141615610adc57610adc6108f6565b500590565b600080821280156001600160ff1b0384900385131615610b0357610b036108f6565b600160ff1b8390038412811615610b1c57610b1c6108f6565b5050019056fea26469706673582212200b76a67778c5fe05ee074f4c69f379886adc553aa5ab811e58a0dec001eef32364736f6c634300080900330000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbcffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc3cba00","name":"CustomAggregatorV3CompatibleFeedAdjusted","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"default","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":false,"additional_sources":[{"file_path":"@chainlink/contracts/src/v0.8/interfaces/AggregatorV3Interface.sol","source_code":"// SPDX-License-Identifier: MIT\npragma solidity ^0.8.0;\n\ninterface AggregatorV3Interface {\n  function decimals() external view returns (uint8);\n\n  function description() external view returns (string memory);\n\n  function version() external view returns (uint256);\n\n  function getRoundData(uint80 _roundId)\n    external\n    view\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    );\n\n  function latestRoundData()\n    external\n    view\n    returns (\n      uint80 roundId,\n      int256 answer,\n      uint256 startedAt,\n      uint256 updatedAt,\n      uint80 answeredInRound\n    );\n}\n"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[{"internalType":"address","name":"_underlyingFeed","type":"address"},{"internalType":"int256","name":"_adjustmentPercentage","type":"int256"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"adjustmentPercentage","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"decimals","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"description","outputs":[{"internalType":"string","name":"","type":"string"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"_roundId","type":"uint80"}],"name":"getRoundData","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":"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":"underlyingFeed","outputs":[{"internalType":"contract AggregatorV3Interface","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"version","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"}],"is_changed_bytecode":false,"is_partially_verified":false,"constructor_args":"0x0000000000000000000000006b593a5fabb90f36e125562db833f761d274fcbcffffffffffffffffffffffffffffffffffffffffffffffffffffffffdc3cba00"}