Apply redistribution correction from singlecap to singlenocap contract

This commit is contained in:
lash
2022-02-28 10:42:30 +00:00
parent a04c826ba7
commit 6dc843fb5d
12 changed files with 39 additions and 13 deletions

View File

@@ -1,4 +1,7 @@
- 0.0.2-pending
- 0.0.9
* Fix wrong redistribution calculation in single nocap
[...]
- 0.0.2
* Move to chainlib-eth
- 0.0.1-unreleased
* Interface for redistributed and non-redistributed, with or without cap

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@@ -1,3 +1,3 @@
chainlib-eth~=0.0.15
eth-erc20~=0.1.5
funga-eth~=0.5.1
chainlib-eth~=0.0.27
eth-erc20~=0.1.10
funga-eth~=0.5.6

View File

@@ -1,6 +1,6 @@
[metadata]
name = erc20-demurrage-token
version = 0.0.8
version = 0.0.9
description = ERC20 token with redistributed continual demurrage
author = Louis Holbrook
author_email = dev@holbrook.no

View File

@@ -107,10 +107,11 @@ class TestBasic(TestDemurrageDefault):
r = self.rpc.do(o)
demurrage_amount = c.parse_demurrage_amount(r)
modifier_base = ((1000000 - self.tax_level) / 1000000) ** 10
logg.warning('mod base {}'.format(modifier_base))
modifier = int(modifier_base * (10 ** 12))
rounding_tolerance_nano = 4000000 # 0.000004% precision
demurrage_amount_truncate = int(demurrage_amount / (10 ** 26)) # equals 12 decimal places
demurrage_amount_truncate = int(demurrage_amount / (10 ** 16)) # equals 38 decimal places - 14 for the modifier magniture - 2 for percent int calc + 6 for token decimals (originally equalled 12 decimal places)
self.assertGreaterEqual(modifier, demurrage_amount_truncate - rounding_tolerance_nano)
self.assertLessEqual(modifier, demurrage_amount_truncate)