tx · F8Lio1yyHw4A3rG6VgyLrYQ2tVhShxivJkx1fTjY9FCw 3N97fNcSZDMJQSbHFJVMvyN5NdJFnDHNYwf: -0.01000000 Waves 2019.08.13 14:22 [629242] smart account 3N97fNcSZDMJQSbHFJVMvyN5NdJFnDHNYwf > SELF 0.00000000 Waves
{ "type": 13, "id": "F8Lio1yyHw4A3rG6VgyLrYQ2tVhShxivJkx1fTjY9FCw", "fee": 1000000, "feeAssetId": null, "timestamp": 1565695342019, "version": 1, "sender": "3N97fNcSZDMJQSbHFJVMvyN5NdJFnDHNYwf", "senderPublicKey": "GbFQqysRz2kuAvcS6LFvbvjtuuQ4e1dtiTeqcQgdue9m", "proofs": [ "2t7aUVDV3j6TZA3196DyMqxgihrEUmQyHReMJw6rGHF5ew3h5vN7PhMU1c51SmjdKRGaT8k9UJ9Xb8uqGERtG6cX" ], "script": "base64:AAIDAAAAAAAAAAAAAAABAAAAAAx3YXZlc0Fzc2V0SWQBAAAAIAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAwAAAAFpAQAAAARzZWxsAAAAAgAAAAVwcmljZQAAAApwcmljZUFzc2V0BAAAAAFwCQEAAAAHZXh0cmFjdAAAAAEIBQAAAAFpAAAAB3BheW1lbnQDCQAAAAAAAAIIBQAAAAFwAAAAB2Fzc2V0SWQFAAAABHVuaXQJAAACAAAAAQIAAAAVWW91IGNhbid0IHNlbGwgV2F2ZXMuAwkAAGcAAAACAAAAAAAAAAAACAUAAAABcAAAAAZhbW91bnQJAAACAAAAAQIAAAASWW91IGNhbid0IG5vdGhpbmcuCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQACWAAAAAEIBQAAAAFpAAAADXRyYW5zYWN0aW9uSWQJAADLAAAAAgkAAMsAAAACCQAAywAAAAIJAADLAAAAAgkAAZoAAAABBQAAAAVwcmljZQkAAZoAAAABCAUAAAABcAAAAAZhbW91bnQFAAAACnByaWNlQ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AEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAthbW91bnRUb0J1eQUAAAALYW1vdW50QXNzZXQJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQUAAAAGc2VsbGVyBQAAAAVwcmljZQUAAAAKcHJpY2VBc3NldAUAAAADbmlsAAAAAB4//9c=", "chainId": 84, "height": 629242, "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 3 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = base58'11111111111111111111111111111111' | |
5 | + | ||
6 | + | @Callable(b) | |
7 | + | func sell (c,d) = { | |
8 | + | let e = extract(b.payment) | |
9 | + | if ((e.assetId == unit)) | |
10 | + | then throw("You can't sell Waves.") | |
11 | + | else if ((0 >= e.amount)) | |
12 | + | then throw("You can't nothing.") | |
13 | + | else WriteSet([DataEntry(toBase58String(b.transactionId), ((((toBytes(c) + toBytes(e.amount)) + d) + extract(extract(b.payment).assetId)) + b.callerPublicKey))]) | |
14 | + | } | |
15 | + | ||
16 | + | ||
17 | + | ||
18 | + | @Callable(b) | |
19 | + | func cancel (f) = { | |
20 | + | let g = extract(getBinary(this, f)) | |
21 | + | let c = toInt(take(g, 8)) | |
22 | + | let h = toInt(take(drop(g, 0), 8)) | |
23 | + | let d = take(drop(g, (8 + 8)), 32) | |
24 | + | let i = take(drop(g, ((8 + 8) + 32)), 32) | |
25 | + | let j = drop(g, (((8 + 8) + 32) + 32)) | |
26 | + | if ((j != b.callerPublicKey)) | |
27 | + | then throw("Invalid user.") | |
28 | + | else ScriptResult(WriteSet([DataEntry(f, ((((toBytes(c) + toBytes(0)) + d) + i) + j))]), TransferSet([ScriptTransfer(addressFromPublicKey(j), h, i)])) | |
29 | + | } | |
30 | + | ||
31 | + | ||
32 | + | ||
33 | + | @Callable(b) | |
34 | + | func buy (f) = { | |
35 | + | let g = extract(getBinary(this, f)) | |
36 | + | let c = toInt(take(g, 8)) | |
37 | + | let h = toInt(take(drop(g, 0), 8)) | |
38 | + | let k = take(drop(g, (8 + 8)), 32) | |
39 | + | let d = if ((k == a)) | |
40 | + | then unit | |
41 | + | else k | |
42 | + | let i = take(drop(g, ((8 + 8) + 32)), 32) | |
43 | + | let j = drop(g, (((8 + 8) + 32) + 32)) | |
44 | + | let e = extract(b.payment) | |
45 | + | let l = (e.amount / c) | |
46 | + | if ((e.assetId == a)) | |
47 | + | then throw("Invalid payment asset.") | |
48 | + | else if ((0 >= l)) | |
49 | + | then throw("Invalid payment amount.") | |
50 | + | else if (((l * c) != e.amount)) | |
51 | + | then throw("Invalid payment amount.") | |
52 | + | else if ((size(g) != ((((8 + 8) + 32) + 32) + 32))) | |
53 | + | then throw("Already sold or cancelled.") | |
54 | + | else if ((l > h)) | |
55 | + | then throw("Not enough items in stock.") | |
56 | + | else if (if ((d != e.assetId)) | |
57 | + | then true | |
58 | + | else !(if ((d == a)) | |
59 | + | then (e.assetId == unit) | |
60 | + | else false)) | |
61 | + | then throw("Invalid payment asset.") | |
62 | + | else ScriptResult(WriteSet([DataEntry(f, ((((toBytes(c) + toBytes((h - l))) + (if ((d == unit)) | |
63 | + | then a | |
64 | + | else k)) + i) + j))]), TransferSet([ScriptTransfer(b.caller, l, i), ScriptTransfer(addressFromPublicKey(j), c, d)])) | |
65 | + | } | |
66 | + | ||
67 | + |
github/deemru/w8io/026f985 18.20 ms ◑