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