Giter Club home page Giter Club logo

curve-api's People

Contributors

dependabot[bot] avatar philippe-git avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

curve-api's Issues

Pool fee parameters in pools apis

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

`currentCrvApy()` non-zero for Arbitrum pool reporting 0%

    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.

Add twocrypto-ng to curve-api

Twocrypto-ng was deployed across several chains where Curve exists.

Add twocrypto-ng to api so curve-js can fetch it.

Deployments:

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.

getAllGauges route fails sporadically

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

Rewards APY from curve pools not being returned

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.

swich the gauge factory address for bsc network on API

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

Image

Image

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

Factory pools not included in raw stats endpoint used by CMC

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

Deposit Zappers for Meta pools in API

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
...
}
{...}
}

sbtc2 not available in the api

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

Add new AddressProvider to the api

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

fetchFactoryPools() failing for Arbitrum

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)

Possible bug in getFactoGauges

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!

Stats not working on Polygon

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...

Incorrect pool type classification in polygon

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:

Image

but the pool contract is a plain pool:

Image

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.

dup pools across registry ids

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.