@layerzerolabs/lz-evm-oapp-v2 2.1.3 → 2.1.5
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/artifacts/contracts/oft/OFT.sol/OFT.json +8 -2
- package/artifacts/contracts/oft/OFTAdapter.sol/OFTAdapter.json +8 -2
- package/artifacts/contracts/oft/OFTCore.sol/OFTCore.json +9 -3
- package/artifacts/contracts/oft/interfaces/IOFT.sol/IOFT.json +8 -2
- package/contracts/oft/OFT.sol +0 -14
- package/contracts/oft/OFTAdapter.sol +0 -14
- package/contracts/oft/OFTCore.sol +17 -3
- package/contracts/oft/interfaces/IOFT.sol +3 -2
- package/package.json +7 -7
|
@@ -207,7 +207,7 @@
|
|
|
207
207
|
{
|
|
208
208
|
"indexed": false,
|
|
209
209
|
"internalType": "uint256",
|
|
210
|
-
"name": "
|
|
210
|
+
"name": "amountReceivedLD",
|
|
211
211
|
"type": "uint256"
|
|
212
212
|
}
|
|
213
213
|
],
|
|
@@ -238,7 +238,13 @@
|
|
|
238
238
|
{
|
|
239
239
|
"indexed": false,
|
|
240
240
|
"internalType": "uint256",
|
|
241
|
-
"name": "
|
|
241
|
+
"name": "amountSentLD",
|
|
242
|
+
"type": "uint256"
|
|
243
|
+
},
|
|
244
|
+
{
|
|
245
|
+
"indexed": false,
|
|
246
|
+
"internalType": "uint256",
|
|
247
|
+
"name": "amountReceivedLD",
|
|
242
248
|
"type": "uint256"
|
|
243
249
|
}
|
|
244
250
|
],
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
{
|
|
183
183
|
"indexed": false,
|
|
184
184
|
"internalType": "uint256",
|
|
185
|
-
"name": "
|
|
185
|
+
"name": "amountReceivedLD",
|
|
186
186
|
"type": "uint256"
|
|
187
187
|
}
|
|
188
188
|
],
|
|
@@ -213,7 +213,13 @@
|
|
|
213
213
|
{
|
|
214
214
|
"indexed": false,
|
|
215
215
|
"internalType": "uint256",
|
|
216
|
-
"name": "
|
|
216
|
+
"name": "amountSentLD",
|
|
217
|
+
"type": "uint256"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"indexed": false,
|
|
221
|
+
"internalType": "uint256",
|
|
222
|
+
"name": "amountReceivedLD",
|
|
217
223
|
"type": "uint256"
|
|
218
224
|
}
|
|
219
225
|
],
|
|
@@ -182,7 +182,7 @@
|
|
|
182
182
|
{
|
|
183
183
|
"indexed": false,
|
|
184
184
|
"internalType": "uint256",
|
|
185
|
-
"name": "
|
|
185
|
+
"name": "amountReceivedLD",
|
|
186
186
|
"type": "uint256"
|
|
187
187
|
}
|
|
188
188
|
],
|
|
@@ -213,7 +213,13 @@
|
|
|
213
213
|
{
|
|
214
214
|
"indexed": false,
|
|
215
215
|
"internalType": "uint256",
|
|
216
|
-
"name": "
|
|
216
|
+
"name": "amountSentLD",
|
|
217
|
+
"type": "uint256"
|
|
218
|
+
},
|
|
219
|
+
{
|
|
220
|
+
"indexed": false,
|
|
221
|
+
"internalType": "uint256",
|
|
222
|
+
"name": "amountReceivedLD",
|
|
217
223
|
"type": "uint256"
|
|
218
224
|
}
|
|
219
225
|
],
|
|
@@ -717,7 +723,7 @@
|
|
|
717
723
|
"type": "uint64"
|
|
718
724
|
}
|
|
719
725
|
],
|
|
720
|
-
"stateMutability": "
|
|
726
|
+
"stateMutability": "pure",
|
|
721
727
|
"type": "function"
|
|
722
728
|
},
|
|
723
729
|
{
|
|
@@ -48,7 +48,7 @@
|
|
|
48
48
|
{
|
|
49
49
|
"indexed": false,
|
|
50
50
|
"internalType": "uint256",
|
|
51
|
-
"name": "
|
|
51
|
+
"name": "amountReceivedLD",
|
|
52
52
|
"type": "uint256"
|
|
53
53
|
}
|
|
54
54
|
],
|
|
@@ -79,7 +79,13 @@
|
|
|
79
79
|
{
|
|
80
80
|
"indexed": false,
|
|
81
81
|
"internalType": "uint256",
|
|
82
|
-
"name": "
|
|
82
|
+
"name": "amountSentLD",
|
|
83
|
+
"type": "uint256"
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"indexed": false,
|
|
87
|
+
"internalType": "uint256",
|
|
88
|
+
"name": "amountReceivedLD",
|
|
83
89
|
"type": "uint256"
|
|
84
90
|
}
|
|
85
91
|
],
|
package/contracts/oft/OFT.sol
CHANGED
|
@@ -24,20 +24,6 @@ abstract contract OFT is OFTCore, ERC20 {
|
|
|
24
24
|
address _delegate
|
|
25
25
|
) ERC20(_name, _symbol) OFTCore(decimals(), _lzEndpoint, _delegate) {}
|
|
26
26
|
|
|
27
|
-
/**
|
|
28
|
-
* @notice Retrieves interfaceID and the version of the OFT.
|
|
29
|
-
* @return interfaceId The interface ID.
|
|
30
|
-
* @return version The version.
|
|
31
|
-
*
|
|
32
|
-
* @dev interfaceId: This specific interface ID is '0x02e49c2c'.
|
|
33
|
-
* @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.
|
|
34
|
-
* @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.
|
|
35
|
-
* ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)
|
|
36
|
-
*/
|
|
37
|
-
function oftVersion() external pure virtual returns (bytes4 interfaceId, uint64 version) {
|
|
38
|
-
return (type(IOFT).interfaceId, 1);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
27
|
/**
|
|
42
28
|
* @dev Retrieves the address of the underlying ERC20 implementation.
|
|
43
29
|
* @return The address of the OFT token.
|
|
@@ -36,20 +36,6 @@ abstract contract OFTAdapter is OFTCore {
|
|
|
36
36
|
innerToken = IERC20(_token);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
|
-
/**
|
|
40
|
-
* @notice Retrieves interfaceID and the version of the OFT.
|
|
41
|
-
* @return interfaceId The interface ID.
|
|
42
|
-
* @return version The version.
|
|
43
|
-
*
|
|
44
|
-
* @dev interfaceId: This specific interface ID is '0x02e49c2c'.
|
|
45
|
-
* @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.
|
|
46
|
-
* @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.
|
|
47
|
-
* ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)
|
|
48
|
-
*/
|
|
49
|
-
function oftVersion() external pure virtual returns (bytes4 interfaceId, uint64 version) {
|
|
50
|
-
return (type(IOFT).interfaceId, 1);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
39
|
/**
|
|
54
40
|
* @dev Retrieves the address of the underlying ERC20 implementation.
|
|
55
41
|
* @return The address of the adapted ERC-20 token.
|
|
@@ -56,6 +56,20 @@ abstract contract OFTCore is IOFT, OApp, OAppPreCrimeSimulator, OAppOptionsType3
|
|
|
56
56
|
decimalConversionRate = 10 ** (_localDecimals - sharedDecimals());
|
|
57
57
|
}
|
|
58
58
|
|
|
59
|
+
/**
|
|
60
|
+
* @notice Retrieves interfaceID and the version of the OFT.
|
|
61
|
+
* @return interfaceId The interface ID.
|
|
62
|
+
* @return version The version.
|
|
63
|
+
*
|
|
64
|
+
* @dev interfaceId: This specific interface ID is '0x02e49c2c'.
|
|
65
|
+
* @dev version: Indicates a cross-chain compatible msg encoding with other OFTs.
|
|
66
|
+
* @dev If a new feature is added to the OFT cross-chain msg encoding, the version will be incremented.
|
|
67
|
+
* ie. localOFT version(x,1) CAN send messages to remoteOFT version(x,1)
|
|
68
|
+
*/
|
|
69
|
+
function oftVersion() external pure virtual returns (bytes4 interfaceId, uint64 version) {
|
|
70
|
+
return (type(IOFT).interfaceId, 1);
|
|
71
|
+
}
|
|
72
|
+
|
|
59
73
|
/**
|
|
60
74
|
* @dev Retrieves the shared decimals of the OFT.
|
|
61
75
|
* @return The shared decimals of the OFT.
|
|
@@ -162,8 +176,8 @@ abstract contract OFTCore is IOFT, OApp, OAppPreCrimeSimulator, OAppOptionsType3
|
|
|
162
176
|
address _refundAddress
|
|
163
177
|
) external payable virtual returns (MessagingReceipt memory msgReceipt, OFTReceipt memory oftReceipt) {
|
|
164
178
|
// @dev Applies the token transfers regarding this send() operation.
|
|
165
|
-
// - amountSentLD is the amount in local decimals that was ACTUALLY sent from the sender.
|
|
166
|
-
// - amountReceivedLD is the amount in local decimals that will be credited to the recipient on the remote OFT instance.
|
|
179
|
+
// - amountSentLD is the amount in local decimals that was ACTUALLY sent/debited from the sender.
|
|
180
|
+
// - amountReceivedLD is the amount in local decimals that will be received/credited to the recipient on the remote OFT instance.
|
|
167
181
|
(uint256 amountSentLD, uint256 amountReceivedLD) = _debit(
|
|
168
182
|
_sendParam.amountLD,
|
|
169
183
|
_sendParam.minAmountLD,
|
|
@@ -178,7 +192,7 @@ abstract contract OFTCore is IOFT, OApp, OAppPreCrimeSimulator, OAppOptionsType3
|
|
|
178
192
|
// @dev Formulate the OFT receipt.
|
|
179
193
|
oftReceipt = OFTReceipt(amountSentLD, amountReceivedLD);
|
|
180
194
|
|
|
181
|
-
emit OFTSent(msgReceipt.guid, _sendParam.dstEid, msg.sender, amountSentLD);
|
|
195
|
+
emit OFTSent(msgReceipt.guid, _sendParam.dstEid, msg.sender, amountSentLD, amountReceivedLD);
|
|
182
196
|
}
|
|
183
197
|
|
|
184
198
|
/**
|
|
@@ -60,13 +60,14 @@ interface IOFT {
|
|
|
60
60
|
bytes32 indexed guid, // GUID of the OFT message.
|
|
61
61
|
uint32 dstEid, // Destination Endpoint ID.
|
|
62
62
|
address indexed fromAddress, // Address of the sender on the src chain.
|
|
63
|
-
uint256
|
|
63
|
+
uint256 amountSentLD, // Amount of tokens sent in local decimals.
|
|
64
|
+
uint256 amountReceivedLD // Amount of tokens received in local decimals.
|
|
64
65
|
);
|
|
65
66
|
event OFTReceived(
|
|
66
67
|
bytes32 indexed guid, // GUID of the OFT message.
|
|
67
68
|
uint32 srcEid, // Source Endpoint ID.
|
|
68
69
|
address indexed toAddress, // Address of the recipient on the dst chain.
|
|
69
|
-
uint256
|
|
70
|
+
uint256 amountReceivedLD // Amount of tokens received in local decimals.
|
|
70
71
|
);
|
|
71
72
|
|
|
72
73
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@layerzerolabs/lz-evm-oapp-v2",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.5",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"artifacts/contracts/**/!(*.dbg).json",
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
},
|
|
12
12
|
"dependencies": {},
|
|
13
13
|
"devDependencies": {
|
|
14
|
-
"@layerzerolabs/lz-evm-messagelib-v2": "^2.1.
|
|
15
|
-
"@layerzerolabs/lz-evm-protocol-v2": "^2.1.
|
|
16
|
-
"@layerzerolabs/lz-evm-v1-0.7": "^2.1.
|
|
14
|
+
"@layerzerolabs/lz-evm-messagelib-v2": "^2.1.5",
|
|
15
|
+
"@layerzerolabs/lz-evm-protocol-v2": "^2.1.5",
|
|
16
|
+
"@layerzerolabs/lz-evm-v1-0.7": "^2.1.5",
|
|
17
17
|
"@openzeppelin/contracts": "^4.8.1",
|
|
18
18
|
"@openzeppelin/contracts-upgradeable": "^4.8.1",
|
|
19
19
|
"hardhat-deploy": "^0.11.44",
|
|
@@ -21,9 +21,9 @@
|
|
|
21
21
|
"solidity-bytes-utils": "^0.8.0"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@layerzerolabs/lz-evm-messagelib-v2": "^2.1.
|
|
25
|
-
"@layerzerolabs/lz-evm-protocol-v2": "^2.1.
|
|
26
|
-
"@layerzerolabs/lz-evm-v1-0.7": "^2.1.
|
|
24
|
+
"@layerzerolabs/lz-evm-messagelib-v2": "^2.1.5",
|
|
25
|
+
"@layerzerolabs/lz-evm-protocol-v2": "^2.1.5",
|
|
26
|
+
"@layerzerolabs/lz-evm-v1-0.7": "^2.1.5",
|
|
27
27
|
"@openzeppelin/contracts": "^4.8.1 || ^5.0.0",
|
|
28
28
|
"@openzeppelin/contracts-upgradeable": "^4.8.1 || ^5.0.0",
|
|
29
29
|
"hardhat-deploy": "^0.11.44",
|