Skip to content

Commit

Permalink
Automated lint (snapshot-labs#1451)
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 Apr 6, 2024
1 parent 3b21cf1 commit a1aab04
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
43 changes: 31 additions & 12 deletions src/strategies/sd-vote-boost-twavp-vsdcrv-crosschain/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ async function getIDChainBlock(snapshot, provider, chainId) {
return data.blocks[0].number;
}


export async function strategy(
space,
network,
Expand Down Expand Up @@ -65,7 +64,11 @@ export async function strategy(

const destinationChainProvider = getProvider(options.targetChainId);
// Get corresponding block number on the destination chain side
const destinationChainBlockTag = await getIDChainBlock(blockTag, provider, options.targetChainId);
const destinationChainBlockTag = await getIDChainBlock(
blockTag,
provider,
options.targetChainId
);

// Create block list
const blockList = getPreviousBlocks(
Expand All @@ -84,21 +87,35 @@ export async function strategy(
const response: any[] = [];
for (let i = 0; i < options.sampleStep; i++) {
response.push(
await multicall(options.targetChainId, destinationChainProvider, abi, balanceOfQueries, { blockTag: blockList[i] })
await multicall(
options.targetChainId,
destinationChainProvider,
abi,
balanceOfQueries,
{ blockTag: blockList[i] }
)
);
}

const mainChainResponses = await multicall(network, provider, abi, [
[options.veAddress, 'balanceOf', [options.locker]],
[options.sdTokenGauge, 'working_supply'],
[options.sdTokenGauge, 'working_balances', [options.booster]],
[options.vsdToken, 'totalSupply', []]
], { blockTag })
const mainChainResponses = await multicall(
network,
provider,
abi,
[
[options.veAddress, 'balanceOf', [options.locker]],
[options.sdTokenGauge, 'working_supply'],
[options.sdTokenGauge, 'working_balances', [options.booster]],
[options.vsdToken, 'totalSupply', []]
],
{ blockTag }
);

const lockerVeBalance = mainChainResponses.shift()[0]; // Last response, latest block
const workingSupply = mainChainResponses.shift()[0]; // Last response, latest block
const workingBalances = mainChainResponses.shift()[0]; // Last response, latest block
const vsdCRVTotalSupply = parseFloat(formatUnits(BigNumber.from(mainChainResponses.shift()[0]), 18)); // Last response, latest block
const vsdCRVTotalSupply = parseFloat(
formatUnits(BigNumber.from(mainChainResponses.shift()[0]), 18)
); // Last response, latest block

const totalVP =
(parseFloat(formatUnits(workingBalances, 18)) /
Expand All @@ -113,7 +130,9 @@ export async function strategy(
const userWorkingBalances: number[] = [];

for (let j = 0; j < options.sampleStep; j++) {
const balanceOf = parseFloat(formatUnits(BigNumber.from(response[j].shift()[0]), 18));
const balanceOf = parseFloat(
formatUnits(BigNumber.from(response[j].shift()[0]), 18)
);

// Add working balance to array.
if (vsdCRVTotalSupply === 0) {
Expand Down Expand Up @@ -165,7 +184,7 @@ function getPreviousBlocks(
currentBlockNumber: number,
numberOfBlocks: number,
daysInterval: number,
blocksPerDay: number,
blocksPerDay: number
): number[] {
// Calculate total blocks interval
const totalBlocksInterval = blocksPerDay * daysInterval;
Expand Down
8 changes: 6 additions & 2 deletions src/strategies/sd-vote-boost-twavp-vsdtoken/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -100,8 +100,12 @@ export async function strategy(
const userWorkingBalances: number[] = [];

for (let j = 0; j < options.sampleStep; j++) {
const balanceOf = parseFloat(formatUnits(BigNumber.from(response[j].shift()[0]), 18));
const totalSupply = parseFloat(formatUnits(BigNumber.from(response[j].shift()[0]), 18));
const balanceOf = parseFloat(
formatUnits(BigNumber.from(response[j].shift()[0]), 18)
);
const totalSupply = parseFloat(
formatUnits(BigNumber.from(response[j].shift()[0]), 18)
);

// Add working balance to array.
if (totalSupply === 0) {
Expand Down

0 comments on commit a1aab04

Please sign in to comment.