tx · 8NCvqyjmtQstQ75WrkrNXTxFduHQxDRAYpJfvVeotNXD 3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z: -0.01400000 Waves 2019.10.17 01:12 [723138] smart account 3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z > SELF 0.00000000 Waves
{ "type": 13, "id": "8NCvqyjmtQstQ75WrkrNXTxFduHQxDRAYpJfvVeotNXD", "fee": 1400000, "feeAssetId": null, "timestamp": 1571263997917, "version": 1, "sender": "3N9nVNxRXkYG1LxBamitnLpZzXcjGDZ2Q6z", "senderPublicKey": "EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1", "proofs": [ "3KpUnAaR5YG5vvmN3oRodcPo9xhLhP2vxCzUYgUQSt4gZD3MXiKbPVHugWxynNVVZWcP62N6KCe6L5C2MKwXMAmK" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgASAwoBAQAAAAEAAAAABW93bmVyAQAAACDEjmw5zzkX3oDIwQ5BL5mutxduNY61q+A7lXL1UaMULAAAAAMAAAABaQEAAAAIcHVyY2hhcmUAAAAABAAAAANwbXQJAQAAAAdleHRyYWN0AAAAAQgFAAAAAWkAAAAHcGF5bWVudAMJAQAAAAlpc0RlZmluZWQAAAABCAUAAAADcG10AAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAkeW91IGNhbiB1c2UgV0FWRVMgb25seSBhdCB0aGUgbW9tZW50BAAAAA5jdXN0b21lckFkZHJlcwkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAAVwcmljZQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzAgAAABNpdGVtX0FfY291cG9uX3ByaWNlAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIFAAAABXByaWNlCAUAAAADcG10AAAABmFtb3VudAkAAAIAAAABAgAAAC5w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4AQAAAAZ2ZXJpZnkAAAAABAAAAAckbWF0Y2gwBQAAAAJ0eAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAUU2V0U2NyaXB0VHJhbnNhY3Rpb24EAAAAAWEFAAAAByRtYXRjaDAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAAAVvd25lcgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPRGF0YVRyYW5zYWN0aW9uBAAAAAFiBQAAAAckbWF0Y2gwBgeRWOaH", "chainId": 84, "height": 723138, "spentComplexity": 0 } View: original | compacted Prev: 2RZV2V7Zt7uuBL5AMmoqSNqfbhy8Bdqjc8EN2iRsRxfb Next: 5R3UgoPr5yrLBYn9tkS1vbxHtVXno8g8tkVtKs8Y4mKB Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let owner = base58'EEGsMXJbL3i6pER7gfBpcw87Km3h2gz6qiqhqPXbdob1' | |
5 | 5 | ||
6 | 6 | @Callable(i) | |
7 | 7 | func purchare () = { | |
8 | 8 | let pmt = extract(i.payment) | |
9 | 9 | if (isDefined(pmt.assetId)) | |
10 | 10 | then throw("you can use WAVES only at the moment") | |
11 | 11 | else { | |
12 | 12 | let customerAddres = toBase58String(i.caller.bytes) | |
13 | 13 | let price = match getInteger(this, "item_A_coupon_price") { | |
14 | 14 | case a: Int => | |
15 | 15 | a | |
16 | 16 | case _ => | |
17 | 17 | 0 | |
18 | 18 | } | |
19 | 19 | if ((price > pmt.amount)) | |
20 | 20 | then throw("purchare amount cannot be less that item price") | |
21 | 21 | else if ((pmt.amount > price)) | |
22 | 22 | then throw("purchare amount cannot be higher that item price") | |
23 | 23 | else WriteSet([DataEntry(("status:purchare_item_A_customer_" + customerAddres), "confirmed"), DataEntry(("price:purchare_item_A_customer" + customerAddres), price)]) | |
24 | 24 | } | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | ||
29 | 29 | @Callable(i) | |
30 | 30 | func deposit () = { | |
31 | 31 | let pmt = extract(i.payment) | |
32 | 32 | if (isDefined(pmt.assetId)) | |
33 | 33 | then throw("you can use WAVES only at the moment") | |
34 | 34 | else { | |
35 | 35 | let currentKey = toBase58String(i.caller.bytes) | |
36 | 36 | let currentAmount = match getInteger(this, ("wl_sts" + currentKey)) { | |
37 | 37 | case a: Int => | |
38 | 38 | a | |
39 | 39 | case _ => | |
40 | 40 | 0 | |
41 | 41 | } | |
42 | 42 | let wlStsCurr = match getString(this, ("wls_sts" + currentKey)) { | |
43 | 43 | case a: String => | |
44 | 44 | a | |
45 | 45 | case _ => | |
46 | 46 | throw("user has not waitlisted") | |
47 | 47 | } | |
48 | 48 | let newAmount = (currentAmount + pmt.amount) | |
49 | 49 | WriteSet([DataEntry(currentKey, newAmount)]) | |
50 | 50 | } | |
51 | 51 | } | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | ||
55 | 55 | @Callable(i) | |
56 | 56 | func withdraw (amount) = { | |
57 | 57 | let currentKey = toBase58String(i.caller.bytes) | |
58 | 58 | let currentAmount = match getInteger(this, currentKey) { | |
59 | 59 | case a: Int => | |
60 | 60 | a | |
61 | 61 | case _ => | |
62 | 62 | 0 | |
63 | 63 | } | |
64 | 64 | let newAmount = (currentAmount - amount) | |
65 | 65 | if ((0 > amount)) | |
66 | 66 | then throw("can't withdraw negative amount") | |
67 | 67 | else if ((0 > newAmount)) | |
68 | 68 | then throw("not enough balance") | |
69 | 69 | else ScriptResult(WriteSet([DataEntry(currentKey, newAmount)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
70 | 70 | } | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | @Verifier(tx) | |
74 | 74 | func verify () = match tx { | |
75 | 75 | case a: SetScriptTransaction => | |
76 | 76 | sigVerify(tx.bodyBytes, tx.proofs[0], owner) | |
77 | 77 | case b: DataTransaction => | |
78 | 78 | true | |
79 | 79 | case _ => | |
80 | 80 | false | |
81 | 81 | } | |
82 | 82 |
github/deemru/w8io/169f3d6 31.01 ms ◑