tx · 3axBkM6wCRVMD3Y3cc7JzQjBg5vohbLiZ8JPrJED8v1U

3N4a8C7yusTjNLbFDBVMQJ4BEkBwHEv3tQU:  -0.01000000 Waves

2019.06.22 19:46 [553506] smart account 3N4a8C7yusTjNLbFDBVMQJ4BEkBwHEv3tQU > SELF 0.00000000 Waves

{ "type": 13, "id": "3axBkM6wCRVMD3Y3cc7JzQjBg5vohbLiZ8JPrJED8v1U", "fee": 1000000, "feeAssetId": null, "timestamp": 1561222056812, "version": 1, "sender": "3N4a8C7yusTjNLbFDBVMQJ4BEkBwHEv3tQU", "senderPublicKey": "4jym492PKYRzYRk3gJpS1AGDQSpTtpeJUnpMMi3ektM1", "proofs": [ "dcyfWUPhD9NQwMfib2ftBGxhkheNGN6WoKo6966UWrmbKTa1kDbxXJouEhsjCk8podJspAjmwsJPuAUuXiUPuqU" ], "script": "base64:AAIDAAAAAAAAAAAAAAARAAAAAAhJZHhQcmljZQAAAAAAAAAAAAAAAAAJSWR4QW1vdW50AAAAAAAAAAABAAAAAAxJZHhUcmFkZVBhaXIAAAAAAAAAAAIAAAAADElkeE9yZGVyVHlwZQAAAAAAAAAAAwAAAAAJSWR4U2VuZGVyAAAAAAAAAAAEAAAAAApJZHhBc3NldElkAAAAAAAAAAAFAAAAAANCVVkCAAAAA0JVWQAAAAAEU0VMTAIAAAAEU0VMTAEAAAAKbWF0Y2hlckZlZQAAAAEAAAAGYW1vdW50CQAAawAAAAMFAAAABmFtb3VudAAAAAAAAAAAAQAAAAAAAAAD6AEAAAAQcmV0YWluTWF0Y2hlckZlZQAAAAEAAAAGYW1vdW50CQAAawAAAAMFAAAABmFtb3VudAAAAAAAAAAD5wAAAAAAAAAD6AEAAAAZUmVtb3ZlVW5kZXJzY29yZUlmUHJlc2VudAAAAAEAAAAJcmVtYWluaW5nAwkAAGYAAAACCQABMQAAAAEFAAAACXJlbWFpbmluZwAAAAAAAAAAAAkAATAAAAACBQAAAAlyZW1haW5pbmcAAAAAAAAAAAEFAAAAC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hTZW5kZXIJAQAAABByZXRhaW5NYXRjaGVyRmVlAAAAAQUAAAAQcHJpY2VBc3NldEFtb3VudAkBAAAAEWFzc2V0SWRGcm9tU3RyaW5nAAAAAQkAAZEAAAACBQAAAAlzZWxsT3JkZXIFAAAACklkeEFzc2V0SWQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwUAAAAEYWRkcgkAAGgAAAACAAAAAAAAAAACCQEAAAAKbWF0Y2hlckZlZQAAAAEFAAAAEHByaWNlQXNzZXRBbW91bnQJAQAAABFhc3NldElkRnJvbVN0cmluZwAAAAEJAAGRAAAAAgUAAAAJc2VsbE9yZGVyBQAAAApJZHhBc3NldElkBQAAAANuaWwAAAABaQEAAAARcmVnaXN0ZXJUcmFpZFBhaXIAAAADAAAABmFzc2V0MQAAAApwcmljZUFzc2V0AAAACXRyYWlkUGFpcgkBAAAACFdyaXRlU2V0AAAAAQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAABmFzc2V0MQIAAAABLwUAAAAKcHJpY2VBc3NldAUAAAAJdHJhaWRQYWlyBQAAAANuaWwAAAAAkiU6ug==", "chainId": 84, "height": 553506, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
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 matcherFee (amount) = fraction(amount, 1, 1000)
21+
22+
23+func retainMatcherFee (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+ let addr = addressFromStringValue(buyOrder[IdxSender])
171+ ScriptResult(WriteSet([DataEntry(if (!(order1isSell))
172+ then order1Id
173+ else order2Id, updatedBuyStr), DataEntry(if (order1isSell)
174+ then order1Id
175+ else order2Id, updatedSellStr)]), TransferSet([ScriptTransfer(addr, retainMatcherFee(amountAssetAmount), assetIdFromString(buyOrder[IdxAssetId])), ScriptTransfer(addressFromStringValue(sellOrder[IdxSender]), retainMatcherFee(priceAssetAmount), assetIdFromString(sellOrder[IdxAssetId])), ScriptTransfer(addr, (2 * matcherFee(priceAssetAmount)), assetIdFromString(sellOrder[IdxAssetId]))]))
176+ }
177+ }
178+ }
179+
180+
181+
182+@Callable(i)
183+func registerTraidPair (asset1,priceAsset,traidPair) = WriteSet([DataEntry(((asset1 + "/") + priceAsset), traidPair)])
184+
185+

github/deemru/w8io/026f985 
21.30 ms