tx · Di5CWbCqwbXZRkVmouMKnvWxM2aBCpGgnib3564CTmBe 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4: -0.05000000 Waves 2022.06.07 03:32 [2085220] smart account 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4 > SELF 0.00000000 Waves
{ "type": 13, "id": "Di5CWbCqwbXZRkVmouMKnvWxM2aBCpGgnib3564CTmBe", "fee": 5000000, "feeAssetId": null, "timestamp": 1654561950223, "version": 2, "chainId": 84, "sender": "3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4", "senderPublicKey": "5nJ4v4Wx6sdXhiDZNrpW7m1aSDsTgTgFJVBgmPMPtbUM", "proofs": [ "CJz8pJTg51LE15ixhBZKBp5qWDrLBfLVwrfYJ6iuEvDXN9h5Wn5ze8Fj2Vsu5W8VwWZL93UXDahb9dT8G1asKym" ], "script": "base64:AAIFAAAAAAAAACMIAhIFCgMICAESBgoECAgBARIGCgQICAEBEgMKAQgSAwoBCAAAABUAAAAABnN0YWtlcgIAAAAGc3Rha2VyAAAAAAVhZG1pbgIAAAAGYWRtaW5fAAAAAAthc3NldElkQ2FsbAIAAAAIQXNzZXQgSUQAAAAACmVudHJ5SW5kZXgCAAAADF9FbnRyeV9JbmRleAEAAAAEZ2V0SQAAAAEAAAADa2V5CQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAEZ2V0UwAAAAEAAAADa2V5CQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAFZ2V0SVYAAAABAAAAA2tleQkBAAAABXZhbHVlAAAAAQkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkBAAAABWdldFNWAAAAAQAAAANrZXkJAQAAAAV2YWx1ZQAAAAEJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAAd0aHJvd0lmAAAAAgAAAAljb25kaXRpb24AAAAFZXJyb3IDBQAAAAljb25kaXRpb24JAAACAAAAAQUAAAAFZXJyb3IGAAAAABR0aGlydHlEYXlzT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ADcnVuCQAD/AAAAAQJAQAAAAdBZGRyZXNzAAAAAQUAAAANc3Rha2VyQWRkcmVzcwIAAAATX2dldEFzc2V0SWRCeVRpY2tlcgkABEwAAAACBQAAAAtBc3NldFRpY2tlcgUAAAADbmlsBQAAAANuaWwEAAAAByRtYXRjaDAFAAAAA3J1bgMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIFAAAAC2Fzc2V0SWRDYWxsBQAAAAFhBQAAAANuaWwFAAAAA25pbAkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAAAb6ygog==", "height": 2085220, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BdqtMbDCNtdJcdzZWkxnE5Nb9BAACt7T7o5g3u9JZYqf Next: BAUj1veMh3iKeynzKiTdzN7V8Ex7YpuTDm2Gu9A7RhqY Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let c = "Asset ID" | |
9 | 9 | ||
10 | - | func d (e) = getInteger(this, e) | |
10 | + | let d = "_Entry_Index" | |
11 | + | ||
12 | + | func e (f) = getInteger(this, f) | |
11 | 13 | ||
12 | 14 | ||
13 | - | func | |
15 | + | func g (f) = getString(this, f) | |
14 | 16 | ||
15 | 17 | ||
16 | - | func | |
18 | + | func h (f) = value(getInteger(this, f)) | |
17 | 19 | ||
18 | 20 | ||
19 | - | func | |
21 | + | func i (f) = value(getString(this, f)) | |
20 | 22 | ||
21 | 23 | ||
22 | - | func | |
23 | - | then throw( | |
24 | + | func j (k,l) = if (k) | |
25 | + | then throw(l) | |
24 | 26 | else true | |
25 | 27 | ||
26 | 28 | ||
27 | - | let | |
29 | + | let m = 30 | |
28 | 30 | ||
29 | - | let | |
31 | + | let n = 60 | |
30 | 32 | ||
31 | - | let | |
33 | + | let o = 90 | |
32 | 34 | ||
33 | - | func | |
34 | - | let | |
35 | - | if ($isInstanceOf( | |
35 | + | func p (q,l) = { | |
36 | + | let r = q | |
37 | + | if ($isInstanceOf(r, "Int")) | |
36 | 38 | then { | |
37 | - | let | |
38 | - | | |
39 | + | let q = r | |
40 | + | q | |
39 | 41 | } | |
40 | - | else throw( | |
42 | + | else throw(l) | |
41 | 43 | } | |
42 | 44 | ||
43 | 45 | ||
44 | - | func | |
45 | - | let | |
46 | - | if ($isInstanceOf( | |
46 | + | func s (q,l) = { | |
47 | + | let r = q | |
48 | + | if ($isInstanceOf(r, "String")) | |
47 | 49 | then { | |
48 | - | let | |
49 | - | | |
50 | + | let q = r | |
51 | + | q | |
50 | 52 | } | |
51 | - | else throw( | |
53 | + | else throw(l) | |
52 | 54 | } | |
53 | 55 | ||
54 | 56 | ||
55 | - | func | |
56 | - | then throw(((("writing negative value " + toString( | |
57 | - | else IntegerEntry( | |
57 | + | func t (f,u) = if ((0 > u)) | |
58 | + | then throw(((("writing negative value " + toString(u)) + " for key ") + f)) | |
59 | + | else IntegerEntry(f, u) | |
58 | 60 | ||
59 | 61 | ||
60 | - | func | |
61 | - | then throw(("writing an empty string " + | |
62 | - | else StringEntry( | |
62 | + | func v (f,u) = if ((" " == u)) | |
63 | + | then throw(("writing an empty string " + u)) | |
64 | + | else StringEntry(f, u) | |
63 | 65 | ||
64 | 66 | ||
65 | - | func | |
66 | - | then | |
67 | - | else throw(("already initialized: " + | |
67 | + | func w (f,u) = if (!(isDefined(g(f)))) | |
68 | + | then v(f, u) | |
69 | + | else throw(("already initialized: " + f)) | |
68 | 70 | ||
69 | 71 | ||
70 | - | func | |
71 | - | then | |
72 | - | else throw(("already initialized: " + | |
72 | + | func x (f,u) = if (!(isDefined(g(f)))) | |
73 | + | then t(f, u) | |
74 | + | else throw(("already initialized: " + f)) | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
76 | - | let | |
77 | - | let | |
78 | - | let | |
79 | - | if ($isInstanceOf( | |
77 | + | func y (z) = { | |
78 | + | let A = toBase58String(z.caller.bytes) | |
79 | + | let B = (b + A) | |
80 | + | let r = g(b) | |
81 | + | if ($isInstanceOf(r, "String")) | |
80 | 82 | then { | |
81 | - | let | |
82 | - | if (( | |
83 | + | let C = r | |
84 | + | if ((A != g(b))) | |
83 | 85 | then throw("unauthorized") | |
84 | 86 | else true | |
85 | 87 | } | |
86 | 88 | else { | |
87 | - | let | |
88 | - | if ($isInstanceOf( | |
89 | + | let D = g(B) | |
90 | + | if ($isInstanceOf(D, "String")) | |
89 | 91 | then { | |
90 | - | let | |
91 | - | if (( | |
92 | + | let E = D | |
93 | + | if ((A != g(B))) | |
92 | 94 | then throw("unauthorized") | |
93 | 95 | else true | |
94 | 96 | } | |
97 | 99 | } | |
98 | 100 | ||
99 | 101 | ||
100 | - | func | |
101 | - | let | |
102 | - | if ($isInstanceOf( | |
102 | + | func F (f,G) = { | |
103 | + | let r = G | |
104 | + | if ($isInstanceOf(r, "String")) | |
103 | 105 | then { | |
104 | - | let | |
105 | - | | |
106 | + | let G = r | |
107 | + | w(f, G) | |
106 | 108 | } | |
107 | - | else if ($isInstanceOf( | |
109 | + | else if ($isInstanceOf(r, "Int")) | |
108 | 110 | then { | |
109 | - | let | |
110 | - | | |
111 | + | let G = r | |
112 | + | x(f, G) | |
111 | 113 | } | |
112 | 114 | else throw("unsupported config type") | |
113 | 115 | } | |
114 | 116 | ||
115 | 117 | ||
116 | - | @Callable(y) | |
117 | - | func init (G) = [v(a, G), v(b, toBase58String(this.bytes))] | |
118 | + | func H (f) = { | |
119 | + | let I = e(f) | |
120 | + | if (isDefined(I)) | |
121 | + | then (value(I) + 1) | |
122 | + | else 0 | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | @Callable(z) | |
127 | + | func getAPYAmount (J,K,L) = { | |
128 | + | let M = ((((J + "_") + K) + "_APY_") + d) | |
129 | + | let I = H(M) | |
130 | + | let N = (((((((((J + "_") + K) + "_APY_Amount_") + "(") + toString(L)) + K) + ")") + "_") + toString(I)) | |
131 | + | let O = valueOrErrorMessage(e(N), ("APY not computed for " + J)) | |
132 | + | $Tuple2(nil, O) | |
133 | + | } | |
118 | 134 | ||
119 | 135 | ||
120 | 136 | ||
121 | - | @Callable( | |
122 | - | func | |
123 | - | let | |
124 | - | if (( | |
137 | + | @Callable(z) | |
138 | + | func storeAPYAmount (J,K,L,P) = { | |
139 | + | let Q = y(z) | |
140 | + | if ((Q == Q)) | |
125 | 141 | then { | |
126 | - | let G = fromBase58String(h("staker")) | |
127 | - | let J = invoke(Address(G), "_getAssetIdByTicker", [H], nil) | |
128 | - | let q = J | |
129 | - | if ($isInstanceOf(q, "String")) | |
142 | + | let M = ((((J + "_") + K) + "_APY_") + d) | |
143 | + | let I = H(M) | |
144 | + | let R = (((((((((J + "_") + K) + "_APY_Amount_") + "(") + toString(L)) + K) + ")") + "_") + toString(I)) | |
145 | + | [x(R, value(P))] | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(z) | |
153 | + | func deleteAPYAmount (J,K,L,P) = { | |
154 | + | let M = ((((J + "_") + K) + "_APY_") + d) | |
155 | + | let I = H(M) | |
156 | + | let R = (((((((((J + "_") + K) + "_APY_Amount_") + "(") + toString(L)) + K) + ")") + "_") + toString(I)) | |
157 | + | [DeleteEntry(R)] | |
158 | + | } | |
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | @Callable(z) | |
163 | + | func init (S) = [w(a, S), w(b, toBase58String(this.bytes))] | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(z) | |
168 | + | func getAssetIdByTicker (K) = { | |
169 | + | let T = y(z) | |
170 | + | if ((T == T)) | |
171 | + | then { | |
172 | + | let S = fromBase58String(i("staker")) | |
173 | + | let U = invoke(Address(S), "_getAssetIdByTicker", [K], nil) | |
174 | + | let r = U | |
175 | + | if ($isInstanceOf(r, "String")) | |
130 | 176 | then { | |
131 | - | let | |
132 | - | [StringEntry(c, | |
177 | + | let C = r | |
178 | + | [StringEntry(c, C)] | |
133 | 179 | } | |
134 | 180 | else nil | |
135 | 181 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "staker" | |
5 | 5 | ||
6 | 6 | let b = "admin_" | |
7 | 7 | ||
8 | 8 | let c = "Asset ID" | |
9 | 9 | ||
10 | - | func d (e) = getInteger(this, e) | |
10 | + | let d = "_Entry_Index" | |
11 | + | ||
12 | + | func e (f) = getInteger(this, f) | |
11 | 13 | ||
12 | 14 | ||
13 | - | func | |
15 | + | func g (f) = getString(this, f) | |
14 | 16 | ||
15 | 17 | ||
16 | - | func | |
18 | + | func h (f) = value(getInteger(this, f)) | |
17 | 19 | ||
18 | 20 | ||
19 | - | func | |
21 | + | func i (f) = value(getString(this, f)) | |
20 | 22 | ||
21 | 23 | ||
22 | - | func | |
23 | - | then throw( | |
24 | + | func j (k,l) = if (k) | |
25 | + | then throw(l) | |
24 | 26 | else true | |
25 | 27 | ||
26 | 28 | ||
27 | - | let | |
29 | + | let m = 30 | |
28 | 30 | ||
29 | - | let | |
31 | + | let n = 60 | |
30 | 32 | ||
31 | - | let | |
33 | + | let o = 90 | |
32 | 34 | ||
33 | - | func | |
34 | - | let | |
35 | - | if ($isInstanceOf( | |
35 | + | func p (q,l) = { | |
36 | + | let r = q | |
37 | + | if ($isInstanceOf(r, "Int")) | |
36 | 38 | then { | |
37 | - | let | |
38 | - | | |
39 | + | let q = r | |
40 | + | q | |
39 | 41 | } | |
40 | - | else throw( | |
42 | + | else throw(l) | |
41 | 43 | } | |
42 | 44 | ||
43 | 45 | ||
44 | - | func | |
45 | - | let | |
46 | - | if ($isInstanceOf( | |
46 | + | func s (q,l) = { | |
47 | + | let r = q | |
48 | + | if ($isInstanceOf(r, "String")) | |
47 | 49 | then { | |
48 | - | let | |
49 | - | | |
50 | + | let q = r | |
51 | + | q | |
50 | 52 | } | |
51 | - | else throw( | |
53 | + | else throw(l) | |
52 | 54 | } | |
53 | 55 | ||
54 | 56 | ||
55 | - | func | |
56 | - | then throw(((("writing negative value " + toString( | |
57 | - | else IntegerEntry( | |
57 | + | func t (f,u) = if ((0 > u)) | |
58 | + | then throw(((("writing negative value " + toString(u)) + " for key ") + f)) | |
59 | + | else IntegerEntry(f, u) | |
58 | 60 | ||
59 | 61 | ||
60 | - | func | |
61 | - | then throw(("writing an empty string " + | |
62 | - | else StringEntry( | |
62 | + | func v (f,u) = if ((" " == u)) | |
63 | + | then throw(("writing an empty string " + u)) | |
64 | + | else StringEntry(f, u) | |
63 | 65 | ||
64 | 66 | ||
65 | - | func | |
66 | - | then | |
67 | - | else throw(("already initialized: " + | |
67 | + | func w (f,u) = if (!(isDefined(g(f)))) | |
68 | + | then v(f, u) | |
69 | + | else throw(("already initialized: " + f)) | |
68 | 70 | ||
69 | 71 | ||
70 | - | func | |
71 | - | then | |
72 | - | else throw(("already initialized: " + | |
72 | + | func x (f,u) = if (!(isDefined(g(f)))) | |
73 | + | then t(f, u) | |
74 | + | else throw(("already initialized: " + f)) | |
73 | 75 | ||
74 | 76 | ||
75 | - | func | |
76 | - | let | |
77 | - | let | |
78 | - | let | |
79 | - | if ($isInstanceOf( | |
77 | + | func y (z) = { | |
78 | + | let A = toBase58String(z.caller.bytes) | |
79 | + | let B = (b + A) | |
80 | + | let r = g(b) | |
81 | + | if ($isInstanceOf(r, "String")) | |
80 | 82 | then { | |
81 | - | let | |
82 | - | if (( | |
83 | + | let C = r | |
84 | + | if ((A != g(b))) | |
83 | 85 | then throw("unauthorized") | |
84 | 86 | else true | |
85 | 87 | } | |
86 | 88 | else { | |
87 | - | let | |
88 | - | if ($isInstanceOf( | |
89 | + | let D = g(B) | |
90 | + | if ($isInstanceOf(D, "String")) | |
89 | 91 | then { | |
90 | - | let | |
91 | - | if (( | |
92 | + | let E = D | |
93 | + | if ((A != g(B))) | |
92 | 94 | then throw("unauthorized") | |
93 | 95 | else true | |
94 | 96 | } | |
95 | 97 | else throw("unauthorizd") | |
96 | 98 | } | |
97 | 99 | } | |
98 | 100 | ||
99 | 101 | ||
100 | - | func | |
101 | - | let | |
102 | - | if ($isInstanceOf( | |
102 | + | func F (f,G) = { | |
103 | + | let r = G | |
104 | + | if ($isInstanceOf(r, "String")) | |
103 | 105 | then { | |
104 | - | let | |
105 | - | | |
106 | + | let G = r | |
107 | + | w(f, G) | |
106 | 108 | } | |
107 | - | else if ($isInstanceOf( | |
109 | + | else if ($isInstanceOf(r, "Int")) | |
108 | 110 | then { | |
109 | - | let | |
110 | - | | |
111 | + | let G = r | |
112 | + | x(f, G) | |
111 | 113 | } | |
112 | 114 | else throw("unsupported config type") | |
113 | 115 | } | |
114 | 116 | ||
115 | 117 | ||
116 | - | @Callable(y) | |
117 | - | func init (G) = [v(a, G), v(b, toBase58String(this.bytes))] | |
118 | + | func H (f) = { | |
119 | + | let I = e(f) | |
120 | + | if (isDefined(I)) | |
121 | + | then (value(I) + 1) | |
122 | + | else 0 | |
123 | + | } | |
124 | + | ||
125 | + | ||
126 | + | @Callable(z) | |
127 | + | func getAPYAmount (J,K,L) = { | |
128 | + | let M = ((((J + "_") + K) + "_APY_") + d) | |
129 | + | let I = H(M) | |
130 | + | let N = (((((((((J + "_") + K) + "_APY_Amount_") + "(") + toString(L)) + K) + ")") + "_") + toString(I)) | |
131 | + | let O = valueOrErrorMessage(e(N), ("APY not computed for " + J)) | |
132 | + | $Tuple2(nil, O) | |
133 | + | } | |
118 | 134 | ||
119 | 135 | ||
120 | 136 | ||
121 | - | @Callable( | |
122 | - | func | |
123 | - | let | |
124 | - | if (( | |
137 | + | @Callable(z) | |
138 | + | func storeAPYAmount (J,K,L,P) = { | |
139 | + | let Q = y(z) | |
140 | + | if ((Q == Q)) | |
125 | 141 | then { | |
126 | - | let G = fromBase58String(h("staker")) | |
127 | - | let J = invoke(Address(G), "_getAssetIdByTicker", [H], nil) | |
128 | - | let q = J | |
129 | - | if ($isInstanceOf(q, "String")) | |
142 | + | let M = ((((J + "_") + K) + "_APY_") + d) | |
143 | + | let I = H(M) | |
144 | + | let R = (((((((((J + "_") + K) + "_APY_Amount_") + "(") + toString(L)) + K) + ")") + "_") + toString(I)) | |
145 | + | [x(R, value(P))] | |
146 | + | } | |
147 | + | else throw("Strict value is not equal to itself.") | |
148 | + | } | |
149 | + | ||
150 | + | ||
151 | + | ||
152 | + | @Callable(z) | |
153 | + | func deleteAPYAmount (J,K,L,P) = { | |
154 | + | let M = ((((J + "_") + K) + "_APY_") + d) | |
155 | + | let I = H(M) | |
156 | + | let R = (((((((((J + "_") + K) + "_APY_Amount_") + "(") + toString(L)) + K) + ")") + "_") + toString(I)) | |
157 | + | [DeleteEntry(R)] | |
158 | + | } | |
159 | + | ||
160 | + | ||
161 | + | ||
162 | + | @Callable(z) | |
163 | + | func init (S) = [w(a, S), w(b, toBase58String(this.bytes))] | |
164 | + | ||
165 | + | ||
166 | + | ||
167 | + | @Callable(z) | |
168 | + | func getAssetIdByTicker (K) = { | |
169 | + | let T = y(z) | |
170 | + | if ((T == T)) | |
171 | + | then { | |
172 | + | let S = fromBase58String(i("staker")) | |
173 | + | let U = invoke(Address(S), "_getAssetIdByTicker", [K], nil) | |
174 | + | let r = U | |
175 | + | if ($isInstanceOf(r, "String")) | |
130 | 176 | then { | |
131 | - | let | |
132 | - | [StringEntry(c, | |
177 | + | let C = r | |
178 | + | [StringEntry(c, C)] | |
133 | 179 | } | |
134 | 180 | else nil | |
135 | 181 | } | |
136 | 182 | else throw("Strict value is not equal to itself.") | |
137 | 183 | } | |
138 | 184 | ||
139 | 185 |
github/deemru/w8io/026f985 59.75 ms ◑