Skip to content

Commit

Permalink
feat: txs
Browse files Browse the repository at this point in the history
  • Loading branch information
0xrajath committed Dec 16, 2024
1 parent fde4f3d commit 6385a71
Showing 1 changed file with 40 additions and 0 deletions.
40 changes: 40 additions & 0 deletions script/TestRewardsV2.s.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,42 @@ contract TestRewardsV2 is Script {
strategy: STRATEGY_STETH,
multiplier: 1e18
});

defaultStrategyAndMultipliers = _sortStrategyArrayAsc(defaultStrategyAndMultipliers);
}

function _sortStrategyArrayAsc(
IStrategy[] memory arr
) internal pure returns (IStrategy[] memory) {
uint256 l = arr.length;
for (uint256 i = 0; i < l; i++) {
for (uint256 j = i + 1; j < l; j++) {
if (address(arr[i]) > address(arr[j])) {
IStrategy temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}


/// @dev Sort to ensure that the array is in ascending order for addresses
function _sortAddressArrayAsc(
address[] memory arr
) internal pure returns (address[] memory) {
uint256 l = arr.length;
for (uint256 i = 0; i < l; i++) {
for (uint256 j = i + 1; j < l; j++) {
if (arr[i] > arr[j]) {
address temp = arr[i];
arr[i] = arr[j];
arr[j] = temp;
}
}
}
return arr;
}

function tx_1() public {
Expand Down Expand Up @@ -103,6 +139,8 @@ contract TestRewardsV2 is Script {
amount: 1e18
});

operatorRewards = _sortAddressArrayAsc(operatorRewards);

IRewardsCoordinator.OperatorDirectedRewardsSubmission[]
memory rewardsSubmissions = new IRewardsCoordinator.OperatorDirectedRewardsSubmission[](
1
Expand Down Expand Up @@ -135,6 +173,8 @@ contract TestRewardsV2 is Script {
amount: 1e18
});

operatorRewards = _sortAddressArrayAsc(operatorRewards);

IRewardsCoordinator.OperatorDirectedRewardsSubmission[]
memory rewardsSubmissions = new IRewardsCoordinator.OperatorDirectedRewardsSubmission[](
1
Expand Down

0 comments on commit 6385a71

Please sign in to comment.