-
Notifications
You must be signed in to change notification settings - Fork 504
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
Add transfer support #218
Merged
Merged
Add transfer support #218
Changes from 5 commits
Commits
Show all changes
30 commits
Select commit
Hold shift + click to select a range
d59846b
move to a base actions router
snreynolds 46f47b2
use one Planner file
snreynolds b198c30
msgSender
snreynolds 3482b23
add transfer
snreynolds 2cee496
add transfer test
snreynolds bf369e6
merge main
snreynolds 494f7d6
use delta saving hook to get deltas
snreynolds 0449cac
remove return values
snreynolds 47bbc6d
add burn comment
snreynolds 7c911cb
make gas snapshots more accurate, remove hook
snreynolds 5f26936
merge main
snreynolds 03cf453
move to 1 planner, fix merge conf
snreynolds 2aba16d
sweep currency, pr comments
snreynolds 486617e
merge updates from use-actions-router
snreynolds b3aa874
rename, add liquidityDelta return param
snreynolds 6885931
rename
snreynolds a60f16d
comment
snreynolds 7ac7043
gas check
snreynolds 64897c3
add gas test, using uint256
snreynolds b0b1b73
gas check, using 0
snreynolds bdfc04d
comments
snreynolds 767605d
Merge branch 'main' into use-actions-router
snreynolds 68e3a66
remove SafeCallback
snreynolds 9d403c3
merge actions router
snreynolds 0778130
remove FULL_DELTA
snreynolds 9087916
merge main
snreynolds 03e978f
move helpers to delta resolver
snreynolds dedf310
remove import
snreynolds 428db01
increase liq with sttle with balance test
hensha256 858707e
Merge branch 'main' into add-transfer-support
hensha256 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
50222 | ||
49205 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
50040 | ||
49023 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
135866 | ||
134184 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
128788 | ||
127105 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
158157 | ||
156278 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
149309 | ||
147430 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
158157 | ||
156278 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
123700 | ||
121821 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
114922 | ||
113419 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
142193 | ||
140280 |
2 changes: 1 addition & 1 deletion
2
.forge-snapshots/PositionManager_decrease_burnEmpty_native.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
134932 | ||
133019 |
2 changes: 1 addition & 1 deletion
2
.forge-snapshots/PositionManager_decrease_sameRange_allLiquidity.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
136416 | ||
134537 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
150444 | ||
148697 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
135654 | ||
133879 |
2 changes: 1 addition & 1 deletion
2
.forge-snapshots/PositionManager_increase_autocompoundExactUnclaimedFees.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
142305 | ||
140501 |
2 changes: 1 addition & 1 deletion
2
.forge-snapshots/PositionManager_increase_autocompoundExcessFeesCredit.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
178459 | ||
176655 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
370660 | ||
368776 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
338770 | ||
336858 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
345708 | ||
343796 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
313342 | ||
311458 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
313984 | ||
312100 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
239566 | ||
237682 |
2 changes: 1 addition & 1 deletion
2
.forge-snapshots/PositionManager_mint_warmedPool_differentRange.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
319360 | ||
317476 |
2 changes: 1 addition & 1 deletion
2
.forge-snapshots/PositionManager_multicall_initialize_mint.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
415150 | ||
413266 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// SPDX-License-Identifier: GPL-3.0-or-later | ||
pragma solidity ^0.8.24; | ||
|
||
import {IPoolManager} from "@uniswap/v4-core/src/interfaces/IPoolManager.sol"; | ||
import {SafeCallback} from "./SafeCallback.sol"; | ||
import {CalldataDecoder} from "../libraries/CalldataDecoder.sol"; | ||
|
||
/// @notice Abstract contract for performing a combination of actions on Uniswap v4. | ||
/// @dev Suggested uint256 action values are defined in Actions.sol, however any definition can be used | ||
/// @dev This contract handles return values from sub calls to _handleAction. | ||
abstract contract BaseActionsRouterReturns is SafeCallback { | ||
using CalldataDecoder for bytes; | ||
|
||
/// @notice emitted when different numbers of parameters and actions are provided | ||
error LengthMismatch(); | ||
|
||
/// @notice emitted when an inheriting contract does not support an action | ||
error UnsupportedAction(uint256 action); | ||
|
||
constructor(IPoolManager _poolManager) SafeCallback(_poolManager) {} | ||
|
||
/// @notice internal function that triggers the execution of a set of actions on v4 | ||
/// @dev inheriting contracts should call this function to trigger execution | ||
function _executeActions(bytes calldata unlockData) internal returns (bytes[] memory) { | ||
return abi.decode(poolManager.unlock(unlockData), (bytes[])); | ||
} | ||
|
||
/// @notice function that is called by the PoolManager through the SafeCallback.unlockCallback | ||
function _unlockCallback(bytes calldata data) internal override returns (bytes memory) { | ||
// abi.decode(data, (uint256[], bytes[])); | ||
(uint256[] calldata actions, bytes[] calldata params) = data.decodeActionsRouterParams(); | ||
|
||
uint256 numActions = actions.length; | ||
if (numActions != params.length) revert LengthMismatch(); | ||
|
||
bytes[] memory results = new bytes[](numActions); | ||
for (uint256 actionIndex = 0; actionIndex < numActions; actionIndex++) { | ||
uint256 action = actions[actionIndex]; | ||
|
||
results[actionIndex] = _handleAction(action, params[actionIndex]); | ||
} | ||
|
||
return abi.encode(results); | ||
} | ||
|
||
/// @notice function to handle the parsing and execution of an action and its parameters | ||
function _handleAction(uint256 action, bytes calldata params) internal virtual returns (bytes memory); | ||
|
||
/// @notice function that returns address considered executer of the actions | ||
/// @dev The other context functions, _msgData and _msgValue, are not supported by this contract | ||
/// In many contracts this will be the address that calls the initial entry point that calls `_executeActions` | ||
/// `msg.sender` shouldnt be used, as this will be the v4 pool manager contract that calls `unlockCallback` | ||
/// If using ReentrancyLock.sol, this function can return Locker.get() - locker of the contract | ||
function _msgSender() internal view virtual returns (address); | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do think youll find if you make this
0
gas should go down noticeably because of removing non-0 calldata bytes.It should go down by
(16-4) * 32) = 384
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lemme check!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
went down by ~700
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
b0b1b73