33pragma solidity 0.8.27 ;
44
55import { IGraphPayments } from "../../interfaces/IGraphPayments.sol " ;
6+ import { IHorizonStakingTypes } from "./IHorizonStakingTypes.sol " ;
67
78/**
89 * @title Inferface for the {HorizonStaking} contract.
@@ -205,6 +206,15 @@ interface IHorizonStakingMain {
205206 uint256 tokens
206207 );
207208
209+ /**
210+ * @notice Emitted when `delegator` withdrew delegated `tokens` from `indexer` using `withdrawDelegated`.
211+ * @dev This event is for the legacy `withdrawDelegated` function.
212+ * @param indexer The address of the indexer
213+ * @param delegator The address of the delegator
214+ * @param tokens The amount of tokens withdrawn
215+ */
216+ event StakeDelegatedWithdrawn (address indexed indexer , address indexed delegator , uint256 tokens );
217+
208218 /**
209219 * @notice Emitted when tokens are added to a delegation pool's reserve.
210220 * @param serviceProvider The address of the service provider
@@ -271,13 +281,15 @@ interface IHorizonStakingMain {
271281 * @param owner The address of the owner of the thaw requests
272282 * @param thawRequestsFulfilled The number of thaw requests fulfilled
273283 * @param tokens The total amount of tokens being released
284+ * @param requestType The type of thaw request
274285 */
275286 event ThawRequestsFulfilled (
276287 address indexed serviceProvider ,
277288 address indexed verifier ,
278289 address indexed owner ,
279290 uint256 thawRequestsFulfilled ,
280- uint256 tokens
291+ uint256 tokens ,
292+ IHorizonStakingTypes.ThawRequestType requestType
281293 );
282294
283295 // -- Events: governance --
@@ -303,9 +315,8 @@ interface IHorizonStakingMain {
303315
304316 /**
305317 * @notice Emitted when the delegation slashing global flag is set.
306- * @param enabled Whether delegation slashing is enabled or disabled.
307318 */
308- event DelegationSlashingEnabled (bool enabled );
319+ event DelegationSlashingEnabled ();
309320
310321 // -- Errors: tokens
311322
@@ -415,6 +426,20 @@ interface IHorizonStakingMain {
415426 */
416427 error HorizonStakingInvalidDelegationPool (address serviceProvider , address verifier );
417428
429+ /**
430+ * @notice Thrown when the minimum token amount required for delegation is not met.
431+ * @param tokens The actual token amount
432+ * @param minTokens The minimum required token amount
433+ */
434+ error HorizonStakingInsufficientDelegationTokens (uint256 tokens , uint256 minTokens );
435+
436+ /**
437+ * @notice Thrown when the minimum token amount required for undelegation with beneficiary is not met.
438+ * @param tokens The actual token amount
439+ * @param minTokens The minimum required token amount
440+ */
441+ error HorizonStakingInsufficientUndelegationTokens (uint256 tokens , uint256 minTokens );
442+
418443 /**
419444 * @notice Thrown when attempting to undelegate with a beneficiary that is the zero address.
420445 */
@@ -515,6 +540,8 @@ interface IHorizonStakingMain {
515540 * - During the transition period it's locked for a period of time before it can be withdrawn
516541 * by calling {withdraw}.
517542 * - After the transition period it's immediately withdrawn.
543+ * Note that after the transition period if there are tokens still locked they will have to be
544+ * withdrawn by calling {withdraw}.
518545 * @dev Requirements:
519546 * - `_tokens` cannot be zero.
520547 * - `_serviceProvider` must have enough idle stake to cover the staking amount and any
@@ -747,7 +774,7 @@ interface IHorizonStakingMain {
747774 * @param beneficiary The address where the tokens will be withdrawn after thawing
748775 * @return The ID of the thaw request
749776 */
750- function undelegate (
777+ function undelegateWithBeneficiary (
751778 address serviceProvider ,
752779 address verifier ,
753780 uint256 shares ,
@@ -772,6 +799,28 @@ interface IHorizonStakingMain {
772799 */
773800 function withdrawDelegated (address serviceProvider , address verifier , uint256 nThawRequests ) external ;
774801
802+ /**
803+ * @notice Withdraw undelegated with beneficiary tokens from a provision after thawing.
804+ * @dev The parameter `nThawRequests` can be set to a non zero value to fulfill a specific number of thaw
805+ * requests in the event that fulfilling all of them results in a gas limit error.
806+ * @dev If the delegation pool was completely slashed before withdrawing, calling this function will fulfill
807+ * the thaw requests with an amount equal to zero.
808+ *
809+ * Requirements:
810+ * - Must have previously initiated a thaw request using {undelegateWithBeneficiary}.
811+ *
812+ * Emits {ThawRequestFulfilled}, {ThawRequestsFulfilled} and {DelegatedTokensWithdrawn} events.
813+ *
814+ * @param serviceProvider The service provider address
815+ * @param verifier The verifier address
816+ * @param nThawRequests The number of thaw requests to fulfill. Set to 0 to fulfill all thaw requests.
817+ */
818+ function withdrawDelegatedWithBeneficiary (
819+ address serviceProvider ,
820+ address verifier ,
821+ uint256 nThawRequests
822+ ) external ;
823+
775824 /**
776825 * @notice Re-delegate undelegated tokens from a provision after thawing to a `newServiceProvider` and `newVerifier`.
777826 * @dev The parameter `nThawRequests` can be set to a non zero value to fulfill a specific number of thaw
@@ -838,13 +887,14 @@ interface IHorizonStakingMain {
838887 /**
839888 * @notice Withdraw undelegated tokens from the subgraph data service provision after thawing.
840889 * This function is for backwards compatibility with the legacy staking contract.
841- * It only allows withdrawing from the subgraph data service and DOES NOT have slippage protection in
842- * case the caller opts for re-delegating.
890+ * It only allows withdrawing tokens undelegated before horizon upgrade.
843891 * @dev See {delegate}.
844892 * @param serviceProvider The service provider address
845- * @param newServiceProvider The address of a new service provider, if the delegator wants to re-delegate
846893 */
847- function withdrawDelegated (address serviceProvider , address newServiceProvider ) external ;
894+ function withdrawDelegated (
895+ address serviceProvider ,
896+ address // newServiceProvider, deprecated
897+ ) external returns (uint256 );
848898
849899 /**
850900 * @notice Slash a service provider. This can only be called by a verifier to which
0 commit comments