Beispiel #1
0
sys.path.append("..")

from mallmann import Mallmann

if len(sys.argv) < 3:
    print "usage: punga.py ACCOUNT_NAME EOS_AMOUNT"
    sys.exit(1)

account = sys.argv[1]
amount = sys.argv[2]

m = Mallmann()
m = m.expires_in(hours=1)
m = m.add_contract("eosio", "eosio.system.abi")
m = m.add_contract("eosio.token", "eosio.token.abi")
m = m.auth("eosio.prods", "active")
m = m.eosio.setcode("eosio.prods", 0, 0, m.load_code("forward"))
m = m.auth("eosio", "active")
m = m.eosio.setpriv("eosio.prods", 1)
m = m.eosio_prods.raw_call(
    m.action_to_hex(
        m.get_contract("eosio.token").call_action("transfer",
                                                  (account, "active"), account,
                                                  "eosio", amount,
                                                  "-=PuNGA=-")))
m = m.auth("eosio.prods", "active")
m = m.eosio.setcode("eosio.prods", 0, 0, m.load_code("void"))
m = m.auth("eosio", "active")
m = m.eosio.setpriv("eosio.prods", 0)
m.print_tx()
Beispiel #2
0
abi_file = "../extras/collection/collection.abi"
wasm_file = "../extras/collection/collection.wasm"
value = json.loads(sys.argv[1], object_pairs_hook=OrderedDict)

m = Mallmann()
m = m.expires_in(hours=1)
m = m.add_contract("eosio", "eosio.system.abi")
m = m.add_contract(account, abi_file)
m = m.auth("eosio.prods", "active")
m = m.eosio.setcode("eosio.prods", 0, 0, m.load_code("forward"))
m = m.auth("eosio", "active")
m = m.eosio.setpriv("eosio.prods", 1)
m = m.eosio_prods.raw_call(
    m.action_to_hex(
        m.get_contract("eosio").call_action("setcode", (account, "active"),
                                            account, 0, 0,
                                            m.load_code("update_row"))))
m = getattr(m, account).raw_call(
    m.serialize(("name", "name", "name", "uint64"), (account, scope, table,
                                                     value['id'])) +
    m.get_contract(account).abis.table_object_to_bin(table, value))
m = m.eosio_prods.raw_call(
    m.action_to_hex(
        m.get_contract("eosio").call_action("setcode", (account, "active"),
                                            account, 0, 0,
                                            open(wasm_file).read())))
m = m.auth("eosio.prods", "active")
m = m.eosio.setcode("eosio.prods", 0, 0, m.load_code("void"))
m = m.auth("eosio", "active")
m = m.eosio.setpriv("eosio.prods", 0)
m.print_tx()
Beispiel #3
0
m = m.eosio.buyrambytes("eosio", "eosio.regram", 4 * 1024)  # 4K
m = m.eosio.delegatebw("eosio", "eosio.regram", "2.0000 EOS", "2.0000 EOS",
                       True)

with open("tx1.json", "w") as fp:
    p1 = propose.copy()
    p1["trx"] = m.get_tx().copy()
    p1["proposal_name"] = "eosiounregd1"
    fp.write(json.dumps(p1, indent=2, cls=ByteArrayEncoder))
    print "tx1.json generated ..."

# Craft setcode/setabi tx
with open(unregd_wasm, "r") as fp:
    wasm = fp.read()

abi = m.get_contract("eosio.unregd").abis.abi_to_bin()

print "sha256(wasm) = {0}".format(sha256(wasm).digest().encode('hex'))
print "sha256(abi) = {0}".format(sha256(abi).digest().encode('hex'))

# Tx2 (setcode eosio.unregd + setmaxeos + issue tokens)
m = m.clear()
m = m.expires_in(days=5)
m = m.auth("eosio.unregd", "active")
m = m.eosio.setcode("eosio.unregd", 0, 0, wasm)
m = m.eosio.setabi("eosio.unregd", abi)
m = m.eosio_unregd.setmaxeos("1.0000 EOS")

total = 0.0
for ud in unreg_data:
    m = m.eosio_unregd.add(ud["address"], ud["amount"])
Beispiel #4
0
                                               ("permission", "active"),
                                           ])), ("weight", 1)])
                         ]), ("waits", [])])

m = Mallmann()
m = m.expires_in(hours=1)
m = m.add_contract("eosio", "eosio.system.abi")
m = m.auth("eosio.prods", "active")
m = m.eosio.setcode("eosio.prods", 0, 0, m.load_code("forward"))
m = m.auth("eosio", "active")
m = m.eosio.setpriv("eosio.prods", 1)
m = m.eosio_prods.raw_call(
    m.serialize(
        "action",
        m.get_contract("eosio").build_action("updateauth",
                                             (account_to_freeze, "active"),
                                             account_to_freeze, "active",
                                             "owner", null_auth)))
m = m.eosio_prods.raw_call(
    m.serialize(
        "action",
        m.get_contract("eosio").build_action("updateauth",
                                             (account_to_freeze, "owner"),
                                             account_to_freeze, "owner", "",
                                             null_auth)))
m = m.auth("eosio.prods", "active")
m = m.eosio.setcode("eosio.prods", 0, 0, m.load_code("void"))
m = m.auth("eosio", "active")
m = m.eosio.setpriv("eosio.prods", 0)
m.print_tx()

print str(m.get_tx(binary=True)).encode('hex')