Skip to content

Commit

Permalink
Added links to no-ops guide (#830)
Browse files Browse the repository at this point in the history
  • Loading branch information
seeyijie authored Dec 9, 2024
1 parent bfca25f commit 7dd3b41
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions docs/contracts/v4/quickstart/04-hooks/03-NoOp.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: NoOp Hooks
---

One feature enabled by custom accounting isβ€‹β€‹β€‹β€‹β€Œ NoOp swap. This feature allows hook developers to replace the v4 (v3-style) swap logic.
One feature enabled by [custom accounting](/contracts/v4/guides/custom-accounting) isβ€‹β€‹β€‹β€‹β€Œ NoOp swap. This feature allows hook developers to replace the v4 (v3-style) swap logic.

This means developers can replace Uniswap's internal core logic for how to handle swaps. Two emergent use-cases are possible with NoOp:

Expand Down Expand Up @@ -49,7 +49,7 @@ contract NoOpHook is BaseHook {

# beforeSwap

NoOp only works on exact-input swaps and the *beforeSwap* **must** take the input currency and return `BeforeSwapDelta`. The hook should `IPoolManager.mint` itself the corresponding tokens equal to the amount of the input (`amountSpecified`). It should then return a `BeforeSwapDelta` where `deltaSpecified = -amountSpecified` (the positive amount).
NoOp only works on exact-input swaps and the *beforeSwap* **must** take the input currency and return [`BeforeSwapDelta`](/contracts/v4/reference/core/types/beforeswapdelta). The hook should `IPoolManager.mint` itself the corresponding tokens equal to the amount of the input (`amountSpecified`). It should then return a `BeforeSwapDelta` where `deltaSpecified = -amountSpecified` (the positive amount).

The funds' movements are as follows:

Expand Down

0 comments on commit 7dd3b41

Please sign in to comment.