Skip to content

Conversation

@anna-carroll
Copy link
Contributor

supersedes #53

/// 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
Copy link
Member

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)

Copy link
Contributor Author

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;
Copy link
Member

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

Copy link
Contributor Author

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.

Copy link
Member

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

Copy link
Member

@prestwich prestwich left a 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

@anna-carroll anna-carroll mentioned this pull request Jul 2, 2024
Base automatically changed from anna/test-order to main July 2, 2024 15:23
@anna-carroll anna-carroll merged commit c45ff58 into main Jul 2, 2024
@anna-carroll anna-carroll deleted the anna/final-fill branch July 2, 2024 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants