-
Notifications
You must be signed in to change notification settings - Fork 18
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Adding interface for applications that use operator role and delay in… #157
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
1977de7
Adding interface for applications that use operator role and delay in…
vzotova 6b3f674
Apply suggestions from code review
vzotova c440eeb
IApplicationWithOperator: added method `operatorToStakingProvider`
vzotova 9b61552
IApplicationWithOperator: removes optional `registerOperator`
vzotova File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
// ██████████████ ▐████▌ ██████████████ | ||
// ██████████████ ▐████▌ ██████████████ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ██████████████ ▐████▌ ██████████████ | ||
// ██████████████ ▐████▌ ██████████████ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
|
||
pragma solidity ^0.8.9; | ||
|
||
import "./IApplication.sol"; | ||
|
||
/// @title Interface for Threshold Network applications with delay after decrease request | ||
interface IApplicationWithDecreaseDelay is IApplication { | ||
/// @notice Returns authorization-related parameters of the application. | ||
/// @dev The minimum authorization is also returned by `minimumAuthorization()` | ||
/// function, as a requirement of `IApplication` interface. | ||
/// @return _minimumAuthorization The minimum authorization amount required | ||
/// so that operator can participate in the application. | ||
/// @return authorizationDecreaseDelay Delay in seconds that needs to pass | ||
/// between the time authorization decrease is requested and the | ||
/// time that request gets approved. Protects against participants | ||
/// earning rewards and not being active in the network. | ||
/// @return authorizationDecreaseChangePeriod Authorization decrease change | ||
/// period in seconds. It is the time window, before authorization decrease | ||
/// delay ends, during which the pending authorization decrease | ||
/// request can be overwritten. | ||
/// If set to 0, pending authorization decrease request can not be | ||
/// overwritten until the entire `authorizationDecreaseDelay` ends. | ||
/// If set to a value equal to `authorizationDecreaseDelay`, request can | ||
/// always be overwritten. | ||
function authorizationParameters() | ||
external | ||
view | ||
returns ( | ||
uint96 _minimumAuthorization, | ||
uint64 authorizationDecreaseDelay, | ||
uint64 authorizationDecreaseChangePeriod | ||
); | ||
|
||
/// @notice Returns the amount of stake that is pending authorization | ||
/// decrease for the given staking provider. If no authorization | ||
/// decrease has been requested, returns zero. | ||
function pendingAuthorizationDecrease(address _stakingProvider) | ||
external | ||
view | ||
returns (uint96); | ||
|
||
/// @notice Returns the remaining time in seconds that needs to pass before | ||
/// the requested authorization decrease can be approved. | ||
function remainingAuthorizationDecreaseDelay(address stakingProvider) | ||
external | ||
view | ||
returns (uint64); | ||
|
||
/// @notice Approves the previously registered authorization decrease | ||
/// request. Reverts if authorization decrease delay has not passed | ||
/// yet or if the authorization decrease was not requested for the | ||
/// given staking provider. | ||
function approveAuthorizationDecrease(address stakingProvider) external; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
|
||
// ██████████████ ▐████▌ ██████████████ | ||
// ██████████████ ▐████▌ ██████████████ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ██████████████ ▐████▌ ██████████████ | ||
// ██████████████ ▐████▌ ██████████████ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
// ▐████▌ ▐████▌ | ||
|
||
pragma solidity ^0.8.9; | ||
|
||
import "./IApplication.sol"; | ||
|
||
/// @title Interface for Threshold Network applications with operator role | ||
interface IApplicationWithOperator is IApplication { | ||
/// @notice Returns operator registered for the given staking provider. | ||
function stakingProviderToOperator(address stakingProvider) | ||
external | ||
view | ||
returns (address); | ||
|
||
/// @notice Returns staking provider of the given operator. | ||
function operatorToStakingProvider(address operator) | ||
external | ||
view | ||
returns (address); | ||
|
||
/// @notice Used by staking provider to set operator address that will | ||
/// operate a node. The operator address must be unique. | ||
/// Reverts if the operator is already set for the staking provider | ||
/// or if the operator address is already in use. | ||
/// @dev Depending on application the given staking provider can set operator | ||
/// address only once or multiple times. Besides that, application can decide | ||
/// if function reverts if there is a pending authorization decrease for | ||
/// the staking provider. | ||
function registerOperator(address operator) external; | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why the
_
here? Same for_stakingProvider
in L51.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
otherwise it shadows
function minimumAuthorization