Skip to content

Commit 35ac2cc

Browse files
committed
chore: remove Vea from the test and deploy scripts, created a VeaMock, removed Rinkeby
1 parent 2e7a8a2 commit 35ac2cc

File tree

16 files changed

+340
-664
lines changed

16 files changed

+340
-664
lines changed

.vscode/settings.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"solidity.compileUsingRemoteVersion": "v0.8.10+commit.fc410830",
2+
"solidity.compileUsingRemoteVersion": "v0.8.9+commit.e5eed63a",
33
"cSpell.words": [
44
"arbitrum",
55
"IERC",

contracts/.solhintignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
node_modules
2+
src/**/mock/*.sol

contracts/README.md

Lines changed: 10 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -113,27 +113,22 @@ The complete deployment is multi-chain, so a deployment to the local network can
113113
**Shell 1: the node**
114114

115115
```bash
116-
yarn hardhat node --tags nothing
116+
yarn node --tags nothing
117117
```
118118

119119
**Shell 2: the deploy script**
120120

121121
```bash
122-
yarn hardhat deploy --network localhost --tags HomeChain
122+
yarn deploy --network localhost --tags <Arbitration|VeaMock>
123123
```
124124

125125
#### 3. Deploy to Public Testnets
126126

127127
```bash
128128
# Goerli
129-
yarn hardhat deploy --network arbitrumGoerli --tags Arbitration
130-
yarn hardhat deploy --network goerli --tags ForeignChain
131-
yarn hardhat deploy --network arbitrumGoerli --tags HomeChain
132-
133-
# Rinkeby
134-
yarn hardhat deploy --network arbitrumRinkeby --tags Arbitration
135-
yarn hardhat deploy --network rinkeby --tags ForeignChain
136-
yarn hardhat deploy --network arbitrumRinkeby --tags HomeChain
129+
yarn deploy --network arbitrumGoerli --tags Arbitration
130+
yarn deploy --network goerli --tags ForeignGateway
131+
yarn deploy --network arbitrumGoerli --tags HomeGateway
137132
```
138133

139134
The deployed addresses should be output to the screen after the deployment is complete.
@@ -144,21 +139,21 @@ If you miss that, you can always go to the `deployments/<network>` directory and
144139
**Shell 1: the node**
145140

146141
```bash
147-
yarn hardhat node --tags Arbitration,ForeignGateway,HomeGateway
142+
yarn node --tags Arbitration,VeaMock
148143
```
149144

150-
**Shell 2: the test script**
145+
**Shell 2: the test scripts**
151146

152147
```bash
153-
yarn hardhat test --network localhost test/pre-alpha1/index.ts
148+
yarn test --network localhost
154149
```
155150

156151
#### 4. Verify the Source Code for Contracts
157152

158153
This must be done for each network separately.
159154

160155
```bash
161-
yarn hardhat --network <arbitrumGoerli|arbitrumRinkeby|arbitrum|goerli|rinkeby|mainnet> etherscan-verify
156+
yarn --network <arbitrumGoerli|arbitrumRinkeby|arbitrum|goerli|rinkeby|mainnet> etherscan-verify
162157
```
163158

164159
## Ad-hoc procedures
@@ -177,7 +172,7 @@ yarn hardhat run scripts/getCourtsV1.ts --network mainnet | tee courts.v1.json
177172
Shell 1:
178173

179174
```bash
180-
yarn hardhat node --tags Arbitration
175+
yarn node --tags Arbitration
181176
```
182177

183178
Shell 2:

contracts/deploy/00-home-chain-arbitration.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,12 @@ import { BigNumber } from "ethers";
44

55
enum HomeChains {
66
ARBITRUM_ONE = 42161,
7-
ARBITRUM_RINKEBY = 421611,
87
ARBITRUM_GOERLI = 421613,
98
HARDHAT = 31337,
109
}
1110

1211
const pnkByChain = new Map<HomeChains, string>([
1312
[HomeChains.ARBITRUM_ONE, "0x330bD769382cFc6d50175903434CCC8D206DCAE5"],
14-
[HomeChains.ARBITRUM_RINKEBY, "0x364530164a2338cdba211f72c1438eb811b5c639"],
1513
[HomeChains.ARBITRUM_GOERLI, "0x4DEeeFD054434bf6721eF39Aa18EfB3fd0D12610"],
1614
]);
1715

contracts/deploy/01-foreign-chain.ts

Lines changed: 0 additions & 125 deletions
This file was deleted.
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
import { parseEther } from "ethers/lib/utils";
2+
import { HardhatRuntimeEnvironment } from "hardhat/types";
3+
import { DeployFunction } from "hardhat-deploy/types";
4+
import getContractAddress from "../deploy-helpers/getContractAddress";
5+
6+
enum ForeignChains {
7+
ETHEREUM_MAINNET = 1,
8+
ETHEREUM_GOERLI = 5,
9+
}
10+
11+
const deployForeignGateway: DeployFunction = async (hre: HardhatRuntimeEnvironment) => {
12+
const { ethers, deployments, getNamedAccounts, getChainId, config } = hre;
13+
const { deploy } = deployments;
14+
const { hexZeroPad, hexlify } = ethers.utils;
15+
16+
// fallback to hardhat node signers on local network
17+
const deployer = (await getNamedAccounts()).deployer ?? (await hre.ethers.getSigners())[0].address;
18+
const chainId = Number(await getChainId());
19+
console.log("deploying to chainId %s with deployer %s", chainId, deployer);
20+
21+
const homeNetworks = {
22+
1: config.networks.arbitrum,
23+
5: config.networks.arbitrumGoerli,
24+
};
25+
26+
// Hack to predict the deployment address on the home chain.
27+
// TODO: use deterministic deployments
28+
const homeChainProvider = new ethers.providers.JsonRpcProvider(homeNetworks[chainId].url);
29+
let nonce = await homeChainProvider.getTransactionCount(deployer);
30+
nonce += 2; // HomeGatewayToEthereum deploy tx will the third tx after this on its home network, so we add two to the current nonce.
31+
const homeChainId = (await homeChainProvider.getNetwork()).chainId;
32+
const homeChainIdAsBytes32 = hexZeroPad(hexlify(homeChainId), 32);
33+
const homeGatewayAddress = getContractAddress(deployer, nonce);
34+
console.log("calculated future HomeGatewayToEthereum address for nonce %d: %s", nonce, homeGatewayAddress);
35+
36+
const veaReceiver = await deployments.get("FastBridgeReceiverOnEthereum");
37+
38+
const foreignGateway = await deploy("ForeignGatewayOnEthereum", {
39+
from: deployer,
40+
contract: "ForeignGateway",
41+
args: [
42+
deployer,
43+
veaReceiver.address,
44+
[ethers.BigNumber.from(10).pow(17)],
45+
homeGatewayAddress,
46+
homeChainIdAsBytes32,
47+
],
48+
gasLimit: 4000000,
49+
log: true,
50+
});
51+
52+
// TODO: change me
53+
const metaEvidenceUri =
54+
"https://raw.githubusercontent.com/kleros/kleros-v2/master/contracts/deployments/rinkeby/MetaEvidence_ArbitrableExample.json";
55+
56+
await deploy("ArbitrableExample", {
57+
from: deployer,
58+
args: [foreignGateway.address, metaEvidenceUri],
59+
log: true,
60+
});
61+
};
62+
63+
deployForeignGateway.tags = ["ForeignChain", "ForeignGateway"];
64+
deployForeignGateway.skip = async ({ getChainId }) => {
65+
const chainId = Number(await getChainId());
66+
return !ForeignChains[chainId];
67+
};
68+
69+
export default deployForeignGateway;

contracts/deploy/02-home-chain.ts

Lines changed: 0 additions & 95 deletions
This file was deleted.

0 commit comments

Comments
 (0)