-
Notifications
You must be signed in to change notification settings - Fork 6
Advertisement Storage contract
Advertisement Storage contract is part of Advertisement contract, as explain in the contract Architecture of Advertisement contract. All operations with intent to change internal contract state are restricted to a list of authorized addresses which usually includes the main Advertisement contract and the Advertisement Storage contract's owner.
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 and finally the owner of the campaign. An additional field is registered for each campaign detailing if a campaign is still valid.
To create a campaign on Storage contract, an authorized address needs to issue a setCampaign
function. Using this function, a new campaign will be created if none with the same bidId exists. When creating a campaign it is mandatory to provide all the information described earlier in this page. Thus, setCampaign
function requires the bidId, price, budget, start and End date of the campaign, as well as a boolean issuing if a campaign is still valid and the campaign's owner address.
When creating a campaign, a CampaignCreated
event will be issued. A CampaignCreated
will include every information passed as argument on the setCampaign
function.
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 following functions are avaliable:
setCampaignPriceById
setCampaignBudgetById
setCampaignStartDateById
setCampaignEndDateById
setCampaignValidById
setCampaignOwnerById
Each of those functions emit a CampaignUpdated
event. This event will include every information stored by the contract regarding the specific campaign which was updated.
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 as following:
getCampaignPriceById
getCampaignBudgetById
getCampaignStartDateById
getCampaignEndDateById
getCampaignValidById
getCampaignOwnerById
Contracts
- Address Proxy
- Advertisement
- Advertisement Storage
- Advertisement Finance
- AppCoins IAB
- AppCoins Timelock
- AppCoins Credits Balance
Extended Contracts
Development
Other