Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Remove direct "hardhat" imports, update types in deploy/ scripts #284

Merged
merged 3 commits into from
Apr 28, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions deploy/001_deploy_hubpool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { L1_ADDRESS_MAP } from "./consts";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
7 changes: 3 additions & 4 deletions deploy/002_deploy_optimism_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { L1_ADDRESS_MAP } from "./consts";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/003_deploy_optimism_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "hardhat-deploy";
import hre from "hardhat";
import { deployNewProxy } from "../utils";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const hubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const chainId = await hre.getChainId();
console.log(`Using L1 (chainId ${chainId}) hub pool @ ${hubPool.address}`);
Expand Down
7 changes: 3 additions & 4 deletions deploy/004_deploy_arbitrum_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { L1_ADDRESS_MAP } from "./consts";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/005_deploy_arbitrum_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "hardhat-deploy";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { L2_ADDRESS_MAP } from "./consts";
import { deployNewProxy } from "../utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const hubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const chainId = await hre.getChainId();
console.log(`Using L1 (chainId ${chainId}) hub pool @ ${hubPool.address}`);
Expand Down
6 changes: 3 additions & 3 deletions deploy/006_deploy_ethereum_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

Expand Down
8 changes: 3 additions & 5 deletions deploy/007_deploy_ethereum_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
import "hardhat-deploy";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { deployNewProxy } from "../utils";
import { L1_ADDRESS_MAP } from "./consts";
import { HardhatRuntimeEnvironment } from "hardhat/types";

export async function printProxyVerificationInstructions() {}

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const hubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const chainId = await hre.getChainId();
console.log(`Using L1 (chainId ${chainId}) hub pool @ ${hubPool.address}`);
Expand Down
7 changes: 3 additions & 4 deletions deploy/008_deploy_polygon_token_bridger_mainnet.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { DeployFunction } from "hardhat-deploy/types";
import { L1_ADDRESS_MAP, POLYGON_CHAIN_IDS } from "./consts";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
7 changes: 3 additions & 4 deletions deploy/009_deploy_polygon_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { DeployFunction } from "hardhat-deploy/types";
import { L1_ADDRESS_MAP } from "./consts";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
7 changes: 3 additions & 4 deletions deploy/010_deploy_polygon_token_bridger_polygon.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

import { DeployFunction } from "hardhat-deploy/types";
import { L1_ADDRESS_MAP } from "./consts";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/011_deploy_polygon_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "hardhat-deploy";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { L2_ADDRESS_MAP } from "./consts";
import { deployNewProxy } from "../utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const hubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const chainId = await hre.getChainId();
console.log(`Using L1 (chainId ${chainId}) hub pool @ ${hubPool.address}`);
Expand Down
7 changes: 3 additions & 4 deletions deploy/012_deploy_boba_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { L1_ADDRESS_MAP } from "./consts";
import { DeployFunction } from "hardhat-deploy/types";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/013_deploy_boba_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import "hardhat-deploy";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { deployNewProxy } from "../utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const hubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const chainId = await hre.getChainId();
console.log(`Using L1 (chainId ${chainId}) hub pool @ ${hubPool.address}`);
Expand Down
6 changes: 3 additions & 3 deletions deploy/014_deploy_config_store.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/015_deploy_zksync_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;

const { deploy } = deployments;
Expand Down
6 changes: 3 additions & 3 deletions deploy/016_deploy_zksync_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "hardhat-deploy";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { L2_ADDRESS_MAP } from "./consts";
import { deployNewProxy } from "../utils";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const hubPool = await hre.companionNetworks.l1.deployments.get("HubPool");
const chainId = await hre.getChainId();
console.log(`Using L1 (chainId ${chainId}) hub pool @ ${hubPool.address}`);
Expand Down
6 changes: 3 additions & 3 deletions deploy/017_deploy_ethereum_merkle_distributor.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

Expand Down
7 changes: 3 additions & 4 deletions deploy/018_deploy_arbitrum_rescueadapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { L1_ADDRESS_MAP } from "./consts";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/019_deploy_bond_token.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deployer } = await getNamedAccounts();

Expand Down
7 changes: 3 additions & 4 deletions deploy/020_deploy_arbitrum_sendtoken_adapter.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import { L1_ADDRESS_MAP } from "./consts";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts, getChainId } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/021_deploy_erc1155.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import "hardhat-deploy";
import { HardhatRuntimeEnvironment } from "hardhat/types/runtime";
import { DeployFunction } from "hardhat-deploy/types";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function (hre: HardhatRuntimeEnvironment) {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;

Expand Down
6 changes: 3 additions & 3 deletions deploy/022_upgrade_spokepool.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import "hardhat-deploy";
import hre from "hardhat";
import { DeployFunction } from "hardhat-deploy/types";
import { getContractFactory } from "../utils";
import * as deployments from "../deployments/deployments.json";
import { HardhatRuntimeEnvironment } from "hardhat/types";

const func = async function () {
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { upgrades, run, getChainId, getNamedAccounts } = hre;
const { deployer } = await getNamedAccounts();

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@across-protocol/contracts-v2",
"version": "2.2.0",
"version": "2.2.1",
"author": "UMA Team",
"license": "AGPL-3.0-only",
"repository": {
Expand Down
15 changes: 6 additions & 9 deletions test/fixtures/MerkleLib.Fixture.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
import { Contract, getContractFactory } from "../../utils/utils";
import hre from "hardhat";
import { Contract, getContractFactory, hre } from "../../utils/utils";

export const merkleLibFixture: () => Promise<{ merkleLibTest: Contract }> = hre.deployments.createFixture(
async ({ deployments }) => {
const [signer] = await hre.ethers.getSigners();
const merkleLibTest = await (await getContractFactory("MerkleLibTest", { signer })).deploy();
return { merkleLibTest };
}
);
export const merkleLibFixture: () => Promise<{ merkleLibTest: Contract }> = hre.deployments.createFixture(async () => {
const [signer] = await hre.ethers.getSigners();
const merkleLibTest = await (await getContractFactory("MerkleLibTest", { signer })).deploy();
return { merkleLibTest };
});
6 changes: 3 additions & 3 deletions utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,14 @@ import * as chai from "chai";
import { getBytecode, getAbi } from "@uma/contracts-node";
import * as optimismContracts from "@eth-optimism/contracts";
import { smock, FakeContract } from "@defi-wonderland/smock";
chai.use(smock.matchers);
import { FactoryOptions } from "hardhat/types";
import hre from "hardhat";
import { ethers } from "hardhat";
import { BigNumber, Signer, Contract, ContractFactory } from "ethers";
import { FactoryOptions } from "hardhat/types";

export { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";

chai.use(smock.matchers);

function isFactoryOptions(signerOrFactoryOptions: Signer | FactoryOptions): signerOrFactoryOptions is FactoryOptions {
return "signer" in signerOrFactoryOptions || "libraries" in signerOrFactoryOptions;
}
Expand Down