Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added reward-related functions to IApplication interface #95

Merged
merged 1 commit into from
Apr 26, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions contracts/staking/IApplication.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,15 @@ pragma solidity 0.8.9;
/// staking provider are eligible to slash the stake delegated to that
/// staking provider.
interface IApplication {
/// @dev Event emitted by `withdrawRewards` function.
event RewardsWithdrawn(address indexed stakingProvider, uint96 amount);

/// @notice Withdraws application rewards for the given staking provider.
/// Rewards are withdrawn to the staking provider's beneficiary
/// address set in the staking contract.
/// @dev Emits `RewardsWithdrawn` event.
function withdrawRewards(address stakingProvider) external;

/// @notice Used by T staking contract to inform the application that the
/// authorized amount for the given staking provider increased.
/// The application may do any necessary housekeeping. The
Expand Down Expand Up @@ -57,6 +66,13 @@ interface IApplication {
uint96 toAmount
) external;

/// @notice Returns the amount of application rewards available for
/// withdrawal for the given staking provider.
function availableRewards(address stakingProvider)
external
view
returns (uint96);

/// @notice The minimum authorization amount required for the staking
/// provider so that they can participate in the application.
function minimumAuthorization() external view returns (uint96);
Expand Down
10 changes: 9 additions & 1 deletion contracts/test/TokenStakingTestSet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,10 @@ contract ApplicationMock is IApplication {
tokenStaking = _tokenStaking;
}

function withdrawRewards(address) external {
// does nothing
}

function authorizationIncreased(
address stakingProvider,
uint96,
Expand Down Expand Up @@ -272,7 +276,11 @@ contract ApplicationMock is IApplication {
stakingProviderStruct.authorized = toAmount;
}

function minimumAuthorization() external view returns (uint96) {
function availableRewards(address) external pure returns (uint96) {
return 0;
}

function minimumAuthorization() external pure returns (uint96) {
return 0;
}
}
Expand Down