tx · C6BfHa54RubtNkmR6dyt5DTofdEp34i7eBQ2nDi2tWvY

3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX:  -0.01400000 Waves

2019.07.11 12:03 [580826] smart account 3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX > SELF 0.00000000 Waves

{ "type": 13, "id": "C6BfHa54RubtNkmR6dyt5DTofdEp34i7eBQ2nDi2tWvY", "fee": 1400000, "feeAssetId": null, "timestamp": 1562835818424, "version": 1, "sender": "3N4w7wVkViML11XdFL5xNkPofVVg1nLWEmX", "senderPublicKey": "EKGwbPjcrwuWgDm8Ed9HAGmxMviCRgqTkQDVt4rYbyre", "proofs": [ "LuMyKuQTNsP1MzR1b6uTqPM2JAFNDNaNe42ouUoD8qZrDqpiFMASYoptMZRTmhC6qy2kr4Cf9468uVsXdng8Xd8" ], "script": "base64:AAIDAAAAAAAAAAAAAAADAAAAAAVvd25lcgEAAAAaAVTvvhtsl5a8uJsx9lmVjj72aCuw5r86MC8AAAAADUxpcXVpZEFzc2V0SWQBAAAAIOko/8ffrEF7C8jHeLG92rw5x2KlLkjVtarJvVMwnDvrAAAAAAdXQVZFU0lEBQAAAAR1bml0AAAAAgAAAApjb250ZXh0T2JqAQAAAAd1bmlzd2FwAAAAAAQAAAALd2F2ZXNBbW91bnQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAAC3dhdmVzQW1vdW50BAAAAAxsaXF1aWRBbW91bnQJAQAAABFAZXh0ck5hdGl2ZSgxMDUwKQAAAAIFAAAABHRoaXMCAAAADGxpcXVpZEFtb3VudAQAAAAHcGF5bWVudAQAAAAHJG1hdGNoMAgFAAAACmNvbnRleHRPYmoAAAAHcGF5bWVudAMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAPQXR0YWNoZWRQYXltZW50BAAAAAFwBQAAAAckbWF0Y2gwBQAAAAFwCQAAAgAAAAECAAAAFFBheW1lbnQgbm90IGF0dGFjaGVkBAAAAA9hc3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dWlkQmFsYW5jZQUAAAANTGlxdWlkQXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADFdhdmVzQmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHVlvdSBhcmUgbm90IGV4Y2hhbmdlcidzIG93bmVyAAAAAQAAAApjb250ZXh0T2JqAQAAAAZ2ZXJpZnkAAAAABh+WEQw=", "chainId": 84, "height": 580826, "spentComplexity": 0 } View: original | compacted Prev: BMXPWUrZNuz1rf9srKZvyfhnD3ShTL7cREM2DvXSpgCU Next: GLRY6F4ZQhCYBThEXFtPCAnKmk3Mu6PfDgB1zYNJyyfg Diff:
OldNewDifferences
88 let WAVESID = unit
99
1010 @Callable(contextObj)
11-func uniswap (comission,minPriceLevel) = if (if ((0 > comission))
12- then true
13- else (comission > 100))
14- then throw("incorrect comission value")
15- else {
16- let wavesAmount = getIntegerValue(this, "wavesAmount")
17- let liquidAmount = getIntegerValue(this, "liquidAmount")
18- let payment = match contextObj.payment {
19- case p: AttachedPayment =>
20- p
21- case _ =>
22- throw("Payment not attached")
23- }
24- let assetIdReceived = payment.assetId
25- let tokenReceiveAmount = payment.amount
26- if ((assetIdReceived == unit))
11+func uniswap () = {
12+ let wavesAmount = getIntegerValue(this, "wavesAmount")
13+ let liquidAmount = getIntegerValue(this, "liquidAmount")
14+ let payment = match contextObj.payment {
15+ case p: AttachedPayment =>
16+ p
17+ case _ =>
18+ throw("Payment not attached")
19+ }
20+ let assetIdReceived = payment.assetId
21+ let tokenReceiveAmount = payment.amount
22+ if ((assetIdReceived == unit))
23+ then {
24+ let tokenSendAmount = fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount))
25+ let assetIdSent = LiquidAssetId
26+ ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount - tokenSendAmount)), DataEntry("wavesAmount", (wavesAmount + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
27+ }
28+ else if ((assetIdReceived == LiquidAssetId))
2729 then {
28- let tokenSendAmount = ((fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount)) * (100 - comission)) / 100)
29- if ((minPriceLevel > tokenSendAmount))
30- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
31- else {
32- let assetIdSent = LiquidAssetId
33- ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount - tokenSendAmount)), DataEntry("wavesAmount", (wavesAmount + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
34- }
30+ let tokenSendAmount = fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount))
31+ let assetIdSent = unit
32+ ScriptResult(WriteSet([DataEntry("liquidAmofunt", (liquidAmount + tokenReceiveAmount)), DataEntry("wavesAmount", (wavesAmount - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
3533 }
36- else if ((assetIdReceived == LiquidAssetId))
37- then {
38- let tokenSendAmount = ((fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount)) * (100 - comission)) / 100)
39- if ((minPriceLevel > tokenSendAmount))
40- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
41- else {
42- let assetIdSent = unit
43- ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount + tokenReceiveAmount)), DataEntry("wavesAmount", (wavesAmount - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
44- }
45- }
46- else throw("Asset is not allowed")
47- }
34+ else throw("Asset is not allowed")
35+ }
4836
4937
5038
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'3NBmj1eEDJmrQ16GJkmVU1p31MTURgoV38r'
55
66 let LiquidAssetId = base58'GhAFhXzwCYfvcXQ3GHFaQFnCzAuYCT156qFqiYyzfkzv'
77
88 let WAVESID = unit
99
1010 @Callable(contextObj)
11-func uniswap (comission,minPriceLevel) = if (if ((0 > comission))
12- then true
13- else (comission > 100))
14- then throw("incorrect comission value")
15- else {
16- let wavesAmount = getIntegerValue(this, "wavesAmount")
17- let liquidAmount = getIntegerValue(this, "liquidAmount")
18- let payment = match contextObj.payment {
19- case p: AttachedPayment =>
20- p
21- case _ =>
22- throw("Payment not attached")
23- }
24- let assetIdReceived = payment.assetId
25- let tokenReceiveAmount = payment.amount
26- if ((assetIdReceived == unit))
11+func uniswap () = {
12+ let wavesAmount = getIntegerValue(this, "wavesAmount")
13+ let liquidAmount = getIntegerValue(this, "liquidAmount")
14+ let payment = match contextObj.payment {
15+ case p: AttachedPayment =>
16+ p
17+ case _ =>
18+ throw("Payment not attached")
19+ }
20+ let assetIdReceived = payment.assetId
21+ let tokenReceiveAmount = payment.amount
22+ if ((assetIdReceived == unit))
23+ then {
24+ let tokenSendAmount = fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount))
25+ let assetIdSent = LiquidAssetId
26+ ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount - tokenSendAmount)), DataEntry("wavesAmount", (wavesAmount + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
27+ }
28+ else if ((assetIdReceived == LiquidAssetId))
2729 then {
28- let tokenSendAmount = ((fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount)) * (100 - comission)) / 100)
29- if ((minPriceLevel > tokenSendAmount))
30- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
31- else {
32- let assetIdSent = LiquidAssetId
33- ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount - tokenSendAmount)), DataEntry("wavesAmount", (wavesAmount + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
34- }
30+ let tokenSendAmount = fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount))
31+ let assetIdSent = unit
32+ ScriptResult(WriteSet([DataEntry("liquidAmofunt", (liquidAmount + tokenReceiveAmount)), DataEntry("wavesAmount", (wavesAmount - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
3533 }
36- else if ((assetIdReceived == LiquidAssetId))
37- then {
38- let tokenSendAmount = ((fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount)) * (100 - comission)) / 100)
39- if ((minPriceLevel > tokenSendAmount))
40- then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
41- else {
42- let assetIdSent = unit
43- ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount + tokenReceiveAmount)), DataEntry("wavesAmount", (wavesAmount - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
44- }
45- }
46- else throw("Asset is not allowed")
47- }
34+ else throw("Asset is not allowed")
35+ }
4836
4937
5038
5139 @Callable(contextObj)
5240 func withdraw () = {
5341 let LiquidBalance = assetBalance(this, LiquidAssetId)
5442 let WavesBalance = wavesBalance(this)
5543 if ((contextObj.caller.bytes == owner))
5644 then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, LiquidBalance, LiquidAssetId), ScriptTransfer(contextObj.caller, WavesBalance, unit)]))
5745 else throw("You are not exchanger's owner")
5846 }
5947
6048
6149 @Verifier(contextObj)
6250 func verify () = true
6351

github/deemru/w8io/026f985 
26.34 ms