Overview
ETH Balance
0 ETH
ETH Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 25 internal transactions (View All)
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
107558056 | 494 days ago | 0 ETH | ||||
107558056 | 494 days ago | 0 ETH | ||||
107558056 | 494 days ago | 0 ETH | ||||
107557852 | 494 days ago | 0 ETH | ||||
107557852 | 494 days ago | 0 ETH | ||||
107557852 | 494 days ago | 0 ETH | ||||
107557765 | 494 days ago | 0 ETH | ||||
107557765 | 494 days ago | 0 ETH | ||||
107557765 | 494 days ago | 0 ETH | ||||
107557027 | 494 days ago | 0 ETH | ||||
107557027 | 494 days ago | 0 ETH | ||||
107557027 | 494 days ago | 0 ETH | ||||
107556922 | 494 days ago | 0 ETH | ||||
107556922 | 494 days ago | 0 ETH | ||||
107556922 | 494 days ago | 0 ETH | ||||
107556639 | 494 days ago | 0 ETH | ||||
107556639 | 494 days ago | 0 ETH | ||||
107556639 | 494 days ago | 0 ETH | ||||
107554929 | 494 days ago | 0 ETH | ||||
107554929 | 494 days ago | 0 ETH | ||||
107554929 | 494 days ago | 0 ETH | ||||
107554478 | 494 days ago | 0 ETH | ||||
107554478 | 494 days ago | 0 ETH | ||||
107554478 | 494 days ago | 0 ETH | ||||
107554473 | 494 days ago | 0 ETH |
Loading...
Loading
Contract Name:
CLSynchronicityPriceAdapterPegToBase
Compiler Version
v0.8.19+commit.7dd6d404
Optimization Enabled:
Yes with 200 runs
Other Settings:
default evmVersion
Contract Source Code (Solidity Standard Json-Input format)
// SPDX-License-Identifier: MIT pragma solidity ^0.8.4; import {IChainlinkAggregator} from '../interfaces/IChainlinkAggregator.sol'; import {ICLSynchronicityPriceAdapter} from '../interfaces/ICLSynchronicityPriceAdapter.sol'; /** * @title CLSynchronicityPriceAdapter * @author BGD Labs * @notice Price adapter to calculate price of (Asset / Base) pair by using * @notice Chainlink Data Feeds for (Asset / Peg) and (Peg / Base) pairs. * @notice For example it can be used to calculate stETH / USD * @notice based on stETH / ETH and ETH / USD feeds. */ contract CLSynchronicityPriceAdapterPegToBase is ICLSynchronicityPriceAdapter { /** * @notice Price feed for (Base / Peg) pair */ IChainlinkAggregator public immutable PEG_TO_BASE; /** * @notice Price feed for (Asset / Peg) pair */ IChainlinkAggregator public immutable ASSET_TO_PEG; /** * @notice Number of decimals in the output of this price adapter */ uint8 public immutable DECIMALS; /** * @notice This is a parameter to bring the resulting answer with the proper precision. * @notice will be equal to 10 to the power of the sum decimals of feeds */ int256 public immutable DENOMINATOR; /** * @notice Maximum number of resulting and feed decimals */ uint8 public constant MAX_DECIMALS = 18; string private _description; /** * @param pegToBaseAggregatorAddress the address of PEG / BASE feed * @param assetToPegAggregatorAddress the address of the ASSET / PEG feed * @param decimals precision of the answer * @param pairDescription description */ constructor( address pegToBaseAggregatorAddress, address assetToPegAggregatorAddress, uint8 decimals, string memory pairDescription ) { PEG_TO_BASE = IChainlinkAggregator(pegToBaseAggregatorAddress); ASSET_TO_PEG = IChainlinkAggregator(assetToPegAggregatorAddress); if (decimals > MAX_DECIMALS) revert DecimalsAboveLimit(); if (PEG_TO_BASE.decimals() > MAX_DECIMALS) revert DecimalsAboveLimit(); if (ASSET_TO_PEG.decimals() > MAX_DECIMALS) revert DecimalsAboveLimit(); DECIMALS = decimals; _description = pairDescription; // equal to 10 to the power of the sum decimals of feeds unchecked { DENOMINATOR = int256(10 ** (PEG_TO_BASE.decimals() + ASSET_TO_PEG.decimals())); } } /// @inheritdoc ICLSynchronicityPriceAdapter function description() external view returns (string memory) { return _description; } /// @inheritdoc ICLSynchronicityPriceAdapter function decimals() external view returns (uint8) { return DECIMALS; } /// @inheritdoc ICLSynchronicityPriceAdapter function latestAnswer() public view virtual override returns (int256) { int256 assetToPegPrice = ASSET_TO_PEG.latestAnswer(); int256 pegToBasePrice = PEG_TO_BASE.latestAnswer(); if (assetToPegPrice <= 0 || pegToBasePrice <= 0) { return 0; } return (assetToPegPrice * pegToBasePrice * int256(10 ** DECIMALS)) / (DENOMINATOR); } }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface IChainlinkAggregator { function decimals() external view returns (uint8); function latestAnswer() external view returns (int256); function latestTimestamp() external view returns (uint256); function latestRound() external view returns (uint256); function getAnswer(uint256 roundId) external view returns (int256); function getTimestamp(uint256 roundId) external view returns (uint256); event AnswerUpdated(int256 indexed current, uint256 indexed roundId, uint256 timestamp); event NewRound(uint256 indexed roundId, address indexed startedBy); }
// SPDX-License-Identifier: MIT pragma solidity ^0.8.0; interface ICLSynchronicityPriceAdapter { /** * @notice Calculates the current answer based on the aggregators. * @return int256 latestAnswer */ function latestAnswer() external view returns (int256); /** * @notice Returns the description of the feed * @return string desciption */ function description() external view returns (string memory); /** * @notice Returns the feed decimals * @return uint8 decimals */ function decimals() external view returns (uint8); error DecimalsAboveLimit(); error DecimalsNotEqual(); }
{ "remappings": [ "aave-address-book/=lib/aave-address-book/src/", "ds-test/=lib/forge-std/lib/ds-test/src/", "forge-std/=lib/forge-std/src/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"pegToBaseAggregatorAddress","type":"address"},{"internalType":"address","name":"assetToPegAggregatorAddress","type":"address"},{"internalType":"uint8","name":"decimals","type":"uint8"},{"internalType":"string","name":"pairDescription","type":"string"}],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[],"name":"DecimalsAboveLimit","type":"error"},{"inputs":[],"name":"DecimalsNotEqual","type":"error"},{"inputs":[],"name":"ASSET_TO_PEG","outputs":[{"internalType":"contract IChainlinkAggregator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DECIMALS","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"DENOMINATOR","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"MAX_DECIMALS","outputs":[{"internalType":"uint8","name":"","type":"uint8"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"PEG_TO_BASE","outputs":[{"internalType":"contract IChainlinkAggregator","name":"","type":"address"}],"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":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
6101006040523480156200001257600080fd5b5060405162000be738038062000be78339810160408190526200003591620002ca565b6001600160a01b03808516608052831660a052601260ff831611156200006e57604051638fdc971960e01b815260040160405180910390fd5b601260ff166080516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620000b4573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620000da9190620003d7565b60ff161115620000fd57604051638fdc971960e01b815260040160405180910390fd5b601260ff1660a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa15801562000143573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620001699190620003d7565b60ff1611156200018c57604051638fdc971960e01b815260040160405180910390fd5b60ff821660c0526000620001a182826200048b565b5060a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015620001e3573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002099190620003d7565b6080516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156200024a573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190620002709190620003d7565b0160ff16600a0a60e052506200055792505050565b80516001600160a01b03811681146200029d57600080fd5b919050565b805160ff811681146200029d57600080fd5b634e487b7160e01b600052604160045260246000fd5b60008060008060808587031215620002e157600080fd5b620002ec8562000285565b93506020620002fd81870162000285565b93506200030d60408701620002a2565b60608701519093506001600160401b03808211156200032b57600080fd5b818801915088601f8301126200034057600080fd5b815181811115620003555762000355620002b4565b604051601f8201601f19908116603f01168101908382118183101715620003805762000380620002b4565b816040528281528b868487010111156200039957600080fd5b600093505b82841015620003bd57848401860151818501870152928501926200039e565b600086848301015280965050505050505092959194509250565b600060208284031215620003ea57600080fd5b620003f582620002a2565b9392505050565b600181811c908216806200041157607f821691505b6020821081036200043257634e487b7160e01b600052602260045260246000fd5b50919050565b601f8211156200048657600081815260208120601f850160051c81016020861015620004615750805b601f850160051c820191505b8181101562000482578281556001016200046d565b5050505b505050565b81516001600160401b03811115620004a757620004a7620002b4565b620004bf81620004b88454620003fc565b8462000438565b602080601f831160018114620004f75760008415620004de5750858301515b600019600386901b1c1916600185901b17855562000482565b600085815260208120601f198616915b82811015620005285788860151825594840194600190910190840162000507565b5085821015620005475787850151600019600388901b60f8161c191681555b5050505050600190811b01905550565b60805160a05160c05160e051610635620005b26000396000818161016801526102df01526000818160b10152818160d5015261030301526000818161012901526101b601526000818161018f015261023c01526106356000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80637284e4161161005b5780637284e4161461010f578063910bb70c14610124578063918f867414610163578063de4aedab1461018a57600080fd5b80630417cf8e1461008d5780632e0f2625146100ac578063313ce567146100d357806350d25bcd146100f9575b600080fd5b610095601281565b60405160ff90911681526020015b60405180910390f35b6100957f000000000000000000000000000000000000000000000000000000000000000081565b7f0000000000000000000000000000000000000000000000000000000000000000610095565b6101016101b1565b6040519081526020016100a3565b61011761034e565b6040516100a391906103e0565b61014b7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b0390911681526020016100a3565b6101017f000000000000000000000000000000000000000000000000000000000000000081565b61014b7f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610212573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610236919061042e565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610298573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102bc919061042e565b90506000821315806102cf575060008113155b156102dd5760009250505090565b7f00000000000000000000000000000000000000000000000000000000000000006103297f0000000000000000000000000000000000000000000000000000000000000000600a610543565b6103338385610559565b61033d9190610559565b6103479190610589565b9250505090565b60606000805461035d906105c5565b80601f0160208091040260200160405190810160405280929190818152602001828054610389906105c5565b80156103d65780601f106103ab576101008083540402835291602001916103d6565b820191906000526020600020905b8154815290600101906020018083116103b957829003601f168201915b5050505050905090565b600060208083528351808285015260005b8181101561040d578581018301518582016040015282016103f1565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561044057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561049857816000190482111561047e5761047e610447565b8085161561048b57918102915b93841c9390800290610462565b509250929050565b6000826104af5750600161053d565b816104bc5750600061053d565b81600181146104d257600281146104dc576104f8565b600191505061053d565b60ff8411156104ed576104ed610447565b50506001821b61053d565b5060208310610133831016604e8410600b841016171561051b575081810a61053d565b610525838361045d565b806000190482111561053957610539610447565b0290505b92915050565b600061055260ff8416836104a0565b9392505050565b80820260008212600160ff1b8414161561057557610575610447565b818105831482151761053d5761053d610447565b6000826105a657634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156105c0576105c0610447565b500590565b600181811c908216806105d957607f821691505b6020821081036105f957634e487b7160e01b600052602260045260246000fd5b5091905056fea264697066735822122015afe3ea68ba5f211c61fe854e0819e7c1d10e10f83cf7209d3c25f09704bc1064736f6c6343000813003300000000000000000000000013e3ee699d1909e989722e753853ae30b17e08c5000000000000000000000000e59eba0d492ca53c6f46015eea00517f2707dc7700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e7773744554482f4554482f555344000000000000000000000000000000000000
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100885760003560e01c80637284e4161161005b5780637284e4161461010f578063910bb70c14610124578063918f867414610163578063de4aedab1461018a57600080fd5b80630417cf8e1461008d5780632e0f2625146100ac578063313ce567146100d357806350d25bcd146100f9575b600080fd5b610095601281565b60405160ff90911681526020015b60405180910390f35b6100957f000000000000000000000000000000000000000000000000000000000000000881565b7f0000000000000000000000000000000000000000000000000000000000000008610095565b6101016101b1565b6040519081526020016100a3565b61011761034e565b6040516100a391906103e0565b61014b7f000000000000000000000000e59eba0d492ca53c6f46015eea00517f2707dc7781565b6040516001600160a01b0390911681526020016100a3565b6101017f00000000000000000000000000000000000000000052b7d2dcc80cd2e400000081565b61014b7f00000000000000000000000013e3ee699d1909e989722e753853ae30b17e08c581565b6000807f000000000000000000000000e59eba0d492ca53c6f46015eea00517f2707dc776001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610212573d6000803e3d6000fd5b505050506040513d601f19601f82011682018060405250810190610236919061042e565b905060007f00000000000000000000000013e3ee699d1909e989722e753853ae30b17e08c56001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610298573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102bc919061042e565b90506000821315806102cf575060008113155b156102dd5760009250505090565b7f00000000000000000000000000000000000000000052b7d2dcc80cd2e40000006103297f0000000000000000000000000000000000000000000000000000000000000008600a610543565b6103338385610559565b61033d9190610559565b6103479190610589565b9250505090565b60606000805461035d906105c5565b80601f0160208091040260200160405190810160405280929190818152602001828054610389906105c5565b80156103d65780601f106103ab576101008083540402835291602001916103d6565b820191906000526020600020905b8154815290600101906020018083116103b957829003601f168201915b5050505050905090565b600060208083528351808285015260005b8181101561040d578581018301518582016040015282016103f1565b506000604082860101526040601f19601f8301168501019250505092915050565b60006020828403121561044057600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561049857816000190482111561047e5761047e610447565b8085161561048b57918102915b93841c9390800290610462565b509250929050565b6000826104af5750600161053d565b816104bc5750600061053d565b81600181146104d257600281146104dc576104f8565b600191505061053d565b60ff8411156104ed576104ed610447565b50506001821b61053d565b5060208310610133831016604e8410600b841016171561051b575081810a61053d565b610525838361045d565b806000190482111561053957610539610447565b0290505b92915050565b600061055260ff8416836104a0565b9392505050565b80820260008212600160ff1b8414161561057557610575610447565b818105831482151761053d5761053d610447565b6000826105a657634e487b7160e01b600052601260045260246000fd5b600160ff1b8214600019841416156105c0576105c0610447565b500590565b600181811c908216806105d957607f821691505b6020821081036105f957634e487b7160e01b600052602260045260246000fd5b5091905056fea264697066735822122015afe3ea68ba5f211c61fe854e0819e7c1d10e10f83cf7209d3c25f09704bc1064736f6c63430008130033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
00000000000000000000000013e3ee699d1909e989722e753853ae30b17e08c5000000000000000000000000e59eba0d492ca53c6f46015eea00517f2707dc7700000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000e7773744554482f4554482f555344000000000000000000000000000000000000
-----Decoded View---------------
Arg [0] : pegToBaseAggregatorAddress (address): 0x13e3Ee699D1909E989722E753853AE30b17e08c5
Arg [1] : assetToPegAggregatorAddress (address): 0xe59EBa0D492cA53C6f46015EEa00517F2707dc77
Arg [2] : decimals (uint8): 8
Arg [3] : pairDescription (string): wstETH/ETH/USD
-----Encoded View---------------
6 Constructor Arguments found :
Arg [0] : 00000000000000000000000013e3ee699d1909e989722e753853ae30b17e08c5
Arg [1] : 000000000000000000000000e59eba0d492ca53c6f46015eea00517f2707dc77
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000008
Arg [3] : 0000000000000000000000000000000000000000000000000000000000000080
Arg [4] : 000000000000000000000000000000000000000000000000000000000000000e
Arg [5] : 7773744554482f4554482f555344000000000000000000000000000000000000
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
[ Download: CSV Export ]
A contract address hosts a smart contract, which is a set of code stored on the blockchain that runs when predetermined conditions are met. Learn more about addresses in our Knowledge Base.