Skip to content

Commit a12ea0e

Browse files
committed
chore: added the hardhat config for layer 2 networks, added hardhat-deploy and mocha
1 parent 65a996b commit a12ea0e

34 files changed

+375
-118
lines changed
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

CHANGELOG.md

+1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
## 0.1.0 (2021-11-11)
22

3+
- test: added a test for IncrementalNG ([65a996b](https://github.com/kleros/kleros-v2/commit/65a996b))
34
- docs: initial commit ([23356e7](https://github.com/kleros/kleros-v2/commit/23356e7))
45
- docs: license file added ([cb62d2c](https://github.com/kleros/kleros-v2/commit/cb62d2c))
56
- docs: readme and spdx headers ([8a5b397](https://github.com/kleros/kleros-v2/commit/8a5b397))

contracts/.env.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
PRIVATE_KEY=0xabc123abc123abc123abc123abc123abc123abc123abc123abc123abc123abc1
2-
ROPSTEN_URL=https://eth-ropsten.alchemyapi.io/v2/<YOUR ALCHEMY KEY>
2+
INFURA_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
33
ETHERSCAN_API_KEY=ABC123ABC123ABC123ABC123ABC123ABC1
44
REPORT_GAS=true

contracts/README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,10 @@ If you miss that, you can always go to the `deployments/<network>` directory and
8585

8686
This must be done for each network separately.
8787

88-
For `Kovan` or `Mainnet` you can use the `etherscan-verify` command from `hardhat`:
88+
For `Mainnet` you can use the `etherscan-verify` command from `hardhat`:
8989

9090
```bash
91-
yarn hardhat --network <kovan|mainnet> etherscan-verify
91+
yarn hardhat --network mainnet etherscan-verify
9292
```
9393

94-
For `Sokol` and `xDAI` the process currently must be done manually through [Blockscout](https://blockscout.com/).
94+
For `Arbitrum` the process currently must be done manually through [Arbiscan](https://arbiscan.io/verifyContract).

contracts/hardhat.config.ts

+55-2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ import "@nomiclabs/hardhat-waffle";
66
import "@typechain/hardhat";
77
import "hardhat-gas-reporter";
88
import "solidity-coverage";
9+
import "hardhat-deploy"
10+
import "hardhat-deploy-ethers"
911

1012
dotenv.config();
1113

@@ -36,9 +38,60 @@ const config: HardhatUserConfig = {
3638
sources: "./src",
3739
},
3840
networks: {
39-
ropsten: {
40-
url: process.env.ROPSTEN_URL || "",
41+
hardhat: {
42+
live: false,
43+
saveDeployments: false,
44+
tags: ["test", "local"],
45+
},
46+
// Home chain ---------------------------------------------------------------------------------
47+
arbitrumRinkeby: {
48+
chainId: 421611,
49+
url: "https://rinkeby.arbitrum.io/rpc",
50+
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
51+
live: true,
52+
saveDeployments: true,
53+
tags: ["staging", "home", "layer2"],
54+
},
55+
arbitrum: {
56+
chainId: 42161,
57+
url: "https://arb1.arbitrum.io/rpc",
58+
accounts: process.env.MAINNET_PRIVATE_KEY !== undefined ? [process.env.MAINNET_PRIVATE_KEY] : [],
59+
live: true,
60+
saveDeployments: true,
61+
tags: ["production", "home", "layer2"],
62+
},
63+
// Foreign chain ---------------------------------------------------------------------------------
64+
rinkeby: {
65+
chainId: 4,
66+
url: `https://rinkeby.infura.io/v3/${process.env.INFURA_API_KEY}`,
67+
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
68+
live: true,
69+
saveDeployments: true,
70+
tags: ["staging", "foreign", "layer1"],
71+
},
72+
kovan: {
73+
chainId: 42,
74+
url: `https://kovan.infura.io/v3/${process.env.INFURA_API_KEY}`,
4175
accounts: process.env.PRIVATE_KEY !== undefined ? [process.env.PRIVATE_KEY] : [],
76+
live: true,
77+
saveDeployments: true,
78+
tags: ["staging", "foreign", "layer1"],
79+
},
80+
mainnet: {
81+
chainId: 1,
82+
url: `https://mainnet.infura.io/v3/${process.env.INFURA_API_KEY}`,
83+
accounts: process.env.MAINNET_PRIVATE_KEY !== undefined ? [process.env.MAINNET_PRIVATE_KEY] : [],
84+
live: true,
85+
saveDeployments: true,
86+
tags: ["production", "foreign", "layer1"],
87+
},
88+
},
89+
namedAccounts: {
90+
homeDeployer: {
91+
default: 0,
92+
},
93+
foreignDeployer: {
94+
default: 0,
4295
},
4396
},
4497
gasReporter: {

contracts/package.json

+4
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,13 @@
3030
"chai": "^4.3.4",
3131
"dotenv": "^10.0.0",
3232
"ethereum-waffle": "^3.4.0",
33+
"ethereumjs-util": "^7.1.3",
3334
"ethers": "^5.5.1",
3435
"hardhat": "^2.6.8",
36+
"hardhat-deploy": "^0.9.6",
37+
"hardhat-deploy-ethers": "^0.3.0-beta.11",
3538
"hardhat-gas-reporter": "^1.0.4",
39+
"mocha": "^9.1.3",
3640
"solhint": "^3.3.6",
3741
"solidity-coverage": "^0.7.17",
3842
"ts-node": "^10.4.0",

contracts/test/rng/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ describe("IncrementalNG", function () {
2424
expect(await incrementalNG.callStatic.getRN(689376)).to.equal(0);
2525
await incrementalNG.getRN(29543);
2626
expect(await incrementalNG.callStatic.getRN(5894382)).to.equal(1);
27-
await incrementalNG.getRN(BigNumber.from(2).pow(255));
28-
expect(await incrementalNG.callStatic.getRN(3465)).to.equal(2);
2927
await incrementalNG.getRN(0);
28+
expect(await incrementalNG.callStatic.getRN(3465)).to.equal(2);
29+
await incrementalNG.getRN(BigNumber.from(2).pow(255));
3030
expect(await incrementalNG.callStatic.getRN(0)).to.equal(3);
3131
});
3232
});

contracts/typechain/factories/ConstantNG__factory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ const _abi = [
105105
];
106106

107107
const _bytecode =
108-
"0x60a060405234801561001057600080fd5b5060405161024438038061024483398101604081905261002f91610037565b608052610050565b60006020828403121561004957600080fd5b5051919050565b6080516101cd6100776000396000818160a80152818160f9015261011f01526101cd6000f3fe60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ca578063ca4742f1146100db575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461017e565b61011b565b60405190815260200160405180910390f35b61009461008f36600461017e565b6100d8565b005b3480156100a257600080fd5b5061006f7f000000000000000000000000000000000000000000000000000000000000000081565b6100946100d836600461017e565b50565b3480156100e757600080fd5b5061006f6100f636600461017e565b507f000000000000000000000000000000000000000000000000000000000000000090565b60007f00000000000000000000000000000000000000000000000000000000000000008061014c5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561019057600080fd5b503591905056fea2646970667358221220da36bd046649ac0965fcb143806f875d8dc06d68eed5b93e4492f5705ddcfe8064736f6c63430008090033";
108+
"0x60a060405234801561001057600080fd5b5060405161024438038061024483398101604081905261002f91610037565b608052610050565b60006020828403121561004957600080fd5b5051919050565b6080516101cd6100776000396000818160a80152818160f9015261011f01526101cd6000f3fe60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ca578063ca4742f1146100db575b600080fd5b34801561005b57600080fd5b5061006f61006a36600461017e565b61011b565b60405190815260200160405180910390f35b61009461008f36600461017e565b6100d8565b005b3480156100a257600080fd5b5061006f7f000000000000000000000000000000000000000000000000000000000000000081565b6100946100d836600461017e565b50565b3480156100e757600080fd5b5061006f6100f636600461017e565b507f000000000000000000000000000000000000000000000000000000000000000090565b60007f00000000000000000000000000000000000000000000000000000000000000008061014c5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561019057600080fd5b503591905056fea264697066735822122003b9e64e2fc826a7dbabe6c0bcad1a93e89ae6315abad056cafd1057560891db64736f6c63430008090033";
109109

110110
export class ConstantNG__factory extends ContractFactory {
111111
constructor(

contracts/typechain/factories/IncrementalNG__factory.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ const _abi = [
8787
];
8888

8989
const _bytecode =
90-
"0x608060405234801561001057600080fd5b50610180806100206000396000f3fe60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ac578063ca4742f1146100bd575b600080fd5b34801561005b57600080fd5b5061006f61006a366004610131565b6100e7565b60405190815260200160405180910390f35b61009461008f366004610131565b6100ba565b005b3480156100a257600080fd5b5061006f60005481565b6100946100ba366004610131565b50565b3480156100c957600080fd5b5061006f6100d8366004610131565b50600080546001810190915590565b60008054600181018255806100ff5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561014357600080fd5b503591905056fea2646970667358221220abbb67524d2ef027650864ec865ea3d2edccc0a550cc8eb16ac0a69c005e2a3c64736f6c63430008090033";
90+
"0x608060405234801561001057600080fd5b50610180806100206000396000f3fe60806040526004361061004a5760003560e01c80631c73601e1461004f5780637b9c34e0146100815780638381f58a14610096578063c1cbbca7146100ac578063ca4742f1146100bd575b600080fd5b34801561005b57600080fd5b5061006f61006a366004610131565b6100e7565b60405190815260200160405180910390f35b61009461008f366004610131565b6100ba565b005b3480156100a257600080fd5b5061006f60005481565b6100946100ba366004610131565b50565b3480156100c957600080fd5b5061006f6100d8366004610131565b50600080546001810190915590565b60008054600181018255806100ff5750600092915050565b6040805133602082015290810182905260600160408051601f1981840301815291905280516020909101209392505050565b60006020828403121561014357600080fd5b503591905056fea264697066735822122043255135395034a3c3e19081046faedbc1c292d1168bde0900b071ac8c866df464736f6c63430008090033";
9191

9292
export class IncrementalNG__factory extends ContractFactory {
9393
constructor(

contracts/typechain/hardhat.d.ts

-60
This file was deleted.

0 commit comments

Comments
 (0)