tx · 9ARKRCdVBTtFf7FnRHKMnRjsYhaQScvgxPN7H8tf95oX 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB: -0.01400000 Waves 2020.01.17 07:13 [857668] smart account 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB > SELF 0.00000000 Waves
{ "type": 13, "id": "9ARKRCdVBTtFf7FnRHKMnRjsYhaQScvgxPN7H8tf95oX", "fee": 1400000, "feeAssetId": null, "timestamp": 1579234393206, "version": 1, "sender": "3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB", "senderPublicKey": "Gd5NihbWQoWuTnSvq25TuV2BYZG4U1e9KDqZn9zBPix7", "proofs": [ "4CLWbLSGiAErLgsDAG8Dz619uXSZHc2MypvBo4segKHTgTf1MxFz47E4xaJP7FKEE5qBCZMgpqkSBg8KEGSuughw" ], "script": "base64:AAIDAAAAAAAAABEIARIGCgQICAgIEgUKAwgICAAAAAIAAAAACHZlcmlmaWVyCQEAAAAHZXh0cmFjdAAAAAEJAQAAABFhZGRyZXNzRnJvbVN0cmluZwAAAAECAAAAIzNOMnM1UnRhSFBCZW5Dc3gyRUNjb0ZSYllIeDNub1poWFcxAAAAAARiYW5rAgAAACMzTjFFNnRYZGRSb1ZhUmZROWRRM3ZnNUxhVzJmc2Q4SEt1YgAAAAIAAAAGaW52b2tlAQAAABFmaWxlQ2VydGlmaWNhdGlvbgAAAAQAAAAEaGFzaAAAAAV0aXRsZQAAAAR1dWlkAAAABGRhdGEEAAAAAmlkCQEAAAAHZXh0cmFjdAAAAAEIBQAAAAZpbnZva2UAAAANdHJhbnNhY3Rpb25JZAQAAAAKZW50cnlFeGlzdAQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzCQABLAAAAAIFAAAABGhhc2gFAAAABHV1aWQDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAETk9ORQQAAAAJdXVpZEV4aXN0BAAAAAckb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AAAAAEFAAAAAmlkCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAACW1lc3NhZ2VpZAUAAAAEdXVpZAkAAlgAAAABBQAAAAJpZAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgIAAAAIZGF0YV9lY18JAAJYAAAAAQUAAAACaWQCAAAAAV8FAAAADWNhbGxlckFkZHJlc3MFAAAABGRhdGEFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAcQGV4dHJVc2VyKGFkZHJlc3NGcm9tU3RyaW5nKQAAAAEFAAAABGJhbmsFAAAABmFtb3VudAgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAUAAAADbmlsAAAAAN3Aock=", "chainId": 84, "height": 857668, "spentComplexity": 0 } View: original | compacted Prev: H1QXaFgLQac6cJ4b8xAFTfVRZ5qABmAdgsZCstyb6jAL Next: 6Un94hdcteHYjTYtM4MuNwwNWvJVevqBRfrDZ8jSZXCQ Diff:
Old | New | Differences | |
---|---|---|---|
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | + | ||
67 | + | @Callable(invoke) | |
68 | + | func emailCertification (messageid,uuid,data) = { | |
69 | + | 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 | + | } | |
82 | + | 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 | + | } | |
89 | + | if ((entryExist != "NONE")) | |
90 | + | then throw("This entry already exist") | |
91 | + | else if ((uuidExist != "NONE")) | |
92 | + | then throw("This uuid already exist") | |
93 | + | else if ((size(uuid) > 36)) | |
94 | + | then throw("Uuid is too long") | |
95 | + | else if ((callerIsWhiteListedNum > 0)) | |
96 | + | 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 | + | else { | |
98 | + | let payment = extract(invoke.payment) | |
99 | + | let amount = extract(payment.amount) | |
100 | + | let paymentAssetId = if (isDefined(payment.assetId)) | |
101 | + | then extract(payment.assetId) | |
102 | + | else throw("Waves is not accepted as payment") | |
103 | + | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
104 | + | case a: String => | |
105 | + | a | |
106 | + | case _ => | |
107 | + | throw("This token is not accepted at the moment") | |
108 | + | } | |
109 | + | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
110 | + | if ((acceptedToken != "WHITELISTED")) | |
111 | + | then throw("This token is not accepted at the moment") | |
112 | + | else if (if ((amount != currentPrice)) | |
113 | + | then (0 >= callerIsWhiteListedNum) | |
114 | + | else false) | |
115 | + | then throw("The price is wrong") | |
116 | + | 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 | + | } | |
118 | + | } | |
119 | + | ||
120 | + |
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 | 8 | @Callable(invoke) | |
9 | 9 | func fileCertification (hash,title,uuid,data) = { | |
10 | 10 | let id = extract(invoke.transactionId) | |
11 | 11 | let entryExist = match getString(this, (hash + uuid)) { | |
12 | 12 | case a: String => | |
13 | 13 | a | |
14 | 14 | case _ => | |
15 | 15 | "NONE" | |
16 | 16 | } | |
17 | 17 | let uuidExist = match getString(this, uuid) { | |
18 | 18 | case a: String => | |
19 | 19 | a | |
20 | 20 | case _ => | |
21 | 21 | "NONE" | |
22 | 22 | } | |
23 | 23 | let callerAddress = toBase58String(invoke.caller.bytes) | |
24 | 24 | let callerIsWhiteListedNum = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) { | |
25 | 25 | case a: Int => | |
26 | 26 | a | |
27 | 27 | case _ => | |
28 | 28 | 0 | |
29 | 29 | } | |
30 | 30 | if ((entryExist != "NONE")) | |
31 | 31 | then throw("This entry already exist") | |
32 | 32 | else if ((uuidExist != "NONE")) | |
33 | 33 | then throw("This uuid already exist") | |
34 | 34 | else if ((size(uuid) > 36)) | |
35 | 35 | then throw("Uuid is too long") | |
36 | 36 | else if ((size(hash) > 64)) | |
37 | 37 | then throw("Hash is too long") | |
38 | 38 | else if ((size(title) > 64)) | |
39 | 39 | then throw("Title is too long") | |
40 | 40 | else if ((callerIsWhiteListedNum > 0)) | |
41 | 41 | 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 | 42 | else { | |
43 | 43 | let payment = extract(invoke.payment) | |
44 | 44 | let amount = extract(payment.amount) | |
45 | 45 | let paymentAssetId = if (isDefined(payment.assetId)) | |
46 | 46 | then extract(payment.assetId) | |
47 | 47 | else throw("Waves is not accepted as payment") | |
48 | 48 | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
49 | 49 | case a: String => | |
50 | 50 | a | |
51 | 51 | case _ => | |
52 | 52 | throw("This token is not accepted at the moment") | |
53 | 53 | } | |
54 | 54 | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
55 | 55 | if ((acceptedToken != "WHITELISTED")) | |
56 | 56 | then throw("This token is not accepted at the moment") | |
57 | 57 | else if (if ((amount != currentPrice)) | |
58 | 58 | then (0 >= callerIsWhiteListedNum) | |
59 | 59 | else false) | |
60 | 60 | then throw("The price is wrong") | |
61 | 61 | 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 | 62 | } | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 | ||
66 | + | ||
67 | + | @Callable(invoke) | |
68 | + | func emailCertification (messageid,uuid,data) = { | |
69 | + | 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 | + | } | |
82 | + | 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 | + | } | |
89 | + | if ((entryExist != "NONE")) | |
90 | + | then throw("This entry already exist") | |
91 | + | else if ((uuidExist != "NONE")) | |
92 | + | then throw("This uuid already exist") | |
93 | + | else if ((size(uuid) > 36)) | |
94 | + | then throw("Uuid is too long") | |
95 | + | else if ((callerIsWhiteListedNum > 0)) | |
96 | + | 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 | + | else { | |
98 | + | let payment = extract(invoke.payment) | |
99 | + | let amount = extract(payment.amount) | |
100 | + | let paymentAssetId = if (isDefined(payment.assetId)) | |
101 | + | then extract(payment.assetId) | |
102 | + | else throw("Waves is not accepted as payment") | |
103 | + | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
104 | + | case a: String => | |
105 | + | a | |
106 | + | case _ => | |
107 | + | throw("This token is not accepted at the moment") | |
108 | + | } | |
109 | + | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
110 | + | if ((acceptedToken != "WHITELISTED")) | |
111 | + | then throw("This token is not accepted at the moment") | |
112 | + | else if (if ((amount != currentPrice)) | |
113 | + | then (0 >= callerIsWhiteListedNum) | |
114 | + | else false) | |
115 | + | then throw("The price is wrong") | |
116 | + | 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 | + | } | |
118 | + | } | |
119 | + | ||
120 | + |
github/deemru/w8io/026f985 43.97 ms ◑