Add CIC package

Add abi signature encoding list

Add cic package
This commit is contained in:
lash
2023-10-29 10:52:11 +00:00
parent b1c03932ad
commit 3d2b2fa612
197 changed files with 824 additions and 1359 deletions

37
scripts/abilist.py Normal file
View File

@@ -0,0 +1,37 @@
# standard imports
import json
import sys
# external imports
import sha3
f = open(sys.argv[1], 'r')
o = json.load(f)
f.close()
ks = []
r = {}
for v in o:
if v['type'] != "function":
continue
name = ''
try:
name = v['name']
except KeyError:
continue
args = []
for vv in v['inputs']:
args.append(vv['type'])
sig = '{}({})'.format(name, ','.join(args))
h = sha3.keccak_256()
h.update(sig.encode('utf-8'))
z = h.digest()
k = z[:4].hex()
#ks.append(k)
r[k] = sig
ks = list(r.keys())
ks.sort()
for k in ks:
print("{}\t{}".format(k, r[k]))