Keep3r V2
Search…
Token Payments
Jobs as well can top-up their credits with ERC20 tokens, and then use them to reward keepers.

Add Tokens To Job

Anyone can add token credits to a job by approving a transfer of an ERC20 token and then calling:
1
/// @notice Add credit to a job to be paid out for work
2
/// @param _job The address of the job being credited
3
/// @param _token The address of the token being credited
4
/// @param _amount The amount of credit being added
5
function addTokenCreditsToJob(
6
address _job,
7
address _token,
8
uint256 _amount
9
) external;
Copied!
This function will give the job token credits in a 1:1 relation to the transferred ERC20 tokens. Job token credit balance can be checked calling:
1
/// @notice The current token credits available for a job
2
/// @return _amount The amount of token credits available for a job
3
function jobTokenCredits(address _job, address _token) external view returns (uint256 _amount);
Copied!
The only way of adding KP3R credits to a job is by Credit Mining. Trying to add KP3R tokens by using addTokenCreditsToJob will revert.

Withdraw Tokens From Job

A job owner can withdraw tokens credits from a job by calling:
1
/// @notice Withdraw credit from a job
2
/// @param _job The address of the job from which the credits are withdrawn
3
/// @param _token The address of the token being withdrawn
4
/// @param _amount The amount of token to be withdrawn
5
/// @param _receiver The user that will receive tokens
6
function withdrawTokenCreditsFromJob(
7
address _job,
8
address _token,
9
uint256 _amount,
10
address _receiver
11
) external;
Copied!
This function can revert if:
  • Job is disputed
  • Token credits were added to the job at most 1 minute before trying to withdraw

Pay Keepers With Token Credits

In order to reward keepers for their work with token credits jobs can call:
1
/// @notice Implemented by jobs to show that a keeper performed work
2
/// @dev Pays the keeper that performs the work with a specific token
3
/// @param _token The asset being awarded to the keeper
4
/// @param _keeper Address of the keeper that performed the work
5
/// @param _amount The reward that should be allocated
6
function directTokenPayment(
7
address _token,
8
address _keeper,
9
uint256 _amount
10
) external;
Copied!