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+Y2rXgVKpJSDL3j5MzZkFIFAAAAAA1hc3NldElkVG9rZW5CBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAGMAAAACAAAACmNvbnRleHRPYmoBAAAACWV4Y2hhbmdlcgAAAAEAAAAPbWluVG9rZW5SZWNpZXZlAwMJAABmAAAAAgAAAAAAAAAAAAUAAAAJY29taXNzaW9uBgkAAGYAAAACBQAAAAljb21pc3Npb24AAAAAAAAAAGQJAAACAAAAAQIAAAAZaW5jb3JyZWN0IGNvbWlzc2lvbiB2YWx1ZQQAAAAMYW1vdW50VG9rZW5CCQEAAAARQGV4dHJOYXRpdmUoMTA1MCkAAAACBQAAAAR0aGlzAgAAAAxhbW91bnRUb2tlbkIEAAAADGFtb3VudFRva2VuQQkBAAAAEUBleHRyTmF0aXZlKDEwNTApAAAAAgUAAAAEdGhpcwIAAAAMYW1vdW50VG9rZW5BB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 640860, "spentComplexity": 0 } View: original | compacted Prev: HXBgzBCaNnUpxyG2dbWupizCjjRQt7hDhzgdMepnicbA Next: 4U3FEhoZjDbjWBaQBgMhSuu3GjoudCiztd6NQnh6Es6u Diff:
Old | New | Differences | |
---|---|---|---|
7 | 7 | ||
8 | 8 | let assetIdTokenB = unit | |
9 | 9 | ||
10 | - | let comission = | |
10 | + | let comission = 99 | |
11 | 11 | ||
12 | 12 | @Callable(contextObj) | |
13 | 13 | func exchanger (minTokenRecieve) = if (if ((0 > comission)) |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let owner = base58'3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL' | |
5 | 5 | ||
6 | 6 | let assetIdTokenA = base58'9Jsnot7RWQmTsfXtezQN7igoS2q1QF1jsotaxwh8Fxp4' | |
7 | 7 | ||
8 | 8 | let assetIdTokenB = unit | |
9 | 9 | ||
10 | - | let comission = | |
10 | + | let comission = 99 | |
11 | 11 | ||
12 | 12 | @Callable(contextObj) | |
13 | 13 | func exchanger (minTokenRecieve) = if (if ((0 > comission)) | |
14 | 14 | then true | |
15 | 15 | else (comission > 100)) | |
16 | 16 | then throw("incorrect comission value") | |
17 | 17 | else { | |
18 | 18 | let amountTokenB = getIntegerValue(this, "amountTokenB") | |
19 | 19 | let amountTokenA = getIntegerValue(this, "amountTokenA") | |
20 | 20 | let payment = match contextObj.payment { | |
21 | 21 | case p: AttachedPayment => | |
22 | 22 | p | |
23 | 23 | case _ => | |
24 | 24 | throw("Payment not attached") | |
25 | 25 | } | |
26 | 26 | let assetIdReceived = payment.assetId | |
27 | 27 | let tokenReceiveAmount = payment.amount | |
28 | 28 | if ((assetIdReceived == assetIdTokenB)) | |
29 | 29 | then { | |
30 | 30 | let tokenSendAmount = ((fraction(amountTokenA, tokenReceiveAmount, (tokenReceiveAmount + amountTokenB)) * (100 - comission)) / 100) | |
31 | 31 | if ((minTokenRecieve > tokenSendAmount)) | |
32 | 32 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
33 | 33 | else { | |
34 | 34 | let assetIdSent = assetIdTokenA | |
35 | 35 | ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA - tokenSendAmount)), DataEntry("amountTokenB", (amountTokenB + tokenReceiveAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)])) | |
36 | 36 | } | |
37 | 37 | } | |
38 | 38 | else if ((assetIdReceived == assetIdTokenA)) | |
39 | 39 | then { | |
40 | 40 | let tokenSendAmount = ((fraction(amountTokenB, tokenReceiveAmount, (tokenReceiveAmount + amountTokenA)) * (100 - comission)) / 100) | |
41 | 41 | if ((minTokenRecieve > tokenSendAmount)) | |
42 | 42 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
43 | 43 | else { | |
44 | 44 | let assetIdSent = assetIdTokenB | |
45 | 45 | ScriptResult(WriteSet([DataEntry("amountTokenA", (amountTokenA + tokenReceiveAmount)), DataEntry("amountTokenB", (amountTokenB - tokenSendAmount))]), TransferSet([ScriptTransfer(contextObj.caller, tokenSendAmount, assetIdSent)])) | |
46 | 46 | } | |
47 | 47 | } | |
48 | 48 | else throw("Asset is not allowed") | |
49 | 49 | } | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | ||
53 | 53 | @Callable(contextObj) | |
54 | 54 | func withdraw () = { | |
55 | 55 | let BalanceTokenA = assetBalance(this, assetIdTokenA) | |
56 | 56 | let BalanceTokenB = assetBalance(this, assetIdTokenB) | |
57 | 57 | if ((contextObj.caller.bytes == owner)) | |
58 | 58 | then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(contextObj.caller, BalanceTokenA, assetIdTokenA), ScriptTransfer(contextObj.caller, BalanceTokenB, assetIdTokenB)])) | |
59 | 59 | else throw("You are not exchanger's owner") | |
60 | 60 | } | |
61 | 61 | ||
62 | 62 | ||
63 | 63 | @Verifier(contextObj) | |
64 | 64 | func verify () = true | |
65 | 65 |
github/deemru/w8io/026f985 40.94 ms ◑