Address Contract Verified
Address
0x230E0321Cf38F09e247e50Afc7801EA2351fe56F
Balance
0 ETH
Nonce
1
Code Size
1210 bytes
Creator
0x5B540d16...E593 at tx 0x234b14f7...4c6206
Indexed Transactions
0
Contract Bytecode
1210 bytes
0x608060405234801561001057600080fd5b50600436106100625760003560e01c80630417cf8e146100675780632e0f26251461008657806350d25bcd146100ad578063910bb70c146100c3578063918f867414610102578063de4aedab14610129575b600080fd5b61006f601281565b60405160ff90911681526020015b60405180910390f35b61006f7f000000000000000000000000000000000000000000000000000000000000000881565b6100b5610150565b60405190815260200161007d565b6100ea7f000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb2381565b6040516001600160a01b03909116815260200161007d565b6100b57f000000000000000000000000000000000000000000000000002386f26fc1000081565b6100ea7f000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c81565b6000807f000000000000000000000000fdfd9c85ad200c506cf9e21f1fd8dd01932fbb236001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa1580156101b1573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d591906102ed565b905060007f000000000000000000000000f4030086522a5beea4988f8ca5b36dbc97bee88c6001600160a01b03166350d25bcd6040518163ffffffff1660e01b8152600401602060405180830381865afa158015610237573d6000803e3d6000fd5b505050506040513d601f19601f8201168201806040525081019061025b91906102ed565b905060008213158061026e575060008113155b1561027c5760009250505090565b7f000000000000000000000000000000000000000000000000002386f26fc100006102c87f0000000000000000000000000000000000000000000000000000000000000008600a610402565b6102d28385610418565b6102dc9190610418565b6102e69190610448565b9250505090565b6000602082840312156102ff57600080fd5b5051919050565b634e487b7160e01b600052601160045260246000fd5b600181815b8085111561035757816000190482111561033d5761033d610306565b8085161561034a57918102915b93841c9390800290610321565b509250929050565b60008261036e575060016103fc565b8161037b575060006103fc565b8160018114610391576002811461039b576103b7565b60019150506103fc565b60ff8411156103ac576103ac610306565b50506001821b6103fc565b5060208310610133831016604e8410600b84101617156103da575081810a6103fc565b6103e4838361031c565b80600019048211156103f8576103f8610306565b0290505b92915050565b600061041160ff84168361035f565b9392505050565b80820260008212600160ff1b8414161561043457610434610306565b81810583148215176103fc576103fc610306565b60008261046557634e487b7160e01b600052601260045260246000fd5b600160ff1b82146000198414161561047f5761047f610306565b50059056fea26469706673582212202d28fcbab4af115a318f66c29a211610d51b9b7ce47eeff9b8419f514a74ba3364736f6c63430008110033
Verified Source Code Full Match
Compiler: v0.8.17+commit.8df45f5f
EVM: london
Optimization: Yes (200 runs)
IChainlinkAggregator.sol 23 lines
// 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);
}
ICLSynchronicityPriceAdapter.sol 12 lines
// 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();
}
CLSynchronicityPriceAdapterPegToBase.sol 82 lines
// 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);
}
}
Read Contract
ASSET_TO_PEG 0x910bb70c → address
DECIMALS 0x2e0f2625 → uint8
DENOMINATOR 0x918f8674 → int256
MAX_DECIMALS 0x0417cf8e → uint8
PEG_TO_BASE 0xde4aedab → address
latestAnswer 0x50d25bcd → int256
Recent Transactions
No transactions found for this address