tx · 7eNNx2X8dEm3zfURuHEEyv3vgK6pnp68iVMjt9t4BiPT 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB: -0.01400000 Waves 2019.11.16 11:40 [767436] smart account 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB > SELF 0.00000000 Waves
{ "type": 13, "id": "7eNNx2X8dEm3zfURuHEEyv3vgK6pnp68iVMjt9t4BiPT", "fee": 1400000, "feeAssetId": null, "timestamp": 1573893703130, "version": 1, "sender": "3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB", "senderPublicKey": "Gd5NihbWQoWuTnSvq25TuV2BYZG4U1e9KDqZn9zBPix7", "proofs": [ "3zVgBbNw8izjdFMRtFBpN5LYZk88ggnyNfGDgcYhYEwPa6qsPJYY1hX6SAQbhUH3K5P4kFtYZFL6AR1ywuyAVoai" ], "script": "base64:AAIDAAAAAAAAAAoIARIGCgQICAgIAAAAAgAAAAAIdmVyaWZpZXIJAQAAAAdleHRyYWN0AAAAAQkBAAAAEWFkZHJlc3NGcm9tU3RyaW5nAAAAAQIAAAAjM04yczVSdGFIUEJlbkNzeDJFQ2NvRlJiWUh4M25vWmhYVzEAAAAABGJhbmsCAAAAIzNOMUU2dFhkZFJvVmFSZlE5ZFEzdmc1TGFXMmZzZDhIS3ViAAAAAQAAAAZpbnZva2UBAAAAEWZpbGVDZXJ0aWZpY2F0aW9uAAAABAAAAARoYXNoAAAABXRpdGxlAAAABHV1aWQAAAAEZGF0YQQAAAACaWQJAQAAAAdleHRyYWN0AAAAAQgFAAAABmludm9rZQAAAA10cmFuc2FjdGlvbklkBAAAAAplbnRyeUV4aXN0BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAEaGFzaAUAAAAEdXVpZAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAROT05FBAAAAAl1dWlkRXhpc3QEAAAABy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nRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAACGRhdGFfZmNfCQACWAAAAAEFAAAAAmlkAgAAAAFfBQAAAA1jYWxsZXJBZGRyZXNzBQAAAARkYXRhBQAAAANuaWwAAAAAMJLsYg==", "chainId": 84, "height": 767436, "spentComplexity": 0 } View: original | compacted Prev: 3NNnoBLG7adtUQ2PBx4fXe27goJotiVVpVsLbD1zEkEy Next: 6yTobJJtqnuVGT2q6MC127Whc1mApLeVEagu9W2e67CM Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | @Callable(invoke) | |
9 | 9 | func fileCertification (hash,title,uuid,data) = { | |
10 | - | let payment = extract(invoke.payment) | |
11 | - | let amount = extract(payment.amount) | |
12 | 10 | let id = extract(invoke.transactionId) | |
13 | 11 | let entryExist = match getString(this, (hash + uuid)) { | |
14 | 12 | case a: String => | |
39 | 37 | then throw("Hash is too long") | |
40 | 38 | else if ((size(title) > 64)) | |
41 | 39 | then throw("Title is too long") | |
42 | - | else { | |
43 | - | let paymentAssetId = if (isDefined(payment.assetId)) | |
44 | - | then extract(payment.assetId) | |
45 | - | else throw("Waves is not accepted as payment") | |
46 | - | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
47 | - | case a: String => | |
48 | - | a | |
49 | - | case _ => | |
50 | - | throw("This token is not accepted at the moment") | |
51 | - | } | |
52 | - | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
53 | - | if ((acceptedToken != "WHITELISTED")) | |
54 | - | then throw("This token is not accepted at the moment") | |
55 | - | else if (if ((amount != currentPrice)) | |
56 | - | then (0 >= callerIsWhiteListedNum) | |
57 | - | else false) | |
58 | - | then throw("The price is wrong") | |
59 | - | else if ((callerIsWhiteListedNum > 0)) | |
60 | - | 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(addressFromStringValue(bank), amount, payment.assetId)])) | |
40 | + | else if (isDefined(invoke.payment)) | |
41 | + | then { | |
42 | + | let payment = extract(invoke.payment) | |
43 | + | let amount = extract(payment.amount) | |
44 | + | let paymentAssetId = if (isDefined(payment.assetId)) | |
45 | + | then extract(payment.assetId) | |
46 | + | else throw("Waves is not accepted as payment") | |
47 | + | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
48 | + | case a: String => | |
49 | + | a | |
50 | + | case _ => | |
51 | + | throw("This token is not accepted at the moment") | |
52 | + | } | |
53 | + | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
54 | + | if ((acceptedToken != "WHITELISTED")) | |
55 | + | then throw("This token is not accepted at the moment") | |
56 | + | else if ((amount != currentPrice)) | |
57 | + | then throw("The price is wrong") | |
61 | 58 | 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 | - | } | |
59 | + | } | |
60 | + | else if ((0 >= callerIsWhiteListedNum)) | |
61 | + | then throw("You are not White Listed, please attach a payment.") | |
62 | + | else 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)]) | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 |
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 | - | let payment = extract(invoke.payment) | |
11 | - | let amount = extract(payment.amount) | |
12 | 10 | let id = extract(invoke.transactionId) | |
13 | 11 | let entryExist = match getString(this, (hash + uuid)) { | |
14 | 12 | case a: String => | |
15 | 13 | a | |
16 | 14 | case _ => | |
17 | 15 | "NONE" | |
18 | 16 | } | |
19 | 17 | let uuidExist = match getString(this, uuid) { | |
20 | 18 | case a: String => | |
21 | 19 | a | |
22 | 20 | case _ => | |
23 | 21 | "NONE" | |
24 | 22 | } | |
25 | 23 | let callerAddress = toBase58String(invoke.caller.bytes) | |
26 | 24 | let callerIsWhiteListedNum = match getInteger(this, ("addr_WHITELISTED_" + callerAddress)) { | |
27 | 25 | case a: Int => | |
28 | 26 | a | |
29 | 27 | case _ => | |
30 | 28 | 0 | |
31 | 29 | } | |
32 | 30 | if ((entryExist != "NONE")) | |
33 | 31 | then throw("This entry already exist") | |
34 | 32 | else if ((uuidExist != "NONE")) | |
35 | 33 | then throw("This uuid already exist") | |
36 | 34 | else if ((size(uuid) > 36)) | |
37 | 35 | then throw("Uuid is too long") | |
38 | 36 | else if ((size(hash) > 64)) | |
39 | 37 | then throw("Hash is too long") | |
40 | 38 | else if ((size(title) > 64)) | |
41 | 39 | then throw("Title is too long") | |
42 | - | else { | |
43 | - | let paymentAssetId = if (isDefined(payment.assetId)) | |
44 | - | then extract(payment.assetId) | |
45 | - | else throw("Waves is not accepted as payment") | |
46 | - | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
47 | - | case a: String => | |
48 | - | a | |
49 | - | case _ => | |
50 | - | throw("This token is not accepted at the moment") | |
51 | - | } | |
52 | - | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
53 | - | if ((acceptedToken != "WHITELISTED")) | |
54 | - | then throw("This token is not accepted at the moment") | |
55 | - | else if (if ((amount != currentPrice)) | |
56 | - | then (0 >= callerIsWhiteListedNum) | |
57 | - | else false) | |
58 | - | then throw("The price is wrong") | |
59 | - | else if ((callerIsWhiteListedNum > 0)) | |
60 | - | 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(addressFromStringValue(bank), amount, payment.assetId)])) | |
40 | + | else if (isDefined(invoke.payment)) | |
41 | + | then { | |
42 | + | let payment = extract(invoke.payment) | |
43 | + | let amount = extract(payment.amount) | |
44 | + | let paymentAssetId = if (isDefined(payment.assetId)) | |
45 | + | then extract(payment.assetId) | |
46 | + | else throw("Waves is not accepted as payment") | |
47 | + | let acceptedToken = match getString(verifier, ("white_list_token_" + toBase58String(extract(paymentAssetId)))) { | |
48 | + | case a: String => | |
49 | + | a | |
50 | + | case _ => | |
51 | + | throw("This token is not accepted at the moment") | |
52 | + | } | |
53 | + | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toBase58String(extract(paymentAssetId)))) | |
54 | + | if ((acceptedToken != "WHITELISTED")) | |
55 | + | then throw("This token is not accepted at the moment") | |
56 | + | else if ((amount != currentPrice)) | |
57 | + | then throw("The price is wrong") | |
61 | 58 | 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 | - | } | |
59 | + | } | |
60 | + | else if ((0 >= callerIsWhiteListedNum)) | |
61 | + | then throw("You are not White Listed, please attach a payment.") | |
62 | + | else 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)]) | |
63 | 63 | } | |
64 | 64 | ||
65 | 65 |
github/deemru/w8io/026f985 39.12 ms ◑