-
Notifications
You must be signed in to change notification settings - Fork 42
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Co-authored-by: 0xCalibur <92554750+0xCalibur@users.noreply.github.com>
- Loading branch information
Showing
17 changed files
with
835 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,199 @@ | ||
{ | ||
"address": "0x46d9F53B68Cb930993E1C9E490d1847046E057dE", | ||
"abi": [ | ||
{ | ||
"type": "constructor", | ||
"inputs": [ | ||
{ | ||
"name": "_pyth", | ||
"type": "address", | ||
"internalType": "contract IPyth" | ||
}, | ||
{ | ||
"name": "_feedId", | ||
"type": "bytes32", | ||
"internalType": "bytes32" | ||
}, | ||
{ | ||
"name": "_maxAge", | ||
"type": "uint256", | ||
"internalType": "uint256" | ||
} | ||
], | ||
"stateMutability": "nonpayable" | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "decimals", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "uint8", | ||
"internalType": "uint8" | ||
} | ||
], | ||
"stateMutability": "view" | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "feedId", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "bytes32", | ||
"internalType": "bytes32" | ||
} | ||
], | ||
"stateMutability": "view" | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "latestAnswer", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "_price", | ||
"type": "int256", | ||
"internalType": "int256" | ||
} | ||
], | ||
"stateMutability": "view" | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "latestRoundData", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "uint80", | ||
"internalType": "uint80" | ||
}, | ||
{ | ||
"name": "answer", | ||
"type": "int256", | ||
"internalType": "int256" | ||
}, | ||
{ | ||
"name": "", | ||
"type": "uint256", | ||
"internalType": "uint256" | ||
}, | ||
{ | ||
"name": "updatedAt", | ||
"type": "uint256", | ||
"internalType": "uint256" | ||
}, | ||
{ | ||
"name": "", | ||
"type": "uint80", | ||
"internalType": "uint80" | ||
} | ||
], | ||
"stateMutability": "view" | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "maxAge", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "uint256", | ||
"internalType": "uint256" | ||
} | ||
], | ||
"stateMutability": "view" | ||
}, | ||
{ | ||
"type": "function", | ||
"name": "pyth", | ||
"inputs": [], | ||
"outputs": [ | ||
{ | ||
"name": "", | ||
"type": "address", | ||
"internalType": "contract IPyth" | ||
} | ||
], | ||
"stateMutability": "view" | ||
}, | ||
{ | ||
"type": "error", | ||
"name": "InvalidDecimals", | ||
"inputs": [] | ||
}, | ||
{ | ||
"type": "error", | ||
"name": "NegativePriceFeed", | ||
"inputs": [] | ||
} | ||
], | ||
"bytecode": "0x610100604052348015610010575f80fd5b5060405161068d38038061068d83398101604081905261002f916100ef565b6001600160a01b038316608081905260a083905260c08290526040516396834ad360e01b8152600481018490525f91906396834ad390602401608060405180830381865afa158015610083573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100a7919061015a565b90505f816040015160030b13156100d157604051630692acc560e51b815260040160405180910390fd5b80604001516100df906101e5565b60ff1660e0525061021292505050565b5f805f60608486031215610101575f80fd5b83516001600160a01b0381168114610117575f80fd5b602085015160409095015190969495509392505050565b80516001600160401b0381168114610144575f80fd5b919050565b8051600381900b8114610144575f80fd5b5f608082840312801561016b575f80fd5b50604051608081016001600160401b038111828210171561019a57634e487b7160e01b5f52604160045260245ffd5b6040528251600781900b81146101ae575f80fd5b81526101bc6020840161012e565b60208201526101cd60408401610149565b60408201526060928301519281019290925250919050565b5f8160030b637fffffff19810361020a57634e487b7160e01b5f52601160045260245ffd5b5f0392915050565b60805160a05160c05160e05161042f61025e5f395f8181607a015261029601525f818160eb01526101c001525f818160ae015261019a01525f818161011201526101f2015261042f5ff3fe608060405234801561000f575f80fd5b506004361061006f575f3560e01c8063687043c51161004d578063687043c5146100e6578063f98d06f01461010d578063feaf968c1461014c575f80fd5b8063313ce567146100735780634a643499146100a957806350d25bcd146100de575b5f80fd5b60405160ff7f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b6100d07f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100a0565b6100d061018b565b6100d07f000000000000000000000000000000000000000000000000000000000000000081565b6101347f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a0565b6101546102f3565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100a0565b60405163052571af60e51b81527f000000000000000000000000000000000000000000000000000000000000000060048201527f000000000000000000000000000000000000000000000000000000000000000060248201525f9081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a4ae35e090604401608060405180830381865afa158015610237573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061025b9190610340565b90505f815f015160070b1215610284576040516365a6a9cd60e11b815260040160405180910390fd5b5f816040015160030b13806102cc57507f000000000000000000000000000000000000000000000000000000000000000060ff1681604001516102c6906103cc565b60ff1614155b156102ea57604051630692acc560e51b815260040160405180910390fd5b5160070b919050565b5f805f805f8061030161018b565b90969095505f94508493508392509050565b805167ffffffffffffffff8116811461032a575f80fd5b919050565b8051600381900b811461032a575f80fd5b5f6080828403128015610351575f80fd5b506040516080810167ffffffffffffffff8111828210171561038157634e487b7160e01b5f52604160045260245ffd5b6040528251600781900b8114610395575f80fd5b81526103a360208401610313565b60208201526103b46040840161032f565b60408201526060928301519281019290925250919050565b5f8160030b637fffffff1981036103f157634e487b7160e01b5f52601160045260245ffd5b5f039291505056fea2646970667358221220e0ebc4235c379ff3a4ff14e82920c56c9d3edeb493cb6b4fd751a64c10be65c764736f6c634300081a0033", | ||
"args_data": "0x000000000000000000000000ff1a0f4744e8582df1ae09d5611b887b6a12925cbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61000000000000000000000000000000000000000000000000000000000000002d", | ||
"tx_hash": "0x632ef6139b79ab334b818fedc021252d2af26961e181a0e9efd70168bb9bf425", | ||
"args": [ | ||
"0xff1a0f4744e8582DF1aE09D5611b887B6a12925C", | ||
"0xbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61", | ||
"45" | ||
], | ||
"data": "0x610100604052348015610010575f80fd5b5060405161068d38038061068d83398101604081905261002f916100ef565b6001600160a01b038316608081905260a083905260c08290526040516396834ad360e01b8152600481018490525f91906396834ad390602401608060405180830381865afa158015610083573d5f803e3d5ffd5b505050506040513d601f19601f820116820180604052508101906100a7919061015a565b90505f816040015160030b13156100d157604051630692acc560e51b815260040160405180910390fd5b80604001516100df906101e5565b60ff1660e0525061021292505050565b5f805f60608486031215610101575f80fd5b83516001600160a01b0381168114610117575f80fd5b602085015160409095015190969495509392505050565b80516001600160401b0381168114610144575f80fd5b919050565b8051600381900b8114610144575f80fd5b5f608082840312801561016b575f80fd5b50604051608081016001600160401b038111828210171561019a57634e487b7160e01b5f52604160045260245ffd5b6040528251600781900b81146101ae575f80fd5b81526101bc6020840161012e565b60208201526101cd60408401610149565b60408201526060928301519281019290925250919050565b5f8160030b637fffffff19810361020a57634e487b7160e01b5f52601160045260245ffd5b5f0392915050565b60805160a05160c05160e05161042f61025e5f395f8181607a015261029601525f818160eb01526101c001525f818160ae015261019a01525f818161011201526101f2015261042f5ff3fe608060405234801561000f575f80fd5b506004361061006f575f3560e01c8063687043c51161004d578063687043c5146100e6578063f98d06f01461010d578063feaf968c1461014c575f80fd5b8063313ce567146100735780634a643499146100a957806350d25bcd146100de575b5f80fd5b60405160ff7f00000000000000000000000000000000000000000000000000000000000000001681526020015b60405180910390f35b6100d07f000000000000000000000000000000000000000000000000000000000000000081565b6040519081526020016100a0565b6100d061018b565b6100d07f000000000000000000000000000000000000000000000000000000000000000081565b6101347f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a0565b6101546102f3565b6040805169ffffffffffffffffffff968716815260208101959095528401929092526060830152909116608082015260a0016100a0565b60405163052571af60e51b81527f000000000000000000000000000000000000000000000000000000000000000060048201527f000000000000000000000000000000000000000000000000000000000000000060248201525f9081906001600160a01b037f0000000000000000000000000000000000000000000000000000000000000000169063a4ae35e090604401608060405180830381865afa158015610237573d5f803e3d5ffd5b505050506040513d601f19601f8201168201806040525081019061025b9190610340565b90505f815f015160070b1215610284576040516365a6a9cd60e11b815260040160405180910390fd5b5f816040015160030b13806102cc57507f000000000000000000000000000000000000000000000000000000000000000060ff1681604001516102c6906103cc565b60ff1614155b156102ea57604051630692acc560e51b815260040160405180910390fd5b5160070b919050565b5f805f805f8061030161018b565b90969095505f94508493508392509050565b805167ffffffffffffffff8116811461032a575f80fd5b919050565b8051600381900b811461032a575f80fd5b5f6080828403128015610351575f80fd5b506040516080810167ffffffffffffffff8111828210171561038157634e487b7160e01b5f52604160045260245ffd5b6040528251600781900b8114610395575f80fd5b81526103a360208401610313565b60208201526103b46040840161032f565b60408201526060928301519281019290925250919050565b5f8160030b637fffffff1981036103f157634e487b7160e01b5f52601160045260245ffd5b5f039291505056fea2646970667358221220e0ebc4235c379ff3a4ff14e82920c56c9d3edeb493cb6b4fd751a64c10be65c764736f6c634300081a0033000000000000000000000000ff1a0f4744e8582df1ae09d5611b887b6a12925cbed3097008b9b5e3c93bec20be79cb43986b85a996475589351a21e67bae9b61000000000000000000000000000000000000000000000000000000000000002d", | ||
"artifact_path": "PythAggregator.sol", | ||
"artifact_full_path": "PythAggregator.sol:PythAggregator", | ||
"standardJsonInput": { | ||
"language": "Solidity", | ||
"sources": { | ||
"src/oracles/aggregators/PythAggregator.sol": { | ||
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\nimport {IAggregator} from \"/interfaces/IAggregator.sol\";\nimport {IPyth} from \"/interfaces/IPyth.sol\";\n\ncontract PythAggregator is IAggregator {\n error InvalidDecimals();\n error NegativePriceFeed();\n\n IPyth public immutable pyth;\n bytes32 public immutable feedId;\n uint256 public immutable maxAge;\n\n uint8 private immutable _decimals;\n\n constructor(IPyth _pyth, bytes32 _feedId, uint256 _maxAge) {\n pyth = _pyth;\n feedId = _feedId;\n maxAge = _maxAge;\n\n IPyth.PriceInfo memory priceInfo = _pyth.getPriceUnsafe(_feedId);\n\n if (priceInfo.expo > 0) {\n revert InvalidDecimals();\n }\n\n _decimals = uint8(uint32(-priceInfo.expo));\n }\n\n function decimals() external view override returns (uint8) {\n return _decimals;\n }\n\n function latestAnswer() public view returns (int256 _price) {\n IPyth.PriceInfo memory priceInfo = pyth.getPriceNoOlderThan(feedId, maxAge);\n\n if (priceInfo.price < 0) {\n revert NegativePriceFeed();\n }\n\n if (priceInfo.expo > 0 || uint8(uint32(-priceInfo.expo)) != _decimals) {\n revert InvalidDecimals();\n }\n\n return priceInfo.price;\n }\n\n function latestRoundData() public view returns (uint80, int256 answer, uint256, uint256 updatedAt, uint80) {\n return (0, latestAnswer(), 0, 0, 0);\n }\n}\n" | ||
}, | ||
"src/interfaces/IAggregator.sol": { | ||
"content": "// SPDX-License-Identifier: MIT\npragma solidity >=0.8.0;\n\ninterface IAggregator {\n function decimals() external view returns (uint8);\n\n function latestAnswer() external view returns (int256 answer);\n\n function latestRoundData()\n external\n view\n returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);\n}\n\ninterface IAggregatorWithMeta is IAggregator {\n function description() external view returns (string memory);\n\n function version() external view returns (uint256);\n}\n" | ||
}, | ||
"src/interfaces/IPyth.sol": { | ||
"content": "// SPDX-License-Identifier: UNLICENSED\npragma solidity >=0.8.0;\n\ninterface IPyth {\n struct PriceInfo {\n int64 price;\n uint64 conf;\n int32 expo;\n uint256 publishTime;\n }\n\n function getPriceNoOlderThan(bytes32 id, uint256 age) external view returns (PriceInfo memory priceInfo);\n function getPrice(bytes32 id) external view returns (PriceInfo memory priceInfo);\n function getPriceUnsafe(bytes32 id) external view returns (PriceInfo memory priceInfo);\n}\n" | ||
} | ||
}, | ||
"settings": { | ||
"remappings": [ | ||
"/=src/", | ||
"forge-std/=dependencies/forge-std-1.9.2/src/", | ||
"halmos-cheatcodes/=dependencies/halmos-cheatcodes-3ca0e11/src/", | ||
"@openzeppelin/contracts/=dependencies/openzeppelin-contracts-5.0.2/contracts/", | ||
"@openzeppelin/contracts-upgradeable/=dependencies/openzeppelin-contracts-upgradeable-5.0.2/contracts/", | ||
"@BoringSolidity/=dependencies/BoringSolidity-1.0.0/contracts/", | ||
"@solady/=dependencies/solady-0.0.281/src/", | ||
"@solmate/=dependencies/solmate-6.2.0/src/", | ||
"@excessivelySafeCall/=dependencies/ExcessivelySafeCall-0.0.1/src/", | ||
"@safe-contracts/=dependencies/safe-contracts-1.3.0/contracts/", | ||
"@fuzzlib/=dependencies/fuzzlib-0.0.1/src/", | ||
"@abracadabra-oftv2/=dependencies/abracadabra-oftv2-0.0.1/src/" | ||
], | ||
"optimizer": { | ||
"enabled": true, | ||
"runs": 400 | ||
}, | ||
"metadata": { | ||
"useLiteralContent": false, | ||
"bytecodeHash": "ipfs", | ||
"appendCBOR": true | ||
}, | ||
"outputSelection": { | ||
"*": { | ||
"*": [ | ||
"abi", | ||
"evm.bytecode", | ||
"evm.deployedBytecode", | ||
"evm.methodIdentifiers", | ||
"metadata" | ||
] | ||
} | ||
}, | ||
"evmVersion": "shanghai", | ||
"viaIR": false, | ||
"libraries": {} | ||
} | ||
}, | ||
"compiler": "0.8.26+commit.8a97fa7a" | ||
} |
Oops, something went wrong.