def pre_action(): newdomain = AG.new_action('newdomain', name=domain_name, creator=user.pub_key) issuetoken = AG.new_action( 'issuetoken', domain=domain_name, names=[token1_name, token2_name, token3_name], owner=[base.Address().set_public_key(user.pub_key)]) destroytoken = AG.new_action('destroytoken', domain=domain_name, name=token2_name) pass_link = evt_link.EvtLink() pass_link.set_header(evt_link.HeaderType.version1.value | evt_link.HeaderType.everiPass.value | evt_link.HeaderType.destroy.value) pass_link.set_domain(domain_name) pass_link.set_token(token3_name) pass_link.set_timestamp(int(time.time())) pass_link.sign(user.priv_key) everipass = AG.new_action('everipass', link=pass_link.to_string()) group_json = json.loads(group_json_raw) group_json['name'] = group_name group_json['group']['name'] = group_name group_json['group']['key'] = str(user.pub_key) newgroup = AG.new_action_from_json('newgroup', json.dumps(group_json)) symbol = base.Symbol(sym_name=sym_name, sym_id=sym_id, precision=sym_prec) asset = base.new_asset(symbol) newfungible = AG.new_action('newfungible', name=sym_name, sym_name=sym_name, sym=symbol, creator=user.pub_key, total_supply=asset(10000000)) issuefungible1 = AG.new_action('issuefungible', address=base.Address().set_public_key( user.pub_key), number=asset(100), memo='goodluck') issuefungible2 = AG.new_action('issuefungible', address=base.Address().set_public_key( user.pub_key), number=base.EvtAsset(1000), memo='goodluck') e2p = AG.new_action('evt2pevt', _from=base.Address().set_public_key(user.pub_key), to=base.Address().set_public_key(user.pub_key), number=base.EvtAsset(100), memo='goodluck') pay_link = evt_link.EvtLink() pay_link.set_timestamp(int(time.time())) pay_link.set_max_pay(999999999) pay_link.set_header(evt_link.HeaderType.version1.value | evt_link.HeaderType.everiPay.value) pay_link.set_symbol_id(sym_id) pay_link.set_link_id_rand() pay_link.sign(user.priv_key) everipay = AG.new_action('everipay', payee=pub2, number=asset(1), link=pay_link.to_string()) trx = TG.new_trx() trx.add_action(issuefungible2) trx.add_sign(priv_evt) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(newdomain) trx.add_sign(user.priv_key) trx.add_action(newgroup) trx.add_action(newfungible) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(issuetoken) trx.add_action(issuefungible1) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) # trx = TG.new_trx() # trx.add_action(issuefungible2) # trx.add_sign(priv_evt) # trx.set_payer(user.pub_key.to_string()) # resp = api.push_transaction(trx.dumps()) # print(resp.content) trx = TG.new_trx() trx.add_action(e2p) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(destroytoken) trx.add_action(everipass) trx.add_action(everipay) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) time.sleep(2)
def pre_action(): prodvote = AG.new_action('prodvote', producer='evt', key="action-everipay", value=2) newdomain = AG.new_action('newdomain', name=domain_name, creator=user.pub_key) auth_A = base.AuthorizerWeight(base.AuthorizerRef('A', evt_pub), 1) updatedomain = AG.new_action('updatedomain', name=domain_name, manage=base.PermissionDef( 'manage', 1, [auth_A])) issuetoken = AG.new_action( 'issuetoken', domain=domain_name, names=[token1_name, token2_name, token3_name], owner=[base.Address().set_public_key(user.pub_key)]) destroytoken = AG.new_action('destroytoken', domain=domain_name, name=token2_name) pass_link = evt_link.EvtLink() pass_link.set_header(evt_link.HeaderType.version1.value | evt_link.HeaderType.everiPass.value | evt_link.HeaderType.destroy.value) pass_link.set_domain(domain_name) pass_link.set_token(token3_name) pass_link.set_timestamp(int(time.time())) pass_link.sign(user.priv_key) everipass = AG.new_action('everipass', link=pass_link.to_string()) group_json = json.loads(group_json_raw) group_json['name'] = group_name group_json['group']['name'] = group_name group_json['group']['key'] = str(user.pub_key) newgroup = AG.new_action_from_json('newgroup', json.dumps(group_json)) group_json['group']['root']['threshold'] = 5 updategroup = AG.new_action_from_json('updategroup', json.dumps(group_json)) symbol = base.Symbol(sym_name=sym_name, sym_id=sym_id, precision=sym_prec) asset = base.new_asset(symbol) newfungible = AG.new_action('newfungible', name=sym_name, sym_name=sym_name, sym=symbol, creator=user.pub_key, total_supply=asset(10000000)) issuefungible1 = AG.new_action('issuefungible', address=base.Address().set_public_key( user.pub_key), number=asset(100), memo='goodluck') issuefungible2 = AG.new_action('issuefungible', address=base.Address().set_public_key( user.pub_key), number=base.EvtAsset(1000), memo='goodluck') e2p = AG.new_action('evt2pevt', _from=base.Address().set_public_key(user.pub_key), to=base.Address().set_public_key(user.pub_key), number=base.EvtAsset(100), memo='goodluck') pay_link = evt_link.EvtLink() pay_link.set_timestamp(int(time.time())) pay_link.set_max_pay(999999999) pay_link.set_header(evt_link.HeaderType.version1.value | evt_link.HeaderType.everiPay.value) pay_link.set_symbol_id(sym_id) pay_link.set_link_id_rand() pay_link.sign(user.priv_key) everipay = AG.new_action('everipay', payee=pub2, number=asset(1), link=pay_link.to_string()) bonus_json = json.loads(bonus_json_raw) setpsvbonus = AG.new_action_from_json('setpsvbonus', json.dumps(bonus_json)) addmeta = AG.new_action('addmeta', meta_key='sdf', meta_value='sdfsadf', creator=base.AuthorizerRef('A', user.pub_key), domain=domain_name, key=token1_name) trx = TG.new_trx() trx.add_action(issuefungible2) trx.add_sign(priv_evt) trx.add_sign(user.priv_key) newsuspend = AG.new_action('newsuspend', name='suspend', proposer=user.pub_key, trx=trx) newsuspend2 = AG.new_action('newsuspend', name='suspend2', proposer=user.pub_key, trx=trx) cancelsuspend = AG.new_action('cancelsuspend', name='suspend2') aprvsuspend = AG.new_action('aprvsuspend', name='suspend', signatures=json.loads( trx.dumps())['signatures']) execsuspend = AG.new_action('execsuspend', name='suspend', executor=user.pub_key) lock_json = json.loads(lock_json_raw) lock_json['proposer'] = str(user.pub_key) lock_json['assets'][0]['data']['from'] = str(user.pub_key) lock_json['condition']['data']['cond_keys'] = [str(user.pub_key)] lock_json['succeed'] = [str(user.pub_key)] lock_json['failed'] = [str(user.pub_key)] newlock = AG.new_action_from_json('newlock', json.dumps(lock_json)) trx = TG.new_trx() trx.add_action(issuefungible2) trx.add_sign(priv_evt) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() # trx.add_action(prodvote) trx.add_action(newdomain) trx.add_action(newsuspend) trx.add_action(newsuspend2) trx.add_action(newgroup) trx.add_action(newfungible) trx.add_sign(user.priv_key) trx.add_sign(priv_evt) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(updatedomain) trx.add_action(cancelsuspend) trx.add_action(aprvsuspend) trx.add_action(updategroup) trx.add_action(issuetoken) trx.add_action(issuefungible1) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(e2p) trx.add_action(addmeta) trx.add_action(execsuspend) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(setpsvbonus) trx.add_sign(priv_evt) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(destroytoken) trx.add_action(everipass) trx.add_action(everipay) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) trx = TG.new_trx() trx.add_action(newlock) trx.add_sign(user.priv_key) trx.set_payer(user.pub_key.to_string()) resp = api.push_transaction(trx.dumps()) print(resp) time.sleep(2)