tx · ELcN8X4odiuYVihCSo3TYVczsnu9cYX8uQKCm5sqEaB3

3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU:  -0.01400000 Waves

2020.09.22 04:18 [1187847] smart account 3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU > SELF 0.00000000 Waves

{ "type": 13, "id": "ELcN8X4odiuYVihCSo3TYVczsnu9cYX8uQKCm5sqEaB3", "fee": 1400000, "feeAssetId": null, "timestamp": 1600737506875, "version": 2, "chainId": 84, "sender": "3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU", "senderPublicKey": "Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz", "proofs": [ "4fD3a25yKRNMGxUuTLSBJZEJRisa6nZwXdJML6LDZkSmUYke33yvbKuVCT4s6Vzz7CGNvDMEZ2pcN9W5yGyt7ubf" ], "script": "base64:AAIEAAAAAAAAACAIAhIECgIBCBIDCgEIEgYKBAgICAESBwoFCAgIAQESAAAAAAUAAAAADHBheW1lbnRBc3NldAEAAAAgzlhA/ZjitMWTd+McxVJoK0GcLLGrEdV8aco355LpR4wAAAAAFGxlc3Nvbk93bmVyUHVibGljS2V5AQAAACDL8+i1dh5Vr1e4XeTXQeu2gcnq6/18vsaB8jf4EQnUaQAAAAAHcGVuZGluZwAAAAAAAAAAAAAAAAAFc3RhcnQAAAAAAAAAAAEAAAAAA2VuZAAAAAAAAAAAAgAAAAUAAAABaQEAAAAJYnV5VGlja2V0AAAAAgAAAApzd2FwQW1vdW50AAAACHRpY2tldElkBAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAADCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAADHBheW1lbnRBc3NldAkAAAIAAAABAgAAABx3b3JrcyB3aXRoIHBheW1lbnRBc3NldCBvbmx5BAAAAA1idXlDdXJyZW50S2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAF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kFAAAAA2VuZAkABEwAAAACCQEAAAAEQnVybgAAAAIFAAAABnRpY2tldAUAAAAMdGlja2V0QW1vdW50BQAAAANuaWwAAAABaQEAAAANb3duZXJXaXRoZHJhdwAAAAAEAAAACG93bmVyS2V5CQACWAAAAAEICAUAAAABaQAAAAZjYWxsZXIAAAAFYnl0ZXMEAAAADWN1cnJlbnRBbW91bnQEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAIb3duZXJLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAMJAABmAAAAAgAAAAAAAAAAAAUAAAANY3VycmVudEFtb3VudAkAAAIAAAABAgAAAB5DYW4ndCB3aXRoZHJhdyBuZWdhdGl2ZSBhbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAACG93bmVyS2V5AAAAAAAAAAAACQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAANY3VycmVudEFtb3VudAUAAAAMcGF5bWVudEFzc2V0BQAAAANuaWwAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAUbGVzc29uT3duZXJQdWJsaWNLZXkF1A0C", "height": 1187847, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FzE1pGfo3rHTE7Y1uhAH7GyqGZcPQqRFfvFFyzwxvKkt Next: AQaQpLwKThbQWjdSmXuG7Ti8yKjvKdnjbH7F98UZNK9w Diff:
OldNewDifferences
2626 }
2727 let buyNewAmount = (buyCurrentAmount + pmt.amount)
2828 let rateAmount = (pmt.amount / swapAmount)
29- let ticket = toBytes(ticketId)
29+ let ticket = fromBase58String(ticketId)
3030 [IntegerEntry(buyCurrentKey, buyNewAmount), ScriptTransfer(i.caller, rateAmount, ticket)]
3131 }
3232 }
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let paymentAsset = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
55
66 let lessonOwnerPublicKey = base58'Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz'
77
88 let pending = 0
99
1010 let start = 1
1111
1212 let end = 2
1313
1414 @Callable(i)
1515 func buyTicket (swapAmount,ticketId) = {
1616 let pmt = i.payments[0]
1717 if ((pmt.assetId != paymentAsset))
1818 then throw("works with paymentAsset only")
1919 else {
2020 let buyCurrentKey = toBase58String(i.caller.bytes)
2121 let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
2222 case a: Int =>
2323 a
2424 case _ =>
2525 0
2626 }
2727 let buyNewAmount = (buyCurrentAmount + pmt.amount)
2828 let rateAmount = (pmt.amount / swapAmount)
29- let ticket = toBytes(ticketId)
29+ let ticket = fromBase58String(ticketId)
3030 [IntegerEntry(buyCurrentKey, buyNewAmount), ScriptTransfer(i.caller, rateAmount, ticket)]
3131 }
3232 }
3333
3434
3535
3636 @Callable(i)
3737 func lessonSubscription (lessonId) = {
3838 let pmt = i.payments[0]
3939 let pmtId = pmt.assetId
4040 let ticketId = toBase58String(value(pmtId))
4141 let studentAddress = toBase58String(i.caller.bytes)
4242 let lessonCurrentKey = ((lessonId + "_") + studentAddress)
4343 let ticketCurrentKey = ((ticketId + "_") + studentAddress)
4444 let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
4545 case a: Int =>
4646 a
4747 case _ =>
4848 0
4949 }
5050 let ticketNewAmount = (ticketCurrentAmount + pmt.amount)
5151 [IntegerEntry(lessonCurrentKey, pending), IntegerEntry(ticketCurrentKey, ticketNewAmount)]
5252 }
5353
5454
5555
5656 @Callable(i)
5757 func lessonStart (lessonID,studentAddress,ticketId,paymentAmount) = {
5858 let buyCurrentKey = ((ticketId + "_") + studentAddress)
5959 let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
6060 case a: Int =>
6161 a
6262 case _ =>
6363 0
6464 }
6565 let buyNewAmount = (buyCurrentAmount - paymentAmount)
6666 let lessonCurrentKey = ((lessonID + "_") + studentAddress)
6767 [IntegerEntry(buyCurrentKey, buyNewAmount), IntegerEntry(lessonCurrentKey, start)]
6868 }
6969
7070
7171
7272 @Callable(i)
7373 func lessonFinish (lessonId,ticketId,studentAddress,paymentAmount,ticketAmount) = {
7474 let ownerKey = toBase58String(i.caller.bytes)
7575 let ownerAmount = match getInteger(this, ownerKey) {
7676 case a: Int =>
7777 a
7878 case _ =>
7979 0
8080 }
8181 let newOwnerAmount = (ownerAmount + paymentAmount)
8282 let lessonCurrentKey = ((lessonId + "_") + studentAddress)
8383 let ticketCurrentKey = ((ticketId + "_") + studentAddress)
8484 let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
8585 case a: Int =>
8686 a
8787 case _ =>
8888 0
8989 }
9090 let ticket = fromBase58String(ticketId)
9191 [IntegerEntry(ownerKey, newOwnerAmount), IntegerEntry(lessonCurrentKey, end), Burn(ticket, ticketAmount)]
9292 }
9393
9494
9595
9696 @Callable(i)
9797 func ownerWithdraw () = {
9898 let ownerKey = toBase58String(i.caller.bytes)
9999 let currentAmount = match getInteger(this, ownerKey) {
100100 case a: Int =>
101101 a
102102 case _ =>
103103 0
104104 }
105105 if ((0 > currentAmount))
106106 then throw("Can't withdraw negative amount")
107107 else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, paymentAsset)]
108108 }
109109
110110
111111 @Verifier(tx)
112112 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], lessonOwnerPublicKey)
113113

github/deemru/w8io/026f985 
27.02 ms