-
Notifications
You must be signed in to change notification settings - Fork 20
Expand file tree
/
Copy pathIApplication.sol
More file actions
82 lines (73 loc) · 4.14 KB
/
IApplication.sol
File metadata and controls
82 lines (73 loc) · 4.14 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
// SPDX-License-Identifier: GPL-3.0-or-later
// ██████████████ ▐████▌ ██████████████
// ██████████████ ▐████▌ ██████████████
// ▐████▌ ▐████▌
// ▐████▌ ▐████▌
// ██████████████ ▐████▌ ██████████████
// ██████████████ ▐████▌ ██████████████
// ▐████▌ ▐████▌
// ▐████▌ ▐████▌
// ▐████▌ ▐████▌
// ▐████▌ ▐████▌
// ▐████▌ ▐████▌
// ▐████▌ ▐████▌
pragma solidity 0.8.9;
/// @title Application interface for Threshold Network applications
/// @notice Generic interface for an application. Application is an external
/// smart contract or a set of smart contracts utilizing functionalities
/// offered by Threshold Network. Applications authorized for the given
/// 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
/// application must revert the transaction in case the
/// authorization is below the minimum required.
function authorizationIncreased(
address stakingProvider,
uint96 fromAmount,
uint96 toAmount
) external;
/// @notice Used by T staking contract to inform the application that the
/// authorization decrease for the given staking provider has been
/// requested. The application should mark the authorization as
/// pending decrease and respond to the staking contract with
/// `approveAuthorizationDecrease` at its discretion. It may
/// happen right away but it also may happen several months later.
/// If there is already a pending authorization decrease request
/// for the application, and the application does not agree for
/// overwriting it, the function should revert.
function authorizationDecreaseRequested(
address stakingProvider,
uint96 fromAmount,
uint96 toAmount
) external;
/// @notice Used by T staking contract to inform the application the
/// authorization has been decreased for the given staking provider
/// involuntarily, as a result of slashing. Lets the application to
/// do any housekeeping neccessary. Called with 250k gas limit and
/// does not revert the transaction if
/// `involuntaryAuthorizationDecrease` call failed.
function involuntaryAuthorizationDecrease(
address stakingProvider,
uint96 fromAmount,
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);
}