tx · 4s9SjGRTTqLRo6uHyYTJpsmUYUgPiQkyaRcKAEzPRkpT 3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj: -0.01400000 Waves 2020.11.27 06:40 [1283311] smart account 3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj > SELF 0.00000000 Waves
{ "type": 13, "id": "4s9SjGRTTqLRo6uHyYTJpsmUYUgPiQkyaRcKAEzPRkpT", "fee": 1400000, "feeAssetId": null, "timestamp": 1606448440638, "version": 2, "chainId": 84, "sender": "3N8xXaYjE27Aa79d5hHrhHu9HaFoTBmhDEj", "senderPublicKey": "A2m227AHcq7gWfSU59Q3UJaqkEa7SccFYmJuWHbFrrKE", "proofs": [ "TYJkwT8n6eXASPwhtGXFUguvQjVpHEV9oCLswNpqq7kx4BQQ462SwqpxqdmenoZsTRZZoBgWhNUdeMcFwwMWt94" ], "script": "base64:AAIEAAAAAAAAACcIAhIGCgQICAgIEgYKBAgICAgSBAoCCAgSAwoBCBIDCgEIEgMKAQgAAAAXAAAAAAtzaWduQXNzZXRJZAEAAAAg6KVqvMp3QvJwYTI1Sk9Fg7m5HuWZZxfDcerZC6EEresAAAAABWNocmlzAgAAACMzTXNHNmpQTkNyVkpVdFlCN1hKQnhTN3V0V3NYQWY0bjlWcAAAAAAEam9lcAIAAAAjM016bTRWTHdzTjl1WndiVE16UGozWHV4VjZrRWZBUjhVRE4AAAAAD1dISVRFTElTVEVET05MWQYAAAAAC2RhcHBSdW5uaW5nBgAAAAAObWFpbnRlbmFuY2VNU0cCAAAAHVNJR04gQXJ0IGlzIHVuZGVyIG1haW50ZW5hbmNlAAAAAAt1c2VyQWxsb3dlZAIAAAAHQUxMT1dFRAAAAAAOdXNlclJlZ2lzdGVyZWQCAAAAClJFR0lTVEVSRUQAAAAADHVzZXJWZXJpZmllZAIAAAAIVkVSSUZJRUQAAAAADXVzZXJTdXNwZW5kZWQCAAAACVNVU1BFTkRFRAAAAAALdXNlclJlbW92ZWQCAAAAB1JFT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a2V5VXNlckRlc2MAAAABBQAAAAdhZGRyZXNzCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEJAQAAAA1rZXlVc2VyU29jaWFsAAAAAQUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALRGVsZXRlRW50cnkAAAABCQEAAAAMa2V5VXNlclRodW1iAAAAAQUAAAAHYWRkcmVzcwkABEwAAAACCQEAAAALU3RyaW5nRW50cnkAAAACCQEAAAANa2V5VXNlclN0YXR1cwAAAAEFAAAAB2FkZHJlc3MFAAAAC3VzZXJSZW1vdmVkBQAAAANuaWwJAAACAAAAAQIAAAALTm90IGFsbG93ZWQAAAABaQEAAAALZGVsZXRlRW50cnkAAAABAAAABWVudHJ5BAAAAAZjYWxsZXIJAAQlAAAAAQkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQgFAAAAAWkAAAAPY2FsbGVyUHVibGljS2V5AwkAAAAAAAACBQAAAAZjYWxsZXIFAAAABWNocmlzCQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAABWVudHJ5BQAAAANuaWwJAAACAAAAAQIAAAACbm8AAAAAPcmJOg==", "height": 1283311, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: B72PPuUBuHQFvxsfyi61v3jTLEMN8HpXoH192CZKiVHr Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let signAssetId = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' | |
5 | + | ||
6 | + | let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp" | |
7 | + | ||
8 | + | let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN" | |
9 | + | ||
10 | + | let WHITELISTEDONLY = true | |
11 | + | ||
12 | + | let dappRunning = true | |
13 | + | ||
14 | + | let maintenanceMSG = "SIGN Art is under maintenance" | |
15 | + | ||
16 | + | let userAllowed = "ALLOWED" | |
17 | + | ||
18 | + | let userRegistered = "REGISTERED" | |
19 | + | ||
20 | + | let userVerified = "VERIFIED" | |
21 | + | ||
22 | + | let userSuspended = "SUSPENDED" | |
23 | + | ||
24 | + | let userRemoved = "REMOVED" | |
25 | + | ||
26 | + | let userChangeRequired = "CHANGE_REQUIRED" | |
27 | + | ||
28 | + | let userUnregistered = "UNREGISTERED" | |
29 | + | ||
30 | + | let userReset = "RESET" | |
31 | + | ||
32 | + | func getStringByKey (key) = match getString(this, key) { | |
33 | + | case a: String => | |
34 | + | a | |
35 | + | case _ => | |
36 | + | "" | |
37 | + | } | |
38 | + | ||
39 | + | ||
40 | + | func validateCID (cid) = if (if ((75 > size(cid))) | |
41 | + | then (60 > size(split(cid, "/")[0])) | |
42 | + | else false) | |
43 | + | then (16 > size(split(cid, "/")[1])) | |
44 | + | else false | |
45 | + | ||
46 | + | ||
47 | + | func keyUserAddr (caller) = ("user_" + caller) | |
48 | + | ||
49 | + | ||
50 | + | func keyUserName (caller) = ("user_name_" + caller) | |
51 | + | ||
52 | + | ||
53 | + | func keyUserDesc (caller) = ("user_desc_" + caller) | |
54 | + | ||
55 | + | ||
56 | + | func keyUserSocial (caller) = ("user_social_" + caller) | |
57 | + | ||
58 | + | ||
59 | + | func keyUserThumb (caller) = ("user_thumb_" + caller) | |
60 | + | ||
61 | + | ||
62 | + | func keyUserStatus (caller) = ("user_status_" + caller) | |
63 | + | ||
64 | + | ||
65 | + | func keyUserDate (caller) = ("user_date_" + caller) | |
66 | + | ||
67 | + | ||
68 | + | @Callable(i) | |
69 | + | func registerUser (name,description,thumb,social) = if (!(dappRunning)) | |
70 | + | then throw(maintenanceMSG) | |
71 | + | else { | |
72 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
73 | + | let canRegister = getStringByKey(keyUserStatus(caller)) | |
74 | + | let id = toBase58String(i.transactionId) | |
75 | + | let timestamp = lastBlock.timestamp | |
76 | + | if (if ((canRegister == userSuspended)) | |
77 | + | then true | |
78 | + | else (canRegister == userRemoved)) | |
79 | + | then throw("Account suspended/ removed.") | |
80 | + | else if ((canRegister == userRegistered)) | |
81 | + | then throw("Already registered") | |
82 | + | else if (if ((canRegister == "")) | |
83 | + | then WHITELISTEDONLY | |
84 | + | else false) | |
85 | + | then throw("Can't register, get approved first.") | |
86 | + | else if (if ((name == "")) | |
87 | + | then true | |
88 | + | else (description == "")) | |
89 | + | then throw("Name and description cannot be empty") | |
90 | + | else if ((size(description) > 600)) | |
91 | + | then throw("600 Char. max description") | |
92 | + | else if ((size(name) > 45)) | |
93 | + | then throw("45 Char. max name") | |
94 | + | else [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)] | |
95 | + | } | |
96 | + | ||
97 | + | ||
98 | + | ||
99 | + | @Callable(i) | |
100 | + | func updateUser (name,description,thumb,social) = if (!(dappRunning)) | |
101 | + | then throw(maintenanceMSG) | |
102 | + | else { | |
103 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
104 | + | let id = toBase58String(i.transactionId) | |
105 | + | let canUpdate = getStringByKey(keyUserStatus(caller)) | |
106 | + | if (if ((canUpdate == userSuspended)) | |
107 | + | then true | |
108 | + | else (canUpdate == userRemoved)) | |
109 | + | then throw("Account suspended/ removed.") | |
110 | + | else if (if ((canUpdate == "")) | |
111 | + | then true | |
112 | + | else (canUpdate == userAllowed)) | |
113 | + | then throw("Register first") | |
114 | + | else if (if ((name == "")) | |
115 | + | then true | |
116 | + | else (description == "")) | |
117 | + | then throw("Name & description cannot be empty") | |
118 | + | else if ((size(description) > 600)) | |
119 | + | then throw("600 Char. max for description") | |
120 | + | else if ((size(name) > 45)) | |
121 | + | then throw("45 Char. max name") | |
122 | + | else [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb)] | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | ||
127 | + | @Callable(i) | |
128 | + | func changeUserStatus (address,status) = if (!(dappRunning)) | |
129 | + | then throw(maintenanceMSG) | |
130 | + | else { | |
131 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
132 | + | let id = toBase58String(i.transactionId) | |
133 | + | let currentStatus = getStringByKey(keyUserStatus(address)) | |
134 | + | let statusToSet = if ((status == userVerified)) | |
135 | + | then userVerified | |
136 | + | else if ((status == userRegistered)) | |
137 | + | then userRegistered | |
138 | + | else if ((status == userSuspended)) | |
139 | + | then userSuspended | |
140 | + | else if ((status == userRemoved)) | |
141 | + | then userRemoved | |
142 | + | else if ((status == userAllowed)) | |
143 | + | then userAllowed | |
144 | + | else if ((status == userChangeRequired)) | |
145 | + | then userChangeRequired | |
146 | + | else if (if ((status == userReset)) | |
147 | + | then (currentStatus == userAllowed) | |
148 | + | else false) | |
149 | + | then "" | |
150 | + | else throw("Unknown status") | |
151 | + | if (if ((currentStatus == userAllowed)) | |
152 | + | then (status == userAllowed) | |
153 | + | else false) | |
154 | + | then throw("User already allowed") | |
155 | + | else if (if ((currentStatus == userRegistered)) | |
156 | + | then (status == userAllowed) | |
157 | + | else false) | |
158 | + | then throw("User already allowed & registered") | |
159 | + | else if (if ((currentStatus == userVerified)) | |
160 | + | then (status == userAllowed) | |
161 | + | else false) | |
162 | + | then throw("User already allowed & verified") | |
163 | + | else if (containsElement([chris, joep], caller)) | |
164 | + | then [StringEntry(keyUserStatus(address), statusToSet)] | |
165 | + | else throw(((("Not allowed to change user status " + caller) + " / ") + chris)) | |
166 | + | } | |
167 | + | ||
168 | + | ||
169 | + | ||
170 | + | @Callable(i) | |
171 | + | func creditUser (address) = { | |
172 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
173 | + | let id = toBase58String(i.transactionId) | |
174 | + | if (containsElement([chris, joep], caller)) | |
175 | + | then [ScriptTransfer(Address(fromBase58String(address)), 30000000000, signAssetId)] | |
176 | + | else throw("Not allowed") | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | @Callable(i) | |
182 | + | func deleteUser (address) = { | |
183 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
184 | + | let id = toBase58String(i.transactionId) | |
185 | + | if (containsElement([chris, joep], caller)) | |
186 | + | then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), StringEntry(keyUserStatus(address), userRemoved)] | |
187 | + | else throw("Not allowed") | |
188 | + | } | |
189 | + | ||
190 | + | ||
191 | + | ||
192 | + | @Callable(i) | |
193 | + | func deleteEntry (entry) = { | |
194 | + | let caller = toString(addressFromPublicKey(i.callerPublicKey)) | |
195 | + | if ((caller == chris)) | |
196 | + | then [DeleteEntry(entry)] | |
197 | + | else throw("no") | |
198 | + | } | |
199 | + | ||
200 | + |
github/deemru/w8io/169f3d6 51.39 ms ◑