tx · USoof2x5QraU1zqSwKr6uaJSpmvf1cRK7c2mMFhSdft 3MsPoN8ANGmVUNA98zLExhAPpgacZAfpU2D: -0.01000000 Waves 2019.06.22 21:02 [553585] smart account 3MsPoN8ANGmVUNA98zLExhAPpgacZAfpU2D > SELF 0.00000000 Waves
{ "type": 13, "id": "USoof2x5QraU1zqSwKr6uaJSpmvf1cRK7c2mMFhSdft", "fee": 1000000, "feeAssetId": null, "timestamp": 1561226567217, "version": 1, "sender": "3MsPoN8ANGmVUNA98zLExhAPpgacZAfpU2D", "senderPublicKey": "58gLtk2Jk2j9CwLWiFjrFJWWbEqumWMUrDzKLRbGofqj", "proofs": [ "4jxszQh8dg6VVXGTW9SQNwTSoAHMhN9xpGpFq9qpG3NCtmYCUmoynjZkrbeRKTiWcwS23PTVavRXadaXCXDejRbR" ], "script": "base64:AAIDAAAAAAAAAAAAAAARAAAAAAhJZHhQcmljZQAAAAAAAAAAAAAAAAAJSWR4QW1vdW50AAAAAAAAAAABAAAAAAxJZHhUcmFkZVBhaXIAAAAAAAAAAAIAAAAADElkeE9yZGVyVHlwZQAAAAAAAAAAAwAAAAAJSWR4U2VuZGVyAAAAAAAAAAAEAAAAAApJZHhBc3NldElkAAAAAAAAAAAFAAAAAANCVVkCAAAAA0JVWQAAAAAEU0VMTAIAAAAEU0VMTAEAAAAQcmV0YWluTWF0Y2hlckZlZQAAAAEAAAAGYW1vdW50CQAAawAAAAMFAAAABmFtb3VudAAAAAAAAAAD5wAAAAAAAAAD6AEAAAAKbWF0Y2hlckZlZQAAAAEAAAAGYW1vdW50CQAAZQAAAAIFAAAABmFtb3VudAkAAGsAAAADBQAAAAZhbW91bnQAAAAAAAAAA+cAAAAAAAAAA+gBAAAAGVJlbW92ZVVuZGVyc2NvcmVJZlByZXNlbnQAAAABAAAACXJlbWFpbmluZwMJAABmAAAAAgkAATEAAAABBQAAAAlyZW1haW5pbmcAAAAAAAAAAAAJAAEwAAAAAgUAAAAJcmVtYWluaW5nAAAAAAA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AAAAEFAAAAEHByaWNlQXNzZXRBbW91bnQJAQAAABFhc3NldElkRnJvbVN0cmluZwAAAAEJAAGRAAAAAgUAAAAJc2VsbE9yZGVyBQAAAApJZHhBc3NldElkCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgkBAAAACm1hdGNoZXJGZWUAAAABBQAAABFhbW91bnRBc3NldEFtb3VudAkBAAAAEWFzc2V0SWRGcm9tU3RyaW5nAAAAAQkAAZEAAAACBQAAAAhidXlPcmRlcgUAAAAKSWR4QXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIJAQAAAAptYXRjaGVyRmVlAAAAAQUAAAAQcHJpY2VBc3NldEFtb3VudAkBAAAAEWFzc2V0SWRGcm9tU3RyaW5nAAAAAQkAAZEAAAACBQAAAAlzZWxsT3JkZXIFAAAACklkeEFzc2V0SWQFAAAAA25pbAAAAAFpAQAAABFyZWdpc3RlclRyYWlkUGFpcgAAAAMAAAAGYXNzZXQxAAAACnByaWNlQXNzZXQAAAAJdHJhaWRQYWlyCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIJAAEsAAAAAgUAAAAGYXNzZXQxAgAAAAEvBQAAAApwcmljZUFzc2V0BQAAAAl0cmFpZFBhaXIFAAAAA25pbAAAAABt2o8M", "chainId": 84, "height": 553585, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let IdxPrice = 0 | |
5 | + | ||
6 | + | let IdxAmount = 1 | |
7 | + | ||
8 | + | let IdxTradePair = 2 | |
9 | + | ||
10 | + | let IdxOrderType = 3 | |
11 | + | ||
12 | + | let IdxSender = 4 | |
13 | + | ||
14 | + | let IdxAssetId = 5 | |
15 | + | ||
16 | + | let BUY = "BUY" | |
17 | + | ||
18 | + | let SELL = "SELL" | |
19 | + | ||
20 | + | func retainMatcherFee (amount) = fraction(amount, 999, 1000) | |
21 | + | ||
22 | + | ||
23 | + | func matcherFee (amount) = (amount - fraction(amount, 999, 1000)) | |
24 | + | ||
25 | + | ||
26 | + | func RemoveUnderscoreIfPresent (remaining) = if ((size(remaining) > 0)) | |
27 | + | then drop(remaining, 1) | |
28 | + | else remaining | |
29 | + | ||
30 | + | ||
31 | + | func FormatDataParam (p) = { | |
32 | + | let s = size(p) | |
33 | + | if ((s == 0)) | |
34 | + | then throw("Parameter size must be greater then 0") | |
35 | + | else if ((s > 99)) | |
36 | + | then throw("Parameter size must be less then 100") | |
37 | + | else if ((10 > s)) | |
38 | + | then (("0" + toString(s)) + p) | |
39 | + | else (toString(s) + p) | |
40 | + | } | |
41 | + | ||
42 | + | ||
43 | + | func ParseNextAttribute (remaining) = { | |
44 | + | let s = size(remaining) | |
45 | + | if ((s > 0)) | |
46 | + | then { | |
47 | + | let nn = parseIntValue(take(remaining, 2)) | |
48 | + | let v = take(drop(remaining, 2), nn) | |
49 | + | let tmpRemaining = drop(remaining, (nn + 2)) | |
50 | + | let remainingState = RemoveUnderscoreIfPresent(tmpRemaining) | |
51 | + | [v, remainingState] | |
52 | + | } | |
53 | + | else throw("Empty string was passed into parseNextAttribute func") | |
54 | + | } | |
55 | + | ||
56 | + | ||
57 | + | func FormatOrderDataStr (traidPair,sender,orderType,price,amount,assetId) = { | |
58 | + | let fullStateStr = ((((((((((FormatDataParam(traidPair) + "_") + FormatDataParam(sender)) + "_") + FormatDataParam(orderType)) + "_") + FormatDataParam(toString(price))) + "_") + FormatDataParam(toString(amount))) + "_") + FormatDataParam(assetId)) | |
59 | + | fullStateStr | |
60 | + | } | |
61 | + | ||
62 | + | ||
63 | + | func ParseOrderRawDataStr (rawStateStr) = { | |
64 | + | let tradePair = ParseNextAttribute(rawStateStr) | |
65 | + | let sender = ParseNextAttribute(tradePair[1]) | |
66 | + | let orderType = ParseNextAttribute(sender[1]) | |
67 | + | let price = ParseNextAttribute(orderType[1]) | |
68 | + | let amount = ParseNextAttribute(price[1]) | |
69 | + | let assetId = ParseNextAttribute(amount[1]) | |
70 | + | [price[0], amount[0], tradePair[0], orderType[0], sender[0], assetId[0]] | |
71 | + | } | |
72 | + | ||
73 | + | ||
74 | + | func pow10 (exp) = if ((exp == 0)) | |
75 | + | then 1 | |
76 | + | else if ((exp == 1)) | |
77 | + | then 10 | |
78 | + | else if ((exp == 2)) | |
79 | + | then 100 | |
80 | + | else if ((exp == 3)) | |
81 | + | then 1000 | |
82 | + | else if ((exp == 4)) | |
83 | + | then 10000 | |
84 | + | else if ((exp == 5)) | |
85 | + | then 100000 | |
86 | + | else if ((exp == 6)) | |
87 | + | then 1000000 | |
88 | + | else if ((exp == 7)) | |
89 | + | then 10000000 | |
90 | + | else if ((exp == 8)) | |
91 | + | then 100000000 | |
92 | + | else if ((exp == 9)) | |
93 | + | then 1000000000 | |
94 | + | else if ((exp == 10)) | |
95 | + | then 10000000000 | |
96 | + | else if ((exp == 11)) | |
97 | + | then 100000000000 | |
98 | + | else if ((exp == 12)) | |
99 | + | then 1000000000000 | |
100 | + | else throw("Pow10 more then 12 is not supported") | |
101 | + | ||
102 | + | ||
103 | + | func assetIdFromString (assetId) = if (if ((assetId == "WAVES")) | |
104 | + | then true | |
105 | + | else (assetId == "")) | |
106 | + | then unit | |
107 | + | else fromBase58String(assetId) | |
108 | + | ||
109 | + | ||
110 | + | @Callable(i) | |
111 | + | func order (assetId,price) = { | |
112 | + | let pmt = extract(i.payment) | |
113 | + | let pmtAssetIdStr = if (isDefined(pmt.assetId)) | |
114 | + | then toBase58String(value(pmt.assetId)) | |
115 | + | else "WAVES" | |
116 | + | let possibleTraidPair1 = getString(this, ((assetId + "/") + pmtAssetIdStr)) | |
117 | + | let possibleTraidPair2 = getString(this, ((pmtAssetIdStr + "/") + assetId)) | |
118 | + | let traidPair = if (isDefined(possibleTraidPair1)) | |
119 | + | then value(possibleTraidPair1) | |
120 | + | else if (isDefined(possibleTraidPair2)) | |
121 | + | then value(possibleTraidPair2) | |
122 | + | else throw("Traiding for that assets is not supported") | |
123 | + | let orderType = if (isDefined(possibleTraidPair1)) | |
124 | + | then BUY | |
125 | + | else SELL | |
126 | + | let orderStr = FormatOrderDataStr(traidPair, toBase58String(i.caller.bytes), orderType, price, pmt.amount, assetId) | |
127 | + | WriteSet([DataEntry(toBase58String(i.transactionId), orderStr)]) | |
128 | + | } | |
129 | + | ||
130 | + | ||
131 | + | ||
132 | + | @Callable(i) | |
133 | + | func matchOrders (order1Id,order2Id) = { | |
134 | + | let order1 = ParseOrderRawDataStr(getStringValue(this, order1Id)) | |
135 | + | let order2 = ParseOrderRawDataStr(getStringValue(this, order2Id)) | |
136 | + | if ((order1[IdxTradePair] != order2[IdxTradePair])) | |
137 | + | then throw("Trying to match orders from different trading pairs") | |
138 | + | else if ((order1[IdxOrderType] == order2[IdxOrderType])) | |
139 | + | then throw("Trying to match orders of the same type") | |
140 | + | else { | |
141 | + | let order1isSell = (order1[IdxOrderType] == SELL) | |
142 | + | let sellOrder = if (order1isSell) | |
143 | + | then order1 | |
144 | + | else order2 | |
145 | + | let buyOrder = if (!(order1isSell)) | |
146 | + | then order1 | |
147 | + | else order2 | |
148 | + | let sellPrice = parseIntValue(sellOrder[IdxPrice]) | |
149 | + | let buyPrice = parseIntValue(buyOrder[IdxPrice]) | |
150 | + | let sellOrderAmount = parseIntValue(sellOrder[IdxAmount]) | |
151 | + | let buyOrderAmount = parseIntValue(buyOrder[IdxAmount]) | |
152 | + | if ((sellPrice > buyPrice)) | |
153 | + | then throw("Orders are not match by price") | |
154 | + | else { | |
155 | + | let exchangePrice = sellPrice | |
156 | + | let amountAssetDecimals = if ((buyOrder[IdxAssetId] == "WAVES")) | |
157 | + | then 8 | |
158 | + | else value(assetInfo(value(assetIdFromString(buyOrder[IdxAssetId])))).decimals | |
159 | + | let priceAssetDecimals = if ((sellOrder[IdxAssetId] == "WAVES")) | |
160 | + | then 8 | |
161 | + | else value(assetInfo(value(assetIdFromString(sellOrder[IdxAssetId])))).decimals | |
162 | + | let buyAmount = ((buyOrderAmount * pow10(amountAssetDecimals)) / exchangePrice) | |
163 | + | let sellAmount = sellOrderAmount | |
164 | + | let amountAssetAmount = if ((buyAmount >= sellAmount)) | |
165 | + | then sellAmount | |
166 | + | else buyAmount | |
167 | + | let priceAssetAmount = ((amountAssetAmount * exchangePrice) / pow10(amountAssetDecimals)) | |
168 | + | let updatedBuyStr = FormatOrderDataStr(buyOrder[IdxTradePair], buyOrder[IdxSender], buyOrder[IdxOrderType], buyPrice, (buyOrderAmount - priceAssetAmount), buyOrder[IdxAssetId]) | |
169 | + | let updatedSellStr = FormatOrderDataStr(sellOrder[IdxTradePair], sellOrder[IdxSender], sellOrder[IdxOrderType], sellPrice, (sellOrderAmount - amountAssetAmount), sellOrder[IdxAssetId]) | |
170 | + | ScriptResult(WriteSet([DataEntry(if (!(order1isSell)) | |
171 | + | then order1Id | |
172 | + | else order2Id, updatedBuyStr), DataEntry(if (order1isSell) | |
173 | + | then order1Id | |
174 | + | else order2Id, updatedSellStr)]), TransferSet([ScriptTransfer(addressFromStringValue(buyOrder[IdxSender]), retainMatcherFee(amountAssetAmount), assetIdFromString(buyOrder[IdxAssetId])), ScriptTransfer(addressFromStringValue(sellOrder[IdxSender]), retainMatcherFee(priceAssetAmount), assetIdFromString(sellOrder[IdxAssetId])), ScriptTransfer(i.caller, matcherFee(amountAssetAmount), assetIdFromString(buyOrder[IdxAssetId])), ScriptTransfer(i.caller, matcherFee(priceAssetAmount), assetIdFromString(sellOrder[IdxAssetId]))])) | |
175 | + | } | |
176 | + | } | |
177 | + | } | |
178 | + | ||
179 | + | ||
180 | + | ||
181 | + | @Callable(i) | |
182 | + | func registerTraidPair (asset1,priceAsset,traidPair) = WriteSet([DataEntry(((asset1 + "/") + priceAsset), traidPair)]) | |
183 | + | ||
184 | + |
github/deemru/w8io/026f985 17.84 ms ◑