예제 #1
0
txinfo, err = goal.app_create(joe, goal.assemble(fund_previous))
assert not err, err
funder = txinfo['application-index']
assert funder

# Fund the funder
txinfo, err = goal.pay(goal.account, goal.app_address(funder), amt=4_000_000)
assert not err, err

# Construct a group that creates an ASA and an app, then "starts" the
# new app by funding and invoking "start(asset)" on it. Inside the new
# app's start() method, there will be yet another inner transaction:
# it opts into the supplied asset.

goal.autosend = False
create_asa = goal.asset_create(joe,
                               total=10_000,
                               unit_name="oz",
                               asset_name="Gold")
app_teal = """
#pragma version 6
 txn ApplicationID
 bz end
 txn ApplicationArgs 0
 method "start(asset)"
 ==
 bz next0

 itxn_begin

 int axfer
 itxn_field TypeEnum
예제 #2
0
print(f"Joe & Flo: {joe}, {flo}")

txinfo, err = goal.pay(goal.account, joe, amt=50_000_000, send=True)
txinfo, err = goal.pay(goal.account, flo, amt=100_000_000, send=True)

expected_goal_mb = CONSENSUS_MIN_BALANCE + APP_MIN_BALANCE

# starting out, should be at global min
assert_min_balance(goal, flo, CONSENSUS_MIN_BALANCE, expected_goal_mb)

expected_goal_mb += APP_MIN_BALANCE
assert_min_balance(goal, joe, CONSENSUS_MIN_BALANCE, expected_goal_mb)

# flo creates an asset
txinfo, err = goal.asset_create(flo,
                                total=10_000,
                                unit_name="oz",
                                asset_name="Gold",
                                manager=flo,
                                send=True)
assert not err, err
assets = {"Gold": txinfo["asset-index"]}

expected_mb = CONSENSUS_MIN_BALANCE + ASSET_MIN_BALANCE
expected_goal_mb += APP_MIN_BALANCE
assert_min_balance(goal, flo, expected_mb, expected_goal_mb)

# goal creates 2 assets
for total, unit, asset in [(1000, "oz", "Silver"), (100, "oz", "Platinum")]:
    txinfo, err = goal.asset_create(
        goal.account,