mirror of
https://github.com/chaintool-py/eth-erc20.git
synced 2024-11-27 04:06:47 +01:00
Factor out token publish in giftable token unittest fixture
This commit is contained in:
parent
2fb7143956
commit
637080c464
@ -1,3 +1,5 @@
|
|||||||
|
* 0.7.5
|
||||||
|
- Factor out token publish method in unittest fixture
|
||||||
* 0.7.4
|
* 0.7.4
|
||||||
- Add missing unittest module to python package
|
- Add missing unittest module to python package
|
||||||
* 0.7.3
|
* 0.7.3
|
||||||
|
@ -22,19 +22,11 @@ class TestGiftableToken(EthTesterCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
super(TestGiftableToken, self).setUp()
|
super(TestGiftableToken, self).setUp()
|
||||||
self.conn = RPCConnection.connect(self.chain_spec, 'default')
|
self.conn = RPCConnection.connect(self.chain_spec, 'default')
|
||||||
|
|
||||||
|
address = self.publish_giftable_token('Foo Token', 'FOO', 16, expire=self.expire)
|
||||||
|
self.address = to_checksum_address(address)
|
||||||
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
|
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
|
||||||
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||||
self.symbol = 'FOO'
|
|
||||||
self.name = 'Foo Token'
|
|
||||||
self.decimals = 16
|
|
||||||
(tx_hash, o) = c.constructor(self.accounts[0], self.name, self.symbol, self.decimals, expire=self.expire)
|
|
||||||
self.rpc.do(o)
|
|
||||||
o = receipt(tx_hash)
|
|
||||||
r = self.rpc.do(o)
|
|
||||||
self.assertEqual(r['status'], 1)
|
|
||||||
self.address = to_checksum_address(r['contract_address'])
|
|
||||||
logg.debug('published on address {} with hash {}'.format(self.address, tx_hash))
|
|
||||||
|
|
||||||
self.initial_supply = 1 << 40
|
self.initial_supply = 1 << 40
|
||||||
(tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[0], self.initial_supply)
|
(tx_hash, o) = c.mint_to(self.address, self.accounts[0], self.accounts[0], self.initial_supply)
|
||||||
r = self.conn.do(o)
|
r = self.conn.do(o)
|
||||||
@ -43,6 +35,22 @@ class TestGiftableToken(EthTesterCase):
|
|||||||
self.assertEqual(r['status'], 1)
|
self.assertEqual(r['status'], 1)
|
||||||
|
|
||||||
|
|
||||||
|
def publish_giftable_token(self, name, symbol, decimals=16, expire=None):
|
||||||
|
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.conn)
|
||||||
|
c = GiftableToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||||
|
self.symbol = name
|
||||||
|
self.name = symbol
|
||||||
|
self.decimals = decimals
|
||||||
|
(tx_hash, o) = c.constructor(self.accounts[0], self.name, self.symbol, self.decimals, expire=expire)
|
||||||
|
self.rpc.do(o)
|
||||||
|
o = receipt(tx_hash)
|
||||||
|
r = self.rpc.do(o)
|
||||||
|
self.assertEqual(r['status'], 1)
|
||||||
|
address = r['contract_address']
|
||||||
|
logg.debug('published on address {} with hash {}'.format(address, tx_hash))
|
||||||
|
return address
|
||||||
|
|
||||||
|
|
||||||
class TestGiftableExpireToken(TestGiftableToken):
|
class TestGiftableExpireToken(TestGiftableToken):
|
||||||
|
|
||||||
expire = int(time.time()) + 100000
|
expire = int(time.time()) + 100000
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
[metadata]
|
[metadata]
|
||||||
name = eth-erc20
|
name = eth-erc20
|
||||||
version = 0.7.4
|
version = 0.7.5
|
||||||
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
description = ERC20 interface and simple contract with deployment script that lets any address mint and gift itself tokens.
|
||||||
author = Louis Holbrook
|
author = Louis Holbrook
|
||||||
author_email = dev@holbrook.no
|
author_email = dev@holbrook.no
|
||||||
|
Loading…
Reference in New Issue
Block a user