Skip to content

Commit 71fcef7

Browse files
authored
Move getRandomAddress (w/out hardhat) to utils/common (#63)
1 parent f3bdfe0 commit 71fcef7

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

utils/common/addressUtils.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { Wallet } from "ethers";
2+
import { Address } from "../types";
3+
4+
export const getRandomAddress = async (): Promise<Address> => {
5+
const wallet = Wallet.createRandom();
6+
return await wallet.getAddress();
7+
};

utils/common/index.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ export {
3737
export {
3838
convertLibraryNameToLinkId
3939
} from "./libraryUtils";
40+
export {
41+
getRandomAddress
42+
} from "./addressUtils";

utils/fixtures/aaveFixture.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,11 @@ import {
2626

2727
import { StandardTokenMock } from "../contracts";
2828

29-
import { ether } from "../common";
29+
import { ether, getRandomAddress } from "../common";
3030

3131
import { AToken__factory } from "../../typechain/factories/AToken__factory";
3232
import { MAX_UINT_256 } from "../constants";
3333
import { AaveTokenV2Mintable } from "../../typechain/AaveTokenV2Mintable";
34-
import { getRandomAddress } from "../test";
3534

3635
export class AaveFixture {
3736
private _deployer: DeployHelper;

utils/test/accountUtils.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,6 @@ export const getRandomAccount = async (): Promise<Account> => {
2626
return accounts[accounts.length - 1];
2727
};
2828

29-
export const getRandomAddress = async (): Promise<Address> => {
30-
const wallet = ethers.Wallet.createRandom().connect(provider);
31-
return await wallet.getAddress();
32-
};
33-
3429
export const getEthBalance = async (account: Address): Promise<BigNumber> => {
3530
return await provider.getBalance(account);
3631
};

utils/test/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ export {
2020
getAccounts,
2121
getEthBalance,
2222
getRandomAccount,
23-
getRandomAddress,
2423
} from "./accountUtils";
2524
export {
2625
addSnapshotBeforeRestoreAfterEach,
@@ -32,3 +31,6 @@ export {
3231
mineBlockAsync,
3332
cacheBeforeEach
3433
} from "./testingUtils";
34+
export {
35+
getRandomAddress
36+
} from "../common";

0 commit comments

Comments
 (0)