mirror of
git://holbrook.no/erc20-demurrage-token
synced 2024-11-05 10:06:45 +01:00
Use chain string in sim constructor
This commit is contained in:
parent
4e11f750e8
commit
2f5bb63f9a
@ -2,6 +2,7 @@
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from chainlib.chain import ChainSpec
|
||||
from chainlib.eth.unittest.ethtester import create_tester_signer
|
||||
from chainlib.eth.unittest.base import TestRPCConnection
|
||||
from chainlib.eth.tx import (
|
||||
@ -35,8 +36,8 @@ logg = logging.getLogger(__name__)
|
||||
|
||||
class DemurrageTokenSimulation:
|
||||
|
||||
def __init__(self, chain_spec, settings, redistribute=True, cap=0, actors=1):
|
||||
self.chain_spec = chain_spec
|
||||
def __init__(self, chain_str, settings, redistribute=True, cap=0, actors=1):
|
||||
self.chain_spec = ChainSpec.from_chain_str(chain_str)
|
||||
self.accounts = []
|
||||
self.keystore = DictKeystore()
|
||||
self.signer = EIP155Signer(self.keystore)
|
||||
@ -76,7 +77,7 @@ class DemurrageTokenSimulation:
|
||||
self.start_timestamp = self.last_timestamp
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.rpc)
|
||||
|
||||
c = DemurrageToken(chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
(tx_hash, o) = c.constructor(self.accounts[0], settings, redistribute=redistribute, cap=cap)
|
||||
self.rpc.do(o)
|
||||
o = receipt(tx_hash)
|
||||
|
@ -2,9 +2,6 @@
|
||||
import unittest
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from chainlib.chain import ChainSpec
|
||||
|
||||
# local imports
|
||||
from erc20_demurrage_token import DemurrageTokenSettings
|
||||
from erc20_demurrage_token.sim import DemurrageTokenSimulation
|
||||
@ -16,7 +13,6 @@ logg = logging.getLogger()
|
||||
class TestSim(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.chain_spec = ChainSpec('evm', 'foochain', 42)
|
||||
self.cap = 0
|
||||
settings = DemurrageTokenSettings()
|
||||
settings.name = 'Simulated Demurrage Token'
|
||||
@ -24,7 +20,7 @@ class TestSim(unittest.TestCase):
|
||||
settings.decimals = 6
|
||||
settings.demurrage_level = 5010590837337300000000000000000000 # equals approx 2% per month
|
||||
settings.period_minutes = 10800 # 1 week in minutes
|
||||
self.sim = DemurrageTokenSimulation(self.chain_spec, settings, redistribute=True, cap=self.cap, actors=10)
|
||||
self.sim = DemurrageTokenSimulation('evm:foochain:42', settings, redistribute=True, cap=self.cap, actors=10)
|
||||
|
||||
|
||||
def test_mint(self):
|
||||
|
@ -2,9 +2,6 @@
|
||||
import unittest
|
||||
import logging
|
||||
|
||||
# external imports
|
||||
from chainlib.chain import ChainSpec
|
||||
|
||||
# local imports
|
||||
from erc20_demurrage_token import DemurrageTokenSettings
|
||||
from erc20_demurrage_token.sim import (
|
||||
@ -18,7 +15,6 @@ logg = logging.getLogger()
|
||||
class TestLimit(unittest.TestCase):
|
||||
|
||||
def setUp(self):
|
||||
self.chain_spec = ChainSpec('evm', 'foochain', 42)
|
||||
self.cap = 0
|
||||
settings = DemurrageTokenSettings()
|
||||
settings.name = 'Simulated Demurrage Token'
|
||||
@ -26,7 +22,7 @@ class TestLimit(unittest.TestCase):
|
||||
settings.decimals = 6
|
||||
settings.demurrage_level = 1
|
||||
settings.period_minutes = 1
|
||||
self.sim = DemurrageTokenSimulation(self.chain_spec, settings, redistribute=True, cap=self.cap, actors=1)
|
||||
self.sim = DemurrageTokenSimulation('evm:foochain:42', settings, redistribute=True, cap=self.cap, actors=1)
|
||||
|
||||
|
||||
def test_limit(self):
|
||||
|
Loading…
Reference in New Issue
Block a user