Functions are listed bellow:
Carries out some action on device using a Key owned by an Organisation (tries to refill account on success).
keyID - id of nft token
action - action to be carried out
keyOwner - address of Organisation owning the key
mobileId - mobile ID of User performing the action
Valid key (timestamp, issuer)
Key whitelisted in device's wallet
Asset (key) in invoking user's wallet
Account performing the action needs to be added to Organisation
User account and Mobile ID in Organisation must match
Organisation has to be added in Supplier data
[E1] Key not owned - Key not found in user's wallet
[E3] Wrong key issuer - Key issuer is other than Supplier
[E4] No such device - There is no such device in Supplier dApp
[E5] Key not whitelisted - Key is not whitelisted in device's data
[E6] Device not connected
[E7] Device not active
[E8] Key expired
[E9] Not permitted by organization - User invoking the function is not a member of the Organisation
[E10] Mobile id not set - User invoking the function does not have Mobile ID set in Organisation
[E11] Id mismatch - Mobile ID of User does not match Mobile ID set in Organisation
[E12] Organization not permitted - Organisation not added to Supplier
[E19] Not a key - there is no asset with given id
[E20] Not a device key - there is no device info in key
Carries out some action on device (tries to refill account on success).
keyID
- id of nft token
action
- action to be carried out
Valid key (timestamp, issuer)
Key whitelisted in device's wallet
Asset (key) in invoking user's wallet
[E1] Key not owned
- Key not found in user's wallet
[E3] Wrong key issuer
- Key issuer is other than Supplier
[E4] No such device
- There is no such device in Supplier dApp
[E5]Key not whitelisted
- Key is not whitelisted in device's data
[E6]Device not connected
[E7] Device not active
[E8] Key expired
[E19] Not a key
- there is no asset with given id
[E20] Not a device key
- there is no device info in key
Transfers key to other user (DAppFather tries to refill both accounts on success).
recipient
- address of recipient
key as payment
- key to send
valid key (issuer, timestamp)
key in users wallet
[E3] Wrong key issuerr
- asset issuer is other than Supplier
[E8] Key expired
- timestamp in key description expired
[E15] Wrong payments count
- more or less than one asset provided as payment
Creates key for device if possible.
If no price is specified in the "key_price" entry, such a key cannot be purchased
Can only be purchased by the owner of the device ('owner' entry in the device)
A default token payment equal to <key_price> * <time in minutes>
is required
The validity of such a key is calculated from the date of purchase
deviceAddr
- address of device
duration
- time in minutes
price per minute defined in device
user is owner of device
the payment amount is equal
[E13] Not an owner
- device not owned by user
[E14] Wrong price
- wrong amount of asset
[E16] Wrong payment
- supported only native token
[E17] Wrong payment value, expected <value>
[E21] Price not specified in device
[E22] Owner not specified in device