Skip to content

Extended Advertisement Storage contract

Tiago Rosado edited this page Oct 15, 2018 · 6 revisions

Features

Functionality

Extended Advertisement Storage contract is part of Extended Advertisement contract, as explain in the contract architecture of Extended Advertisement contract. All operations with intent to change internal contract state are restricted to a list of authorized addresses which usually includes the main Extended Advertisement contract and the Extended Advertisement Storage contract's owner.

Extended Advertisement Storage contract stores every campaign registered for user acquisition by its developer. A campaign is registered in the Storage contract with the following information, bidId (which uniquely identifies the campaign), price which the campaign owner is willing to pay for each app instalation, the start and end dates of the campaign, the owner of the campaign and finally the Web service endpoint responsible for validating PoAs. An additional field is registered for each campaign detailing if a campaign is still valid.

Creating a campaign

The campaign creation using the Extended Advertisement Storage contract is similar to the process described for Advertisement Storage contract. In addition, the setCampaign function receives an additional argument, specifying the Web service endpoint for signing Proofs of attention.

As result from a campaign creation, besides CampaignCreated event, a ExtendedCampaignEndPointCreated event is emitted specifying the Web service endpoint for signing Proofs of attention.

Updating a campaign information

In order to update a campaign information it is possible to issue an update through two alternative methods. The first method to update an existing campaign is to issue a setCampaign function. Thus, the same arguments described in the create campaign section will be needed. The bidId of the campaign will be used to identify the campaign which will be updated.

When updating a campaign using setCampaign function, a CampaignUpdated event will be issued. A CampaignUpdated will include every information passed as argument on the setCampaign function.

The second method used to update a campaign is specific to each information field stored for a campaign. Thus, the available functions are the same as in Advertisement Storage contract. In addition, as Extended Advertisement contract also receives a URL pointing to the signing and validation service for proofs of attention, thus a setCampaignEndPointById function is available to update this information.

Each of those functions emit a CampaignUpdated event, except setCampaignEndPointById function which emits a ExtendedCampaignEndPointUpdated event. This event will include every information stored by the contract regarding the specific campaign which was updated.

Reading campaign informations

In order to read camapaign information it is necessary to provide the bidId of the corresponding campaign. To read campaign information it is not necessary to have special permissions, anyone can read this information. The list of functions available is the same as described in Advertisement Storage contract. In addition a getCampaignEndPointById function is available returning the signing web service for a certain bidId.

How to test