Skip to content

Commit

Permalink
fix: fixed lint
Browse files Browse the repository at this point in the history
  • Loading branch information
web3rover committed Jul 17, 2024
1 parent 83bb253 commit 45c3085
Showing 1 changed file with 11 additions and 18 deletions.
29 changes: 11 additions & 18 deletions deploy/020-prime-update-scores.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import { Prime, VToken, VToken__factory } from "../typechain";

import { BigNumber, BigNumberish } from "ethers";
import { parseUnits } from "ethers/lib/utils";
import { ethers } from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import { Prime, VToken, VToken__factory } from "../typechain";

interface ScoreUpdate {
[key: string]: string[];
}
Expand All @@ -20,19 +18,15 @@ const fetchPrimeHolders = async (prime: Prime, fromBlock: number, toBlock: numbe
}

return users;
}

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();
};

const func: DeployFunction = async function () {
const prime: Prime = await ethers.getContract(`Prime`);
const primeHolders: string[] = [];
const scoreUpdates: ScoreUpdate = {}
const scoreUpdates: ScoreUpdate = {};

const fromBlock = 20157699;
const toBlock = 20325425; //await ethers.provider.getBlockNumber();
const toBlock = await ethers.provider.getBlockNumber();
const chunkSize = 1000;

let startBlock = fromBlock;
Expand All @@ -49,25 +43,24 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const markets = await prime.getAllMarkets();

for (const market of markets) {
// Ignore WETH market
if (market == markets[markets.length - 1]) {
continue
// Ignore WETH market
if (market == markets[markets.length - 1]) {
continue;
}

// if user has balance for the market then update score
const vTokenFactory: VToken__factory = await ethers.getContractFactory("VToken");
const marketContract: VToken = await vTokenFactory.attach(market).connect(ethers.provider);

for (const user of primeHolders) {
const balance = await marketContract.balanceOf(user);
if (balance.gt(0)) {
scoreUpdates[user] = scoreUpdates[user] ? [...scoreUpdates[user], market] : [market];
scoreUpdates[user] = scoreUpdates[user] ? [...scoreUpdates[user], market] : [market];
}
}
}

console.log("********** Score Updates **********");
console.log(scoreUpdates)
console.log(scoreUpdates);
};

func.tags = ["prime-score-updates"];
Expand Down

0 comments on commit 45c3085

Please sign in to comment.