Skip to content

Commit 7f3de11

Browse files
committed
feat: add localhost support in network configuration and deploy script
1 parent 75c9d6d commit 7f3de11

File tree

5 files changed

+22
-0
lines changed

5 files changed

+22
-0
lines changed

lib/protocol/networks.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,7 @@ async function getForkingNetworkConfig(): Promise<ProtocolNetworkConfig> {
141141
export async function getNetworkConfig(network: string): Promise<ProtocolNetworkConfig> {
142142
switch (network) {
143143
case "hardhat":
144+
case "localhost":
144145
if (getMode() === "scratch") {
145146
return getLocalNetworkConfig(network, "scratch");
146147
}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
"test:integration:scratch:trace": "MODE=scratch hardhat test test/integration/**/*.ts --trace --disabletracer",
4444
"test:integration:scratch:fulltrace": "MODE=scratch hardhat test test/integration/**/*.ts --fulltrace --disabletracer",
4545
"test:integration:fork:local": "MODE=scratch hardhat test test/integration/**/*.ts --network local",
46+
"scratch:deploy:localhost": "SKIP_INTERFACES_CHECK=true SKIP_CONTRACT_SIZE=true SKIP_GAS_REPORT=true GENESIS_TIME=1639659600 GAS_PRIORITY_FEE=1 GAS_MAX_FEE=100 DEPLOYER=0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 MODE=scratch hardhat run scripts/scratch/scratch-deploy.ts --network localhost",
4647
"validate:configs": "yarn hardhat validate-configs",
4748
"typecheck": "tsc --noEmit",
4849
"abis:extract": "hardhat abis:extract",

scripts/scratch/scratch-deploy.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { getProtocolContext } from "lib/protocol/context";
2+
3+
async function main() {
4+
console.log("Starting scratch deploy...");
5+
await getProtocolContext();
6+
console.log("Scratch deploy complete!");
7+
}
8+
9+
main().catch((error) => {
10+
console.error(error);
11+
process.exit(1);
12+
});

tasks/index.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ import "./compile";
66
import "./check-interfaces";
77
import "./validate-configs";
88
import "./lint-solidity";
9+
import "./protocol-get-addresses";

tasks/protocol-get-addresses.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
import { task } from "hardhat/config";
2+
3+
task("protocol:get-addresses", "Get deployed protocol contract addresses").setAction(async () => {
4+
const { readNetworkState } = await import("lib/state-file");
5+
const state = readNetworkState();
6+
console.log(JSON.stringify(state, null, 2));
7+
});

0 commit comments

Comments
 (0)