Curve Pools
Fetch 3pool at pool_address
0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7
.
Code
Rust
use futures::StreamExt;
use std::{collections::HashSet, sync::Arc};
use pangea_client::{
core::types::ChainId, query::Bound,
ClientBuilder, Format, WsProvider,
provider::CurveProvider, requests::curve::GetCrvPoolRequest,
};
#[tokio::main]
async fn main() {
dotenvy::dotenv_override().ok();
let client = match ClientBuilder::default()
.endpoint("app.pangea.foundation")
.build::<WsProvider>()
.await
{
Ok(client) => Arc::new(client),
Err(e) => {
eprintln!("Client failed to initialize:\n{e}");
return;
}
};
{
let request = GetCrvPoolRequest {
chains: HashSet::from([ChainId::ETH]),
from_block: Bound::Exact(0),
to_block: Bound::Latest,
pool_address__in: HashSet::from(["0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7"
.parse()
.unwrap()]),
..Default::default()
};
let stream = match client
.get_pools_by_format(request, Format::JsonStream, false)
.await
{
Ok(stream) => stream,
Err(e) => {
eprintln!("Request failed\n{e}");
return;
}
};
futures::pin_mut!(stream);
while let Some(chunk) = stream.next().await {
let chunk = String::from_utf8(chunk.unwrap()).unwrap();
println!("{chunk}");
}
}
}
Response
[
{
"chain": 1,
"owner": "0x6e8f6d1da6232d5e40b0b8758a0145d6c5123eb7",
"token": "0x6c3f90f043a72fa612cbac8115ee7e52bde6e490",
"token_decimals": 18,
"token_name": "Curve.fi DAI/USDC/USDT",
"token_symbol": "3Crv",
"base_pool": "",
"fee": "0x3d0900",
"admin_fee": "0x0",
"initial_a": "0x64",
"future_a": "0x64",
"initial_a_time": "0x0",
"future_a_time": "0x0",
"pool_address": "0xbebc44782c7db0a1a60cb6fe97d0b483032ff1c7",
"n_coins": 3,
"coin0": "0x6b175474e89094c44da98b954eedeac495271d0f",
"coin1": "0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",
"coin2": "0xdac17f958d2ee523a2206206994597c13d831ec7",
"coin3": null,
"coin4": null,
"coin5": null,
"coin0_decimals": 18,
"coin1_decimals": 6,
"coin2_decimals": 6,
"coin3_decimals": null,
"coin4_decimals": null,
"coin5_decimals": null,
"coin0_name": "Dai Stablecoin",
"coin1_name": "USD//C",
"coin2_name": "Tether USD",
"coin3_name": null,
"coin4_name": null,
"coin5_name": null,
"coin0_symbol": "DAI",
"coin1_symbol": "USDC",
"coin2_symbol": "USDT",
"coin3_symbol": null,
"coin4_symbol": null,
"coin5_symbol": null,
"base_coin0": null,
"base_coin1": null,
"base_coin2": null,
"base_coin3": null,
"base_coin4": null,
"base_coin5": null,
"base_coin0_decimals": null,
"base_coin1_decimals": null,
"base_coin2_decimals": null,
"base_coin3_decimals": null,
"base_coin4_decimals": null,
"base_coin5_decimals": null,
"base_coin0_name": null,
"base_coin1_name": null,
"base_coin2_name": null,
"base_coin3_name": null,
"base_coin4_name": null,
"base_coin5_name": null,
"base_coin0_symbol": null,
"base_coin1_symbol": null,
"base_coin2_symbol": null,
"base_coin3_symbol": null,
"base_coin4_symbol": null,
"base_coin5_symbol": null,
"underlying_coin0": null,
"underlying_coin1": null,
"underlying_coin2": null,
"underlying_coin3": null,
"underlying_coin4": null,
"underlying_coin5": null,
"underlying_coin0_decimals": null,
"underlying_coin1_decimals": null,
"underlying_coin2_decimals": null,
"underlying_coin3_decimals": null,
"underlying_coin4_decimals": null,
"underlying_coin5_decimals": null,
"underlying_coin0_name": null,
"underlying_coin1_name": null,
"underlying_coin2_name": null,
"underlying_coin3_name": null,
"underlying_coin4_name": null,
"underlying_coin5_name": null,
"underlying_coin0_symbol": null,
"underlying_coin1_symbol": null,
"underlying_coin2_symbol": null,
"underlying_coin3_symbol": null,
"underlying_coin4_symbol": null,
"underlying_coin5_symbol": null
}
]
Query Parameters
chains
: Filters the data by specific blockchain networks.from_block
: Filters the data by a starting block number.to_block
: Filters the data by an ending block number.pool_address__in
: Filters the data by a list ofpool_address
.token__in
: Filters the data by a list of Curve LPtoken
.owner__in
: Filters the data by a list of pool contractowner
.base_pool__in
: Filters metapools by thebase_pool
address.fee__gte
: Filters the data byfee
using the greater than or equal to operator.fee__lte
: Filters the data byfee
using the less than or equal to operator.admin_fee__gte
: Filters the data byadmin_fee
using the greater than or equal to operator.admin_fee__lte
: Filters the data byadmin_fee
using the less than or equal to operator.initial_a__gte
: Filters the data byinitial_a
using the greater than or equal to operator.initial_a__lte
: Filters the data byinitial_a
using the less than or equal to operator.future_a__gte
: Filters the data byfuture_a
using the greater than or equal to operator.future_a__lte
: Filters the data byfuture_a
using the less than or equal to operator.initial_a_time__gte
: Filters the data byinitial_a_time
using the greater than or equal to operator.initial_a_time__lte
: Filters the data byinitial_a_time
using the less than or equal to operator.future_a_time__gte
: Filters the data byfuture_a_time
using the greater than or equal to operator.future_a_time__lte
: Filters the data byfuture_a_time
using the less than or equal to operator.n_coins__gte
: Filters the data byn_coins
using the greater than or equal to operator.n_coins__lte
: Filters the data byn_coins
using the less than or equal to operator.coins__in
: Filters the data by a list ofcoins
.base_coins__in
: Filters metapools by a list ofbase_coins
.