tx · CUqXwoT3hjLyiFMHtyxwdJSGRctjWfTeD5tYaFQzfgPa 3N7u6nQ6aTajkkFQXMioxNKMH1J4gMbANYW: -0.01000000 Waves 2019.08.21 20:37 [641200] smart account 3N7u6nQ6aTajkkFQXMioxNKMH1J4gMbANYW > SELF 0.00000000 Waves
{ "type": 13, "id": "CUqXwoT3hjLyiFMHtyxwdJSGRctjWfTeD5tYaFQzfgPa", "fee": 1000000, "feeAssetId": null, "timestamp": 1566408996557, "version": 1, "sender": "3N7u6nQ6aTajkkFQXMioxNKMH1J4gMbANYW", "senderPublicKey": "F61jny4qCgvr1wEi27m7oBLvnmQpW46FBdNUtcbv8aXQ", "proofs": [ "DCzPfDnYRM14kHdHQXkbAGeUF9h9TMSb6vjPqsRVPmEfXtscuC4T2yCUupTg4nwZ99V7vhKBEUZX31ohK8nsjvc" ], "script": "base64:AAIDAAAAAAAAAAAAAAAuAAAAAAROT05FAgAAAAABAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEFAAAABE5PTkUAAAAAEk5ldXRyaW5vQXNzZXRJZEtleQIAAAARbmV1dHJpbm9fYXNzZXRfaWQAAAAADkJvbmRBc3NldElkS2V5AgAAAA1ib25kX2Fzc2V0X2lkAAAAABJBdWN0aW9uQ29udHJhY3RLZXkCAAAAEGF1Y3Rpb25fY29udHJhY3QAAAAACFByaWNlS2V5AgAAAAVwcmljZQAAAAAMT3JkZXJCb29rS2V5AgAA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BQAAAA91c2VyQm9uZEJhbGFuY2UFAAAAE3VzZXJOZXV0cmlub0JhbGFuY2UFAAAABmFtb3VudAkAAAIAAAABAgAAABhpbnZhbGlkIGJhbGFuY2Ugc25hcHNob3QDCQAAAAAAAAIFAAAACW9yZGVyYm9vawUAAAAETk9ORQkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAAEsAAAAAgUAAAAVTG9ja05ldXRyaW5vQW1vdW50S2V5BQAAAAJpZAAAAAAAAAAAAAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACBQAAABRMb2NrTmV1dHJpbm9CbG9ja0tleQUAAAACaWQAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIJAABpAAAAAgkAAGgAAAACBQAAAAdzdXJwbHVzBQAAAAZhbW91bnQJAABkAAAAAgUAAAAOc3VwcGx5TmV1dHJpbm8FAAAACWFsbG93Qm9uZAUAAAAPTmV1dHJpbm9Bc3NldElkBQAAAANuaWwJAAACAAAAAQIAAAATb3JkZXJib29rIG5vciBlbXB0eQAAAAAHODYO", "chainId": 84, "height": 641200, "spentComplexity": 0 } View: original | compacted Prev: none Next: F24srpWYefzuZabSmj3z5ieRzBiGdRg7bVBAa3MKSGzi Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let NONE = "" | |
5 | + | ||
6 | + | func getNumberByKey (key) = match getInteger(this, key) { | |
7 | + | case a: Int => | |
8 | + | a | |
9 | + | case _ => | |
10 | + | 0 | |
11 | + | } | |
12 | + | ||
13 | + | ||
14 | + | func getStringByKey (key) = match getString(this, key) { | |
15 | + | case a: String => | |
16 | + | a | |
17 | + | case _ => | |
18 | + | NONE | |
19 | + | } | |
20 | + | ||
21 | + | ||
22 | + | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
23 | + | ||
24 | + | let BondAssetIdKey = "bond_asset_id" | |
25 | + | ||
26 | + | let AuctionContractKey = "auction_contract" | |
27 | + | ||
28 | + | let PriceKey = "price" | |
29 | + | ||
30 | + | let OrderBookKey = "orderbook" | |
31 | + | ||
32 | + | let OrderAmountKey = "order_amount_" | |
33 | + | ||
34 | + | let OrderOwnerKey = "order_owner_" | |
35 | + | ||
36 | + | let OrderHeightKey = "order_height_" | |
37 | + | ||
38 | + | let OrderBookAmountKey = "orderbook_amount" | |
39 | + | ||
40 | + | let OrderBookAmountSnapshotKey = "orderbook_amount_key" | |
41 | + | ||
42 | + | let SurplusKey = "surplus_amount" | |
43 | + | ||
44 | + | let SurplusBlockKey = "surplus_block" | |
45 | + | ||
46 | + | let OrderbookSnapshotKey = "orderbook_snapshot" | |
47 | + | ||
48 | + | let OrderbookSnapshotBlockKey = "orderbook_snapshot_block" | |
49 | + | ||
50 | + | let BondGeneratedBlockKey = "bond_generated_block" | |
51 | + | ||
52 | + | let LockNeutrinoBlockKey = "lock_block_" | |
53 | + | ||
54 | + | let LockNeutrinoOwnerKey = "lock_owner_" | |
55 | + | ||
56 | + | let LockNeutrinoAmountKey = "lock_amount_" | |
57 | + | ||
58 | + | func getPrice () = getNumberByKey(PriceKey) | |
59 | + | ||
60 | + | ||
61 | + | func getOrderBook () = getStringByKey(OrderBookKey) | |
62 | + | ||
63 | + | ||
64 | + | func getOrderBookAmount () = getNumberByKey(OrderBookAmountKey) | |
65 | + | ||
66 | + | ||
67 | + | func getOrderAmount (id) = getNumberByKey((OrderAmountKey + id)) | |
68 | + | ||
69 | + | ||
70 | + | func getOrderOwner (id) = getStringByKey((OrderOwnerKey + id)) | |
71 | + | ||
72 | + | ||
73 | + | func getSurplus () = getStringByKey(SurplusKey) | |
74 | + | ||
75 | + | ||
76 | + | func getSurplusBlock () = getNumberByKey(SurplusKey) | |
77 | + | ||
78 | + | ||
79 | + | func getBondGeneratedBlock () = getNumberByKey(BondGeneratedBlockKey) | |
80 | + | ||
81 | + | ||
82 | + | func getOrderbookSnapshot () = getStringByKey(OrderbookSnapshotKey) | |
83 | + | ||
84 | + | ||
85 | + | func getOrderBookAmountSnapshot () = getNumberByKey(OrderBookAmountSnapshotKey) | |
86 | + | ||
87 | + | ||
88 | + | func getOrderbookSnapshotBlock () = getNumberByKey(OrderbookSnapshotBlockKey) | |
89 | + | ||
90 | + | ||
91 | + | func getLockNeutrinoBlock (id) = getNumberByKey((LockNeutrinoBlockKey + id)) | |
92 | + | ||
93 | + | ||
94 | + | func getLockNeutrinoOwner (id) = getStringByKey((LockNeutrinoOwnerKey + id)) | |
95 | + | ||
96 | + | ||
97 | + | func getLockNeutrinoAmount (id) = getNumberByKey((LockNeutrinoAmountKey + id)) | |
98 | + | ||
99 | + | ||
100 | + | let SnapshotBlockExpire = 10 | |
101 | + | ||
102 | + | let OrderSplitSymbol = "_" | |
103 | + | ||
104 | + | let Wavelet = 100000000 | |
105 | + | ||
106 | + | let MinimalBondOrder = 10 | |
107 | + | ||
108 | + | let MinimalSurplus = 10 | |
109 | + | ||
110 | + | let NeutrinoAssetId = fromBase58String(getStringByKey(NeutrinoAssetIdKey)) | |
111 | + | ||
112 | + | let BondAssetId = fromBase58String(getStringByKey(BondAssetIdKey)) | |
113 | + | ||
114 | + | let AuctionContract = getStringByKey(AuctionContractKey) | |
115 | + | ||
116 | + | func getReserve () = wavesBalance(this) | |
117 | + | ||
118 | + | ||
119 | + | func getNeutrinoSupply () = { | |
120 | + | let info = extract(assetInfo(NeutrinoAssetId)) | |
121 | + | (info.quantity - assetBalance(this, NeutrinoAssetId)) | |
122 | + | } | |
123 | + | ||
124 | + | ||
125 | + | func getBondSupply () = { | |
126 | + | let info = extract(assetInfo(BondAssetId)) | |
127 | + | (info.quantity - assetBalance(this, BondAssetId)) | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | @Callable(i) | |
132 | + | func setCurrentPrice (price) = WriteSet([DataEntry(PriceKey, price)]) | |
133 | + | ||
134 | + | ||
135 | + | ||
136 | + | @Callable(i) | |
137 | + | func swapWavesToNeutrino () = { | |
138 | + | let price = getPrice() | |
139 | + | let pmt = extract(i.payment) | |
140 | + | if (isDefined(pmt.assetId)) | |
141 | + | then throw("can use waves only") | |
142 | + | else { | |
143 | + | let account = toBase58String(i.caller.bytes) | |
144 | + | let amount = (pmt.amount * price) | |
145 | + | TransferSet([ScriptTransfer(addressFromStringValue(account), amount, NeutrinoAssetId)]) | |
146 | + | } | |
147 | + | } | |
148 | + | ||
149 | + | ||
150 | + | ||
151 | + | @Callable(i) | |
152 | + | func swapNeutrinoToWaves () = { | |
153 | + | let price = getPrice() | |
154 | + | let pmt = extract(i.payment) | |
155 | + | if ((pmt.assetId != NeutrinoAssetId)) | |
156 | + | then throw("can use neutrino only") | |
157 | + | else { | |
158 | + | let account = toBase58String(i.caller.bytes) | |
159 | + | let amount = (pmt.amount / price) | |
160 | + | TransferSet([ScriptTransfer(addressFromStringValue(account), amount, unit)]) | |
161 | + | } | |
162 | + | } | |
163 | + | ||
164 | + | ||
165 | + | ||
166 | + | @Callable(i) | |
167 | + | func generateBond () = { | |
168 | + | let priceNeutrino = getPrice() | |
169 | + | let reserve = getReserve() | |
170 | + | let supply = getNeutrinoSupply() | |
171 | + | let deficit = (supply - (reserve * priceNeutrino)) | |
172 | + | let lastBondGenerated = getBondGeneratedBlock() | |
173 | + | if (if ((deficit >= MinimalBondOrder)) | |
174 | + | then ((lastBondGenerated + SnapshotBlockExpire) > height) | |
175 | + | else false) | |
176 | + | then ScriptResult(WriteSet([DataEntry(BondGeneratedBlockKey, height)]), TransferSet([ScriptTransfer(addressFromStringValue(AuctionContract), (deficit - MinimalBondOrder), BondAssetId)])) | |
177 | + | else throw("deficit did not reach the threshold") | |
178 | + | } | |
179 | + | ||
180 | + | ||
181 | + | ||
182 | + | @Callable(i) | |
183 | + | func setOrder () = { | |
184 | + | let orderbook = getOrderBook() | |
185 | + | let pmt = extract(i.payment) | |
186 | + | let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height)))) | |
187 | + | if ((pmt.assetId != BondAssetId)) | |
188 | + | then throw("can use waves only") | |
189 | + | else if ((getOrderOwner(newOrderId) != NONE)) | |
190 | + | then throw("order exists") | |
191 | + | else if ((orderbook == NONE)) | |
192 | + | then WriteSet([DataEntry(OrderBookAmountKey, (getOrderBookAmount() + pmt.amount)), DataEntry(OrderBookKey, (OrderSplitSymbol + newOrderId)), DataEntry((OrderAmountKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)]) | |
193 | + | else WriteSet([DataEntry(OrderBookAmountKey, (getOrderBookAmount() + pmt.amount)), DataEntry(OrderBookKey, ((orderbook + OrderSplitSymbol) + newOrderId)), DataEntry((OrderAmountKey + newOrderId), pmt.amount), DataEntry((OrderOwnerKey + newOrderId), toString(i.caller)), DataEntry((OrderHeightKey + newOrderId), height)]) | |
194 | + | } | |
195 | + | ||
196 | + | ||
197 | + | ||
198 | + | @Callable(i) | |
199 | + | func cancelOrder (orderId) = { | |
200 | + | let orderbook = getOrderBook() | |
201 | + | let owner = getOrderOwner(orderId) | |
202 | + | let amount = getOrderAmount(orderId) | |
203 | + | if ((owner != toString(i.caller))) | |
204 | + | then throw("permission denied") | |
205 | + | else { | |
206 | + | let newOrderBookOnePart = split(orderbook, (OrderSplitSymbol + orderId))[0] | |
207 | + | let newOrderBookTwoPart = split(orderbook, (OrderSplitSymbol + orderId))[1] | |
208 | + | ScriptResult(WriteSet([DataEntry(OrderBookAmountKey, (getOrderBookAmount() - amount)), DataEntry(OrderBookKey, (newOrderBookOnePart + newOrderBookTwoPart)), DataEntry((OrderAmountKey + orderId), 0)]), TransferSet([ScriptTransfer(i.caller, amount, unit)])) | |
209 | + | } | |
210 | + | } | |
211 | + | ||
212 | + | ||
213 | + | ||
214 | + | @Callable(i) | |
215 | + | func executeOrder () = { | |
216 | + | let orderbook = getOrderbookSnapshot() | |
217 | + | let orderId = split(orderbook, OrderSplitSymbol)[1] | |
218 | + | let orderAmount = getOrderAmount(orderId) | |
219 | + | let priceNeutrino = getPrice() | |
220 | + | let reserve = getReserve() | |
221 | + | let supply = getNeutrinoSupply() | |
222 | + | let surplus = ((reserve * priceNeutrino) - supply) | |
223 | + | if ((orderAmount == 0)) | |
224 | + | then { | |
225 | + | let newOrderBookTwoPart = split(orderbook, (orderId + OrderSplitSymbol))[1] | |
226 | + | ScriptResult(WriteSet([DataEntry(OrderbookSnapshotKey, newOrderBookTwoPart)]), TransferSet([ScriptTransfer(i.caller, orderAmount, NeutrinoAssetId)])) | |
227 | + | } | |
228 | + | else if ((0 >= surplus)) | |
229 | + | then throw("surplus is less than zero") | |
230 | + | else if ((surplus >= orderAmount)) | |
231 | + | then { | |
232 | + | let newOrderbookSnapshot = split(orderbook, (orderId + OrderSplitSymbol))[1] | |
233 | + | let actualOrderbook = getOrderBook() | |
234 | + | let newActualOrderBookOnePart = split(actualOrderbook, (OrderSplitSymbol + orderId))[0] | |
235 | + | let newActualOrderBookTwoPart = split(actualOrderbook, (OrderSplitSymbol + orderId))[1] | |
236 | + | ScriptResult(WriteSet([DataEntry(OrderBookAmountKey, (getOrderBookAmount() - orderAmount)), DataEntry(OrderBookKey, (newActualOrderBookOnePart + newActualOrderBookTwoPart)), DataEntry(OrderbookSnapshotKey, newOrderbookSnapshot), DataEntry((OrderAmountKey + orderId), 0)]), TransferSet([ScriptTransfer(i.caller, orderAmount, NeutrinoAssetId)])) | |
237 | + | } | |
238 | + | else ScriptResult(WriteSet([DataEntry(OrderBookAmountKey, (getOrderBookAmount() - surplus)), DataEntry((OrderAmountKey + orderId), (orderAmount - surplus))]), TransferSet([ScriptTransfer(i.caller, surplus, NeutrinoAssetId)])) | |
239 | + | } | |
240 | + | ||
241 | + | ||
242 | + | ||
243 | + | @Callable(i) | |
244 | + | func calculateSurplusAndCreateSnapshot () = { | |
245 | + | let priceNeutrino = getPrice() | |
246 | + | let reserve = getReserve() | |
247 | + | let supply = getNeutrinoSupply() | |
248 | + | let surplus = ((reserve * priceNeutrino) - supply) | |
249 | + | if (if ((0 >= surplus)) | |
250 | + | then true | |
251 | + | else (MinimalSurplus > surplus)) | |
252 | + | then throw("surplus is less minimum") | |
253 | + | else ScriptResult(WriteSet([DataEntry(OrderBookAmountSnapshotKey, getOrderBookAmount()), DataEntry(SurplusBlockKey, height), DataEntry(SurplusKey, surplus)]), TransferSet([ScriptTransfer(i.caller, surplus, NeutrinoAssetId)])) | |
254 | + | } | |
255 | + | ||
256 | + | ||
257 | + | ||
258 | + | @Callable(i) | |
259 | + | func snapshotNeutrino () = { | |
260 | + | let userNeutrinoBalance = assetBalance(i.caller, NeutrinoAssetId) | |
261 | + | let userBondBalance = assetBalance(i.caller, BondAssetId) | |
262 | + | let amount = (userBondBalance + userNeutrinoBalance) | |
263 | + | let id = toBase58String(keccak256(((toBytes(amount) + i.caller.bytes) + toBytes(height)))) | |
264 | + | if ((getLockNeutrinoOwner(id) != NONE)) | |
265 | + | then throw("id exists") | |
266 | + | else WriteSet([DataEntry((LockNeutrinoAmountKey + id), amount), DataEntry((LockNeutrinoBlockKey + id), height), DataEntry((LockNeutrinoOwnerKey + id), toString(i.caller))]) | |
267 | + | } | |
268 | + | ||
269 | + | ||
270 | + | ||
271 | + | @Callable(i) | |
272 | + | func getNewNeutrino (id) = { | |
273 | + | let userNeutrinoBalance = assetBalance(i.caller, NeutrinoAssetId) | |
274 | + | let userBondBalance = assetBalance(i.caller, BondAssetId) | |
275 | + | let orderbook = getOrderbookSnapshot() | |
276 | + | let priceNeutrino = getPrice() | |
277 | + | let reserve = getReserve() | |
278 | + | let supplyNeutrino = getNeutrinoSupply() | |
279 | + | let supplyBond = getBondSupply() | |
280 | + | let allowBond = (supplyBond - getOrderBookAmountSnapshot()) | |
281 | + | let surplus = ((reserve * priceNeutrino) - supplyNeutrino) | |
282 | + | let surplusBlock = getSurplusBlock() | |
283 | + | let block = getLockNeutrinoBlock(id) | |
284 | + | let amount = getLockNeutrinoAmount(id) | |
285 | + | if ((0 >= surplus)) | |
286 | + | then throw("surplus is less than zero") | |
287 | + | else if ((block >= surplusBlock)) | |
288 | + | then throw("wait new snapshot") | |
289 | + | else if (((userBondBalance + userNeutrinoBalance) != amount)) | |
290 | + | then throw("invalid balance snapshot") | |
291 | + | else if ((orderbook == NONE)) | |
292 | + | then ScriptResult(WriteSet([DataEntry((LockNeutrinoAmountKey + id), 0), DataEntry((LockNeutrinoBlockKey + id), 0)]), TransferSet([ScriptTransfer(i.caller, ((surplus * amount) / (supplyNeutrino + allowBond)), NeutrinoAssetId)])) | |
293 | + | else throw("orderbook nor empty") | |
294 | + | } | |
295 | + | ||
296 | + |
github/deemru/w8io/169f3d6 42.57 ms ◑