-
Notifications
You must be signed in to change notification settings - Fork 242
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
[ETHEREUM-CONTRACTS] add missing batch call operations #1967
Merged
Changes from 4 commits
Commits
Show all changes
38 commits
Select commit
Hold shift + click to select a range
c163b35
added batch call operations for upgradeTo and downgradeTo
d10r 947699e
added test case for connecting a pool via batch call
d10r 84bd23e
added OPERATION_TYPE_SIMPLE_FORWARD_CALL
d10r 1f31d3c
added OPERATION_TYPE_ERC2771_FORWARD_CALL
d10r b9582cd
forward native tokens with the first generic external call
d10r a1ae6ad
fix contract size
d10r 8152677
appease linter
d10r b78a0d3
more comments, fixed value forwarding via 2771
d10r 839072c
more verbose documentation
d10r 1391b1f
fix hotfuzz init
d10r 23048b0
add dmzfwd to deploy script
d10r 48279c1
adjust mock constructor
d10r 71b0158
disable code to stay inside contract size limit
d10r 30aed68
this is insanity
d10r 9ec13fb
fix test
d10r 39dfb01
fix deployment test
d10r 34c5bb5
disable only part of the replacePlaceholderCtx test
d10r 804734d
revert unrelated change
d10r 5772a07
try failing test only
d10r ea4d3a3
fixed the flakiness source and undid the undo
d10r bb6fda4
updated CHANGELOG
d10r 08a17fd
allow to withdraw native tokens stuck in DMZForwarder
d10r b511690
made host.forwardBatchCall payable too
d10r 3f4c8e3
rename to GeneralDistributionAgreementV1.prop.t.sol
hellwolf 913d39d
update foundry
hellwolf 43176b0
use assembly destructor to have different error code
hellwolf 0cd9fc3
uncomment out test code
hellwolf 08ffbc3
update foundry version
hellwolf 77dae62
[ETHEREUM-CONTRACTS]: typo fixes
hellwolf 5d7011b
[ETHEREUM-CONTRACTS] rename prop.sol to prop.t.sol
hellwolf fb2654a
fix build warning
hellwolf 4833be0
ignore mocks from hardhat build
hellwolf d8b9e17
use assembly selfdestruct for now
hellwolf 287e1c2
fix build warning
hellwolf 5fceaf1
update CHANGELOG
hellwolf 84bb8ba
Merge branch 'assorted-test-improvements-20240701' into batch-ops
hellwolf 4daae4b
Merge branch 'dev' into batch-ops
hellwolf 524ae94
Merge branch 'dev' into batch-ops
hellwolf 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
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 |
---|---|---|
|
@@ -882,6 +882,20 @@ contract SuperToken is | |
_downgrade(msg.sender, account, account, amount, "", ""); | ||
} | ||
|
||
function operationUpgradeTo(address account, address to, uint256 amount) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this will require Token upgrades There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. right. Also we may later consider deprecating the variants without |
||
external virtual override | ||
onlyHost | ||
{ | ||
_upgrade(msg.sender, account, to, amount, "", ""); | ||
} | ||
|
||
function operationDowngradeTo(address account, address to, uint256 amount) | ||
external virtual override | ||
onlyHost | ||
{ | ||
_downgrade(msg.sender, account, to, amount, "", ""); | ||
} | ||
|
||
/************************************************************************** | ||
* Modifiers | ||
*************************************************************************/ | ||
|
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
33 changes: 33 additions & 0 deletions
33
packages/ethereum-contracts/contracts/utils/DMZForwarder.sol
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,33 @@ | ||
// SPDX-License-Identifier: AGPLv3 | ||
pragma solidity 0.8.23; | ||
|
||
import { Ownable } from "@openzeppelin/contracts/access/Ownable.sol"; | ||
|
||
/** | ||
* @title DMZForwarder | ||
* @dev The purpose of this contract is to make arbitrary contract calls batchable | ||
* alongside Superfluid specific batch operations. | ||
* We route the callse through this dedicated contract in order to not have msg.sender set | ||
* to the host contract, for security reasons. | ||
* Forwarded calls can optionally use ERC-2771 to preserve the original msg.sender. | ||
*/ | ||
contract DMZForwarder is Ownable { | ||
function forwardCall(address target, bytes memory data) | ||
external | ||
returns(bool success, bytes memory returnData) | ||
{ | ||
// solhint-disable-next-line avoid-low-level-calls | ||
(success, returnData) = target.call(data); | ||
} | ||
|
||
// Forwards a call using ERC-2771. | ||
// That means the original msg.sender (provided by the host) is passed along in a trusted way. | ||
// A recipient contract needs to trust this contract (trusted forwarder). | ||
function forward2771Call(address target, address msgSender, bytes memory data) | ||
external onlyOwner | ||
returns(bool success, bytes memory returnData) | ||
{ | ||
// solhint-disable-next-line avoid-low-level-calls | ||
(success, returnData) = target.call(abi.encodePacked(data, msgSender)); | ||
} | ||
} |
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
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.
to be in sync with the rest, use typed signature, and call "data" "callData" to be more specific.