This repository has been archived on 2023-03-01. You can view files and clone it, but cannot push or open issues or pull requests.
erc20-demurrage-token-archive/python/tests/sim/tests_sim.py

46 lines
1.2 KiB
Python
Raw Normal View History

2021-06-05 17:59:34 +02:00
# standard imports
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
2021-06-05 19:19:17 +02:00
logging.basicConfig(level=logging.DEBUG)
2021-06-05 17:59:34 +02:00
logg = logging.getLogger()
class TestSim(unittest.TestCase):
def setUp(self):
self.chain_spec = ChainSpec('evm', 'foochain', 42)
2021-06-05 19:19:17 +02:00
#self.cap = 1000000000
self.cap = 0
2021-06-05 17:59:34 +02:00
settings = DemurrageTokenSettings()
settings.name = 'Simulated Demurrage Token'
settings.symbol = 'SIM'
settings.decimals = 6
settings.demurrage_level = 50
settings.period_minutes = 10800
2021-06-05 19:19:17 +02:00
self.sim = DemurrageTokenSimulation(self.chain_spec, settings, redistribute=True, cap=self.cap, actors=10)
2021-06-05 17:59:34 +02:00
2021-06-05 19:19:17 +02:00
def test_mint(self):
self.sim.mint(self.sim.actors[0], 1024)
self.sim.next()
balance = self.sim.balance(self.sim.actors[0])
self.assertEqual(balance, 1024)
def test_transfer(self):
self.sim.mint(self.sim.actors[0], 1024)
self.sim.transfer(self.sim.actors[0], self.sim.actors[1], 500)
self.sim.next()
2021-06-05 17:59:34 +02:00
if __name__ == '__main__':
unittest.main()