tx · CkSGLxH3tJcemKeAjckS6d8ZFp3BoRyqgb3hyMmRTkL2

3N6KuDDYL9ZpT5CQ1HuzW9G1UfGRXizWbqp:  -0.01400000 Waves

2020.08.10 17:21 [1126510] smart account 3N6KuDDYL9ZpT5CQ1HuzW9G1UfGRXizWbqp > SELF 0.00000000 Waves

{ "type": 13, "id": "CkSGLxH3tJcemKeAjckS6d8ZFp3BoRyqgb3hyMmRTkL2", "fee": 1400000, "feeAssetId": null, "timestamp": 1597069350314, "version": 1, "sender": "3N6KuDDYL9ZpT5CQ1HuzW9G1UfGRXizWbqp", "senderPublicKey": "6WhtgU8um8x2gsT5riuxYih51LoJYx91dzcx7TCx7JT1", "proofs": [ "qVku5PUayETbociZZEbpebmehvkLaDPFmavc9ih2N8VSYXNQx6ik6DFaLSf7ZL3rSJhrm3SYQY5JA4r7jfj5a7F" ], "script": "base64:AAIDAAAAAAAAAA0IARIAEgASAwoBARIAAAAACAAAAAAFb3duZXIBAAAAGgFUkVp9YFceKxS4tZgdZWFQ73BG70sIYCklAAAAAAhJZFRva2VuQQIAAAAFV0FWRVMAAAAACElkVG9rZW5CAgAAACxKNGVlMWJGcU5TcmRheUZvVWVnWHZCWGQxWFltSnRYaDFOUW51RkxDUHFvVwAAAAAJY29taXNzaW9uAAAAAAAAAAAAAAAAAAd2ZXJzaW9uAgAAAAUwLjAuMQEAAAAHYXNzZXRJZAAAAAEAAAAFYXNzZXQDCQAAAAAAAAIFAAAABWFzc2V0AgAAAAVXQVZFUwUAAAAEdW5pdAkAAlkAAAABBQAAAAVhc3NldAAAAAANYXNzZXRJZFRva2VuQQkBAAAAB2Fzc2V0SWQAAAABBQAAAAhJZFRva2VuQQAAAAANYXNzZXRJZFRva2VuQgkBAAAAB2Fzc2V0SWQAAAABBQAAAAhJZFRva2VuQgAAAAQAAAAKY29udGV4dE9iagEAAAAEZnVuZAAAAAAEAAAAB3BheW1lbnQEAAAAByRtYXRjaDAIBQAAAApjb250ZXh0T2JqAAAAB3BheW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dXMHBQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAACmNvbnRleHRPYmoAAAAGY2FsbGVyBQAAAA1CYWxhbmNlVG9rZW5BBQAAAA1hc3NldElkVG9rZW5BCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAANQmFsYW5jZVRva2VuQgUAAAANYXNzZXRJZFRva2VuQgUAAAADbmlsCQAAAgAAAAECAAAAHVlvdSBhcmUgbm90IGV4Y2hhbmdlcidzIG93bmVyAAAAAGPE9Hs=", "chainId": 84, "height": 1126510, "spentComplexity": 0 } View: original | compacted Prev: 9wiCq1E65LZcAgqYn9gqL22Usmdd1SHKdDJUeLK2Z1DV Next: AQ68bg7ELPZFQHdeTC8ao5PfBhWNMcNRkynGx8BnniMG Diff:
OldNewDifferences
113113 else 0
114114 }
115115 if ((n == i))
116- then if (true)
117- then throw(toString(123))
118- else {
119- let u = ((fraction(p, o, (o + q)) * (100 - d)) / 100)
120- if ((r > u))
121- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
122- else {
123- let v = h
124- ScriptResult(WriteSet([DataEntry("amountTokenA", (p - u)), DataEntry("amountTokenB", (q + o)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
125- }
126- }
116+ then {
117+ let u = ((fraction(p, o, (o + q)) * (100 - d)) / 100)
118+ if ((r > u))
119+ then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
120+ else {
121+ let v = h
122+ ScriptResult(WriteSet([DataEntry("amountTokenA", (p - u)), DataEntry("amountTokenB", (q + o)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
123+ }
124+ }
127125 else if ((n == h))
128- then {
129- let u = ((fraction(q, o, (o + p)) * (100 - d)) / 100)
130- if ((r > u))
131- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
132- else {
133- let v = i
134- ScriptResult(WriteSet([DataEntry("amountTokenA", (p + o)), DataEntry("amountTokenB", (q - u)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
135- }
136- }
126+ then if (true)
127+ then throw(toString(123))
128+ else {
129+ let u = ((fraction(q, o, (o + p)) * (100 - d)) / 100)
130+ if ((r > u))
131+ then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
132+ else {
133+ let v = i
134+ ScriptResult(WriteSet([DataEntry("amountTokenA", (p + o)), DataEntry("amountTokenB", (q - u)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
135+ }
136+ }
137137 else throw("Asset is not allowed")
138138 }
139139
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let a = base58'3N3AeA5FWm7EHheHoik8BBEA3GXXJosnVY8'
55
66 let b = "WAVES"
77
88 let c = "J4ee1bFqNSrdayFoUegXvBXd1XYmJtXh1NQnuFLCPqoW"
99
1010 let d = 0
1111
1212 let e = "0.0.1"
1313
1414 func f (g) = if ((g == "WAVES"))
1515 then unit
1616 else fromBase58String(g)
1717
1818
1919 let h = f(b)
2020
2121 let i = f(c)
2222
2323 @Callable(j)
2424 func fund () = {
2525 let k = {
2626 let l = j.payment
2727 if ($isInstanceOf(l, "AttachedPayment"))
2828 then {
2929 let m = l
3030 m
3131 }
3232 else throw("Payment not attached")
3333 }
3434 let n = k.assetId
3535 let o = k.amount
3636 if (isDefined(h))
3737 then throw("aaaa")
3838 else if (if ((n == h))
3939 then !(isDefined(getBoolean(this, "fundA")))
4040 else false)
4141 then if (isDefined(getBoolean(this, "fundB")))
4242 then WriteSet([DataEntry("amountTokenA", o), DataEntry("fundA", true), DataEntry("exchange_count", 0), DataEntry("status", true), DataEntry("assetIdTokenA", b), DataEntry("assetIdTokenB", c), DataEntry("comission", d), DataEntry("version", e), DataEntry("owner", toBase58String(a))])
4343 else WriteSet([DataEntry("amountTokenA", o), DataEntry("assetIdTokenA", b), DataEntry("fundA", true)])
4444 else if (if ((n == i))
4545 then !(isDefined(getBoolean(this, "fundB")))
4646 else false)
4747 then if (isDefined(getBoolean(this, "fundA")))
4848 then WriteSet([DataEntry("amountTokenB", o), DataEntry("fundB", true), DataEntry("exchange_count", 0), DataEntry("status", true), DataEntry("assetIdTokenB", c), DataEntry("assetIdTokenB", c), DataEntry("comission", d), DataEntry("version", e), DataEntry("owner", toBase58String(a))])
4949 else WriteSet([DataEntry("amountTokenB", o), DataEntry("assetIdTokenB", c), DataEntry("fundB", true)])
5050 else throw("already funded or you try to fund with incorrect asset")
5151 }
5252
5353
5454
5555 @Callable(j)
5656 func replenishment () = {
5757 let k = {
5858 let l = j.payment
5959 if ($isInstanceOf(l, "AttachedPayment"))
6060 then {
6161 let m = l
6262 m
6363 }
6464 else throw("Payment not attached")
6565 }
6666 let n = k.assetId
6767 let o = k.amount
6868 if (if ((n == h))
6969 then isDefined(getBoolean(this, "fundA"))
7070 else false)
7171 then {
7272 let p = getIntegerValue(this, "amountTokenA")
7373 WriteSet([DataEntry("amountTokenA", (p + o))])
7474 }
7575 else if (if ((n == i))
7676 then isDefined(getBoolean(this, "fundB"))
7777 else false)
7878 then {
7979 let q = getIntegerValue(this, "amountTokenB")
8080 WriteSet([DataEntry("amountTokenB", (q + o))])
8181 }
8282 else throw("there was an error in the replenishment")
8383 }
8484
8585
8686
8787 @Callable(j)
8888 func exchanger (r) = if (if ((0 > d))
8989 then true
9090 else (d > 100))
9191 then throw("incorrect comission value")
9292 else {
9393 let q = getIntegerValue(this, "amountTokenB")
9494 let p = getIntegerValue(this, "amountTokenA")
9595 let k = {
9696 let l = j.payment
9797 if ($isInstanceOf(l, "AttachedPayment"))
9898 then {
9999 let m = l
100100 m
101101 }
102102 else throw("Payment not attached")
103103 }
104104 let n = k.assetId
105105 let o = k.amount
106106 let s = {
107107 let l = getInteger(this, "exchange_count")
108108 if ($isInstanceOf(l, "Int"))
109109 then {
110110 let t = l
111111 (value(getInteger(this, "exchangecount")) + t)
112112 }
113113 else 0
114114 }
115115 if ((n == i))
116- then if (true)
117- then throw(toString(123))
118- else {
119- let u = ((fraction(p, o, (o + q)) * (100 - d)) / 100)
120- if ((r > u))
121- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
122- else {
123- let v = h
124- ScriptResult(WriteSet([DataEntry("amountTokenA", (p - u)), DataEntry("amountTokenB", (q + o)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
125- }
126- }
116+ then {
117+ let u = ((fraction(p, o, (o + q)) * (100 - d)) / 100)
118+ if ((r > u))
119+ then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
120+ else {
121+ let v = h
122+ ScriptResult(WriteSet([DataEntry("amountTokenA", (p - u)), DataEntry("amountTokenB", (q + o)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
123+ }
124+ }
127125 else if ((n == h))
128- then {
129- let u = ((fraction(q, o, (o + p)) * (100 - d)) / 100)
130- if ((r > u))
131- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
132- else {
133- let v = i
134- ScriptResult(WriteSet([DataEntry("amountTokenA", (p + o)), DataEntry("amountTokenB", (q - u)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
135- }
136- }
126+ then if (true)
127+ then throw(toString(123))
128+ else {
129+ let u = ((fraction(q, o, (o + p)) * (100 - d)) / 100)
130+ if ((r > u))
131+ then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
132+ else {
133+ let v = i
134+ ScriptResult(WriteSet([DataEntry("amountTokenA", (p + o)), DataEntry("amountTokenB", (q - u)), DataEntry("exchange_count", (s + 1))]), TransferSet([ScriptTransfer(j.caller, u, v)]))
135+ }
136+ }
137137 else throw("Asset is not allowed")
138138 }
139139
140140
141141
142142 @Callable(j)
143143 func withdraw () = {
144144 let w = assetBalance(this, h)
145145 let x = assetBalance(this, i)
146146 if ((j.caller.bytes == a))
147147 then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn"), DataEntry("status", false)]), TransferSet([ScriptTransfer(j.caller, w, h), ScriptTransfer(j.caller, x, i)]))
148148 else throw("You are not exchanger's owner")
149149 }
150150
151151

github/deemru/w8io/169f3d6 
48.73 ms