curvefi / curve-api Goto Github PK
View Code? Open in Web Editor NEWHome Page: https://api.curve.fi/v1/documentation
Home Page: https://api.curve.fi/v1/documentation
As an aggregator I could more conveniently and more precisely quote swaps if I had access to the fees of each pool in the api. That way I could adjust the output of get_dy/get_dy_underlying by the amount of the fees and quote curve swaps more precisely. Please let me know if you have other suggestions as well. Many thanks
No tricrypto pools shows up on API requests on Optimism
await curve.init('JsonRpc',
{ url: ARCHIVENODE_ARB },
{ chainId: 42161 }
);
const pool = curve.getPool("2pool");
console.log(await pool.currentCrvApy(pool.gauge));
console.log(await pool.stats.tokenApy()[0]);
both logs here report 167.2949435802717
as of the time of this post.
Curve UI reports that this pool is not streaming CRV rewards.
Hello,
I'm making an API call to https://api.curve.fi/api/getApys and its returning a 500.
Pool for crvusd <> CRV from api shows the following:
It shows the pool for BNT <> BAL
It should show 0x0BC03BC0bcc5A9498F06B041A54eE54DEaaEe2dE:
Twocrypto-ng was deployed across several chains where Curve exists.
Add twocrypto-ng to api so curve-js can fetch it.
arbitrum:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: 0x2005995a71243be9FB995DaB4742327dc76564Df.
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
aurora:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
avax:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
base:mainnet:
amm: '0x1A83348F9cCFD3Fe1A8C0adBa580Ac4e267Fe495'
factory: '0xc9Fe0C63Af9A39402e8a5514f9c43Af0322b665F'
math: '0x64379C265Fc6595065D7d835AAaa731c0584dB80'
views: '0xd3B17f862956464ae4403cCF829CE69199856e1e'
bsc:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
celo:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
ethereum:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
gauge: '0x38D9BdA812da2C68dFC6aDE85A7F7a54E77F8325'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
ethereum:sepolia:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
fraxtal:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
ftm:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
gnosis:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
kava:mainnet:
amm: '0x64379C265Fc6595065D7d835AAaa731c0584dB80'
factory: '0xd3B17f862956464ae4403cCF829CE69199856e1e'
math: '0x7Ca46A636b02D4aBC66883D7FF164bDE506DC66a'
views: '0x0C9D8c7e486e822C29488Ff51BFf0167B4650953'
linea:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
mantle:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
optimism:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
polygon:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
pzkevm:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
scroll:mainnet:
amm: '0x04Fd6beC7D45EFA99a27D29FB94b55c56dD07223'
factory: '0x98EE851a00abeE0d95D08cF4CA2BdCE32aeaAF7F'
math: '0x2005995a71243be9FB995DaB4742327dc76564Df'
views: '0x07CdEBF81977E111B08C126DEFA07818d0045b80'
Most addresses are similar by design (create2 deployed with deterministic addresses).
There is only one implementation, but the factory does support adding implementations.
The factory smart contract stores the implementation addresses in the pool array.
The endpoint: https://api.curve.fi/api/getApys currently isn't showing mim
rewards (https://curve.fi/mim).
I've updated some code to retrieve it locally and can push a PR if required.
In the API response factory crypto-v2 pools are not available, for example these 2 pools are not there:
https://curve.fi/#/polygon/pools/factory-crypto-1
https://curve.fi/#/polygon/pools/factory-crypto-13
I've tried both endpoints:
https://api.curve.fi/api/getPools/polygon/crypto
https://api.curve.fi/api/getPools/polygon/factory
when requesting the API for all gauges I'm seeing some sporadic error responses with success:false
I'm running this on a timer every 10 minutes and 2/10 calls are failing:
curl -H 'Content-Type: application/json' 'https://api.curve.fi/api/getAllGauges?blockchainId=ethereum'
{
"success":false,
"err":"Error: Returned values aren't valid, did it run Out of Gas? You might also see this error if you are not using the correct ABI for the contract you are retrieving data from, requesting data from a block number that does not exist, or querying a node which is not fully synced."
}
I've checked the status page for the getAllGauges
route but it says it was up 100% in the last 24 hours ๐
https://statuspage.freshping.io/59335-CurveAPI/check/735107?timefilter=24
stable-ng api https://api.curve.fi/api/getPools/bsc/factory-stable-ng and twocrypto-ng api https://api.curve.fi/api/getPools/bsc/factory-twocrypto missing already deployed gauges on BSC
child gauge factory https://bscscan.com/address/0xabC000d88f23Bb45525E447528DBF656A9D55bf5
for example:
gauge address for the above pool (crvUSD/USDT) https://bscscan.com/address/0x9721422419E9e952339386D581FCE3413b3f1111
Concerning this endpoint (https://github.com/curvefi/curve-api/blob/main/endpoints.md#getapys), I am trying to get the rewards displayed for the 3pool on curve.fi:
My response from the above endpoint regarding the 3pool is:
"3pool": {
"baseApy": "0.37",
"crvApy": 2.371707765313973,
"crvBoost": 1,
"additionalRewards": [],
"crvPrice": 2.56
}
What I am also looking for is the rewards APY displayed on curve.fi/pools, which for the 3pool are currently 2.39% -> 5.98% CRV.
swicth the child gauge factory on API on BSC network from the old https://bscscan.com/address/0xabC000d88f23Bb45525E447528DBF656A9D55bf5
to the new child gauge factory
https://bscscan.com/address/0xDb205f215f568ADf21b9573b62566f6d9a40bed6#code
the child gauge factory 0xabc000 replaced with a new one on BSC network, currently API it pull gauges from the old..with a result UI pointing out the old gauges.
an example with the following pool (crvUSD/USDT) https://curve.fi/#/bsc/pools/factory-stable-ng-10/deposit
old gauge address (deployed through the old gauge factory): https://bscscan.com/address/0x9721422419e9e952339386d581fce3413b3f1111
and the new gauge address for this pool (deployed through the new gauge factory) : https://bscscan.com/address/0x6c816d6Ed4b2B77e121aD7951841A7D0711561b3
The endpoint https://api.curve.fi/api/getAllPoolsVolume/kava is not working
Error:
{
"success": false,
"err": "TypeError: Cannot read properties of undefined (reading 'totalVolume')"
}
CoinMarketCap are pulling data from the raw-stats feed which doesn't include any of the data from the new factory pools. This is leading to lots of trading volume going unreported.
https://stats.curve.fi/raw-stats/%s-5m.json
CMC have already been given alternative endpoints they can use to get this data (see below), but they haven't gotten around to updating their code. It might be easier to just fix raw-stats than get CMC to update their code.
https://api.curve.fi/api/getAllPoolsVolume/ethereum
https://api.curve.fi/api/getFactoryAPYs?version=2
Hello!
I noticed that CurveStableSwapNG
pools started popping up in Ethereum. EG: https://dao.curve.fi/vote/ownership/483
Can you add support to them in the API? Not sure if these type of pools will be listed under a different endpoint ๐คท
Thanks โค๏ธ
As an aggregator, I'd like to be able to pull the deposit zapper address for meta pools. Currently, we consume this info from https://github.com/curvefi/curve-api/blob/main/constants/pools/pools.js but we'd ideally consume it from the api. For example:
/api/getPools/ethereum/main
{
{...}
{
"id": "22",
"address": "0x8474DdbE98F5aA3179B3B3F5942D724aFcdec9f6",
"name": "Curve.fi MUSD/3Crv",
"lpTokenAddress": "0x1AEf73d49Dedc4b1778d0706583995958Dc862e6",
"depositZapper": "0x803A2B40c5a9BB2B86DD630B274Fa2A9202874C2", <=== New
...
}
{...}
}
https://curve.fi/#/ethereum/pools/sbtc2/deposit
pool: 0xf253f83aca21aabd2a20553ae0bf7f65c755a07f
is not available in any of the ethereum's getPools
endpoints:
"https://api.curve.fi/api/getPools/ethereum/main",
"https://api.curve.fi/api/getPools/ethereum/crypto",
"https://api.curve.fi/api/getPools/ethereum/factory",
"https://api.curve.fi/api/getPools/ethereum/factory-crypto",
Not sure if the bug is related to #272
Contract deployed at: 0x5ffe7FB82894076ECB99A30D6A32e969e6e35E98 on the following networks:
Ethereum, Arbitrum, Optimism, Base, Bsc, Polygon, Fantom, Gnosis, Aurora, Celo, Mantle, Linea, Polygon zkEVM, Scroll, Fraxtal, Avalanche, Kava
https://staging.curve.fi/#/xdai/pools/factory-stable-ng-3/deposit
whereas it is actually nonzero. turns out the shares grow once every three days ...
await curve.init('JsonRpc',
{ url: $RPC_URL_ARBITRUM },
{ chainId: 42161 }
);
await curve.fetchFactoryPools();
Was working, now returns:
/home/project/node_modules/@ethersproject/abi/src.ts/interface.ts:100
defineReadOnly(this, "fragments", abi.map((fragment) => {
^
TypeError: Cannot read properties of undefined (reading 'map')
at new Interface (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@ethersproject/abi/src.ts/interface.ts:100:47)
at BaseContract.getInterface (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@ethersproject/contracts/src.ts/index.ts:820:16)
at Contract.BaseContract (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@ethersproject/contracts/src.ts/index.ts:662:95)
at new Contract (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@ethersproject/contracts/lib/index.js:1053:42)
at /home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@curvefi/api/lib/factory/factory-api.js:90:27
at Array.forEach (<anonymous>)
at Curve.setFactorySwapContracts (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@curvefi/api/lib/factory/factory-api.js:87:21)
at Curve.<anonymous> (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@curvefi/api/lib/factory/factory-api.js:162:45)
at step (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@curvefi/api/lib/factory/factory-api.js:44:23)
at Object.next (/home/riordant/Repositories/Orgs/Spool/test/SpoolAnalytics/node_modules/@curvefi/api/lib/factory/factory-api.js:25:53)
Hi guys!
How can I find the testnet api for polygon? thank you!
for consistency across registries, zapAddress
- 0xA79828DF1850E8a3A3064576f380D90aECDD3359 - should be added to USD metapools in the factory stable ng registry.
When inflation_rate is 0 on a sidechain child gauge, getFactoGauges/[blockchainId].js (lines 116-130) tries to determine an effective inflation rate using total_emissions on the root gauge. However, it looks like total_emissions is a cumulative number, which would make the calculation incorrect. One downstream effect of this is that getPools returns a very high gaugeCrvApy for sidechain child gauges whose inflation_rate is 0.
Example: The Curve front end for the fxETH pool reports 0% CRV APR, but the getPools API reports a gaugeCrvApy of 6700.
I'm not sure what the right fix is for effective inflation rate, but if you can provide some guidance I am willing to work on it and submit a PR. Thanks!
https://curve.fi/#/ethereum/pools/factory-tricrypto-0
https://curve.fi/#/ethereum/pools/factory-tricrypto-1
The new pools are not included in any of the sections of the getPools API call.
Originally posted here:
curvefi/curve-contract-polygon#24
The statistics page isn't working for me on Polygon. Lots of 403 errors for various page callbacks with XML indicating bad permissions and wrong tokens:
<?xml version="1.0" encoding="UTF-8"?>
<Error><Code>AccessDenied</Code><Message>Access Denied</Message><RequestId>QCQPAXWGVKWS193T</RequestId><HostId>N9VT24O6IyQiZaX9IDCz1dCdnMw14bUU/te20q6SAtYDnxRPsjadExIlI6Yn/d2utM8dt3UIDvk=</HostId></Error>
I assume this is supported as there is a link to stats under the hamburger menu once you click into a pool...
From Kyberswap folks:
It seems that the offchain API is wrongly classifying this pool as a Meta pool, while it's just a Plain pool: https://curve.fi/#/polygon/pools/factory-v2-45/swap
So on the UI it allows swapping from AMIS to USDC/USDT but will get error when trying to calculate exchange rate (because it's just a Plain pool with 2 coins AMIS and am3CRV)
Could you please check that pool? (there are many other pools on other chains that get wrongly classified, it seems that they have 1 thing in common: one of their coins is the LP token of another Curve pool)
Upon checking this pool, it does look like a metapool:
but the pool contract is a plain pool:
We need to classify pools based on the contract type. So in this case, we'd want to classify this pool as a plain pool. To check if a pool is a metapool or not, one can look for an exchange_underlying
method perhaps. for NG, this should be simpler because it's metapools have a base_pool
public getter.
Suggestion: maybe we can add a field whether the token is an LP token or not? so it would be useful for integrators? Then they'd know which pool that token belongs to, if it was a plain pool (or even a crypto pool) with an LP token in it.
when I try to access data from "getAPYs" from "https://api.curve.fi/api/getApys", I receive the following response:
{"success":false,"err":"Error: Returned error: execution reverted"}
The following pools show up in the main registry, when I believe they should only be showing up under the factory
registry id
'0xEd279fDD11cA84bEef15AF5D39BB4d4bEE23F0cA': [main, factory]
'0xd632f22692FaC7611d2AA1C0D552930D43CAEd3B': [main, factory]
'0x43b4FdFD4Ff969587185cDB6f0BD875c5Fc83f8c': [main, factory]
'0x5a6A4D54456819380173272A5E8E9B9904BdF41B': [main, factory]
'0xFD5dB7463a3aB53fD211b4af195c5BCCC1A03890': [main, factory]
https://api.curve.fi/api/getPools/ethereum/main
https://api.curve.fi/api/getPools/ethereum/factory
The pools below show up under the main
registry id, when they should be under the factory
registry id.
0xEcd5e75AFb02eFa118AF914515D6521aaBd189F1
0x4807862AA8b2bF68830e4C8dc86D0e9A998e085a
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.