tx · EDbRyRmyHhQuHNhtAJkUtKvMKiqSSUfgxYq7MRBiwqLb

3MyJoBjw9nC4uhgWULVJUaEZEL6z9As7Yfq:  -0.00900000 Waves

2022.07.06 20:31 [2128129] smart account 3MyJoBjw9nC4uhgWULVJUaEZEL6z9As7Yfq > SELF 0.00000000 Waves

{ "type": 13, "id": "EDbRyRmyHhQuHNhtAJkUtKvMKiqSSUfgxYq7MRBiwqLb", "fee": 900000, "feeAssetId": null, "timestamp": 1657128664978, "version": 2, "chainId": 84, "sender": "3MyJoBjw9nC4uhgWULVJUaEZEL6z9As7Yfq", "senderPublicKey": "6E1saVK6whrqLsuLBQRGg6smask3XK5nkfiAWyGd3pEm", "proofs": [ "5JN3xdcByB8s6UmqWzzBBy2cyTBWmUNp9cxXGpAfwD52UQTSjee8BCZmxpoeLNCAexJBtbqScbbGmymAEzvgm7qV" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEIEgMKAQgSAwoBCBIECgIICAAAABIAAAAADVZPVElOR19CTE9DS1MAAAAAAAAAAAoAAAAAC1ZPVEVfQ0xPU0VEAgAAAAZDTE9TRUQAAAAAC1ZPVEVfT1BFTkVEAgAAAARPUEVOAAAAAAxEWVpfQVNTRVRfSUQCAAAALEcyUGI3Q016dHBzN1hFVkdDaVV1SmtMaVMzWkNvNjlBUFFOYkpzMm56MjFqAAAAAA5NSU5fRFlaX0FNT1VOVAAAAAAABfXhAAAAAAAPc3RhdHVzS2V5UHJlZml4AgAAAAdzdGF0dXNfAAAAAA1vcGVuS2V5UHJlZml4AgAAAAVvcGVuXwAAAAAOdG90YWxZZXNTdWZmaXgCAAAACl90b3RhbF95ZXMAAAAADXRvdGFsTm9TdWZmaXgCAAAACV90b3RhbF9ubwAAAAAPcmVwYXltZW50UHJlZml4AgAAAApyZXBheW1lbnRfAQAAAAxnZXRTdGF0dXNLZXkAAAABAAAAAmlkCQABLAAAAAIFAAAAD3N0YXR1c0tleVByZWZpeAUAAAACaWQBAAAACmdldE9wZW5LZ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G90YWxOb0tleQAAAAEFAAAAAmlkBAAAAAxub1ZvdGVzU29GYXIEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAAJbm9Wb3RlS2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAAEAAAACm5ld05vVm90ZXMJAABkAAAAAgUAAAAMbm9Wb3Rlc1NvRmFyAAAAAAAAAAABCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAlub1ZvdGVLZXkFAAAACm5ld05vVm90ZXMJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAADHJlcGF5bWVudEtleQUAAAAGYW1vdW50BQAAAANuaWwFAAAAA25pbAUAAAAIbmV3RW50cnkAAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAACQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAgFAAAAAnR4AAAAD3NlbmRlclB1YmxpY0tleRsoYv0=", "height": 2128129, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CmKoM8vE1qmNRMSTWR2mUaJP3wb5EF1kEdnpcZPfeGrj Next: 7Ek8sW6J5tM35tpKJiDqWZ7WZdcPURrSnZeHWajsmaTs Diff:
OldNewDifferences
109109 let caller = i.caller
110110 let amount = payment.amount
111111 let assetId = toBase58String(value(payment.assetId))
112- if ((assetId != DYZ_ASSET_ID))
113- then throw("payment in DZY necessary!")
114- else if ((amount != MIN_DYZ_AMOUNT))
115- then throw("payment amount wrong!")
116- else {
117- let repaymentKey = getRepaymentKey(id, caller)
118- let voteStatus = getVoteStatus(id)
119- if ((voteStatus == VOTE_CLOSED))
120- then throw("vote closed!")
121- else {
122- let openHeight = match getInteger(getOpenKey(id)) {
123- case n: Int =>
124- n
125- case _ =>
126- 0
127- }
128- if ((height > (openHeight + VOTING_BLOCKS)))
129- then throw("voting ended!")
130- else {
131- let newEntry = if ((vote == "yes"))
132- then {
133- let yesVoteKey = getTotalYesKey(id)
134- let yesVotesSoFar = match getInteger(this, yesVoteKey) {
135- case a: Int =>
136- a
137- case _ =>
138- 0
139- }
140- let newYesVotes = (yesVotesSoFar + 1)
141-[IntegerEntry(yesVoteKey, newYesVotes), IntegerEntry(repaymentKey, amount)]
142- }
143- else if ((vote == "no"))
112+ if (!(isDefined(i.payments[0])))
113+ then throw("payment in DZY needs to be attached")
114+ else if ((assetId != DYZ_ASSET_ID))
115+ then throw("payment in DZY necessary!")
116+ else if ((amount != MIN_DYZ_AMOUNT))
117+ then throw("payment amount wrong!")
118+ else {
119+ let repaymentKey = getRepaymentKey(id, caller)
120+ let voteStatus = getVoteStatus(id)
121+ if ((voteStatus == VOTE_CLOSED))
122+ then throw("vote closed!")
123+ else {
124+ let openHeight = match getInteger(getOpenKey(id)) {
125+ case n: Int =>
126+ n
127+ case _ =>
128+ 0
129+ }
130+ if ((height > (openHeight + VOTING_BLOCKS)))
131+ then throw("voting ended!")
132+ else {
133+ let newEntry = if ((vote == "yes"))
144134 then {
145- let noVoteKey = getTotalNoKey(id)
146- let noVotesSoFar = match getInteger(this, noVoteKey) {
135+ let yesVoteKey = getTotalYesKey(id)
136+ let yesVotesSoFar = match getInteger(this, yesVoteKey) {
147137 case a: Int =>
148138 a
149139 case _ =>
150140 0
151141 }
152- let newNoVotes = (noVotesSoFar + 1)
142+ let newYesVotes = (yesVotesSoFar + 1)
143+[IntegerEntry(yesVoteKey, newYesVotes), IntegerEntry(repaymentKey, amount)]
144+ }
145+ else if ((vote == "no"))
146+ then {
147+ let noVoteKey = getTotalNoKey(id)
148+ let noVotesSoFar = match getInteger(this, noVoteKey) {
149+ case a: Int =>
150+ a
151+ case _ =>
152+ 0
153+ }
154+ let newNoVotes = (noVotesSoFar + 1)
153155 [IntegerEntry(noVoteKey, newNoVotes), IntegerEntry(repaymentKey, amount)]
154- }
155- else nil
156- newEntry
157- }
158- }
159- }
156+ }
157+ else nil
158+ newEntry
159+ }
160+ }
161+ }
160162 }
161163
162164
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let VOTING_BLOCKS = 10
55
66 let VOTE_CLOSED = "CLOSED"
77
88 let VOTE_OPENED = "OPEN"
99
1010 let DYZ_ASSET_ID = "G2Pb7CMztps7XEVGCiUuJkLiS3ZCo69APQNbJs2nz21j"
1111
1212 let MIN_DYZ_AMOUNT = 100000000
1313
1414 let statusKeyPrefix = "status_"
1515
1616 let openKeyPrefix = "open_"
1717
1818 let totalYesSuffix = "_total_yes"
1919
2020 let totalNoSuffix = "_total_no"
2121
2222 let repaymentPrefix = "repayment_"
2323
2424 func getStatusKey (id) = (statusKeyPrefix + id)
2525
2626
2727 func getOpenKey (id) = (openKeyPrefix + id)
2828
2929
3030 func getTotalYesKey (id) = (id + totalYesSuffix)
3131
3232
3333 func getTotalNoKey (id) = (id + totalYesSuffix)
3434
3535
3636 func getVoteStatus (id) = {
3737 let statusKey = getStatusKey(id)
3838 let status = getString(this, statusKey)
3939 status
4040 }
4141
4242
4343 func getRepaymentKey (id,address) = (((repaymentPrefix + id) + "_") + toString(address))
4444
4545
4646 func getStartHeight (id) = {
4747 let result = match getInteger(this, getOpenKey(id)) {
4848 case n: Int =>
4949 n
5050 case _ =>
5151 -1
5252 }
5353 result
5454 }
5555
5656
5757 func getRefundAmount (id,address) = {
5858 let repaymentKey = getRepaymentKey(id, address)
5959 let result = match getInteger(this, repaymentKey) {
6060 case n: Int =>
6161 n
6262 case _ =>
6363 -1
6464 }
6565 result
6666 }
6767
6868
6969 @Callable(i)
7070 func openVote (id) = {
7171 let startHeightKey = getOpenKey(id)
7272 let statusKey = getStatusKey(id)
7373 [StringEntry(statusKey, VOTE_OPENED), IntegerEntry(startHeightKey, height)]
7474 }
7575
7676
7777
7878 @Callable(i)
7979 func closeVote (id) = {
8080 let statusKey = getStatusKey(id)
8181 [StringEntry(statusKey, VOTE_CLOSED)]
8282 }
8383
8484
8585
8686 @Callable(i)
8787 func claim (id) = {
8888 let startHeight = getStartHeight(id)
8989 if ((startHeight == -1))
9090 then throw("No vote started for this id!")
9191 else if (((startHeight + VOTING_BLOCKS) >= height))
9292 then throw("You can only claim after vote ends!")
9393 else {
9494 let caller = i.caller
9595 let repayAmount = getRefundAmount(id, caller)
9696 let statusKey = getStatusKey(id)
9797 let repaymentKey = getRepaymentKey(id, caller)
9898 if ((repayAmount > 0))
9999 then [ScriptTransfer(caller, repayAmount, toBytes(DYZ_ASSET_ID)), StringEntry(statusKey, VOTE_CLOSED), IntegerEntry(repaymentKey, 0)]
100100 else throw("Nothing to claim!")
101101 }
102102 }
103103
104104
105105
106106 @Callable(i)
107107 func vote (id,vote) = {
108108 let payment = value(i.payments[0])
109109 let caller = i.caller
110110 let amount = payment.amount
111111 let assetId = toBase58String(value(payment.assetId))
112- if ((assetId != DYZ_ASSET_ID))
113- then throw("payment in DZY necessary!")
114- else if ((amount != MIN_DYZ_AMOUNT))
115- then throw("payment amount wrong!")
116- else {
117- let repaymentKey = getRepaymentKey(id, caller)
118- let voteStatus = getVoteStatus(id)
119- if ((voteStatus == VOTE_CLOSED))
120- then throw("vote closed!")
121- else {
122- let openHeight = match getInteger(getOpenKey(id)) {
123- case n: Int =>
124- n
125- case _ =>
126- 0
127- }
128- if ((height > (openHeight + VOTING_BLOCKS)))
129- then throw("voting ended!")
130- else {
131- let newEntry = if ((vote == "yes"))
132- then {
133- let yesVoteKey = getTotalYesKey(id)
134- let yesVotesSoFar = match getInteger(this, yesVoteKey) {
135- case a: Int =>
136- a
137- case _ =>
138- 0
139- }
140- let newYesVotes = (yesVotesSoFar + 1)
141-[IntegerEntry(yesVoteKey, newYesVotes), IntegerEntry(repaymentKey, amount)]
142- }
143- else if ((vote == "no"))
112+ if (!(isDefined(i.payments[0])))
113+ then throw("payment in DZY needs to be attached")
114+ else if ((assetId != DYZ_ASSET_ID))
115+ then throw("payment in DZY necessary!")
116+ else if ((amount != MIN_DYZ_AMOUNT))
117+ then throw("payment amount wrong!")
118+ else {
119+ let repaymentKey = getRepaymentKey(id, caller)
120+ let voteStatus = getVoteStatus(id)
121+ if ((voteStatus == VOTE_CLOSED))
122+ then throw("vote closed!")
123+ else {
124+ let openHeight = match getInteger(getOpenKey(id)) {
125+ case n: Int =>
126+ n
127+ case _ =>
128+ 0
129+ }
130+ if ((height > (openHeight + VOTING_BLOCKS)))
131+ then throw("voting ended!")
132+ else {
133+ let newEntry = if ((vote == "yes"))
144134 then {
145- let noVoteKey = getTotalNoKey(id)
146- let noVotesSoFar = match getInteger(this, noVoteKey) {
135+ let yesVoteKey = getTotalYesKey(id)
136+ let yesVotesSoFar = match getInteger(this, yesVoteKey) {
147137 case a: Int =>
148138 a
149139 case _ =>
150140 0
151141 }
152- let newNoVotes = (noVotesSoFar + 1)
142+ let newYesVotes = (yesVotesSoFar + 1)
143+[IntegerEntry(yesVoteKey, newYesVotes), IntegerEntry(repaymentKey, amount)]
144+ }
145+ else if ((vote == "no"))
146+ then {
147+ let noVoteKey = getTotalNoKey(id)
148+ let noVotesSoFar = match getInteger(this, noVoteKey) {
149+ case a: Int =>
150+ a
151+ case _ =>
152+ 0
153+ }
154+ let newNoVotes = (noVotesSoFar + 1)
153155 [IntegerEntry(noVoteKey, newNoVotes), IntegerEntry(repaymentKey, amount)]
154- }
155- else nil
156- newEntry
157- }
158- }
159- }
156+ }
157+ else nil
158+ newEntry
159+ }
160+ }
161+ }
160162 }
161163
162164
163165 @Verifier(tx)
164166 func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
165167

github/deemru/w8io/026f985 
43.03 ms