Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Cyfrin-I4] feat: audit follow ups #35

Merged
merged 3 commits into from
Dec 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/base/Dispatcher.sol
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ abstract contract Dispatcher is
/// @notice Decodes and executes the given command with the given inputs
/// @param commandType The command type to execute
/// @param inputs The inputs to execute the command with
/// @dev inputs must be ABI encoded using abi.encode() to ensure proper padding. WARNING: Direct calldata
// manipulation or abi.encodePacked() can result in incorrect data reads.
/// @dev 2 masks are used to enable use of a nested-if statement in execution for efficiency reasons
/// @return success True on success of the command, false on failure
/// @return output The outputs or error messages, if any, from the command
Expand Down Expand Up @@ -284,6 +286,8 @@ abstract contract Dispatcher is
(success, output) = address(V3_POSITION_MANAGER).call(inputs);
return (success, output);
} else if (command == Commands.V4_CL_INITIALIZE_POOL) {
// equivalent: abi.decode(inputs, (PoolKey, uint160)) where PoolKey is
// (Currency currency0, Currency currency1, IHooks hooks, IPoolManager poolManager, uint24 fee, bytes32 parameters)
PoolKey calldata poolKey;
uint160 sqrtPriceX96;
assembly {
Expand All @@ -293,6 +297,8 @@ abstract contract Dispatcher is
(success, output) =
address(clPoolManager).call(abi.encodeCall(ICLPoolManager.initialize, (poolKey, sqrtPriceX96)));
} else if (command == Commands.V4_BIN_INITIALIZE_POOL) {
// equivalent: abi.decode(inputs, (PoolKey, uint24)) where PoolKey is
// (Currency currency0, Currency currency1, IHooks hooks, IPoolManager poolManager, uint24 fee, bytes32 parameters)
PoolKey calldata poolKey;
uint24 activeId;
assembly {
Expand Down
Loading