Skip to content

Commit 9ff47ac

Browse files
committed
up
1 parent f91914e commit 9ff47ac

File tree

8 files changed

+603
-0
lines changed

8 files changed

+603
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ Gems:
3636
- [abiparser](abiparser) - application binary interface (abi) parser machinery / helper for Ethereum & Co. (blockchain) contracts
3737
- [abidoc](abidoc) - application binary interface (abi) documentation generator for Ethereum & Co. (blockchain) contracts
3838
- [abigen](abigen) - generate ready-to-use (blockchain) contract services / function calls for ethereum & co. via application binary interfaces (abis)
39+
- [abidump](abidump) - command-line tool to dump / pretty print or (re)format application binary interfaces (abi) for Ethereum & Co.
3940
- [abi2sol](abi2sol) - command-line tool for application binary interface (abi) to solidity (contract) source code generation for Ethereum & Co.
4041
- [abibase](abibase) - command line tool / helper to manage application binary interfaces (abis)
4142
- [solidity](solidity) - (fuzzy) parser for (crypto) contracts for ethereum & co.

abidump/.gitignore

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
*.gem
2+
*.rbc
3+
/.config
4+
/coverage/
5+
/InstalledFiles
6+
/pkg/
7+
/spec/reports/
8+
/test/tmp/
9+
/test/version_tmp/
10+
/tmp/
11+
12+
## Specific to RubyMotion:
13+
.dat*
14+
.repl_history
15+
build/
16+
17+
## Documentation cache and generated files:
18+
/.yardoc/
19+
/_yardoc/
20+
/doc/
21+
/rdoc/
22+
23+
## Environment normalisation:
24+
/.bundle/
25+
/vendor/bundle
26+
/lib/bundler/man/
27+
28+
# for a library or gem, you might want to ignore these files since the code is
29+
# intended to run in multiple environments; otherwise, check them in:
30+
# Gemfile.lock
31+
.ruby-version
32+
.ruby-gemset
33+
34+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
35+
.rvmrc
36+
37+
# Gladiator (Glimmer Editor)
38+
.gladiator
39+
.DS_Store
40+
41+
42+
43+
####
44+
# exclude all tmp & tmp2 and o directory (in all levels)
45+
tmp/
46+
tmp2/
47+
o/
48+
49+
########
50+
# exclude all dbs e.g. artbase.db etc.
51+
*.db
52+
53+
######
54+
# exclude all zips (in /dl)
55+
*.zip
56+
57+
58+

abidump/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
### 0.0.1 / 2023-02-06
2+
3+
* Everything is new. First release

abidump/Manifest.txt

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
CHANGELOG.md
2+
Manifest.txt
3+
README.md
4+
Rakefile
5+
bin/abidump
6+
lib/abidump.rb

abidump/README.md

Lines changed: 284 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,284 @@
1+
# abidump
2+
3+
4+
abidump gem - command-line tool to dump / pretty print or (re)format application binary interfaces (abi) for Ethereum & Co.
5+
6+
7+
* home :: [github.com/rubycocos/blockchain](https://github.com/rubycocos/blockchain)
8+
* bugs :: [github.com/rubycocos/blockchain/issues](https://github.com/rubycocos/blockchain/issues)
9+
* gem :: [rubygems.org/gems/abidump](https://rubygems.org/gems/abidump)
10+
* rdoc :: [rubydoc.info/gems/abidump](http://rubydoc.info/gems/abidump)
11+
12+
13+
14+
## New to the Solidity (Contract) Programming Language?
15+
16+
See [**Awesome Solidity @ Open Blockchains »**](https://github.com/openblockchains/awesome-solidity)
17+
18+
19+
20+
21+
## Usage
22+
23+
24+
Let's try a dry run:
25+
26+
```
27+
$ abidump --help
28+
```
29+
30+
resulting in:
31+
32+
```
33+
==> welcome to the abidump tool
34+
35+
Usage: abidump [options]
36+
-j, --json use json format (default: false)
37+
-y, --yaml use yaml format (default: false)
38+
-h, --help Prints this help
39+
```
40+
41+
42+
Let's pretty print (dump) the application binary interface (abi)
43+
for punks v1 (anno 2017):
44+
45+
```
46+
$ abidump ./address/0x6ba6f2207e343923ba692e5cae646fb0f566db8d/abi.json
47+
```
48+
49+
resulting in:
50+
51+
52+
```
53+
==> summary:
54+
29 abi item(s):
55+
1 constructor
56+
6 events
57+
Assign, Transfer, PunkTransfer, PunkOffered, PunkBought, PunkNoLongerForSale
58+
22 functions
59+
name, reservePunksForOwner, punksOfferedForSale, totalSupply, decimals, withdraw, imageHash, nextPunkIndexToAssign, punkIndexToAddress, standard, balanceOf, buyPunk, transferPunk, symbol, numberOfPunksToReserve, numberOfPunksReserved, offerPunkForSaleToAddress, punksRemainingToAssign, offerPunkForSale, getPunk, pendingWithdrawals, punkNoLongerForSale
60+
61+
==> constructor:
62+
payable: true
63+
inputs (0):
64+
[]
65+
66+
==> event Assign:
67+
anonymous: false
68+
inputs (2):
69+
- type: address
70+
indexed: true
71+
name: to
72+
- type: uint256
73+
indexed: false
74+
name: punkIndex
75+
76+
==> event Transfer:
77+
anonymous: false
78+
inputs (3):
79+
- type: address
80+
indexed: true
81+
name: from
82+
- type: address
83+
indexed: true
84+
name: to
85+
- type: uint256
86+
indexed: false
87+
name: value
88+
89+
==> event PunkTransfer:
90+
anonymous: false
91+
inputs (3):
92+
- type: address
93+
indexed: true
94+
name: from
95+
- type: address
96+
indexed: true
97+
name: to
98+
- type: uint256
99+
indexed: false
100+
name: punkIndex
101+
102+
...
103+
104+
==> function name:
105+
constant: true
106+
payable: false
107+
inputs (0):
108+
[]
109+
outputs (1):
110+
- type: string
111+
name: _
112+
113+
==> function reservePunksForOwner:
114+
constant: false
115+
payable: false
116+
inputs (1):
117+
- type: uint256
118+
name: maxForThisRun
119+
outputs (0):
120+
[]
121+
122+
==> function punksOfferedForSale:
123+
constant: true
124+
payable: false
125+
inputs (1):
126+
- type: uint256
127+
name: _
128+
outputs (5):
129+
- type: bool
130+
name: isForSale
131+
- type: uint256
132+
name: punkIndex
133+
- type: address
134+
name: seller
135+
- type: uint256
136+
name: minValue
137+
- type: address
138+
name: onlySellTo
139+
140+
...
141+
```
142+
143+
144+
Let's try to dump (pretty print) the
145+
application binary interface (abi)
146+
for punk blocks (anno 2022):
147+
148+
```
149+
$ abidump ./address/0x58e90596c2065befd3060767736c829c18f3474c/abi.json
150+
```
151+
152+
resulting in:
153+
154+
```
155+
==> summary:
156+
11 abi item(s):
157+
1 constructor
158+
1 event
159+
NewBlock
160+
9 functions
161+
blocks, getBlocks, index, nextId, registerBlock, svgFromIDs, svgFromKeys, svgFromNames, svgFromPunkID
162+
163+
==> constructor:
164+
stateMutability: nonpayable
165+
inputs (0):
166+
[]
167+
168+
==> event NewBlock:
169+
anonymous: false
170+
inputs (3):
171+
- type: address
172+
indexed: false
173+
name: _
174+
- type: uint256
175+
indexed: false
176+
name: _
177+
- type: string
178+
indexed: false
179+
name: _
180+
181+
==> function blocks:
182+
stateMutability: view
183+
inputs (1):
184+
- type: bytes32
185+
name: _
186+
outputs (3):
187+
- type: uint8 (enum PunkBlocks.Layer)
188+
name: layer
189+
- type: bytes
190+
name: dataMale
191+
- type: bytes
192+
name: dataFemale
193+
194+
==> function getBlocks:
195+
stateMutability: view
196+
inputs (2):
197+
- type: uint256
198+
name: _fromID
199+
- type: uint256
200+
name: _count
201+
outputs (2):
202+
- type: tuple[] (struct PunkBlocks.Block[])
203+
name: _
204+
components:
205+
- type: uint8 (enum PunkBlocks.Layer)
206+
name: layer
207+
- type: bytes
208+
name: dataMale
209+
- type: bytes
210+
name: dataFemale
211+
- type: uint256
212+
name: _
213+
214+
==> function index:
215+
stateMutability: view
216+
inputs (1):
217+
- type: uint256
218+
name: _
219+
outputs (1):
220+
- type: bytes32
221+
name: _
222+
223+
==> function nextId:
224+
stateMutability: view
225+
inputs (0):
226+
[]
227+
outputs (1):
228+
- type: uint256
229+
name: _
230+
231+
==> function registerBlock:
232+
stateMutability: nonpayable
233+
inputs (4):
234+
- type: bytes
235+
name: _dataMale
236+
- type: bytes
237+
name: _dataFemale
238+
- type: uint8
239+
name: _layer
240+
- type: string
241+
name: _name
242+
outputs (0):
243+
[]
244+
245+
==> function svgFromIDs:
246+
stateMutability: view
247+
inputs (1):
248+
- type: uint256[]
249+
name: _ids
250+
outputs (1):
251+
- type: string
252+
name: _
253+
254+
...
255+
```
256+
257+
258+
and so on.
259+
260+
261+
Bonus - Using the `-j / --json` switch / flag
262+
or `-y / --yaml` you can (re)export or (re)format
263+
the application binary interface (abi)
264+
to pretty printed json or yaml. Example.
265+
266+
267+
```
268+
$ abidump --json ./address/0x58e90596c2065befd3060767736c829c18f3474c/abi.json
269+
$ abidump --yaml ./address/0x58e90596c2065befd3060767736c829c18f3474c/abi.json
270+
```
271+
272+
273+
274+
## License
275+
276+
The scripts are dedicated to the public domain.
277+
Use it as you please with no restrictions whatsoever.
278+
279+
280+
## Questions? Comments?
281+
282+
283+
Post them on the [D.I.Y. Punk (Pixel) Art reddit](https://old.reddit.com/r/DIYPunkArt). Thanks.
284+

0 commit comments

Comments
 (0)