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