---
# System prepended metadata

title: Untitled

---

## Peckshield audit

- PVE001  [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/ee98ef39c67e3c915bbedbe082c97f29e94de8d9)
- PVE002 [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/3cddf6a3226ad482028f6c2223289c8ae3aea25b)
- PVE003 [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/c3b7e0ea93b2fc530b1257bf0b27e96fe36378aa)
- PVE004 [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/158f22ad232a3c7aefffd7b961b2b5178f786112)
- PVE005: Explaination
```    - Case 1
 
When isToken0 and isLong0ToLong1
 
This means the user is receiving or depositing in token0.
The swap from long0 to long1, expect to require to deposit token1 to pool and to withdraw token0 from the pool.
The spot swap in Uniswap, expect to swap from token0 (tokenAmountIn) to token1 (tokenAmountOut).
 
If the tokenAmountIn (token0 denomination) is greater than token0AndLong0Amount. This means the user has to deposit more token0 to cover for the cost of spot swap. Else, the user expect to receive token0 from the difference.
 
Case 2
 
When isToken1 and isLong1ToLong0
 
This means the user is receiving or depositing in token1.
The swap from long1 to long0, expect to require to deposit token0 to pool and to withdraw token1 from the pool.
The spot swap in Uniswap, expect to swap from token1 (tokenAmountIn) to token0 (tokenAmountOut).
 
If the tokenAmountIn (token1 denomination) is greater than token1AndLong1Amount. This means the user has to deposit more token1 to cover for the cost of spot swap. Else, the user expect to receive token1 from the difference.
 
Case 3
 
When isToken0 and isLong1ToLong0
 
This means the user is receiving or depositing in token0.
The swap from long1 to long0, expect to require to deposit token0 to pool and to withdraw token1 from the pool.
The spot swap in Uniswap, expect to swap from token1 (tokenAmountIn) to token0 (tokenAmountOut).
 
If the tokenAmountOut (token0 denomination) is less than token0AndLong0Amount. This means the user has to deposit more token0 to cover for the not enough amount of return of spot swap. Else, the user expect to receive token0 from the difference.
 
Case 4
 
When isToken1 and isLong0ToLong1
 
This means the user is receiving or depositing in token1.
The swap from long0 to long1, expect to require to deposit token1 to pool and to withdraw token0 from the pool.
The spot swap in Uniswap, expect to swap from token0 (tokenAmountIn) to token1 (tokenAmountOut).
 
If the tokenAmountOut (token1 denomination) is less than token1AndLong1Amount. This means the user has to deposit more token1 to cover for the not enough amount of return of spot swap. Else, the user expect to receive token1 from the difference.
```
- PVE006 [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/96edf63b9e54c03878711e5e54a725981c2d5080)
- PVE007 [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/3bec4582848e0f74d5d6750ee92c3ce989235fea)
- PVE008 [Fixed](https://github.com/Timeswap-Labs/Timeswap-V2-Monorepo/commit/3e0f0b3514dd6ed42137ad2459d30322f396ba1f)
- PVE009: Explaination
```
 
In this section of the code:
 
(tokenAmountIn, tokenAmountOut) = pool.calculateSwap(
        UniswapV3CalculateSwapParam({
          uniswapV3Fee: param.uniswapV3Fee,
          zeroForOne: !param.isToken0,
          exactInput: false,
          amount: param.tokenAmount,
          strikeLimit: param.strike
        })
      );
 
 
Due to the non-increasing behavior of token1/token0 price when zeroForOne swap, and the non-decreasing behavior of token1/token0 price when oneForZero swap, in the pool.calculateSwap calculation above, tokenAmountOut will always be less than or equal to param.tokenAmount. Then in the next calculation:
if (tokenAmountIn > (param.isToken0 ? token1Balance : token0Balance))
        (tokenAmountIn, tokenAmountOut) = pool.calculateSwap(
          UniswapV3CalculateSwapParam({
            uniswapV3Fee: param.uniswapV3Fee,
            zeroForOne: !param.isToken0,
            exactInput: (exactInput = true),
            amount: param.isToken0 ? token1Balance : token0Balance,
            strikeLimit: param.strike
          })
        );
 
Since token1Balance or token0Balance is always less than tokenAmountIn. Then the newly calculated tokenAmountOut will be less than or equal to the previous tokenAmountOut. Thus the newly calculated tokenAmountOut will always be less than or equal to param.tokenAmount.

```