Skip to content

Commit

Permalink
Fixing tests after removing truffle and web 3
Browse files Browse the repository at this point in the history
  • Loading branch information
MilGard91 committed Apr 12, 2023
1 parent 0552a2a commit c712a47
Show file tree
Hide file tree
Showing 21 changed files with 8,598 additions and 12,696 deletions.
2 changes: 0 additions & 2 deletions hardhat.config.js/index.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
require('dotenv').config();
require('@typechain/hardhat');
require('@nomiclabs/hardhat-web3');
require('@nomiclabs/hardhat-truffle5');
require('@nomiclabs/hardhat-etherscan');
require('@nomicfoundation/hardhat-chai-matchers');
require('solidity-coverage');
Expand Down
2 changes: 1 addition & 1 deletion hardhat.config.js/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ task('test', async (args, hre, runSuper) => {
});

task('test:setup-test-environment', async (_, hre) => {
hre.accounts = await hre.web3.eth.getAccounts();
hre.accounts = await hre.ethers.getSigners();
});

task(TASK_TYPECHAIN, async (args, hre, runSuper) => {
Expand Down
7 changes: 3 additions & 4 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
const assert = require('assert');
const readline = require('readline');
const { BN, toBN } = require('web3').utils;
const { BigNumber } = require('ethers');

const toBytes = (string, size = 32) => {
Expand All @@ -20,7 +19,7 @@ const filterArgsKeys = args => {
for (const key of Object.keys(args)) {
if (isNaN(key) && key !== '__length__') {
const value = args[key];
params[key] = BN.isBN(value) ? value.toString() : value;
params[key] = BigNumber.isBigNumber(value) ? value.toString() : value;
}
}
return params;
Expand Down Expand Up @@ -59,8 +58,8 @@ function bnEqual(actual, expected, message) {
);
}

const actualBN = toBN(actual);
const expectedBN = toBN(expected);
const actualBN = BigNumber.from(actual);
const expectedBN = BigNumber.from(expected);
const error = message || `expected ${actualBN.toString()} to equal ${expectedBN.toString()}`;

if (actualBN.eq(expectedBN)) {
Expand Down

0 comments on commit c712a47

Please sign in to comment.