tx · AWuKxb1yvEHcMEV2Boyd5o6J5RKy3grXVyCUccw1GP4H

3PLJHro4tbUssVMHY538QqsVZWPVHTUpHir:  -0.01000000 Waves

2023.05.09 23:15 [3636276] smart account 3PLJHro4tbUssVMHY538QqsVZWPVHTUpHir > SELF 0.00000000 Waves

{ "type": 13, "id": "AWuKxb1yvEHcMEV2Boyd5o6J5RKy3grXVyCUccw1GP4H", "fee": 1000000, "feeAssetId": null, "timestamp": 1683663406400, "version": 2, "chainId": 87, "sender": "3PLJHro4tbUssVMHY538QqsVZWPVHTUpHir", "senderPublicKey": "8er5GibY1hbf7RjN9rdnQW5Ua9xM7UtDohqbdEukAT7v", "proofs": [ "bazKa8SZ1L8FJyUwZNwtP4JS8Dp5wCeurcrEaDHnDcgzNy1tNyZiL5RuUm2dsXXZMzEu2cHuaq9SvQd1y8AN49E" ], "script": "base64:BgIZCAISBgoECAgBGBIDCgEIEgMKAQgSAwoBCAgAEExhc3RDb250ZXN0SWRLZXkCD2xhc3RfY29udGVzdF9pZAANQ29udGVzdFByZWZpeAIIY29udGVzdF8ADFN0YXR1c19EcmFmdAIFZHJhZnQADVN0YXR1c19BY3RpdmUCBmFjdGl2ZQALU3RhdHVzX1N0b3ACBHN0b3AADVN0YXR1c19EZWx0ZWQCB2RlbGV0ZWQBDWNhbGNQcml6ZUZ1bmQBCHBheW1lbnRzCgEEY2FsYwIFYWNjdW0EbmV4dAQJYXNzZXROYW1lBAckbWF0Y2gwCAUEbmV4dAdhc3NldElkAwkAAQIFByRtYXRjaDACCkJ5dGVWZWN0b3IEAXQFByRtYXRjaDAJANgEAQUBdAIFV0FWRVMDAwkAZgIJALECAQUJYXNzZXROYW1lAAAJAGYCCAUEbmV4dAZhbW91bnQAAAcJAM0IAgUFYWNjdW0JAKwCAgkArAICBQlhc3NldE5hbWUCAToJAKQDAQgFBG5leHQGYW1vdW50BQVhY2N1bQkAugkCCgACJGwFCHBheW1lbnRzCgACJHMJAJADAQUCJGwKAAUkYWNjMAUD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Status": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Car4zTFsfhJJ8pWQexuEF5JvFSwdEGHindj4r4vgEWAt Next: AXj54ZCXyCT7mXHC2nfVCfZy1am9j2FpsYhM4ZfuhwMZ Diff:
OldNewDifferences
1313
1414 let Status_Delted = "deleted"
1515
16-func calcPrizeFound (payments) = {
16+func calcPrizeFund (payments) = {
1717 func calc (accum,next) = {
1818 let assetName = match next.assetId {
1919 case t: ByteVector =>
7171
7272 @Callable(i)
7373 func create (name,desc,endHeight,tasks) = {
74- let prizeFoundStr = calcPrizeFound(i.payments)
75- if ((size(prizeFoundStr) == 0))
74+ let prizeFundStr = calcPrizeFund(i.payments)
75+ if ((size(prizeFundStr) == 0))
7676 then throw("No payments")
7777 else if ((size(tasks) == 0))
7878 then throw("Tasks list empty")
8484 then throw("Invalid date end")
8585 else {
8686 let contestId = valueOrElse(getInteger(LastContestIdKey), 1)
87- $Tuple2([StringEntry(((ContestPrefix + toString(contestId)) + "_name"), name), StringEntry(((ContestPrefix + toString(contestId)) + "_desc"), desc), IntegerEntry(((ContestPrefix + toString(contestId)) + "_endHeight"), endHeight), StringEntry(((ContestPrefix + toString(contestId)) + "_owner"), toString(i.caller)), StringEntry(((ContestPrefix + toString(contestId)) + "_prizeFound"), prizeFoundStr), StringEntry(((ContestPrefix + toString(contestId)) + "_tasks"), makeString_2C(tasks, ";")), StringEntry(((ContestPrefix + toString(contestId)) + "_status"), Status_Active), IntegerEntry(LastContestIdKey, (contestId + 1))], contestId)
87+ $Tuple2([StringEntry(((ContestPrefix + toString(contestId)) + "_name"), name), StringEntry(((ContestPrefix + toString(contestId)) + "_desc"), desc), IntegerEntry(((ContestPrefix + toString(contestId)) + "_endHeight"), endHeight), StringEntry(((ContestPrefix + toString(contestId)) + "_owner"), toString(i.caller)), StringEntry(((ContestPrefix + toString(contestId)) + "_prizeFund"), prizeFundStr), StringEntry(((ContestPrefix + toString(contestId)) + "_tasks"), makeString_2C(tasks, ";")), StringEntry(((ContestPrefix + toString(contestId)) + "_status"), Status_Active), IntegerEntry(LastContestIdKey, (contestId + 1))], contestId)
8888 }
8989 }
9090
140140 func remove (contestId) = {
141141 let ContestIdStr = (ContestPrefix + contestId)
142142 let participantsCount = valueOrElse(getInteger((ContestIdStr + "_participantsCount")), 0)
143- let prizeFundStr = valueOrErrorMessage(getString((ContestIdStr + "_prizeFound")), "Prize fund data not found")
143+ let prizeFundStr = valueOrErrorMessage(getString((ContestIdStr + "_prizeFund")), "Prize fund data not found")
144144 let isOwner = match getString((ContestIdStr + "_owner")) {
145145 case t: String =>
146146 (t == toString(i.caller))
151151 then throw("You are not the owner")
152152 else if ((participantsCount > 0))
153153 then throw("The number of participants is greater than zero")
154- else ([DeleteEntry((ContestIdStr + "_name")), DeleteEntry((ContestIdStr + "_desc")), DeleteEntry((ContestIdStr + "_endHeight")), DeleteEntry((ContestIdStr + "_owner")), DeleteEntry((ContestIdStr + "_prizeFound")), DeleteEntry((ContestIdStr + "_tasks")), DeleteEntry((ContestIdStr + "_status")), DeleteEntry((ContestIdStr + "_participantsCount"))] ++ getPrizeTransfers(prizeFundStr, i.caller))
154+ else ([DeleteEntry((ContestIdStr + "_name")), DeleteEntry((ContestIdStr + "_desc")), DeleteEntry((ContestIdStr + "_endHeight")), DeleteEntry((ContestIdStr + "_owner")), DeleteEntry((ContestIdStr + "_prizeFund")), DeleteEntry((ContestIdStr + "_tasks")), DeleteEntry((ContestIdStr + "_status")), DeleteEntry((ContestIdStr + "_participantsCount"))] ++ getPrizeTransfers(prizeFundStr, i.caller))
155155 }
156156
157157
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let LastContestIdKey = "last_contest_id"
55
66 let ContestPrefix = "contest_"
77
88 let Status_Draft = "draft"
99
1010 let Status_Active = "active"
1111
1212 let Status_Stop = "stop"
1313
1414 let Status_Delted = "deleted"
1515
16-func calcPrizeFound (payments) = {
16+func calcPrizeFund (payments) = {
1717 func calc (accum,next) = {
1818 let assetName = match next.assetId {
1919 case t: ByteVector =>
2020 toBase58String(t)
2121 case _ =>
2222 "WAVES"
2323 }
2424 if (if ((size(assetName) > 0))
2525 then (next.amount > 0)
2626 else false)
2727 then (accum :+ ((assetName + ":") + toString(next.amount)))
2828 else accum
2929 }
3030
3131 makeString_2C({
3232 let $l = payments
3333 let $s = size($l)
3434 let $acc0 = nil
3535 func $f0_1 ($a,$i) = if (($i >= $s))
3636 then $a
3737 else calc($a, $l[$i])
3838
3939 func $f0_2 ($a,$i) = if (($i >= $s))
4040 then $a
4141 else throw("List size exceeds 10")
4242
4343 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
4444 }, "|")
4545 }
4646
4747
4848 func getPrizeTransfers (prizeFundStr,recipient) = {
4949 func calc (accum,next) = {
5050 let parts = split(next, ":")
5151 let assetId = if ((parts[0] == "WAVES"))
5252 then unit
5353 else fromBase58String(parts[0])
5454 (accum :+ ScriptTransfer(recipient, value(parseInt(parts[1])), assetId))
5555 }
5656
5757 let $l = split_4C(prizeFundStr, "|")
5858 let $s = size($l)
5959 let $acc0 = nil
6060 func $f0_1 ($a,$i) = if (($i >= $s))
6161 then $a
6262 else calc($a, $l[$i])
6363
6464 func $f0_2 ($a,$i) = if (($i >= $s))
6565 then $a
6666 else throw("List size exceeds 10")
6767
6868 $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
6969 }
7070
7171
7272 @Callable(i)
7373 func create (name,desc,endHeight,tasks) = {
74- let prizeFoundStr = calcPrizeFound(i.payments)
75- if ((size(prizeFoundStr) == 0))
74+ let prizeFundStr = calcPrizeFund(i.payments)
75+ if ((size(prizeFundStr) == 0))
7676 then throw("No payments")
7777 else if ((size(tasks) == 0))
7878 then throw("Tasks list empty")
7979 else if ((size(name) == 0))
8080 then throw("Name empty")
8181 else if ((size(desc) == 0))
8282 then throw("Desc empty")
8383 else if ((height > endHeight))
8484 then throw("Invalid date end")
8585 else {
8686 let contestId = valueOrElse(getInteger(LastContestIdKey), 1)
87- $Tuple2([StringEntry(((ContestPrefix + toString(contestId)) + "_name"), name), StringEntry(((ContestPrefix + toString(contestId)) + "_desc"), desc), IntegerEntry(((ContestPrefix + toString(contestId)) + "_endHeight"), endHeight), StringEntry(((ContestPrefix + toString(contestId)) + "_owner"), toString(i.caller)), StringEntry(((ContestPrefix + toString(contestId)) + "_prizeFound"), prizeFoundStr), StringEntry(((ContestPrefix + toString(contestId)) + "_tasks"), makeString_2C(tasks, ";")), StringEntry(((ContestPrefix + toString(contestId)) + "_status"), Status_Active), IntegerEntry(LastContestIdKey, (contestId + 1))], contestId)
87+ $Tuple2([StringEntry(((ContestPrefix + toString(contestId)) + "_name"), name), StringEntry(((ContestPrefix + toString(contestId)) + "_desc"), desc), IntegerEntry(((ContestPrefix + toString(contestId)) + "_endHeight"), endHeight), StringEntry(((ContestPrefix + toString(contestId)) + "_owner"), toString(i.caller)), StringEntry(((ContestPrefix + toString(contestId)) + "_prizeFund"), prizeFundStr), StringEntry(((ContestPrefix + toString(contestId)) + "_tasks"), makeString_2C(tasks, ";")), StringEntry(((ContestPrefix + toString(contestId)) + "_status"), Status_Active), IntegerEntry(LastContestIdKey, (contestId + 1))], contestId)
8888 }
8989 }
9090
9191
9292
9393 @Callable(i)
9494 func participate (contestId) = {
9595 let ContestIdStr = (ContestPrefix + contestId)
9696 let ContestAddressKey = (((ContestIdStr + "_participant_") + toString(i.caller)) + "_address")
9797 let isOwner = match getString((ContestIdStr + "_owner")) {
9898 case t: String =>
9999 (t == toString(i.caller))
100100 case _ =>
101101 throw("Data get owner error")
102102 }
103103 let isExist = match getString(ContestAddressKey) {
104104 case t: String =>
105105 true
106106 case _ =>
107107 false
108108 }
109109 let participantsCount = valueOrElse(getInteger((ContestIdStr + "_participantsCount")), 0)
110110 if (isOwner)
111111 then throw("Owner cannot participate")
112112 else if (isExist)
113113 then throw("You are already participating")
114114 else [StringEntry(ContestAddressKey, toString(i.caller)), IntegerEntry((ContestIdStr + "_participantsCount"), (participantsCount + 1))]
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func unparticipate (contestId) = {
121121 let ContestIdStr = (ContestPrefix + contestId)
122122 let ContestAddressKey = (((ContestIdStr + "_participant_") + toString(i.caller)) + "_address")
123123 let isExist = match getString(ContestAddressKey) {
124124 case t: String =>
125125 true
126126 case _ =>
127127 false
128128 }
129129 let participantsCount = valueOrElse(getInteger((ContestIdStr + "_participantsCount")), 0)
130130 if (!(isExist))
131131 then throw("You are not participating")
132132 else [DeleteEntry(ContestAddressKey), if (((participantsCount - 1) == 0))
133133 then DeleteEntry((ContestIdStr + "_participantsCount"))
134134 else IntegerEntry((ContestIdStr + "_participantsCount"), (participantsCount - 1))]
135135 }
136136
137137
138138
139139 @Callable(i)
140140 func remove (contestId) = {
141141 let ContestIdStr = (ContestPrefix + contestId)
142142 let participantsCount = valueOrElse(getInteger((ContestIdStr + "_participantsCount")), 0)
143- let prizeFundStr = valueOrErrorMessage(getString((ContestIdStr + "_prizeFound")), "Prize fund data not found")
143+ let prizeFundStr = valueOrErrorMessage(getString((ContestIdStr + "_prizeFund")), "Prize fund data not found")
144144 let isOwner = match getString((ContestIdStr + "_owner")) {
145145 case t: String =>
146146 (t == toString(i.caller))
147147 case _ =>
148148 throw("Data get owner error")
149149 }
150150 if (!(isOwner))
151151 then throw("You are not the owner")
152152 else if ((participantsCount > 0))
153153 then throw("The number of participants is greater than zero")
154- else ([DeleteEntry((ContestIdStr + "_name")), DeleteEntry((ContestIdStr + "_desc")), DeleteEntry((ContestIdStr + "_endHeight")), DeleteEntry((ContestIdStr + "_owner")), DeleteEntry((ContestIdStr + "_prizeFound")), DeleteEntry((ContestIdStr + "_tasks")), DeleteEntry((ContestIdStr + "_status")), DeleteEntry((ContestIdStr + "_participantsCount"))] ++ getPrizeTransfers(prizeFundStr, i.caller))
154+ else ([DeleteEntry((ContestIdStr + "_name")), DeleteEntry((ContestIdStr + "_desc")), DeleteEntry((ContestIdStr + "_endHeight")), DeleteEntry((ContestIdStr + "_owner")), DeleteEntry((ContestIdStr + "_prizeFund")), DeleteEntry((ContestIdStr + "_tasks")), DeleteEntry((ContestIdStr + "_status")), DeleteEntry((ContestIdStr + "_participantsCount"))] ++ getPrizeTransfers(prizeFundStr, i.caller))
155155 }
156156
157157
158158 @Verifier(tx)
159159 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
160160

github/deemru/w8io/0e76f2f 
39.09 ms