Compare commits
1 Commits
Author | SHA1 | Date | |
---|---|---|---|
9bad5b5ccf |
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = okota
|
name = okota
|
||||||
version = 0.4.0
|
version = 0.4.1
|
||||||
description = Registries for CIC using the eth-address-index backend
|
description = Registries for CIC using the eth-address-index backend
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
@ -25,7 +25,7 @@ from okota.token_index.index import (
|
|||||||
# test imports
|
# test imports
|
||||||
from eth_address_declarator.unittest import TestAddressDeclaratorBase
|
from eth_address_declarator.unittest import TestAddressDeclaratorBase
|
||||||
|
|
||||||
logging.basicConfig(level=logging.DEBUG)
|
logging.basicConfig(level=logging.INFO)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
testdir = os.path.dirname(__file__)
|
testdir = os.path.dirname(__file__)
|
||||||
@ -54,12 +54,11 @@ class TestTokenIndex(TestAddressDeclaratorBase):
|
|||||||
r = self.rpc.do(o)
|
r = self.rpc.do(o)
|
||||||
self.assertEqual(r['status'], 1)
|
self.assertEqual(r['status'], 1)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def test_register(self):
|
def test_register(self):
|
||||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||||
c = CICTokenIndex(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
c = CICTokenIndex(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||||
|
|
||||||
|
logg.info('using token index {}'.format(self.token_index_address))
|
||||||
(tx_hash_hex, o) = c.add(self.token_index_address, self.accounts[0], self.foo_token_address)
|
(tx_hash_hex, o) = c.add(self.token_index_address, self.accounts[0], self.foo_token_address)
|
||||||
self.rpc.do(o)
|
self.rpc.do(o)
|
||||||
e = unpack(bytes.fromhex(strip_0x(o['params'][0])), self.chain_spec)
|
e = unpack(bytes.fromhex(strip_0x(o['params'][0])), self.chain_spec)
|
||||||
@ -99,6 +98,34 @@ class TestTokenIndex(TestAddressDeclaratorBase):
|
|||||||
identifier = to_identifier('foo')
|
identifier = to_identifier('foo')
|
||||||
self.assertEqual(proofs[0], identifier)
|
self.assertEqual(proofs[0], identifier)
|
||||||
|
|
||||||
|
def test_duplicate_entry(self):
|
||||||
|
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||||
|
gft = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||||
|
(tx_hash_hex, o) = gft.constructor(self.accounts[0], 'FooTokenRedeploy', 'FOO', 6)
|
||||||
|
self.rpc.do(o)
|
||||||
|
|
||||||
|
o = receipt(tx_hash_hex)
|
||||||
|
r = self.rpc.do(o)
|
||||||
|
self.assertEqual(r['status'], 1)
|
||||||
|
|
||||||
|
self.foo_token_address_redeploy = r['contract_address']
|
||||||
|
logg.info('second foo token deployed with address {}'.format(self.foo_token_address_redeploy))
|
||||||
|
|
||||||
|
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||||
|
c = CICTokenIndex(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||||
|
logg.info('using token index {}'.format(self.token_index_address))
|
||||||
|
(tx_hash_hex, o) = c.add(self.token_index_address, self.accounts[0], self.foo_token_address_redeploy)
|
||||||
|
self.rpc.do(o)
|
||||||
|
e = unpack(bytes.fromhex(strip_0x(o['params'][0])), self.chain_spec)
|
||||||
|
|
||||||
|
o = receipt(tx_hash_hex)
|
||||||
|
r = self.rpc.do(o)
|
||||||
|
self.assertEqual(r['status'], 1)
|
||||||
|
|
||||||
|
o = c.address_of(self.token_index_address, 'FOO', sender_address=self.accounts[0])
|
||||||
|
r = self.rpc.do(o)
|
||||||
|
address = c.parse_address_of(r)
|
||||||
|
self.assertEqual(address, strip_0x(self.foo_token_address_redeploy))
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
unittest.main()
|
unittest.main()
|
||||||
|
@ -55,9 +55,6 @@ contract TokenUniqueSymbolIndexAddressDeclarator {
|
|||||||
require(ok);
|
require(ok);
|
||||||
require(r[31] == 0x01);
|
require(r[31] == 0x01);
|
||||||
|
|
||||||
idx = registry[token_symbol_key];
|
|
||||||
require(idx == 0);
|
|
||||||
|
|
||||||
registry[token_symbol_key] = tokens.length;
|
registry[token_symbol_key] = tokens.length;
|
||||||
tokens.push(_token);
|
tokens.push(_token);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user