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