@layerzerolabs/layerzero-v2-ton 3.0.18-ton.2 → 3.0.19-ton.1

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.
Files changed (208) hide show
  1. package/CHANGELOG.md +4 -88
  2. package/build/AllStorages.compiled.json +1 -1
  3. package/build/AllStorages.test.compiled.json +1 -1
  4. package/build/BaseContract.test.compiled.json +1 -1
  5. package/build/Channel.compiled.json +1 -1
  6. package/build/Channel.permissions.test.compiled.json +1 -1
  7. package/build/ChannelBurn.test.compiled.json +1 -1
  8. package/build/ChannelCommitPacket.test.compiled.json +1 -1
  9. package/build/ChannelConfig.test.compiled.json +1 -1
  10. package/build/ChannelInitialize.test.compiled.json +1 -1
  11. package/build/ChannelMsglibIntegration.test.compiled.json +1 -1
  12. package/build/ChannelMsglibSendCallback.test.compiled.json +1 -1
  13. package/build/ChannelNilify.test.compiled.json +1 -1
  14. package/build/ChannelReceive.test.compiled.json +1 -1
  15. package/build/ChannelReceiveCallback.test.compiled.json +1 -1
  16. package/build/ChannelReceiveView.test.compiled.json +1 -1
  17. package/build/ChannelSend.test.compiled.json +1 -1
  18. package/build/Classlib.test.compiled.json +1 -1
  19. package/build/ComputeDataSizeGas.test.compiled.json +1 -1
  20. package/build/Connection.compiled.json +1 -1
  21. package/build/Controller.assertions.test.compiled.json +1 -1
  22. package/build/Controller.compiled.json +1 -1
  23. package/build/Controller.permissions.test.compiled.json +1 -1
  24. package/build/Controller.test.compiled.json +1 -1
  25. package/build/Counter.compiled.json +1 -1
  26. package/build/Counter.permissions.test.compiled.json +1 -1
  27. package/build/Counter.setters.test.compiled.json +1 -1
  28. package/build/Counter.test.compiled.json +1 -1
  29. package/build/Dvn.compiled.json +1 -1
  30. package/build/Dvn.test.compiled.json +1 -1
  31. package/build/DvnFeeLib.compiled.json +1 -1
  32. package/build/DvnPermissions.test.compiled.json +1 -1
  33. package/build/Endpoint.compiled.json +1 -1
  34. package/build/Endpoint.permissions.test.compiled.json +1 -1
  35. package/build/Endpoint.test.compiled.json +1 -1
  36. package/build/EndpointSetEpConfigDefaults.test.compiled.json +1 -1
  37. package/build/Executor.compiled.json +1 -1
  38. package/build/Executor.test.compiled.json +1 -1
  39. package/build/ExecutorFeeLib.compiled.json +1 -1
  40. package/build/ExecutorPermissions.test.compiled.json +1 -1
  41. package/build/LzClasses.test.compiled.json +1 -1
  42. package/build/LzUtil.test.compiled.json +1 -1
  43. package/build/MsgData.test.compiled.json +1 -1
  44. package/build/MsglibPacketCodec.test.compiled.json +1 -1
  45. package/build/PipelinedOutOfOrder.test.compiled.json +1 -1
  46. package/build/PriceFeedCache.compiled.json +1 -1
  47. package/build/PriceFeedCache.permissions.test.compiled.json +1 -1
  48. package/build/PriceFeedCache.test.compiled.json +1 -1
  49. package/build/Proxy.compiled.json +1 -1
  50. package/build/Proxy.permissions.test.compiled.json +1 -1
  51. package/build/Proxy.test.compiled.json +1 -1
  52. package/build/SmlConnection.compiled.json +1 -1
  53. package/build/SmlConnection.permissions.test.compiled.json +1 -1
  54. package/build/SmlConnection.test.compiled.json +1 -1
  55. package/build/SmlManager.compiled.json +1 -1
  56. package/build/SmlManager.permissions.test.compiled.json +1 -1
  57. package/build/SmlManager.test.compiled.json +1 -1
  58. package/build/Uln.compiled.json +1 -1
  59. package/build/Uln.test.compiled.json +1 -1
  60. package/build/UlnConnection.compiled.json +1 -1
  61. package/build/UlnConnection.test.compiled.json +1 -1
  62. package/build/UlnConnectionPermissions.test.compiled.json +1 -1
  63. package/build/UlnManagement.test.compiled.json +1 -1
  64. package/build/UlnManager.compiled.json +1 -1
  65. package/build/UlnManager.test.compiled.json +1 -1
  66. package/build/UlnManagerPermissions.test.compiled.json +1 -1
  67. package/build/UlnManagerUtil.test.compiled.json +1 -1
  68. package/build/UlnPermissions.test.compiled.json +1 -1
  69. package/build/UlnReceiveConfig.test.compiled.json +1 -1
  70. package/build/UlnSend.test.compiled.json +1 -1
  71. package/build/UlnSendConfig.test.compiled.json +1 -1
  72. package/build/UlnSendWithDvnFeeLib.test.compiled.json +1 -1
  73. package/build/UlnSendWithExecFeeLib.test.compiled.json +1 -1
  74. package/build/UlnSendWorkerFactory.test.compiled.json +1 -1
  75. package/build/UlnUtil.test.compiled.json +1 -1
  76. package/build/WorkerCore.test.compiled.json +1 -1
  77. package/build/badFeeLib1.test.compiled.json +1 -1
  78. package/build/badFeeLib10.test.compiled.json +1 -1
  79. package/build/badFeeLib11.test.compiled.json +1 -1
  80. package/build/badFeeLib12.test.compiled.json +1 -0
  81. package/build/badFeeLib2.test.compiled.json +1 -1
  82. package/build/badFeeLib3.test.compiled.json +1 -1
  83. package/build/badFeeLib4.test.compiled.json +1 -1
  84. package/build/badFeeLib5.test.compiled.json +1 -1
  85. package/build/badFeeLib6.test.compiled.json +1 -1
  86. package/build/badFeeLib7.test.compiled.json +1 -1
  87. package/build/badFeeLib8.test.compiled.json +1 -1
  88. package/build/badFeeLib9.test.compiled.json +1 -1
  89. package/package.json +9 -6
  90. package/src/classes/lz/ReceiveEpConfig.fc +1 -1
  91. package/src/classes/msgdata/LzReceiveStatus.fc +0 -1
  92. package/src/funC++/actions/call.fc +1 -0
  93. package/src/funC++/actions/deploy.fc +0 -1
  94. package/src/funC++/actions/destroy.fc +0 -1
  95. package/src/funC++/actions/dispatch.fc +0 -1
  96. package/src/funC++/actions/event.fc +0 -1
  97. package/src/funC++/actions/payment.fc +0 -1
  98. package/src/funC++/actions/sendJettons.fc +0 -1
  99. package/src/funC++/actions/utils.fc +0 -2
  100. package/src/funC++/baseInterface.fc +0 -2
  101. package/src/funC++/classlib.fc +6 -81
  102. package/src/funC++/contractMain.fc +2 -8
  103. package/src/funC++/dataStructures/DeterministicInsertionCircularQueue.fc +0 -1
  104. package/src/funC++/dataStructures/PipelinedOutOfOrder.fc +0 -1
  105. package/src/funC++/handlerCore.fc +2 -6
  106. package/src/funC++/stringlib.fc +0 -2
  107. package/src/funC++/testutils.fc +0 -1
  108. package/src/funC++/txnContext.fc +1 -1
  109. package/src/funC++/utils.fc +35 -0
  110. package/src/protocol/channel/callbackOpcodes.fc +10 -0
  111. package/src/protocol/channel/handler.fc +1032 -0
  112. package/src/protocol/channel/interface.fc +60 -0
  113. package/src/protocol/channel/main.fc +39 -0
  114. package/src/protocol/channel/storage.fc +55 -0
  115. package/src/protocol/controller/handler.fc +347 -0
  116. package/src/protocol/controller/interface.fc +25 -0
  117. package/src/protocol/controller/main.fc +29 -0
  118. package/src/protocol/controller/storage.fc +31 -0
  119. package/src/protocol/core/abstract/protocolHandler.fc +110 -0
  120. package/src/protocol/core/abstract/protocolMain.fc +30 -0
  121. package/src/protocol/core/baseStorage.fc +33 -0
  122. package/src/protocol/endpoint/handler.fc +426 -0
  123. package/src/protocol/endpoint/interface.fc +20 -0
  124. package/src/protocol/endpoint/main.fc +23 -0
  125. package/src/protocol/endpoint/storage.fc +37 -0
  126. package/src/protocol/interfaces.fc +4 -0
  127. package/src/protocol/msglibs/BytesDecoder.fc +135 -0
  128. package/src/protocol/msglibs/BytesEncoder.fc +150 -0
  129. package/src/protocol/msglibs/interface.fc +16 -0
  130. package/src/protocol/msglibs/simpleMsglib/smlConnection/handler.fc +125 -0
  131. package/src/protocol/msglibs/simpleMsglib/smlConnection/interface.fc +3 -0
  132. package/src/protocol/msglibs/simpleMsglib/smlConnection/main.fc +19 -0
  133. package/src/protocol/msglibs/simpleMsglib/smlConnection/storage.fc +20 -0
  134. package/src/protocol/msglibs/simpleMsglib/smlManager/handler.fc +281 -0
  135. package/src/protocol/msglibs/simpleMsglib/smlManager/interface.fc +14 -0
  136. package/src/protocol/msglibs/simpleMsglib/smlManager/main.fc +24 -0
  137. package/src/protocol/msglibs/simpleMsglib/smlManager/storage.fc +38 -0
  138. package/src/protocol/msglibs/ultralightnode/callbackOpcodes.fc +1 -0
  139. package/src/protocol/msglibs/ultralightnode/feeLibInterface.fc +10 -0
  140. package/src/protocol/msglibs/ultralightnode/feeLibUtils.fc +51 -0
  141. package/src/protocol/msglibs/ultralightnode/msgdata/Attestation.fc +49 -0
  142. package/src/protocol/msglibs/ultralightnode/msgdata/DvnFeesPaidEvent.fc +26 -0
  143. package/src/protocol/msglibs/ultralightnode/msgdata/ExecutorFeePaidEvent.fc +23 -0
  144. package/src/protocol/msglibs/ultralightnode/msgdata/InitUln.fc +18 -0
  145. package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnConnection.fc +62 -0
  146. package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnManager.fc +18 -0
  147. package/src/protocol/msglibs/ultralightnode/msgdata/RentRefill.fc +18 -0
  148. package/src/protocol/msglibs/ultralightnode/msgdata/SetAdminWorkerAddresses.fc +18 -0
  149. package/src/protocol/msglibs/ultralightnode/msgdata/TreasuryFeeBps.fc +16 -0
  150. package/src/protocol/msglibs/ultralightnode/msgdata/UlnEvents.fc +26 -0
  151. package/src/protocol/msglibs/ultralightnode/msgdata/UlnReceiveConfig.fc +249 -0
  152. package/src/protocol/msglibs/ultralightnode/msgdata/UlnSend.fc +27 -0
  153. package/src/protocol/msglibs/ultralightnode/msgdata/UlnSendConfig.fc +170 -0
  154. package/src/protocol/msglibs/ultralightnode/msgdata/UlnVerification.fc +21 -0
  155. package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibBytecode.fc +16 -0
  156. package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibEvents.fc +58 -0
  157. package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibInfo.fc +56 -0
  158. package/src/protocol/msglibs/ultralightnode/msgdata/VerificationStatus.fc +18 -0
  159. package/src/protocol/msglibs/ultralightnode/uln/handler.fc +803 -0
  160. package/src/protocol/msglibs/ultralightnode/uln/interface.fc +63 -0
  161. package/src/protocol/msglibs/ultralightnode/uln/main.fc +37 -0
  162. package/src/protocol/msglibs/ultralightnode/uln/storage.fc +43 -0
  163. package/src/protocol/msglibs/ultralightnode/ulnConnection/handler.fc +600 -0
  164. package/src/protocol/msglibs/ultralightnode/ulnConnection/interface.fc +36 -0
  165. package/src/protocol/msglibs/ultralightnode/ulnConnection/main.fc +32 -0
  166. package/src/protocol/msglibs/ultralightnode/ulnConnection/storage.fc +49 -0
  167. package/src/protocol/msglibs/ultralightnode/ulnConnection/utils.fc +141 -0
  168. package/src/protocol/msglibs/ultralightnode/ulnManager/handler.fc +495 -0
  169. package/src/protocol/msglibs/ultralightnode/ulnManager/interface.fc +59 -0
  170. package/src/protocol/msglibs/ultralightnode/ulnManager/main.fc +40 -0
  171. package/src/protocol/msglibs/ultralightnode/ulnManager/storage.fc +44 -0
  172. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/common.fc +27 -0
  173. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/handler.fc +80 -0
  174. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/main.fc +4 -0
  175. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/storage.fc +26 -0
  176. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/handler.fc +123 -0
  177. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/main.fc +4 -0
  178. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/storage.fc +29 -0
  179. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/main.fc +3 -0
  180. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/main.fc +1 -0
  181. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/storage.fc +39 -0
  182. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/ulnSendWorkerV1.fc +363 -0
  183. package/src/workers/core/abstract/workerHandler.fc +150 -0
  184. package/src/workers/core/interface.fc +25 -0
  185. package/src/workers/core/workerCoreStorage.fc +44 -0
  186. package/src/workers/dvn/handler.fc +332 -0
  187. package/src/workers/dvn/interface.fc +25 -0
  188. package/src/workers/dvn/main.fc +36 -0
  189. package/src/workers/dvn/storage.fc +27 -0
  190. package/src/workers/executor/handler.fc +110 -0
  191. package/src/workers/executor/interface.fc +19 -0
  192. package/src/workers/executor/main.fc +26 -0
  193. package/src/workers/executor/storage.fc +19 -0
  194. package/src/workers/msgdata/ExecuteParams.fc +29 -0
  195. package/src/workers/msgdata/NativeDrop.fc +16 -0
  196. package/src/workers/msgdata/ProxyMessage.fc +20 -0
  197. package/src/workers/msgdata/SetDict.fc +20 -0
  198. package/src/workers/msgdata/SetQuorum.fc +20 -0
  199. package/src/workers/msgdata/SignedRequest.fc +18 -0
  200. package/src/workers/priceFeedCache/handler.fc +114 -0
  201. package/src/workers/priceFeedCache/interface.fc +4 -0
  202. package/src/workers/priceFeedCache/main.fc +25 -0
  203. package/src/workers/priceFeedCache/storage.fc +21 -0
  204. package/src/workers/proxy/handler.fc +81 -0
  205. package/src/workers/proxy/interface.fc +11 -0
  206. package/src/workers/proxy/main.fc +17 -0
  207. package/src/workers/proxy/storage.fc +21 -0
  208. package/tests/testMain.fc +0 -1
@@ -1,4 +1,5 @@
1
1
  #include "utils.fc";
2
+ #include "../classlib.fc";
2
3
 
3
4
  const int action::call::NAME = "actionCall"u;
4
5
 
@@ -1,5 +1,4 @@
1
1
  #include "utils.fc";
2
- #include "../stdlib.fc";
3
2
 
4
3
  ;;; =======================================================
5
4
  ;; Deploys a contract defined by the given code and storage object,
@@ -1,5 +1,4 @@
1
1
  #include "utils.fc";
2
- #include "../stdlib.fc";
3
2
 
4
3
  const int action::destroy::NAME = "destroy"u;
5
4
 
@@ -1,5 +1,4 @@
1
1
  #include "utils.fc";
2
- #include "../stdlib.fc";
3
2
 
4
3
  #include "call.fc";
5
4
 
@@ -1,5 +1,4 @@
1
1
  #include "../baseInterface.fc";
2
- #include "../classlib.fc";
3
2
  #include "utils.fc";
4
3
 
5
4
  const int action::event::NAME = "event"u;
@@ -1,5 +1,4 @@
1
1
  #include "utils.fc";
2
- #include "../stdlib.fc";
3
2
 
4
3
  const int action::payment::NAME = "payment"u;
5
4
 
@@ -1,4 +1,3 @@
1
- #include "../stdlib.fc";
2
1
  #include "utils.fc";
3
2
 
4
3
  const int action::sendJettons::NAME = "sendJetton"u;
@@ -1,5 +1,3 @@
1
- #include "../utils.fc";
2
- #include "../stdlib.fc";
3
1
  #include "../txnContext.fc";
4
2
 
5
3
  ;; Small file for now, but a placeholder for generic actions utility functions
@@ -1,5 +1,3 @@
1
- #include "constants.fc";
2
-
3
1
  const int BaseInterface::event::AUTHENTICATED = "AUTHENTICATED"u;
4
2
  const int BaseInterface::event::INITIALIZED = "INITIALIZED"u;
5
3
 
@@ -1,6 +1,4 @@
1
1
  #include "utils.fc";
2
- #include "constants.fc";
3
- #include "stdlib.fc";
4
2
  #include "stringlib.fc";
5
3
 
6
4
  ;; Types for storage abstraction
@@ -24,7 +22,6 @@ const int cl::NULL_CLASS_NAME = "NULL"u;
24
22
  const int cl::ERROR::INVALID_CLASS = 1057;
25
23
  const int cl::ERROR::MALFORMED_OBJECT = 1058;
26
24
 
27
- const int DEBUG = 0;
28
25
 
29
26
  const int MAX_NAME_LEN = 10; ;; each name can be up to 10 characters long
30
27
  const int _NAME_WIDTH = 8 * MAX_NAME_LEN; ;; convert to bits
@@ -46,26 +43,6 @@ const int _HEADER_WIDTH = _BASIC_HEADER_WIDTH + _MAX_CLASS_FIELDS * _FIELD_INFO_
46
43
  const int FIELD_TYPE_IDX = 0;
47
44
  const int FIELD_VAL_IDX = 1;
48
45
 
49
- ;;; ====================== Address functions ======================
50
- int basechainAddressStdToHashpart(slice full_address) inline {
51
- (int wc, int hp) = parseStdAddress(full_address);
52
- if (DEBUG) {
53
- throw_unless(0, wc == BASECHAIN);
54
- }
55
- return hp;
56
- }
57
-
58
- slice hashpartToBasechainAddressStd(int hashpart) inline {
59
- return begin_cell()
60
- .store_uint(4, 3) ;; 0b100
61
- .store_int(BASECHAIN, 8)
62
- .store_uint(hashpart, 256)
63
- .as_slice();
64
- }
65
-
66
- int getContractAddress() impure inline {
67
- return my_address().preload_bits_offset(11, 256).preload_uint(256);
68
- }
69
46
 
70
47
  ;;; ====================== Class functions ======================
71
48
  ;; returns type width in bits
@@ -144,23 +121,6 @@ int cl::equalObjTypeShallow(cell $a, cell $b) {
144
121
  return true;
145
122
  }
146
123
 
147
- () setContractStorage(cell $obj) impure inline {
148
- set_data($obj);
149
- }
150
-
151
- cell getContractStorage() impure inline method_id {
152
- return get_data();
153
- }
154
-
155
- int computeContractAddress(cell $storage, cell code) impure inline {
156
- return begin_cell()
157
- .store_uint(6, 5)
158
- .store_ref(code)
159
- .store_ref($storage)
160
- .end_cell()
161
- .cell_hash();
162
- }
163
-
164
124
  int cl::typeof(cell $obj) inline method_id {
165
125
  if (cl::isNull($obj)) {
166
126
  return cl::NULL_CLASS_NAME;
@@ -171,12 +131,6 @@ int cl::typeof(cell $obj) inline method_id {
171
131
  cell cl::declare(int name, tuple fields) inline {
172
132
  tuple classBuilder = unsafeTuple([null(), begin_cell()]);
173
133
 
174
- if (DEBUG) {
175
- if (name > MAX_NAME_INTLEN) {
176
- ~strdump("Class name too long! ".str::concat(str::asciiUint256ToStr(name)));
177
- }
178
- }
179
-
180
134
  int num_fields = fields.tlen();
181
135
  builder headerBuilder = begin_cell().store_uint(name, _NAME_WIDTH);
182
136
 
@@ -257,9 +211,6 @@ cell cl::declare(int name, tuple fields) inline {
257
211
 
258
212
  builder rootBuilder = classBuilder.at(1);
259
213
  int numCells = classBuilder.tlen() - 1;
260
- if (DEBUG) {
261
- throw_if(cl::ERROR::INVALID_CLASS, numCells > 3);
262
- }
263
214
  if (numCells > 1) {
264
215
  if (rootBuilder.builder_refs() == 0) {
265
216
  rootBuilder = rootBuilder
@@ -336,10 +287,6 @@ forall X -> cell cl::set(cell $self, int fieldName, X val) inline method_id {
336
287
  int fieldOffset = headerSlice.cl::getFieldOffset::asm(fieldInfoOffset);
337
288
  int fieldRefsOffset = headerSlice.cl::getFieldCellOffset::asm(fieldInfoOffset );
338
289
 
339
- if (DEBUG) {
340
- throwErrorUnless(fieldType < INVALID_TYPE, "Type does not exist");
341
- }
342
-
343
290
  int fieldWidth = _getTypeWidth(fieldType);
344
291
  slice victim = fieldCellIndex == 0
345
292
  ? headerSlice
@@ -411,17 +358,6 @@ int cl::get<uint>(cell $self, int fieldName, int width) inline method_id {
411
358
  int fieldCellIndex = headerSlice.cl::getFieldCellIndex::asm(fieldInfoOffset);
412
359
  int fieldOffset = headerSlice.cl::getFieldOffset::asm(fieldInfoOffset);
413
360
 
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
361
  if (fieldCellIndex == 0) {
426
362
  return cl::preload_bits_offset_3::asm(width, headerSlice, fieldOffset, width);
427
363
  }
@@ -439,24 +375,13 @@ cell cl::get<cellRef>(cell $self, int fieldName) inline method_id {
439
375
  .cl::getFieldCellOffset::asm(
440
376
  fieldInfoOffset);
441
377
 
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
378
  return fieldCellIndex == 0
454
- ? headerSlice.preload_ref_at(fieldRefIdx)
455
- : (headerSlice
456
- .preload_ref_at(fieldCellIndex)
457
- .begin_parse()
458
- .preload_ref_at(fieldRefIdx)
459
- );
379
+ ? headerSlice.preload_ref_at(fieldRefIdx)
380
+ : (headerSlice
381
+ .preload_ref_at(fieldCellIndex)
382
+ .begin_parse()
383
+ .preload_ref_at(fieldRefIdx)
384
+ );
460
385
  }
461
386
 
462
387
  cell cl::get<objRef>(cell $self, int fieldName) inline method_id {
@@ -1,15 +1,9 @@
1
1
  ;;; ================================================================
2
2
  ;; The base main function for LayerZero Endpoint, UltraLightNode, and OApp
3
3
  ;;; ================================================================
4
- #include "baseInterface.fc";
5
- #include "classlib.fc";
6
- #include "constants.fc";
7
- #include "stdlib.fc";
8
- #include "stringlib.fc";
9
- #include "txnContext.fc";
10
- #include "actions/utils.fc";
11
- #include "abstract/contractMainAbstract.fc";
4
+
12
5
  #include "handlerCore.fc";
6
+ #include "abstract/contractMainAbstract.fc";
13
7
 
14
8
  ;;; ===============================
15
9
  ;; Base main - low-level builtin context
@@ -2,7 +2,6 @@
2
2
  ;; the DeterministicInsertionCircularQueue is a deterministic-gas circular buffer
3
3
  ;; that stores key-value pairs along with one piece of metadata (8-bits) per entry.
4
4
  #include "../utils.fc";
5
- #include "../stdlib.fc";
6
5
 
7
6
  const int DeterministicInsertionCircularQueue::statusBits = 8;
8
7
  const int DeterministicInsertionCircularQueue::keyBits = 64;
@@ -3,7 +3,6 @@
3
3
  ;; this data structure defines a bitmap that is used to track a stream of
4
4
  ;; commands that are executed out-of-order in a bounded-depth pipeline
5
5
  #include "../classlib.fc";
6
- #include "../utils.fc";
7
6
 
8
7
  const int POOO::NAME = "POOO"u;
9
8
 
@@ -2,16 +2,12 @@
2
2
  ;; This file contains the utility functions for all handler functions that follow
3
3
  ;; LayerZero Labs handler convention.
4
4
  ;;; ==========================================
5
+ #include "abstract/handlerAbstract.fc";
6
+
5
7
  #include "actions/utils.fc";
6
8
 
7
9
  #include "baseInterface.fc";
8
10
 
9
- #include "constants.fc";
10
- #include "stringlib.fc";
11
- #include "txnContext.fc";
12
-
13
- #include "abstract/handlerAbstract.fc";
14
-
15
11
  ;;; ===================REQUIRED VIRTUAL FUNCTIONS=======================
16
12
  ;; todo: split into permissions and utils?
17
13
 
@@ -1,5 +1,3 @@
1
- #include "constants.fc";
2
- #include "stdlib.fc";
3
1
  #include "utils.fc";
4
2
 
5
3
  ;;; ===============================STRING MANIPULATION FUNCTIONS===========================
@@ -1,4 +1,3 @@
1
- #include "stdlib.fc";
2
1
  #include "utils.fc";
3
2
 
4
3
  cell _garbageFilledCell() {
@@ -1,4 +1,4 @@
1
- #include "classlib.fc";
1
+ #include "utils.fc";
2
2
 
3
3
  global tuple txnContext;
4
4
 
@@ -181,3 +181,38 @@ int _gasToNanoton(int gas) inline {
181
181
  deleteDueLimit
182
182
  );
183
183
  }
184
+
185
+ ;;; ====================== Address functions ======================
186
+ int basechainAddressStdToHashpart(slice full_address) inline {
187
+ (int wc, int hp) = parseStdAddress(full_address);
188
+ return hp;
189
+ }
190
+
191
+ slice hashpartToBasechainAddressStd(int hashpart) inline {
192
+ return begin_cell()
193
+ .store_uint(4, 3) ;; 0b100
194
+ .store_int(BASECHAIN, 8)
195
+ .store_uint(hashpart, 256)
196
+ .as_slice();
197
+ }
198
+
199
+ int getContractAddress() impure inline {
200
+ return my_address().preload_bits_offset(11, 256).preload_uint(256);
201
+ }
202
+
203
+ () setContractStorage(cell $obj) impure inline {
204
+ set_data($obj);
205
+ }
206
+
207
+ cell getContractStorage() impure inline method_id {
208
+ return get_data();
209
+ }
210
+
211
+ int computeContractAddress(cell $storage, cell code) impure inline {
212
+ return begin_cell()
213
+ .store_uint(6, 5)
214
+ .store_ref(code)
215
+ .store_ref($storage)
216
+ .end_cell()
217
+ .cell_hash();
218
+ }
@@ -0,0 +1,10 @@
1
+ ;; Send flow
2
+ const int Layerzero::OP::CHANNEL_SEND_CALLBACK = "Layerzero::OP::CHANNEL_SEND_CALLBACK"c;
3
+
4
+ ;; Receive flow
5
+ const int Layerzero::OP::LZ_RECEIVE_PREPARE = "Layerzero::OP::LZ_RECEIVE_PREPARE"c;
6
+ const int Layerzero::OP::LZ_RECEIVE_EXECUTE = "Layerzero::OP::LZ_RECEIVE_EXECUTE"c;
7
+
8
+ ;; Receive flow management
9
+ const int Layerzero::OP::BURN_CALLBACK = "Layerzero::OP::BURN_CALLBACK"c;
10
+ const int Layerzero::OP::NILIFY_CALLBACK = "Layerzero::OP::NILIFY_CALLBACK"c;