Skip to content

Commit

Permalink
formatted
Browse files Browse the repository at this point in the history
  • Loading branch information
DeluxeRaph committed Aug 23, 2024
1 parent cfca04c commit 1dfa490
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 10 deletions.
9 changes: 6 additions & 3 deletions src/TWAMM.sol
Original file line number Diff line number Diff line change
Expand Up @@ -146,11 +146,14 @@ contract TWAMM is BaseHook, ITWAMM {
(uint160 sqrtPriceX96,,,) = poolManager.getSlot0(poolId);
State storage twamm = twammStates[poolId];

(bool zeroForOne, uint160 sqrtPriceLimitX96) =
_executeTWAMMOrders(twamm, poolManager, key, PoolParamsOnExecute(sqrtPriceX96, poolManager.getLiquidity(poolId)));
(bool zeroForOne, uint160 sqrtPriceLimitX96) = _executeTWAMMOrders(
twamm, poolManager, key, PoolParamsOnExecute(sqrtPriceX96, poolManager.getLiquidity(poolId))
);

if (sqrtPriceLimitX96 != 0 && sqrtPriceLimitX96 != sqrtPriceX96) {
poolManager.unlock(abi.encode(key, IPoolManager.SwapParams(zeroForOne, type(int256).max, sqrtPriceLimitX96)));
poolManager.unlock(
abi.encode(key, IPoolManager.SwapParams(zeroForOne, type(int256).max, sqrtPriceLimitX96))
);
}
}

Expand Down
6 changes: 1 addition & 5 deletions src/mocks/MockERC20.sol
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,7 @@ pragma solidity >=0.8.0;
import {ERC20} from "solmate/src/tokens/ERC20.sol";

contract MockERC20 is ERC20 {
constructor(
string memory _name,
string memory _symbol,
uint8 _decimals
) ERC20(_name, _symbol, _decimals) {}
constructor(string memory _name, string memory _symbol, uint8 _decimals) ERC20(_name, _symbol, _decimals) {}

function mint(address to, uint256 value) public virtual {
_mint(to, value);
Expand Down
4 changes: 2 additions & 2 deletions test/TWAMM.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ contract TWAMMTest is Test, Deployers, GasSnapshot {
uint256 earningsFactorLast
);

//
//
TWAMM twamm =
TWAMM(address(uint160(Hooks.BEFORE_INITIALIZE_FLAG | Hooks.BEFORE_SWAP_FLAG | Hooks.BEFORE_ADD_LIQUIDITY_FLAG)));
address hookAddress;
Expand Down Expand Up @@ -99,7 +99,7 @@ contract TWAMMTest is Test, Deployers, GasSnapshot {
assertEq(twamm.lastVirtualOrderTimestamp(initId), 10000);
}

// @note need to figure out what snapStart is.
// @note need to figure out what snapStart is.
// When it is comment out it is panicing for an arithmetic underflow or overflow.
// function testTWAMM_submitOrder_StoresOrderWithCorrectPoolAndOrderPoolInfo() public {
// uint160 expiration = 30000;
Expand Down

0 comments on commit 1dfa490

Please sign in to comment.