Skip to content

Commit d78cbda

Browse files
committed
Freeze all application except TACo
1 parent 74035ef commit d78cbda

File tree

2 files changed

+27
-4
lines changed

2 files changed

+27
-4
lines changed

contracts/staking/TokenStaking.sol

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,8 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
8383
uint256 internal constant MIN_STAKE_TIME = 24 hours;
8484
uint96 internal constant MAX_STAKE = 15 * 10**(18 + 6); // 15m T
8585
uint96 internal constant HALF_MAX_STAKE = MAX_STAKE / 2; // 7.5m T
86+
address internal constant TACO_APPLICATION =
87+
0x347CC7ede7e5517bD47D20620B2CF1b406edcF07;
8688

8789
/// @custom:oz-upgrades-unsafe-allow state-variable-immutable
8890
T internal immutable token;
@@ -730,20 +732,22 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
730732
.length;
731733

732734
require(authorizedApplications > 0, "Nothing was authorized");
735+
uint256 temp = 0;
733736
for (uint256 i = 0; i < authorizedApplications; i++) {
734737
address application = stakingProviderStruct.authorizedApplications[
735738
i
736739
];
740+
if (skipApplication(application)) {
741+
continue;
742+
}
737743
forceDecreaseAuthorization(
738744
betaStaker,
739745
stakingProviderStruct,
740746
application
741747
);
748+
temp++;
742749
}
743-
cleanAuthorizedApplications(
744-
stakingProviderStruct,
745-
authorizedApplications
746-
);
750+
cleanAuthorizedApplications(stakingProviderStruct, temp);
747751
}
748752

749753
/// @notice Forced deauthorization of stake above 15m T.
@@ -771,6 +775,9 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
771775
address application = stakingProviderStruct.authorizedApplications[
772776
i
773777
];
778+
if (skipApplication(application)) {
779+
continue;
780+
}
774781
maxAuthorization = MathUpgradeable.max(
775782
maxAuthorization,
776783
stakingProviderStruct.authorizations[application].authorized
@@ -957,6 +964,9 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
957964
address application = stakingProviderStruct.authorizedApplications[
958965
i
959966
];
967+
if (skipApplication(application)) {
968+
continue;
969+
}
960970
AppAuthorization storage authorization = stakingProviderStruct
961971
.authorizations[application];
962972
uint96 authorized = authorization.authorized;
@@ -1005,4 +1015,13 @@ contract TokenStaking is Initializable, IStaking, Checkpoints {
10051015
availableToOptOut = (maxAuthorization - optOutAmount) / 2;
10061016
}
10071017
}
1018+
1019+
function skipApplication(address application)
1020+
internal
1021+
pure
1022+
virtual
1023+
returns (bool)
1024+
{
1025+
return application != TACO_APPLICATION;
1026+
}
10081027
}

contracts/test/TokenStakingTestSet.sol

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -285,4 +285,8 @@ contract ExtendedTokenStaking is TokenStaking {
285285
{
286286
newStakeCheckpoint(_delegator, _amount, true);
287287
}
288+
289+
function skipApplication(address) internal pure override returns (bool) {
290+
return false;
291+
}
288292
}

0 commit comments

Comments
 (0)