Some checks failed
CI/CD Pipeline / Solidity Contracts (push) Failing after 1m18s
CI/CD Pipeline / Security Scanning (push) Successful in 2m27s
CI/CD Pipeline / Lint and Format (push) Failing after 46s
CI/CD Pipeline / Terraform Validation (push) Failing after 28s
CI/CD Pipeline / Kubernetes Validation (push) Successful in 29s
Deploy ChainID 138 / Deploy ChainID 138 (push) Failing after 1m0s
HYBX OMNL TypeScript & anchor / token-aggregation build + reconcile artifact (push) Failing after 29s
Validation / validate-genesis (push) Successful in 30s
Validation / validate-terraform (push) Failing after 32s
Validation / validate-kubernetes (push) Failing after 10s
Validation / validate-smart-contracts (push) Failing after 13s
Validation / validate-security (push) Failing after 1m23s
Validation / validate-documentation (push) Failing after 22s
Verify Deployment / Verify Deployment (push) Failing after 11m53s
- CWTokenMarketRegistry + USD feeds for mainnet cW* market anchors - HYBX cross-chain treasury line registry expansion - PMM seed default → live DODOPMMIntegration (0x86ADA6Ef…) - mint-xau-chain138: troy-ounce mint helper with multisig path - relay: prefer CCIP_MAINNET_LINK138 relayer key on default profile Co-authored-by: Cursor <cursoragent@cursor.com>
68 lines
1.8 KiB
Solidity
68 lines
1.8 KiB
Solidity
// SPDX-License-Identifier: MIT
|
|
pragma solidity ^0.8.20;
|
|
|
|
import {IAggregatorV3} from "./interfaces/IAggregatorV3.sol";
|
|
import {CWTokenMarketRegistry} from "./CWTokenMarketRegistry.sol";
|
|
|
|
/**
|
|
* @title CWTokenUsdFeed
|
|
* @notice Per-token Chainlink AggregatorV3-compatible USD feed backed by CWTokenMarketRegistry.
|
|
*/
|
|
contract CWTokenUsdFeed is IAggregatorV3 {
|
|
CWTokenMarketRegistry public immutable registry;
|
|
address public immutable token;
|
|
string public description_;
|
|
|
|
constructor(CWTokenMarketRegistry _registry, address _token, string memory _description) {
|
|
require(address(_registry) != address(0) && _token != address(0), "zero arg");
|
|
registry = _registry;
|
|
token = _token;
|
|
description_ = _description;
|
|
}
|
|
|
|
function decimals() external pure returns (uint8) {
|
|
return 8;
|
|
}
|
|
|
|
function description() external view returns (string memory) {
|
|
return description_;
|
|
}
|
|
|
|
function version() external pure returns (uint256) {
|
|
return 1;
|
|
}
|
|
|
|
function getRoundData(uint80 _roundId)
|
|
external
|
|
view
|
|
returns (
|
|
uint80 roundId,
|
|
int256 answer,
|
|
uint256 startedAt,
|
|
uint256 updatedAt,
|
|
uint80 answeredInRound
|
|
)
|
|
{
|
|
(roundId, answer, startedAt, updatedAt, answeredInRound) = latestRoundData();
|
|
if (_roundId != 0) {
|
|
require(roundId == _roundId, "stale round");
|
|
}
|
|
}
|
|
|
|
function latestRoundData()
|
|
public
|
|
view
|
|
returns (
|
|
uint80 roundId,
|
|
int256 answer,
|
|
uint256 startedAt,
|
|
uint256 updatedAt,
|
|
uint80 answeredInRound
|
|
)
|
|
{
|
|
(roundId, answer, updatedAt) = registry.latestRoundDataForToken(token);
|
|
startedAt = updatedAt;
|
|
answeredInRound = roundId;
|
|
}
|
|
}
|