From 097feed26319b8dab74ca14df9e2b9c5ec46bde3 Mon Sep 17 00:00:00 2001 From: William Liu Date: Mon, 9 Oct 2023 14:36:58 +0000 Subject: [PATCH 1/2] feat: add gamma and camelot farms --- data/mainnet/addresses.json | 62 +++++ data/mainnet/pools.js | 239 ++++++++++++++++++ data/mainnet/tokens.js | 239 +++++++++++++++++- src/lib/constants.js | 2 +- src/lib/third-party/camelot.js | 10 +- src/prices/implementations/quickswap-gamma.js | 4 +- .../apys/implementations/quickswap-gamma.js | 2 +- .../trading-apys/implementations/camelot.js | 7 +- .../implementations/quickswap-gamma.js | 2 +- 9 files changed, 549 insertions(+), 18 deletions(-) diff --git a/data/mainnet/addresses.json b/data/mainnet/addresses.json index 4091bc46..1a4e65f6 100644 --- a/data/mainnet/addresses.json +++ b/data/mainnet/addresses.json @@ -1531,6 +1531,41 @@ "NewPool": "0xFcC9682E08E3B001e9516683cbAAf573aFFc6415", "MasterChef": "0x20ec0d06f447d550fc6edee42121bc8c1817b97d" }, + "quickGamma_USDC_DAI": { + "Underlying": "0x9E31214Db6931727B7d63a0D2b6236DB455c0965", + "NewVault": "0xFDAf1446978F4c221d29967143d5d0Cdf342bb25", + "NewStrategy": "0x4976E487Bc36f5dCc1AB2048EA299dE16F6c61c5", + "NewPool": "0x7Cd65Fe0d765Ade3d36bf47FCEDf815fBE675200", + "MasterChef": "0x20ec0d06f447d550fc6edee42121bc8c1817b97d" + }, + "quickGamma_USDC_USDT": { + "Underlying": "0x795f8c9B0A0Da9Cd8dea65Fc10f9B57AbC532E58", + "NewVault": "0x261923287De9f91b855406DFC6F30FEe4A5825fa", + "NewStrategy": "0x7ca8D398C08f06D55C062F78E3ed8F32Fef15530", + "NewPool": "0xcB78B76238B19EF54733fD3Ec0f7172B27911BFF", + "MasterChef": "0x20ec0d06f447d550fc6edee42121bc8c1817b97d" + }, + "quickGamma_WBTC_ETH_narrow": { + "Underlying": "0x4B9e26a02121a1C541403a611b542965Bd4b68Ce", + "NewVault": "0x43483723c6b1A8d24a9DbaEEbce02b48adE78951", + "NewStrategy": "0x0A4Cd298782Aa6115d61e2D89905A49942Ec3A11", + "NewPool": "0x6f73274dF7BDfAFB57A47735Da9A51728daBDC38", + "MasterChef": "0x20ec0d06f447d550fc6edee42121bc8c1817b97d" + }, + "quickGamma_WBTC_USDC_narrow": { + "Underlying": "0x3f35705479d9d77c619b2aAC9dd7a64e57151506", + "NewVault": "0xdB16a05C8B58D7385bC6fe4d9D5e6E1f261cdF46", + "NewStrategy": "0x6639C4e591BCeC23BDc56e6e265ddc3ce1B58814", + "NewPool": "0xb3117DD0aE35Ba2Bf4E1f1b21f3016E8b9fB0c11", + "MasterChef": "0x20ec0d06f447d550fc6edee42121bc8c1817b97d" + }, + "quickGamma_wstETH_ETH": { + "Underlying": "0x6A6d4d17c2E38D076264081676FfCDDDF32C9715", + "NewVault": "0x466506EB97bDdF4B4b2B50979E251bF92FB26799", + "NewStrategy": "0x4800A07DcbA4d5D85adcf6B95Ea8464A8F380368", + "NewPool": "0x1B60B0bE815C317B166b003EAa755be23f4788a9", + "MasterChef": "0x20ec0d06f447d550fc6edee42121bc8c1817b97d" + }, "curve_3CRV": { "Underlying": "0xE7a24EF0C5e95Ffb0f6684b813A78F2a3AD7D171", "Miner": "0x445FE580eF8d70FF569aB36e80c647af338db351", @@ -1956,6 +1991,33 @@ "NFTPool": "0x1e527Dc9B55DD46DE058239ff33907a5b6E396D1", "NitroPool": "0x7F2a4E30bC0c9eB68CC3644516bA2c4b4b481F1c" }, + "camelotV3_ETH_USDC": { + "Underlying": "0xd7Ef5Ac7fd4AAA7994F3bc1D273eAb1d1013530E", + "NewVault": "0x7f7e98E5FA2ef1dE3b747b55dd81f73960Ce92C2", + "NewStrategy": "0xc083eC7b899a206b312664BEE4a5BD7c85111476", + "NewPool": "0x5f0AB004Ab2a3c35461e0E5Ce89839DA22B2E598", + "NFTPool": "0x3b6486154b9dAe942C393b1cB3d11E3395B02Df8", + "NitroPool": "0", + "AlgebraPool": "0xB1026b8e7276e7AC75410F1fcbbe21796e8f7526" + }, + "camelotV3_ETH_USDT": { + "Underlying": "0x9330e26b5Fc0b7c417C6bD901528d5c65BE5cdf2", + "NewVault": "0x6aDEBe9a4c8dF4E6BFd09263Ab7e2EdF67288763", + "NewStrategy": "0xD69D52eF854F1F6F93949a290F121203257b0BfE", + "NewPool": "0x7e4d7C473d090ff0C70ee41A50116e0b7463EB46", + "NFTPool": "0xF42884071fFe17Bdd7d1710C31191023419e0CA7", + "NitroPool": "0", + "AlgebraPool": "0x7CcCBA38E2D959fe135e79AEBB57CCb27B128358" + }, + "camelotV3_ARB_USDC": { + "Underlying": "0x29237292F15BC3615BFCc0D958C265Aa64527FB2", + "NewVault": "0xc2eEE8782B74289774Fe08DA85292fFD22198925", + "NewStrategy": "0x3725DCa77a10b4ed9F25A8974565516f18A44891", + "NewPool": "0x39bC1a41e9b77De48bb1D6cBDb5E36635c4c28b9", + "NFTPool": "0x14AD01d5f496e9C40358629f6a95a7C3B5c4b767", + "NitroPool": "0", + "AlgebraPool": "0xfaE2AE0a9f87FD35b5b0E24B47BAC796A7EEfEa1" + }, "xGRAIL": { "Underlying": "0x3CAaE25Ee616f2C8E13C74dA0813402eae3F496b", "NewVault": "0xFA10759780304c2B8d34B051C039899dFBbcad7f", diff --git a/data/mainnet/pools.js b/data/mainnet/pools.js index 8b7b0467..f64f8c96 100644 --- a/data/mainnet/pools.js +++ b/data/mainnet/pools.js @@ -4,6 +4,245 @@ const addresses = require('./addresses.json') const strat15PercentFactor = '0.85' module.exports = [ + { + chain: CHAIN_IDS.ARBITRUM_ONE, + id: 'camelotV3_ARB_USDC', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.CAMELOT, + params: [addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.AlgebraPool, true], + }, + contractAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.NewPool, + collateralAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.ARBITRUM_ONE.iFARM], + rewardTokenSymbols: ['iFARM', 'fxGRAIL'], + stakeAndDepositHelpMessage: ` +
+

The vault deposits + Camelot LP tokens in to a Camelot farm, earning + GRAIL, + xGRAIL. + At every harvest, the earned GRAIL is reinvested into more + Camelot LP tokens. The earned xGRAIL is deposited in to + fxGRAIL where it is earning auto-compounding xGRAIL rewards. The fxGRAIL rewards can be claimed with the "Claim All" button. +

+

Get the + Camelot LP tokens by supplying liquidity on + Camelot, using V3 and the "Liquidity Only" option. +

+
+ `, + }, + { + chain: CHAIN_IDS.ARBITRUM_ONE, + id: 'camelotV3_ETH_USDT', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.CAMELOT, + params: [addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.AlgebraPool, true], + }, + contractAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.NewPool, + collateralAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.ARBITRUM_ONE.iFARM], + rewardTokenSymbols: ['iFARM', 'fxGRAIL'], + stakeAndDepositHelpMessage: ` +
+

The vault deposits + Camelot LP tokens in to a Camelot farm, earning + GRAIL, + xGRAIL. + At every harvest, the earned GRAIL is reinvested into more + Camelot LP tokens. The earned xGRAIL is deposited in to + fxGRAIL where it is earning auto-compounding xGRAIL rewards. The fxGRAIL rewards can be claimed with the "Claim All" button. +

+

Get the + Camelot LP tokens by supplying liquidity on + Camelot, using V3 and the "Liquidity Only" option. +

+
+ `, + }, + { + chain: CHAIN_IDS.ARBITRUM_ONE, + id: 'camelotV3_ETH_USDC', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.CAMELOT, + params: [addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.AlgebraPool, true], + }, + contractAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.NewPool, + collateralAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.ARBITRUM_ONE.iFARM], + rewardTokenSymbols: ['iFARM', 'fxGRAIL'], + stakeAndDepositHelpMessage: ` +
+

The vault deposits + Camelot LP tokens in to a Camelot farm, earning + GRAIL, + xGRAIL. + At every harvest, the earned GRAIL is reinvested into more + Camelot LP tokens. The earned xGRAIL is deposited in to + fxGRAIL where it is earning auto-compounding xGRAIL rewards. The fxGRAIL rewards can be claimed with the "Claim All" button. +

+

Get the + Camelot LP tokens by supplying liquidity on + Camelot, using V3 and the "Liquidity Only" option. +

+
+ `, + }, + { + chain: CHAIN_IDS.POLYGON_MAINNET, + id: 'quickGamma_wstETH_ETH', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_wstETH_ETH.Underlying], + }, + contractAddress: addresses.MATIC.V2.quickGamma_wstETH_ETH.NewPool, + collateralAddress: addresses.MATIC.V2.quickGamma_wstETH_ETH.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.MATIC.miFARM], + rewardTokenSymbols: ['iFARM'], + stakeAndDepositHelpMessage: ` +
+

The vault supplies + Gamma LP tokens in a Quickswap farm, earning + dQUICK. + At every harvest, the earned rewards are reinvested into more + Gamma LP tokens. +

+

Get the + Gamma LP tokens by supplying liquidity on + Gamma. +

+
+ `, + }, + { + chain: CHAIN_IDS.POLYGON_MAINNET, + id: 'quickGamma_WBTC_USDC_narrow', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.Underlying], + }, + contractAddress: addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.NewPool, + collateralAddress: addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.MATIC.miFARM], + rewardTokenSymbols: ['iFARM'], + stakeAndDepositHelpMessage: ` +
+

The vault supplies + Gamma LP tokens in a Quickswap farm, earning + dQUICK. + At every harvest, the earned rewards are reinvested into more + Gamma LP tokens. +

+

Get the + Gamma LP tokens by supplying liquidity on + Gamma. +

+
+ `, + }, + { + chain: CHAIN_IDS.POLYGON_MAINNET, + id: 'quickGamma_WBTC_ETH_narrow', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.Underlying], + }, + contractAddress: addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.NewPool, + collateralAddress: addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.MATIC.miFARM], + rewardTokenSymbols: ['iFARM'], + stakeAndDepositHelpMessage: ` +
+

The vault supplies + Gamma LP tokens in a Quickswap farm, earning + dQUICK. + At every harvest, the earned rewards are reinvested into more + Gamma LP tokens. +

+

Get the + Gamma LP tokens by supplying liquidity on + Gamma. +

+
+ `, + }, + { + chain: CHAIN_IDS.POLYGON_MAINNET, + id: 'quickGamma_USDC_USDT', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_USDC_USDT.Underlying], + }, + contractAddress: addresses.MATIC.V2.quickGamma_USDC_USDT.NewPool, + collateralAddress: addresses.MATIC.V2.quickGamma_USDC_USDT.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.MATIC.miFARM], + rewardTokenSymbols: ['iFARM'], + stakeAndDepositHelpMessage: ` +
+

The vault supplies + Gamma LP tokens in a Quickswap farm, earning + dQUICK & + WMATIC. + At every harvest, the earned rewards are reinvested into more + Gamma LP tokens. +

+

Get the + Gamma LP tokens by supplying liquidity on + Gamma. +

+
+ `, + }, + { + chain: CHAIN_IDS.POLYGON_MAINNET, + id: 'quickGamma_USDC_DAI', + type: POOL_TYPES.INCENTIVE, + tradingApyFunction: { + type: TRADING_APY_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_USDC_DAI.Underlying], + }, + contractAddress: addresses.MATIC.V2.quickGamma_USDC_DAI.NewPool, + collateralAddress: addresses.MATIC.V2.quickGamma_USDC_DAI.NewVault, + rewardAPY: [], + rewardAPR: null, + rewardTokens: [addresses.MATIC.miFARM], + rewardTokenSymbols: ['iFARM'], + stakeAndDepositHelpMessage: ` +
+

The vault supplies + Gamma LP tokens in a Quickswap farm, earning + dQUICK. + At every harvest, the earned rewards are reinvested into more + Gamma LP tokens. +

+

Get the + Gamma LP tokens by supplying liquidity on + Gamma. +

+
+ `, + }, { chain: CHAIN_IDS.POLYGON_MAINNET, id: 'pearl_STAR_USDR', diff --git a/data/mainnet/tokens.js b/data/mainnet/tokens.js index 27f23c36..4379dd7b 100644 --- a/data/mainnet/tokens.js +++ b/data/mainnet/tokens.js @@ -52,6 +52,233 @@ module.exports = { ], cmcRewardTokenSymbols: ['FARM', 'WETH'], }, + camelotV3_ARB_USDC: { + chain: CHAIN_IDS.ARBITRUM_ONE, + logoUrl: ['./icons/arb.svg', './icons/usdc.svg'], + apyIconUrls: ['./icons/grail.svg', './icons/xgrail.svg'], + apyTokenSymbols: ['GRAIL', 'xGRAIL'], + tokenNames: ['ARB', 'USDC'], + platform: ['Camelot-V3'], + tags: ['Advanced'], + tokenAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.Underlying, + decimals: '18', + vaultAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.Underlying, 'camelot/arbitrum'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.CAMELOT_LP, + params: [ + addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.NewStrategy, + addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.NFTPool, + addresses.ARBITRUM_ONE.V2.camelotV3_ARB_USDC.NitroPool, + profitSharingCut10Percent, + ], + extraDailyCompound: false, + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'GRAIL', 'xGRAIL'], + }, + camelotV3_ETH_USDT: { + chain: CHAIN_IDS.ARBITRUM_ONE, + logoUrl: ['./icons/eth.svg', './icons/usdt.svg'], + apyIconUrls: ['./icons/grail.svg', './icons/xgrail.svg'], + apyTokenSymbols: ['GRAIL', 'xGRAIL'], + tokenNames: ['ETH', 'USDT'], + platform: ['Camelot-V3'], + tags: ['Advanced'], + tokenAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.Underlying, + decimals: '18', + vaultAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.Underlying, 'camelot/arbitrum'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.CAMELOT_LP, + params: [ + addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.NewStrategy, + addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.NFTPool, + addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDT.NitroPool, + profitSharingCut10Percent, + ], + extraDailyCompound: false, + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'GRAIL', 'xGRAIL'], + }, + camelotV3_ETH_USDC: { + chain: CHAIN_IDS.ARBITRUM_ONE, + logoUrl: ['./icons/eth.svg', './icons/usdc.svg'], + apyIconUrls: ['./icons/grail.svg', './icons/xgrail.svg'], + apyTokenSymbols: ['GRAIL', 'xGRAIL'], + tokenNames: ['ETH', 'USDC'], + platform: ['Camelot-V3'], + tags: ['Advanced'], + tokenAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.Underlying, + decimals: '18', + vaultAddress: addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.Underlying, 'camelot/arbitrum'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.CAMELOT_LP, + params: [ + addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.NewStrategy, + addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.NFTPool, + addresses.ARBITRUM_ONE.V2.camelotV3_ETH_USDC.NitroPool, + profitSharingCut10Percent, + ], + extraDailyCompound: false, + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'GRAIL', 'xGRAIL'], + }, + quickGamma_wstETH_ETH: { + chain: CHAIN_IDS.POLYGON_MAINNET, + logoUrl: ['./icons/wsteth.svg', './icons/eth.svg'], + apyIconUrls: ['./icons/quick.svg'], + apyTokenSymbols: ['dQUICK'], + subLabel: 'Pegged Price', + tokenNames: ['WSTETH', 'ETH'], + platform: ['Quickswap', 'Gamma'], + tags: ['Advanced'], + tokenAddress: addresses.MATIC.V2.quickGamma_wstETH_ETH.Underlying, + decimals: '18', + vaultAddress: addresses.MATIC.V2.quickGamma_wstETH_ETH.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_wstETH_ETH.Underlying, 'quickswap/polygon'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.QUICKSWAP_GAMMA, + params: [ + addresses.MATIC.V2.quickGamma_wstETH_ETH.MasterChef, + addresses.MATIC.V2.quickGamma_wstETH_ETH.Underlying, + profitSharingCut8Percent, + ], + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'dQUICK'], + }, + quickGamma_WBTC_USDC_narrow: { + chain: CHAIN_IDS.POLYGON_MAINNET, + logoUrl: ['./icons/wbtc.svg', './icons/usdc.svg'], + apyIconUrls: ['./icons/quick.svg'], + apyTokenSymbols: ['dQUICK'], + subLabel: 'Narrow', + tokenNames: ['WBTC', 'USDC'], + platform: ['Quickswap', 'Gamma'], + tags: ['Advanced'], + tokenAddress: addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.Underlying, + decimals: '18', + vaultAddress: addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.Underlying, 'quickswap/polygon'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.QUICKSWAP_GAMMA, + params: [ + addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.MasterChef, + addresses.MATIC.V2.quickGamma_WBTC_USDC_narrow.Underlying, + profitSharingCut8Percent, + ], + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'dQUICK'], + }, + quickGamma_WBTC_ETH_narrow: { + chain: CHAIN_IDS.POLYGON_MAINNET, + logoUrl: ['./icons/wbtc.svg', './icons/eth.svg'], + apyIconUrls: ['./icons/quick.svg'], + apyTokenSymbols: ['dQUICK'], + subLabel: 'Narrow', + tokenNames: ['WBTC', 'ETH'], + platform: ['Quickswap', 'Gamma'], + tags: ['Advanced'], + tokenAddress: addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.Underlying, + decimals: '18', + vaultAddress: addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.Underlying, 'quickswap/polygon'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.QUICKSWAP_GAMMA, + params: [ + addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.MasterChef, + addresses.MATIC.V2.quickGamma_WBTC_ETH_narrow.Underlying, + profitSharingCut8Percent, + ], + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'dQUICK'], + }, + quickGamma_USDC_USDT: { + chain: CHAIN_IDS.POLYGON_MAINNET, + logoUrl: ['./icons/usdc.svg', './icons/usdt.svg'], + apyIconUrls: ['./icons/quick.svg', './icons/matic.svg'], + apyTokenSymbols: ['dQUICK', 'WMATIC'], + subLabel: 'Stable', + tokenNames: ['USDC', 'USDT'], + platform: ['Quickswap', 'Gamma'], + tags: ['Stable'], + tokenAddress: addresses.MATIC.V2.quickGamma_USDC_USDT.Underlying, + decimals: '18', + vaultAddress: addresses.MATIC.V2.quickGamma_USDC_USDT.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_USDC_USDT.Underlying, 'quickswap/polygon'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.QUICKSWAP_GAMMA, + params: [ + addresses.MATIC.V2.quickGamma_USDC_USDT.MasterChef, + addresses.MATIC.V2.quickGamma_USDC_USDT.Underlying, + profitSharingCut8Percent, + ], + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'dQUICK', 'WMATIC'], + }, + quickGamma_USDC_DAI: { + chain: CHAIN_IDS.POLYGON_MAINNET, + logoUrl: ['./icons/usdc.svg', './icons/dai.svg'], + apyIconUrls: ['./icons/quick.svg'], + apyTokenSymbols: ['dQUICK'], + subLabel: 'Stable', + tokenNames: ['USDC', 'DAI'], + platform: ['Quickswap', 'Gamma'], + tags: ['Stable'], + tokenAddress: addresses.MATIC.V2.quickGamma_USDC_DAI.Underlying, + decimals: '18', + vaultAddress: addresses.MATIC.V2.quickGamma_USDC_DAI.NewVault, + priceFunction: { + type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, + params: [addresses.MATIC.V2.quickGamma_USDC_DAI.Underlying, 'quickswap/polygon'], + }, + estimateApyFunctions: [ + { + type: ESTIMATED_APY_TYPES.QUICKSWAP_GAMMA, + params: [ + addresses.MATIC.V2.quickGamma_USDC_DAI.MasterChef, + addresses.MATIC.V2.quickGamma_USDC_DAI.Underlying, + profitSharingCut8Percent, + ], + }, + ], + cmcRewardTokenSymbols: ['iFARM', 'dQUICK'], + }, axlWBTC: { chain: CHAIN_IDS.BASE, logoUrl: ['./icons/axlwbtc.svg'], @@ -4247,7 +4474,7 @@ module.exports = { vaultAddress: addresses.MATIC.V2.quickGamma_MATIC_ETH_narrow.NewVault, priceFunction: { type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, - params: [addresses.MATIC.V2.quickGamma_MATIC_ETH_narrow.Underlying], + params: [addresses.MATIC.V2.quickGamma_MATIC_ETH_narrow.Underlying, 'quickswap/polygon'], }, estimateApyFunctions: [ { @@ -4275,7 +4502,7 @@ module.exports = { vaultAddress: addresses.MATIC.V2.quickGamma_MATIC_ETH_wide.NewVault, priceFunction: { type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, - params: [addresses.MATIC.V2.quickGamma_MATIC_ETH_wide.Underlying], + params: [addresses.MATIC.V2.quickGamma_MATIC_ETH_wide.Underlying, 'quickswap/polygon'], }, estimateApyFunctions: [ { @@ -4303,7 +4530,7 @@ module.exports = { vaultAddress: addresses.MATIC.V2.quickGamma_MATIC_USDC_narrow.NewVault, priceFunction: { type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, - params: [addresses.MATIC.V2.quickGamma_MATIC_USDC_narrow.Underlying], + params: [addresses.MATIC.V2.quickGamma_MATIC_USDC_narrow.Underlying, 'quickswap/polygon'], }, estimateApyFunctions: [ { @@ -4331,7 +4558,7 @@ module.exports = { vaultAddress: addresses.MATIC.V2.quickGamma_MATIC_USDC_wide.NewVault, priceFunction: { type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, - params: [addresses.MATIC.V2.quickGamma_MATIC_USDC_wide.Underlying], + params: [addresses.MATIC.V2.quickGamma_MATIC_USDC_wide.Underlying, 'quickswap/polygon'], }, estimateApyFunctions: [ { @@ -4359,7 +4586,7 @@ module.exports = { vaultAddress: addresses.MATIC.V2.quickGamma_USDC_ETH_narrow.NewVault, priceFunction: { type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, - params: [addresses.MATIC.V2.quickGamma_USDC_ETH_narrow.Underlying], + params: [addresses.MATIC.V2.quickGamma_USDC_ETH_narrow.Underlying, 'quickswap/polygon'], }, estimateApyFunctions: [ { @@ -4387,7 +4614,7 @@ module.exports = { vaultAddress: addresses.MATIC.V2.quickGamma_USDC_ETH_wide.NewVault, priceFunction: { type: GET_PRICE_TYPES.QUICKSWAP_GAMMA, - params: [addresses.MATIC.V2.quickGamma_USDC_ETH_wide.Underlying], + params: [addresses.MATIC.V2.quickGamma_USDC_ETH_wide.Underlying, 'quickswap/polygon'], }, estimateApyFunctions: [ { diff --git a/src/lib/constants.js b/src/lib/constants.js index 1ae77420..3ae5136b 100644 --- a/src/lib/constants.js +++ b/src/lib/constants.js @@ -211,7 +211,7 @@ const DEXSCREENER_API_URL = 'https://api.dexscreener.com/latest/dex/tokens' const CURVE_FINANCE_API_URL = 'https://api.curve.fi/api' -const QUICKSWAP_GAMMA_ENDPOINT = 'https://wire2.gamma.xyz/quickswap/polygon/' +const QUICKSWAP_GAMMA_ENDPOINT = 'https://wire2.gamma.xyz/' const DEBUG_MODE = process.env.DEBUG_MODE diff --git a/src/lib/third-party/camelot.js b/src/lib/third-party/camelot.js index 144b074a..396d1139 100644 --- a/src/lib/third-party/camelot.js +++ b/src/lib/third-party/camelot.js @@ -1,15 +1,19 @@ const { get } = require('lodash') const { cachedAxios } = require('../db/models/cache') -const getCamelotData = () => - cachedAxios - .get('https://api.camelot.exchange/pools-v2/') +const getCamelotData = (isV3) => { + let uri = isV3 ? 'https://api.camelot.exchange/v2/liquidity-v3-data/' : 'https://api.camelot.exchange/pools-v2/' + let res = cachedAxios + .get(uri) .then(response => get(response, 'data')) .catch(error => { console.error('getCamelotData() failed:', error) return null }) + return res +} + module.exports = { getCamelotData, } diff --git a/src/prices/implementations/quickswap-gamma.js b/src/prices/implementations/quickswap-gamma.js index bd756450..826470b9 100644 --- a/src/prices/implementations/quickswap-gamma.js +++ b/src/prices/implementations/quickswap-gamma.js @@ -3,11 +3,11 @@ const { get } = require('lodash') const { QUICKSWAP_GAMMA_ENDPOINT } = require('../../lib/constants') const BigNumber = require('bignumber.js') -const getPrice = async poolAddress => { +const getPrice = async (poolAddress, chain) => { let price = 0, response try { - response = await axios.get(`${QUICKSWAP_GAMMA_ENDPOINT}hypervisors/allData`) + response = await axios.get(`${QUICKSWAP_GAMMA_ENDPOINT}${chain}/hypervisors/allData`) const tvlUSD = get(response, `data.${poolAddress.toLowerCase()}.tvlUSD`, 0) let totalSupply = get(response, `data.${poolAddress.toLowerCase()}.totalSupply`, 0) totalSupply = new BigNumber(totalSupply).dividedBy(new BigNumber(10).pow(18)) diff --git a/src/vaults/apys/implementations/quickswap-gamma.js b/src/vaults/apys/implementations/quickswap-gamma.js index b8731b2b..38eaaf37 100644 --- a/src/vaults/apys/implementations/quickswap-gamma.js +++ b/src/vaults/apys/implementations/quickswap-gamma.js @@ -6,7 +6,7 @@ const getApy = async (masterchef, poolAddress, reduction) => { let response, apy try { - response = await axios.get(`${QUICKSWAP_GAMMA_ENDPOINT}allRewards2`) + response = await axios.get(`${QUICKSWAP_GAMMA_ENDPOINT}quickswap/polygon/allRewards2`) apy = get( response, `data.${masterchef.toLowerCase()}.pools.${poolAddress.toLowerCase()}.apr`, diff --git a/src/vaults/trading-apys/implementations/camelot.js b/src/vaults/trading-apys/implementations/camelot.js index 04cf8577..5ce98eeb 100644 --- a/src/vaults/trading-apys/implementations/camelot.js +++ b/src/vaults/trading-apys/implementations/camelot.js @@ -1,11 +1,10 @@ const { getCamelotData } = require('../../../lib/third-party/camelot') const { get } = require('lodash') -const getTradingApy = async poolAddress => { +const getTradingApy = async (poolAddress, isV3 = false) => { let apy - try { - const data = await getCamelotData() + const data = await getCamelotData(isV3) apy = get(data, `data.pools.${poolAddress}.oneDayAverageAPR`, 0) // 1 day moving average APY from trading fees } catch (err) { console.error('Camelot API error: ', err) @@ -17,4 +16,4 @@ const getTradingApy = async poolAddress => { module.exports = { getTradingApy, -} +} \ No newline at end of file diff --git a/src/vaults/trading-apys/implementations/quickswap-gamma.js b/src/vaults/trading-apys/implementations/quickswap-gamma.js index 8446f56a..fdef7905 100644 --- a/src/vaults/trading-apys/implementations/quickswap-gamma.js +++ b/src/vaults/trading-apys/implementations/quickswap-gamma.js @@ -6,7 +6,7 @@ const getTradingApy = async poolAddress => { let response, apy try { - response = await axios.get(`${QUICKSWAP_GAMMA_ENDPOINT}hypervisors/allData`) + response = await axios.get(`${QUICKSWAP_GAMMA_ENDPOINT}quickswap/polygon/hypervisors/allData`) apy = get(response, `data.${poolAddress.toLowerCase()}.returns.daily.feeApr`, 0) apy = parseFloat(apy) * 100 } catch (err) { From 96a94123bda0ecb24b7b1797d20e55d47cb9c155 Mon Sep 17 00:00:00 2001 From: William Liu Date: Mon, 9 Oct 2023 14:42:20 +0000 Subject: [PATCH 2/2] fix: fix lint issue --- src/lib/third-party/camelot.js | 8 +++++--- src/vaults/trading-apys/implementations/camelot.js | 2 +- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/lib/third-party/camelot.js b/src/lib/third-party/camelot.js index 396d1139..03890664 100644 --- a/src/lib/third-party/camelot.js +++ b/src/lib/third-party/camelot.js @@ -1,8 +1,10 @@ const { get } = require('lodash') const { cachedAxios } = require('../db/models/cache') -const getCamelotData = (isV3) => { - let uri = isV3 ? 'https://api.camelot.exchange/v2/liquidity-v3-data/' : 'https://api.camelot.exchange/pools-v2/' +const getCamelotData = isV3 => { + let uri = isV3 + ? 'https://api.camelot.exchange/v2/liquidity-v3-data/' + : 'https://api.camelot.exchange/pools-v2/' let res = cachedAxios .get(uri) .then(response => get(response, 'data')) @@ -11,7 +13,7 @@ const getCamelotData = (isV3) => { return null }) - return res + return res } module.exports = { diff --git a/src/vaults/trading-apys/implementations/camelot.js b/src/vaults/trading-apys/implementations/camelot.js index 5ce98eeb..e094c913 100644 --- a/src/vaults/trading-apys/implementations/camelot.js +++ b/src/vaults/trading-apys/implementations/camelot.js @@ -16,4 +16,4 @@ const getTradingApy = async (poolAddress, isV3 = false) => { module.exports = { getTradingApy, -} \ No newline at end of file +}