Skip to content

Commit

Permalink
Automated lint (snapshot-labs#1667)
Browse files Browse the repository at this point in the history
Co-authored-by: ChaituVR <[email protected]>
  • Loading branch information
github-actions[bot] and ChaituVR authored Dec 30, 2024
1 parent f2fd8f1 commit 7c4e0c9
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions src/strategies/realt/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,26 +14,37 @@ export async function strategy(
snapshot
): Promise<Record<string, number>> {
const blockTag = typeof snapshot === 'number' ? snapshot : 'latest';
const reAltStrategy = "0x6075546538c3eFbD607ea6aFC24149fCcFb2edF4"; // reALT Strategy Mainnet
const reAltStrategy = '0x6075546538c3eFbD607ea6aFC24149fCcFb2edF4'; // reALT Strategy Mainnet

const balanceOfMulticaller = new Multicaller(network, provider, [
'function balanceOf(address account) external view returns (uint256)',
], { blockTag });
const balanceOfMulticaller = new Multicaller(
network,
provider,
['function balanceOf(address account) external view returns (uint256)'],
{ blockTag }
);
addresses.forEach((address) => {
if (address !== reAltStrategy) {
balanceOfMulticaller.call(address, options.address, 'balanceOf', [address]);
balanceOfMulticaller.call(address, options.address, 'balanceOf', [
address
]);
}
});

const sharesMulticaller = new Multicaller(network, provider, [
'function shares(address user) external view returns (uint256)',
], { blockTag });
const sharesMulticaller = new Multicaller(
network,
provider,
['function shares(address user) external view returns (uint256)'],
{ blockTag }
);

addresses.forEach((address) =>
sharesMulticaller.call(address, reAltStrategy, 'shares', [address])
);

const [balanceOfResults, sharesResults]: [Record<string, BigNumberish>, Record<string, BigNumberish>] = await Promise.all([
const [balanceOfResults, sharesResults]: [
Record<string, BigNumberish>,
Record<string, BigNumberish>
] = await Promise.all([
balanceOfMulticaller.execute(),
sharesMulticaller.execute()
]);
Expand All @@ -42,11 +53,10 @@ export async function strategy(
addresses.map((address) => {
const balanceOf = balanceOfResults[address] || BigNumber.from(0);
const shares = sharesResults[address] || BigNumber.from(0);
const totalBalance = BigNumber.from(balanceOf).add(BigNumber.from(shares));
return [
address,
parseFloat(formatUnits(totalBalance, options.decimals))
];
const totalBalance = BigNumber.from(balanceOf).add(
BigNumber.from(shares)
);
return [address, parseFloat(formatUnits(totalBalance, options.decimals))];
})
);
}

0 comments on commit 7c4e0c9

Please sign in to comment.