@layerzerolabs/lz-evm-oapp-v1 1.5.25
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/libraries/LzLib.sol +86 -0
- package/contracts/lzApp/LzApp.sol +165 -0
- package/contracts/lzApp/NonblockingLzApp.sol +87 -0
- package/contracts/mocks/LZEndpointMock.sol +442 -0
- package/contracts/util/BytesLib.sol +490 -0
- package/contracts/util/ExcessivelySafeCall.sol +133 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/index.d.ts +3 -0
- package/dist/typechain-types/@layerzerolabs/index.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/index.js +3 -0
- package/dist/typechain-types/@layerzerolabs/index.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/index.d.ts +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/index.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/index.js +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/index.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint.d.ts +295 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint.js +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver.d.ts +56 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver.js +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig.d.ts +104 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig.js +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.d.ts +4 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.js +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.js.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/index.d.ts +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/index.d.ts.map +1 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/index.js +3 -0
- package/dist/typechain-types/@layerzerolabs/lz-evm-v1-0.7/index.js.map +1 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/Ownable.d.ts +90 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/Ownable.d.ts.map +1 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/Ownable.js +3 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/Ownable.js.map +1 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/index.d.ts +2 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/index.d.ts.map +1 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/index.js +3 -0
- package/dist/typechain-types/@openzeppelin/contracts/access/index.js.map +1 -0
- package/dist/typechain-types/@openzeppelin/contracts/index.d.ts +3 -0
- package/dist/typechain-types/@openzeppelin/contracts/index.d.ts.map +1 -0
- package/dist/typechain-types/@openzeppelin/contracts/index.js +3 -0
- package/dist/typechain-types/@openzeppelin/contracts/index.js.map +1 -0
- package/dist/typechain-types/@openzeppelin/index.d.ts +3 -0
- package/dist/typechain-types/@openzeppelin/index.d.ts.map +1 -0
- package/dist/typechain-types/@openzeppelin/index.js +3 -0
- package/dist/typechain-types/@openzeppelin/index.js.map +1 -0
- package/dist/typechain-types/common.d.ts +23 -0
- package/dist/typechain-types/common.d.ts.map +1 -0
- package/dist/typechain-types/common.js +3 -0
- package/dist/typechain-types/common.js.map +1 -0
- package/dist/typechain-types/contracts/index.d.ts +5 -0
- package/dist/typechain-types/contracts/index.d.ts.map +1 -0
- package/dist/typechain-types/contracts/index.js +3 -0
- package/dist/typechain-types/contracts/index.js.map +1 -0
- package/dist/typechain-types/contracts/lzApp/LzApp.d.ts +359 -0
- package/dist/typechain-types/contracts/lzApp/LzApp.d.ts.map +1 -0
- package/dist/typechain-types/contracts/lzApp/LzApp.js +3 -0
- package/dist/typechain-types/contracts/lzApp/LzApp.js.map +1 -0
- package/dist/typechain-types/contracts/lzApp/NonblockingLzApp.d.ts +449 -0
- package/dist/typechain-types/contracts/lzApp/NonblockingLzApp.d.ts.map +1 -0
- package/dist/typechain-types/contracts/lzApp/NonblockingLzApp.js +3 -0
- package/dist/typechain-types/contracts/lzApp/NonblockingLzApp.js.map +1 -0
- package/dist/typechain-types/contracts/lzApp/index.d.ts +3 -0
- package/dist/typechain-types/contracts/lzApp/index.d.ts.map +1 -0
- package/dist/typechain-types/contracts/lzApp/index.js +3 -0
- package/dist/typechain-types/contracts/lzApp/index.js.map +1 -0
- package/dist/typechain-types/contracts/mocks/LZEndpointMock.d.ts +665 -0
- package/dist/typechain-types/contracts/mocks/LZEndpointMock.d.ts.map +1 -0
- package/dist/typechain-types/contracts/mocks/LZEndpointMock.js +3 -0
- package/dist/typechain-types/contracts/mocks/LZEndpointMock.js.map +1 -0
- package/dist/typechain-types/contracts/mocks/index.d.ts +2 -0
- package/dist/typechain-types/contracts/mocks/index.d.ts.map +1 -0
- package/dist/typechain-types/contracts/mocks/index.js +3 -0
- package/dist/typechain-types/contracts/mocks/index.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/index.d.ts +2 -0
- package/dist/typechain-types/factories/@layerzerolabs/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/index.js +31 -0
- package/dist/typechain-types/factories/@layerzerolabs/index.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/index.d.ts +2 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/index.js +31 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/index.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint__factory.d.ts +343 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint__factory.js +456 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroEndpoint__factory.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver__factory.d.ts +31 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver__factory.js +48 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroReceiver__factory.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig__factory.d.ts +65 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig__factory.js +92 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/ILayerZeroUserApplicationConfig__factory.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.d.ts +4 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.js +13 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/contracts/interfaces/index.js.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/index.d.ts +2 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/index.js +31 -0
- package/dist/typechain-types/factories/@layerzerolabs/lz-evm-v1-0.7/index.js.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/Ownable__factory.d.ts +50 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/Ownable__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/Ownable__factory.js +72 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/Ownable__factory.js.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/index.d.ts +2 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/index.js +9 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/access/index.js.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/index.d.ts +2 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/index.js +31 -0
- package/dist/typechain-types/factories/@openzeppelin/contracts/index.js.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/index.d.ts +2 -0
- package/dist/typechain-types/factories/@openzeppelin/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/@openzeppelin/index.js +31 -0
- package/dist/typechain-types/factories/@openzeppelin/index.js.map +1 -0
- package/dist/typechain-types/factories/contracts/index.d.ts +3 -0
- package/dist/typechain-types/factories/contracts/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/contracts/index.js +32 -0
- package/dist/typechain-types/factories/contracts/index.js.map +1 -0
- package/dist/typechain-types/factories/contracts/lzApp/LzApp__factory.d.ts +354 -0
- package/dist/typechain-types/factories/contracts/lzApp/LzApp__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/contracts/lzApp/LzApp__factory.js +466 -0
- package/dist/typechain-types/factories/contracts/lzApp/LzApp__factory.js.map +1 -0
- package/dist/typechain-types/factories/contracts/lzApp/NonblockingLzApp__factory.d.ts +475 -0
- package/dist/typechain-types/factories/contracts/lzApp/NonblockingLzApp__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/contracts/lzApp/NonblockingLzApp__factory.js +619 -0
- package/dist/typechain-types/factories/contracts/lzApp/NonblockingLzApp__factory.js.map +1 -0
- package/dist/typechain-types/factories/contracts/lzApp/index.d.ts +3 -0
- package/dist/typechain-types/factories/contracts/lzApp/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/contracts/lzApp/index.js +11 -0
- package/dist/typechain-types/factories/contracts/lzApp/index.js.map +1 -0
- package/dist/typechain-types/factories/contracts/mocks/LZEndpointMock__factory.d.ts +738 -0
- package/dist/typechain-types/factories/contracts/mocks/LZEndpointMock__factory.d.ts.map +1 -0
- package/dist/typechain-types/factories/contracts/mocks/LZEndpointMock__factory.js +971 -0
- package/dist/typechain-types/factories/contracts/mocks/LZEndpointMock__factory.js.map +1 -0
- package/dist/typechain-types/factories/contracts/mocks/index.d.ts +2 -0
- package/dist/typechain-types/factories/contracts/mocks/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/contracts/mocks/index.js +9 -0
- package/dist/typechain-types/factories/contracts/mocks/index.js.map +1 -0
- package/dist/typechain-types/factories/index.d.ts +4 -0
- package/dist/typechain-types/factories/index.d.ts.map +1 -0
- package/dist/typechain-types/factories/index.js +33 -0
- package/dist/typechain-types/factories/index.js.map +1 -0
- package/dist/typechain-types/index.d.ts +22 -0
- package/dist/typechain-types/index.d.ts.map +1 -0
- package/dist/typechain-types/index.js +42 -0
- package/dist/typechain-types/index.js.map +1 -0
- package/package.json +56 -0
|
@@ -0,0 +1,490 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
/*
|
|
4
|
+
* @title Solidity Bytes Arrays Utils
|
|
5
|
+
* @author Gonçalo Sá <goncalo.sa@consensys.net>
|
|
6
|
+
*
|
|
7
|
+
* @dev Bytes tightly packed arrays utility library for ethereum contracts written in Solidity.
|
|
8
|
+
* The library lets you concatenate, slice and type cast bytes arrays both in memory and storage.
|
|
9
|
+
*/
|
|
10
|
+
pragma solidity >=0.8.0 <0.9.0;
|
|
11
|
+
|
|
12
|
+
library BytesLib {
|
|
13
|
+
function concat(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bytes memory) {
|
|
14
|
+
bytes memory tempBytes;
|
|
15
|
+
|
|
16
|
+
assembly {
|
|
17
|
+
// Get a location of some free memory and store it in tempBytes as
|
|
18
|
+
// Solidity does for memory variables.
|
|
19
|
+
tempBytes := mload(0x40)
|
|
20
|
+
|
|
21
|
+
// Store the length of the first bytes array at the beginning of
|
|
22
|
+
// the memory for tempBytes.
|
|
23
|
+
let length := mload(_preBytes)
|
|
24
|
+
mstore(tempBytes, length)
|
|
25
|
+
|
|
26
|
+
// Maintain a memory counter for the current write location in the
|
|
27
|
+
// temp bytes array by adding the 32 bytes for the array length to
|
|
28
|
+
// the starting location.
|
|
29
|
+
let mc := add(tempBytes, 0x20)
|
|
30
|
+
// Stop copying when the memory counter reaches the length of the
|
|
31
|
+
// first bytes array.
|
|
32
|
+
let end := add(mc, length)
|
|
33
|
+
|
|
34
|
+
for {
|
|
35
|
+
// Initialize a copy counter to the start of the _preBytes data,
|
|
36
|
+
// 32 bytes into its memory.
|
|
37
|
+
let cc := add(_preBytes, 0x20)
|
|
38
|
+
} lt(mc, end) {
|
|
39
|
+
// Increase both counters by 32 bytes each iteration.
|
|
40
|
+
mc := add(mc, 0x20)
|
|
41
|
+
cc := add(cc, 0x20)
|
|
42
|
+
} {
|
|
43
|
+
// Write the _preBytes data into the tempBytes memory 32 bytes
|
|
44
|
+
// at a time.
|
|
45
|
+
mstore(mc, mload(cc))
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Add the length of _postBytes to the current length of tempBytes
|
|
49
|
+
// and store it as the new length in the first 32 bytes of the
|
|
50
|
+
// tempBytes memory.
|
|
51
|
+
length := mload(_postBytes)
|
|
52
|
+
mstore(tempBytes, add(length, mload(tempBytes)))
|
|
53
|
+
|
|
54
|
+
// Move the memory counter back from a multiple of 0x20 to the
|
|
55
|
+
// actual end of the _preBytes data.
|
|
56
|
+
mc := end
|
|
57
|
+
// Stop copying when the memory counter reaches the new combined
|
|
58
|
+
// length of the arrays.
|
|
59
|
+
end := add(mc, length)
|
|
60
|
+
|
|
61
|
+
for {
|
|
62
|
+
let cc := add(_postBytes, 0x20)
|
|
63
|
+
} lt(mc, end) {
|
|
64
|
+
mc := add(mc, 0x20)
|
|
65
|
+
cc := add(cc, 0x20)
|
|
66
|
+
} {
|
|
67
|
+
mstore(mc, mload(cc))
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Update the free-memory pointer by padding our last write location
|
|
71
|
+
// to 32 bytes: add 31 bytes to the end of tempBytes to move to the
|
|
72
|
+
// next 32 byte block, then round down to the nearest multiple of
|
|
73
|
+
// 32. If the sum of the length of the two arrays is zero then add
|
|
74
|
+
// one before rounding down to leave a blank 32 bytes (the length block with 0).
|
|
75
|
+
mstore(
|
|
76
|
+
0x40,
|
|
77
|
+
and(
|
|
78
|
+
add(add(end, iszero(add(length, mload(_preBytes)))), 31),
|
|
79
|
+
not(31) // Round down to the nearest 32 bytes.
|
|
80
|
+
)
|
|
81
|
+
)
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
return tempBytes;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
function concatStorage(bytes storage _preBytes, bytes memory _postBytes) internal {
|
|
88
|
+
assembly {
|
|
89
|
+
// Read the first 32 bytes of _preBytes storage, which is the length
|
|
90
|
+
// of the array. (We don't need to use the offset into the slot
|
|
91
|
+
// because arrays use the entire slot.)
|
|
92
|
+
let fslot := sload(_preBytes.slot)
|
|
93
|
+
// Arrays of 31 bytes or less have an even value in their slot,
|
|
94
|
+
// while longer arrays have an odd value. The actual length is
|
|
95
|
+
// the slot divided by two for odd values, and the lowest order
|
|
96
|
+
// byte divided by two for even values.
|
|
97
|
+
// If the slot is even, bitwise and the slot with 255 and divide by
|
|
98
|
+
// two to get the length. If the slot is odd, bitwise and the slot
|
|
99
|
+
// with -1 and divide by two.
|
|
100
|
+
let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
|
|
101
|
+
let mlength := mload(_postBytes)
|
|
102
|
+
let newlength := add(slength, mlength)
|
|
103
|
+
// slength can contain both the length and contents of the array
|
|
104
|
+
// if length < 32 bytes so let's prepare for that
|
|
105
|
+
// v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
|
|
106
|
+
switch add(lt(slength, 32), lt(newlength, 32))
|
|
107
|
+
case 2 {
|
|
108
|
+
// Since the new array still fits in the slot, we just need to
|
|
109
|
+
// update the contents of the slot.
|
|
110
|
+
// uint256(bytes_storage) = uint256(bytes_storage) + uint256(bytes_memory) + new_length
|
|
111
|
+
sstore(
|
|
112
|
+
_preBytes.slot,
|
|
113
|
+
// all the modifications to the slot are inside this
|
|
114
|
+
// next block
|
|
115
|
+
add(
|
|
116
|
+
// we can just add to the slot contents because the
|
|
117
|
+
// bytes we want to change are the LSBs
|
|
118
|
+
fslot,
|
|
119
|
+
add(
|
|
120
|
+
mul(
|
|
121
|
+
div(
|
|
122
|
+
// load the bytes from memory
|
|
123
|
+
mload(add(_postBytes, 0x20)),
|
|
124
|
+
// zero all bytes to the right
|
|
125
|
+
exp(0x100, sub(32, mlength))
|
|
126
|
+
),
|
|
127
|
+
// and now shift left the number of bytes to
|
|
128
|
+
// leave space for the length in the slot
|
|
129
|
+
exp(0x100, sub(32, newlength))
|
|
130
|
+
),
|
|
131
|
+
// increase length by the double of the memory
|
|
132
|
+
// bytes length
|
|
133
|
+
mul(mlength, 2)
|
|
134
|
+
)
|
|
135
|
+
)
|
|
136
|
+
)
|
|
137
|
+
}
|
|
138
|
+
case 1 {
|
|
139
|
+
// The stored value fits in the slot, but the combined value
|
|
140
|
+
// will exceed it.
|
|
141
|
+
// get the keccak hash to get the contents of the array
|
|
142
|
+
mstore(0x0, _preBytes.slot)
|
|
143
|
+
let sc := add(keccak256(0x0, 0x20), div(slength, 32))
|
|
144
|
+
|
|
145
|
+
// save new length
|
|
146
|
+
sstore(_preBytes.slot, add(mul(newlength, 2), 1))
|
|
147
|
+
|
|
148
|
+
// The contents of the _postBytes array start 32 bytes into
|
|
149
|
+
// the structure. Our first read should obtain the `submod`
|
|
150
|
+
// bytes that can fit into the unused space in the last word
|
|
151
|
+
// of the stored array. To get this, we read 32 bytes starting
|
|
152
|
+
// from `submod`, so the data we read overlaps with the array
|
|
153
|
+
// contents by `submod` bytes. Masking the lowest-order
|
|
154
|
+
// `submod` bytes allows us to add that value directly to the
|
|
155
|
+
// stored value.
|
|
156
|
+
|
|
157
|
+
let submod := sub(32, slength)
|
|
158
|
+
let mc := add(_postBytes, submod)
|
|
159
|
+
let end := add(_postBytes, mlength)
|
|
160
|
+
let mask := sub(exp(0x100, submod), 1)
|
|
161
|
+
|
|
162
|
+
sstore(
|
|
163
|
+
sc,
|
|
164
|
+
add(
|
|
165
|
+
and(fslot, 0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff00),
|
|
166
|
+
and(mload(mc), mask)
|
|
167
|
+
)
|
|
168
|
+
)
|
|
169
|
+
|
|
170
|
+
for {
|
|
171
|
+
mc := add(mc, 0x20)
|
|
172
|
+
sc := add(sc, 1)
|
|
173
|
+
} lt(mc, end) {
|
|
174
|
+
sc := add(sc, 1)
|
|
175
|
+
mc := add(mc, 0x20)
|
|
176
|
+
} {
|
|
177
|
+
sstore(sc, mload(mc))
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
mask := exp(0x100, sub(mc, end))
|
|
181
|
+
|
|
182
|
+
sstore(sc, mul(div(mload(mc), mask), mask))
|
|
183
|
+
}
|
|
184
|
+
default {
|
|
185
|
+
// get the keccak hash to get the contents of the array
|
|
186
|
+
mstore(0x0, _preBytes.slot)
|
|
187
|
+
// Start copying to the last used word of the stored array.
|
|
188
|
+
let sc := add(keccak256(0x0, 0x20), div(slength, 32))
|
|
189
|
+
|
|
190
|
+
// save new length
|
|
191
|
+
sstore(_preBytes.slot, add(mul(newlength, 2), 1))
|
|
192
|
+
|
|
193
|
+
// Copy over the first `submod` bytes of the new data as in
|
|
194
|
+
// case 1 above.
|
|
195
|
+
let slengthmod := mod(slength, 32)
|
|
196
|
+
let mlengthmod := mod(mlength, 32)
|
|
197
|
+
let submod := sub(32, slengthmod)
|
|
198
|
+
let mc := add(_postBytes, submod)
|
|
199
|
+
let end := add(_postBytes, mlength)
|
|
200
|
+
let mask := sub(exp(0x100, submod), 1)
|
|
201
|
+
|
|
202
|
+
sstore(sc, add(sload(sc), and(mload(mc), mask)))
|
|
203
|
+
|
|
204
|
+
for {
|
|
205
|
+
sc := add(sc, 1)
|
|
206
|
+
mc := add(mc, 0x20)
|
|
207
|
+
} lt(mc, end) {
|
|
208
|
+
sc := add(sc, 1)
|
|
209
|
+
mc := add(mc, 0x20)
|
|
210
|
+
} {
|
|
211
|
+
sstore(sc, mload(mc))
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
mask := exp(0x100, sub(mc, end))
|
|
215
|
+
|
|
216
|
+
sstore(sc, mul(div(mload(mc), mask), mask))
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
function slice(bytes memory _bytes, uint256 _start, uint256 _length) internal pure returns (bytes memory) {
|
|
222
|
+
require(_length + 31 >= _length, "slice_overflow");
|
|
223
|
+
require(_bytes.length >= _start + _length, "slice_outOfBounds");
|
|
224
|
+
|
|
225
|
+
bytes memory tempBytes;
|
|
226
|
+
|
|
227
|
+
assembly {
|
|
228
|
+
switch iszero(_length)
|
|
229
|
+
case 0 {
|
|
230
|
+
// Get a location of some free memory and store it in tempBytes as
|
|
231
|
+
// Solidity does for memory variables.
|
|
232
|
+
tempBytes := mload(0x40)
|
|
233
|
+
|
|
234
|
+
// The first word of the slice result is potentially a partial
|
|
235
|
+
// word read from the original array. To read it, we calculate
|
|
236
|
+
// the length of that partial word and start copying that many
|
|
237
|
+
// bytes into the array. The first word we copy will start with
|
|
238
|
+
// data we don't care about, but the last `lengthmod` bytes will
|
|
239
|
+
// land at the beginning of the contents of the new array. When
|
|
240
|
+
// we're done copying, we overwrite the full first word with
|
|
241
|
+
// the actual length of the slice.
|
|
242
|
+
let lengthmod := and(_length, 31)
|
|
243
|
+
|
|
244
|
+
// The multiplication in the next line is necessary
|
|
245
|
+
// because when slicing multiples of 32 bytes (lengthmod == 0)
|
|
246
|
+
// the following copy loop was copying the origin's length
|
|
247
|
+
// and then ending prematurely not copying everything it should.
|
|
248
|
+
let mc := add(add(tempBytes, lengthmod), mul(0x20, iszero(lengthmod)))
|
|
249
|
+
let end := add(mc, _length)
|
|
250
|
+
|
|
251
|
+
for {
|
|
252
|
+
// The multiplication in the next line has the same exact purpose
|
|
253
|
+
// as the one above.
|
|
254
|
+
let cc := add(add(add(_bytes, lengthmod), mul(0x20, iszero(lengthmod))), _start)
|
|
255
|
+
} lt(mc, end) {
|
|
256
|
+
mc := add(mc, 0x20)
|
|
257
|
+
cc := add(cc, 0x20)
|
|
258
|
+
} {
|
|
259
|
+
mstore(mc, mload(cc))
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
mstore(tempBytes, _length)
|
|
263
|
+
|
|
264
|
+
//update free-memory pointer
|
|
265
|
+
//allocating the array padded to 32 bytes like the compiler does now
|
|
266
|
+
mstore(0x40, and(add(mc, 31), not(31)))
|
|
267
|
+
}
|
|
268
|
+
//if we want a zero-length slice let's just return a zero-length array
|
|
269
|
+
default {
|
|
270
|
+
tempBytes := mload(0x40)
|
|
271
|
+
//zero out the 32 bytes slice we are about to return
|
|
272
|
+
//we need to do it because Solidity does not garbage collect
|
|
273
|
+
mstore(tempBytes, 0)
|
|
274
|
+
|
|
275
|
+
mstore(0x40, add(tempBytes, 0x20))
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
|
|
279
|
+
return tempBytes;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
function toAddress(bytes memory _bytes, uint256 _start) internal pure returns (address) {
|
|
283
|
+
require(_bytes.length >= _start + 20, "toAddress_outOfBounds");
|
|
284
|
+
address tempAddress;
|
|
285
|
+
|
|
286
|
+
assembly {
|
|
287
|
+
tempAddress := div(mload(add(add(_bytes, 0x20), _start)), 0x1000000000000000000000000)
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
return tempAddress;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
function toUint8(bytes memory _bytes, uint256 _start) internal pure returns (uint8) {
|
|
294
|
+
require(_bytes.length >= _start + 1, "toUint8_outOfBounds");
|
|
295
|
+
uint8 tempUint;
|
|
296
|
+
|
|
297
|
+
assembly {
|
|
298
|
+
tempUint := mload(add(add(_bytes, 0x1), _start))
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
return tempUint;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
function toUint16(bytes memory _bytes, uint256 _start) internal pure returns (uint16) {
|
|
305
|
+
require(_bytes.length >= _start + 2, "toUint16_outOfBounds");
|
|
306
|
+
uint16 tempUint;
|
|
307
|
+
|
|
308
|
+
assembly {
|
|
309
|
+
tempUint := mload(add(add(_bytes, 0x2), _start))
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
return tempUint;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
function toUint32(bytes memory _bytes, uint256 _start) internal pure returns (uint32) {
|
|
316
|
+
require(_bytes.length >= _start + 4, "toUint32_outOfBounds");
|
|
317
|
+
uint32 tempUint;
|
|
318
|
+
|
|
319
|
+
assembly {
|
|
320
|
+
tempUint := mload(add(add(_bytes, 0x4), _start))
|
|
321
|
+
}
|
|
322
|
+
|
|
323
|
+
return tempUint;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
function toUint64(bytes memory _bytes, uint256 _start) internal pure returns (uint64) {
|
|
327
|
+
require(_bytes.length >= _start + 8, "toUint64_outOfBounds");
|
|
328
|
+
uint64 tempUint;
|
|
329
|
+
|
|
330
|
+
assembly {
|
|
331
|
+
tempUint := mload(add(add(_bytes, 0x8), _start))
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
return tempUint;
|
|
335
|
+
}
|
|
336
|
+
|
|
337
|
+
function toUint96(bytes memory _bytes, uint256 _start) internal pure returns (uint96) {
|
|
338
|
+
require(_bytes.length >= _start + 12, "toUint96_outOfBounds");
|
|
339
|
+
uint96 tempUint;
|
|
340
|
+
|
|
341
|
+
assembly {
|
|
342
|
+
tempUint := mload(add(add(_bytes, 0xc), _start))
|
|
343
|
+
}
|
|
344
|
+
|
|
345
|
+
return tempUint;
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
function toUint128(bytes memory _bytes, uint256 _start) internal pure returns (uint128) {
|
|
349
|
+
require(_bytes.length >= _start + 16, "toUint128_outOfBounds");
|
|
350
|
+
uint128 tempUint;
|
|
351
|
+
|
|
352
|
+
assembly {
|
|
353
|
+
tempUint := mload(add(add(_bytes, 0x10), _start))
|
|
354
|
+
}
|
|
355
|
+
|
|
356
|
+
return tempUint;
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
function toUint256(bytes memory _bytes, uint256 _start) internal pure returns (uint256) {
|
|
360
|
+
require(_bytes.length >= _start + 32, "toUint256_outOfBounds");
|
|
361
|
+
uint256 tempUint;
|
|
362
|
+
|
|
363
|
+
assembly {
|
|
364
|
+
tempUint := mload(add(add(_bytes, 0x20), _start))
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
return tempUint;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
function toBytes32(bytes memory _bytes, uint256 _start) internal pure returns (bytes32) {
|
|
371
|
+
require(_bytes.length >= _start + 32, "toBytes32_outOfBounds");
|
|
372
|
+
bytes32 tempBytes32;
|
|
373
|
+
|
|
374
|
+
assembly {
|
|
375
|
+
tempBytes32 := mload(add(add(_bytes, 0x20), _start))
|
|
376
|
+
}
|
|
377
|
+
|
|
378
|
+
return tempBytes32;
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function equal(bytes memory _preBytes, bytes memory _postBytes) internal pure returns (bool) {
|
|
382
|
+
bool success = true;
|
|
383
|
+
|
|
384
|
+
assembly {
|
|
385
|
+
let length := mload(_preBytes)
|
|
386
|
+
|
|
387
|
+
// if lengths don't match the arrays are not equal
|
|
388
|
+
switch eq(length, mload(_postBytes))
|
|
389
|
+
case 1 {
|
|
390
|
+
// cb is a circuit breaker in the for loop since there's
|
|
391
|
+
// no said feature for inline assembly loops
|
|
392
|
+
// cb = 1 - don't breaker
|
|
393
|
+
// cb = 0 - break
|
|
394
|
+
let cb := 1
|
|
395
|
+
|
|
396
|
+
let mc := add(_preBytes, 0x20)
|
|
397
|
+
let end := add(mc, length)
|
|
398
|
+
|
|
399
|
+
for {
|
|
400
|
+
let cc := add(_postBytes, 0x20)
|
|
401
|
+
// the next line is the loop condition:
|
|
402
|
+
// while(uint256(mc < end) + cb == 2)
|
|
403
|
+
} eq(add(lt(mc, end), cb), 2) {
|
|
404
|
+
mc := add(mc, 0x20)
|
|
405
|
+
cc := add(cc, 0x20)
|
|
406
|
+
} {
|
|
407
|
+
// if any of these checks fails then arrays are not equal
|
|
408
|
+
if iszero(eq(mload(mc), mload(cc))) {
|
|
409
|
+
// unsuccess:
|
|
410
|
+
success := 0
|
|
411
|
+
cb := 0
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
default {
|
|
416
|
+
// unsuccess:
|
|
417
|
+
success := 0
|
|
418
|
+
}
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
return success;
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
function equalStorage(bytes storage _preBytes, bytes memory _postBytes) internal view returns (bool) {
|
|
425
|
+
bool success = true;
|
|
426
|
+
|
|
427
|
+
assembly {
|
|
428
|
+
// we know _preBytes_offset is 0
|
|
429
|
+
let fslot := sload(_preBytes.slot)
|
|
430
|
+
// Decode the length of the stored array like in concatStorage().
|
|
431
|
+
let slength := div(and(fslot, sub(mul(0x100, iszero(and(fslot, 1))), 1)), 2)
|
|
432
|
+
let mlength := mload(_postBytes)
|
|
433
|
+
|
|
434
|
+
// if lengths don't match the arrays are not equal
|
|
435
|
+
switch eq(slength, mlength)
|
|
436
|
+
case 1 {
|
|
437
|
+
// slength can contain both the length and contents of the array
|
|
438
|
+
// if length < 32 bytes so let's prepare for that
|
|
439
|
+
// v. http://solidity.readthedocs.io/en/latest/miscellaneous.html#layout-of-state-variables-in-storage
|
|
440
|
+
if iszero(iszero(slength)) {
|
|
441
|
+
switch lt(slength, 32)
|
|
442
|
+
case 1 {
|
|
443
|
+
// blank the last byte which is the length
|
|
444
|
+
fslot := mul(div(fslot, 0x100), 0x100)
|
|
445
|
+
|
|
446
|
+
if iszero(eq(fslot, mload(add(_postBytes, 0x20)))) {
|
|
447
|
+
// unsuccess:
|
|
448
|
+
success := 0
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
default {
|
|
452
|
+
// cb is a circuit breaker in the for loop since there's
|
|
453
|
+
// no said feature for inline assembly loops
|
|
454
|
+
// cb = 1 - don't breaker
|
|
455
|
+
// cb = 0 - break
|
|
456
|
+
let cb := 1
|
|
457
|
+
|
|
458
|
+
// get the keccak hash to get the contents of the array
|
|
459
|
+
mstore(0x0, _preBytes.slot)
|
|
460
|
+
let sc := keccak256(0x0, 0x20)
|
|
461
|
+
|
|
462
|
+
let mc := add(_postBytes, 0x20)
|
|
463
|
+
let end := add(mc, mlength)
|
|
464
|
+
|
|
465
|
+
// the next line is the loop condition:
|
|
466
|
+
// while(uint256(mc < end) + cb == 2)
|
|
467
|
+
for {
|
|
468
|
+
|
|
469
|
+
} eq(add(lt(mc, end), cb), 2) {
|
|
470
|
+
sc := add(sc, 1)
|
|
471
|
+
mc := add(mc, 0x20)
|
|
472
|
+
} {
|
|
473
|
+
if iszero(eq(sload(sc), mload(mc))) {
|
|
474
|
+
// unsuccess:
|
|
475
|
+
success := 0
|
|
476
|
+
cb := 0
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
}
|
|
481
|
+
}
|
|
482
|
+
default {
|
|
483
|
+
// unsuccess:
|
|
484
|
+
success := 0
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
return success;
|
|
489
|
+
}
|
|
490
|
+
}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
// SPDX-License-Identifier: MIT
|
|
2
|
+
|
|
3
|
+
pragma solidity >=0.7.6;
|
|
4
|
+
|
|
5
|
+
library ExcessivelySafeCall {
|
|
6
|
+
uint256 constant LOW_28_MASK = 0x00000000ffffffffffffffffffffffffffffffffffffffffffffffffffffffff;
|
|
7
|
+
|
|
8
|
+
/// @notice Use when you _really_ really _really_ don't trust the called
|
|
9
|
+
/// contract. This prevents the called contract from causing reversion of
|
|
10
|
+
/// the caller in as many ways as we can.
|
|
11
|
+
/// @dev The main difference between this and a solidity low-level call is
|
|
12
|
+
/// that we limit the number of bytes that the callee can cause to be
|
|
13
|
+
/// copied to caller memory. This prevents stupid things like malicious
|
|
14
|
+
/// contracts returning 10,000,000 bytes causing a local OOG when copying
|
|
15
|
+
/// to memory.
|
|
16
|
+
/// @param _target The address to call
|
|
17
|
+
/// @param _gas The amount of gas to forward to the remote contract
|
|
18
|
+
/// @param _maxCopy The maximum number of bytes of returndata to copy
|
|
19
|
+
/// to memory.
|
|
20
|
+
/// @param _calldata The data to send to the remote contract
|
|
21
|
+
/// @return success and returndata, as `.call()`. Returndata is capped to
|
|
22
|
+
/// `_maxCopy` bytes.
|
|
23
|
+
function excessivelySafeCall(
|
|
24
|
+
address _target,
|
|
25
|
+
uint256 _gas,
|
|
26
|
+
uint16 _maxCopy,
|
|
27
|
+
bytes memory _calldata
|
|
28
|
+
) internal returns (bool, bytes memory) {
|
|
29
|
+
// set up for assembly call
|
|
30
|
+
uint256 _toCopy;
|
|
31
|
+
bool _success;
|
|
32
|
+
bytes memory _returnData = new bytes(_maxCopy);
|
|
33
|
+
// dispatch message to recipient
|
|
34
|
+
// by assembly calling "handle" function
|
|
35
|
+
// we call via assembly to avoid memcopying a very large returndata
|
|
36
|
+
// returned by a malicious contract
|
|
37
|
+
assembly {
|
|
38
|
+
_success := call(
|
|
39
|
+
_gas, // gas
|
|
40
|
+
_target, // recipient
|
|
41
|
+
0, // ether value
|
|
42
|
+
add(_calldata, 0x20), // inloc
|
|
43
|
+
mload(_calldata), // inlen
|
|
44
|
+
0, // outloc
|
|
45
|
+
0 // outlen
|
|
46
|
+
)
|
|
47
|
+
// limit our copy to 256 bytes
|
|
48
|
+
_toCopy := returndatasize()
|
|
49
|
+
if gt(_toCopy, _maxCopy) {
|
|
50
|
+
_toCopy := _maxCopy
|
|
51
|
+
}
|
|
52
|
+
// Store the length of the copied bytes
|
|
53
|
+
mstore(_returnData, _toCopy)
|
|
54
|
+
// copy the bytes from returndata[0:_toCopy]
|
|
55
|
+
returndatacopy(add(_returnData, 0x20), 0, _toCopy)
|
|
56
|
+
}
|
|
57
|
+
return (_success, _returnData);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/// @notice Use when you _really_ really _really_ don't trust the called
|
|
61
|
+
/// contract. This prevents the called contract from causing reversion of
|
|
62
|
+
/// the caller in as many ways as we can.
|
|
63
|
+
/// @dev The main difference between this and a solidity low-level call is
|
|
64
|
+
/// that we limit the number of bytes that the callee can cause to be
|
|
65
|
+
/// copied to caller memory. This prevents stupid things like malicious
|
|
66
|
+
/// contracts returning 10,000,000 bytes causing a local OOG when copying
|
|
67
|
+
/// to memory.
|
|
68
|
+
/// @param _target The address to call
|
|
69
|
+
/// @param _gas The amount of gas to forward to the remote contract
|
|
70
|
+
/// @param _maxCopy The maximum number of bytes of returndata to copy
|
|
71
|
+
/// to memory.
|
|
72
|
+
/// @param _calldata The data to send to the remote contract
|
|
73
|
+
/// @return success and returndata, as `.call()`. Returndata is capped to
|
|
74
|
+
/// `_maxCopy` bytes.
|
|
75
|
+
function excessivelySafeStaticCall(
|
|
76
|
+
address _target,
|
|
77
|
+
uint256 _gas,
|
|
78
|
+
uint16 _maxCopy,
|
|
79
|
+
bytes memory _calldata
|
|
80
|
+
) internal view returns (bool, bytes memory) {
|
|
81
|
+
// set up for assembly call
|
|
82
|
+
uint256 _toCopy;
|
|
83
|
+
bool _success;
|
|
84
|
+
bytes memory _returnData = new bytes(_maxCopy);
|
|
85
|
+
// dispatch message to recipient
|
|
86
|
+
// by assembly calling "handle" function
|
|
87
|
+
// we call via assembly to avoid memcopying a very large returndata
|
|
88
|
+
// returned by a malicious contract
|
|
89
|
+
assembly {
|
|
90
|
+
_success := staticcall(
|
|
91
|
+
_gas, // gas
|
|
92
|
+
_target, // recipient
|
|
93
|
+
add(_calldata, 0x20), // inloc
|
|
94
|
+
mload(_calldata), // inlen
|
|
95
|
+
0, // outloc
|
|
96
|
+
0 // outlen
|
|
97
|
+
)
|
|
98
|
+
// limit our copy to 256 bytes
|
|
99
|
+
_toCopy := returndatasize()
|
|
100
|
+
if gt(_toCopy, _maxCopy) {
|
|
101
|
+
_toCopy := _maxCopy
|
|
102
|
+
}
|
|
103
|
+
// Store the length of the copied bytes
|
|
104
|
+
mstore(_returnData, _toCopy)
|
|
105
|
+
// copy the bytes from returndata[0:_toCopy]
|
|
106
|
+
returndatacopy(add(_returnData, 0x20), 0, _toCopy)
|
|
107
|
+
}
|
|
108
|
+
return (_success, _returnData);
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* @notice Swaps function selectors in encoded contract calls
|
|
113
|
+
* @dev Allows reuse of encoded calldata for functions with identical
|
|
114
|
+
* argument types but different names. It simply swaps out the first 4 bytes
|
|
115
|
+
* for the new selector. This function modifies memory in place, and should
|
|
116
|
+
* only be used with caution.
|
|
117
|
+
* @param _newSelector The new 4-byte selector
|
|
118
|
+
* @param _buf The encoded contract args
|
|
119
|
+
*/
|
|
120
|
+
function swapSelector(bytes4 _newSelector, bytes memory _buf) internal pure {
|
|
121
|
+
require(_buf.length >= 4);
|
|
122
|
+
uint256 _mask = LOW_28_MASK;
|
|
123
|
+
assembly {
|
|
124
|
+
// load the first word of
|
|
125
|
+
let _word := mload(add(_buf, 0x20))
|
|
126
|
+
// mask out the top 4 bytes
|
|
127
|
+
// /x
|
|
128
|
+
_word := and(_word, _mask)
|
|
129
|
+
_word := or(_newSelector, _word)
|
|
130
|
+
mstore(add(_buf, 0x20), _word)
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAA"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./typechain-types"), exports);
|
|
18
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,oDAAiC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../typechain-types/@layerzerolabs/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,SAAS,MAAM,iBAAiB,CAAC;AAClD,YAAY,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../typechain-types/@layerzerolabs/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../typechain-types/@layerzerolabs/lz-evm-v1-0.7/contracts/index.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,KAAK,UAAU,MAAM,cAAc,CAAC;AAChD,YAAY,EAAE,UAAU,EAAE,CAAC"}
|