tx · 7MDyp4EsZYFUWwKuHKFWnXh6z7TAijdLkGNJUVLwgmB3

3N4nTJ5sSp5X5ChS2bBBmwNMn1eeRzT1FoP:  -0.00700000 Waves

2022.08.31 11:16 [2208376] smart account 3N4nTJ5sSp5X5ChS2bBBmwNMn1eeRzT1FoP > SELF 0.00000000 Waves

{ "type": 13, "id": "7MDyp4EsZYFUWwKuHKFWnXh6z7TAijdLkGNJUVLwgmB3", "fee": 700000, "feeAssetId": null, "timestamp": 1661933794095, "version": 2, "chainId": 84, "sender": "3N4nTJ5sSp5X5ChS2bBBmwNMn1eeRzT1FoP", "senderPublicKey": "EsqRXDXnACFAdXz6EPhF1SbKyeV7MVuoyDqmXsMz7ySv", "proofs": [ "o5eoA3b4Ruzc4T88B68eWovDCBfpUpP5Hjjbqgems5wzhpYjkz37KGzb9XukKrfzbPHsTwgwsZxXzXBWCXepWi6" ], "script": null, "height": 2208376, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: TDGw9J7AyMfLbR7BLCHEtHT1KP89EMuw4XyV51mzNYK Next: HgfTatQtDLFsSdWqvXGPqP5E69XUJ383yz5mdLuxxnAx Full:
OldNewDifferences
1-{-# STDLIB_VERSION 5 #-}
2-{-# SCRIPT_TYPE ACCOUNT #-}
3-{-# CONTENT_TYPE DAPP #-}
4-let SEP = "__"
5-
6-let EMPTY = ""
7-
8-let idxPoolAddress = 1
9-
10-let idxLPAsId = 3
11-
12-let idxAmAsId = 4
13-
14-let idxPrAsId = 5
15-
16-let idxFactStakCntr = 1
17-
18-func keyFactCntr () = "%s__factoryContract"
19-
20-
21-func keyManagerPublicKey () = "%s__managerPublicKey"
22-
23-
24-func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey"
25-
26-
27-func keyPoolAddr () = "%s__poolAddress"
28-
29-
30-func keyAmtAsset () = "%s__amountAsset"
31-
32-
33-func keyPriceAsset () = "%s__priceAsset"
34-
35-
36-func keyAdminPubKeys () = "%s__adminPubKeys"
37-
38-
39-func keyAmp () = "%s__amp"
40-
41-
42-func keyAmpHistory (height) = ("%s%d__amp__" + toString(height))
43-
44-
45-func keyFactoryConfig () = "%s__factoryConfig"
46-
47-
48-func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
49-
50-
51-func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
52-
53-
54-func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
55-
56-
57-func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
58-
59-
60-let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr()))
61-
62-let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr()))
63-
64-func getPoolConfig () = {
65- let amtAs = getStringOrFail(poolContract, keyAmtAsset())
66- let priceAs = getStringOrFail(poolContract, keyPriceAsset())
67- let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs))
68- let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs))
69- split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP)
70- }
71-
72-
73-func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
74-
75-
76-func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
77- case s: String =>
78- fromBase58String(s)
79- case _: Unit =>
80- unit
81- case _ =>
82- throw("Match error")
83-}
84-
85-
86-func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
87- case s: String =>
88- fromBase58String(s)
89- case _: Unit =>
90- unit
91- case _ =>
92- throw("Match error")
93-}
94-
95-
96-func mustManager (i) = {
97- let pd = throw("Permission denied")
98- match managerPublicKeyOrUnit() {
99- case pk: ByteVector =>
100- if ((i.callerPublicKey == pk))
101- then true
102- else pd
103- case _: Unit =>
104- if ((i.caller == this))
105- then true
106- else pd
107- case _ =>
108- throw("Match error")
109- }
110- }
111-
112-
113-func getAdmins () = match getString(keyAdminPubKeys()) {
114- case s: String =>
115- if ((size(s) == 0))
116- then nil
117- else split(s, SEP)
118- case _ =>
119- nil
120-}
121-
122-
123-func mustAdmin (i) = if (containsElement(getAdmins(), toBase58String(i.callerPublicKey)))
124- then true
125- else mustManager(i)
126-
127-
128-func mustPool (i) = if ((i.caller == poolContract))
129- then true
130- else throw("caller must be the pool")
131-
132-
133-@Callable(i)
134-func constructor (poolAddress) = {
135- let checkCaller = mustManager(i)
136- if ((checkCaller == checkCaller))
137- then [StringEntry(keyPoolAddr(), poolAddress)]
138- else throw("Strict value is not equal to itself.")
139- }
140-
141-
142-
143-@Callable(i)
144-func setManager (pendingManagerPublicKey) = {
145- let checkCaller = mustManager(i)
146- if ((checkCaller == checkCaller))
147- then {
148- let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
149- if ((checkManagerPublicKey == checkManagerPublicKey))
150- then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
151- else throw("Strict value is not equal to itself.")
152- }
153- else throw("Strict value is not equal to itself.")
154- }
155-
156-
157-
158-@Callable(i)
159-func confirmManager () = {
160- let pm = pendingManagerPublicKeyOrUnit()
161- let hasPM = if (isDefined(pm))
162- then true
163- else throw("No pending manager")
164- if ((hasPM == hasPM))
165- then {
166- let checkPM = if ((i.callerPublicKey == value(pm)))
167- then true
168- else throw("You are not pending manager")
169- if ((checkPM == checkPM))
170- then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
171- else throw("Strict value is not equal to itself.")
172- }
173- else throw("Strict value is not equal to itself.")
174- }
175-
176-
177-
178-@Callable(i)
179-func setAdmins (adminPubKeys) = {
180- let checkCaller = mustManager(i)
181- if ((checkCaller == checkCaller))
182- then [StringEntry(keyAdminPubKeys(), makeString(adminPubKeys, SEP))]
183- else throw("Strict value is not equal to itself.")
184- }
185-
186-
187-
188-@Callable(i)
189-func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
190- let checkPayments = if ((size(i.payments) != 0))
191- then throw("No pmnts expd")
192- else true
193- if ((checkPayments == checkPayments))
194- then {
195- let cfg = getPoolConfig()
196- let factoryCfg = getFactoryConfig()
197- let lpAssetId = fromBase58String(cfg[idxLPAsId])
198- let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
199- let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
200- if ((unstakeInv == unstakeInv))
201- then {
202- let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
203- if ((getOneTkn == getOneTkn))
204- then nil
205- else throw("Strict value is not equal to itself.")
206- }
207- else throw("Strict value is not equal to itself.")
208- }
209- else throw("Strict value is not equal to itself.")
210- }
211-
212-
213-
214-@Callable(i)
215-func setAmp (amp) = {
216- let checkCaller = mustAdmin(i)
217- if ((checkCaller == checkCaller))
218- then {
219- let res1 = invoke(poolContract, "setS", [keyAmp(), amp], nil)
220- let res2 = invoke(poolContract, "setS", [keyAmpHistory(height), amp], nil)
221- $Tuple2(nil, $Tuple2(res1, res2))
222- }
223- else throw("Strict value is not equal to itself.")
224- }
225-
226-
227-@Verifier(tx)
228-func verify () = {
229- let targetPublicKey = match managerPublicKeyOrUnit() {
230- case pk: ByteVector =>
231- pk
232- case _: Unit =>
233- tx.senderPublicKey
234- case _ =>
235- throw("Match error")
236- }
237- sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
238- }
239-
1+# no script

github/deemru/w8io/026f985 
37.05 ms