tx · 8frZQhPeixqbDX2nG8ATUPTfa9Y5yJRFhkYmd8giUgs8 3MuiTP4cDghsjfjQ6cWf9fDEo69GMNDM5Xk: -0.01000000 Waves 2020.07.01 16:50 [1068051] smart account 3MuiTP4cDghsjfjQ6cWf9fDEo69GMNDM5Xk > SELF 0.00000000 Waves
{ "type": 13, "id": "8frZQhPeixqbDX2nG8ATUPTfa9Y5yJRFhkYmd8giUgs8", "fee": 1000000, "feeAssetId": null, "timestamp": 1593611475955, "version": 1, "sender": "3MuiTP4cDghsjfjQ6cWf9fDEo69GMNDM5Xk", "senderPublicKey": "wbrMRFrDGSugEDAY1Rs32wnhRhtQX4ufaZgDgJ5qdE5", "proofs": [ "3dkhQGKRg8ZdLMmLyNytwgYUbqD4w7wz9GkivYJFAxdRoEaBo1ycVp9wQweQBJGUNgRumPhC6seNbXZQ4ruKUqS1" ], "script": "base64:AAIDAAAAAAAAABMIARIECgIBAhIDCgEIEgQKAggBAAAABwAAAAAMd2F2ZXNBc3NldElkAQAAACAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEAAAAIZ2V0UHJpY2UAAAABAAAABGRhdGEJAASxAAAAAQkAAMkAAAACBQAAAARkYXRhAAAAAAAAAAAIAQAAAAhnZXRTdG9jawAAAAEAAAAEZGF0YQkABLEAAAABCQAAyQAAAAIJAADKAAAAAgUAAAAEZGF0YQAAAAAAAAAACAAAAAAAAAAACAEAAAAOZ2V0QW1vdW50QXNzZXQAAAABAAAABGRhdGEJAADJAAAAAgkAAMoAAAACBQAAAARkYXRhCQAAZAAAAAIJAABkAAAAAgAAAAAAAAAACAAAAAAAAAAACAAAAAAAAAAAIAAAAAAAAAAAIAEAAAAJZ2V0U2VsbGVyAAAAAQAAAARkYXRhCQAAygAAAAIFAAAABGRhdGEJAABkAAAAAgkAAGQAAAACCQAAZAAAAAIAAAAAAAAAAAgAAAAAAAAAAAgAAAAAAAAAACAAAAAAAAAAACABAAAADWdldFByaWNlQXNzZXQA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AAAAFwAAAAB2Fzc2V0SWQJAAACAAAAAQIAAAAWSW52YWxpZCBwYXltZW50IGFzc2V0LgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACXNlcmlhbGl6ZQAAAAYFAAAABWxvdElkBQAAAAVwcmljZQkAAGUAAAACBQAAAAVzdG9jawUAAAALYW1vdW50VG9CdXkFAAAACnByaWNlQXNzZXQFAAAAC2Ftb3VudEFzc2V0BQAAAAZzZWxsZXIFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAAC2Ftb3VudFRvQnV5BQAAAAthbW91bnRBc3NldAkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAAAZzZWxsZXIFAAAABXByaWNlBQAAAApwcmljZUFzc2V0BQAAAANuaWwAAAAA5doq3A==", "chainId": 84, "height": 1068051, "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 | + | func b (c) = toInt(take(c, 8)) | |
7 | + | ||
8 | + | ||
9 | + | func d (c) = toInt(take(drop(c, 8), 8)) | |
10 | + | ||
11 | + | ||
12 | + | func e (c) = take(drop(c, ((8 + 8) + 32)), 32) | |
13 | + | ||
14 | + | ||
15 | + | func f (c) = drop(c, (((8 + 8) + 32) + 32)) | |
16 | + | ||
17 | + | ||
18 | + | func g (c) = { | |
19 | + | let h = take(drop(c, (8 + 8)), 32) | |
20 | + | if ((h == a)) | |
21 | + | then unit | |
22 | + | else h | |
23 | + | } | |
24 | + | ||
25 | + | ||
26 | + | func i (j,k,l,m,n,o) = { | |
27 | + | let p = { | |
28 | + | let q = j | |
29 | + | if ($isInstanceOf(q, "String")) | |
30 | + | then { | |
31 | + | let r = q | |
32 | + | r | |
33 | + | } | |
34 | + | else if ($isInstanceOf(q, "ByteVector")) | |
35 | + | then { | |
36 | + | let s = q | |
37 | + | toBase58String(s) | |
38 | + | } | |
39 | + | else throw() | |
40 | + | } | |
41 | + | let t = { | |
42 | + | let q = m | |
43 | + | if ($isInstanceOf(q, "Unit")) | |
44 | + | then a | |
45 | + | else if ($isInstanceOf(q, "ByteVector")) | |
46 | + | then { | |
47 | + | let s = q | |
48 | + | s | |
49 | + | } | |
50 | + | else throw() | |
51 | + | } | |
52 | + | DataEntry(p, ((((toBytes(k) + toBytes(l)) + t) + n) + o)) | |
53 | + | } | |
54 | + | ||
55 | + | ||
56 | + | @Callable(u) | |
57 | + | func sell (k,m) = { | |
58 | + | let v = extract(u.payment) | |
59 | + | if (if ((v.assetId == unit)) | |
60 | + | then true | |
61 | + | else (v.assetId == a)) | |
62 | + | then throw("Invalid asset to sell.") | |
63 | + | else if ((size(m) != 32)) | |
64 | + | then throw((("Invalid asset: " + toBase58String(m)) + ", expected price asset size should be 32.")) | |
65 | + | else if ((0 >= k)) | |
66 | + | then throw((("Invalid price: " + toString(k)) + ", expected price should be greater than zero.")) | |
67 | + | else if ((0 >= v.amount)) | |
68 | + | then throw((("Invalid amount for sell: " + toString(v.amount)) + ", expected amount should be greater than zero.")) | |
69 | + | else WriteSet([i(u.transactionId, k, v.amount, m, extract(extract(u.payment).assetId), u.callerPublicKey)]) | |
70 | + | } | |
71 | + | ||
72 | + | ||
73 | + | ||
74 | + | @Callable(u) | |
75 | + | func cancel (j) = { | |
76 | + | let c = extract(getBinary(this, j)) | |
77 | + | let k = b(c) | |
78 | + | let l = d(c) | |
79 | + | let m = g(c) | |
80 | + | let n = e(c) | |
81 | + | let o = f(c) | |
82 | + | if ((o != u.callerPublicKey)) | |
83 | + | then throw("Only seller can cancel the lot.") | |
84 | + | else ScriptResult(WriteSet([i(j, k, 0, m, n, o)]), TransferSet([ScriptTransfer(addressFromPublicKey(o), l, n)])) | |
85 | + | } | |
86 | + | ||
87 | + | ||
88 | + | ||
89 | + | @Callable(u) | |
90 | + | func buy (j,w) = { | |
91 | + | let c = extract(getBinary(this, j)) | |
92 | + | let k = b(c) | |
93 | + | let l = d(c) | |
94 | + | let m = g(c) | |
95 | + | let n = e(c) | |
96 | + | let o = f(c) | |
97 | + | let v = extract(u.payment) | |
98 | + | if ((0 >= l)) | |
99 | + | then throw("Lot is closed or cancelled, 0 items in stock.") | |
100 | + | else if ((v.assetId == a)) | |
101 | + | then throw("Invalid payment asset.") | |
102 | + | else if ((0 >= w)) | |
103 | + | then throw((("Invalid amount to buy: " + toString(w)) + ", expected amount should be greater than zero.")) | |
104 | + | else if (((w * k) != v.amount)) | |
105 | + | then throw((((("Invalid payment amount: " + toString(v.amount)) + ", expected amount should be: ") + toString((w * k))) + ".")) | |
106 | + | else if ((w > l)) | |
107 | + | then throw("Not enough items in stock.") | |
108 | + | else if ((m != v.assetId)) | |
109 | + | then throw("Invalid payment asset.") | |
110 | + | else ScriptResult(WriteSet([i(j, k, (l - w), m, n, o)]), TransferSet([ScriptTransfer(u.caller, w, n), ScriptTransfer(addressFromPublicKey(o), k, m)])) | |
111 | + | } | |
112 | + | ||
113 | + |
github/deemru/w8io/169f3d6 22.99 ms ◑