tx · 28foWu6uX7FoP1gvq6VwYKAJ78d4YrAk86Hxg5aHDbqU 3N9D8brsPwA8d2SWKxCKoG15TfAqjtp749H: -0.01400000 Waves 2020.09.16 13:44 [1179724] smart account 3N9D8brsPwA8d2SWKxCKoG15TfAqjtp749H > SELF 0.00000000 Waves
{ "type": 13, "id": "28foWu6uX7FoP1gvq6VwYKAJ78d4YrAk86Hxg5aHDbqU", "fee": 1400000, "feeAssetId": null, "timestamp": 1600253077054, "version": 2, "chainId": 84, "sender": "3N9D8brsPwA8d2SWKxCKoG15TfAqjtp749H", "senderPublicKey": "FpA31WAx86gMxdfoFSRBf8HbjDPaHre9SnjfE1rcjTSA", "proofs": [ "4ZENv2D8gSxrQdf24EFXPs79FKA1dGV6ESaGDSSwJmYiHDjnbjDcfPr75GaWNEZLhEAbnk9KrtUSUxxkRjDURGup" ], "script": "base64:AAIEAAAAAAAAAAkIAhIDCgEIEgAAAAADAAAAAAZOU0JUaWQJAAJZAAAAAQkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEHQAAAAIFAAAABHRoaXMCAAAABk5TQlRpZAIAAAAgTlNCVGlkIGlzIG5vdCBzcGVjaWZpZWQgaW4gc3RhdGUAAAAACWhlaWdodEVuZAkBAAAAE3ZhbHVlT3JFcnJvck1lc3NhZ2UAAAACCQAEGgAAAAIFAAAABHRoaXMCAAAACmhlaWdodF9lbmQCAAAAJGhlaWdodF9lbmQgaXMgbm90IHNwZWNpZmllZCBpbiBzdGF0ZQEAAAAOa2V5VXNlckJhbGFuY2UAAAABAAAACHVzZXJBZGRyCQAEuQAAAAIJAARMAAAAAgIAAAAHYmFsYW5jZQkABEwAAAACCQAEJQAAAAEFAAAACHVzZXJBZGRyBQAAAANuaWwCAAAAAV8AAAACAAAACmNvbnRleHRPYmoBAAAACGNhc3RWb3RlAAAAAQAAAAR2b3RlBAAAAAh2b2l0ZUtleQkABLkAAAACCQAETAAAAAICAAAABXZvaXRlCQAETAAAAAIFAAAABH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Oa2V5VXNlckJhbGFuY2UAAAABCAUAAAAKY29udGV4dE9iagAAAAZjYWxsZXIDCQAAZgAAAAIFAAAACWhlaWdodEVuZAUAAAAGaGVpZ2h0CQAAAgAAAAECAAAAD3ZvdGUgaW4gcHJvY2VzcwQAAAANY2FsbGVyQmFsYW5jZQkBAAAAC3ZhbHVlT3JFbHNlAAAAAgkABBoAAAACBQAAAAR0aGlzBQAAAA51c2VyQmFsYW5jZUtleQAAAAAAAAAAAAMJAABnAAAAAgAAAAAAAAAAAAUAAAANY2FsbGVyQmFsYW5jZQkAAAIAAAABAgAAABBiYWxhbmNlIGlzIGVtcHR5CQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAApjb250ZXh0T2JqAAAABmNhbGxlcgUAAAANY2FsbGVyQmFsYW5jZQUAAAAGTlNCVGlkCQAETAAAAAIJAQAAAAxJbnRlZ2VyRW50cnkAAAACBQAAAA51c2VyQmFsYW5jZUtleQAAAAAAAAAAAAUAAAADbmlsAAAAAFzqsMs=", "height": 1179724, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 7XkBHyiRnVhtGybv7sTvBbdykMC4njL1ZBaYUta5KHQB Next: 2eCkQw2TszTB2JHCvoNW4Ewc4q5kbeZw6kykvMKMSwWE Diff:
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = fromBase58String( | |
4 | + | let a = fromBase58String(valueOrErrorMessage(getString(this, "NSBTid"), "NSBTid is not specified in state")) | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = valueOrErrorMessage(getInteger(this, "height_end"), "height_end is not specified in state") | |
7 | 7 | ||
8 | - | @Callable(c) | |
9 | - | func castVote (d) = { | |
10 | - | let e = makeString(["voite", d], "_") | |
11 | - | let f = makeString(["balance", toString(c.caller)], "_") | |
12 | - | let g = value(c.payments[0]) | |
13 | - | let h = g.assetId | |
14 | - | let i = g.amount | |
15 | - | let j = { | |
16 | - | let k = getInteger(this, e) | |
17 | - | if ($isInstanceOf(k, "Int")) | |
18 | - | then { | |
19 | - | let l = k | |
20 | - | l | |
21 | - | } | |
22 | - | else if ($isInstanceOf(k, "Unit")) | |
23 | - | then { | |
24 | - | let l = k | |
25 | - | 0 | |
26 | - | } | |
27 | - | else throw("Match error") | |
28 | - | } | |
29 | - | let m = { | |
30 | - | let k = getInteger(this, f) | |
31 | - | if ($isInstanceOf(k, "Int")) | |
32 | - | then { | |
33 | - | let n = k | |
34 | - | n | |
35 | - | } | |
36 | - | else if ($isInstanceOf(k, "Unit")) | |
37 | - | then { | |
38 | - | let n = k | |
39 | - | 0 | |
40 | - | } | |
41 | - | else throw("Match error") | |
42 | - | } | |
43 | - | if ((h != a)) | |
8 | + | func c (d) = makeString(["balance", toString(d)], "_") | |
9 | + | ||
10 | + | ||
11 | + | @Callable(e) | |
12 | + | func castVote (f) = { | |
13 | + | let g = makeString(["voite", f], "_") | |
14 | + | let h = c(e.caller) | |
15 | + | let i = value(e.payments[0]) | |
16 | + | let j = i.assetId | |
17 | + | let k = i.amount | |
18 | + | let l = valueOrElse(getInteger(this, g), 0) | |
19 | + | let m = valueOrElse(getInteger(this, h), 0) | |
20 | + | if ((j != a)) | |
44 | 21 | then throw("incorrect assets") | |
45 | 22 | else if ((height >= b)) | |
46 | 23 | then throw("vote finished") | |
47 | - | else [IntegerEntry( | |
24 | + | else [IntegerEntry(g, (l + k)), IntegerEntry(h, (m + k))] | |
48 | 25 | } | |
49 | 26 | ||
50 | 27 | ||
51 | 28 | ||
52 | - | @Callable( | |
29 | + | @Callable(e) | |
53 | 30 | func withdraw () = { | |
54 | - | let | |
31 | + | let h = c(e.caller) | |
55 | 32 | if ((b > height)) | |
56 | 33 | then throw("vote in process") | |
57 | 34 | else { | |
58 | - | let o = getIntegerValue(this, f) | |
59 | - | [ScriptTransfer(c.caller, o, a), IntegerEntry(f, 0)] | |
35 | + | let n = valueOrElse(getInteger(this, h), 0) | |
36 | + | if ((0 >= n)) | |
37 | + | then throw("balance is empty") | |
38 | + | else [ScriptTransfer(e.caller, n, a), IntegerEntry(h, 0)] | |
60 | 39 | } | |
61 | 40 | } | |
62 | 41 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | - | let a = fromBase58String( | |
4 | + | let a = fromBase58String(valueOrErrorMessage(getString(this, "NSBTid"), "NSBTid is not specified in state")) | |
5 | 5 | ||
6 | - | let b = | |
6 | + | let b = valueOrErrorMessage(getInteger(this, "height_end"), "height_end is not specified in state") | |
7 | 7 | ||
8 | - | @Callable(c) | |
9 | - | func castVote (d) = { | |
10 | - | let e = makeString(["voite", d], "_") | |
11 | - | let f = makeString(["balance", toString(c.caller)], "_") | |
12 | - | let g = value(c.payments[0]) | |
13 | - | let h = g.assetId | |
14 | - | let i = g.amount | |
15 | - | let j = { | |
16 | - | let k = getInteger(this, e) | |
17 | - | if ($isInstanceOf(k, "Int")) | |
18 | - | then { | |
19 | - | let l = k | |
20 | - | l | |
21 | - | } | |
22 | - | else if ($isInstanceOf(k, "Unit")) | |
23 | - | then { | |
24 | - | let l = k | |
25 | - | 0 | |
26 | - | } | |
27 | - | else throw("Match error") | |
28 | - | } | |
29 | - | let m = { | |
30 | - | let k = getInteger(this, f) | |
31 | - | if ($isInstanceOf(k, "Int")) | |
32 | - | then { | |
33 | - | let n = k | |
34 | - | n | |
35 | - | } | |
36 | - | else if ($isInstanceOf(k, "Unit")) | |
37 | - | then { | |
38 | - | let n = k | |
39 | - | 0 | |
40 | - | } | |
41 | - | else throw("Match error") | |
42 | - | } | |
43 | - | if ((h != a)) | |
8 | + | func c (d) = makeString(["balance", toString(d)], "_") | |
9 | + | ||
10 | + | ||
11 | + | @Callable(e) | |
12 | + | func castVote (f) = { | |
13 | + | let g = makeString(["voite", f], "_") | |
14 | + | let h = c(e.caller) | |
15 | + | let i = value(e.payments[0]) | |
16 | + | let j = i.assetId | |
17 | + | let k = i.amount | |
18 | + | let l = valueOrElse(getInteger(this, g), 0) | |
19 | + | let m = valueOrElse(getInteger(this, h), 0) | |
20 | + | if ((j != a)) | |
44 | 21 | then throw("incorrect assets") | |
45 | 22 | else if ((height >= b)) | |
46 | 23 | then throw("vote finished") | |
47 | - | else [IntegerEntry( | |
24 | + | else [IntegerEntry(g, (l + k)), IntegerEntry(h, (m + k))] | |
48 | 25 | } | |
49 | 26 | ||
50 | 27 | ||
51 | 28 | ||
52 | - | @Callable( | |
29 | + | @Callable(e) | |
53 | 30 | func withdraw () = { | |
54 | - | let | |
31 | + | let h = c(e.caller) | |
55 | 32 | if ((b > height)) | |
56 | 33 | then throw("vote in process") | |
57 | 34 | else { | |
58 | - | let o = getIntegerValue(this, f) | |
59 | - | [ScriptTransfer(c.caller, o, a), IntegerEntry(f, 0)] | |
35 | + | let n = valueOrElse(getInteger(this, h), 0) | |
36 | + | if ((0 >= n)) | |
37 | + | then throw("balance is empty") | |
38 | + | else [ScriptTransfer(e.caller, n, a), IntegerEntry(h, 0)] | |
60 | 39 | } | |
61 | 40 | } | |
62 | 41 | ||
63 | 42 |
github/deemru/w8io/026f985 26.86 ms ◑