tx · 5QSWyRyEcsk7YJuDqhP7isHa1DCcUYV5askUkMLVfsH5 3N2wcNfEWihUVJV2S6jKwcw3QDupKgXPBnp: -0.01400000 Waves 2021.03.13 12:29 [1435736] smart account 3N2wcNfEWihUVJV2S6jKwcw3QDupKgXPBnp > SELF 0.00000000 Waves
{ "type": 13, "id": "5QSWyRyEcsk7YJuDqhP7isHa1DCcUYV5askUkMLVfsH5", "fee": 1400000, "feeAssetId": null, "timestamp": 1615627775041, "version": 1, "sender": "3N2wcNfEWihUVJV2S6jKwcw3QDupKgXPBnp", "senderPublicKey": "2Ek8QRiW2SC3s4ZC79pXUmvJbmqU6agaNsjN2wmnzmSs", "proofs": [ "5eMNsxz5ufYNSDQbp33ZeDjUrC6ceyi5VGYKfzHCnZgmk5C536AUHYrva4xLGviwEB1txZd2Di6zQDgcY6HvrmH6" ], "script": "base64:AAIEAAAAAAAAAAgIAhIECgIIAQAAAAcAAAAAEWtVc2VyUG9vbFZvdGVTV09QAgAAAAVfdm90ZQAAAAASa1VzZXJUb3RhbFZvdGVTV09QAgAAABVfdXNlcl90b3RhbF9TV09QX3ZvdGUAAAAADWtQb29sVm90ZVNXT1ACAAAACl92b3RlX1NXT1AAAAAADmtUb3RhbFZvdGVTV09QAgAAAA90b3RhbF92b3RlX1NXT1AAAAAAB2dvdkFkZHIJAQAAAAdBZGRyZXNzAAAAAQEAAAAaAVQTpUX1edzu1C+kk914p42uKvNrLVgR210BAAAAFGlzQ2FsbGVySW5Hb3Zlcm5hbmNlAAAAAQAAAAR1c2VyAwMJAABmAAAAAgkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAdnb3ZBZGRyCQABLAAAAAIJAAQlAAAAAQUAAAAEdXNlcgIAAAAMX1NXT1BfYW1vdW50AAAAAAAAAAAAAAAAAAAAAAAABgkAAGYAAAACCQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMJAAEsAAAAAgkABCUAAAABBQAAAAR1c2V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ABpAAAAAEFAAAAFHVzZXJUb3RhbFZvdGVTV09QTmV3CQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQAEJQAAAAEIBQAAAAFpAAAABmNhbGxlcgUAAAARa1VzZXJQb29sVm90ZVNXT1ACAAAAAV8FAAAAC3Bvb2xBZGRyZXNzBQAAAA9wb29sVm90ZVNXT1BOZXcJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkABCUAAAABCAUAAAABaQAAAAZjYWxsZXIFAAAAEmtVc2VyVG90YWxWb3RlU1dPUAUAAAAUdXNlclRvdGFsVm90ZVNXT1BOZXcJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgUAAAALcG9vbEFkZHJlc3MFAAAADWtQb29sVm90ZVNXT1AFAAAAD3Bvb2xWb3RlU1dPUG5ldwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgUAAAAOa1RvdGFsVm90ZVNXT1AFAAAAEHRvdGFsVm90ZVNXT1BuZXcFAAAAA25pbAAAAAB+M4iz", "chainId": 84, "height": 1435736, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2FkE548WTBBAkDWGGa5d9Rfgs81tYX3GmRvsRQmyRLZG Next: G5fneV7LBZ1Mpo3NptMCfUNmC6FZJahv8bQPQTmqsg1F Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let kUserPoolVoteSWOP = "_vote" | |
5 | 5 | ||
6 | 6 | let kUserTotalVoteSWOP = "_user_total_SWOP_vote" | |
7 | 7 | ||
8 | 8 | let kPoolVoteSWOP = "_vote_SWOP" | |
9 | 9 | ||
10 | 10 | let kTotalVoteSWOP = "total_vote_SWOP" | |
11 | 11 | ||
12 | 12 | let govAddr = Address(base58'3MqhxbxHEMtp2Rwy1gUb6cPSJHQepdap1Yp') | |
13 | 13 | ||
14 | 14 | func isCallerInGovernance (user) = if (if ((valueOrElse(getInteger(govAddr, (toString(user) + "_SWOP_amount")), 0) > 0)) | |
15 | 15 | then true | |
16 | 16 | else (valueOrElse(getInteger(this, (toString(user) + kUserTotalVoteSWOP)), 0) > 0)) | |
17 | 17 | then true | |
18 | 18 | else false | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func isPoolInGovernance (poolAddress) = if ((valueOrElse(getInteger(govAddr, (poolAddress + "_startHeight")), 0) > 0)) | |
22 | 22 | then true | |
23 | 23 | else false | |
24 | 24 | ||
25 | 25 | ||
26 | 26 | @Callable(i) | |
27 | 27 | func votePoolWeight (poolAddress,poolVoteSWOPNew) = if (!(isCallerInGovernance(i.caller))) | |
28 | 28 | then throw("This address has 0 SWOP in Governance dApp") | |
29 | 29 | else if (!(isPoolInGovernance(poolAddress))) | |
30 | 30 | then throw("This pool has no _startHeight in Governance dApp") | |
31 | 31 | else { | |
32 | 32 | let userTotalVoteWeight = valueOrElse(getInteger(this, (toString(i.caller) + kUserTotalVoteSWOP)), 0) | |
33 | 33 | let userPoolVoteWeight = valueOrElse(getInteger(this, (((toString(i.caller) + kUserPoolVoteSWOP) + "_") + poolAddress)), 0) | |
34 | 34 | let poolVoteSWOP = valueOrElse(getInteger(this, (poolAddress + kPoolVoteSWOP)), 0) | |
35 | 35 | let totalVoteSWOP = valueOrElse(getInteger(this, kTotalVoteSWOP), 0) | |
36 | 36 | let userSWOPinGovernance = getIntegerValue(govAddr, (toString(i.caller) + "_SWOP_amount")) | |
37 | 37 | let poolVoteWeightDiff = (poolVoteSWOPNew - userPoolVoteWeight) | |
38 | 38 | let userTotalVoteSWOPNew = (userTotalVoteWeight + poolVoteWeightDiff) | |
39 | 39 | let poolVoteSWOPnew = (poolVoteSWOP + poolVoteWeightDiff) | |
40 | 40 | let totalVoteSWOPnew = (poolVoteSWOP + poolVoteWeightDiff) | |
41 | 41 | if ((userSWOPinGovernance > userTotalVoteSWOPNew)) | |
42 | 42 | then throw(((((toString(this) + " has ") + toString(userSWOPinGovernance)) + "SWOP in governance. New SWOP in voting ") + toString(userTotalVoteSWOPNew))) | |
43 | 43 | else [IntegerEntry((((toString(i.caller) + kUserPoolVoteSWOP) + "_") + poolAddress), poolVoteSWOPNew), IntegerEntry((toString(i.caller) + kUserTotalVoteSWOP), userTotalVoteSWOPNew), IntegerEntry((poolAddress + kPoolVoteSWOP), poolVoteSWOPnew), IntegerEntry(kTotalVoteSWOP, totalVoteSWOPnew)] | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 |
github/deemru/w8io/169f3d6 25.55 ms ◑