tx · 9ecQ4zLUaNoekxYFdEqKZt5ktiKWrjSg5Dqc9bD8Y22E 3N84Z7HWZfkuYnfGYpXjRU4MQE9ge1CoVVL: -0.01400000 Waves 2023.05.10 13:15 [2571654] smart account 3N84Z7HWZfkuYnfGYpXjRU4MQE9ge1CoVVL > SELF 0.00000000 Waves
{ "type": 13, "id": "9ecQ4zLUaNoekxYFdEqKZt5ktiKWrjSg5Dqc9bD8Y22E", "fee": 1400000, "feeAssetId": null, "timestamp": 1683713720869, "version": 2, "chainId": 84, "sender": "3N84Z7HWZfkuYnfGYpXjRU4MQE9ge1CoVVL", "senderPublicKey": "ER6eHxtBYJ4JakpeheRtGgvT5AeP1S4g44VxoNJo14kd", "proofs": [ "Qw5Vk22FxJqNMgXBksCwQ9SPB6dfBvZZoiQ5DkTUC9w2rihM82joA3Xevrkq3C3K7rgXwb4CcbwFHBbuvFXnGeV" ], "script": "base64:BgLyEQgCEgcKBQgICAEIEgMKAQESABIAEgUKAwgICBIDCgEIEgMKAQgiA1NFUCIHd3JhcEVyciIDbXNnIgh0aHJvd0VyciIPZ2V0U3RyaW5nT3JGYWlsIgNrZXkiEGdldEJvb2xlYW5PckZhaWwiDmZhaWxFeGVjdXRlR2V0IgxiYXNlQXNzZXRTdHIiDnVzZXJBZGRyZXNzU3RyIgpnZXRUeElkU3RyIgtrZXlBc3NldENmZyIWa2V5TmV4dEludGVybmFsQXNzZXRJZCIMa2V5UHJpY2VMYXN0IhVpbnRlcm5hbEJhc2V0QXNzZXRTdHIiEmtleVRvcFVwTGFzdEhlaWdodCIGc2VuZGVyIg9rZXlQcmljZUhpc3RvcnkiAWgiCXRpbWVzdGFtcCIOa2V5VG90YWxMb2NrZWQiFGtleVRvdGFsTG9ja2VkQnlVc2VyIhRpbnRlcm5hbEJhc2VBc3NldFN0ciIfa2V5TWFwcGluZ3NJbnRlcm5hbDJiYXNlQXNzZXRJZCIRaW50ZXJuYWxCYXNlQXNzZXQiH2tleU1hcHBpbmdzQmFzZUFz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dGVzCQCRAwIIBQJiQwZwcm9vZnMAAAUCYkVy1JSy", "height": 2571654, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 3c8LrSoaaeaPPrz7LWei7RKqzd3noo2QDZbZ4y5tyWRQ Next: yTZtDZAofC3SJzcNKSoSiNyLhDGNRS2Mamrvt9cay6f Diff:
Old | New | Differences | |
---|---|---|---|
73 | 73 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
74 | 74 | ||
75 | 75 | ||
76 | - | func | |
76 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
77 | 77 | ||
78 | 78 | ||
79 | - | func | |
79 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
80 | 80 | case s: String => | |
81 | - | fromBase58String(s) | |
82 | - | case _: Unit => | |
83 | - | unit | |
81 | + | addressFromStringValue(s) | |
84 | 82 | case _ => | |
85 | - | | |
83 | + | this | |
86 | 84 | } | |
87 | 85 | ||
88 | 86 | ||
89 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
90 | - | case s: String => | |
91 | - | fromBase58String(s) | |
92 | - | case _: Unit => | |
93 | - | unit | |
94 | - | case _ => | |
95 | - | throw("Match error") | |
96 | - | } | |
87 | + | func managerPublicKeyOrUnit () = { | |
88 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
89 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
90 | + | case s: String => | |
91 | + | fromBase58String(s) | |
92 | + | case _: Unit => | |
93 | + | unit | |
94 | + | case _ => | |
95 | + | throw("Match error") | |
96 | + | } | |
97 | + | } | |
97 | 98 | ||
98 | 99 | ||
99 | 100 | let permissionDeniedError = throw("Permission denied") | |
379 | 380 | } | |
380 | 381 | ||
381 | 382 | ||
382 | - | ||
383 | - | @Callable(i) | |
384 | - | func setManager (pendingManagerPublicKey) = { | |
385 | - | let checkCaller = mustManager(i) | |
386 | - | if ((checkCaller == checkCaller)) | |
387 | - | then { | |
388 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
389 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
390 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
391 | - | else throw("Strict value is not equal to itself.") | |
392 | - | } | |
393 | - | else throw("Strict value is not equal to itself.") | |
394 | - | } | |
395 | - | ||
396 | - | ||
397 | - | ||
398 | - | @Callable(i) | |
399 | - | func confirmManager () = { | |
400 | - | let pm = pendingManagerPublicKeyOrUnit() | |
401 | - | let hasPM = if (isDefined(pm)) | |
402 | - | then true | |
403 | - | else throwErr("no pending manager") | |
404 | - | if ((hasPM == hasPM)) | |
405 | - | then { | |
406 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
407 | - | then true | |
408 | - | else throwErr("you are not pending manager") | |
409 | - | if ((checkPM == checkPM)) | |
410 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
411 | - | else throw("Strict value is not equal to itself.") | |
412 | - | } | |
413 | - | else throw("Strict value is not equal to itself.") | |
414 | - | } | |
415 | - | ||
416 | - | ||
417 | 383 | @Verifier(tx) | |
418 | 384 | func verify () = { | |
419 | 385 | let targetPublicKey = match managerPublicKeyOrUnit() { |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 6 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let SEP = "__" | |
5 | 5 | ||
6 | 6 | func wrapErr (msg) = makeString(["lp_staking.ride:", msg], " ") | |
7 | 7 | ||
8 | 8 | ||
9 | 9 | func throwErr (msg) = throw(wrapErr(msg)) | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringOrFail (key) = valueOrErrorMessage(getString(this, key), ("No data for this.key=" + key)) | |
13 | 13 | ||
14 | 14 | ||
15 | 15 | func getBooleanOrFail (key) = valueOrErrorMessage(getBoolean(this, key), ("No data for this.key=" + key)) | |
16 | 16 | ||
17 | 17 | ||
18 | 18 | func failExecuteGet (msg,baseAssetStr,userAddressStr,getTxIdStr) = throw(((((((msg + ": baseAssetStr=") + baseAssetStr) + " userAddressStr=") + userAddressStr) + " getTxIdStr=") + getTxIdStr)) | |
19 | 19 | ||
20 | 20 | ||
21 | 21 | func keyAssetCfg (baseAssetStr) = ("%s%s%s__config__asset__" + baseAssetStr) | |
22 | 22 | ||
23 | 23 | ||
24 | 24 | func keyNextInternalAssetId () = "%s__nextInternalAssetId" | |
25 | 25 | ||
26 | 26 | ||
27 | 27 | func keyPriceLast (internalBasetAssetStr) = ("%s%s%d__price__last__" + internalBasetAssetStr) | |
28 | 28 | ||
29 | 29 | ||
30 | 30 | func keyTopUpLastHeight (internalBasetAssetStr,sender) = makeString(["%s%s%s%d%s__topup__last__height", internalBasetAssetStr, sender], SEP) | |
31 | 31 | ||
32 | 32 | ||
33 | 33 | func keyPriceHistory (internalBasetAssetStr,h,timestamp) = makeString(["%s%s%d%d%d__price__history", internalBasetAssetStr, toString(h), toString(timestamp)], SEP) | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func keyTotalLocked (internalBasetAssetStr) = ("%s%s%d__total__locked__" + internalBasetAssetStr) | |
37 | 37 | ||
38 | 38 | ||
39 | 39 | func keyTotalLockedByUser (internalBaseAssetStr,userAddressStr) = makeString(["%s%s%d%s__total__locked", internalBaseAssetStr, userAddressStr], SEP) | |
40 | 40 | ||
41 | 41 | ||
42 | 42 | func keyMappingsInternal2baseAssetId (internalBaseAsset) = ("%s%s%d__mappings__internal2baseAssetId__" + toString(internalBaseAsset)) | |
43 | 43 | ||
44 | 44 | ||
45 | 45 | func keyMappingsBaseAsset2internalId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2internalId__" + baseAssetStr) | |
46 | 46 | ||
47 | 47 | ||
48 | 48 | func keyMappingsShare2baseAssetId (shareAssetStr) = ("%s%s%s__mappings__share2baseAssetId__" + shareAssetStr) | |
49 | 49 | ||
50 | 50 | ||
51 | 51 | func keyMappingsBaseAsset2shareId (baseAssetStr) = ("%s%s%s__mappings__baseAsset2shareId__" + baseAssetStr) | |
52 | 52 | ||
53 | 53 | ||
54 | 54 | func keyShutdownPutOperation (internalBaseAssetStr) = ("%s%s%d__shutdown__put__" + internalBaseAssetStr) | |
55 | 55 | ||
56 | 56 | ||
57 | 57 | func keyShutdown (internalBaseAssetStr) = ("%s%d__shutdown__" + internalBaseAssetStr) | |
58 | 58 | ||
59 | 59 | ||
60 | 60 | func keyShutdownManager (internalBaseAssetStr) = ("%s%s%d__shutdown__manager__" + internalBaseAssetStr) | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | let IdxCfgShareAssetId = 1 | |
64 | 64 | ||
65 | 65 | let IdxCfgInternalBaseAsset = 2 | |
66 | 66 | ||
67 | 67 | let IdxCfgDecimalsMultBothAssets = 3 | |
68 | 68 | ||
69 | 69 | let IdxCfgDecimalsMultPrice = 4 | |
70 | 70 | ||
71 | 71 | let IdxCfgGetDelayBlocks = 5 | |
72 | 72 | ||
73 | 73 | func keyManagerPublicKey () = "%s__managerPublicKey" | |
74 | 74 | ||
75 | 75 | ||
76 | - | func | |
76 | + | func keyManagerVaultAddress () = "%s__managerVaultAddress" | |
77 | 77 | ||
78 | 78 | ||
79 | - | func | |
79 | + | func getManagerVaultAddressOrThis () = match getString(keyManagerVaultAddress()) { | |
80 | 80 | case s: String => | |
81 | - | fromBase58String(s) | |
82 | - | case _: Unit => | |
83 | - | unit | |
81 | + | addressFromStringValue(s) | |
84 | 82 | case _ => | |
85 | - | | |
83 | + | this | |
86 | 84 | } | |
87 | 85 | ||
88 | 86 | ||
89 | - | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
90 | - | case s: String => | |
91 | - | fromBase58String(s) | |
92 | - | case _: Unit => | |
93 | - | unit | |
94 | - | case _ => | |
95 | - | throw("Match error") | |
96 | - | } | |
87 | + | func managerPublicKeyOrUnit () = { | |
88 | + | let managerVaultAddress = getManagerVaultAddressOrThis() | |
89 | + | match getString(managerVaultAddress, keyManagerPublicKey()) { | |
90 | + | case s: String => | |
91 | + | fromBase58String(s) | |
92 | + | case _: Unit => | |
93 | + | unit | |
94 | + | case _ => | |
95 | + | throw("Match error") | |
96 | + | } | |
97 | + | } | |
97 | 98 | ||
98 | 99 | ||
99 | 100 | let permissionDeniedError = throw("Permission denied") | |
100 | 101 | ||
101 | 102 | func mustThis (i) = if ((i.caller == this)) | |
102 | 103 | then true | |
103 | 104 | else permissionDeniedError | |
104 | 105 | ||
105 | 106 | ||
106 | 107 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
107 | 108 | case pk: ByteVector => | |
108 | 109 | if ((i.callerPublicKey == pk)) | |
109 | 110 | then true | |
110 | 111 | else permissionDeniedError | |
111 | 112 | case _: Unit => | |
112 | 113 | mustThis(i) | |
113 | 114 | case _ => | |
114 | 115 | throw("Match error") | |
115 | 116 | } | |
116 | 117 | ||
117 | 118 | ||
118 | 119 | let lpStakingPoolsContract = valueOrErrorMessage(addressFromString(valueOrErrorMessage(getString(makeString(["%s", "lpStakingPoolsContract"], SEP)), wrapErr("lp_staking_pools contract address is undefined"))), wrapErr("invalid lp_staking_pools contract address")) | |
119 | 120 | ||
120 | 121 | func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP) | |
121 | 122 | ||
122 | 123 | ||
123 | 124 | let IdxTotalLockedShare = 1 | |
124 | 125 | ||
125 | 126 | let IdxTotalLockedBase = 2 | |
126 | 127 | ||
127 | 128 | func dataTotalLocked (shareAssetAmount,baseAssetAmount) = makeString(["%d%d", toString(shareAssetAmount), toString(baseAssetAmount)], SEP) | |
128 | 129 | ||
129 | 130 | ||
130 | 131 | func readTotalLocked (key) = { | |
131 | 132 | let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0)), SEP) | |
132 | 133 | [-1, parseIntValue(totalLockedArray[IdxTotalLockedShare]), parseIntValue(totalLockedArray[IdxTotalLockedBase])] | |
133 | 134 | } | |
134 | 135 | ||
135 | 136 | ||
136 | 137 | func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP) | |
137 | 138 | ||
138 | 139 | ||
139 | 140 | let IdxOperStatus = 1 | |
140 | 141 | ||
141 | 142 | let IdxOperInAmount = 2 | |
142 | 143 | ||
143 | 144 | let IdxOperPrice = 3 | |
144 | 145 | ||
145 | 146 | let IdxOperOutAmount = 4 | |
146 | 147 | ||
147 | 148 | let IdxOperStartHeight = 5 | |
148 | 149 | ||
149 | 150 | let IdxOperStartTimestamp = 6 | |
150 | 151 | ||
151 | 152 | let IdxOperEndHeight = 7 | |
152 | 153 | ||
153 | 154 | let IdxOperEndTimestamp = 8 | |
154 | 155 | ||
155 | 156 | func privateDataOperationAllStrings (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp) = makeString(["%s%d%d%d%d%d%d%d", status, inAssetAmount, price, outAssetAmount, startHeight, startTimestamp, endHeight, endTimestamp], SEP) | |
156 | 157 | ||
157 | 158 | ||
158 | 159 | func dataOperation (status,inAssetAmount,price,outAssetAmount,startHeight,startTimestamp,endHeight,endTimestamp) = privateDataOperationAllStrings(status, toString(inAssetAmount), toString(price), toString(outAssetAmount), toString(startHeight), toString(startTimestamp), toString(endHeight), toString(endTimestamp)) | |
159 | 160 | ||
160 | 161 | ||
161 | 162 | func dataOperationExecutionUpdate (currOperArray,newStatus,newEndTimestamp) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], currOperArray[IdxOperPrice], currOperArray[IdxOperOutAmount], currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], currOperArray[IdxOperEndHeight], toString(newEndTimestamp)) | |
162 | 163 | ||
163 | 164 | ||
164 | 165 | func readAssetCfgOrFail (baseAssetStr) = { | |
165 | 166 | let key = keyAssetCfg(baseAssetStr) | |
166 | 167 | split(getStringOrFail(key), SEP) | |
167 | 168 | } | |
168 | 169 | ||
169 | 170 | ||
170 | 171 | func incrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = { | |
171 | 172 | let dataArray = readTotalLocked(key) | |
172 | 173 | StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] + shareAssetAmount), (dataArray[IdxTotalLockedBase] + baseAssetAmount))) | |
173 | 174 | } | |
174 | 175 | ||
175 | 176 | ||
176 | 177 | func decrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = { | |
177 | 178 | let dataArray = readTotalLocked(key) | |
178 | 179 | StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] - shareAssetAmount), (dataArray[IdxTotalLockedBase] - baseAssetAmount))) | |
179 | 180 | } | |
180 | 181 | ||
181 | 182 | ||
182 | 183 | func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = { | |
183 | 184 | let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr)) | |
184 | 185 | let totalLockedBaseAmount = totalLockedArray[IdxTotalLockedBase] | |
185 | 186 | let baseAssetBalance = assetBalance(this, baseAssetId) | |
186 | 187 | let baseAssetBalanceConsideringLock = ((baseAssetBalance - totalLockedBaseAmount) + topUpBaseAmount) | |
187 | 188 | if ((0 > baseAssetBalanceConsideringLock)) | |
188 | 189 | then throw(((("baseAssetBalanceConsideringLock < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceConsideringLock=") + toString(baseAssetBalanceConsideringLock))) | |
189 | 190 | else { | |
190 | 191 | let shareEmission = value(assetInfo(shareAssetId)).quantity | |
191 | 192 | let price = if ((shareEmission == 0)) | |
192 | 193 | then (1 * decimalsMultPrice) | |
193 | 194 | else fraction(baseAssetBalanceConsideringLock, decimalsMultPrice, shareEmission) | |
194 | 195 | $Tuple5(price, baseAssetBalance, totalLockedBaseAmount, baseAssetBalanceConsideringLock, shareEmission) | |
195 | 196 | } | |
196 | 197 | } | |
197 | 198 | ||
198 | 199 | ||
199 | 200 | func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultBothAssets, decimalsMultPrice) | |
200 | 201 | ||
201 | 202 | ||
202 | 203 | func privateCurrentSysParamsREST (baseAssetStr) = { | |
203 | 204 | let baseAssetId = fromBase58String(baseAssetStr) | |
204 | 205 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
205 | 206 | let shareAssetStr = cfgArray[IdxCfgShareAssetId] | |
206 | 207 | let shareAssetId = fromBase58String(shareAssetStr) | |
207 | 208 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
208 | 209 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
209 | 210 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
210 | 211 | let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice) | |
211 | 212 | $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("totalLockedBaseAmount", sysState._3), IntegerEntry("baseAssetBalanceConsideringLock", sysState._4), IntegerEntry("shareEmission", sysState._5)) | |
212 | 213 | } | |
213 | 214 | ||
214 | 215 | ||
215 | 216 | @Callable(i) | |
216 | 217 | func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = { | |
217 | 218 | let baseAssetId = fromBase58String(baseAssetStr) | |
218 | 219 | let decimals = value(assetInfo(baseAssetId)).decimals | |
219 | 220 | let checkCaller = mustManager(i) | |
220 | 221 | if ((checkCaller == checkCaller)) | |
221 | 222 | then if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress)) | |
222 | 223 | then throw("invalid shutdownManagerAddress") | |
223 | 224 | else if ((0 > getDelayinBlocks)) | |
224 | 225 | then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks))) | |
225 | 226 | else { | |
226 | 227 | let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, 1, decimals, true) | |
227 | 228 | let shareAssetId = calculateAssetId(shareAssetIssueAction) | |
228 | 229 | let shareAssetStr = toBase58String(shareAssetId) | |
229 | 230 | let decimalsMultPrice = ((100 * 1000) * 1000) | |
230 | 231 | let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN) | |
231 | 232 | let startPrice = (1 * decimalsMultPrice) | |
232 | 233 | let internalBaseAssettId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0) | |
233 | 234 | let internalBaseAssetStr = toString(internalBaseAssettId) | |
234 | 235 | [StringEntry(keyAssetCfg(baseAssetStr), dataAssetCfg(shareAssetStr, internalBaseAssetStr, decimalsMultBothAssets, decimalsMultPrice, getDelayinBlocks)), StringEntry(keyMappingsInternal2baseAssetId(internalBaseAssettId), baseAssetStr), StringEntry(keyMappingsBaseAsset2internalId(baseAssetStr), internalBaseAssetStr), StringEntry(keyMappingsShare2baseAssetId(shareAssetStr), baseAssetStr), StringEntry(keyMappingsBaseAsset2shareId(baseAssetStr), shareAssetStr), BooleanEntry(keyShutdownPutOperation(internalBaseAssetStr), false), StringEntry(keyShutdownManager(internalBaseAssetStr), shutdownManagerAddress), IntegerEntry(keyNextInternalAssetId(), (internalBaseAssettId + 1)), IntegerEntry(keyPriceLast(internalBaseAssetStr), startPrice), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), startPrice), shareAssetIssueAction, Burn(shareAssetId, 1)] | |
235 | 236 | } | |
236 | 237 | else throw("Strict value is not equal to itself.") | |
237 | 238 | } | |
238 | 239 | ||
239 | 240 | ||
240 | 241 | ||
241 | 242 | @Callable(i) | |
242 | 243 | func shutdownPut (internalBaseAssetId) = { | |
243 | 244 | let internalBaseAssetIdStr = toString(internalBaseAssetId) | |
244 | 245 | let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId)) | |
245 | 246 | let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr)) | |
246 | 247 | if ((1 > size(baseAssetIdStr))) | |
247 | 248 | then throw("invalid internalBaseAssetId") | |
248 | 249 | else if ((toString(i.caller) != shutdownManagerAddress)) | |
249 | 250 | then throw("access denied") | |
250 | 251 | else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)] | |
251 | 252 | } | |
252 | 253 | ||
253 | 254 | ||
254 | 255 | ||
255 | 256 | @Callable(i) | |
256 | 257 | func put () = { | |
257 | 258 | let pmt = value(i.payments[0]) | |
258 | 259 | let baseAssetId = value(pmt.assetId) | |
259 | 260 | let baseAssetStr = toBase58String(baseAssetId) | |
260 | 261 | let userAddressStr = toString(i.caller) | |
261 | 262 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
262 | 263 | let shareAssetStr = cfgArray[IdxCfgShareAssetId] | |
263 | 264 | let shareAssetId = fromBase58String(shareAssetStr) | |
264 | 265 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
265 | 266 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
266 | 267 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
267 | 268 | let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr)) | |
268 | 269 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
269 | 270 | if (if (isPutBlocked) | |
270 | 271 | then true | |
271 | 272 | else shutdown) | |
272 | 273 | then throw("put operation is blocked") | |
273 | 274 | else { | |
274 | 275 | let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1 | |
275 | 276 | let shareAssetAmount = fraction(pmt.amount, decimalsMultPrice, price) | |
276 | 277 | [Reissue(shareAssetId, shareAssetAmount, true), ScriptTransfer(i.caller, shareAssetAmount, shareAssetId), StringEntry(keyOperation("P", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)), dataOperation("FINISHED", pmt.amount, price, shareAssetAmount, height, lastBlock.timestamp, height, lastBlock.timestamp))] | |
277 | 278 | } | |
278 | 279 | } | |
279 | 280 | ||
280 | 281 | ||
281 | 282 | ||
282 | 283 | @Callable(i) | |
283 | 284 | func submitGetRequest () = { | |
284 | 285 | let pmt = value(i.payments[0]) | |
285 | 286 | let shareAssetId = value(pmt.assetId) | |
286 | 287 | let shareAssetStr = toBase58String(shareAssetId) | |
287 | 288 | let callerPubStr = toBase58String(i.callerPublicKey) | |
288 | 289 | let userAddress = i.caller | |
289 | 290 | let userAddressStr = toString(userAddress) | |
290 | 291 | let shareAssetAmount = pmt.amount | |
291 | 292 | let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr)) | |
292 | 293 | let baseAssetId = fromBase58String(baseAssetStr) | |
293 | 294 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
294 | 295 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
295 | 296 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
296 | 297 | let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks]) | |
297 | 298 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
298 | 299 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
299 | 300 | if (shutdown) | |
300 | 301 | then throw("operation is blocked") | |
301 | 302 | else { | |
302 | 303 | let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1 | |
303 | 304 | let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice) | |
304 | 305 | let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)) | |
305 | 306 | let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0) | |
306 | 307 | [Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)] | |
307 | 308 | } | |
308 | 309 | } | |
309 | 310 | ||
310 | 311 | ||
311 | 312 | ||
312 | 313 | @Callable(i) | |
313 | 314 | func executeGetRequest (baseAssetStr,userAddressStr,getTxIdStr) = { | |
314 | 315 | let userAddress = addressFromStringValue(userAddressStr) | |
315 | 316 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
316 | 317 | let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId]) | |
317 | 318 | let baseAssetId = fromBase58String(baseAssetStr) | |
318 | 319 | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
319 | 320 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
320 | 321 | if (shutdown) | |
321 | 322 | then throw("operation is blocked") | |
322 | 323 | else { | |
323 | 324 | let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr) | |
324 | 325 | let operationArray = split(getStringOrFail(operationKey), SEP) | |
325 | 326 | let status = operationArray[IdxOperStatus] | |
326 | 327 | let endHeight = parseIntValue(operationArray[IdxOperEndHeight]) | |
327 | 328 | let inShareAmount = parseIntValue(operationArray[IdxOperInAmount]) | |
328 | 329 | let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount]) | |
329 | 330 | if ((status != "PENDING")) | |
330 | 331 | then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr) | |
331 | 332 | else if ((endHeight > height)) | |
332 | 333 | then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr) | |
333 | 334 | else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)] | |
334 | 335 | } | |
335 | 336 | } | |
336 | 337 | ||
337 | 338 | ||
338 | 339 | ||
339 | 340 | @Callable(i) | |
340 | 341 | func topUpBalance (baseAssetStr) = { | |
341 | 342 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
342 | 343 | let pmt = value(i.payments[0]) | |
343 | 344 | let pmtAssetId = value(pmt.assetId) | |
344 | 345 | let pmtAssetStr = toBase58String(pmtAssetId) | |
345 | 346 | let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId]) | |
346 | 347 | let decimalsMultBothAssets = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets]) | |
347 | 348 | let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice]) | |
348 | 349 | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
349 | 350 | let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller)) | |
350 | 351 | let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0) | |
351 | 352 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
352 | 353 | if (shutdown) | |
353 | 354 | then throw("operation is blocked") | |
354 | 355 | else if ((baseAssetStr != pmtAssetStr)) | |
355 | 356 | then throw("attached payment's asset id is NOT matched passed baseAssetStr") | |
356 | 357 | else if ((size(i.payments) > 1)) | |
357 | 358 | then throw("only one payment can be attached") | |
358 | 359 | else if ((100 > (height - topUpLastHeight))) | |
359 | 360 | then throw("1 topUp per 100 blocks from the same address is allowed") | |
360 | 361 | else { | |
361 | 362 | let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1 | |
362 | 363 | [IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(topUpLastHeightKEY, height)] | |
363 | 364 | } | |
364 | 365 | } | |
365 | 366 | ||
366 | 367 | ||
367 | 368 | ||
368 | 369 | @Callable(i) | |
369 | 370 | func currentSysParamsREST (baseAssetStr) = { | |
370 | 371 | let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr) | |
371 | 372 | let price = sysStateTuple._1.value | |
372 | 373 | let decimalsMultPrice = sysStateTuple._2.value | |
373 | 374 | let baseAssetBalance = sysStateTuple._3.value | |
374 | 375 | let totalLockedBaseAmount = sysStateTuple._4.value | |
375 | 376 | let baseAssetBalanceConsideringLock = sysStateTuple._5.value | |
376 | 377 | let shareEmission = sysStateTuple._6.value | |
377 | 378 | let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceConsideringLock), toString(shareEmission), "endCurrentSysParamsREST"], SEP) | |
378 | 379 | throw(restData) | |
379 | 380 | } | |
380 | 381 | ||
381 | 382 | ||
382 | - | ||
383 | - | @Callable(i) | |
384 | - | func setManager (pendingManagerPublicKey) = { | |
385 | - | let checkCaller = mustManager(i) | |
386 | - | if ((checkCaller == checkCaller)) | |
387 | - | then { | |
388 | - | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
389 | - | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
390 | - | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
391 | - | else throw("Strict value is not equal to itself.") | |
392 | - | } | |
393 | - | else throw("Strict value is not equal to itself.") | |
394 | - | } | |
395 | - | ||
396 | - | ||
397 | - | ||
398 | - | @Callable(i) | |
399 | - | func confirmManager () = { | |
400 | - | let pm = pendingManagerPublicKeyOrUnit() | |
401 | - | let hasPM = if (isDefined(pm)) | |
402 | - | then true | |
403 | - | else throwErr("no pending manager") | |
404 | - | if ((hasPM == hasPM)) | |
405 | - | then { | |
406 | - | let checkPM = if ((i.callerPublicKey == value(pm))) | |
407 | - | then true | |
408 | - | else throwErr("you are not pending manager") | |
409 | - | if ((checkPM == checkPM)) | |
410 | - | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
411 | - | else throw("Strict value is not equal to itself.") | |
412 | - | } | |
413 | - | else throw("Strict value is not equal to itself.") | |
414 | - | } | |
415 | - | ||
416 | - | ||
417 | 383 | @Verifier(tx) | |
418 | 384 | func verify () = { | |
419 | 385 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
420 | 386 | case pk: ByteVector => | |
421 | 387 | pk | |
422 | 388 | case _: Unit => | |
423 | 389 | tx.senderPublicKey | |
424 | 390 | case _ => | |
425 | 391 | throw("Match error") | |
426 | 392 | } | |
427 | 393 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
428 | 394 | } | |
429 | 395 |
github/deemru/w8io/169f3d6 53.74 ms ◑