Move solidity source to subfolder
This commit is contained in:
parent
08040874ef
commit
d15dabb4b5
9
Makefile
9
Makefile
@ -2,10 +2,10 @@
|
|||||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
# File-version: 5
|
# File-version: 5
|
||||||
|
|
||||||
INPUTS = $(wildcard *.sol)
|
INPUTS = $(wildcard solidity/*.sol)
|
||||||
OUTPUTS_JSON = $(patsubst %.sol, %.json, $(INPUTS))
|
OUTPUTS_JSON = $(patsubst %.sol, %.json, $(INPUTS))
|
||||||
OUTPUTS_INTERFACE = $(patsubst %.sol, %.interface, $(INPUTS))
|
OUTPUTS_INTERFACE = $(patsubst %.sol, %.interface, $(INPUTS))
|
||||||
OUTPUTS = ${OUTPUTS_JSON} ${OUTPUTS_INTERFACE}
|
OUTPUTS = $(OUTPUTS_JSON) $(OUTPUTS_INTERFACE)
|
||||||
PREFIX = /usr/local/share/cic/solidity/abi
|
PREFIX = /usr/local/share/cic/solidity/abi
|
||||||
|
|
||||||
#%.abi.json: $(wildcard *.sol)
|
#%.abi.json: $(wildcard *.sol)
|
||||||
@ -20,12 +20,13 @@ PREFIX = /usr/local/share/cic/solidity/abi
|
|||||||
bash to_interface.sh $(basename $@).sol > $@
|
bash to_interface.sh $(basename $@).sol > $@
|
||||||
|
|
||||||
all: $(OUTPUTS)
|
all: $(OUTPUTS)
|
||||||
|
echo $(OUTPUTS)
|
||||||
|
|
||||||
install: $(OUTPUTS)
|
install: $(OUTPUTS)
|
||||||
install -vDm0644 -t $(PREFIX) $?
|
install -vDm0644 -t $(PREFIX) $?
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -vf *.json
|
rm -vf solidity/*.json
|
||||||
rm -vf *.interface
|
rm -vf solidity/*.interface
|
||||||
|
|
||||||
.PHONY: clean install
|
.PHONY: clean install
|
||||||
|
@ -5,8 +5,8 @@ import sys
|
|||||||
# external imports
|
# external imports
|
||||||
import sha3
|
import sha3
|
||||||
|
|
||||||
#logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
#logging.basicConfig(level=logging.DEBUG)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -3,7 +3,7 @@ import logging
|
|||||||
|
|
||||||
import ply.lex as lex
|
import ply.lex as lex
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,44 +0,0 @@
|
|||||||
import sys
|
|
||||||
|
|
||||||
from chainlib.eth.constant import ZERO_ADDRESS
|
|
||||||
from chainlib.eth.gas import DefaultGasOracle
|
|
||||||
from chainlib.eth.nonce import DefaultNonceOracle
|
|
||||||
from chainlib.eth.tx import TxFactory
|
|
||||||
from chainlib.eth.connection import HTTPConnection
|
|
||||||
from chainlib.eth.hash import keccak256_string_to_hex
|
|
||||||
from chainlib.eth.rpc import jsonrpc_template
|
|
||||||
from chainlib.eth.error import EthException
|
|
||||||
import eth_abi
|
|
||||||
from hexathon import (
|
|
||||||
strip_0x,
|
|
||||||
add_0x,
|
|
||||||
)
|
|
||||||
|
|
||||||
i = 0
|
|
||||||
while True:
|
|
||||||
conn = HTTPConnection('http://localhost:63545')
|
|
||||||
gas_oracle = DefaultGasOracle(conn)
|
|
||||||
nonce_oracle = DefaultNonceOracle(ZERO_ADDRESS, conn)
|
|
||||||
|
|
||||||
# Get Token registry address
|
|
||||||
txf = TxFactory(signer=None, gas_oracle=gas_oracle, nonce_oracle=nonce_oracle, chain_id=8996)
|
|
||||||
tx = txf.template(ZERO_ADDRESS, sys.argv[1])
|
|
||||||
identifiers_method = keccak256_string_to_hex('identifiers(uint256)')[:8]
|
|
||||||
data = add_0x(identifiers_method)
|
|
||||||
data += eth_abi.encode_single('uint256', i).hex()
|
|
||||||
txf.set_code(tx, data)
|
|
||||||
|
|
||||||
o = jsonrpc_template()
|
|
||||||
o['method'] = 'eth_call'
|
|
||||||
tx = txf.normalize(tx)
|
|
||||||
o['params'].append(tx)
|
|
||||||
o['params'].append('latest')
|
|
||||||
try:
|
|
||||||
r = conn.do(o)
|
|
||||||
except EthException:
|
|
||||||
break
|
|
||||||
id_bytes = bytes.fromhex(strip_0x(r))
|
|
||||||
id_str = id_bytes[:id_bytes.find(b'\x00')]
|
|
||||||
print(id_str.decode('utf-8̈́'))
|
|
||||||
i += 1
|
|
||||||
|
|
@ -3,7 +3,5 @@
|
|||||||
d=`mktemp -d`
|
d=`mktemp -d`
|
||||||
b=`basename $1`
|
b=`basename $1`
|
||||||
s=${b%%.*}
|
s=${b%%.*}
|
||||||
echo $s
|
|
||||||
python3 reduce_to_methods.py $1 > $d/$b
|
python3 reduce_to_methods.py $1 > $d/$b
|
||||||
python3 calculate_eip165.py $d/$b > ${s}.interface
|
python3 calculate_eip165.py $d/$b
|
||||||
>&2 echo $d/$b
|
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
import sys
|
|
||||||
import web3
|
|
||||||
|
|
||||||
f = open(sys.argv[1], 'r')
|
|
||||||
z = b''
|
|
||||||
for i in range(32):
|
|
||||||
z += b'\x00'
|
|
||||||
while True:
|
|
||||||
l = f.readline()
|
|
||||||
if l == '':
|
|
||||||
break
|
|
||||||
#print('line {}'.format(l))
|
|
||||||
h = web3.Web3.keccak(text=l)
|
|
||||||
z = bytes([a ^ b for a, b in zip(h, z)])
|
|
||||||
#print(h.hex(), z.hex())
|
|
||||||
f.close()
|
|
||||||
print(h[:4].hex())
|
|
Loading…
Reference in New Issue
Block a user