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