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:AAIDAAAAAAAAABwIARIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIAAAACAAAAAANZEFwcFB1YmxpY0tleQEAAAAgh7jA0zfoNqLQbyKEViCOMw71oJOp0h9SmmKVmHnl0zcAAAAAEndoaXRlbGlzdGluZ1N1ZmZpeAIAAAAMX3doaXRlbGlzdGVkAAAAABJibGFja2xpc3RpbmdTdWZmaXgCAAAADF9ibGFja2xpc3RlZAAAAAARYmlydGhSZWNvcmRTdWZmaXgCAAAABl9hbGl2ZQAAAAARZGVhdGhSZWNvcmRTdWZmaXgCAAAACV9kZWNlYXNlZAEAAAAPZ2V0TGlzdEZyb21EYXRhAAAAAQAAAANrZXkEAAAADWdldERhdGFTdHJpbmcJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5BAAAAAlwdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAADWdldERhdGFTdHJpbmcDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAAJcHVibGljS2V5BQAAAAckbWF0Y2gwBQAAAAlwdWJsaWNLZXkJAAACAAAAAQIAAAASQWNjb3VudCBub3QgZm91bmQhCQAE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AAAA25pbAkAAAIAAAABAgAAAE1BY2Nlc3MgZGVuaWVkLiBPbmx5IHRoZSBhY2NvdW50IHRoYXQgY3JlYXRlZCB0aGlzIHJlY29yZCBjYW4gbWFrZSBpdCBkZWNlYXNlZAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAEAAAAByRtYXRjaDAFAAAAAnR4AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABRTZXRTY3JpcHRUcmFuc2FjdGlvbgQAAAABZAUAAAAHJG1hdGNoMAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADWRBcHBQdWJsaWNLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAF0ludm9rZVNjcmlwdFRyYW5zYWN0aW9uBAAAAAFlBQAAAAckbWF0Y2gwAwkBAAAADWlzV2hpdGVsaXN0ZWQAAAABCQACWAAAAAEIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkGCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAANZEFwcFB1YmxpY0tleQeg63bB", "chainId": 84, "height": 754237, "spentComplexity": 0 } View: original | compacted Prev: 3LHzvFYkovFtyNQiak2xs4deoNKw1MQwUvTs9g5CqdDe Next: 948rvWsuDhbRDg4WR2dugft5kwxP5LpJfuRKoEVW25th Diff:
OldNewDifferences
1717 case publicKey: String =>
1818 publicKey
1919 case _ =>
20- throw("Account not found")
20+ throw("Account not found!")
2121 }
2222 split(publicKey, "_")
2323 }
5252 @Callable(i)
5353 func whitelist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
5454 then if (isWhitelisted(publicKey))
55- then throw("This account has already been whitelisted")
55+ then throw("This account has already been whitelisted!")
5656 else {
5757 let whitelistedValue = (publicKey + whitelistingSuffix)
5858 WriteSet([DataEntry(publicKey, whitelistedValue)])
5959 }
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!")
6161
6262
6363
6868 let blacklistedValue = (publicKey + blacklistingSuffix)
6969 WriteSet([DataEntry(publicKey, blacklistedValue)])
7070 }
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!")
7375
7476
7577
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let dAppPublicKey = base58'A8oSHKLfnzD8QqKKhQMUAq7EVSgWHrXv3FnP4uReunNr'
55
66 let whitelistingSuffix = "_whitelisted"
77
88 let blacklistingSuffix = "_blacklisted"
99
1010 let birthRecordSuffix = "_alive"
1111
1212 let deathRecordSuffix = "_deceased"
1313
1414 func getListFromData (key) = {
1515 let getDataString = getString(this, key)
1616 let publicKey = match getDataString {
1717 case publicKey: String =>
1818 publicKey
1919 case _ =>
20- throw("Account not found")
20+ throw("Account not found!")
2121 }
2222 split(publicKey, "_")
2323 }
2424
2525
2626 func isWhitelisted (publicKey) = {
2727 let whitelistedKey = getString(this, publicKey)
2828 if (isDefined(whitelistedKey))
2929 then {
3030 let whitelistedDataList = getListFromData(publicKey)
3131 if ((whitelistedDataList[1] == "whitelisted"))
3232 then true
3333 else false
3434 }
3535 else false
3636 }
3737
3838
3939 func isBlacklisted (publicKey) = {
4040 let blacklistedKey = getString(this, publicKey)
4141 if (isDefined(blacklistedKey))
4242 then {
4343 let blacklistedDataList = getListFromData(publicKey)
4444 if ((blacklistedDataList[1] == "blacklisted"))
4545 then true
4646 else false
4747 }
4848 else false
4949 }
5050
5151
5252 @Callable(i)
5353 func whitelist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
5454 then if (isWhitelisted(publicKey))
55- then throw("This account has already been whitelisted")
55+ then throw("This account has already been whitelisted!")
5656 else {
5757 let whitelistedValue = (publicKey + whitelistingSuffix)
5858 WriteSet([DataEntry(publicKey, whitelistedValue)])
5959 }
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!")
6161
6262
6363
6464 @Callable(i)
6565 func blacklist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
6666 then if (isWhitelisted(publicKey))
6767 then {
6868 let blacklistedValue = (publicKey + blacklistingSuffix)
6969 WriteSet([DataEntry(publicKey, blacklistedValue)])
7070 }
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!")
7375
7476
7577
7678 @Callable(i)
7779 func addBirthRecord (record) = {
7880 let callerPublicKey = toBase58String(i.callerPublicKey)
7981 if (isWhitelisted(callerPublicKey))
8082 then {
8183 let birthRecordKey = toString(toInt(i.transactionId))
8284 let birthRecordValue = (((record + "_") + toBase58String(i.callerPublicKey)) + birthRecordSuffix)
8385 WriteSet([DataEntry(birthRecordKey, birthRecordValue)])
8486 }
8587 else if (isBlacklisted(callerPublicKey))
8688 then throw("This account has been blacklisted")
8789 else throw("Only authorized accounts can add birth records to the blockchain")
8890 }
8991
9092
9193
9294 @Callable(i)
9395 func updateRecord (recordId,newRecord) = {
9496 let record = getString(this, recordId)
9597 if (!(isDefined(record)))
9698 then throw("Record not found")
9799 else {
98100 let recordData = getStringValue(this, recordId)
99101 let recordList = split(recordData, "_")
100102 if ((recordList[1] == toBase58String(i.callerPublicKey)))
101103 then {
102104 let newRecordValue = ((((newRecord + "_") + toBase58String(i.callerPublicKey)) + "_") + birthRecordSuffix)
103105 WriteSet([DataEntry(recordId, newRecord)])
104106 }
105107 else throw("Access denied. Only the account that created this record can update it.")
106108 }
107109 }
108110
109111
110112
111113 @Callable(i)
112114 func makeDeceased (recordId) = {
113115 let record = getString(this, recordId)
114116 if (!(isDefined(record)))
115117 then throw("Record not found")
116118 else {
117119 let recordData = getStringValue(this, recordId)
118120 let recordList = split(recordData, "_")
119121 if ((recordList[1] == toBase58String(i.callerPublicKey)))
120122 then {
121123 let newRecord = ((((recordList[0] + "_") + toBase58String(i.callerPublicKey)) + "_") + deathRecordSuffix)
122124 WriteSet([DataEntry(recordId, newRecord)])
123125 }
124126 else throw("Access denied. Only the account that created this record can make it deceased")
125127 }
126128 }
127129
128130
129131 @Verifier(tx)
130132 func verify () = match tx {
131133 case d: SetScriptTransaction =>
132134 sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
133135 case e: InvokeScriptTransaction =>
134136 if (isWhitelisted(toBase58String(tx.senderPublicKey)))
135137 then true
136138 else sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
137139 case _ =>
138140 false
139141 }
140142

github/deemru/w8io/026f985 
37.36 ms