tx · EKXHshxMiZ1BHhXG1171XTYh4ZoyNm677MWnJH6xxahH 3N7SvhS43TcNEzNLXVSeqWFfE21zr88RMsC: -0.01400000 Waves 2019.11.15 17:09 [766304] smart account 3N7SvhS43TcNEzNLXVSeqWFfE21zr88RMsC > SELF 0.00000000 Waves
{ "type": 13, "id": "EKXHshxMiZ1BHhXG1171XTYh4ZoyNm677MWnJH6xxahH", "fee": 1400000, "feeAssetId": null, "timestamp": 1573826975871, "version": 1, "sender": "3N7SvhS43TcNEzNLXVSeqWFfE21zr88RMsC", "senderPublicKey": "3Lp94uZUAQkwp8vsxnez57VtmkhZXn3zRi4ZmBxC8q4N", "proofs": [ "4KMtwptcwQubHHMvcXf2UBRtnZ6sjScu5iuVbvUMD31udpc6MjzgyN166ND2WWzZo8Sx5m2Hxj2JPJwxbj3NSjAd" ], "script": "base64:AAIDAAAAAAAAAAsIARIAEgMKAQgSAAAAADMBAAAADmdldE51bWJlckJ5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQaAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAANJbnQEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEAAAAAAAAAAAABAAAADmdldFN0cmluZ0J5S2V5AAAAAQAAAANrZXkEAAAAByRtYXRjaDAJAAQdAAAAAgUAAAAEdGhpcwUAAAADa2V5AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAAZTdHJpbmcEAAAAAWEFAAAAByRtYXRjaDAFAAAAAWECAAAAAAEAAAAYZ2V0U3RyaW5nQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABhnZXROdW1iZXJCeUFkZHJlc3NBbmRL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bW91bnQJAQAAAAlkcm9wT3JkZXIAAAABBQAAAAdvcmRlcklkBQAAAAlvcmRlcmJvb2sJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABZnZXRPcmRlckZpbGxlZFRvdGFsS2V5AAAAAQUAAAAHb3JkZXJJZAkAAGQAAAACBQAAAAtmaWxsZWRUb3RhbAUAAAAObmV3RmlsbGVkVG90YWwJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIJAQAAABFnZXRPcmRlclN0YXR1c0tleQAAAAEFAAAAB29yZGVySWQFAAAABnN0YXR1cwUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMJAQAAABxAZXh0clVzZXIoYWRkcmVzc0Zyb21TdHJpbmcpAAAAAQUAAAAKb3JkZXJPd25lcgkBAAAAFWNvbnZlcnRCb25kVG9OZXV0cmlubwAAAAEFAAAADm5ld0ZpbGxlZFRvdGFsBQAAAA9uZXV0cmlub0Fzc2V0SWQFAAAAA25pbAAAAACixD1s", "chainId": 84, "height": 766304, "spentComplexity": 0 } View: original | compacted Prev: FS7AFXQ1kFrtr1wscEU6bBGH7WHBBFhzQYhHRnC3rhB3 Next: FaY14mFdv3mCQih3b7vpvpvfaTCGJjMWNCrv7TzXnUGG 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 getStringByAddressAndKey (address,key) = match getString(address, key) { | |
21 | 21 | case a: String => | |
22 | 22 | a | |
23 | 23 | case _ => | |
24 | 24 | "" | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func getNumberByAddressAndKey (address,key) = match getInteger(address, key) { | |
29 | 29 | case a: Int => | |
30 | 30 | a | |
31 | 31 | case _ => | |
32 | 32 | 0 | |
33 | 33 | } | |
34 | 34 | ||
35 | 35 | ||
36 | 36 | let WAVELET = 100000000 | |
37 | 37 | ||
38 | 38 | let ORDERSPLITSYMBOL = "_" | |
39 | 39 | ||
40 | 40 | let PAULI = 100 | |
41 | 41 | ||
42 | 42 | let PERCENTACCURACY = 1000 | |
43 | 43 | ||
44 | 44 | let MAXDISCOUNT = 50 | |
45 | 45 | ||
46 | 46 | let CANCELED = "canceled" | |
47 | 47 | ||
48 | 48 | let NEW = "new" | |
49 | 49 | ||
50 | 50 | let FILLED = "filled" | |
51 | 51 | ||
52 | 52 | let OrderbookKey = "orderbook" | |
53 | 53 | ||
54 | 54 | let PriceKey = "price" | |
55 | 55 | ||
56 | 56 | let BondAssetIdKey = "bond_asset_id" | |
57 | 57 | ||
58 | 58 | let NeutrinoAssetIdKey = "neutrino_asset_id" | |
59 | 59 | ||
60 | 60 | let NeutrinoContractKey = "neutrino_contract" | |
61 | 61 | ||
62 | 62 | let ControlContractKey = "control_contract" | |
63 | 63 | ||
64 | 64 | let SwapLockedBalanceKey = "swap_locked_balance" | |
65 | 65 | ||
66 | 66 | let SwapNeutrinoLockedBalanceKey = "swap_neutrino_locked_balance" | |
67 | 67 | ||
68 | 68 | let SwapWavesLockedBalanceKey = "swap_waves_locked_balance" | |
69 | 69 | ||
70 | 70 | func getOrderTotalKey (orderId) = ("order_total_" + orderId) | |
71 | 71 | ||
72 | 72 | ||
73 | 73 | func getOrderOwnerKey (orderId) = ("order_owner_" + orderId) | |
74 | 74 | ||
75 | 75 | ||
76 | 76 | func getOrderHeightKey (orderId) = ("order_height_" + orderId) | |
77 | 77 | ||
78 | 78 | ||
79 | 79 | func getOrderStatusKey (orderId) = ("order_status_" + orderId) | |
80 | 80 | ||
81 | 81 | ||
82 | 82 | func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId) | |
83 | 83 | ||
84 | 84 | ||
85 | 85 | func convertNeutrinoToWaves (amount,price) = ((((amount * 100) / price) * WAVELET) / PAULI) | |
86 | 86 | ||
87 | 87 | ||
88 | 88 | func convertWavesToNeutrino (amount,price) = ((((amount * price) / 100) * PAULI) / WAVELET) | |
89 | 89 | ||
90 | 90 | ||
91 | 91 | func convertNeutrinoToBond (amount) = (amount / PAULI) | |
92 | 92 | ||
93 | 93 | ||
94 | 94 | func convertBondToNeutrino (amount) = (amount * PAULI) | |
95 | 95 | ||
96 | 96 | ||
97 | 97 | func convertWavesToBond (amount,price) = convertNeutrinoToBond(convertWavesToNeutrino(amount, price)) | |
98 | 98 | ||
99 | 99 | ||
100 | 100 | let orderbook = getStringByKey(OrderbookKey) | |
101 | 101 | ||
102 | 102 | let neutrinoContract = addressFromStringValue(getStringByKey(NeutrinoContractKey)) | |
103 | 103 | ||
104 | 104 | let controlContract = addressFromStringValue(getStringByAddressAndKey(neutrinoContract, ControlContractKey)) | |
105 | 105 | ||
106 | 106 | let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey) | |
107 | 107 | ||
108 | 108 | let swapLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapLockedBalanceKey) | |
109 | 109 | ||
110 | 110 | let swapNeutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapNeutrinoLockedBalanceKey) | |
111 | 111 | ||
112 | 112 | let swapWavesLockedBalance = getNumberByAddressAndKey(neutrinoContract, SwapWavesLockedBalanceKey) | |
113 | 113 | ||
114 | 114 | let neutrinoAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, NeutrinoAssetIdKey)) | |
115 | 115 | ||
116 | 116 | let bondAssetId = fromBase58String(getStringByAddressAndKey(neutrinoContract, BondAssetIdKey)) | |
117 | 117 | ||
118 | 118 | let reserve = (wavesBalance(neutrinoContract) - swapWavesLockedBalance) | |
119 | 119 | ||
120 | 120 | let neutrinoSupply = ((extract(assetInfo(neutrinoAssetId)).quantity - assetBalance(this, neutrinoAssetId)) + swapNeutrinoLockedBalance) | |
121 | 121 | ||
122 | 122 | let surplus = (convertWavesToNeutrino(reserve, currentPrice) - neutrinoSupply) | |
123 | 123 | ||
124 | 124 | func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id)) | |
125 | 125 | ||
126 | 126 | ||
127 | 127 | func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id)) | |
128 | 128 | ||
129 | 129 | ||
130 | 130 | func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id)) | |
131 | 131 | ||
132 | 132 | ||
133 | 133 | func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id)) | |
134 | 134 | ||
135 | 135 | ||
136 | 136 | func getOrderElementById (id) = (id + ORDERSPLITSYMBOL) | |
137 | 137 | ||
138 | 138 | ||
139 | 139 | func addOrder (orderId,position) = { | |
140 | 140 | let orders = split(orderbook, ORDERSPLITSYMBOL) | |
141 | 141 | let newOrder = getOrderElementById(orderId) | |
142 | 142 | if ((position == 0)) | |
143 | 143 | then (newOrder + orderbook) | |
144 | 144 | else if ((position >= (size(orders) - 1))) | |
145 | 145 | then (orderbook + newOrder) | |
146 | 146 | else { | |
147 | 147 | let parts = split(orderbook, getOrderElementById(orders[position])) | |
148 | 148 | (((parts[0] + newOrder) + getOrderElementById(orders[position])) + parts[1]) | |
149 | 149 | } | |
150 | 150 | } | |
151 | 151 | ||
152 | 152 | ||
153 | 153 | func dropOrder (orderId) = { | |
154 | 154 | let parts = split(orderbook, getOrderElementById(orderId)) | |
155 | 155 | (parts[0] + parts[1]) | |
156 | 156 | } | |
157 | 157 | ||
158 | 158 | ||
159 | 159 | func getOrdersInOrderbook (orderbook) = split(orderbook, ORDERSPLITSYMBOL) | |
160 | 160 | ||
161 | 161 | ||
162 | 162 | @Callable(i) | |
163 | 163 | func addLiquidationOrder () = { | |
164 | 164 | let pmt = extract(i.payment) | |
165 | 165 | let newOrderId = toBase58String(keccak256(((toBytes(pmt.amount) + i.caller.bytes) + toBytes(height)))) | |
166 | 166 | if ((pmt.assetId != bondAssetId)) | |
167 | 167 | then throw("can use appropriate neutrino bonds tokens only") | |
168 | 168 | else if ((getOrderOwner(newOrderId) != "")) | |
169 | 169 | then throw("an order is already exists") | |
170 | 170 | else WriteSet([DataEntry(OrderbookKey, addOrder(newOrderId, size(getOrdersInOrderbook(orderbook)))), DataEntry(getOrderTotalKey(newOrderId), pmt.amount), DataEntry(getOrderOwnerKey(newOrderId), toString(i.caller)), DataEntry(getOrderHeightKey(newOrderId), height), DataEntry(getOrderStatusKey(newOrderId), NEW)]) | |
171 | 171 | } | |
172 | 172 | ||
173 | 173 | ||
174 | 174 | ||
175 | 175 | @Callable(i) | |
176 | 176 | func cancelOrder (orderId) = { | |
177 | 177 | let owner = getOrderOwner(orderId) | |
178 | 178 | let amount = (getOrderTotal(orderId) - getOrderFilledTotal(orderId)) | |
179 | 179 | if ((owner != toString(i.caller))) | |
180 | 180 | then throw("permission denied") | |
181 | 181 | else if ((getOrderStatus(orderId) != NEW)) | |
182 | 182 | then throw("invalid order status") | |
183 | 183 | else ScriptResult(WriteSet([DataEntry(OrderbookKey, dropOrder(orderId)), DataEntry(getOrderStatusKey(orderId), CANCELED)]), TransferSet([ScriptTransfer(i.caller, amount, bondAssetId)])) | |
184 | 184 | } | |
185 | 185 | ||
186 | 186 | ||
187 | 187 | ||
188 | 188 | @Callable(i) | |
189 | 189 | func liquidateBond () = { | |
190 | 190 | let orderId = getOrdersInOrderbook(orderbook)[0] | |
191 | 191 | let orderTotal = getOrderTotal(orderId) | |
192 | 192 | let orderOwner = getOrderOwner(orderId) | |
193 | 193 | let filledTotal = getOrderFilledTotal(orderId) | |
194 | 194 | let surplusBond = (convertNeutrinoToBond(surplus) + assetBalance(this, neutrinoAssetId)) | |
195 | 195 | if ((0 >= surplusBond)) | |
196 | 196 | then throw("there is no proficit on the smart contract now") | |
197 | 197 | else if ((orderbook == "")) | |
198 | 198 | then throw("empty orderbook") | |
199 | 199 | else { | |
200 | 200 | let amount = (orderTotal - filledTotal) | |
201 | 201 | let status = if ((surplusBond >= amount)) | |
202 | 202 | then FILLED | |
203 | 203 | else NEW | |
204 | 204 | let newFilledTotal = if ((surplusBond >= amount)) | |
205 | 205 | then amount | |
206 | 206 | else surplusBond | |
207 | 207 | ScriptResult(WriteSet([DataEntry(OrderbookKey, if ((surplusBond >= amount)) | |
208 | 208 | then dropOrder(orderId) | |
209 | 209 | else orderbook), DataEntry(getOrderFilledTotalKey(orderId), (filledTotal + newFilledTotal)), DataEntry(getOrderStatusKey(orderId), status)]), TransferSet([ScriptTransfer(addressFromStringValue(orderOwner), convertBondToNeutrino(newFilledTotal), neutrinoAssetId)])) | |
210 | 210 | } | |
211 | 211 | } | |
212 | 212 | ||
213 | 213 |
github/deemru/w8io/169f3d6 35.99 ms ◑