tx · FJs5jKw9FTDMmMiQCXY2WjNFzM1Fr6m82pgXhe4ncLNz 3MvpFffWWo5or6sUZeRmSSxKSbiZkArx7En: -0.01400000 Waves 2022.10.21 09:54 [2281846] smart account 3MvpFffWWo5or6sUZeRmSSxKSbiZkArx7En > SELF 0.00000000 Waves
{ "type": 13, "id": "FJs5jKw9FTDMmMiQCXY2WjNFzM1Fr6m82pgXhe4ncLNz", "fee": 1400000, "feeAssetId": null, "timestamp": 1666335263977, "version": 2, "chainId": 84, "sender": "3MvpFffWWo5or6sUZeRmSSxKSbiZkArx7En", "senderPublicKey": "4pdv1bda9eVqVBp5VvxCh7vZWnTAYzoQuidCZhupq1Ak", "proofs": [ "4XP5UaJWT1ot7xo1DoaRfEWgxyN4bWgfCZpmd4EKSGbhUbNRvWxV8qNiwcQTzdXJWeHwZyzbdUpo8czob5A9rmj7" ], "script": "base64:BgIqCAISBAoCCAgSBAoCBAgSBgoECAgICBIGCgQICAgIEgUKAwgICBIDCgEIGAAHVkVSU0lPTgIDMS4wAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFA2tleQIAAQ9nZXRCb29sZWFuQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmwgCBQR0aGlzBQNrZXkHAQ9nZXRJbnRlZ2VyQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQNrZXkAAAAFY2hyaXMJAQ5nZXRTdHJpbmdCeUtleQECDGNvbmZfYWRtaW5fMQAOZGFwcFJ1bm5pbmdLZXkCFGNvbmZfZGFwcF9pc19ydW5uaW5nABFtYWludGVuYW5jZU1TR0tleQIUY29uZl9tYWludGVuYW5jZV9tc2cAC2RhcHBSdW5uaW5nCQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMFDmRhcHBSdW5uaW5nS2V5BgAObWFpbnRlbmFuY2VNU0cJAQt2YWx1ZU9yRWxzZQIJAJ0IAgUEdGhpcw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lBQV0aHVtYgkApAMBBQRkYXRlAwkBD2NvbnRhaW5zRWxlbWVudAIJAMwIAgUFY2hyaXMJAMwIAgkApQgBBQR0aGlzBQNuaWwFBmNhbGxlcgkAzAgCCQELU3RyaW5nRW50cnkCCQENa2V5VXNlclN0YXR1cwEFB2FkZHJlc3MFC3N0YXR1c1RvU2V0CQDMCAIJAQtEZWxldGVFbnRyeQEJAKwCAgkArAICBQ1jdXJyZW50U3RhdHVzAgFfBQdhZGRyZXNzCQDMCAIJAQtTdHJpbmdFbnRyeQIJAKwCAgkArAICBQtzdGF0dXNUb1NldAIBXwUHYWRkcmVzcwUEanNvbgkAzAgCCQELU3RyaW5nRW50cnkCCQCsAgICCnVzZXJfbm90ZV8FB2FkZHJlc3MFBG5vdGUFA25pbAkAAgECIU5vdCBhbGxvd2VkIHRvIGNoYW5nZSB1c2VyIHN0YXR1cwFpAQtkZWxldGVFbnRyeQEFZW50cnkEBmNhbGxlcgkApQgBCAUBaQZjYWxsZXIDCQAAAgUGY2FsbGVyBQVjaHJpcwkAzAgCCQELRGVsZXRlRW50cnkBBQVlbnRyeQUDbmlsCQACAQICbm8AibX9Eg==", "height": 2281846, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HW186RTVs18x4qX7wqseGHXFDZDPVGd6vE3Z6Zgo2S7L Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let VERSION = "1.0" | |
5 | + | ||
6 | + | func getStringByKey (key) = valueOrElse(getString(this, key), "") | |
7 | + | ||
8 | + | ||
9 | + | func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false) | |
10 | + | ||
11 | + | ||
12 | + | func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0) | |
13 | + | ||
14 | + | ||
15 | + | let chris = getStringByKey("conf_admin_1") | |
16 | + | ||
17 | + | let dappRunningKey = "conf_dapp_is_running" | |
18 | + | ||
19 | + | let maintenanceMSGKey = "conf_maintenance_msg" | |
20 | + | ||
21 | + | let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true) | |
22 | + | ||
23 | + | let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "") | |
24 | + | ||
25 | + | let userRegistered = "REGISTERED" | |
26 | + | ||
27 | + | let userVerified = "VERIFIED" | |
28 | + | ||
29 | + | let userSuspended = "SUSPENDED" | |
30 | + | ||
31 | + | let userChangeRequired = "CHANGE_REQUIRED" | |
32 | + | ||
33 | + | func keyUserAddr (caller) = ("user_" + caller) | |
34 | + | ||
35 | + | ||
36 | + | func keyUserName (caller) = ("user_name_" + caller) | |
37 | + | ||
38 | + | ||
39 | + | func keyUserDesc (caller) = ("user_desc_" + caller) | |
40 | + | ||
41 | + | ||
42 | + | func keyUserSocial (caller) = ("user_social_" + caller) | |
43 | + | ||
44 | + | ||
45 | + | func keyUserThumb (caller) = ("user_thumb_" + caller) | |
46 | + | ||
47 | + | ||
48 | + | func keyUserStatus (caller) = ("user_status_" + caller) | |
49 | + | ||
50 | + | ||
51 | + | func keyUserDate (caller) = ("user_date_" + caller) | |
52 | + | ||
53 | + | ||
54 | + | func validateCID (cid) = if (contains(cid, "/")) | |
55 | + | then if (if ((76 > size(cid))) | |
56 | + | then (size(split(cid, "/")[0]) == 59) | |
57 | + | else false) | |
58 | + | then (16 > size(split(cid, "/")[1])) | |
59 | + | else false | |
60 | + | else false | |
61 | + | ||
62 | + | ||
63 | + | func validUserData (caller,name,description,thumb,isAnUpdate) = { | |
64 | + | let validCID = if ((size(thumb) != 0)) | |
65 | + | then validateCID(thumb) | |
66 | + | else true | |
67 | + | if (!(validCID)) | |
68 | + | then throw("CID don't match requirement!") | |
69 | + | else if (if ((name == "")) | |
70 | + | then true | |
71 | + | else (description == "")) | |
72 | + | then throw("Name and description cannot be empty") | |
73 | + | else if ((size(description) > 600)) | |
74 | + | then throw("600 Char. max description") | |
75 | + | else if ((size(name) > 100)) | |
76 | + | then throw("100 Char. max name") | |
77 | + | else { | |
78 | + | let status = getStringByKey(keyUserStatus(caller)) | |
79 | + | if ((status == userSuspended)) | |
80 | + | then throw("Account suspended.") | |
81 | + | else if (if (!(isAnUpdate)) | |
82 | + | then (status == userRegistered) | |
83 | + | else false) | |
84 | + | then throw("Already registered") | |
85 | + | else if (if (if (isAnUpdate) | |
86 | + | then (status == "") | |
87 | + | else false) | |
88 | + | then true | |
89 | + | else isAnUpdate) | |
90 | + | then throw("Register first") | |
91 | + | else true | |
92 | + | } | |
93 | + | } | |
94 | + | ||
95 | + | ||
96 | + | func validateNewStatus (status,address,currentStatus) = { | |
97 | + | let allStatus = [userVerified, userRegistered, userSuspended, userChangeRequired] | |
98 | + | let statusToSet = if (containsElement(allStatus, status)) | |
99 | + | then status | |
100 | + | else throw("Unknown status") | |
101 | + | let userIsRegistered = getIntegerByKey(keyUserDate(address)) | |
102 | + | if ((userIsRegistered == 0)) | |
103 | + | then throw("You cant set this status, user is not registered.") | |
104 | + | else statusToSet | |
105 | + | } | |
106 | + | ||
107 | + | ||
108 | + | func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}") | |
109 | + | ||
110 | + | ||
111 | + | @Callable(invoke) | |
112 | + | func setConf (key,val) = { | |
113 | + | let caller = toString(invoke.caller) | |
114 | + | if (containsElement([chris, toString(this)], caller)) | |
115 | + | then [StringEntry(key, val)] | |
116 | + | else throw("You are not allowed to change this") | |
117 | + | } | |
118 | + | ||
119 | + | ||
120 | + | ||
121 | + | @Callable(invoke) | |
122 | + | func appRunning (isLive,message) = { | |
123 | + | let caller = toString(invoke.caller) | |
124 | + | if (containsElement([chris, toString(this)], caller)) | |
125 | + | then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)] | |
126 | + | else throw("You are not allowed to change this") | |
127 | + | } | |
128 | + | ||
129 | + | ||
130 | + | ||
131 | + | @Callable(invoke) | |
132 | + | func registerUser (name,description,thumb,social) = if (!(dappRunning)) | |
133 | + | then throw(maintenanceMSG) | |
134 | + | else { | |
135 | + | let caller = toString(invoke.caller) | |
136 | + | let id = toBase58String(invoke.transactionId) | |
137 | + | let timestamp = lastBlock.timestamp | |
138 | + | if (!(validUserData(caller, name, description, thumb, false))) | |
139 | + | then throw("Something went wrong") | |
140 | + | else { | |
141 | + | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp)) | |
142 | + | [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(keyUserStatus(caller), userRegistered), StringEntry(((userRegistered + "_") + caller), json)] | |
143 | + | } | |
144 | + | } | |
145 | + | ||
146 | + | ||
147 | + | ||
148 | + | @Callable(invoke) | |
149 | + | func updateUser (name,description,thumb,social) = if (!(dappRunning)) | |
150 | + | then throw(maintenanceMSG) | |
151 | + | else { | |
152 | + | let caller = toString(invoke.caller) | |
153 | + | let status = getStringByKey(keyUserStatus(caller)) | |
154 | + | if (!(validUserData(caller, name, description, thumb, true))) | |
155 | + | then throw("Something went wrong") | |
156 | + | else { | |
157 | + | let date = getIntegerByKey(keyUserDate(caller)) | |
158 | + | let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date)) | |
159 | + | [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(((status + "_") + caller), json)] | |
160 | + | } | |
161 | + | } | |
162 | + | ||
163 | + | ||
164 | + | ||
165 | + | @Callable(invoke) | |
166 | + | func changeUserStatus (address,status,note) = { | |
167 | + | let caller = toString(invoke.caller) | |
168 | + | let currentStatus = getStringByKey(keyUserStatus(address)) | |
169 | + | let statusToSet = validateNewStatus(status, address, currentStatus) | |
170 | + | let name = toBase64String(toBytes(getStringByKey(keyUserName(address)))) | |
171 | + | let thumb = toBase64String(toBytes(getStringByKey(keyUserThumb(address)))) | |
172 | + | let date = getIntegerByKey(keyUserDate(address)) | |
173 | + | let json = makeJSON(name, thumb, toString(date)) | |
174 | + | if (containsElement([chris, toString(this)], caller)) | |
175 | + | then [StringEntry(keyUserStatus(address), statusToSet), DeleteEntry(((currentStatus + "_") + address)), StringEntry(((statusToSet + "_") + address), json), StringEntry(("user_note_" + address), note)] | |
176 | + | else throw("Not allowed to change user status") | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | @Callable(i) | |
182 | + | func deleteEntry (entry) = { | |
183 | + | let caller = toString(i.caller) | |
184 | + | if ((caller == chris)) | |
185 | + | then [DeleteEntry(entry)] | |
186 | + | else throw("no") | |
187 | + | } | |
188 | + | ||
189 | + |
github/deemru/w8io/026f985 33.44 ms ◑