@layerzerolabs/layerzero-v2-ton 3.0.18-ton.1 → 3.0.19-ton.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/CHANGELOG.md +2 -86
- package/build/AllStorages.compiled.json +1 -1
- package/build/BaseContract.test.compiled.json +1 -1
- package/build/Channel.compiled.json +1 -1
- package/build/Channel.permissions.test.compiled.json +1 -1
- package/build/ChannelBurn.test.compiled.json +1 -1
- package/build/ChannelCommitPacket.test.compiled.json +1 -1
- package/build/ChannelConfig.test.compiled.json +1 -1
- package/build/ChannelInitialize.test.compiled.json +1 -1
- package/build/ChannelMsglibIntegration.test.compiled.json +1 -1
- package/build/ChannelMsglibSendCallback.test.compiled.json +1 -1
- package/build/ChannelNilify.test.compiled.json +1 -1
- package/build/ChannelReceive.test.compiled.json +1 -1
- package/build/ChannelReceiveCallback.test.compiled.json +1 -1
- package/build/ChannelReceiveView.test.compiled.json +1 -1
- package/build/ChannelSend.test.compiled.json +1 -1
- package/build/Classlib.test.compiled.json +1 -1
- package/build/Connection.compiled.json +1 -1
- package/build/Controller.assertions.test.compiled.json +1 -1
- package/build/Controller.permissions.test.compiled.json +1 -1
- package/build/Controller.test.compiled.json +1 -1
- package/build/Counter.permissions.test.compiled.json +1 -1
- package/build/Counter.setters.test.compiled.json +1 -1
- package/build/Counter.test.compiled.json +1 -1
- package/build/Dvn.compiled.json +1 -1
- package/build/Dvn.test.compiled.json +1 -1
- package/build/DvnFeeLib.compiled.json +1 -1
- package/build/DvnPermissions.test.compiled.json +1 -1
- package/build/Endpoint.compiled.json +1 -1
- package/build/Endpoint.permissions.test.compiled.json +1 -1
- package/build/Endpoint.test.compiled.json +1 -1
- package/build/EndpointSetEpConfigDefaults.test.compiled.json +1 -1
- package/build/Executor.compiled.json +1 -1
- package/build/Executor.test.compiled.json +1 -1
- package/build/ExecutorFeeLib.compiled.json +1 -1
- package/build/ExecutorPermissions.test.compiled.json +1 -1
- package/build/LzClasses.test.compiled.json +1 -1
- package/build/LzUtil.test.compiled.json +1 -1
- package/build/MsgData.test.compiled.json +1 -1
- package/build/MsglibPacketCodec.test.compiled.json +1 -1
- package/build/PriceFeedCache.compiled.json +1 -1
- package/build/PriceFeedCache.permissions.test.compiled.json +1 -1
- package/build/PriceFeedCache.test.compiled.json +1 -1
- package/build/Proxy.compiled.json +1 -1
- package/build/Proxy.permissions.test.compiled.json +1 -1
- package/build/Proxy.test.compiled.json +1 -1
- package/build/SmlConnection.compiled.json +1 -1
- package/build/SmlConnection.permissions.test.compiled.json +1 -1
- package/build/SmlConnection.test.compiled.json +1 -1
- package/build/SmlManager.permissions.test.compiled.json +1 -1
- package/build/SmlManager.test.compiled.json +1 -1
- package/build/Uln.compiled.json +1 -1
- package/build/Uln.test.compiled.json +1 -1
- package/build/UlnConnection.compiled.json +1 -1
- package/build/UlnConnection.test.compiled.json +1 -1
- package/build/UlnConnectionPermissions.test.compiled.json +1 -1
- package/build/UlnManagement.test.compiled.json +1 -1
- package/build/UlnManager.compiled.json +1 -1
- package/build/UlnManager.test.compiled.json +1 -1
- package/build/UlnManagerPermissions.test.compiled.json +1 -1
- package/build/UlnManagerUtil.test.compiled.json +1 -1
- package/build/UlnPermissions.test.compiled.json +1 -1
- package/build/UlnReceiveConfig.test.compiled.json +1 -1
- package/build/UlnSend.test.compiled.json +1 -1
- package/build/UlnSendConfig.test.compiled.json +1 -1
- package/build/UlnSendWithDvnFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWithExecFeeLib.test.compiled.json +1 -1
- package/build/UlnSendWorkerFactory.test.compiled.json +1 -1
- package/build/UlnUtil.test.compiled.json +1 -1
- package/build/WorkerCore.test.compiled.json +1 -1
- package/build/badFeeLib1.test.compiled.json +1 -1
- package/build/badFeeLib10.test.compiled.json +1 -1
- package/build/badFeeLib11.test.compiled.json +1 -1
- package/build/badFeeLib12.test.compiled.json +1 -0
- package/build/badFeeLib2.test.compiled.json +1 -1
- package/build/badFeeLib3.test.compiled.json +1 -1
- package/build/badFeeLib4.test.compiled.json +1 -1
- package/build/badFeeLib5.test.compiled.json +1 -1
- package/build/badFeeLib6.test.compiled.json +1 -1
- package/build/badFeeLib7.test.compiled.json +1 -1
- package/build/badFeeLib8.test.compiled.json +1 -1
- package/build/badFeeLib9.test.compiled.json +1 -1
- package/package.json +8 -5
- package/src/classes/lz/ReceiveEpConfig.fc +1 -1
- package/src/funC++/classlib.fc +6 -45
- package/src/protocol/core/baseStorage.fc +34 -0
- package/src/protocol/endpoint/storage.fc +37 -0
package/src/funC++/classlib.fc
CHANGED
|
@@ -24,7 +24,6 @@ const int cl::NULL_CLASS_NAME = "NULL"u;
|
|
|
24
24
|
const int cl::ERROR::INVALID_CLASS = 1057;
|
|
25
25
|
const int cl::ERROR::MALFORMED_OBJECT = 1058;
|
|
26
26
|
|
|
27
|
-
const int DEBUG = 0;
|
|
28
27
|
|
|
29
28
|
const int MAX_NAME_LEN = 10; ;; each name can be up to 10 characters long
|
|
30
29
|
const int _NAME_WIDTH = 8 * MAX_NAME_LEN; ;; convert to bits
|
|
@@ -49,9 +48,6 @@ const int FIELD_VAL_IDX = 1;
|
|
|
49
48
|
;;; ====================== Address functions ======================
|
|
50
49
|
int basechainAddressStdToHashpart(slice full_address) inline {
|
|
51
50
|
(int wc, int hp) = parseStdAddress(full_address);
|
|
52
|
-
if (DEBUG) {
|
|
53
|
-
throw_unless(0, wc == BASECHAIN);
|
|
54
|
-
}
|
|
55
51
|
return hp;
|
|
56
52
|
}
|
|
57
53
|
|
|
@@ -171,12 +167,6 @@ int cl::typeof(cell $obj) inline method_id {
|
|
|
171
167
|
cell cl::declare(int name, tuple fields) inline {
|
|
172
168
|
tuple classBuilder = unsafeTuple([null(), begin_cell()]);
|
|
173
169
|
|
|
174
|
-
if (DEBUG) {
|
|
175
|
-
if (name > MAX_NAME_INTLEN) {
|
|
176
|
-
~strdump("Class name too long! ".str::concat(str::asciiUint256ToStr(name)));
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
170
|
int num_fields = fields.tlen();
|
|
181
171
|
builder headerBuilder = begin_cell().store_uint(name, _NAME_WIDTH);
|
|
182
172
|
|
|
@@ -257,9 +247,6 @@ cell cl::declare(int name, tuple fields) inline {
|
|
|
257
247
|
|
|
258
248
|
builder rootBuilder = classBuilder.at(1);
|
|
259
249
|
int numCells = classBuilder.tlen() - 1;
|
|
260
|
-
if (DEBUG) {
|
|
261
|
-
throw_if(cl::ERROR::INVALID_CLASS, numCells > 3);
|
|
262
|
-
}
|
|
263
250
|
if (numCells > 1) {
|
|
264
251
|
if (rootBuilder.builder_refs() == 0) {
|
|
265
252
|
rootBuilder = rootBuilder
|
|
@@ -336,10 +323,6 @@ forall X -> cell cl::set(cell $self, int fieldName, X val) inline method_id {
|
|
|
336
323
|
int fieldOffset = headerSlice.cl::getFieldOffset::asm(fieldInfoOffset);
|
|
337
324
|
int fieldRefsOffset = headerSlice.cl::getFieldCellOffset::asm(fieldInfoOffset );
|
|
338
325
|
|
|
339
|
-
if (DEBUG) {
|
|
340
|
-
throwErrorUnless(fieldType < INVALID_TYPE, "Type does not exist");
|
|
341
|
-
}
|
|
342
|
-
|
|
343
326
|
int fieldWidth = _getTypeWidth(fieldType);
|
|
344
327
|
slice victim = fieldCellIndex == 0
|
|
345
328
|
? headerSlice
|
|
@@ -411,17 +394,6 @@ int cl::get<uint>(cell $self, int fieldName, int width) inline method_id {
|
|
|
411
394
|
int fieldCellIndex = headerSlice.cl::getFieldCellIndex::asm(fieldInfoOffset);
|
|
412
395
|
int fieldOffset = headerSlice.cl::getFieldOffset::asm(fieldInfoOffset);
|
|
413
396
|
|
|
414
|
-
if (DEBUG) {
|
|
415
|
-
int fieldType = headerSlice
|
|
416
|
-
.preload_bits_offset(
|
|
417
|
-
fieldInfoOffset,
|
|
418
|
-
_FIELD_TYPE_WIDTH
|
|
419
|
-
)
|
|
420
|
-
.preload_uint(_FIELD_TYPE_WIDTH);
|
|
421
|
-
int expected_field_width = _getTypeWidth(fieldType);
|
|
422
|
-
throw_unless(0, expected_field_width == width);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
397
|
if (fieldCellIndex == 0) {
|
|
426
398
|
return cl::preload_bits_offset_3::asm(width, headerSlice, fieldOffset, width);
|
|
427
399
|
}
|
|
@@ -439,24 +411,13 @@ cell cl::get<cellRef>(cell $self, int fieldName) inline method_id {
|
|
|
439
411
|
.cl::getFieldCellOffset::asm(
|
|
440
412
|
fieldInfoOffset);
|
|
441
413
|
|
|
442
|
-
if (DEBUG) {
|
|
443
|
-
int fieldType = headerSlice
|
|
444
|
-
.preload_bits_offset(
|
|
445
|
-
fieldInfoOffset,
|
|
446
|
-
_FIELD_TYPE_WIDTH
|
|
447
|
-
)
|
|
448
|
-
.preload_uint(_FIELD_TYPE_WIDTH);
|
|
449
|
-
int expected_field_width = _getTypeWidth(fieldType);
|
|
450
|
-
throw_unless(0, expected_field_width == 0);
|
|
451
|
-
}
|
|
452
|
-
|
|
453
414
|
return fieldCellIndex == 0
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
415
|
+
? headerSlice.preload_ref_at(fieldRefIdx)
|
|
416
|
+
: (headerSlice
|
|
417
|
+
.preload_ref_at(fieldCellIndex)
|
|
418
|
+
.begin_parse()
|
|
419
|
+
.preload_ref_at(fieldRefIdx)
|
|
420
|
+
);
|
|
460
421
|
}
|
|
461
422
|
|
|
462
423
|
cell cl::get<objRef>(cell $self, int fieldName) inline method_id {
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
#include "../../funC++/baseInterface.fc";
|
|
2
|
+
#include "../../funC++/classlib.fc";
|
|
3
|
+
#include "../../funC++/actions/utils.fc";
|
|
4
|
+
|
|
5
|
+
;; !!! If you put this storage anywhere other than index 0 of your custom contract storage,
|
|
6
|
+
;; you are gunna have a bad time
|
|
7
|
+
const int BASE_STORAGE_INDEX = 0;
|
|
8
|
+
|
|
9
|
+
;; required object name
|
|
10
|
+
const int BaseStorage::NAME = "baseStore"u;
|
|
11
|
+
|
|
12
|
+
;; field names
|
|
13
|
+
const int BaseStorage::owner = 0;
|
|
14
|
+
const int BaseStorage::authenticated = 1;
|
|
15
|
+
const int BaseStorage::initialized = 2;
|
|
16
|
+
const int BaseStorage::initialStorage = 3;
|
|
17
|
+
|
|
18
|
+
;; In all blockchains with atomic cross-contract call, we can use src/dst/sender/receiver
|
|
19
|
+
;; because the send channel doesn't exist (it's just a nonce).
|
|
20
|
+
;; In TON, we need both send/receive channels, so we use local/remote to provide
|
|
21
|
+
;; a context-free way to refer to the two ends of the channel.
|
|
22
|
+
;; The direction is inferred by the context of the contract (send vs receive).
|
|
23
|
+
;; The srcOApp is the 256-bit hashpart of a standard address.
|
|
24
|
+
cell BaseStorage::New(int owner) inline method_id {
|
|
25
|
+
return cl::declare(
|
|
26
|
+
BaseStorage::NAME,
|
|
27
|
+
unsafeTuple([
|
|
28
|
+
[cl::t::address, owner], ;; BaseStorage::owner
|
|
29
|
+
[cl::t::bool, false], ;; BaseStorage::authenticated
|
|
30
|
+
[cl::t::bool, false], ;; BaseStorage::initialized
|
|
31
|
+
[cl::t::objRef, cl::nullObject()] ;; BaseStorage::initialStorage
|
|
32
|
+
])
|
|
33
|
+
);
|
|
34
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#include "../core/baseStorage.fc";
|
|
2
|
+
|
|
3
|
+
;; required object name
|
|
4
|
+
const int Endpoint::NAME = "endpoint"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int Endpoint::baseStorage = 0;
|
|
8
|
+
const int Endpoint::eid = 1;
|
|
9
|
+
const int Endpoint::dstEid = 2;
|
|
10
|
+
const int Endpoint::msglibs = 3;
|
|
11
|
+
const int Endpoint::numMsglibs = 4;
|
|
12
|
+
const int Endpoint::channelCode = 5;
|
|
13
|
+
const int Endpoint::channelStorageInit = 6;
|
|
14
|
+
const int Endpoint::defaultSendLibInfo = 7;
|
|
15
|
+
const int Endpoint::defaultReceiveLibInfo = 8;
|
|
16
|
+
const int Endpoint::defaultTimeoutReceiveLibInfo = 9;
|
|
17
|
+
const int Endpoint::defaultExpiry = 10;
|
|
18
|
+
|
|
19
|
+
;; @owner manager
|
|
20
|
+
cell Endpoint::New(int eid, int dstEid, int owner) inline method_id {
|
|
21
|
+
return cl::declare(
|
|
22
|
+
Endpoint::NAME,
|
|
23
|
+
unsafeTuple([
|
|
24
|
+
[cl::t::objRef, BaseStorage::New(owner)], ;; Endpoint::baseStorage
|
|
25
|
+
[cl::t::uint32, eid], ;; Endpoint::eid
|
|
26
|
+
[cl::t::uint32, dstEid], ;; Endpoint::dstEid
|
|
27
|
+
[cl::t::dict256, cl::dict256::New()], ;; Endpoint::msglibs
|
|
28
|
+
[cl::t::uint8, 0], ;; Endpoint::numMsglibs
|
|
29
|
+
[cl::t::cellRef, empty_cell()], ;; Endpoint::channelCode
|
|
30
|
+
[cl::t::objRef, cl::nullObject()], ;; Endpoint::channelStorageInit
|
|
31
|
+
[cl::t::objRef, cl::nullObject()], ;; Endpoint::defaultSendLibInfo
|
|
32
|
+
[cl::t::objRef, cl::nullObject()], ;; Endpoint::defaultReceiveLibInfo
|
|
33
|
+
[cl::t::objRef, cl::nullObject()], ;; Endpoint::defaultTimeoutReceiveLibInfo
|
|
34
|
+
[cl::t::uint64, 0] ;; Endpoint::defaultExpiry
|
|
35
|
+
])
|
|
36
|
+
);
|
|
37
|
+
}
|