tx · GGYxYdttUmjUz8uVUDFspMrU9UXNNYcN6QuCxNB7kUVg 3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV: -0.01400000 Waves 2022.03.05 11:57 [1950463] smart account 3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV > SELF 0.00000000 Waves
{ "type": 13, "id": "GGYxYdttUmjUz8uVUDFspMrU9UXNNYcN6QuCxNB7kUVg", "fee": 1400000, "feeAssetId": null, "timestamp": 1646470635567, "version": 1, "sender": "3N8bnD2caKnxdcTqvrJUEkDe3XebgfwWjSV", "senderPublicKey": "8KXPjDuC8ffL9qjNuDBLnkvJKbMojhZYcnm2o75UCyun", "proofs": [ "3XXKaPVYSp9SoXXQWUG3Va9f2yvd1qHqq7aX6LRSGVy14Rw9T8AUv1gGBYJV4dom4F6EaDq88mDhn1HweFhaEwiB" ], "script": "base64:AAIFAAAAAAAAABgIAhIDCgEIEgMKAQgSABIICgYBAQEBCAEAAAAZAAAAAANTRVACAAAAAl9fAAAAAAVFTVBUWQIAAAAAAAAAAA5pZHhQb29sQWRkcmVzcwAAAAAAAAAAAQAAAAAJaWR4TFBBc0lkAAAAAAAAAAADAAAAAAlpZHhBbUFzSWQAAAAAAAAAAAQAAAAACWlkeFByQXNJZAAAAAAAAAAABQAAAAAPaWR4RmFjdFN0YWtDbnRyAAAAAAAAAAABAQAAAAtrZXlGYWN0Q250cgAAAAACAAAAEyVzX19mYWN0b3J5Q29udHJhY3QBAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABQlc19fbWFuYWdlclB1YmxpY0tleQEAAAAaa2V5UGVuZGluZ01hbmFnZXJQdWJsaWNLZXkAAAAAAgAAABslc19fcGVuZGluZ01hbmFnZXJQdWJsaWNLZXkBAAAAC2tleVBvb2xBZGRyAAAAAAIAAAAPJXNfX3Bvb2xBZGRyZXNzAQAAAAtrZXlBbXRBc3NldAAAAAACAAAADyVzX19hbW91bnRBc3NldAEAAAANa2V5UHJpY2VBc3NldAA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lcnJvcgkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAFAAAAD3RhcmdldFB1YmxpY0tleXyHjec=", "chainId": 84, "height": 1950463, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: CjY3hgzNq2ytuYhHwamQ3XXXA2yD3gfqvUxbtaP3nJ7o Next: 6hLM1g1dBSXmi7moRH4rp93bBYSKEob1JZ39MZTeBp6Y Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 5 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | let EMPTY = "" | |
7 | 7 | ||
8 | 8 | let idxPoolAddress = 1 | |
9 | 9 | ||
10 | 10 | let idxLPAsId = 3 | |
11 | 11 | ||
12 | 12 | let idxAmAsId = 4 | |
13 | 13 | ||
14 | 14 | let idxPrAsId = 5 | |
15 | 15 | ||
16 | 16 | let idxFactStakCntr = 1 | |
17 | 17 | ||
18 | 18 | func keyFactCntr () = "%s__factoryContract" | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func keyPoolAddr () = "%s__poolAddress" | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func keyAmtAsset () = "%s__amountAsset" | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func keyPriceAsset () = "%s__priceAsset" | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyFactoryConfig () = "%s__factoryConfig" | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyPoolConfig (iAmtAs,iPrAs) = (((("%d%d%s__" + iAmtAs) + "__") + iPrAs) + "__config") | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyMappingsBaseAsset2internalId (bAStr) = ("%s%s%s__mappings__baseAsset2internalId__" + bAStr) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func getStringOrFail (addr,key) = valueOrErrorMessage(getString(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func getIntOrFail (addr,key) = valueOrErrorMessage(getInteger(addr, key), makeString(["mandatory ", toString(addr), ".", key, " not defined"], "")) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | let poolContract = addressFromStringValue(getStringOrFail(this, keyPoolAddr())) | |
52 | 52 | ||
53 | 53 | let factoryContract = addressFromStringValue(getStringOrFail(poolContract, keyFactCntr())) | |
54 | 54 | ||
55 | 55 | func getPoolConfig () = { | |
56 | 56 | let amtAs = getStringOrFail(poolContract, keyAmtAsset()) | |
57 | 57 | let priceAs = getStringOrFail(poolContract, keyPriceAsset()) | |
58 | 58 | let iPriceAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(priceAs)) | |
59 | 59 | let iAmtAs = getIntOrFail(factoryContract, keyMappingsBaseAsset2internalId(amtAs)) | |
60 | 60 | split(getStringOrFail(factoryContract, keyPoolConfig(toString(iAmtAs), toString(iPriceAs))), SEP) | |
61 | 61 | } | |
62 | 62 | ||
63 | 63 | ||
64 | 64 | func getFactoryConfig () = split(getStringOrFail(factoryContract, keyFactoryConfig()), SEP) | |
65 | 65 | ||
66 | 66 | ||
67 | 67 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
68 | 68 | case s: String => | |
69 | 69 | fromBase58String(s) | |
70 | 70 | case _: Unit => | |
71 | 71 | unit | |
72 | 72 | case _ => | |
73 | 73 | throw("Match error") | |
74 | 74 | } | |
75 | 75 | ||
76 | 76 | ||
77 | 77 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
78 | 78 | case s: String => | |
79 | 79 | fromBase58String(s) | |
80 | 80 | case _: Unit => | |
81 | 81 | unit | |
82 | 82 | case _ => | |
83 | 83 | throw("Match error") | |
84 | 84 | } | |
85 | 85 | ||
86 | 86 | ||
87 | 87 | func mustManager (i) = { | |
88 | 88 | let pd = throw("Permission denied") | |
89 | 89 | match managerPublicKeyOrUnit() { | |
90 | 90 | case pk: ByteVector => | |
91 | 91 | if ((i.callerPublicKey == pk)) | |
92 | 92 | then true | |
93 | 93 | else pd | |
94 | 94 | case _: Unit => | |
95 | 95 | if ((i.caller == this)) | |
96 | 96 | then true | |
97 | 97 | else pd | |
98 | 98 | case _ => | |
99 | 99 | throw("Match error") | |
100 | 100 | } | |
101 | 101 | } | |
102 | 102 | ||
103 | 103 | ||
104 | 104 | @Callable(i) | |
105 | 105 | func constructor (poolAddress) = { | |
106 | 106 | let checkCaller = mustManager(i) | |
107 | 107 | if ((checkCaller == checkCaller)) | |
108 | 108 | then [StringEntry(keyPoolAddr(), poolAddress)] | |
109 | 109 | else throw("Strict value is not equal to itself.") | |
110 | 110 | } | |
111 | 111 | ||
112 | 112 | ||
113 | 113 | ||
114 | 114 | @Callable(i) | |
115 | 115 | func setManager (pendingManagerPublicKey) = { | |
116 | 116 | let checkCaller = mustManager(i) | |
117 | 117 | if ((checkCaller == checkCaller)) | |
118 | 118 | then { | |
119 | 119 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
120 | 120 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
121 | 121 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
122 | 122 | else throw("Strict value is not equal to itself.") | |
123 | 123 | } | |
124 | 124 | else throw("Strict value is not equal to itself.") | |
125 | 125 | } | |
126 | 126 | ||
127 | 127 | ||
128 | 128 | ||
129 | 129 | @Callable(i) | |
130 | 130 | func confirmManager () = { | |
131 | 131 | let pm = pendingManagerPublicKeyOrUnit() | |
132 | 132 | let hasPM = if (isDefined(pm)) | |
133 | 133 | then true | |
134 | 134 | else throw("No pending manager") | |
135 | 135 | if ((hasPM == hasPM)) | |
136 | 136 | then { | |
137 | 137 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
138 | 138 | then true | |
139 | 139 | else throw("You are not pending manager") | |
140 | 140 | if ((checkPM == checkPM)) | |
141 | 141 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
142 | 142 | else throw("Strict value is not equal to itself.") | |
143 | 143 | } | |
144 | 144 | else throw("Strict value is not equal to itself.") | |
145 | 145 | } | |
146 | 146 | ||
147 | 147 | ||
148 | 148 | ||
149 | 149 | @Callable(i) | |
150 | 150 | func unstakeAndGetOneTkn (amount,exchResult,notUsed,outAmount,outAssetId,slippage) = { | |
151 | 151 | let checkPayments = if ((size(i.payments) != 0)) | |
152 | 152 | then throw("No pmnts expd") | |
153 | 153 | else true | |
154 | 154 | if ((checkPayments == checkPayments)) | |
155 | 155 | then { | |
156 | 156 | let cfg = getPoolConfig() | |
157 | 157 | let factoryCfg = getFactoryConfig() | |
158 | 158 | let lpAssetId = fromBase58String(cfg[idxLPAsId]) | |
159 | 159 | let staking = valueOrErrorMessage(addressFromString(factoryCfg[idxFactStakCntr]), "Wr st addr") | |
160 | 160 | let unstakeInv = invoke(staking, "unstake", [toBase58String(lpAssetId), amount], nil) | |
161 | 161 | if ((unstakeInv == unstakeInv)) | |
162 | 162 | then { | |
163 | 163 | let getOneTkn = invoke(poolContract, "getOneTkn", [exchResult, notUsed, outAmount, outAssetId, slippage], [AttachedPayment(lpAssetId, amount)]) | |
164 | 164 | if ((getOneTkn == getOneTkn)) | |
165 | 165 | then nil | |
166 | 166 | else throw("Strict value is not equal to itself.") | |
167 | 167 | } | |
168 | 168 | else throw("Strict value is not equal to itself.") | |
169 | 169 | } | |
170 | 170 | else throw("Strict value is not equal to itself.") | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | @Verifier(tx) | |
175 | 175 | func verify () = { | |
176 | 176 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
177 | 177 | case pk: ByteVector => | |
178 | 178 | pk | |
179 | 179 | case _: Unit => | |
180 | 180 | tx.senderPublicKey | |
181 | 181 | case _ => | |
182 | 182 | throw("Match error") | |
183 | 183 | } | |
184 | 184 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
185 | 185 | } | |
186 | 186 |
github/deemru/w8io/169f3d6 84.65 ms ◑