Run the Create DRT function using the following "goal" call from the command line:
goal app call \ --app-id $APP_ID \ -f $ACCOUNT_1 \ --app-arg "str:create_drt" \ --app-arg "str:ALEX_DRT_01" \ --app-arg "int:10000" \ --app-arg "str:note" \ --app-arg "int:5" \
View the created asset ID.
goal app read --global --app-id $APP_ID --guess-format
Optin to the created asset: goal asset optin \ --assetid 54 \ -a $ACCOUNT_2 \
Create the following "buy" group transaction:
Transaction 1
goal app call \ --app-id $APP_ID \ -f $ACCOUNT_2 \ --app-arg "str:buy_drt" \ --app-arg "int:1" \ --foreign-asset 54 \ --out txnAppCall.tx
Transaction 2
goal clerk send \ -a 5 \ -t "$ACCOUNT_APP" \ -f "$ACCOUNT_2" \ --out txnPayment.tx
Join into a single group transaction
cat txnAppCall.tx txnPayment.tx > buyCombinedTxns.txgoal clerk group -i buyCombinedTxns.tx -o buyGroupedTxns.txgoal clerk sign -i buyGroupedTxns.tx -o signoutbuy.txgoal clerk rawsend -f signoutbuy.tx
Completed buy functionality for smart contract.
To test functionality.
Run the Create DRT function using the following "goal" call from the command line:
goal app call \ --app-id $APP_ID \ -f $ACCOUNT_1 \ --app-arg "str:create_drt" \ --app-arg "str:ALEX_DRT_01" \ --app-arg "int:10000" \ --app-arg "str:note" \ --app-arg "int:5" \
View the created asset ID.
goal app read --global --app-id $APP_ID --guess-format
Optin to the created asset:
goal asset optin \ --assetid 54 \ -a $ACCOUNT_2 \
Create the following "buy" group transaction: Transaction 1
goal app call \ --app-id $APP_ID \ -f $ACCOUNT_2 \ --app-arg "str:buy_drt" \ --app-arg "int:1" \ --foreign-asset 54 \ --out txnAppCall.tx
Transaction 2goal clerk send \ -a 5 \ -t "$ACCOUNT_APP" \ -f "$ACCOUNT_2" \ --out txnPayment.tx
Join into a single group transactioncat txnAppCall.tx txnPayment.tx > buyCombinedTxns.tx
goal clerk group -i buyCombinedTxns.tx -o buyGroupedTxns.tx
goal clerk sign -i buyGroupedTxns.tx -o signoutbuy.tx
goal clerk rawsend -f signoutbuy.tx