-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtestsol.sh
More file actions
179 lines (160 loc) · 5.03 KB
/
Copy pathtestsol.sh
File metadata and controls
179 lines (160 loc) · 5.03 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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
function esolc() {
file=$1
echo $file
shift
cabal exec sol-core -- -f $file $*
}
function runsol() {
file=$1
echo $file
shift
rm -f -v output1.hull Output.sol
/usr/bin/time -f "Compilation time: %E" cabal run sol-core -- -f $file $* && \
cabal exec yule -- output1.hull -w -O --nodeploy > /dev/null && \
forge script --via-ir Output.sol | egrep '(Gas|RESULT)'
}
function runhull() {
echo $1
rm -f -v Output.sol
cabal exec yule -- $1 -w --nodeploy -O && forge script --via-ir Output.sol | egrep '(Gas|RESULT)'
}
function hevmhull() {
local base=$(basename $1 .hull)
local yulfile=$base.yul
echo $yulfile
local hexfile=$base.hex
rm -f -v $yulfile $hexfile
cabal exec yule -- $1 --nodeploy -o $yulfile
hex=$(solc --strict-assembly --bin --optimize --optimize-yul $yulfile | tail -1)
hevm exec --code $hex | awk -f parse_hevm_output.awk
}
function hevmsol() {
echo $*
file=$1
echo $file
local base=$(basename $1 .solc)
local hull=output1.hull
local hexfile=$base.hex
local yulfile=$base.yul
echo Hex: $hexfile
shift
cabal exec sol-core -- -f $file $* && \
cabal exec yule -- $hull --nodeploy -O -o $yulfile && \
solc --strict-assembly --bin --optimize $yulfile | tail -1 > $hexfile && \
hevm exec --code $(cat $hexfile) | awk -f parse_hevm_output.awk
}
function hevmsol() {
echo $*
file=$1
echo $file
local base=$(basename $1 .solc)
local hull=output1.hull
local hexfile=$base.hex
local yulfile=$base.yul
echo Hex: $hexfile
shift
cabal exec sol-core -- -f $file $* && \
cabal exec yule -- $hull --nodeploy -O -o $yulfile && \
solc --strict-assembly --bin --optimize $yulfile | tail -1 > $hexfile && \
hevm exec --code $(cat $hexfile) | awk -f parse_hevm_output.awk
}
function solchex() {
local file=$1
shift
echo "Solc: $file"
local base=$(basename $file .solc)
local hull=output1.hull
echo "Hull: $hull"
local yulfile=$base.yul
echo "Yul: $yulfile"
rm -f -v $yulfile
cabal exec sol-core -- -f $file $* && \
cabal exec yule -- $hull --compress -o $yulfile
hex=$(solc --strict-assembly --bin --optimize --optimize-yul $yulfile | tail -1)
local hexfile=$base.hex
echo "Writing hex: $hexfile"
echo $hex > $hexfile
}
function deployhull() {
local base=$(basename $1 .hull)
local yulfile=$base.yul
echo $yulfile
local hexfile=$base.hex
rm -f -v $yulfile $hexfile
cabal exec yule -- $1 -o $yulfile
hex=$(solc --strict-assembly --bin --optimize --optimize-yul $yulfile | tail -1)
rawtx=$(cast mktx --private-key=$DEPLOYER_KEY --create $hex)
addr=$(cast publish $rawtx | jq .contractAddress | tr -d '"')
echo $addr
}
# function deployyul() {
# local yulfile=$1
# local base=$(basename $1 .yul)
# hex=$(solc --strict-assembly --bin --optimize --optimize-yul $yulfile | tail -1)
# rawtx=$(cast mktx --private-key=$DEPLOYER_KEY --create $hex)
# addr=$(cast publish $rawtx | jq .contractAddress | tr -d '"')
# echo $addr
# }
function deployhullargs() {
local hull=$1
local base=$(basename $1 .hull)
shift
local yulfile=$base.yul
echo $yulfile
local hexfile=$base.hex
rm -f -v $yulfile #$hexfile
echo cabal exec yule -- $hull -o $yulfile
cabal exec yule -- $hull -o $yulfile
deployyul $yulfile $*
}
function deployyul() {
local yulfile=$1
shift
local data=$(cast ae $* | cut -c 3-)
local base=$(basename $yulfile .yul)
echo "Args: $*"
echo "ABI-enc: $data"
prog=$(solc --strict-assembly --bin --optimize --optimize-yul $yulfile | tail -1)
hex="$prog$data"
echo Hex: $hex
rawtx=$(cast mktx --private-key=$DEPLOYER_KEY --create $hex $*)
txoutput=$(cast publish $rawtx)
echo $txoutput | jq .
export contractAddress=$(echo $txoutput | jq .contractAddress | tr -d '"')
echo $contractAddress
}
function deployhex() {
local hexfile=$1
shift
local data=$(cast ae $* | cut -c 3-)
echo "Args: $*"
echo "ABI-enc: $data"
prog=$(cat $hexfile)
hex="$prog$data"
echo Hex: $hex
rawtx=$(cast mktx --private-key=$DEPLOYER_KEY --create $hex $*)
txoutput=$(cast publish $rawtx)
echo $txoutput | jq .
export contractAddress=$(echo $txoutput | jq .contractAddress | tr -d '"')
echo $contractAddress
}
# deploy contract with 1 uint arg
function deployyul1() {
local yulfile=$1
local data=$(cast ae "constructor(uint256)" $2 | cut -c 3-)
local base=$(basename $1 .yul)
prog=$(solc --strict-assembly --bin --optimize --optimize-yul $yulfile | tail -1)
hex="$prog$data"
echo Hex: $hex
rawtx=$(cast mktx --private-key=$DEPLOYER_KEY --create $hex)
txoutput=$(cast publish $rawtx)
echo $txoutput | jq .
export contractAddress=$(echo $txoutput | jq .contractAddress | tr -d '"')
echo $contractAddress
}
function hull() {
local base=$(basename $1 .hull)
local yulfile=$base.yul
rm -f -v $yulfile
cabal exec yule -- $1 -o $yulfile
}