tx · ECMx6uzT9saTaxjDdHWmqWSdMQW8EPTvK3RCuD75K7mu 3Mv3BEQ8WS2wzrEXuSfxDm7U9UKb5qLSnUc: -0.01400000 Waves 2019.08.10 15:52 [624949] smart account 3Mv3BEQ8WS2wzrEXuSfxDm7U9UKb5qLSnUc > SELF 0.00000000 Waves
{ "type": 13, "id": "ECMx6uzT9saTaxjDdHWmqWSdMQW8EPTvK3RCuD75K7mu", "fee": 1400000, "feeAssetId": null, "timestamp": 1565441553374, "version": 1, "sender": "3Mv3BEQ8WS2wzrEXuSfxDm7U9UKb5qLSnUc", "senderPublicKey": "BoKgJQhf9RWMmneqYEhyMKeUXMCYRJRhaBTDd2w1Rtx", "proofs": [ "38CnGyuRu6bthaw13VhJrHnHANje6sz9sXwKu9YhogXnKJ8ahYHXaSCDaPoiJJkTdWTjq2RQLj8giVVG4uogeVPg" ], "script": "base64:AAIDAAAAAAAAAAAAAAACAAAAAApWU1RBc3NldElEAQAAACCucYFuBYSotpFz1qoINfKJVo0JlR9XCghLbxw/TM2XswAAAAANZWlnaHREZWNpbWFscwAAAAAABfXhAAAAAAYAAAABaQEAAAALbWFrZVNlbGxWU1QAAAABAAAABXByaWNlAwkAAGcAAAACAAAAAAAAAAAABQAAAAVwcmljZQkAAAIAAAABAgAAABZwcmljZSBtdXN0IGJlIHBvc2l0aXZlBAAAAAdwYXltZW50CQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQEAAAACIT0AAAACCAUAAAAHcGF5bWVudAAAAAdhc3NldElkBQAAAApWU1RBc3NldElECQAAAgAAAAEJAAEsAAAAAgIAAAARYXNzZXQgaWQgbXVzdCBiZSAJAAJYAAAAAQUAAAAKVlNUQXNzZXRJRAQAAAAHb3JkZXJJZAkAASwAAAACAgAAAAVzZWxsXwkAAlgAAAABCAUAAAABaQAAAA10cmFuc2FjdGlvbklkCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACC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0byByZXR1cm4JAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQABLAAAAAIFAAAAB29yZGVySWQCAAAABl9zcGVudAUAAAAGYW1vdW50BQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAxyZXR1cm5BbW91bnQFAAAAClZTVEFzc2V0SUQFAAAAA25pbAAAAADPvwYJ", "chainId": 84, "height": 624949, "spentComplexity": 0 } View: original | compacted Prev: ERez6Q6cANpEW59DejHKMXyjFddobRj7GRrpRBimVqNb Next: 98aJXBwkB6LwXbGfASM3CZZVzreBYBFA1Eghu4HVYD85 Diff:
Old | New | Differences | |
---|---|---|---|
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | 8 | @Callable(c) | |
9 | - | func makeSellVST (d) = { | |
10 | - | let e = extract(c.payment) | |
11 | - | if ((e.assetId != a)) | |
12 | - | then throw(("asset id must be " + toBase58String(a))) | |
13 | - | else { | |
14 | - | let f = ("sell_" + toBase58String(c.transactionId)) | |
15 | - | WriteSet([DataEntry((f + "_amount"), e.amount), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
16 | - | } | |
17 | - | } | |
9 | + | func makeSellVST (d) = if ((0 >= d)) | |
10 | + | then throw("price must be positive") | |
11 | + | else { | |
12 | + | let e = extract(c.payment) | |
13 | + | if ((e.assetId != a)) | |
14 | + | then throw(("asset id must be " + toBase58String(a))) | |
15 | + | else { | |
16 | + | let f = ("sell_" + toBase58String(c.transactionId)) | |
17 | + | WriteSet([DataEntry((f + "_amount"), e.amount), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
18 | + | } | |
19 | + | } | |
18 | 20 | ||
19 | 21 | ||
20 | 22 | ||
21 | 23 | @Callable(c) | |
22 | - | func makeBuyVST (d) = { | |
23 | - | let e = extract(c.payment) | |
24 | - | if ((e.assetId != unit)) | |
25 | - | then throw("asset id must be WAVES") | |
26 | - | else { | |
27 | - | let f = ("buy_" + toBase58String(c.transactionId)) | |
28 | - | WriteSet([DataEntry((f + "_amount"), ((e.amount * d) / b)), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
29 | - | } | |
30 | - | } | |
24 | + | func makeBuyVST (d) = if ((0 >= d)) | |
25 | + | then throw("price must be positive") | |
26 | + | else { | |
27 | + | let e = extract(c.payment) | |
28 | + | if ((e.assetId != unit)) | |
29 | + | then throw("asset id must be WAVES") | |
30 | + | else { | |
31 | + | let f = ("buy_" + toBase58String(c.transactionId)) | |
32 | + | WriteSet([DataEntry((f + "_amount"), ((e.amount * d) / b)), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
33 | + | } | |
34 | + | } | |
31 | 35 | ||
32 | 36 | ||
33 | 37 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = base58'CjxKp2kfytghpfforkYLSoXHzJyJ5QYKLYQYgN7pQV4E' | |
5 | 5 | ||
6 | 6 | let b = 100000000 | |
7 | 7 | ||
8 | 8 | @Callable(c) | |
9 | - | func makeSellVST (d) = { | |
10 | - | let e = extract(c.payment) | |
11 | - | if ((e.assetId != a)) | |
12 | - | then throw(("asset id must be " + toBase58String(a))) | |
13 | - | else { | |
14 | - | let f = ("sell_" + toBase58String(c.transactionId)) | |
15 | - | WriteSet([DataEntry((f + "_amount"), e.amount), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
16 | - | } | |
17 | - | } | |
9 | + | func makeSellVST (d) = if ((0 >= d)) | |
10 | + | then throw("price must be positive") | |
11 | + | else { | |
12 | + | let e = extract(c.payment) | |
13 | + | if ((e.assetId != a)) | |
14 | + | then throw(("asset id must be " + toBase58String(a))) | |
15 | + | else { | |
16 | + | let f = ("sell_" + toBase58String(c.transactionId)) | |
17 | + | WriteSet([DataEntry((f + "_amount"), e.amount), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
18 | + | } | |
19 | + | } | |
18 | 20 | ||
19 | 21 | ||
20 | 22 | ||
21 | 23 | @Callable(c) | |
22 | - | func makeBuyVST (d) = { | |
23 | - | let e = extract(c.payment) | |
24 | - | if ((e.assetId != unit)) | |
25 | - | then throw("asset id must be WAVES") | |
26 | - | else { | |
27 | - | let f = ("buy_" + toBase58String(c.transactionId)) | |
28 | - | WriteSet([DataEntry((f + "_amount"), ((e.amount * d) / b)), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
29 | - | } | |
30 | - | } | |
24 | + | func makeBuyVST (d) = if ((0 >= d)) | |
25 | + | then throw("price must be positive") | |
26 | + | else { | |
27 | + | let e = extract(c.payment) | |
28 | + | if ((e.assetId != unit)) | |
29 | + | then throw("asset id must be WAVES") | |
30 | + | else { | |
31 | + | let f = ("buy_" + toBase58String(c.transactionId)) | |
32 | + | WriteSet([DataEntry((f + "_amount"), ((e.amount * d) / b)), DataEntry((f + "_price"), d), DataEntry((f + "_owner"), toBase58String(c.caller.bytes)), DataEntry((f + "_spent"), 0)]) | |
33 | + | } | |
34 | + | } | |
31 | 35 | ||
32 | 36 | ||
33 | 37 | ||
34 | 38 | @Callable(c) | |
35 | 39 | func takeSellVST (g) = { | |
36 | 40 | let f = ("sell_" + g) | |
37 | 41 | let e = extract(c.payment) | |
38 | 42 | if ((e.assetId != unit)) | |
39 | 43 | then throw("asset must be WAVES") | |
40 | 44 | else { | |
41 | 45 | let d = getIntegerValue(this, (f + "_price")) | |
42 | 46 | let h = e.amount | |
43 | 47 | let i = ((h * d) / b) | |
44 | 48 | let j = getIntegerValue(this, (f + "_amount")) | |
45 | 49 | let k = getIntegerValue(this, (f + "_spent")) | |
46 | 50 | let l = (k + i) | |
47 | 51 | if ((l > j)) | |
48 | 52 | then throw("not enougth asset in order") | |
49 | 53 | else ScriptResult(WriteSet([DataEntry((f + "_spent"), l)]), TransferSet([ScriptTransfer(c.caller, i, a)])) | |
50 | 54 | } | |
51 | 55 | } | |
52 | 56 | ||
53 | 57 | ||
54 | 58 | ||
55 | 59 | @Callable(c) | |
56 | 60 | func takeBuyVST (g) = { | |
57 | 61 | let f = ("buy_" + g) | |
58 | 62 | let e = extract(c.payment) | |
59 | 63 | if ((e.assetId != a)) | |
60 | 64 | then throw(("asset must be " + toBase58String(a))) | |
61 | 65 | else { | |
62 | 66 | let d = getIntegerValue(this, (f + "_price")) | |
63 | 67 | let i = e.amount | |
64 | 68 | let h = ((i * b) / d) | |
65 | 69 | let j = getIntegerValue(this, (f + "_amount")) | |
66 | 70 | let k = getIntegerValue(this, (f + "_spent")) | |
67 | 71 | let l = (k + i) | |
68 | 72 | if ((l > j)) | |
69 | 73 | then throw("not enougth asset in order") | |
70 | 74 | else ScriptResult(WriteSet([DataEntry((f + "_spent"), l)]), TransferSet([ScriptTransfer(c.caller, h, unit)])) | |
71 | 75 | } | |
72 | 76 | } | |
73 | 77 | ||
74 | 78 | ||
75 | 79 | ||
76 | 80 | @Callable(c) | |
77 | 81 | func returnBuyVST (g) = { | |
78 | 82 | let f = ("buy_" + g) | |
79 | 83 | let m = getStringValue(this, (f + "_owner")) | |
80 | 84 | if ((m != toBase58String(c.caller.bytes))) | |
81 | 85 | then throw("return should be called by order owner") | |
82 | 86 | else { | |
83 | 87 | let j = getIntegerValue(this, (f + "_amount")) | |
84 | 88 | let k = getIntegerValue(this, (f + "_spent")) | |
85 | 89 | let d = getIntegerValue(this, (f + "_price")) | |
86 | 90 | let n = (((j - k) * b) / d) | |
87 | 91 | if ((0 >= n)) | |
88 | 92 | then throw("nothing to return") | |
89 | 93 | else ScriptResult(WriteSet([DataEntry((f + "_spent"), j)]), TransferSet([ScriptTransfer(c.caller, n, unit)])) | |
90 | 94 | } | |
91 | 95 | } | |
92 | 96 | ||
93 | 97 | ||
94 | 98 | ||
95 | 99 | @Callable(c) | |
96 | 100 | func returnSellVST (g) = { | |
97 | 101 | let f = ("sell_" + g) | |
98 | 102 | let m = getStringValue(this, (f + "_owner")) | |
99 | 103 | if ((m != toBase58String(c.caller.bytes))) | |
100 | 104 | then throw("return should be called by order owner") | |
101 | 105 | else { | |
102 | 106 | let j = getIntegerValue(this, (f + "_amount")) | |
103 | 107 | let k = getIntegerValue(this, (f + "_spent")) | |
104 | 108 | let n = (j - k) | |
105 | 109 | if ((0 >= n)) | |
106 | 110 | then throw("nothing to return") | |
107 | 111 | else ScriptResult(WriteSet([DataEntry((f + "_spent"), j)]), TransferSet([ScriptTransfer(c.caller, n, a)])) | |
108 | 112 | } | |
109 | 113 | } | |
110 | 114 | ||
111 | 115 |
github/deemru/w8io/026f985 36.39 ms ◑