Rename solidity file, return values from evm

This commit is contained in:
nolash 2020-12-07 16:41:48 +01:00
parent 953cb78d80
commit b278d2fb69
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
13 changed files with 32 additions and 15 deletions

View File

@ -1,3 +1,5 @@
- 0.0.5
* Rename solidity file, add return values from evm functions
- 0.0.4 - 0.0.4
* Update dependency versions * Update dependency versions
- 0.0.3 - 0.0.3

View File

@ -0,0 +1 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AccountAdded","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"accounts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -0,0 +1 @@
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002819055506106b8806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80634c2ebc6b1161005b5780634c2ebc6b146101545780635ae06f7e146101ac578063da2824a814610206578063f2a40db8146102605761007d565b806306661abd146100825780630a3b0a4f146100a05780633ef25013146100fa575b600080fd5b61008a6102b8565b6040518082815260200191505060405180910390f35b6100e2600480360360208110156100b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102be565b60405180821515815260200191505060405180910390f35b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061046f565b60405180821515815260200191505060405180910390f35b6101966004803603602081101561016a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104ba565b6040518082815260200191505060405180910390f35b6101ee600480360360208110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104d2565b60405180821515815260200191505060405180910390f35b6102486004803603602081101561021c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610586565b60405180821515815260200191505060405180910390f35b61028c6004803603602081101561027657600080fd5b8101908080359060200190929190505050610643565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661031657600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461036257600080fd5b6000829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038273ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a360019050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60016020528060005260406000206000915090505481565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461052e57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e257600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000818154811061065357600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220c363e1ac71c244f86e7776c46c8498ad7436db5fa97517c8aaad4af25e2ba3ca64736f6c63430007050033

View File

@ -1 +0,0 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AccountAdded","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"accounts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[],"stateMutability":"nonpayable","type":"function"}]

View File

@ -1 +0,0 @@
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160028190555061059e806100cb6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806306661abd146100675780630a3b0a4f146100855780634c2ebc6b146100c95780635ae06f7e14610121578063da2824a814610165578063f2a40db8146101a9575b600080fd5b61006f610201565b6040518082815260200191505060405180910390f35b6100c76004803603602081101561009b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610207565b005b61010b600480360360208110156100df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103b0565b6040518082815260200191505060405180910390f35b6101636004803603602081101561013757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103c8565b005b6101a76004803603602081101561017b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610474565b005b6101d5600480360360208110156101bf57600080fd5b8101908080359060200190929190505050610529565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661025d57600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146102a957600080fd5b6000819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038173ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a350565b60016020528060005260406000206000915090505481565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461042257600080fd5b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104ce57600080fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000818154811061053957600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea26469706673582212202d3f96ec79455e1e6d538b488bb216a8a687c626526e774dbab2d019887109f664736f6c63430007040033

View File

@ -30,7 +30,7 @@ class AccountRegistry:
@staticmethod @staticmethod
def abi(): def abi():
if AccountRegistry.__abi == None: if AccountRegistry.__abi == None:
f = open(os.path.join(datadir, 'registry.abi.json'), 'r') f = open(os.path.join(datadir, 'AccountsIndex.abi.json'), 'r')
AccountRegistry.__abi = json.load(f) AccountRegistry.__abi = json.load(f)
f.close() f.close()
return AccountRegistry.__abi return AccountRegistry.__abi
@ -39,7 +39,7 @@ class AccountRegistry:
@staticmethod @staticmethod
def bytecode(): def bytecode():
if AccountRegistry.__bytecode == None: if AccountRegistry.__bytecode == None:
f = open(os.path.join(datadir, 'registry.bin')) f = open(os.path.join(datadir, 'AccountsIndex.bin'))
AccountRegistry.__bytecode = f.read() AccountRegistry.__bytecode = f.read()
f.close() f.close()
return AccountRegistry.__bytecode return AccountRegistry.__bytecode

View File

@ -1,6 +1,6 @@
[metadata] [metadata]
name = eth-accounts-index name = eth-accounts-index
version = 0.0.4 version = 0.0.5
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

View File

@ -21,11 +21,11 @@ class Test(unittest.TestCase):
'gas_limit': 9000000, 'gas_limit': 9000000,
}) })
f = open(os.path.join(testdir, '../eth_accounts_index/data/registry.bin'), 'r') f = open(os.path.join(testdir, '../eth_accounts_index/data/AccountsIndex.bin'), 'r')
bytecode = f.read() bytecode = f.read()
f.close() f.close()
f = open(os.path.join(testdir, '../eth_accounts_index/data/registry.abi.json'), 'r') f = open(os.path.join(testdir, '../eth_accounts_index/data/AccountsIndex.abi.json'), 'r')
abi = json.load(f) abi = json.load(f)
f.close() f.close()

View File

@ -1 +1 @@
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AccountAdded","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"accounts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[],"stateMutability":"nonpayable","type":"function"}] [{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"addedAccount","type":"address"},{"indexed":true,"internalType":"uint256","name":"accountIndex","type":"uint256"}],"name":"AccountAdded","type":"event"},{"inputs":[{"internalType":"uint256","name":"","type":"uint256"}],"name":"accounts","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"accountsIndex","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"addWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[],"name":"count","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_writer","type":"address"}],"name":"deleteWriter","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"_account","type":"address"}],"name":"have","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"}]

View File

@ -1 +1 @@
608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160028190555061059e806100cb6000396000f3fe608060405234801561001057600080fd5b50600436106100625760003560e01c806306661abd146100675780630a3b0a4f146100855780634c2ebc6b146100c95780635ae06f7e14610121578063da2824a814610165578063f2a40db8146101a9575b600080fd5b61006f610201565b6040518082815260200191505060405180910390f35b6100c76004803603602081101561009b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610207565b005b61010b600480360360208110156100df57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103b0565b6040518082815260200191505060405180910390f35b6101636004803603602081101561013757600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103c8565b005b6101a76004803603602081101561017b57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610474565b005b6101d5600480360360208110156101bf57600080fd5b8101908080359060200190929190505050610529565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661025d57600080fd5b6000600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054146102a957600080fd5b6000819080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038173ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a350565b60016020528060005260406000206000915090505481565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461042257600080fd5b600360008273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905550565b3373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146104ce57600080fd5b6001600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050565b6000818154811061053957600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea26469706673582212202d3f96ec79455e1e6d538b488bb216a8a687c626526e774dbab2d019887109f664736f6c63430007040033 608060405234801561001057600080fd5b5033600460006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060008080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555060016002819055506106b8806100cb6000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80634c2ebc6b1161005b5780634c2ebc6b146101545780635ae06f7e146101ac578063da2824a814610206578063f2a40db8146102605761007d565b806306661abd146100825780630a3b0a4f146100a05780633ef25013146100fa575b600080fd5b61008a6102b8565b6040518082815260200191505060405180910390f35b6100e2600480360360208110156100b657600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506102be565b60405180821515815260200191505060405180910390f35b61013c6004803603602081101561011057600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061046f565b60405180821515815260200191505060405180910390f35b6101966004803603602081101561016a57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104ba565b6040518082815260200191505060405180910390f35b6101ee600480360360208110156101c257600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506104d2565b60405180821515815260200191505060405180910390f35b6102486004803603602081101561021c57600080fd5b81019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610586565b60405180821515815260200191505060405180910390f35b61028c6004803603602081101561027657600080fd5b8101908080359060200190929190505050610643565b604051808273ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b60025481565b6000600360003373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff1661031657600080fd5b6000600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020541461036257600080fd5b6000829080600181540180825580915050600190039060005260206000200160009091909190916101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600254600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506002600081548092919060010191905055506001600254038273ffffffffffffffffffffffffffffffffffffffff167f5ed3bdd47b9af629827a8d129aa39c870b10c03f0153fe9ddb8e84b665061acd60405160405180910390a360019050919050565b600080600160008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002054119050919050565b60016020528060005260406000206000915090505481565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161461052e57600080fd5b600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81549060ff021916905560019050919050565b60003373ffffffffffffffffffffffffffffffffffffffff16600460009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16146105e257600080fd5b6001600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555060019050919050565b6000818154811061065357600080fd5b906000526020600020016000915054906101000a900473ffffffffffffffffffffffffffffffffffffffff168156fea2646970667358221220c363e1ac71c244f86e7776c46c8498ad7436db5fa97517c8aaad4af25e2ba3ca64736f6c63430007050033

View File

@ -1,4 +1,4 @@
pragma solidity ^0.6.12; pragma solidity >=0.6.12;
// SPDX-License-Identifier: GPL-3.0-or-later // SPDX-License-Identifier: GPL-3.0-or-later
@ -18,22 +18,29 @@ contract CustodialAccountIndex {
count = 1; count = 1;
} }
function addWriter(address _writer) public { function addWriter(address _writer) public returns (bool) {
require(owner == msg.sender); require(owner == msg.sender);
writers[_writer] = true; writers[_writer] = true;
return true;
} }
function deleteWriter(address _writer) public { function deleteWriter(address _writer) public returns (bool) {
require(owner == msg.sender); require(owner == msg.sender);
delete writers[_writer]; delete writers[_writer];
return true;
} }
function add(address _account) public { function add(address _account) external returns (bool) {
require(writers[msg.sender]); require(writers[msg.sender]);
require(accountsIndex[_account] == 0); require(accountsIndex[_account] == 0);
accounts.push(_account); accounts.push(_account);
accountsIndex[_account] = count; accountsIndex[_account] = count;
count++; count++;
emit AccountAdded(_account, count-1); emit AccountAdded(_account, count-1);
return true;
}
function have(address _account) external view returns (bool) {
return accountsIndex[_account] > 0;
} }
} }

8
solidity/Makefile Normal file
View File

@ -0,0 +1,8 @@
all:
solc --bin AccountsIndex.sol | awk 'NR>3' > AccountsIndex.bin
truncate -s -1 AccountsIndex.bin
solc --abi AccountsIndex.sol | awk 'NR>3' > AccountsIndex.abi.json
install: all
cp -v *{json,bin} ../python/eth_accounts_index/data/

View File

@ -12,11 +12,11 @@ provider = web3.Web3.EthereumTesterProvider(instance)
w3 = web3.Web3(provider) w3 = web3.Web3(provider)
f = open('registry.bin', 'r') f = open('AccountsIndex.bin', 'r')
bytecode = f.read() bytecode = f.read()
f.close() f.close()
f = open('registry.abi.json', 'r') f = open('AccountsIndex.abi.json', 'r')
abi = json.load(f) abi = json.load(f)
f.close() f.close()