tx · 28DAJQDGWMLhKmHRTCR72v11NDteh36ZBGJh2syKuDFX 3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk: -0.01600000 Waves 2023.01.13 12:52 [2403024] smart account 3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk > SELF 0.00000000 Waves
{ "type": 13, "id": "28DAJQDGWMLhKmHRTCR72v11NDteh36ZBGJh2syKuDFX", "fee": 1600000, "feeAssetId": null, "timestamp": 1673603572199, "version": 1, "sender": "3MsC1Cit1aGB6qPW1hvkyGP2Gx79K1mtUAk", "senderPublicKey": "2rdeGwVMkuRfRdUgrYaekNmjnegHokhyDx1z6TJq525F", "proofs": [ "2Q41vxf6QMZh22TeKQByR7j7qj1gWNmPzamSJyHYrku1FCgaA4k3p8uV9hRR1ctH9TFBAzw32NGoeDRNDWHcFmrV" ], "script": "base64:BgLgEggCEgcKBQgICAEIEgMKAQESABIAEgUKAwgICBIDCgEIEgQKAgIBEgQKAgIBEgMKAQgSAwoBCBIAIgNTRVAiB3dyYXBFcnIiA21zZyIIdGhyb3dFcnIiD2dldFN0cmluZ09yRmFpbCIDa2V5IhBnZXRCb29sZWFuT3JGYWlsIg5mYWlsRXhlY3V0ZUdldCIMYmFzZUFzc2V0U3RyIg51c2VyQWRkcmVzc1N0ciIKZ2V0VHhJZFN0ciILa2V5QXNzZXRDZmciFmtleU5leHRJbnRlcm5hbEFzc2V0SWQiDGtleVByaWNlTGFzdCIVaW50ZXJuYWxCYXNldEFzc2V0U3RyIhJrZXlUb3BVcExhc3RIZWlnaHQiBnNlbmRlciIPa2V5UHJpY2VIaXN0b3J5IgFoIgl0aW1lc3RhbXAiDmtleVRvdGFsTG9ja2VkIhRrZXlUb3RhbExvY2tlZEJ5VXNlciIUaW50ZXJuYWxCYXNlQXNzZXRTdHIiH2tleU1hcHBpbmdzSW50ZXJuYWwyYmFzZUFzc2V0SWQiEWludGVybmFsQmFzZUFzc2V0Ih9rZXlNYXBwaW5nc0Jhc2VBc3N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EAmJKAwkAAAIIBQFUD2NhbGxlclB1YmxpY0tleQkBBXZhbHVlAQUCYkgGCQEBZAECG3lvdSBhcmUgbm90IHBlbmRpbmcgbWFuYWdlcgMJAAACBQJiSgUCYkoJAMwIAgkBC1N0cmluZ0VudHJ5AgkBAUwACQDYBAEJAQV2YWx1ZQEFAmJICQDMCAIJAQtEZWxldGVFbnRyeQEJAQFNAAUDbmlsCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuCQACAQIkU3RyaWN0IHZhbHVlIGlzIG5vdCBlcXVhbCB0byBpdHNlbGYuAQJiSwECYkwABAJiTQQBTwkBAU4AAwkAAQIFAU8CCkJ5dGVWZWN0b3IEAVYFAU8FAVYDCQABAgUBTwIEVW5pdAgFAmJLD3NlbmRlclB1YmxpY0tleQkAAgECC01hdGNoIGVycm9yCQD0AwMIBQJiSwlib2R5Qnl0ZXMJAJEDAggFAmJLBnByb29mcwAABQJiTR+MzJc=", "chainId": 84, "height": 2403024, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: F6qPjohVAwGiuyRayjuXD82KbqjuvVdmwMt87ZWHzvma Next: 8FurQAffAdR21eerYn7eGTv7kMunvoJhooZecsmtyTs4 Diff:
Old | New | Differences | |
---|---|---|---|
114 | 114 | throw("Match error") | |
115 | 115 | } | |
116 | 116 | ||
117 | + | ||
118 | + | 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")) | |
117 | 119 | ||
118 | 120 | func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP) | |
119 | 121 | ||
365 | 367 | ||
366 | 368 | @Callable(i) | |
367 | 369 | func emit (assetId,amount) = { | |
368 | - | 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")) | |
369 | 370 | let checks = [if ((i.caller == lpStakingPoolsContract)) | |
370 | 371 | then true | |
371 | 372 | else throwErr("permission denied"), if ((amount > 0)) | |
378 | 379 | let isReissuable = true | |
379 | 380 | $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount) | |
380 | 381 | } | |
382 | + | else throw("Strict value is not equal to itself.") | |
383 | + | } | |
384 | + | ||
385 | + | ||
386 | + | ||
387 | + | @Callable(i) | |
388 | + | func burn (assetId,amount) = { | |
389 | + | let checks = [if ((i.caller == lpStakingPoolsContract)) | |
390 | + | then true | |
391 | + | else throwErr("permission denied"), if ((amount > 0)) | |
392 | + | then true | |
393 | + | else throwErr("invalid amount to burn"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit)) | |
394 | + | then true | |
395 | + | else throwErr("invalid assetId")] | |
396 | + | if ((checks == checks)) | |
397 | + | then $Tuple2([Burn(assetId, amount)], amount) | |
381 | 398 | else throw("Strict value is not equal to itself.") | |
382 | 399 | } | |
383 | 400 |
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 | 76 | func keyPendingManagerPublicKey () = "%s__pendingManagerPublicKey" | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func managerPublicKeyOrUnit () = match getString(keyManagerPublicKey()) { | |
80 | 80 | case s: String => | |
81 | 81 | fromBase58String(s) | |
82 | 82 | case _: Unit => | |
83 | 83 | unit | |
84 | 84 | case _ => | |
85 | 85 | throw("Match error") | |
86 | 86 | } | |
87 | 87 | ||
88 | 88 | ||
89 | 89 | func pendingManagerPublicKeyOrUnit () = match getString(keyPendingManagerPublicKey()) { | |
90 | 90 | case s: String => | |
91 | 91 | fromBase58String(s) | |
92 | 92 | case _: Unit => | |
93 | 93 | unit | |
94 | 94 | case _ => | |
95 | 95 | throw("Match error") | |
96 | 96 | } | |
97 | 97 | ||
98 | 98 | ||
99 | 99 | let permissionDeniedError = throw("Permission denied") | |
100 | 100 | ||
101 | 101 | func mustThis (i) = if ((i.caller == this)) | |
102 | 102 | then true | |
103 | 103 | else permissionDeniedError | |
104 | 104 | ||
105 | 105 | ||
106 | 106 | func mustManager (i) = match managerPublicKeyOrUnit() { | |
107 | 107 | case pk: ByteVector => | |
108 | 108 | if ((i.callerPublicKey == pk)) | |
109 | 109 | then true | |
110 | 110 | else permissionDeniedError | |
111 | 111 | case _: Unit => | |
112 | 112 | mustThis(i) | |
113 | 113 | case _ => | |
114 | 114 | throw("Match error") | |
115 | 115 | } | |
116 | 116 | ||
117 | + | ||
118 | + | 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")) | |
117 | 119 | ||
118 | 120 | func dataAssetCfg (shareAssetStr,internalBaseAssetStr,decimalsMultBothAssets,decimalsMultPrice,getDelayInBlocks) = makeString(["%s%d%d%d%d", shareAssetStr, internalBaseAssetStr, toString(decimalsMultBothAssets), toString(decimalsMultPrice), toString(getDelayInBlocks)], SEP) | |
119 | 121 | ||
120 | 122 | ||
121 | 123 | let IdxTotalLockedShare = 1 | |
122 | 124 | ||
123 | 125 | let IdxTotalLockedBase = 2 | |
124 | 126 | ||
125 | 127 | func dataTotalLocked (shareAssetAmount,baseAssetAmount) = makeString(["%d%d", toString(shareAssetAmount), toString(baseAssetAmount)], SEP) | |
126 | 128 | ||
127 | 129 | ||
128 | 130 | func readTotalLocked (key) = { | |
129 | 131 | let totalLockedArray = split(valueOrElse(getString(this, key), dataTotalLocked(0, 0)), SEP) | |
130 | 132 | [-1, parseIntValue(totalLockedArray[IdxTotalLockedShare]), parseIntValue(totalLockedArray[IdxTotalLockedBase])] | |
131 | 133 | } | |
132 | 134 | ||
133 | 135 | ||
134 | 136 | func keyOperation (operationType,internalBaseAssetStr,userAddress,txId) = makeString(["%s%d%s%s", operationType, internalBaseAssetStr, userAddress, txId], SEP) | |
135 | 137 | ||
136 | 138 | ||
137 | 139 | let IdxOperStatus = 1 | |
138 | 140 | ||
139 | 141 | let IdxOperInAmount = 2 | |
140 | 142 | ||
141 | 143 | let IdxOperPrice = 3 | |
142 | 144 | ||
143 | 145 | let IdxOperOutAmount = 4 | |
144 | 146 | ||
145 | 147 | let IdxOperStartHeight = 5 | |
146 | 148 | ||
147 | 149 | let IdxOperStartTimestamp = 6 | |
148 | 150 | ||
149 | 151 | let IdxOperEndHeight = 7 | |
150 | 152 | ||
151 | 153 | let IdxOperEndTimestamp = 8 | |
152 | 154 | ||
153 | 155 | 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) | |
154 | 156 | ||
155 | 157 | ||
156 | 158 | 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)) | |
157 | 159 | ||
158 | 160 | ||
159 | 161 | func dataOperationExecutionUpdate (currOperArray,newStatus,newEndTimestamp) = privateDataOperationAllStrings(newStatus, currOperArray[IdxOperInAmount], currOperArray[IdxOperPrice], currOperArray[IdxOperOutAmount], currOperArray[IdxOperStartHeight], currOperArray[IdxOperStartTimestamp], currOperArray[IdxOperEndHeight], toString(newEndTimestamp)) | |
160 | 162 | ||
161 | 163 | ||
162 | 164 | func readAssetCfgOrFail (baseAssetStr) = { | |
163 | 165 | let key = keyAssetCfg(baseAssetStr) | |
164 | 166 | split(getStringOrFail(key), SEP) | |
165 | 167 | } | |
166 | 168 | ||
167 | 169 | ||
168 | 170 | func incrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = { | |
169 | 171 | let dataArray = readTotalLocked(key) | |
170 | 172 | StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] + shareAssetAmount), (dataArray[IdxTotalLockedBase] + baseAssetAmount))) | |
171 | 173 | } | |
172 | 174 | ||
173 | 175 | ||
174 | 176 | func decrementTotalLocked (key,shareAssetAmount,baseAssetAmount) = { | |
175 | 177 | let dataArray = readTotalLocked(key) | |
176 | 178 | StringEntry(key, dataTotalLocked((dataArray[IdxTotalLockedShare] - shareAssetAmount), (dataArray[IdxTotalLockedBase] - baseAssetAmount))) | |
177 | 179 | } | |
178 | 180 | ||
179 | 181 | ||
180 | 182 | func genericCalcPrice (internalBaseAssetStr,baseAssetId,topUpBaseAmount,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = { | |
181 | 183 | let totalLockedArray = readTotalLocked(keyTotalLocked(internalBaseAssetStr)) | |
182 | 184 | let totalLockedBaseAmount = totalLockedArray[IdxTotalLockedBase] | |
183 | 185 | let baseAssetBalance = assetBalance(this, baseAssetId) | |
184 | 186 | let baseAssetBalanceConsideringLock = ((baseAssetBalance - totalLockedBaseAmount) + topUpBaseAmount) | |
185 | 187 | if ((0 > baseAssetBalanceConsideringLock)) | |
186 | 188 | then throw(((("baseAssetBalanceConsideringLock < 0: baseAssetBalance=" + toString(baseAssetBalance)) + " baseAssetBalanceConsideringLock=") + toString(baseAssetBalanceConsideringLock))) | |
187 | 189 | else { | |
188 | 190 | let shareEmission = value(assetInfo(shareAssetId)).quantity | |
189 | 191 | let price = if ((shareEmission == 0)) | |
190 | 192 | then (1 * decimalsMultPrice) | |
191 | 193 | else fraction(baseAssetBalanceConsideringLock, decimalsMultPrice, shareEmission) | |
192 | 194 | $Tuple5(price, baseAssetBalance, totalLockedBaseAmount, baseAssetBalanceConsideringLock, shareEmission) | |
193 | 195 | } | |
194 | 196 | } | |
195 | 197 | ||
196 | 198 | ||
197 | 199 | func calcPrice (internalBaseAssetStr,baseAssetId,shareAssetId,decimalsMultBothAssets,decimalsMultPrice) = genericCalcPrice(internalBaseAssetStr, baseAssetId, 0, shareAssetId, decimalsMultBothAssets, decimalsMultPrice) | |
198 | 200 | ||
199 | 201 | ||
200 | 202 | func privateCurrentSysParamsREST (baseAssetStr) = { | |
201 | 203 | let baseAssetId = fromBase58String(baseAssetStr) | |
202 | 204 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
203 | 205 | let shareAssetStr = cfgArray[IdxCfgShareAssetId] | |
204 | 206 | let shareAssetId = fromBase58String(shareAssetStr) | |
205 | 207 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
206 | 208 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
207 | 209 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
208 | 210 | let sysState = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice) | |
209 | 211 | $Tuple6(IntegerEntry("price", sysState._1), IntegerEntry("decimalsMultPrice", decimalsMultPrice), IntegerEntry("baseAssetBalance", sysState._2), IntegerEntry("totalLockedBaseAmount", sysState._3), IntegerEntry("baseAssetBalanceConsideringLock", sysState._4), IntegerEntry("shareEmission", sysState._5)) | |
210 | 212 | } | |
211 | 213 | ||
212 | 214 | ||
213 | 215 | @Callable(i) | |
214 | 216 | func adminRegisterAsset (baseAssetStr,shareAssetName,shareAssetDescr,getDelayinBlocks,shutdownManagerAddress) = { | |
215 | 217 | let baseAssetId = fromBase58String(baseAssetStr) | |
216 | 218 | let decimals = value(assetInfo(baseAssetId)).decimals | |
217 | 219 | let checkCaller = mustManager(i) | |
218 | 220 | if ((checkCaller == checkCaller)) | |
219 | 221 | then if ((toString(addressFromStringValue(shutdownManagerAddress)) != shutdownManagerAddress)) | |
220 | 222 | then throw("invalid shutdownManagerAddress") | |
221 | 223 | else if ((0 > getDelayinBlocks)) | |
222 | 224 | then throw(("invalid getDelayinBlocks=" + toString(getDelayinBlocks))) | |
223 | 225 | else { | |
224 | 226 | let shareAssetIssueAction = Issue(shareAssetName, shareAssetDescr, 1, decimals, true) | |
225 | 227 | let shareAssetId = calculateAssetId(shareAssetIssueAction) | |
226 | 228 | let shareAssetStr = toBase58String(shareAssetId) | |
227 | 229 | let decimalsMultPrice = ((100 * 1000) * 1000) | |
228 | 230 | let decimalsMultBothAssets = pow(10, 0, decimals, 0, 0, DOWN) | |
229 | 231 | let startPrice = (1 * decimalsMultPrice) | |
230 | 232 | let internalBaseAssettId = valueOrElse(getInteger(this, keyNextInternalAssetId()), 0) | |
231 | 233 | let internalBaseAssetStr = toString(internalBaseAssettId) | |
232 | 234 | [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)] | |
233 | 235 | } | |
234 | 236 | else throw("Strict value is not equal to itself.") | |
235 | 237 | } | |
236 | 238 | ||
237 | 239 | ||
238 | 240 | ||
239 | 241 | @Callable(i) | |
240 | 242 | func shutdownPut (internalBaseAssetId) = { | |
241 | 243 | let internalBaseAssetIdStr = toString(internalBaseAssetId) | |
242 | 244 | let baseAssetIdStr = getStringOrFail(keyMappingsInternal2baseAssetId(internalBaseAssetId)) | |
243 | 245 | let shutdownManagerAddress = getStringOrFail(keyShutdownManager(internalBaseAssetIdStr)) | |
244 | 246 | if ((1 > size(baseAssetIdStr))) | |
245 | 247 | then throw("invalid internalBaseAssetId") | |
246 | 248 | else if ((toString(i.caller) != shutdownManagerAddress)) | |
247 | 249 | then throw("access denied") | |
248 | 250 | else [BooleanEntry(keyShutdownPutOperation(toString(internalBaseAssetId)), true)] | |
249 | 251 | } | |
250 | 252 | ||
251 | 253 | ||
252 | 254 | ||
253 | 255 | @Callable(i) | |
254 | 256 | func put () = { | |
255 | 257 | let pmt = value(i.payments[0]) | |
256 | 258 | let baseAssetId = value(pmt.assetId) | |
257 | 259 | let baseAssetStr = toBase58String(baseAssetId) | |
258 | 260 | let userAddressStr = toString(i.caller) | |
259 | 261 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
260 | 262 | let shareAssetStr = cfgArray[IdxCfgShareAssetId] | |
261 | 263 | let shareAssetId = fromBase58String(shareAssetStr) | |
262 | 264 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
263 | 265 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
264 | 266 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
265 | 267 | let isPutBlocked = getBooleanOrFail(keyShutdownPutOperation(internalBaseAssetStr)) | |
266 | 268 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
267 | 269 | if (if (isPutBlocked) | |
268 | 270 | then true | |
269 | 271 | else shutdown) | |
270 | 272 | then throw("put operation is blocked") | |
271 | 273 | else { | |
272 | 274 | let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1 | |
273 | 275 | let shareAssetAmount = fraction(pmt.amount, decimalsMultPrice, price) | |
274 | 276 | [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))] | |
275 | 277 | } | |
276 | 278 | } | |
277 | 279 | ||
278 | 280 | ||
279 | 281 | ||
280 | 282 | @Callable(i) | |
281 | 283 | func submitGetRequest () = { | |
282 | 284 | let pmt = value(i.payments[0]) | |
283 | 285 | let shareAssetId = value(pmt.assetId) | |
284 | 286 | let shareAssetStr = toBase58String(shareAssetId) | |
285 | 287 | let callerPubStr = toBase58String(i.callerPublicKey) | |
286 | 288 | let userAddress = i.caller | |
287 | 289 | let userAddressStr = toString(userAddress) | |
288 | 290 | let shareAssetAmount = pmt.amount | |
289 | 291 | let baseAssetStr = getStringOrFail(keyMappingsShare2baseAssetId(shareAssetStr)) | |
290 | 292 | let baseAssetId = fromBase58String(baseAssetStr) | |
291 | 293 | let cfgArray = readAssetCfgOrFail(baseAssetStr) | |
292 | 294 | let decimalsMultBothAssets = parseIntValue(cfgArray[IdxCfgDecimalsMultBothAssets]) | |
293 | 295 | let decimalsMultPrice = parseIntValue(cfgArray[IdxCfgDecimalsMultPrice]) | |
294 | 296 | let getDelayBlocks = parseIntValue(cfgArray[IdxCfgGetDelayBlocks]) | |
295 | 297 | let internalBaseAssetStr = cfgArray[IdxCfgInternalBaseAsset] | |
296 | 298 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
297 | 299 | if (shutdown) | |
298 | 300 | then throw("operation is blocked") | |
299 | 301 | else { | |
300 | 302 | let price = calcPrice(internalBaseAssetStr, baseAssetId, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1 | |
301 | 303 | let baseAssetAmount = fraction(shareAssetAmount, price, decimalsMultPrice) | |
302 | 304 | let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, toBase58String(i.transactionId)) | |
303 | 305 | let operationData = dataOperation("PENDING", shareAssetAmount, price, baseAssetAmount, height, lastBlock.timestamp, (height + getDelayBlocks), 0) | |
304 | 306 | [Burn(shareAssetId, shareAssetAmount), StringEntry(operationKey, operationData), incrementTotalLocked(keyTotalLocked(internalBaseAssetStr), shareAssetAmount, baseAssetAmount), incrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), shareAssetAmount, baseAssetAmount)] | |
305 | 307 | } | |
306 | 308 | } | |
307 | 309 | ||
308 | 310 | ||
309 | 311 | ||
310 | 312 | @Callable(i) | |
311 | 313 | func executeGetRequest (baseAssetStr,userAddressStr,getTxIdStr) = { | |
312 | 314 | let userAddress = addressFromStringValue(userAddressStr) | |
313 | 315 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
314 | 316 | let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId]) | |
315 | 317 | let baseAssetId = fromBase58String(baseAssetStr) | |
316 | 318 | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
317 | 319 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
318 | 320 | if (shutdown) | |
319 | 321 | then throw("operation is blocked") | |
320 | 322 | else { | |
321 | 323 | let operationKey = keyOperation("G", internalBaseAssetStr, userAddressStr, getTxIdStr) | |
322 | 324 | let operationArray = split(getStringOrFail(operationKey), SEP) | |
323 | 325 | let status = operationArray[IdxOperStatus] | |
324 | 326 | let endHeight = parseIntValue(operationArray[IdxOperEndHeight]) | |
325 | 327 | let inShareAmount = parseIntValue(operationArray[IdxOperInAmount]) | |
326 | 328 | let outBaseAmount = parseIntValue(operationArray[IdxOperOutAmount]) | |
327 | 329 | if ((status != "PENDING")) | |
328 | 330 | then failExecuteGet("Status is not PENDING", baseAssetStr, userAddressStr, getTxIdStr) | |
329 | 331 | else if ((endHeight > height)) | |
330 | 332 | then failExecuteGet(((("EndHeight[" + toString(endHeight)) + "] > ") + toString(height)), baseAssetStr, userAddressStr, getTxIdStr) | |
331 | 333 | else [ScriptTransfer(userAddress, outBaseAmount, baseAssetId), StringEntry(operationKey, dataOperationExecutionUpdate(operationArray, "FINISHED", lastBlock.timestamp)), decrementTotalLocked(keyTotalLocked(internalBaseAssetStr), inShareAmount, outBaseAmount), decrementTotalLocked(keyTotalLockedByUser(internalBaseAssetStr, userAddressStr), inShareAmount, outBaseAmount)] | |
332 | 334 | } | |
333 | 335 | } | |
334 | 336 | ||
335 | 337 | ||
336 | 338 | ||
337 | 339 | @Callable(i) | |
338 | 340 | func topUpBalance (baseAssetStr) = { | |
339 | 341 | let assetCfgArray = readAssetCfgOrFail(baseAssetStr) | |
340 | 342 | let pmt = value(i.payments[0]) | |
341 | 343 | let pmtAssetId = value(pmt.assetId) | |
342 | 344 | let pmtAssetStr = toBase58String(pmtAssetId) | |
343 | 345 | let shareAssetId = fromBase58String(assetCfgArray[IdxCfgShareAssetId]) | |
344 | 346 | let decimalsMultBothAssets = parseIntValue(assetCfgArray[IdxCfgDecimalsMultBothAssets]) | |
345 | 347 | let decimalsMultPrice = parseIntValue(assetCfgArray[IdxCfgDecimalsMultPrice]) | |
346 | 348 | let internalBaseAssetStr = assetCfgArray[IdxCfgInternalBaseAsset] | |
347 | 349 | let topUpLastHeightKEY = keyTopUpLastHeight(internalBaseAssetStr, toString(i.caller)) | |
348 | 350 | let topUpLastHeight = valueOrElse(getInteger(this, topUpLastHeightKEY), 0) | |
349 | 351 | let shutdown = valueOrElse(getBoolean(keyShutdown(internalBaseAssetStr)), false) | |
350 | 352 | if (shutdown) | |
351 | 353 | then throw("operation is blocked") | |
352 | 354 | else if ((baseAssetStr != pmtAssetStr)) | |
353 | 355 | then throw("attached payment's asset id is NOT matched passed baseAssetStr") | |
354 | 356 | else if ((size(i.payments) > 1)) | |
355 | 357 | then throw("only one payment can be attached") | |
356 | 358 | else if ((100 > (height - topUpLastHeight))) | |
357 | 359 | then throw("1 topUp per 100 blocks from the same address is allowed") | |
358 | 360 | else { | |
359 | 361 | let price = genericCalcPrice(internalBaseAssetStr, pmtAssetId, pmt.amount, shareAssetId, decimalsMultBothAssets, decimalsMultPrice)._1 | |
360 | 362 | [IntegerEntry(keyPriceLast(internalBaseAssetStr), price), IntegerEntry(keyPriceHistory(internalBaseAssetStr, height, lastBlock.timestamp), price), IntegerEntry(topUpLastHeightKEY, height)] | |
361 | 363 | } | |
362 | 364 | } | |
363 | 365 | ||
364 | 366 | ||
365 | 367 | ||
366 | 368 | @Callable(i) | |
367 | 369 | func emit (assetId,amount) = { | |
368 | - | 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")) | |
369 | 370 | let checks = [if ((i.caller == lpStakingPoolsContract)) | |
370 | 371 | then true | |
371 | 372 | else throwErr("permission denied"), if ((amount > 0)) | |
372 | 373 | then true | |
373 | 374 | else throwErr("invalid amount to emit"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit)) | |
374 | 375 | then true | |
375 | 376 | else throwErr("invalid assetId")] | |
376 | 377 | if ((checks == checks)) | |
377 | 378 | then { | |
378 | 379 | let isReissuable = true | |
379 | 380 | $Tuple2([Reissue(assetId, amount, isReissuable), ScriptTransfer(lpStakingPoolsContract, amount, assetId)], amount) | |
380 | 381 | } | |
382 | + | else throw("Strict value is not equal to itself.") | |
383 | + | } | |
384 | + | ||
385 | + | ||
386 | + | ||
387 | + | @Callable(i) | |
388 | + | func burn (assetId,amount) = { | |
389 | + | let checks = [if ((i.caller == lpStakingPoolsContract)) | |
390 | + | then true | |
391 | + | else throwErr("permission denied"), if ((amount > 0)) | |
392 | + | then true | |
393 | + | else throwErr("invalid amount to burn"), if ((getString(keyMappingsShare2baseAssetId(toBase58String(assetId))) != unit)) | |
394 | + | then true | |
395 | + | else throwErr("invalid assetId")] | |
396 | + | if ((checks == checks)) | |
397 | + | then $Tuple2([Burn(assetId, amount)], amount) | |
381 | 398 | else throw("Strict value is not equal to itself.") | |
382 | 399 | } | |
383 | 400 | ||
384 | 401 | ||
385 | 402 | ||
386 | 403 | @Callable(i) | |
387 | 404 | func currentSysParamsREST (baseAssetStr) = { | |
388 | 405 | let sysStateTuple = privateCurrentSysParamsREST(baseAssetStr) | |
389 | 406 | let price = sysStateTuple._1.value | |
390 | 407 | let decimalsMultPrice = sysStateTuple._2.value | |
391 | 408 | let baseAssetBalance = sysStateTuple._3.value | |
392 | 409 | let totalLockedBaseAmount = sysStateTuple._4.value | |
393 | 410 | let baseAssetBalanceConsideringLock = sysStateTuple._5.value | |
394 | 411 | let shareEmission = sysStateTuple._6.value | |
395 | 412 | let restData = makeString(["startCurrentSysParamsREST", toString(price), toString(decimalsMultPrice), toString(baseAssetBalance), toString(totalLockedBaseAmount), toString(baseAssetBalanceConsideringLock), toString(shareEmission), "endCurrentSysParamsREST"], SEP) | |
396 | 413 | throw(restData) | |
397 | 414 | } | |
398 | 415 | ||
399 | 416 | ||
400 | 417 | ||
401 | 418 | @Callable(i) | |
402 | 419 | func setManager (pendingManagerPublicKey) = { | |
403 | 420 | let checkCaller = mustManager(i) | |
404 | 421 | if ((checkCaller == checkCaller)) | |
405 | 422 | then { | |
406 | 423 | let checkManagerPublicKey = fromBase58String(pendingManagerPublicKey) | |
407 | 424 | if ((checkManagerPublicKey == checkManagerPublicKey)) | |
408 | 425 | then [StringEntry(keyPendingManagerPublicKey(), pendingManagerPublicKey)] | |
409 | 426 | else throw("Strict value is not equal to itself.") | |
410 | 427 | } | |
411 | 428 | else throw("Strict value is not equal to itself.") | |
412 | 429 | } | |
413 | 430 | ||
414 | 431 | ||
415 | 432 | ||
416 | 433 | @Callable(i) | |
417 | 434 | func confirmManager () = { | |
418 | 435 | let pm = pendingManagerPublicKeyOrUnit() | |
419 | 436 | let hasPM = if (isDefined(pm)) | |
420 | 437 | then true | |
421 | 438 | else throwErr("no pending manager") | |
422 | 439 | if ((hasPM == hasPM)) | |
423 | 440 | then { | |
424 | 441 | let checkPM = if ((i.callerPublicKey == value(pm))) | |
425 | 442 | then true | |
426 | 443 | else throwErr("you are not pending manager") | |
427 | 444 | if ((checkPM == checkPM)) | |
428 | 445 | then [StringEntry(keyManagerPublicKey(), toBase58String(value(pm))), DeleteEntry(keyPendingManagerPublicKey())] | |
429 | 446 | else throw("Strict value is not equal to itself.") | |
430 | 447 | } | |
431 | 448 | else throw("Strict value is not equal to itself.") | |
432 | 449 | } | |
433 | 450 | ||
434 | 451 | ||
435 | 452 | @Verifier(tx) | |
436 | 453 | func verify () = { | |
437 | 454 | let targetPublicKey = match managerPublicKeyOrUnit() { | |
438 | 455 | case pk: ByteVector => | |
439 | 456 | pk | |
440 | 457 | case _: Unit => | |
441 | 458 | tx.senderPublicKey | |
442 | 459 | case _ => | |
443 | 460 | throw("Match error") | |
444 | 461 | } | |
445 | 462 | sigVerify(tx.bodyBytes, tx.proofs[0], targetPublicKey) | |
446 | 463 | } | |
447 | 464 |
github/deemru/w8io/026f985 55.09 ms ◑