Changes review

The TridentCLPool, TridentCLFactory, and TridentCLPoolDeployer contracts have been updated.

  • Updated the deploy function of the TridentCLPoolDeployer contract. The bentoBox argument was added and passed in the parameters struct to be used in the liquidity pool.

  • Updated the constructor of the TridentCLFactory contract. Added the _bentoBox argument. This address is used in the createPool function to deploy a new liquidity pool.

The changes listed below relate to the TridentCLPool contract:

  • The BentoBox usage. The most important change here is the use of BentoBox, which stores tokens on behalf of the pool contract, like a vault, and has additional functionalities of its own.

  • Added the internal _transfer function. This function allows direct BentoBox transfers or withdrawals towards the to address. Previously, it was a safeTransfer of the specific token towards to. It assumes that token0 and token1 can be both withdrawn and transferred from BentoBox. It is used in collectProtocol(), collect(), swap(), and flash().

  • Updated the balance0() and the balance1() functions. The changes relate to the fact that BentoBox is now the vault for the token0 and the token1. It is important to note that neither balance0 nor balance1 are updated if a direct ERC20 transfer happens to the pool. Therefore, all token transfers must occur through the BentoBox functions.

  • Updated the collect(), swap(), flash(), and collectProtocol() functions. The unwrapBento flag was added. This flag is used in the _transfer function and must determine whether to transfer or to withdraw (e.g., unwrap and then transfer as native) tokens from the vault.

  • Added new structure FlashCache. This structure is used in the flash function to pack the data set in memory.

  • Updated the SwapCache structure. Added new flags zeroForOne and unwrapBento. This structure is used in the swap function. The flag zeroForOne was already used there but now is grouped with other data into this structure. The unwrapBento flag is necessary for the _transfer function to determine whether to withdraw tokens from the vault or transfer after the swap.

Zellic © 2023Back to top ↑