tx · 5DgfwJnSyJwJwNSLt19jtVJMJoWWWzuvpuDJVMX8Y85o

3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc:  -0.01000000 Waves

2022.10.21 10:02 [2281856] smart account 3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc > SELF 0.00000000 Waves

{ "type": 13, "id": "5DgfwJnSyJwJwNSLt19jtVJMJoWWWzuvpuDJVMX8Y85o", "fee": 1000000, "feeAssetId": null, "timestamp": 1666335789063, "version": 2, "chainId": 84, "sender": "3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc", "senderPublicKey": "E3rsNDJ7CyVzRYUkm1k4GYLuZYYxzQioRgWedzPYXTSL", "proofs": [ "589SHrMh3PHpfHDJKP8PxDCacQ1jUc6QyBYdN1ebQ7nreXBG2bteVdhif8EGEs1sLs9EXbAojHYHeiFb67owEZFz" ], "script": "base64:AAIFAAAAAAAAABcIAhIDCgEIEgQKAgEBEgMKAQESAwoBCAAAAAYAAAAACXZvdGVBc3NldAEAAAAgLTcTgdMkN12f4W9209EPk+8sLPTdia1cSlbofMkBchsAAAAAD25ld1B1cnBvc2VQcmljZQAAAAACVAvkAAAAAAAMdm90ZUR1cmF0aW9uCQAAaAAAAAIAAAAAAAAAAAcAAAAAAAAABaAAAAAADW5ld1B1cnBvc2VLZXkCAAAAB3B1cnBvc2UAAAAADHB1cnBvc2VJZEtleQIAAAAJcHVycG9zZUlkAQAAAAtpc1BheW1lbnRPawAAAAEAAAABaQQAAAARYWNjZXB0YWJsZUFzc2V0SWQFAAAACXZvdGVBc3NldAMJAAAAAAAAAgkAAZAAAAABCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAkAAAIAAAABAgAAABRwYXltZW50IG5vdCBhdHRhY2hlZAQAAAABcAkAAZEAAAACCAUAAAABaQAAAAhwYXltZW50cwAAAAAAAAAAAAQAAAAHJG1hdGNoMAgFAAAAAXAAAAAHYXNzZXRJZAMJAAABAAAAAgUAAAAHJG1hdGNoMA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JAAGkAAAAAQUAAAAJcHVycG9zZUlkAgAAAAFfBQAAAApjdXJyZW50S2V5AgAAAA9fZmlyc3RWb3RlQmxvY2sCAAAAFHNvbWV0aGluZyB3ZW50IHdyb25nBAAAAAhsb2NrQmxvawkAAGQAAAACBQAAAAxnZXRMb2NrQmxvY2sFAAAADHZvdGVEdXJhdGlvbgQAAAAFdG90YWwJAABkAAAAAgUAAAAKZ2V0WWVzVXNlcgUAAAAJZ2V0Tm9Vc2VyAwkAAGYAAAACBQAAAAZoZWlnaHQFAAAADGdldExvY2tCbG9jawMJAABmAAAAAgUAAAAFdG90YWwAAAAAAAAAAAAJAARMAAAAAgkBAAAADlNjcmlwdFRyYW5zZmVyAAAAAwgFAAAAAWkAAAAGY2FsbGVyBQAAAAV0b3RhbAUAAAAJdm90ZUFzc2V0BQAAAANuaWwJAAACAAAAAQIAAAARbm90aGluZyB0byBjbGFpbSEJAAACAAAAAQkAASwAAAACAgAAACRzdGlsbCBsb2NrZWQhIHdpbGwgYmUgYXZhaWxhYmxlIGF0OiAJAAGkAAAAAQUAAAAMZ2V0TG9ja0Jsb2NrAAAAAWkBAAAABkRlbGV0ZQAAAAEAAAAFZW50cnkJAARMAAAAAgkBAAAAC0RlbGV0ZUVudHJ5AAAAAQUAAAAFZW50cnkFAAAAA25pbAAAAAD5m82e", "height": 2281856, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: B25jWenfeyiPhN2b33cAR6dJLEEForRiLiUxC6xcp8ZD Next: AwBekB5bP19EiyuDTp8ZmramYbUz6AejohtrEGeZ8erM Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let voteAsset = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS'
55
66 let newPurposePrice = 10000000000
77
88 let voteDuration = (7 * 1440)
99
1010 let newPurposeKey = "purpose"
1111
1212 let purposeIdKey = "purposeId"
1313
1414 func isPaymentOk (i) = {
1515 let acceptableAssetId = voteAsset
1616 if ((size(i.payments) == 0))
1717 then throw("payment not attached")
1818 else {
1919 let p = i.payments[0]
2020 match p.assetId {
2121 case assetId: ByteVector =>
2222 if ((assetId == acceptableAssetId))
2323 then (p.amount == newPurposePrice)
2424 else false
2525 case _ =>
2626 throw("wrong payment asset")
2727 }
2828 }
2929 }
3030
3131
3232 @Callable(i)
3333 func newPurpose (purpose) = {
3434 let stringSize = size(toBytes(purpose))
3535 let currentKey = toBase58String(i.caller.bytes)
3636 let purposeId = valueOrElse(getInteger(this, purposeIdKey), 0)
3737 if (if ((stringSize > 200))
3838 then true
3939 else (10 > stringSize))
4040 then throw("purpose text cannot be more than 200")
4141 else if (!(isPaymentOk(i)))
4242 then throw(("you have to pay " + toString(newPurposePrice)))
4343 else {
4444 let startHeight = height
4545 let endHeight = (height + voteDuration)
4646 let text = toBase64String(toBytes(purpose))
4747 let id = (purposeId + 1)
4848 [StringEntry((((newPurposeKey + "_") + toString(id)) + "_text"), text), IntegerEntry(purposeIdKey, id), StringEntry((((newPurposeKey + "_") + toString(id)) + "_duration"), ((toString(startHeight) + "_") + toString(endHeight))), StringEntry((((newPurposeKey + "_") + toString(id)) + "_owner"), currentKey)]
4949 }
5050 }
5151
5252
5353
5454 @Callable(i)
5555 func vote4EnnoDAO (purposeId,vote) = {
5656 let getDuration = valueOrErrorMessage(getString(this, (((newPurposeKey + "_") + toString(purposeId)) + "_duration")), "purpose not found")
5757 let duration = split(getDuration, "_")
5858 let startHeight = valueOrElse(parseInt(duration[0]), 0)
5959 let endHeight = valueOrElse(parseInt(duration[1]), 0)
6060 let currentKey = toBase58String(i.caller.bytes)
6161 if (if ((startHeight > height))
6262 then true
6363 else (height > endHeight))
6464 then throw(("voting period is over for purpose: " + toString(purposeId)))
6565 else if (if ((0 >= vote))
6666 then true
6767 else (vote > 2))
6868 then throw("vote must be yes or no")
6969 else {
7070 let amount = i.payments[0].amount
7171 let lockTill = (height + voteDuration)
7272 if (if ((0 >= amount))
7373 then true
7474 else (i.payments[0].assetId != voteAsset))
7575 then throw("invalid token attached")
7676 else {
7777 let totalVote = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_totalVote")), 0)
7878 let walletTotalVote = valueOrElse(getInteger(this, ((((newPurposeKey + "_") + toString(purposeId)) + currentKey) + "_walletTotalVote")), 0)
7979 let firstVoteCast = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock")), height)
8080 if ((vote == 1))
8181 then {
8282 let getYes = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_yes")), 0)
8383 let getYesUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes")), 0)
8484 let total = (getYes + amount)
8585 [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))]
8686 }
8787 else if ((vote == 2))
8888 then {
8989 let getNo = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_no")), 0)
9090 let getNoUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no")), 0)
9191 let total = (getNo + amount)
9292 [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))]
9393 }
9494 else throw("nothing to do my friend")
9595 }
9696 }
9797 }
9898
9999
100100
101101 @Callable(i)
102102 func claimBack (purposeId) = {
103103 let currentKey = toBase58String(i.caller.bytes)
104104 let getYesUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes")), 0)
105105 let getNoUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no")), 0)
106106 let getLockBlock = valueOrErrorMessage(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock")), "something went wrong")
107107 let lockBlok = (getLockBlock + voteDuration)
108108 let total = (getYesUser + getNoUser)
109109 if ((height > getLockBlock))
110110 then if ((total > 0))
111111 then [ScriptTransfer(i.caller, total, voteAsset)]
112112 else throw("nothing to claim!")
113113 else throw(("still locked! will be available at: " + toString(getLockBlock)))
114114 }
115115
116116
117117
118118 @Callable(i)
119119 func Delete (entry) = [DeleteEntry(entry)]
120120
121121

github/deemru/w8io/169f3d6 
44.82 ms