Skip to content

Add Adapter for ERC7683#116

Open
luiz-lvj wants to merge 15 commits intoopenintentsframework:mainfrom
luiz-lvj:adapter-7683
Open

Add Adapter for ERC7683#116
luiz-lvj wants to merge 15 commits intoopenintentsframework:mainfrom
luiz-lvj:adapter-7683

Conversation

@luiz-lvj
Copy link
Copy Markdown
Collaborator

@luiz-lvj luiz-lvj commented Sep 5, 2025

Description

Adds adapter for ERC7683. The adapter is only required on the input side, since the output settler is already compliant with the current version of ERC7683, available here.

Related Issues

Copy link
Copy Markdown
Member

@reednaa reednaa left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine, a few changes are needed to be compliant with ERC7683.

However, this adapter really highlights everything that is wrong with v0. It is extremely inefficient and very clunky to use in practise.

Comment on lines +75 to +102
function openFor(
GaslessCrossChainOrder calldata order,
bytes calldata signature,
bytes calldata originFillerData
) external {
if (originFillerData.length > 0) revert InvalidOriginFillerData();
if (order.orderDataType != GASLESS_ORDER_DATA_TYPEHASH) revert InvalidOrderDataType();
if (order.originSettler != address(this)) revert InvalidOriginSettler();

GaslessOrderData memory gaslessOrderData = abi.decode(order.orderData, (GaslessOrderData));

StandardOrder memory standardOrder = StandardOrder({
user: order.user,
nonce: order.nonce,
originChainId: order.originChainId,
expires: gaslessOrderData.expires,
fillDeadline: order.fillDeadline,
inputOracle: gaslessOrderData.inputOracle,
inputs: gaslessOrderData.inputs,
outputs: gaslessOrderData.outputs
});

_inputSettlerEscrow.openFor(abi.encode(standardOrder), order.user, signature);

bytes32 orderId = orderIdentifier(standardOrder);

emit Open(orderId, _resolve(standardOrder));
}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not compliant function. The spec says:

/// @title GaslessCrossChainOrder CrossChainOrder type
/// @notice Standard order struct to be signed by users, disseminated to fillers, and submitted to origin settler
/// contracts by fillers
struct GaslessCrossChainOrder {

This would not be the case here.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

from the PoV of the filler/user, the adapter is acting as a settler, would make it compliant, no?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The user does not sign GasslessCrossChainOrder. You should collect the tokens in this contract and then call open on the escrow.

Comment thread src/adapters/ERC7683Adapter.sol Outdated
Comment on lines +46 to +51
bytes32 public constant ONCHAIN_ORDER_DATA_TYPEHASH = keccak256(
"StandardOrder(address user,uint256 nonce,uint256 originChainId,uint32 expires,uint32 fillDeadline,address inputOracle,uint256[2][] inputs,MandateOutput[] outputs)"
);

bytes32 public constant GASLESS_ORDER_DATA_TYPEHASH =
keccak256("GaslessOrderData(uint32 expires,address inputOracle,uint256[2][] inputs,MandateOutput[] outputs)");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personal: I dislike having multiple "order_data" for the same order. It increases complexity.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand it, but using the same typehash for both would mean that a lot of data would be duplicated, between the GaslessCrosschainOrder and StandarOrder. This would be both very redundant, as well as we would have to check if the data coming from both structs is the same.

@luiz-lvj luiz-lvj requested a review from reednaa September 8, 2025 13:50
@codecov
Copy link
Copy Markdown

codecov Bot commented Sep 8, 2025

Codecov Report

❌ Patch coverage is 92.45283% with 4 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/adapters/ERC7683Adapter.sol 92.45% 4 Missing ⚠️

📢 Thoughts on this report? Let us know!

This was referenced Sep 11, 2025
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.

ERC 7683 adapter

2 participants