Skip to content

Commit

Permalink
archly rename
Browse files Browse the repository at this point in the history
  • Loading branch information
slasher125 committed Dec 21, 2023
1 parent 4607788 commit 2f35727
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,7 @@ const ARC_ADDRESS = '0xa84df7afbcbcc1106834a5fed9453bd1219b1fb5';

const getApy = async () => {
try {
const [arcPrice, pairs] = await Promise.all([
getArcPrice(),
getPairs(),
]);
const [arcPrice, pairs] = await Promise.all([getArcPrice(), getPairs()]);
let gaugePairs = [];
let nonGaugePairs = [];
const multicalls = [];
Expand Down Expand Up @@ -45,13 +42,17 @@ const getApy = async () => {
// gauge pairs apr/apy
gaugePairs = gaugePairs.map((pair, index) => {
const rewardRate = gaugesRewardRates[index].toString();
const aprReward = _calculateGaugeAPR(pair.reserveUSD, rewardRate, arcPrice);
const aprReward = _calculateGaugeAPR(
pair.reserveUSD,
rewardRate,
arcPrice
);
const aprFee = _calculateSwapFeeAPR(
pair.volumeUSD,
pair.reserveUSD,
pair.stable
);

pair.apyBase = Number(aprFee);
pair.apyReward = Number(aprReward);
return pair;
Expand All @@ -63,7 +64,7 @@ const getApy = async () => {
pair.reserveUSD,
pair.stable
);

pair.apyBase = Number(aprFee);
pair.apyReward = Number(0);
return pair;
Expand All @@ -74,7 +75,7 @@ const getApy = async () => {
.map(({ address, token0, token1, reserveUSD, apyReward }) => ({
pool: address,
chain: utils.formatChain('telos'),
project: 'archly-finance',
project: 'archly-v1',
symbol: `${token0.symbol}-${token1.symbol}`.toUpperCase(),
tvlUsd: Number(reserveUSD),
apyReward: apyReward,
Expand Down Expand Up @@ -102,11 +103,7 @@ const _uniquePairs = (pairs) => {
});
};

const _calculateSwapFeeAPR = (
volumeUSD,
reserveUSD,
stable
) => {
const _calculateSwapFeeAPR = (volumeUSD, reserveUSD, stable) => {
const feeShare = new BN(volumeUSD)
.times(stable ? STABLE_FEE_PERCENTAGE : VARIABLE_FEE_PERCENTAGE)
.div(100);
Expand All @@ -116,11 +113,7 @@ const _calculateSwapFeeAPR = (
return feeAPR;
};

const _calculateGaugeAPR = (
reserveUSD,
rewardRate,
arcPrice
) => {
const _calculateGaugeAPR = (reserveUSD, rewardRate, arcPrice) => {
const gaugeAPR = new BN(rewardRate)
.div(1e18)
.times(3600 * 24 * 365)
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 2f35727

Please sign in to comment.