@hyperbridge/core 1.0.1 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/contracts/apps/HyperApp.sol +69 -19
- package/contracts/apps/IntentGateway.sol +233 -171
- package/package.json +1 -1
|
@@ -17,6 +17,8 @@ import {PostRequest, PostResponse, GetRequest} from "../libraries/Message.sol";
|
|
|
17
17
|
import {DispatchPost, DispatchPostResponse, DispatchGet, IDispatcher} from "../interfaces/IDispatcher.sol";
|
|
18
18
|
import {IApp, IncomingPostRequest, IncomingPostResponse, IncomingGetResponse} from "../interfaces/IApp.sol";
|
|
19
19
|
|
|
20
|
+
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
|
|
21
|
+
|
|
20
22
|
/**
|
|
21
23
|
* @dev Uniswap interface for estimating fees in the native token
|
|
22
24
|
*/
|
|
@@ -65,19 +67,6 @@ abstract contract HyperApp is IApp {
|
|
|
65
67
|
return request.fee + (len * IDispatcher(host()).perByteFee(request.dest));
|
|
66
68
|
}
|
|
67
69
|
|
|
68
|
-
/**
|
|
69
|
-
* @dev returns the quoted fee in the native token for dispatching a POST request
|
|
70
|
-
*/
|
|
71
|
-
function quoteNative(DispatchPost memory request) public view returns (uint256) {
|
|
72
|
-
uint256 fee = quote(request);
|
|
73
|
-
address _host = host();
|
|
74
|
-
address _uniswap = IDispatcher(_host).uniswapV2Router();
|
|
75
|
-
address[] memory path = new address[](2);
|
|
76
|
-
path[0] = IUniswapV2Router02(_uniswap).WETH();
|
|
77
|
-
path[1] = IDispatcher(_host).feeToken();
|
|
78
|
-
return IUniswapV2Router02(_uniswap).getAmountsIn(fee, path)[0];
|
|
79
|
-
}
|
|
80
|
-
|
|
81
70
|
/**
|
|
82
71
|
* @dev returns the quoted fee in the feeToken for dispatching a GET request
|
|
83
72
|
*/
|
|
@@ -90,9 +79,17 @@ abstract contract HyperApp is IApp {
|
|
|
90
79
|
}
|
|
91
80
|
|
|
92
81
|
/**
|
|
93
|
-
* @dev returns the quoted fee in the
|
|
82
|
+
* @dev returns the quoted fee in the feeToken for dispatching a POST response
|
|
94
83
|
*/
|
|
95
|
-
function
|
|
84
|
+
function quote(DispatchPostResponse memory response) public view returns (uint256) {
|
|
85
|
+
uint256 len = 32 > response.response.length ? 32 : response.response.length;
|
|
86
|
+
return response.fee + (len * IDispatcher(host()).perByteFee(response.request.source));
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* @dev returns the quoted fee in the native token for dispatching a POST request
|
|
91
|
+
*/
|
|
92
|
+
function quoteNative(DispatchPost memory request) public view returns (uint256) {
|
|
96
93
|
uint256 fee = quote(request);
|
|
97
94
|
address _host = host();
|
|
98
95
|
address _uniswap = IDispatcher(_host).uniswapV2Router();
|
|
@@ -103,11 +100,16 @@ abstract contract HyperApp is IApp {
|
|
|
103
100
|
}
|
|
104
101
|
|
|
105
102
|
/**
|
|
106
|
-
* @dev returns the quoted fee in the
|
|
103
|
+
* @dev returns the quoted fee in the native token for dispatching a GET request
|
|
107
104
|
*/
|
|
108
|
-
function
|
|
109
|
-
uint256
|
|
110
|
-
|
|
105
|
+
function quoteNative(DispatchGet memory request) public view returns (uint256) {
|
|
106
|
+
uint256 fee = quote(request);
|
|
107
|
+
address _host = host();
|
|
108
|
+
address _uniswap = IDispatcher(_host).uniswapV2Router();
|
|
109
|
+
address[] memory path = new address[](2);
|
|
110
|
+
path[0] = IUniswapV2Router02(_uniswap).WETH();
|
|
111
|
+
path[1] = IDispatcher(_host).feeToken();
|
|
112
|
+
return IUniswapV2Router02(_uniswap).getAmountsIn(fee, path)[0];
|
|
111
113
|
}
|
|
112
114
|
|
|
113
115
|
/**
|
|
@@ -123,6 +125,54 @@ abstract contract HyperApp is IApp {
|
|
|
123
125
|
return IUniswapV2Router02(_uniswap).getAmountsIn(fee, path)[0];
|
|
124
126
|
}
|
|
125
127
|
|
|
128
|
+
/**
|
|
129
|
+
* @notice Dispatches a POST request using the fee token for payment
|
|
130
|
+
* @dev Handles fee token approval and transfer before dispatching the request to the Host.
|
|
131
|
+
* If the payer is not this contract, transfers fee tokens from the payer to this contract first.
|
|
132
|
+
* @param request The POST request to dispatch containing destination, body, timeout, and fee parameters
|
|
133
|
+
* @param payer The address that will pay the fee token. If different from this contract, must have approved this contract to spend the fee amount
|
|
134
|
+
*/
|
|
135
|
+
function dispatchWithFeeToken(DispatchPost memory request, address payer) internal {
|
|
136
|
+
address hostAddr = host();
|
|
137
|
+
address feeToken = IDispatcher(hostAddr).feeToken();
|
|
138
|
+
uint256 fee = quote(request);
|
|
139
|
+
if (payer != address(this)) IERC20(feeToken).transferFrom(payer, address(this), fee);
|
|
140
|
+
IERC20(feeToken).approve(hostAddr, fee);
|
|
141
|
+
IDispatcher(hostAddr).dispatch(request);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
/**
|
|
145
|
+
* @notice Dispatches a POST response using the fee token for payment
|
|
146
|
+
* @dev Handles fee token approval and transfer before dispatching the response to the Host.
|
|
147
|
+
* If the payer is not this contract, transfers fee tokens from the payer to this contract first.
|
|
148
|
+
* @param response The POST response to dispatch containing the original request, response data, timeout, and fee parameters
|
|
149
|
+
* @param payer The address that will pay the fee token. If different from this contract, must have approved this contract to spend the fee amount
|
|
150
|
+
*/
|
|
151
|
+
function dispatchWithFeeToken(DispatchPostResponse memory response, address payer) internal {
|
|
152
|
+
address hostAddr = host();
|
|
153
|
+
address feeToken = IDispatcher(hostAddr).feeToken();
|
|
154
|
+
uint256 fee = quote(response);
|
|
155
|
+
if (payer != address(this)) IERC20(feeToken).transferFrom(payer, address(this), fee);
|
|
156
|
+
IERC20(feeToken).approve(hostAddr, fee);
|
|
157
|
+
IDispatcher(hostAddr).dispatch(response);
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
/**
|
|
161
|
+
* @notice Dispatches a GET request using the fee token for payment
|
|
162
|
+
* @dev Handles fee token approval and transfer before dispatching the request to the Host.
|
|
163
|
+
* If the payer is not this contract, transfers fee tokens from the payer to this contract first.
|
|
164
|
+
* @param request The GET request to dispatch containing destination, keys, height, timeout, and fee parameters
|
|
165
|
+
* @param payer The address that will pay the fee token. If different from this contract, must have approved this contract to spend the fee amount
|
|
166
|
+
*/
|
|
167
|
+
function dispatchWithFeeToken(DispatchGet memory request, address payer) internal {
|
|
168
|
+
address hostAddr = host();
|
|
169
|
+
address feeToken = IDispatcher(hostAddr).feeToken();
|
|
170
|
+
uint256 fee = quote(request);
|
|
171
|
+
if (payer != address(this)) IERC20(feeToken).transferFrom(payer, address(this), fee);
|
|
172
|
+
IERC20(feeToken).approve(hostAddr, fee);
|
|
173
|
+
IDispatcher(hostAddr).dispatch(request);
|
|
174
|
+
}
|
|
175
|
+
|
|
126
176
|
/**
|
|
127
177
|
* @notice Callback for receiving incoming POST requests
|
|
128
178
|
* @dev Called by the Host when a new POST request is received for this app.
|
|
@@ -18,211 +18,273 @@ pragma solidity ^0.8.17;
|
|
|
18
18
|
* @notice Tokens that must be received for a valid order fulfillment
|
|
19
19
|
*/
|
|
20
20
|
struct PaymentInfo {
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
21
|
+
/// @dev The address of the ERC20 token on the destination chain
|
|
22
|
+
/// @dev address(0) used as a sentinel for the native token
|
|
23
|
+
bytes32 token;
|
|
24
|
+
/// @dev The amount of the token to be sent
|
|
25
|
+
uint256 amount;
|
|
26
|
+
/// @dev The address to receive the output tokens
|
|
27
|
+
bytes32 beneficiary;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
30
|
/**
|
|
31
31
|
* @notice Tokens that must be escrowed for an order
|
|
32
32
|
*/
|
|
33
33
|
struct TokenInfo {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
34
|
+
/// @dev The address of the ERC20 token on the destination chain
|
|
35
|
+
/// @dev address(0) used as a sentinel for the native token
|
|
36
|
+
bytes32 token;
|
|
37
|
+
/// @dev The amount of the token to be sent
|
|
38
|
+
uint256 amount;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* @dev Struct for predispatch information
|
|
43
|
+
*/
|
|
44
|
+
struct PredispatchInfo {
|
|
45
|
+
/// @dev Assets to execute a predispatch call with
|
|
46
|
+
TokenInfo[] assets;
|
|
47
|
+
/// @dev The actual call data to be executed
|
|
48
|
+
bytes call;
|
|
39
49
|
}
|
|
40
50
|
|
|
41
51
|
/**
|
|
42
52
|
* @dev Represents an order in the IntentGateway module.
|
|
43
|
-
* @param Order The structure defining an order.
|
|
44
53
|
*/
|
|
45
54
|
struct Order {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
55
|
+
/// @dev The address of the user who is initiating the transfer
|
|
56
|
+
bytes32 user;
|
|
57
|
+
/// @dev The state machine identifier of the origin chain
|
|
58
|
+
bytes sourceChain;
|
|
59
|
+
/// @dev The state machine identifier of the destination chain
|
|
60
|
+
bytes destChain;
|
|
61
|
+
/// @dev The block number by which the order must be filled on the destination chain
|
|
62
|
+
uint256 deadline;
|
|
63
|
+
/// @dev The nonce of the order
|
|
64
|
+
uint256 nonce;
|
|
65
|
+
/// @dev Represents the dispatch fees associated with the IntentGateway.
|
|
66
|
+
uint256 fees;
|
|
67
|
+
/// @dev The tokens that the filler will provide.
|
|
68
|
+
PaymentInfo[] outputs;
|
|
69
|
+
/// @dev The tokens that are escrowed for the filler.
|
|
70
|
+
TokenInfo[] inputs;
|
|
71
|
+
/// @dev The predispatch information for the order
|
|
72
|
+
PredispatchInfo predispatch;
|
|
73
|
+
/// @dev A bytes array to store the calls if any.
|
|
74
|
+
bytes callData;
|
|
64
75
|
}
|
|
65
76
|
|
|
66
77
|
/**
|
|
67
78
|
* @dev Struct to define the parameters for the IntentGateway module.
|
|
68
79
|
*/
|
|
69
80
|
struct Params {
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
81
|
+
/// @dev The address of the host contract
|
|
82
|
+
address host;
|
|
83
|
+
/// @dev Address of the dispatcher contract responsible for handling intents.
|
|
84
|
+
address dispatcher;
|
|
85
|
+
/// @dev Protocol fee in basis points (BPS) deducted from filler-provided tokens
|
|
86
|
+
uint256 protocolFeeBps;
|
|
74
87
|
}
|
|
75
88
|
|
|
76
89
|
/**
|
|
77
90
|
* @notice A struct representing the options for filling an intent.
|
|
78
|
-
* @dev This struct is used to specify various parameters and options
|
|
79
|
-
* when filling an intent in the IntentGateway contract.
|
|
80
91
|
*/
|
|
81
92
|
struct FillOptions {
|
|
82
|
-
|
|
83
|
-
|
|
93
|
+
/// @dev The fee paid to the relayer for processing transactions.
|
|
94
|
+
uint256 relayerFee;
|
|
84
95
|
}
|
|
85
96
|
|
|
86
97
|
/**
|
|
87
98
|
* @dev Struct representing the options for canceling an intent.
|
|
88
99
|
*/
|
|
89
100
|
struct CancelOptions {
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
/// @dev The fee paid to the relayer for processing transactions.
|
|
102
|
+
uint256 relayerFee;
|
|
103
|
+
/// @dev Stores the height value.
|
|
104
|
+
uint256 height;
|
|
94
105
|
}
|
|
95
106
|
|
|
96
107
|
/**
|
|
97
|
-
* @title
|
|
108
|
+
* @title IIntentGatewayV2
|
|
98
109
|
* @author Polytope Labs (hello@polytope.technology)
|
|
99
|
-
*
|
|
100
|
-
* @dev
|
|
110
|
+
* @notice Interface for the IntentGatewayV2 contract
|
|
111
|
+
* @dev The IntentGateway allows for the creation and fulfillment of cross-chain orders.
|
|
101
112
|
*/
|
|
102
113
|
interface IIntentGateway {
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
114
|
+
/**
|
|
115
|
+
* @dev Enum representing the different kinds of incoming requests that can be executed.
|
|
116
|
+
*/
|
|
117
|
+
enum RequestKind {
|
|
118
|
+
/// @dev Identifies a request for redeeming an escrow.
|
|
119
|
+
RedeemEscrow,
|
|
120
|
+
/// @dev Identifies a request for recording new contract deployments
|
|
121
|
+
NewDeployment,
|
|
122
|
+
/// @dev Identifies a request for updating parameters.
|
|
123
|
+
UpdateParams,
|
|
124
|
+
/// @dev Identifies a request for refunding an escrow.
|
|
125
|
+
RefundEscrow,
|
|
126
|
+
/// @dev Identifies a request for collecting fees.
|
|
127
|
+
CollectFees
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
/// @notice Thrown when an unauthorized action is attempted.
|
|
131
|
+
error Unauthorized();
|
|
132
|
+
|
|
133
|
+
/// @notice Thrown when an invalid input is provided.
|
|
134
|
+
error InvalidInput();
|
|
135
|
+
|
|
136
|
+
/// @notice Thrown when an action is attempted on an expired order.
|
|
137
|
+
error Expired();
|
|
138
|
+
|
|
139
|
+
/// @notice Thrown when there are insufficient native tokens to complete an action.
|
|
140
|
+
error InsufficientNativeToken();
|
|
141
|
+
|
|
142
|
+
/// @notice Thrown when an action is attempted on an order that has not yet expired.
|
|
143
|
+
error NotExpired();
|
|
144
|
+
|
|
145
|
+
/// @notice Thrown when an action is attempted on an order that has already been filled.
|
|
146
|
+
error Filled();
|
|
147
|
+
|
|
148
|
+
/// @notice Thrown when an action is attempted on an order that has been cancelled.
|
|
149
|
+
error Cancelled();
|
|
150
|
+
|
|
151
|
+
/// @notice Thrown when an action is attempted on the wrong chain.
|
|
152
|
+
error WrongChain();
|
|
153
|
+
|
|
154
|
+
/// @notice Thrown when an action is attempted on an unknown order.
|
|
155
|
+
error UnknownOrder();
|
|
156
|
+
|
|
157
|
+
/**
|
|
158
|
+
* @dev Emitted when an order is placed.
|
|
159
|
+
*/
|
|
160
|
+
event OrderPlaced(
|
|
161
|
+
/// @dev The address of the user who is initiating the transfer
|
|
162
|
+
bytes32 user,
|
|
163
|
+
/// @dev The state machine identifier of the origin chain
|
|
164
|
+
bytes sourceChain,
|
|
165
|
+
/// @dev The state machine identifier of the destination chain
|
|
166
|
+
bytes destChain,
|
|
167
|
+
/// @dev The block number by which the order must be filled on the destination chain
|
|
168
|
+
uint256 deadline,
|
|
169
|
+
/// @dev The nonce of the order
|
|
170
|
+
uint256 nonce,
|
|
171
|
+
/// @dev Represents the dispatch fees associated with the IntentGateway.
|
|
172
|
+
uint256 fees,
|
|
173
|
+
/// @dev Assets that were used to execute a predispatch call
|
|
174
|
+
TokenInfo[] predispatch,
|
|
175
|
+
/// @dev The tokens that are escrowed for the filler.
|
|
176
|
+
TokenInfo[] inputs,
|
|
177
|
+
/// @dev The tokens that the filler will provide.
|
|
178
|
+
PaymentInfo[] outputs
|
|
179
|
+
);
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @notice Event emitted when an order is filled.
|
|
183
|
+
* @param commitment The order commitment hash
|
|
184
|
+
* @param filler The address of the filler
|
|
185
|
+
*/
|
|
186
|
+
event OrderFilled(bytes32 commitment, address filler);
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* @notice Event emitted when escrow is released.
|
|
190
|
+
* @param commitment The order commitment hash
|
|
191
|
+
*/
|
|
192
|
+
event EscrowReleased(bytes32 commitment);
|
|
193
|
+
|
|
194
|
+
/**
|
|
195
|
+
* @notice Event emitted when escrow is refunded.
|
|
196
|
+
* @param commitment The order commitment hash
|
|
197
|
+
*/
|
|
198
|
+
event EscrowRefunded(bytes32 commitment);
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* @notice Event emitted when parameters are updated.
|
|
202
|
+
* @param previous The previous parameters
|
|
203
|
+
* @param current The new parameters
|
|
204
|
+
*/
|
|
205
|
+
event ParamsUpdated(Params previous, Params current);
|
|
206
|
+
|
|
207
|
+
/**
|
|
208
|
+
* @notice Event emitted when a new deployment is added.
|
|
209
|
+
* @param stateMachineId The state machine identifier
|
|
210
|
+
* @param gateway The gateway address
|
|
211
|
+
*/
|
|
212
|
+
event NewDeploymentAdded(bytes stateMachineId, bytes32 gateway);
|
|
213
|
+
|
|
214
|
+
/**
|
|
215
|
+
* @dev Emitted when dust is collected from predispatch swaps.
|
|
216
|
+
* @param token The token contract address of the dust, address(0) for native currency.
|
|
217
|
+
* @param amount The amount of dust collected.
|
|
218
|
+
*/
|
|
219
|
+
event DustCollected(address token, uint256 amount);
|
|
220
|
+
|
|
221
|
+
/**
|
|
222
|
+
* @dev Emitted when protocol fee is collected from a filler.
|
|
223
|
+
* @param token The token contract address of the fee, address(0) for native currency.
|
|
224
|
+
* @param amount The amount of protocol fee collected.
|
|
225
|
+
* @param chain The chain where the funds are stored.
|
|
226
|
+
*/
|
|
227
|
+
event FeeCollected(address token, uint256 amount, bytes chain);
|
|
228
|
+
|
|
229
|
+
/**
|
|
230
|
+
* @dev Emitted when protocol revenue is withdrawn.
|
|
231
|
+
* @param token The token contract address of the fee, address(0) for native currency.
|
|
232
|
+
* @param amount The amount of protocol revenue collected.
|
|
233
|
+
* @param beneficiary The beneficiary of the funds
|
|
234
|
+
*/
|
|
235
|
+
event RevenueWithdrawn(address token, uint256 amount, address beneficiary);
|
|
236
|
+
|
|
237
|
+
/**
|
|
238
|
+
* @notice Returns the host address.
|
|
239
|
+
* @return The host contract address
|
|
240
|
+
*/
|
|
241
|
+
function host() external view returns (address);
|
|
242
|
+
|
|
243
|
+
/**
|
|
244
|
+
* @notice Returns the instance address for a given state machine.
|
|
245
|
+
* @param stateMachineId The state machine identifier
|
|
246
|
+
* @return The instance address
|
|
247
|
+
*/
|
|
248
|
+
function instance(bytes calldata stateMachineId) external view returns (bytes32);
|
|
249
|
+
|
|
250
|
+
/**
|
|
251
|
+
* @notice Returns the current gateway parameters.
|
|
252
|
+
* @return The current parameters
|
|
253
|
+
*/
|
|
254
|
+
function params() external view returns (Params memory);
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @notice Calculates the commitment slot hash for an order.
|
|
258
|
+
* @param commitment The order commitment
|
|
259
|
+
* @return The slot hash
|
|
260
|
+
*/
|
|
261
|
+
function calculateCommitmentSlotHash(bytes32 commitment) external pure returns (bytes32);
|
|
262
|
+
|
|
263
|
+
/**
|
|
264
|
+
* @notice Places a new order.
|
|
265
|
+
* @param order The order details
|
|
266
|
+
* @param graffiti Additional data
|
|
267
|
+
*/
|
|
268
|
+
function placeOrder(Order memory order, bytes32 graffiti) external payable;
|
|
269
|
+
|
|
270
|
+
/**
|
|
271
|
+
* @notice Fills an existing order.
|
|
272
|
+
* @param order The order to fill
|
|
273
|
+
* @param options Fill options including relayer fee
|
|
274
|
+
*/
|
|
275
|
+
function fillOrder(Order calldata order, FillOptions memory options) external payable;
|
|
276
|
+
|
|
277
|
+
/**
|
|
278
|
+
* @notice Cancels an order (for expired orders).
|
|
279
|
+
* @param order The order to cancel
|
|
280
|
+
* @param options Cancel options including height and relayer fee
|
|
281
|
+
*/
|
|
282
|
+
function cancelOrder(Order calldata order, CancelOptions memory options) external payable;
|
|
283
|
+
|
|
284
|
+
/**
|
|
285
|
+
* @notice Cancels a limit order (for orders with deadline = 0).
|
|
286
|
+
* @param order The order to cancel
|
|
287
|
+
* @param options Cancel options including relayer fee
|
|
288
|
+
*/
|
|
289
|
+
function cancelLimitOrder(Order calldata order, CancelOptions memory options) external payable;
|
|
228
290
|
}
|
package/package.json
CHANGED