tx · HXVMrttkBxqoi9ruatwk2CkWv8hARNbc6B289hJmLyhj 3Mu2C9QPkCMbH6JLg6Hz7Netz8WzzsCFuer: -0.01000000 Waves 2022.05.15 18:31 [2052974] smart account 3Mu2C9QPkCMbH6JLg6Hz7Netz8WzzsCFuer > SELF 0.00000000 Waves
{ "type": 13, "id": "HXVMrttkBxqoi9ruatwk2CkWv8hARNbc6B289hJmLyhj", "fee": 1000000, "feeAssetId": null, "timestamp": 1652628775732, "version": 2, "chainId": 84, "sender": "3Mu2C9QPkCMbH6JLg6Hz7Netz8WzzsCFuer", "senderPublicKey": "EpsQDuBHgjx87GJiEmraTUWwEdeaW4vimku5axvyr238", "proofs": [ "2p3pd4uJYg25FjF78L3NwCjQMMsbgkaRfFx6ySyND9wrqgxt9s4AAnjBM1bJ35SjaSWZwshA9nzNEjjQRVvYn3xw" ], "script": "base64:AAIFAAAAAAAAADYIAhIDCgEIEgQKAgQIEgMKAQQSBwoFCAgICAgSBwoFCAgICAgSBgoECAgICBIDCgEIEgMKAQgAAAAkAAAAAAlvcmFjbGVLZXkCAAAACW9yYWNsZUtleQEAAAAGZ2V0U3RyAAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWIFAAAAByRtYXRjaDAFAAAAAWICAAAAAAAAAAAGb3JhY2xlCQEAAAAGZ2V0U3RyAAAAAQUAAAAJb3JhY2xlS2V5AAAAAAlvcmFjbGVGZWUJAQAAAAV2YWx1ZQAAAAEJAAQmAAAAAQUAAAAGb3JhY2xlAQAAABlnZXRJbnRlZ2VyQnlLZXlGcm9tT3JhY2xlAAAAAQAAAANrZXkJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABBoAAAACBQAAAAlvcmFjbGVGZWUFAAAAA2tleQIAAAAfSW50ZWdlciB1bmRlZmluZSBvciAwIGluIG9yYWNsZQAAA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lckRlc2MAAAABBQAAAAdhZGRyZXNzCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAAA1rZXlVc2VyU29jaWFsAAAAAQUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAMa2V5VXNlclRodW1iAAAAAQUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAIJAAEsAAAAAgUAAAANY3VycmVudFN0YXR1cwIAAAABXwUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQABLAAAAAICAAAACWNhdGVnb3J5XwUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAANa2V5VXNlclN0YXR1cwAAAAEFAAAAB2FkZHJlc3MFAAAAC3VzZXJSZW1vdmVkBQAAAANuaWwJAAACAAAAAQIAAAALTm90IGFsbG93ZWQAAAABaQEAAAALZGVsZXRlRW50cnkAAAABAAAABWVudHJ5BAAAAAZjYWxsZXIJAAQlAAAAAQkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQgFAAAAAWkAAAAPY2FsbGVyUHVibGljS2V5AwkBAAAAD2NvbnRhaW5zRWxlbWVudAAAAAIFAAAABm93bmVycwUAAAAGY2FsbGVyCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAABWVudHJ5BQAAAANuaWwJAAACAAAAAQIAAAACbm8AAAAAVCp0aw==", "height": 2052974, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: D4LWkkCriSxiD5fKGDeRJvdBE1s85SHDdMTHbR16Zuiz Next: FAHznfFVnguCwCsgJtTBvCo8MY8if3sVabWHiqNLqfXA Diff:
Old | New | Differences | |
---|---|---|---|
17 | 17 | ||
18 | 18 | func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleFee, key), "Integer undefine or 0 in oracle") | |
19 | 19 | ||
20 | - | ||
21 | - | let SconexAssetId = fromBase58String(getStringValue(oracleFee, "SconexAssetId")) | |
22 | - | ||
23 | - | let currentFeeSconex = getIntegerByKeyFromOracle(("fee_" + toBase58String(SconexAssetId))) | |
24 | 20 | ||
25 | 21 | let stakeDapp = addressFromString(valueOrErrorMessage(getString(oracleFee, "stakeDapp"), "sconexDapp not found")) | |
26 | 22 | ||
151 | 147 | func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}") | |
152 | 148 | ||
153 | 149 | ||
154 | - | func isPayment (i) = if ((size(i.payments) == 0)) | |
155 | - | then throw("No payment attached") | |
156 | - | else { | |
157 | - | let payment = value(i.payments[0]) | |
158 | - | let amount = value(payment.amount) | |
159 | - | $Tuple2(payment, amount) | |
160 | - | } | |
161 | - | ||
162 | - | ||
163 | - | func validatePayment (i) = { | |
164 | - | let t089829018 = isPayment(i) | |
165 | - | let payment = t089829018._1 | |
166 | - | let amount = t089829018._2 | |
167 | - | let assetId = if (if (isDefined(payment.assetId)) | |
168 | - | then (payment.assetId == SconexAssetId) | |
169 | - | else false) | |
170 | - | then payment.assetId | |
171 | - | else throw((("Only " + toBase58String(SconexAssetId)) + " token accepted as transaction fee")) | |
172 | - | if ((amount != currentFeeSconex)) | |
173 | - | then throw(((("Payment amount should be " + toString(currentFeeSconex)) + " but is: ") + toString(amount))) | |
174 | - | else $Tuple2(amount, assetId) | |
175 | - | } | |
176 | - | ||
177 | - | ||
178 | 150 | @Callable(i) | |
179 | 151 | func initDapp (dappKey) = if ((i.caller != this)) | |
180 | 152 | then throw("You cannot do this action") | |
210 | 182 | func registerUser (name,description,thumb,social,banner) = if (!(dappRunning)) | |
211 | 183 | then throw(maintenanceMSG) | |
212 | 184 | else { | |
213 | - | let validP = validatePayment(i) | |
214 | - | let amountP = validP._1 | |
215 | - | let assetIdP = validP._2 | |
216 | - | if (!(isDefined(amountP))) | |
217 | - | then throw("Something went wrong") | |
218 | - | else { | |
219 | - | let invokeTeamFeeSplit = invoke(valueOrErrorMessage(stakeDapp, "stakeDapp not found"), "topUpReward", nil, [AttachedPayment(assetIdP, amountP)]) | |
220 | - | if ((invokeTeamFeeSplit == invokeTeamFeeSplit)) | |
221 | - | then { | |
222 | - | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
223 | - | let id = toBase58String(i.transactionId) | |
224 | - | let timestamp = lastBlock.timestamp | |
225 | - | if (!(validateBanner(banner))) | |
226 | - | then throw("Invalid banner image!") | |
227 | - | else if (!(validUserData(caller, name, description, thumb, false))) | |
228 | - | then throw("Something went wrong") | |
229 | - | else { | |
230 | - | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp)) | |
185 | + | let validateAndProcessPaymentInvoke = invoke(valueOrErrorMessage(stakeDapp, "this not found"), "validateAndProcessPayment", nil, [i.payments[0]]) | |
186 | + | if ((validateAndProcessPaymentInvoke == validateAndProcessPaymentInvoke)) | |
187 | + | then { | |
188 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
189 | + | let id = toBase58String(i.transactionId) | |
190 | + | let timestamp = lastBlock.timestamp | |
191 | + | if (!(validateBanner(banner))) | |
192 | + | then throw("Invalid banner image!") | |
193 | + | else if (!(validUserData(caller, name, description, thumb, false))) | |
194 | + | then throw("Something went wrong") | |
195 | + | else { | |
196 | + | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp)) | |
231 | 197 | [IntegerEntry(keyUserDate(caller), timestamp), StringEntry(keyUserAddr(caller), ((id + "_") + toString(timestamp))), StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(keyUserBanner(caller), banner), StringEntry(keyUserStatus(caller), userRegistered), StringEntry(((userRegistered + "_") + caller), json)] | |
232 | - | } | |
233 | - | } | |
234 | - | else throw("Strict value is not equal to itself.") | |
198 | + | } | |
235 | 199 | } | |
200 | + | else throw("Strict value is not equal to itself.") | |
236 | 201 | } | |
237 | 202 | ||
238 | 203 | ||
241 | 206 | func updateUser (name,description,thumb,social,banner) = if (!(dappRunning)) | |
242 | 207 | then throw(maintenanceMSG) | |
243 | 208 | else { | |
244 | - | let validP = validatePayment(i) | |
245 | - | let amountP = validP._1 | |
246 | - | let assetIdP = validP._2 | |
247 | - | if (!(isDefined(amountP))) | |
248 | - | then throw("Something went wrong") | |
249 | - | else { | |
250 | - | let invokeTeamFeeSplit = invoke(valueOrErrorMessage(stakeDapp, "stakeDapp not found"), "topUpReward", nil, [AttachedPayment(assetIdP, amountP)]) | |
251 | - | if ((invokeTeamFeeSplit == invokeTeamFeeSplit)) | |
252 | - | then { | |
253 | - | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
254 | - | let id = toBase58String(i.transactionId) | |
255 | - | let status = getStringByKey(keyUserStatus(caller)) | |
256 | - | if (!(validateBanner(banner))) | |
257 | - | then throw("Invalid banner image!") | |
258 | - | else if (!(validUserData(caller, name, description, thumb, true))) | |
259 | - | then throw("Something went wrong") | |
260 | - | else { | |
261 | - | let date = getIntegerByKey(keyUserDate(caller)) | |
262 | - | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date)) | |
209 | + | let validateAndProcessPaymentInvoke = invoke(valueOrErrorMessage(stakeDapp, "this not found"), "validateAndProcessPayment", nil, [i.payments[0]]) | |
210 | + | if ((validateAndProcessPaymentInvoke == validateAndProcessPaymentInvoke)) | |
211 | + | then { | |
212 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
213 | + | let id = toBase58String(i.transactionId) | |
214 | + | let status = getStringByKey(keyUserStatus(caller)) | |
215 | + | if (!(validateBanner(banner))) | |
216 | + | then throw("Invalid banner image!") | |
217 | + | else if (!(validUserData(caller, name, description, thumb, true))) | |
218 | + | then throw("Something went wrong") | |
219 | + | else { | |
220 | + | let date = getIntegerByKey(keyUserDate(caller)) | |
221 | + | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date)) | |
263 | 222 | [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserBanner(caller), banner), StringEntry(keyUserThumb(caller), thumb), StringEntry(((status + "_") + caller), json)] | |
264 | - | } | |
265 | - | } | |
266 | - | else throw("Strict value is not equal to itself.") | |
223 | + | } | |
267 | 224 | } | |
225 | + | else throw("Strict value is not equal to itself.") | |
268 | 226 | } | |
269 | 227 | ||
270 | 228 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let oracleKey = "oracleKey" | |
5 | 5 | ||
6 | 6 | func getStr (key) = match getString(this, key) { | |
7 | 7 | case b: String => | |
8 | 8 | b | |
9 | 9 | case _ => | |
10 | 10 | "" | |
11 | 11 | } | |
12 | 12 | ||
13 | 13 | ||
14 | 14 | let oracle = getStr(oracleKey) | |
15 | 15 | ||
16 | 16 | let oracleFee = value(addressFromString(oracle)) | |
17 | 17 | ||
18 | 18 | func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleFee, key), "Integer undefine or 0 in oracle") | |
19 | 19 | ||
20 | - | ||
21 | - | let SconexAssetId = fromBase58String(getStringValue(oracleFee, "SconexAssetId")) | |
22 | - | ||
23 | - | let currentFeeSconex = getIntegerByKeyFromOracle(("fee_" + toBase58String(SconexAssetId))) | |
24 | 20 | ||
25 | 21 | let stakeDapp = addressFromString(valueOrErrorMessage(getString(oracleFee, "stakeDapp"), "sconexDapp not found")) | |
26 | 22 | ||
27 | 23 | let owners = [getString(oracleFee, "owner1"), getString(oracleFee, "owner2")] | |
28 | 24 | ||
29 | 25 | let dappRunningKey = "conf_dapp_is_running" | |
30 | 26 | ||
31 | 27 | let maintenanceMSGKey = "conf_maintenance_msg" | |
32 | 28 | ||
33 | 29 | let whitelistedonlyKey = "conf_whitelisted_only" | |
34 | 30 | ||
35 | 31 | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
36 | 32 | ||
37 | 33 | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
38 | 34 | ||
39 | 35 | let whitelistedonly = valueOrElse(getBoolean(this, whitelistedonlyKey), true) | |
40 | 36 | ||
41 | 37 | let userRegistered = "REGISTERED" | |
42 | 38 | ||
43 | 39 | let userVerified = "VERIFIED" | |
44 | 40 | ||
45 | 41 | let userSuspended = "SUSPENDED" | |
46 | 42 | ||
47 | 43 | let userRemoved = "REMOVED" | |
48 | 44 | ||
49 | 45 | let userChangeRequired = "CHANGE_REQUIRED" | |
50 | 46 | ||
51 | 47 | let userUnregistered = "UNREGISTERED" | |
52 | 48 | ||
53 | 49 | let userReset = "RESET" | |
54 | 50 | ||
55 | 51 | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
56 | 52 | ||
57 | 53 | ||
58 | 54 | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
59 | 55 | ||
60 | 56 | ||
61 | 57 | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
62 | 58 | ||
63 | 59 | ||
64 | 60 | func keyUserAddr (caller) = ("user_" + caller) | |
65 | 61 | ||
66 | 62 | ||
67 | 63 | func keyUserName (caller) = ("user_name_" + caller) | |
68 | 64 | ||
69 | 65 | ||
70 | 66 | func keyUserDesc (caller) = ("user_desc_" + caller) | |
71 | 67 | ||
72 | 68 | ||
73 | 69 | func keyUserSocial (caller) = ("user_social_" + caller) | |
74 | 70 | ||
75 | 71 | ||
76 | 72 | func keyUserThumb (caller) = ("user_thumb_" + caller) | |
77 | 73 | ||
78 | 74 | ||
79 | 75 | func keyUserBanner (caller) = ("user_banner_" + caller) | |
80 | 76 | ||
81 | 77 | ||
82 | 78 | func keyUserStatus (caller) = ("user_status_" + caller) | |
83 | 79 | ||
84 | 80 | ||
85 | 81 | func keyUserDate (caller) = ("user_date_" + caller) | |
86 | 82 | ||
87 | 83 | ||
88 | 84 | func validateCID (cid) = if (contains(cid, "/")) | |
89 | 85 | then if (if ((63 > size(cid))) | |
90 | 86 | then (size(split(cid, "/")[0]) == 46) | |
91 | 87 | else false) | |
92 | 88 | then (16 > size(split(cid, "/")[1])) | |
93 | 89 | else false | |
94 | 90 | else false | |
95 | 91 | ||
96 | 92 | ||
97 | 93 | func validateBanner (cid) = if ((size(cid) == 0)) | |
98 | 94 | then true | |
99 | 95 | else if ((size(cid) == 46)) | |
100 | 96 | then true | |
101 | 97 | else false | |
102 | 98 | ||
103 | 99 | ||
104 | 100 | func validUserData (caller,name,description,thumb,isAnUpdate) = { | |
105 | 101 | let validCID = if ((size(thumb) != 0)) | |
106 | 102 | then validateCID(thumb) | |
107 | 103 | else true | |
108 | 104 | if (!(validCID)) | |
109 | 105 | then throw("CID don't match requirement!") | |
110 | 106 | else if (if ((name == "")) | |
111 | 107 | then true | |
112 | 108 | else (description == "")) | |
113 | 109 | then throw("Name and description cannot be empty") | |
114 | 110 | else if ((size(description) > 600)) | |
115 | 111 | then throw("600 Char. max description") | |
116 | 112 | else if ((size(name) > 45)) | |
117 | 113 | then throw("45 Char. max name") | |
118 | 114 | else { | |
119 | 115 | let status = getStringByKey(keyUserStatus(caller)) | |
120 | 116 | if (if ((status == userSuspended)) | |
121 | 117 | then true | |
122 | 118 | else (status == userRemoved)) | |
123 | 119 | then throw("Account suspended/ removed.") | |
124 | 120 | else if (if (!(isAnUpdate)) | |
125 | 121 | then (status == userRegistered) | |
126 | 122 | else false) | |
127 | 123 | then throw("Already registered") | |
128 | 124 | else if (if (isAnUpdate) | |
129 | 125 | then (status == "") | |
130 | 126 | else false) | |
131 | 127 | then throw("Register first") | |
132 | 128 | else true | |
133 | 129 | } | |
134 | 130 | } | |
135 | 131 | ||
136 | 132 | ||
137 | 133 | func validateNewStatus (status,address,currentStatus) = { | |
138 | 134 | let allStatus = [userVerified, userRegistered, userSuspended, userRemoved, userChangeRequired] | |
139 | 135 | let statusToSet = if (containsElement(allStatus, status)) | |
140 | 136 | then status | |
141 | 137 | else if ((status == userReset)) | |
142 | 138 | then "" | |
143 | 139 | else throw("Unknown status") | |
144 | 140 | let userIsRegistered = getIntegerByKey(keyUserDate(address)) | |
145 | 141 | if ((userIsRegistered == 0)) | |
146 | 142 | then throw("You cant set this status, user is not registered.") | |
147 | 143 | else statusToSet | |
148 | 144 | } | |
149 | 145 | ||
150 | 146 | ||
151 | 147 | func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}") | |
152 | 148 | ||
153 | 149 | ||
154 | - | func isPayment (i) = if ((size(i.payments) == 0)) | |
155 | - | then throw("No payment attached") | |
156 | - | else { | |
157 | - | let payment = value(i.payments[0]) | |
158 | - | let amount = value(payment.amount) | |
159 | - | $Tuple2(payment, amount) | |
160 | - | } | |
161 | - | ||
162 | - | ||
163 | - | func validatePayment (i) = { | |
164 | - | let t089829018 = isPayment(i) | |
165 | - | let payment = t089829018._1 | |
166 | - | let amount = t089829018._2 | |
167 | - | let assetId = if (if (isDefined(payment.assetId)) | |
168 | - | then (payment.assetId == SconexAssetId) | |
169 | - | else false) | |
170 | - | then payment.assetId | |
171 | - | else throw((("Only " + toBase58String(SconexAssetId)) + " token accepted as transaction fee")) | |
172 | - | if ((amount != currentFeeSconex)) | |
173 | - | then throw(((("Payment amount should be " + toString(currentFeeSconex)) + " but is: ") + toString(amount))) | |
174 | - | else $Tuple2(amount, assetId) | |
175 | - | } | |
176 | - | ||
177 | - | ||
178 | 150 | @Callable(i) | |
179 | 151 | func initDapp (dappKey) = if ((i.caller != this)) | |
180 | 152 | then throw("You cannot do this action") | |
181 | 153 | else if ((oracle != "")) | |
182 | 154 | then throw("oracle already set, you can't override!") | |
183 | 155 | else [StringEntry(oracleKey, dappKey)] | |
184 | 156 | ||
185 | 157 | ||
186 | 158 | ||
187 | 159 | @Callable(invoke) | |
188 | 160 | func appRunning (isLive,message) = { | |
189 | 161 | let caller = toString(addressFromPublicKey(invoke.callerPublicKey)) | |
190 | 162 | let id = toBase58String(invoke.transactionId) | |
191 | 163 | if (containsElement((owners :+ toString(this)), caller)) | |
192 | 164 | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
193 | 165 | else throw("You are not allowed to change this") | |
194 | 166 | } | |
195 | 167 | ||
196 | 168 | ||
197 | 169 | ||
198 | 170 | @Callable(invoke) | |
199 | 171 | func registrationMode (WLonly) = { | |
200 | 172 | let caller = toString(addressFromPublicKey(invoke.callerPublicKey)) | |
201 | 173 | let id = toBase58String(invoke.transactionId) | |
202 | 174 | if (containsElement((owners :+ toString(this)), caller)) | |
203 | 175 | then [BooleanEntry(whitelistedonlyKey, WLonly)] | |
204 | 176 | else throw("You are not allowed to change this") | |
205 | 177 | } | |
206 | 178 | ||
207 | 179 | ||
208 | 180 | ||
209 | 181 | @Callable(i) | |
210 | 182 | func registerUser (name,description,thumb,social,banner) = if (!(dappRunning)) | |
211 | 183 | then throw(maintenanceMSG) | |
212 | 184 | else { | |
213 | - | let validP = validatePayment(i) | |
214 | - | let amountP = validP._1 | |
215 | - | let assetIdP = validP._2 | |
216 | - | if (!(isDefined(amountP))) | |
217 | - | then throw("Something went wrong") | |
218 | - | else { | |
219 | - | let invokeTeamFeeSplit = invoke(valueOrErrorMessage(stakeDapp, "stakeDapp not found"), "topUpReward", nil, [AttachedPayment(assetIdP, amountP)]) | |
220 | - | if ((invokeTeamFeeSplit == invokeTeamFeeSplit)) | |
221 | - | then { | |
222 | - | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
223 | - | let id = toBase58String(i.transactionId) | |
224 | - | let timestamp = lastBlock.timestamp | |
225 | - | if (!(validateBanner(banner))) | |
226 | - | then throw("Invalid banner image!") | |
227 | - | else if (!(validUserData(caller, name, description, thumb, false))) | |
228 | - | then throw("Something went wrong") | |
229 | - | else { | |
230 | - | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp)) | |
185 | + | let validateAndProcessPaymentInvoke = invoke(valueOrErrorMessage(stakeDapp, "this not found"), "validateAndProcessPayment", nil, [i.payments[0]]) | |
186 | + | if ((validateAndProcessPaymentInvoke == validateAndProcessPaymentInvoke)) | |
187 | + | then { | |
188 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
189 | + | let id = toBase58String(i.transactionId) | |
190 | + | let timestamp = lastBlock.timestamp | |
191 | + | if (!(validateBanner(banner))) | |
192 | + | then throw("Invalid banner image!") | |
193 | + | else if (!(validUserData(caller, name, description, thumb, false))) | |
194 | + | then throw("Something went wrong") | |
195 | + | else { | |
196 | + | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp)) | |
231 | 197 | [IntegerEntry(keyUserDate(caller), timestamp), StringEntry(keyUserAddr(caller), ((id + "_") + toString(timestamp))), StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(keyUserBanner(caller), banner), StringEntry(keyUserStatus(caller), userRegistered), StringEntry(((userRegistered + "_") + caller), json)] | |
232 | - | } | |
233 | - | } | |
234 | - | else throw("Strict value is not equal to itself.") | |
198 | + | } | |
235 | 199 | } | |
200 | + | else throw("Strict value is not equal to itself.") | |
236 | 201 | } | |
237 | 202 | ||
238 | 203 | ||
239 | 204 | ||
240 | 205 | @Callable(i) | |
241 | 206 | func updateUser (name,description,thumb,social,banner) = if (!(dappRunning)) | |
242 | 207 | then throw(maintenanceMSG) | |
243 | 208 | else { | |
244 | - | let validP = validatePayment(i) | |
245 | - | let amountP = validP._1 | |
246 | - | let assetIdP = validP._2 | |
247 | - | if (!(isDefined(amountP))) | |
248 | - | then throw("Something went wrong") | |
249 | - | else { | |
250 | - | let invokeTeamFeeSplit = invoke(valueOrErrorMessage(stakeDapp, "stakeDapp not found"), "topUpReward", nil, [AttachedPayment(assetIdP, amountP)]) | |
251 | - | if ((invokeTeamFeeSplit == invokeTeamFeeSplit)) | |
252 | - | then { | |
253 | - | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
254 | - | let id = toBase58String(i.transactionId) | |
255 | - | let status = getStringByKey(keyUserStatus(caller)) | |
256 | - | if (!(validateBanner(banner))) | |
257 | - | then throw("Invalid banner image!") | |
258 | - | else if (!(validUserData(caller, name, description, thumb, true))) | |
259 | - | then throw("Something went wrong") | |
260 | - | else { | |
261 | - | let date = getIntegerByKey(keyUserDate(caller)) | |
262 | - | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date)) | |
209 | + | let validateAndProcessPaymentInvoke = invoke(valueOrErrorMessage(stakeDapp, "this not found"), "validateAndProcessPayment", nil, [i.payments[0]]) | |
210 | + | if ((validateAndProcessPaymentInvoke == validateAndProcessPaymentInvoke)) | |
211 | + | then { | |
212 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
213 | + | let id = toBase58String(i.transactionId) | |
214 | + | let status = getStringByKey(keyUserStatus(caller)) | |
215 | + | if (!(validateBanner(banner))) | |
216 | + | then throw("Invalid banner image!") | |
217 | + | else if (!(validUserData(caller, name, description, thumb, true))) | |
218 | + | then throw("Something went wrong") | |
219 | + | else { | |
220 | + | let date = getIntegerByKey(keyUserDate(caller)) | |
221 | + | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date)) | |
263 | 222 | [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserBanner(caller), banner), StringEntry(keyUserThumb(caller), thumb), StringEntry(((status + "_") + caller), json)] | |
264 | - | } | |
265 | - | } | |
266 | - | else throw("Strict value is not equal to itself.") | |
223 | + | } | |
267 | 224 | } | |
225 | + | else throw("Strict value is not equal to itself.") | |
268 | 226 | } | |
269 | 227 | ||
270 | 228 | ||
271 | 229 | ||
272 | 230 | @Callable(invoke) | |
273 | 231 | func changeUserStatus (address,status,note,category) = { | |
274 | 232 | let caller = toString(addressFromPublicKey(invoke.callerPublicKey)) | |
275 | 233 | let id = toBase58String(invoke.transactionId) | |
276 | 234 | let addr = addressFromString(address) | |
277 | 235 | match addr { | |
278 | 236 | case addr: Address => | |
279 | 237 | let currentStatus = getStringByKey(keyUserStatus(address)) | |
280 | 238 | let statusToSet = validateNewStatus(status, address, currentStatus) | |
281 | 239 | let name = toBase64String(toBytes(getStringByKey(keyUserName(address)))) | |
282 | 240 | let thumb = toBase64String(toBytes(getStringByKey(keyUserThumb(address)))) | |
283 | 241 | let date = getIntegerByKey(keyUserDate(address)) | |
284 | 242 | let json = makeJSON(name, thumb, toString(date)) | |
285 | 243 | if (containsElement((owners :+ toString(this)), caller)) | |
286 | 244 | then { | |
287 | 245 | let categoryData = if ((statusToSet == userVerified)) | |
288 | 246 | then [StringEntry(("category_" + address), category)] | |
289 | 247 | else [DeleteEntry(("category_" + address))] | |
290 | 248 | (categoryData ++ [StringEntry(keyUserStatus(address), statusToSet), DeleteEntry(((currentStatus + "_") + address)), StringEntry(((statusToSet + "_") + address), json), StringEntry(("user_note_" + address), note)]) | |
291 | 249 | } | |
292 | 250 | else throw("Not allowed to change user status") | |
293 | 251 | case _ => | |
294 | 252 | throw("Seems to be an invalid address!") | |
295 | 253 | } | |
296 | 254 | } | |
297 | 255 | ||
298 | 256 | ||
299 | 257 | ||
300 | 258 | @Callable(invoke) | |
301 | 259 | func deleteUser (address) = { | |
302 | 260 | let caller = toString(addressFromPublicKey(invoke.callerPublicKey)) | |
303 | 261 | let id = toBase58String(invoke.transactionId) | |
304 | 262 | let currentStatus = getStringByKey(keyUserStatus(address)) | |
305 | 263 | if (containsElement((owners :+ toString(this)), caller)) | |
306 | 264 | then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), DeleteEntry(((currentStatus + "_") + address)), DeleteEntry(("category_" + address)), StringEntry(keyUserStatus(address), userRemoved)] | |
307 | 265 | else throw("Not allowed") | |
308 | 266 | } | |
309 | 267 | ||
310 | 268 | ||
311 | 269 | ||
312 | 270 | @Callable(i) | |
313 | 271 | func deleteEntry (entry) = { | |
314 | 272 | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
315 | 273 | if (containsElement(owners, caller)) | |
316 | 274 | then [DeleteEntry(entry)] | |
317 | 275 | else throw("no") | |
318 | 276 | } | |
319 | 277 | ||
320 | 278 |
github/deemru/w8io/169f3d6 62.73 ms ◑