Compare commits
No commits in common. "master" and "lash/readme" have entirely different histories.
master
...
lash/readm
File diff suppressed because one or more lines are too long
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = okota
|
name = okota
|
||||||
version = 0.4.1
|
version = 0.4.0
|
||||||
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.INFO)
|
logging.basicConfig(level=logging.DEBUG)
|
||||||
logg = logging.getLogger()
|
logg = logging.getLogger()
|
||||||
|
|
||||||
testdir = os.path.dirname(__file__)
|
testdir = os.path.dirname(__file__)
|
||||||
@ -54,11 +54,12 @@ 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)
|
||||||
@ -98,34 +99,6 @@ 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,6 +55,9 @@ 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