Appendix B: Asset States in Kiosk

An asset in Kiosk can be in one of the following states:

  • Placed
  • Locked (special case of Placed)
  • Listed
  • Listed Exclusively

Placed

Asset is put into the Kiosk by the Kiosk Owner using the kiosk::place function. An owner can perform any available action on an item in this state.

Available actions

Check state

To check that asset is in the right state, the caller can use is_placed function, however, to make sure that the asset is not locked, we need to check !is_locked.

let is_placed = kiosk::is_placed<T>(&Kiosk, ItemID) && !kiosk::is_locked<T>(&Kiosk, ItemID);

Locked

Asset can also be placed and locked in a Kiosk using the kiosk::lock function. Unlike place, locking mechanic disables taking.

Available actions

Check state

Kiosk has a built in is_locked function to check if the item is locked.

let is_locked = kiosk::is_locked<T>(&Kiosk, ItemID);

Listed

A placed or a locked item can be listed using the list function. The asset then becomes publicly available for purchase.

While listed, an asset can not be modified.

Available actions

  • purchase - move the asset out of the Kiosk
  • delist - return to the previous state: Placed or Locked
  • borrow

Check state

To check if the item is listed, use is_listed function.

let is_listed = kiosk::is_listed<T>(&Kiosk, ItemID)

Listed Exclusively

When an asset is listed using the list_with_purchase_cap, it gets “listed exclusively” state. While in this state, an asset is available for purchase to the owner of the PurchaseCap, and cannot be delisted unless the PurchaseCap is returned.

While listed exclusively, an asset can not be modified.

Available actions

Check state

To check if an asset is listed exclusively, use is_listed_exclusively function.

let is_listed_exclusively = kiosk::is_listed_exclusively<T>(&Kiosk, ItemID);