-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
631 additions
and
24 deletions.
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
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
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
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
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,120 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
/* | ||
IDelegationController.sol - SKALE Manager | ||
Copyright (C) 2018-Present SKALE Labs | ||
@author Artem Payvin | ||
SKALE Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SKALE Manager is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
pragma solidity >=0.6.10 <0.9.0; | ||
|
||
interface IDelegationController { | ||
enum State { | ||
PROPOSED, | ||
ACCEPTED, | ||
CANCELED, | ||
REJECTED, | ||
DELEGATED, | ||
UNDELEGATION_REQUESTED, | ||
COMPLETED | ||
} | ||
|
||
struct Delegation { | ||
address holder; // address of token owner | ||
uint validatorId; | ||
uint amount; | ||
uint delegationPeriod; | ||
uint created; // time of delegation creation | ||
uint started; // month when a delegation becomes active | ||
uint finished; // first month after a delegation ends | ||
string info; | ||
} | ||
|
||
/** | ||
* @dev Emitted when validator was confiscated. | ||
*/ | ||
event Confiscated( | ||
uint indexed validatorId, | ||
uint amount | ||
); | ||
|
||
/** | ||
* @dev Emitted when validator was confiscated. | ||
*/ | ||
event SlashesProcessed( | ||
address indexed holder, | ||
uint limit | ||
); | ||
|
||
/** | ||
* @dev Emitted when a delegation is proposed to a validator. | ||
*/ | ||
event DelegationProposed( | ||
uint delegationId | ||
); | ||
|
||
/** | ||
* @dev Emitted when a delegation is accepted by a validator. | ||
*/ | ||
event DelegationAccepted( | ||
uint delegationId | ||
); | ||
|
||
/** | ||
* @dev Emitted when a delegation is cancelled by the delegator. | ||
*/ | ||
event DelegationRequestCanceledByUser( | ||
uint delegationId | ||
); | ||
|
||
/** | ||
* @dev Emitted when a delegation is requested to undelegate. | ||
*/ | ||
event UndelegationRequested( | ||
uint delegationId | ||
); | ||
|
||
function getAndUpdateDelegatedToValidatorNow(uint validatorId) external returns (uint); | ||
function getAndUpdateDelegatedAmount(address holder) external returns (uint); | ||
function getAndUpdateEffectiveDelegatedByHolderToValidator(address holder, uint validatorId, uint month) | ||
external | ||
returns (uint effectiveDelegated); | ||
function delegate( | ||
uint validatorId, | ||
uint amount, | ||
uint delegationPeriod, | ||
string calldata info | ||
) | ||
external; | ||
function cancelPendingDelegation(uint delegationId) external; | ||
function acceptPendingDelegation(uint delegationId) external; | ||
function requestUndelegation(uint delegationId) external; | ||
function confiscate(uint validatorId, uint amount) external; | ||
function getAndUpdateEffectiveDelegatedToValidator(uint validatorId, uint month) external returns (uint); | ||
function getAndUpdateDelegatedByHolderToValidatorNow(address holder, uint validatorId) external returns (uint); | ||
function processSlashes(address holder, uint limit) external; | ||
function processAllSlashes(address holder) external; | ||
function getEffectiveDelegatedValuesByValidator(uint validatorId) external view returns (uint[] memory); | ||
function getEffectiveDelegatedToValidator(uint validatorId, uint month) external view returns (uint); | ||
function getDelegatedToValidator(uint validatorId, uint month) external view returns (uint); | ||
function getDelegation(uint delegationId) external view returns (Delegation memory); | ||
function getFirstDelegationMonth(address holder, uint validatorId) external view returns(uint); | ||
function getDelegationsByValidatorLength(uint validatorId) external view returns (uint); | ||
function getDelegationsByHolderLength(address holder) external view returns (uint); | ||
function getState(uint delegationId) external view returns (State state); | ||
function getLockedInPendingDelegations(address holder) external view returns (uint); | ||
function hasUnprocessedSlashes(address holder) external view returns (bool); | ||
} |
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,35 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
/* | ||
IDelegationPeriodManager.sol - SKALE Manager | ||
Copyright (C) 2018-Present SKALE Labs | ||
@author Artem Payvin | ||
SKALE Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SKALE Manager is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
pragma solidity >=0.6.10 <0.9.0; | ||
|
||
interface IDelegationPeriodManager { | ||
/** | ||
* @dev Emitted when a new delegation period is specified. | ||
*/ | ||
event DelegationPeriodWasSet( | ||
uint length, | ||
uint stakeMultiplier | ||
); | ||
|
||
function setDelegationPeriod(uint monthsCount, uint stakeMultiplier) external; | ||
function isDelegationPeriodAllowed(uint monthsCount) external view returns (bool); | ||
} |
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,60 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
/* | ||
IDistributor.sol - SKALE Manager | ||
Copyright (C) 2018-Present SKALE Labs | ||
@author Artem Payvin | ||
SKALE Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SKALE Manager is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
pragma solidity >=0.6.10 <0.9.0; | ||
|
||
interface IDistributor { | ||
/** | ||
* @dev Emitted when bounty is withdrawn. | ||
*/ | ||
event WithdrawBounty( | ||
address holder, | ||
uint validatorId, | ||
address destination, | ||
uint amount | ||
); | ||
|
||
/** | ||
* @dev Emitted when a validator fee is withdrawn. | ||
*/ | ||
event WithdrawFee( | ||
uint validatorId, | ||
address destination, | ||
uint amount | ||
); | ||
|
||
/** | ||
* @dev Emitted when bounty is distributed. | ||
*/ | ||
event BountyWasPaid( | ||
uint validatorId, | ||
uint amount | ||
); | ||
|
||
function getAndUpdateEarnedBountyAmount(uint validatorId) external returns (uint earned, uint endMonth); | ||
function withdrawBounty(uint validatorId, address to) external; | ||
function withdrawFee(address to) external; | ||
function getAndUpdateEarnedBountyAmountOf(address wallet, uint validatorId) | ||
external | ||
returns (uint earned, uint endMonth); | ||
function getEarnedFeeAmount() external view returns (uint earned, uint endMonth); | ||
function getEarnedFeeAmountOf(uint validatorId) external view returns (uint earned, uint endMonth); | ||
} |
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,44 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
/* | ||
IPunisher.sol - SKALE Manager | ||
Copyright (C) 2018-Present SKALE Labs | ||
@author Artem Payvin | ||
SKALE Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SKALE Manager is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
pragma solidity >=0.6.10 <0.9.0; | ||
|
||
interface IPunisher { | ||
/** | ||
* @dev Emitted upon slashing condition. | ||
*/ | ||
event Slash( | ||
uint validatorId, | ||
uint amount | ||
); | ||
|
||
/** | ||
* @dev Emitted upon forgive condition. | ||
*/ | ||
event Forgive( | ||
address wallet, | ||
uint amount | ||
); | ||
|
||
function slash(uint validatorId, uint amount) external; | ||
function forgive(address holder, uint amount) external; | ||
function handleSlash(address holder, uint amount) 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,33 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
/* | ||
ITimeHelpers.sol - SKALE Manager | ||
Copyright (C) 2018-Present SKALE Labs | ||
@author Artem Payvin | ||
SKALE Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SKALE Manager is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
pragma solidity >=0.6.10 <0.9.0; | ||
|
||
interface ITimeHelpers { | ||
function calculateProofOfUseLockEndTime(uint month, uint lockUpPeriodDays) external view returns (uint timestamp); | ||
function getCurrentMonth() external view returns (uint); | ||
function timestampToYear(uint timestamp) external view returns (uint); | ||
function timestampToMonth(uint timestamp) external view returns (uint); | ||
function monthToTimestamp(uint month) external view returns (uint timestamp); | ||
function addDays(uint fromTimestamp, uint n) external pure returns (uint); | ||
function addMonths(uint fromTimestamp, uint n) external pure returns (uint); | ||
function addYears(uint fromTimestamp, uint n) external pure returns (uint); | ||
} |
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,41 @@ | ||
// SPDX-License-Identifier: AGPL-3.0-only | ||
|
||
/* | ||
ITokenState.sol - SKALE Manager | ||
Copyright (C) 2018-Present SKALE Labs | ||
@author Artem Payvin | ||
SKALE Manager is free software: you can redistribute it and/or modify | ||
it under the terms of the GNU Affero General Public License as published | ||
by the Free Software Foundation, either version 3 of the License, or | ||
(at your option) any later version. | ||
SKALE Manager is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU Affero General Public License for more details. | ||
You should have received a copy of the GNU Affero General Public License | ||
along with SKALE Manager. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
pragma solidity >=0.6.10 <0.9.0; | ||
|
||
interface ITokenState { | ||
/** | ||
* @dev Emitted when a contract is added to the locker. | ||
*/ | ||
event LockerWasAdded( | ||
string locker | ||
); | ||
|
||
/** | ||
* @dev Emitted when a contract is removed from the locker. | ||
*/ | ||
event LockerWasRemoved( | ||
string locker | ||
); | ||
|
||
function removeLocker(string calldata locker) external; | ||
function addLocker(string memory locker) external; | ||
} |
Oops, something went wrong.