tx · 9oY5NmxoJnVhcb5BB9gZ22RbR8EiHtMYcTmhPnJYe1uU

3Mt4RGMEyjSWYAocTPqd55wdHQQB3PU2UCm:  -0.01400000 Waves

2021.01.05 12:47 [1339923] smart account 3Mt4RGMEyjSWYAocTPqd55wdHQQB3PU2UCm > SELF 0.00000000 Waves

{ "type": 13, "id": "9oY5NmxoJnVhcb5BB9gZ22RbR8EiHtMYcTmhPnJYe1uU", "fee": 1400000, "feeAssetId": null, "timestamp": 1609840068265, "version": 2, "chainId": 84, "sender": "3Mt4RGMEyjSWYAocTPqd55wdHQQB3PU2UCm", "senderPublicKey": "FohxcSc8stwcVXsytmPwjVRthoDnmiFHbohjcgN1r4bP", "proofs": [ "iht4nLLcfdnLP9X6NgWbKZNv4MXQJRNaPUUHn9V7uQWagkjT5jQRExQpRim1EeUAt1rVbeEWMHrUQe2si7vqL7j" ], "script": "base64:AAIEAAAAAAAAACgIAhIECgIECBIDCgEEEgYKBAgICAgSBgoECAgICBIECgIICBIDCgEIAAAAHQAAAAAFY2hyaXMCAAAAIzNNc0c2alBOQ3JWSlV0WUI3WEpCeFM3dXRXc1hBZjRuOVZwAAAAAARqb2VwAgAAACMzTXptNFZMd3NOOXVad2JUTXpQajNYdXhWNmtFZkFSOFVETgAAAAAOZGFwcFJ1bm5pbmdLZXkCAAAAFGNvbmZfZGFwcF9pc19ydW5uaW5nAAAAABFtYWludGVuYW5jZU1TR0tleQIAAAAUY29uZl9tYWludGVuYW5jZV9tc2cAAAAAEndoaXRlbGlzdGVkb25seUtleQIAAAAVY29uZl93aGl0ZWxpc3RlZF9vbmx5AAAAAAtkYXBwUnVubmluZwkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBsAAAACBQAAAAR0aGlzBQAAAA5kYXBwUnVubmluZ0tleQYAAAAADm1haW50ZW5hbmNlTVNHCQEAAAALdmFsdWVPckVsc2UAAAACCQAEHQAAAAIFAAAABHRoaXMFAAAAEW1haW50ZW5hbmNlTVNHS2V5AgAAAAAA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FAAAAB2FkZHJlc3MFAAAAC3VzZXJSZW1vdmVkBQAAAANuaWwJAAACAAAAAQIAAAALTm90IGFsbG93ZWQAAAAAOCCHjA==", "height": 1339923, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: tPReMNRmDwfWUAe1gZYBQYnBqzuFVBkKqjzjMaWCoRS Next: CRAxueusVJB9jqqRv1ou6kcpExBDnM6mPqpGPK1miv9V Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp"
5+
6+let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN"
7+
48 let dappRunningKey = "conf_dapp_is_running"
59
610 let maintenanceMSGKey = "conf_maintenance_msg"
711
812 let whitelistedonlyKey = "conf_whitelisted_only"
913
10-let dappRunning = match getBoolean(this, dappRunningKey) {
11- case a: Boolean =>
12- a
13- case _ =>
14- true
15-}
14+let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true)
1615
17-let maintenanceMSG = match getString(this, maintenanceMSGKey) {
18- case a: String =>
19- a
20- case _ =>
21- ""
22-}
16+let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "")
2317
24-let whitelistedonly = match getBoolean(this, whitelistedonlyKey) {
25- case a: Boolean =>
26- a
27- case _ =>
28- true
29-}
30-
31-let signAssetId = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a'
32-
33-let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp"
34-
35-let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN"
18+let whitelistedonly = valueOrElse(getBoolean(this, whitelistedonlyKey), true)
3619
3720 let userAllowed = "ALLOWED"
3821
5033
5134 let userReset = "RESET"
5235
53-func getStringByKey (key) = match getString(this, key) {
54- case a: String =>
55- a
56- case _ =>
57- ""
58-}
36+func getStringByKey (key) = valueOrElse(getString(this, key), "")
5937
6038
61-func getBooleanByKey (key) = match getBoolean(this, key) {
62- case a: Boolean =>
63- a
64- case _ =>
65- false
66-}
39+func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false)
6740
6841
69-func getIntegerByKey (key) = match getInteger(this, key) {
70- case i: Int =>
71- i
72- case _ =>
73- 0
74-}
75-
76-
77-func validateCID (cid) = if (if ((75 > size(cid)))
78- then (60 > size(split(cid, "/")[0]))
79- else false)
80- then (16 > size(split(cid, "/")[1]))
81- else false
42+func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0)
8243
8344
8445 func keyUserAddr (caller) = ("user_" + caller)
10263 func keyUserDate (caller) = ("user_date_" + caller)
10364
10465
105-@Callable(i)
66+func validUserData (caller,name,description,isAnUpdate) = if (if ((name == ""))
67+ then true
68+ else (description == ""))
69+ then throw("Name and description cannot be empty")
70+ else if ((size(description) > 600))
71+ then throw("600 Char. max description")
72+ else if ((size(name) > 45))
73+ then throw("45 Char. max name")
74+ else {
75+ let status = getStringByKey(keyUserStatus(caller))
76+ if (if ((status == userSuspended))
77+ then true
78+ else (status == userRemoved))
79+ then throw("Account suspended/ removed.")
80+ else if (if (!(isAnUpdate))
81+ then (status == userRegistered)
82+ else false)
83+ then throw("Already registered")
84+ else if (if (if (!(isAnUpdate))
85+ then (status == "")
86+ else false)
87+ then whitelistedonly
88+ else false)
89+ then throw("Can't register, get approved first.")
90+ else if (if (if (isAnUpdate)
91+ then (status == "")
92+ else false)
93+ then true
94+ else if (isAnUpdate)
95+ then (status == userAllowed)
96+ else false)
97+ then throw("Register first")
98+ else true
99+ }
100+
101+
102+func validateNewStatus (status,address,currentStatus) = {
103+ let allStatus = [userVerified, userRegistered, userSuspended, userRemoved, userAllowed, userChangeRequired]
104+ let statusToSet = if (containsElement(allStatus, status))
105+ then status
106+ else if (if ((status == userReset))
107+ then (currentStatus == userAllowed)
108+ else false)
109+ then ""
110+ else throw("Unknown status")
111+ let userIsRegistered = getIntegerByKey(keyUserDate(address))
112+ if (if ((userIsRegistered == 0))
113+ then (statusToSet != userAllowed)
114+ else false)
115+ then throw("You cant set this status, user is not registered.")
116+ else if (if ((currentStatus == userAllowed))
117+ then (statusToSet == userAllowed)
118+ else false)
119+ then throw("User already allowed")
120+ else if (if ((currentStatus == userRegistered))
121+ then (statusToSet == userAllowed)
122+ else false)
123+ then throw("User already allowed & registered")
124+ else if (if ((currentStatus == userVerified))
125+ then (statusToSet == userAllowed)
126+ else false)
127+ then throw("User already allowed & verified")
128+ else statusToSet
129+ }
130+
131+
132+func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}")
133+
134+
135+@Callable(invoke)
106136 func appRunning (isLive,message) = {
107- let caller = toString(addressFromPublicKey(i.callerPublicKey))
108- let id = toBase58String(i.transactionId)
137+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
138+ let id = toBase58String(invoke.transactionId)
109139 if (containsElement([chris, joep, toString(this)], caller))
110140 then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)]
111141 else throw("You are not allowed to change this")
113143
114144
115145
116-@Callable(i)
146+@Callable(invoke)
117147 func registrationMode (WLonly) = {
118- let caller = toString(addressFromPublicKey(i.callerPublicKey))
119- let id = toBase58String(i.transactionId)
120- if (containsElement([chris, joep, toString(this)], caller))
148+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
149+ let id = toBase58String(invoke.transactionId)
150+ if (containsElement([chris, toString(this)], caller))
121151 then [BooleanEntry(whitelistedonlyKey, WLonly)]
122152 else throw("You are not allowed to change this")
123153 }
124154
125155
126156
127-@Callable(i)
157+@Callable(invoke)
128158 func registerUser (name,description,thumb,social) = if (!(dappRunning))
129159 then throw(maintenanceMSG)
130160 else {
131- let caller = toString(addressFromPublicKey(i.callerPublicKey))
132- let canRegister = getStringByKey(keyUserStatus(caller))
133- let id = toBase58String(i.transactionId)
161+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
162+ let id = toBase58String(invoke.transactionId)
134163 let timestamp = lastBlock.timestamp
135- if (if ((canRegister == userSuspended))
136- then true
137- else (canRegister == userRemoved))
138- then throw("Account suspended/ removed.")
139- else if ((canRegister == userRegistered))
140- then throw("Already registered")
141- else if (if ((canRegister == ""))
142- then whitelistedonly
143- else false)
144- then throw("Can't register, get approved first.")
145- else if (if ((name == ""))
146- then true
147- else (description == ""))
148- then throw("Name and description cannot be empty")
149- else if ((size(description) > 600))
150- then throw("600 Char. max description")
151- else if ((size(name) > 45))
152- then throw("45 Char. max name")
153- 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)]
164+ if (!(validUserData(caller, name, description, false)))
165+ then throw("Something went wrong")
166+ else {
167+ let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp))
168+[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), DeleteEntry(("ALLOWED_" + caller)), StringEntry(((userRegistered + "_") + caller), json)]
169+ }
154170 }
155171
156172
157173
158-@Callable(i)
174+@Callable(invoke)
159175 func updateUser (name,description,thumb,social) = if (!(dappRunning))
160176 then throw(maintenanceMSG)
161177 else {
162- let caller = toString(addressFromPublicKey(i.callerPublicKey))
163- let id = toBase58String(i.transactionId)
164- let canUpdate = getStringByKey(keyUserStatus(caller))
165- if (if ((canUpdate == userSuspended))
166- then true
167- else (canUpdate == userRemoved))
168- then throw("Account suspended/ removed.")
169- else if (if ((canUpdate == ""))
170- then true
171- else (canUpdate == userAllowed))
172- then throw("Register first")
173- else if (if ((name == ""))
174- then true
175- else (description == ""))
176- then throw("Name & description cannot be empty")
177- else if ((size(description) > 600))
178- then throw("600 Char. max for description")
179- else if ((size(name) > 45))
180- then throw("45 Char. max name")
181- else [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb)]
178+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
179+ let id = toBase58String(invoke.transactionId)
180+ let status = getStringByKey(keyUserStatus(caller))
181+ if (!(validUserData(caller, name, description, true)))
182+ then throw("Something went wrong")
183+ else {
184+ let date = getIntegerByKey(keyUserDate(caller))
185+ let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date))
186+[StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(((status + "_") + caller), json)]
187+ }
182188 }
183189
184190
185191
186-@Callable(i)
192+@Callable(invoke)
187193 func changeUserStatus (address,status) = if (!(dappRunning))
188194 then throw(maintenanceMSG)
189195 else {
190- let caller = toString(addressFromPublicKey(i.callerPublicKey))
191- let id = toBase58String(i.transactionId)
196+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
197+ let id = toBase58String(invoke.transactionId)
192198 let currentStatus = getStringByKey(keyUserStatus(address))
193- let statusToSet = if ((status == userVerified))
194- then userVerified
195- else if ((status == userRegistered))
196- then userRegistered
197- else if ((status == userSuspended))
198- then userSuspended
199- else if ((status == userRemoved))
200- then userRemoved
201- else if ((status == userAllowed))
202- then userAllowed
203- else if ((status == userChangeRequired))
204- then userChangeRequired
205- else if (if ((status == userReset))
206- then (currentStatus == userAllowed)
207- else false)
208- then ""
209- else throw("Unknown status")
210- let userIsRegistered = getIntegerByKey(keyUserDate(address))
211- if (if ((userIsRegistered == 0))
212- then (status != userAllowed)
213- else false)
214- then throw("You cant set this status, user is not registered.")
215- else if (if ((currentStatus == userAllowed))
216- then (status == userAllowed)
217- else false)
218- then throw("User already allowed")
219- else if (if ((currentStatus == userRegistered))
220- then (status == userAllowed)
221- else false)
222- then throw("User already allowed & registered")
223- else if (if ((currentStatus == userVerified))
224- then (status == userAllowed)
225- else false)
226- then throw("User already allowed & verified")
227- else if (containsElement([chris, joep, toString(this)], caller))
228- then [StringEntry(keyUserStatus(address), statusToSet)]
229- else throw("Not allowed to change user status")
199+ let statusToSet = validateNewStatus(status, address, currentStatus)
200+ let name = toBase64String(toBytes(getStringByKey(keyUserName(address))))
201+ let thumb = toBase64String(toBytes(getStringByKey(keyUserThumb(address))))
202+ let date = getIntegerByKey(keyUserDate(address))
203+ let json = makeJSON(name, thumb, toString(date))
204+ if (containsElement([chris, joep, toString(this)], caller))
205+ then [StringEntry(keyUserStatus(address), statusToSet), DeleteEntry(((currentStatus + "_") + address)), StringEntry(((statusToSet + "_") + address), json)]
206+ else throw("Not allowed to change user status")
230207 }
231208
232209
233210
234-@Callable(i)
235-func creditUser (address) = {
236- let caller = toString(addressFromPublicKey(i.callerPublicKey))
237- let id = toBase58String(i.transactionId)
238- if (containsElement([chris, joep], caller))
239- then [ScriptTransfer(Address(fromBase58String(address)), 30000000000, signAssetId)]
211+@Callable(invoke)
212+func deleteUser (address) = {
213+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
214+ let id = toBase58String(invoke.transactionId)
215+ let currentStatus = getStringByKey(keyUserStatus(address))
216+ if (containsElement([chris, toString(this)], caller))
217+ then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), DeleteEntry(((currentStatus + "_") + address)), StringEntry(keyUserStatus(address), userRemoved)]
240218 else throw("Not allowed")
241- }
242-
243-
244-
245-@Callable(i)
246-func deleteUser (address) = {
247- let caller = toString(addressFromPublicKey(i.callerPublicKey))
248- let id = toBase58String(i.transactionId)
249- if (containsElement([chris, joep, toString(this)], caller))
250- then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), StringEntry(keyUserStatus(address), userRemoved)]
251- else throw("Not allowed")
252- }
253-
254-
255-
256-@Callable(i)
257-func deleteEntry (entry) = {
258- let caller = toString(addressFromPublicKey(i.callerPublicKey))
259- if ((caller == chris))
260- then [DeleteEntry(entry)]
261- else throw("no")
262219 }
263220
264221
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4+let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp"
5+
6+let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN"
7+
48 let dappRunningKey = "conf_dapp_is_running"
59
610 let maintenanceMSGKey = "conf_maintenance_msg"
711
812 let whitelistedonlyKey = "conf_whitelisted_only"
913
10-let dappRunning = match getBoolean(this, dappRunningKey) {
11- case a: Boolean =>
12- a
13- case _ =>
14- true
15-}
14+let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true)
1615
17-let maintenanceMSG = match getString(this, maintenanceMSGKey) {
18- case a: String =>
19- a
20- case _ =>
21- ""
22-}
16+let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "")
2317
24-let whitelistedonly = match getBoolean(this, whitelistedonlyKey) {
25- case a: Boolean =>
26- a
27- case _ =>
28- true
29-}
30-
31-let signAssetId = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a'
32-
33-let chris = "3MsG6jPNCrVJUtYB7XJBxS7utWsXAf4n9Vp"
34-
35-let joep = "3Mzm4VLwsN9uZwbTMzPj3XuxV6kEfAR8UDN"
18+let whitelistedonly = valueOrElse(getBoolean(this, whitelistedonlyKey), true)
3619
3720 let userAllowed = "ALLOWED"
3821
3922 let userRegistered = "REGISTERED"
4023
4124 let userVerified = "VERIFIED"
4225
4326 let userSuspended = "SUSPENDED"
4427
4528 let userRemoved = "REMOVED"
4629
4730 let userChangeRequired = "CHANGE_REQUIRED"
4831
4932 let userUnregistered = "UNREGISTERED"
5033
5134 let userReset = "RESET"
5235
53-func getStringByKey (key) = match getString(this, key) {
54- case a: String =>
55- a
56- case _ =>
57- ""
58-}
36+func getStringByKey (key) = valueOrElse(getString(this, key), "")
5937
6038
61-func getBooleanByKey (key) = match getBoolean(this, key) {
62- case a: Boolean =>
63- a
64- case _ =>
65- false
66-}
39+func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false)
6740
6841
69-func getIntegerByKey (key) = match getInteger(this, key) {
70- case i: Int =>
71- i
72- case _ =>
73- 0
74-}
75-
76-
77-func validateCID (cid) = if (if ((75 > size(cid)))
78- then (60 > size(split(cid, "/")[0]))
79- else false)
80- then (16 > size(split(cid, "/")[1]))
81- else false
42+func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0)
8243
8344
8445 func keyUserAddr (caller) = ("user_" + caller)
8546
8647
8748 func keyUserName (caller) = ("user_name_" + caller)
8849
8950
9051 func keyUserDesc (caller) = ("user_desc_" + caller)
9152
9253
9354 func keyUserSocial (caller) = ("user_social_" + caller)
9455
9556
9657 func keyUserThumb (caller) = ("user_thumb_" + caller)
9758
9859
9960 func keyUserStatus (caller) = ("user_status_" + caller)
10061
10162
10263 func keyUserDate (caller) = ("user_date_" + caller)
10364
10465
105-@Callable(i)
66+func validUserData (caller,name,description,isAnUpdate) = if (if ((name == ""))
67+ then true
68+ else (description == ""))
69+ then throw("Name and description cannot be empty")
70+ else if ((size(description) > 600))
71+ then throw("600 Char. max description")
72+ else if ((size(name) > 45))
73+ then throw("45 Char. max name")
74+ else {
75+ let status = getStringByKey(keyUserStatus(caller))
76+ if (if ((status == userSuspended))
77+ then true
78+ else (status == userRemoved))
79+ then throw("Account suspended/ removed.")
80+ else if (if (!(isAnUpdate))
81+ then (status == userRegistered)
82+ else false)
83+ then throw("Already registered")
84+ else if (if (if (!(isAnUpdate))
85+ then (status == "")
86+ else false)
87+ then whitelistedonly
88+ else false)
89+ then throw("Can't register, get approved first.")
90+ else if (if (if (isAnUpdate)
91+ then (status == "")
92+ else false)
93+ then true
94+ else if (isAnUpdate)
95+ then (status == userAllowed)
96+ else false)
97+ then throw("Register first")
98+ else true
99+ }
100+
101+
102+func validateNewStatus (status,address,currentStatus) = {
103+ let allStatus = [userVerified, userRegistered, userSuspended, userRemoved, userAllowed, userChangeRequired]
104+ let statusToSet = if (containsElement(allStatus, status))
105+ then status
106+ else if (if ((status == userReset))
107+ then (currentStatus == userAllowed)
108+ else false)
109+ then ""
110+ else throw("Unknown status")
111+ let userIsRegistered = getIntegerByKey(keyUserDate(address))
112+ if (if ((userIsRegistered == 0))
113+ then (statusToSet != userAllowed)
114+ else false)
115+ then throw("You cant set this status, user is not registered.")
116+ else if (if ((currentStatus == userAllowed))
117+ then (statusToSet == userAllowed)
118+ else false)
119+ then throw("User already allowed")
120+ else if (if ((currentStatus == userRegistered))
121+ then (statusToSet == userAllowed)
122+ else false)
123+ then throw("User already allowed & registered")
124+ else if (if ((currentStatus == userVerified))
125+ then (statusToSet == userAllowed)
126+ else false)
127+ then throw("User already allowed & verified")
128+ else statusToSet
129+ }
130+
131+
132+func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}")
133+
134+
135+@Callable(invoke)
106136 func appRunning (isLive,message) = {
107- let caller = toString(addressFromPublicKey(i.callerPublicKey))
108- let id = toBase58String(i.transactionId)
137+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
138+ let id = toBase58String(invoke.transactionId)
109139 if (containsElement([chris, joep, toString(this)], caller))
110140 then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)]
111141 else throw("You are not allowed to change this")
112142 }
113143
114144
115145
116-@Callable(i)
146+@Callable(invoke)
117147 func registrationMode (WLonly) = {
118- let caller = toString(addressFromPublicKey(i.callerPublicKey))
119- let id = toBase58String(i.transactionId)
120- if (containsElement([chris, joep, toString(this)], caller))
148+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
149+ let id = toBase58String(invoke.transactionId)
150+ if (containsElement([chris, toString(this)], caller))
121151 then [BooleanEntry(whitelistedonlyKey, WLonly)]
122152 else throw("You are not allowed to change this")
123153 }
124154
125155
126156
127-@Callable(i)
157+@Callable(invoke)
128158 func registerUser (name,description,thumb,social) = if (!(dappRunning))
129159 then throw(maintenanceMSG)
130160 else {
131- let caller = toString(addressFromPublicKey(i.callerPublicKey))
132- let canRegister = getStringByKey(keyUserStatus(caller))
133- let id = toBase58String(i.transactionId)
161+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
162+ let id = toBase58String(invoke.transactionId)
134163 let timestamp = lastBlock.timestamp
135- if (if ((canRegister == userSuspended))
136- then true
137- else (canRegister == userRemoved))
138- then throw("Account suspended/ removed.")
139- else if ((canRegister == userRegistered))
140- then throw("Already registered")
141- else if (if ((canRegister == ""))
142- then whitelistedonly
143- else false)
144- then throw("Can't register, get approved first.")
145- else if (if ((name == ""))
146- then true
147- else (description == ""))
148- then throw("Name and description cannot be empty")
149- else if ((size(description) > 600))
150- then throw("600 Char. max description")
151- else if ((size(name) > 45))
152- then throw("45 Char. max name")
153- 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)]
164+ if (!(validUserData(caller, name, description, false)))
165+ then throw("Something went wrong")
166+ else {
167+ let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp))
168+[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), DeleteEntry(("ALLOWED_" + caller)), StringEntry(((userRegistered + "_") + caller), json)]
169+ }
154170 }
155171
156172
157173
158-@Callable(i)
174+@Callable(invoke)
159175 func updateUser (name,description,thumb,social) = if (!(dappRunning))
160176 then throw(maintenanceMSG)
161177 else {
162- let caller = toString(addressFromPublicKey(i.callerPublicKey))
163- let id = toBase58String(i.transactionId)
164- let canUpdate = getStringByKey(keyUserStatus(caller))
165- if (if ((canUpdate == userSuspended))
166- then true
167- else (canUpdate == userRemoved))
168- then throw("Account suspended/ removed.")
169- else if (if ((canUpdate == ""))
170- then true
171- else (canUpdate == userAllowed))
172- then throw("Register first")
173- else if (if ((name == ""))
174- then true
175- else (description == ""))
176- then throw("Name & description cannot be empty")
177- else if ((size(description) > 600))
178- then throw("600 Char. max for description")
179- else if ((size(name) > 45))
180- then throw("45 Char. max name")
181- else [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb)]
178+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
179+ let id = toBase58String(invoke.transactionId)
180+ let status = getStringByKey(keyUserStatus(caller))
181+ if (!(validUserData(caller, name, description, true)))
182+ then throw("Something went wrong")
183+ else {
184+ let date = getIntegerByKey(keyUserDate(caller))
185+ let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date))
186+[StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(((status + "_") + caller), json)]
187+ }
182188 }
183189
184190
185191
186-@Callable(i)
192+@Callable(invoke)
187193 func changeUserStatus (address,status) = if (!(dappRunning))
188194 then throw(maintenanceMSG)
189195 else {
190- let caller = toString(addressFromPublicKey(i.callerPublicKey))
191- let id = toBase58String(i.transactionId)
196+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
197+ let id = toBase58String(invoke.transactionId)
192198 let currentStatus = getStringByKey(keyUserStatus(address))
193- let statusToSet = if ((status == userVerified))
194- then userVerified
195- else if ((status == userRegistered))
196- then userRegistered
197- else if ((status == userSuspended))
198- then userSuspended
199- else if ((status == userRemoved))
200- then userRemoved
201- else if ((status == userAllowed))
202- then userAllowed
203- else if ((status == userChangeRequired))
204- then userChangeRequired
205- else if (if ((status == userReset))
206- then (currentStatus == userAllowed)
207- else false)
208- then ""
209- else throw("Unknown status")
210- let userIsRegistered = getIntegerByKey(keyUserDate(address))
211- if (if ((userIsRegistered == 0))
212- then (status != userAllowed)
213- else false)
214- then throw("You cant set this status, user is not registered.")
215- else if (if ((currentStatus == userAllowed))
216- then (status == userAllowed)
217- else false)
218- then throw("User already allowed")
219- else if (if ((currentStatus == userRegistered))
220- then (status == userAllowed)
221- else false)
222- then throw("User already allowed & registered")
223- else if (if ((currentStatus == userVerified))
224- then (status == userAllowed)
225- else false)
226- then throw("User already allowed & verified")
227- else if (containsElement([chris, joep, toString(this)], caller))
228- then [StringEntry(keyUserStatus(address), statusToSet)]
229- else throw("Not allowed to change user status")
199+ let statusToSet = validateNewStatus(status, address, currentStatus)
200+ let name = toBase64String(toBytes(getStringByKey(keyUserName(address))))
201+ let thumb = toBase64String(toBytes(getStringByKey(keyUserThumb(address))))
202+ let date = getIntegerByKey(keyUserDate(address))
203+ let json = makeJSON(name, thumb, toString(date))
204+ if (containsElement([chris, joep, toString(this)], caller))
205+ then [StringEntry(keyUserStatus(address), statusToSet), DeleteEntry(((currentStatus + "_") + address)), StringEntry(((statusToSet + "_") + address), json)]
206+ else throw("Not allowed to change user status")
230207 }
231208
232209
233210
234-@Callable(i)
235-func creditUser (address) = {
236- let caller = toString(addressFromPublicKey(i.callerPublicKey))
237- let id = toBase58String(i.transactionId)
238- if (containsElement([chris, joep], caller))
239- then [ScriptTransfer(Address(fromBase58String(address)), 30000000000, signAssetId)]
211+@Callable(invoke)
212+func deleteUser (address) = {
213+ let caller = toString(addressFromPublicKey(invoke.callerPublicKey))
214+ let id = toBase58String(invoke.transactionId)
215+ let currentStatus = getStringByKey(keyUserStatus(address))
216+ if (containsElement([chris, toString(this)], caller))
217+ then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), DeleteEntry(((currentStatus + "_") + address)), StringEntry(keyUserStatus(address), userRemoved)]
240218 else throw("Not allowed")
241- }
242-
243-
244-
245-@Callable(i)
246-func deleteUser (address) = {
247- let caller = toString(addressFromPublicKey(i.callerPublicKey))
248- let id = toBase58String(i.transactionId)
249- if (containsElement([chris, joep, toString(this)], caller))
250- then [DeleteEntry(keyUserDate(address)), DeleteEntry(keyUserAddr(address)), DeleteEntry(keyUserName(address)), DeleteEntry(keyUserDesc(address)), DeleteEntry(keyUserSocial(address)), DeleteEntry(keyUserThumb(address)), StringEntry(keyUserStatus(address), userRemoved)]
251- else throw("Not allowed")
252- }
253-
254-
255-
256-@Callable(i)
257-func deleteEntry (entry) = {
258- let caller = toString(addressFromPublicKey(i.callerPublicKey))
259- if ((caller == chris))
260- then [DeleteEntry(entry)]
261- else throw("no")
262219 }
263220
264221

github/deemru/w8io/026f985 
53.52 ms