{"file_path":"contracts/oracle/BackedOracle.sol","creation_status":"success","source_code":"/**\n * SPDX-License-Identifier: MIT\n *\n * Copyright (c) 2021-2023 Backed Finance AG\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\npragma solidity 0.8.9;\n\nimport \"./BackedOracleInterface.sol\";\n\nimport \"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol\";\n\ncontract BackedOracle is AccessControlUpgradeable, AggregatorV2V3Interface {\n    uint8 public constant VERSION = 1;\n    uint8 public constant MAX_PERCENT_DIFFERENCE = 10;\n    uint32 public constant MAX_TIMESTAMP_AGE = 5 minutes;\n    uint32 public constant MIN_UPDATE_INTERVAL = 1 hours;\n\n    bytes32 public constant UPDATER_ROLE = keccak256(\"UPDATER_ROLE\");\n\n    struct RoundData {\n        int192 answer;\n        uint32 timestamp;\n    }\n\n    uint8 private _decimals;\n    string private _description;\n\n    mapping(uint256 => RoundData) private _roundData;\n    uint80 private _latestRoundNumber;\n\n    constructor() {\n        initialize(0, \"Backed Oracle Implementation\", address(0), address(0));\n    }\n\n    function initialize(\n        uint8 __decimals,\n        string memory __description,\n\n        address __admin,\n        address __updater\n    ) public initializer {\n        _decimals = __decimals;\n        _description = __description;\n\n        _grantRole(DEFAULT_ADMIN_ROLE, __admin);\n        _grantRole(UPDATER_ROLE, __updater);\n    }\n\n    function version() external view override returns (uint256) {\n        return VERSION;\n    }\n\n    function decimals() external view override returns (uint8) {\n        return _decimals;\n    }\n\n    function description() external view override returns (string memory) {\n        return _description;\n    }\n\n    function latestAnswer() external view override returns (int256) {\n        require(_latestRoundNumber != 0, \"No data present\");\n\n        return _roundData[_latestRoundNumber].answer;\n    }\n\n    function latestTimestamp() external view override returns (uint256) {\n        require(_latestRoundNumber != 0, \"No data present\");\n\n        return _roundData[_latestRoundNumber].timestamp;\n    }\n\n    function latestRound() external view override returns (uint256) {\n        require(_latestRoundNumber != 0, \"No data present\");\n\n        return _latestRoundNumber;\n    }\n\n    function latestRoundData()\n        external\n        view\n        override\n        returns (uint80, int256, uint256, uint256, uint80)\n    {\n        require(_latestRoundNumber != 0, \"No data present\");\n\n        return (\n            uint80(_latestRoundNumber),\n            _roundData[_latestRoundNumber].answer,\n            _roundData[_latestRoundNumber].timestamp,\n            _roundData[_latestRoundNumber].timestamp,\n            uint80(_latestRoundNumber)\n        );\n    }\n\n    function getAnswer(\n        uint256 roundId\n    ) external view override returns (int256) {\n        require(roundId <= _latestRoundNumber, \"No data present\");\n\n        return _roundData[roundId].answer;\n    }\n\n    function getTimestamp(\n        uint256 roundId\n    ) external view override returns (uint256) {\n        require(roundId <= _latestRoundNumber, \"No data present\");\n\n        return _roundData[roundId].timestamp;\n    }\n\n    function getRoundData(\n        uint80 roundId\n    )\n        external\n        view\n        override\n        returns (uint80, int256, uint256, uint256, uint80)\n    {\n        require(roundId <= _latestRoundNumber, \"No data present\");\n\n        return (\n            roundId,\n            _roundData[roundId].answer,\n            _roundData[roundId].timestamp,\n            _roundData[roundId].timestamp,\n            roundId\n        );\n    }\n\n    function updateAnswer(\n        int192 newAnswer,\n        uint32 newTimestamp\n    ) external onlyRole(UPDATER_ROLE) {\n        int256 latestAnswer = _roundData[_latestRoundNumber].answer;\n        uint256 latestTimestamp = _roundData[_latestRoundNumber].timestamp;\n\n        // Timestamp is actual timestamp\n        require(\n            newTimestamp < block.timestamp,\n            \"Timestamp cannot be in the future\"\n        );\n\n        // Check that the timestamp is not too old\n        require(\n            block.timestamp - newTimestamp <= MAX_TIMESTAMP_AGE,\n            \"Timestamp is too old\"\n        );\n\n        // The timestamp is more than the last timestamp\n        require(\n            newTimestamp > latestTimestamp,\n            \"Timestamp is older than the last update\"\n        );\n\n        // The last update happened more than MIN_UPDATE_INTERVAL ago\n        require(\n            newTimestamp - latestTimestamp > MIN_UPDATE_INTERVAL,\n            \"Timestamp cannot be updated too often\"\n        );\n\n        // Limit the value to at most MAX_PERCENT_DIFFERENCE% different from the last value\n        if (latestAnswer > 0) {\n            int192 allowedDeviation = int192(\n                (latestAnswer * int8(MAX_PERCENT_DIFFERENCE)) / 100\n            );\n\n            if (newAnswer > latestAnswer + allowedDeviation) {\n                newAnswer = int192(latestAnswer + allowedDeviation);\n            } else if (newAnswer < latestAnswer - allowedDeviation) {\n                newAnswer = int192(latestAnswer - allowedDeviation);\n            }\n        }\n\n        uint80 newRound = _latestRoundNumber + 1;\n\n        _latestRoundNumber = newRound;\n        _roundData[newRound] = RoundData(newAnswer, newTimestamp);\n\n        emit AnswerUpdated(newAnswer, newRound, newTimestamp);\n        emit NewRound(newRound, msg.sender, newTimestamp);\n    }\n}\n","deployed_bytecode":"0x608060405234801561001057600080fd5b50600436106101585760003560e01c80638205bf6a116100c3578063b633620c1161007c578063b633620c14610300578063bd3be27c14610313578063d547741f1461031c578063f4a290671461032f578063feaf968c14610342578063ffa1ad741461034a57600080fd5b80638205bf6a1461027b5780638a991dd11461028357806391d148541461028b5780639a6fc8f51461029e578063a217fddf146102e5578063b5ab58dc146102ed57600080fd5b806347e633801161011557806347e633801461020a57806350d25bcd1461023157806354fd4d5014610239578063668a0f02146102405780637284e4161461024857806376670d7a1461025d57600080fd5b806301ffc9a71461015d578063248a9ca3146101855780632f2ff15d146101b6578063309676e9146101cb578063313ce567146101de57806336568abe146101f7575b600080fd5b61017061016b366004610f9c565b610352565b60405190151581526020015b60405180910390f35b6101a8610193366004610fc6565b60009081526065602052604090206001015490565b60405190815260200161017c565b6101c96101c4366004610ffb565b610389565b005b6101c96101d9366004611027565b6103b4565b60975460ff165b60405160ff909116815260200161017c565b6101c9610205366004610ffb565b610735565b6101a87f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab81565b6101a86107b3565b60016101a8565b6101a8610800565b61025061083b565b60405161017c919061109f565b61026661012c81565b60405163ffffffff909116815260200161017c565b6101a86108cd565b6101e5600a81565b610170610299366004610ffb565b610924565b6102b16102ac3660046110d2565b61094f565b604080516001600160501b03968716815260208101959095528401929092526060830152909116608082015260a00161017c565b6101a8600081565b6101a86102fb366004610fc6565b6109c3565b6101a861030e366004610fc6565b610a07565b610266610e1081565b6101c961032a366004610ffb565b610a55565b6101c961033d366004611111565b610a7b565b6102b1610b90565b6101e5600181565b60006001600160e01b03198216637965db0b60e01b148061038357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103a58133610c0f565b6103af8383610c73565b505050565b7f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab6103df8133610c0f565b609a546001600160501b0316600090815260996020526040902054601781900b9063ffffffff600160c01b90910481169042908516106104705760405162461bcd60e51b815260206004820152602160248201527f54696d657374616d702063616e6e6f7420626520696e207468652066757475726044820152606560f81b60648201526084015b60405180910390fd5b61012c61048363ffffffff861642611212565b11156104c85760405162461bcd60e51b8152602060048201526014602482015273151a5b595cdd185b5c081a5cc81d1bdbc81bdb1960621b6044820152606401610467565b808463ffffffff161161052d5760405162461bcd60e51b815260206004820152602760248201527f54696d657374616d70206973206f6c646572207468616e20746865206c6173746044820152662075706461746560c81b6064820152608401610467565b610e106105408263ffffffff8716611212565b1161059b5760405162461bcd60e51b815260206004820152602560248201527f54696d657374616d702063616e6e6f74206265207570646174656420746f6f2060448201526437b33a32b760d91b6064820152608401610467565b600082131561061757600060646105b3600a85611229565b6105bd91906112ae565b90506105cd601782900b846112ea565b8660170b13156105ec576105e5601782900b846112ea565b9550610615565b6105fa601782900b8461132b565b8660170b121561061557610612601782900b8461132b565b95505b505b609a54600090610631906001600160501b0316600161136a565b609a805469ffffffffffffffffffff19166001600160501b03831690811790915560408051808201825260178a900b80825263ffffffff8a811660208085018281526000888152609983528790209551865491516001600160c01b039091166001600160e01b031990921691909117600160c01b91909416029290921790935592519182529394509192917f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f910160405180910390a360405163ffffffff8616815233906001600160501b038316907f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac602719060200160405180910390a3505050505050565b6001600160a01b03811633146107a55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610467565b6107af8282610cf9565b5050565b609a546000906001600160501b03166107de5760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b031660009081526099602052604090205460170b90565b609a546000906001600160501b031661082b5760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b031690565b60606098805461084a906113be565b80601f0160208091040260200160405190810160405280929190818152602001828054610876906113be565b80156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b5050505050905090565b609a546000906001600160501b03166108f85760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b0316600090815260996020526040902054600160c01b900463ffffffff1690565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b609a5460009081908190819081906001600160501b0390811690871611156109895760405162461bcd60e51b815260040161046790611395565b505050506001600160501b0382166000908152609960205260409020549192601783900b92600160c01b900463ffffffff16915081908490565b609a546000906001600160501b03168211156109f15760405162461bcd60e51b815260040161046790611395565b5060009081526099602052604090205460170b90565b609a546000906001600160501b0316821115610a355760405162461bcd60e51b815260040161046790611395565b50600090815260996020526040902054600160c01b900463ffffffff1690565b600082815260656020526040902060010154610a718133610c0f565b6103af8383610cf9565b600054610100900460ff16610a965760005460ff1615610a9a565b303b155b610afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610467565b600054610100900460ff16158015610b1f576000805461ffff19166101011790555b6097805460ff191660ff87161790558351610b41906098906020870190610f03565b50610b4d600084610c73565b610b777f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab83610c73565b8015610b89576000805461ff00191690555b5050505050565b609a5460009081908190819081906001600160501b0316610bc35760405162461bcd60e51b815260040161046790611395565b5050609a546001600160501b03166000818152609960205260409020549094601782900b9450600160c01b90910463ffffffff1692508291508490565b6001600160a01b03163b151590565b610c198282610924565b6107af57610c31816001600160a01b03166014610d60565b610c3c836020610d60565b604051602001610c4d9291906113f9565b60408051601f198184030181529082905262461bcd60e51b82526104679160040161109f565b610c7d8282610924565b6107af5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610cb53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610d038282610924565b156107af5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000610d6f83600261146e565b610d7a90600261148d565b67ffffffffffffffff811115610d9257610d926110fb565b6040519080825280601f01601f191660200182016040528015610dbc576020820181803683370190505b509050600360fc1b81600081518110610dd757610dd76114a5565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e0657610e066114a5565b60200101906001600160f81b031916908160001a9053506000610e2a84600261146e565b610e3590600161148d565b90505b6001811115610ead576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610e6957610e696114a5565b1a60f81b828281518110610e7f57610e7f6114a5565b60200101906001600160f81b031916908160001a90535060049490941c93610ea6816114bb565b9050610e38565b508315610efc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610467565b9392505050565b828054610f0f906113be565b90600052602060002090601f016020900481019282610f315760008555610f77565b82601f10610f4a57805160ff1916838001178555610f77565b82800160010185558215610f77579182015b82811115610f77578251825591602001919060010190610f5c565b50610f83929150610f87565b5090565b5b80821115610f835760008155600101610f88565b600060208284031215610fae57600080fd5b81356001600160e01b031981168114610efc57600080fd5b600060208284031215610fd857600080fd5b5035919050565b80356001600160a01b0381168114610ff657600080fd5b919050565b6000806040838503121561100e57600080fd5b8235915061101e60208401610fdf565b90509250929050565b6000806040838503121561103a57600080fd5b82358060170b811461104b57600080fd5b9150602083013563ffffffff8116811461106457600080fd5b809150509250929050565b60005b8381101561108a578181015183820152602001611072565b83811115611099576000848401525b50505050565b60208152600082518060208401526110be81604085016020870161106f565b601f01601f19169190910160400192915050565b6000602082840312156110e457600080fd5b81356001600160501b0381168114610efc57600080fd5b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561112757600080fd5b843560ff8116811461113857600080fd5b9350602085013567ffffffffffffffff8082111561115557600080fd5b818701915087601f83011261116957600080fd5b81358181111561117b5761117b6110fb565b604051601f8201601f19908116603f011681019083821181831017156111a3576111a36110fb565b816040528281528a60208487010111156111bc57600080fd5b8260208601602083013760006020848301015280975050505050506111e360408601610fdf565b91506111f160608601610fdf565b905092959194509250565b634e487b7160e01b600052601160045260246000fd5b600082821015611224576112246111fc565b500390565b60006001600160ff1b038184138284138082168684048611161561124f5761124f6111fc565b600160ff1b600087128281168783058912161561126e5761126e6111fc565b6000871292508782058712848416161561128a5761128a6111fc565b878505871281841616156112a0576112a06111fc565b505050929093029392505050565b6000826112cb57634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156112e5576112e56111fc565b500590565b600080821280156001600160ff1b038490038513161561130c5761130c6111fc565b600160ff1b8390038412811615611325576113256111fc565b50500190565b60008083128015600160ff1b850184121615611349576113496111fc565b6001600160ff1b0384018313811615611364576113646111fc565b50500390565b60006001600160501b0380831681851680830382111561138c5761138c6111fc565b01949350505050565b6020808252600f908201526e139bc819185d18481c1c995cd95b9d608a1b604082015260600190565b600181811c908216806113d257607f821691505b602082108114156113f357634e487b7160e01b600052602260045260246000fd5b50919050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161143181601785016020880161106f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161146281602884016020880161106f565b01602801949350505050565b6000816000190483118215151615611488576114886111fc565b500290565b600082198211156114a0576114a06111fc565b500190565b634e487b7160e01b600052603260045260246000fd5b6000816114ca576114ca6111fc565b50600019019056fea264697066735822122097ec7a5e085f219cbb2920290b7e3a8ba7b459b91549b1695d05deca48cf939164736f6c63430008090033","optimization_enabled":true,"verified_twin_address_hash":null,"is_verified":true,"compiler_settings":{"evmVersion":"london","libraries":{},"metadata":{"bytecodeHash":"ipfs"},"optimizer":{"enabled":true,"runs":200},"remappings":[]},"optimization_runs":200,"sourcify_repo_url":"https://repo.sourcify.dev/contracts/full_match/1/0xb239bd2216D1c8476f601e0d9b5FfAD556C59Cc4/","decoded_constructor_args":null,"compiler_version":"0.8.9+commit.e5eed63a","is_verified_via_verifier_alliance":false,"verified_at":"2024-06-12T09:59:23.431365Z","implementations":[],"proxy_type":null,"external_libraries":[],"creation_bytecode":"0x60806040523480156200001157600080fd5b506200005d60006040518060400160405280601c81526020017f4261636b6564204f7261636c6520496d706c656d656e746174696f6e000000008152506000806200006360201b60201c565b62000342565b600054610100900460ff16620000805760005460ff16156200008a565b6200008a6200018d565b620000f25760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b606482015260840160405180910390fd5b600054610100900460ff1615801562000115576000805461ffff19166101011790555b6097805460ff191660ff87161790558351620001399060989060208701906200025f565b5062000147600084620001ab565b620001737f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab83620001ab565b801562000186576000805461ff00191690555b5050505050565b6000620001a5306200025060201b62000c001760201c565b15905090565b60008281526065602090815260408083206001600160a01b038516845290915290205460ff166200024c5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff191660011790556200020b3390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45b5050565b6001600160a01b03163b151590565b8280546200026d9062000305565b90600052602060002090601f016020900481019282620002915760008555620002dc565b82601f10620002ac57805160ff1916838001178555620002dc565b82800160010185558215620002dc579182015b82811115620002dc578251825591602001919060010190620002bf565b50620002ea929150620002ee565b5090565b5b80821115620002ea5760008155600101620002ef565b600181811c908216806200031a57607f821691505b602082108114156200033c57634e487b7160e01b600052602260045260246000fd5b50919050565b61150880620003526000396000f3fe608060405234801561001057600080fd5b50600436106101585760003560e01c80638205bf6a116100c3578063b633620c1161007c578063b633620c14610300578063bd3be27c14610313578063d547741f1461031c578063f4a290671461032f578063feaf968c14610342578063ffa1ad741461034a57600080fd5b80638205bf6a1461027b5780638a991dd11461028357806391d148541461028b5780639a6fc8f51461029e578063a217fddf146102e5578063b5ab58dc146102ed57600080fd5b806347e633801161011557806347e633801461020a57806350d25bcd1461023157806354fd4d5014610239578063668a0f02146102405780637284e4161461024857806376670d7a1461025d57600080fd5b806301ffc9a71461015d578063248a9ca3146101855780632f2ff15d146101b6578063309676e9146101cb578063313ce567146101de57806336568abe146101f7575b600080fd5b61017061016b366004610f9c565b610352565b60405190151581526020015b60405180910390f35b6101a8610193366004610fc6565b60009081526065602052604090206001015490565b60405190815260200161017c565b6101c96101c4366004610ffb565b610389565b005b6101c96101d9366004611027565b6103b4565b60975460ff165b60405160ff909116815260200161017c565b6101c9610205366004610ffb565b610735565b6101a87f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab81565b6101a86107b3565b60016101a8565b6101a8610800565b61025061083b565b60405161017c919061109f565b61026661012c81565b60405163ffffffff909116815260200161017c565b6101a86108cd565b6101e5600a81565b610170610299366004610ffb565b610924565b6102b16102ac3660046110d2565b61094f565b604080516001600160501b03968716815260208101959095528401929092526060830152909116608082015260a00161017c565b6101a8600081565b6101a86102fb366004610fc6565b6109c3565b6101a861030e366004610fc6565b610a07565b610266610e1081565b6101c961032a366004610ffb565b610a55565b6101c961033d366004611111565b610a7b565b6102b1610b90565b6101e5600181565b60006001600160e01b03198216637965db0b60e01b148061038357506301ffc9a760e01b6001600160e01b03198316145b92915050565b6000828152606560205260409020600101546103a58133610c0f565b6103af8383610c73565b505050565b7f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab6103df8133610c0f565b609a546001600160501b0316600090815260996020526040902054601781900b9063ffffffff600160c01b90910481169042908516106104705760405162461bcd60e51b815260206004820152602160248201527f54696d657374616d702063616e6e6f7420626520696e207468652066757475726044820152606560f81b60648201526084015b60405180910390fd5b61012c61048363ffffffff861642611212565b11156104c85760405162461bcd60e51b8152602060048201526014602482015273151a5b595cdd185b5c081a5cc81d1bdbc81bdb1960621b6044820152606401610467565b808463ffffffff161161052d5760405162461bcd60e51b815260206004820152602760248201527f54696d657374616d70206973206f6c646572207468616e20746865206c6173746044820152662075706461746560c81b6064820152608401610467565b610e106105408263ffffffff8716611212565b1161059b5760405162461bcd60e51b815260206004820152602560248201527f54696d657374616d702063616e6e6f74206265207570646174656420746f6f2060448201526437b33a32b760d91b6064820152608401610467565b600082131561061757600060646105b3600a85611229565b6105bd91906112ae565b90506105cd601782900b846112ea565b8660170b13156105ec576105e5601782900b846112ea565b9550610615565b6105fa601782900b8461132b565b8660170b121561061557610612601782900b8461132b565b95505b505b609a54600090610631906001600160501b0316600161136a565b609a805469ffffffffffffffffffff19166001600160501b03831690811790915560408051808201825260178a900b80825263ffffffff8a811660208085018281526000888152609983528790209551865491516001600160c01b039091166001600160e01b031990921691909117600160c01b91909416029290921790935592519182529394509192917f0559884fd3a460db3073b7fc896cc77986f16e378210ded43186175bf646fc5f910160405180910390a360405163ffffffff8616815233906001600160501b038316907f0109fc6f55cf40689f02fbaad7af7fe7bbac8a3d2186600afc7d3e10cac602719060200160405180910390a3505050505050565b6001600160a01b03811633146107a55760405162461bcd60e51b815260206004820152602f60248201527f416363657373436f6e74726f6c3a2063616e206f6e6c792072656e6f756e636560448201526e103937b632b9903337b91039b2b63360891b6064820152608401610467565b6107af8282610cf9565b5050565b609a546000906001600160501b03166107de5760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b031660009081526099602052604090205460170b90565b609a546000906001600160501b031661082b5760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b031690565b60606098805461084a906113be565b80601f0160208091040260200160405190810160405280929190818152602001828054610876906113be565b80156108c35780601f10610898576101008083540402835291602001916108c3565b820191906000526020600020905b8154815290600101906020018083116108a657829003601f168201915b5050505050905090565b609a546000906001600160501b03166108f85760405162461bcd60e51b815260040161046790611395565b50609a546001600160501b0316600090815260996020526040902054600160c01b900463ffffffff1690565b60009182526065602090815260408084206001600160a01b0393909316845291905290205460ff1690565b609a5460009081908190819081906001600160501b0390811690871611156109895760405162461bcd60e51b815260040161046790611395565b505050506001600160501b0382166000908152609960205260409020549192601783900b92600160c01b900463ffffffff16915081908490565b609a546000906001600160501b03168211156109f15760405162461bcd60e51b815260040161046790611395565b5060009081526099602052604090205460170b90565b609a546000906001600160501b0316821115610a355760405162461bcd60e51b815260040161046790611395565b50600090815260996020526040902054600160c01b900463ffffffff1690565b600082815260656020526040902060010154610a718133610c0f565b6103af8383610cf9565b600054610100900460ff16610a965760005460ff1615610a9a565b303b155b610afd5760405162461bcd60e51b815260206004820152602e60248201527f496e697469616c697a61626c653a20636f6e747261637420697320616c72656160448201526d191e481a5b9a5d1a585b1a5e995960921b6064820152608401610467565b600054610100900460ff16158015610b1f576000805461ffff19166101011790555b6097805460ff191660ff87161790558351610b41906098906020870190610f03565b50610b4d600084610c73565b610b777f73e573f9566d61418a34d5de3ff49360f9c51fec37f7486551670290f6285dab83610c73565b8015610b89576000805461ff00191690555b5050505050565b609a5460009081908190819081906001600160501b0316610bc35760405162461bcd60e51b815260040161046790611395565b5050609a546001600160501b03166000818152609960205260409020549094601782900b9450600160c01b90910463ffffffff1692508291508490565b6001600160a01b03163b151590565b610c198282610924565b6107af57610c31816001600160a01b03166014610d60565b610c3c836020610d60565b604051602001610c4d9291906113f9565b60408051601f198184030181529082905262461bcd60e51b82526104679160040161109f565b610c7d8282610924565b6107af5760008281526065602090815260408083206001600160a01b03851684529091529020805460ff19166001179055610cb53390565b6001600160a01b0316816001600160a01b0316837f2f8788117e7eff1d82e926ec794901d17c78024a50270940304540a733656f0d60405160405180910390a45050565b610d038282610924565b156107af5760008281526065602090815260408083206001600160a01b0385168085529252808320805460ff1916905551339285917ff6391f5c32d9c69d2a47ea670b442974b53935d1edc7fd64eb21e047a839171b9190a45050565b60606000610d6f83600261146e565b610d7a90600261148d565b67ffffffffffffffff811115610d9257610d926110fb565b6040519080825280601f01601f191660200182016040528015610dbc576020820181803683370190505b509050600360fc1b81600081518110610dd757610dd76114a5565b60200101906001600160f81b031916908160001a905350600f60fb1b81600181518110610e0657610e066114a5565b60200101906001600160f81b031916908160001a9053506000610e2a84600261146e565b610e3590600161148d565b90505b6001811115610ead576f181899199a1a9b1b9c1cb0b131b232b360811b85600f1660108110610e6957610e696114a5565b1a60f81b828281518110610e7f57610e7f6114a5565b60200101906001600160f81b031916908160001a90535060049490941c93610ea6816114bb565b9050610e38565b508315610efc5760405162461bcd60e51b815260206004820181905260248201527f537472696e67733a20686578206c656e67746820696e73756666696369656e746044820152606401610467565b9392505050565b828054610f0f906113be565b90600052602060002090601f016020900481019282610f315760008555610f77565b82601f10610f4a57805160ff1916838001178555610f77565b82800160010185558215610f77579182015b82811115610f77578251825591602001919060010190610f5c565b50610f83929150610f87565b5090565b5b80821115610f835760008155600101610f88565b600060208284031215610fae57600080fd5b81356001600160e01b031981168114610efc57600080fd5b600060208284031215610fd857600080fd5b5035919050565b80356001600160a01b0381168114610ff657600080fd5b919050565b6000806040838503121561100e57600080fd5b8235915061101e60208401610fdf565b90509250929050565b6000806040838503121561103a57600080fd5b82358060170b811461104b57600080fd5b9150602083013563ffffffff8116811461106457600080fd5b809150509250929050565b60005b8381101561108a578181015183820152602001611072565b83811115611099576000848401525b50505050565b60208152600082518060208401526110be81604085016020870161106f565b601f01601f19169190910160400192915050565b6000602082840312156110e457600080fd5b81356001600160501b0381168114610efc57600080fd5b634e487b7160e01b600052604160045260246000fd5b6000806000806080858703121561112757600080fd5b843560ff8116811461113857600080fd5b9350602085013567ffffffffffffffff8082111561115557600080fd5b818701915087601f83011261116957600080fd5b81358181111561117b5761117b6110fb565b604051601f8201601f19908116603f011681019083821181831017156111a3576111a36110fb565b816040528281528a60208487010111156111bc57600080fd5b8260208601602083013760006020848301015280975050505050506111e360408601610fdf565b91506111f160608601610fdf565b905092959194509250565b634e487b7160e01b600052601160045260246000fd5b600082821015611224576112246111fc565b500390565b60006001600160ff1b038184138284138082168684048611161561124f5761124f6111fc565b600160ff1b600087128281168783058912161561126e5761126e6111fc565b6000871292508782058712848416161561128a5761128a6111fc565b878505871281841616156112a0576112a06111fc565b505050929093029392505050565b6000826112cb57634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156112e5576112e56111fc565b500590565b600080821280156001600160ff1b038490038513161561130c5761130c6111fc565b600160ff1b8390038412811615611325576113256111fc565b50500190565b60008083128015600160ff1b850184121615611349576113496111fc565b6001600160ff1b0384018313811615611364576113646111fc565b50500390565b60006001600160501b0380831681851680830382111561138c5761138c6111fc565b01949350505050565b6020808252600f908201526e139bc819185d18481c1c995cd95b9d608a1b604082015260600190565b600181811c908216806113d257607f821691505b602082108114156113f357634e487b7160e01b600052602260045260246000fd5b50919050565b7f416363657373436f6e74726f6c3a206163636f756e742000000000000000000081526000835161143181601785016020880161106f565b7001034b99036b4b9b9b4b733903937b6329607d1b601791840191820152835161146281602884016020880161106f565b01602801949350505050565b6000816000190483118215151615611488576114886111fc565b500290565b600082198211156114a0576114a06111fc565b500190565b634e487b7160e01b600052603260045260246000fd5b6000816114ca576114ca6111fc565b50600019019056fea264697066735822122097ec7a5e085f219cbb2920290b7e3a8ba7b459b91549b1695d05deca48cf939164736f6c63430008090033","name":"BackedOracle","is_blueprint":false,"license_type":"none","is_fully_verified":true,"is_verified_via_eth_bytecode_db":true,"language":"solidity","evm_version":"london","can_be_visualized_via_sol2uml":true,"is_verified_via_sourcify":true,"additional_sources":[{"file_path":"@openzeppelin/contracts-upgradeable/access/AccessControlUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (access/AccessControl.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IAccessControlUpgradeable.sol\";\nimport \"../utils/ContextUpgradeable.sol\";\nimport \"../utils/StringsUpgradeable.sol\";\nimport \"../utils/introspection/ERC165Upgradeable.sol\";\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Contract module that allows children to implement role-based access\n * control mechanisms. This is a lightweight version that doesn't allow enumerating role\n * members except through off-chain means by accessing the contract event logs. Some\n * applications may benefit from on-chain enumerability, for those cases see\n * {AccessControlEnumerable}.\n *\n * Roles are referred to by their `bytes32` identifier. These should be exposed\n * in the external API and be unique. The best way to achieve this is by\n * using `public constant` hash digests:\n *\n * ```\n * bytes32 public constant MY_ROLE = keccak256(\"MY_ROLE\");\n * ```\n *\n * Roles can be used to represent a set of permissions. To restrict access to a\n * function call, use {hasRole}:\n *\n * ```\n * function foo() public {\n *     require(hasRole(MY_ROLE, msg.sender));\n *     ...\n * }\n * ```\n *\n * Roles can be granted and revoked dynamically via the {grantRole} and\n * {revokeRole} functions. Each role has an associated admin role, and only\n * accounts that have a role's admin role can call {grantRole} and {revokeRole}.\n *\n * By default, the admin role for all roles is `DEFAULT_ADMIN_ROLE`, which means\n * that only accounts with this role will be able to grant or revoke other\n * roles. More complex role relationships can be created by using\n * {_setRoleAdmin}.\n *\n * WARNING: The `DEFAULT_ADMIN_ROLE` is also its own admin: it has permission to\n * grant and revoke this role. Extra precautions should be taken to secure\n * accounts that have been granted it.\n */\nabstract contract AccessControlUpgradeable is Initializable, ContextUpgradeable, IAccessControlUpgradeable, ERC165Upgradeable {\n    function __AccessControl_init() internal onlyInitializing {\n    }\n\n    function __AccessControl_init_unchained() internal onlyInitializing {\n    }\n    struct RoleData {\n        mapping(address => bool) members;\n        bytes32 adminRole;\n    }\n\n    mapping(bytes32 => RoleData) private _roles;\n\n    bytes32 public constant DEFAULT_ADMIN_ROLE = 0x00;\n\n    /**\n     * @dev Modifier that checks that an account has a specific role. Reverts\n     * with a standardized message including the required role.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     *\n     * _Available since v4.1._\n     */\n    modifier onlyRole(bytes32 role) {\n        _checkRole(role, _msgSender());\n        _;\n    }\n\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IAccessControlUpgradeable).interfaceId || super.supportsInterface(interfaceId);\n    }\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) public view virtual override returns (bool) {\n        return _roles[role].members[account];\n    }\n\n    /**\n     * @dev Revert with a standard message if `account` is missing `role`.\n     *\n     * The format of the revert reason is given by the following regular expression:\n     *\n     *  /^AccessControl: account (0x[0-9a-f]{40}) is missing role (0x[0-9a-f]{64})$/\n     */\n    function _checkRole(bytes32 role, address account) internal view virtual {\n        if (!hasRole(role, account)) {\n            revert(\n                string(\n                    abi.encodePacked(\n                        \"AccessControl: account \",\n                        StringsUpgradeable.toHexString(uint160(account), 20),\n                        \" is missing role \",\n                        StringsUpgradeable.toHexString(uint256(role), 32)\n                    )\n                )\n            );\n        }\n    }\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) public view virtual override returns (bytes32) {\n        return _roles[role].adminRole;\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) public virtual override onlyRole(getRoleAdmin(role)) {\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been revoked `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) public virtual override {\n        require(account == _msgSender(), \"AccessControl: can only renounce roles for self\");\n\n        _revokeRole(role, account);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event. Note that unlike {grantRole}, this function doesn't perform any\n     * checks on the calling account.\n     *\n     * [WARNING]\n     * ====\n     * This function should only be called from the constructor when setting\n     * up the initial roles for the system.\n     *\n     * Using this function in any other way is effectively circumventing the admin\n     * system imposed by {AccessControl}.\n     * ====\n     *\n     * NOTE: This function is deprecated in favor of {_grantRole}.\n     */\n    function _setupRole(bytes32 role, address account) internal virtual {\n        _grantRole(role, account);\n    }\n\n    /**\n     * @dev Sets `adminRole` as ``role``'s admin role.\n     *\n     * Emits a {RoleAdminChanged} event.\n     */\n    function _setRoleAdmin(bytes32 role, bytes32 adminRole) internal virtual {\n        bytes32 previousAdminRole = getRoleAdmin(role);\n        _roles[role].adminRole = adminRole;\n        emit RoleAdminChanged(role, previousAdminRole, adminRole);\n    }\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * Internal function without access restriction.\n     */\n    function _grantRole(bytes32 role, address account) internal virtual {\n        if (!hasRole(role, account)) {\n            _roles[role].members[account] = true;\n            emit RoleGranted(role, account, _msgSender());\n        }\n    }\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * Internal function without access restriction.\n     */\n    function _revokeRole(bytes32 role, address account) internal virtual {\n        if (hasRole(role, account)) {\n            _roles[role].members[account] = false;\n            emit RoleRevoked(role, account, _msgSender());\n        }\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[49] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/access/IAccessControlUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (access/IAccessControl.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev External interface of AccessControl declared to support ERC165 detection.\n */\ninterface IAccessControlUpgradeable {\n    /**\n     * @dev Emitted when `newAdminRole` is set as ``role``'s admin role, replacing `previousAdminRole`\n     *\n     * `DEFAULT_ADMIN_ROLE` is the starting admin for all roles, despite\n     * {RoleAdminChanged} not being emitted signaling this.\n     *\n     * _Available since v3.1._\n     */\n    event RoleAdminChanged(bytes32 indexed role, bytes32 indexed previousAdminRole, bytes32 indexed newAdminRole);\n\n    /**\n     * @dev Emitted when `account` is granted `role`.\n     *\n     * `sender` is the account that originated the contract call, an admin role\n     * bearer except when using {AccessControl-_setupRole}.\n     */\n    event RoleGranted(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Emitted when `account` is revoked `role`.\n     *\n     * `sender` is the account that originated the contract call:\n     *   - if using `revokeRole`, it is the admin role bearer\n     *   - if using `renounceRole`, it is the role bearer (i.e. `account`)\n     */\n    event RoleRevoked(bytes32 indexed role, address indexed account, address indexed sender);\n\n    /**\n     * @dev Returns `true` if `account` has been granted `role`.\n     */\n    function hasRole(bytes32 role, address account) external view returns (bool);\n\n    /**\n     * @dev Returns the admin role that controls `role`. See {grantRole} and\n     * {revokeRole}.\n     *\n     * To change a role's admin, use {AccessControl-_setRoleAdmin}.\n     */\n    function getRoleAdmin(bytes32 role) external view returns (bytes32);\n\n    /**\n     * @dev Grants `role` to `account`.\n     *\n     * If `account` had not been already granted `role`, emits a {RoleGranted}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function grantRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from `account`.\n     *\n     * If `account` had been granted `role`, emits a {RoleRevoked} event.\n     *\n     * Requirements:\n     *\n     * - the caller must have ``role``'s admin role.\n     */\n    function revokeRole(bytes32 role, address account) external;\n\n    /**\n     * @dev Revokes `role` from the calling account.\n     *\n     * Roles are often managed via {grantRole} and {revokeRole}: this function's\n     * purpose is to provide a mechanism for accounts to lose their privileges\n     * if they are compromised (such as when a trusted device is misplaced).\n     *\n     * If the calling account had been granted `role`, emits a {RoleRevoked}\n     * event.\n     *\n     * Requirements:\n     *\n     * - the caller must be `account`.\n     */\n    function renounceRole(bytes32 role, address account) external;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (proxy/utils/Initializable.sol)\n\npragma solidity ^0.8.0;\n\nimport \"../../utils/AddressUpgradeable.sol\";\n\n/**\n * @dev This is a base contract to aid in writing upgradeable contracts, or any kind of contract that will be deployed\n * behind a proxy. Since proxied contracts do not make use of a constructor, it's common to move constructor logic to an\n * external initializer function, usually called `initialize`. It then becomes necessary to protect this initializer\n * function so it can only be called once. The {initializer} modifier provided by this contract will have this effect.\n *\n * TIP: To avoid leaving the proxy in an uninitialized state, the initializer function should be called as early as\n * possible by providing the encoded function call as the `_data` argument to {ERC1967Proxy-constructor}.\n *\n * CAUTION: When used with inheritance, manual care must be taken to not invoke a parent initializer twice, or to ensure\n * that all initializers are idempotent. This is not verified automatically as constructors are by Solidity.\n *\n * [CAUTION]\n * ====\n * Avoid leaving a contract uninitialized.\n *\n * An uninitialized contract can be taken over by an attacker. This applies to both a proxy and its implementation\n * contract, which may impact the proxy. To initialize the implementation contract, you can either invoke the\n * initializer manually, or you can include a constructor to automatically mark it as initialized when it is deployed:\n *\n * [.hljs-theme-light.nopadding]\n * ```\n * /// @custom:oz-upgrades-unsafe-allow constructor\n * constructor() initializer {}\n * ```\n * ====\n */\nabstract contract Initializable {\n    /**\n     * @dev Indicates that the contract has been initialized.\n     */\n    bool private _initialized;\n\n    /**\n     * @dev Indicates that the contract is in the process of being initialized.\n     */\n    bool private _initializing;\n\n    /**\n     * @dev Modifier to protect an initializer function from being invoked twice.\n     */\n    modifier initializer() {\n        // If the contract is initializing we ignore whether _initialized is set in order to support multiple\n        // inheritance patterns, but we only do this in the context of a constructor, because in other contexts the\n        // contract may have been reentered.\n        require(_initializing ? _isConstructor() : !_initialized, \"Initializable: contract is already initialized\");\n\n        bool isTopLevelCall = !_initializing;\n        if (isTopLevelCall) {\n            _initializing = true;\n            _initialized = true;\n        }\n\n        _;\n\n        if (isTopLevelCall) {\n            _initializing = false;\n        }\n    }\n\n    /**\n     * @dev Modifier to protect an initialization function so that it can only be invoked by functions with the\n     * {initializer} modifier, directly or indirectly.\n     */\n    modifier onlyInitializing() {\n        require(_initializing, \"Initializable: contract is not initializing\");\n        _;\n    }\n\n    function _isConstructor() private view returns (bool) {\n        return !AddressUpgradeable.isContract(address(this));\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/AddressUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts (last updated v4.5.0) (utils/Address.sol)\n\npragma solidity ^0.8.1;\n\n/**\n * @dev Collection of functions related to the address type\n */\nlibrary AddressUpgradeable {\n    /**\n     * @dev Returns true if `account` is a contract.\n     *\n     * [IMPORTANT]\n     * ====\n     * It is unsafe to assume that an address for which this function returns\n     * false is an externally-owned account (EOA) and not a contract.\n     *\n     * Among others, `isContract` will return false for the following\n     * types of addresses:\n     *\n     *  - an externally-owned account\n     *  - a contract in construction\n     *  - an address where a contract will be created\n     *  - an address where a contract lived, but was destroyed\n     * ====\n     *\n     * [IMPORTANT]\n     * ====\n     * You shouldn't rely on `isContract` to protect against flash loan attacks!\n     *\n     * Preventing calls from contracts is highly discouraged. It breaks composability, breaks support for smart wallets\n     * like Gnosis Safe, and does not provide security since it can be circumvented by calling from a contract\n     * constructor.\n     * ====\n     */\n    function isContract(address account) internal view returns (bool) {\n        // This method relies on extcodesize/address.code.length, which returns 0\n        // for contracts in construction, since the code is only stored at the end\n        // of the constructor execution.\n\n        return account.code.length > 0;\n    }\n\n    /**\n     * @dev Replacement for Solidity's `transfer`: sends `amount` wei to\n     * `recipient`, forwarding all available gas and reverting on errors.\n     *\n     * https://eips.ethereum.org/EIPS/eip-1884[EIP1884] increases the gas cost\n     * of certain opcodes, possibly making contracts go over the 2300 gas limit\n     * imposed by `transfer`, making them unable to receive funds via\n     * `transfer`. {sendValue} removes this limitation.\n     *\n     * https://diligence.consensys.net/posts/2019/09/stop-using-soliditys-transfer-now/[Learn more].\n     *\n     * IMPORTANT: because control is transferred to `recipient`, care must be\n     * taken to not create reentrancy vulnerabilities. Consider using\n     * {ReentrancyGuard} or the\n     * https://solidity.readthedocs.io/en/v0.5.11/security-considerations.html#use-the-checks-effects-interactions-pattern[checks-effects-interactions pattern].\n     */\n    function sendValue(address payable recipient, uint256 amount) internal {\n        require(address(this).balance >= amount, \"Address: insufficient balance\");\n\n        (bool success, ) = recipient.call{value: amount}(\"\");\n        require(success, \"Address: unable to send value, recipient may have reverted\");\n    }\n\n    /**\n     * @dev Performs a Solidity function call using a low level `call`. A\n     * plain `call` is an unsafe replacement for a function call: use this\n     * function instead.\n     *\n     * If `target` reverts with a revert reason, it is bubbled up by this\n     * function (like regular Solidity function calls).\n     *\n     * Returns the raw returned data. To convert to the expected return value,\n     * use https://solidity.readthedocs.io/en/latest/units-and-global-variables.html?highlight=abi.decode#abi-encoding-and-decoding-functions[`abi.decode`].\n     *\n     * Requirements:\n     *\n     * - `target` must be a contract.\n     * - calling `target` with `data` must not revert.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(address target, bytes memory data) internal returns (bytes memory) {\n        return functionCall(target, data, \"Address: low-level call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`], but with\n     * `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, 0, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but also transferring `value` wei to `target`.\n     *\n     * Requirements:\n     *\n     * - the calling contract must have an ETH balance of at least `value`.\n     * - the called Solidity function must be `payable`.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value\n    ) internal returns (bytes memory) {\n        return functionCallWithValue(target, data, value, \"Address: low-level call with value failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCallWithValue-address-bytes-uint256-}[`functionCallWithValue`], but\n     * with `errorMessage` as a fallback revert reason when `target` reverts.\n     *\n     * _Available since v3.1._\n     */\n    function functionCallWithValue(\n        address target,\n        bytes memory data,\n        uint256 value,\n        string memory errorMessage\n    ) internal returns (bytes memory) {\n        require(address(this).balance >= value, \"Address: insufficient balance for call\");\n        require(isContract(target), \"Address: call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.call{value: value}(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(address target, bytes memory data) internal view returns (bytes memory) {\n        return functionStaticCall(target, data, \"Address: low-level static call failed\");\n    }\n\n    /**\n     * @dev Same as {xref-Address-functionCall-address-bytes-string-}[`functionCall`],\n     * but performing a static call.\n     *\n     * _Available since v3.3._\n     */\n    function functionStaticCall(\n        address target,\n        bytes memory data,\n        string memory errorMessage\n    ) internal view returns (bytes memory) {\n        require(isContract(target), \"Address: static call to non-contract\");\n\n        (bool success, bytes memory returndata) = target.staticcall(data);\n        return verifyCallResult(success, returndata, errorMessage);\n    }\n\n    /**\n     * @dev Tool to verifies that a low level call was successful, and revert if it wasn't, either by bubbling the\n     * revert reason using the provided one.\n     *\n     * _Available since v4.3._\n     */\n    function verifyCallResult(\n        bool success,\n        bytes memory returndata,\n        string memory errorMessage\n    ) internal pure returns (bytes memory) {\n        if (success) {\n            return returndata;\n        } else {\n            // Look for revert reason and bubble it up if present\n            if (returndata.length > 0) {\n                // The easiest way to bubble the revert reason is using memory via assembly\n\n                assembly {\n                    let returndata_size := mload(returndata)\n                    revert(add(32, returndata), returndata_size)\n                }\n            } else {\n                revert(errorMessage);\n            }\n        }\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/ContextUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Context.sol)\n\npragma solidity ^0.8.0;\nimport \"../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Provides information about the current execution context, including the\n * sender of the transaction and its data. While these are generally available\n * via msg.sender and msg.data, they should not be accessed in such a direct\n * manner, since when dealing with meta-transactions the account sending and\n * paying for execution may not be the actual sender (as far as an application\n * is concerned).\n *\n * This contract is only required for intermediate, library-like contracts.\n */\nabstract contract ContextUpgradeable is Initializable {\n    function __Context_init() internal onlyInitializing {\n    }\n\n    function __Context_init_unchained() internal onlyInitializing {\n    }\n    function _msgSender() internal view virtual returns (address) {\n        return msg.sender;\n    }\n\n    function _msgData() internal view virtual returns (bytes calldata) {\n        return msg.data;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/StringsUpgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/Strings.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev String operations.\n */\nlibrary StringsUpgradeable {\n    bytes16 private constant _HEX_SYMBOLS = \"0123456789abcdef\";\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` decimal representation.\n     */\n    function toString(uint256 value) internal pure returns (string memory) {\n        // Inspired by OraclizeAPI's implementation - MIT licence\n        // https://github.com/oraclize/ethereum-api/blob/b42146b063c7d6ee1358846c198246239e9360e8/oraclizeAPI_0.4.25.sol\n\n        if (value == 0) {\n            return \"0\";\n        }\n        uint256 temp = value;\n        uint256 digits;\n        while (temp != 0) {\n            digits++;\n            temp /= 10;\n        }\n        bytes memory buffer = new bytes(digits);\n        while (value != 0) {\n            digits -= 1;\n            buffer[digits] = bytes1(uint8(48 + uint256(value % 10)));\n            value /= 10;\n        }\n        return string(buffer);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation.\n     */\n    function toHexString(uint256 value) internal pure returns (string memory) {\n        if (value == 0) {\n            return \"0x00\";\n        }\n        uint256 temp = value;\n        uint256 length = 0;\n        while (temp != 0) {\n            length++;\n            temp >>= 8;\n        }\n        return toHexString(value, length);\n    }\n\n    /**\n     * @dev Converts a `uint256` to its ASCII `string` hexadecimal representation with fixed length.\n     */\n    function toHexString(uint256 value, uint256 length) internal pure returns (string memory) {\n        bytes memory buffer = new bytes(2 * length + 2);\n        buffer[0] = \"0\";\n        buffer[1] = \"x\";\n        for (uint256 i = 2 * length + 1; i > 1; --i) {\n            buffer[i] = _HEX_SYMBOLS[value & 0xf];\n            value >>= 4;\n        }\n        require(value == 0, \"Strings: hex length insufficient\");\n        return string(buffer);\n    }\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/introspection/ERC165Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/ERC165.sol)\n\npragma solidity ^0.8.0;\n\nimport \"./IERC165Upgradeable.sol\";\nimport \"../../proxy/utils/Initializable.sol\";\n\n/**\n * @dev Implementation of the {IERC165} interface.\n *\n * Contracts that want to implement ERC165 should inherit from this contract and override {supportsInterface} to check\n * for the additional interface id that will be supported. For example:\n *\n * ```solidity\n * function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n *     return interfaceId == type(MyInterface).interfaceId || super.supportsInterface(interfaceId);\n * }\n * ```\n *\n * Alternatively, {ERC165Storage} provides an easier to use but more expensive implementation.\n */\nabstract contract ERC165Upgradeable is Initializable, IERC165Upgradeable {\n    function __ERC165_init() internal onlyInitializing {\n    }\n\n    function __ERC165_init_unchained() internal onlyInitializing {\n    }\n    /**\n     * @dev See {IERC165-supportsInterface}.\n     */\n    function supportsInterface(bytes4 interfaceId) public view virtual override returns (bool) {\n        return interfaceId == type(IERC165Upgradeable).interfaceId;\n    }\n\n    /**\n     * @dev This empty reserved space is put in place to allow future versions to add new\n     * variables without shifting down storage in the inheritance chain.\n     * See https://docs.openzeppelin.com/contracts/4.x/upgradeable#storage_gaps\n     */\n    uint256[50] private __gap;\n}\n"},{"file_path":"@openzeppelin/contracts-upgradeable/utils/introspection/IERC165Upgradeable.sol","source_code":"// SPDX-License-Identifier: MIT\n// OpenZeppelin Contracts v4.4.1 (utils/introspection/IERC165.sol)\n\npragma solidity ^0.8.0;\n\n/**\n * @dev Interface of the ERC165 standard, as defined in the\n * https://eips.ethereum.org/EIPS/eip-165[EIP].\n *\n * Implementers can declare support of contract interfaces, which can then be\n * queried by others ({ERC165Checker}).\n *\n * For an implementation, see {ERC165}.\n */\ninterface IERC165Upgradeable {\n    /**\n     * @dev Returns true if this contract implements the interface defined by\n     * `interfaceId`. See the corresponding\n     * https://eips.ethereum.org/EIPS/eip-165#how-interfaces-are-identified[EIP section]\n     * to learn more about how these ids are created.\n     *\n     * This function call must use less than 30 000 gas.\n     */\n    function supportsInterface(bytes4 interfaceId) external view returns (bool);\n}\n"},{"file_path":"contracts/oracle/BackedOracleInterface.sol","source_code":"/**\n * SPDX-License-Identifier: MIT\n *\n * Copyright (c) 2021-2023 Backed Finance AG\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\npragma solidity 0.8.9;\n\n\ninterface AggregatorInterface {\n  function latestAnswer() external view returns (int256);\n\n  function latestTimestamp() external view returns (uint256);\n\n  function latestRound() external view returns (uint256);\n\n  function getAnswer(uint256 roundId) external view returns (int256);\n\n  function getTimestamp(uint256 roundId) external view returns (uint256);\n\n  event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 updatedAt);\n  event NewRound(uint256 indexed roundId, address indexed startedBy, uint256 startedAt);\n}\n\n\ninterface AggregatorV3Interface {\n  function version() external view returns (uint256);\n  function decimals() external view returns (uint8);\n  function description() external view returns (string memory);\n\n  // getRoundData and latestRoundData should both raise \"No data present\"\n  // if they do not have data to report, instead of returning unset values\n  // which could be misinterpreted as actual reported values.\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}\n\ninterface AggregatorV2V3Interface is AggregatorInterface, AggregatorV3Interface\n{\n}"}],"certified":false,"conflicting_implementations":null,"abi":[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"int256","name":"current","type":"int256"},{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":false,"internalType":"uint256","name":"updatedAt","type":"uint256"}],"name":"AnswerUpdated","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"uint256","name":"roundId","type":"uint256"},{"indexed":true,"internalType":"address","name":"startedBy","type":"address"},{"indexed":false,"internalType":"uint256","name":"startedAt","type":"uint256"}],"name":"NewRound","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"previousAdminRole","type":"bytes32"},{"indexed":true,"internalType":"bytes32","name":"newAdminRole","type":"bytes32"}],"name":"RoleAdminChanged","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleGranted","type":"event"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"bytes32","name":"role","type":"bytes32"},{"indexed":true,"internalType":"address","name":"account","type":"address"},{"indexed":true,"internalType":"address","name":"sender","type":"address"}],"name":"RoleRevoked","type":"event"},{"inputs":[],"name":"DEFAULT_ADMIN_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_PERCENT_DIFFERENCE","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_TIMESTAMP_AGE","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MIN_UPDATE_INTERVAL","outputs":[{"internalType":"uint32","name":"","type":"uint32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"UPDATER_ROLE","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"VERSION","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"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":"uint256","name":"roundId","type":"uint256"}],"name":"getAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"}],"name":"getRoleAdmin","outputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint80","name":"roundId","type":"uint80"}],"name":"getRoundData","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"roundId","type":"uint256"}],"name":"getTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"grantRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"hasRole","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint8","name":"__decimals","type":"uint8"},{"internalType":"string","name":"__description","type":"string"},{"internalType":"address","name":"__admin","type":"address"},{"internalType":"address","name":"__updater","type":"address"}],"name":"initialize","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRound","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestRoundData","outputs":[{"internalType":"uint80","name":"","type":"uint80"},{"internalType":"int256","name":"","type":"int256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint256","name":"","type":"uint256"},{"internalType":"uint80","name":"","type":"uint80"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"latestTimestamp","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"renounceRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"role","type":"bytes32"},{"internalType":"address","name":"account","type":"address"}],"name":"revokeRole","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes4","name":"interfaceId","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"int192","name":"newAnswer","type":"int192"},{"internalType":"uint32","name":"newTimestamp","type":"uint32"}],"name":"updateAnswer","outputs":[],"stateMutability":"nonpayable","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":null}