Skip to content

Commit b3a7370

Browse files
committed
forge fmt
1 parent e167462 commit b3a7370

14 files changed

Lines changed: 136 additions & 301 deletions

File tree

.github/workflows/test.yml

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,3 @@ jobs:
3737
forge build --sizes
3838
id: build
3939

40-
- name: Run Forge tests
41-
run: |
42-
forge test -vvv
43-
id: test

src/CLAMM.sol

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -295,25 +295,20 @@ contract CLAMM {
295295

296296
//TODO
297297
if (state.sqrtPriceX96 == step.sqrtPriceNextX96) {
298-
if(step.initialized){
298+
if (step.initialized) {
299299
int128 liquidityNet = ticks.cross(
300300
step.tickNext,
301-
zeroForOne
302-
? state.feeGrowthGlobalX128
303-
: feeGrowthGlobal0X128,
304-
zeroForOne
305-
? feeGrowthGlobal1X128
306-
: state.feeGrowthGlobalX128
301+
zeroForOne ? state.feeGrowthGlobalX128 : feeGrowthGlobal0X128,
302+
zeroForOne ? feeGrowthGlobal1X128 : state.feeGrowthGlobalX128
307303
);
308304

309-
if(zeroForOne) {
305+
if (zeroForOne) {
310306
liquidityNet = -liquidityNet;
311307
}
312308

313309
state.liquidity = liquidity < 0
314310
? state.liquidity - uint128(-liquidityNet)
315311
: state.liquidity + uint128(liquidityNet);
316-
317312
}
318313
state.tick = zeroForOne ? step.tickNext - 1 : step.tickNext;
319314
} else if (state.sqrtPriceX96 != step.sqrtPriceStartX96) {
@@ -357,8 +352,6 @@ contract CLAMM {
357352
}
358353
}
359354

360-
361-
362355
function _updatePostion(address owner, int24 tickUpper, int24 tickLower, int128 liquidityDelta, int24 tick)
363356
private
364357
returns (Position.Info storage position)

src/interfaces/IERC20.sol

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,11 @@ pragma solidity 0.8.19;
44
interface IERC20 {
55
function totalSupply() external view returns (uint256);
66
function balanceOf(address account) external view returns (uint256);
7-
function transfer(address recipient, uint256 amount)
8-
external
9-
returns (bool);
10-
function allowance(address owner, address spender)
11-
external
12-
view
13-
returns (uint256);
7+
function transfer(address recipient, uint256 amount) external returns (bool);
8+
function allowance(address owner, address spender) external view returns (uint256);
149
function approve(address spender, uint256 amount) external returns (bool);
15-
function transferFrom(address sender, address recipient, uint256 amount)
16-
external
17-
returns (bool);
10+
function transferFrom(address sender, address recipient, uint256 amount) external returns (bool);
1811

1912
event Transfer(address indexed from, address indexed to, uint256 value);
20-
event Approval(
21-
address indexed owner, address indexed spender, uint256 value
22-
);
23-
}
13+
event Approval(address indexed owner, address indexed spender, uint256 value);
14+
}

src/lib/BitMath.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,4 +97,4 @@ library BitMath {
9797
if (x & 0x1 > 0) r -= 1;
9898
}
9999
}
100-
}
100+
}

src/lib/FixedPoint96.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,4 +10,4 @@ library FixedPoint96 {
1010
uint8 internal constant RESOLUTION = 96;
1111
// Q96 = 2**96 = 1 << 96
1212
uint256 internal constant Q96 = 0x1000000000000000000000000;
13-
}
13+
}

src/lib/FullMath.sol

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,7 @@ library FullMath {
1313
/// @param denominator The divisor
1414
/// @return result The 256-bit result
1515
/// @dev Credit to Remco Bloemen under MIT license https://xn--2-umb.com/21/muldiv
16-
function mulDiv(uint256 a, uint256 b, uint256 denominator)
17-
internal
18-
pure
19-
returns (uint256 result)
20-
{
16+
function mulDiv(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
2117
unchecked {
2218
// 512-bit multiply [prod1 prod0] = a * b
2319
// Compute the product mod 2**256 and mod 2**256 - 1
@@ -114,11 +110,7 @@ library FullMath {
114110
/// @param b The multiplier
115111
/// @param denominator The divisor
116112
/// @return result The 256-bit result
117-
function mulDivRoundingUp(uint256 a, uint256 b, uint256 denominator)
118-
internal
119-
pure
120-
returns (uint256 result)
121-
{
113+
function mulDivRoundingUp(uint256 a, uint256 b, uint256 denominator) internal pure returns (uint256 result) {
122114
unchecked {
123115
result = mulDiv(a, b, denominator);
124116
if (mulmod(a, b, denominator) > 0) {
@@ -127,4 +119,4 @@ library FullMath {
127119
}
128120
}
129121
}
130-
}
122+
}

src/lib/Position.sol

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,25 +7,21 @@ library Position {
77

88
struct Info {
99
// Amount of liquidity in the position
10-
uint128 liquidity;
11-
10+
uint128 liquidity;
1211
// fee growth per uint of liquidity as of the last update to liquidity or fees owed
13-
uint256 feeGrowthInside0LastX128;
12+
uint256 feeGrowthInside0LastX128;
1413
uint256 feeGrowthInside1LastX128;
15-
1614
//the fees owed to the position owner in token0/token1
1715
uint128 tokensOwed0;
1816
uint128 tokensOwed1;
1917
}
2018

21-
function get(
22-
mapping(bytes32 => Info) storage self,
23-
address owner,
24-
int24 tickLower,
25-
int24 tickUpper
26-
) internal view returns (Info storage position) {
27-
position =
28-
self[keccak256(abi.encodePacked(owner, tickLower, tickUpper))];
19+
function get(mapping(bytes32 => Info) storage self, address owner, int24 tickLower, int24 tickUpper)
20+
internal
21+
view
22+
returns (Info storage position)
23+
{
24+
position = self[keccak256(abi.encodePacked(owner, tickLower, tickUpper))];
2925
}
3026

3127
function update(
@@ -36,10 +32,10 @@ library Position {
3632
) internal {
3733
Info memory _self = self;
3834

39-
if(liquidityDelta == 0) {
40-
if(_self.liquidity == 0) revert Position__NoLiquidity();
35+
if (liquidityDelta == 0) {
36+
if (_self.liquidity == 0) revert Position__NoLiquidity();
4137
}
42-
if(liquidityDelta != 0) {
38+
if (liquidityDelta != 0) {
4339
self.liquidity = liquidityDelta < 0
4440
? _self.liquidity - uint128(-liquidityDelta)
4541
: _self.liquidity + uint128(liquidityDelta);

src/lib/SafeCast.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ library SafeCast {
3535
require(y <= uint128(type(int128).max));
3636
z = int128(int256(y));
3737
}
38-
}
38+
}

0 commit comments

Comments
 (0)