tx · 2Wwify76SyDEeG8fgXADobWBm3QiZpTbQVph3C9t1Kfq 3Mx6Fhgx2b7Vrcg5cPwmcGx2UTrCsGy16hX: -0.05000000 Waves 2019.08.21 13:55 [640788] smart account 3Mx6Fhgx2b7Vrcg5cPwmcGx2UTrCsGy16hX > SELF 0.00000000 Waves
{ "type": 13, "id": "2Wwify76SyDEeG8fgXADobWBm3QiZpTbQVph3C9t1Kfq", "fee": 5000000, "feeAssetId": null, "timestamp": 1566384885090, "version": 1, "sender": "3Mx6Fhgx2b7Vrcg5cPwmcGx2UTrCsGy16hX", "senderPublicKey": "rbQBcP925Nu3mB58D4Zw36LLDks2LgrcbshyaiSJSHy", "proofs": [ "5uwLPzDxSTzrPyE718YHEEjiT8quJekY4SgHMHQh1roX64hfgPcgwKyH5NoJgU1zSXF591xm13pZ3z8bZhT2z9Af" ], "script": "base64:AAIDAAAAAAAAAAAAAAANAAAAAAROT05FAgAAAARub25lAQAAAA5nZXROdW1iZXJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAADSW50BAAAAAFuBQAAAAckbWF0Y2gwBQAAAAFuAAAAAAAAAAAAAQAAAAtnZXRTdHJCeUtleQAAAAEAAAADa2V5BAAAAAckbWF0Y2gwCQAEHQAAAAIFAAAABHRoaXMFAAAAA2tleQMJAAABAAAAAgUAAAAHJG1hdGNoMAIAAAAGU3RyaW5nBAAAAAFzBQAAAAckbWF0Y2gwBQAAAAFzBQAAAAROT05FAQAAAApnZXRLZXlJdGVtAAAAAgAAAAhzdXBwbGllcgAAAAV0aXRsZQkAASwAAAACAgAAAAVpdGVtXwkAAlgAAAABCQAB9wAAAAEJAAGbAAAAAQkAASwAAAACBQAAAAhzdXBwbGllcgUAAAAFdGl0bGUBAAAAEmdldEtleUl0ZW1TdXBwbGllcgAAAAEAAAAEaXRlbQkAASwAAAACBQAAAARpdGVtAgA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bGllckFkZHJlc3MDCQAAZwAAAAIAAAAAAAAAAAAFAAAAB2JhbGFuY2UJAAACAAAAAQIAAAAUaW5zdWZmaWNpZW50IGJhbGFuY2UJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAVZ2V0S2V5QmFsYW5jZVN1cHBsaWVyAAAAAQUAAAAPc3VwcGxpZXJBZGRyZXNzAAAAAAAAAAAABQAAAANuaWwJAQAAAAtUcmFuc2ZlclNldAAAAAEJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwkBAAAAHEBleHRyVXNlcihhZGRyZXNzRnJvbVN0cmluZykAAAABBQAAAA9zdXBwbGllckFkZHJlc3MJAQAAABdnZXRWYWx1ZUJhbGFuY2VTdXBwbGllcgAAAAEFAAAAD3N1cHBsaWVyQWRkcmVzcwUAAAAEdW5pdAUAAAADbmlsAAAAAMikgYk=", "chainId": 84, "height": 640788, "spentComplexity": 0 } View: original | compacted Prev: C4Y9dZCGzspCU3mkj5WL2GPupYGkTG6ggYAZU6aT3h4k Next: BDpFoTbsQqGXSdNdUDrDPAvhKWzr6YCYJbJt13pZS5qX Diff:
Old | New | Differences | |
---|---|---|---|
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | + | ||
92 | + | @Callable(w) | |
93 | + | func withdraw () = { | |
94 | + | let z = toBase58String(w.caller.bytes) | |
95 | + | let C = v(z) | |
96 | + | if ((0 >= C)) | |
97 | + | then throw("insufficient balance") | |
98 | + | else ScriptResult(WriteSet([DataEntry(q(z), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(z), v(z), unit)])) | |
99 | + | } | |
100 | + | ||
101 | + |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let a = "none" | |
5 | 5 | ||
6 | 6 | func b (c) = { | |
7 | 7 | let d = getInteger(this, c) | |
8 | 8 | if ($isInstanceOf(d, "Int")) | |
9 | 9 | then { | |
10 | 10 | let e = d | |
11 | 11 | e | |
12 | 12 | } | |
13 | 13 | else 0 | |
14 | 14 | } | |
15 | 15 | ||
16 | 16 | ||
17 | 17 | func f (c) = { | |
18 | 18 | let d = getString(this, c) | |
19 | 19 | if ($isInstanceOf(d, "String")) | |
20 | 20 | then { | |
21 | 21 | let g = d | |
22 | 22 | g | |
23 | 23 | } | |
24 | 24 | else a | |
25 | 25 | } | |
26 | 26 | ||
27 | 27 | ||
28 | 28 | func h (i,j) = ("item_" + toBase58String(sha256(toBytes((i + j))))) | |
29 | 29 | ||
30 | 30 | ||
31 | 31 | func k (l) = (l + "_owner") | |
32 | 32 | ||
33 | 33 | ||
34 | 34 | func m (l) = (l + "_price") | |
35 | 35 | ||
36 | 36 | ||
37 | 37 | func n (l) = (l + "_data") | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | func o (p,l) = (((l + "_") + p) + "_cnt") | |
41 | 41 | ||
42 | 42 | ||
43 | 43 | func q (r) = (r + "_account") | |
44 | 44 | ||
45 | 45 | ||
46 | 46 | func s (l) = b(m(l)) | |
47 | 47 | ||
48 | 48 | ||
49 | 49 | func t (p,l) = b(o(p, l)) | |
50 | 50 | ||
51 | 51 | ||
52 | 52 | func u (l) = f(k(l)) | |
53 | 53 | ||
54 | 54 | ||
55 | 55 | func v (r) = b(q(r)) | |
56 | 56 | ||
57 | 57 | ||
58 | 58 | @Callable(w) | |
59 | 59 | func addItem (j,x,y) = { | |
60 | 60 | let z = toBase58String(w.caller.bytes) | |
61 | 61 | let l = h(z, j) | |
62 | 62 | if ((0 >= x)) | |
63 | 63 | then throw("purchase amount cannot be ess than item price") | |
64 | 64 | else if ((u(l) != a)) | |
65 | 65 | then throw("an item already exists") | |
66 | 66 | else WriteSet([DataEntry(k(l), z), DataEntry(m(l), x), DataEntry(n(l), y)]) | |
67 | 67 | } | |
68 | 68 | ||
69 | 69 | ||
70 | 70 | ||
71 | 71 | @Callable(w) | |
72 | 72 | func purchase (l) = { | |
73 | 73 | let A = extract(w.payment) | |
74 | 74 | if (isDefined(A.assetId)) | |
75 | 75 | then throw("can use only WAVES token at the moment") | |
76 | 76 | else { | |
77 | 77 | let B = toBase58String(w.caller.bytes) | |
78 | 78 | let x = s(l) | |
79 | 79 | let z = u(l) | |
80 | 80 | if ((x > A.amount)) | |
81 | 81 | then throw("purchase price cannot be lower than item price") | |
82 | 82 | else if ((x > A.amount)) | |
83 | 83 | then throw("purchase price cannot be higher than item price") | |
84 | 84 | else if ((z == a)) | |
85 | 85 | then throw("supplier does not exist") | |
86 | 86 | else WriteSet([DataEntry(o(B, l), (t(B, l) + 1)), DataEntry(q(z), (v(z) + A.amount))]) | |
87 | 87 | } | |
88 | 88 | } | |
89 | 89 | ||
90 | 90 | ||
91 | + | ||
92 | + | @Callable(w) | |
93 | + | func withdraw () = { | |
94 | + | let z = toBase58String(w.caller.bytes) | |
95 | + | let C = v(z) | |
96 | + | if ((0 >= C)) | |
97 | + | then throw("insufficient balance") | |
98 | + | else ScriptResult(WriteSet([DataEntry(q(z), 0)]), TransferSet([ScriptTransfer(addressFromStringValue(z), v(z), unit)])) | |
99 | + | } | |
100 | + | ||
101 | + |
github/deemru/w8io/169f3d6 32.65 ms ◑