From 85cbfa68eca8c620f547189eb1826ec3cc668a07 Mon Sep 17 00:00:00 2001 From: cgewecke Date: Fri, 9 Apr 2021 08:07:08 -0700 Subject: [PATCH 1/2] Move getRandomAddress (w/out hardhat) to utils/common --- utils/common/addressUtils.ts | 7 +++++++ utils/common/index.ts | 3 +++ utils/fixtures/aaveFixture.ts | 3 +-- utils/test/index.ts | 4 +++- 4 files changed, 14 insertions(+), 3 deletions(-) create mode 100644 utils/common/addressUtils.ts diff --git a/utils/common/addressUtils.ts b/utils/common/addressUtils.ts new file mode 100644 index 000000000..e559484ba --- /dev/null +++ b/utils/common/addressUtils.ts @@ -0,0 +1,7 @@ +import { Wallet } from "ethers"; +import { Address } from "../types"; + +export const getRandomAddress = async (): Promise
=> { + const wallet = Wallet.createRandom(); + return await wallet.getAddress(); +}; diff --git a/utils/common/index.ts b/utils/common/index.ts index b1ac70aae..6ac436ec1 100644 --- a/utils/common/index.ts +++ b/utils/common/index.ts @@ -37,3 +37,6 @@ export { export { convertLibraryNameToLinkId } from "./libraryUtils"; +export { + getRandomAddress +} from "./addressUtils"; diff --git a/utils/fixtures/aaveFixture.ts b/utils/fixtures/aaveFixture.ts index 87f27ab11..8d30328ec 100644 --- a/utils/fixtures/aaveFixture.ts +++ b/utils/fixtures/aaveFixture.ts @@ -26,12 +26,11 @@ import { import { StandardTokenMock } from "../contracts"; -import { ether } from "../common"; +import { ether, getRandomAddress } from "../common"; import { AToken__factory } from "../../typechain/factories/AToken__factory"; import { MAX_UINT_256 } from "../constants"; import { AaveTokenV2Mintable } from "../../typechain/AaveTokenV2Mintable"; -import { getRandomAddress } from "../test"; export class AaveFixture { private _deployer: DeployHelper; diff --git a/utils/test/index.ts b/utils/test/index.ts index e03c75e76..693646527 100644 --- a/utils/test/index.ts +++ b/utils/test/index.ts @@ -20,7 +20,6 @@ export { getAccounts, getEthBalance, getRandomAccount, - getRandomAddress, } from "./accountUtils"; export { addSnapshotBeforeRestoreAfterEach, @@ -32,3 +31,6 @@ export { mineBlockAsync, cacheBeforeEach } from "./testingUtils"; +export { + getRandomAddress +} from "../common"; From 97faf8482fab7c23532c174930e736bf341ce52e Mon Sep 17 00:00:00 2001 From: cgewecke Date: Fri, 9 Apr 2021 08:44:27 -0700 Subject: [PATCH 2/2] Remove getRandomAddress from utils/test/accountUtils --- utils/test/accountUtils.ts | 5 ----- 1 file changed, 5 deletions(-) diff --git a/utils/test/accountUtils.ts b/utils/test/accountUtils.ts index e31c1c3b5..9989f9043 100644 --- a/utils/test/accountUtils.ts +++ b/utils/test/accountUtils.ts @@ -26,11 +26,6 @@ export const getRandomAccount = async (): Promise => { return accounts[accounts.length - 1]; }; -export const getRandomAddress = async (): Promise
=> { - const wallet = ethers.Wallet.createRandom().connect(provider); - return await wallet.getAddress(); -}; - export const getEthBalance = async (account: Address): Promise => { return await provider.getBalance(account); };