Skip to content

Commit

Permalink
Add Kinetix AMM V3 (DefiLlama#1638)
Browse files Browse the repository at this point in the history
* Add Kinetix AMM V3

* Kinetix AMM V3 apyBase fix.
  • Loading branch information
0xrmvdao authored Dec 13, 2024
1 parent 087056a commit 2bc1829
Showing 1 changed file with 64 additions and 0 deletions.
64 changes: 64 additions & 0 deletions src/adaptors/kinetix-amm-v3/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
const { gql, request } = require('graphql-request');
const sdk = require('@defillama/sdk');
const axios = require('axios');

const utils = require('../utils');

const KAI = '0x52369B1539EA8F4e1eadEEF18D85462Dcf9a3658';

const STEER_POOLS_URL =
'https://mv-platform.vercel.app/liquidity/vaults?dex=Kinetix&chain=2222&provider=steer';

const chain = 'kava';

const getApy = async () => {
const { data: steerPoolsWithTokens } = await axios.get(STEER_POOLS_URL);

const poolsValues = steerPoolsWithTokens.map((p, i) => {
const { address: poolAddress, apr, feeTier, decimals, token0, token1 } = p;

const { feeApr, farmApr } = apr;

const {
address: token0Address,
symbol: token0Symbol,
decimals: token0Decimals,
balance: token0Balance,
price: token0Price,
} = token0;

const {
address: token1Address,
symbol: token1Symbol,
decimals: token1Decimals,
balance: token1Balance,
price: token1Price,
} = token1;

const tvlUsd =
Number(token0Balance) * token0Price + Number(token1Balance) * token1Price;

const apyBase = utils.aprToApy(feeApr);
const apyReward = utils.aprToApy(farmApr);

return {
pool: poolAddress,
chain: utils.formatChain('kava'),
project: 'kinetix-amm-v3',
symbol: `${token0Symbol}-${token1Symbol}`,
tvlUsd,
apyBase,
apyReward,
rewardTokens: apyReward ? [KAI] : [],
underlyingTokens: [token0Address, token1Address],
};
});

return poolsValues.filter((p) => utils.keepFinite(p));
};

module.exports = {
timetravel: false,
apy: getApy,
url: 'https://kinetix.finance/pool/v3',
};

0 comments on commit 2bc1829

Please sign in to comment.