Exemplo n.º 1
0
    amount = "%.4f EOS" % (1.0 + random() * 50.0)
    return {"address": addy, "privkey": priv, "amount": amount}


unreg_data = []
if not os.path.isfile("unreg_data.json"):
    for i in xrange(20):
        unreg_data.append(gen_random_unreg_data())

    with open("unreg_data.json", "w") as fp:
        fp.write(json.dumps(unreg_data, indent=2, cls=ByteArrayEncoder))
else:
    with open("unreg_data.json", "r") as fp:
        unreg_data = json.loads(fp.read())

m = Mallmann()
m = m.add_contract("eosio", "eosio.system.abi")
m = m.add_contract("eosio.token", "eosio.token.abi")
m = m.add_contract("eosio.unregd", unregd_abi)

# Tx1 (eosio.unregd/eosio.regram creation)
m = m.expires_in(days=5)
m = m.auth("eosio", "active")
m = m.eosio.newaccount("eosio", "eosio.unregd", eosio_active, eosio_active)
m = m.eosio.buyrambytes("eosio", "eosio.unregd", 1200 * 1024)  # 1.2M
m = m.eosio.delegatebw("eosio", "eosio.unregd", "2.0000 EOS", "2.0000 EOS",
                       True)
m = m.eosio.newaccount("eosio", "eosio.regram", eosio_active, eosio_active)
m = m.eosio.buyrambytes("eosio", "eosio.regram", 4 * 1024)  # 4K
m = m.eosio.delegatebw("eosio", "eosio.regram", "2.0000 EOS", "2.0000 EOS",
                       True)
Exemplo n.º 2
0
#!/usr/bin/env python
import sys
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)
Exemplo n.º 3
0
sys.path.append("..")
from mallmann import Mallmann

if len(sys.argv) < 2:
    print "usage: fix_record.py JSON_VALUE"
    sys.exit(1)

account = "collection"
scope = "collection"
table = "data"
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'])) +
Exemplo n.º 4
0
#!/usr/bin/env python
import sys
sys.path.append("..")

from mallmann import Mallmann

if len(sys.argv) < 2:
  print "usage: unlimited.py ACCOUNT_NAME"
  sys.exit(1)

account_to_unlimit = sys.argv[1]

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("set_resource_limits"))
m = m.auth("eosio","active")
m = m.eosio.setpriv("eosio.prods", 1)
m = m.eosio_prods.raw_call(
  m.serialize(("name","int64","int64","int64"),(account_to_unlimit,-1,-1,-1))
)
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()
Exemplo n.º 5
0
if len(sys.argv) < 2:
    print "usage: freeze_account.py ACCOUNT_NAME"
    sys.exit(1)

account_to_freeze = sys.argv[1]

null_auth = OrderedDict([("threshold", 1), ("keys", []),
                         ("accounts", [
                             OrderedDict([("permission",
                                           OrderedDict([
                                               ("actor", "eosio.null"),
                                               ("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(
Exemplo n.º 6
0
                                table="producers",
                                key_type="float64",
                                index_position="2",
                                limit=30,
                                json=True)["rows"]:
    propose["requested"].append({"actor": r["owner"], "permission": "active"})

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

abi = abi_new.abi_to_bin()

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

m = Mallmann()
m = m.expires_in(days=5)
m = m.add_contract("eosio", "eosio.system.abi")
m = m.auth("eosio", "active")
m = m.eosio.setcode("eosio", 0, 0, wasm)
m = m.eosio.setabi("eosio", abi)

# Generate proposal
propose["trx"] = m.get_tx()

with open("propose.json", "w") as fp:
    fp.write(json.dumps(propose, indent=2, cls=ByteArrayEncoder))
    print "propose.json generated ..."

print "done"
Exemplo n.º 7
0
account_to_freeze = sys.argv[1]

null_auth = OrderedDict([ 
  ("threshold" , 1),
  ("keys"      , []),
  ("accounts"  , [OrderedDict([
    ("permission" , OrderedDict([
      ("actor"     , "eosio.null"),
      ("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.action_to_hex(m.get_contract("eosio").call_action(
    "updateauth", (account_to_freeze,"active"),
    account_to_freeze, "active", "owner", null_auth
  ))
)
m = m.eosio_prods.raw_call(
  m.action_to_hex(m.get_contract("eosio").call_action(
    "updateauth", (account_to_freeze,"owner"),