Fix deprecation warninsg
This commit is contained in:
@@ -1,25 +1,38 @@
|
||||
const promptly = require('promptly');
|
||||
const Table = require('cli-table');
|
||||
const promptly = require("promptly");
|
||||
const Table = require("cli-table");
|
||||
|
||||
const { ethers } = require("hardhat");
|
||||
const Kredits = require('../lib/kredits');
|
||||
const Kredits = require("../lib/kredits");
|
||||
|
||||
async function main() {
|
||||
kredits = new Kredits(hre.ethers.provider, hre.ethers.provider.getSigner())
|
||||
kredits = new Kredits(hre.ethers.provider, hre.ethers.provider.getSigner());
|
||||
await kredits.init();
|
||||
|
||||
console.log(`Using Reimbursement at: ${kredits.Reimbursement.contract.address}`);
|
||||
console.log(
|
||||
`Using Reimbursement at: ${kredits.Reimbursement.contract.address}`
|
||||
);
|
||||
|
||||
const table = new Table({
|
||||
head: ['ID', 'Amount', 'Token', 'recipientId', 'Confirmed?', 'Vetoed?', 'IPFS', 'Expenses']
|
||||
})
|
||||
head: [
|
||||
"ID",
|
||||
"Amount",
|
||||
"Token",
|
||||
"recipientId",
|
||||
"Confirmed?",
|
||||
"Vetoed?",
|
||||
"IPFS",
|
||||
"Expenses",
|
||||
],
|
||||
});
|
||||
|
||||
let blockNumber = await kredits.provider.getBlockNumber();
|
||||
let reimbursements = await kredits.Reimbursement.all({page: {size: 1000}});
|
||||
let reimbursements = await kredits.Reimbursement.all({
|
||||
page: { size: 1000 },
|
||||
});
|
||||
|
||||
let kreditsSum = 0;
|
||||
console.log(`Current block number: ${blockNumber}`);
|
||||
reimbursements.forEach(r => {
|
||||
reimbursements.forEach((r) => {
|
||||
const confirmed = r.confirmedAtBlock <= blockNumber;
|
||||
|
||||
table.push([
|
||||
@@ -30,15 +43,21 @@ async function main() {
|
||||
`${confirmed}`,
|
||||
`${r.vetoed}`,
|
||||
`${r.ipfsHash}`,
|
||||
`${r.expenses.length}`
|
||||
`${r.expenses.length}`,
|
||||
]);
|
||||
});
|
||||
|
||||
console.log(table.toString());
|
||||
|
||||
let totalAmountUnconfirmed = await kredits.Reimbursement.functions.totalAmount(false);
|
||||
let totalAmountConfirmed = await kredits.Reimbursement.functions.totalAmount(true);
|
||||
console.log(`Total: ${totalAmountConfirmed} (confirmed) | ${totalAmountUnconfirmed} (including unconfirmed)`);
|
||||
let totalAmountUnconfirmed = await kredits.Reimbursement.contract.totalAmount(
|
||||
false
|
||||
);
|
||||
let totalAmountConfirmed = await kredits.Reimbursement.contract.totalAmount(
|
||||
true
|
||||
);
|
||||
console.log(
|
||||
`Total: ${totalAmountConfirmed} (confirmed) | ${totalAmountUnconfirmed} (including unconfirmed)`
|
||||
);
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
Reference in New Issue
Block a user