Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 27 additions & 0 deletions packages/address-book/src/address-book/arc/tokens/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,31 @@ export const tokens = {
WNATIVE: USDC,
FEES: USDC,
USDC,
cirBTC: {
name: 'Circle Wrapped Bitcoin',
symbol: 'cirBTC',
oracleId: 'cirBTC',
address: '0x171A4217b86A807A64eB94757Db6849fb4bDbAA0',
chainId: 5042,
decimals: 8,
website: 'https://www.circle.com/cirbtc',
description:
'Circle Wrapped Bitcoin is a BTC-backed token issued by Circle that provides exposure to Bitcoin on Arc and unlocks utility for institutional markets.',
documentation: 'https://developers.circle.com/assets/what-is-cirbtc',
bridge: 'native',
tags: ['BLUECHIP'],
},
arcEURC: {
name: 'EURC',
symbol: 'EURC',
oracleId: 'arcEURC',
address: '0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1',
chainId: 5042,
decimals: 6,
website: 'https://www.circle.com/en/eurc',
description:
'EURC is a euro-backed stablecoin that’s accessible globally on Arc, Avalanche, Ethereum, Base and Stellar. Similar to USDC, EURC is issued by Circle under a full-reserve model.',
bridge: 'native',
tags: ['STABLECOIN'],
},
} as const satisfies Record<string, Token>;
2 changes: 2 additions & 0 deletions src/api/cowcentrated/getCowClms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import type { ApiChain } from '../../utils/chain.ts';
import { typedEntries } from '../../utils/object.ts';
import { type CowClm, validateCowClms } from './types.ts';
import arbitrumPools from '../../data/arbitrum/beefyCowVaults.json' with { type: 'json' };
import arcPools from '../../data/arc/beefyCowVaults.json' with { type: 'json' };
import avaxPools from '../../data/avax/beefyCowVaults.json' with { type: 'json' };
import basePools from '../../data/base/beefyCowVaults.json' with { type: 'json' };
import berachainPools from '../../data/berachain/beefyCowVaults.json' with { type: 'json' };
Expand All @@ -23,6 +24,7 @@ import sonicPools from '../../data/sonic/beefyCowVaults.json' with { type: 'json
import zksyncPools from '../../data/zksync/beefyCowVaults.json' with { type: 'json' };

const chainToClms: Readonly<Partial<Record<ApiChain, CowClm[]>>> = {
arc: validateCowClms(arcPools),
optimism: validateCowClms(optimismPools),
base: validateCowClms(basePools),
arbitrum: validateCowClms(arbitrumPools),
Expand Down
6 changes: 6 additions & 0 deletions src/api/stats/arc/getBeefyArcCowPrices.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import type { PricesById } from '../../../types/prices.ts';
import { getBeefyCowcentratedVaultPrices } from '../common/getBeefyCowcentratedVaultPrices.ts';

export const getBeefyArcCowPrices = async (tokenPrices: PricesById) => {
return await getBeefyCowcentratedVaultPrices('arc', tokenPrices);
};
5 changes: 5 additions & 0 deletions src/api/stats/arc/getBeefyCowArcApys.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import { getCowApys } from '../common/getCowVaultApys.ts';

export const getBeefyCowArcApys = async () => {
return await getCowApys('arc');
};
58 changes: 58 additions & 0 deletions src/api/stats/arc/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import { ARC_CHAIN_ID as chainId } from '../../../constants.ts';
import { getLoggerFor } from '../../../utils/logger/index.ts';
import type { ApyBreakdownResult } from '../common/getApyBreakdownNew.ts';
import { getBeefyCowArcApys } from './getBeefyCowArcApys.ts';

const logger = getLoggerFor({ module: 'apy', chain: chainId });

const getApys = [getBeefyCowArcApys];

const getArcApys = async () => {
const start = Date.now();
let apys: Record<string, unknown> = {};
let apyBreakdowns: Record<string, unknown> = {};

let promises: Promise<Partial<ApyBreakdownResult>>[] = [];
getApys.forEach(getApy => promises.push(getApy()));
const results = await Promise.allSettled(promises);

for (const result of results) {
if (result.status !== 'fulfilled') {
logger.warn({ err: result.reason }, 'apy sub-calculation failed');
continue;
}

// Set default APY values
let mappedApyValues: Record<string, unknown> | undefined = result.value;
let mappedApyBreakdownValues: Record<string, unknown> | undefined = {};

// Loop through key values and move default breakdown format
// To require totalApy key
for (const [key, value] of Object.entries(result.value)) {
mappedApyBreakdownValues[key] = {
totalApy: value,
};
}

// Break out to apy and breakdowns if possible
let hasApyBreakdowns = 'apyBreakdowns' in result.value;
if (hasApyBreakdowns) {
mappedApyValues = result.value.apys;
mappedApyBreakdownValues = result.value.apyBreakdowns;
}

apys = { ...apys, ...mappedApyValues };

apyBreakdowns = { ...apyBreakdowns, ...mappedApyBreakdownValues };
}

const end = Date.now();
logger.info({ durationMs: end - start }, 'apy updated');

return {
apys,
apyBreakdowns,
};
};

export { getArcApys };
2 changes: 2 additions & 0 deletions src/api/stats/getApys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import { envNumber } from '../../utils/env.ts';
import { getLoggerFor } from '../../utils/logger/index.ts';
import { serviceEventBus } from '../../utils/ServiceEventBus.ts';
import { getArbitrumApys } from './arbitrum/index.ts';
import { getArcApys } from './arc/index.ts';
import { getAvaxApys } from './avax/index.ts';
import { getBaseApys } from './base/index.ts';
import { getBSCApys } from './bsc/index.ts';
Expand Down Expand Up @@ -65,6 +66,7 @@ const updateApys = async () => {
getMonadApys(),
getMegaethApys(),
getRobinhoodApys(),
getArcApys(),
]);

for (const result of results) {
Expand Down
2 changes: 2 additions & 0 deletions src/api/stats/getNonAmmPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import { getBeefyCowArbPrices } from './arbitrum/getBeefyCowArbPrices.ts';
import getCurveArbitrumPrices from './arbitrum/getCurvePrices.ts';
import { getGmxArbitrumPrices } from './arbitrum/getGmxPrices.ts';
import { getMimSwapPrices } from './arbitrum/getMimSwapPrices.ts';
import { getBeefyArcCowPrices } from './arc/getBeefyArcCowPrices.ts';
import getBalancerAvaxPrices from './avax/getBalancerPrices.ts';
import { getBeefyCowAvaxPrices } from './avax/getBeefyCowAvaxPrices.ts';
import { getGmxAvalanchePrices } from './avax/getGmxPrices.ts';
Expand Down Expand Up @@ -169,6 +170,7 @@ export const getNonAmmPrices = withTracing(
getBeefyCowMonadPrices(tokenPrices),
getBeefyCowMegaethPrices(tokenPrices),
getBeefyCowRobinhoodPrices(tokenPrices),
getBeefyArcCowPrices(tokenPrices),
getBeefyCowEthereumPrices(tokenPrices),
getPendleCommonPrices(ETH_CHAIN_ID, ethereumPendlePools, tokenPrices),
getPendleCommonPrices(ETH_CHAIN_ID, ethereumPendleUnboostedPools, tokenPrices),
Expand Down
26 changes: 26 additions & 0 deletions src/data/arc/beefyCowVaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
[
{
"address": "0xAAa8C1e4F75Ec7DF802607D827Ea0efE8dCDDbDD",
"lpAddress": "0x82916bee18fCEF517B26C72d7Cb5F13694E1dB41",
"tokens": ["0x171A4217b86A807A64eB94757Db6849fb4bDbAA0", "0x3600000000000000000000000000000000000000"],
"tokenOracleIds": ["cirBTC", "USDC"],
"decimals": [8, 6],
"oracleId": "uniswap-cow-arc-cirbtc-usdc",
"rewardPool": {
"address": "0xcD68b5A8850E5A10531bDE1BC657329575E40E2C",
"oracleId": "uniswap-cow-arc-cirbtc-usdc-rp"
}
},
{
"address": "0x104E6823bAB0be3fe9b48c5fB0F0413301d935a4",
"lpAddress": "0x6fd5F2fb831940DcD61A98c5B3aCB7D8C6f3bFc1",
"tokens": ["0x3600000000000000000000000000000000000000", "0xbEf5f6d51CB62b58e6A8f77868681825C6fe21c1"],
"tokenOracleIds": ["USDC", "arcEURC"],
"decimals": [6, 6],
"oracleId": "uniswap-cow-arc-usdc-eurc",
"rewardPool": {
"address": "0x8f6E62ac78B06F4f45DB8dE37C8A8B6e1F3e3a13",
"oracleId": "uniswap-cow-arc-usdc-eurc-rp"
}
}
]
18 changes: 18 additions & 0 deletions src/utils/fetchConcentratedLiquidityTokenPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2484,6 +2484,24 @@ const tokens = {
secondToken: 'USDG',
},
],
arc: [
{
type: 'UniV3',
oracleId: 'cirBTC',
decimalDelta: 1e2,
pool: '0x82916bee18fCEF517B26C72d7Cb5F13694E1dB41',
firstToken: 'USDC',
secondToken: 'cirBTC',
},
{
type: 'UniV3',
oracleId: 'arcEURC',
decimalDelta: 1,
pool: '0x6fd5F2fb831940DcD61A98c5B3aCB7D8C6f3bFc1',
firstToken: 'arcEURC',
secondToken: 'USDC',
},
],
} satisfies Partial<Record<keyof typeof ChainId, ConcentratedLiquidityToken[]>>;

type Context = {
Expand Down
Loading