跳至主要內容
本頁面使用機器翻譯自英語,可能包含錯誤或不清楚的語言。如需最準確的信息,請參閱英文原文。由於更新頻繁,部分內容可能與英文原文有出入。請加入我們在 Crowdin 上的努力,幫助我們改進本頁面的翻譯。 (Crowdin translation page, Contributing guide)

RedStone

概覽

RedStone 是一個模組化預言機網路,負責向智慧合約提供價格資料。 在 Kaia 上,RedStone 公開了 Push 饋送,這些饋送將價格資料儲存於鏈上,因此 dApp 可以透過熟悉的、與 Chainlink 相容的 AggregatorV3Interface 讀取這些資料。

RedStone Push 會根據可設定的 偏差心跳 條件,定期更新鏈上價格。 請參閱 RedStone Push 文件 以了解更多資訊,並在 Push Feeds 使用者介面 中瀏覽 Kaia 的即時資訊流。

在 Kaia 上使用 RedStone

每個 Push 資料饋送皆以價格饋送合約的形式部署,該合約實作了 Chainlink 的 Aggregator 介面。 您可以呼叫 latestRoundData() 來讀取最新價格。


// SPDX-License-Identifier: MIT
pragma solidity ^0.8.20;
interface AggregatorV3Interface {
function decimals() external view returns (uint8);
function description() external view returns (string memory);
function version() external view returns (uint256);
function latestRoundData()
external
view
returns (
uint80 roundId,
int256 answer,
uint256 startedAt,
uint256 updatedAt,
uint80 answeredInRound
);
}
contract RedStoneConsumer {
AggregatorV3Interface public immutable priceFeed;
constructor(address feedAddress) {
priceFeed = AggregatorV3Interface(feedAddress);
}
function getLatestPrice()
external
view
returns (int256 price, uint256 updatedAt)
{
(, price, , updatedAt, ) = priceFeed.latestRoundData();
}
}

請傳入您所需資產的饋送網址(請參閱下表)。 請務必驗證 updatedAt,並根據您所採用協議的資料新鮮度要求對資料進行四捨五入。

Kaia 的動態

主網(鏈 ID 8217)

動態地址《偏差/心跳》
BTC0x6AEE1334b4053B0148907649D447557560CC81260.5% / 6 小時
ETH0xb728dbB1D8504fD521db0e87bdDdF33466bCabAD0.5% / 6 小時
USDT0xE08bcb1407E8496d434eFe4ecf2a20E27068a14A0.5% / 6 小時
KAIA0xa2F3430ac9cfc37aEF88449DADf36af676211A640.1% / 12 小時
賺取 USDT0x6334c5EAE8CD1E2aD2fe32989775C92e7F729e710.1% / 12 小時
stKAIA0x6b860bE3CCc3b69C912ff2f7975Ea0d1194928a70.1% / 12 小時

Kairos 測試網(鏈 ID 1001)

動態地址《偏差/心跳》
USDT0x13d3B27c7C100621CB3B714deAb858Ee06d41db10.5% / 6 小時

飼料的供應狀況及相關參數可能會有所變動。 請在 Push Feeds 使用者介面 中確認最新的網址及更新條件。

資源

讓這個頁面變得更好