tx · 5AAD11qPuV4nqxuS9UvxDerDyYHfq2V5SRyuNKcs5X5t 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB: -0.01400000 Waves 2019.09.25 12:42 [691697] smart account 3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB > SELF 0.00000000 Waves
{ "type": 13, "id": "5AAD11qPuV4nqxuS9UvxDerDyYHfq2V5SRyuNKcs5X5t", "fee": 1400000, "feeAssetId": null, "timestamp": 1569404556856, "version": 1, "sender": "3NC28hSivrmsTUXaYD1x6L362J4ZpUnoTdB", "senderPublicKey": "Gd5NihbWQoWuTnSvq25TuV2BYZG4U1e9KDqZn9zBPix7", "proofs": [ "2g3Y8WnqNtxqoTsa451P1t5BZmNYZ3UoE3V67y81T5rumK4WhLUQnGcDpMDh93zVmkmC7Fgp6DTRiq5mR5aCSLYb" ], "script": "base64:AAIDAAAAAAAAAAAAAAACAAAAAAh2ZXJpZmllcgkBAAAAB2V4dHJhY3QAAAABCQEAAAARYWRkcmVzc0Zyb21TdHJpbmcAAAABAgAAACMzTkN6QXBHM2thNHR2RHVLWDhIeG5KdFhlN2VKdzVQbWRWdAAAAAAEYmFuawIAAAAjM04xRTZ0WGRkUm9WYVJmUTlkUTN2ZzVMYVcyZnNkOEhLdWIAAAABAAAABmludm9rZQEAAAARZmlsZUNlcnRpZmljYXRpb24AAAAEAAAABGhhc2gAAAAFdGl0bGUAAAAEdXVpZAAAAARkYXRhBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAZpbnZva2UAAAAHcGF5bWVudAQAAAAGYW1vdW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAdwYXltZW50AAAABmFtb3VudAQAAAACaWQJAQAAAAdleHRyYWN0AAAAAQgFAAAABmludm9rZQAAAA10cmFuc2FjdGlvbklkBAAAAAplbnRyeUV4aXN0BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMJAAEsAAAAAgUAAAAEaGFzaAUAAAAEdXVpZ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AA6uJGSg==", "chainId": 84, "height": 691697, "spentComplexity": 0 } View: original | compacted Prev: 7CmtvMV5BS4oxKwm2UAfCFkzhPdAMytPruGEpdPFhe1o Next: BGq9XLSeh9QsPhkFVsocBMiCedfxVLwb8R1pdkKZ6gpd Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let acceptedToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' | |
5 | - | ||
6 | - | let currentPrice = 350000000000 | |
4 | + | let verifier = extract(addressFromString("3NCzApG3ka4tvDuKX8HxnJtXe7eJw5PmdVt")) | |
7 | 5 | ||
8 | 6 | let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
9 | 7 | ||
36 | 34 | let paymentAssetId = if (isDefined(payment.assetId)) | |
37 | 35 | then extract(payment.assetId) | |
38 | 36 | else throw("Waves is not accepted as payment") | |
39 | - | if ((paymentAssetId != acceptedToken)) | |
40 | - | then throw("Only payments in SIGN are allowed at the moment") | |
37 | + | let acceptedToken = match getString(verifier, ("white_list_token_" + toUtf8String(paymentAssetId))) { | |
38 | + | case a: String => | |
39 | + | a | |
40 | + | case _ => | |
41 | + | throw("This token is not accepted at the moment") | |
42 | + | } | |
43 | + | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toUtf8String(paymentAssetId))) | |
44 | + | if ((acceptedToken != "WHITELISTED")) | |
45 | + | then throw("This token is not accepted at the moment") | |
41 | 46 | else if ((amount != currentPrice)) | |
42 | 47 | then throw("The price is wrong") | |
43 | - | else ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((hash + uuid), toBase58String(id)), DataEntry((title + uuid), toBase58String(id)), DataEntry(((("data_fc_" + toBase58String(id)) + "_") + toBase58String(invoke.caller.bytes)), data)]), TransferSet([ScriptTransfer(addressFromStringValue(bank), amount, | |
48 | + | else ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((hash + uuid), toBase58String(id)), DataEntry((title + uuid), toBase58String(id)), DataEntry(((("data_fc_" + toBase58String(id)) + "_") + toBase58String(invoke.caller.bytes)), data)]), TransferSet([ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)])) | |
44 | 49 | } | |
45 | 50 | } | |
46 | 51 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let acceptedToken = base58'Gf9t8FA4H3ssoZPCwrg3KwUFCci8zuUFP9ssRsUY3s6a' | |
5 | - | ||
6 | - | let currentPrice = 350000000000 | |
4 | + | let verifier = extract(addressFromString("3NCzApG3ka4tvDuKX8HxnJtXe7eJw5PmdVt")) | |
7 | 5 | ||
8 | 6 | let bank = "3N1E6tXddRoVaRfQ9dQ3vg5LaW2fsd8HKub" | |
9 | 7 | ||
10 | 8 | @Callable(invoke) | |
11 | 9 | func fileCertification (hash,title,uuid,data) = { | |
12 | 10 | let payment = extract(invoke.payment) | |
13 | 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 | if ((entryExist != "NONE")) | |
28 | 26 | then throw("This entry already exist") | |
29 | 27 | else if ((uuidExist != "NONE")) | |
30 | 28 | then throw("This uuid already exist") | |
31 | 29 | else if ((size(uuid) > 36)) | |
32 | 30 | then throw("Uuid is too long") | |
33 | 31 | else if ((size(title) > 64)) | |
34 | 32 | then throw("Title is too long") | |
35 | 33 | else { | |
36 | 34 | let paymentAssetId = if (isDefined(payment.assetId)) | |
37 | 35 | then extract(payment.assetId) | |
38 | 36 | else throw("Waves is not accepted as payment") | |
39 | - | if ((paymentAssetId != acceptedToken)) | |
40 | - | then throw("Only payments in SIGN are allowed at the moment") | |
37 | + | let acceptedToken = match getString(verifier, ("white_list_token_" + toUtf8String(paymentAssetId))) { | |
38 | + | case a: String => | |
39 | + | a | |
40 | + | case _ => | |
41 | + | throw("This token is not accepted at the moment") | |
42 | + | } | |
43 | + | let currentPrice = getIntegerValue(verifier, ("certification_fee_" + toUtf8String(paymentAssetId))) | |
44 | + | if ((acceptedToken != "WHITELISTED")) | |
45 | + | then throw("This token is not accepted at the moment") | |
41 | 46 | else if ((amount != currentPrice)) | |
42 | 47 | then throw("The price is wrong") | |
43 | - | else ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((hash + uuid), toBase58String(id)), DataEntry((title + uuid), toBase58String(id)), DataEntry(((("data_fc_" + toBase58String(id)) + "_") + toBase58String(invoke.caller.bytes)), data)]), TransferSet([ScriptTransfer(addressFromStringValue(bank), amount, | |
48 | + | else ScriptResult(WriteSet([DataEntry(uuid, toBase58String(id)), DataEntry((hash + uuid), toBase58String(id)), DataEntry((title + uuid), toBase58String(id)), DataEntry(((("data_fc_" + toBase58String(id)) + "_") + toBase58String(invoke.caller.bytes)), data)]), TransferSet([ScriptTransfer(addressFromStringValue(bank), amount, payment.assetId)])) | |
44 | 49 | } | |
45 | 50 | } | |
46 | 51 | ||
47 | 52 |
github/deemru/w8io/026f985 28.41 ms ◑