Freeze accounts balances at expiry
This commit is contained in:
22
python/erc20_demurrage_token/expiry.py
Normal file
22
python/erc20_demurrage_token/expiry.py
Normal file
@@ -0,0 +1,22 @@
|
||||
# external imports
|
||||
from chainlib.eth.tx import (
|
||||
TxFactory,
|
||||
TxFormat,
|
||||
)
|
||||
from chainlib.eth.contract import (
|
||||
ABIContractEncoder,
|
||||
ABIContractType,
|
||||
)
|
||||
|
||||
class ExpiryContract(TxFactory):
|
||||
|
||||
def set_expires(self, contract_address, sender_address, expire_timestamp, tx_format=TxFormat.JSONRPC):
|
||||
enc = ABIContractEncoder()
|
||||
enc.method('setExpires')
|
||||
enc.typ(ABIContractType.UINT256)
|
||||
enc.uint256(expire_timestamp)
|
||||
data = enc.get()
|
||||
tx = self.template(sender_address, contract_address, use_nonce=True)
|
||||
tx = self.set_code(tx, data)
|
||||
tx = self.finalize(tx, tx_format)
|
||||
return tx
|
||||
21
python/erc20_demurrage_token/seal.py
Normal file
21
python/erc20_demurrage_token/seal.py
Normal file
@@ -0,0 +1,21 @@
|
||||
# external imports
|
||||
from chainlib.eth.tx import (
|
||||
TxFactory,
|
||||
TxFormat,
|
||||
)
|
||||
from chainlib.eth.contract import (
|
||||
ABIContractEncoder,
|
||||
)
|
||||
|
||||
class SealedContract(TxFactory):
|
||||
|
||||
def set_state(self, contract_address, sender_address, seal, tx_format=TxFormat.JSONRPC):
|
||||
enc = ABIContractEncoder()
|
||||
enc.method('seal')
|
||||
enc.typ(ABIContractType.UINT256)
|
||||
enc.uint256(seal)
|
||||
data = enc.get()
|
||||
tx = self.template(sender_address, contract_address, use_nonce=True)
|
||||
tx = self.set_code(tx, data)
|
||||
tx = self.finalize(tx, tx_format)
|
||||
return tx
|
||||
Reference in New Issue
Block a user