base.py (1320B)
1 # standard imports 2 import logging 3 import time 4 5 # external imports 6 from chainlib.eth.unittest.ethtester import EthTesterCase 7 from chainlib.connection import RPCConnection 8 from chainlib.eth.nonce import RPCNonceOracle 9 from chainlib.eth.tx import receipt 10 from chainlib.eth.address import to_checksum_address 11 12 # local imports 13 from static_token import StaticToken 14 from eth_erc20.unittest import TestInterface 15 16 logg = logging.getLogger(__name__) 17 18 19 class TestStaticToken(EthTesterCase, TestInterface): 20 21 def setUp(self): 22 super(TestStaticToken, self).setUp() 23 self.conn = RPCConnection.connect(self.chain_spec, 'default') 24 nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) 25 c = StaticToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) 26 self.symbol = 'FOO' 27 self.name = 'Foo Token' 28 self.decimals = 16 29 self.initial_supply = 1 << 24 30 (tx_hash, o) = c.constructor(self.accounts[0], self.name, self.symbol, self.decimals, self.initial_supply) 31 self.rpc.do(o) 32 o = receipt(tx_hash) 33 r = self.rpc.do(o) 34 self.assertEqual(r['status'], 1) 35 self.address = to_checksum_address(r['contract_address']) 36 logg.debug('published statictoken on address {} with hash {}'.format(self.address, tx_hash))