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