-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathtest
More file actions
executable file
·57 lines (50 loc) · 1.72 KB
/
test
File metadata and controls
executable file
·57 lines (50 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -eu -o pipefail
nix-build
export PATH="./result/bin:$PATH"
export DAPP_SOLC=solc-0.7.5
export DAPP_JSON=${DAPP_JSON:-out/dapp.sol.json} # get this from radicle-contracts-tests build output
dapp --version
which dapp
TMPDIR=$(mktemp -d)
dapp testnet --dir "$TMPDIR" & PID=$!
sleep 5
die() {
echo "shutting down testnet"
killall dapp dapp-testnet dapp---nix-run dapp---testnet-launch geth
rm -rf $TMPDIR
}
trap die EXIT
export ETH_FROM=$(cat "$TMPDIR/8545/config/account")
export ETH_RPC_URL=http://127.0.0.1:8545
export ETH_KEYSTORE="$TMPDIR/8545/keystore"
export ETH_PASSWORD=/dev/null
export SETH_CHAINID=99
# deploy the stuff
bin=0x$(<$DAPP_JSON jq -r '.contracts["lib/radicle-contracts/contracts/deploy/phase0.sol"]["Phase0"].evm.bytecode.object')
export ETH_GAS=20000000
phase0=$(seth send --create "$bin" "constructor(address,uint256,address,address,bytes32,string)" $ETH_FROM 172800 $ETH_FROM $ETH_FROM 0x0000000000000000000000000000000000000000000000000000000000000000 '""' --from $ETH_FROM --keystore $ETH_KEYSTORE)
RAD=$(seth call $phase0 "token()(address)")
TIMELOCK=$(seth call $phase0 "timelock()(address)")
RADGOV=$(seth call $phase0 "governor()(address)")
REGISTRAR=$(seth call $phase0 "registrar()(address)")
# force geth to mine a block
nextBlock() {
seth send $ETH_FROM --value 0 --from $ETH_FROM --keystore $ETH_KEYSTORE
}
set -x
export RADGOV RAD
radgov delegate $ETH_FROM --keystore $ETH_KEYSTORE
nextBlock
radgov account $ETH_FROM
id=$(radgov propose example)
nextBlock
nextBlock
radgov vote $id true --keystore $ETH_KEYSTORE
radgov receipt $id $ETH_FROM
radgov state $id
radgov actions $id
radgov proposal $id --receipts $ETH_FROM,$ETH_FROM
radgov proposal $id
radgov ls --receipts $ETH_FROM
set +x