tx · BkRLwJJ9wanQu5D7DGRq1E3kK3MvNFQC92DHniCGVouW

3PPF8URZjEByhzZK4DjPjAFHvSq2z1h4xBq:  -0.00900000 Waves

2022.11.28 00:43 [3401534] smart account 3PPF8URZjEByhzZK4DjPjAFHvSq2z1h4xBq > SELF 0.00000000 Waves

{ "type": 13, "id": "BkRLwJJ9wanQu5D7DGRq1E3kK3MvNFQC92DHniCGVouW", "fee": 900000, "feeAssetId": null, "timestamp": 1669585332305, "version": 2, "chainId": 87, "sender": "3PPF8URZjEByhzZK4DjPjAFHvSq2z1h4xBq", "senderPublicKey": "EXjiBV2LZBbPQz843eSmNCEpzYYkf4HBaaqMz26yEDcn", "proofs": [ "2iNCqxkGvEPGnLPYZVz54FQzkDcjwqbrFuzzFtfRACoLReTGCcKcqPVs2kuXKLeNiX3PLHDybamQV5TEmMkXCx2V", "DDaoBMDC7HyvhWQGZGkWZMQ1JNyr7G3f1ock8caEmfXwj1qDF2926jhe2Kzb1MqbjAay2kh3crqoDxxDYigCFj7", "5EmqQPWJ66Y3bCVZ9emVySzb4qWApikQ38Qg8UcQjDpjygqhANbuijAES2xWrXNXX9URrs4DCFwzTpGgw5yA5fTT" ], "script": null, "height": 3401534, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: BvZAXdZmQqskfCLqNyVJ7XJrJzUEjz1yvqxJknthrLwP Next: none Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let dAppAddress = Address(base58'3PPNhHYkkEy13gRWDCaruQyhNbX2GrjYSyV')
5-
6-let wxAssetId = base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on'
7-
8-let wxbAssetId = base58'HkYbq1oqnfBnicWwXBRJZCxjM85zAVsQMdHvpQbDCRBo'
9-
10-let giveawayAssetId = base58'Atqv59EYzjFGuitKVnMRk6H8FukjoV3ktPorbEys25on'
11-
12-let wxLockAddress = Address(base58'3PJL8Hn8LACaSBWLQ3UVhctA5cTQLBFwBAP')
13-
14-let teamFeeAddress = Address(base58'3P8yQX1rfCaSszeCJGFHsZxFRdThhr6MDyJ')
15-
16-let adminPubKey1 = base58'3YEaTjB5tn2nVbCfjdBVUWqzYpp9xNtGge7ZcT1BpUWi'
17-
18-let adminPubKey2 = base58'EV2PfBinYYkhRLiKriHbkgyH7hFMiSuceK6qcGNNpG9F'
19-
20-let adminPubKey3 = base58'4u4XFsf9gZjpjUhiQ35AxYrwbETcmQz1Hr8sX4SGQe5F'
21-
22-let adminPubKey4 = base58'7DABJMvHWNbywnXQqBYzsQy5jD64YDHuvdcWyfpFcZs3'
23-
24-@Callable(i)
25-func stakeLP () = {
26- let callerAddressString = toString(i.caller)
27- let isWhitelisted = valueOrElse(getBoolean((callerAddressString + "_whitelisted")), false)
28- let lpAssetId = valueOrElse(getString((callerAddressString + "_assetId")), "")
29- if (if (if (if (isWhitelisted)
30- then (size(i.payments) == 1)
31- else false)
32- then (i.payments[0].amount > 0)
33- else false)
34- then (i.payments[0].assetId == fromBase58String(lpAssetId))
35- else false)
36- then {
37- let stakeLPCall = invoke(dAppAddress, "stake", nil, [AttachedPayment(i.payments[0].assetId, i.payments[0].amount)])
38- if ((stakeLPCall == stakeLPCall))
39- then {
40- let balance = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_balance")), 0) + i.payments[0].amount)
41- $Tuple2([IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_balance"), balance)], unit)
42- }
43- else throw("Strict value is not equal to itself.")
44- }
45- else throw("")
46- }
47-
48-
49-
50-@Callable(i)
51-func unstakeLP (amount) = {
52- let callerAddressString = toString(i.caller)
53- let isWhitelisted = valueOrElse(getBoolean((callerAddressString + "_whitelisted")), false)
54- if (isWhitelisted)
55- then {
56- let lpAssetId = valueOrElse(getString((callerAddressString + "_assetId")), "")
57- let wxBalance = assetBalance(this, wxAssetId)
58- if ((wxBalance == wxBalance))
59- then {
60- let unstakeLPCall = invoke(dAppAddress, "unstake", [lpAssetId, amount], nil)
61- if ((unstakeLPCall == unstakeLPCall))
62- then {
63- let claimedWXAmount = (assetBalance(this, wxAssetId) - wxBalance)
64- if ((claimedWXAmount == claimedWXAmount))
65- then {
66- let totalClaimedWXPool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_claimed_wx")), 0) + claimedWXAmount)
67- let totalClaimedWX = (valueOrElse(getInteger(this, "total_claimed_wx"), 0) + claimedWXAmount)
68- let lockFeeRate = getIntegerValue(this, "lock_fee")
69- let teamFeeRate = getIntegerValue(this, "team_fee")
70- let lockFee = fraction(claimedWXAmount, lockFeeRate, 100)
71- let teamFee = fraction(claimedWXAmount, teamFeeRate, 100)
72- let totalCollectedFeePool = ((valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_collected_fee")), 0) + lockFee) + teamFee)
73- let totalCollectedFee = ((valueOrElse(getInteger("total_collected_fee"), 0) + lockFee) + teamFee)
74- let totalLockFeePool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_lock_fee")), 0) + lockFee)
75- let totalLockFee = (valueOrElse(getInteger("total_lock_fee"), 0) + lockFee)
76- let totalTeamFeePool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_team_fee")), 0) + teamFee)
77- let totalTeamFee = (valueOrElse(getInteger("total_team_fee"), 0) + teamFee)
78- let wxLockCall = invoke(wxLockAddress, "increaseLock", [0], [AttachedPayment(wxAssetId, lockFee)])
79- if ((wxLockCall == wxLockCall))
80- then {
81- let totalLockedWX = (valueOrElse(getInteger("total_locked_wx"), 0) + lockFee)
82- let balance = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_balance")), 0) - amount)
83- $Tuple2([ScriptTransfer(i.caller, amount, fromBase58String(lpAssetId)), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_balance"), balance), ScriptTransfer(i.caller, ((claimedWXAmount - lockFee) - teamFee), wxAssetId), ScriptTransfer(teamFeeAddress, teamFee, wxAssetId), IntegerEntry("total_locked_wx", totalLockedWX), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_claimed_wx"), totalClaimedWXPool), IntegerEntry("total_claimed_wx", totalClaimedWX), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_collected_fee"), totalCollectedFeePool), IntegerEntry("total_collected_fee", totalCollectedFee), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_lock_fee"), totalLockFeePool), IntegerEntry("total_lock_fee", totalLockFee), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_team_fee"), totalTeamFeePool), IntegerEntry("total_team_fee", totalTeamFee)], unit)
84- }
85- else throw("Strict value is not equal to itself.")
86- }
87- else throw("Strict value is not equal to itself.")
88- }
89- else throw("Strict value is not equal to itself.")
90- }
91- else throw("Strict value is not equal to itself.")
92- }
93- else throw("")
94- }
95-
96-
97-
98-@Callable(i)
99-func claim () = {
100- let callerAddressString = toString(i.caller)
101- let isWhitelisted = valueOrElse(getBoolean((callerAddressString + "_whitelisted")), false)
102- if (isWhitelisted)
103- then {
104- let lpAssetId = valueOrElse(getString((callerAddressString + "_assetId")), "")
105- let wxBalance = assetBalance(this, wxAssetId)
106- if ((wxBalance == wxBalance))
107- then {
108- let claimWXCall = invoke(dAppAddress, "claimWx", [lpAssetId], nil)
109- if ((claimWXCall == claimWXCall))
110- then {
111- let claimedWXAmount = (assetBalance(this, wxAssetId) - wxBalance)
112- if ((claimedWXAmount == claimedWXAmount))
113- then {
114- let totalClaimedWXPool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_claimed_wx")), 0) + claimedWXAmount)
115- let totalClaimedWX = (valueOrElse(getInteger(this, "total_claimed_wx"), 0) + claimedWXAmount)
116- let lockFeeRate = getIntegerValue(this, "lock_fee")
117- let teamFeeRate = getIntegerValue(this, "team_fee")
118- let lockFee = fraction(claimedWXAmount, lockFeeRate, 100)
119- let teamFee = fraction(claimedWXAmount, teamFeeRate, 100)
120- let totalCollectedFeePool = ((valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_collected_fee")), 0) + lockFee) + teamFee)
121- let totalCollectedFee = ((valueOrElse(getInteger("total_collected_fee"), 0) + lockFee) + teamFee)
122- let totalLockFeePool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_lock_fee")), 0) + lockFee)
123- let totalLockFee = (valueOrElse(getInteger("total_lock_fee"), 0) + lockFee)
124- let totalTeamFeePool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_team_fee")), 0) + teamFee)
125- let totalTeamFee = (valueOrElse(getInteger("total_team_fee"), 0) + teamFee)
126- let wxLockCall = invoke(wxLockAddress, "increaseLock", [0], [AttachedPayment(wxAssetId, lockFee)])
127- if ((wxLockCall == wxLockCall))
128- then {
129- let totalLockedWX = (valueOrElse(getInteger("total_locked_wx"), 0) + lockFee)
130- let wxbAllocation = valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_wxb_allocation")), 0)
131- let totalClaimedWXBPool = (valueOrElse(getInteger((((callerAddressString + "_") + lpAssetId) + "_total_claimed_wxb")), 0) + wxbAllocation)
132- let totalClaimedWXB = (valueOrElse(getInteger("total_claimed_wxb"), 0) + wxbAllocation)
133- $Tuple2([ScriptTransfer(i.caller, ((claimedWXAmount - lockFee) - teamFee), wxAssetId), ScriptTransfer(teamFeeAddress, teamFee, wxAssetId), ScriptTransfer(i.caller, wxbAllocation, wxbAssetId), IntegerEntry("total_locked_wx", totalLockedWX), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_claimed_wx"), totalClaimedWXPool), IntegerEntry("total_claimed_wx", totalClaimedWX), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_claimed_wxb"), totalClaimedWXBPool), IntegerEntry("total_claimed_wxb", totalClaimedWXB), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_collected_fee"), totalCollectedFeePool), IntegerEntry("total_collected_fee", totalCollectedFee), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_lock_fee"), totalLockFeePool), IntegerEntry("total_lock_fee", totalLockFee), IntegerEntry((((callerAddressString + "_") + lpAssetId) + "_total_team_fee"), totalTeamFeePool), IntegerEntry("total_team_fee", totalTeamFee)], unit)
134- }
135- else throw("Strict value is not equal to itself.")
136- }
137- else throw("Strict value is not equal to itself.")
138- }
139- else throw("Strict value is not equal to itself.")
140- }
141- else throw("Strict value is not equal to itself.")
142- }
143- else throw("")
144- }
145-
146-
147-
148-@Callable(i)
149-func init () = {
150- let initialized = valueOrElse(getBoolean("initialized"), false)
151- if (!(initialized))
152- then {
153- let firstLock = invoke(wxLockAddress, "lock", [2102400], [AttachedPayment(i.payments[0].assetId, i.payments[0].amount)])
154- if ((firstLock == firstLock))
155- then $Tuple2([BooleanEntry("initialized", true), IntegerEntry("it_all_started_in_this_block", height), IntegerEntry("total_locked_wx", i.payments[0].amount), IntegerEntry("lock_duration", (2102400 + height)), IntegerEntry("lock_fee", 15), IntegerEntry("team_fee", 0)], unit)
156- else throw("Strict value is not equal to itself.")
157- }
158- else throw("")
159- }
160-
161-
162-
163-@Callable(i)
164-func setFee (lockFee,teamFee) = if (if (if (if (if ((i.caller == this))
165- then (15 >= lockFee)
166- else false)
167- then (lockFee >= 10)
168- else false)
169- then (5 >= teamFee)
170- else false)
171- then (teamFee >= 0)
172- else false)
173- then $Tuple2([IntegerEntry("lock_fee", lockFee), IntegerEntry("team_fee", teamFee)], unit)
174- else throw("")
175-
176-
177-
178-@Callable(i)
179-func whitelist (whitelistAddress,assetId,allocation) = if ((i.caller == this))
180- then $Tuple2([BooleanEntry((whitelistAddress + "_whitelisted"), true), StringEntry((whitelistAddress + "_assetId"), assetId), IntegerEntry((((whitelistAddress + "_") + assetId) + "_wxb_allocation"), allocation)], unit)
181- else throw("")
182-
183-
184-
185-@Callable(i)
186-func removeWhitelist (whitelistAddress) = {
187- let isWhitelisted = valueOrElse(getBoolean((whitelistAddress + "_whitelisted")), false)
188- if (if ((i.caller == this))
189- then isWhitelisted
190- else false)
191- then $Tuple2([BooleanEntry((whitelistAddress + "_whitelisted"), false)], unit)
192- else throw("")
193- }
194-
195-
196-
197-@Callable(i)
198-func setAllocation (amount,whitelistAddress,assetId) = {
199- let isWhitelisted = valueOrElse(getBoolean((whitelistAddress + "_whitelisted")), false)
200- if (if ((i.caller == this))
201- then isWhitelisted
202- else false)
203- then [IntegerEntry((((whitelistAddress + "_") + assetId) + "_wxb_allocation"), amount)]
204- else throw("")
205- }
206-
207-
208-
209-@Callable(i)
210-func giveaway () = {
211- let callerAddressString = toString(i.caller)
212- let isWhitelisted = valueOrElse(getBoolean((callerAddressString + "_whitelisted")), false)
213- if (if (if (if (isWhitelisted)
214- then (size(i.payments) == 1)
215- else false)
216- then (i.payments[0].assetId == giveawayAssetId)
217- else false)
218- then (i.payments[0].amount > 0)
219- else false)
220- then {
221- let wxLockCall = invoke(wxLockAddress, "increaseLock", [0], [AttachedPayment(i.payments[0].assetId, i.payments[0].amount)])
222- if ((wxLockCall == wxLockCall))
223- then {
224- let totalLockedWX = (valueOrElse(getInteger("total_locked_wx"), 0) + i.payments[0].amount)
225- let totalGiveawayWX = (valueOrElse(getInteger("total_giveaway_wx"), 0) + i.payments[0].amount)
226- $Tuple2([IntegerEntry("total_locked_wx", totalLockedWX), IntegerEntry("total_giveaway_wx", totalGiveawayWX)], unit)
227- }
228- else throw("Strict value is not equal to itself.")
229- }
230- else throw("")
231- }
232-
233-
234-
235-@Callable(i)
236-func increaseLockDuration (duration) = if (containsElement([adminPubKey1, adminPubKey2, adminPubKey3, adminPubKey4], i.callerPublicKey))
237- then {
238- let increaseLockDurationCall = invoke(wxLockAddress, "increaseLock", [duration], nil)
239- if ((increaseLockDurationCall == increaseLockDurationCall))
240- then {
241- let lockDuration = (getIntegerValue("lock_duration") + duration)
242- $Tuple2([IntegerEntry("lock_duration", lockDuration)], unit)
243- }
244- else throw("Strict value is not equal to itself.")
245- }
246- else throw("")
247-
248-
249-@Verifier(tx)
250-func verify () = {
251- let adminPubKey1Signed = if (sigVerify(tx.bodyBytes, tx.proofs[0], adminPubKey1))
252- then 1
253- else 0
254- let adminPubKey2Signed = if (sigVerify(tx.bodyBytes, tx.proofs[1], adminPubKey2))
255- then 1
256- else 0
257- let adminPubKey3Signed = if (sigVerify(tx.bodyBytes, tx.proofs[2], adminPubKey3))
258- then 1
259- else 0
260- let adminPubKey4Signed = if (sigVerify(tx.bodyBytes, tx.proofs[3], adminPubKey4))
261- then 1
262- else 0
263- ((((adminPubKey1Signed + adminPubKey2Signed) + adminPubKey3Signed) + adminPubKey4Signed) >= 3)
264- }
265-
1+# no script

github/deemru/w8io/6500d08 
51.51 ms