tx · Eh3syjnLB5kZtgMfmuAYBD4k4cZCZZ9z8XGhKFDEFr8m 3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU: -0.01000000 Waves 2020.09.22 03:50 [1187820] smart account 3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU > SELF 0.00000000 Waves
{ "type": 13, "id": "Eh3syjnLB5kZtgMfmuAYBD4k4cZCZZ9z8XGhKFDEFr8m", "fee": 1000000, "feeAssetId": null, "timestamp": 1600735802044, "version": 2, "chainId": 84, "sender": "3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU", "senderPublicKey": "Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz", "proofs": [ "3E8KKs9oYp3YGZqsbS4SWyxwuNnUd1ZTtmBeZcC722kT2bzvYLLWDc2y3zKnLLmHg3rNcABtc2Nj8kcyAcgR8HU" ], "script": "base64:AAIEAAAAAAAAACAIAhIECgIBCBIDCgEIEgYKBAgICAESBwoFCAgIAQESAAAAAAUAAAAADHBheW1lbnRBc3NldAEAAAAgzlhA/ZjitMWTd+McxVJoK0GcLLGrEdV8aco355LpR4wAAAAAFGxlc3Nvbk93bmVyUHVibGljS2V5AQAAACDL8+i1dh5Vr1e4XeTXQeu2gcnq6/18vsaB8jf4EQnUaQAAAAAHcGVuZGluZwAAAAAAAAAAAAAAAAAFc3RhcnQAAAAAAAAAAAEAAAAAA2VuZAAAAAAAAAAAAgAAAAUAAAABaQEAAAAJYnV5VGlja2V0AAAAAgAAAApzd2FwQW1vdW50AAAACHRpY2tldElkBAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAADHBheW1lbnRBc3NldAkAAAIAAAABAgAAABx3b3JrcyB3aXRoIHBheW1lbnRBc3NldCBvbmx5BAAAAA1idXlDdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxs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JlbnRLZXkFAAAAA2VuZAkABEwAAAACCQEAAAAEQnVybgAAAAIFAAAABnRpY2tldAUAAAAMdGlja2V0QW1vdW50BQAAAANuaWwAAAABaQEAAAANb3duZXJXaXRoZHJhdwAAAAAEAAAACG93bmVyS2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAIb3duZXJLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgAAAAAAAAAAAAUAAAANY3VycmVudEFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACG93bmVyS2V5AAAAAAAAAAAACQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAANY3VycmVudEFtb3VudAUAAAAMcGF5bWVudEFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAUbGVzc29uT3duZXJQdWJsaWNLZXm/zj88", "height": 1187820, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: FzE1pGfo3rHTE7Y1uhAH7GyqGZcPQqRFfvFFyzwxvKkt Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 4 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let paymentAsset = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm' | |
5 | + | ||
6 | + | let lessonOwnerPublicKey = base58'Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz' | |
7 | + | ||
8 | + | let pending = 0 | |
9 | + | ||
10 | + | let start = 1 | |
11 | + | ||
12 | + | let end = 2 | |
13 | + | ||
14 | + | @Callable(i) | |
15 | + | func buyTicket (swapAmount,ticketId) = { | |
16 | + | let pmt = i.payments[0] | |
17 | + | if ((pmt.assetId != paymentAsset)) | |
18 | + | then throw("works with paymentAsset only") | |
19 | + | else { | |
20 | + | let buyCurrentKey = toBase58String(i.caller.bytes) | |
21 | + | let buyCurrentAmount = match getInteger(this, buyCurrentKey) { | |
22 | + | case a: Int => | |
23 | + | a | |
24 | + | case _ => | |
25 | + | 0 | |
26 | + | } | |
27 | + | let buyNewAmount = (buyCurrentAmount + pmt.amount) | |
28 | + | let rateAmount = (pmt.amount * swapAmount) | |
29 | + | let ticket = toBytes(ticketId) | |
30 | + | [IntegerEntry(buyCurrentKey, buyNewAmount), ScriptTransfer(i.caller, rateAmount, ticket)] | |
31 | + | } | |
32 | + | } | |
33 | + | ||
34 | + | ||
35 | + | ||
36 | + | @Callable(i) | |
37 | + | func lessonSubscription (lessonId) = { | |
38 | + | let pmt = i.payments[0] | |
39 | + | let pmtId = pmt.assetId | |
40 | + | let ticketId = toBase58String(value(pmtId)) | |
41 | + | let studentAddress = toBase58String(i.caller.bytes) | |
42 | + | let lessonCurrentKey = ((lessonId + "_") + studentAddress) | |
43 | + | let ticketCurrentKey = ((ticketId + "_") + studentAddress) | |
44 | + | let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) { | |
45 | + | case a: Int => | |
46 | + | a | |
47 | + | case _ => | |
48 | + | 0 | |
49 | + | } | |
50 | + | let ticketNewAmount = (ticketCurrentAmount + pmt.amount) | |
51 | + | [IntegerEntry(lessonCurrentKey, pending), IntegerEntry(ticketCurrentKey, ticketNewAmount)] | |
52 | + | } | |
53 | + | ||
54 | + | ||
55 | + | ||
56 | + | @Callable(i) | |
57 | + | func lessonStart (lessonID,studentAddress,ticketId,paymentAmount) = { | |
58 | + | let buyCurrentKey = ((ticketId + "_") + studentAddress) | |
59 | + | let buyCurrentAmount = match getInteger(this, buyCurrentKey) { | |
60 | + | case a: Int => | |
61 | + | a | |
62 | + | case _ => | |
63 | + | 0 | |
64 | + | } | |
65 | + | let buyNewAmount = (buyCurrentAmount - paymentAmount) | |
66 | + | let lessonCurrentKey = ((lessonID + "_") + studentAddress) | |
67 | + | [IntegerEntry(buyCurrentKey, buyNewAmount), IntegerEntry(lessonCurrentKey, start)] | |
68 | + | } | |
69 | + | ||
70 | + | ||
71 | + | ||
72 | + | @Callable(i) | |
73 | + | func lessonFinish (lessonId,ticketId,studentAddress,paymentAmount,ticketAmount) = { | |
74 | + | let ownerKey = toBase58String(i.caller.bytes) | |
75 | + | let ownerAmount = match getInteger(this, ownerKey) { | |
76 | + | case a: Int => | |
77 | + | a | |
78 | + | case _ => | |
79 | + | 0 | |
80 | + | } | |
81 | + | let newOwnerAmount = (ownerAmount + paymentAmount) | |
82 | + | let lessonCurrentKey = ((lessonId + "_") + studentAddress) | |
83 | + | let ticketCurrentKey = ((ticketId + "_") + studentAddress) | |
84 | + | let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) { | |
85 | + | case a: Int => | |
86 | + | a | |
87 | + | case _ => | |
88 | + | 0 | |
89 | + | } | |
90 | + | let ticket = fromBase58String(ticketId) | |
91 | + | [IntegerEntry(ownerKey, newOwnerAmount), IntegerEntry(lessonCurrentKey, end), Burn(ticket, ticketAmount)] | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | ||
96 | + | @Callable(i) | |
97 | + | func ownerWithdraw () = { | |
98 | + | let ownerKey = toBase58String(i.caller.bytes) | |
99 | + | let currentAmount = match getInteger(this, ownerKey) { | |
100 | + | case a: Int => | |
101 | + | a | |
102 | + | case _ => | |
103 | + | 0 | |
104 | + | } | |
105 | + | if ((0 > currentAmount)) | |
106 | + | then throw("Can't withdraw negative amount") | |
107 | + | else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, paymentAsset)] | |
108 | + | } | |
109 | + | ||
110 | + | ||
111 | + | @Verifier(tx) | |
112 | + | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], lessonOwnerPublicKey) | |
113 | + |
github/deemru/w8io/026f985 16.89 ms ◑