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:AAIDAAAAAAAAABEIARIGCgQICAgIEgUKAwgICAAAAAUAAAAACHZlcmlmaWVyCQEAAAAHZXh0cmFjdAAAAAEJAQAAABFhZGRyZXNzRnJvbVN0cmluZwAAAAECAAAAIzNOMnM1UnRhSFBCZW5Dc3gyRUNjb0ZSYllIeDNub1poWFcxAAAAAARiYW5rAgAAACMzTjFFNnRYZGRSb1ZhUmZROWRRM3ZnNUxhVzJmc2Q4SEt1YgEAAAAKY2hlY2tFbnRyeQAAAAIAAAAGcHJlZml4AAAABHV1aWQEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwkAASwAAAACBQAAAAZwcmVmaXgFAAAABHV1aWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAETk9ORQEAAAAJY2hlY2tVVUlEAAAAAQAAAAR1dWlkBAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAABHV1aWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQ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AACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAAAltZXNzYWdlaWQFAAAABHV1aWQJAAJYAAAAAQUAAAACaWQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAACGRhdGFfZWNfCQACWAAAAAEFAAAAAmlkAgAAAAFfBQAAAA1jYWxsZXJBZGRyZXNzBQAAAARkYXRhBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAARiYW5rBQAAAAZhbW91bnQIBQAAAAdwYXltZW50AAAAB2Fzc2V0SWQFAAAAA25pbAAAAACLtr4A", "chainId": 84, "height": 857677, "spentComplexity": 0 } View: original | compacted Prev: 9ARKRCdVBTtFf7FnRHKMnRjsYhaQScvgxPN7H8tf95oX Next: 6Pwbo6XCYEVXHwQFSgd52y96HPwXGJzgNyPmunPoTepz Diff:
Old | New | Differences | |
---|---|---|---|
5 | 5 | ||
6 | 6 | let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
7 | 7 | ||
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 | + | ||
8 | 32 | @Callable(invoke) | |
9 | 33 | func fileCertification (hash,title,uuid,data) = { | |
10 | 34 | 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) | |
23 | 37 | 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) | |
30 | 39 | if ((entryExist != "NONE")) | |
31 | 40 | then throw("This entry already exist") | |
32 | 41 | else if ((uuidExist != "NONE")) | |
67 | 76 | @Callable(invoke) | |
68 | 77 | func emailCertification (messageid,uuid,data) = { | |
69 | 78 | 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) | |
82 | 81 | 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) | |
89 | 83 | if ((entryExist != "NONE")) | |
90 | 84 | then throw("This entry already exist") | |
91 | 85 | else if ((uuidExist != "NONE")) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let verifier = extract(addressFromString("3N2s5RtaHPBenCsx2ECcoFRbYHx3noZhXW1")) | |
5 | 5 | ||
6 | 6 | let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
7 | 7 | ||
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 | + | ||
8 | 32 | @Callable(invoke) | |
9 | 33 | func fileCertification (hash,title,uuid,data) = { | |
10 | 34 | 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) | |
23 | 37 | 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) | |
30 | 39 | if ((entryExist != "NONE")) | |
31 | 40 | then throw("This entry already exist") | |
32 | 41 | else if ((uuidExist != "NONE")) | |
33 | 42 | then throw("This uuid already exist") | |
34 | 43 | else if ((size(uuid) > 36)) | |
35 | 44 | then throw("Uuid is too long") | |
36 | 45 | else if ((size(hash) > 64)) | |
37 | 46 | then throw("Hash is too long") | |
38 | 47 | else if ((size(title) > 64)) | |
39 | 48 | then throw("Title is too long") | |
40 | 49 | else if ((callerIsWhiteListedNum > 0)) | |
41 | 50 | 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)])) | |
42 | 51 | else { | |
43 | 52 | let payment = extract(invoke.payment) | |
44 | 53 | let amount = extract(payment.amount) | |
45 | 54 | let paymentAssetId = if (isDefined(payment.assetId)) | |
46 | 55 | then extract(payment.assetId) | |
47 | 56 | else throw("Waves is not accepted as payment") | |
48 | 57 | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
49 | 58 | case a: String => | |
50 | 59 | a | |
51 | 60 | case _ => | |
52 | 61 | throw("This token is not accepted at the moment") | |
53 | 62 | } | |
54 | 63 | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
55 | 64 | if ((acceptedToken != "WHITELISTED")) | |
56 | 65 | then throw("This token is not accepted at the moment") | |
57 | 66 | else if (if ((amount != currentPrice)) | |
58 | 67 | then (0 >= callerIsWhiteListedNum) | |
59 | 68 | else false) | |
60 | 69 | then throw("The price is wrong") | |
61 | 70 | 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)])) | |
62 | 71 | } | |
63 | 72 | } | |
64 | 73 | ||
65 | 74 | ||
66 | 75 | ||
67 | 76 | @Callable(invoke) | |
68 | 77 | func emailCertification (messageid,uuid,data) = { | |
69 | 78 | 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) | |
82 | 81 | 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) | |
89 | 83 | if ((entryExist != "NONE")) | |
90 | 84 | then throw("This entry already exist") | |
91 | 85 | else if ((uuidExist != "NONE")) | |
92 | 86 | then throw("This uuid already exist") | |
93 | 87 | else if ((size(uuid) > 36)) | |
94 | 88 | then throw("Uuid is too long") | |
95 | 89 | else if ((callerIsWhiteListedNum > 0)) | |
96 | 90 | 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)])) | |
97 | 91 | else { | |
98 | 92 | let payment = extract(invoke.payment) | |
99 | 93 | let amount = extract(payment.amount) | |
100 | 94 | let paymentAssetId = if (isDefined(payment.assetId)) | |
101 | 95 | then extract(payment.assetId) | |
102 | 96 | else throw("Waves is not accepted as payment") | |
103 | 97 | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
104 | 98 | case a: String => | |
105 | 99 | a | |
106 | 100 | case _ => | |
107 | 101 | throw("This token is not accepted at the moment") | |
108 | 102 | } | |
109 | 103 | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
110 | 104 | if ((acceptedToken != "WHITELISTED")) | |
111 | 105 | then throw("This token is not accepted at the moment") | |
112 | 106 | else if (if ((amount != currentPrice)) | |
113 | 107 | then (0 >= callerIsWhiteListedNum) | |
114 | 108 | else false) | |
115 | 109 | then throw("The price is wrong") | |
116 | 110 | 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)])) | |
117 | 111 | } | |
118 | 112 | } | |
119 | 113 | ||
120 | 114 |
github/deemru/w8io/026f985 24.44 ms ◑