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:BgIsCAISAwoBCBIGCgQICAEBEgQKAgEEEgMKAQESBAoCAQQSAwoBARIDCgEIEgASAANTRVACAl9fARNrZXlNYW5hZ2VyUHVibGljS2V5AAIVJXNfX21hbmFnZXJQdWJsaWNwS2V5ARprZXlQZW5kaW5nTWFuYWdlclB1YmxpY0tleQACGyVzX19wZW5kaW5nTWFuYWdlclB1YmxpY0tleQEQYmxvY2tIZWlnaHRFcnJvcgAJAAIBAi9UaGUgYmxvY2sncyBoZWlnaHQgaXMgdG9vIGJpZyBmb3IgdGhpcyBwcm9wb3NhbAEQYWxyZWFkeVZvdGVFcnJvcgAJAAIBAhZZb3UgaGF2ZSBhbHJlYWR5IHZvdGVkAQtub1ZvdGVFcnJvcgAJAAIBAhpZb3UgaGF2ZSBub3QgYWxyZWFkeSB2b3RlZAESZ3d4Q29udHJhY3RBZGRyZXNzAAkAuQkCCQDMCAICAiVzCQDMCAICEmd3eENvbnRyYWN0QWRkcmVzcwUDbmlsBQNTRVABD2tleUN1cnJlbnRJbmRleAAJALkJAgkAzAgCAgIlcwkAzAgCAgxjdXJyZW50SW5kZXgFA25pbAUDU0VQAQ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T3JVbml0AAMJAAECBQckbWF0Y2gwAgpCeXRlVmVjdG9yBAJwawUHJG1hdGNoMAUCcGsDCQABAgUHJG1hdGNoMAIEVW5pdAgFAnR4D3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQ90YXJnZXRQdWJsaWNLZXn2r12A", "height": 2381450, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: Deoqy2urwxR5kQ4wv2KdBzu66Mt3t67cXwZWTDyjRdZH Next: kcqmwuotNHvUpxk9yU8BN1JzRvJm7qgaTiEAUmGiMHf Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
6-func keyManagerPublicKey () = "%s__managerPublicKey"
6+func keyManagerPublicKey () = "%s__managerPublicpKey"
77
88
99 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
2424 func keyCurrentIndex () = makeString(["%s", "currentIndex"], SEP)
2525
2626
27-func keyProposalDescription (number) = makeString(["%s%d", "proposalDescription", toString(number)], SEP)
27+func keyProposalInfo (number) = makeString(["%s%d", "proposalInfo", toString(number)], SEP)
2828
2929
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)
4631
4732
4833 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)
4940
5041
5142 func asInt (val) = match val {
10293
10394
10495 @Callable(i)
105-func startNewVote (description,expirationHeight,quorumNumber) = {
96+func startNewVote (name,description,expirationHeight,quorumNumber) = {
10697 let checks = [mustManager(i)]
10798 if ((checks == checks))
10899 then {
109100 let theIndex = getCurrentIndex()
110-[IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry(keyProposalDescription(theIndex), description), IntegerEntry(keyProposalEnd(theIndex), (lastBlock.height + expirationHeight)), IntegerEntry(keyTotalPositiveVoteByProposal(theIndex), 0), IntegerEntry(keyTotalNegativeVoteByProposal(theIndex), 0), IntegerEntry(keyQuorumQuantity(theIndex), quorumNumber)]
101+[IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry(keyProposalInfo(theIndex), formatProposalInfo(name, description, toString((lastBlock.height + expirationHeight)), toString(quorumNumber), "0", "0"))]
111102 }
112103 else throw("Strict value is not equal to itself.")
113104 }
116107
117108 @Callable(i)
118109 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))
120115 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))
122119 then true
123120 else alreadyVoteError()]
124121 if ((checks == checks))
125122 then {
126- let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), getIntegerValue(keyProposalEnd(proposalIndex))], nil))
127- let $t034374018 = if (choice)
123+ let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), parseInt(voteInfoArray[2])], nil))
124+ let $t035494637 = if (choice)
128125 then {
129- let action1 = IntegerEntry(keyUserChoice(proposalIndex, toString(i.caller)), 1)
130- let action2 = IntegerEntry(keyTotalPositiveVoteByProposal(proposalIndex), (getIntegerValue(keyTotalPositiveVoteByProposal(proposalIndex)) + gwxNumber))
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)))
131128 $Tuple2(action1, action2)
132129 }
133130 else {
134- let action1 = IntegerEntry(keyUserChoice(proposalIndex, toString(i.caller)), 0)
135- let action2 = IntegerEntry(keyTotalNegativeVoteByProposal(proposalIndex), (getIntegerValue(keyTotalNegativeVoteByProposal(proposalIndex)) + gwxNumber))
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)))
136133 $Tuple2(action1, action2)
137134 }
138- let action1 = $t034374018._1
139- let action2 = $t034374018._2
140-[IntegerEntry(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller)), gwxNumber), action1, action2]
135+ let action1 = $t035494637._1
136+ let action2 = $t035494637._2
137+[action1, action2]
141138 }
142139 else throw("Strict value is not equal to itself.")
143140 }
146143
147144 @Callable(i)
148145 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))
150152 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))
152156 then true
153157 else noVoteError()]
154158 if ((checks == checks))
155159 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)))]
160207 }
161208 else throw("Strict value is not equal to itself.")
162209 }
165212
166213 @Callable(i)
167214 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.")
172229 }
173230
174231
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
6-func keyManagerPublicKey () = "%s__managerPublicKey"
6+func keyManagerPublicKey () = "%s__managerPublicpKey"
77
88
99 func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
1010
1111
1212 func blockHeightError () = throw("The block's height is too big for this proposal")
1313
1414
1515 func alreadyVoteError () = throw("You have already voted")
1616
1717
1818 func noVoteError () = throw("You have not already voted")
1919
2020
2121 func gwxContractAddress () = makeString(["%s", "gwxContractAddress"], SEP)
2222
2323
2424 func keyCurrentIndex () = makeString(["%s", "currentIndex"], SEP)
2525
2626
27-func keyProposalDescription (number) = makeString(["%s%d", "proposalDescription", toString(number)], SEP)
27+func keyProposalInfo (number) = makeString(["%s%d", "proposalInfo", toString(number)], SEP)
2828
2929
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)
4631
4732
4833 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)
4940
5041
5142 func asInt (val) = match val {
5243 case valInt: Int =>
5344 valInt
5445 case _ =>
5546 throw("fail to cast into Int")
5647 }
5748
5849
5950 func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
6051 case s: String =>
6152 fromBase58String(s)
6253 case _: Unit =>
6354 unit
6455 case _ =>
6556 throw("Match error")
6657 }
6758
6859
6960 func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
7061 case s: String =>
7162 fromBase58String(s)
7263 case _: Unit =>
7364 unit
7465 case _ =>
7566 throw("Match error")
7667 }
7768
7869
7970 func isManager (i) = match managerPublicKeyOrUnit() {
8071 case pk: ByteVector =>
8172 (i.callerPublicKey == pk)
8273 case _: Unit =>
8374 (i.caller == this)
8475 case _ =>
8576 throw("Match error")
8677 }
8778
8879
8980 func mustManager (i) = if (isManager(i))
9081 then true
9182 else throw("permission denied")
9283
9384
9485 @Callable(i)
9586 func constructor (gwxContractAddress) = {
9687 let check = mustManager(i)
9788 if ((check == check))
9889 then [StringEntry(gwxContractAddress(), gwxContractAddress), IntegerEntry(keyCurrentIndex(), 0)]
9990 else throw("Strict value is not equal to itself.")
10091 }
10192
10293
10394
10495 @Callable(i)
105-func startNewVote (description,expirationHeight,quorumNumber) = {
96+func startNewVote (name,description,expirationHeight,quorumNumber) = {
10697 let checks = [mustManager(i)]
10798 if ((checks == checks))
10899 then {
109100 let theIndex = getCurrentIndex()
110-[IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry(keyProposalDescription(theIndex), description), IntegerEntry(keyProposalEnd(theIndex), (lastBlock.height + expirationHeight)), IntegerEntry(keyTotalPositiveVoteByProposal(theIndex), 0), IntegerEntry(keyTotalNegativeVoteByProposal(theIndex), 0), IntegerEntry(keyQuorumQuantity(theIndex), quorumNumber)]
101+[IntegerEntry(keyCurrentIndex(), (theIndex + 1)), StringEntry(keyProposalInfo(theIndex), formatProposalInfo(name, description, toString((lastBlock.height + expirationHeight)), toString(quorumNumber), "0", "0"))]
111102 }
112103 else throw("Strict value is not equal to itself.")
113104 }
114105
115106
116107
117108 @Callable(i)
118109 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))
120115 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))
122119 then true
123120 else alreadyVoteError()]
124121 if ((checks == checks))
125122 then {
126- let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), getIntegerValue(keyProposalEnd(proposalIndex))], nil))
127- let $t034374018 = if (choice)
123+ let gwxNumber = asInt(invoke(addressFromStringValue(getStringValue(gwxContractAddress())), "getUserGwxAmountAtHeightREADONLY", [toString(i.caller), parseInt(voteInfoArray[2])], nil))
124+ let $t035494637 = if (choice)
128125 then {
129- let action1 = IntegerEntry(keyUserChoice(proposalIndex, toString(i.caller)), 1)
130- let action2 = IntegerEntry(keyTotalPositiveVoteByProposal(proposalIndex), (getIntegerValue(keyTotalPositiveVoteByProposal(proposalIndex)) + gwxNumber))
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)))
131128 $Tuple2(action1, action2)
132129 }
133130 else {
134- let action1 = IntegerEntry(keyUserChoice(proposalIndex, toString(i.caller)), 0)
135- let action2 = IntegerEntry(keyTotalNegativeVoteByProposal(proposalIndex), (getIntegerValue(keyTotalNegativeVoteByProposal(proposalIndex)) + gwxNumber))
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)))
136133 $Tuple2(action1, action2)
137134 }
138- let action1 = $t034374018._1
139- let action2 = $t034374018._2
140-[IntegerEntry(keyUserNumberVotesGwxInProposal(proposalIndex, toString(i.caller)), gwxNumber), action1, action2]
135+ let action1 = $t035494637._1
136+ let action2 = $t035494637._2
137+[action1, action2]
141138 }
142139 else throw("Strict value is not equal to itself.")
143140 }
144141
145142
146143
147144 @Callable(i)
148145 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))
150152 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))
152156 then true
153157 else noVoteError()]
154158 if ((checks == checks))
155159 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)))]
160207 }
161208 else throw("Strict value is not equal to itself.")
162209 }
163210
164211
165212
166213 @Callable(i)
167214 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.")
172229 }
173230
174231
175232
176233 @Callable(i)
177234 func setManager (pendingManagerPublicKey) = {
178235 let checkCaller = mustManager(i)
179236 if ((checkCaller == checkCaller))
180237 then {
181238 let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
182239 if ((checkManagerPublicKey == checkManagerPublicKey))
183240 then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
184241 else throw("Strict value is not equal to itself.")
185242 }
186243 else throw("Strict value is not equal to itself.")
187244 }
188245
189246
190247
191248 @Callable(i)
192249 func confirmManager () = {
193250 let pm = pendingManagerPublicKeyOrUnit()
194251 let hasPM = if (isDefined(pm))
195252 then true
196253 else throw("no pending manager")
197254 if ((hasPM == hasPM))
198255 then {
199256 let checkPM = if ((i.callerPublicKey == value(pm)))
200257 then true
201258 else throw("you are not pending manager")
202259 if ((checkPM == checkPM))
203260 then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
204261 else throw("Strict value is not equal to itself.")
205262 }
206263 else throw("Strict value is not equal to itself.")
207264 }
208265
209266
210267 @Verifier(tx)
211268 func verify () = {
212269 let targetPublicKey = match managerPublicKeyOrUnit() {
213270 case pk: ByteVector =>
214271 pk
215272 case _: Unit =>
216273 tx.senderPublicKey
217274 case _ =>
218275 throw("Match error")
219276 }
220277 sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
221278 }
222279

github/deemru/w8io/026f985 
57.70 ms