tx · 8gwAVCQHrmC8bwBmBWXBzSvSc4GT8b1K392r6DUxkygQ 3MvebeGZYw4DzztAuqcdxyT22s6rB3yMNj7: -0.01000000 Waves 2022.03.17 01:42 [1967120] smart account 3MvebeGZYw4DzztAuqcdxyT22s6rB3yMNj7 > SELF 0.00000000 Waves
{ "type": 13, "id": "8gwAVCQHrmC8bwBmBWXBzSvSc4GT8b1K392r6DUxkygQ", "fee": 1000000, "feeAssetId": null, "timestamp": 1647470354050, "version": 2, "chainId": 84, "sender": "3MvebeGZYw4DzztAuqcdxyT22s6rB3yMNj7", "senderPublicKey": "J283pC8bzRfJ3j1oxPrgDH8hjUVhFZS2CiRcPTmzQukz", "proofs": [ "eHiU5KcofW5r6thayGaTmhpqJYz2wdmHBXT32KUQCmBBN38YDLoxdDjSmtUAGomjpHsP3aNRFb3yEiYkrfuAmCn" ], "script": "base64:AAIFAAAAAAAAAA8IAhIECgIIARIFCgMIAQEAAAAaAAAAAApkZWxheUJsb2NrAAAAAAAAAAABAAAAAAptaW5QYXltZW50AAAAAAAdzWUAAAAAABFhY2NlcHRhYmxlQXNzZXRJZAEAAAAg5PpGdWo9J1HbfiCa7IUj8tNs55tRKSuPgPaCoKWt9soAAAAAEmZpZWxkTmFtZVJpc3VsdGF0bwIAAAANc2VtZV9lc3RyYXR0bwAAAAANZmllbGROYW1lU2VlZAIAAAAEc2VlZAAAAAAQZmllbGROYW1lU2VlZEIxNgIAAAAIc2VlZF9iMTYAAAAAGWZpZWxkTmFtZUhlaWdodEV4dHJhY3Rpb24CAAAAEWhlaWdodF9leHRyYWN0aW9uAAAAAA1maWVsZE5hbWVKc29uAgAAAARqc29uAAAAABRmaWVsZE5hbWVDYXJkaW5hbGl0YQIAAAALY2FyZGluYWxpdGEAAAAAFmZpZWxkTmFtZURhdGFSaWNoaWVzdGECAAAADmRhdGFfcmljaGllc3RhAAAAABNmaWVsZE5hbWVFc3RyYXppb25pAgAAAAplc3RyYXppb25pAAAAABJmaWVsZE5hbWVSa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AAAAJcmljaGllc3RhAAAABm51bWVybwkBAAAAB2VzdHJhaTEAAAADBQAAAAlyaWNoaWVzdGEFAAAABm51bWVybwUAAAABaQAAAAFpAQAAAAhyZWdpc3RyYQAAAAMAAAAJcmljaGllc3RhAAAAC2NhcmRpbmFsaXRhAAAACmVzdHJhemlvbmkDCQEAAAALaXNQYXltZW50T2sAAAABBQAAAAFpCQEAAAAJcmVnaXN0cmExAAAABAUAAAAJcmljaGllc3RhBQAAAAtjYXJkaW5hbGl0YQUAAAAKZXN0cmF6aW9uaQUAAAABaQkAAAIAAAABAgAAABpEZXZpIGluc2VyaXJlIHVuIHBhZ2FtZW50bwAAAABzGaXL", "height": 1967120, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FPrEeFt2Kk669Uek5Z4Gi3Fcf85cZWfYD3Nt3gp9Kj8T Next: FatyWDzPd2qMCMinBxzhepp789WFCHHS9Xe2GFTAofPH Diff:
Old | New | Differences | |
---|---|---|---|
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let delayBlock = 1 | |
5 | + | ||
6 | + | let minPayment = 500000000 | |
7 | + | ||
8 | + | let acceptableAssetId = base58'GQqJPRuXvxoyz22DeLqquGcx3cdbYpWi6QdqfQUMbLuf' | |
5 | 9 | ||
6 | 10 | let fieldNameRisultato = "seme_estratto" | |
7 | 11 | ||
26 | 30 | let fieldNameIdCounter = "id_richiesta" | |
27 | 31 | ||
28 | 32 | let fieldNameProvider = "provider" | |
33 | + | ||
34 | + | func isPaymentOk (i) = if ((size(i.payments) == 0)) | |
35 | + | then throw(((("Devi effettuare un pagamento in " + toBase58String(acceptableAssetId)) + " di almeno ") + toString(minPayment))) | |
36 | + | else { | |
37 | + | let p = i.payments[0] | |
38 | + | match p.assetId { | |
39 | + | case a: ByteVector => | |
40 | + | if ((a == acceptableAssetId)) | |
41 | + | then (p.amount >= minPayment) | |
42 | + | else false | |
43 | + | case _ => | |
44 | + | false | |
45 | + | } | |
46 | + | } | |
47 | + | ||
29 | 48 | ||
30 | 49 | func openJson (key,value) = ((("{\"" + key) + "\":\"") + value) | |
31 | 50 | ||
143 | 162 | } | |
144 | 163 | ||
145 | 164 | ||
146 | - | @Callable(i) | |
147 | - | func registra (richiesta,cardinalita,estrazioni) = { | |
165 | + | func registra1 (richiesta,cardinalita,estrazioni,i) = { | |
148 | 166 | let keyPrefix = (((toString(i.caller) + "_") + richiesta) + "_") | |
149 | 167 | let keyCounter = (keyPrefix + fieldNameCounter) | |
150 | 168 | let nRichiesta = match getInteger(this, keyCounter) { | |
161 | 179 | } | |
162 | 180 | ||
163 | 181 | ||
182 | + | @Callable(i) | |
183 | + | func estrai (richiesta,numero) = estrai1(richiesta, numero, i) | |
184 | + | ||
185 | + | ||
164 | 186 | ||
165 | 187 | @Callable(i) | |
166 | - | func estrai (richiesta,numero) = estrai1(richiesta, numero, i) | |
188 | + | func registra (richiesta,cardinalita,estrazioni) = if (isPaymentOk(i)) | |
189 | + | then registra1(richiesta, cardinalita, estrazioni, i) | |
190 | + | else throw("Devi inserire un pagamento") | |
167 | 191 | ||
168 | 192 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let delayBlock = 1 | |
5 | + | ||
6 | + | let minPayment = 500000000 | |
7 | + | ||
8 | + | let acceptableAssetId = base58'GQqJPRuXvxoyz22DeLqquGcx3cdbYpWi6QdqfQUMbLuf' | |
5 | 9 | ||
6 | 10 | let fieldNameRisultato = "seme_estratto" | |
7 | 11 | ||
8 | 12 | let fieldNameSeed = "seed" | |
9 | 13 | ||
10 | 14 | let fieldNameSeedB16 = "seed_b16" | |
11 | 15 | ||
12 | 16 | let fieldNameHeightExtraction = "height_extraction" | |
13 | 17 | ||
14 | 18 | let fieldNameJson = "json" | |
15 | 19 | ||
16 | 20 | let fieldNameCardinalita = "cardinalita" | |
17 | 21 | ||
18 | 22 | let fieldNameDataRichiesta = "data_richiesta" | |
19 | 23 | ||
20 | 24 | let fieldNameEstrazioni = "estrazioni" | |
21 | 25 | ||
22 | 26 | let fieldNameRichiesta = "richiesta" | |
23 | 27 | ||
24 | 28 | let fieldNameCounter = "counter" | |
25 | 29 | ||
26 | 30 | let fieldNameIdCounter = "id_richiesta" | |
27 | 31 | ||
28 | 32 | let fieldNameProvider = "provider" | |
33 | + | ||
34 | + | func isPaymentOk (i) = if ((size(i.payments) == 0)) | |
35 | + | then throw(((("Devi effettuare un pagamento in " + toBase58String(acceptableAssetId)) + " di almeno ") + toString(minPayment))) | |
36 | + | else { | |
37 | + | let p = i.payments[0] | |
38 | + | match p.assetId { | |
39 | + | case a: ByteVector => | |
40 | + | if ((a == acceptableAssetId)) | |
41 | + | then (p.amount >= minPayment) | |
42 | + | else false | |
43 | + | case _ => | |
44 | + | false | |
45 | + | } | |
46 | + | } | |
47 | + | ||
29 | 48 | ||
30 | 49 | func openJson (key,value) = ((("{\"" + key) + "\":\"") + value) | |
31 | 50 | ||
32 | 51 | ||
33 | 52 | func addJson (key,value) = ((("\", \"" + key) + "\":\" ") + value) | |
34 | 53 | ||
35 | 54 | ||
36 | 55 | func closeJson (key,value) = (((("\", \"" + key) + "\":\" ") + value) + "\"}") | |
37 | 56 | ||
38 | 57 | ||
39 | 58 | func myGetInt (key,msg) = { | |
40 | 59 | let myInt = match getInteger(this, key) { | |
41 | 60 | case t: Int => | |
42 | 61 | t | |
43 | 62 | case _ => | |
44 | 63 | throw(msg) | |
45 | 64 | } | |
46 | 65 | myInt | |
47 | 66 | } | |
48 | 67 | ||
49 | 68 | ||
50 | 69 | func getCurrentBlock () = { | |
51 | 70 | let block = match blockInfoByHeight(height) { | |
52 | 71 | case x: BlockInfo => | |
53 | 72 | x | |
54 | 73 | case _ => | |
55 | 74 | throw("Alla ricerca del blocco corrente: Blocco non trovato!") | |
56 | 75 | } | |
57 | 76 | block | |
58 | 77 | } | |
59 | 78 | ||
60 | 79 | ||
61 | 80 | func getTimestamp () = { | |
62 | 81 | let block = match blockInfoByHeight(height) { | |
63 | 82 | case x: BlockInfo => | |
64 | 83 | x.timestamp | |
65 | 84 | case _ => | |
66 | 85 | throw("Alla ricerca del `timestamp`: Blocco non trovato!") | |
67 | 86 | } | |
68 | 87 | block | |
69 | 88 | } | |
70 | 89 | ||
71 | 90 | ||
72 | 91 | func getVrf (thisBlock) = { | |
73 | 92 | let vrf = match thisBlock.vrf { | |
74 | 93 | case t: ByteVector => | |
75 | 94 | t | |
76 | 95 | case _ => | |
77 | 96 | throw("Alla ricerca del `vrf`: Blocco non trovato o blocco non in versione 5 ritenta.") | |
78 | 97 | } | |
79 | 98 | vrf | |
80 | 99 | } | |
81 | 100 | ||
82 | 101 | ||
83 | 102 | func randomizer (inv) = { | |
84 | 103 | let currentBlock = getCurrentBlock() | |
85 | 104 | let rand = (((((inv.transactionId + inv.callerPublicKey) + getVrf(currentBlock)) + currentBlock.generationSignature) + toBytes(currentBlock.timestamp)) + toBytes(currentBlock.height)) | |
86 | 105 | sha256_16Kb(sha256_16Kb(rand)) | |
87 | 106 | } | |
88 | 107 | ||
89 | 108 | ||
90 | 109 | func estrai1 (richiesta,numero,i) = { | |
91 | 110 | let strOwnerAddress = toString(i.caller) | |
92 | 111 | let keyPrefix = (((strOwnerAddress + "_") + richiesta) + "_") | |
93 | 112 | let keyCounter = (keyPrefix + fieldNameCounter) | |
94 | 113 | let maxRichiesta = myGetInt(keyCounter, "La richiesta fatta non è stata ancora registrata") | |
95 | 114 | let numeroRichiesta = if ((0 >= numero)) | |
96 | 115 | then maxRichiesta | |
97 | 116 | else if ((maxRichiesta >= numero)) | |
98 | 117 | then numero | |
99 | 118 | else throw("Non esiste una richiesta con questo numero") | |
100 | 119 | let keyPrefixN = ((keyPrefix + toString(numeroRichiesta)) + "_") | |
101 | 120 | let keyRisultato = (keyPrefixN + fieldNameRisultato) | |
102 | 121 | let isEstratto = match getString(this, keyRisultato) { | |
103 | 122 | case t: String => | |
104 | 123 | throw(((("Risultato già presente in blockchain: " + keyRisultato) + ": ") + t)) | |
105 | 124 | case _ => | |
106 | 125 | false | |
107 | 126 | } | |
108 | 127 | if (!(isEstratto)) | |
109 | 128 | then { | |
110 | 129 | let heightBloccoCandidato = myGetInt((keyPrefixN + fieldNameHeightExtraction), "Errore generico su dati della richiesta") | |
111 | 130 | if ((heightBloccoCandidato > height)) | |
112 | 131 | then throw(((("Devi aspettare il blocco " + toString(heightBloccoCandidato)) + ". siamo al blocco ") + toString(height))) | |
113 | 132 | else { | |
114 | 133 | let keySeme = (keyPrefixN + fieldNameSeed) | |
115 | 134 | let seed = match getBinary(this, keySeme) { | |
116 | 135 | case t: ByteVector => | |
117 | 136 | t | |
118 | 137 | case _ => | |
119 | 138 | throw("Seme non trovato. Qualcosa è andata storta!") | |
120 | 139 | } | |
121 | 140 | let bloccoCandidato = match blockInfoByHeight(heightBloccoCandidato) { | |
122 | 141 | case block: BlockInfo => | |
123 | 142 | block | |
124 | 143 | case _ => | |
125 | 144 | throw("Errore: Il blocco di estrazione non esiste") | |
126 | 145 | } | |
127 | 146 | let vrfValue = match bloccoCandidato.vrf { | |
128 | 147 | case t: ByteVector => | |
129 | 148 | t | |
130 | 149 | case _ => | |
131 | 150 | throw("Blocco non in versione 5 ritenta.") | |
132 | 151 | } | |
133 | 152 | let rand = (((seed + bloccoCandidato.generationSignature) + bloccoCandidato.generatorPublicKey) + getVrf(bloccoCandidato)) | |
134 | 153 | let sha = toBase16String(sha256_16Kb(sha256_16Kb(rand))) | |
135 | 154 | let strCardinalita = toString(myGetInt((keyPrefixN + fieldNameCardinalita), "Errore lettura cardinalità")) | |
136 | 155 | let strDataRichiesta = toString(myGetInt((keyPrefixN + fieldNameDataRichiesta), "Errore lettura DataRichiesta")) | |
137 | 156 | let strEstrazioni = toString(myGetInt((keyPrefixN + fieldNameEstrazioni), "Errore lettura Estrazioni")) | |
138 | 157 | let json = (((((((((openJson(fieldNameIdCounter, toString(numeroRichiesta)) + addJson(fieldNameCounter, toString(maxRichiesta))) + addJson(fieldNameProvider, strOwnerAddress)) + addJson(fieldNameRichiesta, richiesta)) + addJson(fieldNameCardinalita, strCardinalita)) + addJson(fieldNameEstrazioni, strEstrazioni)) + addJson(fieldNameDataRichiesta, strDataRichiesta)) + addJson(fieldNameSeedB16, toBase16String(seed))) + addJson(fieldNameHeightExtraction, toString(heightBloccoCandidato))) + closeJson(fieldNameRisultato, sha)) | |
139 | 158 | [StringEntry((keyPrefixN + fieldNameJson), json), StringEntry(keyRisultato, sha)] | |
140 | 159 | } | |
141 | 160 | } | |
142 | 161 | else throw("Errore: non dovresti passare da quì") | |
143 | 162 | } | |
144 | 163 | ||
145 | 164 | ||
146 | - | @Callable(i) | |
147 | - | func registra (richiesta,cardinalita,estrazioni) = { | |
165 | + | func registra1 (richiesta,cardinalita,estrazioni,i) = { | |
148 | 166 | let keyPrefix = (((toString(i.caller) + "_") + richiesta) + "_") | |
149 | 167 | let keyCounter = (keyPrefix + fieldNameCounter) | |
150 | 168 | let nRichiesta = match getInteger(this, keyCounter) { | |
151 | 169 | case c: Int => | |
152 | 170 | (c + 1) | |
153 | 171 | case _ => | |
154 | 172 | 1 | |
155 | 173 | } | |
156 | 174 | let keyPrefixN = ((keyPrefix + toString(nRichiesta)) + "_") | |
157 | 175 | let seed = randomizer(i) | |
158 | 176 | let currDate = getTimestamp() | |
159 | 177 | let heightExtraction = (height + delayBlock) | |
160 | 178 | [IntegerEntry(keyCounter, nRichiesta), IntegerEntry((keyPrefixN + fieldNameHeightExtraction), heightExtraction), IntegerEntry((keyPrefixN + fieldNameCardinalita), cardinalita), IntegerEntry((keyPrefixN + fieldNameEstrazioni), estrazioni), IntegerEntry((keyPrefixN + fieldNameDataRichiesta), currDate), BinaryEntry((keyPrefixN + fieldNameSeed), seed), StringEntry((keyPrefixN + fieldNameSeedB16), toBase16String(seed)), StringEntry((keyPrefixN + fieldNameRichiesta), richiesta)] | |
161 | 179 | } | |
162 | 180 | ||
163 | 181 | ||
182 | + | @Callable(i) | |
183 | + | func estrai (richiesta,numero) = estrai1(richiesta, numero, i) | |
184 | + | ||
185 | + | ||
164 | 186 | ||
165 | 187 | @Callable(i) | |
166 | - | func estrai (richiesta,numero) = estrai1(richiesta, numero, i) | |
188 | + | func registra (richiesta,cardinalita,estrazioni) = if (isPaymentOk(i)) | |
189 | + | then registra1(richiesta, cardinalita, estrazioni, i) | |
190 | + | else throw("Devi inserire un pagamento") | |
167 | 191 | ||
168 | 192 |
github/deemru/w8io/169f3d6 38.96 ms ◑