Add sink address in token sum to total supply

This commit is contained in:
nolash 2021-06-07 09:28:08 +02:00
parent 62d8820936
commit fb8d1e548c
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
3 changed files with 18 additions and 5 deletions

File diff suppressed because one or more lines are too long

View File

@ -148,16 +148,26 @@ class DemurrageTokenSimulation:
def get_period(self):
return self.period
def get_demurrage(self):
o = self.caller_contract.demurrage_amount(self.address, sender_address=self.caller_address)
r = self.rpc.do(o)
return float(self.caller_contract.parse_demurrage_amount(r) / (10 ** 38))
def get_supply(self):
o = self.caller_contract.total_supply(self.address, sender_address=self.caller_address)
r = self.rpc.do(o)
supply = self.caller_contract.parse_total_supply(r)
return supply
def from_units(self, v):
return v * (10 ** self.decimals)
def mint(self, recipient, value):
self.__check_limit()
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.rpc)

View File

@ -19,6 +19,7 @@ settings.demurrage_level = int(decay_per_minute*(10**38))
settings.period_minutes = 1 # 1 week in minutes
chain = 'evm:foochain:42'
cap = (10 ** 6) * (10 ** 12)
#cap = 0
# instantiate simulation
sim = DemurrageTokenSimulation(chain, settings, redistribute=False, cap=cap, actors=10)
@ -62,9 +63,9 @@ demurrage_delta = contract_demurrage - frontend_demurrage # difference betw
alice_checksum = 50000000 - (50000000 * frontend_demurrage) + (200000000 * frontend_demurrage) # alice's balance calculated with frontend demurrage
print("""alice frontend balance {}
alice contract balance {}
frontend demurrage {:f}
contract demurrage {:f}
demurrage delta {}""".format(
frontend demurrage {:.38f}
contract demurrage {:.38f}
demurrage delta {:.38f}""".format(
alice_checksum,
sim.balance(alice),
frontend_demurrage,
@ -72,5 +73,7 @@ demurrage delta {}""".format(
demurrage_delta),
)
balance_sum = sim.balance(alice) + sim.balance(bob) + sim.balance(carol)
balance_sum = sim.balance(alice) + sim.balance(bob) + sim.balance(carol) + sim.balance(sim.sink_address)
supply = sim.get_supply()
print('sum of contract demurraged balances {}'.format(balance_sum))
print('total token supply {}'.format(supply))