Spool Tech Docs
Search
⌃K

RewardDistributor.sol

Implementation of the {IRewardDistributor} interface.
This contract has the simple logic to distribute ERC20 tokens to the desired address (e.g. SpoolStaking). It can be called from the whitelisted addresses to pay the rewards. Reward tokens should be sent to this contract in advance. The contract is pausable by the Spool DAO or the pauser.

Methods

isDistributor

function isDistributor(address) external view returns (bool)
Is the address reward distributor
e.g. Spool staking contract

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

isPauser

function isPauser(address) external view returns (bool)
Can the address pause the contract

Parameters

Name
Type
Description
_0
address
undefined

Returns

Name
Type
Description
_0
bool
undefined

pause

function pause() external nonpayable
Stops the controller.
Requirements: - the caller must be the pauser or the contract owner (Spool DAO)

paused

function paused() external view returns (bool)
Returns true if the contract is paused, and false otherwise.

Returns

Name
Type
Description
_0
bool
undefined

payReward

function payReward(address account, contract IERC20 token, uint256 amount) external nonpayable
Pay ERC20 token reward to account
Requirements: - the caller must be the distributor

Parameters

Name
Type
Description
account
address
address to retrieve the token to
token
contract IERC20
ERC20 token to send
amount
uint256
amount of reward to send

payRewards

function payRewards(address account, contract IERC20[] tokens, uint256[] amounts) external nonpayable
Pay ERC20 token rewards to account
Requirements: - the caller must be the distributor

Parameters

Name
Type
Description
account
address
address to retrieve the token to
tokens
contract IERC20[]
ERC20 tokens to send
amounts
uint256[]
amount of rewards to send

retrieveRewards

function retrieveRewards(address account, contract IERC20 token, uint256 amount) external nonpayable
Retrieve the reward tokens from this contract
Requirements: - the caller must be the contract owner (Spool DAO)

Parameters

Name
Type
Description
account
address
address to retrieve the token to
token
contract IERC20
ERC20 token to retrieve
amount
uint256
amount to retrieve

setDistributor

function setDistributor(address account, bool _set) external nonpayable
Add or remove the reward distributer
Requirements: - the caller must be the contract owner (Spool DAO)

Parameters

Name
Type
Description
account
address
address to manage the distributer role for
_set
bool
true to set the role, flase to remove

setPauser

function setPauser(address account, bool _set) external nonpayable
Add or remove the pauser role
Requirements: - the caller must be the contract owner (Spool DAO)

Parameters

Name
Type
Description
account
address
address to manage the pauser role for
_set
bool
true to set the role, flase to remove

unpause

function unpause() external nonpayable
Resumes the reward distribution.
Requirements: - the caller must be the contract owner (Spool DAO)

Events

DistributorUpdated

event DistributorUpdated(address indexed user, bool set)

Parameters

Name
Type
Description
user indexed
address
undefined
set
bool
undefined

Paused

event Paused(address account)

Parameters

Name
Type
Description
account
address
undefined

PauserUpdated

event PauserUpdated(address indexed user, bool set)

Parameters

Name
Type
Description
user indexed
address
undefined
set
bool
undefined

RewardPaid

event RewardPaid(contract IERC20 token, address indexed account, uint256 amount)

Parameters

Name
Type
Description
token
contract IERC20
undefined
account indexed
address
undefined
amount
uint256
undefined

RewardRetrieved

event RewardRetrieved(contract IERC20 token, address indexed account, uint256 amount)

Parameters

Name
Type
Description
token
contract IERC20
undefined
account indexed
address
undefined
amount
uint256
undefined

Unpaused

event Unpaused(address account)

Parameters

Name
Type
Description
account
address
undefined