tx · 79wA1EwicJZemuFbMcSHaz4HAujU8HeRfG2DmXMp3UA9

3N5MerXBH5LejNxKNjAoJm4pS1TMNV3QAcP:  -0.01400000 Waves

2019.11.11 08:25 [759952] smart account 3N5MerXBH5LejNxKNjAoJm4pS1TMNV3QAcP > SELF 0.00000000 Waves

{ "type": 13, "id": "79wA1EwicJZemuFbMcSHaz4HAujU8HeRfG2DmXMp3UA9", "fee": 1400000, "feeAssetId": null, "timestamp": 1573449951407, "version": 1, "sender": "3N5MerXBH5LejNxKNjAoJm4pS1TMNV3QAcP", "senderPublicKey": "H1FQXSdk2DP6ZCTNadYpdigGZXT4k5ezfch9ur9JHQPb", "proofs": [ "5yHva63Aapkn8QwcYrUVbi2mbZLJfGYkR3zxfXg78EpgL1ywA4iEbbBEYe3f7yqwTDqkWT12swLUKKqg9GJ1bDRv" ], "script": "base64:AAIDAAAAAAAAABwIARIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIAAAACQAAAAANZEFwcFB1YmxpY0tleQEAAAAg7ctHf1T8+ZuRelMjtxnN82PzKimbNwhAqjDdhbonmSoAAAAAEndoaXRlbGlzdGluZ1N1ZmZpeAIAAAAMX3doaXRlbGlzdGVkAAAAABJibGFja2xpc3RpbmdTdWZmaXgCAAAADF9ibGFja2xpc3RlZAAAAAARYmlydGhSZWNvcmRTdWZmaXgCAAAABl9hbGl2ZQAAAAARZGVhdGhSZWNvcmRTdWZmaXgCAAAACV9kZWNlYXNlZAEAAAAPZ2V0TGlzdEZyb21EYXRhAAAAAQAAAANrZXkEAAAADWdldERhdGFTdHJpbmcJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5BAAAAAlwdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAADWdldERhdGFTdHJpbmcDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAAJcHVibGljS2V5BQAAAAckbWF0Y2gwBQAAAAlwdWJsaWNLZXkJAAACAAAAAQIAAAASQWNjb3VudCBub3QgZm91b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AAAAAAAAQUAAAAPY2FsbGVyUHVibGljS2V5CQEAAAANaXNCbGFja2xpc3RlZAAAAAEFAAAAD2NhbGxlclB1YmxpY0tleQcJAAACAAAAAQIAAAA2VGhpcyBhY2NvdW50IGhhcyBiZWVuIGJsYWNrbGlzdGVkLiBDb250YWN0IGRBcHAgT3duZXIhCQAAAgAAAAECAAAATUFjY2VzcyBkZW5pZWQuIE9ubHkgdGhlIGFjY291bnQgdGhhdCBjcmVhdGVkIHRoaXMgcmVjb3JkIGNhbiBtYWtlIGl0IGRlY2Vhc2VkCQAAAgAAAAECAAAAJ1lvdSBhcmUgbm90IGF1dGhvcml6ZWQgZm9yIHRoaXMgYWN0aW9uIQAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADWRBcHBQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAAFlBQAAAAckbWF0Y2gwAwkBAAAADWlzV2hpdGVsaXN0ZWQAAAABCQACWAAAAAEIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAANZEFwcFB1YmxpY0tleQdK18+3", "chainId": 84, "height": 759952, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let dAppPublicKey = base58'H1FQXSdk2DP6ZCTNadYpdigGZXT4k5ezfch9ur9JHQPb'
5+
6+let whitelistingSuffix = "_whitelisted"
7+
8+let blacklistingSuffix = "_blacklisted"
9+
10+let birthRecordSuffix = "_alive"
11+
12+let deathRecordSuffix = "_deceased"
13+
14+func getListFromData (key) = {
15+ let getDataString = getString(this, key)
16+ let publicKey = match getDataString {
17+ case publicKey: String =>
18+ publicKey
19+ case _ =>
20+ throw("Account not found!")
21+ }
22+ split(publicKey, "_")
23+ }
24+
25+
26+func isWhitelisted (publicKey) = {
27+ let whitelistedKey = getString(this, publicKey)
28+ if (isDefined(whitelistedKey))
29+ then {
30+ let whitelistedDataList = getListFromData(publicKey)
31+ if ((whitelistedDataList[1] == "whitelisted"))
32+ then true
33+ else false
34+ }
35+ else false
36+ }
37+
38+
39+func isBlacklisted (publicKey) = {
40+ let blacklistedKey = getString(this, publicKey)
41+ if (isDefined(blacklistedKey))
42+ then {
43+ let blacklistedDataList = getListFromData(publicKey)
44+ if ((blacklistedDataList[1] == "blacklisted"))
45+ then true
46+ else false
47+ }
48+ else false
49+ }
50+
51+
52+func getPositiveRecordKey (intendedKey) = if ((0 > intendedKey))
53+ then -(intendedKey)
54+ else intendedKey
55+
56+
57+@Callable(i)
58+func whitelist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
59+ then if (isWhitelisted(publicKey))
60+ then throw("This account has already been whitelisted!")
61+ else {
62+ let whitelistedValue = (publicKey + whitelistingSuffix)
63+ WriteSet([DataEntry(publicKey, whitelistedValue)])
64+ }
65+ else throw("You are not authorized to whitelist accounts. Contact dApp Owner!")
66+
67+
68+
69+@Callable(i)
70+func blacklist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
71+ then if (isWhitelisted(publicKey))
72+ then {
73+ let blacklistedValue = (publicKey + blacklistingSuffix)
74+ WriteSet([DataEntry(publicKey, blacklistedValue)])
75+ }
76+ else if (isBlacklisted(publicKey))
77+ then throw("This account has already been blacklisted!")
78+ else throw("This account was never whitelisted. Do verify!")
79+ else throw("You are not authorized to blacklist accounts. Contact dApp Owner!")
80+
81+
82+
83+@Callable(i)
84+func addBirthRecord (record) = {
85+ let callerPublicKey = toBase58String(i.callerPublicKey)
86+ if (isWhitelisted(callerPublicKey))
87+ then {
88+ let birthRecordKey = toString(getPositiveRecordKey(toInt(i.transactionId)))
89+ let transactionId = ("_" + toBase58String(i.transactionId))
90+ let birthRecordValue = ((((record + "_") + callerPublicKey) + transactionId) + birthRecordSuffix)
91+ WriteSet([DataEntry(birthRecordKey, birthRecordValue)])
92+ }
93+ else if (isBlacklisted(callerPublicKey))
94+ then throw("This account has been blacklisted")
95+ else throw("Only authorized accounts can add birth records to the blockchain")
96+ }
97+
98+
99+
100+@Callable(i)
101+func updateRecord (recordId,newRecord) = {
102+ let callerPublicKey = toBase58String(i.callerPublicKey)
103+ if (isWhitelisted(callerPublicKey))
104+ then {
105+ let record = getString(this, recordId)
106+ if (!(isDefined(record)))
107+ then throw("Record not found")
108+ else {
109+ let recordData = match getString(this, recordId) {
110+ case a: String =>
111+ a
112+ case _ =>
113+ throw("Record not found")
114+ }
115+ let recordList = split(recordData, "_")
116+ if ((recordList[1] == callerPublicKey))
117+ then {
118+ let newRecordValue = ((((newRecord + "_") + callerPublicKey) + "_") + recordList[2])
119+ WriteSet([DataEntry(recordId, newRecordValue)])
120+ }
121+ else if (if ((recordList[1] == callerPublicKey))
122+ then isBlacklisted(callerPublicKey)
123+ else false)
124+ then throw("This account has been blacklisted. Contact dApp Owner!")
125+ else throw("Access denied. Only the account that created this record can update it.")
126+ }
127+ }
128+ else throw("You are not authorized for this action!")
129+ }
130+
131+
132+
133+@Callable(i)
134+func makeDeceased (recordId) = {
135+ let callerPublicKey = toBase58String(i.callerPublicKey)
136+ if (isWhitelisted(callerPublicKey))
137+ then {
138+ let record = getString(this, recordId)
139+ if (!(isDefined(record)))
140+ then throw("Record not found")
141+ else {
142+ let recordData = match getString(this, recordId) {
143+ case a: String =>
144+ a
145+ case _ =>
146+ throw("Record not found")
147+ }
148+ let recordList = split(recordData, "_")
149+ if ((recordList[1] == callerPublicKey))
150+ then {
151+ let newRecordValue = (((recordList[0] + "_") + callerPublicKey) + deathRecordSuffix)
152+ WriteSet([DataEntry(recordId, newRecordValue)])
153+ }
154+ else if (if ((recordList[1] == callerPublicKey))
155+ then isBlacklisted(callerPublicKey)
156+ else false)
157+ then throw("This account has been blacklisted. Contact dApp Owner!")
158+ else throw("Access denied. Only the account that created this record can make it deceased")
159+ }
160+ }
161+ else throw("You are not authorized for this action!")
162+ }
163+
164+
165+@Verifier(tx)
166+func verify () = match tx {
167+ case d: SetScriptTransaction =>
168+ sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
169+ case e: InvokeScriptTransaction =>
170+ if (isWhitelisted(toBase58String(tx.senderPublicKey)))
171+ then true
172+ else sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
173+ case _ =>
174+ false
175+}
176+

github/deemru/w8io/169f3d6 
23.37 ms