Rewards

// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

/**
 * @title IRewards
 * @dev Interface for managing the rewards system.
 */
interface IRewards {

    /**
     * @dev Emitted when tokens are earned.
     * @param user The address of the user earning tokens.
     * @param activityType The type of activity for which tokens are earned.
     * @param tokens The number of tokens earned.
     */
    event TokensEarned(address indexed user, uint256 indexed activityType, uint256 indexed tokens);

    /**
     * @dev Emitted when tokens are redeemed.
     * @param user The address of the user redeeming tokens.
     * @param tokens The number of tokens redeemed.
     */
    event TokensRedeemed(address indexed user, uint256 indexed tokens);


    /**
     * @dev Emitted when activity reward amount is updated.
     * @param activityType The type of activity for which the reward amount is updated.
     * @param amount The new reward amount.
     */
    event ActivityRewardUpdated(uint256 indexed activityType, uint256 indexed amount);

    /**
     * @dev Emitted when the boost factor is updated.
     * @param oldFactor The old boost factor.
     * @param newFactor The new boost factor.
     */
    event BoostFactorUpdated(uint256 indexed oldFactor, uint256 indexed newFactor);

    /**
     * @dev Emitted when the payout duration is updated.
     * @param oldDuration The old payout duration.
     * @param newDuration The new payout duration.
     */
    event PayoutDurationUpdated(uint256 indexed oldDuration, uint256 indexed newDuration);

    /**
     * @dev Emitted when the variable reward approval rate is updated.
     * @param newRate The new rate.
     */
    event VariableRewardApprovalRateChanged(uint256 indexed newRate);

    /**
     * @notice Adds tokens to a user's balance based on an activity type.
     * @param user The address of the user earning tokens.
     * @param activityType The type of activity (e.g., "List Product"=1, "Make Purchase"=2, .etc).
     */
    function earnTokens(address user, uint256 activityType) external;

    /**
     * @notice Redeems tokens from a user's balance.
     * @param user The address of the user redeeming tokens.
     * @param tokens The number of tokens to redeem.
     */
    function redeemTokens(address user, uint256 tokens) external;

    /**
     * @notice Retrieves the current token balance of a user.
     * @param user The address of the user.
     * @return balance The current token balance.
     */
    function getTokenBalance(address user) external view returns (uint256);

    /**
     * @notice Retrieves the total tokens earned by a user for a specific activity type.
     * @param user The address of the user.
     * @param activityType The type of activity.
     * @return totalTokens The total number of tokens earned for the specified activity type.
     */
    function getTotalTokensEarnedForActivity(address user, uint256 activityType) external view returns (uint256);
}

Last updated