tx · 7pujF7e6j2Ymo4JC3v34vgVJz3PfcA91ePjrcrNXMrF9

3N1PkLo5TvDa2gm7EFc2ZXiCPQVVr12bVps:  -0.01000000 Waves

2022.03.15 11:49 [1964833] smart account 3N1PkLo5TvDa2gm7EFc2ZXiCPQVVr12bVps > SELF 0.00000000 Waves

{ "type": 13, "id": "7pujF7e6j2Ymo4JC3v34vgVJz3PfcA91ePjrcrNXMrF9", "fee": 1000000, "feeAssetId": null, "timestamp": 1647334198623, "version": 2, "chainId": 84, "sender": "3N1PkLo5TvDa2gm7EFc2ZXiCPQVVr12bVps", "senderPublicKey": "BfznM6h3nLdXZmWsimnG4qTUgLHDpMXF5uuHnNnLsGAh", "proofs": [ "bY6gp38LvZasxTEAs2FtEgSTUwZuR2iAZScig1DonTpSKwCtVqJZPK2HBa2RmFr3LydPrUdXxSHDbftz2QM3bt9" ], "script": "base64:AAIFAAAAAAAAABgIAhIDCgEIEgMKAQgSABIICgYBAQEBCAEAAAAZAAAAAANTRVACAAAAAl9fAAAAAAVFTVBUWQIAAAAAAAAAAA5pZHhQb29sQWRkcmVzcwAAAAAAAAAAAQAAAAAJaWR4TFBBc0lkAAAAAAAAAAADAAAAAAlpZHhBbUFzSWQAAAAAAAAAAAQAAAAACWlkeFByQXNJZAAAAAAAAAAABQAAAAAPaWR4RmFjdFN0YWtDbnRyAAAAAAAAAAABAQAAAAtrZXlGYWN0Q250cgAAAAACAAAAEyVzX19mYWN0b3J5Q29udHJhY3QBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAAAAC2tleVBvb2xBZGRyAAAAAAIAAAAPJXNfX3Bvb2xBZGRyZXNzAQAAAAtrZXlBbXRBc3NldAAAAAACAAAADyVzX19hbW91bnRBc3NldAEAAAANa2V5UHJpY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tNYXRjaCBlcnJvcgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAD3RhcmdldFB1YmxpY0tleXyHjec=", "height": 1964833, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
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 keyFactoryConfig () = "%s__factoryConfig"
37+
38+
39+func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config")
40+
41+
42+func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr)
43+
44+
45+func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
46+
47+
48+func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], ""))
49+
50+
51+let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr()))
52+
53+let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr()))
54+
55+func getPoolConfig () = {
56+ let amtAs = getStringOrFail(poolContract, keyAmtAsset())
57+ let priceAs = getStringOrFail(poolContract, keyPriceAsset())
58+ let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs))
59+ let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs))
60+ split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP)
61+ }
62+
63+
64+func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP)
65+
66+
67+func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) {
68+ case s: String =>
69+ fromBase58String(s)
70+ case _: Unit =>
71+ unit
72+ case _ =>
73+ throw("Match error")
74+}
75+
76+
77+func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) {
78+ case s: String =>
79+ fromBase58String(s)
80+ case _: Unit =>
81+ unit
82+ case _ =>
83+ throw("Match error")
84+}
85+
86+
87+func mustManager (i) = {
88+ let pd = throw("Permission denied")
89+ match managerPublicKeyOrUnit() {
90+ case pk: ByteVector =>
91+ if ((i.callerPublicKey == pk))
92+ then true
93+ else pd
94+ case _: Unit =>
95+ if ((i.caller == this))
96+ then true
97+ else pd
98+ case _ =>
99+ throw("Match error")
100+ }
101+ }
102+
103+
104+@Callable(i)
105+func constructor (poolAddress) = {
106+ let checkCaller = mustManager(i)
107+ if ((checkCaller == checkCaller))
108+ then [StringEntry(keyPoolAddr(), poolAddress)]
109+ else throw("Strict value is not equal to itself.")
110+ }
111+
112+
113+
114+@Callable(i)
115+func setManager (pendingManagerPublicKey) = {
116+ let checkCaller = mustManager(i)
117+ if ((checkCaller == checkCaller))
118+ then {
119+ let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey)
120+ if ((checkManagerPublicKey == checkManagerPublicKey))
121+ then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)]
122+ else throw("Strict value is not equal to itself.")
123+ }
124+ else throw("Strict value is not equal to itself.")
125+ }
126+
127+
128+
129+@Callable(i)
130+func confirmManager () = {
131+ let pm = pendingManagerPublicKeyOrUnit()
132+ let hasPM = if (isDefined(pm))
133+ then true
134+ else throw("No pending manager")
135+ if ((hasPM == hasPM))
136+ then {
137+ let checkPM = if ((i.callerPublicKey == value(pm)))
138+ then true
139+ else throw("You are not pending manager")
140+ if ((checkPM == checkPM))
141+ then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())]
142+ else throw("Strict value is not equal to itself.")
143+ }
144+ else throw("Strict value is not equal to itself.")
145+ }
146+
147+
148+
149+@Callable(i)
150+func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = {
151+ let checkPayments = if ((size(i.payments) != 0))
152+ then throw("No pmnts expd")
153+ else true
154+ if ((checkPayments == checkPayments))
155+ then {
156+ let cfg = getPoolConfig()
157+ let factoryCfg = getFactoryConfig()
158+ let lpAssetId = fromBase58String(cfg[idxLPAsId])
159+ let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr")
160+ let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil)
161+ if ((unstakeInv == unstakeInv))
162+ then {
163+ let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)])
164+ if ((getOneTkn == getOneTkn))
165+ then nil
166+ else throw("Strict value is not equal to itself.")
167+ }
168+ else throw("Strict value is not equal to itself.")
169+ }
170+ else throw("Strict value is not equal to itself.")
171+ }
172+
173+
174+@Verifier(tx)
175+func verify () = {
176+ let targetPublicKey = match managerPublicKeyOrUnit() {
177+ case pk: ByteVector =>
178+ pk
179+ case _: Unit =>
180+ tx.senderPublicKey
181+ case _ =>
182+ throw("Match error")
183+ }
184+ sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey)
185+ }
186+

github/deemru/w8io/026f985 
17.20 ms