ntls-io / ntc-smart-contract-mvp

Smart Contract development for NTC MVP.
GNU Affero General Public License v3.0
0 stars 0 forks source link

feat: buy function completed #1

Closed Astewart1510 closed 2 years ago

Astewart1510 commented 2 years ago

Completed buy functionality for smart contract.

To test functionality.

  1. 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" \

  2. View the created asset ID. goal app read --global --app-id $APP_ID --guess-format

  3. Optin to the created asset:
    goal asset optin \ --assetid 54 \ -a $ACCOUNT_2 \

  4. 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.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