tx · DERQVDjE8R1vyHnmaJVykjTeQz4xvmwSAadY2eoicC2M 3MrqFfv385KAzAqqdQyprR7FMLSapeifggB: -0.01000000 Waves 2022.12.29 13:35 [2381450] smart account 3MrqFfv385KAzAqqdQyprR7FMLSapeifggB > SELF 0.00000000 Waves
{ "type": 13, "id": "DERQVDjE8R1vyHnmaJVykjTeQz4xvmwSAadY2eoicC2M", "fee": 1000000, "feeAssetId": null, "timestamp": 1672310078402, "version": 2, "chainId": 84, "sender": "3MrqFfv385KAzAqqdQyprR7FMLSapeifggB", "senderPublicKey": "8Tqc64F7G2nACr6yk8egBWCVAp9ZLxjTeWYdXoyQvMAN", "proofs": [ "w6W5iDthdwJZSAtipP2uW1VmNZr6m6EuDvwM4NfgBrzpWY53fZx7bwiNDMWiuGbvS8eQyNE7KeT9tZYw2sy5zgA" ], "script": "base64:BgIsCAISAwoBCBIGCgQICAEBEgQKAgEEEgMKAQESBAoCAQQSAwoBARIDCgEIEgASAANTRVACAl9fARNrZXlNYW5hZ2VyUHVibGljS2V5AAIVJXNfX21hbmFnZXJQdWJsaWNwS2V5ARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQACGyVzX19wZW5kaW5nTWFuYWdlclB1YmxpY0tleQEQYmxvY2tIZWlnaHRFcnJvcgAJAAIBAi9UaGUgYmxvY2sncyBoZWlnaHQgaXMgdG9vIGJpZyBmb3IgdGhpcyBwcm9wb3NhbAEQYWxyZWFkeVZvdGVFcnJvcgAJAAIBAhZZb3UgaGF2ZSBhbHJlYWR5IHZvdGVkAQtub1ZvdGVFcnJvcgAJAAIBAhpZb3UgaGF2ZSBub3QgYWxyZWFkeSB2b3RlZAESZ3d4Q29udHJhY3RBZGRyZXNzAAkAuQkCCQDMCAICAiVzCQDMCAICEmd3eENvbnRyYWN0QWRkcmVzcwUDbmlsBQNTRVABD2tleUN1cnJlbnRJbmRleAAJALkJAgkAzAgCAgIlcwkAzAgCAgxjdXJyZW50SW5kZXgFA25pbAUDU0VQAQ9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3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXn2r12A", "height": 2381450, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Deoqy2urwxR5kQ4wv2KdBzu66Mt3t67cXwZWTDyjRdZH Next: kcqmwuotNHvUpxk9yU8BN1JzRvJm7qgaTiEAUmGiMHf Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | - | func keyManagerPublicKey () = "%s__ | |
6 | + | func keyManagerPublicKey () = "%s__managerPublicpKey" | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
24 | 24 | func keyCurrentIndex () = makeString(["%s", "currentIndex"], SEP) | |
25 | 25 | ||
26 | 26 | ||
27 | - | func | |
27 | + | func keyProposalInfo (number) = makeString(["%s%d", "proposalInfo", toString(number)], SEP) | |
28 | 28 | ||
29 | 29 | ||
30 | - | func keyProposalEnd (number) = makeString(["%s%d", "proposalEnd", toString(number)], SEP) | |
31 | - | ||
32 | - | ||
33 | - | func keyTotalPositiveVoteByProposal (number) = makeString(["%s%d", "proposalTotalPositiveVoteNumber", toString(number)], SEP) | |
34 | - | ||
35 | - | ||
36 | - | func keyTotalNegativeVoteByProposal (number) = makeString(["%s%d", "proposalTotalNegativeVoteNumber", toString(number)], SEP) | |
37 | - | ||
38 | - | ||
39 | - | func keyUserChoice (number,user) = makeString(["%s%d%s", "usersChoicebyProposal", toString(number), user], SEP) | |
40 | - | ||
41 | - | ||
42 | - | func keyUserNumberVotesGwxInProposal (number,user) = makeString(["%s%d%s", "usersGWXbyProposal", toString(number), user], SEP) | |
43 | - | ||
44 | - | ||
45 | - | func keyQuorumQuantity (number) = makeString(["%s%d", "quorumQuantity", toString(number)], SEP) | |
30 | + | func keyUserVoteOnProposal (number,user) = makeString(["%s%d%d", "userVoteOnProposal", toString(number), user], SEP) | |
46 | 31 | ||
47 | 32 | ||
48 | 33 | func getCurrentIndex () = getIntegerValue(this, keyCurrentIndex()) | |
34 | + | ||
35 | + | ||
36 | + | func formatProposalInfo (name,description,end,quorumNumber,positiveVotes,negativeVotes) = makeString(["%d%d%d%d%d%d", name, description, end, quorumNumber, positiveVotes, negativeVotes], SEP) | |
37 | + | ||
38 | + | ||
39 | + | func formatUserVoteOnProposal (vote,gwxNumber) = makeString(["%d%d", vote, gwxNumber], SEP) | |
49 | 40 | ||
50 | 41 | ||
51 | 42 | func asInt (val) = match val { | |
102 | 93 | ||
103 | 94 | ||
104 | 95 | @Callable(i) | |
105 | - | func startNewVote (description,expirationHeight,quorumNumber) = { | |
96 | + | func startNewVote (name,description,expirationHeight,quorumNumber) = { | |
106 | 97 | let checks = [mustManager(i)] | |
107 | 98 | if ((checks == checks)) | |
108 | 99 | then { | |
109 | 100 | let theIndex = getCurrentIndex() | |
110 | - | [IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry( | |
101 | + | [IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry(keyProposalInfo(theIndex), formatProposalInfo(name, description, toString((lastBlock.height + expirationHeight)), toString(quorumNumber), "0", "0"))] | |
111 | 102 | } | |
112 | 103 | else throw("Strict value is not equal to itself.") | |
113 | 104 | } | |
116 | 107 | ||
117 | 108 | @Callable(i) | |
118 | 109 | func voteFor (proposalIndex,choice) = { | |
119 | - | let checks = [if ((getIntegerValue(this, keyProposalEnd(proposalIndex)) > lastBlock.height)) | |
110 | + | let EMPTY = "EMPTY" | |
111 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
112 | + | let voteInfoArray = split(voteInfo, SEP) | |
113 | + | let userVoteInfo = valueOrElse(getString(this, keyUserVoteOnProposal(proposalIndex, toString(i.caller))), EMPTY) | |
114 | + | let checks = [if ((voteInfo != EMPTY)) | |
120 | 115 | then true | |
121 | - | else blockHeightError(), if ((getString(this, keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))) == unit)) | |
116 | + | else throw("No such vote"), if ((value(parseInt(voteInfoArray[2])) > lastBlock.height)) | |
117 | + | then true | |
118 | + | else blockHeightError(), if ((userVoteInfo == EMPTY)) | |
122 | 119 | then true | |
123 | 120 | else alreadyVoteError()] | |
124 | 121 | if ((checks == checks)) | |
125 | 122 | then { | |
126 | - | let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), | |
127 | - | let $ | |
123 | + | let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), parseInt(voteInfoArray[2])], nil)) | |
124 | + | let $t035494637 = if (choice) | |
128 | 125 | then { | |
129 | - | let action1 = | |
130 | - | let action2 = | |
126 | + | let action1 = StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString((value(parseInt(voteInfoArray[4])) + gwxNumber)), voteInfoArray[5])) | |
127 | + | let action2 = StringEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)), formatUserVoteOnProposal("1", toString(gwxNumber))) | |
131 | 128 | $Tuple2(action1, action2) | |
132 | 129 | } | |
133 | 130 | else { | |
134 | - | let action1 = | |
135 | - | let action2 = | |
131 | + | let action1 = StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], voteInfoArray[4], toString((value(parseInt(voteInfoArray[5])) + gwxNumber)))) | |
132 | + | let action2 = StringEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)), formatUserVoteOnProposal("0", toString(gwxNumber))) | |
136 | 133 | $Tuple2(action1, action2) | |
137 | 134 | } | |
138 | - | let action1 = $ | |
139 | - | let action2 = $ | |
140 | - | [ | |
135 | + | let action1 = $t035494637._1 | |
136 | + | let action2 = $t035494637._2 | |
137 | + | [action1, action2] | |
141 | 138 | } | |
142 | 139 | else throw("Strict value is not equal to itself.") | |
143 | 140 | } | |
146 | 143 | ||
147 | 144 | @Callable(i) | |
148 | 145 | func deleteVote (proposalIndex) = { | |
149 | - | let checks = [if ((getIntegerValue(this, keyProposalEnd(proposalIndex)) > lastBlock.height)) | |
146 | + | let EMPTY = "EMPTY" | |
147 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
148 | + | let voteInfoArray = split(voteInfo, SEP) | |
149 | + | let userVoteInfo = valueOrElse(getString(this, keyUserVoteOnProposal(proposalIndex, toString(i.caller))), EMPTY) | |
150 | + | let userVoteInfoArray = split(voteInfo, SEP) | |
151 | + | let checks = [if ((voteInfo != EMPTY)) | |
150 | 152 | then true | |
151 | - | else blockHeightError(), if ((getInteger(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))) != unit)) | |
153 | + | else throw("No such vote"), if ((value(parseInt(voteInfoArray[2])) > lastBlock.height)) | |
154 | + | then true | |
155 | + | else blockHeightError(), if ((userVoteInfo != EMPTY)) | |
152 | 156 | then true | |
153 | 157 | else noVoteError()] | |
154 | 158 | if ((checks == checks)) | |
155 | 159 | then { | |
156 | - | let action = if ((getIntegerValue(keyUserChoice(proposalIndex, toString(i.caller))) == 1)) | |
157 | - | then IntegerEntry(keyTotalPositiveVoteByProposal(proposalIndex), (getIntegerValue(keyTotalPositiveVoteByProposal(proposalIndex)) - getIntegerValue(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))))) | |
158 | - | else IntegerEntry(keyTotalNegativeVoteByProposal(proposalIndex), (getIntegerValue(keyTotalNegativeVoteByProposal(proposalIndex)) - getIntegerValue(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))))) | |
159 | - | [action, DeleteEntry(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))), DeleteEntry(keyUserChoice(proposalIndex, toString(i.caller)))] | |
160 | + | let action = if ((userVoteInfoArray[0] == "1")) | |
161 | + | then StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString((value(parseInt(voteInfoArray[4])) - value(parseInt(userVoteInfoArray[1])))), voteInfoArray[5])) | |
162 | + | else StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], voteInfoArray[4], toString((value(parseInt(voteInfoArray[5])) - value(parseInt(userVoteInfoArray[1])))))) | |
163 | + | [action, DeleteEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)))] | |
164 | + | } | |
165 | + | else throw("Strict value is not equal to itself.") | |
166 | + | } | |
167 | + | ||
168 | + | ||
169 | + | ||
170 | + | @Callable(i) | |
171 | + | func changeVote (proposalIndex,choice) = { | |
172 | + | let EMPTY = "EMPTY" | |
173 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
174 | + | let voteInfoArray = split(voteInfo, SEP) | |
175 | + | let userVoteInfo = valueOrElse(getString(this, keyUserVoteOnProposal(proposalIndex, toString(i.caller))), EMPTY) | |
176 | + | let userVoteInfoArray = split(voteInfo, SEP) | |
177 | + | let checks = [if ((voteInfo != EMPTY)) | |
178 | + | then true | |
179 | + | else throw("No such vote"), if ((value(parseInt(voteInfoArray[2])) > lastBlock.height)) | |
180 | + | then true | |
181 | + | else blockHeightError(), if ((userVoteInfo != EMPTY)) | |
182 | + | then true | |
183 | + | else noVoteError()] | |
184 | + | if ((checks == checks)) | |
185 | + | then { | |
186 | + | let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), parseInt(voteInfoArray[2])], nil)) | |
187 | + | let $t068417180 = if (choice) | |
188 | + | then { | |
189 | + | let forNumber = gwxNumber | |
190 | + | let againstNumber = 0 | |
191 | + | let choiceInteger = 1 | |
192 | + | $Tuple3(forNumber, againstNumber, choiceInteger) | |
193 | + | } | |
194 | + | else { | |
195 | + | let forNumber = 0 | |
196 | + | let againstNumber = gwxNumber | |
197 | + | let choiceInteger = 0 | |
198 | + | $Tuple3(forNumber, againstNumber, choiceInteger) | |
199 | + | } | |
200 | + | let userPowerFor = $t068417180._1 | |
201 | + | let userPowerAgainst = $t068417180._2 | |
202 | + | let choiceInt = $t068417180._3 | |
203 | + | let action = if ((userVoteInfoArray[0] == "1")) | |
204 | + | then StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString(((value(parseInt(voteInfoArray[4])) - value(parseInt(userVoteInfoArray[1]))) + userPowerFor)), toString((value(parseInt(voteInfoArray[5])) + userPowerAgainst)))) | |
205 | + | else StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString((value(parseInt(voteInfoArray[4])) + userPowerFor)), toString(((value(parseInt(voteInfoArray[5])) - value(parseInt(userVoteInfoArray[1]))) + userPowerAgainst)))) | |
206 | + | [action, StringEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)), formatUserVoteOnProposal(toString(choiceInt), toString(gwxNumber)))] | |
160 | 207 | } | |
161 | 208 | else throw("Strict value is not equal to itself.") | |
162 | 209 | } | |
165 | 212 | ||
166 | 213 | @Callable(i) | |
167 | 214 | func getResultREADONLY (proposalIndex) = { | |
168 | - | let positiveVotes = getIntegerValue(keyTotalPositiveVoteByProposal(proposalIndex)) | |
169 | - | let negativeVotes = getIntegerValue(keyTotalNegativeVoteByProposal(proposalIndex)) | |
170 | - | let quorumNumber = getIntegerValue(keyQuorumQuantity(proposalIndex)) | |
171 | - | $Tuple2(nil, [positiveVotes, negativeVotes, quorumNumber]) | |
215 | + | let EMPTY = "EMPTY" | |
216 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
217 | + | let voteInfoArray = split(voteInfo, SEP) | |
218 | + | let checks = [if ((voteInfo != EMPTY)) | |
219 | + | then true | |
220 | + | else throw("No such vote")] | |
221 | + | if ((checks == checks)) | |
222 | + | then { | |
223 | + | let positiveVotes = voteInfoArray[4] | |
224 | + | let negativeVotes = voteInfoArray[5] | |
225 | + | let quorumNumber = voteInfoArray[3] | |
226 | + | $Tuple2(nil, [positiveVotes, negativeVotes, quorumNumber]) | |
227 | + | } | |
228 | + | else throw("Strict value is not equal to itself.") | |
172 | 229 | } | |
173 | 230 | ||
174 | 231 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | - | func keyManagerPublicKey () = "%s__ | |
6 | + | func keyManagerPublicKey () = "%s__managerPublicpKey" | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func blockHeightError () = throw("The block's height is too big for this proposal") | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func alreadyVoteError () = throw("You have already voted") | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func noVoteError () = throw("You have not already voted") | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func gwxContractAddress () = makeString(["%s", "gwxContractAddress"], SEP) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyCurrentIndex () = makeString(["%s", "currentIndex"], SEP) | |
25 | 25 | ||
26 | 26 | ||
27 | - | func | |
27 | + | func keyProposalInfo (number) = makeString(["%s%d", "proposalInfo", toString(number)], SEP) | |
28 | 28 | ||
29 | 29 | ||
30 | - | func keyProposalEnd (number) = makeString(["%s%d", "proposalEnd", toString(number)], SEP) | |
31 | - | ||
32 | - | ||
33 | - | func keyTotalPositiveVoteByProposal (number) = makeString(["%s%d", "proposalTotalPositiveVoteNumber", toString(number)], SEP) | |
34 | - | ||
35 | - | ||
36 | - | func keyTotalNegativeVoteByProposal (number) = makeString(["%s%d", "proposalTotalNegativeVoteNumber", toString(number)], SEP) | |
37 | - | ||
38 | - | ||
39 | - | func keyUserChoice (number,user) = makeString(["%s%d%s", "usersChoicebyProposal", toString(number), user], SEP) | |
40 | - | ||
41 | - | ||
42 | - | func keyUserNumberVotesGwxInProposal (number,user) = makeString(["%s%d%s", "usersGWXbyProposal", toString(number), user], SEP) | |
43 | - | ||
44 | - | ||
45 | - | func keyQuorumQuantity (number) = makeString(["%s%d", "quorumQuantity", toString(number)], SEP) | |
30 | + | func keyUserVoteOnProposal (number,user) = makeString(["%s%d%d", "userVoteOnProposal", toString(number), user], SEP) | |
46 | 31 | ||
47 | 32 | ||
48 | 33 | func getCurrentIndex () = getIntegerValue(this, keyCurrentIndex()) | |
34 | + | ||
35 | + | ||
36 | + | func formatProposalInfo (name,description,end,quorumNumber,positiveVotes,negativeVotes) = makeString(["%d%d%d%d%d%d", name, description, end, quorumNumber, positiveVotes, negativeVotes], SEP) | |
37 | + | ||
38 | + | ||
39 | + | func formatUserVoteOnProposal (vote,gwxNumber) = makeString(["%d%d", vote, gwxNumber], SEP) | |
49 | 40 | ||
50 | 41 | ||
51 | 42 | func asInt (val) = match val { | |
52 | 43 | case valInt: Int => | |
53 | 44 | valInt | |
54 | 45 | case _ => | |
55 | 46 | throw("fail to cast into Int") | |
56 | 47 | } | |
57 | 48 | ||
58 | 49 | ||
59 | 50 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
60 | 51 | case s: String => | |
61 | 52 | fromBase58String(s) | |
62 | 53 | case _: Unit => | |
63 | 54 | unit | |
64 | 55 | case _ => | |
65 | 56 | throw("Match error") | |
66 | 57 | } | |
67 | 58 | ||
68 | 59 | ||
69 | 60 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
70 | 61 | case s: String => | |
71 | 62 | fromBase58String(s) | |
72 | 63 | case _: Unit => | |
73 | 64 | unit | |
74 | 65 | case _ => | |
75 | 66 | throw("Match error") | |
76 | 67 | } | |
77 | 68 | ||
78 | 69 | ||
79 | 70 | func isManager (i) = match managerPublicKeyOrUnit() { | |
80 | 71 | case pk: ByteVector => | |
81 | 72 | (i.callerPublicKey == pk) | |
82 | 73 | case _: Unit => | |
83 | 74 | (i.caller == this) | |
84 | 75 | case _ => | |
85 | 76 | throw("Match error") | |
86 | 77 | } | |
87 | 78 | ||
88 | 79 | ||
89 | 80 | func mustManager (i) = if (isManager(i)) | |
90 | 81 | then true | |
91 | 82 | else throw("permission denied") | |
92 | 83 | ||
93 | 84 | ||
94 | 85 | @Callable(i) | |
95 | 86 | func constructor (gwxContractAddress) = { | |
96 | 87 | let check = mustManager(i) | |
97 | 88 | if ((check == check)) | |
98 | 89 | then [StringEntry(gwxContractAddress(), gwxContractAddress), IntegerEntry(keyCurrentIndex(), 0)] | |
99 | 90 | else throw("Strict value is not equal to itself.") | |
100 | 91 | } | |
101 | 92 | ||
102 | 93 | ||
103 | 94 | ||
104 | 95 | @Callable(i) | |
105 | - | func startNewVote (description,expirationHeight,quorumNumber) = { | |
96 | + | func startNewVote (name,description,expirationHeight,quorumNumber) = { | |
106 | 97 | let checks = [mustManager(i)] | |
107 | 98 | if ((checks == checks)) | |
108 | 99 | then { | |
109 | 100 | let theIndex = getCurrentIndex() | |
110 | - | [IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry( | |
101 | + | [IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry(keyProposalInfo(theIndex), formatProposalInfo(name, description, toString((lastBlock.height + expirationHeight)), toString(quorumNumber), "0", "0"))] | |
111 | 102 | } | |
112 | 103 | else throw("Strict value is not equal to itself.") | |
113 | 104 | } | |
114 | 105 | ||
115 | 106 | ||
116 | 107 | ||
117 | 108 | @Callable(i) | |
118 | 109 | func voteFor (proposalIndex,choice) = { | |
119 | - | let checks = [if ((getIntegerValue(this, keyProposalEnd(proposalIndex)) > lastBlock.height)) | |
110 | + | let EMPTY = "EMPTY" | |
111 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
112 | + | let voteInfoArray = split(voteInfo, SEP) | |
113 | + | let userVoteInfo = valueOrElse(getString(this, keyUserVoteOnProposal(proposalIndex, toString(i.caller))), EMPTY) | |
114 | + | let checks = [if ((voteInfo != EMPTY)) | |
120 | 115 | then true | |
121 | - | else blockHeightError(), if ((getString(this, keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))) == unit)) | |
116 | + | else throw("No such vote"), if ((value(parseInt(voteInfoArray[2])) > lastBlock.height)) | |
117 | + | then true | |
118 | + | else blockHeightError(), if ((userVoteInfo == EMPTY)) | |
122 | 119 | then true | |
123 | 120 | else alreadyVoteError()] | |
124 | 121 | if ((checks == checks)) | |
125 | 122 | then { | |
126 | - | let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), | |
127 | - | let $ | |
123 | + | let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), parseInt(voteInfoArray[2])], nil)) | |
124 | + | let $t035494637 = if (choice) | |
128 | 125 | then { | |
129 | - | let action1 = | |
130 | - | let action2 = | |
126 | + | let action1 = StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString((value(parseInt(voteInfoArray[4])) + gwxNumber)), voteInfoArray[5])) | |
127 | + | let action2 = StringEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)), formatUserVoteOnProposal("1", toString(gwxNumber))) | |
131 | 128 | $Tuple2(action1, action2) | |
132 | 129 | } | |
133 | 130 | else { | |
134 | - | let action1 = | |
135 | - | let action2 = | |
131 | + | let action1 = StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], voteInfoArray[4], toString((value(parseInt(voteInfoArray[5])) + gwxNumber)))) | |
132 | + | let action2 = StringEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)), formatUserVoteOnProposal("0", toString(gwxNumber))) | |
136 | 133 | $Tuple2(action1, action2) | |
137 | 134 | } | |
138 | - | let action1 = $ | |
139 | - | let action2 = $ | |
140 | - | [ | |
135 | + | let action1 = $t035494637._1 | |
136 | + | let action2 = $t035494637._2 | |
137 | + | [action1, action2] | |
141 | 138 | } | |
142 | 139 | else throw("Strict value is not equal to itself.") | |
143 | 140 | } | |
144 | 141 | ||
145 | 142 | ||
146 | 143 | ||
147 | 144 | @Callable(i) | |
148 | 145 | func deleteVote (proposalIndex) = { | |
149 | - | let checks = [if ((getIntegerValue(this, keyProposalEnd(proposalIndex)) > lastBlock.height)) | |
146 | + | let EMPTY = "EMPTY" | |
147 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
148 | + | let voteInfoArray = split(voteInfo, SEP) | |
149 | + | let userVoteInfo = valueOrElse(getString(this, keyUserVoteOnProposal(proposalIndex, toString(i.caller))), EMPTY) | |
150 | + | let userVoteInfoArray = split(voteInfo, SEP) | |
151 | + | let checks = [if ((voteInfo != EMPTY)) | |
150 | 152 | then true | |
151 | - | else blockHeightError(), if ((getInteger(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))) != unit)) | |
153 | + | else throw("No such vote"), if ((value(parseInt(voteInfoArray[2])) > lastBlock.height)) | |
154 | + | then true | |
155 | + | else blockHeightError(), if ((userVoteInfo != EMPTY)) | |
152 | 156 | then true | |
153 | 157 | else noVoteError()] | |
154 | 158 | if ((checks == checks)) | |
155 | 159 | then { | |
156 | - | let action = if ((getIntegerValue(keyUserChoice(proposalIndex, toString(i.caller))) == 1)) | |
157 | - | then IntegerEntry(keyTotalPositiveVoteByProposal(proposalIndex), (getIntegerValue(keyTotalPositiveVoteByProposal(proposalIndex)) - getIntegerValue(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))))) | |
158 | - | else IntegerEntry(keyTotalNegativeVoteByProposal(proposalIndex), (getIntegerValue(keyTotalNegativeVoteByProposal(proposalIndex)) - getIntegerValue(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))))) | |
159 | - | [action, DeleteEntry(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller))), DeleteEntry(keyUserChoice(proposalIndex, toString(i.caller)))] | |
160 | + | let action = if ((userVoteInfoArray[0] == "1")) | |
161 | + | then StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString((value(parseInt(voteInfoArray[4])) - value(parseInt(userVoteInfoArray[1])))), voteInfoArray[5])) | |
162 | + | else StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], voteInfoArray[4], toString((value(parseInt(voteInfoArray[5])) - value(parseInt(userVoteInfoArray[1])))))) | |
163 | + | [action, DeleteEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)))] | |
164 | + | } | |
165 | + | else throw("Strict value is not equal to itself.") | |
166 | + | } | |
167 | + | ||
168 | + | ||
169 | + | ||
170 | + | @Callable(i) | |
171 | + | func changeVote (proposalIndex,choice) = { | |
172 | + | let EMPTY = "EMPTY" | |
173 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
174 | + | let voteInfoArray = split(voteInfo, SEP) | |
175 | + | let userVoteInfo = valueOrElse(getString(this, keyUserVoteOnProposal(proposalIndex, toString(i.caller))), EMPTY) | |
176 | + | let userVoteInfoArray = split(voteInfo, SEP) | |
177 | + | let checks = [if ((voteInfo != EMPTY)) | |
178 | + | then true | |
179 | + | else throw("No such vote"), if ((value(parseInt(voteInfoArray[2])) > lastBlock.height)) | |
180 | + | then true | |
181 | + | else blockHeightError(), if ((userVoteInfo != EMPTY)) | |
182 | + | then true | |
183 | + | else noVoteError()] | |
184 | + | if ((checks == checks)) | |
185 | + | then { | |
186 | + | let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), parseInt(voteInfoArray[2])], nil)) | |
187 | + | let $t068417180 = if (choice) | |
188 | + | then { | |
189 | + | let forNumber = gwxNumber | |
190 | + | let againstNumber = 0 | |
191 | + | let choiceInteger = 1 | |
192 | + | $Tuple3(forNumber, againstNumber, choiceInteger) | |
193 | + | } | |
194 | + | else { | |
195 | + | let forNumber = 0 | |
196 | + | let againstNumber = gwxNumber | |
197 | + | let choiceInteger = 0 | |
198 | + | $Tuple3(forNumber, againstNumber, choiceInteger) | |
199 | + | } | |
200 | + | let userPowerFor = $t068417180._1 | |
201 | + | let userPowerAgainst = $t068417180._2 | |
202 | + | let choiceInt = $t068417180._3 | |
203 | + | let action = if ((userVoteInfoArray[0] == "1")) | |
204 | + | then StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString(((value(parseInt(voteInfoArray[4])) - value(parseInt(userVoteInfoArray[1]))) + userPowerFor)), toString((value(parseInt(voteInfoArray[5])) + userPowerAgainst)))) | |
205 | + | else StringEntry(keyProposalInfo(proposalIndex), formatProposalInfo(voteInfoArray[0], voteInfoArray[1], voteInfoArray[2], voteInfoArray[3], toString((value(parseInt(voteInfoArray[4])) + userPowerFor)), toString(((value(parseInt(voteInfoArray[5])) - value(parseInt(userVoteInfoArray[1]))) + userPowerAgainst)))) | |
206 | + | [action, StringEntry(keyUserVoteOnProposal(proposalIndex, toString(i.caller)), formatUserVoteOnProposal(toString(choiceInt), toString(gwxNumber)))] | |
160 | 207 | } | |
161 | 208 | else throw("Strict value is not equal to itself.") | |
162 | 209 | } | |
163 | 210 | ||
164 | 211 | ||
165 | 212 | ||
166 | 213 | @Callable(i) | |
167 | 214 | func getResultREADONLY (proposalIndex) = { | |
168 | - | let positiveVotes = getIntegerValue(keyTotalPositiveVoteByProposal(proposalIndex)) | |
169 | - | let negativeVotes = getIntegerValue(keyTotalNegativeVoteByProposal(proposalIndex)) | |
170 | - | let quorumNumber = getIntegerValue(keyQuorumQuantity(proposalIndex)) | |
171 | - | $Tuple2(nil, [positiveVotes, negativeVotes, quorumNumber]) | |
215 | + | let EMPTY = "EMPTY" | |
216 | + | let voteInfo = valueOrElse(getString(this, keyProposalInfo(proposalIndex)), EMPTY) | |
217 | + | let voteInfoArray = split(voteInfo, SEP) | |
218 | + | let checks = [if ((voteInfo != EMPTY)) | |
219 | + | then true | |
220 | + | else throw("No such vote")] | |
221 | + | if ((checks == checks)) | |
222 | + | then { | |
223 | + | let positiveVotes = voteInfoArray[4] | |
224 | + | let negativeVotes = voteInfoArray[5] | |
225 | + | let quorumNumber = voteInfoArray[3] | |
226 | + | $Tuple2(nil, [positiveVotes, negativeVotes, quorumNumber]) | |
227 | + | } | |
228 | + | else throw("Strict value is not equal to itself.") | |
172 | 229 | } | |
173 | 230 | ||
174 | 231 | ||
175 | 232 | ||
176 | 233 | @Callable(i) | |
177 | 234 | func setManager (pendingManagerPublicKey) = { | |
178 | 235 | let checkCaller = mustManager(i) | |
179 | 236 | if ((checkCaller == checkCaller)) | |
180 | 237 | then { | |
181 | 238 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
182 | 239 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
183 | 240 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
184 | 241 | else throw("Strict value is not equal to itself.") | |
185 | 242 | } | |
186 | 243 | else throw("Strict value is not equal to itself.") | |
187 | 244 | } | |
188 | 245 | ||
189 | 246 | ||
190 | 247 | ||
191 | 248 | @Callable(i) | |
192 | 249 | func confirmManager () = { | |
193 | 250 | let pm = pendingManagerPublicKeyOrUnit() | |
194 | 251 | let hasPM = if (isDefined(pm)) | |
195 | 252 | then true | |
196 | 253 | else throw("no pending manager") | |
197 | 254 | if ((hasPM == hasPM)) | |
198 | 255 | then { | |
199 | 256 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
200 | 257 | then true | |
201 | 258 | else throw("you are not pending manager") | |
202 | 259 | if ((checkPM == checkPM)) | |
203 | 260 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
204 | 261 | else throw("Strict value is not equal to itself.") | |
205 | 262 | } | |
206 | 263 | else throw("Strict value is not equal to itself.") | |
207 | 264 | } | |
208 | 265 | ||
209 | 266 | ||
210 | 267 | @Verifier(tx) | |
211 | 268 | func verify () = { | |
212 | 269 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
213 | 270 | case pk: ByteVector => | |
214 | 271 | pk | |
215 | 272 | case _: Unit => | |
216 | 273 | tx.senderPublicKey | |
217 | 274 | case _ => | |
218 | 275 | throw("Match error") | |
219 | 276 | } | |
220 | 277 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
221 | 278 | } | |
222 | 279 |
github/deemru/w8io/169f3d6 68.94 ms ◑