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