tx · 3mbQpL9V1L9bRAkhiood43XYiLcUrQKt5bHjxRxs58bh 3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL: -0.01400000 Waves 2019.08.22 15:32 [642328] smart account 3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL > SELF 0.00000000 Waves
{ "type": 13, "id": "3mbQpL9V1L9bRAkhiood43XYiLcUrQKt5bHjxRxs58bh", "fee": 1400000, "feeAssetId": null, "timestamp": 1566477232758, "version": 1, "sender": "3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL", "senderPublicKey": "3RTmBp69DqXiohzMXcmVU1pMFssmztWoibFARiKrgTr7", "proofs": [ "32qW3nLSFzmrVf4pXen6JzKvThPytpiyvUynMdRabSxh4ZxxpxXCmmJJ9ZPu5JHQiovng7EnGXteQnJfWnRwz9Fo" ], "script": "base64:AAIDAAAAAAAAAAAAAAAEAAAAAAVvd25lcgEAAAAaAVSTOHBLt7RyJdugRiL5k8zovFc+bobXqh8AAAAADWFzc2V0SWRUb2tlbkEBAAAAIHtxzCCjiO5MvMQa1Azqp+Y2rXgVKpJSDL3j5MzZkFIFAAAAAA1hc3NldElkVG9rZW5CBQAAAAR1bml0AAAAAAljb21pc3Npb24AAAAAAAAAAAAAAAADAAAACmNvbnRleHRPYmoBAAAABGZ1bmQAAAAABAAAAAdwYXltZW50BAAAAAckbWF0Y2gwCAUAAAAKY29udGV4dE9iagAAAAdwYXltZW50AwkAAAEAAAACBQAAAAckbWF0Y2gwAgAAAA9BdHRhY2hlZFBheW1lbnQEAAAAAXAFAAAAByRtYXRjaDAFAAAAAXAJAAACAAAAAQIAAAAUUGF5bWVudCBub3QgYXR0YWNoZWQEAAAAD2Fzc2V0SWRSZWNlaXZlZAgFAAAAB3BheW1lbnQAAAAHYXNzZXRJZAQAAAASdG9rZW5SZWNlaXZlQW1vdW50CAUAAAAHcGF5bWVudAAAAAZhbW91bnQDAwkAAAAAAAACBQAAAA9hc3NldElkUmVjZWl2ZWQFA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WZ5AAAAAAYuHoBr", "chainId": 84, "height": 642328, "spentComplexity": 0 } View: original | compacted Prev: E3vfbtkmN1MFjtjdLJ9G6o5CvjKkw3ZNGepKuZYevCpX Next: B2LgimrneTiKrC1WT4AMSUmwMwu1H85FWJh5PNA5SeLi Diff:
Old | New | Differences | |
---|---|---|---|
26 | 26 | then !(isDefined(getString(this, "fundA"))) | |
27 | 27 | else false) | |
28 | 28 | then WriteSet([DataEntry("amountTokenA", j), DataEntry("fundA", "funded")]) | |
29 | - | else if ((i == c)) | |
29 | + | else if (if ((i == c)) | |
30 | + | then !(isDefined(getString(this, "fundB"))) | |
31 | + | else false) | |
30 | 32 | then WriteSet([DataEntry("amountTokenB", j), DataEntry("fundB", "funded")]) | |
31 | 33 | else throw("already funded or you try to fund with incorrect asset") | |
32 | 34 | } |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'3N3LWiYdT9n8o6ecwFZGy6MCehhq6sLUFFL' | |
5 | 5 | ||
6 | 6 | let b = base58'9Jsnot7RWQmTsfXtezQN7igoS2q1QF1jsotaxwh8Fxp4' | |
7 | 7 | ||
8 | 8 | let c = unit | |
9 | 9 | ||
10 | 10 | let d = 0 | |
11 | 11 | ||
12 | 12 | @Callable(e) | |
13 | 13 | func fund () = { | |
14 | 14 | let f = { | |
15 | 15 | let g = e.payment | |
16 | 16 | if ($isInstanceOf(g, "AttachedPayment")) | |
17 | 17 | then { | |
18 | 18 | let h = g | |
19 | 19 | h | |
20 | 20 | } | |
21 | 21 | else throw("Payment not attached") | |
22 | 22 | } | |
23 | 23 | let i = f.assetId | |
24 | 24 | let j = f.amount | |
25 | 25 | if (if ((i == b)) | |
26 | 26 | then !(isDefined(getString(this, "fundA"))) | |
27 | 27 | else false) | |
28 | 28 | then WriteSet([DataEntry("amountTokenA", j), DataEntry("fundA", "funded")]) | |
29 | - | else if ((i == c)) | |
29 | + | else if (if ((i == c)) | |
30 | + | then !(isDefined(getString(this, "fundB"))) | |
31 | + | else false) | |
30 | 32 | then WriteSet([DataEntry("amountTokenB", j), DataEntry("fundB", "funded")]) | |
31 | 33 | else throw("already funded or you try to fund with incorrect asset") | |
32 | 34 | } | |
33 | 35 | ||
34 | 36 | ||
35 | 37 | ||
36 | 38 | @Callable(e) | |
37 | 39 | func exchanger (k) = if (if ((0 > d)) | |
38 | 40 | then true | |
39 | 41 | else (d > 100)) | |
40 | 42 | then throw("incorrect comission value") | |
41 | 43 | else { | |
42 | 44 | let l = getIntegerValue(this, "amountTokenB") | |
43 | 45 | let m = getIntegerValue(this, "amountTokenA") | |
44 | 46 | let f = { | |
45 | 47 | let g = e.payment | |
46 | 48 | if ($isInstanceOf(g, "AttachedPayment")) | |
47 | 49 | then { | |
48 | 50 | let h = g | |
49 | 51 | h | |
50 | 52 | } | |
51 | 53 | else throw("Payment not attached") | |
52 | 54 | } | |
53 | 55 | let i = f.assetId | |
54 | 56 | let j = f.amount | |
55 | 57 | if ((i == c)) | |
56 | 58 | then { | |
57 | 59 | let n = ((fraction(m, j, (j + l)) * (100 - d)) / 100) | |
58 | 60 | if ((k > n)) | |
59 | 61 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
60 | 62 | else { | |
61 | 63 | let o = b | |
62 | 64 | ScriptResult(WriteSet([DataEntry("amountTokenA", (m - n)), DataEntry("amountTokenB", (l + j))]), TransferSet([ScriptTransfer(e.caller, n, o)])) | |
63 | 65 | } | |
64 | 66 | } | |
65 | 67 | else if ((i == b)) | |
66 | 68 | then { | |
67 | 69 | let n = ((fraction(l, j, (j + m)) * (100 - d)) / 100) | |
68 | 70 | if ((k > n)) | |
69 | 71 | then throw("Price has changed dramaticaly. Receiving token amount don't satisfy specified price level") | |
70 | 72 | else { | |
71 | 73 | let o = c | |
72 | 74 | ScriptResult(WriteSet([DataEntry("amountTokenA", (m + j)), DataEntry("amountTokenB", (l - n))]), TransferSet([ScriptTransfer(e.caller, n, o)])) | |
73 | 75 | } | |
74 | 76 | } | |
75 | 77 | else throw("Asset is not allowed") | |
76 | 78 | } | |
77 | 79 | ||
78 | 80 | ||
79 | 81 | ||
80 | 82 | @Callable(e) | |
81 | 83 | func withdraw () = { | |
82 | 84 | let p = assetBalance(this, b) | |
83 | 85 | let q = assetBalance(this, c) | |
84 | 86 | if ((e.caller.bytes == a)) | |
85 | 87 | then ScriptResult(WriteSet([DataEntry("amountTokenA", "withdrawn"), DataEntry("amountTokenB", "withdrawn")]), TransferSet([ScriptTransfer(e.caller, p, b), ScriptTransfer(e.caller, q, c)])) | |
86 | 88 | else throw("You are not exchanger's owner") | |
87 | 89 | } | |
88 | 90 | ||
89 | 91 | ||
90 | 92 | @Verifier(e) | |
91 | 93 | func r () = true | |
92 | 94 |
github/deemru/w8io/026f985 28.79 ms ◑