tx · 6KtxpETcXcMvyozrZM4uwZgdRQdtVVwCdWP1jQ55gkvF 3N2jcP6cAcDJoVpfsQ5tVDTQrNgJcVUjj4v: -0.00600000 Waves 2024.04.16 19:04 [3065539] smart account 3N2jcP6cAcDJoVpfsQ5tVDTQrNgJcVUjj4v > SELF 0.00000000 Waves
{ "type": 13, "id": "6KtxpETcXcMvyozrZM4uwZgdRQdtVVwCdWP1jQ55gkvF", "fee": 600000, "feeAssetId": null, "timestamp": 1713283350211, "version": 1, "sender": "3N2jcP6cAcDJoVpfsQ5tVDTQrNgJcVUjj4v", "senderPublicKey": "C7n2hFekcETMHZtCJNSt9jVtwdQWRhVDnUQGrv6y8t3t", "proofs": [ "5ypTa5YvAVEQx2R32B9ijmU6nZcRGvFT6SJsk6r1J84kqzr3gyFEmSyaVdB6jFAtzqGj3i2riWbp31FeZ7DofuQt" ], "script": "base64:BgITCAISAwoBGBIDCgEYEgUKAxgYCBAAB1dhdmVzSWQCBVdBVkVTAA5Ob2RlQWRkcmVzc1N0cgIjM1BDclJyd0hFakdYRmpZdFhEc052NzhmM0NoM0NIM3A2VjEAEUlucHV0c1F1YW50aXR5S2V5Ag5pbnB1dHNRdWFudGl0eQAST3V0cHV0c1F1YW50aXR5S2V5Ag9vdXRwdXRzUXVhbnRpdHkAEUFzc2V0c1F1YW50aXR5S2V5Ag5hc3NldHNRdWFudGl0eQAFQXJyMTAJAMwIAgAACQDMCAIAAQkAzAgCAAIJAMwIAgADCQDMCAIABAkAzAgCAAUJAMwIAgAGCQDMCAIABwkAzAgCAAgJAMwIAgAJBQNuaWwBFm1ha2VJbnB1dEFzc2V0SW5kZXhLZXkBCmFzc2V0SWRTdHIJAKwCAgIQaW5wdXRBc3NldEluZGV4XwUKYXNzZXRJZFN0cgEXbWFrZU91dHB1dEFzc2V0SW5kZXhLZXkBCmFzc2V0SWRTdHIJAKwCAgIRb3V0cHV0QXNzZXRJbmRleF8FCmFzc2V0SWRTdHIBEW1ha2VBc3NldEluZGV4S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meQAJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAAIBQJ0eA9zZW5kZXJQdWJsaWNLZXmXmGQE", "chainId": 84, "height": 3065539, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HSJZV76RksSXXZFQkdAeLFJxu7wNZX9G3kvWYWbiiAHv Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let WavesId = "WAVES" | |
5 | + | ||
6 | + | let NodeAddressStr = "3PCrRrwHEjGXFjYtXDsNv78f3Ch3CH3p6V1" | |
7 | + | ||
8 | + | let InputsQuantityKey = "inputsQuantity" | |
9 | + | ||
10 | + | let OutputsQuantityKey = "outputsQuantity" | |
11 | + | ||
12 | + | let AssetsQuantityKey = "assetsQuantity" | |
13 | + | ||
14 | + | let Arr10 = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9] | |
15 | + | ||
16 | + | func makeInputAssetIndexKey (assetIdStr) = ("inputAssetIndex_" + assetIdStr) | |
17 | + | ||
18 | + | ||
19 | + | func makeOutputAssetIndexKey (assetIdStr) = ("outputAssetIndex_" + assetIdStr) | |
20 | + | ||
21 | + | ||
22 | + | func makeAssetIndexKey (assetIdStr) = ("assetIndex_" + assetIdStr) | |
23 | + | ||
24 | + | ||
25 | + | func makeAssetIdKey (assetIndex) = ("assetId_" + toString(assetIndex)) | |
26 | + | ||
27 | + | ||
28 | + | func getInputAssetIndex (assetIdStr) = getInteger(makeInputAssetIndexKey(assetIdStr)) | |
29 | + | ||
30 | + | ||
31 | + | func getOutputAssetIndex (assetIdStr) = getInteger(makeOutputAssetIndexKey(assetIdStr)) | |
32 | + | ||
33 | + | ||
34 | + | func getAssetIndex (assetIdStr) = getInteger(makeAssetIndexKey(assetIdStr)) | |
35 | + | ||
36 | + | ||
37 | + | func getInputsQuantity () = valueOrElse(getInteger(InputsQuantityKey), 0) | |
38 | + | ||
39 | + | ||
40 | + | func getOutputsQuantity () = valueOrElse(getInteger(OutputsQuantityKey), 0) | |
41 | + | ||
42 | + | ||
43 | + | func getAssetsQuantity () = valueOrElse(getInteger(AssetsQuantityKey), 0) | |
44 | + | ||
45 | + | ||
46 | + | @Callable(i) | |
47 | + | func registerInputs (inputs) = if ((i.caller != this)) | |
48 | + | then throw("Only self call is allowed") | |
49 | + | else if ((size(i.payments) > 0)) | |
50 | + | then throw("Payments are prohibited") | |
51 | + | else { | |
52 | + | let inputsSize = size(inputs) | |
53 | + | let assetsQuanity = getAssetsQuantity() | |
54 | + | let inputsQuantity = getInputsQuantity() | |
55 | + | func inputsFold (accum,index) = if ((index >= inputsSize)) | |
56 | + | then accum | |
57 | + | else { | |
58 | + | let input = inputs[index] | |
59 | + | if ((getInputAssetIndex(input) != unit)) | |
60 | + | then throw(("Already registered: " + input)) | |
61 | + | else { | |
62 | + | let assetId = if ((input == WavesId)) | |
63 | + | then base58'' | |
64 | + | else value(assetInfo(fromBase58String(input))).id | |
65 | + | let assetInputIndex = (inputsQuantity + index) | |
66 | + | let $t019252148 = if ((getOutputAssetIndex(input) == unit)) | |
67 | + | then $Tuple2([BinaryEntry(makeAssetIdKey(accum._2), assetId), IntegerEntry(makeAssetIndexKey(input), accum._2)], 1) | |
68 | + | else $Tuple2(nil, 0) | |
69 | + | let assetIdRegistration = $t019252148._1 | |
70 | + | let incrementAssetId = $t019252148._2 | |
71 | + | $Tuple2(((accum._1 :+ IntegerEntry(makeInputAssetIndexKey(input), assetInputIndex)) ++ assetIdRegistration), (accum._2 + incrementAssetId)) | |
72 | + | } | |
73 | + | } | |
74 | + | ||
75 | + | let $t023142408 = { | |
76 | + | let $l = Arr10 | |
77 | + | let $s = size($l) | |
78 | + | let $acc0 = $Tuple2(nil, assetsQuanity) | |
79 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
80 | + | then $a | |
81 | + | else inputsFold($a, $l[$i]) | |
82 | + | ||
83 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
84 | + | then $a | |
85 | + | else throw("List size exceeds 10") | |
86 | + | ||
87 | + | $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) | |
88 | + | } | |
89 | + | let inputsRegistration = $t023142408._1 | |
90 | + | let newAssetsQuantity = $t023142408._2 | |
91 | + | (inputsRegistration ++ [IntegerEntry(AssetsQuantityKey, newAssetsQuantity), IntegerEntry(InputsQuantityKey, (inputsQuantity + inputsSize))]) | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(i) | |
97 | + | func registerOutputs (outputs) = if ((i.caller != this)) | |
98 | + | then throw("Only self call is allowed") | |
99 | + | else if ((size(i.payments) > 0)) | |
100 | + | then throw("Payments are prohibited") | |
101 | + | else { | |
102 | + | let outputsSize = size(outputs) | |
103 | + | let assetsQuantity = getAssetsQuantity() | |
104 | + | let outputsQuantity = getOutputsQuantity() | |
105 | + | func outputsFold (accum,index) = if ((index >= outputsSize)) | |
106 | + | then accum | |
107 | + | else { | |
108 | + | let output = outputs[index] | |
109 | + | if ((getOutputAssetIndex(output) != unit)) | |
110 | + | then throw(("Already registered: " + output)) | |
111 | + | else { | |
112 | + | let assetId = if ((output == WavesId)) | |
113 | + | then base58'' | |
114 | + | else value(assetInfo(fromBase58String(output))).id | |
115 | + | let assetOutputIndex = (outputsQuantity + index) | |
116 | + | let $t033333557 = if ((getInputAssetIndex(output) == unit)) | |
117 | + | then $Tuple2([BinaryEntry(makeAssetIdKey(accum._2), assetId), IntegerEntry(makeAssetIndexKey(output), accum._2)], 1) | |
118 | + | else $Tuple2(nil, 0) | |
119 | + | let assetIdRegistration = $t033333557._1 | |
120 | + | let incrementAssetId = $t033333557._2 | |
121 | + | $Tuple2(((accum._1 :+ IntegerEntry(makeOutputAssetIndexKey(output), assetOutputIndex)) ++ assetIdRegistration), (accum._2 + incrementAssetId)) | |
122 | + | } | |
123 | + | } | |
124 | + | ||
125 | + | let $t037263823 = { | |
126 | + | let $l = Arr10 | |
127 | + | let $s = size($l) | |
128 | + | let $acc0 = $Tuple2(nil, assetsQuantity) | |
129 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
130 | + | then $a | |
131 | + | else outputsFold($a, $l[$i]) | |
132 | + | ||
133 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
134 | + | then $a | |
135 | + | else throw("List size exceeds 10") | |
136 | + | ||
137 | + | $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) | |
138 | + | } | |
139 | + | let outputsRegistration = $t037263823._1 | |
140 | + | let newAssetsQuantity = $t037263823._2 | |
141 | + | (outputsRegistration ++ [IntegerEntry(AssetsQuantityKey, newAssetsQuantity), IntegerEntry(OutputsQuantityKey, (outputsQuantity + outputsSize))]) | |
142 | + | } | |
143 | + | ||
144 | + | ||
145 | + | ||
146 | + | @Callable(i) | |
147 | + | func applySettings (inputs,outputs,delegateTo) = if ((size(i.payments) > 0)) | |
148 | + | then throw("Payments are prohibited") | |
149 | + | else if ((i.caller == this)) | |
150 | + | then throw("Self call is prohibited") | |
151 | + | else { | |
152 | + | let callerAddressStr = toString(i.caller) | |
153 | + | let inputsQuantity = getIntegerValue(InputsQuantityKey) | |
154 | + | let inputsSize = size(inputs) | |
155 | + | let outputsSize = size(outputs) | |
156 | + | if (if ((inputsSize != outputsSize)) | |
157 | + | then true | |
158 | + | else (inputsSize != inputsQuantity)) | |
159 | + | then throw("Wrong size of inputs or outputs") | |
160 | + | else if ((addressFromString(delegateTo) == unit)) | |
161 | + | then throw(("Invalid address: " + delegateTo)) | |
162 | + | else if (if ((delegateTo == NodeAddressStr)) | |
163 | + | then true | |
164 | + | else (delegateTo == toString(this))) | |
165 | + | then throw(("Prohibited address: " + delegateTo)) | |
166 | + | else { | |
167 | + | func mappingsFold (accum,index) = if ((index >= inputsSize)) | |
168 | + | then accum | |
169 | + | else { | |
170 | + | let input = inputs[index] | |
171 | + | if ((getInputAssetIndex(input) == unit)) | |
172 | + | then throw(("Unknown input: " + input)) | |
173 | + | else { | |
174 | + | let output = outputs[index] | |
175 | + | if ((getOutputAssetIndex(output) == unit)) | |
176 | + | then throw(("Unknown output: " + output)) | |
177 | + | else (accum :+ StringEntry(((callerAddressStr + "_") + input), output)) | |
178 | + | } | |
179 | + | } | |
180 | + | ||
181 | + | let mappings = { | |
182 | + | let $l = Arr10 | |
183 | + | let $s = size($l) | |
184 | + | let $acc0 = nil | |
185 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
186 | + | then $a | |
187 | + | else mappingsFold($a, $l[$i]) | |
188 | + | ||
189 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
190 | + | then $a | |
191 | + | else throw("List size exceeds 10") | |
192 | + | ||
193 | + | $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) | |
194 | + | } | |
195 | + | (mappings :+ StringEntry((callerAddressStr + "_delegateTo"), delegateTo)) | |
196 | + | } | |
197 | + | } | |
198 | + | ||
199 | + | ||
200 | + | @Verifier(tx) | |
201 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
202 | + |
github/deemru/w8io/026f985 21.85 ms ◑