tx · 9zgDygJkRZihaqm2SSDUcaNdxi3fqos1XkRT6BvPneqo 3MsmgWBZKrHwbVbSQiqmStRiFyg5hkfxxa2: -0.00200000 Waves 2022.08.16 12:22 [2186830] smart account 3MsmgWBZKrHwbVbSQiqmStRiFyg5hkfxxa2 > SELF 0.00000000 Waves
{ "type": 13, "id": "9zgDygJkRZihaqm2SSDUcaNdxi3fqos1XkRT6BvPneqo", "fee": 200000, "feeAssetId": null, "timestamp": 1660641751984, "version": 2, "chainId": 84, "sender": "3MsmgWBZKrHwbVbSQiqmStRiFyg5hkfxxa2", "senderPublicKey": "9TejtrnvgE7MvzMR4DcLbf3dqUzovyt4BKEmCsqha2z", "proofs": [ "2rQB9p9VELmuAV6JYNUKPi9aB3j7f2EwtPvrhjXxH44X8NzCvHJs82AFWBmWpEtCKuHW38AGm5NmtPDJnKpixsTE" ], "script": "base64:AAIFAAAAAAAAAAcIAhIDCgEIAAAABwAAAAAJaGVpZ2h0RW5kCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwIAAAAKaGVpZ2h0X2VuZAIAAAAkaGVpZ2h0X2VuZCBpcyBub3Qgc3BlY2lmaWVkIGluIHN0YXRlAAAAAAxhc3NldHNTdHJpbmcJAQAAABN2YWx1ZU9yRXJyb3JNZXNzYWdlAAAAAgkABB0AAAACBQAAAAR0aGlzAgAAABBhdmFpbGFibGVfYXNzZXRzAgAAACVBc3NldHMgbGlzdCBpcyBub3Qgc3BlY2lmaWVkIGluIHN0YXRlAQAAABJhc1N3YXBQYXJhbXNTVFJVQ1QAAAABAAAAA3ZhbAQAAAAHJG1hdGNoMAUAAAADdmFsAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAABkoSW50LCBJbnQsIEludCwgSW50LCBJbnQpBAAAAAZzdHJ1Y3QFAAAAByRtYXRjaDAFAAAABnN0cnVjdAkAAAIAAAABAgAAABVmYWlsIHRvIGNhc3QgaW50byBJbnQAAAAAEG5ldX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AAskdDAxMTAwMTI5NAAAAAJfMQQAAAAKbGltaXRTcGVudAgFAAAACyR0MDExMDAxMjk0AAAAAl8yBAAAAA5ibGNrczJMbXRSZXNldAgFAAAACyR0MDExMDAxMjk0AAAAAl8zBAAAAAhnbnNidEFtdAgFAAAACyR0MDExMDAxMjk0AAAAAl80BAAAAA1nbnNidEFtdFRvdGFsCAUAAAALJHQwMTEwMDEyOTQAAAACXzUEAAAAEHVzZXJWb3RpbmdBbW91bnQFAAAACGduc2J0QW10BAAAAA92b3RlVG90YWxBbW91bnQJAQAAAAt2YWx1ZU9yRWxzZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwUAAAAMdG90YWxWb3RlS2V5AAAAAAAAAAAABAAAABB2b3RlQnlVc2VyQW1vdW50CQEAAAALdmFsdWVPckVsc2UAAAACCQAEGgAAAAIFAAAABHRoaXMFAAAAC3VzZXJWb3RlS2V5AAAAAAAAAAAAAwkAAGcAAAACBQAAAAZoZWlnaHQFAAAACWhlaWdodEVuZAkAAAIAAAABAgAAAA12b3RlIGZpbmlzaGVkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAAx0b3RhbFZvdGVLZXkJAABlAAAAAgkAAGQAAAACBQAAAA92b3RlVG90YWxBbW91bnQFAAAAEHVzZXJWb3RpbmdBbW91bnQFAAAAEHZvdGVCeVVzZXJBbW91bnQJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIFAAAAC3VzZXJWb3RlS2V5BQAAABB1c2VyVm90aW5nQW1vdW50BQAAAANuaWwAAAAAAa649w==", "height": 2186830, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: HigpkR1HvdQcKtmdkwyXqJkKiP8bwuzoXQo8VSarQkwN Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let heightEnd = valueOrErrorMessage(getInteger(this, "height_end"), "height_end is not specified in state") | |
5 | + | ||
6 | + | let assetsString = valueOrErrorMessage(getString(this, "available_assets"), "Assets list is not specified in state") | |
7 | + | ||
8 | + | func asSwapParamsSTRUCT (val) = match val { | |
9 | + | case struct: (Int, Int, Int, Int, Int) => | |
10 | + | struct | |
11 | + | case _ => | |
12 | + | throw("fail to cast into Int") | |
13 | + | } | |
14 | + | ||
15 | + | ||
16 | + | let neutrinoContract = Address(base58'3N9be2mwrA52WJho6DiesZkk4351GvpnWuj') | |
17 | + | ||
18 | + | let assets = split(assetsString, ",") | |
19 | + | ||
20 | + | func keyUserBalance (userAddr) = makeString(["balance", toString(userAddr)], "_") | |
21 | + | ||
22 | + | ||
23 | + | func keyUserVoteKey (userAddr,vote) = makeString(["vote", userAddr, vote], "_") | |
24 | + | ||
25 | + | ||
26 | + | @Callable(contextObj) | |
27 | + | func castVote (vote) = if ((containsElement(assets, vote) == false)) | |
28 | + | then throw("Incorrect vote!") | |
29 | + | else { | |
30 | + | let totalVoteKey = makeString(["vote", vote], "_") | |
31 | + | let userVoteKey = keyUserVoteKey(toString(contextObj.caller), vote) | |
32 | + | let $t011001294 = asSwapParamsSTRUCT(invoke(neutrinoContract, "swapParamsByUserSYSREADONLY", [toString(contextObj.caller), 0], nil)) | |
33 | + | let limitMaxUsdn = $t011001294._1 | |
34 | + | let limitSpent = $t011001294._2 | |
35 | + | let blcks2LmtReset = $t011001294._3 | |
36 | + | let gnsbtAmt = $t011001294._4 | |
37 | + | let gnsbtAmtTotal = $t011001294._5 | |
38 | + | let userVotingAmount = gnsbtAmt | |
39 | + | let voteTotalAmount = valueOrElse(getInteger(this, totalVoteKey), 0) | |
40 | + | let voteByUserAmount = valueOrElse(getInteger(this, userVoteKey), 0) | |
41 | + | if ((height >= heightEnd)) | |
42 | + | then throw("vote finished") | |
43 | + | else [IntegerEntry(totalVoteKey, ((voteTotalAmount + userVotingAmount) - voteByUserAmount)), IntegerEntry(userVoteKey, userVotingAmount)] | |
44 | + | } | |
45 | + | ||
46 | + |
github/deemru/w8io/026f985 15.48 ms ◑