tx · GUFPTeQDd17PYJcj2qLXSDkvF5uyXormhHXFsWXVY2s2

3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL:  -0.01400000 Waves

2019.08.21 15:05 [640860] smart account 3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL > SELF 0.00000000 Waves

{ "type": 13, "id": "GUFPTeQDd17PYJcj2qLXSDkvF5uyXormhHXFsWXVY2s2", "fee": 1400000, "feeAssetId": null, "timestamp": 1566389142284, "version": 1, "sender": "3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL", "senderPublicKey": "3RTmBp69DqXiohzMXcmVU1pMFssmztWoibFARiKrgTr7", "proofs": [ "2mdkg9qqrNbGg2ddcRph1S2hXdfZNncoBRPFNaZPCzPQ6CAcFRi6AL3bUUGu9EaeQeSDvyh9GRmzx111D34ntPwH" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVSTOHBLt7RyJdugRiL5k8zovFc+bobXqh8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIHtxzCCjiO5MvMQa1Azqp+Y2rXgVKpJSDL3j5MzZkFIFAAAAAA1hc3NldElkVG9rZW5CBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAGMAAAACAAAACmNvbnRleHRPYmoBAAAACWV4Y2hhbmdlcgAAAAEAAAAPbWluVG9rZW5SZWNpZXZlAwMJAABmAAAAAgAAAAAAAAAAAAUAAAAJY29taXNzaW9uBgkAAGYAAAACBQAAAAljb21pc3Npb24AAAAAAAAAAGQJAAACAAAAAQIAAAAZaW5jb3JyZWN0IGNvbWlzc2lvbiB2YWx1ZQQAAAAMYW1vdW50VG9rZW5CCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxhbW91bnRUb2tlbkIEAAAADGFtb3VudFRva2VuQQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAMYW1vdW50VG9rZW5B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": 640860, "spentComplexity": 0 } View: original | compacted Prev: HXBgzBCaNnUpxyG2dbWupizCjjRQt7hDhzgdMepnicbA Next: 4U3FEhoZjDbjWBaQBgMhSuu3GjoudCiztd6NQnh6Es6u Diff:
OldNewDifferences
77
88 let assetIdTokenB = unit
99
10-let comission = 0
10+let comission = 99
1111
1212 @Callable(contextObj)
1313 func exchanger (minTokenRecieve) = if (if ((0 > comission))
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let owner = base58'3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL'
55
66 let assetIdTokenA = base58'9Jsnot7RWQmTsfXtezQN7igoS2q1QF1jsotaxwh8Fxp4'
77
88 let assetIdTokenB = unit
99
10-let comission = 0
10+let comission = 99
1111
1212 @Callable(contextObj)
1313 func exchanger (minTokenRecieve) = if (if ((0 > comission))
1414 then true
1515 else (comission > 100))
1616 then throw("incorrect comission value")
1717 else {
1818 let amountTokenB = getIntegerValue(this, "amountTokenB")
1919 let amountTokenA = getIntegerValue(this, "amountTokenA")
2020 let payment = match contextObj.payment {
2121 case p: AttachedPayment =>
2222 p
2323 case _ =>
2424 throw("Payment not attached")
2525 }
2626 let assetIdReceived = payment.assetId
2727 let tokenReceiveAmount = payment.amount
2828 if ((assetIdReceived == assetIdTokenB))
2929 then {
3030 let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100)
3131 if ((minTokenRecieve > tokenSendAmount))
3232 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
3333 else {
3434 let assetIdSent = assetIdTokenA
3535 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
3636 }
3737 }
3838 else if ((assetIdReceived == assetIdTokenA))
3939 then {
4040 let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100)
4141 if ((minTokenRecieve > tokenSendAmount))
4242 then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level")
4343 else {
4444 let assetIdSent = assetIdTokenB
4545 ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)]))
4646 }
4747 }
4848 else throw("Asset is not allowed")
4949 }
5050
5151
5252
5353 @Callable(contextObj)
5454 func withdraw () = {
5555 let BalanceTokenA = assetBalance(this, assetIdTokenA)
5656 let BalanceTokenB = assetBalance(this, assetIdTokenB)
5757 if ((contextObj.caller.bytes == owner))
5858 then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)]))
5959 else throw("You are not exchanger's owner")
6060 }
6161
6262
6363 @Verifier(contextObj)
6464 func verify () = true
6565

github/deemru/w8io/026f985 
40.94 ms