tx · 6eK19d1JP3qiR2a8AaK6PBGhZ9GXZL9EVFoU65mehnvT 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy: -0.01200000 Waves 2023.07.02 19:43 [2648547] smart account 3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy > SELF 0.00000000 Waves
{ "type": 13, "id": "6eK19d1JP3qiR2a8AaK6PBGhZ9GXZL9EVFoU65mehnvT", "fee": 1200000, "feeAssetId": null, "timestamp": 1688316217549, "version": 2, "chainId": 84, "sender": "3N7HtrKeFFLz5oy6PfGv1Lg3GwPk4gCPdGy", "senderPublicKey": "FsR18761ZAsUqsTd7TK3XmR6bhihs1UXVmpHYxz5JzQ1", "proofs": [ "4E55GNUCivVzQ4VHNkaDzSMBNHmpjkgBM2nX9ysC94Y3SVAGCM41KxEm1febEaJUuWHminh9Q5LamSpKAaJ3mM4e" ], "script": "base64:BgIgCAISBgoECAgICBIDCgEBEgMKAQESABIDCgEIEgMKAQhFAQprZXlCbG9ja2VkAAIQY29udHJhY3RzQmxvY2tlZAALSWR4RWZmVG90YWwAAAAKSWR4RWZmVXNlcgABAAVjaGFpbgkAyQECCQDKAQIIBQR0aGlzBWJ5dGVzAAEAAQALdXNkdEFzc2V0SWQEByRtYXRjaDAFBWNoYWluAwkAAAIBAVcFByRtYXRjaDABIITaerIIAz9O0bvKju6Lk7zJgt0LXfoHlqjUI/moD/+5AwkAAAIBAVQFByRtYXRjaDABIFWx2J9yh4Lv5eNbjawFq2XemkOhLxa7BfMat4el8cUYCQACAQINVW5rbm93biBjaGFpbgAVZGVmYXVsdFJlc3RBZGRyZXNzU3RyBAckbWF0Y2gwBQVjaGFpbgMJAAACAQFXBQckbWF0Y2gwAiMzUFFDdXZGYnZoNExrUFVucm5VMXozam5iQTFwOW0zV05odgMJAAACAQFUBQckbWF0Y2gwAiMzTXVta0dHenRDS0FYcFdEcXhrZGRvZnFYU1VicVFrdlNKeQkAAgECDVVua25vd24gY2hhaW4ADmFyYml0c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c3Rha2luZ0NvbnRyYWN0CQACAQIRUGVybWlzc2lvbiBkZW5pZWQJAQ1jbGFpbUludGVybmFsAQkBEUBleHRyTmF0aXZlKDEwNjIpAQUEYWRkcgFpAQ1vblVuc3Rha2VMYW5kAQRhZGRyAwkBAiE9AggFAWkGY2FsbGVyBQ9zdGFraW5nQ29udHJhY3QJAAIBAhFQZXJtaXNzaW9uIGRlbmllZAkBDWNsYWltSW50ZXJuYWwBCQERQGV4dHJOYXRpdmUoMTA2MikBBQRhZGRyAGT001U=", "height": 2648547, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CDpwHRtmo6zdWy3NCUS5Rw66qFpeG3gn1asXF4FW8SDH Next: 35Z36AT5VfLXJ5FB19VsrV2o1EZ4SWLja7GZ2EFMY4Qt Diff:
Old | New | Differences | |
---|---|---|---|
253 | 253 | let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0) | |
254 | 254 | let now = lastBlock.timestamp | |
255 | 255 | if ((arbitrageDelay > (now - lastTime))) | |
256 | - | then throw("Arbitrages are possible once a | |
256 | + | then throw((("Arbitrages are possible once a " + toString((arbitrageDelay / 60000))) + "ms")) | |
257 | 257 | else { | |
258 | 258 | let pieces = getVotingPower(addr)[IdxEffUser] | |
259 | 259 | let pow8 = pow(pieces, 0, B8, 8, 8, CEILING) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func keyBlocked () = "contractsBlocked" | |
5 | 5 | ||
6 | 6 | ||
7 | 7 | let IdxEffTotal = 0 | |
8 | 8 | ||
9 | 9 | let IdxEffUser = 1 | |
10 | 10 | ||
11 | 11 | let chain = take(drop(this.bytes, 1), 1) | |
12 | 12 | ||
13 | 13 | let usdtAssetId = match chain { | |
14 | 14 | case _ => | |
15 | 15 | if ((base58'2W' == $match0)) | |
16 | 16 | then base58'9wc3LXNA4TEBsXyKtoLE9mrbDD7WMHXvXrCjZvabLAsi' | |
17 | 17 | else if ((base58'2T' == $match0)) | |
18 | 18 | then base58'6mWwf9mZBjVgkC54idpyaZLQfAosD914wT8fGf2iiY63' | |
19 | 19 | else throw("Unknown chain") | |
20 | 20 | } | |
21 | 21 | ||
22 | 22 | let defaultRestAddressStr = match chain { | |
23 | 23 | case _ => | |
24 | 24 | if ((base58'2W' == $match0)) | |
25 | 25 | then "3PQCuvFbvh4LkPUnrnU1z3jnbA1p9m3WNhv" | |
26 | 26 | else if ((base58'2T' == $match0)) | |
27 | 27 | then "3MumkGGztCKAXpWDqxkddofqXSUbqQkvSJy" | |
28 | 28 | else throw("Unknown chain") | |
29 | 29 | } | |
30 | 30 | ||
31 | 31 | let arbitrageDelay = match chain { | |
32 | 32 | case _ => | |
33 | 33 | if ((base58'2W' == $match0)) | |
34 | 34 | then 600000 | |
35 | 35 | else if ((base58'2T' == $match0)) | |
36 | 36 | then 60000 | |
37 | 37 | else throw("Unknown chain") | |
38 | 38 | } | |
39 | 39 | ||
40 | 40 | let SEP = "__" | |
41 | 41 | ||
42 | 42 | let MULT6 = 1000000 | |
43 | 43 | ||
44 | 44 | let MULT8 = 100000000 | |
45 | 45 | ||
46 | 46 | let SSIZE = 25 | |
47 | 47 | ||
48 | 48 | let MSIZE = 100 | |
49 | 49 | ||
50 | 50 | let LSIZE = 225 | |
51 | 51 | ||
52 | 52 | let XLSIZE = 400 | |
53 | 53 | ||
54 | 54 | let XXLSIZE = 625 | |
55 | 55 | ||
56 | 56 | func getStringOrFail (address,key) = valueOrErrorMessage(getString(address, key), makeString(["mandatory ", toString(address), ".", key, " is not defined"], "")) | |
57 | 57 | ||
58 | 58 | ||
59 | 59 | let IdxCfgStakingDapp = 1 | |
60 | 60 | ||
61 | 61 | let IdxCfgEconomyDapp = 2 | |
62 | 62 | ||
63 | 63 | let IdxCfgWlgDapp = 4 | |
64 | 64 | ||
65 | 65 | let IdxCfgPuzzlePoolDapp = 5 | |
66 | 66 | ||
67 | 67 | func keyRestCfg () = "%s__restConfig" | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | func keyRestAddress () = "%s__restAddr" | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func readRestCfgOrFail (rest) = split_4C(getStringOrFail(rest, keyRestCfg()), SEP) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getContractAddressOrFail (restCfg,idx) = valueOrErrorMessage(addressFromString(restCfg[idx]), ("Rest cfg doesn't contain address at index " + toString(idx))) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | let restContract = addressFromStringValue(valueOrElse(getString(this, keyRestAddress()), defaultRestAddressStr)) | |
80 | 80 | ||
81 | 81 | let restCfg = readRestCfgOrFail(restContract) | |
82 | 82 | ||
83 | 83 | let stakingContract = getContractAddressOrFail(restCfg, IdxCfgStakingDapp) | |
84 | 84 | ||
85 | 85 | let economyContract = getContractAddressOrFail(restCfg, IdxCfgEconomyDapp) | |
86 | 86 | ||
87 | 87 | let wlgContract = getContractAddressOrFail(restCfg, IdxCfgWlgDapp) | |
88 | 88 | ||
89 | 89 | let puzzlePoolContract = getContractAddressOrFail(restCfg, IdxCfgPuzzlePoolDapp) | |
90 | 90 | ||
91 | 91 | let recLandSize = 1 | |
92 | 92 | ||
93 | 93 | func keyResProportions () = "resTypesProportions" | |
94 | 94 | ||
95 | 95 | ||
96 | 96 | func keyStakedLandsByOwner (ownerAddr) = ("stakedLandsByOwner_" + ownerAddr) | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | let wlgIssuedAmountKey = "wlg_issuedAmount" | |
100 | 100 | ||
101 | 101 | let wlgAssetIdKey = "wlg_assetId" | |
102 | 102 | ||
103 | 103 | let wlgAssetId = valueOrErrorMessage(getBinary(wlgContract, wlgAssetIdKey), "Not initialized yet") | |
104 | 104 | ||
105 | 105 | let idxWlgAmount = 0 | |
106 | 106 | ||
107 | 107 | let idxWlgPrice = 1 | |
108 | 108 | ||
109 | 109 | let idxWlgFunds = 2 | |
110 | 110 | ||
111 | 111 | func asInt (v) = match v { | |
112 | 112 | case n: Int => | |
113 | 113 | n | |
114 | 114 | case _ => | |
115 | 115 | throw("fail to cast into Int") | |
116 | 116 | } | |
117 | 117 | ||
118 | 118 | ||
119 | 119 | func numPiecesBySize (landSize) = match landSize { | |
120 | 120 | case _ => | |
121 | 121 | if (("S" == $match0)) | |
122 | 122 | then SSIZE | |
123 | 123 | else if (("M" == $match0)) | |
124 | 124 | then MSIZE | |
125 | 125 | else if (("L" == $match0)) | |
126 | 126 | then LSIZE | |
127 | 127 | else if (("XL" == $match0)) | |
128 | 128 | then XLSIZE | |
129 | 129 | else if (("XXL" == $match0)) | |
130 | 130 | then XXLSIZE | |
131 | 131 | else throw("Unknown land size") | |
132 | 132 | } | |
133 | 133 | ||
134 | 134 | ||
135 | 135 | func getVotingPower (userAddrStrOrEmpty) = { | |
136 | 136 | let props = split(valueOrElse(getString(stakingContract, keyResProportions()), "0_0_0_0_0_0"), "_") | |
137 | 137 | func adder (acc,item) = (acc + parseIntValue(item)) | |
138 | 138 | ||
139 | 139 | let totalPower = { | |
140 | 140 | let $l = props | |
141 | 141 | let $s = size($l) | |
142 | 142 | let $acc0 = 0 | |
143 | 143 | func $f0_1 ($a,$i) = if (($i >= $s)) | |
144 | 144 | then $a | |
145 | 145 | else adder($a, $l[$i]) | |
146 | 146 | ||
147 | 147 | func $f0_2 ($a,$i) = if (($i >= $s)) | |
148 | 148 | then $a | |
149 | 149 | else throw("List size exceeds 6") | |
150 | 150 | ||
151 | 151 | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6) | |
152 | 152 | } | |
153 | 153 | let usersPower = if ((userAddrStrOrEmpty == "")) | |
154 | 154 | then 0 | |
155 | 155 | else { | |
156 | 156 | let landsStr = getString(stakingContract, keyStakedLandsByOwner(userAddrStrOrEmpty)) | |
157 | 157 | let lands = if (isDefined(landsStr)) | |
158 | 158 | then split_51C(value(landsStr), "_") | |
159 | 159 | else nil | |
160 | 160 | func oneLand (acc,landAssetId) = { | |
161 | 161 | let asset = value(assetInfo(fromBase58String(landAssetId))) | |
162 | 162 | let landSize = split(asset.description, "_")[recLandSize] | |
163 | 163 | (acc + numPiecesBySize(landSize)) | |
164 | 164 | } | |
165 | 165 | ||
166 | 166 | let $l = lands | |
167 | 167 | let $s = size($l) | |
168 | 168 | let $acc0 = 0 | |
169 | 169 | func $f1_1 ($a,$i) = if (($i >= $s)) | |
170 | 170 | then $a | |
171 | 171 | else oneLand($a, $l[$i]) | |
172 | 172 | ||
173 | 173 | func $f1_2 ($a,$i) = if (($i >= $s)) | |
174 | 174 | then $a | |
175 | 175 | else throw("List size exceeds 100") | |
176 | 176 | ||
177 | 177 | $f1_2($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($f1_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10), 11), 12), 13), 14), 15), 16), 17), 18), 19), 20), 21), 22), 23), 24), 25), 26), 27), 28), 29), 30), 31), 32), 33), 34), 35), 36), 37), 38), 39), 40), 41), 42), 43), 44), 45), 46), 47), 48), 49), 50), 51), 52), 53), 54), 55), 56), 57), 58), 59), 60), 61), 62), 63), 64), 65), 66), 67), 68), 69), 70), 71), 72), 73), 74), 75), 76), 77), 78), 79), 80), 81), 82), 83), 84), 85), 86), 87), 88), 89), 90), 91), 92), 93), 94), 95), 96), 97), 98), 99), 100) | |
178 | 178 | } | |
179 | 179 | [totalPower, usersPower] | |
180 | 180 | } | |
181 | 181 | ||
182 | 182 | ||
183 | 183 | func getWlgStats () = { | |
184 | 184 | let issuedAmount = valueOrErrorMessage(getInteger(wlgContract, wlgIssuedAmountKey), "WLGOLD is not issued yet") | |
185 | 185 | let economyUsd = assetBalance(economyContract, usdtAssetId) | |
186 | 186 | let restUsd = assetBalance(restContract, usdtAssetId) | |
187 | 187 | let wlgUsd = assetBalance(wlgContract, usdtAssetId) | |
188 | 188 | let puzzleUsd = assetBalance(puzzlePoolContract, usdtAssetId) | |
189 | 189 | let totalFundsUsd = (((economyUsd + restUsd) + wlgUsd) + puzzleUsd) | |
190 | 190 | [issuedAmount, fraction(totalFundsUsd, MULT8, issuedAmount), totalFundsUsd, economyUsd, restUsd, wlgUsd, puzzleUsd] | |
191 | 191 | } | |
192 | 192 | ||
193 | 193 | ||
194 | 194 | func fixedPoint (val,decimals) = { | |
195 | 195 | let tenPow = pow(10, 0, decimals, 0, 0, DOWN) | |
196 | 196 | ((toString((val / tenPow)) + ".") + toString((val % tenPow))) | |
197 | 197 | } | |
198 | 198 | ||
199 | 199 | ||
200 | 200 | let MULT14 = 100000000000000 | |
201 | 201 | ||
202 | 202 | let MARKETINGSHARE = 100000 | |
203 | 203 | ||
204 | 204 | let TEAMSHARE = 200000 | |
205 | 205 | ||
206 | 206 | let ACTIVITYSHARE = 100000 | |
207 | 207 | ||
208 | 208 | let PLAYERSHARE = 400000 | |
209 | 209 | ||
210 | 210 | let YEARMILLIS = 31557600000 | |
211 | 211 | ||
212 | 212 | let WEEKMILLIS = 604800000 | |
213 | 213 | ||
214 | 214 | let MAXPERIOD = 156 | |
215 | 215 | ||
216 | 216 | let A6 = 100000000 | |
217 | 217 | ||
218 | 218 | let B8 = 50000000 | |
219 | 219 | ||
220 | 220 | let wlgIssueTimeKey = "wlg_issueTime" | |
221 | 221 | ||
222 | 222 | let marketingAddrKey = "marketingAddr" | |
223 | 223 | ||
224 | 224 | let teamAddrKey = "teamAddr" | |
225 | 225 | ||
226 | 226 | let profitAddrKey = "profitAddr" | |
227 | 227 | ||
228 | 228 | let lastMarketingTimeKey = "lastClaimedTime_marketing" | |
229 | 229 | ||
230 | 230 | let lastTeamTimeKey = "lastClaimedTime_team" | |
231 | 231 | ||
232 | 232 | let lastActivitiesTimeKey = "lastClaimedTime_activities" | |
233 | 233 | ||
234 | 234 | func keyLastClaimedTimeByUser (addr) = ("lastClaimedTimeUser_" + addr) | |
235 | 235 | ||
236 | 236 | ||
237 | 237 | func keyLastArbTimeByUser (addr) = ("lastArbTimeUser_" + addr) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | let stakersAmountLeftKey = "stakersAmountLeft" | |
241 | 241 | ||
242 | 242 | let stakersAmountPaidTotalKey = "stakersAmountPaidTotal" | |
243 | 243 | ||
244 | 244 | func keyStakersAmountPaidUser (addr) = ("stakersAmountPaidUser_" + addr) | |
245 | 245 | ||
246 | 246 | ||
247 | 247 | func prolog () = if (valueOrElse(getBoolean(stakingContract, keyBlocked()), false)) | |
248 | 248 | then throw("Contracts are under maintenance") | |
249 | 249 | else asInt(invoke(stakingContract, "saveLastTx", nil, nil)) | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | func getSwapLimit (addr) = { | |
253 | 253 | let lastTime = valueOrElse(getInteger(keyLastArbTimeByUser(addr)), 0) | |
254 | 254 | let now = lastBlock.timestamp | |
255 | 255 | if ((arbitrageDelay > (now - lastTime))) | |
256 | - | then throw("Arbitrages are possible once a | |
256 | + | then throw((("Arbitrages are possible once a " + toString((arbitrageDelay / 60000))) + "ms")) | |
257 | 257 | else { | |
258 | 258 | let pieces = getVotingPower(addr)[IdxEffUser] | |
259 | 259 | let pow8 = pow(pieces, 0, B8, 8, 8, CEILING) | |
260 | 260 | fraction(A6, pow8, MULT8) | |
261 | 261 | } | |
262 | 262 | } | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | func claimInternal (caller) = { | |
266 | 266 | let callerAddr = toString(caller) | |
267 | 267 | let now = lastBlock.timestamp | |
268 | 268 | let issueTime = valueOrErrorMessage(getInteger(wlgIssueTimeKey), "Not initialized") | |
269 | 269 | let lastMarketingTime = valueOrElse(getInteger(lastMarketingTimeKey), issueTime) | |
270 | 270 | let marketingAddr = addressFromStringValue(value(getString(marketingAddrKey))) | |
271 | 271 | let marketingAmount = fraction(fraction(MULT14, MARKETINGSHARE, MULT6), (now - lastMarketingTime), YEARMILLIS) | |
272 | 272 | let lastTeamTime = valueOrElse(getInteger(lastTeamTimeKey), issueTime) | |
273 | 273 | let teamAddr = addressFromStringValue(value(getString(teamAddrKey))) | |
274 | 274 | let teamAmount = fraction(fraction(MULT14, TEAMSHARE, MULT6), (now - lastTeamTime), (3 * YEARMILLIS)) | |
275 | 275 | let lastActivitiesTime = valueOrElse(getInteger(lastActivitiesTimeKey), issueTime) | |
276 | 276 | let actAmount = fraction(fraction(MULT14, ACTIVITYSHARE, MULT6), (now - lastActivitiesTime), (3 * YEARMILLIS)) | |
277 | 277 | let curPeriod = ((now - issueTime) / WEEKMILLIS) | |
278 | 278 | if ((curPeriod > (MAXPERIOD / 2))) | |
279 | 279 | then throw("Please modify contract for next 1.5 years, according to stats") | |
280 | 280 | else { | |
281 | 281 | let eff = getVotingPower(callerAddr) | |
282 | 282 | let totalPieces = eff[IdxEffTotal] | |
283 | 283 | let amountLeftTotal = valueOrElse(getInteger(stakersAmountLeftKey), 0) | |
284 | 284 | let curPeriodDistribution = fraction(amountLeftTotal, (2 * totalPieces), (totalPieces + (max([100000, totalPieces]) * (MAXPERIOD - curPeriod)))) | |
285 | 285 | let userTimeKey = keyLastClaimedTimeByUser(callerAddr) | |
286 | 286 | let lastUserTime = valueOrElse(getInteger(userTimeKey), issueTime) | |
287 | 287 | let userAmount = fraction(fraction(curPeriodDistribution, eff[IdxEffUser], totalPieces), (now - lastUserTime), (3 * YEARMILLIS)) | |
288 | 288 | let userKey = keyStakersAmountPaidUser(callerAddr) | |
289 | 289 | $Tuple2([ScriptTransfer(marketingAddr, marketingAmount, wlgAssetId), ScriptTransfer(teamAddr, teamAmount, wlgAssetId), ScriptTransfer(restContract, actAmount, wlgAssetId), ScriptTransfer(caller, userAmount, wlgAssetId), IntegerEntry(userKey, (valueOrElse(getInteger(userKey), 0) + userAmount)), IntegerEntry(stakersAmountPaidTotalKey, (valueOrElse(getInteger(stakersAmountPaidTotalKey), 0) + userAmount)), IntegerEntry(stakersAmountLeftKey, (amountLeftTotal - userAmount)), IntegerEntry(lastMarketingTimeKey, now), IntegerEntry(lastTeamTimeKey, now), IntegerEntry(lastActivitiesTimeKey, now), IntegerEntry(userTimeKey, now)], userAmount) | |
290 | 290 | } | |
291 | 291 | } | |
292 | 292 | ||
293 | 293 | ||
294 | 294 | @Callable(i) | |
295 | 295 | func constructorV1 (restAddr,marketingAddr,teamAddr,profitAddr) = if ((i.caller != this)) | |
296 | 296 | then throw("Permission denied") | |
297 | 297 | else if (isDefined(getBinary(wlgAssetIdKey))) | |
298 | 298 | then throw("Already initialized") | |
299 | 299 | else { | |
300 | 300 | let issuedAmount = MULT14 | |
301 | 301 | let issue = Issue("WLGOLD", "WavesLands Gold investment token", issuedAmount, 8, true, unit, 0) | |
302 | 302 | let assetId = calculateAssetId(issue) | |
303 | 303 | [issue, IntegerEntry(wlgIssueTimeKey, lastBlock.timestamp), IntegerEntry(wlgIssuedAmountKey, issuedAmount), IntegerEntry(stakersAmountPaidTotalKey, 0), IntegerEntry(stakersAmountLeftKey, fraction(MULT14, PLAYERSHARE, MULT6)), BinaryEntry(wlgAssetIdKey, assetId), StringEntry(keyRestAddress(), restAddr), StringEntry(marketingAddrKey, marketingAddr), StringEntry(teamAddrKey, teamAddr), StringEntry(profitAddrKey, profitAddr)] | |
304 | 304 | } | |
305 | 305 | ||
306 | 306 | ||
307 | 307 | ||
308 | 308 | @Callable(i) | |
309 | 309 | func buyWlg (minAmount) = { | |
310 | 310 | let prologResult = prolog() | |
311 | 311 | if ((size(i.payments) != 1)) | |
312 | 312 | then throw("exactly 1 payment must be attached") | |
313 | 313 | else { | |
314 | 314 | let pmt = i.payments[0] | |
315 | 315 | let usdtAmt = pmt.amount | |
316 | 316 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
317 | 317 | if ((pmtAssetId != usdtAssetId)) | |
318 | 318 | then throw("USDT payments only!") | |
319 | 319 | else { | |
320 | 320 | let caller = i.caller | |
321 | 321 | let addr = toString(caller) | |
322 | 322 | let maxUsdt = getSwapLimit(addr) | |
323 | 323 | if ((usdtAmt > maxUsdt)) | |
324 | 324 | then throw((("You can spend max " + fixedPoint(maxUsdt, 6)) + " USDT")) | |
325 | 325 | else { | |
326 | 326 | let curStats = getWlgStats() | |
327 | 327 | let curWlgAmount = curStats[idxWlgAmount] | |
328 | 328 | let oldFundsUsd = (curStats[idxWlgFunds] - usdtAmt) | |
329 | 329 | let wlgPrice = fraction(oldFundsUsd, MULT8, curWlgAmount) | |
330 | 330 | let buyPrice = fraction(wlgPrice, 6, 5) | |
331 | 331 | let wlgAmount = fraction(usdtAmt, MULT8, buyPrice) | |
332 | 332 | if ((minAmount > wlgAmount)) | |
333 | 333 | then throw("Price changed during operation, please try again") | |
334 | 334 | else { | |
335 | 335 | let profitAmount = (usdtAmt / 6) | |
336 | 336 | let deltaFunds = (usdtAmt - profitAmount) | |
337 | 337 | let reissued = fraction(curWlgAmount, deltaFunds, oldFundsUsd) | |
338 | 338 | $Tuple2([Reissue(wlgAssetId, reissued, true), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount + reissued)), IntegerEntry(keyLastArbTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, wlgAmount, wlgAssetId)], prologResult) | |
339 | 339 | } | |
340 | 340 | } | |
341 | 341 | } | |
342 | 342 | } | |
343 | 343 | } | |
344 | 344 | ||
345 | 345 | ||
346 | 346 | ||
347 | 347 | @Callable(i) | |
348 | 348 | func sellWlg (minAmount) = { | |
349 | 349 | let prologResult = prolog() | |
350 | 350 | if ((size(i.payments) != 1)) | |
351 | 351 | then throw("exactly 1 payment must be attached") | |
352 | 352 | else { | |
353 | 353 | let pmt = i.payments[0] | |
354 | 354 | let wlgAmt = pmt.amount | |
355 | 355 | let pmtAssetId = valueOrErrorMessage(pmt.assetId, "WAVES can't be used as payment") | |
356 | 356 | if ((pmtAssetId != wlgAssetId)) | |
357 | 357 | then throw("WLGOLD payments only!") | |
358 | 358 | else { | |
359 | 359 | let caller = i.caller | |
360 | 360 | let addr = toString(caller) | |
361 | 361 | let maxUsdt = getSwapLimit(addr) | |
362 | 362 | let curStats = getWlgStats() | |
363 | 363 | let curWlgAmount = curStats[idxWlgAmount] | |
364 | 364 | let sellPrice = fraction(curStats[idxWlgPrice], 4, 5) | |
365 | 365 | let usdtAmt = fraction(wlgAmt, sellPrice, MULT8) | |
366 | 366 | if ((usdtAmt > maxUsdt)) | |
367 | 367 | then throw((("You can get max " + fixedPoint(maxUsdt, 6)) + " USDT")) | |
368 | 368 | else if ((minAmount > usdtAmt)) | |
369 | 369 | then throw("Price changed during operation, please try again") | |
370 | 370 | else { | |
371 | 371 | let profitAmount = (usdtAmt / 4) | |
372 | 372 | let burned = fraction((usdtAmt + profitAmount), curWlgAmount, curStats[idxWlgFunds]) | |
373 | 373 | $Tuple2([Burn(wlgAssetId, burned), IntegerEntry(wlgIssuedAmountKey, (curWlgAmount - burned)), IntegerEntry(keyLastArbTimeByUser(addr), lastBlock.timestamp), ScriptTransfer(addressFromStringValue(value(getString(profitAddrKey))), profitAmount, usdtAssetId), ScriptTransfer(caller, usdtAmt, usdtAssetId)], prologResult) | |
374 | 374 | } | |
375 | 375 | } | |
376 | 376 | } | |
377 | 377 | } | |
378 | 378 | ||
379 | 379 | ||
380 | 380 | ||
381 | 381 | @Callable(i) | |
382 | 382 | func claim () = { | |
383 | 383 | let prologResult = prolog() | |
384 | 384 | let actions = claimInternal(i.caller)._1 | |
385 | 385 | $Tuple2(actions, prologResult) | |
386 | 386 | } | |
387 | 387 | ||
388 | 388 | ||
389 | 389 | ||
390 | 390 | @Callable(i) | |
391 | 391 | func onStakeLand (addr) = if ((i.caller != stakingContract)) | |
392 | 392 | then throw("Permission denied") | |
393 | 393 | else claimInternal(addressFromStringValue(addr)) | |
394 | 394 | ||
395 | 395 | ||
396 | 396 | ||
397 | 397 | @Callable(i) | |
398 | 398 | func onUnstakeLand (addr) = if ((i.caller != stakingContract)) | |
399 | 399 | then throw("Permission denied") | |
400 | 400 | else claimInternal(addressFromStringValue(addr)) | |
401 | 401 | ||
402 | 402 |
github/deemru/w8io/026f985 44.72 ms ◑