Description:
Smart contract deployed on Ethereum with Factory, Oracle features.
Blockchain: Ethereum
Source Code: View Code On The Blockchain
Solidity Source Code:
{{
"language": "Solidity",
"sources": {
"src/PriceAdapters/USTBAdapter.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;
import "../interface/IPriceAdapter.sol";
import "../../lib/chainlink-local/src/data-feeds/interfaces/AggregatorV3Interface.sol";
contract USTBAdapter is IPriceAdapter {
AggregatorV3Interface private immutable PRICE_FEED;
error ZeroAddress();
error InvalidPrice();
constructor(address _priceFeed) {
if (_priceFeed == address(0)) revert ZeroAddress();
PRICE_FEED = AggregatorV3Interface(_priceFeed);
}
function getPrice() external view returns (uint256) {
(, int256 answer,,,) = PRICE_FEED.latestRoundData();
if (answer <= 0) revert InvalidPrice();
return uint256(answer) * 1e12;
}
}
"
},
"src/interface/IPriceAdapter.sol": {
"content": "// SPDX-License-Identifier: UNLICENSED
pragma solidity 0.8.30;
interface IPriceAdapter {
/// @notice Get the price of a RWA token in USD (WAD)
function getPrice() external view returns (uint256);
}
"
},
"lib/chainlink-local/src/data-feeds/interfaces/AggregatorV3Interface.sol": {
"content": "// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
/// @title AggregatorV3Interface
/// @notice Interface for accessing detailed data from an aggregator contract, including round data and metadata.
/// @dev Provides methods to get the latest data, historical data for specific rounds, and metadata such as decimals and description.
interface AggregatorV3Interface {
/**
* @notice Gets the number of decimals used by the aggregator.
* @return uint8 - The number of decimals.
*/
function decimals() external view returns (uint8);
/**
* @notice Gets the description of the aggregator.
* @return string memory - The description of the aggregator.
*/
function description() external view returns (string memory);
/**
* @notice Gets the version of the aggregator.
* @return uint256 - The version of the aggregator.
*/
function version() external view returns (uint256);
/**
* @notice Gets the round data for a specific round ID.
* @param _roundId - The round ID to get the data for.
* @return roundId - The round ID.
* @return answer - The answer for the round.
* @return startedAt - The timestamp when the round started.
* @return updatedAt - The timestamp when the round was updated.
* @return answeredInRound - The round ID in which the answer was computed.
* @dev This function should raise "No data present" if no data is available for the given round ID.
*/
function getRoundData(uint80 _roundId)
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
/**
* @notice Gets the latest round data.
* @return roundId - The latest round ID.
* @return answer - The latest answer.
* @return startedAt - The timestamp when the latest round started.
* @return updatedAt - The timestamp when the latest round was updated.
* @return answeredInRound - The round ID in which the latest answer was computed.
* @dev This function should raise "No data present" if no data is available.
*/
function latestRoundData()
external
view
returns (uint80 roundId, int256 answer, uint256 startedAt, uint256 updatedAt, uint80 answeredInRound);
}
"
}
},
"settings": {
"remappings": [
"@openzeppelin/contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/contracts/",
"@openzeppelin/contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/contracts/",
"agora-contracts/=lib/agora-contracts/src/contracts/",
"erc4626-tests/=lib/openzeppelin-contracts-upgradeable/lib/erc4626-tests/",
"forge-std/=lib/forge-std/src/",
"halmos-cheatcodes/=lib/openzeppelin-contracts-upgradeable/lib/halmos-cheatcodes/src/",
"openzeppelin-contracts-upgradeable/=lib/openzeppelin-contracts-upgradeable/",
"openzeppelin-contracts/=lib/openzeppelin-contracts-upgradeable/lib/openzeppelin-contracts/",
"solady/=lib/solady/src/",
"agora-stable-swap/=lib/agora-stable-swap/src/",
"@chainlink/contracts-ccip/=lib/chainlink-local/lib/ccip/contracts/",
"@chainlink/contracts/=lib/chainlink-local/lib/chainlink-brownie-contracts/contracts/",
"@chainlink/local/src/=lib/chainlink-local/src/",
"ccip/=lib/chainlink-local/lib/ccip/",
"chainlink-brownie-contracts/=lib/chainlink-local/lib/chainlink-brownie-contracts/contracts/src/v0.6/vendor/@arbitrum/nitro-contracts/src/",
"chainlink-local/=lib/chainlink-local/src/",
"contracts/=lib/agora-stable-swap/src/contracts/",
"createx/=lib/agora-stable-swap/node_modules/createx/src/",
"ds-test/=lib/agora-stable-swap/node_modules/ds-test/src/",
"interfaces/=lib/agora-stable-swap/src/contracts/interfaces/",
"script/=lib/agora-stable-swap/src/script/"
],
"optimizer": {
"enabled": true,
"runs": 200
},
"metadata": {
"useLiteralContent": false,
"bytecodeHash": "ipfs",
"appendCBOR": true
},
"outputSelection": {
"*": {
"*": [
"evm.bytecode",
"evm.deployedBytecode",
"devdoc",
"userdoc",
"metadata",
"abi"
]
}
},
"evmVersion": "prague",
"viaIR": true
}
}}
Submitted on: 2025-09-30 10:53:43
Comments
Log in to comment.
No comments yet.