Description:
Smart contract deployed on Ethereum with Oracle features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
// SPDX-License-Identifier: SEE LICENSE IN LICENSE
pragma solidity ^0.8.0 ^0.8.19;
// interfaces/AggregatorV3Interface.sol
// solhint-disable-next-line interface-starts-with-i
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function getRoundData(
uint80 _roundId
) external view returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
// src/chainlink_curve_adapter.sol
contract CurveAdapter {
AggregatorV3Interface public immutable oracle;
uint256 public immutable factor;
constructor(AggregatorV3Interface _oracle) {
oracle = _oracle;
factor = 10 ** (18 - _oracle.decimals());
}
function lastPrice() external view returns (uint256) {
(, int256 price, , , ) = oracle.latestRoundData();
return uint256(price) * factor;
}
}
Submitted on: 2025-10-27 16:43:04
Comments
Log in to comment.
No comments yet.