We start with the library for RentOnZilliqa. We declare the
one_msg helper function. The source code can be found here.
Then we get to creating a handful of message codes we will use to communicate with the frontend. The codes are of type
The codes are grouped into three categories:
These codes are general codes that apply to all users that communicate with the contract (the source code).
|Successfully created user|
|User already exists|
|User does not exist|
|Cannot update/claim commission as user is not owner|
|Commission claimed by owner|
|Commission updated by owner|
|Night Duration updated by owner|
Host Account Codes
These codes are codes specifically used to communicate after actions relating to host accounts (the source code).
|Successfully created listing|
|Successfully updated listing|
|Successfully deleted listing|
|Successfully claimed rent from listing|
|No accumulated rent for listing being claimed|
|Cannot delete listing as it has accumulated rent|
|Cannot book listing because user is host|
|Cannot manage listing because sender is not host|
Renter Account Codes
These codes are codes specifically used to communicate after actions relating to renter accounts (the source code).
|Successfully booked listing|
|Cannot book listing because it is rented|
|Cannot create listing as user is a renter account|
|Cannot book listing as amount is wrong|
|Cannot book listing because it does not exist|
|Listing details are missing|
We define a few more additional constants for use within the contract. We create constants for storing the account roles. As well as some constants for ease of use. (the source code).