mirror of
git://holbrook.no/eth-accounts-index
synced 2024-11-05 10:16:47 +01:00
Implement external signer
This commit is contained in:
parent
70d7428bcd
commit
b77448a0f1
@ -1,3 +1,8 @@
|
|||||||
|
- 0.0.10-unreleased
|
||||||
|
- Implement external signer
|
||||||
|
- Standardize cli arg flags
|
||||||
|
- 0.0.9
|
||||||
|
- Fix wrong abi path in registry.py
|
||||||
- 0.0.8
|
- 0.0.8
|
||||||
- Add executable to add writers and addresses after deploy
|
- Add executable to add writers and addresses after deploy
|
||||||
- 0.0.7
|
- 0.0.7
|
||||||
|
@ -1 +1 @@
|
|||||||
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002819055506106b8806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80634c2ebc6b1161005b5780634c2ebc6b146101545780635ae06f7e146101ac578063da2824a814610206578063f2a40db8146102605761007d565b806306661abd146100825780630a3b0a4f146100a05780633ef25013146100fa575b600080fd5b61008a6102b8565b6040518082815260200191505060405180910390f35b6100e2600480360360208110156100b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102be565b60405180821515815260200191505060405180910390f35b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061046f565b60405180821515815260200191505060405180910390f35b6101966004803603602081101561016a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104ba565b6040518082815260200191505060405180910390f35b6101ee600480360360208110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104d2565b60405180821515815260200191505060405180910390f35b6102486004803603602081101561021c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610586565b60405180821515815260200191505060405180910390f35b61028c6004803603602081101561027657600080fd5b8101908080359060200190929190505050610643565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661031657600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461036257600080fd5b6000829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038273ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a360019050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60016020528060005260406000206000915090505481565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461052e57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e257600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000818154811061065357600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220c363e1ac71c244f86e7776c46c8498ad7436db5fa97517c8aaad4af25e2ba3ca64736f6c63430007050033
|
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002819055506106f7806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480634c2ebc6b116100785780634c2ebc6b146101715780635ae06f7e146101c9578063da2824a814610223578063f2a40db81461027d5761009a565b806306661abd1461009f5780630a3b0a4f146100bd5780633ef2501314610117575b600080fd5b6100a76102d5565b6040518082815260200191505060405180910390f35b6100ff600480360360208110156100d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102db565b60405180821515815260200191505060405180910390f35b6101596004803603602081101561012d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061048c565b60405180821515815260200191505060405180910390f35b6101b36004803603602081101561018757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104d7565b6040518082815260200191505060405180910390f35b61020b600480360360208110156101df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b6102656004803603602081101561023957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105a3565b60405180821515815260200191505060405180910390f35b6102a96004803603602081101561029357600080fd5b8101908080359060200190929190505050610660565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661033357600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461037f57600080fd5b6000829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038273ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a360019050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60016020528060005260406000206000915090505481565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461054b57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105ff57600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000818154811061066d57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea264697066735822122015b8d8e75596c6a573f6b345fd0d9e2ce7cb2ae5be362ccbe8e60c1db0871c3f64736f6c637827302e362e31322d646576656c6f702e323032312e312e382b636f6d6d69742e32376435313736350058
|
@ -13,7 +13,9 @@ import logging
|
|||||||
|
|
||||||
# third-party imports
|
# third-party imports
|
||||||
import web3
|
import web3
|
||||||
|
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
|
||||||
|
from crypto_dev_signer.keystore import DictKeystore
|
||||||
|
from crypto_dev_signer.eth.helper import EthTxExecutor
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
@ -26,40 +28,76 @@ data_dir = os.path.join(script_dir, '..', 'data')
|
|||||||
|
|
||||||
argparser = argparse.ArgumentParser()
|
argparser = argparse.ArgumentParser()
|
||||||
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
|
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
|
||||||
argparser.add_argument('-w', '--writer', dest='w', action='append', type=str, help='Writer to add')
|
argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed')
|
||||||
argparser.add_argument('-o', '--owner', dest='o', type=str, help='Accounts index owner')
|
argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
|
||||||
argparser.add_argument('-a', '--account', dest='a', action='append', type=str, help='Account to add')
|
argparser.add_argument('--writer', dest='writer', action='append', type=str, help='Writer to add')
|
||||||
|
argparser.add_argument('-a', '--signer-address', dest='o', type=str, help='Accounts index owner')
|
||||||
|
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string')
|
||||||
|
argparser.add_argument('--account', dest='account', action='append', type=str, help='Account to add')
|
||||||
|
argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing')
|
||||||
argparser.add_argument('-r', '--accounts-index-address', dest='r', required=True, type=str, help='Contract address to account index to edit')
|
argparser.add_argument('-r', '--accounts-index-address', dest='r', required=True, type=str, help='Contract address to account index to edit')
|
||||||
argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir))
|
argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir))
|
||||||
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
||||||
|
argparser.add_argument('-vv', action='store_true', help='Be more verbose')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
if args.v:
|
if args.vv:
|
||||||
logg.setLevel(logging.DEBUG)
|
logg.setLevel(logging.DEBUG)
|
||||||
|
elif args.v:
|
||||||
|
logg.setLevel(logging.INFO)
|
||||||
|
|
||||||
|
block_last = args.w
|
||||||
|
block_all = args.ww
|
||||||
|
|
||||||
|
w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
|
||||||
|
|
||||||
|
signer_address = None
|
||||||
|
keystore = DictKeystore()
|
||||||
|
if args.y != None:
|
||||||
|
logg.debug('loading keystore file {}'.format(args.y))
|
||||||
|
signer_address = keystore.import_keystore_file(args.y)
|
||||||
|
logg.debug('now have key for signer address {}'.format(signer_address))
|
||||||
|
signer = EIP155Signer(keystore)
|
||||||
|
|
||||||
|
chain_pair = args.i.split(':')
|
||||||
|
chain_id = int(chain_pair[1])
|
||||||
|
|
||||||
|
helper = EthTxExecutor(
|
||||||
|
w3,
|
||||||
|
signer_address,
|
||||||
|
signer,
|
||||||
|
chain_id,
|
||||||
|
block=args.ww,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
|
|
||||||
|
|
||||||
f = open(os.path.join(args.abi_dir, 'AccountsIndex.json'), 'r')
|
f = open(os.path.join(args.abi_dir, 'AccountsIndex.json'), 'r')
|
||||||
abi = json.load(f)
|
abi = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
w3.eth.defaultAccount = w3.eth.accounts[0]
|
|
||||||
if args.o != None:
|
|
||||||
w3.eth.defaultAccount = args.o
|
|
||||||
logg.debug('owner address {}'.format(w3.eth.defaultAccount))
|
|
||||||
|
|
||||||
c = w3.eth.contract(abi=abi, address=args.r)
|
c = w3.eth.contract(abi=abi, address=args.r)
|
||||||
|
|
||||||
if args.w != None:
|
if args.writer != None:
|
||||||
for w in args.w:
|
for w in args.writer:
|
||||||
logg.info('adding {} to write list'.format(w))
|
logg.info('adding {} to write list'.format(w))
|
||||||
print(c.functions.addWriter(w).transact().hex())
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
|
c.functions.addWriter(w).buildTransaction,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
print(tx_hash)
|
||||||
|
|
||||||
if args.a != None:
|
|
||||||
for a in args.a:
|
if args.account != None:
|
||||||
|
for a in args.account:
|
||||||
logg.info('adding {} to accounts index'.format(a))
|
logg.info('adding {} to accounts index'.format(a))
|
||||||
print(c.functions.add(a).transact().hex())
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
|
c.functions.add(a).buildTransaction,
|
||||||
|
],
|
||||||
|
)
|
||||||
|
print(tx_hash)
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
@ -13,7 +13,9 @@ import logging
|
|||||||
|
|
||||||
# third-party imports
|
# third-party imports
|
||||||
import web3
|
import web3
|
||||||
|
from crypto_dev_signer.eth.signer import ReferenceSigner as EIP155Signer
|
||||||
|
from crypto_dev_signer.keystore import DictKeystore
|
||||||
|
from crypto_dev_signer.eth.helper import EthTxExecutor
|
||||||
|
|
||||||
logging.basicConfig(level=logging.WARNING)
|
logging.basicConfig(level=logging.WARNING)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
@ -26,20 +28,50 @@ data_dir = os.path.join(script_dir, '..', 'data')
|
|||||||
|
|
||||||
argparser = argparse.ArgumentParser()
|
argparser = argparse.ArgumentParser()
|
||||||
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
|
argparser.add_argument('-p', '--provider', dest='p', default='http://localhost:8545', type=str, help='Web3 provider url (http only)')
|
||||||
argparser.add_argument('-w', '--writer', dest='w', action='append', type=str, help='Writer to add')
|
argparser.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed')
|
||||||
argparser.add_argument('-o', '--owner', dest='o', type=str, help='Accounts index owner')
|
argparser.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
|
||||||
argparser.add_argument('-a', '--account', dest='a', action='append', type=str, help='Account to add')
|
argparser.add_argument('-i', '--chain-spec', dest='i', type=str, default='Ethereum:1', help='Chain specification string')
|
||||||
argparser.add_argument('-k', '--keep-sender', dest='k', action='store_true', help='If set, sender will be kept as writer')
|
argparser.add_argument('--writer', dest='writer', action='append', type=str, help='Writer to add')
|
||||||
|
argparser.add_argument('-a', '--signer-address', dest='a', type=str, help='Signing address')
|
||||||
|
argparser.add_argument('-y', '--key-file', dest='y', type=str, help='Ethereum keystore file to use for signing')
|
||||||
|
argparser.add_argument('--account', action='append', type=str, help='Account to add')
|
||||||
|
argparser.add_argument('--keep-sender', dest='keep_sender', action='store_true', help='If set, sender will be kept as writer')
|
||||||
argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir))
|
argparser.add_argument('--abi-dir', dest='abi_dir', type=str, default=data_dir, help='Directory containing bytecode and abi (default: {})'.format(data_dir))
|
||||||
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
argparser.add_argument('-v', action='store_true', help='Be verbose')
|
||||||
|
argparser.add_argument('-vv', action='store_true', help='Be more verbose')
|
||||||
args = argparser.parse_args()
|
args = argparser.parse_args()
|
||||||
|
|
||||||
if args.v:
|
if args.vv:
|
||||||
logg.setLevel(logging.DEBUG)
|
logg.setLevel(logging.DEBUG)
|
||||||
|
elif args.v:
|
||||||
|
logg.setLevel(logging.INFO)
|
||||||
|
|
||||||
|
block_last = args.w
|
||||||
|
block_all = args.ww
|
||||||
|
|
||||||
|
w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
|
||||||
|
|
||||||
|
signer_address = None
|
||||||
|
keystore = DictKeystore()
|
||||||
|
if args.y != None:
|
||||||
|
logg.debug('loading keystore file {}'.format(args.y))
|
||||||
|
signer_address = keystore.import_keystore_file(args.y)
|
||||||
|
logg.debug('now have key for signer address {}'.format(signer_address))
|
||||||
|
signer = EIP155Signer(keystore)
|
||||||
|
|
||||||
|
chain_pair = args.i.split(':')
|
||||||
|
chain_id = int(chain_pair[1])
|
||||||
|
|
||||||
|
helper = EthTxExecutor(
|
||||||
|
w3,
|
||||||
|
signer_address,
|
||||||
|
signer,
|
||||||
|
chain_id,
|
||||||
|
block=args.ww,
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
w3 = web3.Web3(web3.Web3.HTTPProvider(args.p))
|
|
||||||
|
|
||||||
f = open(os.path.join(args.abi_dir, 'AccountsIndex.json'), 'r')
|
f = open(os.path.join(args.abi_dir, 'AccountsIndex.json'), 'r')
|
||||||
abi = json.load(f)
|
abi = json.load(f)
|
||||||
f.close()
|
f.close()
|
||||||
@ -48,60 +80,53 @@ def main():
|
|||||||
bytecode = f.read()
|
bytecode = f.read()
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
w3.eth.defaultAccount = w3.eth.accounts[0]
|
|
||||||
if args.o != None:
|
|
||||||
w3.eth.defaultAccount = args.o
|
|
||||||
logg.debug('owner address {}'.format(w3.eth.defaultAccount))
|
|
||||||
|
|
||||||
c = w3.eth.contract(abi=abi, bytecode=bytecode)
|
c = w3.eth.contract(abi=abi, bytecode=bytecode)
|
||||||
tx_hash = c.constructor().transact()
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
rcpt = w3.eth.getTransactionReceipt(tx_hash)
|
c.constructor().buildTransaction
|
||||||
|
],
|
||||||
|
force_wait=True,
|
||||||
|
)
|
||||||
address = rcpt.contractAddress
|
address = rcpt.contractAddress
|
||||||
|
|
||||||
c = w3.eth.contract(abi=abi, address=address)
|
c = w3.eth.contract(abi=abi, address=address)
|
||||||
|
|
||||||
logg.debug('adding sender to write list')
|
logg.debug('adding sender to write list')
|
||||||
c.functions.addWriter(w3.eth.accounts[0]).transact()
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
|
c.functions.addWriter(signer_address).buildTransaction
|
||||||
|
],
|
||||||
|
force_wait=True,
|
||||||
|
)
|
||||||
|
|
||||||
if args.w != None:
|
if args.writer != None:
|
||||||
for w in args.w:
|
for w in args.writer:
|
||||||
logg.info('adding {} to write list'.format(w))
|
logg.info('adding {} to write list'.format(w))
|
||||||
c.functions.addWriter(w).transact()
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
|
c.functions.addWriter(w).buildTransaction
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
if args.a != None:
|
if args.account != None:
|
||||||
for a in args.a:
|
for a in args.account:
|
||||||
logg.info('adding {} to accounts index'.format(a))
|
logg.info('adding {} to accounts index'.format(a))
|
||||||
c.functions.add(a).transact()
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
|
c.functions.add(a).buildTransaction
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
if not args.k:
|
if not args.keep_sender:
|
||||||
logg.debug('deleting sender for write list')
|
logg.debug('deleting sender for write list')
|
||||||
c.functions.deleteWriter(w3.eth.defaultAccount).transact()
|
(tx_hash, rcpt) = helper.sign_and_send(
|
||||||
|
[
|
||||||
|
c.functions.deleteWriter(signer_address).buildTransaction
|
||||||
|
],
|
||||||
|
)
|
||||||
|
|
||||||
print(address)
|
print(address)
|
||||||
|
|
||||||
# fail = False
|
|
||||||
# try:
|
|
||||||
# c.functions.add(w3.eth.accounts[2]).transact({'from': w3.eth.accounts[1]})
|
|
||||||
# except:
|
|
||||||
# fail = True
|
|
||||||
# assert fail
|
|
||||||
#
|
|
||||||
# c.functions.addWriter(w3.eth.accounts[1]).transact({'from': w3.eth.accounts[0]})
|
|
||||||
# c.functions.add(w3.eth.accounts[2]).transact({'from': w3.eth.accounts[1]})
|
|
||||||
# c.functions.add(w3.eth.accounts[3]).transact({'from': w3.eth.accounts[1]})
|
|
||||||
#
|
|
||||||
# assert c.functions.count().call() == 3
|
|
||||||
# assert c.functions.accountsIndex(w3.eth.accounts[3]).call() == 2
|
|
||||||
# assert c.functions.accounts(2).call() == w3.eth.accounts[3]
|
|
||||||
#
|
|
||||||
# fail = False
|
|
||||||
# try:
|
|
||||||
# c.functions.add(w3.eth.accounts[3]).transact({'from': w3.eth.accounts[1]})
|
|
||||||
# except:
|
|
||||||
# fail = True
|
|
||||||
# assert fail
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
main()
|
main()
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-accounts-index
|
name = eth-accounts-index
|
||||||
version = 0.0.8
|
version = 0.0.10a1
|
||||||
description = Accounts index evm contract tooling with permissioned writes
|
description = Accounts index evm contract tooling with permissioned writes
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
@ -29,6 +29,7 @@ packages =
|
|||||||
install_requires =
|
install_requires =
|
||||||
confini==0.3.5
|
confini==0.3.5
|
||||||
web3==5.12.2
|
web3==5.12.2
|
||||||
|
crypto-dev-signer~=0.4.13b1
|
||||||
tests_require =
|
tests_require =
|
||||||
pytest==6.0.1
|
pytest==6.0.1
|
||||||
eth-tester==0.5.0b2
|
eth-tester==0.5.0b2
|
||||||
|
@ -1 +1 @@
|
|||||||
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002819055506106b8806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80634c2ebc6b1161005b5780634c2ebc6b146101545780635ae06f7e146101ac578063da2824a814610206578063f2a40db8146102605761007d565b806306661abd146100825780630a3b0a4f146100a05780633ef25013146100fa575b600080fd5b61008a6102b8565b6040518082815260200191505060405180910390f35b6100e2600480360360208110156100b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102be565b60405180821515815260200191505060405180910390f35b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061046f565b60405180821515815260200191505060405180910390f35b6101966004803603602081101561016a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104ba565b6040518082815260200191505060405180910390f35b6101ee600480360360208110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104d2565b60405180821515815260200191505060405180910390f35b6102486004803603602081101561021c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610586565b60405180821515815260200191505060405180910390f35b61028c6004803603602081101561027657600080fd5b8101908080359060200190929190505050610643565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661031657600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461036257600080fd5b6000829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038273ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a360019050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60016020528060005260406000206000915090505481565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461052e57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e257600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000818154811061065357600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220c363e1ac71c244f86e7776c46c8498ad7436db5fa97517c8aaad4af25e2ba3ca64736f6c63430007050033
|
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002819055506106f7806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061009a576000357c0100000000000000000000000000000000000000000000000000000000900480634c2ebc6b116100785780634c2ebc6b146101715780635ae06f7e146101c9578063da2824a814610223578063f2a40db81461027d5761009a565b806306661abd1461009f5780630a3b0a4f146100bd5780633ef2501314610117575b600080fd5b6100a76102d5565b6040518082815260200191505060405180910390f35b6100ff600480360360208110156100d357600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102db565b60405180821515815260200191505060405180910390f35b6101596004803603602081101561012d57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061048c565b60405180821515815260200191505060405180910390f35b6101b36004803603602081101561018757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104d7565b6040518082815260200191505060405180910390f35b61020b600480360360208110156101df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104ef565b60405180821515815260200191505060405180910390f35b6102656004803603602081101561023957600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105a3565b60405180821515815260200191505060405180910390f35b6102a96004803603602081101561029357600080fd5b8101908080359060200190929190505050610660565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661033357600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461037f57600080fd5b6000829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038273ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a360019050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60016020528060005260406000206000915090505481565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461054b57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105ff57600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000818154811061066d57fe5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea264697066735822122015b8d8e75596c6a573f6b345fd0d9e2ce7cb2ae5be362ccbe8e60c1db0871c3f64736f6c637827302e362e31322d646576656c6f702e323032312e312e382b636f6d6d69742e32376435313736350058
|
@ -1,4 +1,4 @@
|
|||||||
pragma solidity >=0.6.12;
|
pragma solidity >0.6.11;
|
||||||
|
|
||||||
// SPDX-License-Identifier: GPL-3.0-or-later
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
||||||
|
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
|
SOLC = /usr/bin/solc
|
||||||
|
|
||||||
all:
|
all:
|
||||||
solc --bin AccountsIndex.sol | awk 'NR>3' > AccountsIndex.bin
|
$(SOLC) --bin AccountsIndex.sol --evm-version byzantium | awk 'NR>3' > AccountsIndex.bin
|
||||||
truncate -s -1 AccountsIndex.bin
|
truncate -s -1 AccountsIndex.bin
|
||||||
solc --abi AccountsIndex.sol | awk 'NR>3' > AccountsIndex.abi.json
|
$(SOLC) --abi AccountsIndex.sol --evm-version byzantium | awk 'NR>3' > AccountsIndex.json
|
||||||
|
|
||||||
install: all
|
install: all
|
||||||
cp -v *{json,bin} ../python/eth_accounts_index/data/
|
cp -v *{json,bin} ../python/eth_accounts_index/data/
|
||||||
|
Loading…
Reference in New Issue
Block a user