tx · J78Pt3YfBwHAVf6ptMvBLvzAyznFXL4h1rHqAdNS74Dh 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu: -0.01700000 Waves 2022.06.08 19:55 [2087661] smart account 3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu > SELF 0.00000000 Waves
{ "type": 13, "id": "J78Pt3YfBwHAVf6ptMvBLvzAyznFXL4h1rHqAdNS74Dh", "fee": 1700000, "feeAssetId": null, "timestamp": 1654707397541, "version": 1, "sender": "3Muw1aRbeKgLqAS264AakECyQAvDsnweHLu", "senderPublicKey": "668WwQVaWxezbvLEK3FccCSTbjst4zYAJDPrfLFRj9b9", "proofs": [ "5qqRnmhSA2vocNqRBHMo1w8cb5tZe32UvQzt6mhjGcLGFxTwGjdSQ9uATYsbTHjvZPYdsX1jmWv47cXH4rFFWof7" ], "script": "base64:AAIFAAAAAAAAACwIAhIDCgEIEgASABIFCgMICAgSCQoHCAgICAEIARIAEgQKAggBEgMKAQgSAAAAABYAAAAAA1NFUAIAAAACX18AAAAABUVNUFRZAgAAAAAAAAAACGNvbnRyYWN0AgAAAA9scF9zdGFraW5nX3YyOiABAAAAE2tleU1hbmFnZXJQdWJsaWNLZXkAAAAACQAEuQAAAAIJAARMAAAAAgIAAAACJXMJAARMAAAAAgIAAAAQbWFuYWdlclB1YmxpY0tleQUAAAADbmlsBQAAAANTRVABAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAkABLkAAAACCQAETAAAAAICAAAAAiVzCQAETAAAAAICAAAAF3BlbmRpbmdNYW5hZ2VyUHVibGljS2V5BQAAAANuaWwFAAAAA1NFUAEAAAAGa2V5VFZMAAAAAQAAAAdhc3NldElkCQAEuQAAAAIJAARMAAAAAgIAAAAEJXMlcwkABEwAAAACAgAAAAN0dmwJAARMAAAAAgUAAAAHYXNzZXRJZAUAAAADbmlsBQAAAANTRVABAAAADWtleVRWTEhpc3RvcnkAAAACAAAAB2Fzc2V0SWQAAAAGaGVpZ2h0C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BAAAAC0RlbGV0ZUVudHJ5AAAAAQkBAAAAGmtleVBlbmRpbmdNYW5hZ2VyUHVibGljS2V5AAAAAAUAAAADbmlsCQAAAgAAAAECAAAAJFN0cmljdCB2YWx1ZSBpcyBub3QgZXF1YWwgdG8gaXRzZWxmLgkAAAIAAAABAgAAACRTdHJpY3QgdmFsdWUgaXMgbm90IGVxdWFsIHRvIGl0c2VsZi4AAAABAAAAAnR4AQAAAAZ2ZXJpZnkAAAAABAAAAA90YXJnZXRQdWJsaWNLZXkEAAAAByRtYXRjaDAJAQAAABZtYW5hZ2VyUHVibGljS2V5T3JVbml0AAAAAAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAKQnl0ZVZlY3RvcgQAAAACcGsFAAAAByRtYXRjaDAFAAAAAnBrAwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAARVbml0CAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5CQAAAgAAAAECAAAAC01hdGNoIGVycm9yCQAB9AAAAAMIBQAAAAJ0eAAAAAlib2R5Qnl0ZXMJAAGRAAAAAggFAAAAAnR4AAAABnByb29mcwAAAAAAAAAAAAUAAAAPdGFyZ2V0UHVibGljS2V5KHPJRw==", "chainId": 84, "height": 2087661, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 9LA7qr8ZwkVPtVgErL9XCej1ZuCqeWCi6btZbdQZHBVY Next: 6sPeaTDqUhQpwXGNvnYT6n6xbuAnYxreRmSWLoseSPUw Diff:
Old | New | Differences | |
---|---|---|---|
38 | 38 | ||
39 | 39 | ||
40 | 40 | func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP) | |
41 | 44 | ||
42 | 45 | ||
43 | 46 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
184 | 187 | ||
185 | 188 | ||
186 | 189 | @Callable(i) | |
187 | - | func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress) = { | |
190 | + | func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = { | |
188 | 191 | let checks = [mustManager(i), if ((delayInBlocks >= 0)) | |
189 | 192 | then true | |
190 | 193 | else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit)) | |
203 | 206 | then { | |
204 | 207 | let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil) | |
205 | 208 | if ((addLabel == addLabel)) | |
206 | - | then [BooleanEntry(keyCreated(assetId), true), IntegerEntry(keyTVL(assetId), 0), IntegerEntry(keyTVLHistory(assetId, height), 0), IntegerEntry(keyDelayInBlocks(assetId), delayInBlocks), StringEntry(keyLPIdToAssetId(lpId), assetId), StringEntry(keyAssetIdToLPId(assetId), lpId), StringEntry(keyProxyAddress(assetId), proxyAddress), lpIssue, Burn(lp, 1)] | |
209 | + | then [BooleanEntry(keyCreated(assetId), true), IntegerEntry(keyTVL(assetId), 0), IntegerEntry(keyTVLHistory(assetId, height), 0), IntegerEntry(keyDelayInBlocks(assetId), delayInBlocks), StringEntry(keyLPIdToAssetId(lpId), assetId), StringEntry(keyAssetIdToLPId(assetId), lpId), StringEntry(keyProxyAddress(assetId), proxyAddress), IntegerEntry(keyOtherChainAssetDecimals(assetId), otherChainAssetDecimals), lpIssue, Burn(lp, 1)] | |
207 | 210 | else throw("Strict value is not equal to itself.") | |
208 | 211 | } | |
209 | 212 | else throw("Strict value is not equal to itself.") | |
236 | 239 | ||
237 | 240 | ||
238 | 241 | @Callable(i) | |
239 | - | func setTVL (assetId,newTVL) = { | |
240 | - | let checkCaller = mustProxyAddress(i, assetId) | |
241 | - | if ((checkCaller == checkCaller)) | |
242 | - | then [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)] | |
242 | + | func setTVL (assetId,newRawTVL) = { | |
243 | + | let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
244 | + | then true | |
245 | + | else throwErr("asset must be registered in the contract")] | |
246 | + | if ((checks == checks)) | |
247 | + | then { | |
248 | + | let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals | |
249 | + | let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId))) | |
250 | + | let newTVL = if ((otherChainAssetDecimals > assetDecimals)) | |
251 | + | then { | |
252 | + | let diff = (otherChainAssetDecimals - assetDecimals) | |
253 | + | (newRawTVL / pow(10, 0, diff, 0, 0, DOWN)) | |
254 | + | } | |
255 | + | else if ((assetDecimals > otherChainAssetDecimals)) | |
256 | + | then { | |
257 | + | let diff = (assetDecimals - otherChainAssetDecimals) | |
258 | + | (newRawTVL * pow(10, 0, diff, 0, 0, DOWN)) | |
259 | + | } | |
260 | + | else newRawTVL | |
261 | + | [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)] | |
262 | + | } | |
243 | 263 | else throw("Strict value is not equal to itself.") | |
244 | 264 | } | |
245 | 265 |
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 contract = "lp_staking_v2: " | |
9 | 9 | ||
10 | 10 | func keyManagerPublicKey () = makeString(["%s", "managerPublicKey"], SEP) | |
11 | 11 | ||
12 | 12 | ||
13 | 13 | func keyPendingManagerPublicKey () = makeString(["%s", "pendingManagerPublicKey"], SEP) | |
14 | 14 | ||
15 | 15 | ||
16 | 16 | func keyTVL (assetId) = makeString(["%s%s", "tvl", assetId], SEP) | |
17 | 17 | ||
18 | 18 | ||
19 | 19 | func keyTVLHistory (assetId,height) = makeString(["%s%s%d", "tvlHistory", assetId, toString(height)], SEP) | |
20 | 20 | ||
21 | 21 | ||
22 | 22 | func keyPendingWithdrawals (assetId) = makeString(["%s%s", "pendingWithdrawals", assetId], SEP) | |
23 | 23 | ||
24 | 24 | ||
25 | 25 | func keyDelayInBlocks (assetId) = makeString(["%s%s", "delayInBlocks", assetId], SEP) | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func keyCreated (assetId) = makeString(["%s%s", "created", assetId], SEP) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func keyAssetIdToLPId (assetId) = makeString(["%s%s", "assetIdToLPId", assetId], SEP) | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func keyLPIdToAssetId (lpId) = makeString(["%s%s", "lpIdToAssetId", lpId], SEP) | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func keyProxyAddress (assetId) = makeString(["%s%s", "proxyAddress", assetId], SEP) | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func keyMappingsUserToWithdrawal (assetId,userAddress,txId) = makeString(["%s%s%s%s", "userWithdrawalAmount", assetId, userAddress, txId], SEP) | |
41 | + | ||
42 | + | ||
43 | + | func keyOtherChainAssetDecimals (assetId) = makeString(["%s%s", "otherChainAssetDecimals", assetId], SEP) | |
41 | 44 | ||
42 | 45 | ||
43 | 46 | func keyAssetsStoreContract () = makeString(["%s", "assetsStoreContract"], SEP) | |
44 | 47 | ||
45 | 48 | ||
46 | 49 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
47 | 50 | case s: String => | |
48 | 51 | fromBase58String(s) | |
49 | 52 | case _: Unit => | |
50 | 53 | unit | |
51 | 54 | case _ => | |
52 | 55 | throw("Match error") | |
53 | 56 | } | |
54 | 57 | ||
55 | 58 | ||
56 | 59 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
57 | 60 | case s: String => | |
58 | 61 | fromBase58String(s) | |
59 | 62 | case _: Unit => | |
60 | 63 | unit | |
61 | 64 | case _ => | |
62 | 65 | throw("Match error") | |
63 | 66 | } | |
64 | 67 | ||
65 | 68 | ||
66 | 69 | func throwErr (msg) = throw((contract + msg)) | |
67 | 70 | ||
68 | 71 | ||
69 | 72 | func mustManager (i) = { | |
70 | 73 | let pd = throwErr("permission denied") | |
71 | 74 | match managerPublicKeyOrUnit() { | |
72 | 75 | case pk: ByteVector => | |
73 | 76 | if ((i.callerPublicKey == pk)) | |
74 | 77 | then true | |
75 | 78 | else pd | |
76 | 79 | case _: Unit => | |
77 | 80 | if ((i.caller == this)) | |
78 | 81 | then true | |
79 | 82 | else pd | |
80 | 83 | case _ => | |
81 | 84 | throw("Match error") | |
82 | 85 | } | |
83 | 86 | } | |
84 | 87 | ||
85 | 88 | ||
86 | 89 | func assetsStoreContract () = addressFromStringValue(value(getString(keyAssetsStoreContract()))) | |
87 | 90 | ||
88 | 91 | ||
89 | 92 | func mustProxyAddress (i,assetId) = { | |
90 | 93 | let isProxy = (toString(i.caller) == valueOrElse(getString(keyProxyAddress(assetId)), EMPTY)) | |
91 | 94 | if (isProxy) | |
92 | 95 | then true | |
93 | 96 | else { | |
94 | 97 | let checkCaller = mustManager(i) | |
95 | 98 | if ((checkCaller == checkCaller)) | |
96 | 99 | then true | |
97 | 100 | else throw("Strict value is not equal to itself.") | |
98 | 101 | } | |
99 | 102 | } | |
100 | 103 | ||
101 | 104 | ||
102 | 105 | @Callable(i) | |
103 | 106 | func constructor (assetsStoreContract) = { | |
104 | 107 | let checkCaller = mustManager(i) | |
105 | 108 | if ((checkCaller == checkCaller)) | |
106 | 109 | then [StringEntry(keyAssetsStoreContract(), assetsStoreContract)] | |
107 | 110 | else throw("Strict value is not equal to itself.") | |
108 | 111 | } | |
109 | 112 | ||
110 | 113 | ||
111 | 114 | ||
112 | 115 | @Callable(i) | |
113 | 116 | func put () = { | |
114 | 117 | let pmt = value(i.payments[0]) | |
115 | 118 | let asset = value(pmt.assetId) | |
116 | 119 | let assetId = toBase58String(asset) | |
117 | 120 | let checks = [if ((size(i.payments) == 1)) | |
118 | 121 | then true | |
119 | 122 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
120 | 123 | then true | |
121 | 124 | else throwErr("attached payment asset must be registered in the contract"), if ((pmt.amount > 0)) | |
122 | 125 | then true | |
123 | 126 | else throwErr("positive amount required")] | |
124 | 127 | if ((checks == checks)) | |
125 | 128 | then { | |
126 | 129 | let tvl = valueOrElse(getInteger(keyTVL(assetId)), 0) | |
127 | 130 | let lpId = value(getString(keyAssetIdToLPId(assetId))) | |
128 | 131 | let lpInfo = value(assetInfo(fromBase58String(assetId))) | |
129 | 132 | let sharesAmount = if ((tvl > 0)) | |
130 | 133 | then ((pmt.amount * lpInfo.quantity) / tvl) | |
131 | 134 | else pmt.amount | |
132 | 135 | [Reissue(lpInfo.id, sharesAmount, true), ScriptTransfer(i.caller, sharesAmount, lpInfo.id)] | |
133 | 136 | } | |
134 | 137 | else throw("Strict value is not equal to itself.") | |
135 | 138 | } | |
136 | 139 | ||
137 | 140 | ||
138 | 141 | ||
139 | 142 | @Callable(i) | |
140 | 143 | func submitGetRequest () = { | |
141 | 144 | let pmt = value(i.payments[0]) | |
142 | 145 | let lp = value(pmt.assetId) | |
143 | 146 | let lpId = toBase58String(lp) | |
144 | 147 | let userAddress = toString(i.caller) | |
145 | 148 | let baseAssetId = value(getString(keyLPIdToAssetId(lpId))) | |
146 | 149 | let shares = pmt.amount | |
147 | 150 | let checks = [if ((size(i.payments) == 1)) | |
148 | 151 | then true | |
149 | 152 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(baseAssetId)), false)) | |
150 | 153 | then true | |
151 | 154 | else throwErr("attached payment asset must be registered in the contract"), if ((shares > 0)) | |
152 | 155 | then true | |
153 | 156 | else throwErr("positive amount to withdrawal required")] | |
154 | 157 | if ((checks == checks)) | |
155 | 158 | then { | |
156 | 159 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(baseAssetId)), 0) | |
157 | 160 | let tvl = valueOrElse(getInteger(keyTVL(baseAssetId)), 0) | |
158 | 161 | let lpInfo = value(assetInfo(lp)) | |
159 | 162 | let decimals = lpInfo.decimals | |
160 | 163 | let withdrawalAmount = ((shares * tvl) / lpInfo.quantity) | |
161 | 164 | [Burn(lp, shares), IntegerEntry(keyPendingWithdrawals(baseAssetId), (pendingWithdrawals + withdrawalAmount)), IntegerEntry(keyMappingsUserToWithdrawal(baseAssetId, userAddress, toBase58String(i.transactionId)), withdrawalAmount)] | |
162 | 165 | } | |
163 | 166 | else throw("Strict value is not equal to itself.") | |
164 | 167 | } | |
165 | 168 | ||
166 | 169 | ||
167 | 170 | ||
168 | 171 | @Callable(i) | |
169 | 172 | func executeGetRequest (assetId,userAddress,submitTxId) = { | |
170 | 173 | let withdrawalAmount = valueOrElse(getInteger(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), 0) | |
171 | 174 | let checks = [if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
172 | 175 | then true | |
173 | 176 | else throwErr("asset must be registered in the contract"), if ((withdrawalAmount > 0)) | |
174 | 177 | then true | |
175 | 178 | else throwErr("no corresponding withdrawal request")] | |
176 | 179 | if ((checks == checks)) | |
177 | 180 | then { | |
178 | 181 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
179 | 182 | [ScriptTransfer(addressFromStringValue(userAddress), withdrawalAmount, fromBase58String(assetId)), DeleteEntry(keyMappingsUserToWithdrawal(assetId, userAddress, submitTxId)), IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - withdrawalAmount))] | |
180 | 183 | } | |
181 | 184 | else throw("Strict value is not equal to itself.") | |
182 | 185 | } | |
183 | 186 | ||
184 | 187 | ||
185 | 188 | ||
186 | 189 | @Callable(i) | |
187 | - | func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress) = { | |
190 | + | func registerAsset (assetId,lpName,lpDescription,lpLogo,delayInBlocks,proxyAddress,otherChainAssetDecimals) = { | |
188 | 191 | let checks = [mustManager(i), if ((delayInBlocks >= 0)) | |
189 | 192 | then true | |
190 | 193 | else throwErr("invalid delayInBlocks"), if ((addressFromString(proxyAddress) != unit)) | |
191 | 194 | then true | |
192 | 195 | else throwErr("invalid proxyAddress"), if ((valueOrElse(getBoolean(keyCreated(assetId)), false) == false)) | |
193 | 196 | then true | |
194 | 197 | else throwErr("asset already registered")] | |
195 | 198 | if ((checks == checks)) | |
196 | 199 | then { | |
197 | 200 | let decimals = value(assetInfo(fromBase58String(assetId))).decimals | |
198 | 201 | let lpIssue = Issue(lpName, lpDescription, 1, decimals, true) | |
199 | 202 | let lp = calculateAssetId(lpIssue) | |
200 | 203 | let lpId = toBase58String(lp) | |
201 | 204 | let createOrUpdate = invoke(assetsStoreContract(), "createOrUpdate", [lpId, lpLogo, false], nil) | |
202 | 205 | if ((createOrUpdate == createOrUpdate)) | |
203 | 206 | then { | |
204 | 207 | let addLabel = invoke(assetsStoreContract(), "addLabel", [lpId, "DEFI"], nil) | |
205 | 208 | if ((addLabel == addLabel)) | |
206 | - | then [BooleanEntry(keyCreated(assetId), true), IntegerEntry(keyTVL(assetId), 0), IntegerEntry(keyTVLHistory(assetId, height), 0), IntegerEntry(keyDelayInBlocks(assetId), delayInBlocks), StringEntry(keyLPIdToAssetId(lpId), assetId), StringEntry(keyAssetIdToLPId(assetId), lpId), StringEntry(keyProxyAddress(assetId), proxyAddress), lpIssue, Burn(lp, 1)] | |
209 | + | then [BooleanEntry(keyCreated(assetId), true), IntegerEntry(keyTVL(assetId), 0), IntegerEntry(keyTVLHistory(assetId, height), 0), IntegerEntry(keyDelayInBlocks(assetId), delayInBlocks), StringEntry(keyLPIdToAssetId(lpId), assetId), StringEntry(keyAssetIdToLPId(assetId), lpId), StringEntry(keyProxyAddress(assetId), proxyAddress), IntegerEntry(keyOtherChainAssetDecimals(assetId), otherChainAssetDecimals), lpIssue, Burn(lp, 1)] | |
207 | 210 | else throw("Strict value is not equal to itself.") | |
208 | 211 | } | |
209 | 212 | else throw("Strict value is not equal to itself.") | |
210 | 213 | } | |
211 | 214 | else throw("Strict value is not equal to itself.") | |
212 | 215 | } | |
213 | 216 | ||
214 | 217 | ||
215 | 218 | ||
216 | 219 | @Callable(i) | |
217 | 220 | func topUpBalance () = { | |
218 | 221 | let pmt = valueOrErrorMessage(i.payments[0], (contract + "payment must be attached")) | |
219 | 222 | let assetId = toBase58String(value(pmt.assetId)) | |
220 | 223 | let amount = pmt.amount | |
221 | 224 | let pendingWithdrawals = valueOrElse(getInteger(keyPendingWithdrawals(assetId)), 0) | |
222 | 225 | let checks = [mustProxyAddress(i, assetId), if ((size(i.payments) == 1)) | |
223 | 226 | then true | |
224 | 227 | else throwErr("only one payment must be attached"), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
225 | 228 | then true | |
226 | 229 | else throwErr("attached payment asset must be registered in the contract"), if ((pendingWithdrawals != 0)) | |
227 | 230 | then true | |
228 | 231 | else throwErr("zero pendingWithdrawals, nothing to top up"), if ((pendingWithdrawals >= amount)) | |
229 | 232 | then true | |
230 | 233 | else "amount to top up must be less or equal than pendingWithdrawals"] | |
231 | 234 | if ((checks == checks)) | |
232 | 235 | then [IntegerEntry(keyPendingWithdrawals(assetId), (pendingWithdrawals - amount))] | |
233 | 236 | else throw("Strict value is not equal to itself.") | |
234 | 237 | } | |
235 | 238 | ||
236 | 239 | ||
237 | 240 | ||
238 | 241 | @Callable(i) | |
239 | - | func setTVL (assetId,newTVL) = { | |
240 | - | let checkCaller = mustProxyAddress(i, assetId) | |
241 | - | if ((checkCaller == checkCaller)) | |
242 | - | then [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)] | |
242 | + | func setTVL (assetId,newRawTVL) = { | |
243 | + | let checks = [mustProxyAddress(i, assetId), if (valueOrElse(getBoolean(keyCreated(assetId)), false)) | |
244 | + | then true | |
245 | + | else throwErr("asset must be registered in the contract")] | |
246 | + | if ((checks == checks)) | |
247 | + | then { | |
248 | + | let assetDecimals = value(assetInfo(fromBase58String(assetId))).decimals | |
249 | + | let otherChainAssetDecimals = value(getInteger(keyOtherChainAssetDecimals(assetId))) | |
250 | + | let newTVL = if ((otherChainAssetDecimals > assetDecimals)) | |
251 | + | then { | |
252 | + | let diff = (otherChainAssetDecimals - assetDecimals) | |
253 | + | (newRawTVL / pow(10, 0, diff, 0, 0, DOWN)) | |
254 | + | } | |
255 | + | else if ((assetDecimals > otherChainAssetDecimals)) | |
256 | + | then { | |
257 | + | let diff = (assetDecimals - otherChainAssetDecimals) | |
258 | + | (newRawTVL * pow(10, 0, diff, 0, 0, DOWN)) | |
259 | + | } | |
260 | + | else newRawTVL | |
261 | + | [IntegerEntry(keyTVL(assetId), newTVL), IntegerEntry(keyTVLHistory(assetId, height), newTVL)] | |
262 | + | } | |
243 | 263 | else throw("Strict value is not equal to itself.") | |
244 | 264 | } | |
245 | 265 | ||
246 | 266 | ||
247 | 267 | ||
248 | 268 | @Callable(i) | |
249 | 269 | func setManager (pendingManagerPublicKey) = { | |
250 | 270 | let checkCaller = mustManager(i) | |
251 | 271 | if ((checkCaller == checkCaller)) | |
252 | 272 | then { | |
253 | 273 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
254 | 274 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
255 | 275 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
256 | 276 | else throw("Strict value is not equal to itself.") | |
257 | 277 | } | |
258 | 278 | else throw("Strict value is not equal to itself.") | |
259 | 279 | } | |
260 | 280 | ||
261 | 281 | ||
262 | 282 | ||
263 | 283 | @Callable(i) | |
264 | 284 | func confirmManager () = { | |
265 | 285 | let pm = pendingManagerPublicKeyOrUnit() | |
266 | 286 | let hasPM = if (isDefined(pm)) | |
267 | 287 | then true | |
268 | 288 | else throwErr("no pending manager") | |
269 | 289 | if ((hasPM == hasPM)) | |
270 | 290 | then { | |
271 | 291 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
272 | 292 | then true | |
273 | 293 | else throwErr("you are not pending manager") | |
274 | 294 | if ((checkPM == checkPM)) | |
275 | 295 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
276 | 296 | else throw("Strict value is not equal to itself.") | |
277 | 297 | } | |
278 | 298 | else throw("Strict value is not equal to itself.") | |
279 | 299 | } | |
280 | 300 | ||
281 | 301 | ||
282 | 302 | @Verifier(tx) | |
283 | 303 | func verify () = { | |
284 | 304 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
285 | 305 | case pk: ByteVector => | |
286 | 306 | pk | |
287 | 307 | case _: Unit => | |
288 | 308 | tx.senderPublicKey | |
289 | 309 | case _ => | |
290 | 310 | throw("Match error") | |
291 | 311 | } | |
292 | 312 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
293 | 313 | } | |
294 | 314 |
github/deemru/w8io/026f985 45.76 ms ◑