mirror of
git://holbrook.no/eth-address-index
synced 2024-11-27 02:36:45 +01:00
Rehabilitate tests
This commit is contained in:
parent
44c077c8d3
commit
7afd00cfb8
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceCode","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceCode","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_toAddress","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
||||
|
@ -1,6 +1,6 @@
|
||||
[metadata]
|
||||
name = eth-address-index
|
||||
version = 0.1.1a9
|
||||
version = 0.1.1a10
|
||||
description = Signed metadata declarations for ethereum addresses
|
||||
author = Louis Holbrook
|
||||
author_email = dev@holbrook.no
|
||||
|
@ -35,7 +35,8 @@ class Test(EthTesterCase):
|
||||
super(Test, self).setUp()
|
||||
self.description = add_0x(os.urandom(32).hex())
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
#c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.constructor(self.accounts[0], self.description)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -45,7 +46,8 @@ class Test(EthTesterCase):
|
||||
|
||||
self.address = r['contract_address']
|
||||
|
||||
c = GiftableToken(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
#c = GiftableToken(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.constructor(self.accounts[0], 'FooToken', 'FOO', 6)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -55,7 +57,8 @@ class Test(EthTesterCase):
|
||||
|
||||
self.foo_token_address = r['contract_address']
|
||||
|
||||
c = GiftableToken(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
#c = GiftableToken(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.constructor(self.accounts[0], 'BarToken', 'BAR', 6)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -66,23 +69,22 @@ class Test(EthTesterCase):
|
||||
self.bar_token_address = r['contract_address']
|
||||
|
||||
|
||||
|
||||
def test_basic(self):
|
||||
|
||||
d = add_0x(os.urandom(32).hex())
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[0], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[0], self.bar_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -101,20 +103,20 @@ class Test(EthTesterCase):
|
||||
d_two = add_0x(os.urandom(32).hex())
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.foo_token_address, d_two)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[2], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[2], self.bar_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -130,17 +132,17 @@ class Test(EthTesterCase):
|
||||
d = add_0x(os.urandom(32).hex())
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[2], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.bar_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -161,17 +163,17 @@ class Test(EthTesterCase):
|
||||
d = '0x' + os.urandom(32).hex()
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[2], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[2], self.foo_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[1], self.rpc)
|
||||
c = AddressDeclarator(signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = AddressDeclarator(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.add_declaration(self.address, self.accounts[1], self.bar_token_address, d)
|
||||
self.rpc.do(o)
|
||||
|
||||
|
@ -30,7 +30,8 @@ class Test(EthTesterCase):
|
||||
def setUp(self):
|
||||
super(Test, self).setUp()
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
c = TokenUniqueSymbolIndex(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
#c = TokenUniqueSymbolIndex(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
c = TokenUniqueSymbolIndex(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.constructor(self.accounts[0])
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -40,7 +41,8 @@ class Test(EthTesterCase):
|
||||
|
||||
self.address = r['contract_address']
|
||||
|
||||
c = GiftableToken(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
#c = GiftableToken(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash_hex, o) = c.constructor(self.accounts[0], 'FooToken', 'FOO', 6)
|
||||
self.rpc.do(o)
|
||||
|
||||
@ -53,11 +55,12 @@ class Test(EthTesterCase):
|
||||
|
||||
def test_register(self):
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
c = TokenUniqueSymbolIndex(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
#c = TokenUniqueSymbolIndex(signer=self.signer, nonce_oracle=nonce_oracle, chain_id=self.chain_spec.chain_id())
|
||||
c = TokenUniqueSymbolIndex(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
|
||||
(tx_hash_hex, o) = c.register(self.address, self.accounts[0], self.token_address)
|
||||
self.rpc.do(o)
|
||||
e = unpack(bytes.fromhex(strip_0x(o['params'][0])), chain_id=self.chain_spec.chain_id())
|
||||
e = unpack(bytes.fromhex(strip_0x(o['params'][0])), self.chain_spec)
|
||||
logg.debug('e {}'.format(e))
|
||||
|
||||
o = receipt(tx_hash_hex)
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@ -1 +1 @@
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceCode","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[],"name":"transferOwnership","outputs":[],"stateMutability":"nonpayable","type":"function"}]
|
||||
[{"inputs":[],"stateMutability":"nonpayable","type":"constructor"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"add","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"_key","type":"bytes32"}],"name":"addressOf","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"uint256","name":"_idx","type":"uint256"}],"name":"entry","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"entryCount","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"owner","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"_token","type":"address"}],"name":"register","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"bytes32","name":"","type":"bytes32"}],"name":"registry","outputs":[{"internalType":"uint256","name":"","type":"uint256"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"bytes4","name":"_interfaceCode","type":"bytes4"}],"name":"supportsInterface","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"pure","type":"function"},{"inputs":[{"internalType":"address","name":"_toAddress","type":"address"}],"name":"transferOwnership","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"nonpayable","type":"function"}]
|
||||
|
@ -6,6 +6,7 @@ contract TokenUniqueSymbolIndex {
|
||||
|
||||
// EIP 173
|
||||
address public owner;
|
||||
address newOwner;
|
||||
|
||||
mapping ( bytes32 => uint256 ) public registry;
|
||||
address[] tokens;
|
||||
@ -26,15 +27,17 @@ contract TokenUniqueSymbolIndex {
|
||||
return false;
|
||||
}
|
||||
|
||||
// Implements AccountsIndex
|
||||
function entry(uint256 _idx) public view returns ( address ) {
|
||||
return tokens[_idx + 1];
|
||||
}
|
||||
|
||||
// EIP 173
|
||||
function transferOwnership() public {
|
||||
revert("owner cannot be changed");
|
||||
function transferOwnership(address _toAddress) public returns (bool) {
|
||||
require(ms
|
||||
}
|
||||
|
||||
// Implements Registry
|
||||
function addressOf(bytes32 _key) public view returns ( address ) {
|
||||
uint256 idx;
|
||||
|
||||
@ -63,6 +66,13 @@ contract TokenUniqueSymbolIndex {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Implements AccountsIndex
|
||||
function add(address _token) public returns (bool) {
|
||||
return register(_token);
|
||||
}
|
||||
|
||||
|
||||
// Implements AccountsIndex
|
||||
function entryCount() public view returns ( uint256 ) {
|
||||
return tokens.length - 1;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user