tx · 6Un94hdcteHYjTYtM4MuNwwNWvJVevqBRfrDZ8jSZXCQ

3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB:  -0.01400000 Waves

2020.01.17 07:20 [857677] smart account 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB > SELF 0.00000000 Waves

{ "type": 13, "id": "6Un94hdcteHYjTYtM4MuNwwNWvJVevqBRfrDZ8jSZXCQ", "fee": 1400000, "feeAssetId": null, "timestamp": 1579234852646, "version": 1, "sender": "3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB", "senderPublicKey": "Gd5NihbWQoWuTnSvq25TuV2BYZG4U1e9KDqZn9zBPix7", "proofs": [ "4Kob2mKogxoBVpJtSUirxTritBGbWeDHwtEyJXQMhNRCxRignDMaEQUuNQ1d3MbtgkPxpziuUWQ7VRB5jUFNL9vc" ], "script": "base64:AAIDAAAAAAAAABEIARIGCgQICAgIEgUKAwgICAAAAAUAAAAACHZlcmlmaWVyCQEAAAAHZXh0cmFjdAAAAAEJAQAAABFhZGRyZXNzRnJvbVN0cmluZwAAAAECAAAAIzNOMnM1UnRhSFBCZW5Dc3gyRUNjb0ZSYllIeDNub1poWFcxAAAAAARiYW5rAgAAACMzTjFFNnRYZGRSb1ZhUmZROWRRM3ZnNUxhVzJmc2Q4SEt1YgEAAAAKY2hlY2tFbnRyeQAAAAIAAAAGcHJlZml4AAAABHV1aWQEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAZwcmVmaXgFAAAABHV1aWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAETk9ORQEAAAAJY2hlY2tVVUlEAAAAAQAAAAR1dWlkBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAABHV1aWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABY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AAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAltZXNzYWdlaWQFAAAABHV1aWQJAAJYAAAAAQUAAAACaWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAACGRhdGFfZWNfCQACWAAAAAEFAAAAAmlkAgAAAAFfBQAAAA1jYWxsZXJBZGRyZXNzBQAAAARkYXRhBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAARiYW5rBQAAAAZhbW91bnQIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAAA25pbAAAAACLtr4A", "chainId": 84, "height": 857677, "spentComplexity": 0 } View: original | compacted Prev: 9ARKRCdVBTtFf7FnRHKMnRjsYhaQScvgxPN7H8tf95oX Next: 6Pwbo6XCYEVXHwQFSgd52y96HPwXGJzgNyPmunPoTepz Diff:
OldNewDifferences
55
66 let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub"
77
8+func checkEntry (prefix,uuid) = match getString(this, (prefix + uuid)) {
9+ case a: String =>
10+ a
11+ case _ =>
12+ "NONE"
13+}
14+
15+
16+func checkUUID (uuid) = match getString(this, uuid) {
17+ case a: String =>
18+ a
19+ case _ =>
20+ "NONE"
21+}
22+
23+
24+func checkIfWhiteListed (callerAddress) = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
25+ case a: Int =>
26+ a
27+ case _ =>
28+ 0
29+}
30+
31+
832 @Callable(invoke)
933 func fileCertification (hash,title,uuid,data) = {
1034 let id = extract(invoke.transactionId)
11- let entryExist = match getString(this, (hash + uuid)) {
12- case a: String =>
13- a
14- case _ =>
15- "NONE"
16- }
17- let uuidExist = match getString(this, uuid) {
18- case a: String =>
19- a
20- case _ =>
21- "NONE"
22- }
35+ let entryExist = checkEntry(hash, uuid)
36+ let uuidExist = checkUUID(uuid)
2337 let callerAddress = toBase58String(invoke.caller.bytes)
24- let callerIsWhiteListedNum = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
25- case a: Int =>
26- a
27- case _ =>
28- 0
29- }
38+ let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
3039 if ((entryExist != "NONE"))
3140 then throw("This entry already exist")
3241 else if ((uuidExist != "NONE"))
6776 @Callable(invoke)
6877 func emailCertification (messageid,uuid,data) = {
6978 let id = extract(invoke.transactionId)
70- let entryExist = match getString(this, (messageid + uuid)) {
71- case a: String =>
72- a
73- case _ =>
74- "NONE"
75- }
76- let uuidExist = match getString(this, uuid) {
77- case a: String =>
78- a
79- case _ =>
80- "NONE"
81- }
79+ let entryExist = checkEntry(messageid, uuid)
80+ let uuidExist = checkUUID(uuid)
8281 let callerAddress = toBase58String(invoke.caller.bytes)
83- let callerIsWhiteListedNum = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
84- case a: Int =>
85- a
86- case _ =>
87- 0
88- }
82+ let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
8983 if ((entryExist != "NONE"))
9084 then throw("This entry already exist")
9185 else if ((uuidExist != "NONE"))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let verifier = extract(addressFromString("3N2s5RtaHPBenCsx2ECcoFRbYHx3noZhXW1"))
55
66 let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub"
77
8+func checkEntry (prefix,uuid) = match getString(this, (prefix + uuid)) {
9+ case a: String =>
10+ a
11+ case _ =>
12+ "NONE"
13+}
14+
15+
16+func checkUUID (uuid) = match getString(this, uuid) {
17+ case a: String =>
18+ a
19+ case _ =>
20+ "NONE"
21+}
22+
23+
24+func checkIfWhiteListed (callerAddress) = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
25+ case a: Int =>
26+ a
27+ case _ =>
28+ 0
29+}
30+
31+
832 @Callable(invoke)
933 func fileCertification (hash,title,uuid,data) = {
1034 let id = extract(invoke.transactionId)
11- let entryExist = match getString(this, (hash + uuid)) {
12- case a: String =>
13- a
14- case _ =>
15- "NONE"
16- }
17- let uuidExist = match getString(this, uuid) {
18- case a: String =>
19- a
20- case _ =>
21- "NONE"
22- }
35+ let entryExist = checkEntry(hash, uuid)
36+ let uuidExist = checkUUID(uuid)
2337 let callerAddress = toBase58String(invoke.caller.bytes)
24- let callerIsWhiteListedNum = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
25- case a: Int =>
26- a
27- case _ =>
28- 0
29- }
38+ let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
3039 if ((entryExist != "NONE"))
3140 then throw("This entry already exist")
3241 else if ((uuidExist != "NONE"))
3342 then throw("This uuid already exist")
3443 else if ((size(uuid) > 36))
3544 then throw("Uuid is too long")
3645 else if ((size(hash) > 64))
3746 then throw("Hash is too long")
3847 else if ((size(title) > 64))
3948 then throw("Title is too long")
4049 else if ((callerIsWhiteListedNum > 0))
4150 then ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((hash + uuid), toBase58String(id)), DataEntry((title + uuid), toBase58String(id)), DataEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - 1)), DataEntry(((("data_fc_" + toBase58String(id)) + "_") + callerAddress), data)]), TransferSet([ScriptTransfer(invoke.caller, 500000, unit)]))
4251 else {
4352 let payment = extract(invoke.payment)
4453 let amount = extract(payment.amount)
4554 let paymentAssetId = if (isDefined(payment.assetId))
4655 then extract(payment.assetId)
4756 else throw("Waves is not accepted as payment")
4857 let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) {
4958 case a: String =>
5059 a
5160 case _ =>
5261 throw("This token is not accepted at the moment")
5362 }
5463 let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId))))
5564 if ((acceptedToken != "WHITELISTED"))
5665 then throw("This token is not accepted at the moment")
5766 else if (if ((amount != currentPrice))
5867 then (0 >= callerIsWhiteListedNum)
5968 else false)
6069 then throw("The price is wrong")
6170 else ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((hash + uuid), toBase58String(id)), DataEntry((title + uuid), toBase58String(id)), DataEntry(((("data_fc_" + toBase58String(id)) + "_") + callerAddress), data)]), TransferSet([ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)]))
6271 }
6372 }
6473
6574
6675
6776 @Callable(invoke)
6877 func emailCertification (messageid,uuid,data) = {
6978 let id = extract(invoke.transactionId)
70- let entryExist = match getString(this, (messageid + uuid)) {
71- case a: String =>
72- a
73- case _ =>
74- "NONE"
75- }
76- let uuidExist = match getString(this, uuid) {
77- case a: String =>
78- a
79- case _ =>
80- "NONE"
81- }
79+ let entryExist = checkEntry(messageid, uuid)
80+ let uuidExist = checkUUID(uuid)
8281 let callerAddress = toBase58String(invoke.caller.bytes)
83- let callerIsWhiteListedNum = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) {
84- case a: Int =>
85- a
86- case _ =>
87- 0
88- }
82+ let callerIsWhiteListedNum = checkIfWhiteListed(callerAddress)
8983 if ((entryExist != "NONE"))
9084 then throw("This entry already exist")
9185 else if ((uuidExist != "NONE"))
9286 then throw("This uuid already exist")
9387 else if ((size(uuid) > 36))
9488 then throw("Uuid is too long")
9589 else if ((callerIsWhiteListedNum > 0))
9690 then ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((messageid + uuid), toBase58String(id)), DataEntry(("addr_WHITELISTED_" + callerAddress), (callerIsWhiteListedNum - 1)), DataEntry(((("data_ec_" + toBase58String(id)) + "_") + callerAddress), data)]), TransferSet([ScriptTransfer(invoke.caller, 500000, unit)]))
9791 else {
9892 let payment = extract(invoke.payment)
9993 let amount = extract(payment.amount)
10094 let paymentAssetId = if (isDefined(payment.assetId))
10195 then extract(payment.assetId)
10296 else throw("Waves is not accepted as payment")
10397 let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) {
10498 case a: String =>
10599 a
106100 case _ =>
107101 throw("This token is not accepted at the moment")
108102 }
109103 let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId))))
110104 if ((acceptedToken != "WHITELISTED"))
111105 then throw("This token is not accepted at the moment")
112106 else if (if ((amount != currentPrice))
113107 then (0 >= callerIsWhiteListedNum)
114108 else false)
115109 then throw("The price is wrong")
116110 else ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((messageid + uuid), toBase58String(id)), DataEntry(((("data_ec_" + toBase58String(id)) + "_") + callerAddress), data)]), TransferSet([ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)]))
117111 }
118112 }
119113
120114

github/deemru/w8io/026f985 
24.44 ms