tx · GFUqudSot1opYVJPHuc8KKPDnuSv5VJGyU7o6KiSL57x 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4: -0.01500000 Waves 2022.06.08 18:29 [2087573] smart account 3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4 > SELF 0.00000000 Waves
{ "type": 13, "id": "GFUqudSot1opYVJPHuc8KKPDnuSv5VJGyU7o6KiSL57x", "fee": 1500000, "feeAssetId": null, "timestamp": 1654702178200, "version": 2, "chainId": 84, "sender": "3N4UhavKsWv4dPmmhtaYT573ALxuvsAp6M4", "senderPublicKey": "5nJ4v4Wx6sdXhiDZNrpW7m1aSDsTgTgFJVBgmPMPtbUM", "proofs": [ "29yztVrLJQwzoLfEXVrBaJSaCAWgkghU9piPWKqEMfumDh2crJDgV1whm1Q2EToMM6Pk8PZf1VidGsC1g9L38njQ" ], "script": "base64:AAIFAAAAAAAAACkIAhIFCgMICAESBgoECAgBARIFCgMICAESAwoBCBIDCgEIEgUKAwgIAQAAABgAAAAABnN0YWtlcgIAAAAGc3Rha2VyAAAAAAVhZG1pbgIAAAAGYWRtaW5fAAAAAAthc3NldElkQ2FsbAIAAAAIQXNzZXQgSUQAAAAACGRheXNMZWZ0AgAAABJkYXlzX2xlZnRfdG9fY2xhaW0AAAAACmVudHJ5SW5kZXgCAAAADF9FbnRyeV9JbmRleAAAAAAKQVBZX0Ftb3VudAIAAAALX0FQWV9BbW91bnQBAAAABGdldEkAAAABAAAAA2tleQkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkBAAAABGdldFMAAAABAAAAA2tleQkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkBAAAABWdldElWAAAAAQAAAANrZXkJAQAAAAV2YWx1ZQAAAAEJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AQAAAAVnZXRTVgAAAAEAAAADa2V5CQEAAAAFdmFsdWUAAAABCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQEAAAAHdGhyb3dJZgAAAAIAAAAJY29uZ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087573, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BZnkjqNfCkMTZ1wRr3uT1WkfwLbCDrmm58SuhEno6MHe Next: 2xkBoxtYpMLebowMN4iaGcax9EpkcKuNYx2qmi5zLenD Diff:
Old | New | Differences | |
---|---|---|---|
188 | 188 | ||
189 | 189 | ||
190 | 190 | @Callable(i) | |
191 | - | func getDaysLeftToClaim (userAddress) = { | |
191 | + | func getDaysLeftToClaim (userAddress,AssetTicker,EntryIndex) = { | |
192 | 192 | let checks = adminOnly(i) | |
193 | 193 | if ((checks == checks)) | |
194 | 194 | then { | |
195 | 195 | let stakerAddress = fromBase58String(getSV("staker")) | |
196 | - | let run = invoke(Address(stakerAddress), "_getDaysLeftToClaim", [userAddress], nil) | |
196 | + | let run = invoke(Address(stakerAddress), "_getDaysLeftToClaim", [userAddress, AssetTicker, EntryIndex], nil) | |
197 | 197 | match run { | |
198 | 198 | case a: String => | |
199 | 199 | [StringEntry(daysLeft, a)] |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let staker = "staker" | |
5 | 5 | ||
6 | 6 | let admin = "admin_" | |
7 | 7 | ||
8 | 8 | let assetIdCall = "Asset ID" | |
9 | 9 | ||
10 | 10 | let daysLeft = "days_left_to_claim" | |
11 | 11 | ||
12 | 12 | let entryIndex = "_Entry_Index" | |
13 | 13 | ||
14 | 14 | let APY_Amount = "_APY_Amount" | |
15 | 15 | ||
16 | 16 | func getI (key) = getInteger(this, key) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func getS (key) = getString(this, key) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func getIV (key) = value(getInteger(this, key)) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func getSV (key) = value(getString(this, key)) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func throwIf (condition,error) = if (condition) | |
29 | 29 | then throw(error) | |
30 | 30 | else true | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | let thirtyDaysLockPeriod = 30 | |
34 | 34 | ||
35 | 35 | let sixtyDaysLockPeriod = 60 | |
36 | 36 | ||
37 | 37 | let ninetyDaysLockPeriod = 90 | |
38 | 38 | ||
39 | 39 | func throwOrReturnI (val,error) = match val { | |
40 | 40 | case val: Int => | |
41 | 41 | val | |
42 | 42 | case _ => | |
43 | 43 | throw(error) | |
44 | 44 | } | |
45 | 45 | ||
46 | 46 | ||
47 | 47 | func throwOrReturnS (val,error) = match val { | |
48 | 48 | case val: String => | |
49 | 49 | val | |
50 | 50 | case _ => | |
51 | 51 | throw(error) | |
52 | 52 | } | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func writeInt (key,value) = if ((0 > value)) | |
56 | 56 | then throw(((("writing negative value " + toString(value)) + " for key ") + key)) | |
57 | 57 | else IntegerEntry(key, value) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func writeStr (key,value) = if ((" " == value)) | |
61 | 61 | then throw(("writing an empty string " + value)) | |
62 | 62 | else StringEntry(key, value) | |
63 | 63 | ||
64 | 64 | ||
65 | 65 | func writeConstString (key,value) = if (!(isDefined(getS(key)))) | |
66 | 66 | then writeStr(key, value) | |
67 | 67 | else throw(("already initialized: " + key)) | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func writeConstInteger (key,value) = if (!(isDefined(getS(key)))) | |
71 | 71 | then writeInt(key, value) | |
72 | 72 | else throw(("already initialized: " + key)) | |
73 | 73 | ||
74 | 74 | ||
75 | 75 | func adminOnly (i) = { | |
76 | 76 | let inputAddress = toBase58String(i.caller.bytes) | |
77 | 77 | let otherAdmin = (admin + inputAddress) | |
78 | 78 | match getS(admin) { | |
79 | 79 | case a: String => | |
80 | 80 | if ((inputAddress != getS(admin))) | |
81 | 81 | then throw("unauthorized") | |
82 | 82 | else true | |
83 | 83 | case _ => | |
84 | 84 | match getS(otherAdmin) { | |
85 | 85 | case b: String => | |
86 | 86 | if ((inputAddress != getS(otherAdmin))) | |
87 | 87 | then throw("unauthorized") | |
88 | 88 | else true | |
89 | 89 | case _ => | |
90 | 90 | throw("unauthorizd") | |
91 | 91 | } | |
92 | 92 | } | |
93 | 93 | } | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func stakerOnly (i) = { | |
97 | 97 | let inputAddress = toBase58String(i.caller.bytes) | |
98 | 98 | let check = if ((inputAddress != getS(staker))) | |
99 | 99 | then throw("unauthorized") | |
100 | 100 | else true | |
101 | 101 | check | |
102 | 102 | } | |
103 | 103 | ||
104 | 104 | ||
105 | 105 | func writeConfigValue (key,data) = match data { | |
106 | 106 | case data: String => | |
107 | 107 | writeConstString(key, data) | |
108 | 108 | case data: Int => | |
109 | 109 | writeConstInteger(key, data) | |
110 | 110 | case _ => | |
111 | 111 | throw("unsupported config type") | |
112 | 112 | } | |
113 | 113 | ||
114 | 114 | ||
115 | 115 | func incrementEntryIndex (key) = { | |
116 | 116 | let uIndex = getI(key) | |
117 | 117 | if (isDefined(uIndex)) | |
118 | 118 | then (value(uIndex) + 1) | |
119 | 119 | else 0 | |
120 | 120 | } | |
121 | 121 | ||
122 | 122 | ||
123 | 123 | @Callable(i) | |
124 | 124 | func getAPYAmount (user,AssetTicker,EntryIndex) = { | |
125 | 125 | let check = stakerOnly(i) | |
126 | 126 | if ((check == check)) | |
127 | 127 | then { | |
128 | 128 | let uEntryToString = ((((user + "_") + AssetTicker) + "_") + toString(EntryIndex)) | |
129 | 129 | let uAPY = (uEntryToString + APY_Amount) | |
130 | 130 | let uAPYAmount = valueOrErrorMessage(getI(uAPY), ("APY not computed for " + user)) | |
131 | 131 | $Tuple2(nil, uAPYAmount) | |
132 | 132 | } | |
133 | 133 | else throw("Strict value is not equal to itself.") | |
134 | 134 | } | |
135 | 135 | ||
136 | 136 | ||
137 | 137 | ||
138 | 138 | @Callable(i) | |
139 | 139 | func storeAPYAmount (user,AssetTicker,APYAmount,EntryIndex) = { | |
140 | 140 | let check = adminOnly(i) | |
141 | 141 | if ((check == check)) | |
142 | 142 | then { | |
143 | 143 | let uEntryToString = ((((user + "_") + AssetTicker) + "_") + toString(EntryIndex)) | |
144 | 144 | let uAPY = (uEntryToString + APY_Amount) | |
145 | 145 | [writeConstInteger(uEntryToString, EntryIndex), writeConstInteger(uAPY, APYAmount)] | |
146 | 146 | } | |
147 | 147 | else throw("Strict value is not equal to itself.") | |
148 | 148 | } | |
149 | 149 | ||
150 | 150 | ||
151 | 151 | ||
152 | 152 | @Callable(i) | |
153 | 153 | func deleteAPYAmount (user,AssetTicker,EntryIndex) = { | |
154 | 154 | let check = adminOnly(i) | |
155 | 155 | if ((check == check)) | |
156 | 156 | then { | |
157 | 157 | let uEntryToString = ((((user + "_") + AssetTicker) + "_") + toString(EntryIndex)) | |
158 | 158 | let uAPY = (uEntryToString + APY_Amount) | |
159 | 159 | [DeleteEntry(uAPY), DeleteEntry(uEntryToString)] | |
160 | 160 | } | |
161 | 161 | else throw("Strict value is not equal to itself.") | |
162 | 162 | } | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | ||
166 | 166 | @Callable(i) | |
167 | 167 | func init (stakerAddress) = [writeConstString(staker, stakerAddress), writeConstString(admin, toBase58String(this.bytes))] | |
168 | 168 | ||
169 | 169 | ||
170 | 170 | ||
171 | 171 | @Callable(i) | |
172 | 172 | func getAssetIdByTicker (AssetTicker) = { | |
173 | 173 | let checks = adminOnly(i) | |
174 | 174 | if ((checks == checks)) | |
175 | 175 | then { | |
176 | 176 | let stakerAddress = fromBase58String(getSV("staker")) | |
177 | 177 | let run = invoke(Address(stakerAddress), "_getAssetIdByTicker", [AssetTicker], nil) | |
178 | 178 | match run { | |
179 | 179 | case a: String => | |
180 | 180 | [StringEntry(assetIdCall, a)] | |
181 | 181 | case _ => | |
182 | 182 | nil | |
183 | 183 | } | |
184 | 184 | } | |
185 | 185 | else throw("Strict value is not equal to itself.") | |
186 | 186 | } | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | ||
190 | 190 | @Callable(i) | |
191 | - | func getDaysLeftToClaim (userAddress) = { | |
191 | + | func getDaysLeftToClaim (userAddress,AssetTicker,EntryIndex) = { | |
192 | 192 | let checks = adminOnly(i) | |
193 | 193 | if ((checks == checks)) | |
194 | 194 | then { | |
195 | 195 | let stakerAddress = fromBase58String(getSV("staker")) | |
196 | - | let run = invoke(Address(stakerAddress), "_getDaysLeftToClaim", [userAddress], nil) | |
196 | + | let run = invoke(Address(stakerAddress), "_getDaysLeftToClaim", [userAddress, AssetTicker, EntryIndex], nil) | |
197 | 197 | match run { | |
198 | 198 | case a: String => | |
199 | 199 | [StringEntry(daysLeft, a)] | |
200 | 200 | case _ => | |
201 | 201 | nil | |
202 | 202 | } | |
203 | 203 | } | |
204 | 204 | else throw("Strict value is not equal to itself.") | |
205 | 205 | } | |
206 | 206 | ||
207 | 207 |
github/deemru/w8io/169f3d6 59.77 ms ◑