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/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); }; 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";