@layerzerolabs/layerzero-v2-ton 3.0.41 → 3.0.43
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 +12 -0
- package/build/AllStorages.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/Controller.assertions.test.compiled.json +1 -1
- package/build/Controller.permissions.test.compiled.json +1 -1
- package/build/Controller.test.compiled.json +1 -1
- package/build/Counter.permissions.test.compiled.json +1 -1
- package/build/Counter.setters.test.compiled.json +1 -1
- package/build/Counter.test.compiled.json +1 -1
- package/build/Dvn.compiled.json +1 -1
- package/build/Dvn.test.compiled.json +1 -1
- package/build/DvnFeeLib.compiled.json +1 -1
- package/build/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.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/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/PriceFeedFeeLibArbitrum.compiled.json +1 -0
- package/build/PriceFeedFeeLibArbitrum.test.compiled.json +1 -0
- package/build/PriceFeedFeeLibDefault.compiled.json +1 -0
- package/build/PriceFeedFeeLibDefault.test.compiled.json +1 -0
- package/build/PriceFeedFeeLibOptimism.compiled.json +1 -0
- package/build/PriceFeedFeeLibOptimism.test.compiled.json +1 -0
- 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.permissions.test.compiled.json +1 -1
- package/build/SmlConnection.test.compiled.json +1 -1
- package/build/SmlManager.permissions.test.compiled.json +1 -1
- package/build/SmlManager.test.compiled.json +1 -1
- package/build/Uln.test.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.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/UlnSendWithArbDvnFeeLib.test.compiled.json +1 -0
- package/build/UlnSendWithArbExecFeeLib.test.compiled.json +1 -0
- package/build/UlnSendWithDefaultDvnFeeLib.test.compiled.json +1 -0
- package/build/UlnSendWithDefaultExecFeeLib.test.compiled.json +1 -0
- package/build/UlnSendWithOpDvnFeeLib.test.compiled.json +1 -0
- package/build/UlnSendWithOpExecFeeLib.test.compiled.json +1 -0
- 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 +1 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/common.fc +6 -7
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/handler.fc +33 -14
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/dvnFeeLib/storage.fc +7 -7
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/executorFeeLib/handler.fc +27 -11
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/arbitrum/handler.fc +38 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/arbitrum/main.fc +2 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/default/handler.fc +27 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/default/main.fc +2 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/extensions/ArbitrumPriceFeedExtension.fc +27 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/interface.fc +1 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/optimism/handler.fc +45 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/optimism/main.fc +2 -0
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/storage.fc +94 -21
- package/src/workers/core/abstract/workerHandler.fc +37 -2
- package/src/workers/core/interface.fc +6 -2
- package/src/workers/dvn/handler.fc +13 -3
- package/src/workers/executor/handler.fc +10 -6
- package/src/workers/msgdata/ClaimTon.fc +1 -1
- package/src/workers/msgdata/NativeDrop.fc +6 -2
- package/src/workers/priceFeedCache/handler.fc +124 -4
- package/src/workers/priceFeedCache/interface.fc +4 -1
- package/src/workers/priceFeedCache/main.fc +6 -0
- package/src/workers/priceFeedCache/storage.fc +7 -5
- package/src/workers/proxy/handler.fc +15 -1
- package/src/workers/proxy/interface.fc +1 -0
- package/src/workers/proxy/main.fc +2 -0
- package/build/PriceFeedFeeLib.compiled.json +0 -1
- package/build/UlnSendWithDvnFeeLib.test.compiled.json +0 -1
- package/build/UlnSendWithExecFeeLib.test.compiled.json +0 -1
- package/src/protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/main.fc +0 -1
- package/src/workers/msgdata/DropEvent.fc +0 -18
|
@@ -6,31 +6,37 @@ const int PRICE_RATIO_DENOMINATOR = 1000 * 1000 * 1000 * 1000 * 1000 * 1000 * 10
|
|
|
6
6
|
|
|
7
7
|
;; Bytecodes
|
|
8
8
|
const int PriceFeedFeelib::priceRatio = 0;
|
|
9
|
-
const int PriceFeedFeelib::
|
|
9
|
+
const int PriceFeedFeelib::gasPriceInRemoteUnit = 1;
|
|
10
10
|
const int PriceFeedFeelib::gasPerByte = 2;
|
|
11
11
|
const int PriceFeedFeelib::nativePriceUsd = 3;
|
|
12
|
+
const int PriceFeedFeelib::arbitrumExtension = 4;
|
|
13
|
+
const int PriceFeedFeelib::optimismExtension = 5;
|
|
12
14
|
|
|
13
15
|
;; @owner LayerZero admin EOA
|
|
14
16
|
cell PriceFeedFeelib::New(
|
|
15
17
|
int priceRatio,
|
|
16
|
-
int
|
|
18
|
+
int gasPriceInRemoteUnit,
|
|
17
19
|
int gasPerByte,
|
|
18
|
-
int nativePriceUsd
|
|
20
|
+
int nativePriceUsd,
|
|
21
|
+
cell arbitrumExtension,
|
|
22
|
+
cell optimismExtension
|
|
19
23
|
) method_id {
|
|
20
24
|
return cl::declare(
|
|
21
25
|
PriceFeedFeelib::NAME,
|
|
22
26
|
unsafeTuple([
|
|
23
|
-
[cl::t::coins, priceRatio],
|
|
24
|
-
[cl::t::uint64,
|
|
25
|
-
[cl::t::uint32, gasPerByte],
|
|
26
|
-
[cl::t::coins, nativePriceUsd]
|
|
27
|
+
[cl::t::coins, priceRatio], ;; PriceFeedFeelib::priceRatio
|
|
28
|
+
[cl::t::uint64, gasPriceInRemoteUnit], ;; PriceFeedFeelib::gasPriceInRemoteUnit
|
|
29
|
+
[cl::t::uint32, gasPerByte], ;; PriceFeedFeelib::gasPerByte
|
|
30
|
+
[cl::t::coins, nativePriceUsd], ;; PriceFeedFeelib::nativePriceUsd
|
|
31
|
+
[cl::t::objRef, arbitrumExtension], ;; PriceFeedFeelib::arbitrumExtension
|
|
32
|
+
[cl::t::objRef, optimismExtension] ;; PriceFeedFeelib::optimismExtension
|
|
27
33
|
])
|
|
28
34
|
);
|
|
29
35
|
}
|
|
30
36
|
|
|
31
37
|
const int PriceFeedFeelib::_priceRatioOffset = _HEADER_WIDTH;
|
|
32
|
-
const int PriceFeedFeelib::
|
|
33
|
-
const int PriceFeedFeelib::_gasPerByteOffset = PriceFeedFeelib::
|
|
38
|
+
const int PriceFeedFeelib::_gasPriceInRemoteUnitOffset = PriceFeedFeelib::_priceRatioOffset + 128;
|
|
39
|
+
const int PriceFeedFeelib::_gasPerByteOffset = PriceFeedFeelib::_gasPriceInRemoteUnitOffset + 64;
|
|
34
40
|
const int PriceFeedFeelib::_nativePriceUsdOffset = PriceFeedFeelib::_gasPerByteOffset + 32;
|
|
35
41
|
|
|
36
42
|
|
|
@@ -43,46 +49,113 @@ int PriceFeedFeelib::getNativePriceUsd(cell $self) impure inline {
|
|
|
43
49
|
|
|
44
50
|
;; ============================== Object Multi-Getters =========================================
|
|
45
51
|
|
|
46
|
-
;; (priceRatio,
|
|
52
|
+
;; (priceRatio, gasPriceInRemoteUnit, gasPerByte)
|
|
47
53
|
(int, int, int) PriceFeedFeelib::utils::getFirstThreeFields(cell $self) impure inline {
|
|
48
54
|
;; slice selfSlice = $self.begin_parse().skip_bits(_HEADER_WIDTH);
|
|
49
55
|
slice selfSlice = $self.begin_parse();
|
|
50
56
|
return (
|
|
51
57
|
selfSlice.preloadCoinsAt(PriceFeedFeelib::_priceRatioOffset),
|
|
52
|
-
selfSlice.preloadUint64At(PriceFeedFeelib::
|
|
58
|
+
selfSlice.preloadUint64At(PriceFeedFeelib::_gasPriceInRemoteUnitOffset),
|
|
53
59
|
selfSlice.preloadUint32At(PriceFeedFeelib::_gasPerByteOffset)
|
|
54
60
|
);
|
|
55
61
|
}
|
|
56
62
|
|
|
57
|
-
|
|
58
|
-
|
|
63
|
+
cell PriceFeedFeelib::getArbitrumExtension(cell $self) impure inline {
|
|
64
|
+
return $self.cellPreloadRefAt(0);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
cell PriceFeedFeelib::getOptimismExtension(cell $self) impure inline {
|
|
68
|
+
return $self.cellPreloadRefAt(1);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
;; (priceRatio, gasPriceInRemoteUnit, gasPerByte, nativePriceUsd)
|
|
72
|
+
(int, int, int, int) PriceFeedFeelib::deserializeInts(cell $storage) impure inline {
|
|
59
73
|
slice selfSlice = $storage.begin_parse();
|
|
60
74
|
return (
|
|
61
75
|
selfSlice.preloadCoinsAt(PriceFeedFeelib::_priceRatioOffset),
|
|
62
|
-
selfSlice.preloadUint64At(PriceFeedFeelib::
|
|
76
|
+
selfSlice.preloadUint64At(PriceFeedFeelib::_gasPriceInRemoteUnitOffset),
|
|
63
77
|
selfSlice.preloadUint32At(PriceFeedFeelib::_gasPerByteOffset),
|
|
64
78
|
selfSlice.preloadCoinsAt(PriceFeedFeelib::_nativePriceUsdOffset)
|
|
65
79
|
);
|
|
66
80
|
}
|
|
67
81
|
|
|
82
|
+
;; (priceRatio, gasPriceInRemoteUnit, gasPerByte, nativePriceUsd, arbitrumExtension, optimismExtension)
|
|
83
|
+
(int, int, int, int, cell, cell) PriceFeedFeelib::deserialize(cell $storage) impure inline {
|
|
84
|
+
slice selfSlice = $storage.begin_parse();
|
|
85
|
+
return (
|
|
86
|
+
selfSlice.preloadCoinsAt(PriceFeedFeelib::_priceRatioOffset),
|
|
87
|
+
selfSlice.preloadUint64At(PriceFeedFeelib::_gasPriceInRemoteUnitOffset),
|
|
88
|
+
selfSlice.preloadUint32At(PriceFeedFeelib::_gasPerByteOffset),
|
|
89
|
+
selfSlice.preloadCoinsAt(PriceFeedFeelib::_nativePriceUsdOffset),
|
|
90
|
+
selfSlice.preloadRefAt(0),
|
|
91
|
+
selfSlice.preloadRefAt(1)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
;; ============================== Object Setters =========================================
|
|
96
|
+
|
|
97
|
+
;; (priceRatio, gasPriceInRemoteUnit, gasPerByte)
|
|
98
|
+
cell PriceFeedFeelib::setFirstThreeFields(
|
|
99
|
+
cell $self,
|
|
100
|
+
int priceRatio,
|
|
101
|
+
int gasPriceInRemoteUnit,
|
|
102
|
+
int gasPerByte
|
|
103
|
+
) impure inline {
|
|
104
|
+
slice selfSlice = $self.begin_parse();
|
|
105
|
+
return begin_cell()
|
|
106
|
+
.store_slice(selfSlice.scutfirst(_HEADER_WIDTH, 2)) ;; header + refs
|
|
107
|
+
.store_uint128(priceRatio) ;; new priceRatio
|
|
108
|
+
.store_uint64(gasPriceInRemoteUnit) ;; new gasPriceInRemoteUnit
|
|
109
|
+
.store_uint32(gasPerByte) ;; new gasPerByte
|
|
110
|
+
.store_slice(selfSlice.scutlast(128, 0)) ;; last 128 bits = old nativePriceUsd
|
|
111
|
+
.end_cell();
|
|
112
|
+
}
|
|
113
|
+
|
|
68
114
|
cell PriceFeedFeelib::setNativePriceUsd(cell $self, int nativePriceUsd) impure inline {
|
|
69
115
|
slice selfSlice = $self.begin_parse();
|
|
70
116
|
return begin_cell()
|
|
71
|
-
.store_slice(selfSlice.scutfirst(PriceFeedFeelib::_nativePriceUsdOffset,
|
|
117
|
+
.store_slice(selfSlice.scutfirst(PriceFeedFeelib::_nativePriceUsdOffset, 2)) ;; everything up to nativePriceUsd
|
|
72
118
|
.store_uint128(nativePriceUsd) ;; new nativePriceUsd
|
|
73
119
|
.end_cell();
|
|
74
120
|
}
|
|
75
121
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
122
|
+
cell PriceFeedFeelib::setPricesAndOptimismExtension(
|
|
123
|
+
cell $self,
|
|
124
|
+
int priceRatio,
|
|
125
|
+
int gasPriceInRemoteUnit,
|
|
126
|
+
int gasPerByte,
|
|
127
|
+
cell $optimismExtension
|
|
128
|
+
) impure inline {
|
|
80
129
|
slice selfSlice = $self.begin_parse();
|
|
81
130
|
return begin_cell()
|
|
82
|
-
.store_slice(selfSlice.scutfirst(_HEADER_WIDTH,
|
|
131
|
+
.store_slice(selfSlice.scutfirst(_HEADER_WIDTH, 1)) ;; header + old arbitrumExtension
|
|
83
132
|
.store_uint128(priceRatio) ;; new priceRatio
|
|
84
|
-
.store_uint64(
|
|
133
|
+
.store_uint64(gasPriceInRemoteUnit) ;; new gasPriceInRemoteUnit
|
|
85
134
|
.store_uint32(gasPerByte) ;; new gasPerByte
|
|
86
135
|
.store_slice(selfSlice.scutlast(128, 0)) ;; last 128 bits = old nativePriceUsd
|
|
136
|
+
.store_ref($optimismExtension) ;; new optimismExtension
|
|
137
|
+
.end_cell();
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
cell PriceFeedFeelib::setNativePriceUsdAndOptimismExtension(
|
|
141
|
+
cell $self,
|
|
142
|
+
int nativePriceUsd,
|
|
143
|
+
cell $optimismExtension
|
|
144
|
+
) impure inline {
|
|
145
|
+
slice selfSlice = $self.begin_parse();
|
|
146
|
+
return begin_cell()
|
|
147
|
+
.store_slice(selfSlice.scutfirst(PriceFeedFeelib::_nativePriceUsdOffset, 1)) ;; bits up to nativePriceUsd + old arbitrumExtension
|
|
148
|
+
.store_uint128(nativePriceUsd) ;; new nativePriceUsd
|
|
149
|
+
.store_ref($optimismExtension) ;; new optimismExtension
|
|
150
|
+
.end_cell();
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
cell PriceFeedFeelib::setArbitrumExtension(cell $self, cell $arbitrumExtension) impure inline {
|
|
155
|
+
slice selfSlice = $self.begin_parse();
|
|
156
|
+
return begin_cell()
|
|
157
|
+
.store_slice(selfSlice.sskipfirst(0, 2)) ;; same bits, no refs
|
|
158
|
+
.store_ref($arbitrumExtension) ;; new arbitrumExtension
|
|
159
|
+
.store_ref(selfSlice.preloadRefAt(1)) ;; same optimismExtension
|
|
87
160
|
.end_cell();
|
|
88
161
|
}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
#include "../interface.fc";
|
|
1
2
|
#include "../../../funC++/handlerCore.fc";
|
|
2
3
|
|
|
3
4
|
#include "../../../funC++/actions/call.fc";
|
|
4
5
|
#include "../../../funC++/actions/event.fc";
|
|
5
6
|
#include "../../../funC++/actions/payment.fc";
|
|
7
|
+
#include "../../../funC++/actions/dispatch.fc";
|
|
6
8
|
|
|
7
9
|
#include "../../../classes/msgdata/CoinsAmount.fc";
|
|
8
10
|
#include "../../../classes/msgdata/SetAddress.fc";
|
|
@@ -15,6 +17,7 @@
|
|
|
15
17
|
#include "../../../protocol/msglibs/ultralightnode/ulnManager/interface.fc";
|
|
16
18
|
#include "../../proxy/interface.fc";
|
|
17
19
|
#include "../workerCoreStorage.fc";
|
|
20
|
+
#include "../../../funC++/utils.fc";
|
|
18
21
|
|
|
19
22
|
cell getInitialStorage() impure inline {
|
|
20
23
|
return empty_cell();
|
|
@@ -73,12 +76,28 @@ int verifyEventOrigin(int address) method_id {
|
|
|
73
76
|
|
|
74
77
|
;;; =================================== (HANDLER) HELPER FUNCTIONS =================================
|
|
75
78
|
|
|
79
|
+
const int ONE_TON = 1000000000; ;; 1 ton is equivalent to 10^9 nanotons
|
|
80
|
+
|
|
76
81
|
tuple _claimTon(tuple actions, cell $claimTon) impure {
|
|
82
|
+
|
|
83
|
+
int contractBalance = getInitialContractBalance();
|
|
84
|
+
int claimAmount = $claimTon.cl::get<coins>(md::ClaimTon::amount);
|
|
85
|
+
|
|
86
|
+
throw_unless(
|
|
87
|
+
Worker::ERROR::insufficientBalance,
|
|
88
|
+
(contractBalance >= (claimAmount + ONE_TON))
|
|
89
|
+
);
|
|
90
|
+
|
|
77
91
|
;; this amount will be paid from the contract balance
|
|
78
92
|
actions~pushAction<payment>(
|
|
79
93
|
$claimTon.cl::get<address>(md::ClaimTon::target),
|
|
80
|
-
|
|
81
|
-
|
|
94
|
+
claimAmount,
|
|
95
|
+
claimAmount
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
actions~pushAction<event>(
|
|
99
|
+
Worker::event::CLAIMED_TON,
|
|
100
|
+
$claimTon
|
|
82
101
|
);
|
|
83
102
|
|
|
84
103
|
return actions;
|
|
@@ -91,6 +110,11 @@ tuple _claimTonFromProxy(tuple actions, cell $claimTon) impure {
|
|
|
91
110
|
$claimTon
|
|
92
111
|
);
|
|
93
112
|
|
|
113
|
+
actions~pushAction<event>(
|
|
114
|
+
Worker::event::CLAIMED_TON_FROM_PROXY,
|
|
115
|
+
$claimTon
|
|
116
|
+
);
|
|
117
|
+
|
|
94
118
|
return actions;
|
|
95
119
|
}
|
|
96
120
|
|
|
@@ -153,6 +177,17 @@ tuple _callViaProxy(tuple actions, cell $executeParams) impure {
|
|
|
153
177
|
return actions;
|
|
154
178
|
}
|
|
155
179
|
|
|
180
|
+
tuple _emitViaProxy(tuple actions, int topic, cell $body) impure {
|
|
181
|
+
actions~pushAction<dispatch>(
|
|
182
|
+
getProxyAddress(),
|
|
183
|
+
Proxy::OP::EMIT_EVENT,
|
|
184
|
+
action::event::build(topic, $body, cl::nullObject()),
|
|
185
|
+
_gasToNanoton(PROXY_CALL_DEFAULT_GAS)
|
|
186
|
+
);
|
|
187
|
+
|
|
188
|
+
return actions;
|
|
189
|
+
}
|
|
190
|
+
|
|
156
191
|
;;; =================================== VIEW FUNCTIONS =================================
|
|
157
192
|
|
|
158
193
|
int getLatestAdmin() impure method_id {
|
|
@@ -22,6 +22,10 @@ const int Worker::ERROR::invalidOpcode = 2014;
|
|
|
22
22
|
|
|
23
23
|
const int Worker::ERROR::invalidSignedOpcode = 2013;
|
|
24
24
|
const int Worker::ERROR::invalidTarget = 2012;
|
|
25
|
-
|
|
25
|
+
const int Worker::ERROR::insufficientBalance = 2011;
|
|
26
26
|
;;; ==========================EVENTS=====================================
|
|
27
|
-
const int Worker::event::ADMINS_SET = "Worker::event::ADMINS_SET"u;
|
|
27
|
+
const int Worker::event::ADMINS_SET = "Worker::event::ADMINS_SET"u;
|
|
28
|
+
const int Worker::event::CLAIMED_TON = "Worker::event::CLAIMED_TON"u;
|
|
29
|
+
const int Worker::event::CLAIMED_TON_FROM_PROXY = "Worker::event::CLAIMED_TON_PROXY"u;
|
|
30
|
+
|
|
31
|
+
const int PROXY_CALL_DEFAULT_GAS = 1000000;
|
|
@@ -75,6 +75,7 @@ tuple _verifySignatures(tuple actions, int hash, cell signatures, cell verifiers
|
|
|
75
75
|
validSignatures += 1;
|
|
76
76
|
}
|
|
77
77
|
} else {
|
|
78
|
+
;; emitting this from the proxy will cause the double-call issue
|
|
78
79
|
actions~pushAction<event>(
|
|
79
80
|
Dvn::event::INVALID_SIGNATURE,
|
|
80
81
|
begin_cell().store_uint256(indexedPublicKeyHash).end_cell()
|
|
@@ -162,7 +163,10 @@ tuple setVerifiers(cell $signedRequest) impure {
|
|
|
162
163
|
.cl::set(Dvn::setVerifiersNonce, incomingNonce + 1)
|
|
163
164
|
);
|
|
164
165
|
|
|
165
|
-
actions
|
|
166
|
+
actions = actions._emitViaProxy(
|
|
167
|
+
Dvn::event::SET_VERIFIERS,
|
|
168
|
+
$setDict
|
|
169
|
+
);
|
|
166
170
|
|
|
167
171
|
return actions;
|
|
168
172
|
}
|
|
@@ -213,7 +217,10 @@ tuple setQuorum(cell $signedRequest) impure {
|
|
|
213
217
|
.cl::set(Dvn::setQuorumNonce, incomingNonce + 1)
|
|
214
218
|
);
|
|
215
219
|
|
|
216
|
-
actions
|
|
220
|
+
actions = actions._emitViaProxy(
|
|
221
|
+
Dvn::event::SET_QUORUM,
|
|
222
|
+
$setQuorum
|
|
223
|
+
);
|
|
217
224
|
|
|
218
225
|
return actions;
|
|
219
226
|
}
|
|
@@ -250,7 +257,10 @@ tuple setAdminsByQuorum(cell $signedRequest) impure {
|
|
|
250
257
|
$storage.cl::get<uint64>(Dvn::quorum)
|
|
251
258
|
);
|
|
252
259
|
|
|
253
|
-
actions
|
|
260
|
+
actions = actions._emitViaProxy(
|
|
261
|
+
Dvn::event::SET_ADMINS_BY_QUORUM,
|
|
262
|
+
$setDict
|
|
263
|
+
);
|
|
254
264
|
|
|
255
265
|
setContractStorage(
|
|
256
266
|
$storage
|
|
@@ -12,8 +12,6 @@
|
|
|
12
12
|
#include "../proxy/interface.fc";
|
|
13
13
|
|
|
14
14
|
#include "../msgdata/NativeDrop.fc";
|
|
15
|
-
#include "../msgdata/DropEvent.fc";
|
|
16
|
-
|
|
17
15
|
|
|
18
16
|
#include "interface.fc";
|
|
19
17
|
#include "storage.fc";
|
|
@@ -30,12 +28,15 @@
|
|
|
30
28
|
;;; ==========================HANDLERS=====================================
|
|
31
29
|
|
|
32
30
|
tuple _executorNativeDrop(tuple actions, cell $mdNativeDrop) impure inline {
|
|
31
|
+
|
|
33
32
|
cell $storage = getContractStorage();
|
|
34
33
|
|
|
35
34
|
int totalAmount = 0;
|
|
36
35
|
tuple payees = deserializePayees($mdNativeDrop.md::NativeDrop::getPayees());
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
int numPayees = payees.tlen();
|
|
38
|
+
|
|
39
|
+
repeat (numPayees) {
|
|
39
40
|
[int payeeAddress, int nativeAmount] = payees~tpopPayee();
|
|
40
41
|
|
|
41
42
|
actions~pushAction<payment>(
|
|
@@ -44,11 +45,14 @@ tuple _executorNativeDrop(tuple actions, cell $mdNativeDrop) impure inline {
|
|
|
44
45
|
0
|
|
45
46
|
);
|
|
46
47
|
|
|
47
|
-
|
|
48
|
+
totalAmount += nativeAmount;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
if (numPayees > 0) {
|
|
52
|
+
actions = actions._emitViaProxy(
|
|
48
53
|
Executor::event::NATIVE_DROP,
|
|
49
|
-
|
|
54
|
+
$mdNativeDrop
|
|
50
55
|
);
|
|
51
|
-
totalAmount += nativeAmount;
|
|
52
56
|
}
|
|
53
57
|
|
|
54
58
|
throw_if(
|
|
@@ -11,7 +11,7 @@ cell md::ClaimTon::New(int amount, int target) inline method_id {
|
|
|
11
11
|
return cl::declare(
|
|
12
12
|
md::ClaimTon::NAME,
|
|
13
13
|
unsafeTuple([
|
|
14
|
-
[cl::t::coins, amount],
|
|
14
|
+
[cl::t::coins, amount], ;; md::ClaimTon::amount
|
|
15
15
|
[cl::t::address, target] ;; md::ClaimTon::target
|
|
16
16
|
])
|
|
17
17
|
);
|
|
@@ -5,12 +5,16 @@ const int md::NativeDrop::NAME = "NativeDrop"u;
|
|
|
5
5
|
|
|
6
6
|
;; field names
|
|
7
7
|
const int md::NativeDrop::payees = 0;
|
|
8
|
+
const int md::NativeDrop::packetId = 1;
|
|
9
|
+
const int md::NativeDrop::msglib = 2;
|
|
8
10
|
|
|
9
|
-
cell md::NativeDrop::New(cell payees) inline method_id {
|
|
11
|
+
cell md::NativeDrop::New(cell payees, cell $packetId, int msglib) inline method_id {
|
|
10
12
|
return cl::declare(
|
|
11
13
|
md::NativeDrop::NAME,
|
|
12
14
|
unsafeTuple([
|
|
13
|
-
[cl::t::cellRef, payees]
|
|
15
|
+
[cl::t::cellRef, payees], ;; md::NativeDrop::payees
|
|
16
|
+
[cl::t::objRef, $packetId], ;; md::NativeDrop::packetId
|
|
17
|
+
[cl::t::address, msglib] ;; md::NativeDrop::msgLib
|
|
14
18
|
])
|
|
15
19
|
);
|
|
16
20
|
}
|
|
@@ -55,7 +55,7 @@ tuple updatePrice(cell $mdAddress) impure inline {
|
|
|
55
55
|
;; call into the proxy to update the priceFeedFeeLib
|
|
56
56
|
return _callViaProxy(
|
|
57
57
|
actions,
|
|
58
|
-
md::ExecuteParams::
|
|
58
|
+
md::ExecuteParams::build(
|
|
59
59
|
targetAddress, ;; usually the uln
|
|
60
60
|
$pfStorage, ;; new priceFeedFeeLib storage
|
|
61
61
|
0,
|
|
@@ -71,12 +71,12 @@ tuple updateNativePrice(cell $mdAddress) impure inline {
|
|
|
71
71
|
(cell $ulnPriceFeed, int targetAddress) = $mdAddress.md::MdAddress::deserialize();
|
|
72
72
|
int nativePriceUsd = $ulnPriceFeed.PriceFeedFeelib::getNativePriceUsd();
|
|
73
73
|
|
|
74
|
-
cell $
|
|
74
|
+
cell $newPfStorage = $storage
|
|
75
75
|
.PriceFeedCache::getPriceFeedFeeLibStorage()
|
|
76
76
|
.PriceFeedFeelib::setNativePriceUsd(nativePriceUsd);
|
|
77
77
|
|
|
78
78
|
setContractStorage(
|
|
79
|
-
$storage.PriceFeedCache::setPriceFeedFeeLibStorage($
|
|
79
|
+
$storage.PriceFeedCache::setPriceFeedFeeLibStorage($newPfStorage)
|
|
80
80
|
);
|
|
81
81
|
|
|
82
82
|
;; call into the proxy to update the priceFeedFeeLib
|
|
@@ -84,7 +84,127 @@ tuple updateNativePrice(cell $mdAddress) impure inline {
|
|
|
84
84
|
actions,
|
|
85
85
|
md::ExecuteParams::build(
|
|
86
86
|
targetAddress, ;; usually the uln
|
|
87
|
-
$
|
|
87
|
+
$newPfStorage, ;; new priceFeedFeeLib storage
|
|
88
|
+
0,
|
|
89
|
+
Uln::OP::UPDATE_WORKER_FEELIB,
|
|
90
|
+
NULLADDRESS
|
|
91
|
+
)
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
;; ------- custom handlers for op/arb price feed caches -------
|
|
96
|
+
|
|
97
|
+
;; update base price and op price
|
|
98
|
+
tuple updateOpPrices(cell $mdAddress) impure inline {
|
|
99
|
+
(cell $storage, tuple actions) = preamble();
|
|
100
|
+
|
|
101
|
+
cell $oldPfStorage = $storage.PriceFeedCache::getPriceFeedFeeLibStorage();
|
|
102
|
+
cell $oldOpExtension = $oldPfStorage.PriceFeedFeelib::getOptimismExtension();
|
|
103
|
+
|
|
104
|
+
(cell $ulnPriceFeed, int targetAddress) = $mdAddress.md::MdAddress::deserialize();
|
|
105
|
+
(
|
|
106
|
+
int priceRatio,
|
|
107
|
+
int gasPriceInUnit,
|
|
108
|
+
int gasPerByte
|
|
109
|
+
) = PriceFeedFeelib::utils::getFirstThreeFields($ulnPriceFeed);
|
|
110
|
+
|
|
111
|
+
cell $incomingOpExtension = $ulnPriceFeed.PriceFeedFeelib::getOptimismExtension();
|
|
112
|
+
(
|
|
113
|
+
int opPriceRatio,
|
|
114
|
+
int opGasPriceInUnit,
|
|
115
|
+
int opGasPerByte
|
|
116
|
+
) = PriceFeedFeelib::utils::getFirstThreeFields($incomingOpExtension);
|
|
117
|
+
|
|
118
|
+
cell $newOpExtension = $oldOpExtension.PriceFeedFeelib::setFirstThreeFields(
|
|
119
|
+
opPriceRatio,
|
|
120
|
+
opGasPriceInUnit,
|
|
121
|
+
opGasPerByte
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
cell $newPfStorage = $oldPfStorage
|
|
125
|
+
.PriceFeedFeelib::setPricesAndOptimismExtension(
|
|
126
|
+
priceRatio,
|
|
127
|
+
gasPriceInUnit,
|
|
128
|
+
gasPerByte,
|
|
129
|
+
$newOpExtension
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
setContractStorage(
|
|
133
|
+
$storage.PriceFeedCache::setPriceFeedFeeLibStorage($newPfStorage)
|
|
134
|
+
);
|
|
135
|
+
|
|
136
|
+
;; call into the proxy to update the priceFeedFeeLib
|
|
137
|
+
return _callViaProxy(
|
|
138
|
+
actions,
|
|
139
|
+
md::ExecuteParams::build(
|
|
140
|
+
targetAddress, ;; usually the uln
|
|
141
|
+
$newPfStorage, ;; new priceFeedFeeLib storage
|
|
142
|
+
0,
|
|
143
|
+
Uln::OP::UPDATE_WORKER_FEELIB,
|
|
144
|
+
NULLADDRESS
|
|
145
|
+
)
|
|
146
|
+
);
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
;; update base native price and op native price
|
|
150
|
+
tuple updateOpNativePrices(cell $mdAddress) impure inline {
|
|
151
|
+
(cell $storage, tuple actions) = preamble();
|
|
152
|
+
|
|
153
|
+
cell $oldPfStorage = $storage.PriceFeedCache::getPriceFeedFeeLibStorage();
|
|
154
|
+
cell $oldOpExtension = $oldPfStorage.PriceFeedFeelib::getOptimismExtension();
|
|
155
|
+
|
|
156
|
+
(cell $ulnPriceFeed, int targetAddress) = $mdAddress.md::MdAddress::deserialize();
|
|
157
|
+
|
|
158
|
+
int nativePriceUsd = $ulnPriceFeed.PriceFeedFeelib::getNativePriceUsd();
|
|
159
|
+
cell $incomingOpExtension = $ulnPriceFeed.PriceFeedFeelib::getOptimismExtension();
|
|
160
|
+
|
|
161
|
+
int opNativePriceUsd = $incomingOpExtension.PriceFeedFeelib::getNativePriceUsd();
|
|
162
|
+
cell $newOpExtension = $oldOpExtension.PriceFeedFeelib::setNativePriceUsd(opNativePriceUsd);
|
|
163
|
+
|
|
164
|
+
cell $newPfStorage = $oldPfStorage
|
|
165
|
+
.PriceFeedFeelib::setNativePriceUsdAndOptimismExtension(
|
|
166
|
+
nativePriceUsd,
|
|
167
|
+
$newOpExtension
|
|
168
|
+
);
|
|
169
|
+
|
|
170
|
+
setContractStorage(
|
|
171
|
+
$storage.PriceFeedCache::setPriceFeedFeeLibStorage($newPfStorage)
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
;; call into the proxy to update the priceFeedFeeLib
|
|
175
|
+
return _callViaProxy(
|
|
176
|
+
actions,
|
|
177
|
+
md::ExecuteParams::build(
|
|
178
|
+
targetAddress, ;; usually the uln
|
|
179
|
+
$newPfStorage, ;; new priceFeedFeeLib storage
|
|
180
|
+
0,
|
|
181
|
+
Uln::OP::UPDATE_WORKER_FEELIB,
|
|
182
|
+
NULLADDRESS
|
|
183
|
+
)
|
|
184
|
+
);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
;; update arb extension
|
|
188
|
+
tuple updateArbExtension(cell $mdAddress) impure inline {
|
|
189
|
+
(cell $storage, tuple actions) = preamble();
|
|
190
|
+
|
|
191
|
+
(cell $ulnPriceFeed, int targetAddress) = $mdAddress.md::MdAddress::deserialize();
|
|
192
|
+
cell $arbExtension = $ulnPriceFeed.PriceFeedFeelib::getArbitrumExtension();
|
|
193
|
+
|
|
194
|
+
cell $newPfStorage = $storage
|
|
195
|
+
.PriceFeedCache::getPriceFeedFeeLibStorage()
|
|
196
|
+
.PriceFeedFeelib::setArbitrumExtension($arbExtension);
|
|
197
|
+
|
|
198
|
+
setContractStorage(
|
|
199
|
+
$storage.PriceFeedCache::setPriceFeedFeeLibStorage($newPfStorage)
|
|
200
|
+
);
|
|
201
|
+
|
|
202
|
+
;; call into the proxy to update the priceFeedFeeLib
|
|
203
|
+
return _callViaProxy(
|
|
204
|
+
actions,
|
|
205
|
+
md::ExecuteParams::build(
|
|
206
|
+
targetAddress, ;; usually the uln
|
|
207
|
+
$newPfStorage, ;; new priceFeedFeeLib storage
|
|
88
208
|
0,
|
|
89
209
|
Uln::OP::UPDATE_WORKER_FEELIB,
|
|
90
210
|
NULLADDRESS
|
|
@@ -1,4 +1,7 @@
|
|
|
1
1
|
;;; ==========================OPCODES=====================================
|
|
2
2
|
|
|
3
3
|
const int PriceFeedCache::OP::UPDATE_PRICE = "PriceFeedCache::OP::UPDATE_PRICE"c;
|
|
4
|
-
const int PriceFeedCache::OP::UPDATE_NATIVE_PRICE = "PriceFeedCache::OP::UPDATE_NATIVE_PRICE"c;
|
|
4
|
+
const int PriceFeedCache::OP::UPDATE_NATIVE_PRICE = "PriceFeedCache::OP::UPDATE_NATIVE_PRICE"c;
|
|
5
|
+
const int PriceFeedCache::OP::UPDATE_OP_PRICES = "PriceFeedCache::OP::UPDATE_OP_PRICES"c;
|
|
6
|
+
const int PriceFeedCache::OP::UPDATE_OP_NATIVE_PRICES = "PriceFeedCache::OP::UPDATE_OP_NATIVE_PRICES"c;
|
|
7
|
+
const int PriceFeedCache::OP::UPDATE_ARB_EXTENSION = "PriceFeedCache::OP::UPDATE_ARB_EXTENSION"c;
|
|
@@ -9,6 +9,12 @@ tuple _executeOpcode(int op, cell $md) impure inline {
|
|
|
9
9
|
return updatePrice($md);
|
|
10
10
|
} elseif (op == PriceFeedCache::OP::UPDATE_NATIVE_PRICE) {
|
|
11
11
|
return updateNativePrice($md);
|
|
12
|
+
} elseif (op == PriceFeedCache::OP::UPDATE_OP_PRICES) {
|
|
13
|
+
return updateOpPrices($md);
|
|
14
|
+
} elseif (op == PriceFeedCache::OP::UPDATE_OP_NATIVE_PRICES) {
|
|
15
|
+
return updateOpNativePrices($md);
|
|
16
|
+
} elseif (op == PriceFeedCache::OP::UPDATE_ARB_EXTENSION) {
|
|
17
|
+
return updateArbExtension($md);
|
|
12
18
|
} elseif (op == Worker::OP::CALL_VIA_PROXY) {
|
|
13
19
|
return callViaProxy($md);
|
|
14
20
|
} elseif (op == Worker::OP::SET_ADMINS) {
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
#include "../../funC++/classlib.fc";
|
|
1
|
+
#include "../../funC++/classlib.fc";
|
|
2
2
|
|
|
3
3
|
#include "../core/workerCoreStorage.fc";
|
|
4
4
|
|
|
5
5
|
#include "../../protocol/msglibs/ultralightnode/workerFeeLibs/priceFeedFeeLib/storage.fc";
|
|
6
6
|
|
|
7
|
-
|
|
8
7
|
;; required object name
|
|
9
8
|
const int PriceFeedCache::NAME = "pfCache"u;
|
|
10
9
|
|
|
11
10
|
;; field names
|
|
12
11
|
const int PriceFeedCache::workerCoreStorage = 0;
|
|
13
12
|
const int PriceFeedCache::priceFeedFeeLibStorage = 1;
|
|
13
|
+
const int PriceFeedCache::dstEid = 2; ;; sharding key, unused in actual logic
|
|
14
14
|
|
|
15
15
|
;; @owner manager
|
|
16
|
-
cell PriceFeedCache::New(cell admins, int version, cell $priceFeedFeeLib) method_id {
|
|
16
|
+
cell PriceFeedCache::New(cell admins, int version, cell $priceFeedFeeLib, int dstEid) method_id {
|
|
17
17
|
return cl::declare(
|
|
18
18
|
PriceFeedCache::NAME,
|
|
19
19
|
unsafeTuple([
|
|
20
|
-
[cl::t::objRef, WorkerCoreStorage::New(admins, NULLADDRESS, version)],
|
|
21
|
-
[cl::t::objRef, $priceFeedFeeLib] ;; PriceFeedCache::priceFeedFeeLibStorage
|
|
20
|
+
[cl::t::objRef, WorkerCoreStorage::New(admins, NULLADDRESS, version)], ;; PriceFeedCache::workerCoreStorage
|
|
21
|
+
[cl::t::objRef, $priceFeedFeeLib], ;; PriceFeedCache::priceFeedFeeLibStorage
|
|
22
|
+
[cl::t::uint32, dstEid] ;; PriceFeedCache::dstEid
|
|
22
23
|
])
|
|
23
24
|
);
|
|
24
25
|
}
|
|
@@ -32,5 +33,6 @@ cell PriceFeedCache::setPriceFeedFeeLibStorage(cell $self, cell $priceFeedFeeLib
|
|
|
32
33
|
return begin_cell()
|
|
33
34
|
.store_slice(selfSlice.scutfirst(_HEADER_WIDTH, 1)) ;; header + refs[0]
|
|
34
35
|
.store_ref($priceFeedFeeLibStorage) ;; new refs[1]
|
|
36
|
+
.store_uint32(selfSlice.preloadUint32At(_HEADER_WIDTH)) ;; dstEid
|
|
35
37
|
.end_cell();
|
|
36
38
|
}
|
|
@@ -20,7 +20,10 @@
|
|
|
20
20
|
|
|
21
21
|
;; this is special in proxy, only the people in the address book can call 'callContract'
|
|
22
22
|
() _checkPermissions(int op, cell $md) impure inline {
|
|
23
|
-
if (
|
|
23
|
+
if (
|
|
24
|
+
(op == Proxy::OP::CALL_CONTRACT)
|
|
25
|
+
| (op == Proxy::OP::EMIT_EVENT)
|
|
26
|
+
) {
|
|
24
27
|
return assertLatestAdmin();
|
|
25
28
|
} elseif (
|
|
26
29
|
(op == Worker::OP::SET_ADMINS)
|
|
@@ -46,6 +49,17 @@ tuple callContract(cell $executeParams) impure inline {
|
|
|
46
49
|
return _callContract(emptyActions(), $executeParams);
|
|
47
50
|
}
|
|
48
51
|
|
|
52
|
+
tuple emitEvent(cell $event) impure inline {
|
|
53
|
+
(cell $storage, tuple actions) = preamble();
|
|
54
|
+
|
|
55
|
+
actions~pushAction<event>(
|
|
56
|
+
$event.cl::get<uint256>(action::event::topic),
|
|
57
|
+
$event.cl::get<objRef>(action::event::body)
|
|
58
|
+
);
|
|
59
|
+
|
|
60
|
+
return actions;
|
|
61
|
+
}
|
|
62
|
+
|
|
49
63
|
tuple callback(cell $md) impure inline {
|
|
50
64
|
(cell $storage, tuple actions) = preamble();
|
|
51
65
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
;;; ==========================OPCODES=====================================
|
|
2
2
|
const int Proxy::OP::CALL_CONTRACT = "Proxy::OP::CALL_CONTRACT"c;
|
|
3
|
+
const int Proxy::OP::EMIT_EVENT = "Proxy::OP::EMIT_EVENT"c;
|
|
3
4
|
|
|
4
5
|
;; this is the opcode that we will "send out" of proxy to specify the callback
|
|
5
6
|
;; note that every other opcode that's namespaced by some contract is handled by the contract itself
|
|
@@ -12,6 +12,8 @@ tuple _executeOpcode(int op, cell $md) impure inline {
|
|
|
12
12
|
return callContract($md);
|
|
13
13
|
} elseif (op == Proxy::OP::TOGGLE_CALLBACK) {
|
|
14
14
|
return toggleCallback($md);
|
|
15
|
+
} elseif (op == Proxy::OP::EMIT_EVENT) {
|
|
16
|
+
return emitEvent($md);
|
|
15
17
|
}
|
|
16
18
|
return callback($md);
|
|
17
19
|
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"hash":"62bac6fb0b72b3cf50109a7a7f531b7241a040673d985747a9c7def7451f43bc","hashBase64":"YrrG+wtys89QEJp6f1MbckGgQGc9mFdHqcfe90UfQ7w=","hex":"b5ee9c72410102010010000114ff00f4a413f4bcf2c80b010002d375051ca1"}
|