Skip to content

Commit e5c41a1

Browse files
authored
Merge pull request #171 from threshold-network/tip-100-preparation
TIP-100 preparation
2 parents 09487d8 + 748f264 commit e5c41a1

7 files changed

+1829
-3554
lines changed

contracts/staking/IApplicationWithDecreaseDelay.sol

+6-6
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ import "./IApplication.sol";
1919

2020
/// @title Interface for Threshold Network applications with delay after decrease request
2121
interface IApplicationWithDecreaseDelay is IApplication {
22+
/// @notice Approves the previously registered authorization decrease
23+
/// request. Reverts if authorization decrease delay has not passed
24+
/// yet or if the authorization decrease was not requested for the
25+
/// given staking provider.
26+
function approveAuthorizationDecrease(address stakingProvider) external;
27+
2228
/// @notice Returns authorization-related parameters of the application.
2329
/// @dev The minimum authorization is also returned by `minimumAuthorization()`
2430
/// function, as a requirement of `IApplication` interface.
@@ -59,10 +65,4 @@ interface IApplicationWithDecreaseDelay is IApplication {
5965
external
6066
view
6167
returns (uint64);
62-
63-
/// @notice Approves the previously registered authorization decrease
64-
/// request. Reverts if authorization decrease delay has not passed
65-
/// yet or if the authorization decrease was not requested for the
66-
/// given staking provider.
67-
function approveAuthorizationDecrease(address stakingProvider) external;
6868
}

contracts/staking/IApplicationWithOperator.sol

+10-10
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,16 @@ import "./IApplication.sol";
1919

2020
/// @title Interface for Threshold Network applications with operator role
2121
interface IApplicationWithOperator is IApplication {
22+
/// @notice Used by staking provider to set operator address that will
23+
/// operate a node. The operator address must be unique.
24+
/// Reverts if the operator is already set for the staking provider
25+
/// or if the operator address is already in use.
26+
/// @dev Depending on application the given staking provider can set operator
27+
/// address only once or multiple times. Besides that, application can decide
28+
/// if function reverts if there is a pending authorization decrease for
29+
/// the staking provider.
30+
function registerOperator(address operator) external;
31+
2232
/// @notice Returns operator registered for the given staking provider.
2333
function stakingProviderToOperator(address stakingProvider)
2434
external
@@ -30,14 +40,4 @@ interface IApplicationWithOperator is IApplication {
3040
external
3141
view
3242
returns (address);
33-
34-
/// @notice Used by staking provider to set operator address that will
35-
/// operate a node. The operator address must be unique.
36-
/// Reverts if the operator is already set for the staking provider
37-
/// or if the operator address is already in use.
38-
/// @dev Depending on application the given staking provider can set operator
39-
/// address only once or multiple times. Besides that, application can decide
40-
/// if function reverts if there is a pending authorization decrease for
41-
/// the staking provider.
42-
function registerOperator(address operator) external;
4343
}

contracts/staking/IStaking.sol

-79
Original file line numberDiff line numberDiff line change
@@ -33,18 +33,6 @@ interface IStaking {
3333
//
3434
//
3535

36-
/// @notice Creates a delegation with `msg.sender` owner with the given
37-
/// staking provider, beneficiary, and authorizer. Transfers the
38-
/// given amount of T to the staking contract.
39-
/// @dev The owner of the delegation needs to have the amount approved to
40-
/// transfer to the staking contract.
41-
function stake(
42-
address stakingProvider,
43-
address payable beneficiary,
44-
address authorizer,
45-
uint96 amount
46-
) external;
47-
4836
/// @notice Allows the Governance to set the minimum required stake amount.
4937
/// This amount is required to protect against griefing the staking
5038
/// contract and individual applications are allowed to require
@@ -57,22 +45,6 @@ interface IStaking {
5745
//
5846
//
5947

60-
/// @notice Allows the Governance to approve the particular application
61-
/// before individual stake authorizers are able to authorize it.
62-
function approveApplication(address application) external;
63-
64-
/// @notice Increases the authorization of the given staking provider for
65-
/// the given application by the given amount. Can only be called by
66-
/// the authorizer for that staking provider.
67-
/// @dev Calls `authorizationIncreased(address stakingProvider, uint256 amount)`
68-
/// on the given application to notify the application about
69-
/// authorization change. See `IApplication`.
70-
function increaseAuthorization(
71-
address stakingProvider,
72-
address application,
73-
uint96 amount
74-
) external;
75-
7648
/// @notice Requests decrease of the authorization for the given staking
7749
/// provider on the given application by the provided amount.
7850
/// It may not change the authorized amount immediatelly. When
@@ -90,17 +62,6 @@ interface IStaking {
9062
uint96 amount
9163
) external;
9264

93-
/// @notice Requests decrease of all authorizations for the given staking
94-
/// provider on all applications by all authorized amount.
95-
/// It may not change the authorized amount immediatelly. When
96-
/// it happens depends on the application. Can only be called by the
97-
/// given staking provider’s authorizer. Overwrites pending
98-
/// authorization decrease for the given staking provider and
99-
/// application.
100-
/// @dev Calls `authorizationDecreaseRequested(address stakingProvider, uint256 amount)`
101-
/// for each authorized application. See `IApplication`.
102-
function requestAuthorizationDecrease(address stakingProvider) external;
103-
10465
/// @notice Called by the application at its discretion to approve the
10566
/// previously requested authorization decrease request. Can only be
10667
/// called by the application that was previously requested to
@@ -145,23 +106,6 @@ interface IStaking {
145106
/// Can only be called by the Governance.
146107
function setAuthorizationCeiling(uint256 ceiling) external;
147108

148-
//
149-
//
150-
// Stake top-up
151-
//
152-
//
153-
154-
/// @notice Increases the amount of the stake for the given staking provider.
155-
/// If `autoIncrease` flag is true then the amount will be added for
156-
/// all authorized applications.
157-
/// @dev The sender of this transaction needs to have the amount approved to
158-
/// transfer to the staking contract.
159-
function topUp(address stakingProvider, uint96 amount) external;
160-
161-
/// @notice Toggle `autoIncrease` flag. If true then the complete amount
162-
/// in top-up will be added to already authorized applications.
163-
function toggleAutoAuthorizationIncrease(address stakingProvider) external;
164-
165109
//
166110
//
167111
// Undelegating a stake (unstaking)
@@ -182,14 +126,6 @@ interface IStaking {
182126
//
183127
//
184128

185-
/// @notice Sets reward in T tokens for notification of misbehaviour
186-
/// of one staking provider. Can only be called by the governance.
187-
function setNotificationReward(uint96 reward) external;
188-
189-
/// @notice Transfer some amount of T tokens as reward for notifications
190-
/// of misbehaviour
191-
function pushNotificationReward(uint96 reward) external;
192-
193129
/// @notice Withdraw some amount of T tokens from notifiers treasury.
194130
/// Can only be called by the governance.
195131
function withdrawNotificationReward(address recipient, uint96 amount)
@@ -212,12 +148,6 @@ interface IStaking {
212148
address[] memory stakingProviders
213149
) external;
214150

215-
/// @notice Takes the given number of queued slashing operations and
216-
/// processes them. Receives 5% of the slashed amount.
217-
/// Executes `involuntaryAllocationDecrease` function on each
218-
/// affected application.
219-
function processSlashing(uint256 count) external;
220-
221151
//
222152
//
223153
// Auxiliary functions
@@ -244,12 +174,6 @@ interface IStaking {
244174
view
245175
returns (uint256);
246176

247-
/// @notice Returns auto-increase flag.
248-
function getAutoIncreaseFlag(address stakingProvider)
249-
external
250-
view
251-
returns (bool);
252-
253177
/// @notice Gets the stake owner, the beneficiary and the authorizer
254178
/// for the specified staking provider address.
255179
/// @return owner Stake owner address.
@@ -267,9 +191,6 @@ interface IStaking {
267191
/// @notice Returns length of application array
268192
function getApplicationsLength() external view returns (uint256);
269193

270-
/// @notice Returns length of slashing queue
271-
function getSlashingQueueLength() external view returns (uint256);
272-
273194
/// @notice Returns the maximum application authorization
274195
function getMaxAuthorization(address stakingProvider)
275196
external

0 commit comments

Comments
 (0)