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+FvdtPRD5PvLCz03YmtXEpW6HzJAXIbAAAAAAx2b3RlQXNzZXRTdHICAAAALDQzVzRGY3FBMXJFcFNtVUdIb0dpWHZwU0xmaGFkd3M5TFM1ajNTSnNLeHhTAAAAAA9uZXdQdXJwb3NlUHJpY2UAAAAAAlQL5AAAAAAADHZvdGVEdXJhdGlvbgkAAGgAAAACAAAAAAAAAAAHAAAAAAAAAAWgAAAAAA1uZXdQdXJwb3NlS2V5AgAAAAdwdXJwb3NlAAAAAAxwdXJwb3NlSWRLZXkCAAAACXB1cnBvc2VJZAAAAAAKbXVsdGlwbGllcgAAAAAAAAAAAgEAAAALaXNQYXltZW50T2sAAAABAAAAAWkEAAAAEWFjY2VwdGFibGVBc3NldElkBQAAAAl2b3RlQXNzZXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAUcGF5bWVudCBub3QgYXR0YWNoZWQ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yb3JNZXNzYWdlAAAAAgkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAANbmV3UHVycG9zZUtleQIAAAABXwkAAaQAAAABBQAAAAlwdXJwb3NlSWQCAAAAAV8FAAAACmN1cnJlbnRLZXkCAAAAD19maXJzdFZvdGVCbG9jawIAAAA5c29tZXRoaW5nIHdlbnQgd3JvbmcuIHByb2JhYmx5IHlvdSBkaWQgbm90IHZvdGUgZm9yIHRoaXMhBAAAAAlsb2NrQmxvY2sJAABkAAAAAgUAAAAMZ2V0TG9ja0Jsb2NrBQAAAAx2b3RlRHVyYXRpb24EAAAABXRvdGFsCQAAZAAAAAIFAAAACmdldFllc1VzZXIFAAAACWdldE5vVXNlcgMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAAAlsb2NrQmxvY2sDCQAAZgAAAAIFAAAABXRvdGFsAAAAAAAAAAAACQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAFdG90YWwFAAAACXZvdGVBc3NldAUAAAADbmlsCQAAAgAAAAECAAAAEW5vdGhpbmcgdG8gY2xhaW0hCQAAAgAAAAEJAAEsAAAAAgIAAAAkc3RpbGwgbG9ja2VkISB3aWxsIGJlIGF2YWlsYWJsZSBhdDogCQABpAAAAAEFAAAACWxvY2tCbG9jawAAAACuFaV/", "height": 2282055, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: none Next: none Full:
OldNewDifferences
1-# no script
1+{-# STDLIB_VERSION 5 #-}
2+{-# SCRIPT_TYPE ACCOUNT #-}
3+{-# CONTENT_TYPE DAPP #-}
4+let voteAsset = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS'
5+
6+let voteAssetStr = "43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS"
7+
8+let newPurposePrice = 10000000000
9+
10+let voteDuration = (7 * 1440)
11+
12+let newPurposeKey = "purpose"
13+
14+let purposeIdKey = "purposeId"
15+
16+let multiplier = 2
17+
18+func isPaymentOk (i) = {
19+ let acceptableAssetId = voteAsset
20+ if ((size(i.payments) == 0))
21+ then throw("payment not attached")
22+ else {
23+ let p = i.payments[0]
24+ match p.assetId {
25+ case assetId: ByteVector =>
26+ if ((assetId == acceptableAssetId))
27+ then (p.amount == newPurposePrice)
28+ else false
29+ case _ =>
30+ throw("wrong payment asset")
31+ }
32+ }
33+ }
34+
35+
36+@Callable(i)
37+func newPurpose (purpose) = {
38+ let stringSize = size(toBytes(purpose))
39+ let currentKey = toBase58String(i.caller.bytes)
40+ let purposeId = valueOrElse(getInteger(this, purposeIdKey), 0)
41+ if (if ((stringSize > 200))
42+ then true
43+ else (10 > stringSize))
44+ then throw("purpose text cannot be more than 200")
45+ else if (!(isPaymentOk(i)))
46+ then throw(("you have to pay " + toString(newPurposePrice)))
47+ else {
48+ let startHeight = height
49+ let endHeight = (height + voteDuration)
50+ let text = toBase64String(toBytes(purpose))
51+ let id = (purposeId + 1)
52+[StringEntry((((newPurposeKey + "_") + toString(id)) + "_text"), text), IntegerEntry(purposeIdKey, id), StringEntry((((newPurposeKey + "_") + toString(id)) + "_duration"), ((toString(startHeight) + "_") + toString(endHeight))), StringEntry((((newPurposeKey + "_") + toString(id)) + "_owner"), currentKey)]
53+ }
54+ }
55+
56+
57+
58+@Callable(i)
59+func vote4EnnoDAO (purposeId,vote) = {
60+ let getDuration = valueOrErrorMessage(getString(this, (((newPurposeKey + "_") + toString(purposeId)) + "_duration")), "purpose not found")
61+ let duration = split(getDuration, "_")
62+ let startHeight = valueOrElse(parseInt(duration[0]), 0)
63+ let endHeight = valueOrElse(parseInt(duration[1]), 0)
64+ let currentKey = toBase58String(i.caller.bytes)
65+ if (if ((startHeight > height))
66+ then true
67+ else (height > endHeight))
68+ then throw(("voting period is over for purposal: " + toString(purposeId)))
69+ else if (if ((0 >= vote))
70+ then true
71+ else (vote > 2))
72+ then throw("vote must be yes or no")
73+ else {
74+ let amount = i.payments[0].amount
75+ let lockTill = (height + voteDuration)
76+ if (if ((0 >= amount))
77+ then true
78+ else (i.payments[0].assetId != voteAsset))
79+ then throw("invalid token attached")
80+ else {
81+ let totalVote = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_totalVote")), 0)
82+ let walletTotalVote = valueOrElse(getInteger(this, ((((newPurposeKey + "_") + toString(purposeId)) + currentKey) + "_walletTotalVote")), 0)
83+ let firstVoteCast = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock")), height)
84+ if ((vote == 1))
85+ then {
86+ let getYes = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_yes")), 0)
87+ let getYesUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes")), 0)
88+ let total = (getYes + amount)
89+[IntegerEntry((((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes"), (getYesUser + amount)), IntegerEntry((((newPurposeKey + "_") + toString(purposeId)) + "_yes"), total), IntegerEntry((((newPurposeKey + "_") + toString(purposeId)) + "_totalVote"), (amount + totalVote)), IntegerEntry((((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock"), firstVoteCast), IntegerEntry((((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_walletTotalVote"), (amount + walletTotalVote))]
90+ }
91+ else if ((vote == 2))
92+ then {
93+ let getNo = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_no")), 0)
94+ let getNoUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no")), 0)
95+ let total = (getNo + amount)
96+[IntegerEntry((((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no"), (getNoUser + amount)), IntegerEntry((((newPurposeKey + "_") + toString(purposeId)) + "_no"), total), IntegerEntry((((newPurposeKey + "_") + toString(purposeId)) + "_totalVote"), (amount + totalVote)), IntegerEntry((((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock"), firstVoteCast), IntegerEntry((((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_walletTotalVote"), (amount + walletTotalVote))]
97+ }
98+ else throw("nothing to do my friend")
99+ }
100+ }
101+ }
102+
103+
104+
105+@Callable(i)
106+func claimBack (purposeId) = {
107+ let currentKey = toBase58String(i.caller.bytes)
108+ let getYesUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes")), 0)
109+ let getNoUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no")), 0)
110+ let getLockBlock = valueOrErrorMessage(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock")), "something went wrong. probably you did not vote for this!")
111+ let lockBlock = (getLockBlock + voteDuration)
112+ let total = (getYesUser + getNoUser)
113+ if ((height > lockBlock))
114+ then if ((total > 0))
115+ then [ScriptTransfer(i.caller, total, voteAsset)]
116+ else throw("nothing to claim!")
117+ else throw(("still locked! will be available at: " + toString(lockBlock)))
118+ }
119+
120+

github/deemru/w8io/026f985 
29.21 ms