@layerzerolabs/layerzero-v2-ton 3.0.28 → 3.0.30-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 +6 -0
- package/build/ActionsSerde.test.compiled.json +1 -1
- package/build/AllStorages.compiled.json +1 -1
- package/build/AllStorages.test.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/ChannelSerde.test.compiled.json +1 -1
- package/build/Classlib.test.compiled.json +1 -1
- package/build/ComputeDataSizeGas.test.compiled.json +1 -1
- package/build/Connection.compiled.json +1 -1
- package/build/Controller.assertions.test.compiled.json +1 -1
- package/build/Controller.compiled.json +1 -1
- package/build/Controller.permissions.test.compiled.json +1 -1
- package/build/Controller.test.compiled.json +1 -1
- package/build/Counter.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/DvnFeeLibSerde.test.compiled.json +1 -1
- package/build/DvnPermissions.test.compiled.json +1 -1
- package/build/DvnSerde.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/EndpointSerde.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/ExecutorFeeLibSerde.test.compiled.json +1 -1
- package/build/ExecutorPermissions.test.compiled.json +1 -1
- package/build/ExecutorSerde.test.compiled.json +1 -1
- package/build/LzClasses.test.compiled.json +1 -1
- package/build/LzClassesSerde.test.compiled.json +1 -1
- package/build/LzUtil.test.compiled.json +1 -1
- package/build/MsgData.test.compiled.json +1 -1
- package/build/MsgDataSerde.test.compiled.json +1 -1
- package/build/MsglibPacketCodec.test.compiled.json +1 -1
- package/build/PipelinedOutOfOrder.test.compiled.json +1 -1
- package/build/PipelinedOutOfOrderSerde.test.compiled.json +1 -1
- package/build/PriceFeedCache.compiled.json +1 -1
- package/build/PriceFeedCache.test.compiled.json +1 -1
- package/build/PriceFeedCache.test.permissions.compiled.json +1 -1
- package/build/PriceFeedCacheSerde.test.compiled.json +1 -1
- package/build/PriceFeedFeeLibSerde.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.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/UlnConnectionSerde.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/UlnMsgDataSerde.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/UlnSerde.test.compiled.json +1 -1
- package/build/UlnUtil.test.compiled.json +1 -1
- package/build/WorkerCore.test.compiled.json +1 -1
- package/build/WorkerCoreMsgDataSerde.test.compiled.json +1 -1
- package/build/WorkerCoreSerde.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 -1
- 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 +2 -1
- package/src/classes/msgdata/LzSend.fc +6 -6
- package/src/funC++/classlib.fc +22 -0
- package/src/protocol/msglibs/ultralightnode/ulnConnection/handler.fc +5 -0
- package/src/workers/core/abstract/workerHandler.fc +15 -5
- package/src/workers/core/interface.fc +1 -0
- package/src/workers/dvn/handler.fc +5 -0
- package/src/workers/dvn/main.fc +2 -0
- package/src/workers/executor/handler.fc +6 -2
- package/src/workers/executor/main.fc +2 -0
- package/src/workers/msgdata/ClaimTon.fc +18 -0
- package/src/workers/proxy/handler.fc +2 -2
- package/tests/baseSerdeTest.fc +117 -0
package/src/workers/dvn/main.fc
CHANGED
|
@@ -24,6 +24,8 @@ tuple _executeOpcode(int op, cell $md) impure inline {
|
|
|
24
24
|
return setProxy($md);
|
|
25
25
|
} elseif (op == Worker::OP::CLAIM_TON) {
|
|
26
26
|
return claimTon($md);
|
|
27
|
+
} elseif (op == Worker::OP::CLAIM_TON_FROM_PROXY) {
|
|
28
|
+
return claimTonFromProxy($md);
|
|
27
29
|
} elseif (op == Dvn::OP::SET_PROXY_ADMINS) {
|
|
28
30
|
return setProxyAdmins($md);
|
|
29
31
|
} elseif (op == Worker::OP::CALL_VIA_PROXY) {
|
|
@@ -106,8 +106,12 @@ tuple setAdmins(cell $addressList) impure inline {
|
|
|
106
106
|
return _setAdmins(emptyActions(), $addressList);
|
|
107
107
|
}
|
|
108
108
|
|
|
109
|
-
tuple claimTon(cell $
|
|
110
|
-
return _claimTon(emptyActions(), $
|
|
109
|
+
tuple claimTon(cell $claimTon) impure inline {
|
|
110
|
+
return _claimTon(emptyActions(), $claimTon);
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
tuple claimTonFromProxy(cell $claimTon) impure inline {
|
|
114
|
+
return _claimTonFromProxy(emptyActions(), $claimTon);
|
|
111
115
|
}
|
|
112
116
|
|
|
113
117
|
tuple setProxy(cell $setAddress) impure inline {
|
|
@@ -14,6 +14,8 @@ tuple _executeOpcode(int op, cell $md) impure inline {
|
|
|
14
14
|
return setAdmins($md);
|
|
15
15
|
} elseif (op == Worker::OP::CLAIM_TON) {
|
|
16
16
|
return claimTon($md);
|
|
17
|
+
} elseif (op == Worker::OP::CLAIM_TON_FROM_PROXY) {
|
|
18
|
+
return claimTonFromProxy($md);
|
|
17
19
|
} elseif (op == Worker::OP::CALL_VIA_PROXY) {
|
|
18
20
|
return callViaProxy($md);
|
|
19
21
|
} elseif (op == Worker::OP::SET_PROXY) {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::ClaimTon::NAME = "claimTon"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::ClaimTon::amount = 0;
|
|
8
|
+
const int md::ClaimTon::target = 1;
|
|
9
|
+
|
|
10
|
+
cell md::ClaimTon::New(int amount, int target) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
md::ClaimTon::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::coins, amount], ;; md::ClaimTon::amount
|
|
15
|
+
[cl::t::address, target] ;; md::ClaimTon::target
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -38,8 +38,8 @@ tuple setAdmins(cell $addressList) impure inline {
|
|
|
38
38
|
return _setAdmins(emptyActions(), $addressList);
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
tuple claimTon(cell $
|
|
42
|
-
return _claimTon(emptyActions(), $
|
|
41
|
+
tuple claimTon(cell $claimTon) impure inline {
|
|
42
|
+
return _claimTon(emptyActions(), $claimTon);
|
|
43
43
|
}
|
|
44
44
|
|
|
45
45
|
tuple callContract(cell $executeParams) impure inline {
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
#include "./testMain.fc";
|
|
2
|
+
#include "../src/funC++/classlib.fc";
|
|
3
|
+
#include "../src/funC++/stringlib.fc";
|
|
4
|
+
|
|
5
|
+
cell baseTest::prepare(tuple args) impure {
|
|
6
|
+
return cl::nullObject();
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
;;; ===============================TEST HANDLERS===============================
|
|
10
|
+
|
|
11
|
+
;; int TEST_SUCCESS or TEST_FAILURE, slice (optional) error_message
|
|
12
|
+
(int, slice) test::build::equal(cell $newObject, cell $buildObject) impure {
|
|
13
|
+
if ($newObject.cl::hash() != $buildObject.cl::hash()) {
|
|
14
|
+
~strdump("::new output does not match ::build");
|
|
15
|
+
int wrongField = compareObjectFields($newObject, $buildObject);
|
|
16
|
+
if (wrongField == INVALID_CLASS_MEMBER) {
|
|
17
|
+
return (
|
|
18
|
+
TEST_FAILED,
|
|
19
|
+
"Object and expected object not of the same type"
|
|
20
|
+
);
|
|
21
|
+
} elseif (wrongField != -1) {
|
|
22
|
+
return (
|
|
23
|
+
TEST_FAILED,
|
|
24
|
+
"malformed field ".str::concatInt(wrongField)
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return (TEST_SUCCESS, "");
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
(int, slice) test::getBool::equal(cell $obj, (cell -> int) getter, int field) impure {
|
|
32
|
+
int expected = $obj.cl::get<bool>(field);
|
|
33
|
+
int actual = getter($obj);
|
|
34
|
+
if (expected != actual) {
|
|
35
|
+
return (TEST_FAILED, "expected: ".str::concatInt(expected).str::concat(" != actual: ").str::concatInt(actual));
|
|
36
|
+
}
|
|
37
|
+
return (TEST_SUCCESS, "");
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
(int, slice) test::getData::equal(cell $obj, (cell -> int) getter, int field) impure {
|
|
41
|
+
int width = _getTypeWidth(typeofField($obj, field));
|
|
42
|
+
int expected = $obj.cl::get<uint>(field, width);
|
|
43
|
+
int actual = getter($obj);
|
|
44
|
+
if (expected != actual) {
|
|
45
|
+
return (TEST_FAILED, "expected: ".str::concatInt(expected).str::concat(" != actual: ").str::concatInt(actual));
|
|
46
|
+
}
|
|
47
|
+
return (TEST_SUCCESS, "");
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
(int, slice) test::getRef::equal(cell $obj, (cell -> cell) getter, int fieldId) impure {
|
|
51
|
+
cell expected = $obj.cl::get<cellRef>(fieldId);
|
|
52
|
+
cell actual = getter($obj);
|
|
53
|
+
if (expected.cell_hash() != actual.cell_hash()) {
|
|
54
|
+
return (TEST_FAILED, "expected != actual");
|
|
55
|
+
}
|
|
56
|
+
return (TEST_SUCCESS, "");
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
(int, slice) test::multiget::equal(cell $object, tuple keys, tuple expected) impure {
|
|
60
|
+
tuple actual = empty_tuple();
|
|
61
|
+
int idx = 0;
|
|
62
|
+
|
|
63
|
+
while (idx < keys.tlen()) {
|
|
64
|
+
int key = keys.int_at(idx);
|
|
65
|
+
int typeOfKey = typeofField($object, key);
|
|
66
|
+
int fieldBits = _getTypeWidth(typeOfKey);
|
|
67
|
+
if (typeOfKey == cl::t::bool) {
|
|
68
|
+
actual~tpush($object.cl::get<bool>(key));
|
|
69
|
+
} elseif (typeOfKey <= cl::t::uint256) {
|
|
70
|
+
actual~tpush($object.cl::get<uint>(key, fieldBits));
|
|
71
|
+
} else {
|
|
72
|
+
actual~tpush($object.cl::get<cellRef>(key));
|
|
73
|
+
}
|
|
74
|
+
idx += 1;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
if (expected.tlen() != actual.tlen()) {
|
|
78
|
+
return (TEST_FAILED, "expected length: ".str::concatInt(expected.tlen()).str::concat(" != actual length: ").str::concatInt(actual.tlen()));
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
int idx = 0;
|
|
82
|
+
while (idx < expected.tlen()) {
|
|
83
|
+
if (expected.at(idx).is_cell() & actual.at(idx).is_cell()) {
|
|
84
|
+
if (expected.at(idx).cell_hash() != actual.at(idx).cell_hash()) {
|
|
85
|
+
return (TEST_FAILED, "expected cell != actual cell");
|
|
86
|
+
}
|
|
87
|
+
} elseif (expected.at(idx).is_int() & actual.at(idx).is_int()) {
|
|
88
|
+
if (expected.at(idx) != actual.at(idx)) {
|
|
89
|
+
return (TEST_FAILED, "expected: ".str::concatInt(expected.at(idx)).str::concat(" != actual: ").str::concatInt(actual.at(idx)));
|
|
90
|
+
}
|
|
91
|
+
} else {
|
|
92
|
+
return (TEST_FAILED, "type mismatch at idx ".str::concatInt(idx));
|
|
93
|
+
}
|
|
94
|
+
idx += 1;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
return (TEST_SUCCESS, "");
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
(int, slice) test::set::equal(cell $expected, cell $actual) impure {
|
|
101
|
+
if ($expected.cl::hash() != $actual.cl::hash()) {
|
|
102
|
+
~strdump("::set output does not match ::get");
|
|
103
|
+
int wrongField = compareObjectFields($expected, $actual);
|
|
104
|
+
if (wrongField == INVALID_CLASS_MEMBER) {
|
|
105
|
+
return (
|
|
106
|
+
TEST_FAILED,
|
|
107
|
+
"Object and expected object not of the same type"
|
|
108
|
+
);
|
|
109
|
+
} elseif (wrongField != -1) {
|
|
110
|
+
return (
|
|
111
|
+
TEST_FAILED,
|
|
112
|
+
"malformed field ".str::concatInt(wrongField)
|
|
113
|
+
);
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
return (TEST_SUCCESS, "");
|
|
117
|
+
}
|