tx · 4n5AWKDB3X87kqWGSuKuhBCzXYMVo1b1UZsF421FNA9T

3NBoZGzVNdXHr7zKjezMTPScBxZxcDRDGNA:  -0.01000000 Waves

2020.09.23 08:59 [1189555] smart account 3NBoZGzVNdXHr7zKjezMTPScBxZxcDRDGNA > SELF 0.00000000 Waves

{ "type": 13, "id": "4n5AWKDB3X87kqWGSuKuhBCzXYMVo1b1UZsF421FNA9T", "fee": 1000000, "feeAssetId": null, "timestamp": 1600840751359, "version": 2, "chainId": 84, "sender": "3NBoZGzVNdXHr7zKjezMTPScBxZxcDRDGNA", "senderPublicKey": "9jJcHPNsjfevinvYw4BMoJcT3LjdWXBJ9nmqgwC6T8zy", "proofs": [ "evGr64uC58fshphDTfEo7wMyMxEBqw1JXAvGWLG8Z2XZ3hdAVNHeJiNN42Jjnpnom7cYHaGqdGMw6r49nEX9FTk" ], "script": "base64:AAIEAAAAAAAAABoIAhIDCgEBEgMKAQgSBAoCCAgSBAoCCAgSAAAAAAkAAAAABkxFU1NPTgEAAAAg6OdIfDiOzW+ts6FrKmoGBQyHvIqj4OP++9eUJIMA4OkAAAAABFBBUjcBAAAAIM5YQP2Y4rTFk3fjHMVSaCtBnCyxqxHVfGnKN+eS6UeMAAAAAARKUFlOAQAAACCmTC3V3D8eNfjHPi7DVbvBO0eo/+Gir84g9LzlVJx3YAAAAAAEVVNETgEAAAAgImQ/Hr5gRukRahMT3KYz/hZ+B/l36bPyFfyZSSowCjcAAAAAB1BBUjdQQVkBAAAAIJedbhD+DwLKhAB/H26DYx4Zv6xpfO57kM3OSOXSB0EjAAAAABRsZXNzb25Pd25lclB1YmxpY0tleQEAAAAg1vK/kBzQxF1/u6KI6jnuBHLyHrob3fKaNiibyNQyRVQAAAAAB3BlbmRpbmcAAAAAAAAAAAAAAAAABXN0YXJ0AAAAAAAAAAABAAAAAANlbmQAAAAAAAAAAAIAAAAFAAAAAWkBAAAACWJ1eVRpY2tldAAAAAEAAAALdGlja2V0UHJpY2UEAAAAA3Btd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RjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAQAAAAGdGlja2V0CQACWQAAAAEFAAAACHRpY2tldElkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAhvd25lcktleQUAAAAObmV3T3duZXJBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAEGxlc3NvbkN1cnJlbnRLZXkFAAAAA2VuZAkABEwAAAACCQEAAAAEQnVybgAAAAIFAAAABkxFU1NPTgUAAAANcGF5bWVudEFtb3VudAUAAAADbmlsAAAAAWkBAAAADW93bmVyV2l0aGRyYXcAAAAABAAAAAhvd25lcktleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACG93bmVyS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIAAAAAAAAAAAAFAAAADWN1cnJlbnRBbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAhvd25lcktleQAAAAAAAAAAAAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWN1cnJlbnRBbW91bnQFAAAABFBBUjcFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAABRsZXNzb25Pd25lclB1YmxpY0tledzwDPQ=", "height": 1189555, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 4 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let LESSON = base58'GgA8mL3SEYvuhYoZFd418Li4bqXAasGbYCKJshTt2MGU'
5+
6+let PAR7 = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
7+
8+let JPYN = base58'CCA3xSCed22LYv22gZ646XjKQikbGYRe49StqbrSkNEK'
9+
10+let USDN = base58'3KFXBGGLCjA5Z2DuW4Dq9fDDrHjJJP1ZEkaoajSzuKsC'
11+
12+let PAR7PAY = base58'BCqo4hvDBB2dzmidJQKkVtQtkgEQVVwMy1jjV4R4tNB4'
13+
14+let lessonOwnerPublicKey = base58'FU4wEpLzTjfekkKGGSaXKgBmP1LNJu6ewSw82z6AjoXH'
15+
16+let pending = 0
17+
18+let start = 1
19+
20+let end = 2
21+
22+@Callable(i)
23+func buyTicket (ticketPrice) = {
24+ let pmt = i.payments[0]
25+ let rateAmount = (pmt.amount / ticketPrice)
26+ if ((pmt.assetId != PAR7))
27+ then throw("works with PAR7 only")
28+ else {
29+ let buyCurrentKey = toBase58String(i.caller.bytes)
30+ let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
31+ case a: Int =>
32+ a
33+ case _ =>
34+ 0
35+ }
36+ let buyNewAmount = (buyCurrentAmount + rateAmount)
37+[IntegerEntry(("buy_" + buyCurrentKey), buyNewAmount), ScriptTransfer(i.caller, rateAmount, LESSON)]
38+ }
39+ }
40+
41+
42+
43+@Callable(i)
44+func lessonSubscription (lessonId) = {
45+ let pmt = i.payments[0]
46+ let pmtId = pmt.assetId
47+ let studentAddress = toBase58String(i.caller.bytes)
48+ let lessonCurrentKey = ((lessonId + "_") + studentAddress)
49+ let lessonFeeCurrentKey = ((("fee_" + lessonId) + "_") + studentAddress)
50+ let ticketId = toBase58String(value(pmtId))
51+ let ticketCurrentKey = ((ticketId + "_") + studentAddress)
52+ let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
53+ case a: Int =>
54+ a
55+ case _ =>
56+ 0
57+ }
58+ let ticketNewAmount = (ticketCurrentAmount + pmt.amount)
59+[IntegerEntry(lessonCurrentKey, pending), IntegerEntry(lessonFeeCurrentKey, pmt.amount), IntegerEntry(ticketCurrentKey, ticketNewAmount)]
60+ }
61+
62+
63+
64+@Callable(i)
65+func lessonStart (lessonId,studentAddress) = {
66+ let lessonCurrentKey = ((lessonId + "_") + studentAddress)
67+[IntegerEntry(lessonCurrentKey, start)]
68+ }
69+
70+
71+
72+@Callable(i)
73+func lessonFinish (lessonId,studentAddress) = {
74+ let ticketId = toBase58String(value(LESSON))
75+ let lessonFeeCurrentKey = ((("fee_" + lessonId) + "_") + studentAddress)
76+ let paymentAmount = match getInteger(this, lessonFeeCurrentKey) {
77+ case a: Int =>
78+ a
79+ case _ =>
80+ 0
81+ }
82+ let ownerKey = toBase58String(i.caller.bytes)
83+ let ownerAmount = match getInteger(this, ownerKey) {
84+ case a: Int =>
85+ a
86+ case _ =>
87+ 0
88+ }
89+ let newOwnerAmount = (ownerAmount + paymentAmount)
90+ let lessonCurrentKey = ((lessonId + "_") + studentAddress)
91+ let ticketCurrentKey = ((ticketId + "_") + studentAddress)
92+ let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
93+ case a: Int =>
94+ a
95+ case _ =>
96+ 0
97+ }
98+ let ticket = fromBase58String(ticketId)
99+[IntegerEntry(ownerKey, newOwnerAmount), IntegerEntry(lessonCurrentKey, end), Burn(LESSON, paymentAmount)]
100+ }
101+
102+
103+
104+@Callable(i)
105+func ownerWithdraw () = {
106+ let ownerKey = toBase58String(i.caller.bytes)
107+ let currentAmount = match getInteger(this, ownerKey) {
108+ case a: Int =>
109+ a
110+ case _ =>
111+ 0
112+ }
113+ if ((0 > currentAmount))
114+ then throw("Can't withdraw negative amount")
115+ else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, PAR7)]
116+ }
117+
118+
119+@Verifier(tx)
120+func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], lessonOwnerPublicKey)
121+

github/deemru/w8io/026f985 
20.77 ms