@hyperbridge/core 1.3.0 → 1.4.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.
|
@@ -37,6 +37,10 @@ struct TokenInfo {
|
|
|
37
37
|
uint256 amount;
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
+
/**
|
|
41
|
+
* @notice Information for executing calls before an order is placed on the destination chain
|
|
42
|
+
* @dev Used to specify pre-dispatch operations with associated assets
|
|
43
|
+
*/
|
|
40
44
|
struct DispatchInfo {
|
|
41
45
|
/// @dev Assets to execute a predispatch call with
|
|
42
46
|
TokenInfo[] assets;
|
|
@@ -100,6 +104,28 @@ struct Params {
|
|
|
100
104
|
uint256 protocolFeeBps;
|
|
101
105
|
}
|
|
102
106
|
|
|
107
|
+
/**
|
|
108
|
+
* @dev Struct to define the destination fee parameters.
|
|
109
|
+
*/
|
|
110
|
+
struct DestinationFee {
|
|
111
|
+
/// @dev The percentage of fee (in basis points) charged for the destination chain.
|
|
112
|
+
/// 10000 = 100%, 5000 = 50%, etc.
|
|
113
|
+
uint256 destinationFeeBps;
|
|
114
|
+
/// @dev The state machine ID associated with the destination fee.
|
|
115
|
+
bytes32 stateMachineId;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
/**
|
|
119
|
+
* @dev Struct to define a parameter update request from Hyperbridge
|
|
120
|
+
* @notice Contains both general parameters and destination-specific fee configurations
|
|
121
|
+
*/
|
|
122
|
+
struct ParamsUpdate {
|
|
123
|
+
/// @dev The general parameters for the IntentGateway module
|
|
124
|
+
Params params;
|
|
125
|
+
/// @dev The destination fee parameters for specific chains
|
|
126
|
+
DestinationFee[] destinationFees;
|
|
127
|
+
}
|
|
128
|
+
|
|
103
129
|
/**
|
|
104
130
|
* @dev Struct representing the body of a request.
|
|
105
131
|
*/
|
|
@@ -15,33 +15,33 @@
|
|
|
15
15
|
pragma solidity ^0.8.17;
|
|
16
16
|
|
|
17
17
|
struct TeleportParams {
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
18
|
+
// amount to be sent
|
|
19
|
+
uint256 amount;
|
|
20
|
+
// Relayer fee
|
|
21
|
+
uint256 relayerFee;
|
|
22
|
+
// The token identifier to send
|
|
23
|
+
bytes32 assetId;
|
|
24
|
+
// Redeem ERC20 on the destination?
|
|
25
|
+
bool redeem;
|
|
26
|
+
// recipient address
|
|
27
|
+
bytes32 to;
|
|
28
|
+
// recipient state machine
|
|
29
|
+
bytes dest;
|
|
30
|
+
// request timeout in seconds
|
|
31
|
+
uint64 timeout;
|
|
32
|
+
// Amount of native token to pay for dispatching the request
|
|
33
|
+
// if 0 will use the `IIsmpHost.feeToken`
|
|
34
|
+
uint256 nativeCost;
|
|
35
|
+
// destination contract call data
|
|
36
|
+
bytes data;
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
// Params for the TokenGateway contract
|
|
40
40
|
struct TokenGatewayParams {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
41
|
+
// address of the IsmpHost contract on this chain
|
|
42
|
+
address host;
|
|
43
|
+
// dispatcher for delegating external calls
|
|
44
|
+
address dispatcher;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
47
|
/**
|
|
@@ -55,88 +55,88 @@ struct TokenGatewayParams {
|
|
|
55
55
|
* Otherwise if hyper-fungible tokens are sent, then it simply performs a burn-and-mint.
|
|
56
56
|
*/
|
|
57
57
|
interface ITokenGateway {
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
// User has received some assets
|
|
59
|
+
event AssetReceived(
|
|
60
|
+
// The amount that was provided to the user
|
|
61
|
+
uint256 amount,
|
|
62
|
+
// The associated request commitment
|
|
63
|
+
bytes32 commitment,
|
|
64
|
+
// The source of the funds
|
|
65
|
+
bytes32 indexed from,
|
|
66
|
+
// The beneficiary of the funds
|
|
67
|
+
address indexed beneficiary,
|
|
68
|
+
// The provided assetId
|
|
69
|
+
bytes32 indexed assetId
|
|
70
|
+
);
|
|
71
71
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
72
|
+
// User has sent some assets
|
|
73
|
+
event AssetTeleported(
|
|
74
|
+
// The beneficiary of the funds
|
|
75
|
+
bytes32 to,
|
|
76
|
+
// The destination chain
|
|
77
|
+
string dest,
|
|
78
|
+
// The amount that was requested to be sent
|
|
79
|
+
uint256 amount,
|
|
80
|
+
// The associated request commitment
|
|
81
|
+
bytes32 commitment,
|
|
82
|
+
// The source of the funds
|
|
83
|
+
address indexed from,
|
|
84
|
+
// The provided assetId
|
|
85
|
+
bytes32 indexed assetId,
|
|
86
|
+
// Flag to redeem funds from the TokenGateway
|
|
87
|
+
bool redeem
|
|
88
|
+
);
|
|
89
89
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
90
|
+
// User assets could not be delivered and have been refunded.
|
|
91
|
+
event AssetRefunded(
|
|
92
|
+
// The amount that was requested to be sent
|
|
93
|
+
uint256 amount,
|
|
94
|
+
// The associated request commitment
|
|
95
|
+
bytes32 commitment,
|
|
96
|
+
// The beneficiary of the funds
|
|
97
|
+
address indexed beneficiary,
|
|
98
|
+
// The provided assetId
|
|
99
|
+
bytes32 indexed assetId
|
|
100
|
+
);
|
|
101
101
|
|
|
102
|
-
|
|
103
|
-
|
|
102
|
+
// @dev Unexpected zero address
|
|
103
|
+
error ZeroAddress();
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
// @dev Provided amount was invalid
|
|
106
|
+
error InvalidAmount();
|
|
107
107
|
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
// @dev Provided token was unknown
|
|
109
|
+
error UnknownAsset();
|
|
110
110
|
|
|
111
|
-
|
|
112
|
-
|
|
111
|
+
// @dev Protocol invariant violated
|
|
112
|
+
error InconsistentState();
|
|
113
113
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
114
|
+
/**
|
|
115
|
+
* @dev Read the protocol parameters
|
|
116
|
+
*/
|
|
117
|
+
function params() external view returns (TokenGatewayParams memory);
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
119
|
+
/**
|
|
120
|
+
* @dev Fetch the address for an ERC20 asset
|
|
121
|
+
*/
|
|
122
|
+
function erc20(bytes32 assetId) external view returns (address);
|
|
123
123
|
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
124
|
+
/**
|
|
125
|
+
* @dev Fetch the address for a hyper-fungible asset
|
|
126
|
+
*/
|
|
127
|
+
function erc6160(bytes32 assetId) external view returns (address);
|
|
128
128
|
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
129
|
+
/**
|
|
130
|
+
* @dev Fetch the TokenGateway instance for a destination.
|
|
131
|
+
*/
|
|
132
|
+
function instance(bytes calldata destination) external view returns (address);
|
|
133
133
|
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
134
|
+
/**
|
|
135
|
+
* @dev Teleports a local ERC20/hyper-fungible asset to the destination chain. Allows users to pay
|
|
136
|
+
* the Hyperbridge fees in the native token or `IIsmpHost.feeToken`
|
|
137
|
+
*
|
|
138
|
+
* @notice If a request times out, users can request a refund permissionlessly through
|
|
139
|
+
* `HandlerV1.handlePostRequestTimeouts`.
|
|
140
|
+
*/
|
|
141
|
+
function teleport(TeleportParams calldata teleportParams) external payable;
|
|
142
142
|
}
|
package/package.json
CHANGED