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