Remove growby method

This commit is contained in:
lash 2023-02-08 06:03:56 +00:00
parent 9d7b87be9c
commit 00f4ddba68
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
2 changed files with 24 additions and 20 deletions

View File

@ -28,23 +28,23 @@ testdir = os.path.dirname(__file__)
class TestGrowth(TestDemurrageDefault): class TestGrowth(TestDemurrageDefault):
def test_grow_by(self): # def test_grow_by(self):
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc) # nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle) # c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
#
growth_factor = (1000000 + self.tax_level) / 1000000 # growth_factor = (1000000 + self.tax_level) / 1000000
v = 1000000000 # v = 1000000000
o = c.grow_by(self.address, v, 1, sender_address=self.accounts[0]) # o = c.grow_by(self.address, v, 1, sender_address=self.accounts[0])
r = self.rpc.do(o) # r = self.rpc.do(o)
g = c.parse_grow_by(r) # g = c.parse_grow_by(r)
self.assertEqual(int(v * growth_factor), g) # self.assertEqual(int(v * growth_factor), g)
#
period = 10 # period = 10
growth_factor = (1 + (self.tax_level) / 1000000) ** period # growth_factor = (1 + (self.tax_level) / 1000000) ** period
o = c.grow_by(self.address, v, period, sender_address=self.accounts[0]) # o = c.grow_by(self.address, v, period, sender_address=self.accounts[0])
r = self.rpc.do(o) # r = self.rpc.do(o)
g = c.parse_grow_by(r) # g = c.parse_grow_by(r)
self.assertEqual(int(v * growth_factor), g) # self.assertEqual(int(v * growth_factor), g)
def test_decay_by(self): def test_decay_by(self):
@ -63,7 +63,7 @@ class TestGrowth(TestDemurrageDefault):
o = c.decay_by(self.address, v, period, sender_address=self.accounts[0]) o = c.decay_by(self.address, v, period, sender_address=self.accounts[0])
r = self.rpc.do(o) r = self.rpc.do(o)
g = c.parse_decay_by(r) g = c.parse_decay_by(r)
self.assertEqual(int(v * growth_factor), g) self.assertEqual(int(v * growth_factor), g)
if __name__ == '__main__': if __name__ == '__main__':

View File

@ -32,11 +32,15 @@ test: all
python ../python/tests/test_redistribution.py python ../python/tests/test_redistribution.py
python ../python/tests/test_pure.py python ../python/tests/test_pure.py
install: all #install: all
install: single_nocap
#cp -v DemurrageToken*.{json,bin} ../python/erc20_demurrage_token/data/ #cp -v DemurrageToken*.{json,bin} ../python/erc20_demurrage_token/data/
cp -v DemurrageTokenSingleNocap.{json,bin} ../python/erc20_demurrage_token/data/ cp -v DemurrageTokenSingleNocap.json ../python/erc20_demurrage_token/data/
cp -v DemurrageTokenSingleNocap.bin ../python/erc20_demurrage_token/data/
install-broken: all install-broken: all
cp -v DemurrageToken*.{json,bin} ../python/erc20_demurrage_token/data/ cp -v DemurrageToken*.{json,bin} ../python/erc20_demurrage_token/data/
.PHONY: test install .PHONY: test install