tx · CDX9KYjmN7g1reFWuXq6CeJj7H1WvrCTTMeWtBnckchx

3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV:  -0.01400000 Waves

2019.07.18 17:50 [591454] smart account 3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV > SELF 0.00000000 Waves

{ "type": 13, "id": "CDX9KYjmN7g1reFWuXq6CeJj7H1WvrCTTMeWtBnckchx", "fee": 1400000, "feeAssetId": null, "timestamp": 1563461432874, "version": 1, "sender": "3MpVFGJWgiGyh5LmE1nxNLsjjtSL3Bgh9NV", "senderPublicKey": "854p8BYzrj6yBPRPmfQur3oF1Rjc1AJ548qRp5FT5kDa", "proofs": [ "48FNGbZk4Sw3Am9L5KCi3jrvxkb6J1WUr4NYhatW2wRZp1yNvom8tULhAGA9GszKMJLwA3qzrvBeX4uGwTPDDqgE" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVTvvhtsl5a8uJsx9lmVjj72aCuw5r86MC8AAAAADUxpcXVpZEFzc2V0SWQBAAAAIHBCjimyt7IbF+A5PbfgHl69Nj5vF05nQ3u/n6SWmToWAAAAAAdXQVZFU0lEBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAAAAAAACAAAACmNvbnRleHRPYmoBAAAACWV4Y2hhbmdlcgAAAAEAAAAPbWluVG9rZW5SZWNpZXZlBAAAAAt3YXZlc0Ftb3VudAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAALd2F2ZXNBbW91bnQEAAAADGxpcXVpZEFtb3VudAkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAMbGlxdWlkQW1vdW50BAAAAAdwYXltZW50BAAAAAckbWF0Y2gwCAUAAAAKY29udGV4dE9iagAAAAdwYXltZW50AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9BdHRhY2hlZFBheW1lbnQEAAAAAXAFAAAAByRt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ZXRJZAQAAAAMV2F2ZXNCYWxhbmNlCQEAAAAMd2F2ZXNCYWxhbmNlAAAAAQUAAAAEdGhpcwMJAAAAAAAAAggIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgAAAAVieXRlcwUAAAAFb3duZXIJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACAgAAAAxsaXF1aWRBbW91bnQCAAAACXdpdGhkcmF3bgkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgIAAAALd2F2ZXNBbW91bnQCAAAACXdpdGhkcmF3bgUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAANTGlxdWlkQmFsYW5jZQUAAAANTGlxdWlkQXNzZXRJZAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIFAAAADFdhdmVzQmFsYW5jZQUAAAAEdW5pdAUAAAADbmlsCQAAAgAAAAECAAAAHVlvdSBhcmUgbm90IGV4Y2hhbmdlcidzIG93bmVyAAAAAQAAAApjb250ZXh0T2JqAQAAAAZ2ZXJpZnkAAAAABkd0OuU=", "chainId": 84, "height": 591454, "spentComplexity": 0 } View: original | compacted Prev: 8vHTChqnq2mLz86DKdDtZV1yqCyWBPxYikVzKnPhd5xZ Next: 3JH4TD113CaBykNknW6hzoL7r7zDubPN9Xs84f69XFMq Diff:
OldNewDifferences
2323 let tokenReceiveAmount = payment.amount
2424 if ((assetIdReceived == unit))
2525 then {
26- let tokenSendAmount = ((fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount)) * (100 - comission)) / 100)
26+ let tokenSendAmount = fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount))
2727 if ((minTokenRecieve > tokenSendAmount))
2828 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
2929 else {
3333 }
3434 else if ((assetIdReceived == LiquidAssetId))
3535 then {
36- let tokenSendAmount = ((fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount)) * (100 - comission)) / 100)
36+ let tokenSendAmount = fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount))
3737 if ((minTokenRecieve > tokenSendAmount))
3838 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
3939 else {
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'3NBmj1eEDJmrQ16GJkmVU1p31MTURgoV38r'
55
66 let LiquidAssetId = base58'8ZDXPncY5ypuMoAY4Ec9hCH2eMbgVpSYtGXK7SzkzmQy'
77
88 let WAVESID = unit
99
1010 let comission = 0
1111
1212 @Callable(contextObj)
1313 func exchanger (minTokenRecieve) = {
1414 let wavesAmount = getIntegerValue(this, "wavesAmount")
1515 let liquidAmount = getIntegerValue(this, "liquidAmount")
1616 let payment = match contextObj.payment {
1717 case p: AttachedPayment =>
1818 p
1919 case _ =>
2020 throw("Payment not attached")
2121 }
2222 let assetIdReceived = payment.assetId
2323 let tokenReceiveAmount = payment.amount
2424 if ((assetIdReceived == unit))
2525 then {
26- let tokenSendAmount = ((fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount)) * (100 - comission)) / 100)
26+ let tokenSendAmount = fraction(liquidAmount, tokenReceiveAmount, (tokenReceiveAmount + wavesAmount))
2727 if ((minTokenRecieve > tokenSendAmount))
2828 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
2929 else {
3030 let assetIdSent = LiquidAssetId
3131 ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount - tokenSendAmount)), DataEntry("wavesAmount", (wavesAmount + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
3232 }
3333 }
3434 else if ((assetIdReceived == LiquidAssetId))
3535 then {
36- let tokenSendAmount = ((fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount)) * (100 - comission)) / 100)
36+ let tokenSendAmount = fraction(wavesAmount, tokenReceiveAmount, (tokenReceiveAmount + liquidAmount))
3737 if ((minTokenRecieve > tokenSendAmount))
3838 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
3939 else {
4040 let assetIdSent = unit
4141 ScriptResult(WriteSet([DataEntry("liquidAmount", (liquidAmount + tokenReceiveAmount)), DataEntry("wavesAmount", (wavesAmount - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
4242 }
4343 }
4444 else throw("Asset is not allowed")
4545 }
4646
4747
4848
4949 @Callable(contextObj)
5050 func withdraw () = {
5151 let LiquidBalance = assetBalance(this, LiquidAssetId)
5252 let WavesBalance = wavesBalance(this)
5353 if ((contextObj.caller.bytes == owner))
5454 then ScriptResult(WriteSet([DataEntry("liquidAmount", "withdrawn"), DataEntry("wavesAmount", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, LiquidBalance, LiquidAssetId), ScriptTransfer(contextObj.caller, WavesBalance, unit)]))
5555 else throw("You are not exchanger's owner")
5656 }
5757
5858
5959 @Verifier(contextObj)
6060 func verify () = true
6161

github/deemru/w8io/169f3d6 
43.97 ms