Skip to content

Commit

Permalink
updates to snapLido Hardhat task
Browse files Browse the repository at this point in the history
  • Loading branch information
naddison36 committed Oct 23, 2024
1 parent d4ce091 commit c29acbd
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions src/js/tasks/lido.js
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,10 @@ const snapLido = async ({ amount, block, curve, oneInch, uniswap, gas }) => {
);
await logWithdrawalQueue(lidoARM, blockTag, liquidityWeth);
await logUser(lidoARM, capManager, blockTag, totalSupply);
await logCaps(capManager, totalAssets, blockTag);
};

const feesAccrued = await lidoARM.feesAccrued({ blockTag });
const logCaps = async (capManager, totalAssets, blockTag) => {
const totalAssetsCap = await capManager.totalAssetsCap({ blockTag });
const capRemaining = totalAssetsCap - totalAssets;
const capUsedPercent = (totalAssets * 10000n) / totalAssetsCap;
Expand All @@ -197,7 +199,6 @@ const snapLido = async ({ amount, block, curve, oneInch, uniswap, gas }) => {
2
)}% used, ${formatUnits(capRemaining, 18)} remaining`
);
console.log(`${formatUnits(feesAccrued, 18)} in accrued performance fees`);
};

const logUser = async (arm, capManager, blockTag, totalSupply) => {
Expand Down Expand Up @@ -231,8 +232,10 @@ const logWithdrawalQueue = async (arm, blockTag, liquidityWeth) => {
};

const logAssets = async (arm, blockTag) => {
const armBuybackAddress = await parseAddress("ARM_BUYBACK");
const weth = await resolveAsset("WETH");
const liquidityWeth = await weth.balanceOf(arm.getAddress(), { blockTag });
const armBuybackWeth = await weth.balanceOf(armBuybackAddress, { blockTag });

const steth = await resolveAsset("STETH");
const liquiditySteth = await steth.balanceOf(arm.getAddress(), { blockTag });
Expand All @@ -250,6 +253,7 @@ const logAssets = async (arm, blockTag) => {
const assetPerShare = await arm.convertToAssets(parseUnits("1"), {
blockTag,
});
const feesAccrued = await arm.feesAccrued({ blockTag });

console.log(`\nAssets`);
console.log(
Expand All @@ -273,6 +277,10 @@ const logAssets = async (arm, blockTag) => {
console.log(`${formatUnits(totalAssets, 18).padEnd(23)} total assets`);
console.log(`${formatUnits(totalSupply, 18).padEnd(23)} total supply`);
console.log(`${formatUnits(assetPerShare, 18).padEnd(23)} asset per share`);
console.log(
`${formatUnits(feesAccrued, 18).padEnd(23)} accrued performance fees`
);
console.log(`${formatUnits(armBuybackWeth, 18).padEnd(23)} WETH in Buyback`);

return { totalAssets, totalSupply, liquidityWeth };
};
Expand Down

0 comments on commit c29acbd

Please sign in to comment.