tx · EhT3Rgri2VSzFHP7qNK6JghJnrAdDGiWdugZLaDpQyY4 3Mzms5gHUDYufDRjSVN7g9DcCMG77pzFN4h: -0.01400000 Waves 2021.10.05 10:05 [1732599] smart account 3Mzms5gHUDYufDRjSVN7g9DcCMG77pzFN4h > SELF 0.00000000 Waves
{ "type": 13, "id": "EhT3Rgri2VSzFHP7qNK6JghJnrAdDGiWdugZLaDpQyY4", "fee": 1400000, "feeAssetId": null, "timestamp": 1633417562761, "version": 2, "chainId": 84, "sender": "3Mzms5gHUDYufDRjSVN7g9DcCMG77pzFN4h", "senderPublicKey": "CU8dJ2mJQjVBWaDHwXjPztuVdy9XAyAnTuqSCKuNPARn", "proofs": [ "2oJt4Q1QqUdwc3xibuqtMpMqVQpQg2daH3RLFXnEpmx8mic2VwNXb8CMnPu9PG67hGtwMeWPtiJQELBFU3sfbdGg" ], "script": "base64:AAIFAAAAAAAAAB0IAhIDCgEBEgASBwoFCAgICAgSBAoCCAgSAwoBCAAAAAwAAAAAD3N0b3JhZ2VWZXJpZmllcgkBAAAABXZhbHVlAAAAAQkABCYAAAABAgAAACMzTjJzNVJ0YUhQQmVuQ3N4MkVDY29GUmJZSHgzbm9aaFhXMQAAAAAJc2lnbkFkbWluAgAAACMzTjF3UGdIRnRlem1SVkJhcW9valA4WEp3VGthcms0aGJpZgAAAAAIZmVlQWRtaW4CAAAAIzNNdnVqVVpUdG9BTlJ6cktZS3p4OTlWdGI5VFVoNlZQQ0RtAAAAAARiYW5rAgAAACMzTjFFNnRYZGRSb1ZhUmZROWRRM3ZnNUxhVzJmc2Q4SEt1YgAAAAAJc2lnblRva2VuAQAAACDopWq8yndC8nBhMjVKT0WDubke5ZlnF8Nx6tkLoQSt6wAAAAANYWNjZXB0ZWRUb2tlbgEAAAAgYfHkwqhFFD81I1SLw0GO/ozjwqWx6THXqSKcOOhu9fcAAAAAD2FjY2VwdGVkRGVjaW1hbAAAAAAABfXhAAAAAAAGdXNkbklEAgAAACwzS0ZYQkdHT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ZWQgYXQgdGhlIG1vbWVudAMJAQAAAAIhPQAAAAIFAAAABmFtb3VudAUAAAAMY3VycmVudFByaWNlCQAAAgAAAAECAAAAElRoZSBwcmljZSBpcyB3cm9uZwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAICAAAAClNUQVRVU19GQ18FAAAAD2NlcnRpZmljYXRpb25JZAkAASwAAAACAgAAAAhSRVZPS0VEXwkAAlgAAAABBQAAAAJpZAkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACAgAAAAhkYXRhX2ZjXwUAAAAPY2VydGlmaWNhdGlvbklkAgAAAAFfBQAAAA1jYWxsZXJBZGRyZXNzBQAAAAduZXdKc29uCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAICAAAACGNyZWRpdHNfCQACWAAAAAEFAAAADWFjY2VwdGVkVG9rZW4JAABlAAAAAgUAAAAPZGFwcFNJR05DcmVkaXRzAAAAAAAAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAEFAAAABGJhbmsFAAAABmFtb3VudAgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAUAAAADbmlsAAAAAWkBAAAAC2RlbGV0ZUVudHJ5AAAAAQAAAAVlbnRyeQQAAAAGY2FsbGVyCQAEJQAAAAEJAQAAABRhZGRyZXNzRnJvbVB1YmxpY0tleQAAAAEIBQAAAAFpAAAAD2NhbGxlclB1YmxpY0tleQMJAAAAAAAAAgUAAAAGY2FsbGVyBQAAAAlzaWduQWRtaW4JAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAFZW50cnkFAAAAA25pbAkAAAIAAAABAgAAAAJubwAAAAAiYz9O", "height": 1732599, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 43GMwisvVSbmyuE9N5M2VVGzJHBoGHH9Vz7JGN5Qf9xg Next: 9g7kfR8iM2ne6raetFDA8WFvQwfP1TUZTfo5CaZ25tAr Diff:
Old | New | Differences | |
---|---|---|---|
142 | 142 | then value(payment.assetId) | |
143 | 143 | else throw("Waves is not accepted as payment") | |
144 | 144 | let currentPrice = getIntegerValue(this, ("certification_fee_" + toBase58String(value(paymentAssetId)))) | |
145 | - | let | |
146 | - | if ((0 >= | |
145 | + | let dappSIGNCredits = getIntegerValue(this, ("credits_" + toBase58String(acceptedToken))) | |
146 | + | if ((0 >= dappSIGNCredits)) | |
147 | 147 | then throw("Not enough credit on the dapp, please refill") | |
148 | 148 | else if ((acceptedToken != paymentAssetId)) | |
149 | 149 | then throw("This token is not accepted at the moment") | |
150 | 150 | else if ((amount != currentPrice)) | |
151 | 151 | then throw("The price is wrong") | |
152 | - | else [StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), IntegerEntry(("credits_" + toBase58String(acceptedToken)), ( | |
152 | + | else [StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), IntegerEntry(("credits_" + toBase58String(acceptedToken)), (dappSIGNCredits - 1)), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)] | |
153 | 153 | } | |
154 | 154 | } | |
155 | 155 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let storageVerifier = value(addressFromString("3N2s5RtaHPBenCsx2ECcoFRbYHx3noZhXW1")) | |
5 | 5 | ||
6 | 6 | let signAdmin = "3N1wPgHFtezmRVBaqoojP8XJwTkark4hbif" | |
7 | 7 | ||
8 | 8 | let feeAdmin = "3MvujUZTtoANRzrKYKzx99Vtb9TUh6VPCDm" | |
9 | 9 | ||
10 | 10 | let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
11 | 11 | ||
12 | 12 | let signToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' | |
13 | 13 | ||
14 | 14 | let acceptedToken = base58'7bLUm2XNLWvVwgC9aPp9fNNAMVtbGwhwkqdgomJAgVbC' | |
15 | 15 | ||
16 | 16 | let acceptedDecimal = 100000000 | |
17 | 17 | ||
18 | 18 | let usdnID = "3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC" | |
19 | 19 | ||
20 | 20 | let signDapp = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
21 | 21 | ||
22 | 22 | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func checkEntry (prefix,uuid) = match getString(this, (prefix + uuid)) { | |
26 | 26 | case a: String => | |
27 | 27 | a | |
28 | 28 | case _ => | |
29 | 29 | "NONE" | |
30 | 30 | } | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func checkUUID (uuid) = match getString(this, uuid) { | |
34 | 34 | case a: String => | |
35 | 35 | a | |
36 | 36 | case _ => | |
37 | 37 | "NONE" | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(i) | |
42 | 42 | func setFee (fee) = { | |
43 | 43 | let callerAddress = toBase58String(i.caller.bytes) | |
44 | 44 | if ((callerAddress == feeAdmin)) | |
45 | 45 | then [IntegerEntry(("certification_fee_" + toBase58String(acceptedToken)), fee)] | |
46 | 46 | else throw("You are not allowed to change fee") | |
47 | 47 | } | |
48 | 48 | ||
49 | 49 | ||
50 | 50 | ||
51 | 51 | @Callable(i) | |
52 | 52 | func refillCredits () = { | |
53 | 53 | let callerAddress = toBase58String(i.caller.bytes) | |
54 | 54 | let payment = value(i.payments[0]) | |
55 | 55 | let amount = value(payment.amount) | |
56 | 56 | let paymentAssetId = if (isDefined(payment.assetId)) | |
57 | 57 | then value(payment.assetId) | |
58 | 58 | else throw("Accept SIGN token only") | |
59 | 59 | if ((signToken != paymentAssetId)) | |
60 | 60 | then throw("Accept SIGN token only") | |
61 | 61 | else { | |
62 | 62 | let currentSIGNPrice = getIntegerValue(storageVerifier, ("certification_fee_" + toBase58String(value(paymentAssetId)))) | |
63 | 63 | let numCredit = (amount / (currentSIGNPrice / acceptedDecimal)) | |
64 | 64 | let currentCreditsAmount = getIntegerByKey(("credits_" + toBase58String(acceptedToken))) | |
65 | 65 | let newCreditsAmount = ((numCredit / acceptedDecimal) + currentCreditsAmount) | |
66 | 66 | if ((0 >= numCredit)) | |
67 | 67 | then throw("Not enough for at least 1 credit") | |
68 | 68 | else [IntegerEntry(("credits_" + toBase58String(acceptedToken)), newCreditsAmount), ScriptTransfer(addressFromStringValue(signDapp), amount, payment.assetId)] | |
69 | 69 | } | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | ||
74 | 74 | @Callable(invoke) | |
75 | 75 | func fileCertification (hash,title,uuid,ipfs,signerPubKey) = { | |
76 | 76 | let id = value(invoke.transactionId) | |
77 | 77 | let entryExist = checkEntry(hash, uuid) | |
78 | 78 | let uuidExist = checkUUID(uuid) | |
79 | 79 | let callerAddress = toBase58String(invoke.caller.bytes) | |
80 | 80 | if ((entryExist != "NONE")) | |
81 | 81 | then throw("This entry already exist") | |
82 | 82 | else if ((uuidExist != "NONE")) | |
83 | 83 | then throw("This uuid already exist") | |
84 | 84 | else if ((size(uuid) != 36)) | |
85 | 85 | then throw("Uuid should be 36 characters.") | |
86 | 86 | else if ((size(hash) != 64)) | |
87 | 87 | then throw("Hash should be 64 characters.") | |
88 | 88 | else if ((size(title) > 100)) | |
89 | 89 | then throw("Title is too long, 100 characters max.") | |
90 | 90 | else if (if (if (contains(hash, "\"")) | |
91 | 91 | then true | |
92 | 92 | else contains(title, "\"")) | |
93 | 93 | then true | |
94 | 94 | else contains(ipfs, "\"")) | |
95 | 95 | then throw("No \" allowed") | |
96 | 96 | else { | |
97 | 97 | let data = (((((((("{\"hash\":\"" + hash) + "\",\"timestamp\":") + toString(lastBlock.timestamp)) + ",\"title\":\"") + title) + "\",\"ipfs\":\"") + ipfs) + "\"}") | |
98 | 98 | let payment = value(invoke.payments[0]) | |
99 | 99 | let amount = value(payment.amount) | |
100 | 100 | let paymentAssetId = if (isDefined(payment.assetId)) | |
101 | 101 | then value(payment.assetId) | |
102 | 102 | else throw("Waves is not accepted as payment") | |
103 | 103 | let currentPrice = getIntegerValue(this, ("certification_fee_" + toBase58String(value(paymentAssetId)))) | |
104 | 104 | let dappSIGNCredits = getIntegerByKey(("credits_" + toBase58String(acceptedToken))) | |
105 | 105 | if ((0 >= dappSIGNCredits)) | |
106 | 106 | then throw("Not enough credit on the dapp, please refill") | |
107 | 107 | else if ((acceptedToken != paymentAssetId)) | |
108 | 108 | then throw("This token is not accepted at the moment") | |
109 | 109 | else if ((amount != currentPrice)) | |
110 | 110 | then throw("The price is wrong") | |
111 | 111 | else [StringEntry(uuid, toBase58String(id)), StringEntry((hash + uuid), toBase58String(id)), StringEntry((title + uuid), toBase58String(id)), StringEntry(((("data_fc_" + toBase58String(id)) + "_") + callerAddress), data), IntegerEntry(("credits_" + toBase58String(acceptedToken)), (dappSIGNCredits - 1)), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)] | |
112 | 112 | } | |
113 | 113 | } | |
114 | 114 | ||
115 | 115 | ||
116 | 116 | ||
117 | 117 | @Callable(invoke) | |
118 | 118 | func revokeCertification (certificationId,signerPubKey) = { | |
119 | 119 | let id = value(invoke.transactionId) | |
120 | 120 | let callerAddress = toBase58String(invoke.caller.bytes) | |
121 | 121 | let entryExist = match getString(this, ((("data_fc_" + certificationId) + "_") + callerAddress)) { | |
122 | 122 | case a: String => | |
123 | 123 | a | |
124 | 124 | case _ => | |
125 | 125 | "NONE" | |
126 | 126 | } | |
127 | 127 | let isRevoked = match getString(this, ("STATUS_FC_" + certificationId)) { | |
128 | 128 | case a: String => | |
129 | 129 | a | |
130 | 130 | case _ => | |
131 | 131 | "NONE" | |
132 | 132 | } | |
133 | 133 | let newJson = (((dropRight(entryExist, 1) + ",\"status\":\"REVOKED_") + toBase58String(id)) + "\"}") | |
134 | 134 | if ((isRevoked != "NONE")) | |
135 | 135 | then throw("This certification have already been revoked.") | |
136 | 136 | else if ((entryExist == "NONE")) | |
137 | 137 | then throw("You cannot change the status of this certification.") | |
138 | 138 | else { | |
139 | 139 | let payment = value(invoke.payments[0]) | |
140 | 140 | let amount = value(payment.amount) | |
141 | 141 | let paymentAssetId = if (isDefined(payment.assetId)) | |
142 | 142 | then value(payment.assetId) | |
143 | 143 | else throw("Waves is not accepted as payment") | |
144 | 144 | let currentPrice = getIntegerValue(this, ("certification_fee_" + toBase58String(value(paymentAssetId)))) | |
145 | - | let | |
146 | - | if ((0 >= | |
145 | + | let dappSIGNCredits = getIntegerValue(this, ("credits_" + toBase58String(acceptedToken))) | |
146 | + | if ((0 >= dappSIGNCredits)) | |
147 | 147 | then throw("Not enough credit on the dapp, please refill") | |
148 | 148 | else if ((acceptedToken != paymentAssetId)) | |
149 | 149 | then throw("This token is not accepted at the moment") | |
150 | 150 | else if ((amount != currentPrice)) | |
151 | 151 | then throw("The price is wrong") | |
152 | - | else [StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), IntegerEntry(("credits_" + toBase58String(acceptedToken)), ( | |
152 | + | else [StringEntry(("STATUS_FC_" + certificationId), ("REVOKED_" + toBase58String(id))), StringEntry(((("data_fc_" + certificationId) + "_") + callerAddress), newJson), IntegerEntry(("credits_" + toBase58String(acceptedToken)), (dappSIGNCredits - 1)), ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)] | |
153 | 153 | } | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | ||
157 | 157 | ||
158 | 158 | @Callable(i) | |
159 | 159 | func deleteEntry (entry) = { | |
160 | 160 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
161 | 161 | if ((caller == signAdmin)) | |
162 | 162 | then [DeleteEntry(entry)] | |
163 | 163 | else throw("no") | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 |
github/deemru/w8io/169f3d6 40.73 ms ◑