tx · HmRviMS5VcsoU9Y4EB5oBaYvDjnrAjMmx8K8xA8pV31v 3N8dYK8BQhY7z1yKFRFhdw4m9b4JjsNQJVd: -0.01400000 Waves 2023.04.10 13:12 [2528344] smart account 3N8dYK8BQhY7z1yKFRFhdw4m9b4JjsNQJVd > SELF 0.00000000 Waves
{ "type": 13, "id": "HmRviMS5VcsoU9Y4EB5oBaYvDjnrAjMmx8K8xA8pV31v", "fee": 1400000, "feeAssetId": null, "timestamp": 1681121636162, "version": 2, "chainId": 84, "sender": "3N8dYK8BQhY7z1yKFRFhdw4m9b4JjsNQJVd", "senderPublicKey": "AK6rRKpHobxNveEtJE5BBXbdwm9BpGL7ewP9Xb6VYuHx", "proofs": [ "taHH45aMQPvEexQcvtkiYxkGmHL7cya9McGrJ2Zyt6F7bRF1AQWF2dVZPXbzk7zPYquA7XeiGwHJfsibuCik61n" ], "script": "base64:AAIEAAAAAAAAABMIAhIFCgMIAQESAwoBARIDCgEIAAAACgAAAAADQTRBAQAAACAIZYS3D/CKahrz4mjoLgiQJMPTJ1gDzSz2Ll4L39oVpAAAAAAOQTRBU3Rha2luZ0RBcHAJAQAAABFAZXh0ck5hdGl2ZSgxMDYyKQAAAAECAAAAIzNONm9XTHlRWTJnTTdRVWtVdkJtZTFSRW5BNmQxVjd5M0FUAAAAACJ2b3RpbmdfdGltZXN0YW1wX2NvbnRyb2xsZXJfcHVia2V5AQAAACAbvUu+h+2As3kugOhMQC3bvgebie3kDmlbUlrvLFQPbQAAAAASY29udHJvbGxlcl9hZGRyZXNzCQEAAAAUYWRkcmVzc0Zyb21QdWJsaWNLZXkAAAABBQAAACJ2b3RpbmdfdGltZXN0YW1wX2NvbnRyb2xsZXJfcHVia2V5AAAAAAxsYXVuY2hfZXJyb3ICAAAAJERhcHAgd2lsbCBzdGFydCBWb3RpbmcgYXQgVGltZXN0YW1wIAAAAAADbXNnAgAAAC48aDE+WW91ciBWb3RlIFN1Ym1pdHRlZCBTdWNjZXNzZnVsbHkhPC9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wkAAaQAAAABBQAAAAtQb3Jwb3NhbF9JRAUAAAAYTGF0ZXN0VXNlckNvdW50Zm9yVm90aW5nCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAICAAAAB21lc3NhZ2UFAAAAA21zZwUAAAADbmlsAAAAAWkBAAAACURlbGV0ZUtleQAAAAEAAAADS2V5CQAETAAAAAIJAQAAAAtEZWxldGVFbnRyeQAAAAEFAAAAA0tleQUAAAADbmlsAAAAAQAAAAJ0eAEAAAAGdmVyaWZ5AAAAAAkAAfQAAAADCAUAAAACdHgAAAAJYm9keUJ5dGVzCQABkQAAAAIIBQAAAAJ0eAAAAAZwcm9vZnMAAAAAAAAAAAAIBQAAAAJ0eAAAAA9zZW5kZXJQdWJsaWNLZXkueeoe", "height": 2528344, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: HWUK4APAeFbTJMwCUmNiGqYcVej4nbQrmEMyeAkTS46S Next: 2XbTfKF8e72N7x6f6XyFxBtCzDLbJxWZJHA7SKG7AcZk Diff:
Old | New | Differences | |
---|---|---|---|
14 | 14 | let msg = "<h1>Your Vote Submitted Successfully!</h1><br>" | |
15 | 15 | ||
16 | 16 | let pymterror = "DApp Need 0.00000001 A4A Token as Attach payment[1]." | |
17 | + | ||
18 | + | let AlreadyVotedError = "This Address Already participated for Voting in this Proposal." | |
17 | 19 | ||
18 | 20 | let asseterr = (("Incorrect asset attach, please attach " + toBase58String(A4A)) + " AssetID Only.") | |
19 | 21 | ||
61 | 63 | 0 | |
62 | 64 | } | |
63 | 65 | let ATVO = (FTVO + readA4AStakingAmount) | |
66 | + | let PreviousUserCountforVoting = match getInteger(this, ((pubkey + "_") + toString(Porposal_ID))) { | |
67 | + | case a: Int => | |
68 | + | a | |
69 | + | case _ => | |
70 | + | 0 | |
71 | + | } | |
72 | + | let LatestUserCountforVoting = (PreviousUserCountforVoting + 1) | |
64 | 73 | if ((StartTS > lastBlock.timestamp)) | |
65 | 74 | then throw((launch_error + toString(StartTS))) | |
66 | 75 | else if ((lastBlock.timestamp > EndTS)) | |
67 | 76 | then throw(voteErr) | |
68 | - | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), StringEntry("message", msg)] | |
77 | + | else if ((LatestUserCountforVoting > 1)) | |
78 | + | then throw(AlreadyVotedError) | |
79 | + | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry("message", msg)] | |
69 | 80 | } | |
70 | 81 | ||
71 | 82 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let A4A = base58'Zn3cLHW7aAVPm5aACcTjvg7e7iEy2cKDtbowok5qa9H' | |
5 | 5 | ||
6 | 6 | let A4AStakingDApp = addressFromStringValue("3N6oWLyQY2gM7QUkUvBme1REnA6d1V7y3AT") | |
7 | 7 | ||
8 | 8 | let voting_timestamp_controller_pubkey = base58'2sHRUrJCMpDhAQEcN7Zhk3LqnD9zizebpxeQXpPoscQU' | |
9 | 9 | ||
10 | 10 | let controller_address = addressFromPublicKey(voting_timestamp_controller_pubkey) | |
11 | 11 | ||
12 | 12 | let launch_error = "Dapp will start Voting at Timestamp " | |
13 | 13 | ||
14 | 14 | let msg = "<h1>Your Vote Submitted Successfully!</h1><br>" | |
15 | 15 | ||
16 | 16 | let pymterror = "DApp Need 0.00000001 A4A Token as Attach payment[1]." | |
17 | + | ||
18 | + | let AlreadyVotedError = "This Address Already participated for Voting in this Proposal." | |
17 | 19 | ||
18 | 20 | let asseterr = (("Incorrect asset attach, please attach " + toBase58String(A4A)) + " AssetID Only.") | |
19 | 21 | ||
20 | 22 | let voteErr = "Voting is Over for this Dapp." | |
21 | 23 | ||
22 | 24 | @Callable(i) | |
23 | 25 | func SetVotingTimeStamps (Proposal,Voting_Start_TimeStamp,Voting_End_TimeStamp) = { | |
24 | 26 | let StartTS = Voting_Start_TimeStamp | |
25 | 27 | let EndTS = Voting_End_TimeStamp | |
26 | 28 | let pubkey = toBase58String(i.caller.bytes) | |
27 | 29 | let Previoustotalproposals = match getInteger(this, "Total_Proposals") { | |
28 | 30 | case a: Int => | |
29 | 31 | a | |
30 | 32 | case _ => | |
31 | 33 | 0 | |
32 | 34 | } | |
33 | 35 | let totalproposals = (Previoustotalproposals + 1) | |
34 | 36 | if ((size(Proposal) > 5100)) | |
35 | 37 | then throw("Subject Char Limits are Over. Reduce length less than 5100 Char.") | |
36 | 38 | else if ((i.caller != controller_address)) | |
37 | 39 | then throw((("This Address is not Authorized. Only " + toString(controller_address)) + " is Authorized Address to Sign it.")) | |
38 | 40 | else [StringEntry(("Proposal_Text_" + toString(totalproposals)), Proposal), IntegerEntry("Total_Proposals", totalproposals), StringEntry(("Proposer_" + toString(totalproposals)), pubkey), IntegerEntry(("Voting_Start_TimeStamp_" + toString(totalproposals)), StartTS), IntegerEntry(("Voting_End_TimeStamp_" + toString(totalproposals)), EndTS)] | |
39 | 41 | } | |
40 | 42 | ||
41 | 43 | ||
42 | 44 | ||
43 | 45 | @Callable(i) | |
44 | 46 | func Yes (Porposal_ID) = { | |
45 | 47 | let VoteAst = "Yes" | |
46 | 48 | let StartTS = getIntegerValue(this, ("Voting_Start_TimeStamp_" + toString(Porposal_ID))) | |
47 | 49 | let EndTS = getIntegerValue(this, ("Voting_End_TimeStamp_" + toString(Porposal_ID))) | |
48 | 50 | let pubkey = toBase58String(i.caller.bytes) | |
49 | 51 | let readA4AStakingAmount = valueOrErrorMessage(getInteger(A4AStakingDApp, ("Deposit_Amount_Of_" + pubkey)), "Address not found in A4A Staking.") | |
50 | 52 | let Previoustotalvotes = match getInteger(this, ("Total_Votes_" + toString(Porposal_ID))) { | |
51 | 53 | case a: Int => | |
52 | 54 | a | |
53 | 55 | case _ => | |
54 | 56 | 0 | |
55 | 57 | } | |
56 | 58 | let totalvotes = (Previoustotalvotes + readA4AStakingAmount) | |
57 | 59 | let FTVO = match getInteger(this, ((("Total_" + VoteAst) + "_") + toString(Porposal_ID))) { | |
58 | 60 | case a: Int => | |
59 | 61 | a | |
60 | 62 | case _ => | |
61 | 63 | 0 | |
62 | 64 | } | |
63 | 65 | let ATVO = (FTVO + readA4AStakingAmount) | |
66 | + | let PreviousUserCountforVoting = match getInteger(this, ((pubkey + "_") + toString(Porposal_ID))) { | |
67 | + | case a: Int => | |
68 | + | a | |
69 | + | case _ => | |
70 | + | 0 | |
71 | + | } | |
72 | + | let LatestUserCountforVoting = (PreviousUserCountforVoting + 1) | |
64 | 73 | if ((StartTS > lastBlock.timestamp)) | |
65 | 74 | then throw((launch_error + toString(StartTS))) | |
66 | 75 | else if ((lastBlock.timestamp > EndTS)) | |
67 | 76 | then throw(voteErr) | |
68 | - | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), StringEntry("message", msg)] | |
77 | + | else if ((LatestUserCountforVoting > 1)) | |
78 | + | then throw(AlreadyVotedError) | |
79 | + | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry("message", msg)] | |
69 | 80 | } | |
70 | 81 | ||
71 | 82 | ||
72 | 83 | ||
73 | 84 | @Callable(i) | |
74 | 85 | func DeleteKey (Key) = [DeleteEntry(Key)] | |
75 | 86 | ||
76 | 87 | ||
77 | 88 | @Verifier(tx) | |
78 | 89 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
79 | 90 |
github/deemru/w8io/026f985 42.70 ms ◑