-
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
Introduce standard batched call under a lock #81
Conversation
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.
cool stuff. will prob have more feedback once I try building with it but so far looks like a very great start
test/SimpleBatchCallTest.t.sol
Outdated
bytes memory settleData = | ||
abi.encode(SimpleBatchCall.SettleConfig({withdrawTokens: true, settleUsingTransfer: true})); |
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.
unused, no?
function _handleAfterExecute(bytes memory callReturnData, bytes memory settleReturnData) internal virtual; | ||
|
||
/// @param executeData The function selectors and calldata for any of the function selectors in ICallsWithLock encoded as an array of bytes. | ||
function execute(bytes memory executeData, bytes memory settleData) external { |
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.
just my opinion and happy to keep as-is, but I think we should type settleData with SettleConfig
the serialization/deserialization feels cumbersome from a devex POV
contracts/base/CallsWithLock.sol
Outdated
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 prefer cleaner function signatures so I think you can drop the WithLock
suffixes
contracts/SimpleBatchCall.sol
Outdated
if (config.withdrawTokens) { | ||
poolManager.mint(currency, address(this), uint256(-delta)); | ||
} else { | ||
poolManager.take(currency, address(this), uint256(-delta)); | ||
} |
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.
this is mixed up right? withdraw=true
should be take
Closing for now. We can create a generalized lock and batch call example for integrators in the future though. This PR will add all the SafeCallback logic though to standardize some Hook Example development |
Related Issue
Which issue does this pull request resolve?
It might be helpful for integrating contracts to have a way to call multiple functions on core under one lock. This is a start to making a standard for that.
Description of changes
I think there could be some improvements in a more standard interface for _settle and _handleAfterExecute. I wonder if there is a way we could also be passing LESS data up and back.. lmk thoughts/improvements/suggestions