hermez-node/eth/README.md
eth/README.mdRaw
1 Test Ethclient - Contracts
2
3## Contracts
4
5The first step is to clone the github repository where the contracts are located:
6
7`git clone https://github.com/hermeznetwork/contracts.git`
8
9While the prepared deployment is not found to master, branch in repository must be changed:
10
11`git checkout feature/newDeploymentScript-eth` (tested with commit `f3b627d2145a029fd967f05c1fd32f23d614ec8e`)
12
13Now, install the dependencies:
14
15```
16cd contracts/
17yarn install
18```
19
20Go to where the deployment scripts for the test are found:
21
22`cd scripts/ethclient-deployment/`
23
24Now, in a terminal start a local blockchain with ganache:
25```
26../../node_modules/.bin/ganache-cli -d -m "explain tackle mirror kit van hammer degree position ginger unfair soup bonus" -p 8545 -l 12500000 -a 20 -e 10000 --allowUnlimitedContractSize --chainId 31337
27```
28Once ganache is ready, in another terminal run the deployment in the local ganache network:
29```
30npx buidler run --network localhostMnemonic test-deployment.js
31```
32
33An output file necessary for the next step is obtained: `deploy-output`.
34
35> The files that appear in `hermez-node/eth/contracts` must be generated from the same contract that we deploy in this step
36
37## Ethclient Test
38
39Different environment variables are necessary to run this test.
40They must be taken from the output file of the previous step.
41
42They can be provided by file called `.env`:
43
44```
45GENESIS_BLOCK=98
46AUCTION="0x317113D2593e3efF1FfAE0ba2fF7A61861Df7ae5"
47AUCTION_TEST="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3"
48TOKENHEZ="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77"
49HERMEZ="0x8EEaea23686c319133a7cC110b840d1591d9AeE0"
50WDELAYER="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F"
51WDELAYER_TEST="0xc8F466fFeF9E9788fb363c2F4fBDdF2cAe477805"
52```
53
54> An example is found in `hermez-node/eth/.env.example`
55
56And then run test from `hermez-node/eth/`:
57
58`INTEGRATION=1 go test`
59
60Or they can be provided as a parameter in the command that runs the test:
61
62`INTEGRATION=1 GENESIS_BLOCK=98 AUCTION="0x317113D2593e3efF1FfAE0ba2fF7A61861Df7ae5" AUCTION_TEST="0x2b7dEe2CF60484325716A1c6A193519c8c3b19F3" TOKENHEZ="0x5D94e3e7aeC542aB0F9129B9a7BAdeb5B3Ca0f77" HERMEZ="0x8EEaea23686c319133a7cC110b840d1591d9AeE0" WDELAYER="0x5E0816F0f8bC560cB2B9e9C87187BeCac8c2021F" WDELAYER_TEST="0xc8F466fFeF9E9788fb363c2F4fBDdF2cAe477805" go test`