Skip to content

Commit

Permalink
Add Pendle Base
Browse files Browse the repository at this point in the history
  • Loading branch information
roman-monk committed Nov 28, 2024
1 parent 22c72e2 commit cf68657
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 26 deletions.
15 changes: 15 additions & 0 deletions packages/address-book/src/address-book/base/tokens/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1779,6 +1779,21 @@ export const tokens = {
website: 'https://warpcast.com/clanker/0x30f98af8',
bridge: 'native',
},
LBTC: {
name: 'Lombard Staked Bitcoin',
symbol: 'LBTC',
oracleId: 'LBTC',
address: '0xecAc9C5F704e954931349Da37F60E39f515c11c1',
chainId: 1,
decimals: 8,
logoURI: '',
website: 'https://www.lombard.finance/app/',
description:
"LBTC is liquid Bitcoin; it's yield-bearing, cross-chain, and 1:1 backed by BTC. LBTC enables yield-bearing BTC to move cross-chain without fragmenting liquidity, and is designed to seamlessly integrate Bitcoin into the decentralized finance (DeFi) ecosystem while maintaining the security and integrity of the underlying asset.",
bridge: 'native',
documentation: 'https://docs.lombard.finance/lbtc-liquid-bitcoin/introduction-to-lbtc',
risks: ['NO_TIMELOCK', 'LARGE_HOLDERS'],
},
EIGEN: {
name: 'Eigen',
symbol: 'EIGEN',
Expand Down
2 changes: 2 additions & 0 deletions src/api/stats/base/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const { getSonneApys } = require('./getSonneApys');
const { getSeamlessApys } = require('./getSeamlessApys');
const { getBeefyBaseCowApys } = require('./getBeefyBaseCowApys');
const { getMellowVeloApys } = require('../common/getMellowVeloApys');
const { getEquilibriaApys } = require('../common/getEquilibriaApys');
const { getBaseSiloApys } = require('./getBaseSiloApys');
const { getBesnARSApy } = require('./getBesnARSApy');
const { getTokemakApys } = require('./getTokemakApys');
Expand All @@ -40,6 +41,7 @@ const getApys = [
getBaseCompoundV3Apys,
getAuraBaseApys,
() => getMellowVeloApys(BASE_CHAIN_ID, require('../../../data/base/mellowAeroPools.json')),
() => getEquilibriaApys(require('../../../data/base/pendlePools.json')),
getBeefyBaseCowApys,
];

Expand Down
23 changes: 5 additions & 18 deletions src/api/stats/common/balancer/getAuraApys.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,7 @@ const getPoolApys = async (params: BalancerParams): Promise<FarmApyResult> => {
const lsAprs = [];
const cmpAprs = [];

const { tokenQtys, balances, rewardRates, periodFinishes, extras, auraRate } = await getPoolsData(
params
);
const { tokenQtys, balances, rewardRates, periodFinishes, extras, auraRate } = await getPoolsData(params);

for (let i = 0; i < params.pools.length; i++) {
const { rewardsApy, aprFixed, composableApr } = await getPoolApy(
Expand Down Expand Up @@ -178,9 +176,7 @@ const getPoolApy = async (
try {
const lsResponses: any[] = await Promise.all(
lsUrls.map(url =>
url === 'DSR'
? fetchDaiSavingsRate().then(res => res)
: fetch(url).then(res => res.json())
url === 'DSR' ? fetchDaiSavingsRate().then(res => res) : fetch(url).then(res => res.json())
)
);

Expand All @@ -201,7 +197,7 @@ const getPoolApy = async (
}
});
} catch (err) {
console.error(`Aura: Liquid Staking URL Fetch Error ${pool.name}`);
console.error(`Aura: Failed to fetch ${pool.name} liquid staking APR`);
}
}

Expand Down Expand Up @@ -239,12 +235,7 @@ const getPoolApy = async (
let composableApr = compApr.toNumber();

if (params.log) {
console.log(
pool.name,
rewardsApy.toNumber(),
totalStakedInUsd.valueOf(),
yearlyRewardsInUsd.valueOf()
);
console.log(pool.name, rewardsApy.toNumber(), totalStakedInUsd.valueOf(), yearlyRewardsInUsd.valueOf());
}

return { rewardsApy, aprFixed, composableApr };
Expand Down Expand Up @@ -299,11 +290,7 @@ const getComposableAaveYield = async (
tokenQtyCalls.push(balVault.read.getPoolTokens([poolId as `0x${string}`]));

tokens.forEach(t => {
const dataProvider = fetchContract(
params.aaveDataProvider,
IAaveProtocolDataProvider,
params.chainId
);
const dataProvider = fetchContract(params.aaveDataProvider, IAaveProtocolDataProvider, params.chainId);
supplyRateCalls.push(dataProvider.read.getReserveData([t.address as `0x${string}`]));
tokenQtyCalls.push(balVault.read.getPoolTokens([t.poolId as `0x${string}`]));
});
Expand Down
10 changes: 5 additions & 5 deletions src/api/stats/common/getEquilibriaApys.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ const eqbMinter = {
[ARBITRUM_CHAIN_ID]: '0x09bae4C38B1a9142726C6F08DC4d1260B0C8e94d',
};

export async function getEquilibriaApys(allPools) {
const chainId = allPools[0].chainId;
const pools = allPools.filter(p => p.eqbGauge);
const eqbApys = await getPoolApys(chainId, pools);
export async function getEquilibriaApys(pools) {
const chainId = pools[0].chainId;
const eqbPools = pools.filter(p => p.eqbGauge);
const eqbApys = await getPoolApys(chainId, eqbPools);
const { tradingApys, pendleApys } = await getPendleApys(chainId, pools);

// pools.forEach((p, i) => {
Expand Down Expand Up @@ -92,7 +92,7 @@ const getPoolApys = async (chainId, pools) => {
const info = poolInfo[i];

if (info.expiry < Date.now() / 1000) {
apys.push(new BigNumber(0));
apys[pool.address] = new BigNumber(0);
continue;
}

Expand Down
3 changes: 2 additions & 1 deletion src/api/stats/common/getPendleCommonPrices.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@ import BigNumber from 'bignumber.js';
import { parseAbi } from 'viem';
import { fetchContract } from '../../rpc/client';
import ERC20Abi from '../../../abis/ERC20Abi';
import { ARBITRUM_CHAIN_ID, BSC_CHAIN_ID, ETH_CHAIN_ID } from '../../../constants';
import { ARBITRUM_CHAIN_ID, BASE_CHAIN_ID, BSC_CHAIN_ID, ETH_CHAIN_ID } from '../../../constants';

const routerStatic = {
[ARBITRUM_CHAIN_ID]: '0xAdB09F65bd90d19e3148D9ccb693F3161C6DB3E8',
[ETH_CHAIN_ID]: '0x263833d47eA3fA4a30f269323aba6a107f9eB14C',
[BSC_CHAIN_ID]: '0x2700ADB035F82a11899ce1D3f1BF8451c296eABb',
[BASE_CHAIN_ID]: '0xB4205a645c7e920BD8504181B1D7f2c5C955C3e7',
};
const routerAbi = parseAbi([
'function isExpired() external view returns (bool)',
Expand Down
4 changes: 2 additions & 2 deletions src/api/stats/ethereum/getAuraApys.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ const getLiquidStakingPoolYield = async pool => {
: (response = await fetch(pool.lsUrl[i]).then(res => res.json()));
lsApr = await jp.query(response, pool.dataPath[i]);
} catch (e) {
console.error(`Aura: Liquid Staking URL Fetch Error ${pool.name}`, e);
console.error(`Aura: Failed to fetch ${pool.name} liquid staking APR from ${pool.lsUrl[i]}`);
}

const divisor = pool.divisor ? pool.divisor[i] : 100;
Expand All @@ -212,7 +212,7 @@ const getLiquidStakingPoolYield = async pool => {
: (response = await fetch(pool.lsUrl).then(res => res.json()));
lsApr = await jp.query(response, pool.dataPath);
} catch (e) {
console.error(`Aura: Liquid Staking URL Fetch Error ${pool.name}`);
console.error(`Aura: Failed to fetch ${pool.name} liquid staking APR from ${pool.lsUrl}`);
}

pool.balancerChargesFee
Expand Down
1 change: 1 addition & 0 deletions src/api/stats/getNonAmmPrices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -238,6 +238,7 @@ export async function getNonAmmPrices(tokenPrices: Record<string, number>): Prom
getPendleCommonPrices(ARB_CHAIN_ID, require('../../data/arbitrum/pendlePools.json'), tokenPrices),
getPendleCommonPrices(ETH_CHAIN_ID, require('../../data/ethereum/pendlePools.json'), tokenPrices),
getPendleCommonPrices(BSC_CHAIN_ID, require('../../data/bsc/pendlePools.json'), tokenPrices),
getPendleCommonPrices(BASE_CHAIN_ID, require('../../data/base/pendlePools.json'), tokenPrices),
getMellowVeloPrices(OPTIMISM_CHAIN_ID, require('../../data/optimism/mellowVeloPools.json'), tokenPrices),
getMellowVeloPrices(BASE_CHAIN_ID, require('../../data/base/mellowAeroPools.json'), tokenPrices),
getPearlTridentPrices(tokenPrices),
Expand Down
18 changes: 18 additions & 0 deletions src/data/base/pendlePools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[
{
"name": "pendle-base-cbeth-25dec25",
"address": "0x483f2e223c58a5ef19c4b32fbc6de57709749cb3",
"oracle": "tokens",
"oracleId": "WETH",
"decimals": "1e18",
"chainId": 8453
},
{
"name": "pendle-base-lbtc-29may25",
"address": "0x727cebacfb10ffd353fc221d06a862b437ec1735",
"oracle": "tokens",
"oracleId": "WBTC",
"decimals": "1e8",
"chainId": 8453
}
]

0 comments on commit cf68657

Please sign in to comment.