mirror of
git://holbrook.no/eth-address-index
synced 2026-05-26 21:26:19 +02:00
Move token index, accounts index out of repo
This commit is contained in:
1
python/eth_address_declarator/unittest/__init__.py
Normal file
1
python/eth_address_declarator/unittest/__init__.py
Normal file
@@ -0,0 +1 @@
|
||||
from .addressdeclarator import *
|
||||
46
python/eth_address_declarator/unittest/addressdeclarator.py
Normal file
46
python/eth_address_declarator/unittest/addressdeclarator.py
Normal file
@@ -0,0 +1,46 @@
|
||||
# standard imports
|
||||
import unittest
|
||||
import logging
|
||||
import os
|
||||
|
||||
# external imports
|
||||
from hexathon import add_0x
|
||||
from chainlib.eth.unittest.ethtester import EthTesterCase
|
||||
from chainlib.eth.nonce import RPCNonceOracle
|
||||
from chainlib.eth.tx import receipt
|
||||
from giftable_erc20_token import GiftableToken
|
||||
|
||||
# local imports
|
||||
from eth_address_declarator.declarator import AddressDeclarator
|
||||
|
||||
logging.basicConfig(level=logging.DEBUG)
|
||||
logg = logging.getLogger()
|
||||
|
||||
|
||||
class TestAddressDeclaratorBase(EthTesterCase):
|
||||
|
||||
def setUp(self):
|
||||
super(TestAddressDeclaratorBase, self).setUp()
|
||||
self.description = add_0x(os.urandom(32).hex())
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
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)
|
||||
|
||||
o = receipt(tx_hash_hex)
|
||||
r = self.rpc.do(o)
|
||||
self.assertEqual(r['status'], 1)
|
||||
|
||||
self.address = r['contract_address']
|
||||
logg.debug('address declarator deployed with address {}'.format(self.address))
|
||||
|
||||
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)
|
||||
|
||||
o = receipt(tx_hash_hex)
|
||||
r = self.rpc.do(o)
|
||||
self.assertEqual(r['status'], 1)
|
||||
|
||||
self.foo_token_address = r['contract_address']
|
||||
logg.debug('foo token deployed with address {}'.format(self.foo_token_address))
|
||||
Reference in New Issue
Block a user