-
Notifications
You must be signed in to change notification settings - Fork 6
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: update fill logic #55
Conversation
04fa345
to
c986aa5
Compare
/// The user calls `initiate` on a rollup; the Builder calls `fill` on the target chain aggregating Outputs. | ||
/// @param outputs - The Outputs to be transferred. | ||
/// @dev NOTE that here, Output.chainId denotes the *origin* chainId. | ||
/// @custom:emits Filled |
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.
should note the caller is allowed to collapse outputs if the chain Id, recipient, and token are the same (by adding the value together)
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.
for (uint256 i; i < outputs.length; i++) { | ||
if (outputs[i].token == address(0)) { | ||
// this line should underflow if there's an attempt to spend more ETH than is attached to the transaction | ||
value -= outputs[i].amount; |
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.
opt: future versions could crawl the list and collapse transfers to the same account, instead of having 1 transfer per output
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.
yeah, the Solidity for this is a bit gnarly though :) the Builder should aggregate the Outputs offchain to save on gas.
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.
builder can't aggregate outputs with different chain ids tho
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 a comment change
5a87474
to
b66fa9f
Compare
supersedes #53