Skip to content

Commit

Permalink
feat: Update quoter MINIMUM_VALID_RESPONSE_LENGTH (#14)
Browse files Browse the repository at this point in the history
* feat: Update MINIMUM_VALID_RESPONSE_LENGTH

* feat: Add CL_MINIMUM_VALID_RESPONSE_LENGTH and BIN_MINIMUM_VALID_RESPONSE_LENGTH
  • Loading branch information
ChefSnoopy authored Aug 30, 2024
1 parent cfc2125 commit d4ad2d2
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
9 changes: 5 additions & 4 deletions src/pool-bin/lens/BinQuoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,12 @@ contract BinQuoter is Quoter, IBinQuoter {
using PathKeyLib for PathKey;

IBinPoolManager public immutable poolManager;
uint256 private constant BIN_MINIMUM_VALID_RESPONSE_LENGTH = 160;

/// @dev min valid reason is 2-words long
/// @dev int128[2] + activeIdAfter padded to 32bytes
/// MINIMUM_VALID_RESPONSE_LENGTH = 64;
constructor(address _poolManager) Quoter(_poolManager, 64) {
/// @dev min valid reason is 5-words long (160 bytes)
/// @dev int128[2] includes 32 bytes for offset, 32 bytes for length, and 32 bytes for each element
/// @dev Plus activeIdAfter padded to 32 bytes
constructor(address _poolManager) Quoter(_poolManager, BIN_MINIMUM_VALID_RESPONSE_LENGTH) {
poolManager = IBinPoolManager(_poolManager);
}

Expand Down
9 changes: 5 additions & 4 deletions src/pool-cl/lens/CLQuoter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,12 @@ contract CLQuoter is Quoter, ICLQuoter {
using PathKeyLib for PathKey;

ICLPoolManager public immutable poolManager;
uint256 private constant CL_MINIMUM_VALID_RESPONSE_LENGTH = 192;

/// @dev min valid reason is 3-words long
/// @dev int128[2] + sqrtPriceX96After padded to 32bytes + intializeTicksLoaded padded to 32bytes
/// MINIMUM_VALID_RESPONSE_LENGTH = 96;
constructor(address _poolManager) Quoter(_poolManager, 96) {
/// @dev min valid reason is 6-words long (192 bytes)
/// @dev int128[2] includes 32 bytes for offset, 32 bytes for length, and 32 bytes for each element
/// @dev Plus sqrtPriceX96After padded to 32 bytes and initializedTicksLoaded padded to 32 bytes
constructor(address _poolManager) Quoter(_poolManager, CL_MINIMUM_VALID_RESPONSE_LENGTH) {
poolManager = ICLPoolManager(_poolManager);
}

Expand Down

0 comments on commit d4ad2d2

Please sign in to comment.