🔫Trigger Functions

Some functions can only be called by whitelisted accounts that trigger actions

  1. setPubId();

function setPubId(
        uint256 actionId, 
        string memory pubId, 
        string memory actionName
    ) external onlyWav3sTrigger {
ParameterTypeDescription

actionId

uint256

Action ID returned by fundAction()

pubId

string

A string that identifies a publication in a social graph. Prefixes are used to uniquely identify publication from different social graphs, like "lens-0x01a2ee-0x09"

actionName

string

Action names are "mirror", "like", "comment", "post", "follow", "collect", and so on.

This function is used to bound the settings stored in an Action ID with a corresponding publication ID and an "action name". An Action ID is returned each time a fundAction() is executed.

  1. processAction();

function processAction(
        string memory pubId,
        string[] memory action,
        address[] memory user,
        uint256[] memory variableCount
    ) external stopInEmergency onlyWav3sTrigger
ParameterTypeDescription

pubId

string

The string that identifies a publication in a social graph.

action

string[]

An array of actions that were engaged and areprocessed. Action names are "mirror", "like", "comment", "post", "follow", "collect", and so on.

user

address[]

A correlating array of the users addresses that engaged with the actions input.

variableCount

uint256[]

An array of arbitrary values used as filters for the action being processed.

Triggers will call this function after reading engagements on wav3s posts with the information of the zurfers that engaged. If the user fill the requiremets the reward will be transfered to them. If the action being processed is a raffle, then the function will store the valid zurfers waiting to the executiong of the raffle.

An event is emitted each time an action in processed with the user address and the pubId of the post.

emit Events.wav3s__ActionProcessed(_user, pubId);

If the budget of the publication is over after the processing of the action, an "Action Finished" event is emitted

emit Events.wav3s__ActionFinished(pubId, _action);

  1. executeRaffle();

function executeRaffle(
        string memory pubId, 
        string memory actionName
      ) external stopInEmergency onlyWav3sTrigger {
ParameterTypeDescription

pubId

string

The string that identifies a publication in a social graph.

actionName

string

Action names are "mirror", "like", "comment", "post", "follow", "collect", and so on.

With both pubId and actionName, the trigger can command the execution of a Raffle related to both inputs. The raffle will only succed if the "raffle duration" time has passed, and at least there is enough amount of zurfers in the list as rewards has the raffle.

When a prize of the raffle is paid, an event is emitted:

emit Events.wav3s__PrizePaid(
    actionDataBase.pubId,
    actionDataBase.actionName,
    indexOfWinner, 
    winner, 
    _reward);

If the prizes are over, an Action Prize Finished event is emitted:

emit Events.wav3s__ActionPrizeFinished(
    actionDataBase.pubId, 
    actionDataBase.actionName
    );
  1. getWinners();

function getWinners(
    string memory pubId,
    string memory actionName
    ) public view returns (address[] memory) {
ParameterTypeDescription

pubId

string

The string that identifies a publication in a social graph.

actionName

string

Action names are "mirror", "like", "comment", "post", "follow", "collect", and so on.

By calling getWinners() with a specified pubId and actionName, if the action was a raffle, the function will return an array containing all the addresses of the winners of the raffle.

Last updated