ITipsWithConfig
This is the interface for the TipsWithConfig contract.
Functions
initialize
Initialize the contract, setting web3Entry address.
function initialize(address web3Entry_) external;
Parameters
Name | Type | Description |
---|---|---|
web3Entry_ | address | Address 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
Name | Type | Description |
---|---|---|
feeReceiver | address | The fee receiver address. |
fraction | uint256 | The 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
Name | Type | Description |
---|---|---|
feeReceiver | address | The fee receiver address. |
characterId | uint256 | The character ID. |
fraction | uint256 | The 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
Name | Type | Description |
---|---|---|
fromCharacterId | uint256 | The token ID of character that would send the reward. |
toCharacterId | uint256 | The token ID of character that would receive the reward. |
token | address | The token address. |
amount | uint256 | The amount of token. |
startTime | uint256 | The start time of tips. |
endTime | uint256 | The end time of tips. |
interval | uint256 | The interval of tips. |
feeReceiver | address | The 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
Name | Type | Description |
---|---|---|
tipConfigId | uint256 | The 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
Name | Type | Description |
---|---|---|
tipConfigId | uint256 | The tip config ID. |
Returns
Name | Type | Description |
---|---|---|
collectedAmount | uint256 | The 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
Name | Type | Description |
---|---|---|
feeReceiver | address | The fee receiver address. |
characterId | uint256 | The character ID . |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | fraction 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
Name | Type | Description |
---|---|---|
feeReceiver | address | The fee receiver address. |
characterId | uint256 | The character ID . |
tipAmount | uint256 |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | The fee amount. |
getTipsConfigId
Return the tips config Id.
function getTipsConfigId(uint256 fromCharacterId, uint256 toCharacterId) external view returns (uint256);
Parameters
Name | Type | Description |
---|---|---|
fromCharacterId | uint256 | The token ID of character that initiated a reward. |
toCharacterId | uint256 | The token ID of character that would receive the reward. |
Returns
Name | Type | Description |
---|---|---|
<none> | uint256 | uint256 Returns tips config ID. |
getTipsConfig
Return the tips config.
function getTipsConfig(uint256 tipConfigId) external view returns (TipsConfig memory config);
Parameters
Name | Type | Description |
---|---|---|
tipConfigId | uint256 | The tip config ID. |
getWeb3Entry
Returns the address of web3Entry contract.
function getWeb3Entry() external view returns (address);
Returns
Name | Type | Description |
---|---|---|
<none> | address | The 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;
}