mirror of
git://holbrook.no/erc20-demurrage-token
synced 2024-11-22 08:16:47 +01:00
Add sink address in token sum to total supply
This commit is contained in:
parent
62d8820936
commit
fb8d1e548c
File diff suppressed because one or more lines are too long
@ -148,16 +148,26 @@ class DemurrageTokenSimulation:
|
|||||||
def get_period(self):
|
def get_period(self):
|
||||||
return self.period
|
return self.period
|
||||||
|
|
||||||
|
|
||||||
def get_demurrage(self):
|
def get_demurrage(self):
|
||||||
o = self.caller_contract.demurrage_amount(self.address, sender_address=self.caller_address)
|
o = self.caller_contract.demurrage_amount(self.address, sender_address=self.caller_address)
|
||||||
r = self.rpc.do(o)
|
r = self.rpc.do(o)
|
||||||
return float(self.caller_contract.parse_demurrage_amount(r) / (10 ** 38))
|
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):
|
def from_units(self, v):
|
||||||
return v * (10 ** self.decimals)
|
return v * (10 ** self.decimals)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
def mint(self, recipient, value):
|
def mint(self, recipient, value):
|
||||||
self.__check_limit()
|
self.__check_limit()
|
||||||
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.rpc)
|
nonce_oracle = RPCNonceOracle(self.accounts[0], conn=self.rpc)
|
||||||
|
@ -19,6 +19,7 @@ settings.demurrage_level = int(decay_per_minute*(10**38))
|
|||||||
settings.period_minutes = 1 # 1 week in minutes
|
settings.period_minutes = 1 # 1 week in minutes
|
||||||
chain = 'evm:foochain:42'
|
chain = 'evm:foochain:42'
|
||||||
cap = (10 ** 6) * (10 ** 12)
|
cap = (10 ** 6) * (10 ** 12)
|
||||||
|
#cap = 0
|
||||||
|
|
||||||
# instantiate simulation
|
# instantiate simulation
|
||||||
sim = DemurrageTokenSimulation(chain, settings, redistribute=False, cap=cap, actors=10)
|
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
|
alice_checksum = 50000000 - (50000000 * frontend_demurrage) + (200000000 * frontend_demurrage) # alice's balance calculated with frontend demurrage
|
||||||
print("""alice frontend balance {}
|
print("""alice frontend balance {}
|
||||||
alice contract balance {}
|
alice contract balance {}
|
||||||
frontend demurrage {:f}
|
frontend demurrage {:.38f}
|
||||||
contract demurrage {:f}
|
contract demurrage {:.38f}
|
||||||
demurrage delta {}""".format(
|
demurrage delta {:.38f}""".format(
|
||||||
alice_checksum,
|
alice_checksum,
|
||||||
sim.balance(alice),
|
sim.balance(alice),
|
||||||
frontend_demurrage,
|
frontend_demurrage,
|
||||||
@ -72,5 +73,7 @@ demurrage delta {}""".format(
|
|||||||
demurrage_delta),
|
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('sum of contract demurraged balances {}'.format(balance_sum))
|
||||||
|
print('total token supply {}'.format(supply))
|
||||||
|
Loading…
Reference in New Issue
Block a user