ITipsWithConfig

Git Source

This is the interface for the TipsWithConfig contract.

Functions

initialize

Initialize the contract, setting web3Entry address.

function initialize(address web3Entry_) external;

Parameters

NameTypeDescription
web3Entry_addressAddress of web3Entry.

setDefaultFeeFraction

Sets the default fee percentage of specific receiver.

The feeReceiver can be a platform account.

function setDefaultFeeFraction(address feeReceiver, uint256 fraction) external;

Parameters

NameTypeDescription
feeReceiveraddressThe fee receiver address.
fractionuint256The percentage measured in basis points. Each basis point represents 0.01%.

setFeeFraction4Character

Sets the fee percentage of specific <receiver, character>.

If this is set, it will override the default fee fraction.

function setFeeFraction4Character(address feeReceiver, uint256 characterId, uint256 fraction) external;

Parameters

NameTypeDescription
feeReceiveraddressThe fee receiver address.
characterIduint256The character ID.
fractionuint256The percentage measured in basis points. Each basis point represents 0.01%.

setTipsConfig4Character

Sets the tips config of specific <fromCharacter, toCharacter>.
Emits a {SetTipsConfig4Character} event.

If the tips config of specific <fromCharacter, toCharacter> is already, it will try to collect the tips first, and then override the tips config.

function setTipsConfig4Character(
    uint256 fromCharacterId,
    uint256 toCharacterId,
    address token,
    uint256 amount,
    uint256 startTime,
    uint256 endTime,
    uint256 interval,
    address feeReceiver
) external;

Parameters

NameTypeDescription
fromCharacterIduint256The token ID of character that would send the reward.
toCharacterIduint256The token ID of character that would receive the reward.
tokenaddressThe token address.
amountuint256The amount of token.
startTimeuint256The start time of tips.
endTimeuint256The end time of tips.
intervaluint256The interval of tips.
feeReceiveraddressThe fee receiver address.

cancelTips4Character

Cancels the tips config.
Emits a {CancelTips4Character} event.

It will try to collect the tips first, and then delete the tips config.

function cancelTips4Character(uint256 tipConfigId) external;

Parameters

NameTypeDescription
tipConfigIduint256The tip config ID to cancel.

collectTips4Character

Collects all unredeemed token from the fromCharacter to the toCharacter.
Emits a {CollectTips4Character} event if collects successfully.

It will transfer all unredeemed token from the fromCharacter to the toCharacter.

function collectTips4Character(uint256 tipConfigId) external returns (uint256 collectedAmount);

Parameters

NameTypeDescription
tipConfigIduint256The tip config ID.

Returns

NameTypeDescription
collectedAmountuint256The amount of token collected.

getFeeFraction

Returns the fee percentage of specific <receiver, note>.

It will return the first non-zero value by priority feeFraction4Character and defaultFeeFraction.

function getFeeFraction(address feeReceiver, uint256 characterId) external view returns (uint256);

Parameters

NameTypeDescription
feeReceiveraddressThe fee receiver address.
characterIduint256The character ID .

Returns

NameTypeDescription
<none>uint256fraction The percentage measured in basis points. Each basis point represents 0.01%.

getFeeAmount

Returns how much the fee is owed by <feeFraction, tipAmount>.

function getFeeAmount(address feeReceiver, uint256 characterId, uint256 tipAmount) external view returns (uint256);

Parameters

NameTypeDescription
feeReceiveraddressThe fee receiver address.
characterIduint256The character ID .
tipAmountuint256

Returns

NameTypeDescription
<none>uint256The fee amount.

getTipsConfigId

Return the tips config Id.

function getTipsConfigId(uint256 fromCharacterId, uint256 toCharacterId) external view returns (uint256);

Parameters

NameTypeDescription
fromCharacterIduint256The token ID of character that initiated a reward.
toCharacterIduint256The token ID of character that would receive the reward.

Returns

NameTypeDescription
<none>uint256uint256 Returns tips config ID.

getTipsConfig

Return the tips config.

function getTipsConfig(uint256 tipConfigId) external view returns (TipsConfig memory config);

Parameters

NameTypeDescription
tipConfigIduint256The tip config ID.

getWeb3Entry

Returns the address of web3Entry contract.

function getWeb3Entry() external view returns (address);

Returns

NameTypeDescription
<none>addressThe address of web3Entry contract.

Structs

TipsConfig

struct TipsConfig {
    uint256 id;
    uint256 fromCharacterId;
    uint256 toCharacterId;
    address token;
    uint256 amount;
    uint256 startTime;
    uint256 endTime;
    uint256 interval;
    address feeReceiver;
    uint256 totalRound;
    uint256 currentRound;
}