tx · 8eoexJsEVTPAx34UofaN9UosyvNZkecXQGFSRo8RRQ5D

3MpHH6zrns5Yr1gp4bHYeBtEd9BBKsCTou6:  -0.01400000 Waves

2019.11.07 08:17 [754069] smart account 3MpHH6zrns5Yr1gp4bHYeBtEd9BBKsCTou6 > SELF 0.00000000 Waves

{ "type": 13, "id": "8eoexJsEVTPAx34UofaN9UosyvNZkecXQGFSRo8RRQ5D", "fee": 1400000, "feeAssetId": null, "timestamp": 1573103947877, "version": 1, "sender": "3MpHH6zrns5Yr1gp4bHYeBtEd9BBKsCTou6", "senderPublicKey": "EW5L8pthNV1jLZqSb1XAsbWZWfikCDkfsp15mCGiuhHA", "proofs": [ "3NGa6R5R8J6VzLGvbruJmgBK1x83mcXF7x8huuhVZ7i8VSAZyruH5mYWvRAn7PGWCEc1wT2zxg2rpSi1SGriUcz3" ], "script": "base64:AAIDAAAAAAAAABEIARIDCgEIEgMKAQgSAwoBCAAAAAYAAAAADWRBcHBQdWJsaWNLZXkBAAAAIMiaq1q/aRWIgy4v82rgCcahL5n05g9t5jfX4ZzqluAZAAAAABJ3aGl0ZWxpc3RpbmdTdWZmaXgCAAAADF93aGl0ZWxpc3RlZAAAAAASYmxhY2tsaXN0aW5nU3VmZml4AgAAAAxfYmxhY2tsaXN0ZWQBAAAAD2dldExpc3RGcm9tRGF0YQAAAAEAAAADa2V5BAAAAA1nZXREYXRhU3RyaW5nCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQQAAAAJcHVibGljS2V5BAAAAAckbWF0Y2gwBQAAAA1nZXREYXRhU3RyaW5nAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAACXB1YmxpY0tleQUAAAAHJG1hdGNoMAUAAAAJcHVibGljS2V5CQAAAgAAAAECAAAAEUFjY291bnQgbm90IGZvdW5kCQAEtQAAAAIFAAAACXB1YmxpY0tleQIAAAABXwEAAAANaXNXaGl0ZWxpc3RlZAAAAAEAAAAJcHVibGljS2V5BAAAAA53a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QAAAA9jYWxsZXJQdWJsaWNLZXkJAAACAAAAAQIAAAAhVGhpcyBhY2NvdW50IGhhcyBiZWVuIGJsYWNrbGlzdGVkCQAAAgAAAAECAAAAQE9ubHkgYXV0aG9yaXplZCBhY2NvdW50cyBjYW4gYWRkIGJpcnRoIHJlY29yZHMgdG8gdGhlIGJsb2NrY2hhaW4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWQFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAA1kQXBwUHVibGljS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABdJbnZva2VTY3JpcHRUcmFuc2FjdGlvbgQAAAABZQUAAAAHJG1hdGNoMAMJAQAAAA1pc1doaXRlbGlzdGVkAAAAAQkAAlgAAAABCAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5BgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAADWRBcHBQdWJsaWNLZXkHM+tYOw==", "chainId": 84, "height": 754069, "spentComplexity": 0 } View: original | compacted Prev: 6pyZC5zSPCNV2FTws7GQYkmSLCmSCPBKBGotbBS3bA7J Next: none Diff:
OldNewDifferences
55
66 let whitelistingSuffix = "_whitelisted"
77
8+let blacklistingSuffix = "_blacklisted"
9+
10+func getListFromData (key) = {
11+ let getDataString = getString(this, key)
12+ let publicKey = match getDataString {
13+ case publicKey: String =>
14+ publicKey
15+ case _ =>
16+ throw("Account not found")
17+ }
18+ split(publicKey, "_")
19+ }
20+
21+
822 func isWhitelisted (publicKey) = {
9- let keyOfWhitelistedAccount = (publicKey + whitelistingSuffix)
10- let whitlistedKey = getString(this, keyOfWhitelistedAccount)
11- if (isDefined(whitlistedKey))
12- then true
23+ let whitelistedKey = getString(this, publicKey)
24+ if (isDefined(whitelistedKey))
25+ then {
26+ let whitelistedDataList = getListFromData(publicKey)
27+ if ((whitelistedDataList[1] == "whitelisted"))
28+ then true
29+ else false
30+ }
31+ else false
32+ }
33+
34+
35+func isBlacklisted (publicKey) = {
36+ let blacklistedKey = getString(this, publicKey)
37+ if (isDefined(blacklistedKey))
38+ then {
39+ let blacklistedDataList = getListFromData(publicKey)
40+ if ((blacklistedDataList[1] == "blacklisted"))
41+ then true
42+ else false
43+ }
1344 else false
1445 }
1546
1950 then if (isWhitelisted(publicKey))
2051 then throw("This account has already been whitelisted")
2152 else {
22- let whitelistedKey = (publicKey + whitelistingSuffix)
23- WriteSet([DataEntry(whitelistedKey, publicKey)])
53+ let whitelistedValue = (publicKey + whitelistingSuffix)
54+ WriteSet([DataEntry(publicKey, whitelistedValue)])
2455 }
25- else throw("You are not permitted to whitelist an account")
56+ else throw("You are not authorized to whitelist accounts. Contact dApp Owner")
2657
2758
2859
2960 @Callable(i)
30-func addBirthRecord (info) = if (isWhitelisted(toBase58String(i.callerPublicKey)))
31- then {
32- let birthRecordKey = toString(toInt(i.transactionId))
33- WriteSet([DataEntry(birthRecordKey, info)])
34- }
35- else throw("You are not allowed to create birth record on the blockchain")
61+func blacklist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
62+ then if (isWhitelisted(publicKey))
63+ then {
64+ let blacklistedValue = (publicKey + blacklistingSuffix)
65+ WriteSet([DataEntry(publicKey, blacklistedValue)])
66+ }
67+ else throw("This account was never whitelisted. Do verify")
68+ else throw("You are not authorized to blacklist accounts. Contact dApp Owner")
69+
70+
71+
72+@Callable(i)
73+func addBirthRecord (record) = {
74+ let callerPublicKey = toBase58String(i.callerPublicKey)
75+ if (isWhitelisted(callerPublicKey))
76+ then {
77+ let birthRecordKey = toString(toInt(i.transactionId))
78+ WriteSet([DataEntry(birthRecordKey, record)])
79+ }
80+ else if (isBlacklisted(callerPublicKey))
81+ then throw("This account has been blacklisted")
82+ else throw("Only authorized accounts can add birth records to the blockchain")
83+ }
3684
3785
3886 @Verifier(tx)
3987 func verify () = match tx {
4088 case d: SetScriptTransaction =>
4189 sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
90+ case e: InvokeScriptTransaction =>
91+ if (isWhitelisted(toBase58String(tx.senderPublicKey)))
92+ then true
93+ else sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
4294 case _ =>
43- true
95+ false
4496 }
4597
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let dAppPublicKey = base58'EW5L8pthNV1jLZqSb1XAsbWZWfikCDkfsp15mCGiuhHA'
55
66 let whitelistingSuffix = "_whitelisted"
77
8+let blacklistingSuffix = "_blacklisted"
9+
10+func getListFromData (key) = {
11+ let getDataString = getString(this, key)
12+ let publicKey = match getDataString {
13+ case publicKey: String =>
14+ publicKey
15+ case _ =>
16+ throw("Account not found")
17+ }
18+ split(publicKey, "_")
19+ }
20+
21+
822 func isWhitelisted (publicKey) = {
9- let keyOfWhitelistedAccount = (publicKey + whitelistingSuffix)
10- let whitlistedKey = getString(this, keyOfWhitelistedAccount)
11- if (isDefined(whitlistedKey))
12- then true
23+ let whitelistedKey = getString(this, publicKey)
24+ if (isDefined(whitelistedKey))
25+ then {
26+ let whitelistedDataList = getListFromData(publicKey)
27+ if ((whitelistedDataList[1] == "whitelisted"))
28+ then true
29+ else false
30+ }
31+ else false
32+ }
33+
34+
35+func isBlacklisted (publicKey) = {
36+ let blacklistedKey = getString(this, publicKey)
37+ if (isDefined(blacklistedKey))
38+ then {
39+ let blacklistedDataList = getListFromData(publicKey)
40+ if ((blacklistedDataList[1] == "blacklisted"))
41+ then true
42+ else false
43+ }
1344 else false
1445 }
1546
1647
1748 @Callable(i)
1849 func whitelist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
1950 then if (isWhitelisted(publicKey))
2051 then throw("This account has already been whitelisted")
2152 else {
22- let whitelistedKey = (publicKey + whitelistingSuffix)
23- WriteSet([DataEntry(whitelistedKey, publicKey)])
53+ let whitelistedValue = (publicKey + whitelistingSuffix)
54+ WriteSet([DataEntry(publicKey, whitelistedValue)])
2455 }
25- else throw("You are not permitted to whitelist an account")
56+ else throw("You are not authorized to whitelist accounts. Contact dApp Owner")
2657
2758
2859
2960 @Callable(i)
30-func addBirthRecord (info) = if (isWhitelisted(toBase58String(i.callerPublicKey)))
31- then {
32- let birthRecordKey = toString(toInt(i.transactionId))
33- WriteSet([DataEntry(birthRecordKey, info)])
34- }
35- else throw("You are not allowed to create birth record on the blockchain")
61+func blacklist (publicKey) = if ((i.callerPublicKey == dAppPublicKey))
62+ then if (isWhitelisted(publicKey))
63+ then {
64+ let blacklistedValue = (publicKey + blacklistingSuffix)
65+ WriteSet([DataEntry(publicKey, blacklistedValue)])
66+ }
67+ else throw("This account was never whitelisted. Do verify")
68+ else throw("You are not authorized to blacklist accounts. Contact dApp Owner")
69+
70+
71+
72+@Callable(i)
73+func addBirthRecord (record) = {
74+ let callerPublicKey = toBase58String(i.callerPublicKey)
75+ if (isWhitelisted(callerPublicKey))
76+ then {
77+ let birthRecordKey = toString(toInt(i.transactionId))
78+ WriteSet([DataEntry(birthRecordKey, record)])
79+ }
80+ else if (isBlacklisted(callerPublicKey))
81+ then throw("This account has been blacklisted")
82+ else throw("Only authorized accounts can add birth records to the blockchain")
83+ }
3684
3785
3886 @Verifier(tx)
3987 func verify () = match tx {
4088 case d: SetScriptTransaction =>
4189 sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
90+ case e: InvokeScriptTransaction =>
91+ if (isWhitelisted(toBase58String(tx.senderPublicKey)))
92+ then true
93+ else sigVerify(tx.bodyBytes, tx.proofs[0], dAppPublicKey)
4294 case _ =>
43- true
95+ false
4496 }
4597

github/deemru/w8io/026f985 
26.75 ms