diff --git a/contracts/core/accounts/scripts/deploy/cutDiamond.ts b/contracts/core/accounts/scripts/deploy/cutDiamond.ts index 3e8b55519..f2d338472 100644 --- a/contracts/core/accounts/scripts/deploy/cutDiamond.ts +++ b/contracts/core/accounts/scripts/deploy/cutDiamond.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {DiamondCutFacet__factory, DiamondInit__factory} from "typechain-types"; import {getAxlNetworkName, logger} from "utils"; @@ -7,7 +7,7 @@ import {FacetCut} from "./types"; export default async function cutDiamond( address: string, diamondInit: string, - admin: SignerWithAddress, + admin: Signer, owner: string, registrar: string, facetCuts: FacetCut[], diff --git a/contracts/core/accounts/scripts/deploy/deploy.ts b/contracts/core/accounts/scripts/deploy/deploy.ts index 3d6f02a30..ea996b809 100644 --- a/contracts/core/accounts/scripts/deploy/deploy.ts +++ b/contracts/core/accounts/scripts/deploy/deploy.ts @@ -1,5 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {ContractFactory} from "ethers"; +import {ContractFactory, Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import { DiamondCutFacet__factory, @@ -16,7 +15,7 @@ export async function deployAccountsDiamond( owner: string, registrar: string, diamondAdmin: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise<{ diamond: Deployment; @@ -51,7 +50,7 @@ export async function deployAccountsDiamond( } async function deployDiamond( - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise<{ diamond: Deployment; @@ -60,7 +59,7 @@ async function deployDiamond( const diamondCutFacet = await deploy(new DiamondCutFacet__factory(deployer)); const diamond = await deploy(new Diamond__factory(deployer), [ - deployer.address, + await deployer.getAddress(), diamondCutFacet.contract.address, ]); @@ -86,7 +85,7 @@ async function deployDiamond( * @param admin signer representing administrator of the contract */ async function deployDiamondInit( - admin: SignerWithAddress, + admin: Signer, hre: HardhatRuntimeEnvironment ): Promise> { const diamondInit = await deploy(new DiamondInit__factory(admin)); @@ -96,11 +95,7 @@ async function deployDiamondInit( return diamondInit; } -async function setDiamondContractOwner( - address: string, - newOwner: string, - curOwner: SignerWithAddress -) { +async function setDiamondContractOwner(address: string, newOwner: string, curOwner: Signer) { logger.out(`Transferring ownership from "${curOwner}" to "${newOwner}"...`); const accountsDiamond = IERC173__factory.connect(address, curOwner); const tx = await accountsDiamond.transferOwnership(newOwner); diff --git a/contracts/core/accounts/scripts/deploy/deployDiamond.ts b/contracts/core/accounts/scripts/deploy/deployDiamond.ts index a83ae756a..26058cc1a 100644 --- a/contracts/core/accounts/scripts/deploy/deployDiamond.ts +++ b/contracts/core/accounts/scripts/deploy/deployDiamond.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import { Diamond, @@ -9,7 +9,7 @@ import { import {logger, updateAddresses} from "utils"; export default async function deployDiamond( - admin: SignerWithAddress, + admin: Signer, hre: HardhatRuntimeEnvironment ): Promise<{diamond: Diamond; diamondCutFacet: DiamondCutFacet}> { const DiamondCutFacet = new DiamondCutFacet__factory(admin); @@ -18,7 +18,7 @@ export default async function deployDiamond( logger.out(`DiamondCutFacet deployed at: ${diamondCutFacet.address}`); const Diamond = new Diamond__factory(admin); - const diamond = await Diamond.deploy(admin.address, diamondCutFacet.address); + const diamond = await Diamond.deploy(await admin.getAddress(), diamondCutFacet.address); await diamond.deployed(); logger.out(`Diamond deployed at: ${diamond.address}`); diff --git a/contracts/core/accounts/scripts/deploy/deployFacets.ts b/contracts/core/accounts/scripts/deploy/deployFacets.ts index 737d43140..a10fea3f8 100644 --- a/contracts/core/accounts/scripts/deploy/deployFacets.ts +++ b/contracts/core/accounts/scripts/deploy/deployFacets.ts @@ -1,12 +1,12 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {deploy, logger, updateAddresses} from "utils"; import {FacetCutAction, getSelectors} from "../libraries/diamond"; import getFacetFactoryEntries from "./getFacetFactoryEntries"; import {FacetCut} from "./types"; +import {Signer} from "ethers"; export default async function deployFacets( - diamondOwner: SignerWithAddress, + diamondOwner: Signer, hre: HardhatRuntimeEnvironment ): Promise { logger.out("Deploying facets..."); diff --git a/contracts/core/accounts/scripts/deploy/getFacetFactoryEntries.ts b/contracts/core/accounts/scripts/deploy/getFacetFactoryEntries.ts index 4f73c4443..cc11a0883 100644 --- a/contracts/core/accounts/scripts/deploy/getFacetFactoryEntries.ts +++ b/contracts/core/accounts/scripts/deploy/getFacetFactoryEntries.ts @@ -1,5 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {ContractFactory} from "ethers"; +import {ContractFactory, Signer} from "ethers"; import { AccountsDepositWithdrawEndowments__factory, AccountsAllowance__factory, @@ -18,7 +17,7 @@ import { import {AddressObj} from "utils"; // Getting factories instantiated in bulk as they share the deploy/cut creation logic. -export default function getFacetFactoryEntries(diamondOwner: SignerWithAddress): { +export default function getFacetFactoryEntries(diamondOwner: Signer): { factory: ContractFactory; addressField: keyof AddressObj["accounts"]["facets"]; }[] { diff --git a/contracts/core/gasFwd/scripts/deploy.ts b/contracts/core/gasFwd/scripts/deploy.ts index 79d51ccad..59f55e252 100644 --- a/contracts/core/gasFwd/scripts/deploy.ts +++ b/contracts/core/gasFwd/scripts/deploy.ts @@ -1,11 +1,11 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {GasFwdFactory__factory, GasFwd__factory} from "typechain-types"; import {Deployment} from "types"; import {deploy, logger, updateAddresses} from "utils"; type Data = { - deployer: SignerWithAddress; + deployer: Signer; proxyAdmin: string; factoryOwner: string; registrar: string; diff --git a/contracts/core/index-fund/scripts/deploy.ts b/contracts/core/index-fund/scripts/deploy.ts index 3c2a6d435..95bcac9ba 100644 --- a/contracts/core/index-fund/scripts/deploy.ts +++ b/contracts/core/index-fund/scripts/deploy.ts @@ -1,5 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {CONFIG} from "config"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {IndexFund__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -9,7 +9,7 @@ export async function deployIndexFund( registrar: string, owner: string, proxyAdmin: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { // data setup diff --git a/contracts/core/registrar/scripts/deploy.ts b/contracts/core/registrar/scripts/deploy.ts index 914814bd9..4318c5817 100644 --- a/contracts/core/registrar/scripts/deploy.ts +++ b/contracts/core/registrar/scripts/deploy.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {LocalRegistrar__factory, Registrar__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -9,7 +9,7 @@ type RegistrarDeployData = { axelarGasService: string; router: string; owner: string; - deployer: SignerWithAddress; + deployer: Signer; proxyAdmin: string; treasury: string; apTeamMultisig: string; @@ -75,7 +75,7 @@ export async function deployRegistrar( type LocalRegistrarDeployData = { owner: string; - deployer: SignerWithAddress; + deployer: Signer; proxyAdmin: string; }; diff --git a/contracts/core/router/scripts/deploy.ts b/contracts/core/router/scripts/deploy.ts index 7a15580d2..c9bef1c76 100644 --- a/contracts/core/router/scripts/deploy.ts +++ b/contracts/core/router/scripts/deploy.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {Router__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -7,7 +7,7 @@ import {deployBehindProxy, updateAddresses} from "utils"; export async function deployRouter( registrar: string, proxyAdmin: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { // data setup diff --git a/contracts/core/vault/scripts/deployVaultEmitter.ts b/contracts/core/vault/scripts/deployVaultEmitter.ts index 1b80394c3..46cac4439 100644 --- a/contracts/core/vault/scripts/deployVaultEmitter.ts +++ b/contracts/core/vault/scripts/deployVaultEmitter.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {VaultEmitter__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -6,7 +6,7 @@ import {deployBehindProxy, updateAddresses} from "utils"; export async function deployVaultEmitter( proxyAdmin: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { // data setup diff --git a/contracts/halo/airdrop/scripts/deploy.ts b/contracts/halo/airdrop/scripts/deploy.ts index 01c1fc437..3c8d412e5 100644 --- a/contracts/halo/airdrop/scripts/deploy.ts +++ b/contracts/halo/airdrop/scripts/deploy.ts @@ -23,7 +23,11 @@ export async function deployAirdrop( const Airdrop = new Airdrop__factory(deployer); const initData = Airdrop.interface.encodeFunctionData("initialize", [AirdropDataInput]); // deploy - const {implementation, proxy} = await deployBehindProxy(Airdrop, proxyAdmin.address, initData); + const {implementation, proxy} = await deployBehindProxy( + Airdrop, + await proxyAdmin.getAddress(), + initData + ); // update address file await updateAddresses( diff --git a/contracts/halo/collector/scripts/deploy.ts b/contracts/halo/collector/scripts/deploy.ts index 970a9eaad..73e135e49 100644 --- a/contracts/halo/collector/scripts/deploy.ts +++ b/contracts/halo/collector/scripts/deploy.ts @@ -25,7 +25,7 @@ export async function deployCollector( // deploy const {implementation, proxy} = await deployBehindProxy( Collector, - proxyAdmin.address, + await proxyAdmin.getAddress(), initData ); diff --git a/contracts/halo/community/scripts/deploy.ts b/contracts/halo/community/scripts/deploy.ts index f6c0c9d39..78b24255d 100644 --- a/contracts/halo/community/scripts/deploy.ts +++ b/contracts/halo/community/scripts/deploy.ts @@ -26,7 +26,7 @@ export async function deployCommunity( // deploy const {implementation, proxy} = await deployBehindProxy( Community, - proxyAdmin.address, + await proxyAdmin.getAddress(), initData ); diff --git a/contracts/halo/gov/scripts/deploy.ts b/contracts/halo/gov/scripts/deploy.ts index f1c1ac2be..b8e919352 100644 --- a/contracts/halo/gov/scripts/deploy.ts +++ b/contracts/halo/gov/scripts/deploy.ts @@ -23,7 +23,11 @@ export async function deployGov( const Gov = new Gov__factory(deployer); const initData = Gov.interface.encodeFunctionData("initialize", [haloToken, timelock]); // deploy - const {implementation, proxy} = await deployBehindProxy(Gov, proxyAdmin.address, initData); + const {implementation, proxy} = await deployBehindProxy( + Gov, + await proxyAdmin.getAddress(), + initData + ); // update address file await updateAddresses( diff --git a/contracts/halo/staking/scripts/deploy.ts b/contracts/halo/staking/scripts/deploy.ts index f59b0fe67..e60262eb4 100644 --- a/contracts/halo/staking/scripts/deploy.ts +++ b/contracts/halo/staking/scripts/deploy.ts @@ -23,7 +23,11 @@ export async function deployStaking( const Staking = new Staking__factory(deployer); const initData = Staking.interface.encodeFunctionData("initialize", [StakingDataInput]); // deploy - const {implementation, proxy} = await deployBehindProxy(Staking, proxyAdmin.address, initData); + const {implementation, proxy} = await deployBehindProxy( + Staking, + await proxyAdmin.getAddress(), + initData + ); // update address file await updateAddresses( diff --git a/contracts/halo/vesting/scripts/deploy.ts b/contracts/halo/vesting/scripts/deploy.ts index f972758da..47a8ab585 100644 --- a/contracts/halo/vesting/scripts/deploy.ts +++ b/contracts/halo/vesting/scripts/deploy.ts @@ -23,7 +23,11 @@ export async function deployVesting( const Vesting = new Vesting__factory(deployer); const initData = Vesting.interface.encodeFunctionData("initialize", [VestingDataInput]); // deploy - const {implementation, proxy} = await deployBehindProxy(Vesting, proxyAdmin.address, initData); + const {implementation, proxy} = await deployBehindProxy( + Vesting, + await proxyAdmin.getAddress(), + initData + ); // update address file await updateAddresses( diff --git a/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSig.ts b/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSig.ts index b3ba5ed18..b9f1da89e 100644 --- a/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSig.ts +++ b/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSig.ts @@ -1,11 +1,11 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {EndowmentMultiSig__factory} from "typechain-types"; import {Deployment} from "types"; import {deploy, logger, updateAddresses} from "utils"; export async function deployEndowmentMultiSig( - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { logger.out("Deploying EndowmentMultiSig..."); diff --git a/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigEmitter.ts b/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigEmitter.ts index 2107cd528..c071bc731 100644 --- a/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigEmitter.ts +++ b/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigEmitter.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {EndowmentMultiSigEmitter__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -7,7 +7,7 @@ import {deployBehindProxy, logger, updateAddresses} from "utils"; export async function deployEndowmentMultiSigEmitter( factory: string, proxyAdmin: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { logger.out("Deploying EndowmentMultiSigEmitter..."); diff --git a/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigFactory.ts b/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigFactory.ts index 34c22a802..f3d1ff5c4 100644 --- a/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigFactory.ts +++ b/contracts/multisigs/endowment-multisig/scripts/deployEndowmentMultiSigFactory.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {EndowmentMultiSigFactory__factory} from "typechain-types"; import {Deployment} from "types"; @@ -9,7 +9,7 @@ export async function deployEndowmentMultiSigFactory( registrar: string, proxyAdmin: string, factoryOwner: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { logger.out("Deploying EndowmentMultiSigFactory..."); diff --git a/contracts/multisigs/scripts/deployAPTeamMultiSig.ts b/contracts/multisigs/scripts/deployAPTeamMultiSig.ts index 219d1253e..08484fe29 100644 --- a/contracts/multisigs/scripts/deployAPTeamMultiSig.ts +++ b/contracts/multisigs/scripts/deployAPTeamMultiSig.ts @@ -1,5 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {CONFIG} from "config"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {APTeamMultiSig__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -7,12 +7,12 @@ import {deployBehindProxy, getSigners, updateAddresses} from "utils"; export async function deployAPTeamMultiSig( proxyAdmin: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { const {apTeamMultisigOwners} = await getSigners(hre); const owners = apTeamMultisigOwners - ? apTeamMultisigOwners.map((x) => x.address) + ? await Promise.all(apTeamMultisigOwners.map((x) => x.getAddress())) : CONFIG.PROD_CONFIG.APTeamMultiSigOwners; // data setup diff --git a/contracts/multisigs/scripts/deployCharityApplications.ts b/contracts/multisigs/scripts/deployCharityApplications.ts index 36ca10bda..a71ac3db3 100644 --- a/contracts/multisigs/scripts/deployCharityApplications.ts +++ b/contracts/multisigs/scripts/deployCharityApplications.ts @@ -1,5 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {CONFIG} from "config"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {CharityApplications__factory} from "typechain-types"; import {ProxyDeployment} from "types"; @@ -9,13 +9,13 @@ export async function deployCharityApplications( accountsDiamond: string, proxyAdmin: string, seedAsset: string, - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { const {charityApplicationsOwners} = await getSigners(hre); const owners = !charityApplicationsOwners ? CONFIG.PROD_CONFIG.CharityApplicationsOwners - : charityApplicationsOwners.map((x) => x.address); + : await Promise.all(charityApplicationsOwners.map((x) => x.getAddress())); // data setup const CharityApplications = new CharityApplications__factory(deployer); diff --git a/contracts/multisigs/scripts/deployProxyAdminMultiSig.ts b/contracts/multisigs/scripts/deployProxyAdminMultiSig.ts index 0b157d693..0a1aabefa 100644 --- a/contracts/multisigs/scripts/deployProxyAdminMultiSig.ts +++ b/contracts/multisigs/scripts/deployProxyAdminMultiSig.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {CONFIG} from "config"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {ProxyAdminMultiSig__factory} from "typechain-types"; @@ -7,7 +7,7 @@ import {deploy, updateAddresses} from "utils"; export async function deployProxyAdminMultisig( owners: string[], - deployer: SignerWithAddress, + deployer: Signer, hre: HardhatRuntimeEnvironment ): Promise> { const proxyAdmin = await deploy(new ProxyAdminMultiSig__factory(deployer), [ diff --git a/tasks/deploy/deployAngelProtocol.ts b/tasks/deploy/deployAngelProtocol.ts index c6c7b85c2..2df827a8a 100644 --- a/tasks/deploy/deployAngelProtocol.ts +++ b/tasks/deploy/deployAngelProtocol.ts @@ -54,16 +54,16 @@ task("deploy:AngelProtocol", "Will deploy complete Angel Protocol") let {deployer, proxyAdminMultisigOwners, treasury} = await getSigners(hre); - let treasuryAddress = treasury ? treasury.address : CONFIG.PROD_CONFIG.Treasury; + let treasuryAddress = treasury ? await treasury.getAddress() : CONFIG.PROD_CONFIG.Treasury; const proxyAdminMultisigOwnerAddresses = proxyAdminMultisigOwners - ? proxyAdminMultisigOwners.map((x) => x.address) + ? await Promise.all(proxyAdminMultisigOwners.map((x) => x.getAddress())) : CONFIG.PROD_CONFIG.ProxyAdminMultiSigOwners; // Reset the contract address object for all contracts that will be deployed here await resetContractAddresses(hre); - logger.out(`Deploying the contracts with the account: ${deployer.address}`); + logger.out(`Deploying the contracts with the account: ${await deployer.getAddress()}`); const proxyAdminMultisig = await deployProxyAdminMultisig( proxyAdminMultisigOwnerAddresses, diff --git a/tasks/deploy/deployHaloImplementation.ts b/tasks/deploy/deployHaloImplementation.ts index 2e36bc8a8..8c06046b9 100644 --- a/tasks/deploy/deployHaloImplementation.ts +++ b/tasks/deploy/deployHaloImplementation.ts @@ -62,7 +62,7 @@ export async function deployHaloImplementation( const {airdropOwner, apTeam1} = await getSigners(hre); const halo = await deployHalo(verify_contracts, hre); - const gov = await deployGov(halo, apTeam1.address, verify_contracts, hre); + const gov = await deployGov(halo, await apTeam1.getAddress(), verify_contracts, hre); var response = { Halo: halo, Gov: gov, diff --git a/tasks/deploy/deployRegistrar.ts b/tasks/deploy/deployRegistrar.ts index c6ee801db..0c1b180f8 100644 --- a/tasks/deploy/deployRegistrar.ts +++ b/tasks/deploy/deployRegistrar.ts @@ -39,7 +39,7 @@ task( const {treasury, deployer} = await getSigners(hre); - let treasuryAddress = treasury ? treasury.address : CONFIG.PROD_CONFIG.Treasury; + let treasuryAddress = treasury ? await treasury.getAddress() : CONFIG.PROD_CONFIG.Treasury; const addresses = await getAddresses(hre); diff --git a/tasks/deploy/deploySideChain.ts b/tasks/deploy/deploySideChain.ts index 7d33ab9f7..03e06eb9f 100644 --- a/tasks/deploy/deploySideChain.ts +++ b/tasks/deploy/deploySideChain.ts @@ -37,14 +37,14 @@ task("deploy:SideChain", "Will deploy complete side-chain infrastructure") let {deployer, proxyAdminMultisigOwners} = await getSigners(hre); const proxyAdminMultisigOwnerAddresses = proxyAdminMultisigOwners - ? proxyAdminMultisigOwners.map((x) => x.address) + ? await Promise.all(proxyAdminMultisigOwners.map((x) => x.getAddress())) : CONFIG.PROD_CONFIG.ProxyAdminMultiSigOwners; await resetContractAddresses(hre); await getOrDeployThirdPartyContracts(deployer, hre); - logger.out(`Deploying the contracts with the account: ${deployer.address}`); + logger.out(`Deploying the contracts with the account: ${await deployer.getAddress()}`); const proxyAdminMultisig = await deployProxyAdminMultisig( proxyAdminMultisigOwnerAddresses, diff --git a/tasks/deploy/integrations/genericVault.ts b/tasks/deploy/integrations/genericVault.ts index 70036f27a..bffd257e6 100644 --- a/tasks/deploy/integrations/genericVault.ts +++ b/tasks/deploy/integrations/genericVault.ts @@ -50,7 +50,7 @@ task("Deploy:genericVault", "Will deploy a generic vault with the provided param const deployment = await deploy(APVault_V1, [ vaultConfig, addresses.vaultEmitter.proxy, - deployer.address, + await deployer.getAddress(), ]); logger.out("Emitting `VaultCreated` event..."); diff --git a/tasks/helpers/deploy/deployDummyAxelar.ts b/tasks/helpers/deploy/deployDummyAxelar.ts index e1bb5efc5..8277f07d4 100644 --- a/tasks/helpers/deploy/deployDummyAxelar.ts +++ b/tasks/helpers/deploy/deployDummyAxelar.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import { DummyGateway__factory, DummyGateway, @@ -6,14 +6,14 @@ import { DummyGasService, } from "typechain-types"; -export async function deployDummyGateway(deployer: SignerWithAddress): Promise { +export async function deployDummyGateway(deployer: Signer): Promise { const Gateway = new DummyGateway__factory(deployer); const gateway = await Gateway.deploy(); await gateway.deployed(); return gateway; } -export async function deployDummyGasService(deployer: SignerWithAddress): Promise { +export async function deployDummyGasService(deployer: Signer): Promise { const GasService = new DummyGasService__factory(deployer); const gasService = await GasService.deploy(); await gasService.deployed(); diff --git a/tasks/helpers/deploy/deployDummyERC20.ts b/tasks/helpers/deploy/deployDummyERC20.ts index 9f3f1cc01..3bbe2439f 100644 --- a/tasks/helpers/deploy/deployDummyERC20.ts +++ b/tasks/helpers/deploy/deployDummyERC20.ts @@ -1,9 +1,9 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {wait} from "test/utils"; import {DummyERC20__factory} from "typechain-types"; export async function deployDummyERC20( - deployer: SignerWithAddress, + deployer: Signer, recipients?: string[], amounts?: number[], decimals?: number diff --git a/tasks/helpers/deploy/deployDummyUniswap.ts b/tasks/helpers/deploy/deployDummyUniswap.ts index 7a4fdb024..db8cc49c1 100644 --- a/tasks/helpers/deploy/deployDummyUniswap.ts +++ b/tasks/helpers/deploy/deployDummyUniswap.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import { ISwapRouter, @@ -9,12 +9,12 @@ import { import {logger} from "utils"; export async function deployDummyUniswap( - signer: SignerWithAddress, + signer: Signer, hre: HardhatRuntimeEnvironment ): Promise<{factory: IUniswapV3Factory; swapRouter: ISwapRouter}> { // just use some placeholder address until actual mock deployment is created // TODO: create a real mock contract for the swap router - const address = signer.address; + const address = await signer.getAddress(); logger.out("Deploying dummy Uniswap Factory..."); logger.out(`Address: ${address}`); diff --git a/tasks/helpers/getOrDeployThirdPartyContracts.ts b/tasks/helpers/getOrDeployThirdPartyContracts.ts index 75a901d81..08d4846dd 100644 --- a/tasks/helpers/getOrDeployThirdPartyContracts.ts +++ b/tasks/helpers/getOrDeployThirdPartyContracts.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import { DummyGasService, @@ -35,7 +35,7 @@ type Result = { }; export async function getOrDeployThirdPartyContracts( - signer: SignerWithAddress, + signer: Signer, hre: HardhatRuntimeEnvironment ): Promise { if (isLocalNetwork(hre)) { @@ -43,9 +43,9 @@ export async function getOrDeployThirdPartyContracts( axelarGasService: await deployDummyGasService(signer), axelarGateway: await deployDummyGateway(signer), uniswap: await deployDummyUniswap(signer, hre), - seedAsset: await deployDummyERC20(signer, [signer.address], [100]), - usdcToken: await deployDummyERC20(signer, [signer.address], [100], 6), - wmaticToken: await deployDummyERC20(signer, [signer.address], [1]), + seedAsset: await deployDummyERC20(signer, [await signer.getAddress()], [100]), + usdcToken: await deployDummyERC20(signer, [await signer.getAddress()], [100], 6), + wmaticToken: await deployDummyERC20(signer, [await signer.getAddress()], [1]), }; await updateAddresses( diff --git a/tasks/helpers/proposeCharityApplication.ts b/tasks/helpers/proposeCharityApplication.ts index 0d7bfa3d5..242165cc7 100644 --- a/tasks/helpers/proposeCharityApplication.ts +++ b/tasks/helpers/proposeCharityApplication.ts @@ -1,5 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {BytesLike, Wallet} from "ethers"; +import {BytesLike, Signer} from "ethers"; import {CharityApplications__factory} from "typechain-types"; import {AccountMessages} from "typechain-types/contracts/multisigs/CharityApplications"; import {filterEvents, logger} from "utils"; @@ -14,7 +13,7 @@ import {filterEvents, logger} from "utils"; */ export async function proposeCharityApplication( charAppsAddress: string, - owner: SignerWithAddress | Wallet, + owner: Signer, applicationRequest: AccountMessages.CreateEndowmentRequestStruct, metadata: BytesLike = "0x" ): Promise { diff --git a/tasks/helpers/submitMultiSigTx.ts b/tasks/helpers/submitMultiSigTx.ts index e8f2956cb..8519e7148 100644 --- a/tasks/helpers/submitMultiSigTx.ts +++ b/tasks/helpers/submitMultiSigTx.ts @@ -1,5 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {BytesLike, Wallet} from "ethers"; +import {BytesLike, Signer} from "ethers"; import {IMultiSigGeneric__factory} from "typechain-types"; import {filterEvents, logger} from "utils"; @@ -13,7 +12,7 @@ import {filterEvents, logger} from "utils"; */ export async function submitMultiSigTx( msAddress: string, - owner: SignerWithAddress | Wallet, + owner: Signer, destination: string, data: BytesLike ): Promise { diff --git a/tasks/manage/addMultisigOwners.ts b/tasks/manage/addMultisigOwners.ts index 6c9e58761..ace2822dc 100644 --- a/tasks/manage/addMultisigOwners.ts +++ b/tasks/manage/addMultisigOwners.ts @@ -22,7 +22,8 @@ task("manage:addMultisigOwners", "Will add the specified address to the multisig const msOwner = await connectSignerFromPkey(taskArguments.multisigOwnerPkey, hre); const isConfirmed = - taskArguments.yes || (await confirmAction(`Adding new owner: ${msOwner.address}`)); + taskArguments.yes || + (await confirmAction(`Adding new owner: ${await msOwner.getAddress()}`)); if (!isConfirmed) { return logger.out("Confirmation denied.", logger.Level.Warn); } diff --git a/tasks/manage/changeProxyAdmin.ts b/tasks/manage/changeProxyAdmin.ts index 3e2dc2ec7..c2ae1c92c 100644 --- a/tasks/manage/changeProxyAdmin.ts +++ b/tasks/manage/changeProxyAdmin.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {task} from "hardhat/config"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import { @@ -8,7 +8,6 @@ import { } from "typechain-types"; import {AddressObj, confirmAction, getAddresses, getProxyAdminOwner, logger} from "utils"; import {submitMultiSigTx} from "../helpers"; -import {Wallet} from "ethers"; type TaskArgs = { apTeamSignerPkey?: string; @@ -42,7 +41,7 @@ task("manage:changeProxyAdmin", "Will update the proxy admin for all proxy contr const proxyAdminOwner = await getProxyAdminOwner(hre, taskArgs.proxyAdminPkey); - if (proxyAdminOwner.address === taskArgs.newProxyAdmin) { + if ((await proxyAdminOwner.getAddress()) === taskArgs.newProxyAdmin) { return logger.out(`"${taskArgs.newProxyAdmin}" is already the proxy admin.`); } @@ -63,7 +62,7 @@ task("manage:changeProxyAdmin", "Will update the proxy admin for all proxy contr }); async function transferAccountOwnership( - proxyAdminOwner: SignerWithAddress | Wallet, + proxyAdminOwner: Signer, newProxyAdmin: string, addresses: AddressObj, hre: HardhatRuntimeEnvironment @@ -98,7 +97,7 @@ async function transferAccountOwnership( * will never revert, but will nevertheless NOT update the admin. */ async function changeProxiesAdmin( - proxyAdminOwner: SignerWithAddress | Wallet, + proxyAdminOwner: Signer, newProxyAdmin: string, addresses: AddressObj, hre: HardhatRuntimeEnvironment diff --git a/tasks/manage/createEndowment.ts b/tasks/manage/createEndowment.ts index 47c98028f..18db0e5fd 100644 --- a/tasks/manage/createEndowment.ts +++ b/tasks/manage/createEndowment.ts @@ -36,7 +36,7 @@ task("manage:createEndowment", "Will create a new endowment") const defaultSettingsPermissionsStruct = { locked: false, delegate: { - addr: appsSigner.address, + addr: await appsSigner.getAddress(), expires: 0, }, }; @@ -57,7 +57,7 @@ task("manage:createEndowment", "Will create a new endowment") endowType: taskArgs.endowType, // Charity logo: "", image: "", - members: [appsSigner.address], + members: [await appsSigner.getAddress()], threshold: 1, allowlistedBeneficiaries: [], allowlistedContributors: [], diff --git a/tasks/manage/updateRegistrar.ts b/tasks/manage/updateRegistrar.ts index d06e89cce..18d652c85 100644 --- a/tasks/manage/updateRegistrar.ts +++ b/tasks/manage/updateRegistrar.ts @@ -28,7 +28,7 @@ task( .setAction(async (taskArgs: TaskArgs, hre) => { try { const {treasury} = await getSigners(hre); - let treasuryAddress = treasury ? treasury.address : CONFIG.PROD_CONFIG.Treasury; + let treasuryAddress = treasury ? await treasury.getAddress() : CONFIG.PROD_CONFIG.Treasury; const addresses = await getAddresses(hre); diff --git a/tasks/manage/verifyAll/getDiamondAddresses.ts b/tasks/manage/verifyAll/getDiamondAddresses.ts index 6a423b1ae..52099c5fd 100644 --- a/tasks/manage/verifyAll/getDiamondAddresses.ts +++ b/tasks/manage/verifyAll/getDiamondAddresses.ts @@ -17,7 +17,7 @@ export default async function getDiamondAddresses( { contract: Diamond__factory.connect(accounts.diamond, hre.ethers.provider), contractName: getContractName(Diamond__factory), - constructorArguments: [deployer.address, accounts.facets.diamondCutFacet], + constructorArguments: [await deployer.getAddress(), accounts.facets.diamondCutFacet], }, ]; diff --git a/tasks/manage/verifyAll/verifyAll.ts b/tasks/manage/verifyAll/verifyAll.ts index 3566c7e71..2ffe9d692 100644 --- a/tasks/manage/verifyAll/verifyAll.ts +++ b/tasks/manage/verifyAll/verifyAll.ts @@ -71,7 +71,7 @@ task("manage:verifyAll", "Will verify all the contracts").setAction(async (_, hr contractName: getContractName(ProxyAdminMultiSig__factory), constructorArguments: [ proxyAdminMultisigOwners - ? proxyAdminMultisigOwners.map((x) => x.address) + ? await Promise.all(proxyAdminMultisigOwners.map((x) => x.getAddress())) : CONFIG.PROD_CONFIG.ProxyAdminMultiSigOwners, CONFIG.PROXY_ADMIN_MULTISIG_DATA.threshold, CONFIG.PROXY_ADMIN_MULTISIG_DATA.requireExecution, diff --git a/tasks/upgrade/upgradeFacets/cutDiamond.ts b/tasks/upgrade/upgradeFacets/cutDiamond.ts index 69b260821..6aa2ee950 100644 --- a/tasks/upgrade/upgradeFacets/cutDiamond.ts +++ b/tasks/upgrade/upgradeFacets/cutDiamond.ts @@ -1,14 +1,13 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {submitMultiSigTx} from "tasks/helpers"; import {DiamondCutFacet__factory, DiamondInit__factory} from "typechain-types"; import {logger} from "utils"; import {FacetCut} from "./types"; -import {Wallet} from "ethers"; export default async function cutDiamond( diamondAddress: string, proxyAdminMultiSig: string, - proxyAdmin: SignerWithAddress | Wallet, + proxyAdmin: Signer, facetCuts: FacetCut[] ) { logger.out("Updating Diamond with new facet addresses..."); diff --git a/tasks/upgrade/upgradeFacets/deployFacets.ts b/tasks/upgrade/upgradeFacets/deployFacets.ts index 3f24bdb9d..9ccbd6205 100644 --- a/tasks/upgrade/upgradeFacets/deployFacets.ts +++ b/tasks/upgrade/upgradeFacets/deployFacets.ts @@ -1,13 +1,12 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import getFacetFactoryEntries from "contracts/core/accounts/scripts/deploy/getFacetFactoryEntries"; -import {ContractFactory} from "ethers"; +import {ContractFactory, Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {Deployment} from "types"; import {deploy, getContractName, logger, updateAddresses} from "utils"; export default async function deployFacets( facetNames: string[], - diamondOwner: SignerWithAddress, + diamondOwner: Signer, hre: HardhatRuntimeEnvironment ): Promise[]> { logger.out("Deploying facets..."); @@ -34,7 +33,7 @@ export default async function deployFacets( return facetDeployments; } -function getFacetsToUpgrade(facetNames: string[], diamondOwner: SignerWithAddress) { +function getFacetsToUpgrade(facetNames: string[], diamondOwner: Signer) { const factoryEntries = getFacetFactoryEntries(diamondOwner); const facetsToUpgrade = facetNames.map((facetName) => { const factoryEntry = factoryEntries.find( diff --git a/tasks/upgrade/upgradeFacets/sortIntoFacetCuts/sortIntoFacetCuts.ts b/tasks/upgrade/upgradeFacets/sortIntoFacetCuts/sortIntoFacetCuts.ts index 1285eb509..bcfda7eb4 100644 --- a/tasks/upgrade/upgradeFacets/sortIntoFacetCuts/sortIntoFacetCuts.ts +++ b/tasks/upgrade/upgradeFacets/sortIntoFacetCuts/sortIntoFacetCuts.ts @@ -1,6 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {FacetCutAction} from "contracts/core/accounts/scripts/libraries/diamond"; -import {ContractFactory} from "ethers"; +import {ContractFactory, Signer} from "ethers"; import {DiamondLoupeFacet__factory} from "typechain-types"; import {Deployment} from "types"; import {ADDRESS_ZERO, logger} from "utils"; @@ -10,7 +9,7 @@ import getFacetSelectors from "./getFacetSelectors"; export default async function sortIntoFacetCuts( facetDeployments: Deployment[], diamondAddress: string, - diamondOwner: SignerWithAddress + diamondOwner: Signer ): Promise { logger.out("Creating facet cuts..."); diff --git a/test/core/IndexFund.ts b/test/core/IndexFund.ts index e8e4692c6..a9354b1e1 100644 --- a/test/core/IndexFund.ts +++ b/test/core/IndexFund.ts @@ -1,8 +1,7 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; import {impersonateAccount, setBalance, time} from "@nomicfoundation/hardhat-network-helpers"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; -import {Wallet} from "ethers"; +import {Signer} from "ethers"; import hre from "hardhat"; import {deployFacetAsProxy} from "test/core/accounts/utils/deployTestFacet"; import {DEFAULT_CHARITY_ENDOWMENT, DEFAULT_REGISTRAR_CONFIG, wait} from "test/utils"; @@ -28,9 +27,9 @@ describe("IndexFund", function () { const MAX_ENDOWMENT_MEMBERS = 10; - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let owner: Signer; + let proxyAdmin: Signer; + let user: Signer; let registrar: FakeContract; let wmatic: FakeContract; @@ -57,7 +56,7 @@ describe("IndexFund", function () { ]); const IndexFundProxy = await ProxyContract.deploy( IndexFundImpl.address, - proxyAdmin.address, + await proxyAdmin.getAddress(), IndexFundInitData ); await IndexFundProxy.deployed(); @@ -127,7 +126,7 @@ describe("IndexFund", function () { await wait( state.setConfig({ - owner: owner.address, + owner: await owner.getAddress(), version: "1", networkName: "Polygon", registrarContract: registrar.address, @@ -147,7 +146,7 @@ describe("IndexFund", function () { wMaticAddress: wmatic.address, accountsContract: accountsDepositWithdrawEndowments.address, indexFundContract: facet.address, - treasury: owner.address, + treasury: await owner.getAddress(), }; registrar.queryConfig.returns(registrarConfig); registrar.isTokenAccepted.whenCalledWith(token.address).returns(true); diff --git a/test/core/accounts/AccountsAllowance.ts b/test/core/accounts/AccountsAllowance.ts index 27ac9c664..d2982f320 100644 --- a/test/core/accounts/AccountsAllowance.ts +++ b/test/core/accounts/AccountsAllowance.ts @@ -1,6 +1,7 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {time} from "@nomicfoundation/hardhat-network-helpers"; import {expect} from "chai"; +import {Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_CHARITY_ENDOWMENT, wait} from "test/utils"; import { @@ -12,18 +13,16 @@ import { } from "typechain-types"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; -import {time} from "@nomicfoundation/hardhat-network-helpers"; -import {Wallet} from "ethers"; describe("AccountsAllowance", function () { const {ethers} = hre; const ACCOUNT_ID = 42; - let accOwner: SignerWithAddress; - let endowOwner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let accOwner: Signer; + let endowOwner: Signer; + let proxyAdmin: Signer; + let user: Signer; let facet: AccountsAllowance; let state: TestFacetProxyContract; @@ -64,13 +63,13 @@ describe("AccountsAllowance", function () { await wait( state.setEndowmentDetails(ACCOUNT_ID, { ...DEFAULT_CHARITY_ENDOWMENT, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), }) ); // Beneficiaries & Maturity Allowlists set for endowment user - await wait(state.setAllowlist(ACCOUNT_ID, 0, [user.address])); // beneficiaries - await wait(state.setAllowlist(ACCOUNT_ID, 2, [user.address])); // maturity + await wait(state.setAllowlist(ACCOUNT_ID, 0, [await user.getAddress()])); // beneficiaries + await wait(state.setAllowlist(ACCOUNT_ID, 2, [await user.getAddress()])); // maturity }); describe("Test cases for `manageAllowances`", function () { @@ -82,14 +81,16 @@ describe("AccountsAllowance", function () { }) ); await expect( - facet.manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 10) + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10) ).to.be.revertedWith("Endowment is closed"); }); it("reverts for a non-mature endowment when the sender is not the endowment owner or a valid delegate who can control allowlists", async function () { // not the endowment owner sending the message and user is not a delegate await expect( - facet.connect(user).manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 10) + facet + .connect(user) + .manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10) ).to.be.revertedWith("Unauthorized"); }); @@ -101,30 +102,37 @@ describe("AccountsAllowance", function () { await wait( state.setEndowmentDetails(ACCOUNT_ID, { ...DEFAULT_CHARITY_ENDOWMENT, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), maturityTime: currTime - timeDiff, }) ); // not the endowment owner sending the message and user is not a delegate await expect( - facet.connect(user).manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 10) + facet + .connect(user) + .manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10) ).to.be.revertedWith("Unauthorized"); }); }); it("reverts when the token is invalid", async function () { await expect( - facet.manageAllowances(ACCOUNT_ID, user.address, ethers.constants.AddressZero, 10) + facet.manageAllowances( + ACCOUNT_ID, + await user.getAddress(), + ethers.constants.AddressZero, + 10 + ) ).to.be.revertedWith("Invalid Token"); await expect( - facet.manageAllowances(ACCOUNT_ID, user.address, genWallet().address, 10) + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), genWallet().address, 10) ).to.be.revertedWith("Invalid Token"); }); it("reverts when the spender is not in allowlistedBeneficiaries of a non-mature endowment", async function () { await expect( - facet.manageAllowances(ACCOUNT_ID, proxyAdmin.address, tokenFake.address, 10) + facet.manageAllowances(ACCOUNT_ID, await proxyAdmin.getAddress(), tokenFake.address, 10) ).to.be.revertedWith("Spender is not in allowlists"); }); @@ -133,36 +141,40 @@ describe("AccountsAllowance", function () { await wait( state.setEndowmentDetails(ACCOUNT_ID, { ...DEFAULT_CHARITY_ENDOWMENT, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), maturityTime: currTime, }) ); await expect( - facet.manageAllowances(ACCOUNT_ID, proxyAdmin.address, tokenFake.address, 10) + facet.manageAllowances(ACCOUNT_ID, await proxyAdmin.getAddress(), tokenFake.address, 10) ).to.be.revertedWith("Spender is not in allowlists"); }); it("reverts when there are no adjustments needed (ie. proposed amount == spender balance amount)", async function () { // set allowance for user to 10 tokens of total 10 tokens outstanding - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 10, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10) + ); await expect( - facet.manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 10) + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10) ).to.be.revertedWith("Spender balance equal to amount. No changes needed"); }); it("reverts when try to increase a valid token's allowance beyond liquid balance available", async function () { await expect( - facet.manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 100000) + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 100000) ).to.be.revertedWith("Insufficient liquid balance to allocate"); }); it("reverts when try to decrease a valid token's allowance beyond total outstanding balance available", async function () { - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 1000, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 1000, 10) + ); await expect( - facet.manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 100) + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 100) ).to.be.revertedWith("Insufficient allowances outstanding to cover requested reduction"); }); @@ -185,9 +197,11 @@ describe("AccountsAllowance", function () { }); it(`passes when try to increase a valid token's allowance within range of liquid balance available for a ${maturityStatus} endowment`, async function () { - await expect(facet.manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 10)) + await expect( + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10) + ) .to.emit(facet, "AllowanceUpdated") - .withArgs(ACCOUNT_ID, user.address, tokenFake.address, 10, 10, 0); + .withArgs(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10, 0); // endowment liquid balance should be 90 now (100 - 10) const endowBal = await state.getEndowmentTokenBalance(ACCOUNT_ID, tokenFake.address); @@ -195,7 +209,7 @@ describe("AccountsAllowance", function () { // user allowance should be 10 now const allowance = await state.getTokenAllowance( ACCOUNT_ID, - user.address, + await user.getAddress(), tokenFake.address ); expect(allowance).to.equal(10); @@ -209,12 +223,16 @@ describe("AccountsAllowance", function () { it(`passes when try to decrease an existing spender's allowance for a ${maturityStatus} endowment`, async function () { // now we allocate some token allowance to the user address to spend from - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 10, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10) + ); // set a lower total token allowance for the user, returning the delta to liquid balance - await expect(facet.manageAllowances(ACCOUNT_ID, user.address, tokenFake.address, 3)) + await expect( + facet.manageAllowances(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 3) + ) .to.emit(facet, "AllowanceUpdated") - .withArgs(ACCOUNT_ID, user.address, tokenFake.address, 3, 0, 7); + .withArgs(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 3, 0, 7); // endowment liquid balance should be 107 now (100 + 7) const endowBal = await state.getEndowmentTokenBalance(ACCOUNT_ID, tokenFake.address); @@ -222,7 +240,7 @@ describe("AccountsAllowance", function () { // user allowance should be 3 now const allowance = await state.getTokenAllowance( ACCOUNT_ID, - user.address, + await user.getAddress(), tokenFake.address ); expect(allowance).to.equal(3); @@ -240,51 +258,65 @@ describe("AccountsAllowance", function () { it("reverts when try to spend token that is invalid(zero address) or dne in allowances", async function () { // try to spend an allowance that is invalid (Zero Address) await expect( - facet.spendAllowance(ACCOUNT_ID, ethers.constants.AddressZero, 10, user.address) + facet.spendAllowance(ACCOUNT_ID, ethers.constants.AddressZero, 10, await user.getAddress()) ).to.be.revertedWith("Invalid Token"); // try to spend an allowance for a token that dne await expect( - facet.spendAllowance(ACCOUNT_ID, genWallet().address, 10, user.address) + facet.spendAllowance(ACCOUNT_ID, genWallet().address, 10, await user.getAddress()) ).to.be.revertedWith("Invalid Token"); }); it("reverts when try to spend zero amount of allowance", async function () { // now we allocate some token allowance to the user address to spend from - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 10, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10) + ); // try to spend zero allowance await expect( - facet.spendAllowance(ACCOUNT_ID, tokenFake.address, 0, user.address) + facet.spendAllowance(ACCOUNT_ID, tokenFake.address, 0, await user.getAddress()) ).to.be.revertedWith("Zero Amount"); }); it("reverts when try to spend more allowance than is available for token", async function () { // now we allocate some token allowance to the user address to spend from - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 10, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10) + ); // try to spend more allowance than user was allocated await expect( - facet.connect(user).spendAllowance(ACCOUNT_ID, tokenFake.address, 1000, user.address) + facet + .connect(user) + .spendAllowance(ACCOUNT_ID, tokenFake.address, 1000, await user.getAddress()) ).to.be.revertedWith("Amount requested exceeds Allowance balance"); }); it("passes when spend less than or equal to the allowance available for token", async function () { // now we allocate some token allowance to the user address to spend from - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 10, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10) + ); // mint tokens so that the contract can transfer them to recipient tokenFake.transfer.returns(true); // user spends less than what was allocated to them (ie. 5 out of 10 available) await expect( - facet.connect(user).spendAllowance(ACCOUNT_ID, tokenFake.address, 5, user.address) + facet + .connect(user) + .spendAllowance(ACCOUNT_ID, tokenFake.address, 5, await user.getAddress()) ) .to.emit(facet, "AllowanceSpent") - .withArgs(ACCOUNT_ID, user.address, tokenFake.address, 5); + .withArgs(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 5); // user allowance should be 5 now (10 - 5) - const allowance = await state.getTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address); + const allowance = await state.getTokenAllowance( + ACCOUNT_ID, + await user.getAddress(), + tokenFake.address + ); expect(allowance).to.equal(5); const totalOutstanding = await state.getTotalOutstandingAllowance( @@ -297,18 +329,22 @@ describe("AccountsAllowance", function () { describe("upon queryAllowance", function () { beforeEach(async () => { - await wait(state.setTokenAllowance(ACCOUNT_ID, user.address, tokenFake.address, 10, 10)); + await wait( + state.setTokenAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address, 10, 10) + ); }); it("returns 0 (zero) for non-existent endowment", async () => { const nonExistentEndowId = 200; expect( - await facet.queryAllowance(nonExistentEndowId, user.address, tokenFake.address) + await facet.queryAllowance(nonExistentEndowId, await user.getAddress(), tokenFake.address) ).to.equal(0); }); it("returns 0 (zero) for non-existent token", async () => { - expect(await facet.queryAllowance(ACCOUNT_ID, user.address, genWallet().address)).to.equal(0); + expect( + await facet.queryAllowance(ACCOUNT_ID, await user.getAddress(), genWallet().address) + ).to.equal(0); }); it("returns 0 (zero) for non-existent spender", async () => { @@ -318,7 +354,9 @@ describe("AccountsAllowance", function () { }); it("returns accurate allowance", async () => { - expect(await facet.queryAllowance(ACCOUNT_ID, user.address, tokenFake.address)).to.equal(10); + expect( + await facet.queryAllowance(ACCOUNT_ID, await user.getAddress(), tokenFake.address) + ).to.equal(10); }); }); }); diff --git a/test/core/accounts/AccountsCreateEndowment.ts b/test/core/accounts/AccountsCreateEndowment.ts index 0b7ddd0e6..640437508 100644 --- a/test/core/accounts/AccountsCreateEndowment.ts +++ b/test/core/accounts/AccountsCreateEndowment.ts @@ -1,7 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {BigNumber, Wallet} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_REGISTRAR_CONFIG, wait} from "test/utils"; import { @@ -29,9 +28,9 @@ describe("AccountsCreateEndowment", function () { const expectedNextAccountId = 1; - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let charityApplications: SignerWithAddress; + let owner: Signer; + let proxyAdmin: Signer; + let charityApplications: Signer; let facet: AccountsCreateEndowment; let state: TestFacetProxyContract; let createEndowmentRequest: AccountMessages.CreateEndowmentRequestStruct; @@ -48,13 +47,13 @@ describe("AccountsCreateEndowment", function () { const defaultSettingsPermissionsStruct = { locked: false, delegate: { - addr: owner.address, + addr: await owner.getAddress(), expires: 0, }, }; const defaultFeeStruct = { - payoutAddress: owner.address, + payoutAddress: await owner.getAddress(), bps: 1000, }; @@ -69,7 +68,7 @@ describe("AccountsCreateEndowment", function () { endowType: 1, // Endowment logo: "", image: "", - members: [owner.address], + members: [await owner.getAddress()], threshold: 1, allowlistedBeneficiaries: [], allowlistedContributors: [], @@ -123,7 +122,7 @@ describe("AccountsCreateEndowment", function () { }); const config: RegistrarStorage.ConfigStruct = { ...DEFAULT_REGISTRAR_CONFIG, - charityApplications: charityApplications.address, + charityApplications: await charityApplications.getAddress(), multisigFactory: endowmentFactoryFake.address, gasFwdFactory: gasFwdFactoryFake.address, }; @@ -137,7 +136,7 @@ describe("AccountsCreateEndowment", function () { await wait( state.setConfig({ - owner: owner.address, + owner: await owner.getAddress(), version: "1", networkName: "Polygon", registrarContract: registrarFake.address, @@ -176,7 +175,7 @@ describe("AccountsCreateEndowment", function () { ...createEndowmentRequest, earlyLockedWithdrawFee: { bps: 100000, - payoutAddress: owner.address, + payoutAddress: await owner.getAddress(), }, }; @@ -204,7 +203,7 @@ describe("AccountsCreateEndowment", function () { ...createEndowmentRequest, withdrawFee: { bps: 100000, - payoutAddress: owner.address, + payoutAddress: await owner.getAddress(), }, }; @@ -232,7 +231,7 @@ describe("AccountsCreateEndowment", function () { ...createEndowmentRequest, depositFee: { bps: 100000, - payoutAddress: owner.address, + payoutAddress: await owner.getAddress(), }, }; @@ -260,7 +259,7 @@ describe("AccountsCreateEndowment", function () { ...createEndowmentRequest, balanceFee: { bps: 100000, - payoutAddress: owner.address, + payoutAddress: await owner.getAddress(), }, }; diff --git a/test/core/accounts/AccountsDepositWithdrawEndowments.ts b/test/core/accounts/AccountsDepositWithdrawEndowments.ts index b56115982..311ec3b6c 100644 --- a/test/core/accounts/AccountsDepositWithdrawEndowments.ts +++ b/test/core/accounts/AccountsDepositWithdrawEndowments.ts @@ -1,8 +1,7 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; import {impersonateAccount, setBalance, time} from "@nomicfoundation/hardhat-network-helpers"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {BigNumber, Wallet} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_CHARITY_ENDOWMENT, DEFAULT_REGISTRAR_CONFIG, wait} from "test/utils"; import { @@ -52,10 +51,10 @@ describe("AccountsDepositWithdrawEndowments", function () { donationMatch: ethers.constants.AddressZero, }; - let accOwner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let endowOwner: SignerWithAddress; - let indexFund: SignerWithAddress; + let accOwner: Signer; + let proxyAdmin: Signer; + let endowOwner: Signer; + let indexFund: Signer; let facet: AccountsDepositWithdrawEndowments; let state: TestFacetProxyContract; @@ -81,7 +80,7 @@ describe("AccountsDepositWithdrawEndowments", function () { charity = { ...DEFAULT_CHARITY_ENDOWMENT, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), splitToLiquid: {defaultSplit: 25, max: 90, min: 10}, }; normalEndow = { @@ -116,7 +115,7 @@ describe("AccountsDepositWithdrawEndowments", function () { const registrarConfig: RegistrarStorage.ConfigStruct = { ...DEFAULT_REGISTRAR_CONFIG, haloToken: genWallet().address, - indexFundContract: indexFund.address, + indexFundContract: await indexFund.getAddress(), wMaticAddress: wmaticFake.address, treasury: treasury, }; @@ -129,7 +128,7 @@ describe("AccountsDepositWithdrawEndowments", function () { await wait( state.setConfig({ - owner: accOwner.address, + owner: await accOwner.getAddress(), version: "1", networkName: "Polygon", registrarContract: registrarFake.address, @@ -567,7 +566,7 @@ describe("AccountsDepositWithdrawEndowments", function () { it("deposit with endowment-level deposit fee only", async () => { const depositBps: AccountStorage.EndowmentStruct = { ...normalEndow, - depositFee: {payoutAddress: endowOwner.address, bps: 100}, + depositFee: {payoutAddress: await endowOwner.getAddress(), bps: 100}, }; await wait(state.setEndowmentDetails(depositToNormalEndow.id, depositBps)); @@ -608,7 +607,7 @@ describe("AccountsDepositWithdrawEndowments", function () { const depositBps: AccountStorage.EndowmentStruct = { ...normalEndow, - depositFee: {payoutAddress: endowOwner.address, bps: 100}, + depositFee: {payoutAddress: await endowOwner.getAddress(), bps: 100}, }; await wait(state.setEndowmentDetails(depositToNormalEndow.id, depositBps)); @@ -956,7 +955,7 @@ describe("AccountsDepositWithdrawEndowments", function () { // set endowment-level withdraw fee to 0.1% const normalWithFee: AccountStorage.EndowmentStruct = { ...normalEndow, - withdrawFee: {payoutAddress: endowOwner.address, bps: 10}, + withdrawFee: {payoutAddress: await endowOwner.getAddress(), bps: 10}, }; await wait(state.setEndowmentDetails(normalEndowId, normalWithFee)); @@ -977,7 +976,10 @@ describe("AccountsDepositWithdrawEndowments", function () { beneficiaryId ); - expect(tokenFake.transfer).to.have.been.calledWith(endowOwner.address, expectedFeeEndow); + expect(tokenFake.transfer).to.have.been.calledWith( + await endowOwner.getAddress(), + expectedFeeEndow + ); expect(tokenFake.transfer).to.have.been.calledWith( beneficiaryAddress, finalAmountLeftover @@ -1064,7 +1066,7 @@ describe("AccountsDepositWithdrawEndowments", function () { // set Endowment allowlist & withdraw fee const normalWithAllowlist: AccountStorage.EndowmentStruct = { ...normalEndow, - withdrawFee: {payoutAddress: endowOwner.address, bps: 10}, // 0.1% + withdrawFee: {payoutAddress: await endowOwner.getAddress(), bps: 10}, // 0.1% }; await wait(state.setEndowmentDetails(normalEndowId, normalWithAllowlist)); @@ -1088,7 +1090,10 @@ describe("AccountsDepositWithdrawEndowments", function () { ); expect(tokenFake.transfer).to.have.been.calledWith(treasury, expectedFeeAp); - expect(tokenFake.transfer).to.have.been.calledWith(endowOwner.address, expectedFeeEndow); + expect(tokenFake.transfer).to.have.been.calledWith( + await endowOwner.getAddress(), + expectedFeeEndow + ); expect(tokenFake.transfer).to.have.been.calledWith( beneficiaryAddress, finalAmountLeftover @@ -1112,7 +1117,7 @@ describe("AccountsDepositWithdrawEndowments", function () { // set Endowment allowlist & withdraw fee const normalWithAllowlist: AccountStorage.EndowmentStruct = { ...normalEndow, - withdrawFee: {payoutAddress: endowOwner.address, bps: 10}, // 0.1% + withdrawFee: {payoutAddress: await endowOwner.getAddress(), bps: 10}, // 0.1% }; await wait(state.setEndowmentDetails(normalEndowId, normalWithAllowlist)); await wait(state.setAllowlist(normalEndowId, 0, [beneficiaryAddress])); @@ -1144,7 +1149,10 @@ describe("AccountsDepositWithdrawEndowments", function () { let expectedFeeEndow = amount.mul(10).div(10000); let finalAmountLeftover = amount.sub(expectedFeeEndow); - expect(tokenFake.transfer).to.have.been.calledWith(endowOwner.address, expectedFeeEndow); + expect(tokenFake.transfer).to.have.been.calledWith( + await endowOwner.getAddress(), + expectedFeeEndow + ); expect(tokenFake.transfer).to.have.been.calledWith( beneficiaryAddress, finalAmountLeftover @@ -1161,7 +1169,10 @@ describe("AccountsDepositWithdrawEndowments", function () { expectedFeeEndow = amount.mul(10).div(10000); finalAmountLeftover = amount.sub(expectedFeeEndow); - expect(wmaticFake.transfer).to.have.been.calledWith(endowOwner.address, expectedFeeEndow); + expect(wmaticFake.transfer).to.have.been.calledWith( + await endowOwner.getAddress(), + expectedFeeEndow + ); expect(wmaticFake.transfer).to.have.been.calledWith( beneficiaryAddress, finalAmountLeftover @@ -1181,7 +1192,7 @@ describe("AccountsDepositWithdrawEndowments", function () { const normalEndowWithFee: AccountStorage.EndowmentStruct = { ...normalEndow, - withdrawFee: {bps: 10, payoutAddress: endowOwner.address}, + withdrawFee: {bps: 10, payoutAddress: await endowOwner.getAddress()}, }; await wait(state.setEndowmentDetails(normalEndowId, normalEndowWithFee)); @@ -1216,7 +1227,7 @@ describe("AccountsDepositWithdrawEndowments", function () { expect(tokenFake.transfer).to.have.been.calledWith(treasury, protocolWithdrawFee); expect(tokenFake.transfer).to.have.been.calledWith(treasury, protocolEarlyWithdrawFee); expect(tokenFake.transfer).to.have.been.calledWith( - endowOwner.address, + await endowOwner.getAddress(), endowmentWithdrawFee ); expect(tokenFake.transfer).to.have.been.calledWith( @@ -1349,7 +1360,7 @@ describe("AccountsDepositWithdrawEndowments", function () { maturityTime: currTime, }; await wait(state.setEndowmentDetails(normalEndowId, matureEndowment)); - await wait(state.setAllowlist(normalEndowId, 2, [indexFund.address])); + await wait(state.setAllowlist(normalEndowId, 2, [await indexFund.getAddress()])); const acctType = VaultType.LOCKED; const beneficiaryAddress = ethers.constants.AddressZero; diff --git a/test/core/accounts/AccountsGasManager.ts b/test/core/accounts/AccountsGasManager.ts index e75fb0296..74fe7ddca 100644 --- a/test/core/accounts/AccountsGasManager.ts +++ b/test/core/accounts/AccountsGasManager.ts @@ -1,6 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; +import {Signer} from "ethers"; import hre from "hardhat"; import { DEFAULT_ACCOUNTS_CONFIG, @@ -21,14 +21,13 @@ import { import {VaultType} from "types"; import {getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; -import {Wallet} from "ethers"; use(smock.matchers); describe("AccountsGasManager", function () { - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let owner: Signer; + let proxyAdmin: Signer; + let user: Signer; let impl: AccountsGasManager; let token: FakeContract; let gasFwd: FakeContract; @@ -98,13 +97,13 @@ describe("AccountsGasManager", function () { let config = { ...DEFAULT_ACCOUNTS_CONFIG, - owner: owner.address, + owner: await owner.getAddress(), }; await wait(state.setConfig(config)); let endowment = { ...DEFAULT_CHARITY_ENDOWMENT, - owner: user.address, + owner: await user.getAddress(), gasFwd: gasFwd.address, }; await wait(state.setEndowmentDetails(ACCOUNT_ID, endowment)); @@ -150,7 +149,7 @@ describe("AccountsGasManager", function () { let lockedPerms = { ...DEFAULT_PERMISSIONS_STRUCT, delegate: { - addr: user.address, + addr: await user.getAddress(), expires: 0, }, }; @@ -179,7 +178,7 @@ describe("AccountsGasManager", function () { let liquidPerms = { ...DEFAULT_PERMISSIONS_STRUCT, delegate: { - addr: user.address, + addr: await user.getAddress(), expires: 0, }, }; @@ -207,7 +206,7 @@ describe("AccountsGasManager", function () { it("allows the owner to call", async function () { let endowment = { ...DEFAULT_CHARITY_ENDOWMENT, - owner: user.address, + owner: await user.getAddress(), gasFwd: gasFwd.address, }; await wait(state.setEndowmentDetails(ACCOUNT_ID, endowment)); diff --git a/test/core/accounts/AccountsQueryEndowments.ts b/test/core/accounts/AccountsQueryEndowments.ts index b5eb361a5..d0ac9f248 100644 --- a/test/core/accounts/AccountsQueryEndowments.ts +++ b/test/core/accounts/AccountsQueryEndowments.ts @@ -1,6 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; -import {BigNumber, Wallet} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_ACCOUNTS_CONFIG, DEFAULT_CHARITY_ENDOWMENT, wait} from "test/utils"; import { @@ -16,8 +15,8 @@ import {deployFacetAsProxy} from "./utils"; describe("AccountsQueryEndowments", function () { const {ethers} = hre; - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; + let owner: Signer; + let proxyAdmin: Signer; let facet: AccountsQueryEndowments; let state: TestFacetProxyContract; @@ -43,7 +42,7 @@ describe("AccountsQueryEndowments", function () { before(async function () { const signers = await getSigners(hre); owner = signers.apTeam1; - tokenAddress = signers.deployer.address; + tokenAddress = await signers.deployer.getAddress(); proxyAdmin = await getProxyAdminOwner(hre); @@ -65,7 +64,7 @@ describe("AccountsQueryEndowments", function () { config = { ...DEFAULT_ACCOUNTS_CONFIG, - owner: owner.address, + owner: await owner.getAddress(), nextAccountId: accountId + 1, // endowment was created in previous step }; await wait(state.setConfig(config)); diff --git a/test/core/accounts/AccountsStrategy.ts b/test/core/accounts/AccountsStrategy.ts index 3b080a6f0..33817cf07 100644 --- a/test/core/accounts/AccountsStrategy.ts +++ b/test/core/accounts/AccountsStrategy.ts @@ -1,7 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {BigNumber, Wallet} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import { DEFAULT_ACCOUNTS_CONFIG, @@ -62,9 +61,9 @@ describe("AccountsStrategy", function () { const NET_NAME_THIS = "ThisNet"; const NET_NAME_THAT = "ThatNet"; - let owner: SignerWithAddress; - let admin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let owner: Signer; + let admin: Signer; + let user: Signer; let gasFwd: FakeContract; let gasService: FakeContract; @@ -128,14 +127,14 @@ describe("AccountsStrategy", function () { liquidInvestmentManagement: { locked: false, delegate: { - addr: owner.address, + addr: await owner.getAddress(), expires: 0, }, }, lockedInvestmentManagement: { locked: false, delegate: { - addr: owner.address, + addr: await owner.getAddress(), expires: 0, }, }, @@ -152,7 +151,7 @@ describe("AccountsStrategy", function () { axelarGateway: gateway.address, gasReceiver: gasService.address, router: router.address, - refundAddr: user.address, + refundAddr: await user.getAddress(), }; netInfoThat = { ...DEFAULT_NETWORK_INFO, @@ -1571,7 +1570,7 @@ describe("AccountsStrategy", function () { facet.executeWithToken( ethers.utils.formatBytes32String("true"), NET_NAME_THIS, - owner.address, + await owner.getAddress(), payload, await token.symbol(), 1 @@ -1625,14 +1624,14 @@ describe("AccountsStrategy", function () { facet.executeWithToken( ethers.utils.formatBytes32String("true"), NET_NAME_THAT, - owner.address, + await owner.getAddress(), payload, await token.symbol(), 1 ) ) .to.be.revertedWithCustomError(facet, "UnexpectedCaller") - .withArgs(returnedAction, NET_NAME_THAT, owner.address); + .withArgs(returnedAction, NET_NAME_THAT, await owner.getAddress()); }); it("reverts if the call didn't originate from the chain's router", async function () { diff --git a/test/core/accounts/AccountsSwapRouter.ts b/test/core/accounts/AccountsSwapRouter.ts index 21c805e2a..debe93732 100644 --- a/test/core/accounts/AccountsSwapRouter.ts +++ b/test/core/accounts/AccountsSwapRouter.ts @@ -1,6 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; import {time} from "@nomicfoundation/hardhat-network-helpers"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {expect, use} from "chai"; import hre from "hardhat"; import {deployDummyERC20} from "tasks/helpers"; @@ -28,15 +28,14 @@ import { import {VaultType} from "types"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; -import {Wallet} from "ethers"; use(smock.matchers); describe("AccountsSwapRouter", function () { const {ethers} = hre; - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let owner: Signer; + let proxyAdmin: Signer; + let user: Signer; let facet: AccountsSwapRouter; let facetImpl: AccountsSwapRouter; let state: TestFacetProxyContract; @@ -271,7 +270,7 @@ describe("AccountsSwapRouter", function () { ...DEFAULT_PERMISSIONS_STRUCT, delegate: { expires: 0, - addr: user.address, + addr: await user.getAddress(), }, }; await wait(state.setEndowmentDetails(ACCOUNT_ID, endow)); @@ -294,7 +293,7 @@ describe("AccountsSwapRouter", function () { ...DEFAULT_PERMISSIONS_STRUCT, delegate: { expires: 0, - addr: user.address, + addr: await user.getAddress(), }, }; await wait(state.setEndowmentDetails(ACCOUNT_ID, endow)); @@ -315,7 +314,7 @@ describe("AccountsSwapRouter", function () { registrar.isTokenAccepted.returns(true); const endow = { ...DEFAULT_CHARITY_ENDOWMENT, - owner: owner.address, + owner: await owner.getAddress(), }; await wait(state.setEndowmentDetails(ACCOUNT_ID, endow)); registrar.queryTokenPriceFeed.returns(ethers.constants.AddressZero); @@ -340,7 +339,7 @@ describe("AccountsSwapRouter", function () { registrar.isTokenAccepted.returns(true); const endow = { ...DEFAULT_CHARITY_ENDOWMENT, - owner: owner.address, + owner: await owner.getAddress(), }; await wait(state.setEndowmentDetails(ACCOUNT_ID, endow)); registrar.queryTokenPriceFeed.returns(chainlink.address); @@ -367,7 +366,7 @@ describe("AccountsSwapRouter", function () { const endow = { ...DEFAULT_CHARITY_ENDOWMENT, - owner: owner.address, + owner: await owner.getAddress(), }; token1 = await deployDummyERC20(owner); token2 = await deployDummyERC20(owner); diff --git a/test/core/accounts/AccountsUpdate.ts b/test/core/accounts/AccountsUpdate.ts index 768d19548..8507b3004 100644 --- a/test/core/accounts/AccountsUpdate.ts +++ b/test/core/accounts/AccountsUpdate.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {expect} from "chai"; import hre from "hardhat"; import {DEFAULT_CHARITY_ENDOWMENT, wait} from "test/utils"; @@ -7,14 +7,13 @@ import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetP import {EndowmentType} from "types"; import {getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; -import {Wallet} from "ethers"; describe("AccountsUpdate", function () { const {ethers} = hre; - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let owner: Signer; + let proxyAdmin: Signer; + let user: Signer; let facet: AccountsUpdate; let state: TestFacetProxyContract; @@ -29,8 +28,8 @@ describe("AccountsUpdate", function () { proxyAdmin = await getProxyAdminOwner(hre); - newRegistrar = signers.apTeam1.address; - endowment = {...DEFAULT_CHARITY_ENDOWMENT, owner: owner.address}; + newRegistrar = await signers.apTeam1.getAddress(); + endowment = {...DEFAULT_CHARITY_ENDOWMENT, owner: await owner.getAddress()}; }); beforeEach(async function () { @@ -44,7 +43,7 @@ describe("AccountsUpdate", function () { await wait( state.setConfig({ - owner: owner.address, + owner: await owner.getAddress(), version: "1", networkName: "Polygon", registrarContract: ethers.constants.AddressZero, @@ -58,17 +57,17 @@ describe("AccountsUpdate", function () { describe("updateOwner", () => { it("should update the owner when called by the current owner", async () => { - await expect(facet.updateOwner(user.address)) + await expect(facet.updateOwner(await user.getAddress())) .to.emit(facet, "OwnerUpdated") - .withArgs(user.address); + .withArgs(await user.getAddress()); const {owner} = await state.getConfig(); - expect(owner).to.equal(user.address); + expect(owner).to.equal(await user.getAddress()); }); it("should revert when called by a non-owner address", async () => { - await expect(facet.connect(user).updateOwner(user.address)).to.be.revertedWith( + await expect(facet.connect(user).updateOwner(await user.getAddress())).to.be.revertedWith( "Unauthorized" ); }); diff --git a/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts b/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts index b3a2e3f06..73bb40579 100644 --- a/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts +++ b/test/core/accounts/AccountsUpdateEndowmentSettingsController.ts @@ -1,5 +1,5 @@ import {smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {time} from "@nomicfoundation/hardhat-network-helpers"; import {expect, use} from "chai"; import hre from "hardhat"; @@ -16,7 +16,6 @@ import { } from "typechain-types/contracts/test/accounts/TestFacetProxyContract"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy, updateAllSettings} from "./utils"; -import {Wallet} from "ethers"; use(smock.matchers); @@ -26,9 +25,9 @@ describe("AccountsUpdateEndowmentSettingsController", function () { const charityId = 1; const normalEndowId = 2; - let owner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let endowOwner: SignerWithAddress; + let owner: Signer; + let proxyAdmin: Signer; + let endowOwner: Signer; let facet: AccountsUpdateEndowmentSettingsController; let state: TestFacetProxyContract; @@ -46,7 +45,7 @@ describe("AccountsUpdateEndowmentSettingsController", function () { charity = { ...DEFAULT_CHARITY_ENDOWMENT, maturityTime: 0, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), }; normalEndow = { ...charity, @@ -61,7 +60,7 @@ describe("AccountsUpdateEndowmentSettingsController", function () { await wait( state.setConfig({ - owner: owner.address, + owner: await owner.getAddress(), version: "1", networkName: "", registrarContract: ethers.constants.AddressZero, diff --git a/test/core/accounts/AccountsUpdateEndowments.ts b/test/core/accounts/AccountsUpdateEndowments.ts index 11a561401..448ad064a 100644 --- a/test/core/accounts/AccountsUpdateEndowments.ts +++ b/test/core/accounts/AccountsUpdateEndowments.ts @@ -1,7 +1,6 @@ import {smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {BigNumberish, Wallet} from "ethers"; +import {BigNumberish, Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_CHARITY_ENDOWMENT, wait} from "test/utils"; import { @@ -29,10 +28,10 @@ describe("AccountsUpdateEndowments", function () { const charityId = 1; const normalEndowId = 2; - let accOwner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let endowOwner: SignerWithAddress; - let delegate: SignerWithAddress; + let accOwner: Signer; + let proxyAdmin: Signer; + let endowOwner: Signer; + let delegate: Signer; let facet: AccountsUpdateEndowments; let state: TestFacetProxyContract; @@ -51,9 +50,9 @@ describe("AccountsUpdateEndowments", function () { oldCharity = { ...DEFAULT_CHARITY_ENDOWMENT, dao: genWallet().address, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), // maturityAllowlist: [genWallet().address], - multisig: endowOwner.address, + multisig: await endowOwner.getAddress(), }; oldNormalEndow = { ...oldCharity, @@ -197,7 +196,7 @@ describe("AccountsUpdateEndowments", function () { await updateAllSettings( charityReq.id, { - delegate: {addr: delegate.address, expires: blockTimestamp - 1}, + delegate: {addr: await delegate.getAddress(), expires: blockTimestamp - 1}, }, state ); @@ -214,7 +213,7 @@ describe("AccountsUpdateEndowments", function () { await updateAllSettings( normalEndowReq.id, { - delegate: {addr: delegate.address, expires: blockTimestamp - 1}, + delegate: {addr: await delegate.getAddress(), expires: blockTimestamp - 1}, }, state ); @@ -243,7 +242,7 @@ describe("AccountsUpdateEndowments", function () { it("updates all charity settings except those updateable only by owner", async () => { await updateAllSettings( charityReq.id, - {delegate: {addr: delegate.address, expires: 0}}, + {delegate: {addr: await delegate.getAddress(), expires: 0}}, state ); @@ -265,7 +264,7 @@ describe("AccountsUpdateEndowments", function () { it("updates all normal endowment settings except those updateable only by owner", async () => { await updateAllSettings( normalEndowReq.id, - {delegate: {addr: delegate.address, expires: 0}}, + {delegate: {addr: await delegate.getAddress(), expires: 0}}, state ); @@ -476,7 +475,7 @@ describe("AccountsUpdateEndowments", function () { field, { delegate: { - addr: delegate.address, + addr: await delegate.getAddress(), expires: blockTimestamp - 1, }, }, @@ -548,7 +547,7 @@ describe("AccountsUpdateEndowments", function () { "acceptedTokens", { delegate: { - addr: delegate.address, + addr: await delegate.getAddress(), expires: blockTimestamp - 1, }, }, @@ -605,7 +604,7 @@ describe("AccountsUpdateEndowments", function () { await wait( state.setConfig({ networkName: "test", - owner: accOwner.address, + owner: await accOwner.getAddress(), version: "1", registrarContract: registrarFake.address, nextAccountId: 1, diff --git a/test/core/accounts/AccountsUpdateStatusEndowments.ts b/test/core/accounts/AccountsUpdateStatusEndowments.ts index c737677e2..eac873608 100644 --- a/test/core/accounts/AccountsUpdateStatusEndowments.ts +++ b/test/core/accounts/AccountsUpdateStatusEndowments.ts @@ -1,5 +1,5 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {expect, use} from "chai"; import hre from "hardhat"; import { @@ -23,7 +23,6 @@ import {AccountStorage} from "typechain-types/contracts/test/accounts/TestFacetP import {BeneficiaryEnum, EndowmentType} from "types"; import {genWallet, getProxyAdminOwner, getSigners} from "utils"; import {deployFacetAsProxy} from "./utils"; -import {Wallet} from "ethers"; use(smock.matchers); @@ -43,9 +42,9 @@ describe("AccountsUpdateStatusEndowments", function () { (x) => ethers.utils.id(x).slice(0, 10) // map to bytes4 selectors ); - let accOwner: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let endowOwner: SignerWithAddress; + let accOwner: Signer; + let proxyAdmin: Signer; + let endowOwner: Signer; let facet: AccountsUpdateStatusEndowments; let state: TestFacetProxyContract; @@ -63,20 +62,20 @@ describe("AccountsUpdateStatusEndowments", function () { const signers = await getSigners(hre); accOwner = signers.apTeam1; endowOwner = signers.deployer; - treasuryAddress = signers.apTeam2.address; + treasuryAddress = await signers.apTeam2.getAddress(); proxyAdmin = await getProxyAdminOwner(hre); - charity_endowment = {...DEFAULT_CHARITY_ENDOWMENT, owner: endowOwner.address}; + charity_endowment = {...DEFAULT_CHARITY_ENDOWMENT, owner: await endowOwner.getAddress()}; ast_endowment = { ...DEFAULT_CHARITY_ENDOWMENT, endowType: EndowmentType.Ast, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), }; daf_endowment = { ...DEFAULT_CHARITY_ENDOWMENT, endowType: EndowmentType.Daf, - owner: endowOwner.address, + owner: await endowOwner.getAddress(), }; }); @@ -108,7 +107,7 @@ describe("AccountsUpdateStatusEndowments", function () { await wait( state.setConfig({ - owner: accOwner.address, + owner: await accOwner.getAddress(), version: "1", networkName: "Polygon", registrarContract: registrarFake.address, diff --git a/test/core/accounts/utils/deployTestFacet.ts b/test/core/accounts/utils/deployTestFacet.ts index ba4a69454..009854902 100644 --- a/test/core/accounts/utils/deployTestFacet.ts +++ b/test/core/accounts/utils/deployTestFacet.ts @@ -1,15 +1,14 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {Wallet} from "ethers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {TestFacetProxyContract__factory, TestFacetProxyContract} from "typechain-types"; export async function deployFacetAsProxy( hre: HardhatRuntimeEnvironment, - deployer: SignerWithAddress | Wallet, - proxyAdmin: SignerWithAddress | Wallet, + deployer: Signer, + proxyAdmin: Signer, implementation: string ): Promise { let Proxy = new TestFacetProxyContract__factory(deployer); - let proxy = await Proxy.deploy(implementation, proxyAdmin.address, []); + let proxy = await Proxy.deploy(implementation, await proxyAdmin.getAddress(), []); await proxy.deployed(); return proxy; } diff --git a/test/core/gasFwd/GasFwd.ts b/test/core/gasFwd/GasFwd.ts index 34a4e5434..7aa64081e 100644 --- a/test/core/gasFwd/GasFwd.ts +++ b/test/core/gasFwd/GasFwd.ts @@ -1,7 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {expect, use} from "chai"; -import {Wallet} from "ethers"; import hre from "hardhat"; import { GasFwd, @@ -17,26 +16,26 @@ use(smock.matchers); describe("GasFwd", function () { const BALANCE = 1000; - let owner: SignerWithAddress; - let admin: SignerWithAddress | Wallet; - let accounts: SignerWithAddress; + let owner: Signer; + let admin: Signer; + let accounts: Signer; let token: FakeContract; let gasFwd: GasFwd; async function deployGasFwdAsProxy( - owner: SignerWithAddress, - admin: SignerWithAddress | Wallet, - accounts: SignerWithAddress + owner: Signer, + admin: Signer, + accounts: Signer ): Promise { let GasFwd = new GasFwd__factory(admin); let gasFwdImpl = await GasFwd.deploy(); await gasFwdImpl.deployed(); const data = gasFwdImpl.interface.encodeFunctionData("initialize", [ - accounts ? accounts.address : owner.address, + accounts ? await accounts.getAddress() : await owner.getAddress(), ]); let proxyFactory = new ProxyContract__factory(owner); - let proxy = await proxyFactory.deploy(gasFwdImpl.address, admin.address, data); + let proxy = await proxyFactory.deploy(gasFwdImpl.address, await admin.getAddress(), data); await proxy.deployed(); return GasFwd__factory.connect(proxy.address, accounts); } @@ -77,19 +76,19 @@ describe("GasFwd", function () { await expect(gasFwd.payForGas(token.address, amount)) .to.emit(gasFwd, "GasPay") .withArgs(token.address, amount); - expect(token.transfer).to.have.been.calledWith(accounts.address, amount); + expect(token.transfer).to.have.been.calledWith(await accounts.getAddress(), amount); }); it("transfers tokens when amount to transfer is equal to balance", async function () { await expect(gasFwd.payForGas(token.address, BALANCE)) .to.emit(gasFwd, "GasPay") .withArgs(token.address, BALANCE); - expect(token.transfer).to.have.been.calledWith(accounts.address, BALANCE); + expect(token.transfer).to.have.been.calledWith(await accounts.getAddress(), BALANCE); }); it("transfers tokens when the call exceeds the balance", async function () { await expect(gasFwd.payForGas(token.address, BALANCE + 1)) .to.emit(gasFwd, "GasPay") .withArgs(token.address, BALANCE); - expect(token.transfer).to.have.been.calledWith(accounts.address, BALANCE); + expect(token.transfer).to.have.been.calledWith(await accounts.getAddress(), BALANCE); }); }); @@ -110,7 +109,7 @@ describe("GasFwd", function () { await expect(gasFwd.sweep(token.address)) .to.emit(gasFwd, "Sweep") .withArgs(token.address, BALANCE); - expect(token.transfer).to.have.been.calledWith(accounts.address, BALANCE); + expect(token.transfer).to.have.been.calledWith(await accounts.getAddress(), BALANCE); }); }); }); diff --git a/test/core/gasFwd/GasFwdFactory.ts b/test/core/gasFwd/GasFwdFactory.ts index dc11af766..c393a99fa 100644 --- a/test/core/gasFwd/GasFwdFactory.ts +++ b/test/core/gasFwd/GasFwdFactory.ts @@ -1,7 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {expect, use} from "chai"; -import {Wallet} from "ethers"; import hre from "hardhat"; import {DEFAULT_REGISTRAR_CONFIG} from "test/utils"; import { @@ -17,21 +16,21 @@ use(smock.matchers); describe("GasFwdFactory", function () { const {ethers} = hre; - let owner: SignerWithAddress; - let admin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let owner: Signer; + let admin: Signer; + let user: Signer; let registrarFake: FakeContract; async function deployGasFwdFactory( - owner: SignerWithAddress, - admin: SignerWithAddress | Wallet, + owner: Signer, + admin: Signer, registrar: string ): Promise { let GasFwd = new GasFwd__factory(admin); let gasFwdImpl = await GasFwd.deploy(); await gasFwdImpl.deployed(); let GFF = new GasFwdFactory__factory(owner); - let gff = await GFF.deploy(gasFwdImpl.address, admin.address, registrar); + let gff = await GFF.deploy(gasFwdImpl.address, await admin.getAddress(), registrar); await gff.deployed(); return gff; } diff --git a/test/core/registrar/LocalRegistrar.ts b/test/core/registrar/LocalRegistrar.ts index 5ab8ad7fc..0f4f54e68 100644 --- a/test/core/registrar/LocalRegistrar.ts +++ b/test/core/registrar/LocalRegistrar.ts @@ -1,6 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; -import {BigNumber} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_NETWORK_INFO} from "test/utils"; import {LocalRegistrar, LocalRegistrar__factory} from "typechain-types"; @@ -11,8 +10,8 @@ import {getSigners} from "utils"; describe("Local Registrar", function () { const {ethers, upgrades} = hre; - let owner: SignerWithAddress; - let user: SignerWithAddress; + let owner: Signer; + let user: Signer; let Registrar: LocalRegistrar__factory; let defaultRebalParams = { @@ -63,7 +62,7 @@ describe("Local Registrar", function () { }); it("Should set the right owner", async function () { - expect(await registrar.owner()).to.equal(owner.address); + expect(await registrar.owner()).to.equal(await owner.getAddress()); }); it("Should set the default parameters as specified by the Registrar Config", async function () { @@ -157,24 +156,26 @@ describe("Local Registrar", function () { describe("setTokenAccepted and isTokenAccepted", async function () { it("Should be an owner restricted method", async function () { - await expect(registrar.connect(user).setTokenAccepted(user.address, true)).to.be.reverted; + await expect(registrar.connect(user).setTokenAccepted(await user.getAddress(), true)).to.be + .reverted; }); it("Should accept and set the new value", async function () { - await expect(registrar.setTokenAccepted(user.address, true)).to.not.be.reverted; - let returnedValue = await registrar.isTokenAccepted(user.address); + await expect(registrar.setTokenAccepted(await user.getAddress(), true)).to.not.be.reverted; + let returnedValue = await registrar.isTokenAccepted(await user.getAddress()); expect(returnedValue).to.be.true; }); }); describe("setGasByToken and getGasByToken", async function () { it("Should be an owner restricted method", async function () { - await expect(registrar.connect(user).setGasByToken(user.address, 1)).to.be.reverted; + await expect(registrar.connect(user).setGasByToken(await user.getAddress(), 1)).to.be + .reverted; }); it("Should accept and set the new value", async function () { - await expect(registrar.setGasByToken(user.address, 1)).to.not.be.reverted; - let returnedValue = await registrar.getGasByToken(user.address); + await expect(registrar.setGasByToken(await user.getAddress(), 1)).to.not.be.reverted; + let returnedValue = await registrar.getGasByToken(await user.getAddress()); expect(returnedValue.toNumber()).to.equal(1); }); }); @@ -308,13 +309,15 @@ describe("Local Registrar", function () { describe("set and get vaultOperatorApproved", async function () { it("Should be an owner restricted method", async function () { - await expect(registrar.connect(user).setVaultOperatorApproved(user.address, true)).to.be - .reverted; + await expect( + registrar.connect(user).setVaultOperatorApproved(await user.getAddress(), true) + ).to.be.reverted; }); it("Should set and get the vault operator approval status", async function () { - expect(await registrar.getVaultOperatorApproved(user.address)).to.be.false; - await expect(registrar.setVaultOperatorApproved(user.address, true)).to.not.be.reverted; - expect(await registrar.getVaultOperatorApproved(user.address)).to.be.true; + expect(await registrar.getVaultOperatorApproved(await user.getAddress())).to.be.false; + await expect(registrar.setVaultOperatorApproved(await user.getAddress(), true)).to.not.be + .reverted; + expect(await registrar.getVaultOperatorApproved(await user.getAddress())).to.be.true; }); }); @@ -330,32 +333,37 @@ describe("Local Registrar", function () { it("Should revert if a single fee meets or exceeds 100%", async function () { // setting to 100% should fail outright await expect( - registrar.setFeeSettingsByFeesType(FeeTypes.Deposit, 10000, user.address) + registrar.setFeeSettingsByFeesType(FeeTypes.Deposit, 10000, await user.getAddress()) ).to.be.revertedWith("Fees meet or exceed 100%"); }); it("Should revert if combined Withdraw-related fees meet or exceeds 100%", async function () { // First set a Withdraw Fee as 50% - await expect(registrar.setFeeSettingsByFeesType(FeeTypes.Withdraw, 5000, user.address)).to - .not.be.reverted; + await expect( + registrar.setFeeSettingsByFeesType(FeeTypes.Withdraw, 5000, await user.getAddress()) + ).to.not.be.reverted; // Trying to set an Early Locked Withdraw Fee at, or above, 50% should fail await expect( registrar.setFeeSettingsByFeesType( FeeTypes.EarlyLockedWithdraw, BigNumber.from(6000), - user.address + await user.getAddress() ) ).to.be.revertedWith("Fees meet or exceed 100%"); }); it("Should set a fee rate (in bps) and a payout address", async function () { await expect( - registrar.setFeeSettingsByFeesType(FeeTypes.Harvest, BigNumber.from(5000), user.address) + registrar.setFeeSettingsByFeesType( + FeeTypes.Harvest, + BigNumber.from(5000), + await user.getAddress() + ) ).to.not.be.reverted; let afterHarvestFee = await registrar.getFeeSettingsByFeeType(FeeTypes.Harvest); expect(afterHarvestFee.bps).to.equal(5000); - expect(afterHarvestFee.payoutAddress).to.equal(user.address); + expect(afterHarvestFee.payoutAddress).to.equal(await user.getAddress()); }); }); }); @@ -381,7 +389,7 @@ describe("Local Registrar", function () { }); it("should emit TokenAcceptanceUpdated", async function () { - await expect(registrar.setTokenAccepted(user.address, true)).to.emit( + await expect(registrar.setTokenAccepted(await user.getAddress(), true)).to.emit( registrar, "TokenAcceptanceUpdated" ); @@ -406,7 +414,10 @@ describe("Local Registrar", function () { }); it("should emit GasFeeUpdated", async function () { - await expect(registrar.setGasByToken(user.address, 1)).to.emit(registrar, "GasFeeUpdated"); + await expect(registrar.setGasByToken(await user.getAddress(), 1)).to.emit( + registrar, + "GasFeeUpdated" + ); }); }); }); diff --git a/test/core/router/Router.ts b/test/core/router/Router.ts index 501a37486..83f16b52f 100644 --- a/test/core/router/Router.ts +++ b/test/core/router/Router.ts @@ -1,7 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {expect, use} from "chai"; -import {Wallet} from "ethers"; import hre from "hardhat"; import { DEFAULT_ACTION_DATA, @@ -33,10 +32,10 @@ use(smock.matchers); describe("Router", function () { const {ethers} = hre; - let owner: SignerWithAddress; - let admin: SignerWithAddress | Wallet; - let user: SignerWithAddress; - let collector: SignerWithAddress; + let owner: Signer; + let admin: Signer; + let user: Signer; + let collector: Signer; let deadAddr = "0x000000000000000000000000000000000000dead"; const originatingChain = "Polygon"; const localChain = "Ethereum"; @@ -61,14 +60,14 @@ describe("Router", function () { const RouterProxy = await ProxyContract.deploy( RouterImpl.address, - admin.address, + await admin.getAddress(), RouterInitData ); await RouterProxy.deployed(); return Router__factory.connect(RouterProxy.address, owner); } - async function upgradeProxy(signer: SignerWithAddress | Wallet, routerProxy: string) { + async function upgradeProxy(signer: Signer, routerProxy: string) { const RouterFactory = new Router__factory(owner); const RouterImpl = await RouterFactory.deploy(); await RouterImpl.deployed(); @@ -108,7 +107,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; gateway.validateContractCall.returns(true); @@ -118,7 +117,9 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.thisChain.returns(localChain); router = await deployRouterAsProxy(registrar.address); }); @@ -128,7 +129,7 @@ describe("Router", function () { router.executeWithToken( ethers.utils.formatBytes32String("true"), originatingChain, - owner.address, + await owner.getAddress(), ethers.utils.formatBytes32String("payload"), "USDC", 1 @@ -142,7 +143,7 @@ describe("Router", function () { .connect(user) .executeWithTokenLocal( localChain, - user.address, + await user.getAddress(), ethers.utils.formatBytes32String("payload"), "USDC", 1 @@ -155,7 +156,7 @@ describe("Router", function () { router.execute( ethers.utils.formatBytes32String("true"), originatingChain, - owner.address, + await owner.getAddress(), ethers.utils.formatBytes32String("payload") ) ).to.be.revertedWith("Unauthorized Call"); @@ -165,7 +166,11 @@ describe("Router", function () { await expect( router .connect(user) - .executeLocal(localChain, user.address, ethers.utils.formatBytes32String("payload")) + .executeLocal( + localChain, + await user.getAddress(), + ethers.utils.formatBytes32String("payload") + ) ).to.be.revertedWith("Unauthorized local call"); }); @@ -224,7 +229,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; gateway.validateContractCall.returns(true); @@ -235,7 +240,9 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.getGasByToken.whenCalledWith(token.address).returns(GAS_COST); registrar.thisChain.returns(localChain); token.transfer.returns(true); @@ -398,7 +405,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; gateway.validateContractCall.returns(true); @@ -411,7 +418,7 @@ describe("Router", function () { .returns(accountsContract); registrar.getAccountsContractAddressByChain .whenCalledWith(localChain) - .returns(owner.address); + .returns(await owner.getAddress()); registrar.getGasByToken.whenCalledWith(token.address).returns(GAS_COST); registrar.thisChain.returns(localChain); token.transfer.returns(true); @@ -439,7 +446,7 @@ describe("Router", function () { ) .to.emit(router, "ErrorLogged") .withArgs(Array, "Only deposit accepts tokens"); - expect(token.transfer).to.have.been.calledWith(collector.address, TOTAL_AMT); + expect(token.transfer).to.have.been.calledWith(await collector.getAddress(), TOTAL_AMT); }); it("when the payload amt doesn't match the GMP amt", async function () { @@ -459,7 +466,7 @@ describe("Router", function () { ) .to.emit(router, "ErrorLogged") .withArgs(Array, "Amount mismatch"); - expect(token.transfer).to.have.been.calledWith(collector.address, TOTAL_AMT - 1); + expect(token.transfer).to.have.been.calledWith(await collector.getAddress(), TOTAL_AMT - 1); }); it("when the vault values are both zero", async function () { @@ -501,7 +508,7 @@ describe("Router", function () { ) .to.emit(router, "ErrorLogged") .withArgs(Array, "Token not accepted"); - expect(token.transfer).to.have.been.calledWith(collector.address, TOTAL_AMT); + expect(token.transfer).to.have.been.calledWith(await collector.getAddress(), TOTAL_AMT); }); it("when the strategy is not approved", async function () { @@ -521,7 +528,7 @@ describe("Router", function () { ) .to.emit(router, "ErrorLogged") .withArgs(Array, "Strategy not approved"); - expect(token.transfer).to.have.been.calledWith(collector.address, TOTAL_AMT); + expect(token.transfer).to.have.been.calledWith(await collector.getAddress(), TOTAL_AMT); }); it("when the strategy is not approved for execute", async function () { @@ -572,7 +579,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; const stratParams: LocalRegistrarLib.StrategyParamsStruct = { @@ -590,7 +597,9 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.getGasByToken.whenCalledWith(token.address).returns(GAS_COST); registrar.getStrategyApprovalState.returns(StrategyApprovalState.APPROVED); registrar.getStrategyParamsById.returns(stratParams); @@ -708,7 +717,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; const stratParams: LocalRegistrarLib.StrategyParamsStruct = { @@ -726,7 +735,9 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.getStrategyApprovalState.returns(StrategyApprovalState.APPROVED); registrar.getStrategyParamsById.returns(stratParams); token.transfer.returns(true); @@ -786,7 +797,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; const stratParams: LocalRegistrarLib.StrategyParamsStruct = { @@ -803,11 +814,16 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.getGasByToken.whenCalledWith(token.address).returns(GAS_COST); registrar.getStrategyApprovalState.returns(StrategyApprovalState.APPROVED); registrar.getStrategyParamsById.returns(stratParams); - registrar.getFeeSettingsByFeeType.returns({payoutAddress: collector.address, bps: 1}); + registrar.getFeeSettingsByFeeType.returns({ + payoutAddress: await collector.getAddress(), + bps: 1, + }); registrar.thisChain.returns(localChain); token.transfer.returns(true); token.transferFrom.returns(true); @@ -866,7 +882,7 @@ describe("Router", function () { TOTAL_AMT - GAS_COST, token.address, GAS_COST, - collector.address + await collector.getAddress() ); expect(gateway.callContractWithToken).to.have.been.calledWith( originatingChain, @@ -935,7 +951,7 @@ describe("Router", function () { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, gasReceiver: gasService.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; const stratParams: LocalRegistrarLib.StrategyParamsStruct = { @@ -952,11 +968,16 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.getGasByToken.whenCalledWith(token.address).returns(GAS_COST); registrar.getStrategyApprovalState.returns(StrategyApprovalState.APPROVED); registrar.getStrategyParamsById.returns(stratParams); - registrar.getFeeSettingsByFeeType.returns({payoutAddress: collector.address, bps: 1}); + registrar.getFeeSettingsByFeeType.returns({ + payoutAddress: await collector.getAddress(), + bps: 1, + }); registrar.thisChain.returns(localChain); token.transfer.returns(true); token.transferFrom.returns(true); @@ -1015,7 +1036,7 @@ describe("Router", function () { TOTAL_AMT - GAS_COST, token.address, GAS_COST, - collector.address + await collector.getAddress() ); expect(gateway.callContractWithToken).to.have.been.calledWith( originatingChain, @@ -1078,7 +1099,7 @@ describe("Router", function () { const networkParams = { ...DEFAULT_NETWORK_INFO, axelarGateway: gateway.address, - refundAddr: collector.address, + refundAddr: await collector.getAddress(), }; const stratParams: LocalRegistrarLib.StrategyParamsStruct = { @@ -1095,11 +1116,16 @@ describe("Router", function () { registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) .returns(accountsContract); - registrar.getAccountsContractAddressByChain.whenCalledWith(localChain).returns(owner.address); + registrar.getAccountsContractAddressByChain + .whenCalledWith(localChain) + .returns(await owner.getAddress()); registrar.getStrategyApprovalState.returns(StrategyApprovalState.APPROVED); registrar.getStrategyParamsById.returns(stratParams); - registrar.getVaultOperatorApproved.whenCalledWith(owner.address).returns(true); - registrar.getFeeSettingsByFeeType.returns({payoutAddress: collector.address, bps: 1}); + registrar.getVaultOperatorApproved.whenCalledWith(await owner.getAddress()).returns(true); + registrar.getFeeSettingsByFeeType.returns({ + payoutAddress: await collector.getAddress(), + bps: 1, + }); registrar.thisChain.returns(localChain); token.transfer.returns(true); token.transferFrom.returns(true); @@ -1164,11 +1190,14 @@ describe("Router", function () { registrar.queryNetworkConnection.returns(networkParams); registrar.getAccountsContractAddressByChain .whenCalledWith(originatingChain) - .returns(owner.address); + .returns(await owner.getAddress()); registrar.getStrategyApprovalState.returns(StrategyApprovalState.APPROVED); registrar.getStrategyParamsById.returns(stratParams); - registrar.getVaultOperatorApproved.whenCalledWith(owner.address).returns(true); - registrar.getFeeSettingsByFeeType.returns({payoutAddress: collector.address, bps: 1}); + registrar.getVaultOperatorApproved.whenCalledWith(await owner.getAddress()).returns(true); + registrar.getFeeSettingsByFeeType.returns({ + payoutAddress: await collector.getAddress(), + bps: 1, + }); registrar.thisChain.returns(originatingChain); token.transfer.returns(true); token.transferFrom.returns(true); @@ -1210,7 +1239,7 @@ describe("Router", function () { expect(liquidVault.harvest).to.have.been.calledWith(requestData.accountIds); expect(token.transfer).to.have.been.calledWith(router.address, LOCK_AMT); expect(token.transfer).to.have.been.calledWith(router.address, LIQ_AMT); - expect(token.transfer).to.have.been.calledWith(collector.address, TOTAL_AMT); + expect(token.transfer).to.have.been.calledWith(await collector.getAddress(), TOTAL_AMT); }); }); }); diff --git a/test/core/vault/Vault.ts b/test/core/vault/Vault.ts index 1e21200fa..37d314c1b 100644 --- a/test/core/vault/Vault.ts +++ b/test/core/vault/Vault.ts @@ -1,7 +1,6 @@ import {FakeContract, smock} from "@defi-wonderland/smock"; -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect, use} from "chai"; -import {BigNumber, Wallet} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import { DEFAULT_NETWORK, @@ -38,10 +37,10 @@ describe("Vault", function () { let registrarFake: FakeContract; let vaultEmitterFake: FakeContract; - let owner: SignerWithAddress; - let user: SignerWithAddress; - let admin: SignerWithAddress | Wallet; - let collector: SignerWithAddress; + let owner: Signer; + let user: Signer; + let admin: Signer; + let collector: Signer; async function deployVault( { @@ -104,7 +103,7 @@ describe("Vault", function () { token.decimals.returns(DECIMALS); vault = await deployVault( { - admin: owner.address, + admin: await owner.getAddress(), baseToken: token.address, yieldToken: token.address, }, @@ -123,7 +122,7 @@ describe("Vault", function () { await expect( deployVault( { - admin: owner.address, + admin: await owner.getAddress(), baseToken: ethers.constants.AddressZero, yieldToken: ethers.constants.AddressZero, }, @@ -141,7 +140,7 @@ describe("Vault", function () { token = await smock.fake(new DummyERC20__factory()); vault = await deployVault( { - admin: owner.address, + admin: await owner.getAddress(), baseToken: token.address, yieldToken: token.address, }, @@ -159,12 +158,12 @@ describe("Vault", function () { expect(config.yieldToken).to.equal(token.address); expect(config.apTokenName).to.equal(DEFAULT_VAULT_NAME); expect(config.apTokenSymbol).to.equal(DEFAULT_VAULT_SYMBOL); - expect(admin).to.equal(owner.address); + expect(admin).to.equal(await owner.getAddress()); }); it("should accept new config values", async function () { let newConfig = { - strategy: user.address, - registrar: user.address, + strategy: await user.getAddress(), + registrar: await user.getAddress(), } as IVault.VaultConfigStruct; await vault.setVaultConfig(newConfig); let queriedConfig = await vault.getVaultConfig(); @@ -173,8 +172,8 @@ describe("Vault", function () { }); it("should revert when a non-admin calls the set method", async function () { let newConfig = { - strategy: user.address, - registrar: user.address, + strategy: await user.getAddress(), + registrar: await user.getAddress(), } as IVault.VaultConfigStruct; await expect(vault.connect(user).setVaultConfig(newConfig)).to.be.reverted; }); @@ -202,14 +201,14 @@ describe("Vault", function () { strategyId: DEFAULT_STRATEGY_ID, baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); registrarFake = await smock.fake(new LocalRegistrar__factory()); - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(true); + registrarFake.getVaultOperatorApproved.whenCalledWith(await owner.getAddress()).returns(true); vault = await deployVault( { vaultType: 1, // Liquid - admin: owner.address, + admin: await owner.getAddress(), baseToken: baseToken.address, yieldToken: yieldToken.address, strategy: strategy.address, @@ -221,15 +220,17 @@ describe("Vault", function () { registrarFake.thisChain.returns(DEFAULT_NETWORK); registrarFake.queryNetworkConnection.whenCalledWith(DEFAULT_NETWORK).returns({ ...DEFAULT_NETWORK_INFO, - router: owner.address, + router: await owner.getAddress(), }); }); it("reverts if the operator isn't approved as an operator, sibling vault, or approved router", async function () { - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(false); + registrarFake.getVaultOperatorApproved + .whenCalledWith(await owner.getAddress()) + .returns(false); registrarFake.queryNetworkConnection.whenCalledWith(DEFAULT_NETWORK).returns({ ...DEFAULT_NETWORK_INFO, - router: user.address, + router: await user.getAddress(), }); await expect(vault.deposit(0, baseToken.address, 1)).to.be.revertedWithCustomError( vault, @@ -324,7 +325,7 @@ describe("Vault", function () { strategyId: DEFAULT_STRATEGY_ID, baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); const networkParams = { ...DEFAULT_NETWORK_INFO, @@ -333,16 +334,16 @@ describe("Vault", function () { registrarFake = await smock.fake(new LocalRegistrar__factory()); registrarFake.thisChain.returns(DEFAULT_NETWORK); registrarFake.queryNetworkConnection.returns(networkParams); - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(true); + registrarFake.getVaultOperatorApproved.whenCalledWith(await owner.getAddress()).returns(true); registrarFake.getFeeSettingsByFeeType.returns({ - payoutAddress: collector.address, + payoutAddress: await collector.getAddress(), bps: TAX_RATE, }); vault = await deployVault( { vaultType: 0, // Locked - admin: owner.address, + admin: await owner.getAddress(), baseToken: baseToken.address, yieldToken: yieldToken.address, strategy: strategy.address, @@ -365,7 +366,9 @@ describe("Vault", function () { }); it("reverts if the caller isn't approved", async function () { - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(false); + registrarFake.getVaultOperatorApproved + .whenCalledWith(await owner.getAddress()) + .returns(false); await expect(vault.redeem(0, DEPOSIT / 2)).to.be.revertedWithCustomError( vault, "OnlyApproved" @@ -459,7 +462,7 @@ describe("Vault", function () { strategyId: DEFAULT_STRATEGY_ID, baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); const networkParams = { ...DEFAULT_NETWORK_INFO, @@ -468,16 +471,16 @@ describe("Vault", function () { registrarFake = await smock.fake(new LocalRegistrar__factory()); registrarFake.thisChain.returns(DEFAULT_NETWORK); registrarFake.queryNetworkConnection.returns(networkParams); - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(true); + registrarFake.getVaultOperatorApproved.whenCalledWith(await owner.getAddress()).returns(true); registrarFake.getFeeSettingsByFeeType.returns({ - payoutAddress: collector.address, + payoutAddress: await collector.getAddress(), bps: TAX_RATE, }); vault = await deployVault( { vaultType: 0, // Locked - admin: owner.address, + admin: await owner.getAddress(), baseToken: baseToken.address, yieldToken: yieldToken.address, strategy: strategy.address, @@ -497,7 +500,9 @@ describe("Vault", function () { }); it("reverts if the caller isn't approved", async function () { - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(false); + registrarFake.getVaultOperatorApproved + .whenCalledWith(await owner.getAddress()) + .returns(false); await expect(vault.redeemAll(0)).to.be.revertedWithCustomError(vault, "OnlyApproved"); }); @@ -525,7 +530,10 @@ describe("Vault", function () { vault.address, DEPOSIT * 2 ); - expect(baseToken.approve).to.have.been.calledWith(owner.address, DEPOSIT * 2 - expectedTax); + expect(baseToken.approve).to.have.been.calledWith( + await owner.getAddress(), + DEPOSIT * 2 - expectedTax + ); expect(baseToken.approve).to.have.been.calledWith(router.address, expectedTax); }); @@ -566,13 +574,13 @@ describe("Vault", function () { strategyId: DEFAULT_STRATEGY_ID, baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); registrarFake = await smock.fake(new LocalRegistrar__factory()); - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(true); + registrarFake.getVaultOperatorApproved.whenCalledWith(await owner.getAddress()).returns(true); registrarFake.getFeeSettingsByFeeType .whenCalledWith(1) - .returns({payoutAddress: collector.address, bps: TAX_RATE}); + .returns({payoutAddress: await collector.getAddress(), bps: TAX_RATE}); registrarFake.thisChain.returns(DEFAULT_NETWORK); registrarFake.queryNetworkConnection.whenCalledWith(DEFAULT_NETWORK).returns({ ...DEFAULT_NETWORK_INFO, @@ -586,7 +594,7 @@ describe("Vault", function () { vault = await deployVault( { vaultType: 1, // Locked - admin: owner.address, + admin: await owner.getAddress(), baseToken: baseToken.address, yieldToken: yieldToken.address, strategy: strategy.address, @@ -605,11 +613,13 @@ describe("Vault", function () { }); it("reverts if the caller isn't approved", async function () { - registrarFake.getVaultOperatorApproved.whenCalledWith(owner.address).returns(false); + registrarFake.getVaultOperatorApproved + .whenCalledWith(await owner.getAddress()) + .returns(false); registrarFake.thisChain.returns(DEFAULT_NETWORK); registrarFake.queryNetworkConnection.whenCalledWith(DEFAULT_NETWORK).returns({ ...DEFAULT_NETWORK_INFO, - router: user.address, + router: await user.getAddress(), }); await expect(vault.harvest([0])).to.be.revertedWithCustomError(vault, "OnlyApproved"); }); @@ -654,12 +664,12 @@ describe("Vault", function () { strategyId: DEFAULT_STRATEGY_ID, baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); liquidVault = await deployVault( { vaultType: 1, // Liquid - admin: owner.address, + admin: await owner.getAddress(), baseToken: baseToken.address, yieldToken: yieldToken.address, strategy: liquidStrategy.address, @@ -670,7 +680,7 @@ describe("Vault", function () { lockedVault = await deployVault( { vaultType: 0, // Locked - admin: owner.address, + admin: await owner.getAddress(), baseToken: baseToken.address, yieldToken: yieldToken.address, strategy: strategy.address, @@ -689,7 +699,7 @@ describe("Vault", function () { registrarFake.thisChain.returns(DEFAULT_NETWORK); registrarFake.queryNetworkConnection.whenCalledWith(DEFAULT_NETWORK).returns({ ...DEFAULT_NETWORK_INFO, - router: owner.address, + router: await owner.getAddress(), }); registrarFake.getRebalanceParams.returns({ rebalanceLiquidProfits: false, @@ -722,7 +732,7 @@ describe("Vault", function () { liquidStrategy.deposit.returns(expectedRebalAmt); liquidStrategy.paused.returns(false); await expect(lockedVault.harvest([0])).to.not.be.reverted; - expect(baseToken.approve).to.have.been.calledWith(owner.address, expectedTaxAmt); + expect(baseToken.approve).to.have.been.calledWith(await owner.getAddress(), expectedTaxAmt); expect(baseToken.transfer).to.have.been.calledWith(liquidVault.address, expectedRebalAmt); expect(baseToken.approve).to.have.been.calledWith(liquidStrategy.address, expectedRebalAmt); }); diff --git a/test/halo/Halo.ts b/test/halo/Halo.ts index c1fbbe3c2..825087fdb 100644 --- a/test/halo/Halo.ts +++ b/test/halo/Halo.ts @@ -1,6 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; -import {BigNumber, Wallet} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import {Halo, Halo__factory} from "typechain-types"; import {getProxyAdminOwner, getSigners} from "utils"; @@ -8,9 +7,9 @@ import {getProxyAdminOwner, getSigners} from "utils"; describe("Halo token", function () { let Halo: Halo__factory; - let deployer: SignerWithAddress; - let proxyAdmin: SignerWithAddress | Wallet; - let user: SignerWithAddress; + let deployer: Signer; + let proxyAdmin: Signer; + let user: Signer; describe("upon Deployment", async function () { let halo: Halo; @@ -28,10 +27,10 @@ describe("Halo token", function () { }); it("Sends the specified amount to the specified recipient", async function () { - expect(await halo.balanceOf(deployer.address)).to.equal(INITIALSUPPLY); + expect(await halo.balanceOf(await deployer.getAddress())).to.equal(INITIALSUPPLY); }); it("Does not mint tokens for the deployer implicitly", async function () { - expect(await halo.balanceOf(user.address)).to.equal(0); + expect(await halo.balanceOf(await user.getAddress())).to.equal(0); }); it("Creates initial tokens only for the contract deployer", async function () { expect(await halo.totalSupply()).to.equal(INITIALSUPPLY); diff --git a/test/integrations/flux/FluxStrategy.ts b/test/integrations/flux/FluxStrategy.ts index 6c72a1611..d9f86fec1 100644 --- a/test/integrations/flux/FluxStrategy.ts +++ b/test/integrations/flux/FluxStrategy.ts @@ -1,6 +1,5 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; import {expect} from "chai"; -import {BigNumber} from "ethers"; +import {BigNumber, Signer} from "ethers"; import hre from "hardhat"; import {DEFAULT_STRATEGY_ID, deployDummyERC20, deployDummyFUSDC, wait} from "test/utils"; import { @@ -14,9 +13,9 @@ import { describe("FluxStrategy", function () { const {ethers} = hre; - let owner: SignerWithAddress; - let user: SignerWithAddress; - let collector: SignerWithAddress; + let owner: Signer; + let user: Signer; + let collector: Signer; async function deployFluxStrategy({ baseToken, @@ -48,23 +47,23 @@ describe("FluxStrategy", function () { }); it("deploys", async function () { flux = await deployFluxStrategy({ - baseToken: user.address, - yieldToken: user.address, - admin: owner.address, + baseToken: await user.getAddress(), + yieldToken: await user.getAddress(), + admin: await owner.getAddress(), }); expect(flux); }); it("sets the config according to the input params", async function () { flux = await deployFluxStrategy({ - baseToken: user.address, - yieldToken: collector.address, - admin: owner.address, + baseToken: await user.getAddress(), + yieldToken: await collector.getAddress(), + admin: await owner.getAddress(), }); let config = await flux.getStrategyConfig(); - expect(config.baseToken).to.equal(user.address); - expect(config.yieldToken).to.equal(collector.address); + expect(config.baseToken).to.equal(await user.getAddress()); + expect(config.yieldToken).to.equal(await collector.getAddress()); expect(config.strategyId).to.equal(DEFAULT_STRATEGY_ID); - expect(config.admin).to.equal(owner.address); + expect(config.admin).to.equal(await owner.getAddress()); }); }); @@ -72,9 +71,9 @@ describe("FluxStrategy", function () { let flux: FluxStrategy; beforeEach(async function () { flux = await deployFluxStrategy({ - baseToken: user.address, - yieldToken: user.address, - admin: owner.address, + baseToken: await user.getAddress(), + yieldToken: await user.getAddress(), + admin: await owner.getAddress(), }); }); it("reverts if a non-admin calls the `pause` method", async function () { @@ -97,9 +96,9 @@ describe("FluxStrategy", function () { let flux: FluxStrategy; beforeEach(async function () { flux = await deployFluxStrategy({ - baseToken: user.address, - yieldToken: user.address, - admin: owner.address, + baseToken: await user.getAddress(), + yieldToken: await user.getAddress(), + admin: await owner.getAddress(), }); }); it("reverts if set is called by a non-admin", async function () { @@ -108,7 +107,7 @@ describe("FluxStrategy", function () { baseToken: ethers.constants.AddressZero, yieldToken: ethers.constants.AddressZero, strategyId: "0xffffffff", - admin: user.address, + admin: await user.getAddress(), }) ).to.be.revertedWithCustomError(flux, "AdminOnly"); }); @@ -118,14 +117,14 @@ describe("FluxStrategy", function () { baseToken: ethers.constants.AddressZero, yieldToken: ethers.constants.AddressZero, strategyId: "0xffffffff", - admin: user.address, + admin: await user.getAddress(), }) ).to.emit(flux, "ConfigChanged"); let config = await flux.getStrategyConfig(); expect(config.baseToken).to.equal(ethers.constants.AddressZero); expect(config.yieldToken).to.equal(ethers.constants.AddressZero); expect(config.strategyId).to.equal("0xffffffff"); - expect(config.admin).to.equal(user.address); + expect(config.admin).to.equal(await user.getAddress()); }); }); describe("upon Deposit", async function () { @@ -140,7 +139,7 @@ describe("FluxStrategy", function () { flux = await deployFluxStrategy({ baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); }); it("reverts when paused", async function () { @@ -151,13 +150,13 @@ describe("FluxStrategy", function () { await expect(flux.deposit(0)).to.be.revertedWithCustomError(flux, "ZeroAmount"); }); it("reverts if the baseToken transfer fails", async function () { - await wait(baseToken.mint(owner.address, 1)); + await wait(baseToken.mint(await owner.getAddress(), 1)); await wait(baseToken.setTransferAllowed(false)); await expect(flux.deposit(1)).to.be.revertedWithCustomError(flux, "TransferFailed"); await wait(baseToken.setTransferAllowed(true)); }); it("reverts if the baseToken approve fails", async function () { - await wait(baseToken.mint(owner.address, 1)); + await wait(baseToken.mint(await owner.getAddress(), 1)); await wait(baseToken.approve(flux.address, 1)); await wait(baseToken.setApproveAllowed(false)); await wait(yieldToken.setResponseAmt(1)); @@ -165,7 +164,7 @@ describe("FluxStrategy", function () { await wait(baseToken.setApproveAllowed(true)); }); it("reverts if the deposit fails", async function () { - await wait(baseToken.mint(owner.address, 1)); + await wait(baseToken.mint(await owner.getAddress(), 1)); await wait(baseToken.approve(flux.address, 1)); await wait(yieldToken.setResponseAmt(1)); await wait(yieldToken.setMintAllowed(false)); @@ -173,7 +172,7 @@ describe("FluxStrategy", function () { await wait(yieldToken.setMintAllowed(true)); }); it("reverts if the yieldToken approve fails", async function () { - await wait(baseToken.mint(owner.address, 1)); + await wait(baseToken.mint(await owner.getAddress(), 1)); await wait(baseToken.approve(flux.address, 1)); await wait(yieldToken.setResponseAmt(1)); await wait(yieldToken.setApproveAllowed(false)); @@ -181,13 +180,13 @@ describe("FluxStrategy", function () { await wait(yieldToken.setApproveAllowed(true)); }); it("correctly executes the deposit", async function () { - await wait(baseToken.mint(owner.address, 10)); + await wait(baseToken.mint(await owner.getAddress(), 10)); await wait(baseToken.approve(flux.address, 10)); await wait(yieldToken.setResponseAmt(10)); expect(await flux.deposit(10)); let baseTokenBal = await baseToken.balanceOf(yieldToken.address); let yieldBal = await yieldToken.balanceOf(flux.address); - await wait(yieldToken.transferFrom(flux.address, owner.address, yieldBal)); + await wait(yieldToken.transferFrom(flux.address, await owner.getAddress(), yieldBal)); expect(baseTokenBal).to.equal(10); expect(yieldBal).to.equal(10); }); @@ -205,13 +204,13 @@ describe("FluxStrategy", function () { flux = await deployFluxStrategy({ baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); - await wait(baseToken.mint(owner.address, DEPOSIT_AMT)); + await wait(baseToken.mint(await owner.getAddress(), DEPOSIT_AMT)); await wait(baseToken.approve(flux.address, DEPOSIT_AMT)); await wait(yieldToken.setResponseAmt(DEPOSIT_AMT)); await wait(flux.deposit(DEPOSIT_AMT)); - await wait(yieldToken.transferFrom(flux.address, owner.address, DEPOSIT_AMT)); + await wait(yieldToken.transferFrom(flux.address, await owner.getAddress(), DEPOSIT_AMT)); }); it("reverts when paused", async function () { await expect(flux.pause()).to.not.be.reverted; @@ -253,7 +252,7 @@ describe("FluxStrategy", function () { expect(await flux.withdraw(10)); let baseTokenBal = await baseToken.balanceOf(flux.address); expect(baseTokenBal).to.equal(10); - await wait(baseToken.transferFrom(flux.address, owner.address, 10)); + await wait(baseToken.transferFrom(flux.address, await owner.getAddress(), 10)); }); }); describe("upon previewDeposit and previewWithdraw", async function () { @@ -271,7 +270,7 @@ describe("FluxStrategy", function () { flux = await deployFluxStrategy({ baseToken: baseToken.address, yieldToken: yieldToken.address, - admin: owner.address, + admin: await owner.getAddress(), }); }); it("correctly applies the exchange rate for previewDeposit", async function () { diff --git a/test/integrations/goldfinch/GoldfinchVault.ts.old b/test/integrations/goldfinch/GoldfinchVault.ts.old index 5ab9babd6..f2e09c15b 100644 --- a/test/integrations/goldfinch/GoldfinchVault.ts.old +++ b/test/integrations/goldfinch/GoldfinchVault.ts.old @@ -17,9 +17,9 @@ import {StrategyApprovalState, getSigners} from "utils"; describe("Goldfinch Vault", function () { const {ethers, upgrades} = hre; - let owner: SignerWithAddress; - let taxCollector: SignerWithAddress; - let user: SignerWithAddress; + let owner: Signer; + let taxCollector: Signer; + let user: Signer; let Registrar: LocalRegistrar__factory; let Vault: GoldfinchVault__factory; let StakingToken: DummyERC20__factory; // FIDU @@ -73,7 +73,7 @@ describe("Goldfinch Vault", function () { let configuredApParams = defaultApParams; configuredApParams.protocolTaxCollector = taxCollector.address; // Set the owner address as the router for ease of test - configuredApParams.routerAddr = owner.address; + configuredApParams.routerAddr = await owner.getAddress(); await registrar.setAngelProtocolParams(configuredApParams); // Set the strategy params in the registrar for Goldfinch @@ -458,7 +458,7 @@ describe("Goldfinch Vault", function () { await liquidVault.redeem(ACCOUNTID1, stableToken.address, STABLETOKENAMOUNT); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(STABLETOKENAMOUNT); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(0); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( STABLETOKENAMOUNT ); }); @@ -483,7 +483,7 @@ describe("Goldfinch Vault", function () { expect(await stableToken.balanceOf(liquidVault.address)).to.equal(REDUCEDSTABLETOKENAMOUNT); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(0); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( REDUCEDSTABLETOKENAMOUNT ); }); @@ -507,7 +507,7 @@ describe("Goldfinch Vault", function () { let redemptionAmt = STABLETOKENAMOUNT.sub(expectedTax); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(expectedTax); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(redemptionAmt); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( redemptionAmt ); }); @@ -621,7 +621,7 @@ describe("Goldfinch Vault", function () { await liquidVault.redeemAll(ACCOUNTID1); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(STABLETOKENAMOUNT); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(0); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( STABLETOKENAMOUNT ); }); @@ -645,7 +645,7 @@ describe("Goldfinch Vault", function () { let redemptionAmt = STABLETOKENWITHYIELD.sub(expectedTax); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(expectedTax); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(redemptionAmt); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( redemptionAmt ); }); diff --git a/test/integrations/goldfinch/GoldfinchVault.ts_old b/test/integrations/goldfinch/GoldfinchVault.ts_old index 5ab9babd6..f2e09c15b 100644 --- a/test/integrations/goldfinch/GoldfinchVault.ts_old +++ b/test/integrations/goldfinch/GoldfinchVault.ts_old @@ -17,9 +17,9 @@ import {StrategyApprovalState, getSigners} from "utils"; describe("Goldfinch Vault", function () { const {ethers, upgrades} = hre; - let owner: SignerWithAddress; - let taxCollector: SignerWithAddress; - let user: SignerWithAddress; + let owner: Signer; + let taxCollector: Signer; + let user: Signer; let Registrar: LocalRegistrar__factory; let Vault: GoldfinchVault__factory; let StakingToken: DummyERC20__factory; // FIDU @@ -73,7 +73,7 @@ describe("Goldfinch Vault", function () { let configuredApParams = defaultApParams; configuredApParams.protocolTaxCollector = taxCollector.address; // Set the owner address as the router for ease of test - configuredApParams.routerAddr = owner.address; + configuredApParams.routerAddr = await owner.getAddress(); await registrar.setAngelProtocolParams(configuredApParams); // Set the strategy params in the registrar for Goldfinch @@ -458,7 +458,7 @@ describe("Goldfinch Vault", function () { await liquidVault.redeem(ACCOUNTID1, stableToken.address, STABLETOKENAMOUNT); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(STABLETOKENAMOUNT); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(0); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( STABLETOKENAMOUNT ); }); @@ -483,7 +483,7 @@ describe("Goldfinch Vault", function () { expect(await stableToken.balanceOf(liquidVault.address)).to.equal(REDUCEDSTABLETOKENAMOUNT); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(0); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( REDUCEDSTABLETOKENAMOUNT ); }); @@ -507,7 +507,7 @@ describe("Goldfinch Vault", function () { let redemptionAmt = STABLETOKENAMOUNT.sub(expectedTax); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(expectedTax); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(redemptionAmt); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( redemptionAmt ); }); @@ -621,7 +621,7 @@ describe("Goldfinch Vault", function () { await liquidVault.redeemAll(ACCOUNTID1); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(STABLETOKENAMOUNT); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(0); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( STABLETOKENAMOUNT ); }); @@ -645,7 +645,7 @@ describe("Goldfinch Vault", function () { let redemptionAmt = STABLETOKENWITHYIELD.sub(expectedTax); expect(await stableToken.balanceOf(taxCollector.address)).to.equal(expectedTax); expect(await stableToken.balanceOf(liquidVault.address)).to.equal(redemptionAmt); - expect(await stableToken.allowance(liquidVault.address, owner.address)).to.equal( + expect(await stableToken.allowance(liquidVault.address, await owner.getAddress())).to.equal( redemptionAmt ); }); diff --git a/test/utils/dummyAxelar.ts b/test/utils/dummyAxelar.ts index edbe82d6c..15d98cd39 100644 --- a/test/utils/dummyAxelar.ts +++ b/test/utils/dummyAxelar.ts @@ -1,4 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import { DummyGateway__factory, DummyGateway, @@ -6,14 +6,14 @@ import { DummyGasService, } from "typechain-types"; -export async function deployDummyGateway(deployer: SignerWithAddress): Promise { +export async function deployDummyGateway(deployer: Signer): Promise { let Gateway = new DummyGateway__factory(deployer); const gateway = await Gateway.deploy(); await gateway.deployed(); return gateway; } -export async function deployDummyGasService(deployer: SignerWithAddress): Promise { +export async function deployDummyGasService(deployer: Signer): Promise { let GasService = new DummyGasService__factory(deployer); const gasService = await GasService.deploy(); await gasService.deployed(); diff --git a/test/utils/dummyERC20.ts b/test/utils/dummyERC20.ts index 0339ed838..29a4ab165 100644 --- a/test/utils/dummyERC20.ts +++ b/test/utils/dummyERC20.ts @@ -1,14 +1,11 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {DummyERC20__factory, DummyERC20} from "typechain-types"; export async function mint(token: DummyERC20, to: string, amt: number) { await token.mint(to, amt); } -export async function deployDummyERC20( - deployer: SignerWithAddress, - decimals?: number -): Promise { +export async function deployDummyERC20(deployer: Signer, decimals?: number): Promise { const decs = decimals ? decimals : 0; let Token = new DummyERC20__factory(deployer); const token = await Token.deploy(decs); diff --git a/test/utils/dummyRouter.ts b/test/utils/dummyRouter.ts index 6bd9651d4..81bfa8c13 100644 --- a/test/utils/dummyRouter.ts +++ b/test/utils/dummyRouter.ts @@ -1,7 +1,7 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {DummyRouter, DummyRouter__factory} from "typechain-types"; -export async function deployDummyRouter(deployer: SignerWithAddress): Promise { +export async function deployDummyRouter(deployer: Signer): Promise { let Router = new DummyRouter__factory(deployer); const router = await Router.deploy(); await router.deployed(); diff --git a/test/utils/dummyStrategy.ts b/test/utils/dummyStrategy.ts index bb53f82af..e5be7ef04 100644 --- a/test/utils/dummyStrategy.ts +++ b/test/utils/dummyStrategy.ts @@ -1,9 +1,9 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {DummyStrategy, DummyStrategy__factory, IStrategy} from "typechain-types"; import {DEFAULT_STRATEGY_ID} from "./constants"; export async function deployDummyStrategy( - deployer: SignerWithAddress, + deployer: Signer, { baseToken, yieldToken, diff --git a/test/utils/dummyVault.ts b/test/utils/dummyVault.ts index 13c6e5abd..98308abe4 100644 --- a/test/utils/dummyVault.ts +++ b/test/utils/dummyVault.ts @@ -1,11 +1,11 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {ADDRESS_ZERO} from "utils"; import {DummyVault, DummyVault__factory, IVault} from "typechain-types"; import {DEFAULT_STRATEGY_ID, DEFAULT_VAULT_NAME, DEFAULT_VAULT_SYMBOL} from "./constants"; export async function deployDummyVault( - deployer: SignerWithAddress, + deployer: Signer, { vaultType = 0, strategyId = DEFAULT_STRATEGY_ID, diff --git a/test/utils/integrations/flux/dummyFUSDC.ts b/test/utils/integrations/flux/dummyFUSDC.ts index 844ad2752..7e7d59958 100644 --- a/test/utils/integrations/flux/dummyFUSDC.ts +++ b/test/utils/integrations/flux/dummyFUSDC.ts @@ -1,10 +1,7 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {DummyFUSDC__factory, DummyFUSDC} from "typechain-types"; -export async function deployDummyFUSDC( - deployer: SignerWithAddress, - underlying: string -): Promise { +export async function deployDummyFUSDC(deployer: Signer, underlying: string): Promise { let FUSDC = new DummyFUSDC__factory(deployer); const fUSDC = await FUSDC.deploy(underlying); await fUSDC.deployed(); diff --git a/utils/deploy.ts b/utils/deploy.ts index 7f57f0802..28a78aa4c 100644 --- a/utils/deploy.ts +++ b/utils/deploy.ts @@ -1,5 +1,4 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; -import {BytesLike, ContractFactory, Wallet} from "ethers"; +import {BytesLike, ContractFactory, Signer} from "ethers"; import {submitMultiSigTx} from "tasks/helpers"; import {ITransparentUpgradeableProxy__factory, ProxyContract__factory} from "typechain-types"; import {Deployment, ProxyDeployment} from "types"; @@ -81,7 +80,7 @@ export async function deployBehindProxy( export async function upgradeProxy( factory: T, proxyAdminMultiSig: string, - proxyAdminOwner: SignerWithAddress | Wallet, + proxyAdminOwner: Signer, proxyToUpgrade: string ): Promise | undefined> { const deployment = await deploy(factory); diff --git a/utils/signers/connectSignerFromPkey.ts b/utils/signers/connectSignerFromPkey.ts index 0cbce32e5..f21195f07 100644 --- a/utils/signers/connectSignerFromPkey.ts +++ b/utils/signers/connectSignerFromPkey.ts @@ -1,9 +1,9 @@ -import {Wallet} from "ethers"; +import {Signer, Wallet} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; export async function connectSignerFromPkey( pkey: string, hre: HardhatRuntimeEnvironment -): Promise { +): Promise { return new Wallet(pkey, hre.ethers.provider); } diff --git a/utils/signers/getAPTeamOwner.ts b/utils/signers/getAPTeamOwner.ts index 8f29ef994..049dc4765 100644 --- a/utils/signers/getAPTeamOwner.ts +++ b/utils/signers/getAPTeamOwner.ts @@ -1,13 +1,12 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {connectSignerFromPkey} from "./connectSignerFromPkey"; import {getSigners} from "./getSigners"; -import {Wallet} from "ethers"; export async function getAPTeamOwner( hre: HardhatRuntimeEnvironment, pkey?: string -): Promise { +): Promise { if (pkey) { return await connectSignerFromPkey(pkey, hre); } diff --git a/utils/signers/getCharityApplicationsOwner.ts b/utils/signers/getCharityApplicationsOwner.ts index 2ea86b805..3c551f059 100644 --- a/utils/signers/getCharityApplicationsOwner.ts +++ b/utils/signers/getCharityApplicationsOwner.ts @@ -1,13 +1,12 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {connectSignerFromPkey} from "./connectSignerFromPkey"; import {getSigners} from "./getSigners"; -import {Wallet} from "ethers"; export async function getCharityApplicationsOwner( hre: HardhatRuntimeEnvironment, pkey?: string -): Promise { +): Promise { if (pkey) { return await connectSignerFromPkey(pkey, hre); } diff --git a/utils/signers/getProxyAdminOwner.ts b/utils/signers/getProxyAdminOwner.ts index 96a38ca3d..c0a14d62a 100644 --- a/utils/signers/getProxyAdminOwner.ts +++ b/utils/signers/getProxyAdminOwner.ts @@ -1,13 +1,12 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {connectSignerFromPkey} from "./connectSignerFromPkey"; import {getSigners} from "./getSigners"; -import {Wallet} from "ethers"; export async function getProxyAdminOwner( hre: HardhatRuntimeEnvironment, pkey?: string -): Promise { +): Promise { if (pkey) { return await connectSignerFromPkey(pkey, hre); } diff --git a/utils/signers/getSigners.ts b/utils/signers/getSigners.ts index 541f58aeb..35fecf358 100644 --- a/utils/signers/getSigners.ts +++ b/utils/signers/getSigners.ts @@ -1,18 +1,18 @@ -import {SignerWithAddress} from "@nomiclabs/hardhat-ethers/signers"; +import {Signer} from "ethers"; import {HardhatRuntimeEnvironment} from "hardhat/types"; import {isProdNetwork} from "../networkHelpers"; type Result = { - airdropOwner?: SignerWithAddress; - apTeam1: SignerWithAddress; - apTeam2: SignerWithAddress; - apTeam3: SignerWithAddress; - charityApplicationsOwners?: SignerWithAddress[]; - apTeamMultisigOwners?: SignerWithAddress[]; - proxyAdminMultisigOwners?: SignerWithAddress[]; - deployer: SignerWithAddress; - timeLockAdmin?: SignerWithAddress; - treasury?: SignerWithAddress; + airdropOwner?: Signer; + apTeam1: Signer; + apTeam2: Signer; + apTeam3: Signer; + charityApplicationsOwners?: Signer[]; + apTeamMultisigOwners?: Signer[]; + proxyAdminMultisigOwners?: Signer[]; + deployer: Signer; + timeLockAdmin?: Signer; + treasury?: Signer; }; export async function getSigners(hre: HardhatRuntimeEnvironment): Promise {