Example #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
Example #2
0
  itxn_field ApplicationID
 itxn_submit


 end:
  int 1
"""

app3 = """
#pragma version 6
pushbytes "success"
log
int 1
"""

goal.autosend = True

# app1 creation
txinfo1, err = goal.app_create(joe, goal.assemble(app1))
assert not err, err
app1ID = txinfo1['application-index']
assert app1ID

# insert clear state program with inner app call
txinfo2, err = goal.app_create(joe, goal.assemble(app2), goal.assemble(app2))
assert not err, err
app2ID = txinfo2['application-index']
assert app2ID

# dummy destination app
txinfo3, err = goal.app_create(joe, goal.assemble(app3))