tx · 5hMiiTZDdhkKNGotqSZyLBdrp6R856DbRqZZjoLJnfUi 3N8P9bdRz4kqwJr27kpdTpnXho5m4926LFP: -0.01400000 Waves 2019.11.07 11:02 [754237] smart account 3N8P9bdRz4kqwJr27kpdTpnXho5m4926LFP > SELF 0.00000000 Waves
{ "type": 13, "id": "5hMiiTZDdhkKNGotqSZyLBdrp6R856DbRqZZjoLJnfUi", "fee": 1400000, "feeAssetId": null, "timestamp": 1573113751809, "version": 1, "sender": "3N8P9bdRz4kqwJr27kpdTpnXho5m4926LFP", "senderPublicKey": "A8oSHKLfnzD8QqKKhQMUAq7EVSgWHrXv3FnP4uReunNr", "proofs": [ "uW1JS2rkskDZcyAnvJHZemHyU8E41GnQ684pRtBq4bcc6RwzizxQg2o8RawoZkebwGGqXUoLNjCP6pJsYrDEXd8" ], "script": "base64:AAIDAAAAAAAAABwIARIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIAAAACAAAAAANZEFwcFB1YmxpY0tleQEAAAAgh7jA0zfoNqLQbyKEViCOMw71oJOp0h9SmmKVmHnl0zcAAAAAEndoaXRlbGlzdGluZ1N1ZmZpeAIAAAAMX3doaXRlbGlzdGVkAAAAABJibGFja2xpc3RpbmdTdWZmaXgCAAAADF9ibGFja2xpc3RlZAAAAAARYmlydGhSZWNvcmRTdWZmaXgCAAAABl9hbGl2ZQAAAAARZGVhdGhSZWNvcmRTdWZmaXgCAAAACV9kZWNlYXNlZAEAAAAPZ2V0TGlzdEZyb21EYXRhAAAAAQAAAANrZXkEAAAADWdldERhdGFTdHJpbmcJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5BAAAAAlwdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAADWdldERhdGFTdHJpbmcDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAAJcHVibGljS2V5BQAAAAckbWF0Y2gwBQAAAAlwdWJsaWNLZXkJAAACAAAAAQIAAAASQWNjb3VudCBub3QgZm91bmQhCQAEt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AAA25pbAkAAAIAAAABAgAAAE1BY2Nlc3MgZGVuaWVkLiBPbmx5IHRoZSBhY2NvdW50IHRoYXQgY3JlYXRlZCB0aGlzIHJlY29yZCBjYW4gbWFrZSBpdCBkZWNlYXNlZAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADWRBcHBQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAAFlBQAAAAckbWF0Y2gwAwkBAAAADWlzV2hpdGVsaXN0ZWQAAAABCQACWAAAAAEIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAANZEFwcFB1YmxpY0tleQeg63bB", "chainId": 84, "height": 754237, "spentComplexity": 0 } View: original | compacted Prev: 3LHzvFYkovFtyNQiak2xs4deoNKw1MQwUvTs9g5CqdDe Next: 948rvWsuDhbRDg4WR2dugft5kwxP5LpJfuRKoEVW25th Diff:
Old | New | Differences | |
---|---|---|---|
17 | 17 | case publicKey: String => | |
18 | 18 | publicKey | |
19 | 19 | case _ => | |
20 | - | throw("Account not found") | |
20 | + | throw("Account not found!") | |
21 | 21 | } | |
22 | 22 | split(publicKey, "_") | |
23 | 23 | } | |
52 | 52 | @Callable(i) | |
53 | 53 | func whitelist (publicKey) = if ((i.callerPublicKey == dAppPublicKey)) | |
54 | 54 | then if (isWhitelisted(publicKey)) | |
55 | - | then throw("This account has already been whitelisted") | |
55 | + | then throw("This account has already been whitelisted!") | |
56 | 56 | else { | |
57 | 57 | let whitelistedValue = (publicKey + whitelistingSuffix) | |
58 | 58 | WriteSet([DataEntry(publicKey, whitelistedValue)]) | |
59 | 59 | } | |
60 | - | else throw("You are not authorized to whitelist accounts. Contact dApp Owner") | |
60 | + | else throw("You are not authorized to whitelist accounts. Contact dApp Owner!") | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
68 | 68 | let blacklistedValue = (publicKey + blacklistingSuffix) | |
69 | 69 | WriteSet([DataEntry(publicKey, blacklistedValue)]) | |
70 | 70 | } | |
71 | - | else throw("This account was never whitelisted. Do verify") | |
72 | - | else throw("You are not authorized to blacklist accounts. Contact dApp Owner") | |
71 | + | else if (isBlacklisted(publicKey)) | |
72 | + | then throw("This account has already been blacklisted!") | |
73 | + | else throw("This account was never whitelisted. Do verify!") | |
74 | + | else throw("You are not authorized to blacklist accounts. Contact dApp Owner!") | |
73 | 75 | ||
74 | 76 | ||
75 | 77 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let dAppPublicKey = base58'A8oSHKLfnzD8QqKKhQMUAq7EVSgWHrXv3FnP4uReunNr' | |
5 | 5 | ||
6 | 6 | let whitelistingSuffix = "_whitelisted" | |
7 | 7 | ||
8 | 8 | let blacklistingSuffix = "_blacklisted" | |
9 | 9 | ||
10 | 10 | let birthRecordSuffix = "_alive" | |
11 | 11 | ||
12 | 12 | let deathRecordSuffix = "_deceased" | |
13 | 13 | ||
14 | 14 | func getListFromData (key) = { | |
15 | 15 | let getDataString = getString(this, key) | |
16 | 16 | let publicKey = match getDataString { | |
17 | 17 | case publicKey: String => | |
18 | 18 | publicKey | |
19 | 19 | case _ => | |
20 | - | throw("Account not found") | |
20 | + | throw("Account not found!") | |
21 | 21 | } | |
22 | 22 | split(publicKey, "_") | |
23 | 23 | } | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | func isWhitelisted (publicKey) = { | |
27 | 27 | let whitelistedKey = getString(this, publicKey) | |
28 | 28 | if (isDefined(whitelistedKey)) | |
29 | 29 | then { | |
30 | 30 | let whitelistedDataList = getListFromData(publicKey) | |
31 | 31 | if ((whitelistedDataList[1] == "whitelisted")) | |
32 | 32 | then true | |
33 | 33 | else false | |
34 | 34 | } | |
35 | 35 | else false | |
36 | 36 | } | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func isBlacklisted (publicKey) = { | |
40 | 40 | let blacklistedKey = getString(this, publicKey) | |
41 | 41 | if (isDefined(blacklistedKey)) | |
42 | 42 | then { | |
43 | 43 | let blacklistedDataList = getListFromData(publicKey) | |
44 | 44 | if ((blacklistedDataList[1] == "blacklisted")) | |
45 | 45 | then true | |
46 | 46 | else false | |
47 | 47 | } | |
48 | 48 | else false | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | @Callable(i) | |
53 | 53 | func whitelist (publicKey) = if ((i.callerPublicKey == dAppPublicKey)) | |
54 | 54 | then if (isWhitelisted(publicKey)) | |
55 | - | then throw("This account has already been whitelisted") | |
55 | + | then throw("This account has already been whitelisted!") | |
56 | 56 | else { | |
57 | 57 | let whitelistedValue = (publicKey + whitelistingSuffix) | |
58 | 58 | WriteSet([DataEntry(publicKey, whitelistedValue)]) | |
59 | 59 | } | |
60 | - | else throw("You are not authorized to whitelist accounts. Contact dApp Owner") | |
60 | + | else throw("You are not authorized to whitelist accounts. Contact dApp Owner!") | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | ||
64 | 64 | @Callable(i) | |
65 | 65 | func blacklist (publicKey) = if ((i.callerPublicKey == dAppPublicKey)) | |
66 | 66 | then if (isWhitelisted(publicKey)) | |
67 | 67 | then { | |
68 | 68 | let blacklistedValue = (publicKey + blacklistingSuffix) | |
69 | 69 | WriteSet([DataEntry(publicKey, blacklistedValue)]) | |
70 | 70 | } | |
71 | - | else throw("This account was never whitelisted. Do verify") | |
72 | - | else throw("You are not authorized to blacklist accounts. Contact dApp Owner") | |
71 | + | else if (isBlacklisted(publicKey)) | |
72 | + | then throw("This account has already been blacklisted!") | |
73 | + | else throw("This account was never whitelisted. Do verify!") | |
74 | + | else throw("You are not authorized to blacklist accounts. Contact dApp Owner!") | |
73 | 75 | ||
74 | 76 | ||
75 | 77 | ||
76 | 78 | @Callable(i) | |
77 | 79 | func addBirthRecord (record) = { | |
78 | 80 | let callerPublicKey = toBase58String(i.callerPublicKey) | |
79 | 81 | if (isWhitelisted(callerPublicKey)) | |
80 | 82 | then { | |
81 | 83 | let birthRecordKey = toString(toInt(i.transactionId)) | |
82 | 84 | let birthRecordValue = (((record + "_") + toBase58String(i.callerPublicKey)) + birthRecordSuffix) | |
83 | 85 | WriteSet([DataEntry(birthRecordKey, birthRecordValue)]) | |
84 | 86 | } | |
85 | 87 | else if (isBlacklisted(callerPublicKey)) | |
86 | 88 | then throw("This account has been blacklisted") | |
87 | 89 | else throw("Only authorized accounts can add birth records to the blockchain") | |
88 | 90 | } | |
89 | 91 | ||
90 | 92 | ||
91 | 93 | ||
92 | 94 | @Callable(i) | |
93 | 95 | func updateRecord (recordId,newRecord) = { | |
94 | 96 | let record = getString(this, recordId) | |
95 | 97 | if (!(isDefined(record))) | |
96 | 98 | then throw("Record not found") | |
97 | 99 | else { | |
98 | 100 | let recordData = getStringValue(this, recordId) | |
99 | 101 | let recordList = split(recordData, "_") | |
100 | 102 | if ((recordList[1] == toBase58String(i.callerPublicKey))) | |
101 | 103 | then { | |
102 | 104 | let newRecordValue = ((((newRecord + "_") + toBase58String(i.callerPublicKey)) + "_") + birthRecordSuffix) | |
103 | 105 | WriteSet([DataEntry(recordId, newRecord)]) | |
104 | 106 | } | |
105 | 107 | else throw("Access denied. Only the account that created this record can update it.") | |
106 | 108 | } | |
107 | 109 | } | |
108 | 110 | ||
109 | 111 | ||
110 | 112 | ||
111 | 113 | @Callable(i) | |
112 | 114 | func makeDeceased (recordId) = { | |
113 | 115 | let record = getString(this, recordId) | |
114 | 116 | if (!(isDefined(record))) | |
115 | 117 | then throw("Record not found") | |
116 | 118 | else { | |
117 | 119 | let recordData = getStringValue(this, recordId) | |
118 | 120 | let recordList = split(recordData, "_") | |
119 | 121 | if ((recordList[1] == toBase58String(i.callerPublicKey))) | |
120 | 122 | then { | |
121 | 123 | let newRecord = ((((recordList[0] + "_") + toBase58String(i.callerPublicKey)) + "_") + deathRecordSuffix) | |
122 | 124 | WriteSet([DataEntry(recordId, newRecord)]) | |
123 | 125 | } | |
124 | 126 | else throw("Access denied. Only the account that created this record can make it deceased") | |
125 | 127 | } | |
126 | 128 | } | |
127 | 129 | ||
128 | 130 | ||
129 | 131 | @Verifier(tx) | |
130 | 132 | func verify () = match tx { | |
131 | 133 | case d: SetScriptTransaction => | |
132 | 134 | sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey) | |
133 | 135 | case e: InvokeScriptTransaction => | |
134 | 136 | if (isWhitelisted(toBase58String(tx.senderPublicKey))) | |
135 | 137 | then true | |
136 | 138 | else sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey) | |
137 | 139 | case _ => | |
138 | 140 | false | |
139 | 141 | } | |
140 | 142 |
github/deemru/w8io/026f985 37.36 ms ◑