tx · 6GZCrvWEsrpCLjbiqyrwTyVpoo3Sn3DwM8zsvjCmrVC5

3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU:  -0.01400000 Waves

2020.09.22 08:29 [1188093] smart account 3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU > SELF 0.00000000 Waves

{ "type": 13, "id": "6GZCrvWEsrpCLjbiqyrwTyVpoo3Sn3DwM8zsvjCmrVC5", "fee": 1400000, "feeAssetId": null, "timestamp": 1600752600009, "version": 2, "chainId": 84, "sender": "3N72X4SpkNvXqi3ruDJgYdDmVJe8nRqj7zU", "senderPublicKey": "Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz", "proofs": [ "VLdzwPmWfYN2xSweDgBvXES2yhBYLHJ6t2tqxRmzpwMGChHqm5BNzSfRGPLMFNtR2ECVs1aMx6DTt1mobTQFrff" ], "script": "base64:AAIEAAAAAAAAAB8IAhIDCgEBEgMKAQgSBgoECAgIARIHCgUICAgBARIAAAAABgAAAAAGTEVTU09OAQAAACDo50h8OI7Nb62zoWsqagYFDIe8iqPg4/7715QkgwDg6QAAAAAEUEFSNwEAAAAgzlhA/ZjitMWTd+McxVJoK0GcLLGrEdV8aco355LpR4wAAAAAFGxlc3Nvbk93bmVyUHVibGljS2V5AQAAACDL8+i1dh5Vr1e4XeTXQeu2gcnq6/18vsaB8jf4EQnUaQAAAAAHcGVuZGluZwAAAAAAAAAAAAAAAAAFc3RhcnQAAAAAAAAAAAEAAAAAA2VuZAAAAAAAAAAAAgAAAAUAAAABaQEAAAAJYnV5VGlja2V0AAAAAQAAAApzd2FwQW1vdW50BAAAAANwbXQJAAGRAAAAAggFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAEAAAACnJhdGVBbW91bnQJAABpAAAAAggFAAAAA3BtdAAAAAZhbW91bnQFAAAACnN3YXBBbW91bnQDCQEAAAACIT0AAAACCAUAAAADcG10AAAAB2Fzc2V0SWQFAAAABFBBUjcJAAACA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ABBsZXNzb25DdXJyZW50S2V5BQAAAANlbmQJAARMAAAAAgkBAAAABEJ1cm4AAAACBQAAAAZ0aWNrZXQFAAAADHRpY2tldEFtb3VudAUAAAADbmlsAAAAAWkBAAAADW93bmVyV2l0aGRyYXcAAAAABAAAAAhvd25lcktleQkAAlgAAAABCAgFAAAAAWkAAAAGY2FsbGVyAAAABWJ5dGVzBAAAAA1jdXJyZW50QW1vdW50BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACG93bmVyS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAADCQAAZgAAAAIAAAAAAAAAAAAFAAAADWN1cnJlbnRBbW91bnQJAAACAAAAAQIAAAAeQ2FuJ3Qgd2l0aGRyYXcgbmVnYXRpdmUgYW1vdW50CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAhvd25lcktleQAAAAAAAAAAAAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWN1cnJlbnRBbW91bnQFAAAABFBBUjcFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAABQAAABRsZXNzb25Pd25lclB1YmxpY0tleS9iq7M=", "height": 1188093, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: DebXCcYaeHxKCjLPHz3tj1m8XpPey1LJVL2MLCKiRatc Next: HbtV2BCKiYaCA2pm2mHdLAevT6Gr5LsSAvLZNaSMoe8e Diff:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let paymentAsset = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
4+let LESSON = base58'GgA8mL3SEYvuhYoZFd418Li4bqXAasGbYCKJshTt2MGU'
5+
6+let PAR7 = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
57
68 let lessonOwnerPublicKey = base58'Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz'
79
1214 let end = 2
1315
1416 @Callable(i)
15-func buyTicket (swapAmount,ticketId) = {
17+func buyTicket (swapAmount) = {
1618 let pmt = i.payments[0]
17- if ((pmt.assetId != paymentAsset))
18- then throw("works with paymentAsset only")
19+ let rateAmount = (pmt.amount / swapAmount)
20+ if ((pmt.assetId != PAR7))
21+ then throw("works with PAR7 only")
1922 else {
2023 let buyCurrentKey = toBase58String(i.caller.bytes)
2124 let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
2427 case _ =>
2528 0
2629 }
27- let buyNewAmount = (buyCurrentAmount + pmt.amount)
28- let rateAmount = (pmt.amount / swapAmount)
29- let ticket = fromBase58String(ticketId)
30-[IntegerEntry(buyCurrentKey, buyNewAmount), ScriptTransfer(i.caller, rateAmount, ticket)]
30+ let buyNewAmount = (buyCurrentAmount + rateAmount)
31+[IntegerEntry(("buy_" + buyCurrentKey), buyNewAmount), ScriptTransfer(i.caller, rateAmount, LESSON)]
3132 }
3233 }
3334
104105 }
105106 if ((0 > currentAmount))
106107 then throw("Can't withdraw negative amount")
107- else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, paymentAsset)]
108+ else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, PAR7)]
108109 }
109110
110111
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 4 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
4-let paymentAsset = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
4+let LESSON = base58'GgA8mL3SEYvuhYoZFd418Li4bqXAasGbYCKJshTt2MGU'
5+
6+let PAR7 = base58'EtV3CXQ4wqm28WPB1KaBv5B9ke2bpXRZMutYNEJUQcXm'
57
68 let lessonOwnerPublicKey = base58'Ej9UfgzgHeDPtoinwmZaL71Jv5CgK2QzWZZYyQUbpByz'
79
810 let pending = 0
911
1012 let start = 1
1113
1214 let end = 2
1315
1416 @Callable(i)
15-func buyTicket (swapAmount,ticketId) = {
17+func buyTicket (swapAmount) = {
1618 let pmt = i.payments[0]
17- if ((pmt.assetId != paymentAsset))
18- then throw("works with paymentAsset only")
19+ let rateAmount = (pmt.amount / swapAmount)
20+ if ((pmt.assetId != PAR7))
21+ then throw("works with PAR7 only")
1922 else {
2023 let buyCurrentKey = toBase58String(i.caller.bytes)
2124 let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
2225 case a: Int =>
2326 a
2427 case _ =>
2528 0
2629 }
27- let buyNewAmount = (buyCurrentAmount + pmt.amount)
28- let rateAmount = (pmt.amount / swapAmount)
29- let ticket = fromBase58String(ticketId)
30-[IntegerEntry(buyCurrentKey, buyNewAmount), ScriptTransfer(i.caller, rateAmount, ticket)]
30+ let buyNewAmount = (buyCurrentAmount + rateAmount)
31+[IntegerEntry(("buy_" + buyCurrentKey), buyNewAmount), ScriptTransfer(i.caller, rateAmount, LESSON)]
3132 }
3233 }
3334
3435
3536
3637 @Callable(i)
3738 func lessonSubscription (lessonId) = {
3839 let pmt = i.payments[0]
3940 let pmtId = pmt.assetId
4041 let ticketId = toBase58String(value(pmtId))
4142 let studentAddress = toBase58String(i.caller.bytes)
4243 let lessonCurrentKey = ((lessonId + "_") + studentAddress)
4344 let ticketCurrentKey = ((ticketId + "_") + studentAddress)
4445 let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
4546 case a: Int =>
4647 a
4748 case _ =>
4849 0
4950 }
5051 let ticketNewAmount = (ticketCurrentAmount + pmt.amount)
5152 [IntegerEntry(lessonCurrentKey, pending), IntegerEntry(ticketCurrentKey, ticketNewAmount)]
5253 }
5354
5455
5556
5657 @Callable(i)
5758 func lessonStart (lessonID,studentAddress,ticketId,paymentAmount) = {
5859 let buyCurrentKey = ((ticketId + "_") + studentAddress)
5960 let buyCurrentAmount = match getInteger(this, buyCurrentKey) {
6061 case a: Int =>
6162 a
6263 case _ =>
6364 0
6465 }
6566 let buyNewAmount = (buyCurrentAmount - paymentAmount)
6667 let lessonCurrentKey = ((lessonID + "_") + studentAddress)
6768 [IntegerEntry(buyCurrentKey, buyNewAmount), IntegerEntry(lessonCurrentKey, start)]
6869 }
6970
7071
7172
7273 @Callable(i)
7374 func lessonFinish (lessonId,ticketId,studentAddress,paymentAmount,ticketAmount) = {
7475 let ownerKey = toBase58String(i.caller.bytes)
7576 let ownerAmount = match getInteger(this, ownerKey) {
7677 case a: Int =>
7778 a
7879 case _ =>
7980 0
8081 }
8182 let newOwnerAmount = (ownerAmount + paymentAmount)
8283 let lessonCurrentKey = ((lessonId + "_") + studentAddress)
8384 let ticketCurrentKey = ((ticketId + "_") + studentAddress)
8485 let ticketCurrentAmount = match getInteger(this, ticketCurrentKey) {
8586 case a: Int =>
8687 a
8788 case _ =>
8889 0
8990 }
9091 let ticket = fromBase58String(ticketId)
9192 [IntegerEntry(ownerKey, newOwnerAmount), IntegerEntry(lessonCurrentKey, end), Burn(ticket, ticketAmount)]
9293 }
9394
9495
9596
9697 @Callable(i)
9798 func ownerWithdraw () = {
9899 let ownerKey = toBase58String(i.caller.bytes)
99100 let currentAmount = match getInteger(this, ownerKey) {
100101 case a: Int =>
101102 a
102103 case _ =>
103104 0
104105 }
105106 if ((0 > currentAmount))
106107 then throw("Can't withdraw negative amount")
107- else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, paymentAsset)]
108+ else [IntegerEntry(ownerKey, 0), ScriptTransfer(i.caller, currentAmount, PAR7)]
108109 }
109110
110111
111112 @Verifier(tx)
112113 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], lessonOwnerPublicKey)
113114

github/deemru/w8io/026f985 
48.36 ms