Mutable Variables


In this section, we look at the mutable fields declared in the contract. The source code.

Declaring the Mutable Fields

The fields can be grouped into the following types based on their purpose.

Owner Fields

These fields can be modified by the owner of the contract. They dictate the behavior of the platform.

FieldDescriptionTypeInitial value
owners_comissionThe commission collected by the platform owner on every rentalUint12810
night_durationThe change in BLOCKNUMBER that is understood to be a nightUint3210
listing_id_generatorA variable that is incremented to generate sequential IDs for new listingsUint128zero

User Details Fields

These Map fields are dictionaries that are used to store details about the user accounts created on the platform. The key for each of them is the Wallet Address of the user.

FieldDescriptionTypeInitial value
user_nameThe name of the userMap ByStr20 StringEmp ByStr20 String
user_roleThe role of the user
(0: Renter, 1: Host)
Map ByStr20 Uint32Emp ByStr20 Uint32

Listing Details Fields

These Map fields are dictionaries that are used to store details about each listing. The key for each of them is the ID as explained with the listing_id_generator in the Owner Fields. The value is the listing information corresponding to the field.

FieldValue descriptionTypeInitial value
listing_hostThe wallet address of the host account that created the listingMap Uint128 ByStr20Emp Uint128 ByStr20
listing_renterThe wallet address of the current renter of the listingMap Uint128 ByStr20Emp Uint128 ByStr20
listing_rented_tillThe BLOCKNUMBER until which the listing is rentedMap Uint128 BNumEmp Uint128 BNum
listing_nameThe name of the listingMap Uint128 StringEmp Uint128 String
listing_descriptionThe description of the listingMap Uint128 StringEmp Uint128 String
listing_priceThe price of the listingMap Uint128 Uint128Emp Uint128 Uint128
listing_roomsThe number of rooms in the listingMap Uint128 Uint32Emp Uint128 Uint32
listing_bathroomsThe number of bathrooms in the listingMap Uint128 Uint32Emp Uint128 Uint32
listing_imageA URL to an image of the listingMap Uint128 StringEmp Uint128 String
listing_locationA Google Maps Plus Code for the location of the listingMap Uint128 StringEmp Uint128 String
listing_wifiThe availability of WiFi at the listingMap Uint128 StringEmp Uint128 String
listing_laundryThe availability of a Landry at the listingMap Uint128 StringEmp Uint128 String
listing_hvacThe availability of an HVAC at the listingMap Uint128 StringEmp Uint128 String
listing_tvThe availability of a TV at the listingMap Uint128 StringEmp Uint128 String
listing_kitchenThe availability of a Kitchen at the listingMap Uint128 StringEmp Uint128 String
listing_accumulated_rentThe rent accumulated for the listingMap Uint128 Uint128Emp Uint128 Uint128