Skip to content

Commit 8e120d1

Browse files
committed
Fix formatting
1 parent 3f7be8b commit 8e120d1

2 files changed

Lines changed: 21 additions & 13 deletions

File tree

src/QueryTypeStakingPool.sol

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,8 @@ import {QueryTypeStakerFactory} from "src/QueryTypeStakerFactory.sol";
1111
/// @notice This contract manages staking of tokens for query type pools. Users can stake tokens for
1212
/// a specified lockup and access period. During the lockup period, tokens cannot be withdrawn.
1313
/// After the lockup period ends, users have an access period during which they can withdraw their
14-
/// tokens.
15-
/// The contract maintains a conversion table history that tracks changes to the conversion rate
16-
/// between staked tokens and query credits.
14+
/// tokens. The contract maintains a conversion table history that tracks changes to the conversion
15+
/// rate between staked tokens and query credits.
1716
contract QueryTypeStakingPool is Ownable {
1817
using SafeERC20 for IERC20;
1918

@@ -47,7 +46,7 @@ contract QueryTypeStakingPool is Ownable {
4746

4847
/// @notice A struct containing information about a user's stake, including the amount staked, the
4948
/// index into the conversion table history at time of staking, and the lockup/access period end
50-
/// times.
49+
/// times, and capacity of the stake.
5150
struct StakeInfo {
5251
uint256 amount;
5352
uint256 conversionTableIndex;
@@ -281,7 +280,7 @@ contract QueryTypeStakingPool is Ownable {
281280
if (block.timestamp < userStake.lockupEnd) revert QueryTypeStakingPool__StillInLockupPeriod();
282281
if (_amount > userStake.amount) revert QueryTypeStakingPool__InsufficientBalance();
283282

284-
uint256 _oldUserCapacity = userStake.capacity;
283+
uint256 _oldUserCapacity = userStake.capacity;
285284

286285
userStake.amount -= _amount;
287286
userStake.capacity = userStake.amount;

test/QueryTypeStakingPool.t.sol

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,11 @@ contract QueryTypeStakingPoolTest is Test {
5353
) = pool.stakes(_staker);
5454
}
5555

56-
function _expectedDecay(address _staker, uint256 _amount, uint256 _elapsed) internal view returns (uint256) {
56+
function _expectedDecay(address _staker, uint256 _amount, uint256 _elapsed)
57+
internal
58+
view
59+
returns (uint256)
60+
{
5761
// Get stake info to calculate decay period
5862
QueryTypeStakingPool.StakeInfo memory stakeInfo = _getStakeInfo(_staker);
5963
uint256 totalPeriod = stakeInfo.accessEnd - stakeInfo.lastClaimed;
@@ -297,11 +301,11 @@ contract Stake is QueryTypeStakingPoolTest {
297301
function testFuzz_StakesTokensAfterUsersHaveBeenBlacklisted(
298302
uint48 _amount,
299303
uint128 _capacity,
300-
address _blockedStaker
304+
address _blockedStaker
301305
) public {
302306
vm.assume(_blockedStaker != address(0));
303307
// Stake greater than staking capacity
304-
// total blocked is greater than the difference
308+
// total blocked is greater than the difference
305309
_capacity = uint128(bound(_capacity, 4, type(uint128).max));
306310
_amount = uint48(bound(_amount, 2, _capacity - 2));
307311

@@ -323,10 +327,9 @@ contract Stake is QueryTypeStakingPoolTest {
323327

324328
pool.blocklist(_blockedStaker);
325329

326-
vm.expectRevert(QueryTypeStakingPool.QueryTypeStakingPool__CapacityExceeded.selector);
330+
vm.expectRevert(QueryTypeStakingPool.QueryTypeStakingPool__CapacityExceeded.selector);
327331
vm.prank(staker);
328332
pool.stake(_capacity);
329-
330333
}
331334

332335
function testFuzz_RevertIf_StakeAmountBelowMinimum(
@@ -527,7 +530,10 @@ contract Unstake is QueryTypeStakingPoolTest {
527530
assertEq(remainingStakeAfter.amount, _remainingStake - _unstakeAmt);
528531
assertEq(remainingStakeAfter.capacity, remainingStakeAfter.amount);
529532

530-
assertEq(pool.totalCapacityStaked(), _stakeAmount - _unstakeAmt - (_preDecayStake.amount - _remainingStake));
533+
assertEq(
534+
pool.totalCapacityStaked(),
535+
_stakeAmount - _unstakeAmt - (_preDecayStake.amount - _remainingStake)
536+
);
531537
}
532538

533539
function testFuzz_UnstakeAfterMultipleStakes(
@@ -571,7 +577,10 @@ contract Unstake is QueryTypeStakingPoolTest {
571577
QueryTypeStakingPool.StakeInfo memory remainingStakeAfter = _getStakeInfo(staker);
572578
assertEq(remainingStakeAfter.amount, _remainingStake - _unstakeAmt);
573579
assertEq(remainingStakeAfter.capacity, remainingStakeAfter.amount);
574-
assertEq(pool.totalCapacityStaked(), totalStaked - _unstakeAmt - (preDecayStake.amount - _remainingStake));
580+
assertEq(
581+
pool.totalCapacityStaked(),
582+
totalStaked - _unstakeAmt - (preDecayStake.amount - _remainingStake)
583+
);
575584
}
576585

577586
function testFuzz_RevertIf_TokenTransferFails(
@@ -1069,7 +1078,7 @@ contract Blocklist is QueryTypeStakingPoolTest {
10691078

10701079
// User unstakes full amount
10711080
uint256 userBalanceBefore = stakingToken.balanceOf(user);
1072-
uint256 _decayed = _expectedDecay(user, stakeAmount, pool.lockupPeriod() + 1);
1081+
uint256 _decayed = _expectedDecay(user, stakeAmount, pool.lockupPeriod() + 1);
10731082

10741083
vm.prank(user);
10751084
pool.unstake(stakeAmount - _decayed);

0 commit comments

Comments
 (0)