Overview
ETH Balance
0 ETH
Eth Value
$0.00More Info
Private Name Tags
ContractCreator
Latest 1 from a total of 1 transactions
Transaction Hash |
Method
|
Block
|
From
|
To
|
|||||
---|---|---|---|---|---|---|---|---|---|
0x61010060 | 16418941 | 676 days ago | IN | 0 ETH | 0.00497463 |
View more zero value Internal Transactions in Advanced View mode
Advanced mode:
Loading...
Loading
Contract Name:
CLSynchronicityPriceAdapterPegToBase
Compiler Version
v0.8.17+commit.8df45f5f
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; /** * @param pegToBaseAggregatorAddress the address of PEG / BASE feed * @param assetToPegAggregatorAddress the address of the ASSET / PEG feed * @param decimals precision of the answer */ constructor( address pegToBaseAggregatorAddress, address assetToPegAggregatorAddress, uint8 decimals ) { 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; // 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 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 ICLSynchronicityPriceAdapter { /** * @notice Calculates the current answer based on the aggregators. */ function latestAnswer() external view returns (int256); error DecimalsAboveLimit(); error DecimalsNotEqual(); }
// 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); }
{ "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" }, "outputSelection": { "*": { "*": [ "evm.bytecode", "evm.deployedBytecode", "devdoc", "userdoc", "metadata", "abi" ] } }, "evmVersion": "london", "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"}],"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":"latestAnswer","outputs":[{"internalType":"int256","name":"","type":"int256"}],"stateMutability":"view","type":"function"}]
Contract Creation Code
61010060405234801561001157600080fd5b5060405161080638038061080683398101604081905261003091610294565b6001600160a01b03808416608052821660a052601260ff8216111561006857604051638fdc971960e01b815260040160405180910390fd5b601260ff166080516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156100ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906100d191906102d7565b60ff1611156100f357604051638fdc971960e01b815260040160405180910390fd5b601260ff1660a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610138573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061015c91906102d7565b60ff16111561017e57604051638fdc971960e01b815260040160405180910390fd5b8060ff1660c08160ff168152505060a0516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101cc573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101f091906102d7565b6080516001600160a01b031663313ce5676040518163ffffffff1660e01b8152600401602060405180830381865afa158015610230573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025491906102d7565b0160ff16600a0a60e052506102f9915050565b80516001600160a01b038116811461027e57600080fd5b919050565b805160ff8116811461027e57600080fd5b6000806000606084860312156102a957600080fd5b6102b284610267565b92506102c060208501610267565b91506102ce60408501610283565b90509250925092565b6000602082840312156102e957600080fd5b6102f282610283565b9392505050565b60805160a05160c05160e0516104ba61034c60003960008181610107015261027e015260008181608b01526102a201526000818160c8015261015501526000818161012e01526101db01526104ba6000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c80630417cf8e146100675780632e0f26251461008657806350d25bcd146100ad578063910bb70c146100c3578063918f867414610102578063de4aedab14610129575b600080fd5b61006f601281565b60405160ff90911681526020015b60405180910390f35b61006f7f000000000000000000000000000000000000000000000000000000000000000081565b6100b5610150565b60405190815260200161007d565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6040516001600160a01b03909116815260200161007d565b6100b57f000000000000000000000000000000000000000000000000000000000000000081565b6100ea7f000000000000000000000000000000000000000000000000000000000000000081565b6000807f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d591906102ed565b905060007f00000000000000000000000000000000000000000000000000000000000000006001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b91906102ed565b905060008213158061026e575060008113155b1561027c5760009250505090565b7f00000000000000000000000000000000000000000000000000000000000000006102c87f0000000000000000000000000000000000000000000000000000000000000000600a610402565b6102d28385610418565b6102dc9190610418565b6102e69190610448565b9250505090565b6000602082840312156102ff57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561035757816000190482111561033d5761033d610306565b8085161561034a57918102915b93841c9390800290610321565b509250929050565b60008261036e575060016103fc565b8161037b575060006103fc565b8160018114610391576002811461039b576103b7565b60019150506103fc565b60ff8411156103ac576103ac610306565b50506001821b6103fc565b5060208310610133831016604e8410600b84101617156103da575081810a6103fc565b6103e4838361031c565b80600019048211156103f8576103f8610306565b0290505b92915050565b600061041160ff84168361035f565b9392505050565b80820260008212600160ff1b8414161561043457610434610306565b81810583148215176103fc576103fc610306565b60008261046557634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561047f5761047f610306565b50059056fea26469706673582212202d28fcbab4af115a318f66c29a211610d51b9b7ce47eeff9b8419f514a74ba3364736f6c63430008110033000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb230000000000000000000000000000000000000000000000000000000000000008
Deployed Bytecode
0x608060405234801561001057600080fd5b50600436106100625760003560e01c80630417cf8e146100675780632e0f26251461008657806350d25bcd146100ad578063910bb70c146100c3578063918f867414610102578063de4aedab14610129575b600080fd5b61006f601281565b60405160ff90911681526020015b60405180910390f35b61006f7f000000000000000000000000000000000000000000000000000000000000000881565b6100b5610150565b60405190815260200161007d565b6100ea7f000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb2381565b6040516001600160a01b03909116815260200161007d565b6100b57f000000000000000000000000000000000000000000000000002386f26fc1000081565b6100ea7f000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c81565b6000807f000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb236001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d591906102ed565b905060007f000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b91906102ed565b905060008213158061026e575060008113155b1561027c5760009250505090565b7f000000000000000000000000000000000000000000000000002386f26fc100006102c87f0000000000000000000000000000000000000000000000000000000000000008600a610402565b6102d28385610418565b6102dc9190610418565b6102e69190610448565b9250505090565b6000602082840312156102ff57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561035757816000190482111561033d5761033d610306565b8085161561034a57918102915b93841c9390800290610321565b509250929050565b60008261036e575060016103fc565b8161037b575060006103fc565b8160018114610391576002811461039b576103b7565b60019150506103fc565b60ff8411156103ac576103ac610306565b50506001821b6103fc565b5060208310610133831016604e8410600b84101617156103da575081810a6103fc565b6103e4838361031c565b80600019048211156103f8576103f8610306565b0290505b92915050565b600061041160ff84168361035f565b9392505050565b80820260008212600160ff1b8414161561043457610434610306565b81810583148215176103fc576103fc610306565b60008261046557634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561047f5761047f610306565b50059056fea26469706673582212202d28fcbab4af115a318f66c29a211610d51b9b7ce47eeff9b8419f514a74ba3364736f6c63430008110033
Constructor Arguments (ABI-Encoded and is the last bytes of the Contract Creation Code above)
000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb230000000000000000000000000000000000000000000000000000000000000008
-----Decoded View---------------
Arg [0] : pegToBaseAggregatorAddress (address): 0xF4030086522a5bEEa4988F8cA5B36dbC97BeE88c
Arg [1] : assetToPegAggregatorAddress (address): 0xfdFD9C85aD200c506Cf9e21F1FD8dd01932FBB23
Arg [2] : decimals (uint8): 8
-----Encoded View---------------
3 Constructor Arguments found :
Arg [0] : 000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c
Arg [1] : 000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb23
Arg [2] : 0000000000000000000000000000000000000000000000000000000000000008
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.