tx · 9NMBKLuANdaCzvQ9vzgrvfLYDUYntixxGqEbXK8Y7AUk 3MrtHeXquGPcRd3YjJQHfY1Ss6oSDpfxGuL: -0.01400000 Waves 2019.09.17 18:25 [680420] smart account 3MrtHeXquGPcRd3YjJQHfY1Ss6oSDpfxGuL > SELF 0.00000000 Waves
{ "type": 13, "id": "9NMBKLuANdaCzvQ9vzgrvfLYDUYntixxGqEbXK8Y7AUk", "fee": 1400000, "feeAssetId": null, "timestamp": 1568733931878, "version": 1, "sender": "3MrtHeXquGPcRd3YjJQHfY1Ss6oSDpfxGuL", "senderPublicKey": "3nmDHSgwcZ79tNbGjppGBY9MbYm4qLZEJcZ32D2WmxkG", "proofs": [ "2TANbRqRm7QiBFPw7azWSgMeaEAAnMDoJqJdSxF79ofTmDDEYM9QaHw6GTd9VarECXApziAL5dqaNxHNHr9Vmwgv" ], "script": "base64:AAIDAAAAAAAAAAAAAABGAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAAAAAAAAAAAAAQAAAA5nZXRTdHJpbmdCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFhBQAAAAckbWF0Y2gwBQAAAAFhAgAAAAABAAAADGdldEJvb2xCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGwAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAHQm9vbGVhbgQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQcBAAAAGGdldE51bWJlckJ5S2V5QW5kQWRkcmVzcwAAAAIAAAAHYWRkcmVzcwAAAANrZXkEAA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Kb3JkZXJUb3RhbAUAAAAHc3VycGx1cwUAAAAPbmV1dHJpbm9Bc3NldElkBQAAAANuaWwAAAABaQEAAAAOY3JlYXRlU25hcHNob3QAAAAABAAAAApuZXdTdXJwbHVzCQAAZQAAAAIJAQAAABZjb252ZXJ0V2F2ZXNUb05ldXRyaW5vAAAAAQUAAAAHcmVzZXJ2ZQUAAAAObmV1dHJpbm9TdXBwbHkDAwkAAGcAAAACAAAAAAAAAAAABQAAAApuZXdTdXJwbHVzBgkAAGYAAAACBQAAAA5NaW5pbWFsU3VycGx1cwUAAAAKbmV3U3VycGx1cwkAAAIAAAABAgAAABdzdXJwbHVzIGlzIGxlc3MgbWluaW11bQMJAABnAAAAAgUAAAAGaGVpZ2h0CQAAZAAAAAIFAAAADXNuYXBzaG90QmxvY2sFAAAAE1NuYXBzaG90QmxvY2tFeHBpcmUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAFE9yZGVyYm9va1NuYXBzaG90S2V5BQAAAAlvcmRlcmJvb2sJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAGU9yZGVyYm9va1RvdGFsU25hcHNob3RLZXkFAAAADm9yZGVyYm9va1RvdGFsCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACBQAAABBTbmFwc2hvdEJsb2NrS2V5BQAAAAZoZWlnaHQJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAAClN1cnBsdXNLZXkFAAAAB3N1cnBsdXMFAAAAA25pbAkAAAIAAAABAgAAABllcnJvciBjcmVhdGUgbmV3IHNuYXBzaG90AAAAAF2xGik=", "chainId": 84, "height": 680420, "spentComplexity": 0 } View: original | compacted Prev: 5DCZNK7ymFBCFmcm8g2hP6X1hrPiLFE3Qifpcfek5F24 Next: 3YATXx91kkV91111EzMTQPFrshWevWQvWik5TwNDsQHp Full:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | func getNumberByKey (key) = match getInteger(this, key) { | |
5 | 5 | case a: Int => | |
6 | 6 | a | |
7 | 7 | case _ => | |
8 | 8 | 0 | |
9 | 9 | } | |
10 | 10 | ||
11 | 11 | ||
12 | 12 | func getStringByKey (key) = match getString(this, key) { | |
13 | 13 | case a: String => | |
14 | 14 | a | |
15 | 15 | case _ => | |
16 | 16 | "" | |
17 | 17 | } | |
18 | 18 | ||
19 | 19 | ||
20 | 20 | func getBoolByKey (key) = match getBoolean(this, key) { | |
21 | 21 | case a: Boolean => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | false | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getNumberByKeyAndAddress (address,key) = match getInteger(addressFromStringValue(address), key) { | |
29 | 29 | case a: Int => | |
30 | 30 | a | |
31 | 31 | case _ => | |
32 | 32 | 0 | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | func getStringByKeyAndAddress (address,key) = match getString(addressFromStringValue(address), key) { | |
37 | 37 | case a: String => | |
38 | 38 | a | |
39 | 39 | case _ => | |
40 | 40 | "" | |
41 | 41 | } | |
42 | 42 | ||
43 | 43 | ||
44 | 44 | func getBoolByKeyAndAddress (address,key) = match getBoolean(addressFromStringValue(address), key) { | |
45 | 45 | case a: Boolean => | |
46 | 46 | a | |
47 | 47 | case _ => | |
48 | 48 | false | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | let ListSplitSymbol = "_" | |
53 | 53 | ||
54 | 54 | let SnapshotBlockExpire = 5 | |
55 | 55 | ||
56 | 56 | let BalanceLockBlock = 2 | |
57 | 57 | ||
58 | 58 | let ListDataSplitSymbol = "+" | |
59 | 59 | ||
60 | 60 | let Wavelet = 100000000 | |
61 | 61 | ||
62 | 62 | let MinimalBondOrder = (10 * Wavelet) | |
63 | 63 | ||
64 | 64 | let MinimalSurplus = (10 * Wavelet) | |
65 | 65 | ||
66 | 66 | let ApplyBlockTimeout = 10 | |
67 | 67 | ||
68 | 68 | let LeaseContractKey = "lease_contract" | |
69 | 69 | ||
70 | 70 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
71 | 71 | ||
72 | 72 | let BondAssetIdKey = "bond_asset_id" | |
73 | 73 | ||
74 | 74 | let AuctionContractKey = "auction_contract" | |
75 | 75 | ||
76 | 76 | let PriceKey = "price" | |
77 | 77 | ||
78 | 78 | let NeutrinoBalanceKey = "neutrino_" | |
79 | 79 | ||
80 | 80 | let WavesBalanceKey = "waves_" | |
81 | 81 | ||
82 | 82 | let BalanceBlockKey = "balance_block_" | |
83 | 83 | ||
84 | 84 | let OrderbookKey = "orderbook" | |
85 | 85 | ||
86 | 86 | let OrderTotalKey = "order_total_" | |
87 | 87 | ||
88 | 88 | let OrderOwnerKey = "order_owner_" | |
89 | 89 | ||
90 | 90 | let OrderHeightKey = "order_height_" | |
91 | 91 | ||
92 | 92 | let OrderbookTotalKey = "orderbook_total" | |
93 | 93 | ||
94 | 94 | let OrderbookTotalSnapshotKey = "orderbook_total_snapshot" | |
95 | 95 | ||
96 | 96 | let SurplusKey = "surplus" | |
97 | 97 | ||
98 | 98 | let SnapshotBlockKey = "snapshot_block" | |
99 | 99 | ||
100 | 100 | let OrderbookSnapshotKey = "orderbook_snapshot" | |
101 | 101 | ||
102 | 102 | let BondGeneratedBlockKey = "bond_generated_block" | |
103 | 103 | ||
104 | 104 | let AccountSnapshotBlockKey = "account_snapshot_block_" | |
105 | 105 | ||
106 | 106 | let AccountSnapshotOwnerKey = "account_snapshot_owner_" | |
107 | 107 | ||
108 | 108 | let AccountSnapshotAmountKey = "account_snapshot_amount_" | |
109 | 109 | ||
110 | 110 | let AccountSnapshotNodeKey = "account_snapshot_node_" | |
111 | 111 | ||
112 | 112 | let SnapshotNodeBalanceKey = "snapshot_node_balance_" | |
113 | 113 | ||
114 | 114 | let NodeBalanceKey = "node_balance_" | |
115 | 115 | ||
116 | 116 | let IsSentNodeBalanceKey = "is_sent_node_balance_" | |
117 | 117 | ||
118 | 118 | let NodeProviderStatus = "node_status" | |
119 | 119 | ||
120 | 120 | let neutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey)) | |
121 | 121 | ||
122 | 122 | let price = getNumberByKey(PriceKey) | |
123 | 123 | ||
124 | 124 | let reserve = wavesBalance(this) | |
125 | 125 | ||
126 | 126 | let neutrinoSupply = { | |
127 | 127 | let info = extract(assetInfo(neutrinoAssetId)) | |
128 | 128 | (info.quantity - assetBalance(this, neutrinoAssetId)) | |
129 | 129 | } | |
130 | 130 | ||
131 | 131 | let orderbookTotal = getNumberByKey(OrderbookTotalKey) | |
132 | 132 | ||
133 | 133 | let orderbook = getStringByKey(OrderbookKey) | |
134 | 134 | ||
135 | 135 | let surplus = getNumberByKey(SurplusKey) | |
136 | 136 | ||
137 | 137 | let snapshotBlock = getNumberByKey(SnapshotBlockKey) | |
138 | 138 | ||
139 | 139 | let lastBondGenerated = getNumberByKey(BondGeneratedBlockKey) | |
140 | 140 | ||
141 | 141 | let orderbookSnapshot = getStringByKey(OrderbookSnapshotKey) | |
142 | 142 | ||
143 | 143 | let orderbookTotalSnapshot = getNumberByKey(OrderbookTotalSnapshotKey) | |
144 | 144 | ||
145 | 145 | let bondAssetId = fromBase58String(getStringByKey(BondAssetIdKey)) | |
146 | 146 | ||
147 | 147 | let auctionContract = getStringByKey(AuctionContractKey) | |
148 | 148 | ||
149 | 149 | let leaseContract = getStringByKey(LeaseContractKey) | |
150 | 150 | ||
151 | 151 | let bondSupply = { | |
152 | 152 | let info = extract(assetInfo(bondAssetId)) | |
153 | 153 | (info.quantity - assetBalance(this, bondAssetId)) | |
154 | 154 | } | |
155 | 155 | ||
156 | 156 | func getWavesBalance (owner) = getNumberByKey((WavesBalanceKey + owner)) | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getNeutrinoBalance (owner) = getNumberByKey((NeutrinoBalanceKey + owner)) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | func getBalanceBlock (owner) = getNumberByKey((BalanceBlockKey + owner)) | |
163 | 163 | ||
164 | 164 | ||
165 | 165 | func getOrderTotal (id) = getNumberByKey((OrderTotalKey + id)) | |
166 | 166 | ||
167 | 167 | ||
168 | 168 | func getOrderOwner (id) = getStringByKey((OrderOwnerKey + id)) | |
169 | 169 | ||
170 | 170 | ||
171 | 171 | func getAccountSnapshotBlock (id) = getNumberByKey((AccountSnapshotBlockKey + id)) | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | func getAccountSnapshotOwner (id) = getStringByKey((AccountSnapshotOwnerKey + id)) | |
175 | 175 | ||
176 | 176 | ||
177 | 177 | func getAccountSnapshotAmount (id) = getNumberByKey((AccountSnapshotAmountKey + id)) | |
178 | 178 | ||
179 | 179 | ||
180 | 180 | func getNodeBalance (address,block) = getNumberByKeyAndAddress(leaseContract, (((NodeBalanceKey + address) + ListSplitSymbol) + toString(block))) | |
181 | 181 | ||
182 | 182 | ||
183 | 183 | func isSentNodeBalance (address,block) = getBoolByKey((((IsSentNodeBalanceKey + address) + ListSplitSymbol) + toString(block))) | |
184 | 184 | ||
185 | 185 | ||
186 | 186 | func convertNeutrinoToWaves (amount) = ((amount * 100) / price) | |
187 | 187 | ||
188 | 188 | ||
189 | 189 | func convertWavesToNeutrino (amount) = ((amount * price) / 100) | |
190 | 190 | ||
191 | 191 | ||
192 | 192 | func convertNeutrinoToBond (amount) = (amount / Wavelet) | |
193 | 193 | ||
194 | 194 | ||
195 | 195 | func convertBondToNeutrino (amount) = (amount * Wavelet) | |
196 | 196 | ||
197 | 197 | ||
198 | 198 | func convertWavesToBond (amount) = convertNeutrinoToBond(convertWavesToNeutrino(amount)) | |
199 | 199 | ||
200 | 200 | ||
201 | 201 | @Callable(i) | |
202 | 202 | func setCurrentPrice (price) = WriteSet([DataEntry(PriceKey, price), DataEntry(((PriceKey + ListSplitSymbol) + toString(height)), price)]) | |
203 | 203 | ||
204 | 204 | ||
205 | 205 | ||
206 | 206 | @Callable(i) | |
207 | 207 | func swapWavesToNeutrino () = { | |
208 | 208 | let pmt = extract(i.payment) | |
209 | 209 | if (isDefined(pmt.assetId)) | |
210 | 210 | then throw("can use waves only") | |
211 | 211 | else { | |
212 | 212 | let account = toBase58String(i.caller.bytes) | |
213 | 213 | let amount = convertWavesToNeutrino(pmt.amount) | |
214 | 214 | WriteSet([DataEntry((NeutrinoBalanceKey + toString(i.caller)), (amount + getNeutrinoBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)]) | |
215 | 215 | } | |
216 | 216 | } | |
217 | 217 | ||
218 | 218 | ||
219 | 219 | ||
220 | 220 | @Callable(i) | |
221 | 221 | func swapNeutrinoToWaves () = { | |
222 | 222 | let pmt = extract(i.payment) | |
223 | 223 | if ((pmt.assetId != neutrinoAssetId)) | |
224 | 224 | then throw("can use neutrino only") | |
225 | 225 | else { | |
226 | 226 | let account = toBase58String(i.caller.bytes) | |
227 | 227 | let amount = convertNeutrinoToWaves(pmt.amount) | |
228 | 228 | WriteSet([DataEntry((WavesBalanceKey + toString(i.caller)), (amount + getWavesBalance(account))), DataEntry((BalanceBlockKey + toString(i.caller)), height)]) | |
229 | 229 | } | |
230 | 230 | } | |
231 | 231 | ||
232 | 232 | ||
233 | 233 | ||
234 | 234 | @Callable(i) | |
235 | 235 | func withdraw (account) = if (((getBalanceBlock(account) + BalanceLockBlock) > height)) | |
236 | 236 | then throw("wait a couple of blocks for withdraw") | |
237 | 237 | else ScriptResult(WriteSet([DataEntry((WavesBalanceKey + account), 0), DataEntry((NeutrinoBalanceKey + account), 0)]), TransferSet([ScriptTransfer(i.caller, getNeutrinoBalance(account), neutrinoAssetId), ScriptTransfer(i.caller, getWavesBalance(account), unit)])) | |
238 | 238 | ||
239 | 239 | ||
240 | 240 | ||
241 | 241 | @Callable(i) | |
242 | 242 | func generateBond () = { | |
243 | 243 | let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve)) | |
244 | 244 | let balanceAuction = assetBalance(addressFromStringValue(auctionContract), bondAssetId) | |
245 | 245 | let amount = (convertNeutrinoToBond(deficit) - balanceAuction) | |
246 | 246 | if ((amount > 0)) | |
247 | 247 | then TransferSet([ScriptTransfer(addressFromStringValue(auctionContract), amount, bondAssetId)]) | |
248 | 248 | else throw(("deficit did not reach the threshold. deficit =" + toString(deficit))) | |
249 | 249 | } | |
250 | 250 | ||
251 | 251 | ||
252 | 252 | ||
253 | 253 | @Callable(i) | |
254 | 254 | func setOrder () = { | |
255 | 255 | let pmt = extract(i.payment) | |
256 | 256 | let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height)))) | |
257 | 257 | if ((pmt.assetId != bondAssetId)) | |
258 | 258 | then throw("can use bond only") | |
259 | 259 | else if ((getOrderOwner(newOrderId) != "")) | |
260 | 260 | then throw("order exists") | |
261 | 261 | else WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal + pmt.amount)), DataEntry(OrderbookKey, ((orderbook + newOrderId) + ListSplitSymbol)), DataEntry((OrderTotalKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)]) | |
262 | 262 | } | |
263 | 263 | ||
264 | 264 | ||
265 | 265 | ||
266 | 266 | @Callable(i) | |
267 | 267 | func cancelOrder (orderId) = { | |
268 | 268 | let owner = getOrderOwner(orderId) | |
269 | 269 | let total = getOrderTotal(orderId) | |
270 | 270 | if ((owner != toString(i.caller))) | |
271 | 271 | then throw("permission denied") | |
272 | 272 | else { | |
273 | 273 | let newOrderBookOnePart = split(orderbook, (orderId + ListSplitSymbol))[0] | |
274 | 274 | let newOrderBookTwoPart = split(orderbook, (orderId + ListSplitSymbol))[1] | |
275 | 275 | ScriptResult(WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal - total)), DataEntry(OrderbookKey, (newOrderBookOnePart + newOrderBookTwoPart)), DataEntry((OrderTotalKey + orderId), 0)]), TransferSet([ScriptTransfer(i.caller, total, unit)])) | |
276 | 276 | } | |
277 | 277 | } | |
278 | 278 | ||
279 | 279 | ||
280 | 280 | ||
281 | 281 | @Callable(i) | |
282 | 282 | func executeOrder () = { | |
283 | 283 | let orderId = split(orderbookSnapshot, ListSplitSymbol)[0] | |
284 | 284 | let orderTotal = getOrderTotal(orderId) | |
285 | 285 | if ((0 >= surplus)) | |
286 | 286 | then throw("surplus is less than zero") | |
287 | 287 | else { | |
288 | 288 | let parts = split(orderbook, (orderId + ListSplitSymbol)) | |
289 | 289 | let newActualOrderbook = (parts[0] + parts[1]) | |
290 | 290 | let amount = convertBondToNeutrino((orderTotal - convertNeutrinoToBond(surplus))) | |
291 | 291 | ScriptResult(WriteSet([DataEntry(OrderbookTotalKey, (orderbookTotal - (if ((surplus >= orderTotal)) | |
292 | 292 | then orderTotal | |
293 | 293 | else surplus))), DataEntry(OrderbookKey, newActualOrderbook), DataEntry(OrderbookSnapshotKey, split(orderbookSnapshot, (orderId + ListSplitSymbol))[1]), DataEntry((OrderTotalKey + orderId), if ((0 >= amount)) | |
294 | 294 | then 0 | |
295 | 295 | else amount)]), TransferSet([ScriptTransfer(i.caller, if ((surplus >= orderTotal)) | |
296 | 296 | then convertBondToNeutrino(orderTotal) | |
297 | 297 | else surplus, neutrinoAssetId)])) | |
298 | 298 | } | |
299 | 299 | } | |
300 | 300 | ||
301 | 301 | ||
302 | 302 | ||
303 | 303 | @Callable(i) | |
304 | 304 | func createSnapshot () = { | |
305 | 305 | let newSurplus = (convertWavesToNeutrino(reserve) - neutrinoSupply) | |
306 | 306 | if (if ((0 >= newSurplus)) | |
307 | 307 | then true | |
308 | 308 | else (MinimalSurplus > newSurplus)) | |
309 | 309 | then throw("surplus is less minimum") | |
310 | 310 | else if ((height >= (snapshotBlock + SnapshotBlockExpire))) | |
311 | 311 | then WriteSet([DataEntry(OrderbookSnapshotKey, orderbook), DataEntry(OrderbookTotalSnapshotKey, orderbookTotal), DataEntry(SnapshotBlockKey, height), DataEntry(SurplusKey, surplus)]) | |
312 | 312 | else throw("error create new snapshot") | |
313 | 313 | } | |
314 | 314 | ||
315 | 315 |
github/deemru/w8io/169f3d6 44.76 ms ◑