Walkthrough

Introduction

The Escrow Demo website allows to have a quick overview of what enables the Smartlink Escrow Demo smart-contract through an easy to use and accessible to everyone interface.

Originate

  • Url: /originate

  • Alias: /

The originate page allows a user to originate a copy of the SmartLink Escrow Demo smart contract or to use an already existing one. The origination is made thanks to the Temple Wallet on the Edo2 testnet network.

User interaction
Smart contract interaction
User interaction

The user can originate a copy of the Escrow demo smart contract or enter the address of an already existing one.

Originate a copy of the smart contract

After selecting Originate, the user has to connect his Temple wallet.

Once the contract is originated, the contract address is displayed on the screen and the user can select "Go to Smartlink" to access the demo. He will be redirected to /marketplace.The contract address is stored in the localstorage of the browser.

Run an existing contract

The user can paste the address of an existing Smartlink demo escrow contract.

If the contract exists, the user will be redirected to /marketplace. The contract address is stored in the localstorage of the browser.

Smart contract interaction

Read operations

Retrieves the slashing rate in the smart contract storage in order to save it in the browser local storage.

Entry point calls

There is no entry point interactions.

Offers

  • Url: /offers

The offers page represents the peer-to-peer offers a user received. At this point, none of these offers information are stored in exchanges map of the smart contract. All offers are composed by a product to sell, a seller address, and a price in Tezos.

User interaction
Smart contract interaction
User interaction

The user can view an offer or delete it.

If the user selects view an offer, he is redirected to /offer/{id}

Smart contract interaction

Read operations

Retrieves the commission percentage from the exchange_types map in order to compute the displayed fees amount.

Entry point calls

There is no entry point interactions.

Marketplace

  • Url: /marketplace

The marketplace allows a user to buy a listed item. At this point, none of the marketplace items information are stored in exchanges map of the smart contract.

User interaction
Smart contract interaction
User interaction

The user can buy an item.

If the user selects buy, he is redirected to /buy/{id}

Smart contract interaction

Read operations

Retrieves the commission percentage from the exchange_types map in order to compute the displayed fees amount.

Entry point calls

There is no entry point interactions.

Orders

  • Url: /orders

The tracking pages allows the user to track his accepted offers and purchased items. The information about the items is retrieved from the exchanges map of the smart contract. An order can have three states:

  • Shipped: the user is waiting for the item to arrive

  • Delivered: the item was transferred to the user, the order is awaiting validation

  • Finished: the offer was validated, the exchange has successfully ended

User interaction
Smart contract interaction
User interaction

The user can view all his orders: ongoing or past.

If the user selects view order, he is redirected to /order/{id}

Smart contract interaction

Read operations

Retrieves the key exchange information from the exchange map:

  • seller address

  • state

  • last update date

  • amount put in escrow

  • fees (commission + slashing rate)

  • shipping price

Entry point calls

There is no entry point interactions.

View an offer

  • Url: /offer/{id}

Allows the user to view an offer. At this point, none of the marketplace items information are stored in exchanges map of the smart contract.

User interaction
Smart contract interaction
User interaction

The user can either remove the selected offer or begin an escrow.

If the user selects Remove, he will be redirected to /offers

If the user selects Begin escrow, the app will connect with his Temple wallet allowing him to put the needed amount into escrow.

Smart contract interaction

Read operations

Retrieves the commission percentage from the exchange_types map in order to compute the displayed fees amount.

Entry point calls

If the user selects Begin escrow, the entry point addNewExchange is called with the following parameters:

  • the buyer address retrieved from his Temple wallet

  • the name of the offer

  • the id of the offer

  • the price of the offer

  • the seller address

Buy an item

  • Url: /buy/{id}

Allows the user to view an item before buying it. At this point, none of the marketplace items information are stored in exchanges map of the smart contract.

User interaction
Smart contract interaction
User interaction

The user can buy the selected item.

If the user selects Begin escrow, the app will connect with his Temple wallet allowing him to put the needed amount into escrow.

Smart contract interaction

Read operations

Retrieves the commission percentage from the exchange_types map in order to compute the displayed fees amount.

Entry point calls

If the user selects Buy, the entry point addNewExchange is called with the following parameters:

  • the buyer address retrieved from his Temple wallet

  • the name of the item

  • the id of the item

  • the price of the item

  • the seller address

View an order

  • Url: /order/{id}

Allows the user to view an order and carry out actions depending on the order state such as validate the exchange. The information about the order is retrieved from the exchanges map of the smart contract. An order can have three states:

  • Shipped

  • Awaiting validation

  • Finished

User interaction
Smart contract interaction
User interaction

The user can view the selected order.

Depending on the order status, he can carry out the following actions:

  • validate: if the order is awaiting validation, the user can validate the exchange. By selection validate the app will connect with his Temple wallet allowing him to perform the validation.

Smart contract interaction

Read operations

Retrieves the key exchange information from the exchange map:

  • seller address

  • state

  • last update date

  • amount put in escrow

  • fees (commission + slashing rate)

Entry point calls

If the state of the exchange is WAITING_FOR_VALIDATION and the user selects validate then the entry point validateExchange is called with the following parameters:

  • id of the order