diff --git a/contracts/interfaces/INodeDriver.sol b/contracts/interfaces/INodeDriver.sol index ae328bb..a8519de 100644 --- a/contracts/interfaces/INodeDriver.sol +++ b/contracts/interfaces/INodeDriver.sol @@ -13,17 +13,7 @@ interface INodeDriver { uint256 deactivatedTime ) external; - function setGenesisDelegation( - address delegator, - uint256 toValidatorID, - uint256 stake, - uint256 lockedStake, - uint256 lockupFromEpoch, - uint256 lockupEndTime, - uint256 lockupDuration, - uint256 earlyUnlockPenalty, - uint256 rewards - ) external; + function setGenesisDelegation(address delegator, uint256 toValidatorID, uint256 stake) external; function deactivateValidator(uint256 validatorID, uint256 status) external; diff --git a/contracts/interfaces/ISFC.sol b/contracts/interfaces/ISFC.sol index 54817a5..93ef4f6 100644 --- a/contracts/interfaces/ISFC.sol +++ b/contracts/interfaces/ISFC.sol @@ -11,23 +11,9 @@ interface ISFC { event Delegated(address indexed delegator, uint256 indexed toValidatorID, uint256 amount); event Undelegated(address indexed delegator, uint256 indexed toValidatorID, uint256 indexed wrID, uint256 amount); event Withdrawn(address indexed delegator, uint256 indexed toValidatorID, uint256 indexed wrID, uint256 amount); - event ClaimedRewards( - address indexed delegator, - uint256 indexed toValidatorID, - uint256 lockupExtraReward, - uint256 lockupBaseReward, - uint256 unlockedReward - ); - event RestakedRewards( - address indexed delegator, - uint256 indexed toValidatorID, - uint256 lockupExtraReward, - uint256 lockupBaseReward, - uint256 unlockedReward - ); + event ClaimedRewards(address indexed delegator, uint256 indexed toValidatorID, uint256 rewards); + event RestakedRewards(address indexed delegator, uint256 indexed toValidatorID, uint256 rewards); event BurntFTM(uint256 amount); - event LockedUpStake(address indexed delegator, uint256 indexed validatorID, uint256 duration, uint256 amount); - event UnlockedStake(address indexed delegator, uint256 indexed validatorID, uint256 amount, uint256 penalty); event UpdatedSlashingRefundRatio(uint256 indexed validatorID, uint256 refundRatio); event RefundedSlashedLegacyDelegation(address indexed delegator, uint256 indexed validatorID, uint256 amount); @@ -53,18 +39,8 @@ interface ISFC { uint256 totalSupply ); - function getLockupInfo( - address, - uint256 - ) external view returns (uint256 lockedStake, uint256 fromEpoch, uint256 endTime, uint256 duration); - function getStake(address, uint256) external view returns (uint256); - function getStashedLockupRewards( - address, - uint256 - ) external view returns (uint256 lockupExtraReward, uint256 lockupBaseReward, uint256 unlockedReward); - function getValidator( uint256 ) @@ -106,8 +82,6 @@ interface ISFC { function totalActiveStake() external view returns (uint256); - function totalSlashedStake() external view returns (uint256); - function totalStake() external view returns (uint256); function totalSupply() external view returns (uint256); @@ -142,8 +116,6 @@ interface ISFC { function rewardsStash(address delegator, uint256 validatorID) external view returns (uint256); - function getLockedStake(address delegator, uint256 toValidatorID) external view returns (uint256); - function createValidator(bytes calldata pubkey) external payable; function getSelfStake(uint256 validatorID) external view returns (uint256); @@ -186,16 +158,6 @@ interface ISFC { function sealEpochValidators(uint256[] calldata nextValidatorIDs) external; - function isLockedUp(address delegator, uint256 toValidatorID) external view returns (bool); - - function getUnlockedStake(address delegator, uint256 toValidatorID) external view returns (uint256); - - function lockStake(uint256 toValidatorID, uint256 lockupDuration, uint256 amount) external; - - function relockStake(uint256 toValidatorID, uint256 lockupDuration, uint256 amount) external; - - function unlockStake(uint256 toValidatorID, uint256 amount) external returns (uint256); - function initialize( uint256 sealedEpoch, uint256 _totalSupply, @@ -215,17 +177,7 @@ interface ISFC { uint256 deactivatedTime ) external; - function setGenesisDelegation( - address delegator, - uint256 toValidatorID, - uint256 stake, - uint256 lockedStake, - uint256 lockupFromEpoch, - uint256 lockupEndTime, - uint256 lockupDuration, - uint256 earlyUnlockPenalty, - uint256 rewards - ) external; + function setGenesisDelegation(address delegator, uint256 toValidatorID, uint256 stake) external; function updateVoteBookAddress(address v) external; diff --git a/contracts/sfc/ConstantsManager.sol b/contracts/sfc/ConstantsManager.sol index b5283ea..42c50c0 100644 --- a/contracts/sfc/ConstantsManager.sol +++ b/contracts/sfc/ConstantsManager.sol @@ -15,12 +15,6 @@ contract ConstantsManager is Ownable { uint256 public burntFeeShare; // The percentage of fees to transfer to treasury address, e.g., 10% uint256 public treasuryFeeShare; - // The ratio of the reward rate at base rate (no lock), e.g., 30% - uint256 public unlockedRewardRatio; - // The minimum duration of a stake/delegation lockup, e.g. 2 weeks - uint256 public minLockupDuration; - // The maximum duration of a stake/delegation lockup, e.g. 1 year - uint256 public maxLockupDuration; // the number of epochs that undelegated stake is locked for uint256 public withdrawalPeriodEpochs; // the number of seconds that undelegated stake is locked for @@ -87,36 +81,6 @@ contract ConstantsManager is Ownable { treasuryFeeShare = v; } - function updateUnlockedRewardRatio(uint256 v) external virtual onlyOwner { - if (v < (5 * Decimal.unit()) / 100) { - revert ValueTooSmall(); - } - if (v > Decimal.unit() / 2) { - revert ValueTooLarge(); - } - unlockedRewardRatio = v; - } - - function updateMinLockupDuration(uint256 v) external virtual onlyOwner { - if (v < 86400) { - revert ValueTooSmall(); - } - if (v > 86400 * 30) { - revert ValueTooLarge(); - } - minLockupDuration = v; - } - - function updateMaxLockupDuration(uint256 v) external virtual onlyOwner { - if (v < 86400 * 30) { - revert ValueTooSmall(); - } - if (v > 86400 * 1460) { - revert ValueTooLarge(); - } - maxLockupDuration = v; - } - function updateWithdrawalPeriodEpochs(uint256 v) external virtual onlyOwner { if (v < 2) { revert ValueTooSmall(); diff --git a/contracts/sfc/NetworkInitializer.sol b/contracts/sfc/NetworkInitializer.sol index 86187ba..ce34811 100644 --- a/contracts/sfc/NetworkInitializer.sol +++ b/contracts/sfc/NetworkInitializer.sol @@ -27,9 +27,6 @@ contract NetworkInitializer { consts.updateValidatorCommission((15 * Decimal.unit()) / 100); consts.updateBurntFeeShare((20 * Decimal.unit()) / 100); consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100); - consts.updateUnlockedRewardRatio((30 * Decimal.unit()) / 100); - consts.updateMinLockupDuration(86400 * 14); - consts.updateMaxLockupDuration(86400 * 365); consts.updateWithdrawalPeriodEpochs(3); consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7); consts.updateBaseRewardPerSecond(2668658453701531600); diff --git a/contracts/sfc/NodeDriver.sol b/contracts/sfc/NodeDriver.sol index d8b7013..99f1a69 100644 --- a/contracts/sfc/NodeDriver.sol +++ b/contracts/sfc/NodeDriver.sol @@ -110,28 +110,8 @@ contract NodeDriver is Initializable { ); } - function setGenesisDelegation( - address delegator, - uint256 toValidatorID, - uint256 stake, - uint256 lockedStake, - uint256 lockupFromEpoch, - uint256 lockupEndTime, - uint256 lockupDuration, - uint256 earlyUnlockPenalty, - uint256 rewards - ) external onlyNode { - backend.setGenesisDelegation( - delegator, - toValidatorID, - stake, - lockedStake, - lockupFromEpoch, - lockupEndTime, - lockupDuration, - earlyUnlockPenalty, - rewards - ); + function setGenesisDelegation(address delegator, uint256 toValidatorID, uint256 stake) external onlyNode { + backend.setGenesisDelegation(delegator, toValidatorID, stake); } function deactivateValidator(uint256 validatorID, uint256 status) external onlyNode { diff --git a/contracts/sfc/NodeDriverAuth.sol b/contracts/sfc/NodeDriverAuth.sol index 8a2a6ce..eab3348 100644 --- a/contracts/sfc/NodeDriverAuth.sol +++ b/contracts/sfc/NodeDriverAuth.sol @@ -138,28 +138,8 @@ contract NodeDriverAuth is Initializable, Ownable { ); } - function setGenesisDelegation( - address delegator, - uint256 toValidatorID, - uint256 stake, - uint256 lockedStake, - uint256 lockupFromEpoch, - uint256 lockupEndTime, - uint256 lockupDuration, - uint256 earlyUnlockPenalty, - uint256 rewards - ) external onlyDriver { - sfc.setGenesisDelegation( - delegator, - toValidatorID, - stake, - lockedStake, - lockupFromEpoch, - lockupEndTime, - lockupDuration, - earlyUnlockPenalty, - rewards - ); + function setGenesisDelegation(address delegator, uint256 toValidatorID, uint256 stake) external onlyDriver { + sfc.setGenesisDelegation(delegator, toValidatorID, stake); } function deactivateValidator(uint256 validatorID, uint256 status) external onlyDriver { diff --git a/contracts/sfc/Updater.sol b/contracts/sfc/Updater.sol index b178199..e3380a2 100644 --- a/contracts/sfc/Updater.sol +++ b/contracts/sfc/Updater.sol @@ -83,9 +83,6 @@ contract Updater { consts.updateValidatorCommission((15 * Decimal.unit()) / 100); consts.updateBurntFeeShare((20 * Decimal.unit()) / 100); consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100); - consts.updateUnlockedRewardRatio((30 * Decimal.unit()) / 100); - consts.updateMinLockupDuration(86400 * 14); - consts.updateMaxLockupDuration(86400 * 365); consts.updateWithdrawalPeriodEpochs(3); consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7); consts.updateBaseRewardPerSecond(2668658453701531600); diff --git a/contracts/test/UnitTestSFC.sol b/contracts/test/UnitTestSFC.sol index f75896b..6b4567c 100644 --- a/contracts/test/UnitTestSFC.sol +++ b/contracts/test/UnitTestSFC.sol @@ -46,18 +46,6 @@ contract UnitTestSFC is SFC { } return SFC.isNode(addr); } - - function highestLockupEpoch(address delegator, uint256 validatorID) external view returns (uint256) { - return _highestLockupEpoch(delegator, validatorID); - } - - function _getAvgEpochStep(uint256) internal pure override returns (uint256) { - return 1; - } - - function _getAvgUptime(uint256, uint256 duration, uint256) internal pure override returns (uint256) { - return duration; - } } contract UnitTestNetworkInitializer { @@ -80,9 +68,6 @@ contract UnitTestNetworkInitializer { consts.updateValidatorCommission((15 * Decimal.unit()) / 100); consts.updateBurntFeeShare((20 * Decimal.unit()) / 100); consts.updateTreasuryFeeShare((10 * Decimal.unit()) / 100); - consts.updateUnlockedRewardRatio((30 * Decimal.unit()) / 100); - consts.updateMinLockupDuration(86400 * 14); - consts.updateMaxLockupDuration(86400 * 365); consts.updateWithdrawalPeriodEpochs(3); consts.updateWithdrawalPeriodTime(60 * 60 * 24 * 7); consts.updateBaseRewardPerSecond(6183414351851851852);