tx · 5V2xqY6wJDNWiVCaQsRuoQoMu3KxKZ75g1yHuoboEaHs 3NASZBVWhnQZKB9YFGUMMhS1QrFRVz46f9G: -0.01400000 Waves 2021.03.07 20:35 [1427580] smart account 3NASZBVWhnQZKB9YFGUMMhS1QrFRVz46f9G > SELF 0.00000000 Waves
{ "type": 13, "id": "5V2xqY6wJDNWiVCaQsRuoQoMu3KxKZ75g1yHuoboEaHs", "fee": 1400000, "feeAssetId": null, "timestamp": 1615138566548, "version": 1, "sender": "3NASZBVWhnQZKB9YFGUMMhS1QrFRVz46f9G", "senderPublicKey": "sxaKTR56AbBktJ12bQksWCna2DhhcKKbD6bwepHT1N3", "proofs": [ "5bV3swNeLzqYsdhaFjV9jgAmpWfhLrnnthqgeuKCsQyXQxBDMixwuGZzpwVb83UTu4QWTD1CQmhJACuEiTk6vvGx" ], "script": "base64:AAIEAAAAAAAAAAgIAhIECgIIAQAAAAYAAAAAE2tVc2VyUG9vbFZvdGVXZWlnaHQCAAAABV92b3RlAAAAABRrVXNlclRvdGFsVm90ZVdlaWdodAIAAAAQX3VzZXJfdG90YWxfdm90ZQAAAAAHZ292QWRkcgkBAAAAB0FkZHJlc3MAAAABAQAAABoBVBOlRfV53O7UL6ST3Xinja4q82stWBHbXQAAAAAWdXNlclRvdGFsVm90ZVdpZWdodE1heAAAAAAAAA9CQAEAAAAUaXNDYWxsZXJJbkdvdmVybmFuY2UAAAABAAAABHVzZXIDAwkAAGYAAAACCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAAB2dvdkFkZHIJAAEsAAAAAgkABCUAAAABBQAAAAR1c2VyAgAAAAxfU1dPUF9hbW91bnQAAAAAAAAAAAAAAAAAAAAAAAAGCQAAZgAAAAIJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwkAASwAAAACCQAEJQAAAAEFAAAABHVzZXIFAAAAFGtVc2VyVG90YWxWb3RlV2VpZ2h0AAAAAAAAAAAAAAAAA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Z1c2VyVG90YWxWb3RlV2VpZ2h0TmV3CQAAZAAAAAIFAAAAEnVzZXJQb29sVm90ZVdlaWdodAUAAAAScG9vbFZvdGVXZWlnaHREaWZmAwkAAGYAAAACBQAAABZ1c2VyVG90YWxWb3RlV2VpZ2h0TmV3BQAAABZ1c2VyVG90YWxWb3RlV2llZ2h0TWF4CQAAAgAAAAEJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAAD05ldyB0b3RhbCB2b3RlIAkAAaQAAAABBQAAABZ1c2VyVG90YWxWb3RlV2VpZ2h0TmV3AgAAABUgc2hvdWxkIGJlIGxlc3MgdGhlbiAJAAGkAAAAAQUAAAAWdXNlclRvdGFsVm90ZVdpZWdodE1heAkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIFAAAAE2tVc2VyUG9vbFZvdGVXZWlnaHQCAAAAAV8FAAAAC3Bvb2xBZGRyZXNzBQAAABFwb29sVm90ZVdlaWdodE5ldwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgUAAAAUa1VzZXJUb3RhbFZvdGVXZWlnaHQFAAAAFnVzZXJUb3RhbFZvdGVXZWlnaHROZXcFAAAAA25pbAAAAABxEqJo", "chainId": 84, "height": 1427580, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CjWED1khHeA4LUA6eBrN9DtcJZ7QgzAw7WqEiSJJfDFM Next: EXXgvPiLw2o282PV6KhK2BAqpvwXUkbMGaqQSUewgcNg Diff:
Old | New | Differences | |
---|---|---|---|
33 | 33 | let userTotalVoteWeightNew = (userPoolVoteWeight + poolVoteWeightDiff) | |
34 | 34 | if ((userTotalVoteWeightNew > userTotalVoteWieghtMax)) | |
35 | 35 | then throw(((("New total vote " + toString(userTotalVoteWeightNew)) + " should be less then ") + toString(userTotalVoteWieghtMax))) | |
36 | - | else [IntegerEntry((toString(i.caller) + kUserPoolVoteWeight), poolVoteWeightNew), IntegerEntry((toString(i.caller) + | |
36 | + | else [IntegerEntry((((toString(i.caller) + kUserPoolVoteWeight) + "_") + poolAddress), poolVoteWeightNew), IntegerEntry((toString(i.caller) + kUserTotalVoteWeight), userTotalVoteWeightNew)] | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kUserPoolVoteWeight = "_vote" | |
5 | 5 | ||
6 | 6 | let kUserTotalVoteWeight = "_user_total_vote" | |
7 | 7 | ||
8 | 8 | let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp') | |
9 | 9 | ||
10 | 10 | let userTotalVoteWieghtMax = 1000000 | |
11 | 11 | ||
12 | 12 | func isCallerInGovernance (user) = if (if ((valueOrElse(getInteger(govAddr, (toString(user) + "_SWOP_amount")), 0) > 0)) | |
13 | 13 | then true | |
14 | 14 | else (valueOrElse(getInteger(this, (toString(user) + kUserTotalVoteWeight)), 0) > 0)) | |
15 | 15 | then true | |
16 | 16 | else false | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func isPoolInGovernance (poolAddress) = if ((valueOrElse(getInteger(govAddr, (poolAddress + "_startHeight")), 0) > 0)) | |
20 | 20 | then true | |
21 | 21 | else false | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | @Callable(i) | |
25 | 25 | func votePoolWeight (poolAddress,poolVoteWeightNew) = if (!(isCallerInGovernance(i.caller))) | |
26 | 26 | then throw("This address has 0 SWOP in Governance dApp") | |
27 | 27 | else if (!(isPoolInGovernance(poolAddress))) | |
28 | 28 | then throw("This pool has no _startHeight in Governance dApp") | |
29 | 29 | else { | |
30 | 30 | let userTotalVoteWeight = valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVoteWeight)), 0) | |
31 | 31 | let userPoolVoteWeight = valueOrElse(getInteger(this, (toString(i.caller) + kUserPoolVoteWeight)), 0) | |
32 | 32 | let poolVoteWeightDiff = (poolVoteWeightNew - userPoolVoteWeight) | |
33 | 33 | let userTotalVoteWeightNew = (userPoolVoteWeight + poolVoteWeightDiff) | |
34 | 34 | if ((userTotalVoteWeightNew > userTotalVoteWieghtMax)) | |
35 | 35 | then throw(((("New total vote " + toString(userTotalVoteWeightNew)) + " should be less then ") + toString(userTotalVoteWieghtMax))) | |
36 | - | else [IntegerEntry((toString(i.caller) + kUserPoolVoteWeight), poolVoteWeightNew), IntegerEntry((toString(i.caller) + | |
36 | + | else [IntegerEntry((((toString(i.caller) + kUserPoolVoteWeight) + "_") + poolAddress), poolVoteWeightNew), IntegerEntry((toString(i.caller) + kUserTotalVoteWeight), userTotalVoteWeightNew)] | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 |
github/deemru/w8io/169f3d6 24.73 ms ◑![]()