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(v4-sdk): add permit2 forwarder support and other permit funcs #104

Merged
merged 39 commits into from
Sep 26, 2024

Conversation

zhongeric
Copy link
Contributor

@zhongeric zhongeric commented Sep 23, 2024

PR Scope

Please title your PR according to the following types and scopes following conventional commits:

  • fix(SDK name): will trigger a patch version
  • chore(<type>): will not trigger any release and should be used for internal repo changes
  • <type>(public): will trigger a patch version for non-code changes (e.g. README changes)
  • feat(SDK name): will trigger a minor version
  • feat(breaking): will trigger a major version for a breaking change

Description

Relies on #102 , adds:

  • use permit2 batch permit to approve tokens for increase/mint liquidity
  • use erc721permit for burn liquidity
  • encode native 2612 permit for token approval to permit2

How Has This Been Tested?

[e.g. Manually, E2E tests, unit tests, Storybook]

Are there any breaking changes?

[e.g. Type definitions, API definitions]

If there are breaking changes, please ensure you bump the major version Bump the major version (by using the title feat(breaking): ...), post a notice in #eng-sdks, and explicitly notify all Uniswap Labs consumers of the SDK.

(Optional) Feedback Focus

[Specific parts of this PR you'd like feedback on, or that reviewers should pay closer attention to]

(Optional) Follow Ups

[Things that weren't addressed in this PR, ways you plan to build on this work, or other ways this work could be extended]

@zhongeric zhongeric requested a review from a team as a code owner September 23, 2024 19:40
Copy link

graphite-app bot commented Sep 23, 2024

Graphite Automations

"Request reviewers once CI passes on sdks monorepo" took an action on this PR • (09/23/24)

1 assignee was added and 1 reviewer was added to this PR based on 's automation.

@zhongeric zhongeric changed the title feat(v4-sdk): add permit2 forwarder support feat(v4-sdk): add permit2 forwarder support and other permit funcs Sep 23, 2024
@zhongeric zhongeric changed the base branch from sra/removeCallParameters to main September 23, 2024 20:30
Comment on lines +248 to +256
if (options.batchPermit) {
calldataList.push(
V4PositionManager.encodePermitBatch(
options.batchPermit.owner,
options.batchPermit.permitBatch,
options.batchPermit.signature
)
)
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I feel like we don't need to support permit2 permit for either token0 OR token1. We can just do a batchPermit of 1 element in that case, simplifying the options interface

Copy link
Contributor

Choose a reason for hiding this comment

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

i wonder how much more gas it is. But yeah we can always do this as a follow-up? Maybe worth opening an issue or something just in case its way more gas

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep just made an issue #107

sdks/v4-sdk/src/PositionManager.test.ts Show resolved Hide resolved
sdks/v4-sdk/src/PositionManager.test.ts Outdated Show resolved Hide resolved
sdks/v4-sdk/src/utils/ERC2612Permit.ts Outdated Show resolved Hide resolved
@zhongeric zhongeric merged commit 582a43d into main Sep 26, 2024
7 checks passed
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.

4 participants