tx · 4H3AaSGtRRNRjWLJV3kqndyiy7NyFSdYHH39WvPCQits

3N3r2srkFiS6xvSDY9xVPgF2Yjz8djnd3cN:  -0.01400000 Waves

2022.09.07 07:49 [2218230] smart account 3N3r2srkFiS6xvSDY9xVPgF2Yjz8djnd3cN > SELF 0.00000000 Waves

{ "type": 13, "id": "4H3AaSGtRRNRjWLJV3kqndyiy7NyFSdYHH39WvPCQits", "fee": 1400000, "feeAssetId": null, "timestamp": 1662526163710, "version": 2, "chainId": 84, "sender": "3N3r2srkFiS6xvSDY9xVPgF2Yjz8djnd3cN", "senderPublicKey": "Ea9xszKCieHW2X9h4i9PEKXbMC4GDCkHwLoK3FY5T6nC", "proofs": [ "6jhLqQbDLJBPeLMdWhVFCru5QbSTkhvoyME4bjmZoVijFGmheShJoTNrQeoRQq5HifJwQKVY7EzfhjbgizLebsP" ], "script": "base64:BgIqCAISBAoCCAgSBAoCBAgSBgoECAgICBIGCgQICAgIEgUKAwgICBIDCgEIHgAHVkVSU0lPTgIDMC4xAQ5nZXRTdHJpbmdCeUtleQEDa2V5CQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMFA2tleQIAAQ9nZXRCb29sZWFuQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmwgCBQR0aGlzBQNrZXkHAQ9nZXRJbnRlZ2VyQnlLZXkBA2tleQkBC3ZhbHVlT3JFbHNlAgkAmggCBQR0aGlzBQNrZXkAAAAFY2hyaXMJAQ5nZXRTdHJpbmdCeUtleQECDGNvbmZfYWRtaW5fMQAOZGFwcFJ1bm5pbmdLZXkCFGNvbmZfZGFwcF9pc19ydW5uaW5nABFtYWludGVuYW5jZU1TR0tleQIUY29uZl9tYWludGVuYW5jZV9tc2cAEndoaXRlbGlzdGVkb25seUtleQIVY29uZl93aGl0ZWxpc3RlZF9vbmx5AAtkYXBwUnVubmluZwkBC3ZhbHVlT3JFbHNlAgkAmwgCBQR0aGlzBQ5kYXBwUnVubmluZ0tleQYADm1haW50Z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2UgdXNlciBzdGF0dXMBaQELZGVsZXRlRW50cnkBBWVudHJ5BAZjYWxsZXIJAKUIAQgFAWkGY2FsbGVyAwkAAAIFBmNhbGxlcgUFY2hyaXMJAMwIAgkBC0RlbGV0ZUVudHJ5AQUFZW50cnkFA25pbAkAAgECAm5vAKdJYxY=", "height": 2218230, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DUd4d7LEHHd6gUQchThYoW7fCawH1YLwroy7tDCW1yW2 Next: Dt8coWdSc5QNzHdEka83612oEkAAhV21ufHbWyF4S9pi Diff:
OldNewDifferences
5757
5858
5959 let currentCertificationPrice = (getIntegerByKeyFromOracle(("certification_fee_" + toBase58String(signAssetId))) * 2)
60+
61+let feeReceiver = getStringByKey("conf_fee_receiver")
6062
6163 func validateCID (cid) = if (contains(cid, "/"))
6264 then if (if ((76 > size(cid)))
131133
132134
133135 func validatePayment (i) = {
134- let $t039223958 = isPayment(i)
135- let payment = $t039223958._1
136- let amount = $t039223958._2
136+ let $t039774013 = isPayment(i)
137+ let payment = $t039774013._1
138+ let amount = $t039774013._2
137139 let assetId = if (if (isDefined(payment.assetId))
138140 then (payment.assetId == signAssetId)
139141 else false)
172174 let caller = toString(invoke.caller)
173175 let id = toBase58String(invoke.transactionId)
174176 let timestamp = lastBlock.timestamp
175- let $t054535500 = validatePayment(invoke)
176- let amount = $t054535500._1
177- let assetId = $t054535500._2
177+ let $t055205567 = validatePayment(invoke)
178+ let amount = $t055205567._1
179+ let assetId = $t055205567._2
178180 if (!(isDefined(amount)))
179181 then throw("Something went wrong")
180182 else if (!(validUserData(caller, name, description, thumb, false)))
181183 then throw("Something went wrong")
182184 else {
183185 let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp))
184-[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)]
186+[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), ScriptTransfer(Address(fromBase58String(feeReceiver)), amount, assetId)]
185187 }
186188 }
187189
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let VERSION = "0.1"
55
66 func getStringByKey (key) = valueOrElse(getString(this, key), "")
77
88
99 func getBooleanByKey (key) = valueOrElse(getBoolean(this, key), false)
1010
1111
1212 func getIntegerByKey (key) = valueOrElse(getInteger(this, key), 0)
1313
1414
1515 let chris = getStringByKey("conf_admin_1")
1616
1717 let dappRunningKey = "conf_dapp_is_running"
1818
1919 let maintenanceMSGKey = "conf_maintenance_msg"
2020
2121 let whitelistedonlyKey = "conf_whitelisted_only"
2222
2323 let dappRunning = valueOrElse(getBoolean(this, dappRunningKey), true)
2424
2525 let maintenanceMSG = valueOrElse(getString(this, maintenanceMSGKey), "")
2626
2727 let userSuspended = "SUSPENDED"
2828
2929 let userRegistered = "REGISTERED"
3030
3131 func keyUserAddr (caller) = ("user_" + caller)
3232
3333
3434 func keyUserName (caller) = ("user_name_" + caller)
3535
3636
3737 func keyUserDesc (caller) = ("user_desc_" + caller)
3838
3939
4040 func keyUserSocial (caller) = ("user_social_" + caller)
4141
4242
4343 func keyUserThumb (caller) = ("user_thumb_" + caller)
4444
4545
4646 func keyUserStatus (caller) = ("user_status_" + caller)
4747
4848
4949 func keyUserDate (caller) = ("user_date_" + caller)
5050
5151
5252 let signAssetId = fromBase58String(getStringByKey("conf_accepted_asset_SIGN"))
5353
5454 let oracleFeeAddress = value(addressFromString(getStringByKey("conf_oracle_fee_address")))
5555
5656 func getIntegerByKeyFromOracle (key) = valueOrErrorMessage(getInteger(oracleFeeAddress, key), "Integer undefine or 0 in oracle")
5757
5858
5959 let currentCertificationPrice = (getIntegerByKeyFromOracle(("certification_fee_" + toBase58String(signAssetId))) * 2)
60+
61+let feeReceiver = getStringByKey("conf_fee_receiver")
6062
6163 func validateCID (cid) = if (contains(cid, "/"))
6264 then if (if ((76 > size(cid)))
6365 then (size(split(cid, "/")[0]) == 59)
6466 else false)
6567 then (16 > size(split(cid, "/")[1]))
6668 else false
6769 else false
6870
6971
7072 func validUserData (caller,name,description,thumb,isAnUpdate) = {
7173 let validCID = if ((size(thumb) != 0))
7274 then validateCID(thumb)
7375 else true
7476 if (!(validCID))
7577 then throw("CID don't match requirement!")
7678 else if (if ((name == ""))
7779 then true
7880 else (description == ""))
7981 then throw("Name and description cannot be empty")
8082 else if ((size(description) > 600))
8183 then throw("600 Char. max description")
8284 else if ((size(name) > 45))
8385 then throw("45 Char. max name")
8486 else {
8587 let status = getStringByKey(keyUserStatus(caller))
8688 if ((status == userSuspended))
8789 then throw("Account suspended.")
8890 else if (if (!(isAnUpdate))
8991 then (status == userRegistered)
9092 else false)
9193 then throw("Already registered")
9294 else if (if (isAnUpdate)
9395 then (status == "")
9496 else false)
9597 then throw("Register first")
9698 else true
9799 }
98100 }
99101
100102
101103 func validateNewStatus (status,address,currentStatus) = {
102104 let allStatus = [userRegistered, userSuspended]
103105 let statusToSet = if (containsElement(allStatus, status))
104106 then status
105107 else throw("Unknown status")
106108 let userIsRegistered = getIntegerByKey(keyUserDate(address))
107109 if ((userIsRegistered == 0))
108110 then throw("You cant set this status, user is not registered.")
109111 else if (if ((currentStatus == userRegistered))
110112 then (statusToSet == userRegistered)
111113 else false)
112114 then throw("User already registered")
113115 else if (if ((currentStatus == userSuspended))
114116 then (statusToSet == userSuspended)
115117 else false)
116118 then throw("User already suspended")
117119 else statusToSet
118120 }
119121
120122
121123 func makeJSON (name,thumb,date) = (((((("{\"user_name\": \"" + name) + "\", \"user_thumb\":\"") + thumb) + "\",\"user_date\":\"") + date) + "\"}")
122124
123125
124126 func isPayment (i) = if ((size(i.payments) == 0))
125127 then throw("No payment attached")
126128 else {
127129 let payment = value(i.payments[0])
128130 let amount = value(payment.amount)
129131 $Tuple2(payment, amount)
130132 }
131133
132134
133135 func validatePayment (i) = {
134- let $t039223958 = isPayment(i)
135- let payment = $t039223958._1
136- let amount = $t039223958._2
136+ let $t039774013 = isPayment(i)
137+ let payment = $t039774013._1
138+ let amount = $t039774013._2
137139 let assetId = if (if (isDefined(payment.assetId))
138140 then (payment.assetId == signAssetId)
139141 else false)
140142 then payment.assetId
141143 else throw("Only SIGN token accepted as transaction fee")
142144 if ((amount != currentCertificationPrice))
143145 then throw(("Payment amount should be " + toString(currentCertificationPrice)))
144146 else $Tuple2(amount, assetId)
145147 }
146148
147149
148150 @Callable(invoke)
149151 func setConf (key,val) = {
150152 let caller = toString(invoke.caller)
151153 if (containsElement([chris, toString(this)], caller))
152154 then [StringEntry(key, val)]
153155 else throw("You are not allowed to change this")
154156 }
155157
156158
157159
158160 @Callable(invoke)
159161 func appRunning (isLive,message) = {
160162 let caller = toString(invoke.caller)
161163 if (containsElement([chris, toString(this)], caller))
162164 then [BooleanEntry(dappRunningKey, isLive), StringEntry(maintenanceMSGKey, message)]
163165 else throw("You are not allowed to change this")
164166 }
165167
166168
167169
168170 @Callable(invoke)
169171 func registerUser (name,description,thumb,social) = if (!(dappRunning))
170172 then throw(maintenanceMSG)
171173 else {
172174 let caller = toString(invoke.caller)
173175 let id = toBase58String(invoke.transactionId)
174176 let timestamp = lastBlock.timestamp
175- let $t054535500 = validatePayment(invoke)
176- let amount = $t054535500._1
177- let assetId = $t054535500._2
177+ let $t055205567 = validatePayment(invoke)
178+ let amount = $t055205567._1
179+ let assetId = $t055205567._2
178180 if (!(isDefined(amount)))
179181 then throw("Something went wrong")
180182 else if (!(validUserData(caller, name, description, thumb, false)))
181183 then throw("Something went wrong")
182184 else {
183185 let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(timestamp))
184-[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)]
186+[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), ScriptTransfer(Address(fromBase58String(feeReceiver)), amount, assetId)]
185187 }
186188 }
187189
188190
189191
190192 @Callable(invoke)
191193 func updateUser (name,description,thumb,social) = if (!(dappRunning))
192194 then throw(maintenanceMSG)
193195 else {
194196 let caller = toString(invoke.caller)
195197 let status = getStringByKey(keyUserStatus(caller))
196198 if (!(validUserData(caller, name, description, thumb, true)))
197199 then throw("Something went wrong")
198200 else {
199201 let date = getIntegerByKey(keyUserDate(caller))
200202 let json = makeJSON(toBase64String(toBytes(name)), toBase64String(toBytes(thumb)), toString(date))
201203 [StringEntry(keyUserName(caller), name), StringEntry(keyUserDesc(caller), description), StringEntry(keyUserSocial(caller), social), StringEntry(keyUserThumb(caller), thumb), StringEntry(((status + "_") + caller), json)]
202204 }
203205 }
204206
205207
206208
207209 @Callable(invoke)
208210 func changeUserStatus (address,status,note) = {
209211 let caller = toString(invoke.caller)
210212 let currentStatus = getStringByKey(keyUserStatus(address))
211213 let statusToSet = validateNewStatus(status, address, currentStatus)
212214 let name = toBase64String(toBytes(getStringByKey(keyUserName(address))))
213215 let thumb = toBase64String(toBytes(getStringByKey(keyUserThumb(address))))
214216 let date = getIntegerByKey(keyUserDate(address))
215217 let json = makeJSON(name, thumb, toString(date))
216218 if (containsElement([chris, toString(this)], caller))
217219 then [StringEntry(keyUserStatus(address), statusToSet), DeleteEntry(((currentStatus + "_") + address)), StringEntry(((statusToSet + "_") + address), json), StringEntry(("user_note_" + address), note)]
218220 else throw("Not allowed to change user status")
219221 }
220222
221223
222224
223225 @Callable(i)
224226 func deleteEntry (entry) = {
225227 let caller = toString(i.caller)
226228 if ((caller == chris))
227229 then [DeleteEntry(entry)]
228230 else throw("no")
229231 }
230232
231233

github/deemru/w8io/026f985 
35.65 ms