Skip to content

Commit

Permalink
Update index.js
Browse files Browse the repository at this point in the history
  • Loading branch information
skords committed Dec 1, 2024
1 parent 7013078 commit 51c06f8
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/adaptors/avantis/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -98,16 +98,14 @@ const fetchTransfersForFeeDistributedIds = async (ids) => {
};

const main = async (timestamp = null) => {
timestamp = timestamp ? timestamp : Math.floor(Date.now() / 1000);
timestamp = timestamp ? parseInt(timestamp) : Math.floor(Date.now() / 1000);

// Get total fees distributed for junior and senior tranches
const feesDistributedIds = await fetchFeeDistributedIds(timestamp);
const { totalJunior, totalSenior } = await fetchTransfersForFeeDistributedIds(
feesDistributedIds
);

console.log(totalJunior, totalSenior);

const [block] = await getBlocksByTime([timestamp], 'base');

// Get TVL for junior and senior tranches
Expand All @@ -117,14 +115,14 @@ const main = async (timestamp = null) => {
target: ADDRESSES.base.USDC,
params: [ADDRESSES.base.AvantisJuniorTranche],
chain: 'base',
block: block.height,
block: block,
}),
sdk.api.abi.call({
abi: 'erc20:balanceOf',
target: ADDRESSES.base.USDC,
params: [ADDRESSES.base.AvantisSeniorTranche],
chain: 'base',
block: block.height,
block: block,
}),
]);

Expand Down

0 comments on commit 51c06f8

Please sign in to comment.