tx · PYNG8TMuBwimUwnB5ZYa9rph4C7Q8CoRj6sFmub1CKv 3Msj81YL4DxQdbQACtfXhMbpWmze1VVnctu: -0.01000000 Waves 2022.10.17 08:56 [2275981] smart account 3Msj81YL4DxQdbQACtfXhMbpWmze1VVnctu > SELF 0.00000000 Waves
{ "type": 13, "id": "PYNG8TMuBwimUwnB5ZYa9rph4C7Q8CoRj6sFmub1CKv", "fee": 1000000, "feeAssetId": null, "timestamp": 1665986296621, "version": 2, "chainId": 84, "sender": "3Msj81YL4DxQdbQACtfXhMbpWmze1VVnctu", "senderPublicKey": "28hGQdonCy33HT27DAdzF7rwYRv24Nizp2yBBtwjRUia", "proofs": [ "52VXTX1hDF34WpdPNXz49rdGWrhNyR4rP758bgwSN1WxHxHUstCg4PBq66ASY6t7SSkaqRhe4HfejJj6JitaVxyE" ], "script": "base64:AAIFAAAAAAAAAA8IAhIGCgQIAQEBEgMKAQgAAAANAQAAAAxoZWlnaHRFbmRLRVkAAAAAAgAAAApoZWlnaHRfZW5kAQAAAA5oZWlnaHRTdGFydEtFWQAAAAACAAAADGhlaWdodF9zdGFydAEAAAASYXZhaWxhYmxlQXNzZXRzS0VZAAAAAAIAAAAQYXZhaWxhYmxlX2Fzc2V0cwAAAAAJaGVpZ2h0RW5kCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQaAAAAAgUAAAAEdGhpcwkBAAAADGhlaWdodEVuZEtFWQAAAAACAAAAJGhlaWdodF9lbmQgaXMgbm90IHNwZWNpZmllZCBpbiBzdGF0ZQAAAAAMYXNzZXRzU3RyaW5nCQEAAAATdmFsdWVPckVycm9yTWVzc2FnZQAAAAIJAAQdAAAAAgUAAAAEdGhpcwkBAAAAEmF2YWlsYWJsZUFzc2V0c0tFWQAAAAACAAAAJUFzc2V0cyBsaXN0IGlzIG5vdCBzcGVjaWZpZWQgaW4gc3RhdGUBAAAACWFzQW55TGlzdAAAAAEAAAADdmFsBAAAAAckbWF0Y2gwBQAAAAN2YW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ZWRPcHRpb25zBQAAAANuaWwAAAAAtY7GoA==", "height": 2275981, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | func a () = "height_end" | |
5 | + | ||
6 | + | ||
7 | + | func b () = "height_start" | |
8 | + | ||
9 | + | ||
10 | + | func c () = "available_assets" | |
11 | + | ||
12 | + | ||
13 | + | let d = valueOrErrorMessage(getInteger(this, a()), "height_end is not specified in state") | |
14 | + | ||
15 | + | let e = valueOrErrorMessage(getString(this, c()), "Assets list is not specified in state") | |
16 | + | ||
17 | + | func f (g) = { | |
18 | + | let h = g | |
19 | + | if ($isInstanceOf(h, "List[Any]")) | |
20 | + | then { | |
21 | + | let i = h | |
22 | + | i | |
23 | + | } | |
24 | + | else throw("fail to cast into List[Any]") | |
25 | + | } | |
26 | + | ||
27 | + | ||
28 | + | func j (g) = { | |
29 | + | let h = g | |
30 | + | if ($isInstanceOf(h, "Int")) | |
31 | + | then { | |
32 | + | let k = h | |
33 | + | k | |
34 | + | } | |
35 | + | else throw("fail to cast into Int") | |
36 | + | } | |
37 | + | ||
38 | + | ||
39 | + | let l = Address(base58'3MuGfNhF98CNBCfthhoJEo6SYUv7zTgkK4J') | |
40 | + | ||
41 | + | let m = Address(base58'3N5yarEiTQccnnuerogYT3BxM5Zc5bRgDZy') | |
42 | + | ||
43 | + | let n = split(e, ",") | |
44 | + | ||
45 | + | func o (p) = makeString(["balance", toString(p)], "_") | |
46 | + | ||
47 | + | ||
48 | + | func q (p) = makeString(["votingPower", p], "_") | |
49 | + | ||
50 | + | ||
51 | + | func r (p) = makeString(["last_vote", p], "_") | |
52 | + | ||
53 | + | ||
54 | + | @Callable(s) | |
55 | + | func constructor (t,u,d,v) = { | |
56 | + | let w = f(invoke(m, "surfStakingSYSREADONLY", ["", 0], nil)) | |
57 | + | let x = j(w[3]) | |
58 | + | let y = f(invoke(l, "nsbtStakingSYSREADONLY", ["", 0], nil)) | |
59 | + | let z = j(y[1]) | |
60 | + | if ((s.caller != this)) | |
61 | + | then throw("permissions denied") | |
62 | + | else [IntegerEntry(b(), u), IntegerEntry(a(), d), StringEntry(c(), t), IntegerEntry("gnsbt_fromNsbt_total", z), IntegerEntry("gnsbt_fromSurf_total", x), IntegerEntry("quorum", fraction((z + x), v, 100))] | |
63 | + | } | |
64 | + | ||
65 | + | ||
66 | + | ||
67 | + | @Callable(s) | |
68 | + | func castVote (A) = { | |
69 | + | let B = toString(s.caller) | |
70 | + | if ((containsElement(n, A) == false)) | |
71 | + | then throw("Incorrect vote!") | |
72 | + | else if ((height >= d)) | |
73 | + | then throw("vote finished") | |
74 | + | else { | |
75 | + | let w = f(invoke(m, "surfStakingSYSREADONLY", [B, 0], nil)) | |
76 | + | let C = j(w[4]) | |
77 | + | let D = if ((C > d)) | |
78 | + | then 0 | |
79 | + | else j(w[2]) | |
80 | + | let y = f(invoke(l, "nsbtStakingSYSREADONLY", [B, 0], nil)) | |
81 | + | let E = (j(y[0]) + D) | |
82 | + | if ((0 >= E)) | |
83 | + | then throw("not enough gnsbt to vote") | |
84 | + | else { | |
85 | + | let F = split(A, ":") | |
86 | + | let G = r(B) | |
87 | + | let H = valueOrElse(getString(this, G), A) | |
88 | + | let I = split(H, ":") | |
89 | + | let J = q(B) | |
90 | + | let K = valueOrElse(getInteger(this, J), 0) | |
91 | + | func L (M,N) = { | |
92 | + | let O = F[N] | |
93 | + | let P = I[N] | |
94 | + | let Q = makeString(["vote", O], "_") | |
95 | + | let R = valueOrElse(getInteger(this, Q), 0) | |
96 | + | let S = makeString(["vote", P], "_") | |
97 | + | let T = valueOrElse(getInteger(this, S), 0) | |
98 | + | let U = if ((O != P)) | |
99 | + | then [IntegerEntry(S, (T - K)), IntegerEntry(Q, (R + E))] | |
100 | + | else [IntegerEntry(Q, ((R + E) - K))] | |
101 | + | (M ++ U) | |
102 | + | } | |
103 | + | ||
104 | + | let V = [0] | |
105 | + | ({ | |
106 | + | let W = V | |
107 | + | let X = size(W) | |
108 | + | let Y = nil | |
109 | + | func Z (aa,ab) = if ((ab >= X)) | |
110 | + | then aa | |
111 | + | else L(aa, W[ab]) | |
112 | + | ||
113 | + | func ac (aa,ab) = if ((ab >= X)) | |
114 | + | then aa | |
115 | + | else throw("List size exceeds 2") | |
116 | + | ||
117 | + | ac(Z(Z(Y, 0), 1), 2) | |
118 | + | } ++ [IntegerEntry(J, E), StringEntry(G, A)]) | |
119 | + | } | |
120 | + | } | |
121 | + | } | |
122 | + | ||
123 | + |
github/deemru/w8io/169f3d6 22.39 ms ◑