Skip to content

Commit

Permalink
Prepared for the QTum mainnet deployment
Browse files Browse the repository at this point in the history
  • Loading branch information
KyrylR committed May 6, 2024
1 parent 3193a5a commit c23a2f8
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 26 deletions.
5 changes: 3 additions & 2 deletions deploy/1_bridge.migration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ const validators = process.env.BRIDGE_VALIDATORS!.split(",");
const threshold = parseInt(process.env.BRIDGE_THRESHHOLD!, 10);

const networkMap: Record<string, any> = {
"81": qtumDeployment,
"8889": qtumDeployment,
"1": ethereumDeployment,
"11155111": ethereumDeployment,
Expand Down Expand Up @@ -39,7 +40,7 @@ async function qtumDeployment(_deployer: Deployer): Promise<[string, string]> {
validators,
ethers.ZeroAddress,
threshold,
true,
false,
]),
]);

Expand All @@ -59,7 +60,7 @@ async function ethereumDeployment(deployer: Deployer): Promise<[string, string]>
validators,
ethers.ZeroAddress,
threshold,
true,
false,
]),
]);

Expand Down
14 changes: 3 additions & 11 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,14 @@ const config: HardhatUserConfig = {
gasMultiplier: 1.2,
timeout: 60000,
},
chapel: {
url: "https://data-seed-prebsc-1-s1.binance.org:8545",
accounts: privateKey(),
gasMultiplier: 1.2,
timeout: 60000,
},
bsc_mainnet: {
url: "https://bsc-dataseed.binance.org/",
accounts: privateKey(),
gasMultiplier: 1.2,
},
eth_mainnet: {
url: `https://mainnet.infura.io/v3/${process.env.INFURA_KEY}`,
accounts: privateKey(),
gasMultiplier: 1.2,
},
qtumMainnet: {
url: `https://mainnet.qnode.qtum.info/v1/${process.env.QTUM_API_KEY}`,
},
qtumTestnet: {
url: `https://testnet.qnode.qtum.info/v1/${process.env.QTUM_API_KEY}`,
},
Expand Down
8 changes: 0 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,7 @@
"compile": "npx hardhat compile --force",
"coverage": "npx hardhat coverage --solcoverjs ./.solcover.ts",
"test": "npx hardhat test",
"test-all": "npm run deploy-dev && npm run test",
"private-network": "npx hardhat node",
"private-network-fork": "npx hardhat node --fork https://mainnet.infura.io/v3/$(grep INFURA_KEY .env | cut -d '\"' -f2)",
"deploy-dev": "npx hardhat run deploy/runners/deployer/migrations.js --network localhost",
"deploy-goerli": "npx hardhat migrate --network goerli",
"deploy-sepolia": "npx hardhat migrate --network sepolia",
"deploy-chapel": "npx hardhat migrate --network chapel",
"deploy-eth-mainnet": "npx hardhat migrate --network eth_mainnet",
"deploy-bsc-mainnet": "npx hardhat migrate --network bsc_mainnet",
"generate-types": "TYPECHAIN_FORCE=true npx hardhat typechain",
"generate-go-bindings": "npx hardhat gobind --outdir ./go-bindings",
"lint-fix": "npm run lint-sol-fix && npm run lint-ts-fix && npm run lint-json-fix",
Expand Down
4 changes: 0 additions & 4 deletions scripts/qtumDeploy/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,6 @@ export async function deployQTumContract(

await reportTransactionReceipt(await instance.deployTransaction.wait(), contractName);

if (UserStorage.has(contractName)) {
throw new Error(`Contract ${contractName} already exists in UserStorage`);
}

UserStorage.set(contractName, instance.address);

return instance;
Expand Down
2 changes: 1 addition & 1 deletion scripts/qtumDeploy/reporter.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { QTumReceipt } from "@/types";
import { getQTumProvider } from "@/scripts/qtumDeploy/network";

import { sleep } from "@solarity/hardhat-migrate/dist/src/utils";
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));

export async function reportTransaction(transaction: any, identifier: string, attempts = 20) {
while (attempts > 0) {
Expand Down
21 changes: 21 additions & 0 deletions test/bridge/Bridge.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -406,5 +406,26 @@ describe("Bridge", () => {

expect(await bridge.paused()).to.be.false;
});

it("should be able to pause/unpause with pauseManager with `isSignersMode` true", async () => {
await bridge.setPauseManager(SECOND.address, []);
await bridge.toggleSignersMode(true, []);

await expect(bridge.connect(SECOND).pause([])).to.be.eventually.fulfilled;
await expect(bridge.connect(OWNER).pause([])).to.be.eventually.rejected;

let functionData = ethers.solidityPackedKeccak256(["uint8"], [ProtectedFunction.Pause]);

let signHash = await bridge.getFunctionSignHash(
functionData,
await bridge.nonces(functionData),
await bridge.getAddress(),
(await ethers.provider.getNetwork()).chainId,
);

let signature = await getSignature(OWNER, signHash);

await expect(bridge.pause([signature])).to.be.eventually.rejected;
});
});
});

0 comments on commit c23a2f8

Please sign in to comment.