tx · GUhvEZZgnAJW8MPfkPJFoUJeAfKjhmFKhpENixbFB4sn 3NCA3EtxZmjmBYhKBT3b7NepxKq6nqsjuai: -0.01000000 Waves 2022.10.21 13:27 [2282055] smart account 3NCA3EtxZmjmBYhKBT3b7NepxKq6nqsjuai > SELF 0.00000000 Waves
{ "type": 13, "id": "GUhvEZZgnAJW8MPfkPJFoUJeAfKjhmFKhpENixbFB4sn", "fee": 1000000, "feeAssetId": null, "timestamp": 1666348060988, "version": 2, "chainId": 84, "sender": "3NCA3EtxZmjmBYhKBT3b7NepxKq6nqsjuai", "senderPublicKey": "5GepnmadncaXDve3cejJsVaCoHWiTYk1YD6JsUT7tgCh", "proofs": [ "3aqaSQ9ei9u1PJewDk7hBQWtC59pXJmpQ7GiMVioNajWkVeYMS76AKMCZBQRRnmr62hanPFG17jHE9YZnwf9pXyG" ], "script": "base64:AAIFAAAAAAAAABIIAhIDCgEIEgQKAgEBEgMKAQEAAAAIAAAAAAl2b3RlQXNzZXQBAAAAIC03E4HTJDddn+FvdtPRD5PvLCz03YmtXEpW6HzJAXIbAAAAAAx2b3RlQXNzZXRTdHICAAAALDQzVzRGY3FBMXJFcFNtVUdIb0dpWHZwU0xmaGFkd3M5TFM1ajNTSnNLeHhTAAAAAA9uZXdQdXJwb3NlUHJpY2UAAAAAAlQL5AAAAAAADHZvdGVEdXJhdGlvbgkAAGgAAAACAAAAAAAAAAAHAAAAAAAAAAWgAAAAAA1uZXdQdXJwb3NlS2V5AgAAAAdwdXJwb3NlAAAAAAxwdXJwb3NlSWRLZXkCAAAACXB1cnBvc2VJZAAAAAAKbXVsdGlwbGllcgAAAAAAAAAAAgEAAAALaXNQYXltZW50T2sAAAABAAAAAWkEAAAAEWFjY2VwdGFibGVBc3NldElkBQAAAAl2b3RlQXNzZXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAUcGF5bWVudCBub3QgYXR0YWNoZWQE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b3JNZXNzYWdlAAAAAgkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAANbmV3UHVycG9zZUtleQIAAAABXwkAAaQAAAABBQAAAAlwdXJwb3NlSWQCAAAAAV8FAAAACmN1cnJlbnRLZXkCAAAAD19maXJzdFZvdGVCbG9jawIAAAA5c29tZXRoaW5nIHdlbnQgd3JvbmcuIHByb2JhYmx5IHlvdSBkaWQgbm90IHZvdGUgZm9yIHRoaXMhBAAAAAlsb2NrQmxvY2sJAABkAAAAAgUAAAAMZ2V0TG9ja0Jsb2NrBQAAAAx2b3RlRHVyYXRpb24EAAAABXRvdGFsCQAAZAAAAAIFAAAACmdldFllc1VzZXIFAAAACWdldE5vVXNlcgMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAAAlsb2NrQmxvY2sDCQAAZgAAAAIFAAAABXRvdGFsAAAAAAAAAAAACQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAFdG90YWwFAAAACXZvdGVBc3NldAUAAAADbmlsCQAAAgAAAAECAAAAEW5vdGhpbmcgdG8gY2xhaW0hCQAAAgAAAAEJAAEsAAAAAgIAAAAkc3RpbGwgbG9ja2VkISB3aWxsIGJlIGF2YWlsYWJsZSBhdDogCQABpAAAAAEFAAAACWxvY2tCbG9jawAAAACuFaV/", "height": 2282055, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
Old | New | Differences | |
---|---|---|---|
1 | - | # no script | |
1 | + | {-# STDLIB_VERSION 5 #-} | |
2 | + | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | + | {-# CONTENT_TYPE DAPP #-} | |
4 | + | let a = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS' | |
5 | + | ||
6 | + | let b = "43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS" | |
7 | + | ||
8 | + | let c = 10000000000 | |
9 | + | ||
10 | + | let d = (7 * 1440) | |
11 | + | ||
12 | + | let e = "purpose" | |
13 | + | ||
14 | + | let f = "purposeId" | |
15 | + | ||
16 | + | let g = 2 | |
17 | + | ||
18 | + | func h (i) = { | |
19 | + | let j = a | |
20 | + | if ((size(i.payments) == 0)) | |
21 | + | then throw("payment not attached") | |
22 | + | else { | |
23 | + | let k = i.payments[0] | |
24 | + | let l = k.assetId | |
25 | + | if ($isInstanceOf(l, "ByteVector")) | |
26 | + | then { | |
27 | + | let m = l | |
28 | + | if ((m == j)) | |
29 | + | then (k.amount == c) | |
30 | + | else false | |
31 | + | } | |
32 | + | else throw("wrong payment asset") | |
33 | + | } | |
34 | + | } | |
35 | + | ||
36 | + | ||
37 | + | @Callable(i) | |
38 | + | func newPurpose (n) = { | |
39 | + | let o = size(toBytes(n)) | |
40 | + | let p = toBase58String(i.caller.bytes) | |
41 | + | let q = valueOrElse(getInteger(this, f), 0) | |
42 | + | if (if ((o > 200)) | |
43 | + | then true | |
44 | + | else (10 > o)) | |
45 | + | then throw("purpose text cannot be more than 200") | |
46 | + | else if (!(h(i))) | |
47 | + | then throw(("you have to pay " + toString(c))) | |
48 | + | else { | |
49 | + | let r = height | |
50 | + | let s = (height + d) | |
51 | + | let t = toBase64String(toBytes(n)) | |
52 | + | let u = (q + 1) | |
53 | + | [StringEntry((((e + "_") + toString(u)) + "_text"), t), IntegerEntry(f, u), StringEntry((((e + "_") + toString(u)) + "_duration"), ((toString(r) + "_") + toString(s))), StringEntry((((e + "_") + toString(u)) + "_owner"), p)] | |
54 | + | } | |
55 | + | } | |
56 | + | ||
57 | + | ||
58 | + | ||
59 | + | @Callable(i) | |
60 | + | func vote4EnnoDAO (q,v) = { | |
61 | + | let w = valueOrErrorMessage(getString(this, (((e + "_") + toString(q)) + "_duration")), "purpose not found") | |
62 | + | let x = split(w, "_") | |
63 | + | let r = valueOrElse(parseInt(x[0]), 0) | |
64 | + | let s = valueOrElse(parseInt(x[1]), 0) | |
65 | + | let p = toBase58String(i.caller.bytes) | |
66 | + | if (if ((r > height)) | |
67 | + | then true | |
68 | + | else (height > s)) | |
69 | + | then throw(("voting period is over for purposal: " + toString(q))) | |
70 | + | else if (if ((0 >= v)) | |
71 | + | then true | |
72 | + | else (v > 2)) | |
73 | + | then throw("vote must be yes or no") | |
74 | + | else { | |
75 | + | let y = i.payments[0].amount | |
76 | + | let z = (height + d) | |
77 | + | if (if ((0 >= y)) | |
78 | + | then true | |
79 | + | else (i.payments[0].assetId != a)) | |
80 | + | then throw("invalid token attached") | |
81 | + | else { | |
82 | + | let A = valueOrElse(getInteger(this, (((e + "_") + toString(q)) + "_totalVote")), 0) | |
83 | + | let B = valueOrElse(getInteger(this, ((((e + "_") + toString(q)) + p) + "_walletTotalVote")), 0) | |
84 | + | let C = valueOrElse(getInteger(this, (((((e + "_") + toString(q)) + "_") + p) + "_firstVoteBlock")), height) | |
85 | + | if ((v == 1)) | |
86 | + | then { | |
87 | + | let D = valueOrElse(getInteger(this, (((e + "_") + toString(q)) + "_yes")), 0) | |
88 | + | let E = valueOrElse(getInteger(this, (((((e + "_") + toString(q)) + "_") + p) + "_yes")), 0) | |
89 | + | let F = (D + y) | |
90 | + | [IntegerEntry((((((e + "_") + toString(q)) + "_") + p) + "_yes"), (E + y)), IntegerEntry((((e + "_") + toString(q)) + "_yes"), F), IntegerEntry((((e + "_") + toString(q)) + "_totalVote"), (y + A)), IntegerEntry((((((e + "_") + toString(q)) + "_") + p) + "_firstVoteBlock"), C), IntegerEntry((((((e + "_") + toString(q)) + "_") + p) + "_walletTotalVote"), (y + B))] | |
91 | + | } | |
92 | + | else if ((v == 2)) | |
93 | + | then { | |
94 | + | let G = valueOrElse(getInteger(this, (((e + "_") + toString(q)) + "_no")), 0) | |
95 | + | let H = valueOrElse(getInteger(this, (((((e + "_") + toString(q)) + "_") + p) + "_no")), 0) | |
96 | + | let F = (G + y) | |
97 | + | [IntegerEntry((((((e + "_") + toString(q)) + "_") + p) + "_no"), (H + y)), IntegerEntry((((e + "_") + toString(q)) + "_no"), F), IntegerEntry((((e + "_") + toString(q)) + "_totalVote"), (y + A)), IntegerEntry((((((e + "_") + toString(q)) + "_") + p) + "_firstVoteBlock"), C), IntegerEntry((((((e + "_") + toString(q)) + "_") + p) + "_walletTotalVote"), (y + B))] | |
98 | + | } | |
99 | + | else throw("nothing to do my friend") | |
100 | + | } | |
101 | + | } | |
102 | + | } | |
103 | + | ||
104 | + | ||
105 | + | ||
106 | + | @Callable(i) | |
107 | + | func claimBack (q) = { | |
108 | + | let p = toBase58String(i.caller.bytes) | |
109 | + | let E = valueOrElse(getInteger(this, (((((e + "_") + toString(q)) + "_") + p) + "_yes")), 0) | |
110 | + | let H = valueOrElse(getInteger(this, (((((e + "_") + toString(q)) + "_") + p) + "_no")), 0) | |
111 | + | let I = valueOrErrorMessage(getInteger(this, (((((e + "_") + toString(q)) + "_") + p) + "_firstVoteBlock")), "something went wrong. probably you did not vote for this!") | |
112 | + | let J = (I + d) | |
113 | + | let F = (E + H) | |
114 | + | if ((height > J)) | |
115 | + | then if ((F > 0)) | |
116 | + | then [ScriptTransfer(i.caller, F, a)] | |
117 | + | else throw("nothing to claim!") | |
118 | + | else throw(("still locked! will be available at: " + toString(J))) | |
119 | + | } | |
120 | + | ||
121 | + |
github/deemru/w8io/026f985 16.79 ms ◑