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

Conversation

tamaralipows
Copy link

@tamaralipows tamaralipows commented Dec 19, 2024

This is mostly based off of BatchSwapRouterV1. Why?

  • I'm much more familiar with the current swap router than the old one - whose code I never touched.
  • I like the very clear, separated methods for single, sequential, and split.
  • Didn't see any mention of exactOut in SwapRouterMethodsV1

Executors/Verifiers

  • There will be no more built-in executors (such as USV2 and V3), nor built-in callback verifiers.

Fees

  • No fee taking, right?

TODO

  • ETH wrapping and unwrapping (see permissioned frontent contract for implementation)
  • Some imports missing (Efficient ERC20, PackedSwapStructs, PrefixLengthEncodedByteArray)
  • Remove SetApprovals if using Permit2
    - MAKE CHANGES FROM MAX'S AUDIT

Executors/Verifiers
- There will be no more built-in executors (such as USV2 and V3), not built-in callback verifiers.
- Removed swap callback methods. Should we still include a generic callback in the fallback() method?

ActionTypes
- No more TRANSFER, PAY, or SWAP action types. I don't see these being used in any way after we simplify the UniswapV3 Executor. I've also removed the _getPayer() method because of this.

Fees
- No fee taking, right?

TODO
- ETH wrapping and unwrapping (see permissioned frontent contract for implementation)
- Some imports missing (Efficient ERC20, PackedSwapStructs, PrefixLengthEncodedByteArray)
- Remove SetApprovals if using Permit2
address internal _currentSender;
}

contract SwapContext is SwapContextStorage {
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't fully understand this.

Copy link
Contributor

@dianacarvalho1 dianacarvalho1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you so much @tamaralipows 🙏🏼 This is looking greeeaatt! awesome push!
left a million comments for future us.

No fee taking, right?

that is a great question. no idea

evm/src/propeller-router/PropellerRouterInternal.sol Outdated Show resolved Hide resolved
* @author PropellerHeads Devs
* @dev Allows a contract to tokens for trading on third party contracts.
*/
contract ApprovalManagement is IBatchSwapRouterV1Structs {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's leave this for now until we get feedback from the users. then we can check how to use permit2

0xd8aa0f3194971a2a116679f7c2090f6939c8d4e01a2a8d7e41d55e5351469e63;

constructor() {
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the audit: we should have multiple roles

evm/src/propeller-router/PropellerRouter.sol Outdated Show resolved Hide resolved
_setupRole(DEFAULT_ADMIN_ROLE, msg.sender);
}

function _executeSwap(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you know I'm gonna ask for these functions to be in order of usage eheh

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

boo

Comment on lines 126 to 129
// Idea: On v2, reserve 14 bytes for calculatedAmount and replace them here
// to save some quotes, if these 14 bytes are all zero the swap call won't
// recalculate the quote else, it will simply execute with the calculatedAmount
// that was passed along.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't understand this idea 🤔 but I think I don't understand the problem well enough either 🙃

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yet

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

legacy code (we can either do this from scratch or keep this)

evm/src/propeller-router/PropellerRouter.sol Outdated Show resolved Hide resolved
evm/src/propeller-router/PropellerRouterInternal.sol Outdated Show resolved Hide resolved
evm/src/propeller-router/PropellerRouterInternal.sol Outdated Show resolved Hide resolved
evm/src/propeller-router/PropellerRouterInternal.sol Outdated Show resolved Hide resolved
TAMARA LIPOWSKI added 5 commits December 20, 2024 14:08
- Didn't realize the internal _singleSwap method was being used for the other single swaps
- All methods are now checked by default. Merge checked and unchecked internal methods for simplicity.
- Also remove the remaining _executeAction which was only used for batch execution, as well as the ActionType.
- The internal was useful in the case where we would want to reuse the methods for several different routers (i.e. Fusion, UniswapX, Cowswap, and Frontend). Now - this is not the case for the forseeable future. So, let's keep this as simple as possible and avoid premature overgeneralization.
accidental delete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants