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