quote.py (1397B)
1 # standard imports 2 import logging 3 import time 4 # external imports 5 from chainlib.eth.unittest.ethtester import EthTesterCase 6 from chainlib.connection import RPCConnection 7 from chainlib.eth.nonce import RPCNonceOracle 8 from chainlib.eth.tx import receipt 9 from chainlib.eth.address import to_checksum_address 10 from giftable_erc20_token.unittest import TestGiftableToken 11 from eth_erc20 import ERC20 12 from chainlib.eth.block import block_latest 13 from eth_accounts_index.unittest import TestAccountsIndex 14 from eth_accounts_index.registry import AccountRegistry 15 from giftable_erc20_token import GiftableToken 16 from erc20_limiter.unittest import TestLimiter 17 18 # local imports 19 from erc20_pool.quote import DecimalQuote 20 21 logg = logging.getLogger(__name__) 22 23 class TestDecimalQuote(EthTesterCase): 24 25 def setUp(self): 26 super(TestDecimalQuote, self).setUp() 27 self.conn = RPCConnection.connect(self.chain_spec, 'default') 28 29 nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn) 30 c = DecimalQuote(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) 31 (tx_hash, o) = c.constructor(self.accounts[0]) 32 self.rpc.do(o) 33 o = receipt(tx_hash) 34 r = self.rpc.do(o) 35 self.assertEqual(r['status'], 1) 36 self.quoter_address = to_checksum_address(r['contract_address']) 37 logg.debug('published quoter {}'.format(self.quoter_address))