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

feat: (WIP) Simplified PropellerRouter Sketch #127

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
feat: remove batchExecute, put back _singleSwap
- Didn't realize the internal _singleSwap method was being used for the other single swaps
  • Loading branch information
TAMARA LIPOWSKI committed Dec 20, 2024
commit 5b7fb0efda6ee9bfba2e819162b3d450591a051e
9 changes: 0 additions & 9 deletions evm/src/propeller-router/PropellerRouter.sol
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,6 @@ contract PropellerRouter is
);
}

function batchExecute(bytes calldata data)
external
override
onlyRole(EXECUTOR_ROLE)
withSwapContext
{
_batchExecute(data);
}

/**
* @dev Entrypoint to add or replace a swap method contract address
* @param id for this method
Expand Down
26 changes: 11 additions & 15 deletions evm/src/propeller-router/PropellerRouterInternal.sol
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ abstract contract PropellerRouterInternal is PropellerRouterStructs {
bytes calldata protocolDataIncludingTokens
) internal virtual returns (uint256 calculatedAmount);

/**
* @dev Executes a single swap, but might do more actions through callbacks.
*/
function _singleSwap(uint256 amount, bytes calldata swap)
internal
returns (uint256 calculatedAmount)
{
calculatedAmount =
_executeSwap(swap.exchange(), amount, swap.protocolData());
}

function _singleExactOutChecked(uint256 amount, bytes calldata data)
tamaralipows marked this conversation as resolved.
Show resolved Hide resolved
internal
returns (uint256 calculatedAmount)
Expand Down Expand Up @@ -265,21 +276,6 @@ abstract contract PropellerRouterInternal is PropellerRouterStructs {
}
}

/**
* @dev Executes multiple actions with a single call.
*/
function _batchExecute(bytes calldata data) internal {
uint256 amount;
bytes calldata actionData;
bytes calldata batchElement;
ActionType actionType;
while (data.length > 0) {
(batchElement, data) = data.next();
(amount, actionType, actionData) = batchElement.decodeBatchExecute();
_executeAction(amount, actionType, actionData);
}
}

/**
* @dev Allows to route amount into any other action type supported
* by this contract. This allows for more flexibility during
Expand Down
Loading