TYMLEZ Smart Contract Explorer - Vehicle Transfer Flow

This article shows you how to use the TYMLEZ Smart Contract Explorer to run the vehicle transfer flow.

This article is based on the vehicle transfer flow. Instead of using the CLI, you can use the Smart Contract Explorer to run the flow instead. 

You need to log in to the TBSP UI with a user to access all the explorers. 

Log in to the TBSP UI

First, log in via the TBSP UI with a user and the generated password:

Screen Shot 2020-10-14 at 1.03.21 PM

Once logged in, navigate to the smart contract explorer:

Screen Shot 2020-10-19 at 3.11.59 PM

Create an asset with the asset explorer

Before deploying the smart contract, create a digital asset using the Asset Explorer.

In the Asset Explorer, click on the "+" button on the far-right corner:

Screen Shot 2020-10-21 at 1.13.08 PM-1The following pop-up will appear:

In the field Asset Type, select an existing asset type.

For this smart contract, let's create a sample_car type asset.

In this example, let's enter the amount of 1.

Screen Shot 2020-10-23 at 9.47.47 AM

Create the asset.

The asset is displayed in the asset explorer:

Screen Shot 2020-10-06 at 10.42.41 AM

Select the vehicle transfer smart contract

On the sidebar, navigate to "Smart Contract Explorer":

Screen Shot 2020-10-21 at 1.24.35 PM

Here, you will see the different contract templates available.

Select the vehicle transfer flow:

Screen Shot 2020-10-19 at 3.12.11 PM

As outlined in the vehicle transfer smart contract tutorial for the CLI, deploying this specific template will create a digital asset and transfer this asset between different owners with a specific acceptance condition.

Publish and deploy the Smart Contract

The SC_vehicleTransfer contract template contains a number of elements:

  • the contract template you have chosen
  • a short description of the contract template
  • functions, which are execution instructions for the smart contract.

Specifically, these functions are

  • getLastInspectionDate
  • transferVehicle
  • setInspectionDate.

Publish the smart contract

To publish the smart contract, use the init function.

You must provide an argument, which is the inspection date.

This inspection date is the specific acceptance condition. 

To begin, enter the ID of an existing digital asset from above

Screen Shot 2020-10-09 at 11.23.10 AM

Click the Publish button to create a smart contract instance. 

After publishing the smart contract, you can view this specific instance by clicking on Open Instance.

The smart contract ID is then displayed:

Screen Shot 2020-10-09 at 3.11.27 PM

In the contract instance, you can see the state of the smart contract as well as the result of the call.

Alternatively, you can also access the state of the contract, which is stored in the database, by clicking on the Get State button.

Execute smart contract

Execute the smart contract by placing a call.

In the Functions section, navigate to the getInspectionDate tab and click on Call:

Screen Shot 2020-10-09 at 3.20.52 PM

Here, the call returns the message that no inspection date has been set.

Now, in the Functions tab, navigate to the setInspectionDate.

As a next step, let's provide an inspection date falling within the last 12 months, using the format YYYY-MM-DD: 

Screen Shot 2020-10-09 at 3.41.03 PMNow, click on the tab getLastInspectionDate to see the new inspection date:

Screen Shot 2020-10-09 at 3.46.01 PM

Since the inspection date is set, let's transfer the asset.

Navigate to the transferVehicle tab and retrieve the asset ID by clicking GET STATE:

Screen Shot 2020-10-09 at 3.52.32 PM

Now, enter the assets, the public keys of the next owner, as well as the desired amount. 

Click TRANSFER:

Screen Shot 2020-10-09 at 3.54.33 PM

If the transfer is successful, a transaction ID will be shown:

Screen Shot 2020-10-09 at 3.55.18 PM

To see the state of the contract, click the GET STATE button.

In the output, you will see that the contract has finished:

{ 
"assetId": "3845f230d8220dc2b842548b100668c1c994ebc542d37953487944170a1e5ea",
"ownerPubKey": "CNoTeQVazsMP9859xKvKsiFx9a5gMvySajGBYVHkxpgF",
"state": "finished",
"lastInspectionDate": "2020-10-01"
}

Navigation

Return to the main explorers page