Skip to content

Commit

Permalink
add support for opening orders for other users
Browse files Browse the repository at this point in the history
  • Loading branch information
Zodomo committed Jan 23, 2025
1 parent 201c20f commit 8916cd5
Show file tree
Hide file tree
Showing 10 changed files with 190 additions and 63 deletions.
15 changes: 8 additions & 7 deletions contracts/bindings/isolvernetbindings.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion contracts/bindings/solvernetinbox.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion contracts/bindings/solvernetoutbox.go

Large diffs are not rendered by default.

84 changes: 43 additions & 41 deletions contracts/solve/.gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -31,47 +31,49 @@ SolveInbox_request_Test:test_request_two() (gas: 816192)
SolveOutbox_fulfill_test:test_fulfillFee() (gas: 27996)
SolveOutbox_fulfill_test:test_fulfill_reverts() (gas: 673377)
SolveOutbox_fulfill_test:test_fulfill_succeeds() (gas: 274856)
SolverNet_E2E_Test:test_e2e_complete_contract_order() (gas: 1656479)
SolverNet_E2E_Test:test_e2e_complete_token_transfer_order() (gas: 1414836)
SolverNet_E2E_Test:test_mixed_deposits_and_expenses() (gas: 1856966)
SolverNet_E2E_Test:test_multi_token_deposits_and_expenses() (gas: 2074968)
SolverNet_Inbox_Accept_Test:test_accept_reverts_not_solver() (gas: 996775)
SolverNet_Inbox_Accept_Test:test_accept_reverts_order_not_pending() (gas: 1049674)
SolverNet_Inbox_Accept_Test:test_accept_succeeds() (gas: 1119263)
SolverNet_Inbox_Cancel_Test:test_cancel_reverts_not_user() (gas: 1003999)
SolverNet_Inbox_Cancel_Test:test_cancel_reverts_order_not_pending_or_rejected() (gas: 1061333)
SolverNet_Inbox_Cancel_Test:test_cancel_succeeds() (gas: 1123948)
SolverNet_Inbox_Claim_Test:test_claim_native_succeeds() (gas: 1221745)
SolverNet_Inbox_Claim_Test:test_claim_reverts_not_solver() (gas: 1136209)
SolverNet_Inbox_Claim_Test:test_claim_reverts_order_not_filled() (gas: 1055937)
SolverNet_Inbox_Claim_Test:test_claim_reverts_zero_recipient() (gas: 1181903)
SolverNet_Inbox_Claim_Test:test_claim_succeeds() (gas: 1275953)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_not_outbox() (gas: 1094759)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_order_not_accepted() (gas: 1042562)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_wrong_fill_hash() (gas: 1097364)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_wrong_source_chain() (gas: 1097245)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_succeeds() (gas: 1198580)
SolverNet_Inbox_Open_Test:test_open_reverts_insufficient_erc20_allowance() (gas: 106363)
SolverNet_Inbox_Open_Test:test_open_reverts_multiple_native_deposits() (gas: 58248)
SolverNet_Inbox_Open_Test:test_open_reverts_native_deposit_without_value() (gas: 51185)
SolverNet_Inbox_Open_Test:test_open_reverts_native_deposit_wrong_value() (gas: 57835)
SolverNet_Inbox_Open_Test:test_open_reverts_value_without_native_deposit() (gas: 162176)
SolverNet_Inbox_Open_Test:test_open_reverts_zero_amount_erc20_deposit() (gas: 52697)
SolverNet_Inbox_Open_Test:test_open_succeeds() (gas: 1072291)
SolverNet_Inbox_Reject_Test:test_reject_native_refund() (gas: 1082861)
SolverNet_Inbox_Reject_Test:test_reject_reverts_not_solver() (gas: 996978)
SolverNet_Inbox_Reject_Test:test_reject_reverts_order_not_pending() (gas: 1066699)
SolverNet_Inbox_Reject_Test:test_reject_succeeds() (gas: 1128769)
SolverNet_Inbox_Resolve_Test:test_resolveOrder_erc20_deposit_succeeds() (gas: 79326)
SolverNet_Inbox_Resolve_Test:test_resolveOrder_native_deposit_succeeds() (gas: 77237)
SolverNet_Inbox_Validate_Test:test_validate_reverts() (gas: 168204)
SolverNet_Inbox_Validate_Test:test_validate_succeeds() (gas: 31343)
SolverNet_E2E_Test:test_e2e_complete_contract_order() (gas: 1657831)
SolverNet_E2E_Test:test_e2e_complete_token_transfer_order() (gas: 1416192)
SolverNet_E2E_Test:test_mixed_deposits_and_expenses() (gas: 1858315)
SolverNet_E2E_Test:test_multi_token_deposits_and_expenses() (gas: 2076316)
SolverNet_Inbox_Accept_Test:test_accept_reverts_not_solver() (gas: 997852)
SolverNet_Inbox_Accept_Test:test_accept_reverts_order_not_pending() (gas: 1050751)
SolverNet_Inbox_Accept_Test:test_accept_succeeds() (gas: 1120440)
SolverNet_Inbox_Cancel_Test:test_cancel_empty_user_address_succeeds() (gas: 1144448)
SolverNet_Inbox_Cancel_Test:test_cancel_reverts_not_user() (gas: 1005098)
SolverNet_Inbox_Cancel_Test:test_cancel_reverts_order_not_pending_or_rejected() (gas: 1062432)
SolverNet_Inbox_Cancel_Test:test_cancel_succeeds() (gas: 1125210)
SolverNet_Inbox_Claim_Test:test_claim_native_succeeds() (gas: 1222923)
SolverNet_Inbox_Claim_Test:test_claim_reverts_not_solver() (gas: 1137282)
SolverNet_Inbox_Claim_Test:test_claim_reverts_order_not_filled() (gas: 1057014)
SolverNet_Inbox_Claim_Test:test_claim_reverts_zero_recipient() (gas: 1182976)
SolverNet_Inbox_Claim_Test:test_claim_succeeds() (gas: 1277130)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_not_outbox() (gas: 1095832)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_order_not_accepted() (gas: 1043635)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_wrong_fill_hash() (gas: 1098441)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_reverts_wrong_source_chain() (gas: 1098318)
SolverNet_Inbox_MarkFulfilled_Test:test_mark_fulfilled_succeeds() (gas: 1199757)
SolverNet_Inbox_Open_Test:test_open_empty_user_address_succeeds() (gas: 1077776)
SolverNet_Inbox_Open_Test:test_open_reverts_insufficient_erc20_allowance() (gas: 106940)
SolverNet_Inbox_Open_Test:test_open_reverts_multiple_native_deposits() (gas: 58824)
SolverNet_Inbox_Open_Test:test_open_reverts_native_deposit_without_value() (gas: 51651)
SolverNet_Inbox_Open_Test:test_open_reverts_native_deposit_wrong_value() (gas: 58411)
SolverNet_Inbox_Open_Test:test_open_reverts_value_without_native_deposit() (gas: 162752)
SolverNet_Inbox_Open_Test:test_open_reverts_zero_amount_erc20_deposit() (gas: 53251)
SolverNet_Inbox_Open_Test:test_open_succeeds() (gas: 1073519)
SolverNet_Inbox_Reject_Test:test_reject_native_refund() (gas: 1084180)
SolverNet_Inbox_Reject_Test:test_reject_reverts_not_solver() (gas: 998055)
SolverNet_Inbox_Reject_Test:test_reject_reverts_order_not_pending() (gas: 1067776)
SolverNet_Inbox_Reject_Test:test_reject_succeeds() (gas: 1129946)
SolverNet_Inbox_Resolve_Test:test_resolveOrder_erc20_deposit_succeeds() (gas: 79964)
SolverNet_Inbox_Resolve_Test:test_resolveOrder_native_deposit_succeeds() (gas: 77875)
SolverNet_Inbox_Validate_Test:test_validate_reverts() (gas: 173203)
SolverNet_Inbox_Validate_Test:test_validate_succeeds() (gas: 31833)
SolverNet_Outbox_Executor_Test:test_all_reverts_not_outbox() (gas: 14265)
SolverNet_Outbox_Executor_Test:test_execute_reverts_call_failed() (gas: 20331)
SolverNet_Outbox_Fill_Test:test_fill_call_refund() (gas: 266782)
SolverNet_Outbox_Fill_Test:test_fill_overpayment_refund() (gas: 342913)
SolverNet_Outbox_Fill_Test:test_fill_reverts_already_filled() (gas: 420887)
SolverNet_Outbox_Fill_Test:test_fill_reverts_insufficient_fee() (gas: 405964)
SolverNet_Outbox_Fill_Test:test_fill_call_refund() (gas: 267319)
SolverNet_Outbox_Fill_Test:test_fill_overpayment_refund() (gas: 343449)
SolverNet_Outbox_Fill_Test:test_fill_reverts_already_filled() (gas: 421423)
SolverNet_Outbox_Fill_Test:test_fill_reverts_insufficient_fee() (gas: 406501)
SolverNet_Outbox_Fill_Test:test_fill_reverts_invalid_origin_data() (gas: 78579)
SolverNet_Outbox_Fill_Test:test_fill_reverts_wrong_chain() (gas: 258059)
SolverNet_Outbox_Fill_Test:test_fill_succeeds() (gas: 347718)
SolverNet_Outbox_Fill_Test:test_fill_reverts_wrong_chain() (gas: 258595)
SolverNet_Outbox_Fill_Test:test_fill_succeeds() (gas: 348255)
2 changes: 1 addition & 1 deletion contracts/solve/src/ERC7683/SolverNetInbox.sol
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ contract SolverNetInbox is OwnableRoles, ReentrancyGuard, Initializable, Deploye
});

return ResolvedCrossChainOrder({
user: msg.sender,
user: orderData.user != address(0) ? orderData.user : msg.sender,
originChainId: block.chainid,
openDeadline: uint32(block.timestamp),
fillDeadline: order.fillDeadline,
Expand Down
2 changes: 2 additions & 0 deletions contracts/solve/src/ERC7683/interfaces/ISolverNet.sol
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,12 @@ interface ISolverNet {
/**
* @notice SolverNet ERC-7683 order data.
* Restricted to single call on a destination chain.
* @param user User who the order is for.
* @param call Call to execute on.
* @param deposits Deposits payed by user, locked on source chain. Awarded to solver on fill.
*/
struct OrderData {
address user;
Call call;
Deposit[] deposits;
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/solve/test/ERC7683/E2E.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ contract SolverNet_E2E_Test is TestBase {
expenses: expense
});

ISolverNet.OrderData memory orderData = ISolverNet.OrderData({ call: call, deposits: deposit });
ISolverNet.OrderData memory orderData = ISolverNet.OrderData({ user: user, call: call, deposits: deposit });

IERC7683.OnchainCrossChainOrder memory order = IERC7683.OnchainCrossChainOrder({
fillDeadline: uint32(block.timestamp + 1 minutes),
Expand Down
Loading

0 comments on commit 8916cd5

Please sign in to comment.