@layerzerolabs/layerzero-v2-ton 3.0.12-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 +67 -0
- package/README.md +15 -0
- package/build/AllStorages.boc +0 -0
- package/build/AllStorages.compiled.json +1 -0
- package/build/AllStorages.fif +4164 -0
- package/build/AllStorages.test.boc +0 -0
- package/build/AllStorages.test.compiled.json +1 -0
- package/build/AllStorages.test.fif +1831 -0
- package/build/BaseContract.test.boc +0 -0
- package/build/BaseContract.test.compiled.json +1 -0
- package/build/BaseContract.test.fif +3553 -0
- package/build/Channel.boc +0 -0
- package/build/Channel.compiled.json +1 -0
- package/build/Channel.fif +5001 -0
- package/build/Channel.permissions.test.boc +0 -0
- package/build/Channel.permissions.test.compiled.json +1 -0
- package/build/Channel.permissions.test.fif +7569 -0
- package/build/ChannelBurn.test.boc +0 -0
- package/build/ChannelBurn.test.compiled.json +1 -0
- package/build/ChannelBurn.test.fif +7454 -0
- package/build/ChannelCommitPacket.test.boc +0 -0
- package/build/ChannelCommitPacket.test.compiled.json +1 -0
- package/build/ChannelCommitPacket.test.fif +7981 -0
- package/build/ChannelConfig.test.boc +0 -0
- package/build/ChannelConfig.test.compiled.json +1 -0
- package/build/ChannelConfig.test.fif +7442 -0
- package/build/ChannelInitialize.test.boc +0 -0
- package/build/ChannelInitialize.test.compiled.json +1 -0
- package/build/ChannelInitialize.test.fif +7289 -0
- package/build/ChannelMsglibIntegration.test.boc +0 -0
- package/build/ChannelMsglibIntegration.test.compiled.json +1 -0
- package/build/ChannelMsglibIntegration.test.fif +7404 -0
- package/build/ChannelMsglibSendCallback.test.boc +0 -0
- package/build/ChannelMsglibSendCallback.test.compiled.json +1 -0
- package/build/ChannelMsglibSendCallback.test.fif +7711 -0
- package/build/ChannelNilify.test.boc +0 -0
- package/build/ChannelNilify.test.compiled.json +1 -0
- package/build/ChannelNilify.test.fif +7672 -0
- package/build/ChannelReceive.test.boc +0 -0
- package/build/ChannelReceive.test.compiled.json +1 -0
- package/build/ChannelReceive.test.fif +7702 -0
- package/build/ChannelReceiveCallback.test.boc +0 -0
- package/build/ChannelReceiveCallback.test.compiled.json +1 -0
- package/build/ChannelReceiveCallback.test.fif +7549 -0
- package/build/ChannelReceiveView.test.boc +0 -0
- package/build/ChannelReceiveView.test.compiled.json +1 -0
- package/build/ChannelReceiveView.test.fif +7352 -0
- package/build/ChannelSend.test.boc +0 -0
- package/build/ChannelSend.test.compiled.json +1 -0
- package/build/ChannelSend.test.fif +7658 -0
- package/build/Classlib.test.boc +0 -0
- package/build/Classlib.test.compiled.json +1 -0
- package/build/Classlib.test.fif +4728 -0
- package/build/Connection.boc +0 -0
- package/build/Connection.compiled.json +1 -0
- package/build/Connection.fif +3503 -0
- package/build/Connection.test.boc +0 -0
- package/build/Connection.test.compiled.json +1 -0
- package/build/Connection.test.fif +6575 -0
- package/build/Controller.assertions.test.boc +0 -0
- package/build/Controller.assertions.test.compiled.json +1 -0
- package/build/Controller.assertions.test.fif +6130 -0
- package/build/Controller.boc +0 -0
- package/build/Controller.compiled.json +1 -0
- package/build/Controller.fif +3195 -0
- package/build/Controller.permissions.test.boc +0 -0
- package/build/Controller.permissions.test.compiled.json +1 -0
- package/build/Controller.permissions.test.fif +6237 -0
- package/build/Controller.test.boc +0 -0
- package/build/Controller.test.compiled.json +1 -0
- package/build/Controller.test.fif +6400 -0
- package/build/Counter.boc +0 -0
- package/build/Counter.compiled.json +1 -0
- package/build/Counter.fif +4809 -0
- package/build/Counter.permissions.test.boc +0 -0
- package/build/Counter.permissions.test.compiled.json +1 -0
- package/build/Counter.permissions.test.fif +7106 -0
- package/build/Counter.setters.test.boc +0 -0
- package/build/Counter.setters.test.compiled.json +1 -0
- package/build/Counter.setters.test.fif +7083 -0
- package/build/Counter.test.boc +0 -0
- package/build/Counter.test.compiled.json +1 -0
- package/build/Counter.test.fif +7540 -0
- package/build/Dvn.boc +0 -0
- package/build/Dvn.compiled.json +1 -0
- package/build/Dvn.fif +2923 -0
- package/build/Dvn.test.boc +0 -0
- package/build/Dvn.test.compiled.json +1 -0
- package/build/Dvn.test.fif +5753 -0
- package/build/Endpoint.boc +0 -0
- package/build/Endpoint.compiled.json +1 -0
- package/build/Endpoint.fif +3694 -0
- package/build/Endpoint.permissions.test.boc +0 -0
- package/build/Endpoint.permissions.test.compiled.json +1 -0
- package/build/Endpoint.permissions.test.fif +6211 -0
- package/build/Endpoint.test.boc +0 -0
- package/build/Endpoint.test.compiled.json +1 -0
- package/build/Endpoint.test.fif +6899 -0
- package/build/EndpointSetEpConfigDefaults.test.boc +0 -0
- package/build/EndpointSetEpConfigDefaults.test.compiled.json +1 -0
- package/build/EndpointSetEpConfigDefaults.test.fif +6529 -0
- package/build/Executor.boc +0 -0
- package/build/Executor.compiled.json +1 -0
- package/build/Executor.fif +2731 -0
- package/build/Executor.test.boc +0 -0
- package/build/Executor.test.compiled.json +1 -0
- package/build/Executor.test.fif +5822 -0
- package/build/LzClasses.test.boc +0 -0
- package/build/LzClasses.test.compiled.json +1 -0
- package/build/LzClasses.test.fif +4457 -0
- package/build/LzUtil.test.boc +0 -0
- package/build/LzUtil.test.compiled.json +1 -0
- package/build/LzUtil.test.fif +1831 -0
- package/build/MsgData.test.boc +0 -0
- package/build/MsgData.test.compiled.json +1 -0
- package/build/MsgData.test.fif +4318 -0
- package/build/MsglibPacketCodec.test.boc +0 -0
- package/build/MsglibPacketCodec.test.compiled.json +1 -0
- package/build/MsglibPacketCodec.test.fif +4851 -0
- package/build/MultiSig.boc +0 -0
- package/build/MultiSig.compiled.json +1 -0
- package/build/MultiSig.fif +727 -0
- package/build/MultiSigOrder.boc +0 -0
- package/build/MultiSigOrder.compiled.json +1 -0
- package/build/MultiSigOrder.fif +650 -0
- package/build/PipelinedOutOfOrder.test.boc +0 -0
- package/build/PipelinedOutOfOrder.test.compiled.json +1 -0
- package/build/PipelinedOutOfOrder.test.fif +2188 -0
- package/build/SmlConnection.boc +0 -0
- package/build/SmlConnection.compiled.json +1 -0
- package/build/SmlConnection.fif +2517 -0
- package/build/SmlConnection.permissions.test.boc +0 -0
- package/build/SmlConnection.permissions.test.compiled.json +1 -0
- package/build/SmlConnection.permissions.test.fif +5497 -0
- package/build/SmlConnection.test.boc +0 -0
- package/build/SmlConnection.test.compiled.json +1 -0
- package/build/SmlConnection.test.fif +5494 -0
- package/build/SmlManager.boc +0 -0
- package/build/SmlManager.compiled.json +1 -0
- package/build/SmlManager.fif +3904 -0
- package/build/SmlManager.permissions.test.boc +0 -0
- package/build/SmlManager.permissions.test.compiled.json +1 -0
- package/build/SmlManager.permissions.test.fif +6018 -0
- package/build/SmlManager.test.boc +0 -0
- package/build/SmlManager.test.compiled.json +1 -0
- package/build/SmlManager.test.fif +6047 -0
- package/build/Uln.boc +0 -0
- package/build/Uln.compiled.json +1 -0
- package/build/Uln.fif +4841 -0
- package/build/Uln.test.boc +0 -0
- package/build/Uln.test.compiled.json +1 -0
- package/build/Uln.test.fif +7077 -0
- package/build/UlnManager.boc +0 -0
- package/build/UlnManager.compiled.json +1 -0
- package/build/UlnManager.fif +3851 -0
- package/build/UlnManager.test.boc +0 -0
- package/build/UlnManager.test.compiled.json +1 -0
- package/build/UlnManager.test.fif +6571 -0
- package/build/UlnReceiveConfig.test.boc +0 -0
- package/build/UlnReceiveConfig.test.compiled.json +1 -0
- package/build/UlnReceiveConfig.test.fif +4413 -0
- package/build/UlnSend.test.boc +0 -0
- package/build/UlnSend.test.compiled.json +1 -0
- package/build/UlnSend.test.fif +6576 -0
- package/build/UlnSendConfig.test.boc +0 -0
- package/build/UlnSendConfig.test.compiled.json +1 -0
- package/build/UlnSendConfig.test.fif +4431 -0
- package/build/UlnSendWorkerFactory.test.boc +0 -0
- package/build/UlnSendWorkerFactory.test.compiled.json +1 -0
- package/build/UlnSendWorkerFactory.test.fif +6683 -0
- package/build/UlnUtil.test.boc +0 -0
- package/build/UlnUtil.test.compiled.json +1 -0
- package/build/UlnUtil.test.fif +5873 -0
- package/build/WorkerCore.test.boc +0 -0
- package/build/WorkerCore.test.compiled.json +1 -0
- package/build/WorkerCore.test.fif +5630 -0
- package/build/ZroMinter.boc +0 -0
- package/build/ZroMinter.compiled.json +1 -0
- package/build/ZroMinter.fif +2300 -0
- package/build/ZroWallet.boc +0 -0
- package/build/ZroWallet.compiled.json +1 -0
- package/build/ZroWallet.fif +2471 -0
- package/package.json +64 -0
- package/src/classes/lz/Attestation.fc +23 -0
- package/src/classes/lz/Config.fc +23 -0
- package/src/classes/lz/EpConfig.fc +91 -0
- package/src/classes/lz/MsglibInfo.fc +31 -0
- package/src/classes/lz/Packet.fc +202 -0
- package/src/classes/lz/Path.fc +56 -0
- package/src/classes/lz/ReceiveEpConfig.fc +24 -0
- package/src/classes/lz/SendEpConfig.fc +18 -0
- package/src/classes/lz/SmlJobAssigned.fc +20 -0
- package/src/classes/lz/Worker.fc +32 -0
- package/src/classes/msgdata/AddMsglib.fc +18 -0
- package/src/classes/msgdata/Amount.fc +16 -0
- package/src/classes/msgdata/Bool.fc +16 -0
- package/src/classes/msgdata/ChannelNonceInfo.fc +18 -0
- package/src/classes/msgdata/ClaimUnaccountedPoolFunds.fc +0 -0
- package/src/classes/msgdata/CoinsAmount.fc +16 -0
- package/src/classes/msgdata/CounterIncrement.fc +24 -0
- package/src/classes/msgdata/Deploy.fc +20 -0
- package/src/classes/msgdata/ExtendedMd.fc +20 -0
- package/src/classes/msgdata/GetMsglibCallback.fc +18 -0
- package/src/classes/msgdata/InitEndpoint.fc +16 -0
- package/src/classes/msgdata/InitSmlConnection.fc +16 -0
- package/src/classes/msgdata/InitUlnConnection.fc +18 -0
- package/src/classes/msgdata/LzReceiveStatus.fc +58 -0
- package/src/classes/msgdata/LzSend.fc +58 -0
- package/src/classes/msgdata/MdAddress.fc +18 -0
- package/src/classes/msgdata/MdEid.fc +18 -0
- package/src/classes/msgdata/MdObj.fc +18 -0
- package/src/classes/msgdata/MessagingReceipt.fc +22 -0
- package/src/classes/msgdata/MsglibSendCallback.fc +113 -0
- package/src/classes/msgdata/Nonce.fc +16 -0
- package/src/classes/msgdata/OptionsExtended.fc +20 -0
- package/src/classes/msgdata/OptionsV1.fc +27 -0
- package/src/classes/msgdata/OptionsV2.fc +34 -0
- package/src/classes/msgdata/PacketId.fc +18 -0
- package/src/classes/msgdata/PacketSent.fc +39 -0
- package/src/classes/msgdata/SetAddress.fc +16 -0
- package/src/classes/msgdata/SetEpConfig.fc +33 -0
- package/src/classes/msgdata/SetPeer.fc +18 -0
- package/src/classes/msgdata/SetSmlManagerConfig.fc +18 -0
- package/src/funC++/abstract/contractMainAbstract.fc +3 -0
- package/src/funC++/abstract/handlerAbstract.fc +12 -0
- package/src/funC++/actions/call.fc +51 -0
- package/src/funC++/actions/deploy.fc +118 -0
- package/src/funC++/actions/destroy.fc +28 -0
- package/src/funC++/actions/dispatch.fc +57 -0
- package/src/funC++/actions/event.fc +69 -0
- package/src/funC++/actions/payment.fc +52 -0
- package/src/funC++/actions/sendJettons.fc +76 -0
- package/src/funC++/actions/utils.fc +49 -0
- package/src/funC++/baseInterface.fc +16 -0
- package/src/funC++/classlib.fc +819 -0
- package/src/funC++/constants.fc +64 -0
- package/src/funC++/contractMain.fc +84 -0
- package/src/funC++/dataStructures/DeterministicInsertionCircularQueue.fc +155 -0
- package/src/funC++/dataStructures/PipelinedOutOfOrder.fc +93 -0
- package/src/funC++/handlerCore.fc +30 -0
- package/src/funC++/stdlib.fc +625 -0
- package/src/funC++/stringlib.fc +75 -0
- package/src/funC++/txnContext.fc +126 -0
- package/src/funC++/utils.fc +119 -0
- package/src/jettons/zro/minter.fc +120 -0
- package/src/jettons/zro/op-codes.fc +10 -0
- package/src/jettons/zro/params.fc +18 -0
- package/src/jettons/zro/utils.fc +33 -0
- package/src/jettons/zro/wallet.fc +261 -0
- package/tests/baseContractTest.fc +192 -0
- package/tests/testMain.fc +135 -0
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@layerzerolabs/layerzero-v2-ton",
|
|
3
|
+
"version": "3.0.12-ton.0",
|
|
4
|
+
"exports": {
|
|
5
|
+
".": {
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"import": "./dist/index.mjs",
|
|
8
|
+
"require": "./dist/index.cjs"
|
|
9
|
+
},
|
|
10
|
+
"./package.json": "./package.json"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.cjs",
|
|
13
|
+
"types": "./dist/index.d.ts",
|
|
14
|
+
"files": [
|
|
15
|
+
"build/",
|
|
16
|
+
"src/classes/*/*.fc",
|
|
17
|
+
"src/funC++/actions/*.fc",
|
|
18
|
+
"src/funC++/abstract/*.fc",
|
|
19
|
+
"src/funC++/dataStructures/*.fc",
|
|
20
|
+
"src/funC++/*.fc",
|
|
21
|
+
"src/funC++/actions/sendJettons.fc",
|
|
22
|
+
"src/protocol/",
|
|
23
|
+
"src/jettons/zro/*.fc",
|
|
24
|
+
"tests/testMain.fc",
|
|
25
|
+
"tests/baseContractTest.fc"
|
|
26
|
+
],
|
|
27
|
+
"scripts": {
|
|
28
|
+
"build": "$npm_execpath clean-prebuild && $npm_execpath build-all && $npm_execpath compile",
|
|
29
|
+
"build-all": "$npm_execpath blueprint build --all",
|
|
30
|
+
"build-single": "$npm_execpath blueprint build",
|
|
31
|
+
"clean": "$npm_execpath clean-prebuild && rimraf .turbo",
|
|
32
|
+
"clean-prebuild": "rimraf build",
|
|
33
|
+
"compile": "GIT_ROOT=$(git rev-parse --show-toplevel) docker compose run --rm compiler && yarn generate-artifacts",
|
|
34
|
+
"crc16xmodem": "$npm_execpath ts-node scripts/crc16xmodem.ts",
|
|
35
|
+
"generate-artifacts": "$npm_execpath ts-node scripts/generateArtifacts.ts",
|
|
36
|
+
"start": "$npm_execpath blueprint run",
|
|
37
|
+
"test": "$npm_execpath jest --verbose",
|
|
38
|
+
"test-local": "$npm_execpath compile && $npm_execpath test"
|
|
39
|
+
},
|
|
40
|
+
"dependencies": {
|
|
41
|
+
"crc-32": "^1.2.2"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@jest/globals": "^29.7.0",
|
|
45
|
+
"@ston-fi/funcbox": "^0.1.1",
|
|
46
|
+
"@ton/blueprint": "0.25.0-beta.1",
|
|
47
|
+
"@ton/core": "^0.59.0",
|
|
48
|
+
"@ton/crypto": "^3.3.0",
|
|
49
|
+
"@ton/sandbox": "^0.22.0",
|
|
50
|
+
"@ton/test-utils": "^0.4.2",
|
|
51
|
+
"@ton/ton": "^15.1.0",
|
|
52
|
+
"@types/jest": "^29.5.10",
|
|
53
|
+
"@types/node": "^20.10.5",
|
|
54
|
+
"jest": "^29.7.0",
|
|
55
|
+
"prettier": "^3.2.4",
|
|
56
|
+
"rimraf": "^5.0.5",
|
|
57
|
+
"ts-jest": "^29.1.1",
|
|
58
|
+
"ts-node": "^10.9.1",
|
|
59
|
+
"typescript": "~5.2.2"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "restricted"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::Attestation::NAME = "Attest"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::Attestation::hash = 0; ;; hash
|
|
8
|
+
const int lz::Attestation::confirmations = 1; ;; uint64
|
|
9
|
+
|
|
10
|
+
cell lz::Attestation::New(int hash, int confirmations) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
lz::Attestation::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::uint256, hash], ;; lz::Attestation::hash
|
|
15
|
+
[cl::t::uint64, confirmations] ;; lz::Attestation::confirmations
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
int lz::Attestation::isValid(cell self, int hash, int confirmations) inline method_id {
|
|
21
|
+
return (self.cl::get<uint256>(lz::Attestation::hash) == hash) &
|
|
22
|
+
(self.cl::get<uint64>(lz::Attestation::confirmations) <= confirmations);
|
|
23
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::Config::NAME = "Config"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::Config::path = 0;
|
|
8
|
+
const int lz::Config::forwardingAddress = 1;
|
|
9
|
+
const int lz::Config::opCode = 2;
|
|
10
|
+
;; provide an arbitrary config md that can be forwarded anywhere in the lz protocol that a config is accepted
|
|
11
|
+
const int lz::Config::config = 3;
|
|
12
|
+
|
|
13
|
+
cell lz::Config::New(cell $path, int forwardingAddress, int opCode, cell $config) inline method_id {
|
|
14
|
+
return cl::declare(
|
|
15
|
+
lz::Config::NAME,
|
|
16
|
+
unsafeTuple([
|
|
17
|
+
[cl::t::objRef, $path], ;; lz::Config::path
|
|
18
|
+
[cl::t::address, forwardingAddress], ;; lz::Config::forwardingAddress
|
|
19
|
+
[cl::t::uint32, opCode], ;; lz::Config::opCode
|
|
20
|
+
[cl::t::objRef, $config] ;; lz::Config::config
|
|
21
|
+
])
|
|
22
|
+
);
|
|
23
|
+
}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; ERRORS
|
|
4
|
+
const int lz::EpConfig::ERROR::sameMsglib = "sameMsglib"c & ERRORCODE_MASK;
|
|
5
|
+
const int lz::EpConfig::ERROR::invalidTimeoutExpiry = "invalidTimeoutExpiry"c & ERRORCODE_MASK;
|
|
6
|
+
const int lz::EpConfig::ERROR::invalidTimeoutReceiveMsglib = "invalidTimeoutReceiveMsglib"c & ERRORCODE_MASK;
|
|
7
|
+
const int lz::EpConfig::VALID = 42069 & ERRORCODE_MASK;
|
|
8
|
+
|
|
9
|
+
;; required storage name
|
|
10
|
+
const int lz::EpConfig::NAME = "EpConfig"u;
|
|
11
|
+
|
|
12
|
+
;; field names
|
|
13
|
+
const int lz::EpConfig::useDefaults = 0;
|
|
14
|
+
const int lz::EpConfig::sendMsglib = 1;
|
|
15
|
+
const int lz::EpConfig::sendMsglibConnection = 2;
|
|
16
|
+
const int lz::EpConfig::receiveMsglib = 3;
|
|
17
|
+
const int lz::EpConfig::receiveMsglibConnection = 4;
|
|
18
|
+
const int lz::EpConfig::timeoutReceiveMsglib = 5;
|
|
19
|
+
const int lz::EpConfig::timeoutReceiveMsglibConnection = 6;
|
|
20
|
+
const int lz::EpConfig::timeoutReceiveMsglibExpiry = 7;
|
|
21
|
+
|
|
22
|
+
cell lz::EpConfig::NewWithConnection(
|
|
23
|
+
int useDefaults,
|
|
24
|
+
int sendMsglib,
|
|
25
|
+
int sendMsglibConnection,
|
|
26
|
+
int receiveMsglib,
|
|
27
|
+
int receiveMsglibConnection,
|
|
28
|
+
int timeoutReceiveMsglib,
|
|
29
|
+
int timeoutReceiveMsglibConnection,
|
|
30
|
+
int timeoutReceiveMsglibExpiry
|
|
31
|
+
) inline method_id {
|
|
32
|
+
return cl::declare(
|
|
33
|
+
lz::EpConfig::NAME,
|
|
34
|
+
unsafeTuple([
|
|
35
|
+
[cl::t::bool, useDefaults], ;; lz::EpConfig::useDefaults,
|
|
36
|
+
[cl::t::address, sendMsglib], ;; lz::EpConfig::sendMsglib,
|
|
37
|
+
[cl::t::address, sendMsglibConnection], ;; lz::EpConfig::sendMsglibConnection,
|
|
38
|
+
[cl::t::address, receiveMsglib], ;; lz::EpConfig::receiveMsglib,
|
|
39
|
+
[cl::t::address, receiveMsglibConnection], ;; lz::EpConfig::receiveMsglibConnection,
|
|
40
|
+
[cl::t::address, timeoutReceiveMsglib], ;; lz::EpConfig::timeoutReceiveMsglib,
|
|
41
|
+
[cl::t::address, timeoutReceiveMsglibConnection], ;; lz::EpConfig::timeoutReceiveMsglibConnection,
|
|
42
|
+
[cl::t::uint64, timeoutReceiveMsglibExpiry] ;; lz::EpConfig::timeoutReceiveMsglibExpiry
|
|
43
|
+
])
|
|
44
|
+
);
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
cell lz::EpConfig::New(
|
|
48
|
+
int useDefaults,
|
|
49
|
+
int sendMsglib,
|
|
50
|
+
int receiveMsglib,
|
|
51
|
+
int timeoutReceiveMsglib,
|
|
52
|
+
int timeoutReceiveMsglibExpiry
|
|
53
|
+
) inline method_id {
|
|
54
|
+
return lz::EpConfig::NewWithConnection(
|
|
55
|
+
useDefaults,
|
|
56
|
+
sendMsglib,
|
|
57
|
+
NULLADDRESS,
|
|
58
|
+
receiveMsglib,
|
|
59
|
+
NULLADDRESS,
|
|
60
|
+
timeoutReceiveMsglib,
|
|
61
|
+
NULLADDRESS,
|
|
62
|
+
timeoutReceiveMsglibExpiry
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
cell lz::EpConfig::NewWithDefaults() inline method_id {
|
|
67
|
+
return lz::EpConfig::New(true, NULLADDRESS, NULLADDRESS, NULLADDRESS, 0);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
cell lz::EpConfig::NewFrom(int sendMsglib, int receiveMsglib) inline method_id {
|
|
71
|
+
return lz::EpConfig::New(true, sendMsglib, receiveMsglib, NULLADDRESS, 0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
int lz::EpConfig::isValid(cell $epConfig) inline method_id {
|
|
75
|
+
int receiveMsglib = $epConfig.cl::get<address>(lz::EpConfig::receiveMsglib);
|
|
76
|
+
int timeoutReceiveMsglib = $epConfig.cl::get<address>(lz::EpConfig::timeoutReceiveMsglib);
|
|
77
|
+
int timeoutReceiveMsglibExpiry = $epConfig.cl::get<uint64>(lz::EpConfig::timeoutReceiveMsglibExpiry);
|
|
78
|
+
|
|
79
|
+
if ((timeoutReceiveMsglib == NULLADDRESS) & (timeoutReceiveMsglibExpiry != 0)) {
|
|
80
|
+
;; If the timeout receive msglib is null, the expiry must be 0
|
|
81
|
+
return lz::EpConfig::ERROR::invalidTimeoutReceiveMsglib;
|
|
82
|
+
} elseif ((timeoutReceiveMsglib != NULLADDRESS) & (timeoutReceiveMsglibExpiry <= now())) {
|
|
83
|
+
;; if the timeout receive msglib is not null, the expiry must be in the future
|
|
84
|
+
return lz::EpConfig::ERROR::invalidTimeoutExpiry;
|
|
85
|
+
} elseif ((receiveMsglib != NULLADDRESS) & (receiveMsglib == timeoutReceiveMsglib)) {
|
|
86
|
+
;; the receive msglib and timeout receive msglib must be different
|
|
87
|
+
return lz::EpConfig::ERROR::sameMsglib;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
return lz::EpConfig::VALID;
|
|
91
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
#include "../../protocol/msglibs/interface.fc";
|
|
3
|
+
|
|
4
|
+
;; required storage name
|
|
5
|
+
const int lz::MsglibInfo::NAME = "MsglibInfo"u;
|
|
6
|
+
|
|
7
|
+
;; field names
|
|
8
|
+
const int lz::MsglibInfo::msglibAddress = 0;
|
|
9
|
+
;; connectionCode + connectionInitStorage are used to programmatically derive the connection address
|
|
10
|
+
const int lz::MsglibInfo::msglibConnectionCode = 1;
|
|
11
|
+
const int lz::MsglibInfo::msglibConnectionInitStorage = 2;
|
|
12
|
+
|
|
13
|
+
cell lz::MsglibInfo::New(int msglibAddress, cell msglibConnectionCode, cell msglibConnectionInitStorage) inline method_id {
|
|
14
|
+
return cl::declare(
|
|
15
|
+
lz::MsglibInfo::NAME,
|
|
16
|
+
unsafeTuple([
|
|
17
|
+
[cl::t::address, msglibAddress], ;; lz::MsglibInfo::msglibAddress
|
|
18
|
+
[cl::t::cellRef, msglibConnectionCode], ;; lz::MsglibInfo::msglibConnectionBytecode
|
|
19
|
+
[cl::t::objRef, msglibConnectionInitStorage] ;; lz::MsglibInfo::msglibConnectionInitStorage
|
|
20
|
+
])
|
|
21
|
+
);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
int lz::MsglibInfo::getMsglibConnectionAddress(cell $msglibInfo, cell $path) inline method_id {
|
|
25
|
+
return computeContractAddress(
|
|
26
|
+
$msglibInfo
|
|
27
|
+
.cl::get<objRef>(lz::MsglibInfo::msglibConnectionInitStorage)
|
|
28
|
+
.cl::set(MsglibConnection::PathFieldIdx, $path),
|
|
29
|
+
$msglibInfo.cl::get<cellRef>(lz::MsglibInfo::msglibConnectionCode)
|
|
30
|
+
);
|
|
31
|
+
}
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
#include "../../funC++/constants.fc";
|
|
3
|
+
|
|
4
|
+
#include "Path.fc";
|
|
5
|
+
|
|
6
|
+
;; required storage name
|
|
7
|
+
const int lz::Packet::NAME = "Packet"u;
|
|
8
|
+
|
|
9
|
+
;; field names
|
|
10
|
+
const int lz::Packet::path = 0;
|
|
11
|
+
const int lz::Packet::message = 1;
|
|
12
|
+
const int lz::Packet::nonce = 2;
|
|
13
|
+
const int lz::Packet::guid = 3;
|
|
14
|
+
|
|
15
|
+
const int lz::Packet::ERROR::INVALID_MESSAGE = "invalid_message"c & ERRORCODE_MASK;
|
|
16
|
+
const int lz::Packet::ERROR::INVALID_NONCE = "invalid_nonce"c & ERRORCODE_MASK;
|
|
17
|
+
const int lz::Packet::ERROR::INVALID_PACKET_FIELD = "invalid_packet_field"c & ERRORCODE_MASK;
|
|
18
|
+
|
|
19
|
+
const int lz::Packet::MAX_RECEIVE_MESSAGE_CELLS = 32;
|
|
20
|
+
const int lz::Packet::MAX_SEND_MESSAGE_CELLS = 255;
|
|
21
|
+
|
|
22
|
+
cell lz::Packet::New(cell $path, cell message, int nonce) inline method_id {
|
|
23
|
+
return cl::declare(
|
|
24
|
+
lz::Packet::NAME,
|
|
25
|
+
unsafeTuple([
|
|
26
|
+
[cl::t::objRef, $path], ;; lz::Packet::path
|
|
27
|
+
[cl::t::cellRef, message], ;; lz::Packet::message
|
|
28
|
+
[cl::t::uint64, nonce], ;; lz::Packet::nonce
|
|
29
|
+
[cl::t::uint256, 0] ;; lz::Packet::guid
|
|
30
|
+
])
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
cell lz::Packet::nonceless(cell $path, cell message) inline method_id {
|
|
35
|
+
return lz::Packet::New($path, message, 0);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
() lz::Packet::_assertValidLinkedList(cell head, int maxLen) impure inline {
|
|
39
|
+
slice messageSlice = head.begin_parse();
|
|
40
|
+
repeat (maxLen) {
|
|
41
|
+
(int sliceBits, int sliceRefs) = messageSlice.slice_bits_refs();
|
|
42
|
+
if (sliceRefs == 0) {
|
|
43
|
+
throw_if(lz::Packet::ERROR::INVALID_MESSAGE, sliceBits % 8 != 0);
|
|
44
|
+
return ();
|
|
45
|
+
} else {
|
|
46
|
+
throw_if(
|
|
47
|
+
lz::Packet::ERROR::INVALID_MESSAGE,
|
|
48
|
+
(sliceRefs != 1) | (sliceBits != MAX_CELL_WHOLE_BYTE_BITS)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
messageSlice = messageSlice.preload_first_ref().begin_parse();
|
|
52
|
+
}
|
|
53
|
+
throw(lz::Packet::ERROR::INVALID_MESSAGE);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
() lz::Packet::assertValidSendMessage(cell $self) impure inline {
|
|
57
|
+
lz::Packet::_assertValidLinkedList(
|
|
58
|
+
$self.cl::get<cellRef>(lz::Packet::message),
|
|
59
|
+
lz::Packet::MAX_SEND_MESSAGE_CELLS
|
|
60
|
+
);
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
() lz::Packet::assertValidReceiveMessage(cell $self) impure inline {
|
|
64
|
+
lz::Packet::_assertValidLinkedList(
|
|
65
|
+
$self.cl::get<cellRef>(lz::Packet::message),
|
|
66
|
+
lz::Packet::MAX_RECEIVE_MESSAGE_CELLS
|
|
67
|
+
);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
int lz::Packet::calculateGuid(cell $path, int nonce) inline method_id {
|
|
71
|
+
return keccak256Builder(
|
|
72
|
+
begin_cell()
|
|
73
|
+
.store_uint64(nonce)
|
|
74
|
+
.store_uint32($path.cl::get<uint32>(lz::Path::srcEid))
|
|
75
|
+
.store_uint256($path.cl::get<address>(lz::Path::srcOApp))
|
|
76
|
+
.store_uint32($path.cl::get<uint32>(lz::Path::dstEid))
|
|
77
|
+
.store_uint256($path.cl::get<address>(lz::Path::dstOApp))
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
;; NOTE: this assumes that the placement of the first field is before the second field
|
|
82
|
+
cell lz::Packet::replaceTwoFieldsAtOffsets(
|
|
83
|
+
cell encodedPacket,
|
|
84
|
+
int replacementValue1,
|
|
85
|
+
int replacementOffsetBytes1,
|
|
86
|
+
int field1Bytes,
|
|
87
|
+
int replacementValue2,
|
|
88
|
+
int replacementOffsetBytes2,
|
|
89
|
+
int field2Bytes
|
|
90
|
+
) impure inline method_id {
|
|
91
|
+
int field1PosBits = (replacementOffsetBytes1 % MAX_CELL_BYTES) * 8;
|
|
92
|
+
int cell1Idx = replacementOffsetBytes1 / MAX_CELL_BYTES;
|
|
93
|
+
int field2PosBits = (replacementOffsetBytes2 % MAX_CELL_BYTES) * 8;
|
|
94
|
+
int cell2Idx = replacementOffsetBytes2 / MAX_CELL_BYTES;
|
|
95
|
+
slice itr = encodedPacket.begin_parse();
|
|
96
|
+
int field1Bits = field1Bytes * 8;
|
|
97
|
+
int field2Bits = field2Bytes * 8;
|
|
98
|
+
int field1EndPosBits = field1PosBits + field1Bits;
|
|
99
|
+
int field2EndPosBits = field2PosBits + field2Bits;
|
|
100
|
+
|
|
101
|
+
throw_if(
|
|
102
|
+
lz::Packet::ERROR::INVALID_PACKET_FIELD,
|
|
103
|
+
(max(field1Bytes, field2Bytes) > MAX_CELL_BYTES)
|
|
104
|
+
| (max(field1EndPosBits, field2EndPosBits) > MAX_CELL_WHOLE_BYTE_BITS)
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
;; short-circuit the common case to save gas
|
|
108
|
+
if (cell2Idx == 0) {
|
|
109
|
+
return begin_cell()
|
|
110
|
+
.store_slice(scutfirst(itr, field1PosBits, 0))
|
|
111
|
+
.store_uint(replacementValue1, field1Bits)
|
|
112
|
+
.store_slice(subslice(
|
|
113
|
+
itr,
|
|
114
|
+
field1EndPosBits,
|
|
115
|
+
0,
|
|
116
|
+
field2PosBits - field1EndPosBits,
|
|
117
|
+
0
|
|
118
|
+
))
|
|
119
|
+
.store_uint(replacementValue2, field2Bits)
|
|
120
|
+
.store_slice(scutlast(
|
|
121
|
+
itr,
|
|
122
|
+
itr.slice_bits() - field2EndPosBits,
|
|
123
|
+
itr.slice_refs()
|
|
124
|
+
))
|
|
125
|
+
.end_cell();
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
tuple encodedPacketBuilders = empty_tuple();
|
|
129
|
+
|
|
130
|
+
int idx = 0;
|
|
131
|
+
|
|
132
|
+
do {
|
|
133
|
+
if ((idx == cell1Idx) & (cell1Idx == cell2Idx)) {
|
|
134
|
+
slice beforeFirstField = scutfirst(itr, field1PosBits, 0);
|
|
135
|
+
|
|
136
|
+
slice betweenFields = subslice(
|
|
137
|
+
itr,
|
|
138
|
+
(field1PosBits + field1Bits),
|
|
139
|
+
0,
|
|
140
|
+
(field2PosBits - field1PosBits - field1Bits),
|
|
141
|
+
0
|
|
142
|
+
);
|
|
143
|
+
|
|
144
|
+
slice afterSecondField = scutlast(
|
|
145
|
+
itr,
|
|
146
|
+
itr.slice_bits() - (field2Bits + field2PosBits),
|
|
147
|
+
itr.slice_refs()
|
|
148
|
+
);
|
|
149
|
+
|
|
150
|
+
encodedPacketBuilders~tpush(
|
|
151
|
+
begin_cell()
|
|
152
|
+
.store_slice(beforeFirstField)
|
|
153
|
+
.store_uint(replacementValue1, field1Bits)
|
|
154
|
+
.store_slice(betweenFields)
|
|
155
|
+
.store_uint(replacementValue2, field2Bits)
|
|
156
|
+
.store_slice(afterSecondField)
|
|
157
|
+
);
|
|
158
|
+
} elseif (idx == cell1Idx) {
|
|
159
|
+
encodedPacketBuilders~tpush(
|
|
160
|
+
begin_cell()
|
|
161
|
+
.store_slice(scutfirst(itr, field1PosBits, 0))
|
|
162
|
+
.store_uint(replacementValue1, field1Bits)
|
|
163
|
+
.store_slice(
|
|
164
|
+
scutlast(
|
|
165
|
+
itr,
|
|
166
|
+
itr.slice_bits() - (field1Bits + field1PosBits),
|
|
167
|
+
itr.slice_refs()
|
|
168
|
+
)
|
|
169
|
+
)
|
|
170
|
+
);
|
|
171
|
+
} elseif (idx == cell2Idx) {
|
|
172
|
+
encodedPacketBuilders~tpush(
|
|
173
|
+
begin_cell()
|
|
174
|
+
.store_slice(scutfirst(itr, field2PosBits, 0))
|
|
175
|
+
.store_uint(replacementValue2, field2Bits)
|
|
176
|
+
.store_slice(
|
|
177
|
+
scutlast(
|
|
178
|
+
itr,
|
|
179
|
+
itr.slice_bits() - (field2Bits + field2PosBits),
|
|
180
|
+
itr.slice_refs()
|
|
181
|
+
)
|
|
182
|
+
)
|
|
183
|
+
);
|
|
184
|
+
} else {
|
|
185
|
+
encodedPacketBuilders~tpush(begin_cell().store_slice(itr));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
if (itr.slice_refs() > 0) {
|
|
189
|
+
itr = itr.preload_first_ref().begin_parse();
|
|
190
|
+
}
|
|
191
|
+
idx += 1;
|
|
192
|
+
} until (idx >= cell2Idx);
|
|
193
|
+
|
|
194
|
+
cell curCell = encodedPacketBuilders.at(cell2Idx).end_cell();
|
|
195
|
+
|
|
196
|
+
while (cell2Idx > 0) {
|
|
197
|
+
cell2Idx -= 1;
|
|
198
|
+
curCell = encodedPacketBuilders.at(cell2Idx).store_ref(curCell).end_cell();
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
return curCell;
|
|
202
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::Path::NAME = "path"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::Path::srcEid = 0;
|
|
8
|
+
const int lz::Path::srcOApp = 1;
|
|
9
|
+
const int lz::Path::dstEid = 2;
|
|
10
|
+
const int lz::Path::dstOApp = 3;
|
|
11
|
+
|
|
12
|
+
;; In all blockchains with atomic cross-contract call, we can use src/dst/srcOApp/dstOApp
|
|
13
|
+
;; because the send channel doesn't exist (it's just a nonce).
|
|
14
|
+
;; In TON, we need both send/receive channels, so we use srcOApp/dstOApp to provide
|
|
15
|
+
;; a context-free way to refer to the two ends of the channel.
|
|
16
|
+
;; The direction is inferred by the context of the contract (send vs receive).
|
|
17
|
+
;; The srcOApp is the 256-bit hashpart of a standard address.
|
|
18
|
+
cell lz::Path::New(int srcEid, int srcOApp, int dstEid, int dstOApp) inline method_id {
|
|
19
|
+
return cl::declare(
|
|
20
|
+
lz::Path::NAME,
|
|
21
|
+
unsafeTuple([
|
|
22
|
+
[cl::t::uint32, srcEid], ;; lz::Path::srcEid
|
|
23
|
+
[cl::t::uint256, srcOApp], ;; lz::Path::srcOApp
|
|
24
|
+
[cl::t::uint32, dstEid], ;; lz::Path::dstEid
|
|
25
|
+
[cl::t::uint256, dstOApp] ;; lz::Path::dstOApp
|
|
26
|
+
])
|
|
27
|
+
);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
cell lz::Path::endpointPath(int srcEid, int dstEid) inline {
|
|
31
|
+
return lz::Path::New(srcEid, NULLADDRESS, dstEid, NULLADDRESS);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
cell lz::Path::reverse(cell $path) inline {
|
|
35
|
+
int srcEid = $path.cl::get<uint32>(lz::Path::srcEid);
|
|
36
|
+
int srcOapp = $path.cl::get<address>(lz::Path::srcOApp);
|
|
37
|
+
int dstEid = $path.cl::get<uint32>(lz::Path::dstEid);
|
|
38
|
+
int dstOapp = $path.cl::get<address>(lz::Path::dstOApp);
|
|
39
|
+
return lz::Path::New(dstEid, dstOapp, srcEid, srcOapp);
|
|
40
|
+
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const int lz::Path::_srcEidOffset = _HEADER_WIDTH;
|
|
44
|
+
const int lz::Path::_srcOAppOffset = lz::Path::_srcEidOffset + 32;
|
|
45
|
+
const int lz::Path::_dstEidOffset = lz::Path::_srcOAppOffset + 256;
|
|
46
|
+
;; low-level optimized version
|
|
47
|
+
;; original: 12k gas
|
|
48
|
+
;; optimized: 1k gas
|
|
49
|
+
cell lz::Path::optimizedReverse(cell $path) inline {
|
|
50
|
+
slice pathSlice = $path.begin_parse();
|
|
51
|
+
return begin_cell()
|
|
52
|
+
.store_slice(pathSlice.scutfirst(_HEADER_WIDTH, 0))
|
|
53
|
+
.store_slice(pathSlice.preload_bits_offset(lz::Path::_dstEidOffset, 288)) ;; 32 + 256
|
|
54
|
+
.store_slice(pathSlice.preload_bits_offset(lz::Path::_srcEidOffset, 288)) ;; eid + address
|
|
55
|
+
.end_cell();
|
|
56
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::ReceiveEpConfig::NAME = "RcvMsglib"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::ReceiveEpConfig::receiveMsglibConnectionAddress = 0;
|
|
8
|
+
const int lz::ReceiveEpConfig::timeoutReceiveMsglibConnectionAddress = 1;
|
|
9
|
+
const int lz::ReceiveEpConfig::expiry = 2;
|
|
10
|
+
|
|
11
|
+
cell lz::ReceiveEpConfig::New(
|
|
12
|
+
int receiveMsglibConnectionAddress,
|
|
13
|
+
int timeoutReceiveMsglibConnectionAddress,
|
|
14
|
+
int expiry
|
|
15
|
+
) inline method_id {
|
|
16
|
+
return cl::declare(
|
|
17
|
+
lz::ReceiveEpConfig::NAME,
|
|
18
|
+
unsafeTuple([
|
|
19
|
+
[cl::t::address, receiveMsglibConnectionAddress], ;; lz::ReceiveEpConfig::receiveMsglibConnectionAddress
|
|
20
|
+
[cl::t::address, timeoutReceiveMsglibConnectionAddress], ;; lz::ReceiveEpConfig::timeoutReceiveMsglibConnectionAddress
|
|
21
|
+
[cl::t::uint64, expiry] ;; lz::ReceiveEpConfig::expiry
|
|
22
|
+
])
|
|
23
|
+
);
|
|
24
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::SendEpConfig::NAME = "SendEpCfg"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::SendEpConfig::sendMsglibAddress = 0;
|
|
8
|
+
const int lz::SendEpConfig::sendMsglibConnectionAddress = 1;
|
|
9
|
+
|
|
10
|
+
cell lz::SendEpConfig::New(int sendMsglibAddress, int sendMsglibConnectionAddress) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
lz::SendEpConfig::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::address, sendMsglibAddress], ;; lz::SendEpConfig::sendMsglibAddress
|
|
15
|
+
[cl::t::address, sendMsglibConnectionAddress] ;; lz::SendEpConfig::sendMsglibConnectionAddress
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::SmlJobAssigned::NAME = "SmlJobAssg"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::SmlJobAssigned::executorAddress = 0;
|
|
8
|
+
const int lz::SmlJobAssigned::fee = 1;
|
|
9
|
+
|
|
10
|
+
const int lz::SmlJobAssigned::SmlExecutorAddress = 0xdeadbeef;
|
|
11
|
+
|
|
12
|
+
cell lz::SmlJobAssigned::New(int fee) inline method_id {
|
|
13
|
+
return cl::declare(
|
|
14
|
+
lz::SmlJobAssigned::NAME,
|
|
15
|
+
unsafeTuple([
|
|
16
|
+
[cl::t::address, lz::SmlJobAssigned::SmlExecutorAddress], ;; lz::SmlJobAssigned::executorAddress
|
|
17
|
+
[cl::t::coins, fee] ;; lz::SmlJobAssigned::fee
|
|
18
|
+
])
|
|
19
|
+
);
|
|
20
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int lz::Worker::NAME = "Worker"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int lz::Worker::owner = 0; ;; key
|
|
8
|
+
;; allowlist of workers who are allowed to view my storage
|
|
9
|
+
const int lz::Worker::viewAllowlist = 1;
|
|
10
|
+
;; list of workers whose storage I depend on
|
|
11
|
+
const int lz::Worker::viewDependencies = 2;
|
|
12
|
+
const int lz::Worker::bytecodeLibrary = 3; ;; library cell
|
|
13
|
+
const int lz::Worker::storage = 4;
|
|
14
|
+
|
|
15
|
+
;; In all blockchains with atomic cross-contract call, we can use src/dst/sender/receiver
|
|
16
|
+
;; because the send channel doesn't exist (it's just a nonce).
|
|
17
|
+
;; In TON, we need both send/receive channels, so we use local/remote to provide
|
|
18
|
+
;; a context-free way to refer to the two ends of the channel.
|
|
19
|
+
;; The direction is inferred by the context of the contract (send vs receive).
|
|
20
|
+
;; The srcOApp is the 256-bit hashpart of a standard address.
|
|
21
|
+
cell lz::Worker::New(int owner, int pricefeedAddress, cell bytecode, cell $storage) inline method_id {
|
|
22
|
+
return cl::declare(
|
|
23
|
+
lz::Worker::NAME,
|
|
24
|
+
unsafeTuple([
|
|
25
|
+
[cl::t::address, owner], ;; lz::Worker::owner
|
|
26
|
+
[cl::t::dict256, cl::dict256::New()], ;; lz::Worker::viewAllowlist
|
|
27
|
+
[cl::t::dict256, cl::dict256::New()], ;; lz::Worker::viewDependencies
|
|
28
|
+
[cl::t::cellRef, bytecode], ;; lz::Worker::bytecodeLibrary
|
|
29
|
+
[cl::t::objRef, $storage] ;; lz::Worker::storage
|
|
30
|
+
])
|
|
31
|
+
);
|
|
32
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::AddMsglib::NAME = "addMsgLib"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::AddMsglib::msglibManagerAddress = 0;
|
|
8
|
+
const int md::AddMsglib::dstEid = 1; ;; dstEid is not used by SML, only ULN
|
|
9
|
+
|
|
10
|
+
cell md::AddMsglib::New(int msglibManagerAddress, int dstEid) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
md::AddMsglib::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::address, msglibManagerAddress], ;; md::AddMsglib::msglibManagerAddress
|
|
15
|
+
[cl::t::uint32, dstEid] ;; md::AddMsglib::dstEid
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::Amount::NAME = "Amount"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::Amount::amount = 0;
|
|
8
|
+
|
|
9
|
+
cell md::Amount::New(int amount) inline method_id {
|
|
10
|
+
return cl::declare(
|
|
11
|
+
md::Amount::NAME,
|
|
12
|
+
unsafeTuple([
|
|
13
|
+
[cl::t::coins, amount] ;; md::Amount::amount
|
|
14
|
+
])
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::Bool::NAME = "Bool"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::Bool::bool = 0;
|
|
8
|
+
|
|
9
|
+
cell md::Bool::New(int boolean) inline method_id {
|
|
10
|
+
return cl::declare(
|
|
11
|
+
md::Bool::NAME,
|
|
12
|
+
unsafeTuple([
|
|
13
|
+
[cl::t::bool, boolean] ;; md::Bool::success
|
|
14
|
+
])
|
|
15
|
+
);
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
|
+
|
|
3
|
+
;; required storage name
|
|
4
|
+
const int md::ChannelNonceInfo::NAME = "cNonceInfo"u;
|
|
5
|
+
|
|
6
|
+
;; field names
|
|
7
|
+
const int md::ChannelNonceInfo::firstUncommittedNonce = 0;
|
|
8
|
+
const int md::ChannelNonceInfo::firstUnexecutedNonce = 1;
|
|
9
|
+
|
|
10
|
+
cell md::ChannelNonceInfo::New(int firstUncommittedNonce, int firstUnexecutedNonce) inline method_id {
|
|
11
|
+
return cl::declare(
|
|
12
|
+
md::ChannelNonceInfo::NAME,
|
|
13
|
+
unsafeTuple([
|
|
14
|
+
[cl::t::uint64, firstUncommittedNonce], ;; md::ChannelNonceInfo::firstUncommittedNonce
|
|
15
|
+
[cl::t::uint64, firstUnexecutedNonce] ;; md::ChannelNonceInfo::firstUnexecutedNonce
|
|
16
|
+
])
|
|
17
|
+
);
|
|
18
|
+
}
|
|
File without changes
|