diff --git a/docs/2-network.mdx b/docs/2-network.mdx index 9354b0ef..14b976bf 100644 --- a/docs/2-network.mdx +++ b/docs/2-network.mdx @@ -17,7 +17,7 @@ Flare has four networks, each serving different purposes, so choosing the right - **Songbird Canary-Network.** Experimental proving ground for Flare, test your applications in a real-world environment. -- **Songbird Testnet Coston.** This is the testnet for the Songbird network. +- **Songbird Testnet Coston.** The testnet for Songbird network. The most common development tracks are: diff --git a/docs/ftso/guides/read-feeds-offchain.mdx b/docs/ftso/guides/read-feeds-offchain.mdx index f8621709..f5ff8074 100644 --- a/docs/ftso/guides/read-feeds-offchain.mdx +++ b/docs/ftso/guides/read-feeds-offchain.mdx @@ -9,7 +9,11 @@ sidebar_position: 1 import TabItem from "@theme/TabItem"; import Tabs from "@theme/Tabs"; -This guide contains code examples that demonstrate how to read FTSOv2 feeds off-chain using different programming languages. +This guide contains code examples that demonstrate how to read FTSOv2 feeds off-chain using different programming languages. To read a block-latency feed off-chain you need two pieces of information: + +1. **RPC Endpoint URL:** This determines which network that code will interact with. You can use a node provider service or point to your own client. A list of public and private RPC endpoints for all Flare networks is provided on the [Network Configuration](../../network#configuration) page. + +2. **FastUpdater Contract Address:** The address for the `FastUpdater` contract is different for each network. You can query this by calling the `FlareContractRegistry`, which has the same address across all Flare networks `0xaD67FE66660Fb8dFE9d6b1b4240d8650e30F6019`. Examples for how to query the `FlareContractRegistry` are given in the language guides using [Python](/guides/flare-for-python-developers#make-query), [Rust](/guides/flare-for-rust-developers#make-query), [JavaScript](/guides/flare-for-javascript-developers#make-query), and [Go](/guides/flare-for-go-developers#make-query). ## Python @@ -37,7 +41,7 @@ import asyncio from web3 import AsyncHTTPProvider, AsyncWeb3 # FastUpdater address (Songbird Testnet Coston) -FTSO_ADDRESS = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9" +ADDRESS = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9" RPC_URL = "https://rpc.ankr.com/flare_coston" # Feed indexes: 0 = FLR/USD, 2 = BTC/USD, 9 = ETH/USD FEED_INDEXES = [0, 2, 9] @@ -49,7 +53,7 @@ async def main() -> None: # Connect to an RPC node w3 = AsyncWeb3(AsyncHTTPProvider(RPC_URL)) # Set up contract instance - ftsov2 = w3.eth.contract(address=FTSO_ADDRESS, abi=ABI) + ftsov2 = w3.eth.contract(address=ADDRESS, abi=ABI) # Fetch current feeds feeds, decimals, timestamp = await ftsov2.functions.fetchCurrentFeeds( FEED_INDEXES @@ -90,7 +94,7 @@ This example shows two ways, one using [web3.js](https://github.com/web3/web3.js import { Web3 } from "web3"; // FastUpdater address (Songbird Testnet Coston) - const FTSO_ADDRESS = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9"; + const ADDRESS = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9"; const RPC_URL = "https://rpc.ankr.com/flare_coston"; // Feed indexes: 0 = FLR/USD, 2 = BTC/USD, 9 = ETH/USD const FEED_INDEXES = [0, 2, 9]; @@ -102,7 +106,7 @@ This example shows two ways, one using [web3.js](https://github.com/web3/web3.js // Connect to an RPC node const w3 = new Web3(RPC_URL); // Set up contract instance - const ftsov2 = new w3.eth.Contract(ABI, FTSO_ADDRESS); + const ftsov2 = new w3.eth.Contract(ABI, ADDRESS); // Fetch current feeds const res = await ftsov2.methods.fetchCurrentFeeds(FEED_INDEXES).call(); // Log results @@ -122,7 +126,7 @@ This example shows two ways, one using [web3.js](https://github.com/web3/web3.js import { ethers } from "ethers"; // FastUpdater address (Songbird Testnet Coston) - const FTSO_ADDRESS = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9"; + const ADDRESS = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9"; const RPC_URL = "https://rpc.ankr.com/flare_coston"; // Feed indexes: 0 = FLR/USD, 2 = BTC/USD, 9 = ETH/USD const FEED_INDEXES = [0, 2, 9]; @@ -134,7 +138,7 @@ This example shows two ways, one using [web3.js](https://github.com/web3/web3.js // Connect to an RPC node const provider = new ethers.JsonRpcProvider(RPC_URL); // Set up contract instance - const ftsov2 = new ethers.Contract(FTSO_ADDRESS, ABI, provider); + const ftsov2 = new ethers.Contract(ADDRESS, ABI, provider); // Fetch current feeds const res = await ftsov2.fetchCurrentFeeds(FEED_INDEXES); // Log results @@ -174,14 +178,14 @@ sol!( #[tokio::main] async fn main() -> Result<()> { // FastUpdater address (Songbird Testnet Coston) - let ftso_address = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9".parse()?; + let address = "0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9".parse()?; let rpc_url = "https://rpc.ankr.com/flare_coston".parse()?; // Feed indexes: 0 = FLR/USD, 2 = BTC/USD, 9 = ETH/USD let feed_indexes = vec![U256::from(0_u32), U256::from(2_u32), U256::from(9_u32)]; // Connect to an RPC node let provider = ProviderBuilder::new().on_http(rpc_url); // Set up contract instance - let ftsov2 = FtsoV2::new(ftso_address, provider); + let ftsov2 = FtsoV2::new(address, provider); // Fetch current feeds let FtsoV2::fetchCurrentFeedsReturn { _feeds, @@ -226,12 +230,12 @@ import ( func FtsoV2Consumer() { // FastUpdater address (Songbird Testnet Coston) - ftsoAddress := common.HexToAddress("0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9") + address := common.HexToAddress("0x9B931f5d3e24fc8C9064DB35bDc8FB4bE0E862f9") rpcUrl := "https://rpc.ankr.com/flare_coston" // Connect to an RPC node client, _ := ethclient.Dial(rpcUrl) // Set up contract instance - ftsov2, _ := NewFastUpdater(ftsoAddress, client) + ftsov2, _ := NewFastUpdater(address, client) // Feed indexes: 0 = FLR/USD, 2 = BTC/USD, 9 = ETH/USD feedIndexes := []*big.Int{big.NewInt(0), big.NewInt(2), big.NewInt(9)} // Fetch current feeds diff --git a/guides/2024-05-24-flare-for-go-developers.mdx b/guides/2024-05-24-flare-for-go-developers.mdx index 1bbe060f..958fee9a 100644 --- a/guides/2024-05-24-flare-for-go-developers.mdx +++ b/guides/2024-05-24-flare-for-go-developers.mdx @@ -125,7 +125,7 @@ abigen --abi FlareContractRegistry.abi --pkg main --type contract --out FlareCon ### Make query -You can query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. +You can now query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. For example, querying it for the address of the `WNat` contract: diff --git a/guides/2024-05-25-flare-for-javascript-developers.mdx b/guides/2024-05-25-flare-for-javascript-developers.mdx index 2ed28369..350ecbad 100644 --- a/guides/2024-05-25-flare-for-javascript-developers.mdx +++ b/guides/2024-05-25-flare-for-javascript-developers.mdx @@ -124,7 +124,7 @@ To fetch a contract's ABI programmatically, you can query the [Flare Blockchain ### Make query -Using this `abi` you can query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. +You can now query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. For example, querying it for the address of the `WNat` contract: diff --git a/guides/2024-05-26-flare-for-rust-developers.mdx b/guides/2024-05-26-flare-for-rust-developers.mdx index 64b3cfd5..3aeb6877 100644 --- a/guides/2024-05-26-flare-for-rust-developers.mdx +++ b/guides/2024-05-26-flare-for-rust-developers.mdx @@ -103,7 +103,7 @@ To fetch a contract's ABI, you can use Flarescan. Copy the **Contract ABI** from ### Make query -You can query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. +You can now query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. For example, querying it for the address of the `WNat` contract: diff --git a/guides/2024-05-27-flare-for-python-developers.mdx b/guides/2024-05-27-flare-for-python-developers.mdx index b899b686..d5bb4c11 100644 --- a/guides/2024-05-27-flare-for-python-developers.mdx +++ b/guides/2024-05-27-flare-for-python-developers.mdx @@ -160,7 +160,7 @@ To fetch a contract's ABI programmatically, you can query the [Flare Blockchain ### Make query -Using this `abi` you can query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. +You can now query the `FlareContractRegistry` contract to get the addresses of other Flare contracts. For example, querying it for the address of the `WNat` contract: