tx · E2GuSsvnQQECUi5VpB4WpnjzFGZ2sFpHMEGiXNPERBvR 3N8dYK8BQhY7z1yKFRFhdw4m9b4JjsNQJVd: -0.01400000 Waves 2023.04.14 16:44 [2534280] smart account 3N8dYK8BQhY7z1yKFRFhdw4m9b4JjsNQJVd > SELF 0.00000000 Waves
{ "type": 13, "id": "E2GuSsvnQQECUi5VpB4WpnjzFGZ2sFpHMEGiXNPERBvR", "fee": 1400000, "feeAssetId": null, "timestamp": 1681479867937, "version": 2, "chainId": 84, "sender": "3N8dYK8BQhY7z1yKFRFhdw4m9b4JjsNQJVd", "senderPublicKey": "AK6rRKpHobxNveEtJE5BBXbdwm9BpGL7ewP9Xb6VYuHx", "proofs": [ "DeenKhe8C522YEQvLM1fTNPE2MsukEBxtTjvDtM861ZxEfWm1wcwUDija2dBhg8ZgRDiUtGMz9sf8DTrBvVCkV6" ], "script": "base64:AAIEAAAAAAAAAA4IAhIFCgMIAQESAwoBAQAAAAcAAAAADkE0QVN0YWtpbmdEQXBwCQEAAAARQGV4dHJOYXRpdmUoMTA2MikAAAABAgAAACMzTjZvV0x5UVkyZ003UVVrVXZCbWUxUkVuQTZkMVY3eTNBVAAAAAAidm90aW5nX3RpbWVzdGFtcF9jb250cm9sbGVyX3B1YmtleQEAAAAgO3RF8b5QOeRSsZiONgCOv+riQ9YfIBAqDV0YsQ0EQwwAAAAAEmNvbnRyb2xsZXJfYWRkcmVzcwkBAAAAFGFkZHJlc3NGcm9tUHVibGljS2V5AAAAAQUAAAAidm90aW5nX3RpbWVzdGFtcF9jb250cm9sbGVyX3B1YmtleQAAAAAMbGF1bmNoX2Vycm9yAgAAACREYXBwIHdpbGwgc3RhcnQgVm90aW5nIGF0IFRpbWVzdGFtcCAAAAAAA21zZwIAAAAuPGgxPllvdXIgVm90ZSBTdWJtaXR0ZWQgU3VjY2Vzc2Z1bGx5ITwvaDE+PGJyPgAAAAARQWxyZWFkeVZvdGVkRXJyb3ICAAAAPlRoaXMgQWRkcmVzcy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x1ZQkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACAgAAAAxUb3RhbF9Wb3Rlc18JAAGkAAAAAQUAAAALUG9ycG9zYWxfSUQFAAAACnRvdGFsdm90ZXMJAARMAAAAAgkBAAAADEludGVnZXJFbnRyeQAAAAIJAAEsAAAAAgkAASwAAAACCQABLAAAAAICAAAABlRvdGFsXwUAAAAHVm90ZUFzdAIAAAABXwkAAaQAAAABBQAAAAtQb3Jwb3NhbF9JRAUAAAAEQVRWTwkABEwAAAACCQEAAAAMSW50ZWdlckVudHJ5AAAAAgkAASwAAAACCQABLAAAAAIFAAAABnB1YmtleQIAAAABXwkAAaQAAAABBQAAAAtQb3Jwb3NhbF9JRAUAAAAYTGF0ZXN0VXNlckNvdW50Zm9yVm90aW5nCQAETAAAAAIJAQAAAAtTdHJpbmdFbnRyeQAAAAIJAAEsAAAAAgIAAAAOUXVvcnVtX1N0YXR1c18JAAGkAAAAAQUAAAALUG9ycG9zYWxfSUQCAAAABFBhc3MJAARMAAAAAgkBAAAAC1N0cmluZ0VudHJ5AAAAAgIAAAAHbWVzc2FnZQUAAAADbXNnBQAAAANuaWwFAAAAA25pbAAAAAEAAAACdHgBAAAABnZlcmlmeQAAAAAJAAH0AAAAAwgFAAAAAnR4AAAACWJvZHlCeXRlcwkAAZEAAAACCAUAAAACdHgAAAAGcHJvb2ZzAAAAAAAAAAAACAUAAAACdHgAAAAPc2VuZGVyUHVibGljS2V5olhAzw==", "height": 2534280, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6cp8saB11g67dp49fW27R4gBva5SeV4LxwBqK8kbwGM7 Next: 2yWDvu2q89GZkxDJoydYDbAucwZ2uuCBLscrP3Lte5YY Diff:
Old | New | Differences | |
---|---|---|---|
33 | 33 | then throw("Subject Char Limits are Over. Reduce length less than 5100 Char.") | |
34 | 34 | else if ((i.caller != controller_address)) | |
35 | 35 | then throw((("This Address is not Authorized. Only " + toString(controller_address)) + " is Authorized Address to Sign it.")) | |
36 | - | 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), IntegerEntry(("Quorum_" + toString(totalproposals)), QuorumValue), IntegerEntry(("Total_Votes_" + toString(totalproposals)), 0), IntegerEntry(("Total_No_" + toString(totalproposals)), 0), IntegerEntry(("Total_Yes_" + toString(totalproposals)), 0)] | |
36 | + | 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), IntegerEntry(("Quorum_" + toString(totalproposals)), QuorumValue), IntegerEntry(("Total_Votes_" + toString(totalproposals)), 0), IntegerEntry(("Total_No_" + toString(totalproposals)), 0), IntegerEntry(("Total_Yes_" + toString(totalproposals)), 0), StringEntry(("Quorum_Status_" + toString(totalproposals)), "Fail")] | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
46 | 46 | let pubkey = toBase58String(i.caller.bytes) | |
47 | 47 | let readA4AStakingAmount = valueOrErrorMessage(getInteger(A4AStakingDApp, ("Deposit_Amount_Of_" + pubkey)), "Address not found in A4A Staking.") | |
48 | 48 | let readQuoraumValue = getIntegerValue(this, ("Quorum_" + toString(Porposal_ID))) | |
49 | + | let readTotalNoVotesValue = getIntegerValue(this, ("Total_No_" + toString(Porposal_ID))) | |
49 | 50 | let Previoustotalvotes = match getInteger(this, ("Total_Votes_" + toString(Porposal_ID))) { | |
50 | 51 | case a: Int => | |
51 | 52 | a | |
71 | 72 | then throw((launch_error + toString(StartTS))) | |
72 | 73 | else if ((lastBlock.timestamp > EndTS)) | |
73 | 74 | then throw(voteErr) | |
74 | - | else if ((readQuoraumValue > | |
75 | + | else if ((readQuoraumValue > totalvotes)) | |
75 | 76 | then [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Fail"), StringEntry("message", msg)] | |
76 | - | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Pass"), StringEntry("message", msg)] | |
77 | - | } | |
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | @Callable(i) | |
82 | - | func No (Porposal_ID) = { | |
83 | - | let VoteAst = "No" | |
84 | - | let StartTS = getIntegerValue(this, ("Voting_Start_TimeStamp_" + toString(Porposal_ID))) | |
85 | - | let EndTS = getIntegerValue(this, ("Voting_End_TimeStamp_" + toString(Porposal_ID))) | |
86 | - | let pubkey = toBase58String(i.caller.bytes) | |
87 | - | let readA4AStakingAmount = valueOrErrorMessage(getInteger(A4AStakingDApp, ("Deposit_Amount_Of_" + pubkey)), "Address not found in A4A Staking.") | |
88 | - | let readQuoraumValue = getIntegerValue(this, ("Quorum_" + toString(Porposal_ID))) | |
89 | - | let Previoustotalvotes = match getInteger(this, ("Total_Votes_" + toString(Porposal_ID))) { | |
90 | - | case a: Int => | |
91 | - | a | |
92 | - | case _ => | |
93 | - | 0 | |
94 | - | } | |
95 | - | let totalvotes = (Previoustotalvotes + readA4AStakingAmount) | |
96 | - | let FTVO = match getInteger(this, ((("Total_" + VoteAst) + "_") + toString(Porposal_ID))) { | |
97 | - | case a: Int => | |
98 | - | a | |
99 | - | case _ => | |
100 | - | 0 | |
101 | - | } | |
102 | - | let ATVO = (FTVO + readA4AStakingAmount) | |
103 | - | let PreviousUserCountforVoting = match getInteger(this, ((pubkey + "_") + toString(Porposal_ID))) { | |
104 | - | case a: Int => | |
105 | - | a | |
106 | - | case _ => | |
107 | - | 0 | |
108 | - | } | |
109 | - | let LatestUserCountforVoting = (PreviousUserCountforVoting + 1) | |
110 | - | if ((StartTS > lastBlock.timestamp)) | |
111 | - | then throw((launch_error + toString(StartTS))) | |
112 | - | else if ((lastBlock.timestamp > EndTS)) | |
113 | - | then throw(voteErr) | |
114 | - | else if ((readQuoraumValue > ATVO)) | |
115 | - | then [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Fail"), StringEntry("message", msg)] | |
116 | - | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Fail"), StringEntry("message", msg)] | |
77 | + | else if ((totalvotes > readQuoraumValue)) | |
78 | + | then [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Pass"), StringEntry("message", msg)] | |
79 | + | else nil | |
117 | 80 | } | |
118 | 81 | ||
119 | 82 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 4 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let A4AStakingDApp = addressFromStringValue("3N6oWLyQY2gM7QUkUvBme1REnA6d1V7y3AT") | |
5 | 5 | ||
6 | 6 | let voting_timestamp_controller_pubkey = base58'515tSAyMUbAb8kKjcpGDpqALGfCgcwfWmWKKkcBKTcGB' | |
7 | 7 | ||
8 | 8 | let controller_address = addressFromPublicKey(voting_timestamp_controller_pubkey) | |
9 | 9 | ||
10 | 10 | let launch_error = "Dapp will start Voting at Timestamp " | |
11 | 11 | ||
12 | 12 | let msg = "<h1>Your Vote Submitted Successfully!</h1><br>" | |
13 | 13 | ||
14 | 14 | let AlreadyVotedError = "This Address Already participated for Voting in this Proposal." | |
15 | 15 | ||
16 | 16 | let voteErr = "Voting is Over for this Dapp." | |
17 | 17 | ||
18 | 18 | @Callable(i) | |
19 | 19 | func SetVotingTimeStamps (Proposal,Voting_Start_TimeStamp,Voting_End_TimeStamp) = { | |
20 | 20 | let StartTS = Voting_Start_TimeStamp | |
21 | 21 | let EndTS = Voting_End_TimeStamp | |
22 | 22 | let readtotalStakedA4A = getIntegerValue(A4AStakingDApp, "Staked_Amount") | |
23 | 23 | let QuorumValue = fraction(readtotalStakedA4A, 1, 3) | |
24 | 24 | let pubkey = toBase58String(i.caller.bytes) | |
25 | 25 | let Previoustotalproposals = match getInteger(this, "Total_Proposals") { | |
26 | 26 | case a: Int => | |
27 | 27 | a | |
28 | 28 | case _ => | |
29 | 29 | 0 | |
30 | 30 | } | |
31 | 31 | let totalproposals = (Previoustotalproposals + 1) | |
32 | 32 | if ((size(Proposal) > 5100)) | |
33 | 33 | then throw("Subject Char Limits are Over. Reduce length less than 5100 Char.") | |
34 | 34 | else if ((i.caller != controller_address)) | |
35 | 35 | then throw((("This Address is not Authorized. Only " + toString(controller_address)) + " is Authorized Address to Sign it.")) | |
36 | - | 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), IntegerEntry(("Quorum_" + toString(totalproposals)), QuorumValue), IntegerEntry(("Total_Votes_" + toString(totalproposals)), 0), IntegerEntry(("Total_No_" + toString(totalproposals)), 0), IntegerEntry(("Total_Yes_" + toString(totalproposals)), 0)] | |
36 | + | 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), IntegerEntry(("Quorum_" + toString(totalproposals)), QuorumValue), IntegerEntry(("Total_Votes_" + toString(totalproposals)), 0), IntegerEntry(("Total_No_" + toString(totalproposals)), 0), IntegerEntry(("Total_Yes_" + toString(totalproposals)), 0), StringEntry(("Quorum_Status_" + toString(totalproposals)), "Fail")] | |
37 | 37 | } | |
38 | 38 | ||
39 | 39 | ||
40 | 40 | ||
41 | 41 | @Callable(i) | |
42 | 42 | func Yes (Porposal_ID) = { | |
43 | 43 | let VoteAst = "Yes" | |
44 | 44 | let StartTS = getIntegerValue(this, ("Voting_Start_TimeStamp_" + toString(Porposal_ID))) | |
45 | 45 | let EndTS = getIntegerValue(this, ("Voting_End_TimeStamp_" + toString(Porposal_ID))) | |
46 | 46 | let pubkey = toBase58String(i.caller.bytes) | |
47 | 47 | let readA4AStakingAmount = valueOrErrorMessage(getInteger(A4AStakingDApp, ("Deposit_Amount_Of_" + pubkey)), "Address not found in A4A Staking.") | |
48 | 48 | let readQuoraumValue = getIntegerValue(this, ("Quorum_" + toString(Porposal_ID))) | |
49 | + | let readTotalNoVotesValue = getIntegerValue(this, ("Total_No_" + toString(Porposal_ID))) | |
49 | 50 | let Previoustotalvotes = match getInteger(this, ("Total_Votes_" + toString(Porposal_ID))) { | |
50 | 51 | case a: Int => | |
51 | 52 | a | |
52 | 53 | case _ => | |
53 | 54 | 0 | |
54 | 55 | } | |
55 | 56 | let totalvotes = (Previoustotalvotes + readA4AStakingAmount) | |
56 | 57 | let FTVO = match getInteger(this, ((("Total_" + VoteAst) + "_") + toString(Porposal_ID))) { | |
57 | 58 | case a: Int => | |
58 | 59 | a | |
59 | 60 | case _ => | |
60 | 61 | 0 | |
61 | 62 | } | |
62 | 63 | let ATVO = (FTVO + readA4AStakingAmount) | |
63 | 64 | let PreviousUserCountforVoting = match getInteger(this, ((pubkey + "_") + toString(Porposal_ID))) { | |
64 | 65 | case a: Int => | |
65 | 66 | a | |
66 | 67 | case _ => | |
67 | 68 | 0 | |
68 | 69 | } | |
69 | 70 | let LatestUserCountforVoting = (PreviousUserCountforVoting + 1) | |
70 | 71 | if ((StartTS > lastBlock.timestamp)) | |
71 | 72 | then throw((launch_error + toString(StartTS))) | |
72 | 73 | else if ((lastBlock.timestamp > EndTS)) | |
73 | 74 | then throw(voteErr) | |
74 | - | else if ((readQuoraumValue > | |
75 | + | else if ((readQuoraumValue > totalvotes)) | |
75 | 76 | then [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Fail"), StringEntry("message", msg)] | |
76 | - | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Pass"), StringEntry("message", msg)] | |
77 | - | } | |
78 | - | ||
79 | - | ||
80 | - | ||
81 | - | @Callable(i) | |
82 | - | func No (Porposal_ID) = { | |
83 | - | let VoteAst = "No" | |
84 | - | let StartTS = getIntegerValue(this, ("Voting_Start_TimeStamp_" + toString(Porposal_ID))) | |
85 | - | let EndTS = getIntegerValue(this, ("Voting_End_TimeStamp_" + toString(Porposal_ID))) | |
86 | - | let pubkey = toBase58String(i.caller.bytes) | |
87 | - | let readA4AStakingAmount = valueOrErrorMessage(getInteger(A4AStakingDApp, ("Deposit_Amount_Of_" + pubkey)), "Address not found in A4A Staking.") | |
88 | - | let readQuoraumValue = getIntegerValue(this, ("Quorum_" + toString(Porposal_ID))) | |
89 | - | let Previoustotalvotes = match getInteger(this, ("Total_Votes_" + toString(Porposal_ID))) { | |
90 | - | case a: Int => | |
91 | - | a | |
92 | - | case _ => | |
93 | - | 0 | |
94 | - | } | |
95 | - | let totalvotes = (Previoustotalvotes + readA4AStakingAmount) | |
96 | - | let FTVO = match getInteger(this, ((("Total_" + VoteAst) + "_") + toString(Porposal_ID))) { | |
97 | - | case a: Int => | |
98 | - | a | |
99 | - | case _ => | |
100 | - | 0 | |
101 | - | } | |
102 | - | let ATVO = (FTVO + readA4AStakingAmount) | |
103 | - | let PreviousUserCountforVoting = match getInteger(this, ((pubkey + "_") + toString(Porposal_ID))) { | |
104 | - | case a: Int => | |
105 | - | a | |
106 | - | case _ => | |
107 | - | 0 | |
108 | - | } | |
109 | - | let LatestUserCountforVoting = (PreviousUserCountforVoting + 1) | |
110 | - | if ((StartTS > lastBlock.timestamp)) | |
111 | - | then throw((launch_error + toString(StartTS))) | |
112 | - | else if ((lastBlock.timestamp > EndTS)) | |
113 | - | then throw(voteErr) | |
114 | - | else if ((readQuoraumValue > ATVO)) | |
115 | - | then [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Fail"), StringEntry("message", msg)] | |
116 | - | else [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Fail"), StringEntry("message", msg)] | |
77 | + | else if ((totalvotes > readQuoraumValue)) | |
78 | + | then [IntegerEntry(("Total_Votes_" + toString(Porposal_ID)), totalvotes), IntegerEntry(((("Total_" + VoteAst) + "_") + toString(Porposal_ID)), ATVO), IntegerEntry(((pubkey + "_") + toString(Porposal_ID)), LatestUserCountforVoting), StringEntry(("Quorum_Status_" + toString(Porposal_ID)), "Pass"), StringEntry("message", msg)] | |
79 | + | else nil | |
117 | 80 | } | |
118 | 81 | ||
119 | 82 | ||
120 | 83 | @Verifier(tx) | |
121 | 84 | func verify () = sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey) | |
122 | 85 |
github/deemru/w8io/169f3d6 37.77 ms ◑