Skip to content

fix: apy numbers with updated address #1877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 14, 2025
Merged
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
18 changes: 9 additions & 9 deletions src/adaptors/yieldfi/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ const { poll } = require('ethers/lib/utils');
const sdk = require('@defillama/sdk');

// 2) Addresses and ABIs
const distributionAddress = "0xf4eF3ba63593dfD0967577B2bb3C9ba51D78427b";
const distributionAddress = "0x392017161a9507F19644E8886A237C58809212B5";
const distributionABI = [
"event DistributeYield(address indexed asset, address indexed receiver, uint256 amount, bool profit)"
"event DistributeYield(address caller, address indexed asset, address indexed receiver, uint256 amount, bool profit)"
];

const sUsdAddress = "0x4F8E1426A9d10bddc11d26042ad270F16cCb95F2";
const sUsdABI = 'function totalSupply() view returns (uint256)';
const yUSDAddress = "0x19Ebd191f7A24ECE672ba13A302212b5eF7F35cb";
const yUSDABI = 'function totalSupply() view returns (uint256)';

// 3) Create contract objects

Expand Down Expand Up @@ -39,21 +39,21 @@ const poolsFunction = async () => {

const {output} = await sdk.api.abi.call({
chain: "ethereum",
abi: sUsdABI,
target: sUsdAddress,
abi: yUSDABI,
target: yUSDAddress,
block: eventBlockNumber
});
const tvl = parseFloat((output/1e18).toFixed(2));
const yieldAmount = parseFloat(iface.parseLog(lastLog).args.amount/1e18);
const yieldAmount = parseFloat(iface.parseLog(lastLog).args.amount/1e6);
const apy = ((((tvl+yieldAmount)/tvl)**365-1)*100).toFixed(2);

const yusdPool = {
pool: '0x1CE7D9942ff78c328A4181b9F3826fEE6D845A97',
pool: '0x19Ebd191f7A24ECE672ba13A302212b5eF7F35cb',
chain: 'ethereum',
project: 'yieldfi',
symbol: utils.formatSymbol('yUSD'),
tvlUsd: tvl,
apy: parseFloat(apy),
apyBase: parseFloat(apy),
};

return [yusdPool];
Expand Down
Loading