tx · BxJFVTnMqE8CBVWLYoo3tYTUYRT9mrXuGF6RYgFXtuCB

3N8P9bdRz4kqwJr27kpdTpnXho5m4926LFP:  -0.01400000 Waves

2019.11.07 11:19 [754257] smart account 3N8P9bdRz4kqwJr27kpdTpnXho5m4926LFP > SELF 0.00000000 Waves

{ "type": 13, "id": "BxJFVTnMqE8CBVWLYoo3tYTUYRT9mrXuGF6RYgFXtuCB", "fee": 1400000, "feeAssetId": null, "timestamp": 1573114808984, "version": 1, "sender": "3N8P9bdRz4kqwJr27kpdTpnXho5m4926LFP", "senderPublicKey": "A8oSHKLfnzD8QqKKhQMUAq7EVSgWHrXv3FnP4uReunNr", "proofs": [ "3UQhuq44C16RS4VJwyi7bKKzT9F1sdgqCSjcox16e8gH4FQw75kaHpXHb5o225X6KDdkjsrGtKAT6zsGfxHHm8gR" ], "script": "base64:AAIDAAAAAAAAABwIARIDCgEIEgMKAQgSAwoBCBIECgIICBIDCgEIAAAACAAAAAANZEFwcFB1YmxpY0tleQEAAAAgh7jA0zfoNqLQbyKEViCOMw71oJOp0h9SmmKVmHnl0zcAAAAAEndoaXRlbGlzdGluZ1N1ZmZpeAIAAAAMX3doaXRlbGlzdGVkAAAAABJibGFja2xpc3RpbmdTdWZmaXgCAAAADF9ibGFja2xpc3RlZAAAAAARYmlydGhSZWNvcmRTdWZmaXgCAAAABl9hbGl2ZQAAAAARZGVhdGhSZWNvcmRTdWZmaXgCAAAACV9kZWNlYXNlZAEAAAAPZ2V0TGlzdEZyb21EYXRhAAAAAQAAAANrZXkEAAAADWdldERhdGFTdHJpbmcJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5BAAAAAlwdWJsaWNLZXkEAAAAByRtYXRjaDAFAAAADWdldERhdGFTdHJpbmcDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAAJcHVibGljS2V5BQAAAAckbWF0Y2gwBQAAAAlwdWJsaWNLZXkJAAACAAAAAQIAAAASQWNjb3VudCBub3QgZm91bm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AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAANZEFwcFB1YmxpY0tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAXSW52b2tlU2NyaXB0VHJhbnNhY3Rpb24EAAAAAWUFAAAAByRtYXRjaDADCQEAAAANaXNXaGl0ZWxpc3RlZAAAAAEJAAJYAAAAAQgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleQYJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA1kQXBwUHVibGljS2V5B3cPc7s=", "chainId": 84, "height": 754257, "spentComplexity": 0 } View: original | compacted Prev: 948rvWsuDhbRDg4WR2dugft5kwxP5LpJfuRKoEVW25th Next: 4i9dQUGQPWAw6rexb56GRrQS49mh8XjjJCspZrQEXabB Diff:
OldNewDifferences
9292
9393
9494 @Callable(i)
95-func updateRecord (recordId,newRecord) = if (isWhitelisted(toBase58String(i.callerPublicKey)))
96- then {
97- let record = getString(this, recordId)
98- if (!(isDefined(record)))
99- then throw("Record not found")
100- else {
101- let recordData = getStringValue(this, recordId)
102- let recordList = split(recordData, "_")
103- if ((recordList[1] == toBase58String(i.callerPublicKey)))
104- then {
105- let newRecordValue = ((((newRecord + "_") + toBase58String(i.callerPublicKey)) + "_") + birthRecordSuffix)
106- WriteSet([DataEntry(recordId, newRecord)])
107- }
108- else if (if ((recordList[1] == toBase58String(i.callerPublicKey)))
109- then isBlacklisted(toBase58String(i.callerPublicKey))
110- else false)
111- then throw("This account has been blacklisted. Contact dApp Owner!")
112- else throw("Access denied. Only the account that created this record can update it.")
113- }
114- }
115- else throw("You are not authorized for this action")
95+func updateRecord (recordId,newRecord) = {
96+ let callerPublicKey = toBase58String(i.callerPublicKey)
97+ if (isWhitelisted(callerPublicKey))
98+ then {
99+ let record = getString(this, recordId)
100+ if (!(isDefined(record)))
101+ then throw("Record not found")
102+ else {
103+ let recordData = getStringValue(this, recordId)
104+ let recordList = split(recordData, "_")
105+ if ((recordList[1] == callerPublicKey))
106+ then {
107+ let newRecordValue = ((((newRecord + "_") + callerPublicKey) + "_") + birthRecordSuffix)
108+ WriteSet([DataEntry(recordId, newRecord)])
109+ }
110+ else if (if ((recordList[1] == callerPublicKey))
111+ then isBlacklisted(callerPublicKey)
112+ else false)
113+ then throw("This account has been blacklisted. Contact dApp Owner!")
114+ else throw("Access denied. Only the account that created this record can update it.")
115+ }
116+ }
117+ else throw("You are not authorized for this action!")
118+ }
116119
117120
118121
119122 @Callable(i)
120123 func makeDeceased (recordId) = {
121- let record = getString(this, recordId)
122- if (!(isDefined(record)))
123- then throw("Record not found")
124- else {
125- let recordData = getStringValue(this, recordId)
126- let recordList = split(recordData, "_")
127- if ((recordList[1] == toBase58String(i.callerPublicKey)))
128- then {
129- let newRecord = ((((recordList[0] + "_") + toBase58String(i.callerPublicKey)) + "_") + deathRecordSuffix)
130- WriteSet([DataEntry(recordId, newRecord)])
124+ let callerPublicKey = toBase58String(i.callerPublicKey)
125+ if (isWhitelisted(callerPublicKey))
126+ then {
127+ let record = getString(this, recordId)
128+ if (!(isDefined(record)))
129+ then throw("Record not found")
130+ else {
131+ let recordData = getStringValue(this, recordId)
132+ let recordList = split(recordData, "_")
133+ if ((recordList[1] == callerPublicKey))
134+ then {
135+ let newRecord = ((((recordList[0] + "_") + callerPublicKey) + "_") + deathRecordSuffix)
136+ WriteSet([DataEntry(recordId, newRecord)])
137+ }
138+ else if (if ((recordList[1] == callerPublicKey))
139+ then isBlacklisted(callerPublicKey)
140+ else false)
141+ then throw("This account has been blacklisted. Contact dApp Owner!")
142+ else throw("Access denied. Only the account that created this record can make it deceased")
131143 }
132- else throw("Access denied. Only the account that created this record can make it deceased")
133144 }
145+ else throw("You are not authorized for this action!")
134146 }
135147
136148
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 _ =>
2020 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))
5555 then throw("This account has already been whitelisted!")
5656 else {
5757 let whitelistedValue = (publicKey + whitelistingSuffix)
5858 WriteSet([DataEntry(publicKey, whitelistedValue)])
5959 }
6060 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 }
7171 else if (isBlacklisted(publicKey))
7272 then throw("This account has already been blacklisted!")
7373 else throw("This account was never whitelisted. Do verify!")
7474 else throw("You are not authorized to blacklist accounts. Contact dApp Owner!")
7575
7676
7777
7878 @Callable(i)
7979 func addBirthRecord (record) = {
8080 let callerPublicKey = toBase58String(i.callerPublicKey)
8181 if (isWhitelisted(callerPublicKey))
8282 then {
8383 let birthRecordKey = toString(toInt(i.transactionId))
8484 let birthRecordValue = (((record + "_") + toBase58String(i.callerPublicKey)) + birthRecordSuffix)
8585 WriteSet([DataEntry(birthRecordKey, birthRecordValue)])
8686 }
8787 else if (isBlacklisted(callerPublicKey))
8888 then throw("This account has been blacklisted")
8989 else throw("Only authorized accounts can add birth records to the blockchain")
9090 }
9191
9292
9393
9494 @Callable(i)
95-func updateRecord (recordId,newRecord) = if (isWhitelisted(toBase58String(i.callerPublicKey)))
96- then {
97- let record = getString(this, recordId)
98- if (!(isDefined(record)))
99- then throw("Record not found")
100- else {
101- let recordData = getStringValue(this, recordId)
102- let recordList = split(recordData, "_")
103- if ((recordList[1] == toBase58String(i.callerPublicKey)))
104- then {
105- let newRecordValue = ((((newRecord + "_") + toBase58String(i.callerPublicKey)) + "_") + birthRecordSuffix)
106- WriteSet([DataEntry(recordId, newRecord)])
107- }
108- else if (if ((recordList[1] == toBase58String(i.callerPublicKey)))
109- then isBlacklisted(toBase58String(i.callerPublicKey))
110- else false)
111- then throw("This account has been blacklisted. Contact dApp Owner!")
112- else throw("Access denied. Only the account that created this record can update it.")
113- }
114- }
115- else throw("You are not authorized for this action")
95+func updateRecord (recordId,newRecord) = {
96+ let callerPublicKey = toBase58String(i.callerPublicKey)
97+ if (isWhitelisted(callerPublicKey))
98+ then {
99+ let record = getString(this, recordId)
100+ if (!(isDefined(record)))
101+ then throw("Record not found")
102+ else {
103+ let recordData = getStringValue(this, recordId)
104+ let recordList = split(recordData, "_")
105+ if ((recordList[1] == callerPublicKey))
106+ then {
107+ let newRecordValue = ((((newRecord + "_") + callerPublicKey) + "_") + birthRecordSuffix)
108+ WriteSet([DataEntry(recordId, newRecord)])
109+ }
110+ else if (if ((recordList[1] == callerPublicKey))
111+ then isBlacklisted(callerPublicKey)
112+ else false)
113+ then throw("This account has been blacklisted. Contact dApp Owner!")
114+ else throw("Access denied. Only the account that created this record can update it.")
115+ }
116+ }
117+ else throw("You are not authorized for this action!")
118+ }
116119
117120
118121
119122 @Callable(i)
120123 func makeDeceased (recordId) = {
121- let record = getString(this, recordId)
122- if (!(isDefined(record)))
123- then throw("Record not found")
124- else {
125- let recordData = getStringValue(this, recordId)
126- let recordList = split(recordData, "_")
127- if ((recordList[1] == toBase58String(i.callerPublicKey)))
128- then {
129- let newRecord = ((((recordList[0] + "_") + toBase58String(i.callerPublicKey)) + "_") + deathRecordSuffix)
130- WriteSet([DataEntry(recordId, newRecord)])
124+ let callerPublicKey = toBase58String(i.callerPublicKey)
125+ if (isWhitelisted(callerPublicKey))
126+ then {
127+ let record = getString(this, recordId)
128+ if (!(isDefined(record)))
129+ then throw("Record not found")
130+ else {
131+ let recordData = getStringValue(this, recordId)
132+ let recordList = split(recordData, "_")
133+ if ((recordList[1] == callerPublicKey))
134+ then {
135+ let newRecord = ((((recordList[0] + "_") + callerPublicKey) + "_") + deathRecordSuffix)
136+ WriteSet([DataEntry(recordId, newRecord)])
137+ }
138+ else if (if ((recordList[1] == callerPublicKey))
139+ then isBlacklisted(callerPublicKey)
140+ else false)
141+ then throw("This account has been blacklisted. Contact dApp Owner!")
142+ else throw("Access denied. Only the account that created this record can make it deceased")
131143 }
132- else throw("Access denied. Only the account that created this record can make it deceased")
133144 }
145+ else throw("You are not authorized for this action!")
134146 }
135147
136148
137149 @Verifier(tx)
138150 func verify () = match tx {
139151 case d: SetScriptTransaction =>
140152 sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
141153 case e: InvokeScriptTransaction =>
142154 if (isWhitelisted(toBase58String(tx.senderPublicKey)))
143155 then true
144156 else sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
145157 case _ =>
146158 false
147159 }
148160

github/deemru/w8io/026f985 
61.63 ms