Skip to content

Application

asandanov edited this page Jan 9, 2019 · 24 revisions

Application methods

addApp

Registering a New Application

Currently supported only IPFS storage system and Android applications

Application price is set in virtual units PMC

addApp(
    uint32 hashType,      // default 1 - IPFS
    uint32 appType,       // default 0 - android application 
    uint price,           // price App in virtual units PMC
    bool publish,         // the developer decides whether to publish or not
    string hash)          // hash of content in storage system

buyAppObj

The developer independently registers objects and their price using the SetPrice method.

The object with ID = 0 is reserved and contains the price of the application.

The purchase of an object can be carried out without indicating the price or with an indication. If the price is set, the smart contract will check the price of the object.

Buy object without check price

buyAppObj(
    uint app,             // application ID 
    address node,         // node address through which the purchase occurred  
    uint obj)             // object ID

Buy object with check price

buyAppObj(
    uint app,             // application ID 
    address node,         // node address through which the purchase occurred  
    uint obj,             // object ID
    uint price)           // price Object in virtual units PMC

buyAppSub

Buy subscription without check price

buyAppSub(
    uint app,             // application ID  
    address node,         // node address through which the purchase occurred   
    uint obj)             // object ID

Buy subscription with check price

buyAppSub(
    uint app,             // application ID  
    address node,         // node address through which the purchase occurred   
    uint obj,             // object ID
    uint price)           // price Object in virtual units PMC

buy

Buy without checks

buy(
    uint app,             // application ID  
    address node,         // node address through which the purchase occurred   
    uint obj)             // object ID

changeHashApp

change hash application in storage system, after change - confirmation sets to false.

changeHashApp(
    uint app,             // application ID
    string hash,          // hash of content in storage system
    uint32 hashType)      // default 1 - IPFS

changePublish

change application visibility

changePublish(
    uint app,             // application ID
    bool publish)         // true - publish/false - unpublish

setPrice

register the price(s) of the object(s).

only Developer may register prices of objects.

AppsOBJprice[application][object] = price; (in virtual units (PMC))

mapping (uint => mapping (uint => uint)) AppsOBJprice;

setPrice(
    uint app,             // application ID
    uint obj,             // object ID
    uint price)           // price of object

setPrice(
    uint app,             // application ID
    uint[] arrObj,        // array of object ID
    uint[] arrPrice)      // array price of object

setPrice(
    uint app,             // application ID
    uint[] arrObj,        // array of object ID
    uint price)           // price for array of object

setDuration

register the price(s) of the object(s) (object => subscription).

only Developer may register prices of objects.

AppsOBJduration[application][object] = price; (in virtual units (PMC))

mapping (uint => mapping (uint => uint)) AppsOBJduration;

setDuration(
    uint app,             // application ID
    uint obj,             // object ID
    uint price)           // price of object

setDuration(
    uint app,             // application ID
    uint[] arrObj,        // array of object ID
    uint[] arrPrice)      // array price of object

setDuration(
    uint app,             // application ID
    uint[] arrObj,        // array of object ID
    uint price)           // price for array of object

getDeveloper

get developer address by application ID.

getDeveloper(
    uint app              // application ID
) returns (
    address developer     // developer address
)

getBuyObject

check objects buy.

getBuyObject(
    uint app,             // application ID
    address user,         // user address  
    uint obj              // object ID
) returns (
    uint result)          // true - buyed, false - did not buy

getTimeSubscription

check time subscription by application ID.

getTimeSubscription(
    uint app,             // application ID
    address user,         // user address  
    uint obj              // object ID
) returns (
    uint time)            // end time subscription

getInfoApp

return information about application.

getInfoApp(
    uint app              // application ID
) returns (
    uint32 hashType,      // default 1 - IPFS
    uint32 appType,       // default 0 - android application 
    bool publish,         // true - publish/false - unpublish
    bool confirmation,    // true - confirmed/false - unconfirmed
    uint price,           // price of application
    string hash)          // hash of content in storage system

feedbackRating

We do not store the data in the contract, but generate the event. This allows you to make feedback as cheap as possible. The event generation costs 8 wei for 1 byte, and data storage in the contract 20,000 wei for 32 bytes.

feedbackRating(
    uint app,               // application ID
    uint vote,              // rating (1-5)
    string description,     // feedback comment
    bytes32 txIndex)        // identifier comment for the answer
Clone this wiki locally