mirror of
git://holbrook.no/erc20-demurrage-token
synced 2026-04-26 18:17:14 +02:00
Create demurrage calc from contract
This commit is contained in:
@@ -2,7 +2,11 @@
|
||||
import datetime
|
||||
import unittest
|
||||
|
||||
# external imports
|
||||
from chainlib.eth.nonce import RPCNonceOracle
|
||||
|
||||
# local imports
|
||||
from erc20_demurrage_token import DemurrageToken
|
||||
from erc20_demurrage_token.demurrage import DemurrageCalculator
|
||||
|
||||
# test imports
|
||||
@@ -19,5 +23,13 @@ class TestEmulate(TestDemurrage):
|
||||
self.assert_within_lower(a, 99.69667, 0.1)
|
||||
|
||||
|
||||
def test_from_contract(self):
|
||||
nonce_oracle = RPCNonceOracle(self.accounts[0], self.rpc)
|
||||
c = DemurrageToken(self.chain_spec, signer=self.signer, nonce_oracle=nonce_oracle)
|
||||
self.deploy(c, 'SingleNocap')
|
||||
dc = DemurrageCalculator.from_contract(self.rpc, self.chain_spec, self.address, sender_address=self.accounts[0])
|
||||
self.assertEqual(dc.r_min, 0.02)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user