tx · RWH34vwBRg1JQHkWropJ15gy2CvNT3Pcpre6PebWbFN

3N3wgpZuw6MWRgf7XouSYL26EZSHCBYKgd6:  -0.10000000 Waves

2020.04.01 11:40 [934852] smart account 3N3wgpZuw6MWRgf7XouSYL26EZSHCBYKgd6 > SELF 0.00000000 Waves

{ "type": 13, "id": "RWH34vwBRg1JQHkWropJ15gy2CvNT3Pcpre6PebWbFN", "fee": 10000000, "feeAssetId": null, "timestamp": 1585730079700, "version": 1, "sender": "3N3wgpZuw6MWRgf7XouSYL26EZSHCBYKgd6", "senderPublicKey": "9ZPbyU1ZXeXBHtwUPjdeVo3xNdu7TqRN7S81nrZznxs3", "proofs": [ "2tYaZCm9329AcK6qqkjgbAqXPEWRa48WYAkv4CNF5B16z1fwZncjS3DA7o8h7YewQppL8Vs7NHbFZNvCxS5bf1S8" ], "script": "base64:AAIDAAAAAAAAAAQIARIAAAAANwEAAAAOZ2V0TnVtYmVyQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABBoAAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQAAAAAAAAAAAAEAAAAOZ2V0U3RyaW5nQnlLZXkAAAABAAAAA2tleQQAAAAHJG1hdGNoMAkABB0AAAACBQAAAAR0aGlzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAABlN0cmluZwQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQIAAAAAAQAAABZnZXRCb29sQnlBZGRyZXNzQW5kS2V5AAAAAgAAAAdhZGRyZXNzAAAAA2tleQQAAAAHJG1hdGNoMAkABBsAAAACBQAAAAdhZGRyZXNzBQAAAANrZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAB0Jvb2xlYW4EAAAAAWEFAAAAByRtYXRjaDAFAAAAAWEHAQAAABhnZXRTdHJpbmdCeUFkZHJlc3NBbmRLZXkAAAACAAAAB2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Ym9uZEFtb3VudAMJAABnAAAAAgUAAAAPZGVmaWNpdFBvc2l0aXZlBQAAAAtib25kQmFsYW5jZQUAAAALYm9uZEJhbGFuY2UFAAAAD2RlZmljaXRQb3NpdGl2ZQQAAAAMcmV0dXJuQW1vdW50AwkAAGcAAAACBQAAAA9kZWZpY2l0UG9zaXRpdmUFAAAAC2JvbmRCYWxhbmNlAAAAAAAAAAAACQAAZQAAAAIFAAAAC2JvbmRCYWxhbmNlBQAAAA9kZWZpY2l0UG9zaXRpdmUJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAADUZpcnN0T3JkZXJLZXkCAAAABnRlc3QwMQkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAEWdldE9yZGVyU3RhdHVzS2V5AAAAAQUAAAAKZmlyc3RPcmRlcgIAAAAHdGVzdC0tMgUAAAADbmlsAAAAABqFw68=", "chainId": 84, "height": 934852, "spentComplexity": 0 } View: original | compacted Prev: none Next: J6Eap3tZdhThYoX6rFoQSM7YgeCeYBqDyBvDxhqXm1Uj Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 3 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+func getNumberByKey (key) = match getInteger(this, key) {
5+ case a: Int =>
6+ a
7+ case _ =>
8+ 0
9+}
10+
11+
12+func getStringByKey (key) = match getString(this, key) {
13+ case a: String =>
14+ a
15+ case _ =>
16+ ""
17+}
18+
19+
20+func getBoolByAddressAndKey (address,key) = match getBoolean(address, key) {
21+ case a: Boolean =>
22+ a
23+ case _ =>
24+ false
25+}
26+
27+
28+func getStringByAddressAndKey (address,key) = match getString(address, key) {
29+ case a: String =>
30+ a
31+ case _ =>
32+ ""
33+}
34+
35+
36+func getNumberByAddressAndKey (address,key) = match getInteger(address, key) {
37+ case a: Int =>
38+ a
39+ case _ =>
40+ 0
41+}
42+
43+
44+let WAVELET = 100000000
45+
46+let PAULI = 1000000
47+
48+let PERCENTACCURACY = 1000
49+
50+let MINORDERTOTAL = (10 * WAVELET)
51+
52+let MAXROI = 100
53+
54+let CANCELED = "canceled"
55+
56+let NEW = "new"
57+
58+let FILLED = "filled"
59+
60+let NeutrinoContractKey = "neutrino_contract"
61+
62+let PriceKey = "price"
63+
64+let BondAssetIdKey = "bond_asset_id"
65+
66+let NeutrinoAssetIdKey = "neutrino_asset_id"
67+
68+let ControlContractKey = "control_contract"
69+
70+let BalanceLockedkKey = "balance_lock_"
71+
72+let WavesLockedBalanceKey = (BalanceLockedkKey + "waves")
73+
74+let NeutrinoLockedBalanceKey = (BalanceLockedkKey + "neutrino")
75+
76+let LiquidationContractKey = "liquidation_contract"
77+
78+let FirstOrderKey = "order_first"
79+
80+func getRoiByOrderIdKey (orderId) = ("debug_order_roi_" + orderId)
81+
82+
83+func getOrderPriceKey (orderId) = ("order_price_" + orderId)
84+
85+
86+func getOrderTotalKey (orderId) = ("order_total_" + orderId)
87+
88+
89+func getOrderOwnerKey (orderId) = ("order_owner_" + orderId)
90+
91+
92+func getOrderHeightKey (orderId) = ("order_height_" + orderId)
93+
94+
95+func getOrderStatusKey (orderId) = ("order_status_" + orderId)
96+
97+
98+func getOrderFilledTotalKey (orderId) = ("order_filled_total_" + orderId)
99+
100+
101+func getPrevOrderKey (orderId) = ("order_prev_" + orderId)
102+
103+
104+func getNextOrderKey (orderId) = ("order_next_" + orderId)
105+
106+
107+func convertNeutrinoToWaves (amount,price) = fraction(fraction(amount, 100, price), WAVELET, PAULI)
108+
109+
110+func convertWavesToNeutrino (amount,price) = fraction(fraction(amount, price, 100), PAULI, WAVELET)
111+
112+
113+func convertWavesToBond (amount,price) = convertWavesToNeutrino(amount, price)
114+
115+
116+func convertBondToWaves (amount,price) = convertNeutrinoToWaves(amount, price)
117+
118+
119+let neutrinoContract = addressFromStringValue("3PC9BfRwJWWiw9AREE2B3eWzCks3CYtg4yo")
120+
121+let controlContract = addressFromStringValue("3P5Bfd58PPfNvBM2Hy8QfbcDqMeNtzg7KfP")
122+
123+let liquidationContract = addressFromStringValue("3P4PCxsJqMzQBALo8zANHtBDZRRquobHQp7")
124+
125+let neutrinoAssetId = fromBase58String("DG2xFkPdDwKUoBkzGAhQtLpSGzfXLiCYPEzeKH2Ad24p")
126+
127+let bondAssetId = fromBase58String("6nSpVyNH7yM69eg446wrQR94ipbbcmZMU1ENPwanC97g")
128+
129+let isBlocked = getBoolByAddressAndKey(controlContract, "is_blocked")
130+
131+let currentPrice = getNumberByAddressAndKey(controlContract, PriceKey)
132+
133+let neutrinoLockedBalance = getNumberByAddressAndKey(neutrinoContract, NeutrinoLockedBalanceKey)
134+
135+let reserve = (wavesBalance(neutrinoContract) - getNumberByAddressAndKey(neutrinoContract, WavesLockedBalanceKey))
136+
137+let neutrinoSupply = (((neutrinoLockedBalance + extract(assetInfo(neutrinoAssetId)).quantity) - assetBalance(neutrinoContract, neutrinoAssetId)) - assetBalance(liquidationContract, neutrinoAssetId))
138+
139+let deficit = (neutrinoSupply - convertWavesToNeutrino(reserve, currentPrice))
140+
141+let firstOrder = getStringByKey(FirstOrderKey)
142+
143+func getOrderPrice (id) = getNumberByKey(getOrderPriceKey(id))
144+
145+
146+func getOrderTotal (id) = getNumberByKey(getOrderTotalKey(id))
147+
148+
149+func getOrderOwner (id) = getStringByKey(getOrderOwnerKey(id))
150+
151+
152+func getOrderStatus (id) = getStringByKey(getOrderStatusKey(id))
153+
154+
155+func getOrderFilledTotal (id) = getNumberByKey(getOrderFilledTotalKey(id))
156+
157+
158+func getPrevOrder (id) = getStringByKey(getPrevOrderKey(id))
159+
160+
161+func getNextOrder (id) = getStringByKey(getNextOrderKey(id))
162+
163+
164+@Callable(i)
165+func sellBond () = {
166+ let bondBalance = assetBalance(this, bondAssetId)
167+ let deficitPositive = if ((0 >= deficit))
168+ then 0
169+ else deficit
170+ let bondAmount = if ((deficitPositive >= bondBalance))
171+ then bondBalance
172+ else deficitPositive
173+ let returnAmount = if ((deficitPositive >= bondBalance))
174+ then 0
175+ else (bondBalance - deficitPositive)
176+ WriteSet([DataEntry(FirstOrderKey, "test01"), DataEntry(getOrderStatusKey(firstOrder), "test--2")])
177+ }
178+
179+

github/deemru/w8io/169f3d6 
85.20 ms