tx · 5AhQAXEViBmhNMBB3dbQQTy6c9qjc81moApEszPmsBxP

3N7XWpdx1UJKZp5stTtFMXPEygyfZ7j4PyC:  -0.01400000 Waves

2024.05.15 11:36 [3106917] smart account 3N7XWpdx1UJKZp5stTtFMXPEygyfZ7j4PyC > SELF 0.00000000 Waves

{ "type": 13, "id": "5AhQAXEViBmhNMBB3dbQQTy6c9qjc81moApEszPmsBxP", "fee": 1400000, "feeAssetId": null, "timestamp": 1715762223859, "version": 2, "chainId": 84, "sender": "3N7XWpdx1UJKZp5stTtFMXPEygyfZ7j4PyC", "senderPublicKey": "APsCCjsKHFx7rbr1mG8Pca43pccTbH2G4FZj4keEqKJ5", "proofs": [ "5r4z6En5Tep8sguM8t8BJswxsnvKAc2xCw1bHLh3cT2mZpVEWijSm67NuwJCDBcn9ZGXUbog3NySh1duWCknc1xo" ], "script": "base64:BgItCAISAwoBCBIHCgUBAQERGBIHCgUBCAEIARIHCgUBEhERCBIDCgEBEgASABIAJgAHV2F2ZXNJZAIFV0FWRVMACE1pbmVyRmVlAAUAEVBheW91dEVtcHR5U3RhdHVzAAAAFVBheW91dEluaXRpYXRlZFN0YXR1cwABABVQYXlvdXRDb21wbGV0ZWRTdGF0dXMAAgASQmxvY2tzQmF0Y2hNYXhTaXplAAoAFlJlY2lwaWVudHNCYXRjaE1heFNpemUAZAAGSGVpZ2h0BQZoZWlnaHQABUFycjEwCQDMCAIAAAkAzAgCAAEJAMwIAgACCQDMCAIAAwkAzAgCAAQJAMwIAgAFCQDMCAIABgkAzAgCAAcJAMwIAgAICQDMCAIACQUDbmlsABBDb25maWdBZGRyZXNzS2V5Ag1jb25maWdBZGRyZXNzAA1MYXN0UGF5b3V0S2V5AgpsYXN0UGF5b3V0ABNNYXNzVHJhbnNmZXJGZWVzS2V5AhBtYXNzVHJhbnNmZXJGZWVzAApDaGFpbklkS2V5AgdjaGFpbklkABBEYWVtb25BZGRyZXNzS2V5Ag1kYWVtb25BZGRyZXNzABJEYWVtb25QdW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ZHJlc3MED3NpZ25lclB1YmxpY0tleQkBC3ZhbHVlT3JFbHNlAgkAnAgCBQ1jb25maWdBZGRyZXNzBRJTaWduZXJQdWJsaWNLZXlLZXkIBQJ0eA9zZW5kZXJQdWJsaWNLZXkECXB1YmxpY0tleQMJAQlpc0RlZmluZWQBBRBjb25maWdBZGRyZXNzU3RyAwMJAQlpc0RlZmluZWQBBRR1bml0c0NoYWluQWRkcmVzc1N0cgURdmFsaWRGdW5jdGlvbk5hbWUHCAUCdHgPc2VuZGVyUHVibGljS2V5BQ9zaWduZXJQdWJsaWNLZXkIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAMQTAwgFCGludm9rZVR4CWJvZHlCeXRlcwkAkQMCCAUIaW52b2tlVHgGcHJvb2ZzAAAFCXB1YmxpY0tleQQQY29uZmlnQWRkcmVzc1N0cgkAnQgCBQR0aGlzBRBDb25maWdBZGRyZXNzS2V5BA1jb25maWdBZGRyZXNzCQERQGV4dHJOYXRpdmUoMTA2MikBCQEFdmFsdWUBBRBjb25maWdBZGRyZXNzU3RyBAlwdWJsaWNLZXkDCQEJaXNEZWZpbmVkAQUQY29uZmlnQWRkcmVzc1N0cgkBC3ZhbHVlT3JFbHNlAgkAnAgCBQ1jb25maWdBZGRyZXNzBRJTaWduZXJQdWJsaWNLZXlLZXkIBQJ0eA9zZW5kZXJQdWJsaWNLZXkIBQJ0eA9zZW5kZXJQdWJsaWNLZXkJAMgTAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAFCXB1YmxpY0tleZx1RAY=", "height": 3106917, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7cW213AvGoKvVVNrKP8iGi9n8yrpNSsSXXDEo4zQAhwL Next: HT69Nu1VNhAkR5uYH9mDrp1tzdFvHnxWdmS1P9d5awwS Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let WavesId = "WAVES"
5+
46 let MinerFee = 5
57
68 let PayoutEmptyStatus = 0
1517
1618 let Height = height
1719
18-let ChainId = 84
19-
2020 let Arr10 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2121
22-let CallerAddress = Address(base58'3NC2Xn1tUKEc7YxJS9oxdtY4x5NaQHhpH2e')
23-
24-let WavesDaoFactoryAddress = Address(base58'3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx')
25-
26-let SettingsAddress = Address(base58'3N2jcP6cAcDJoVpfsQ5tVDTQrNgJcVUjj4v')
27-
28-let PuzzleAggregatorAddress = Address(base58'3MyJM8hLxAMYFrPzdh68QqeMdFSSWufQqw3')
29-
30-let MaintainerAddress = Address(base58'3N7ynzLr2PzVg9bCkrwLezNLVmoEyFmJtPL')
31-
32-let PuzzleBuybackAddress = Address(base58'3MyUDpTMG43mkmScfDKgG9gep4reUboH9YF')
33-
34-let WavesId = "WAVES"
22+let ConfigAddressKey = "configAddress"
3523
3624 let LastPayoutKey = "lastPayout"
3725
3826 let MassTransferFeesKey = "massTransferFees"
27+
28+let ChainIdKey = "chainId"
29+
30+let DaemonAddressKey = "daemonAddress"
31+
32+let DaemonPublicKeyKey = "daemonPublicKey"
33+
34+let MaintainerAddressKey = "maintainerAddress"
35+
36+let PuzzleAggregatorAddressKey = "puzzleAggregatorAddress"
37+
38+let PuzzleBuybackAddressKey = "puzzleBuybackAddress"
39+
40+let SettingsAddressKey = "settingsAddress"
41+
42+let SignerPublicKeyKey = "signerPublicKey"
43+
44+let WavesDaoFactoryAddressKey = "wavesDaoFactoryAddress"
45+
46+let ConfigAddress = addressFromStringValue(getStringValue(this, ConfigAddressKey))
47+
48+let ChainId = getIntegerValue(ConfigAddress, ChainIdKey)
49+
50+let DaemonAddress = addressFromStringValue(getStringValue(ConfigAddress, DaemonAddressKey))
51+
52+let DaemonPublicKey = getBinaryValue(ConfigAddress, DaemonPublicKeyKey)
53+
54+let MaintainerAddress = addressFromStringValue(getStringValue(ConfigAddress, MaintainerAddressKey))
55+
56+let PuzzleAggregatorAddress = addressFromStringValue(getStringValue(ConfigAddress, PuzzleAggregatorAddressKey))
57+
58+let PuzzleBuybackAddress = addressFromStringValue(getStringValue(ConfigAddress, PuzzleBuybackAddressKey))
59+
60+let SettingsAddress = addressFromStringValue(getStringValue(ConfigAddress, SettingsAddressKey))
61+
62+let SignerPublicKey = getBinary(ConfigAddress, SignerPublicKeyKey)
63+
64+let WavesDaoFactoryAddress = addressFromStringValue(getStringValue(ConfigAddress, WavesDaoFactoryAddressKey))
3965
4066 func makePayoutDataKey (payoutId) = ("payoutData_" + toString(payoutId))
4167
6591
6692
6793 @Callable(i)
68-func initiatePayout (payoutId,startHeight,endHeight,amounts,assets) = if ((i.caller != CallerAddress))
94+func setup (configAddress) = if ((i.caller != this))
95+ then throw("Access denied")
96+ else if ((size(i.payments) != 0))
97+ then throw("Payments are prohibited")
98+ else if ((addressFromString(configAddress) == unit))
99+ then throw(("Invalid configAddress: " + configAddress))
100+ else [StringEntry(ConfigAddressKey, configAddress)]
101+
102+
103+
104+@Callable(i)
105+func initiatePayout (payoutId,startHeight,endHeight,amounts,assets) = if ((i.caller != DaemonAddress))
69106 then throw("Access denied")
70107 else if ((size(i.payments) != 0))
71108 then throw("Payments are prohibited")
78115 if ((lastPayoutStatus != PayoutCompletedStatus))
79116 then throw((("Last payout: " + toString(lastPayout)) + " was not completed"))
80117 else {
81- let $t024492513 = getPayoutData(lastPayout)
82- let lastStartHeight = $t024492513._1
83- let lastEndHeight = $t024492513._2
118+ let $t036663730 = getPayoutData(lastPayout)
119+ let lastStartHeight = $t036663730._1
120+ let lastEndHeight = $t036663730._2
84121 if ((startHeight != (lastEndHeight + 1)))
85122 then throw(((("Wrong startHeight: " + toString(startHeight)) + ", should be: ") + toString((lastEndHeight + 1))))
86123 else if ((startHeight > endHeight))
111148 if ((getInteger(SettingsAddress, ("inputAssetIndex_" + assetStr)) == unit))
112149 then throw(("Unknown input: " + assetStr))
113150 else {
114- let $t039154094 = if ((assetStr == WavesId))
151+ let $t051325311 = if ((assetStr == WavesId))
115152 then $Tuple2(unit, (amounts[index] + currentAdditionalRewards))
116153 else $Tuple2(fromBase58String(assetStr), amounts[index])
117- let asset = $t039154094._1
118- let amount = $t039154094._2
154+ let asset = $t051325311._1
155+ let amount = $t051325311._2
119156 if ((0 > amount))
120157 then throw((("Wrong asset amount: " + toString(amount)) + ", should be positive or zero"))
121158 else {
128165 }
129166 }
130167
131- let $t046694736 = {
168+ let $t058865953 = {
132169 let $l = Arr10
133170 let $s = size($l)
134171 let $acc0 = $Tuple2(nil, nil)
142179
143180 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
144181 }
145- let transfers = $t046694736._1
146- let amountKeys = $t046694736._2
182+ let transfers = $t058865953._1
183+ let amountKeys = $t058865953._2
147184 let newPayoutData = makeString(([toString(startHeight), toString(endHeight)] ++ amountKeys), "_")
148185 (transfers ++ [IntegerEntry(LastPayoutKey, payoutId), StringEntry(makePayoutDataKey(payoutId), newPayoutData), IntegerEntry(makePayoutStatusKey(payoutId), PayoutInitiatedStatus)])
149186 }
157194
158195
159196 @Callable(i)
160-func swap (payoutId,swapFrom,amountIn,route,minToReceive) = if ((i.caller != CallerAddress))
197+func swap (payoutId,swapFrom,amountIn,route,minToReceive) = if ((i.caller != DaemonAddress))
161198 then throw("Access denied")
162199 else if ((size(i.payments) != 0))
163200 then throw("Payments are prohibited")
170207 if ((payoutStatus != PayoutInitiatedStatus))
171208 then throw((("Wrong payout status: " + toString(payoutStatus)) + ", should be 1"))
172209 else {
173- let $t056875936 = if ((swapFrom == WavesId))
210+ let $t069047153 = if ((swapFrom == WavesId))
174211 then $Tuple2(wavesBalance(this).available, unit)
175212 else {
176213 let assetId = fromBase58String(swapFrom)
177214 $Tuple2(assetBalance(this, assetId), assetId)
178215 }
179- let balanceInBeforeSwap = $t056875936._1
180- let swapFromId = $t056875936._2
216+ let balanceInBeforeSwap = $t069047153._1
217+ let swapFromId = $t069047153._2
181218 let swapInvoke = invoke(PuzzleAggregatorAddress, "swapWithReferral", [route, minToReceive, "puzzlenode"], [AttachedPayment(swapFromId, amountIn)])
182219 if ((swapInvoke == swapInvoke))
183220 then {
197234
198235
199236 @Callable(i)
200-func distributeTokens (payoutId,recipients,amounts,assets,attachment) = if ((i.caller != CallerAddress))
237+func distributeTokens (payoutId,recipients,amounts,assets,attachment) = if ((i.caller != DaemonAddress))
201238 then throw("Access denied")
202239 else if ((size(i.payments) != 0))
203240 then throw("Payments are prohibited")
262299
263300
264301 @Callable(i)
265-func finalizePayout (payoutId) = if ((i.caller != CallerAddress))
302+func finalizePayout (payoutId) = if ((i.caller != DaemonAddress))
266303 then throw("Access denied")
267304 else {
268305 let lastPayout = getLastPayout()
325362
326363
327364 @Verifier(tx)
328-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
365+func verify () = match tx {
366+ case massTx: MassTransferTransaction =>
367+ let configAddressStr = getString(this, ConfigAddressKey)
368+ let configAddress = addressFromStringValue(value(configAddressStr))
369+ let publicKey = if (isDefined(configAddressStr))
370+ then valueOrElse(getBinary(configAddress, DaemonPublicKeyKey), tx.senderPublicKey)
371+ else tx.senderPublicKey
372+ sigVerify_8Kb(massTx.bodyBytes, massTx.proofs[0], publicKey)
373+ case invokeTx: InvokeScriptTransaction =>
374+ let validFunctionName = if (if (if ((invokeTx.function == "extendMainChain"))
375+ then true
376+ else (invokeTx.function == "appendBlock"))
377+ then true
378+ else (invokeTx.function == "startAltChain"))
379+ then true
380+ else (invokeTx.function == "extendAltChain")
381+ let configAddressStr = getString(this, ConfigAddressKey)
382+ let configAddress = addressFromStringValue(value(configAddressStr))
383+ let unitsChainAddressStr = getString(configAddress, ("unitsChain_" + toString({
384+ let @ = invokeTx.dApp
385+ if ($isInstanceOf(@, "Address"))
386+ then @
387+ else throw(($getType(@) + " couldn't be cast to Address"))
388+ })))
389+ let signerPublicKey = valueOrElse(getBinary(configAddress, SignerPublicKeyKey), tx.senderPublicKey)
390+ let publicKey = if (isDefined(configAddressStr))
391+ then if (if (isDefined(unitsChainAddressStr))
392+ then validFunctionName
393+ else false)
394+ then tx.senderPublicKey
395+ else signerPublicKey
396+ else tx.senderPublicKey
397+ sigVerify_8Kb(invokeTx.bodyBytes, invokeTx.proofs[0], publicKey)
398+ case _ =>
399+ let configAddressStr = getString(this, ConfigAddressKey)
400+ let configAddress = addressFromStringValue(value(configAddressStr))
401+ let publicKey = if (isDefined(configAddressStr))
402+ then valueOrElse(getBinary(configAddress, SignerPublicKeyKey), tx.senderPublicKey)
403+ else tx.senderPublicKey
404+ sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], publicKey)
405+}
329406
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let WavesId = "WAVES"
5+
46 let MinerFee = 5
57
68 let PayoutEmptyStatus = 0
79
810 let PayoutInitiatedStatus = 1
911
1012 let PayoutCompletedStatus = 2
1113
1214 let BlocksBatchMaxSize = 10
1315
1416 let RecipientsBatchMaxSize = 100
1517
1618 let Height = height
1719
18-let ChainId = 84
19-
2020 let Arr10 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
2121
22-let CallerAddress = Address(base58'3NC2Xn1tUKEc7YxJS9oxdtY4x5NaQHhpH2e')
23-
24-let WavesDaoFactoryAddress = Address(base58'3MuS6qVvhBR6wSynFRdcE3fVqmGBjoc7Hhx')
25-
26-let SettingsAddress = Address(base58'3N2jcP6cAcDJoVpfsQ5tVDTQrNgJcVUjj4v')
27-
28-let PuzzleAggregatorAddress = Address(base58'3MyJM8hLxAMYFrPzdh68QqeMdFSSWufQqw3')
29-
30-let MaintainerAddress = Address(base58'3N7ynzLr2PzVg9bCkrwLezNLVmoEyFmJtPL')
31-
32-let PuzzleBuybackAddress = Address(base58'3MyUDpTMG43mkmScfDKgG9gep4reUboH9YF')
33-
34-let WavesId = "WAVES"
22+let ConfigAddressKey = "configAddress"
3523
3624 let LastPayoutKey = "lastPayout"
3725
3826 let MassTransferFeesKey = "massTransferFees"
27+
28+let ChainIdKey = "chainId"
29+
30+let DaemonAddressKey = "daemonAddress"
31+
32+let DaemonPublicKeyKey = "daemonPublicKey"
33+
34+let MaintainerAddressKey = "maintainerAddress"
35+
36+let PuzzleAggregatorAddressKey = "puzzleAggregatorAddress"
37+
38+let PuzzleBuybackAddressKey = "puzzleBuybackAddress"
39+
40+let SettingsAddressKey = "settingsAddress"
41+
42+let SignerPublicKeyKey = "signerPublicKey"
43+
44+let WavesDaoFactoryAddressKey = "wavesDaoFactoryAddress"
45+
46+let ConfigAddress = addressFromStringValue(getStringValue(this, ConfigAddressKey))
47+
48+let ChainId = getIntegerValue(ConfigAddress, ChainIdKey)
49+
50+let DaemonAddress = addressFromStringValue(getStringValue(ConfigAddress, DaemonAddressKey))
51+
52+let DaemonPublicKey = getBinaryValue(ConfigAddress, DaemonPublicKeyKey)
53+
54+let MaintainerAddress = addressFromStringValue(getStringValue(ConfigAddress, MaintainerAddressKey))
55+
56+let PuzzleAggregatorAddress = addressFromStringValue(getStringValue(ConfigAddress, PuzzleAggregatorAddressKey))
57+
58+let PuzzleBuybackAddress = addressFromStringValue(getStringValue(ConfigAddress, PuzzleBuybackAddressKey))
59+
60+let SettingsAddress = addressFromStringValue(getStringValue(ConfigAddress, SettingsAddressKey))
61+
62+let SignerPublicKey = getBinary(ConfigAddress, SignerPublicKeyKey)
63+
64+let WavesDaoFactoryAddress = addressFromStringValue(getStringValue(ConfigAddress, WavesDaoFactoryAddressKey))
3965
4066 func makePayoutDataKey (payoutId) = ("payoutData_" + toString(payoutId))
4167
4268
4369 func makePayoutStatusKey (payoutId) = ("payoutStatus_" + toString(payoutId))
4470
4571
4672 func makePayoutAdditionalRewardsKey (payoutId) = ("payoutAdditionalRewards_" + toString(payoutId))
4773
4874
4975 func getLastPayout () = getIntegerValue(this, LastPayoutKey)
5076
5177
5278 func getPayoutData (payoutId) = {
5379 let payoutString = getStringValue(makePayoutDataKey(payoutId))
5480 let payoutDataList = split(payoutString, "_")
5581 let startHeight = parseIntValue(payoutDataList[0])
5682 let endHeight = parseIntValue(payoutDataList[1])
5783 $Tuple2(startHeight, endHeight)
5884 }
5985
6086
6187 func getPayoutStatus (payoutId) = valueOrElse(getInteger(makePayoutStatusKey(payoutId)), PayoutEmptyStatus)
6288
6389
6490 func getPayoutAdditionalRewards (payoutId) = valueOrElse(getInteger(makePayoutAdditionalRewardsKey(payoutId)), 0)
6591
6692
6793 @Callable(i)
68-func initiatePayout (payoutId,startHeight,endHeight,amounts,assets) = if ((i.caller != CallerAddress))
94+func setup (configAddress) = if ((i.caller != this))
95+ then throw("Access denied")
96+ else if ((size(i.payments) != 0))
97+ then throw("Payments are prohibited")
98+ else if ((addressFromString(configAddress) == unit))
99+ then throw(("Invalid configAddress: " + configAddress))
100+ else [StringEntry(ConfigAddressKey, configAddress)]
101+
102+
103+
104+@Callable(i)
105+func initiatePayout (payoutId,startHeight,endHeight,amounts,assets) = if ((i.caller != DaemonAddress))
69106 then throw("Access denied")
70107 else if ((size(i.payments) != 0))
71108 then throw("Payments are prohibited")
72109 else {
73110 let lastPayout = getLastPayout()
74111 if ((payoutId != (lastPayout + 1)))
75112 then throw(((("Wrong payoutId: " + toString(payoutId)) + ", should be: ") + toString((lastPayout + 1))))
76113 else {
77114 let lastPayoutStatus = getPayoutStatus(lastPayout)
78115 if ((lastPayoutStatus != PayoutCompletedStatus))
79116 then throw((("Last payout: " + toString(lastPayout)) + " was not completed"))
80117 else {
81- let $t024492513 = getPayoutData(lastPayout)
82- let lastStartHeight = $t024492513._1
83- let lastEndHeight = $t024492513._2
118+ let $t036663730 = getPayoutData(lastPayout)
119+ let lastStartHeight = $t036663730._1
120+ let lastEndHeight = $t036663730._2
84121 if ((startHeight != (lastEndHeight + 1)))
85122 then throw(((("Wrong startHeight: " + toString(startHeight)) + ", should be: ") + toString((lastEndHeight + 1))))
86123 else if ((startHeight > endHeight))
87124 then throw(((("endHeight: " + toString(endHeight)) + " less than startHeight: ") + toString(startHeight)))
88125 else {
89126 let inputsQuantity = getIntegerValue(SettingsAddress, "inputsQuantity")
90127 let amountsSize = size(amounts)
91128 let assetsSize = size(assets)
92129 if (if ((amountsSize != assetsSize))
93130 then true
94131 else (amountsSize != inputsQuantity))
95132 then throw("Wrong size of amounts or assets")
96133 else {
97134 let availableWavesDaoLpToClaim = valueOrElse(getInteger(WavesDaoFactoryAddress, ("%s%s__available__" + toString(this))), 0)
98135 let wavesDaoNextBlockToProcess = getIntegerValue(WavesDaoFactoryAddress, "%s__nextBlockToProcess")
99136 let wavesDlpClaim = if (if ((availableWavesDaoLpToClaim > 0))
100137 then ((wavesDaoNextBlockToProcess + BlocksBatchMaxSize) >= Height)
101138 else false)
102139 then invoke(WavesDaoFactoryAddress, "claimLP", nil, nil)
103140 else unit
104141 if ((wavesDlpClaim == wavesDlpClaim))
105142 then {
106143 let currentAdditionalRewards = getPayoutAdditionalRewards(payoutId)
107144 func assetsFold (accum,index) = if ((index >= assetsSize))
108145 then accum
109146 else {
110147 let assetStr = assets[index]
111148 if ((getInteger(SettingsAddress, ("inputAssetIndex_" + assetStr)) == unit))
112149 then throw(("Unknown input: " + assetStr))
113150 else {
114- let $t039154094 = if ((assetStr == WavesId))
151+ let $t051325311 = if ((assetStr == WavesId))
115152 then $Tuple2(unit, (amounts[index] + currentAdditionalRewards))
116153 else $Tuple2(fromBase58String(assetStr), amounts[index])
117- let asset = $t039154094._1
118- let amount = $t039154094._2
154+ let asset = $t051325311._1
155+ let amount = $t051325311._2
119156 if ((0 > amount))
120157 then throw((("Wrong asset amount: " + toString(amount)) + ", should be positive or zero"))
121158 else {
122159 let minerFee = fraction(amount, MinerFee, 100)
123160 let maintainerFee = (minerFee / 2)
124161 let puzzleTeamFee = (minerFee - maintainerFee)
125162 let lessorsAmount = ((amount - maintainerFee) - puzzleTeamFee)
126163 $Tuple2(((accum._1 :+ ScriptTransfer(MaintainerAddress, maintainerFee, asset)) :+ ScriptTransfer(PuzzleBuybackAddress, puzzleTeamFee, asset)), (accum._2 :+ toString(lessorsAmount)))
127164 }
128165 }
129166 }
130167
131- let $t046694736 = {
168+ let $t058865953 = {
132169 let $l = Arr10
133170 let $s = size($l)
134171 let $acc0 = $Tuple2(nil, nil)
135172 func $f0_1 ($a,$i) = if (($i >= $s))
136173 then $a
137174 else assetsFold($a, $l[$i])
138175
139176 func $f0_2 ($a,$i) = if (($i >= $s))
140177 then $a
141178 else throw("List size exceeds 10")
142179
143180 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
144181 }
145- let transfers = $t046694736._1
146- let amountKeys = $t046694736._2
182+ let transfers = $t058865953._1
183+ let amountKeys = $t058865953._2
147184 let newPayoutData = makeString(([toString(startHeight), toString(endHeight)] ++ amountKeys), "_")
148185 (transfers ++ [IntegerEntry(LastPayoutKey, payoutId), StringEntry(makePayoutDataKey(payoutId), newPayoutData), IntegerEntry(makePayoutStatusKey(payoutId), PayoutInitiatedStatus)])
149186 }
150187 else throw("Strict value is not equal to itself.")
151188 }
152189 }
153190 }
154191 }
155192 }
156193
157194
158195
159196 @Callable(i)
160-func swap (payoutId,swapFrom,amountIn,route,minToReceive) = if ((i.caller != CallerAddress))
197+func swap (payoutId,swapFrom,amountIn,route,minToReceive) = if ((i.caller != DaemonAddress))
161198 then throw("Access denied")
162199 else if ((size(i.payments) != 0))
163200 then throw("Payments are prohibited")
164201 else {
165202 let lastPayout = getLastPayout()
166203 if ((lastPayout != payoutId))
167204 then throw(((("Wrong payoutId: " + toString(payoutId)) + ", should be: ") + toString(lastPayout)))
168205 else {
169206 let payoutStatus = getPayoutStatus(payoutId)
170207 if ((payoutStatus != PayoutInitiatedStatus))
171208 then throw((("Wrong payout status: " + toString(payoutStatus)) + ", should be 1"))
172209 else {
173- let $t056875936 = if ((swapFrom == WavesId))
210+ let $t069047153 = if ((swapFrom == WavesId))
174211 then $Tuple2(wavesBalance(this).available, unit)
175212 else {
176213 let assetId = fromBase58String(swapFrom)
177214 $Tuple2(assetBalance(this, assetId), assetId)
178215 }
179- let balanceInBeforeSwap = $t056875936._1
180- let swapFromId = $t056875936._2
216+ let balanceInBeforeSwap = $t069047153._1
217+ let swapFromId = $t069047153._2
181218 let swapInvoke = invoke(PuzzleAggregatorAddress, "swapWithReferral", [route, minToReceive, "puzzlenode"], [AttachedPayment(swapFromId, amountIn)])
182219 if ((swapInvoke == swapInvoke))
183220 then {
184221 let balanceInAfterSwap = if ((swapFrom == WavesId))
185222 then wavesBalance(this).available
186223 else assetBalance(this, value(swapFromId))
187224 let refund = (balanceInAfterSwap - (balanceInBeforeSwap - amountIn))
188225 if ((refund > 10))
189226 then throw(("Rollback aggregator refund: " + toString(refund)))
190227 else nil
191228 }
192229 else throw("Strict value is not equal to itself.")
193230 }
194231 }
195232 }
196233
197234
198235
199236 @Callable(i)
200-func distributeTokens (payoutId,recipients,amounts,assets,attachment) = if ((i.caller != CallerAddress))
237+func distributeTokens (payoutId,recipients,amounts,assets,attachment) = if ((i.caller != DaemonAddress))
201238 then throw("Access denied")
202239 else if ((size(i.payments) != 0))
203240 then throw("Payments are prohibited")
204241 else {
205242 let lastPayout = getLastPayout()
206243 if ((lastPayout != payoutId))
207244 then throw(((("Wrong payoutId: " + toString(payoutId)) + ", should be: ") + toString(lastPayout)))
208245 else {
209246 let payoutStatus = getPayoutStatus(payoutId)
210247 if ((payoutStatus != PayoutInitiatedStatus))
211248 then throw((("Wrong payout status: " + toString(payoutStatus)) + ", should be 1"))
212249 else {
213250 let recipientsSize = size(recipients)
214251 let amountsSize = size(amounts)
215252 let assetsSize = size(assets)
216253 if (if ((recipientsSize != amountsSize))
217254 then true
218255 else (recipientsSize != assetsSize))
219256 then throw(((((("Wrong recipients size: " + toString(recipientsSize)) + ", amounts size: ") + toString(amountsSize)) + ", assets size: ") + toString(assetsSize)))
220257 else if ((recipientsSize == 0))
221258 then throw("Recipients list should not be empty")
222259 else if ((recipientsSize > RecipientsBatchMaxSize))
223260 then throw(((("Should be not greater than " + toString(RecipientsBatchMaxSize)) + " recipients, current: ") + toString(recipientsSize)))
224261 else {
225262 let magicByte = drop(toBytes(1), 7)
226263 let chainIdByte = drop(toBytes(ChainId), 7)
227264 let addressPrefix = (magicByte + chainIdByte)
228265 func scriptTransfersFold (accum,index) = if ((index >= recipientsSize))
229266 then accum
230267 else {
231268 let publicKeyHash = recipients[index]
232269 let addressData = (addressPrefix + publicKeyHash)
233270 let addressChecksum = take(keccak256(blake2b256(addressData)), 4)
234271 let recipient = Address((addressData + addressChecksum))
235272 let amount = amounts[index]
236273 let assetIndex = assets[index]
237274 let assetId = getBinaryValue(SettingsAddress, ("assetId_" + toString(assetIndex)))
238275 let asset = if ((assetId == base58''))
239276 then unit
240277 else assetId
241278 (accum :+ ScriptTransfer(recipient, amount, asset))
242279 }
243280
244281 let indexes = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 62, 63, 64, 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 91, 92, 93, 94, 95, 96, 97, 98, 99]
245282 let $l = indexes
246283 let $s = size($l)
247284 let $acc0 = nil
248285 func $f0_1 ($a,$i) = if (($i >= $s))
249286 then $a
250287 else scriptTransfersFold($a, $l[$i])
251288
252289 func $f0_2 ($a,$i) = if (($i >= $s))
253290 then $a
254291 else throw("List size exceeds 100")
255292
256293 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100)
257294 }
258295 }
259296 }
260297 }
261298
262299
263300
264301 @Callable(i)
265-func finalizePayout (payoutId) = if ((i.caller != CallerAddress))
302+func finalizePayout (payoutId) = if ((i.caller != DaemonAddress))
266303 then throw("Access denied")
267304 else {
268305 let lastPayout = getLastPayout()
269306 if ((lastPayout != payoutId))
270307 then throw(((("Wrong payoutId: " + toString(payoutId)) + ", should be: ") + toString(lastPayout)))
271308 else {
272309 let payoutStatus = getPayoutStatus(lastPayout)
273310 if ((payoutStatus != PayoutInitiatedStatus))
274311 then throw((("Wrong payout status: " + toString(payoutStatus)) + ", should be: 1"))
275312 else [IntegerEntry(makePayoutStatusKey(lastPayout), PayoutCompletedStatus)]
276313 }
277314 }
278315
279316
280317
281318 @Callable(i)
282319 func addAdditionalRewards () = if ((size(i.payments) != 1))
283320 then throw("At least one payment should be attached")
284321 else if ((i.payments[0].assetId != unit))
285322 then throw("Only waves can be attached")
286323 else {
287324 let lastPayout = getLastPayout()
288325 let lastPayoutStatus = getPayoutStatus(lastPayout)
289326 if ((lastPayoutStatus != PayoutCompletedStatus))
290327 then throw((("Last payout: " + toString(lastPayout)) + " was not completed"))
291328 else {
292329 let nextPayoutId = (lastPayout + 1)
293330 let currentAdditionalRewards = getPayoutAdditionalRewards(nextPayoutId)
294331 let newAdditionalRewards = (currentAdditionalRewards + i.payments[0].amount)
295332 [IntegerEntry(makePayoutAdditionalRewardsKey(nextPayoutId), newAdditionalRewards)]
296333 }
297334 }
298335
299336
300337
301338 @Callable(i)
302339 func addMassTransferFees () = if ((size(i.payments) != 1))
303340 then throw("At least one payment should be attached")
304341 else if ((i.payments[0].assetId != unit))
305342 then throw("Only waves can be attached")
306343 else {
307344 let currentMassTransferFees = valueOrElse(getInteger(MassTransferFeesKey), 0)
308345 let newMassTransferFees = (currentMassTransferFees + i.payments[0].amount)
309346 [IntegerEntry(MassTransferFeesKey, newMassTransferFees)]
310347 }
311348
312349
313350
314351 @Callable(i)
315352 func withdrawMassTransferFees () = if ((i.caller != MaintainerAddress))
316353 then throw("Access denied")
317354 else if ((size(i.payments) != 0))
318355 then throw("Payments are prohibited")
319356 else {
320357 let currentMassTransferFees = valueOrElse(getInteger(MassTransferFeesKey), 0)
321358 if ((currentMassTransferFees == 0))
322359 then throw("Nothing to withdraw")
323360 else [IntegerEntry(MassTransferFeesKey, 0), ScriptTransfer(MaintainerAddress, currentMassTransferFees, unit)]
324361 }
325362
326363
327364 @Verifier(tx)
328-func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
365+func verify () = match tx {
366+ case massTx: MassTransferTransaction =>
367+ let configAddressStr = getString(this, ConfigAddressKey)
368+ let configAddress = addressFromStringValue(value(configAddressStr))
369+ let publicKey = if (isDefined(configAddressStr))
370+ then valueOrElse(getBinary(configAddress, DaemonPublicKeyKey), tx.senderPublicKey)
371+ else tx.senderPublicKey
372+ sigVerify_8Kb(massTx.bodyBytes, massTx.proofs[0], publicKey)
373+ case invokeTx: InvokeScriptTransaction =>
374+ let validFunctionName = if (if (if ((invokeTx.function == "extendMainChain"))
375+ then true
376+ else (invokeTx.function == "appendBlock"))
377+ then true
378+ else (invokeTx.function == "startAltChain"))
379+ then true
380+ else (invokeTx.function == "extendAltChain")
381+ let configAddressStr = getString(this, ConfigAddressKey)
382+ let configAddress = addressFromStringValue(value(configAddressStr))
383+ let unitsChainAddressStr = getString(configAddress, ("unitsChain_" + toString({
384+ let @ = invokeTx.dApp
385+ if ($isInstanceOf(@, "Address"))
386+ then @
387+ else throw(($getType(@) + " couldn't be cast to Address"))
388+ })))
389+ let signerPublicKey = valueOrElse(getBinary(configAddress, SignerPublicKeyKey), tx.senderPublicKey)
390+ let publicKey = if (isDefined(configAddressStr))
391+ then if (if (isDefined(unitsChainAddressStr))
392+ then validFunctionName
393+ else false)
394+ then tx.senderPublicKey
395+ else signerPublicKey
396+ else tx.senderPublicKey
397+ sigVerify_8Kb(invokeTx.bodyBytes, invokeTx.proofs[0], publicKey)
398+ case _ =>
399+ let configAddressStr = getString(this, ConfigAddressKey)
400+ let configAddress = addressFromStringValue(value(configAddressStr))
401+ let publicKey = if (isDefined(configAddressStr))
402+ then valueOrElse(getBinary(configAddress, SignerPublicKeyKey), tx.senderPublicKey)
403+ else tx.senderPublicKey
404+ sigVerify_128Kb(tx.bodyBytes, tx.proofs[0], publicKey)
405+}
329406

github/deemru/w8io/fabc49c 
55.05 ms