tx · EgKs4AaKg79xcC5qaAqcTQ8WwAZk8vHZsCXKXeUuvagp

3Mx9FcvbywzbM3uTGL1ocnC6Yz4LwG6VNnQ:  -0.01400000 Waves

2020.09.23 08:24 [1189522] smart account 3Mx9FcvbywzbM3uTGL1ocnC6Yz4LwG6VNnQ > SELF 0.00000000 Waves

{ "type": 13, "id": "EgKs4AaKg79xcC5qaAqcTQ8WwAZk8vHZsCXKXeUuvagp", "fee": 1400000, "feeAssetId": null, "timestamp": 1600838706918, "version": 2, "chainId": 84, "sender": "3Mx9FcvbywzbM3uTGL1ocnC6Yz4LwG6VNnQ", "senderPublicKey": "3rxJnS9mVKpfLXyuwkosSTVgnu1cZ6cGj1WTVNqrhcyd", "proofs": [ "64uq5XUDTqkFXwCgHe6nXNv8f9MiVYrwmHp7S6BZcWF2mDM7qWBdA39WBEhe697atUwkRGvorK7UxngRU29YzHF5" ], "script": "base64:AAIEAAAAAAAAACEIAhIECgIIARIDCgEIEgMKAQgSBAoCCAgSBQoDCAgIEgAAAAAHAAAAAAZMRVNTT04BAAAAIOjnSHw4js1vrbOhaypqBgUMh7yKo+Dj/vvXlCSDAODpAAAAAARQQVI3AQAAACDOWED9mOK0xZN34xzFUmgrQZwssasR1XxpyjfnkulHjAAAAAAUbGVzc29uQ29hY2hQdWJsaWNLZXkBAAAAIJEV1LNN0Z9m46J3ebNUFkD8Hn3i3U/7YD3XLgZSbu1vAAAAAAdwZW5kaW5nAAAAAAAAAAAAAAAAAAVzdGFydAAAAAAAAAAAAQAAAAADZW5kAAAAAAAAAAACAAAAAAxwYXltZW50VG9rZW4FAAAABFBBUjcAAAAGAAAAAWkBAAAAEWlzc3VlTGVzc29uVGlja2V0AAAAAgAAAARqc29uAAAABXByaWNlBAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAABkxFU1NPTgkAAAIAAAABAgAAABZ3b3J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JYAAAAAQgIBQAAAAFpAAAABmNhbGxlcgAAAAVieXRlcwQAAAANY3VycmVudEFtb3VudAQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAAhvd25lcktleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAwkAAGYAAAACAAAAAAAAAAAABQAAAA1jdXJyZW50QW1vdW50CQAAAgAAAAECAAAAHkNhbid0IHdpdGhkcmF3IG5lZ2F0aXZlIGFtb3VudAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAIb3duZXJLZXkAAAAAAAAAAAAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAA1jdXJyZW50QW1vdW50BQAAAARQQVI3BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleRuW9DA=", "height": 1189522, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 5N4w5gAVo7s6RBj4c3LihKgx1UtnPL9h7FPx8EAZP1E3 Next: Ad9jxEXHCKN4xK8n3HBp6vLCFVbGuH4q1LZ5jzGuJHYu Diff:
OldNewDifferences
127127 case _ =>
128128 0
129129 }
130- let lessonPaymentAmount = (lessonFeeCurrentAmount / ticketPriceCurrentAmount)
130+ let lessonPaymentAmount = (lessonFeeCurrentAmount * ticketPriceCurrentAmount)
131131 let ownerKey = ("owner_balance_" + toBase58String(i.caller.bytes))
132132 let ownerAmount = match getInteger(this, ownerKey) {
133133 case a: Int =>
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let LESSON = base58'GgA8mL3SEYvuhYoZFd418Li4bqXAasGbYCKJshTt2MGU'
55
66 let PAR7 = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
77
88 let lessonCoachPublicKey = base58'AmMRZeqDosA2ygpV6GTCJrK3KVvrf4ST7ECPj9pub4mU'
99
1010 let pending = 0
1111
1212 let start = 1
1313
1414 let end = 2
1515
1616 let paymentToken = PAR7
1717
1818 @Callable(i)
1919 func issueLessonTicket (json,price) = {
2020 let pmt = i.payments[0]
2121 if ((pmt.assetId != LESSON))
2222 then throw("works with LESSON only")
2323 else {
2424 let issueCurrentKey = "issueNumber"
2525 let issueCurrentNumber = match getInteger(this, issueCurrentKey) {
2626 case a: Int =>
2727 a
2828 case _ =>
2929 0
3030 }
3131 let newIssueNumber = (issueCurrentNumber + 1)
3232 let newIssueNumberString = toString(newIssueNumber)
3333 let ticketDetailsCurrentKey = (("TICKET_" + newIssueNumberString) + "_details")
3434 let ticketPriceCurrentKey = (("TICKET_" + newIssueNumberString) + "_price")
3535 let ticketBalanceCurrentKey = (("TICKET_" + newIssueNumberString) + "_balance")
3636 let ticketBalanceCurrentAmount = match getInteger(this, ticketBalanceCurrentKey) {
3737 case a: Int =>
3838 a
3939 case _ =>
4040 0
4141 }
4242 let newTicketBalanceAmount = (ticketBalanceCurrentAmount + pmt.amount)
4343 [IntegerEntry(ticketPriceCurrentKey, price), IntegerEntry(issueCurrentKey, newIssueNumber), StringEntry(ticketDetailsCurrentKey, json), IntegerEntry(ticketBalanceCurrentKey, newTicketBalanceAmount)]
4444 }
4545 }
4646
4747
4848
4949 @Callable(i)
5050 func buyTicket (ticketNumber) = {
5151 let pmt = i.payments[0]
5252 let ticketPriceCurrentKey = (("TICKET_" + ticketNumber) + "_price")
5353 let ticketPriceCurrentAmount = match getInteger(this, ticketPriceCurrentKey) {
5454 case a: Int =>
5555 a
5656 case _ =>
5757 0
5858 }
5959 let ticketPrice = ticketPriceCurrentAmount
6060 let rateAmount = (pmt.amount / ticketPrice)
6161 if ((pmt.assetId != paymentToken))
6262 then throw("works with PAR7 only")
6363 else {
6464 let buyCurrentKey = ("buy_" + toBase58String(i.caller.bytes))
6565 let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
6666 case a: Int =>
6767 a
6868 case _ =>
6969 0
7070 }
7171 let buyNewAmount = (buyCurrentAmount + rateAmount)
7272 let ticketBalanceCurrentKey = (("TICKET_" + ticketNumber) + "_balance")
7373 let ticketBalanceCurrentAmount = match getInteger(this, ticketBalanceCurrentKey) {
7474 case a: Int =>
7575 a
7676 case _ =>
7777 0
7878 }
7979 let newTicketBalanceAmount = (ticketBalanceCurrentAmount - rateAmount)
8080 [IntegerEntry(buyCurrentKey, buyNewAmount), IntegerEntry(ticketBalanceCurrentKey, newTicketBalanceAmount), ScriptTransfer(i.caller, rateAmount, LESSON)]
8181 }
8282 }
8383
8484
8585
8686 @Callable(i)
8787 func lessonSubscription (lessonId) = {
8888 let pmt = i.payments[0]
8989 let pmtId = pmt.assetId
9090 let studentAddress = toBase58String(i.caller.bytes)
9191 let lessonStatusCurrentKey = ((("status_" + lessonId) + "_") + studentAddress)
9292 let lessonFeeCurrentKey = ((("payment_" + lessonId) + "_") + studentAddress)
9393 let lessonFeeCurrentAmount = match getInteger(this, lessonFeeCurrentKey) {
9494 case a: Int =>
9595 a
9696 case _ =>
9797 0
9898 }
9999 let ticketNewAmount = (lessonFeeCurrentAmount + pmt.amount)
100100 [IntegerEntry(lessonStatusCurrentKey, pending), IntegerEntry(lessonFeeCurrentKey, ticketNewAmount)]
101101 }
102102
103103
104104
105105 @Callable(i)
106106 func lessonStart (lessonId,studentAddress) = {
107107 let lessonStatusCurrentKey = ((("status_" + lessonId) + "_") + studentAddress)
108108 [IntegerEntry(lessonStatusCurrentKey, start)]
109109 }
110110
111111
112112
113113 @Callable(i)
114114 func lessonFinish (lessonId,studentAddress,ticketNumber) = {
115115 let ticketId = toBase58String(value(LESSON))
116116 let lessonFeeCurrentKey = ((("payment_" + lessonId) + "_") + studentAddress)
117117 let lessonFeeCurrentAmount = match getInteger(this, lessonFeeCurrentKey) {
118118 case a: Int =>
119119 a
120120 case _ =>
121121 0
122122 }
123123 let ticketPriceCurrentKey = (("TICKET_" + ticketNumber) + "_price")
124124 let ticketPriceCurrentAmount = match getInteger(this, ticketPriceCurrentKey) {
125125 case a: Int =>
126126 a
127127 case _ =>
128128 0
129129 }
130- let lessonPaymentAmount = (lessonFeeCurrentAmount / ticketPriceCurrentAmount)
130+ let lessonPaymentAmount = (lessonFeeCurrentAmount * ticketPriceCurrentAmount)
131131 let ownerKey = ("owner_balance_" + toBase58String(i.caller.bytes))
132132 let ownerAmount = match getInteger(this, ownerKey) {
133133 case a: Int =>
134134 a
135135 case _ =>
136136 0
137137 }
138138 let newOwnerAmount = (ownerAmount + lessonPaymentAmount)
139139 let lessonStatusCurrentKey = ((("status_" + lessonId) + "_") + studentAddress)
140140 let ticketCurrentKey = ((ticketId + "_") + studentAddress)
141141 let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
142142 case a: Int =>
143143 a
144144 case _ =>
145145 0
146146 }
147147 let ticket = fromBase58String(ticketId)
148148 [IntegerEntry(ownerKey, newOwnerAmount), IntegerEntry(lessonStatusCurrentKey, end), Burn(LESSON, lessonFeeCurrentAmount)]
149149 }
150150
151151
152152
153153 @Callable(i)
154154 func ownerWithdraw () = {
155155 let ownerKey = toBase58String(i.caller.bytes)
156156 let currentAmount = match getInteger(this, ownerKey) {
157157 case a: Int =>
158158 a
159159 case _ =>
160160 0
161161 }
162162 if ((0 > currentAmount))
163163 then throw("Can't withdraw negative amount")
164164 else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, PAR7)]
165165 }
166166
167167
168168 @Verifier(tx)
169169 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
170170

github/deemru/w8io/169f3d6 
40.86 ms