tx · GA6ogJJSQQbB5E648Pbeu6JNXNf1qHYuR4wkzsZgZDUS 3MssRJsCtoAhkL5kNjxowQupbXVkfsK2d1J: -0.01400000 Waves 2020.10.08 15:45 [1211612] smart account 3MssRJsCtoAhkL5kNjxowQupbXVkfsK2d1J > SELF 0.00000000 Waves
{ "type": 13, "id": "GA6ogJJSQQbB5E648Pbeu6JNXNf1qHYuR4wkzsZgZDUS", "fee": 1400000, "feeAssetId": null, "timestamp": 1602161140783, "version": 1, "sender": "3MssRJsCtoAhkL5kNjxowQupbXVkfsK2d1J", "senderPublicKey": "6ykraGjmEJoiMGV9H8exLDGexkih6SbTzGnZi7CFSd3D", "proofs": [ "59Hop1Y8u7io7i3ptz2MpCtvyFohDvuGeJN8gvbJVEE6gDhfnT2VB99Sk6fzjMMGTwV5QVrjWcVHgBuNem1bVKuz" ], "script": "base64:AAIEAAAAAAAAAAsIAhIDCgEIEgASAAAAAAYAAAAABk5TQlRpZAkAAlkAAAABCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwIAAAAGTlNCVGlkAgAAACBOU0JUaWQgaXMgbm90IHNwZWNpZmllZCBpbiBzdGF0ZQAAAAAJaGVpZ2h0RW5kCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwIAAAAKaGVpZ2h0X2VuZAIAAAAkaGVpZ2h0X2VuZCBpcyBub3Qgc3BlY2lmaWVkIGluIHN0YXRlAAAAAAxhc3NldHNTdHJpbmcJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAABBhdmFpbGFibGVfYXNzZXRzAgAAACVBc3NldHMgbGlzdCBpcyBub3Qgc3BlY2lmaWVkIGluIHN0YXRlAAAAAAZhc3NldHMJAAS1AAAAAgUAAAAMYXNzZXRzU3RyaW5nAgAAAAEsAQAAAA5rZXlVc2VyQmFsYW5jZQAAAAEAAA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hbGFuY2UFAAAABk5TQlRpZAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAOdXNlckJhbGFuY2VLZXkAAAAAAAAAAAAFAAAAA25pbAAAAABevDVV", "chainId": 84, "height": 1211612, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Gb1D7zUb68USY97WKFr9dxeTMMFq2q6HjMtznbkhYudt Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let NSBTid = fromBase58String(valueOrErrorMessage(getString(this, "NSBTid"), "NSBTid is not specified in state")) | |
5 | 5 | ||
6 | 6 | let heightEnd = valueOrErrorMessage(getInteger(this, "height_end"), "height_end is not specified in state") | |
7 | 7 | ||
8 | 8 | let assetsString = valueOrErrorMessage(getString(this, "available_assets"), "Assets list is not specified in state") | |
9 | 9 | ||
10 | 10 | let assets = split(assetsString, ",") | |
11 | 11 | ||
12 | 12 | func keyUserBalance (userAddr) = makeString(["balance", toString(userAddr)], "_") | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func keyUserAssetBalance (userAddr,vote) = makeString(["vote", userAddr, vote], "_") | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | @Callable(contextObj) | |
19 | 19 | func castVote (vote) = if ((containsElement(assets, vote) == false)) | |
20 | 20 | then throw("Incorrect vote!") | |
21 | 21 | else { | |
22 | 22 | let voiteKey = makeString(["vote", vote], "_") | |
23 | 23 | let voteAddressKey = keyUserAssetBalance(toString(contextObj.caller), vote) | |
24 | 24 | let userBalanceKey = keyUserBalance(contextObj.caller) | |
25 | 25 | let payment = value(contextObj.payments[0]) | |
26 | 26 | let assetIdReceived = payment.assetId | |
27 | 27 | let tokenReceiveAmount = payment.amount | |
28 | 28 | let voteNumberThis = valueOrElse(getInteger(this, voiteKey), 0) | |
29 | 29 | let contractUserBalance = valueOrElse(getInteger(this, userBalanceKey), 0) | |
30 | 30 | let voteOnAsset = valueOrElse(getInteger(this, voteAddressKey), 0) | |
31 | 31 | if ((assetIdReceived != NSBTid)) | |
32 | 32 | then throw("incorrect assets") | |
33 | 33 | else if ((height >= heightEnd)) | |
34 | 34 | then throw("vote finished") | |
35 | 35 | else [IntegerEntry(voiteKey, (voteNumberThis + tokenReceiveAmount)), IntegerEntry(userBalanceKey, (contractUserBalance + tokenReceiveAmount)), IntegerEntry(voteAddressKey, (voteOnAsset + tokenReceiveAmount))] | |
36 | 36 | } | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | ||
40 | 40 | @Callable(contextObj) | |
41 | 41 | func cancelVote () = { | |
42 | 42 | let userBalanceKey = keyUserBalance(contextObj.caller) | |
43 | 43 | let contractUserBalance = valueOrElse(getInteger(this, userBalanceKey), 0) | |
44 | 44 | if ((contractUserBalance == 0)) | |
45 | 45 | then nil | |
46 | 46 | else { | |
47 | 47 | func cancelVotePerdecateNew (accumulatedResultList,assetCode) = { | |
48 | 48 | let totalVotes4AssetKey = makeString(["vote", assetCode], "_") | |
49 | 49 | let userNsbtBalance4AssetKey = keyUserAssetBalance(toString(contextObj.caller), assetCode) | |
50 | 50 | let totalVotes4Asset = valueOrElse(getInteger(this, totalVotes4AssetKey), 0) | |
51 | 51 | let userNsbtBalance4Asset = valueOrElse(getInteger(this, userNsbtBalance4AssetKey), 0) | |
52 | 52 | if ((totalVotes4Asset == 0)) | |
53 | 53 | then accumulatedResultList | |
54 | 54 | else ((accumulatedResultList :+ IntegerEntry(totalVotes4AssetKey, (totalVotes4Asset - userNsbtBalance4Asset))) :+ IntegerEntry(userNsbtBalance4AssetKey, 0)) | |
55 | 55 | } | |
56 | 56 | ||
57 | 57 | ({ | |
58 | 58 | let $list27792870 = assets | |
59 | 59 | let $size27792870 = size($list27792870) | |
60 | 60 | let $acc027792870 = [IntegerEntry(userBalanceKey, 0)] | |
61 | 61 | if (($size27792870 == 0)) | |
62 | 62 | then $acc027792870 | |
63 | 63 | else { | |
64 | 64 | let $acc127792870 = cancelVotePerdecateNew($acc027792870, $list27792870[0]) | |
65 | 65 | if (($size27792870 == 1)) | |
66 | 66 | then $acc127792870 | |
67 | 67 | else { | |
68 | 68 | let $acc227792870 = cancelVotePerdecateNew($acc127792870, $list27792870[1]) | |
69 | 69 | if (($size27792870 == 2)) | |
70 | 70 | then $acc227792870 | |
71 | 71 | else { | |
72 | 72 | let $acc327792870 = cancelVotePerdecateNew($acc227792870, $list27792870[2]) | |
73 | 73 | if (($size27792870 == 3)) | |
74 | 74 | then $acc327792870 | |
75 | 75 | else { | |
76 | 76 | let $acc427792870 = cancelVotePerdecateNew($acc327792870, $list27792870[3]) | |
77 | 77 | if (($size27792870 == 4)) | |
78 | 78 | then $acc427792870 | |
79 | 79 | else { | |
80 | 80 | let $acc527792870 = cancelVotePerdecateNew($acc427792870, $list27792870[4]) | |
81 | 81 | if (($size27792870 == 5)) | |
82 | 82 | then $acc527792870 | |
83 | 83 | else { | |
84 | 84 | let $acc627792870 = cancelVotePerdecateNew($acc527792870, $list27792870[5]) | |
85 | 85 | if (($size27792870 == 6)) | |
86 | 86 | then $acc627792870 | |
87 | 87 | else { | |
88 | 88 | let $acc727792870 = cancelVotePerdecateNew($acc627792870, $list27792870[6]) | |
89 | 89 | if (($size27792870 == 7)) | |
90 | 90 | then $acc727792870 | |
91 | 91 | else { | |
92 | 92 | let $acc827792870 = cancelVotePerdecateNew($acc727792870, $list27792870[7]) | |
93 | 93 | if (($size27792870 == 8)) | |
94 | 94 | then $acc827792870 | |
95 | 95 | else { | |
96 | 96 | let $acc927792870 = cancelVotePerdecateNew($acc827792870, $list27792870[8]) | |
97 | 97 | if (($size27792870 == 9)) | |
98 | 98 | then $acc927792870 | |
99 | 99 | else { | |
100 | 100 | let $acc1027792870 = cancelVotePerdecateNew($acc927792870, $list27792870[9]) | |
101 | 101 | if (($size27792870 == 10)) | |
102 | 102 | then $acc1027792870 | |
103 | 103 | else { | |
104 | 104 | let $acc1127792870 = cancelVotePerdecateNew($acc1027792870, $list27792870[10]) | |
105 | 105 | if (($size27792870 == 11)) | |
106 | 106 | then $acc1127792870 | |
107 | 107 | else { | |
108 | 108 | let $acc1227792870 = cancelVotePerdecateNew($acc1127792870, $list27792870[11]) | |
109 | 109 | if (($size27792870 == 12)) | |
110 | 110 | then $acc1227792870 | |
111 | 111 | else { | |
112 | 112 | let $acc1327792870 = cancelVotePerdecateNew($acc1227792870, $list27792870[12]) | |
113 | 113 | if (($size27792870 == 13)) | |
114 | 114 | then $acc1327792870 | |
115 | 115 | else { | |
116 | 116 | let $acc1427792870 = cancelVotePerdecateNew($acc1327792870, $list27792870[13]) | |
117 | 117 | if (($size27792870 == 14)) | |
118 | 118 | then $acc1427792870 | |
119 | 119 | else { | |
120 | 120 | let $acc1527792870 = cancelVotePerdecateNew($acc1427792870, $list27792870[14]) | |
121 | 121 | if (($size27792870 == 15)) | |
122 | 122 | then $acc1527792870 | |
123 | 123 | else { | |
124 | 124 | let $acc1627792870 = cancelVotePerdecateNew($acc1527792870, $list27792870[15]) | |
125 | 125 | if (($size27792870 == 16)) | |
126 | 126 | then $acc1627792870 | |
127 | 127 | else { | |
128 | 128 | let $acc1727792870 = cancelVotePerdecateNew($acc1627792870, $list27792870[16]) | |
129 | 129 | if (($size27792870 == 17)) | |
130 | 130 | then $acc1727792870 | |
131 | 131 | else { | |
132 | 132 | let $acc1827792870 = cancelVotePerdecateNew($acc1727792870, $list27792870[17]) | |
133 | 133 | if (($size27792870 == 18)) | |
134 | 134 | then $acc1827792870 | |
135 | 135 | else { | |
136 | 136 | let $acc1927792870 = cancelVotePerdecateNew($acc1827792870, $list27792870[18]) | |
137 | 137 | if (($size27792870 == 19)) | |
138 | 138 | then $acc1927792870 | |
139 | 139 | else { | |
140 | 140 | let $acc2027792870 = cancelVotePerdecateNew($acc1927792870, $list27792870[19]) | |
141 | 141 | if (($size27792870 == 20)) | |
142 | 142 | then $acc2027792870 | |
143 | 143 | else { | |
144 | 144 | let $acc2127792870 = cancelVotePerdecateNew($acc2027792870, $list27792870[20]) | |
145 | 145 | throw("List size exceed 20") | |
146 | 146 | } | |
147 | 147 | } | |
148 | 148 | } | |
149 | 149 | } | |
150 | 150 | } | |
151 | 151 | } | |
152 | 152 | } | |
153 | 153 | } | |
154 | 154 | } | |
155 | 155 | } | |
156 | 156 | } | |
157 | 157 | } | |
158 | 158 | } | |
159 | 159 | } | |
160 | 160 | } | |
161 | 161 | } | |
162 | 162 | } | |
163 | 163 | } | |
164 | 164 | } | |
165 | 165 | } | |
166 | 166 | } | |
167 | 167 | } :+ ScriptTransfer(contextObj.caller, contractUserBalance, NSBTid)) | |
168 | 168 | } | |
169 | 169 | } | |
170 | 170 | ||
171 | 171 | ||
172 | 172 | ||
173 | 173 | @Callable(contextObj) | |
174 | 174 | func withdraw () = { | |
175 | 175 | let userBalanceKey = keyUserBalance(contextObj.caller) | |
176 | 176 | if ((heightEnd > height)) | |
177 | 177 | then throw("vote in process") | |
178 | 178 | else { | |
179 | 179 | let callerBalance = valueOrElse(getInteger(this, userBalanceKey), 0) | |
180 | 180 | if ((0 >= callerBalance)) | |
181 | 181 | then throw("balance is empty") | |
182 | 182 | else [ScriptTransfer(contextObj.caller, callerBalance, NSBTid), IntegerEntry(userBalanceKey, 0)] | |
183 | 183 | } | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 |
github/deemru/w8io/026f985 46.20 ms ◑