Skip to content

Commit b181f2a

Browse files
committed
TokenStaking: removes all functions related to legacy stakes
1 parent 116e669 commit b181f2a

File tree

6 files changed

+93
-2175
lines changed

6 files changed

+93
-2175
lines changed

contracts/staking/IStaking.sol

+7-68
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,6 @@ pragma solidity ^0.8.9;
2727
/// delegation optimizes the network throughput without compromising the
2828
/// security of the owners’ stake.
2929
interface IStaking {
30-
enum StakeType {
31-
NU,
32-
KEEP,
33-
T
34-
}
35-
3630
//
3731
//
3832
// Delegating a stake
@@ -176,39 +170,11 @@ interface IStaking {
176170

177171
/// @notice Reduces the liquid T stake amount by the provided amount and
178172
/// withdraws T to the owner. Reverts if there is at least one
179-
/// authorization higher than the sum of the legacy stake and
180-
/// remaining liquid T stake or if the unstake amount is higher than
181-
/// the liquid T stake amount. Can be called only by the delegation
182-
/// owner or the staking provider.
183-
function unstakeT(address stakingProvider, uint96 amount) external;
184-
185-
/// @notice Sets the legacy KEEP staking contract active stake amount cached
186-
/// in T staking contract to 0. Reverts if the amount of liquid T
187-
/// staked in T staking contract is lower than the highest
188-
/// application authorization. This function allows to unstake from
189-
/// KEEP staking contract and still being able to operate in T
190-
/// network and earning rewards based on the liquid T staked. Can be
191-
/// called only by the delegation owner or the staking provider.
192-
function unstakeKeep(address stakingProvider) external;
193-
194-
/// @notice Sets to 0 the amount of T that is cached from the legacy
195-
/// NU staking contract. Reverts if there is at least one
196-
/// authorization higher than the sum of remaining legacy NU stake
197-
/// and native T stake for that staking provider or if the unstaked
198-
/// amount is higher than the cached legacy stake amount. If succeeded,
199-
/// the legacy NU stake can be partially or fully undelegated on
200-
/// the legacy NU staking contract. This function allows to unstake
201-
/// from NU staking contract while still being able to operate in
202-
/// T network and earning rewards based on the native T staked.
203-
/// Can be called only by the stake owner or the staking provider.
204-
function unstakeNu(address stakingProvider) external;
205-
206-
/// @notice Sets cached legacy stake amount to 0, sets the liquid T stake
207-
/// amount to 0 and withdraws all liquid T from the stake to the
208-
/// owner. Reverts if there is at least one non-zero authorization.
173+
/// authorization higher than the remaining liquid T stake or
174+
/// if the unstake amount is higher than the liquid T stake amount.
209175
/// Can be called only by the delegation owner or the staking
210176
/// provider.
211-
function unstakeAll(address stakingProvider) external;
177+
function unstakeT(address stakingProvider, uint96 amount) external;
212178

213179
//
214180
//
@@ -265,17 +231,8 @@ interface IStaking {
265231
view
266232
returns (uint96);
267233

268-
/// @notice Returns staked amount of T, Keep and Nu for the specified
269-
/// staking provider.
270-
/// @dev All values are in T denomination
271-
function stakes(address stakingProvider)
272-
external
273-
view
274-
returns (
275-
uint96 tStake,
276-
uint96 keepInTStake,
277-
uint96 nuInTStake
278-
);
234+
/// @notice Returns staked amount of T for the specified staking provider.
235+
function tStake(address stakingProvider) external view returns (uint96);
279236

280237
/// @notice Returns start staking timestamp.
281238
/// @dev This value is set at most once.
@@ -290,9 +247,6 @@ interface IStaking {
290247
view
291248
returns (bool);
292249

293-
/// @notice Returns staked amount of NU for the specified staking provider.
294-
function stakedNu(address stakingProvider) external view returns (uint256);
295-
296250
/// @notice Gets the stake owner, the beneficiary and the authorizer
297251
/// for the specified staking provider address.
298252
/// @return owner Stake owner address.
@@ -313,23 +267,8 @@ interface IStaking {
313267
/// @notice Returns length of slashing queue
314268
function getSlashingQueueLength() external view returns (uint256);
315269

316-
/// @notice Returns minimum possible stake for T, KEEP or NU in T
317-
/// denomination.
318-
/// @dev For example, suppose the given staking provider has 10 T, 20 T worth
319-
/// of KEEP, and 30 T worth of NU all staked, and the maximum
320-
/// application authorization is 40 T, then `getMinStaked` for
321-
/// that staking provider returns:
322-
/// * 0 T if KEEP stake type specified i.e.
323-
/// min = 40 T max - (10 T) = 30 T
324-
/// * 10 T if NU stake type specified i.e.
325-
/// min = 40 T max - (10 T) = 30 T
326-
/// * 0 T if T stake type specified i.e.
327-
/// min = 40 T max = 40 T
328-
/// In other words, the minimum stake amount for the specified
329-
/// stake type is the minimum amount of stake of the given type
330-
/// needed to satisfy the maximum application authorization given
331-
/// the staked amounts of the T stake types for that staking provider.
332-
function getMinStaked(address stakingProvider, StakeType stakeTypes)
270+
/// @notice Returns the maximum application authorization
271+
function getMaxAuthorization(address stakingProvider)
333272
external
334273
view
335274
returns (uint96);

0 commit comments

Comments
 (0)