tx · HPxwx8V9oD3n2JpeffYTZKA6RaktbyNw1Vf63BpNRbuM 3N4erM2YbPHzpzNT31KQbgHxQoRdiJdFFTY: -0.01000000 Waves 2023.10.05 10:39 [2785027] smart account 3N4erM2YbPHzpzNT31KQbgHxQoRdiJdFFTY > SELF 0.00000000 Waves
{ "type": 13, "id": "HPxwx8V9oD3n2JpeffYTZKA6RaktbyNw1Vf63BpNRbuM", "fee": 1000000, "feeAssetId": null, "timestamp": 1696491614987, "version": 2, "chainId": 84, "sender": "3N4erM2YbPHzpzNT31KQbgHxQoRdiJdFFTY", "senderPublicKey": "7GUbGVG276ULommBZzxXPzHL6btx9riLfjv8zVcRKLci", "proofs": [ "2NjRXzA3igqYauoktCDpeuJK6KsuhzwDjVv3JntgNcTs8rTm3mJKRgUeZnraMBokPA2gBf4tqEk4oYL7C8WSQKNo" ], "script": "base64:BgIWCAISAwoBCBIAEgMKAQESABIAEgASAB0ABlNDQUxFOACAwtcvAA1QRVJDRU5UX1NDQUxFAJBOAA5BWExZX01BSU5fQUREUgkBB0FkZHJlc3MBARoBVEdh0UpNzn/72+6l9L3Wwi2aSOpC0rlhmwAMQVhMWV9GQVJNSU5HCQEHQWRkcmVzcwEBGgFUiFrCGKZVQmFa0TmuSd5FGDc6uNWQtIjpAA5BWExZX1RPS0VOT01JQwkBEUBleHRyTmF0aXZlKDEwNjIpAQkBE3ZhbHVlT3JFcnJvck1lc3NhZ2UCCQCdCAIFDEFYTFlfRkFSTUlORwIRdG9rZW5vbWljQ29udHJhY3QCGENhbid0IGdldCB0b2tlbm9taWMgYWRkcgAJa0ludGVyZXN0AghpbnRlcmVzdAANa1VzZXJJbnRlcmVzdAINX3VzZXJJbnRlcmVzdAAOa1VzZXJBdmFpbGFibGUCE191c2VyQXZhaWxhYmxlQ2xhaW0AEGtVc2VyVG9rZW5TdGFrZWQCEF91c2VyVG9rZW5TdGFrZWQAEWtUb3RhbFRva2VuU3Rha2VkAhB0b3RhbFRva2VuU3Rha2VkAA1r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ZHJvcHMBBQlwbXRBbW91bnQFA25pbAFpAQhhY3RpdmF0ZQAJAQt2YWx1ZU9yRWxzZQIJAQtpc0FkbWluQ2FsbAEFAWkDCQELdmFsdWVPckVsc2UCCQCbCAIFBHRoaXMFB2tBY3RpdmUGCQACAQITZEFwcCBhbHJlYWR5IGFjdGl2ZQkAzAgCCQEMQm9vbGVhbkVudHJ5AgUHa0FjdGl2ZQYFA25pbAFpAQhzaHV0ZG93bgAJAQt2YWx1ZU9yRWxzZQIJAQtpc0FkbWluQ2FsbAEFAWkDCQEBIQEJAQt2YWx1ZU9yRWxzZQIJAJsIAgUEdGhpcwUHa0FjdGl2ZQYJAAIBAhVkQXBwIGFscmVhZHkgc2h1dGRvd24JAMwIAgkBDEJvb2xlYW5FbnRyeQIFB2tBY3RpdmUHBQNuaWwBAnR4AQZ2ZXJpZnkABBNtdWx0aVNpZ25lZEJ5QWRtaW5zBBJhZG1pblB1YktleTFTaWduZWQDCQD0AwMIBQJ0eAlib2R5Qnl0ZXMJAJEDAggFAnR4BnByb29mcwAABQhhZG1pbjFQSwABAAAEEmFkbWluUHViS2V5MlNpZ25lZAMJAPQDAwgFAnR4CWJvZHlCeXRlcwkAkQMCCAUCdHgGcHJvb2ZzAAEFCGFkbWluMlBLAAEAAAQSYWRtaW5QdWJLZXkzU2lnbmVkAwkA9AMDCAUCdHgJYm9keUJ5dGVzCQCRAwIIBQJ0eAZwcm9vZnMAAgUIYWRtaW4zUEsAAQAACQBnAgkAZAIJAGQCBRJhZG1pblB1YktleTFTaWduZWQFEmFkbWluUHViS2V5MlNpZ25lZAUSYWRtaW5QdWJLZXkzU2lnbmVkAAIFE211bHRpU2lnbmVkQnlBZG1pbnPzBPhd", "height": 2785027, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 6 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let SCALE8 = 100000000 | |
5 | + | ||
6 | + | let PERCENT_SCALE = 10000 | |
7 | + | ||
8 | + | let AXLY_MAIN_ADDR = Address(base58'3MvRWw2FPEimFCTGtK7qY9uAJbM7XJ4ZfJS') | |
9 | + | ||
10 | + | let AXLY_FARMING = Address(base58'3N2M4PztorHwrfENp7D6LhYGgGodjiD1fjn') | |
11 | + | ||
12 | + | let AXLY_TOKENOMIC = addressFromStringValue(valueOrErrorMessage(getString(AXLY_FARMING, "tokenomicContract"), "Can't get tokenomic addr")) | |
13 | + | ||
14 | + | let kInterest = "interest" | |
15 | + | ||
16 | + | let kUserInterest = "_userInterest" | |
17 | + | ||
18 | + | let kUserAvailable = "_userAvailableClaim" | |
19 | + | ||
20 | + | let kUserTokenStaked = "_userTokenStaked" | |
21 | + | ||
22 | + | let kTotalTokenStaked = "totalTokenStaked" | |
23 | + | ||
24 | + | let kLastAirdrops = "lastAirdrops" | |
25 | + | ||
26 | + | let kActive = "active" | |
27 | + | ||
28 | + | let kAXLYTokenId = "axlyTokenId" | |
29 | + | ||
30 | + | let kAdmin1PK = "group1_admin1_pub_key" | |
31 | + | ||
32 | + | let kAdmin2PK = "group1_admin2_pub_key" | |
33 | + | ||
34 | + | let kAdmin3PK = "group1_admin3_pub_key" | |
35 | + | ||
36 | + | let kOperatorCallPK = "admin_call_pub_key" | |
37 | + | ||
38 | + | let admin1PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin1PK), "Can't get admin1PK")) | |
39 | + | ||
40 | + | let admin2PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin2PK), "Can't get admin2PK")) | |
41 | + | ||
42 | + | let admin3PK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kAdmin3PK), "Can't get admin3PK")) | |
43 | + | ||
44 | + | let operatorPK = fromBase58String(valueOrErrorMessage(getString(AXLY_MAIN_ADDR, kOperatorCallPK), "Can't get operatorPK")) | |
45 | + | ||
46 | + | let axlyId = fromBase58String(valueOrErrorMessage(getString(AXLY_TOKENOMIC, kAXLYTokenId), "Can't get axly token id")) | |
47 | + | ||
48 | + | func isAdminCall (i) = if (containsElement([admin1PK, admin2PK, admin3PK], i.callerPublicKey)) | |
49 | + | then unit | |
50 | + | else throw("Only admin can call this function") | |
51 | + | ||
52 | + | ||
53 | + | func isSelfCall (i) = if ((i.caller == this)) | |
54 | + | then unit | |
55 | + | else throw("Only contract itself can call this function") | |
56 | + | ||
57 | + | ||
58 | + | func isActive () = if (valueOrElse(getBoolean(this, kActive), true)) | |
59 | + | then unit | |
60 | + | else throw("DApp is inactive at this moment") | |
61 | + | ||
62 | + | ||
63 | + | func assetIdToStr (assetId) = match assetId { | |
64 | + | case id: ByteVector => | |
65 | + | toBase58String(id) | |
66 | + | case waves: Unit => | |
67 | + | "WAVES" | |
68 | + | case _ => | |
69 | + | throw("Not Asset id") | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | func claimCalc (user) = { | |
74 | + | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
75 | + | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
76 | + | let availableForClaim = valueOrElse(getInteger(this, (user + kUserAvailable)), 0) | |
77 | + | let userInterest = valueOrElse(getInteger(this, (user + kUserInterest)), curInterest) | |
78 | + | let userTokenStaked = valueOrElse(getInteger(this, (user + kUserTokenStaked)), 0) | |
79 | + | let claimAmount = fraction(userTokenStaked, (curInterest - userInterest), SCALE8) | |
80 | + | $Tuple4(curInterest, (claimAmount + availableForClaim), userTokenStaked, totalTokenStaked) | |
81 | + | } | |
82 | + | ||
83 | + | ||
84 | + | func calcTokenApr () = { | |
85 | + | let lastAirdrops = valueOrElse(getString(this, kLastAirdrops), "") | |
86 | + | if ((lastAirdrops == "")) | |
87 | + | then 0 | |
88 | + | else { | |
89 | + | func calcTotalAirdrops (total,airdrop) = { | |
90 | + | let aInt = parseIntValue(airdrop) | |
91 | + | (total + aInt) | |
92 | + | } | |
93 | + | ||
94 | + | let airdrops = split(lastAirdrops, ",") | |
95 | + | let avgAirdrop = ({ | |
96 | + | let $l = airdrops | |
97 | + | let $s = size($l) | |
98 | + | let $acc0 = 0 | |
99 | + | func $f0_1 ($a,$i) = if (($i >= $s)) | |
100 | + | then $a | |
101 | + | else calcTotalAirdrops($a, $l[$i]) | |
102 | + | ||
103 | + | func $f0_2 ($a,$i) = if (($i >= $s)) | |
104 | + | then $a | |
105 | + | else throw("List size exceeds 7") | |
106 | + | ||
107 | + | $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7) | |
108 | + | } / size(airdrops)) | |
109 | + | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
110 | + | (fraction(avgAirdrop, PERCENT_SCALE, totalTokenStaked) * 365) | |
111 | + | } | |
112 | + | } | |
113 | + | ||
114 | + | ||
115 | + | func calcAirdrops (pmt) = { | |
116 | + | let airdrops = valueOrElse(getString(this, kLastAirdrops), "") | |
117 | + | let airdropsList = if ((airdrops == "")) | |
118 | + | then nil | |
119 | + | else split(airdrops, ",") | |
120 | + | let newAirdropsList = if ((7 > size(airdropsList))) | |
121 | + | then (airdropsList :+ toString(pmt)) | |
122 | + | else (removeByIndex(airdropsList, 0) :+ toString(pmt)) | |
123 | + | makeString(newAirdropsList, ",") | |
124 | + | } | |
125 | + | ||
126 | + | ||
127 | + | @Callable(i) | |
128 | + | func getStatsREADONLY (user) = { | |
129 | + | let apr = calcTokenApr() | |
130 | + | if ((user == "")) | |
131 | + | then $Tuple2(nil, [apr, 0, 0, 0]) | |
132 | + | else { | |
133 | + | let userAddr = valueOrErrorMessage(addressFromString(user), "Wrong user address") | |
134 | + | let $t038413937 = claimCalc(user) | |
135 | + | let userNewInterest = $t038413937._1 | |
136 | + | let claimAmountAvailable = $t038413937._2 | |
137 | + | let userTokenStaked = $t038413937._3 | |
138 | + | let totalTokenStaked = $t038413937._4 | |
139 | + | let userTokenBalance = assetBalance(userAddr, axlyId) | |
140 | + | $Tuple2(nil, [apr, userTokenBalance, userTokenStaked, claimAmountAvailable]) | |
141 | + | } | |
142 | + | } | |
143 | + | ||
144 | + | ||
145 | + | ||
146 | + | @Callable(i) | |
147 | + | func stake () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
148 | + | then throw("One payment expected") | |
149 | + | else { | |
150 | + | let $t042364311 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
151 | + | let pmtAmount = $t042364311._1 | |
152 | + | let pmtAssetId = $t042364311._2 | |
153 | + | if ((pmtAssetId != axlyId)) | |
154 | + | then throw("Wrong payment asset") | |
155 | + | else { | |
156 | + | let user = toString(i.caller) | |
157 | + | let $t044124508 = claimCalc(user) | |
158 | + | let userNewInterest = $t044124508._1 | |
159 | + | let claimAmountAvailable = $t044124508._2 | |
160 | + | let userTokenStaked = $t044124508._3 | |
161 | + | let totalTokenStaked = $t044124508._4 | |
162 | + | [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked + pmtAmount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked + pmtAmount))] | |
163 | + | } | |
164 | + | }) | |
165 | + | ||
166 | + | ||
167 | + | ||
168 | + | @Callable(i) | |
169 | + | func unstake (amount) = valueOrElse(isActive(), { | |
170 | + | let user = toString(i.caller) | |
171 | + | if ((0 >= amount)) | |
172 | + | then throw("Amount must be greater than 0") | |
173 | + | else { | |
174 | + | let $t049465042 = claimCalc(user) | |
175 | + | let userNewInterest = $t049465042._1 | |
176 | + | let claimAmountAvailable = $t049465042._2 | |
177 | + | let userTokenStaked = $t049465042._3 | |
178 | + | let totalTokenStaked = $t049465042._4 | |
179 | + | if ((amount > userTokenStaked)) | |
180 | + | then throw("You can't unstake more than staked") | |
181 | + | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), claimAmountAvailable), IntegerEntry((user + kUserTokenStaked), (userTokenStaked - amount)), IntegerEntry(kTotalTokenStaked, (totalTokenStaked - amount)), ScriptTransfer(i.caller, amount, axlyId)] | |
182 | + | } | |
183 | + | }) | |
184 | + | ||
185 | + | ||
186 | + | ||
187 | + | @Callable(i) | |
188 | + | func claim () = valueOrElse(isActive(), { | |
189 | + | let user = toString(i.caller) | |
190 | + | let $t055285624 = claimCalc(user) | |
191 | + | let userNewInterest = $t055285624._1 | |
192 | + | let claimAmountAvailable = $t055285624._2 | |
193 | + | let userTokenStaked = $t055285624._3 | |
194 | + | let totalTokenStaked = $t055285624._4 | |
195 | + | if ((claimAmountAvailable == 0)) | |
196 | + | then throw("Nothing to claim") | |
197 | + | else [IntegerEntry((user + kUserInterest), userNewInterest), IntegerEntry((user + kUserAvailable), 0), ScriptTransfer(i.caller, claimAmountAvailable, axlyId)] | |
198 | + | }) | |
199 | + | ||
200 | + | ||
201 | + | ||
202 | + | @Callable(i) | |
203 | + | func airdrop () = valueOrElse(isActive(), if ((size(i.payments) != 1)) | |
204 | + | then throw("One payment expected") | |
205 | + | else { | |
206 | + | let $t059916066 = $Tuple2(i.payments[0].amount, i.payments[0].assetId) | |
207 | + | let pmtAmount = $t059916066._1 | |
208 | + | let pmtAssetId = $t059916066._2 | |
209 | + | if ((pmtAssetId != axlyId)) | |
210 | + | then throw("Wrong payment asset") | |
211 | + | else { | |
212 | + | let totalTokenStaked = valueOrElse(getInteger(this, kTotalTokenStaked), 0) | |
213 | + | let curInterest = valueOrElse(getInteger(this, kInterest), 0) | |
214 | + | let interestNew = if ((totalTokenStaked > 0)) | |
215 | + | then (curInterest + fraction(pmtAmount, SCALE8, totalTokenStaked)) | |
216 | + | else curInterest | |
217 | + | [IntegerEntry(kInterest, interestNew), StringEntry(kLastAirdrops, calcAirdrops(pmtAmount))] | |
218 | + | } | |
219 | + | }) | |
220 | + | ||
221 | + | ||
222 | + | ||
223 | + | @Callable(i) | |
224 | + | func activate () = valueOrElse(isAdminCall(i), if (valueOrElse(getBoolean(this, kActive), true)) | |
225 | + | then throw("dApp already active") | |
226 | + | else [BooleanEntry(kActive, true)]) | |
227 | + | ||
228 | + | ||
229 | + | ||
230 | + | @Callable(i) | |
231 | + | func shutdown () = valueOrElse(isAdminCall(i), if (!(valueOrElse(getBoolean(this, kActive), true))) | |
232 | + | then throw("dApp already shutdown") | |
233 | + | else [BooleanEntry(kActive, false)]) | |
234 | + | ||
235 | + | ||
236 | + | @Verifier(tx) | |
237 | + | func verify () = { | |
238 | + | let multiSignedByAdmins = { | |
239 | + | let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], admin1PK)) | |
240 | + | then 1 | |
241 | + | else 0 | |
242 | + | let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], admin2PK)) | |
243 | + | then 1 | |
244 | + | else 0 | |
245 | + | let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], admin3PK)) | |
246 | + | then 1 | |
247 | + | else 0 | |
248 | + | (((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) >= 2) | |
249 | + | } | |
250 | + | multiSignedByAdmins | |
251 | + | } | |
252 | + |
github/deemru/w8io/026f985 22.50 ms ◑