Skip to content

Commit 2e0b108

Browse files
Merge remote-tracking branch 'origin/main' into deployment-script
2 parents b1b6073 + ffba678 commit 2e0b108

15 files changed

+8664
-101
lines changed

contracts/governance/Checkpoints.sol

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: MIT
22

3-
pragma solidity ^0.8.0;
3+
pragma solidity 0.8.9;
44

55
import "@openzeppelin/contracts/utils/cryptography/ECDSA.sol";
66
import "@openzeppelin/contracts/utils/math/Math.sol";

contracts/staking/IApplication.sol

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// SPDX-License-Identifier: GPL-3.0-or-later
22

3-
pragma solidity 0.8.4;
3+
pragma solidity 0.8.9;
44

55
/// @title Application interface for Threshold Network applications
66
/// @notice Generic interface for an application. Application is an external
@@ -9,25 +9,25 @@ pragma solidity 0.8.4;
99
/// operator are eligible to slash the stake delegated to that operator.
1010
interface IApplication {
1111
/// @notice Used by T staking contract to inform the application that the
12-
/// authorized amount for the given operator increased. The
13-
/// application may do any necessary housekeeping.
14-
function authorizationIncreased(address worker, uint256 amount) external;
12+
/// authorized amount for the given operator increased to the
13+
/// given amount. The application may do any necessary housekeeping.
14+
function authorizationIncreased(address operator, uint96 amount) external;
1515

1616
/// @notice Used by T staking contract to inform the application that the
1717
/// given operator requested to decrease the authorization to the
1818
/// given amount. The application should mark the authorization as
1919
/// pending decrease and respond to the staking contract with
2020
/// `approveAuthorizationDecrease` at its discretion. It may
2121
/// happen right away but it also may happen several months later.
22-
function authorizationDecreaseRequested(address worker, uint256 amount)
22+
function authorizationDecreaseRequested(address operator, uint96 amount)
2323
external;
2424

2525
/// @notice Used by T staking contract to inform the application the
2626
/// authorization has been decreased for the given operator to the
2727
/// given amount involuntarily, as a result of slashing. Lets the
2828
/// application to do any housekeeping neccessary. Called with 250k
2929
/// gas limit and does not revert the transaction if
30-
/// `involuntaryAllocationDecrease` call failed.
31-
function involuntaryAllocationDecrease(address worker, uint256 amount)
30+
/// `involuntaryAuthorizationDecrease` call failed.
31+
function involuntaryAuthorizationDecrease(address operator, uint96 amount)
3232
external;
3333
}
+92
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
// SPDX-License-Identifier: GPL-3.0-or-later
2+
3+
pragma solidity 0.8.9;
4+
5+
/// @title IKeepTokenStaking
6+
/// @notice Interface for Keep TokenStaking contract
7+
interface IKeepTokenStaking {
8+
/// @notice Seize provided token amount from every member in the misbehaved
9+
/// operators array. The tattletale is rewarded with 5% of the total seized
10+
/// amount scaled by the reward adjustment parameter and the rest 95% is burned.
11+
/// @param amountToSeize Token amount to seize from every misbehaved operator.
12+
/// @param rewardMultiplier Reward adjustment in percentage. Min 1% and 100% max.
13+
/// @param tattletale Address to receive the 5% reward.
14+
/// @param misbehavedOperators Array of addresses to seize the tokens from.
15+
function seize(
16+
uint256 amountToSeize,
17+
uint256 rewardMultiplier,
18+
address tattletale,
19+
address[] memory misbehavedOperators
20+
) external;
21+
22+
/// @notice Gets stake delegation info for the given operator.
23+
/// @param operator Operator address.
24+
/// @return amount The amount of tokens the given operator delegated.
25+
/// @return createdAt The time when the stake has been delegated.
26+
/// @return undelegatedAt The time when undelegation has been requested.
27+
/// If undelegation has not been requested, 0 is returned.
28+
function getDelegationInfo(address operator)
29+
external
30+
view
31+
returns (
32+
uint256 amount,
33+
uint256 createdAt,
34+
uint256 undelegatedAt
35+
);
36+
37+
/// @notice Gets the stake owner for the specified operator address.
38+
/// @return Stake owner address.
39+
function ownerOf(address operator) external view returns (address);
40+
41+
/// @notice Gets the beneficiary for the specified operator address.
42+
/// @return Beneficiary address.
43+
function beneficiaryOf(address operator)
44+
external
45+
view
46+
returns (address payable);
47+
48+
/// @notice Gets the authorizer for the specified operator address.
49+
/// @return Authorizer address.
50+
function authorizerOf(address operator) external view returns (address);
51+
52+
/// @notice Gets the eligible stake balance of the specified address.
53+
/// An eligible stake is a stake that passed the initialization period
54+
/// and is not currently undelegating. Also, the operator had to approve
55+
/// the specified operator contract.
56+
///
57+
/// Operator with a minimum required amount of eligible stake can join the
58+
/// network and participate in new work selection.
59+
///
60+
/// @param operator address of stake operator.
61+
/// @param operatorContract address of operator contract.
62+
/// @return balance an uint256 representing the eligible stake balance.
63+
function eligibleStake(address operator, address operatorContract)
64+
external
65+
view
66+
returns (uint256 balance);
67+
}
68+
69+
/// @title INuCypherStakingEscrow
70+
/// @notice Interface for NuCypher StakingEscrow contract
71+
interface INuCypherStakingEscrow {
72+
/// @notice Slash the staker's stake and reward the investigator
73+
/// @param staker Staker's address
74+
/// @param penalty Penalty
75+
/// @param investigator Investigator
76+
/// @param reward Reward for the investigator
77+
function slashStaker(
78+
address staker,
79+
uint256 penalty,
80+
address investigator,
81+
uint256 reward
82+
) external;
83+
84+
/// @notice Request merge between NuCypher staking contract and T staking contract.
85+
/// Returns amount of staked tokens
86+
function requestMerge(address staker, address operator)
87+
external
88+
returns (uint256);
89+
90+
/// @notice Get all tokens belonging to the staker
91+
function getAllTokens(address staker) external view returns (uint256);
92+
}

0 commit comments

Comments
 (0)