tx · 5divqDQeqFc7iw6u73i8qH4AEBw7DML5czvWYUeqokgD

3MsdfK4j8fgA65zhEyr7yMqYFZaZaDHQ1Q7:  -0.00900000 Waves

2022.08.01 20:55 [2165753] smart account 3MsdfK4j8fgA65zhEyr7yMqYFZaZaDHQ1Q7 > SELF 0.00000000 Waves

{ "type": 13, "id": "5divqDQeqFc7iw6u73i8qH4AEBw7DML5czvWYUeqokgD", "fee": 900000, "feeAssetId": null, "timestamp": 1659376484355, "version": 2, "chainId": 84, "sender": "3MsdfK4j8fgA65zhEyr7yMqYFZaZaDHQ1Q7", "senderPublicKey": "WHz6KMz8NXiDY3SdJVcJnL6oFNzbL3sivL4dhb3E4em", "proofs": [ "U4RABWr899VFukLkXm8jjKQpybxHtzWwbknHoPet34wSv2VTWvEpjtohQH8MLhtc6owUHKX5Jv8x3vPeMdMPowX" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEIEgMKAQgSAwoBCBIECgIIBAAAABUAAAAADERZWl9BU1NFVF9JRAEAAAAg3zps0tw/jE/1UGNUg8jPjkHKkKTlI05ittGCsjg0jKYAAAAAFFZFUklGSUNBVElPTl9TVE9SQUdFAQAAABoBVKmUKcc/0YXwTLy/eiHqHB2l8395VTBIlwAAAAAOTUlOX0RZWl9BTU9VTlQAAAAAAAX14QAAAAAADVZPVElOR19CTE9DS1MAAAAAAAAAAGQAAAAAC1ZPVEVfQ0xPU0VEAgAAAAZDTE9TRUQAAAAAC1ZPVEVfT1BFTkVEAgAAAARPUEVOAAAAAA9zdGF0dXNLZXlQcmVmaXgCAAAAB3N0YXR1c18AAAAADW9wZW5LZXlQcmVmaXgCAAAABW9wZW5fAAAAAA50b3RhbFllc1N1ZmZpeAIAAAAKX3RvdGFsX3llcwAAAAANdG90YWxOb1N1ZmZpeAIAAAAJX3RvdGFsX25vAAAAAA9yZXBheW1lbnRQcmVmaXgCAAAACnJlcGF5bWVudF8AAAAAEGFsbG93ZWRLZXlTdWZmaXgCAAAACF9hbGxvd2VkA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DAJAAQaAAAAAgUAAAAEdGhpcwUAAAAJbm9Wb3RlS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACm5ld05vVm90ZXMJAABkAAAAAgUAAAAMbm9Wb3Rlc1NvRmFyAAAAAAAAAAABCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAlub1ZvdGVLZXkFAAAACm5ld05vVm90ZXMJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADHJlcGF5bWVudEtleQUAAAAGYW1vdW50BQAAAANuaWwFAAAAA25pbAUAAAAIbmV3RW50cnkAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleYGS/8M=", "height": 2165753, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: FgEHQC1TkXNuxcVn68sMh5V1of9pKRoi5zA711RjDNsi Next: DEQzNdws84SnaAMmZa71DNvKKuJvd8BbBo4BPS13ytBv Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let DYZ_ASSET_ID = base58'G2Pb7CMztps7XEVGCiUuJkLiS3ZCo69APQNbJs2nz21j'
55
6-let VERIFICATION_STORAGE = base58'3P82q7po2rw6A4wuK4TRyA9GKTH1LwL7FnH'
6+let VERIFICATION_STORAGE = base58'3N5NjTu7M5vyZ89HvdR69jW2wLZ2Rwj8LNr'
77
88 let MIN_DYZ_AMOUNT = 100000000
99
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let DYZ_ASSET_ID = base58'G2Pb7CMztps7XEVGCiUuJkLiS3ZCo69APQNbJs2nz21j'
55
6-let VERIFICATION_STORAGE = base58'3P82q7po2rw6A4wuK4TRyA9GKTH1LwL7FnH'
6+let VERIFICATION_STORAGE = base58'3N5NjTu7M5vyZ89HvdR69jW2wLZ2Rwj8LNr'
77
88 let MIN_DYZ_AMOUNT = 100000000
99
1010 let VOTING_BLOCKS = 100
1111
1212 let VOTE_CLOSED = "CLOSED"
1313
1414 let VOTE_OPENED = "OPEN"
1515
1616 let statusKeyPrefix = "status_"
1717
1818 let openKeyPrefix = "open_"
1919
2020 let totalYesSuffix = "_total_yes"
2121
2222 let totalNoSuffix = "_total_no"
2323
2424 let repaymentPrefix = "repayment_"
2525
2626 let allowedKeySuffix = "_allowed"
2727
2828 func getStatusKey (id) = (statusKeyPrefix + id)
2929
3030
3131 func getOpenKey (id) = (openKeyPrefix + id)
3232
3333
3434 func getTotalYesKey (id) = (id + totalYesSuffix)
3535
3636
3737 func getTotalNoKey (id) = (id + totalNoSuffix)
3838
3939
4040 func getVoteStatus (id) = getString(this, getStatusKey(id))
4141
4242
4343 func getRepaymentKey (id,address) = (((repaymentPrefix + id) + "_") + toString(address))
4444
4545
4646 func getStartHeight (id) = match getInteger(this, getOpenKey(id)) {
4747 case n: Int =>
4848 n
4949 case _ =>
5050 -1
5151 }
5252
5353
5454 func getRefundAmount (repaymentKey) = match getInteger(this, repaymentKey) {
5555 case n: Int =>
5656 n
5757 case _ =>
5858 -1
5959 }
6060
6161
6262 func isAllowed (address) = match getBoolean(Address(VERIFICATION_STORAGE), (toString(address) + allowedKeySuffix)) {
6363 case b: Boolean =>
6464 b
6565 case _ =>
6666 false
6767 }
6868
6969
7070 @Callable(i)
7171 func openVote (id) = {
7272 let startHeightKey = getOpenKey(id)
7373 let alreadyVoting = getStartHeight(id)
7474 if ((alreadyVoting != -1))
7575 then throw("Vote already ongoing for id!")
7676 else {
7777 let statusKey = getStatusKey(id)
7878 [StringEntry(statusKey, VOTE_OPENED), IntegerEntry(startHeightKey, height)]
7979 }
8080 }
8181
8282
8383
8484 @Callable(i)
8585 func closeVote (id) = {
8686 let currentStartHeight = getStartHeight(id)
8787 if ((currentStartHeight == -1))
8888 then throw("No vote found for id!")
8989 else if (((currentStartHeight + VOTING_BLOCKS) > height))
9090 then throw("Vote can not be closed yet!")
9191 else {
9292 let statusKey = getStatusKey(id)
9393 [StringEntry(statusKey, VOTE_CLOSED)]
9494 }
9595 }
9696
9797
9898
9999 @Callable(i)
100100 func claim (id) = {
101101 let startHeight = getStartHeight(id)
102102 if ((startHeight == -1))
103103 then throw("No vote started for this id!")
104104 else if (((startHeight + VOTING_BLOCKS) >= height))
105105 then throw("You can only claim after vote ends!")
106106 else {
107107 let caller = i.caller
108108 let repaymentKey = getRepaymentKey(id, caller)
109109 let repayAmount = getRefundAmount(repaymentKey)
110110 let statusKey = getStatusKey(id)
111111 if ((repayAmount > 0))
112112 then [ScriptTransfer(caller, repayAmount, DYZ_ASSET_ID), StringEntry(statusKey, VOTE_CLOSED), IntegerEntry(repaymentKey, 0)]
113113 else throw("Nothing to claim!")
114114 }
115115 }
116116
117117
118118
119119 @Callable(i)
120120 func vote (id,vote) = if ((size(i.payments) != 1))
121121 then throw("One payment in DZY needs to be attached")
122122 else {
123123 let payment = value(i.payments[0])
124124 let caller = i.caller
125125 if (!(isAllowed(caller)))
126126 then throw("Address not allowed to vote!")
127127 else {
128128 let amount = payment.amount
129129 if (!(isDefined(payment.assetId)))
130130 then throw("Payment in Waves not allowed!")
131131 else {
132132 let assetId = toBase58String(value(payment.assetId))
133133 let repaymentKey = getRepaymentKey(id, caller)
134134 let refundAmount = getRefundAmount(repaymentKey)
135135 if ((refundAmount != -1))
136136 then throw("Only one vote per id per address!")
137137 else if ((assetId != toBase58String(DYZ_ASSET_ID)))
138138 then throw("payment in DZY necessary!")
139139 else if ((amount != MIN_DYZ_AMOUNT))
140140 then throw("payment amount wrong!")
141141 else {
142142 let voteStatus = getVoteStatus(id)
143143 if ((voteStatus == VOTE_CLOSED))
144144 then throw("vote closed!")
145145 else {
146146 let openHeight = match getInteger(this, getOpenKey(id)) {
147147 case a: Int =>
148148 a
149149 case _ =>
150150 0
151151 }
152152 if ((height > (openHeight + VOTING_BLOCKS)))
153153 then throw("voting ended!")
154154 else {
155155 let newEntry = if ((vote == true))
156156 then {
157157 let yesVoteKey = getTotalYesKey(id)
158158 let yesVotesSoFar = match getInteger(this, yesVoteKey) {
159159 case a: Int =>
160160 a
161161 case _ =>
162162 0
163163 }
164164 let newYesVotes = (yesVotesSoFar + 1)
165165 [IntegerEntry(yesVoteKey, newYesVotes), IntegerEntry(repaymentKey, amount)]
166166 }
167167 else if ((vote == false))
168168 then {
169169 let noVoteKey = getTotalNoKey(id)
170170 let noVotesSoFar = match getInteger(this, noVoteKey) {
171171 case a: Int =>
172172 a
173173 case _ =>
174174 0
175175 }
176176 let newNoVotes = (noVotesSoFar + 1)
177177 [IntegerEntry(noVoteKey, newNoVotes), IntegerEntry(repaymentKey, amount)]
178178 }
179179 else nil
180180 newEntry
181181 }
182182 }
183183 }
184184 }
185185 }
186186 }
187187
188188
189189 @Verifier(tx)
190190 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
191191

github/deemru/w8io/169f3d6 
26.85 ms