Sitelet https://github.com/Fantom-foundation/opera-sfc/commit/302a6101a3d98486a2853b17a271a22572a08648
Skip to content

Commit 302a610

Browse files
committed
Add list of network guardians allowed to stake
1 parent 1bdecf0 commit 302a610

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

‎contracts/sfc/SFCLib.sol‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ contract SFCLib is SFCBase {
105105

106106
function _rawDelegate(address delegator, uint256 toValidatorID, uint256 amount, bool strict) internal {
107107
// Delegations are disabled to protect current chain while migrating to the new sonic chain
108-
revert("delegation disabled");
109-
108+
// Only network guardians are allowed to modify the stake to prevent a potential network hijacking
109+
require(isGuardianAccount(delegator), "delegation disabled");
110110
require(amount > 0, "zero amount");
111111

112112
_stashRewards(delegator, toValidatorID);
@@ -447,7 +447,7 @@ contract SFCLib is SFCBase {
447447
function _lockStake(address delegator, uint256 toValidatorID, uint256 lockupDuration, uint256 amount, bool relock) internal {
448448
// Locks are disabled due to chain migrating to the new sonic chain
449449
revert("stake lock disabled");
450-
450+
/*
451451
require(!_redirected(delegator), "redirected");
452452
require(amount <= getUnlockedStake(delegator, toValidatorID), "not enough stake");
453453
require(getValidator[toValidatorID].status == OK_STATUS, "validator isn't active");
@@ -484,6 +484,7 @@ contract SFCLib is SFCBase {
484484
ld.duration = lockupDuration;
485485
486486
emit LockedUpStake(delegator, toValidatorID, lockupDuration, amount);
487+
*/
487488
}
488489

489490
function lockStake(uint256 toValidatorID, uint256 lockupDuration, uint256 amount) public {
@@ -784,4 +785,24 @@ contract SFCLib is SFCBase {
784785
r.lockupBaseReward = r.lockupBaseReward.mul(maxReasonablePenalty).div(storedPenalty);
785786
}
786787
}
788+
789+
function guardians() public pure returns(address[] memory) {
790+
address[] memory list = new address[](5);
791+
list[0] = 0x0b2E90c831626A65a26f75153Be54aeaAeeb8363;
792+
list[1] = 0x9a5C9EC1E9a10E2fc5fBDDB2D0F37286Ab2fE262;
793+
list[2] = 0xc4D0207D48d96E1f08B3d30eA1f6BE53980E3c56;
794+
list[3] = 0x1e276A3BB8CEeD82deB263Fda2a0575BC7107636;
795+
list[4] = 0x68faE19105C979e5dA7dF4ed55A06B48222b275E;
796+
return list;
797+
}
798+
799+
function isGuardianAccount(address addr) public pure returns (bool) {
800+
address[] memory list = guardians();
801+
for (uint256 i = 0; i < list.length; i++) {
802+
if (addr == list[i]) {
803+
return true;
804+
}
805+
}
806+
return false;
807+
}
787808
}

0 commit comments

Comments
 (0)