github.com/platonnetwork/platon-go@v0.7.6/cases/tests/lib/restricting.py (about) 1 from environment.env import TestEnvironment 2 from environment.node import Node 3 from .economic import Economic 4 5 6 class Restricting: 7 """ 8 Used to initiate a Restricting transaction, 9 if you need to use the call method, please call ppos 10 example: 11 >>>res=Restricting(env, node) 12 >>>res.ppos.getRestrictingInfo(...) 13 """ 14 15 def __init__(self, env: TestEnvironment, node: Node): 16 self.node = node 17 self.economic = Economic(env) 18 19 def createRestrictingPlan(self, account, plan, from_address, transaction_cfg=None): 20 """ 21 Create a lockout plan 22 :param account: Locked account release account 23 :param plan: 24 An is a list of RestrictingPlan types (array), and RestrictingPlan is defined as follows: 25 type RestrictingPlan struct { 26 Epoch uint64 27 Amount *big.Int 28 } 29 where Epoch: represents a multiple of the billing period. 30 The product of the number of blocks per billing cycle indicates that the locked fund 31 s are released at the target block height. Epoch * The number of blocks per cycle is 32 at least greater than the maximum irreversible block height. 33 Amount: indicates the amount to be released on the target block. 34 :param from_address: address for transaction 35 :param transaction_cfg: Transaction basic configuration 36 type: dict 37 example:cfg = { 38 "gas":100000000, 39 "gasPrice":2000000000000, 40 "nonce":1, 41 } 42 :return: if is need analyze return transaction result dict 43 if is not need analyze return transaction hash 44 """ 45 pri_key = self.economic.account.find_pri_key(from_address) 46 return self.ppos.createRestrictingPlan(account, plan, pri_key, transaction_cfg) 47 48 @property 49 def ppos(self): 50 return self.node.ppos