@layerzerolabs/layerzero-v2-ton 3.0.19-ton.0 → 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 (206) hide show
  1. package/CHANGELOG.md +6 -0
  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 -1
  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 +5 -5
  90. package/src/classes/msgdata/LzReceiveStatus.fc +0 -1
  91. package/src/funC++/actions/call.fc +1 -0
  92. package/src/funC++/actions/deploy.fc +0 -1
  93. package/src/funC++/actions/destroy.fc +0 -1
  94. package/src/funC++/actions/dispatch.fc +0 -1
  95. package/src/funC++/actions/event.fc +0 -1
  96. package/src/funC++/actions/payment.fc +0 -1
  97. package/src/funC++/actions/sendJettons.fc +0 -1
  98. package/src/funC++/actions/utils.fc +0 -2
  99. package/src/funC++/baseInterface.fc +0 -2
  100. package/src/funC++/classlib.fc +0 -36
  101. package/src/funC++/contractMain.fc +2 -8
  102. package/src/funC++/dataStructures/DeterministicInsertionCircularQueue.fc +0 -1
  103. package/src/funC++/dataStructures/PipelinedOutOfOrder.fc +0 -1
  104. package/src/funC++/handlerCore.fc +2 -6
  105. package/src/funC++/stringlib.fc +0 -2
  106. package/src/funC++/testutils.fc +0 -1
  107. package/src/funC++/txnContext.fc +1 -1
  108. package/src/funC++/utils.fc +35 -0
  109. package/src/protocol/channel/callbackOpcodes.fc +10 -0
  110. package/src/protocol/channel/handler.fc +1032 -0
  111. package/src/protocol/channel/interface.fc +60 -0
  112. package/src/protocol/channel/main.fc +39 -0
  113. package/src/protocol/channel/storage.fc +55 -0
  114. package/src/protocol/controller/handler.fc +347 -0
  115. package/src/protocol/controller/interface.fc +25 -0
  116. package/src/protocol/controller/main.fc +29 -0
  117. package/src/protocol/controller/storage.fc +31 -0
  118. package/src/protocol/core/abstract/protocolHandler.fc +110 -0
  119. package/src/protocol/core/abstract/protocolMain.fc +30 -0
  120. package/src/protocol/core/baseStorage.fc +1 -2
  121. package/src/protocol/endpoint/handler.fc +426 -0
  122. package/src/protocol/endpoint/interface.fc +20 -0
  123. package/src/protocol/endpoint/main.fc +23 -0
  124. package/src/protocol/interfaces.fc +4 -0
  125. package/src/protocol/msglibs/BytesDecoder.fc +135 -0
  126. package/src/protocol/msglibs/BytesEncoder.fc +150 -0
  127. package/src/protocol/msglibs/interface.fc +16 -0
  128. package/src/protocol/msglibs/simpleMsglib/smlConnection/handler.fc +125 -0
  129. package/src/protocol/msglibs/simpleMsglib/smlConnection/interface.fc +3 -0
  130. package/src/protocol/msglibs/simpleMsglib/smlConnection/main.fc +19 -0
  131. package/src/protocol/msglibs/simpleMsglib/smlConnection/storage.fc +20 -0
  132. package/src/protocol/msglibs/simpleMsglib/smlManager/handler.fc +281 -0
  133. package/src/protocol/msglibs/simpleMsglib/smlManager/interface.fc +14 -0
  134. package/src/protocol/msglibs/simpleMsglib/smlManager/main.fc +24 -0
  135. package/src/protocol/msglibs/simpleMsglib/smlManager/storage.fc +38 -0
  136. package/src/protocol/msglibs/ultralightnode/callbackOpcodes.fc +1 -0
  137. package/src/protocol/msglibs/ultralightnode/feeLibInterface.fc +10 -0
  138. package/src/protocol/msglibs/ultralightnode/feeLibUtils.fc +51 -0
  139. package/src/protocol/msglibs/ultralightnode/msgdata/Attestation.fc +49 -0
  140. package/src/protocol/msglibs/ultralightnode/msgdata/DvnFeesPaidEvent.fc +26 -0
  141. package/src/protocol/msglibs/ultralightnode/msgdata/ExecutorFeePaidEvent.fc +23 -0
  142. package/src/protocol/msglibs/ultralightnode/msgdata/InitUln.fc +18 -0
  143. package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnConnection.fc +62 -0
  144. package/src/protocol/msglibs/ultralightnode/msgdata/InitUlnManager.fc +18 -0
  145. package/src/protocol/msglibs/ultralightnode/msgdata/RentRefill.fc +18 -0
  146. package/src/protocol/msglibs/ultralightnode/msgdata/SetAdminWorkerAddresses.fc +18 -0
  147. package/src/protocol/msglibs/ultralightnode/msgdata/TreasuryFeeBps.fc +16 -0
  148. package/src/protocol/msglibs/ultralightnode/msgdata/UlnEvents.fc +26 -0
  149. package/src/protocol/msglibs/ultralightnode/msgdata/UlnReceiveConfig.fc +249 -0
  150. package/src/protocol/msglibs/ultralightnode/msgdata/UlnSend.fc +27 -0
  151. package/src/protocol/msglibs/ultralightnode/msgdata/UlnSendConfig.fc +170 -0
  152. package/src/protocol/msglibs/ultralightnode/msgdata/UlnVerification.fc +21 -0
  153. package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibBytecode.fc +16 -0
  154. package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibEvents.fc +58 -0
  155. package/src/protocol/msglibs/ultralightnode/msgdata/UlnWorkerFeelibInfo.fc +56 -0
  156. package/src/protocol/msglibs/ultralightnode/msgdata/VerificationStatus.fc +18 -0
  157. package/src/protocol/msglibs/ultralightnode/uln/handler.fc +803 -0
  158. package/src/protocol/msglibs/ultralightnode/uln/interface.fc +63 -0
  159. package/src/protocol/msglibs/ultralightnode/uln/main.fc +37 -0
  160. package/src/protocol/msglibs/ultralightnode/uln/storage.fc +43 -0
  161. package/src/protocol/msglibs/ultralightnode/ulnConnection/handler.fc +600 -0
  162. package/src/protocol/msglibs/ultralightnode/ulnConnection/interface.fc +36 -0
  163. package/src/protocol/msglibs/ultralightnode/ulnConnection/main.fc +32 -0
  164. package/src/protocol/msglibs/ultralightnode/ulnConnection/storage.fc +49 -0
  165. package/src/protocol/msglibs/ultralightnode/ulnConnection/utils.fc +141 -0
  166. package/src/protocol/msglibs/ultralightnode/ulnManager/handler.fc +495 -0
  167. package/src/protocol/msglibs/ultralightnode/ulnManager/interface.fc +59 -0
  168. package/src/protocol/msglibs/ultralightnode/ulnManager/main.fc +40 -0
  169. package/src/protocol/msglibs/ultralightnode/ulnManager/storage.fc +44 -0
  170. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/common.fc +27 -0
  171. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/handler.fc +80 -0
  172. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/main.fc +4 -0
  173. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/storage.fc +26 -0
  174. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/handler.fc +123 -0
  175. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/main.fc +4 -0
  176. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/storage.fc +29 -0
  177. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/main.fc +3 -0
  178. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/main.fc +1 -0
  179. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/storage.fc +39 -0
  180. package/src/protocol/msglibs/ultralightnode/workerFeeLibs/ulnSendWorkerV1.fc +363 -0
  181. package/src/workers/core/abstract/workerHandler.fc +150 -0
  182. package/src/workers/core/interface.fc +25 -0
  183. package/src/workers/core/workerCoreStorage.fc +44 -0
  184. package/src/workers/dvn/handler.fc +332 -0
  185. package/src/workers/dvn/interface.fc +25 -0
  186. package/src/workers/dvn/main.fc +36 -0
  187. package/src/workers/dvn/storage.fc +27 -0
  188. package/src/workers/executor/handler.fc +110 -0
  189. package/src/workers/executor/interface.fc +19 -0
  190. package/src/workers/executor/main.fc +26 -0
  191. package/src/workers/executor/storage.fc +19 -0
  192. package/src/workers/msgdata/ExecuteParams.fc +29 -0
  193. package/src/workers/msgdata/NativeDrop.fc +16 -0
  194. package/src/workers/msgdata/ProxyMessage.fc +20 -0
  195. package/src/workers/msgdata/SetDict.fc +20 -0
  196. package/src/workers/msgdata/SetQuorum.fc +20 -0
  197. package/src/workers/msgdata/SignedRequest.fc +18 -0
  198. package/src/workers/priceFeedCache/handler.fc +114 -0
  199. package/src/workers/priceFeedCache/interface.fc +4 -0
  200. package/src/workers/priceFeedCache/main.fc +25 -0
  201. package/src/workers/priceFeedCache/storage.fc +21 -0
  202. package/src/workers/proxy/handler.fc +81 -0
  203. package/src/workers/proxy/interface.fc +11 -0
  204. package/src/workers/proxy/main.fc +17 -0
  205. package/src/workers/proxy/storage.fc +21 -0
  206. package/tests/testMain.fc +0 -1
@@ -0,0 +1,363 @@
1
+ #include "../../../../funC++/classlib.fc";
2
+ #include "../../../../funC++/stdlib.fc";
3
+ #include "../../../../funC++/utils.fc";
4
+ #include "../../../../classes/msgdata/LzSend.fc";
5
+ ;; updated storage
6
+ cell ulnWorker::setConfig(cell $storage, cell $md) method_id {
7
+ return $storage;
8
+ }
9
+
10
+ tuple ulnWorker::quote(tuple inputs) method_id {
11
+ cell $lzSend = inputs.cell_at(2);
12
+
13
+ int maxCount = $lzSend.cl::get<uint64>(md::LzSend::sendRequestId);
14
+ throw_if(1000, maxCount == 111);
15
+
16
+ int count = 0;
17
+ while (count < maxCount) {
18
+ count += 1;
19
+ }
20
+
21
+ return unsafeTuple(
22
+ [42, begin_cell().store_uint256(42).end_cell()]
23
+ );
24
+ }
25
+
26
+ tuple ulnWorker::simpleQuote(tuple inputs) method_id {
27
+ return inputs;
28
+ }
29
+
30
+ int ulnWorker::tooManyInputs(tuple one, tuple two, tuple three) method_id {
31
+ return 100;
32
+ }
33
+
34
+ int ulnWorker::tooFewInputs() method_id {
35
+ return 200;
36
+ }
37
+
38
+ (int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) ulnWorker::sixtyFourOutputs(tuple inputs) method_id {
39
+ return (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1);
40
+ }
41
+
42
+ int ulnWorker::put16ItemsBeforeOOG(tuple inputs) method_id {
43
+ int a = 1;
44
+ int b = 2;
45
+ int c = 3;
46
+ int d = 4;
47
+ int e = 5;
48
+ int f = 6;
49
+ int g = 7;
50
+ int h = 8;
51
+ int i = 9;
52
+ int j = 10;
53
+ int k = 11;
54
+ int l = 12;
55
+ int m = 13;
56
+ int n = 14;
57
+ int o = 15;
58
+ int p = 16;
59
+
60
+ int counter = 10 * 1000;
61
+
62
+ while (counter > 0) {
63
+ counter -= 1;
64
+ }
65
+
66
+ return (a + b + c + d + e + f + g + h + i + j + k + l + m + n + o + p);
67
+ }
68
+
69
+ int ulnWorker::put32ItemsBeforeOOG(tuple inputs) method_id {
70
+ int a0 = 100;
71
+ int a1 = 101;
72
+ int a2 = 102;
73
+ int a3 = 103;
74
+ int a4 = 104;
75
+ int a5 = 105;
76
+ int a6 = 106;
77
+ int a7 = 107;
78
+ int a8 = 108;
79
+ int a9 = 109;
80
+ int a10 = 110;
81
+ int a11 = 111;
82
+ int a12 = 112;
83
+ int a13 = 113;
84
+ int a14 = 114;
85
+ int a15 = 115;
86
+ int a16 = 116;
87
+ int a17 = 117;
88
+ int a18 = 118;
89
+ int a19 = 119;
90
+ int a20 = 120;
91
+ int a21 = 121;
92
+ int a22 = 122;
93
+ int a23 = 123;
94
+ int a24 = 124;
95
+ int a25 = 125;
96
+ int a26 = 126;
97
+ int a27 = 127;
98
+ int a28 = 128;
99
+ int a29 = 129;
100
+ int a30 = 130;
101
+ int a31 = 131;
102
+ int a32 = 132;
103
+
104
+ int counter = 20 * 1000;
105
+
106
+ while (counter > 0) {
107
+ counter -= 1;
108
+ }
109
+
110
+ return (a0 + a1 + a2 + a3 + a4 + a5 + a6 + a7 + a8 + a9 + a10 + a11 + a12 + a13 + a14 + a15 + a16 + a17 + a18 + a19 + a20 + a21 + a22 + a23 + a24 + a25 + a26 + a27 + a28 + a29 + a30 + a31 + a32);
111
+ }
112
+
113
+ int ulnWorker::put64ItemsBeforeOOG(tuple inputs) method_id {
114
+ cell a0 = begin_cell().store_uint(100, 64).end_cell();
115
+ cell a1 = begin_cell().store_uint(101, 64).end_cell();
116
+ cell a2 = begin_cell().store_uint(102, 64).end_cell();
117
+ cell a3 = begin_cell().store_uint(103, 64).end_cell();
118
+ cell a4 = begin_cell().store_uint(104, 64).end_cell();
119
+ cell a5 = begin_cell().store_uint(105, 64).end_cell();
120
+ cell a6 = begin_cell().store_uint(106, 64).end_cell();
121
+ cell a7 = begin_cell().store_uint(107, 64).end_cell();
122
+ cell a8 = begin_cell().store_uint(108, 64).end_cell();
123
+ cell a9 = begin_cell().store_uint(109, 64).end_cell();
124
+ cell a10 = begin_cell().store_uint(110, 64).end_cell();
125
+ cell a11 = begin_cell().store_uint(111, 64).end_cell();
126
+ cell a12 = begin_cell().store_uint(112, 64).end_cell();
127
+ cell a13 = begin_cell().store_uint(113, 64).end_cell();
128
+ cell a14 = begin_cell().store_uint(114, 64).end_cell();
129
+ cell a15 = begin_cell().store_uint(115, 64).end_cell();
130
+ cell a16 = begin_cell().store_uint(116, 64).end_cell();
131
+ cell a17 = begin_cell().store_uint(117, 64).end_cell();
132
+ cell a18 = begin_cell().store_uint(118, 64).end_cell();
133
+ cell a19 = begin_cell().store_uint(119, 64).end_cell();
134
+ cell a20 = begin_cell().store_uint(120, 64).end_cell();
135
+ cell a21 = begin_cell().store_uint(121, 64).end_cell();
136
+ cell a22 = begin_cell().store_uint(122, 64).end_cell();
137
+ cell a23 = begin_cell().store_uint(123, 64).end_cell();
138
+ cell a24 = begin_cell().store_uint(124, 64).end_cell();
139
+ cell a25 = begin_cell().store_uint(125, 64).end_cell();
140
+ cell a26 = begin_cell().store_uint(126, 64).end_cell();
141
+ cell a27 = begin_cell().store_uint(127, 64).end_cell();
142
+ cell a28 = begin_cell().store_uint(128, 64).end_cell();
143
+ cell a29 = begin_cell().store_uint(129, 64).end_cell();
144
+ cell a30 = begin_cell().store_uint(130, 64).end_cell();
145
+ cell a31 = begin_cell().store_uint(131, 64).end_cell();
146
+ cell a32 = begin_cell().store_uint(132, 64).end_cell();
147
+ cell a33 = begin_cell().store_uint(133, 64).end_cell();
148
+ cell a34 = begin_cell().store_uint(134, 64).end_cell();
149
+ cell a35 = begin_cell().store_uint(135, 64).end_cell();
150
+ cell a36 = begin_cell().store_uint(136, 64).end_cell();
151
+ cell a37 = begin_cell().store_uint(137, 64).end_cell();
152
+ cell a38 = begin_cell().store_uint(138, 64).end_cell();
153
+ cell a39 = begin_cell().store_uint(139, 64).end_cell();
154
+ cell a40 = begin_cell().store_uint(140, 64).end_cell();
155
+ cell a41 = begin_cell().store_uint(141, 64).end_cell();
156
+ cell a42 = begin_cell().store_uint(142, 64).end_cell();
157
+ cell a43 = begin_cell().store_uint(143, 64).end_cell();
158
+ cell a44 = begin_cell().store_uint(144, 64).end_cell();
159
+ cell a45 = begin_cell().store_uint(145, 64).end_cell();
160
+ cell a46 = begin_cell().store_uint(146, 64).end_cell();
161
+ cell a47 = begin_cell().store_uint(147, 64).end_cell();
162
+ cell a48 = begin_cell().store_uint(148, 64).end_cell();
163
+ cell a49 = begin_cell().store_uint(149, 64).end_cell();
164
+ cell a50 = begin_cell().store_uint(150, 64).end_cell();
165
+ cell a51 = begin_cell().store_uint(151, 64).end_cell();
166
+ cell a52 = begin_cell().store_uint(152, 64).end_cell();
167
+ cell a53 = begin_cell().store_uint(153, 64).end_cell();
168
+ cell a54 = begin_cell().store_uint(154, 64).end_cell();
169
+ cell a55 = begin_cell().store_uint(155, 64).end_cell();
170
+ cell a56 = begin_cell().store_uint(156, 64).end_cell();
171
+ cell a57 = begin_cell().store_uint(157, 64).end_cell();
172
+ cell a58 = begin_cell().store_uint(158, 64).end_cell();
173
+ cell a59 = begin_cell().store_uint(159, 64).end_cell();
174
+ cell a60 = begin_cell().store_uint(160, 64).end_cell();
175
+ cell a61 = begin_cell().store_uint(161, 64).end_cell();
176
+ cell a62 = begin_cell().store_uint(162, 64).end_cell();
177
+ cell a63 = begin_cell().store_uint(163, 64).end_cell();
178
+ cell a64 = begin_cell().store_uint(164, 64).end_cell();
179
+
180
+ int counter = 30 * 1000;
181
+
182
+ while (counter > 0) {
183
+ counter -= 1;
184
+ }
185
+
186
+ return (
187
+ a0.begin_parse().preload_uint(64) +
188
+ a1.begin_parse().preload_uint(64) +
189
+ a2.begin_parse().preload_uint(64) +
190
+ a3.begin_parse().preload_uint(64) +
191
+ a4.begin_parse().preload_uint(64) +
192
+ a5.begin_parse().preload_uint(64) +
193
+ a6.begin_parse().preload_uint(64) +
194
+ a7.begin_parse().preload_uint(64) +
195
+ a8.begin_parse().preload_uint(64) +
196
+ a9.begin_parse().preload_uint(64) +
197
+ a10.begin_parse().preload_uint(64) +
198
+ a11.begin_parse().preload_uint(64) +
199
+ a12.begin_parse().preload_uint(64) +
200
+ a13.begin_parse().preload_uint(64) +
201
+ a14.begin_parse().preload_uint(64) +
202
+ a15.begin_parse().preload_uint(64) +
203
+ a16.begin_parse().preload_uint(64) +
204
+ a17.begin_parse().preload_uint(64) +
205
+ a18.begin_parse().preload_uint(64) +
206
+ a19.begin_parse().preload_uint(64) +
207
+ a20.begin_parse().preload_uint(64) +
208
+ a21.begin_parse().preload_uint(64) +
209
+ a22.begin_parse().preload_uint(64) +
210
+ a23.begin_parse().preload_uint(64) +
211
+ a24.begin_parse().preload_uint(64) +
212
+ a25.begin_parse().preload_uint(64) +
213
+ a26.begin_parse().preload_uint(64) +
214
+ a27.begin_parse().preload_uint(64) +
215
+ a28.begin_parse().preload_uint(64) +
216
+ a29.begin_parse().preload_uint(64) +
217
+ a30.begin_parse().preload_uint(64) +
218
+ a31.begin_parse().preload_uint(64) +
219
+ a32.begin_parse().preload_uint(64) +
220
+ a33.begin_parse().preload_uint(64) +
221
+ a34.begin_parse().preload_uint(64) +
222
+ a35.begin_parse().preload_uint(64) +
223
+ a36.begin_parse().preload_uint(64) +
224
+ a37.begin_parse().preload_uint(64) +
225
+ a38.begin_parse().preload_uint(64) +
226
+ a39.begin_parse().preload_uint(64) +
227
+ a40.begin_parse().preload_uint(64) +
228
+ a41.begin_parse().preload_uint(64) +
229
+ a42.begin_parse().preload_uint(64) +
230
+ a43.begin_parse().preload_uint(64) +
231
+ a44.begin_parse().preload_uint(64) +
232
+ a45.begin_parse().preload_uint(64) +
233
+ a46.begin_parse().preload_uint(64) +
234
+ a47.begin_parse().preload_uint(64) +
235
+ a48.begin_parse().preload_uint(64) +
236
+ a49.begin_parse().preload_uint(64) +
237
+ a50.begin_parse().preload_uint(64) +
238
+ a51.begin_parse().preload_uint(64) +
239
+ a52.begin_parse().preload_uint(64) +
240
+ a53.begin_parse().preload_uint(64) +
241
+ a54.begin_parse().preload_uint(64) +
242
+ a55.begin_parse().preload_uint(64) +
243
+ a56.begin_parse().preload_uint(64) +
244
+ a57.begin_parse().preload_uint(64) +
245
+ a58.begin_parse().preload_uint(64) +
246
+ a59.begin_parse().preload_uint(64) +
247
+ a60.begin_parse().preload_uint(64) +
248
+ a61.begin_parse().preload_uint(64) +
249
+ a62.begin_parse().preload_uint(64) +
250
+ a63.begin_parse().preload_uint(64) +
251
+ a64.begin_parse().preload_uint(64)
252
+ );
253
+ }
254
+
255
+ ;; this is the other case, we could run out of gas by stack overflowing or by the gas limit
256
+ int ulnWorker::fibonacci(tuple inputs) method_id {
257
+ int n = inputs.int_at(0);
258
+
259
+ if (n <= 0) {
260
+ return 0;
261
+ }
262
+ if (n == 1) {
263
+ return 1;
264
+ }
265
+ return ulnWorker::fibonacci(unsafeTuple([n - 1])) + ulnWorker::fibonacci(unsafeTuple([n - 2]));
266
+ }
267
+
268
+ int ulnWorker::tooFewInputs1() method_id {
269
+ return 200;
270
+ }
271
+ int ulnWorker::tooFewInputs2() method_id {
272
+ return 200;
273
+ }
274
+ int ulnWorker::tooFewInputs3() method_id {
275
+ return 200;
276
+ }
277
+ int ulnWorker::tooFewInputs4() method_id {
278
+ return 200;
279
+ }
280
+ int ulnWorker::tooFewInputs5() method_id {
281
+ return 200;
282
+ }
283
+ int ulnWorker::tooFewInputs6() method_id {
284
+ return 200;
285
+ }
286
+ int ulnWorker::tooFewInputs7() method_id {
287
+ return 200;
288
+ }
289
+ int ulnWorker::tooFewInputs8() method_id {
290
+ return 200;
291
+ }
292
+ int ulnWorker::tooFewInputs9() method_id {
293
+ return 200;
294
+ }
295
+ int ulnWorker::tooFewInputs10() method_id {
296
+ return 200;
297
+ }
298
+ int ulnWorker::tooFewInputs11() method_id {
299
+ return 200;
300
+ }
301
+ int ulnWorker::tooFewInputs12() method_id {
302
+ return 200;
303
+ }
304
+ int ulnWorker::tooFewInputs13() method_id {
305
+ return 200;
306
+ }
307
+ int ulnWorker::tooFewInputs14() method_id {
308
+ return 200;
309
+ }
310
+ int ulnWorker::tooFewInputs15() method_id {
311
+ return 200;
312
+ }
313
+ int ulnWorker::tooFewInputs16() method_id {
314
+ return 200;
315
+ }
316
+ int ulnWorker::tooFewInputs17() method_id {
317
+ return 200;
318
+ }
319
+ int ulnWorker::tooFewInputs18() method_id {
320
+ return 200;
321
+ }
322
+ int ulnWorker::tooFewInputs19() method_id {
323
+ return 200;
324
+ }
325
+ int ulnWorker::tooFewInputs20() method_id {
326
+ return 200;
327
+ }
328
+ int ulnWorker::tooFewInputs21() method_id {
329
+ return 200;
330
+ }
331
+ int ulnWorker::tooFewInputs22() method_id {
332
+ return 200;
333
+ }
334
+ int ulnWorker::tooFewInputs23() method_id {
335
+ return 200;
336
+ }
337
+ int ulnWorker::tooFewInputs24() method_id {
338
+ return 200;
339
+ }
340
+ int ulnWorker::tooFewInputs25() method_id {
341
+ return 200;
342
+ }
343
+ int ulnWorker::tooFewInputs26() method_id {
344
+ return 200;
345
+ }
346
+ int ulnWorker::tooFewInputs27() method_id {
347
+ return 200;
348
+ }
349
+ int ulnWorker::tooFewInputs28() method_id {
350
+ return 200;
351
+ }
352
+ int ulnWorker::tooFewInputs29() method_id {
353
+ return 200;
354
+ }
355
+ int ulnWorker::tooFewInputs30() method_id {
356
+ return 200;
357
+ }
358
+ int ulnWorker::tooFewInputs31() method_id {
359
+ return 200;
360
+ }
361
+ int ulnWorker::tooFewInputs32() method_id {
362
+ return 200;
363
+ }
@@ -0,0 +1,150 @@
1
+ #include "../../../funC++/handlerCore.fc";
2
+
3
+ #include "../../../funC++/actions/call.fc";
4
+ #include "../../../funC++/actions/event.fc";
5
+ #include "../../../funC++/actions/payment.fc";
6
+
7
+ #include "../../../classes/msgdata/CoinsAmount.fc";
8
+ #include "../../../classes/msgdata/SetAddress.fc";
9
+ #include "../../../classes/msgdata/MdObj.fc";
10
+
11
+ #include "../../msgdata/ExecuteParams.fc";
12
+
13
+ #include "../../../protocol/msglibs/ultralightnode/uln/interface.fc";
14
+ #include "../../../protocol/msglibs/ultralightnode/ulnManager/interface.fc";
15
+ #include "../../proxy/interface.fc";
16
+ #include "../workerCoreStorage.fc";
17
+
18
+ cell getInitialStorage() impure inline {
19
+ return empty_cell();
20
+ }
21
+
22
+ ;; declared inside of the actions/event.fc
23
+ ;; We declare it here because it saves the need for declaring initialStorage everytime we call event
24
+ tuple _newAction<event>(int topic, cell $body) impure inline {
25
+ return action::event::New(topic, $body, cl::nullObject());
26
+ }
27
+
28
+ ;;; ==========================================
29
+ ;; Modifiers
30
+ () assertAuthenticated() impure inline { }
31
+
32
+ () assertInitialized() impure inline { }
33
+
34
+ () assertAdmin() impure inline {
35
+ cell $admins = getCoreStorage().cl::get<cellRef>(WorkerCoreStorage::admins);
36
+ throw_unless(
37
+ Worker::ERROR::onlyAdmin,
38
+ AddressList::includes(getCaller(), $admins.begin_parse())
39
+ );
40
+ }
41
+
42
+ ;; Step 1: authenticate
43
+ () authenticate() impure { }
44
+
45
+ () authenticateIfNecessary() impure inline { }
46
+
47
+ ;; Step 2: initialize
48
+ ;; mdAddress: (md=null, address=proxy), they're both 256.
49
+ tuple initialize(cell $mdAddress) impure inline {
50
+ return emptyActions();
51
+ }
52
+
53
+ () assertOwner() impure inline { }
54
+
55
+ ;;; =================================== EVENT FUNCTIONS =================================
56
+
57
+ int _getEventSink() impure inline method_id {
58
+ int eventSink = getCoreStorage().cl::get<address>(WorkerCoreStorage::proxy);
59
+ if (eventSink == NULLADDRESS) {
60
+ return getContractAddress();
61
+ }
62
+ return eventSink;
63
+ }
64
+
65
+ int verifyEventOrigin(int address) method_id {
66
+ return AddressList::includes(
67
+ address, getCoreStorage().cl::get<objRef>(WorkerCoreStorage::admins).begin_parse()
68
+ );
69
+ }
70
+
71
+ ;;; =================================== (HANDLER) HELPER FUNCTIONS =================================
72
+
73
+ tuple _claimTon(tuple actions, cell $coinsAmount) impure {
74
+ ;; this amount will be paid from the contract balance
75
+ actions~pushAction<payment>(
76
+ getCaller(),
77
+ $coinsAmount.cl::get<coins>(md::CoinsAmount::amount),
78
+ $coinsAmount.cl::get<coins>(md::CoinsAmount::amount)
79
+ );
80
+
81
+ return actions;
82
+ }
83
+
84
+ tuple _callContract(tuple actions, cell $executeParams) impure inline {
85
+ actions~pushAction<call>(
86
+ $executeParams.cl::get<address>(md::ExecuteParams::target),
87
+ $executeParams.cl::get<uint32>(md::ExecuteParams::opcode),
88
+ $executeParams.cl::get<objRef>(md::ExecuteParams::callData)
89
+ );
90
+
91
+ return actions;
92
+ }
93
+
94
+ tuple _setAdmins(tuple actions, cell $addressList) impure {
95
+ actions~pushAction<event>(
96
+ Worker::event::ADMINS_SET,
97
+ $addressList
98
+ );
99
+
100
+ setContractStorage(
101
+ getContractStorage().setCoreStorage(
102
+ getCoreStorage().cl::set(
103
+ WorkerCoreStorage::admins,
104
+ $addressList
105
+ )
106
+ )
107
+ );
108
+
109
+ return actions;
110
+ }
111
+
112
+ tuple _setProxyAddress(tuple actions, int newProxyAddress) impure {
113
+ setContractStorage(
114
+ getContractStorage().setCoreStorage(
115
+ getCoreStorage().cl::set(WorkerCoreStorage::proxy, newProxyAddress)
116
+ )
117
+ );
118
+ return actions;
119
+ }
120
+
121
+ tuple _callViaProxy(tuple actions, cell $executeParams) impure {
122
+ ;; only these opcodes are allowed to be called from the worker to the proxy
123
+ int opcode = $executeParams.cl::get<uint32>(md::ExecuteParams::opcode);
124
+ throw_unless(
125
+ Worker::ERROR::DISALLOWED_INNER_OPCODE,
126
+ (opcode == Uln::OP::UPDATE_WORKER_FEELIB)
127
+ | (opcode == Uln::OP::DEREGISTER_WORKER_FEELIB)
128
+ | (opcode == UlnManager::OP::ADD_ULN_WORKER)
129
+ | (opcode == Worker::OP::CLAIM_TON)
130
+ );
131
+
132
+ return _callContract(
133
+ actions,
134
+ md::ExecuteParams::New(
135
+ getProxyAddress(),
136
+ $executeParams,
137
+ 0,
138
+ Proxy::OP::CALL_CONTRACT
139
+ )
140
+ );
141
+ }
142
+
143
+ ;;; =================================== VIEW FUNCTIONS =================================
144
+
145
+ int getLatestAdmin() impure method_id {
146
+ slice adminSlice = getCoreStorage()
147
+ .cl::get<cellRef>(WorkerCoreStorage::admins)
148
+ .begin_parse();
149
+ return adminSlice~AddressList::next();
150
+ }
@@ -0,0 +1,25 @@
1
+ ;;; ==========================OPCODES=====================================
2
+ ;; Any authorized signer can call CLAIM_TON to claim funds in the executor contract.
3
+ const int Worker::OP::CLAIM_TON = "Worker::OP::CLAIM_TON"c;
4
+
5
+ ;; Send an arbitrary command to an arbitrary contract
6
+ ;; only owner
7
+ const int Worker::OP::CALL_VIA_PROXY = "Worker::OP::CALL_VIA_PROXY"c;
8
+
9
+ ;; Change the proxy address
10
+ ;; only admins
11
+ const int Worker::OP::SET_PROXY = "Worker::OP::SET_PROXY"c;
12
+
13
+ ;; Change the list of admins
14
+ ;; only admins
15
+ const int Worker::OP::SET_ADMINS = "Worker::OP::SET_ADMINS"c;
16
+
17
+ ;;; ==========================ERRORS=====================================
18
+ const int Worker::ERROR::onlyAdmin = 2015;
19
+ const int Worker::ERROR::invalidOpcode = 2014;
20
+
21
+ const int Worker::ERROR::DISALLOWED_INNER_OPCODE = 2013;
22
+ const int Worker::ERROR::DISALLOWED_INNER_TARGET = 2012;
23
+
24
+ ;;; ==========================EVENTS=====================================
25
+ const int Worker::event::ADMINS_SET = "Worker::event::ADMINS_SET"u;
@@ -0,0 +1,44 @@
1
+ #include "../../funC++/classlib.fc";
2
+
3
+ #include "interface.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 WORKER_CORE_STORAGE_IDX = 0;
8
+
9
+ ;; required object name
10
+ const int WorkerCoreStorage::NAME = "wrkCorStor"u;
11
+
12
+ ;; field names
13
+ const int WorkerCoreStorage::admins = 0;
14
+ const int WorkerCoreStorage::proxy = 1;
15
+ const int WorkerCoreStorage::version = 2;
16
+
17
+ ;; In all blockchains with atomic cross-contract call, we can use src/dst/sender/receiver
18
+ ;; because the send channel doesn't exist (it's just a nonce).
19
+ ;; In TON, we need both send/receive channels, so we use local/remote to provide
20
+ ;; a context-free way to refer to the two ends of the channel.
21
+ ;; The direction is inferred by the context of the contract (send vs receive).
22
+ ;; The srcOApp is the 256-bit hashpart of a standard address.
23
+ cell WorkerCoreStorage::New(cell admins, int proxy, int version) inline method_id {
24
+ return cl::declare(
25
+ WorkerCoreStorage::NAME,
26
+ unsafeTuple([
27
+ [cl::t::cellRef, admins], ;; WorkerCoreStorage::admins
28
+ [cl::t::address, proxy], ;; WorkerCoreStorage::proxy
29
+ [cl::t::uint256, version] ;; WorkerCoreStorage::version
30
+ ])
31
+ );
32
+ }
33
+
34
+ cell getCoreStorage() impure inline {
35
+ return getContractStorage().cl::get<objRef>(WORKER_CORE_STORAGE_IDX);
36
+ }
37
+
38
+ cell setCoreStorage(cell $storage, cell $newCoreStorage) impure inline {
39
+ return $storage.cl::set(WORKER_CORE_STORAGE_IDX, $newCoreStorage);
40
+ }
41
+
42
+ int getProxyAddress() impure inline {
43
+ return getCoreStorage().cl::get<address>(WorkerCoreStorage::proxy);
44
+ }