😸User Functions

Users can directly interact with wav3s contract. Interfaces should implement the following features.

  1. fundWallet()

function fundWallet(
    uint256 _fundingAmount,
    address _currency
    ) payable external stopInEmergency returns (uint256){
Parameter
Type
Description

fundingAmount

uint256

The amount of a currency that the user wants to deposit in its internal wallet.

currency

address

The address of the currency to be deposited.

msg.value

bytes32

The amount of ether to be deposited in the internal wallet native balance.

By funding the internal users wallet, now the user can fund several amount of actions without having to deposit again.

  1. fundAction()

function fundAction(
        uint256[] memory _budget, 
        uint256[] memory _reward, 
        uint256[] memory _raffleDuration, 
        uint256[] memory _variable, 
        address _currency,
        address consumerApp
    ) external stopInEmergency payable returns (uint256[10] memory){
Parameter
Type
Description

budget

uint256

An array with the budgets, including all the fees, for the different actions the user wants to fund in a post.

reward

uint256

An array with the amount of reward for each action and budget.

raffleDuration

uint256

If the user wants to use the Raffle Mode, input raffleDuration in seconds. Else send a zero. One value per budget.

variable

uint256

The values in this array can represent any variable that can be used as filter, like minimum followers or character count.

currency

address

The address of the ERC20 token that will be used in this promotions.

consumerApp

address

The address of the consumer App from where this promoted post was made.

The structure of this function is aimed to fund in one transaction different budgets for liking, mirroring, commenting, collecting or more actions, for the same publication. That's why the input is an array of values. You can fund un to 10 actions, giving the information in the same order for every array in the function. Only one currency for all the actions in a publication. Finally, the app from where this post is being funded, should add it's consumerApp address in the last input.

For each action funded, an event with logging information is emitted, where you can know the user that funded an action, the budget and reward of the action and the unique action ID of the action:

 emit Events.wav3s__ActionFunded(
                sender,
                budget,
                reward,
                actionId
            );

  1. withdrawActionBudget()

function withdrawActionBudget(
    string memory pubId, 
    string memory actionName
    ) external stopInEmergency {
Parameter
Type
Description

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.

Any user can withdraw a previously funded action by calling this function with the "pubId" of the publication and the action funded. Users can withdraw both their internal wallets budget and a published promoted post. For minimizing bad behaviour, there's a 2-day cooldown period in wich you cannot withdraw an action budget. If you want to withdraw before 2 days, you can delete the publication from the social graph so it doesn't get more interactions, and thus, wav3s wont pay any Zurfer, and then after 2 days, withdraw the remaining budget, given that Zurfers can interact with your promoted post in the space between you published the post and then deleted it.

An event is emitted each time an action is withdrawn:

emit Events.wav3s__ActionWithdrawn(budget_, pubId, actionName, msg.sender);

  1. withdrawInternalWallet();

function withdrawInternalWalletBudget(
    uint256 etherAmount, 
    uint256 currencyAmount, 
    address _currency
    ) public payable stopInEmergency {
Parameter
Type
Description

etherAmount

uint256

The amount of ether or native currency that wants to be withdrawn.

currencyAmonut

uint256

The amount of a specific ERC20 token held in the internal wallet of the user that will be withdrawn.

currency

address

The address of the specific ERC20 token that will be withdrawn.

With this function users can withdraw both an ERC20 token in their internall wallet and an ether amount of native currency stored in the user's internal wallet.

Last updated