tx · CwKnpEMwVKg5B4gCdryW29Ju92F6eCPErhdKaWEKoYN5

3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc:  -0.01000000 Waves

2022.10.21 11:08 [2281910] smart account 3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc > SELF 0.00000000 Waves

{ "type": 13, "id": "CwKnpEMwVKg5B4gCdryW29Ju92F6eCPErhdKaWEKoYN5", "fee": 1000000, "feeAssetId": null, "timestamp": 1666339751106, "version": 2, "chainId": 84, "sender": "3N5YzdqDE6FDdsLNGXU4G4yrmirb2oiifEc", "senderPublicKey": "E3rsNDJ7CyVzRYUkm1k4GYLuZYYxzQioRgWedzPYXTSL", "proofs": [ "2CqEPTSfyAgciFjzGgujmaA2jCYo5DPHqair3Nb4jVQjSVdzyWFgfnV8u2o2AYnJjcTuPFQvnfGPnVhiSU1gj9Rr" ], "script": "base64:AAIFAAAAAAAAABIIAhIDCgEIEgQKAgEBEgMKAQEAAAAIAAAAAAl2b3RlQXNzZXQBAAAAIC03E4HTJDddn+FvdtPRD5PvLCz03YmtXEpW6HzJAXIbAAAAAAx2b3RlQXNzZXRTdHICAAAALDQzVzRGY3FBMXJFcFNtVUdIb0dpWHZwU0xmaGFkd3M5TFM1ajNTSnNLeHhTAAAAAA9uZXdQdXJwb3NlUHJpY2UAAAAAAlQL5AAAAAAADHZvdGVEdXJhdGlvbgkAAGgAAAACAAAAAAAAAAAHAAAAAAAAAAWgAAAAAA1uZXdQdXJwb3NlS2V5AgAAAAdwdXJwb3NlAAAAAAxwdXJwb3NlSWRLZXkCAAAACXB1cnBvc2VJZAAAAAAKbXVsdGlwbGllcgAAAAAAAAAAAgEAAAALaXNQYXltZW50T2sAAAABAAAAAWkEAAAAEWFjY2VwdGFibGVBc3NldElkBQAAAAl2b3RlQXNzZXQDCQAAAAAAAAIJAAGQAAAAAQgFAAAAAWkAAAAIcGF5bWVudHMAAAAAAAAAAAAJAAACAAAAAQIAAAAUcGF5bWVudCBub3QgYXR0Y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U9yRXJyb3JNZXNzYWdlAAAAAgkABBoAAAACBQAAAAR0aGlzCQABLAAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAANbmV3UHVycG9zZUtleQIAAAABXwkAAaQAAAABBQAAAAlwdXJwb3NlSWQCAAAAAV8FAAAACmN1cnJlbnRLZXkCAAAAD19maXJzdFZvdGVCbG9jawIAAAA5c29tZXRoaW5nIHdlbnQgd3JvbmcuIHByb2JhYmx5IHlvdSBkaWQgbm90IHZvdGUgZm9yIHRoaXMhBAAAAAlsb2NrQmxvY2sJAABkAAAAAgUAAAAMZ2V0TG9ja0Jsb2NrBQAAAAx2b3RlRHVyYXRpb24EAAAABXRvdGFsCQAAZAAAAAIFAAAACmdldFllc1VzZXIFAAAACWdldE5vVXNlcgMJAABmAAAAAgUAAAAGaGVpZ2h0BQAAAAlsb2NrQmxvY2sDCQAAZgAAAAIFAAAABXRvdGFsAAAAAAAAAAAACQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAFdG90YWwFAAAACXZvdGVBc3NldAUAAAADbmlsCQAAAgAAAAECAAAAEW5vdGhpbmcgdG8gY2xhaW0hCQAAAgAAAAEJAAEsAAAAAgIAAAAkc3RpbGwgbG9ja2VkISB3aWxsIGJlIGF2YWlsYWJsZSBhdDogCQABpAAAAAEFAAAADGdldExvY2tCbG9jawAAAADA5A2q", "height": 2281910, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 2A8tU5AXsf5vVhQnwHJ5X4FJTZfsb4ND73Gknkurqnaj Next: none Diff:
OldNewDifferences
33 {-# CONTENT_TYPE DAPP #-}
44 let voteAsset = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS'
55
6-let gAsset = base58'AkU3DaDKndbWSVaw4LmxuduVQBXkwkKZ7mV5dxrAqLvT'
7-
86 let voteAssetStr = "43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS"
9-
10-let gAssetStr = "AkU3DaDKndbWSVaw4LmxuduVQBXkwkKZ7mV5dxrAqLvT"
117
128 let newPurposePrice = 10000000000
139
7773 else {
7874 let amount = i.payments[0].amount
7975 let lockTill = (height + voteDuration)
80- if (if (if ((0 >= amount))
76+ if (if ((0 >= amount))
8177 then true
8278 else (i.payments[0].assetId != voteAsset))
83- then true
84- else (i.payments[0].assetId != gAsset))
8579 then throw("invalid token attached")
8680 else {
8781 let totalVote = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_totalVote")), 0)
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 5 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let voteAsset = base58'43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS'
55
6-let gAsset = base58'AkU3DaDKndbWSVaw4LmxuduVQBXkwkKZ7mV5dxrAqLvT'
7-
86 let voteAssetStr = "43W4FcqA1rEpSmUGHoGiXvpSLfhadws9LS5j3SJsKxxS"
9-
10-let gAssetStr = "AkU3DaDKndbWSVaw4LmxuduVQBXkwkKZ7mV5dxrAqLvT"
117
128 let newPurposePrice = 10000000000
139
1410 let voteDuration = (7 * 1440)
1511
1612 let newPurposeKey = "purpose"
1713
1814 let purposeIdKey = "purposeId"
1915
2016 let multiplier = 2
2117
2218 func isPaymentOk (i) = {
2319 let acceptableAssetId = voteAsset
2420 if ((size(i.payments) == 0))
2521 then throw("payment not attached")
2622 else {
2723 let p = i.payments[0]
2824 match p.assetId {
2925 case assetId: ByteVector =>
3026 if ((assetId == acceptableAssetId))
3127 then (p.amount == newPurposePrice)
3228 else false
3329 case _ =>
3430 throw("wrong payment asset")
3531 }
3632 }
3733 }
3834
3935
4036 @Callable(i)
4137 func newPurpose (purpose) = {
4238 let stringSize = size(toBytes(purpose))
4339 let currentKey = toBase58String(i.caller.bytes)
4440 let purposeId = valueOrElse(getInteger(this, purposeIdKey), 0)
4541 if (if ((stringSize > 200))
4642 then true
4743 else (10 > stringSize))
4844 then throw("purpose text cannot be more than 200")
4945 else if (!(isPaymentOk(i)))
5046 then throw(("you have to pay " + toString(newPurposePrice)))
5147 else {
5248 let startHeight = height
5349 let endHeight = (height + voteDuration)
5450 let text = toBase64String(toBytes(purpose))
5551 let id = (purposeId + 1)
5652 [StringEntry((((newPurposeKey + "_") + toString(id)) + "_text"), text), IntegerEntry(purposeIdKey, id), StringEntry((((newPurposeKey + "_") + toString(id)) + "_duration"), ((toString(startHeight) + "_") + toString(endHeight))), StringEntry((((newPurposeKey + "_") + toString(id)) + "_owner"), currentKey)]
5753 }
5854 }
5955
6056
6157
6258 @Callable(i)
6359 func vote4EnnoDAO (purposeId,vote) = {
6460 let getDuration = valueOrErrorMessage(getString(this, (((newPurposeKey + "_") + toString(purposeId)) + "_duration")), "purpose not found")
6561 let duration = split(getDuration, "_")
6662 let startHeight = valueOrElse(parseInt(duration[0]), 0)
6763 let endHeight = valueOrElse(parseInt(duration[1]), 0)
6864 let currentKey = toBase58String(i.caller.bytes)
6965 if (if ((startHeight > height))
7066 then true
7167 else (height > endHeight))
7268 then throw(("voting period is over for purposal: " + toString(purposeId)))
7369 else if (if ((0 >= vote))
7470 then true
7571 else (vote > 2))
7672 then throw("vote must be yes or no")
7773 else {
7874 let amount = i.payments[0].amount
7975 let lockTill = (height + voteDuration)
80- if (if (if ((0 >= amount))
76+ if (if ((0 >= amount))
8177 then true
8278 else (i.payments[0].assetId != voteAsset))
83- then true
84- else (i.payments[0].assetId != gAsset))
8579 then throw("invalid token attached")
8680 else {
8781 let totalVote = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_totalVote")), 0)
8882 let walletTotalVote = valueOrElse(getInteger(this, ((((newPurposeKey + "_") + toString(purposeId)) + currentKey) + "_walletTotalVote")), 0)
8983 let firstVoteCast = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock")), height)
9084 if ((vote == 1))
9185 then {
9286 let getYes = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_yes")), 0)
9387 let getYesUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes")), 0)
9488 let total = (getYes + amount)
9589 [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))]
9690 }
9791 else if ((vote == 2))
9892 then {
9993 let getNo = valueOrElse(getInteger(this, (((newPurposeKey + "_") + toString(purposeId)) + "_no")), 0)
10094 let getNoUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no")), 0)
10195 let total = (getNo + amount)
10296 [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))]
10397 }
10498 else throw("nothing to do my friend")
10599 }
106100 }
107101 }
108102
109103
110104
111105 @Callable(i)
112106 func claimBack (purposeId) = {
113107 let currentKey = toBase58String(i.caller.bytes)
114108 let getYesUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_yes")), 0)
115109 let getNoUser = valueOrElse(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_no")), 0)
116110 let getLockBlock = valueOrErrorMessage(getInteger(this, (((((newPurposeKey + "_") + toString(purposeId)) + "_") + currentKey) + "_firstVoteBlock")), "something went wrong. probably you did not vote for this!")
117111 let lockBlock = (getLockBlock + voteDuration)
118112 let total = (getYesUser + getNoUser)
119113 if ((height > lockBlock))
120114 then if ((total > 0))
121115 then [ScriptTransfer(i.caller, total, voteAsset)]
122116 else throw("nothing to claim!")
123117 else throw(("still locked! will be available at: " + toString(getLockBlock)))
124118 }
125119
126120

github/deemru/w8io/026f985 
32.72 ms