-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into mike/oz-n-04
# Conflicts: # contracts/sfc/NodeDriverAuth.sol
- Loading branch information
Showing
13 changed files
with
318 additions
and
104 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.27; | ||
|
||
/** | ||
* @title Stake Subscriber Interface | ||
* @notice Used to recount votes from delegators in the governance contract | ||
* @custom:security-contact [email protected] | ||
*/ | ||
interface IStakeSubscriber { | ||
function announceStakeChange(address delegator, address validator) 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 |
---|---|---|
@@ -1,13 +1,13 @@ | ||
// SPDX-License-Identifier: UNLICENSED | ||
pragma solidity 0.8.27; | ||
|
||
import {OwnableUpgradeable} from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol"; | ||
import {Ownable} from "@openzeppelin/contracts/access/Ownable.sol"; | ||
import {Decimal} from "../common/Decimal.sol"; | ||
|
||
/** | ||
* @custom:security-contact [email protected] | ||
*/ | ||
contract ConstantsManager is OwnableUpgradeable { | ||
contract ConstantsManager is Ownable { | ||
// Minimum amount of stake for a validator, i.e., 500000 FTM | ||
uint256 public minSelfStake; | ||
// Maximum ratio of delegations a validator can have, say, 15 times of self-stake | ||
|
@@ -37,6 +37,10 @@ contract ConstantsManager is OwnableUpgradeable { | |
// Zero to disable validators deactivation by this metric. | ||
uint64 public minAverageUptime; | ||
|
||
// The address of the recipient that receives issued tokens | ||
// as a counterparty to the burnt FTM tokens | ||
address public issuedTokensRecipient; | ||
|
||
/** | ||
* @dev Given value is too small | ||
*/ | ||
|
@@ -47,15 +51,13 @@ contract ConstantsManager is OwnableUpgradeable { | |
*/ | ||
error ValueTooLarge(); | ||
|
||
constructor(address owner) initializer { | ||
__Ownable_init(owner); | ||
} | ||
constructor(address owner) Ownable(owner) {} | ||
|
||
function updateMinSelfStake(uint256 v) external virtual onlyOwner { | ||
if (v < 100000 * 1e18) { | ||
if (v < 100000 * Decimal.unit()) { | ||
revert ValueTooSmall(); | ||
} | ||
if (v > 10000000 * 1e18) { | ||
if (v > 10000000 * Decimal.unit()) { | ||
revert ValueTooLarge(); | ||
} | ||
minSelfStake = v; | ||
|
@@ -113,10 +115,10 @@ contract ConstantsManager is OwnableUpgradeable { | |
} | ||
|
||
function updateBaseRewardPerSecond(uint256 v) external virtual onlyOwner { | ||
if (v < 0.5 * 1e18) { | ||
if (v < Decimal.unit() / 2) { | ||
revert ValueTooSmall(); | ||
} | ||
if (v > 32 * 1e18) { | ||
if (v > 32 * Decimal.unit()) { | ||
revert ValueTooLarge(); | ||
} | ||
baseRewardPerSecond = v; | ||
|
@@ -179,4 +181,8 @@ contract ConstantsManager is OwnableUpgradeable { | |
} | ||
minAverageUptime = v; | ||
} | ||
|
||
function updateIssuedTokensRecipient(address v) external virtual onlyOwner { | ||
issuedTokensRecipient = v; | ||
} | ||
} |
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
Oops, something went wrong.