Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 internal transaction
Advanced mode:
Parent Transaction Hash | Block | From | To | |||
---|---|---|---|---|---|---|
19681343 | 215 days ago | Contract Creation | 0 ETH |
Loading...
Loading
Similar Match Source Code This contract matches the deployed Bytecode of the Source Code for Contract 0x378E959C...f6d6B7aC7 The constructor portion of the code might be different and could alter the actual behaviour of the contract
Contract Name:
CLSynchronicityPriceAdapterBaseToPeg
Compiler Version
v0.8.21+commit.d9974bed
Optimization Enabled:
Yes with 200 runs
Other Settings:
paris 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 CLSynchronicityPriceAdapterBaseToPeg * @author BGD Labs * @notice Price adapter to calculate price of (Asset / Base) pair by using * @notice Chainlink Data Feeds for (Asset / Peg) and (Base / Peg) pairs. * @notice For example it can be used to calculate USDC / ETH * @notice based on USDC / USD and ETH / USD feeds. */ contract CLSynchronicityPriceAdapterBaseToPeg is ICLSynchronicityPriceAdapter { /** * @notice Price feed for (Base / Peg) pair */ IChainlinkAggregator public immutable BASE_TO_PEG; /** * @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 Maximum number of resulting and feed decimals */ uint8 public constant MAX_DECIMALS = 18; string private _description; /** * @param baseToPegAggregatorAddress the address of BASE / PEG feed * @param assetToPegAggregatorAddress the address of the ASSET / PEG feed * @param decimals precision of the answer * @param pairDescription description */ constructor( address baseToPegAggregatorAddress, address assetToPegAggregatorAddress, uint8 decimals, string memory pairDescription ) { BASE_TO_PEG = IChainlinkAggregator(baseToPegAggregatorAddress); ASSET_TO_PEG = IChainlinkAggregator(assetToPegAggregatorAddress); if (decimals > MAX_DECIMALS) revert DecimalsAboveLimit(); if (BASE_TO_PEG.decimals() > MAX_DECIMALS) revert DecimalsAboveLimit(); if (BASE_TO_PEG.decimals() != ASSET_TO_PEG.decimals()) revert DecimalsNotEqual(); DECIMALS = decimals; _description = pairDescription; } /// @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() external view override returns (int256) { int256 assetToPegPrice = ASSET_TO_PEG.latestAnswer(); int256 baseToPegPrice = BASE_TO_PEG.latestAnswer(); if (assetToPegPrice <= 0 || baseToPegPrice <= 0) { return 0; } return (assetToPegPrice * int256(10 ** DECIMALS)) / (baseToPegPrice); } }
// 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(); error RatioOutOfBounds(); }
{ "remappings": [ "forge-std/=lib/forge-std/src/", "aave-address-book/=lib/aave-address-book/src/", "cl-synchronicity-price-adapter/=lib/cl-synchronicity-price-adapter/src/", "aave-v3-core/=lib/aave-address-book/lib/aave-v3-core/", "aave-helpers/=lib/aave-helpers/src/", "solidity-utils/=lib/aave-helpers/lib/solidity-utils/src/", "@aave/core-v3/=lib/aave-address-book/lib/aave-v3-core/", "@aave/periphery-v3/=lib/aave-address-book/lib/aave-v3-periphery/", "aave-v3-periphery/=lib/aave-address-book/lib/aave-v3-periphery/", "ds-test/=lib/forge-std/lib/ds-test/src/", "governance-crosschain-bridges/=lib/aave-helpers/lib/governance-crosschain-bridges/" ], "optimizer": { "enabled": true, "runs": 200 }, "metadata": { "useLiteralContent": false, "bytecodeHash": "ipfs", "appendCBOR": true }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "paris", "viaIR": false, "libraries": {} }
Contract Security Audit
- No Contract Security Audit Submitted- Submit Audit Here
[{"inputs":[{"internalType":"address","name":"baseToPegAggregatorAddress","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":"RatioOutOfBounds","type":"error"},{"inputs":[],"name":"ASSET_TO_PEG","outputs":[{"internalType":"contract IChainlinkAggregator","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"BASE_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":"MAX_DECIMALS","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":[],"name":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"}]
Deployed Bytecode
0x608060405234801561001057600080fd5b506004361061007d5760003560e01c806350d25bcd1161005b57806350d25bcd146100ee5780636753b8c4146101045780637284e41614610143578063910bb70c1461015857600080fd5b80630417cf8e146100825780632e0f2625146100a1578063313ce567146100c8575b600080fd5b61008a601281565b60405160ff90911681526020015b60405180910390f35b61008a7f000000000000000000000000000000000000000000000000000000000000001281565b7f000000000000000000000000000000000000000000000000000000000000001261008a565b6100f661017f565b604051908152602001610098565b61012b7f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b841981565b6040516001600160a01b039091168152602001610098565b61014b6102f2565b6040516100989190610384565b61012b7f000000000000000000000000b9e3a06317b58b0944c6a58a47223a7f6d37bf3c81565b6000807f000000000000000000000000b9e3a06317b58b0944c6a58a47223a7f6d37bf3c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101e0573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061020491906103d2565b905060007f0000000000000000000000005f4ec3df9cbd43714fe2740f5e3616155c5b84196001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610266573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061028a91906103d2565b905060008213158061029d575060008113155b156102ab5760009250505090565b806102d77f0000000000000000000000000000000000000000000000000000000000000012600a6104e7565b6102e190846104fd565b6102eb919061052d565b9250505090565b60606000805461030190610569565b80601f016020809104026020016040519081016040528092919081815260200182805461032d90610569565b801561037a5780601f1061034f5761010080835404028352916020019161037a565b820191906000526020600020905b81548152906001019060200180831161035d57829003601f168201915b5050505050905090565b600060208083528351808285015260005b818110156103b157858101830151858201604001528201610395565b506000604082860101526040601f19601f8301168501019250505092915050565b6000602082840312156103e457600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561043c578160001904821115610422576104226103eb565b8085161561042f57918102915b93841c9390800290610406565b509250929050565b600082610453575060016104e1565b81610460575060006104e1565b816001811461047657600281146104805761049c565b60019150506104e1565b60ff841115610491576104916103eb565b50506001821b6104e1565b5060208310610133831016604e8410600b84101617156104bf575081810a6104e1565b6104c98383610401565b80600019048211156104dd576104dd6103eb565b0290505b92915050565b60006104f660ff841683610444565b9392505050565b80820260008212600160ff1b84141615610519576105196103eb565b81810583148215176104e1576104e16103eb565b60008261054a57634e487b7160e01b600052601260045260246000fd5b600160ff1b821460001984141615610564576105646103eb565b500590565b600181811c9082168061057d57607f821691505b60208210810361059d57634e487b7160e01b600052602260045260246000fd5b5091905056fea2646970667358221220a8c95d702e044622913efa73996027f1e2ec1ac8cf3ae9231e355ca87770483764736f6c63430008150033
Loading...
Loading
Loading...
Loading
Multichain Portfolio | 30 Chains
Chain | Token | Portfolio % | Price | Amount | Value |
---|
Loading...
Loading
[ 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.