tx · 7QWw8qRa772iU5o4Mov522tWri7JHSB5BamV4PzUGNNj

3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu:  -0.01400000 Waves

2020.09.22 22:01 [1188903] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves

{ "type": 13, "id": "7QWw8qRa772iU5o4Mov522tWri7JHSB5BamV4PzUGNNj", "fee": 1400000, "feeAssetId": null, "timestamp": 1600801326396, "version": 2, "chainId": 84, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "4sDocNduLnqjNcgXhWhEpqFVyh27YNqjue4N4eudP9mVmEoExKMrAvTeYtY3EwRCPd4zEEQtwQTtKaaiWzFbQrBh" ], "script": "base64:AAIDAAAAAAAAACAIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgSAwoBCAAAABEAAAAABnVwVm90ZQIAAAAGdXB2b3RlAAAAAA1hZG1pbkFkZHJlc3MxAQAAABoBVDi2IViANlgIPSCUAVQpoGSXhJ2Tw/Y0iwAAAAANYWRtaW5BZGRyZXNzMgEAAAAaAVTlj1A9878YQ058BBZUI9QC+LwgFva37DoAAAAADWFkbWluQWRkcmVzczMBAAAAGgFUPo0bC5weIFiGP3KzAhxqwrizqd9EMgoVAAAAAAVkeXpJZAEAAAAgfqtB2c5SyrdhjTSeT2NUMvY45D97zjqBcAiarzFPFmsBAAAADWdldFByb2ZpbGVLZXkAAAABAAAAAmlkCQABLAAAAAIFAAAAAmlkAgAAABRfZW50cmVwcmVuZXVyUHJvZmlsZQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAHX3N0YXR1cwEAAAARZ2V0Vm90ZXJBbW91bnRLZXkAAAACAAAAAmlkAAAABnZvdGVJZAkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAACaWQCAAAAAV8FAAA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dAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWN1cnJlbnRBbW91bnQFAAAABWR5eklkBQAAAANuaWwJAAACAAAAAQIAAAA2Q2FuJ3Qgd2l0aGRyYXcgdm90ZSBhbW91bnQgd2hpbGUgdm90aW5nIGlzIHN0aWxsIG9wZW4uCQAAAgAAAAECAAAAJVlvdSBkaWRuJ3Qgdm90ZSBmb3IgdGhpcyBlbnRyZXByZW5ldXIAAAAAhQCsEQ==", "height": 1188903, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: AnVCgpToNVwyGpZRvYo3Strh62KTY7AdapAz68vLYitB Next: F3Fdv54noSFXLmYRku2G9QF9ktXH6PQaop6nVLY43tby Diff:
OldNewDifferences
5858 case a: Int =>
5959 a
6060 case _ =>
61- throw("Not a valid vote ID")
61+ 0
6262 }
6363
6464
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 3 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let upVote = "upvote"
55
66 let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC'
77
88 let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b'
99
1010 let adminAddress3 = base58'3Mucpi1K4FMVrZKnYEgjxQf5DkkBX7QrHoJ'
1111
1212 let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'
1313
1414 func getProfileKey (id) = (id + "_entrepreneurProfile")
1515
1616
1717 func getStatusKey (id) = (id + "_status")
1818
1919
2020 func getVoterAmountKey (id,voteId) = (((id + "_") + voteId) + "_amount")
2121
2222
2323 func getVoteKey (id,type) = if ((type == "upvote"))
2424 then (id + "_upvote")
2525 else throw("Invalid vote type")
2626
2727
2828 func getVoteAmountKey (id,type) = if ((type == "upvote"))
2929 then (((id + "_") + type) + "_amount")
3030 else throw("Invalid vote type")
3131
3232
3333 func profileExist (id) = match getString(this, getProfileKey(id)) {
3434 case a: String =>
3535 true
3636 case _ =>
3737 false
3838 }
3939
4040
4141 func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) {
4242 case a: String =>
4343 a
4444 case _ =>
4545 false
4646 }
4747
4848
4949 func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) {
5050 case a: Int =>
5151 a
5252 case _ =>
5353 throw("Not a valid vote ID")
5454 }
5555
5656
5757 func getVoteAmountCount (voteId,vote) = match getInteger(this, getVoteAmountKey(voteId, vote)) {
5858 case a: Int =>
5959 a
6060 case _ =>
61- throw("Not a valid vote ID")
61+ 0
6262 }
6363
6464
6565 func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
6666
6767
6868 func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) {
6969 case a: String =>
7070 a
7171 case _ =>
7272 ""
7373 }
7474
7575
7676 func canVote (address,voteId) = {
7777 let voter = getVoter(address, voteId)
7878 if ((voter == ""))
7979 then true
8080 else false
8181 }
8282
8383
8484 @Callable(i)
8585 func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1))
8686 then true
8787 else (i.caller.bytes == adminAddress2))
8888 then true
8989 else (i.caller.bytes == adminAddress3))
9090 then {
9191 let transactionId = toBase58String(i.transactionId)
9292 WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getVoteAmountKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
9393 }
9494 else throw("Only Dyzrupt Admin can call this dApp function")
9595
9696
9797
9898 @Callable(i)
9999 func vote (voteId,vote) = {
100100 let pmt = extract(i.payment)
101101 let voter = toBase58String(i.caller.bytes)
102102 if ((pmt.amount == 0))
103103 then throw("You cannot vote without paying voting fee")
104104 else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
105105 then throw("You can only vote with DYZRUPT token")
106106 else if (canVote(voter, voteId))
107107 then if (profileExist(voteId))
108108 then if ((getVoteStatus(voteId) == "open"))
109109 then if ((vote == upVote))
110110 then {
111111 let voteCount = getVoteCount(voteId, vote)
112112 let voteAmountCount = getVoteAmountCount(voteId, vote)
113113 let newVoteCount = (voteCount + 1)
114114 let newVoteAmountCount = (voteAmountCount + pmt.amount)
115115 ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
116116 }
117117 else throw("Not a valid vote value")
118118 else throw("This profile is not open for voting")
119119 else throw("Invalid Profile")
120120 else throw("You can't vote twice")
121121 }
122122
123123
124124
125125 @Callable(i)
126126 func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
127127 then true
128128 else (i.caller.bytes == adminAddress2))
129129 then true
130130 else (i.caller.bytes == adminAddress3))
131131 then if (profileExist(voteId))
132132 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
133133 else throw("Invalid ID")
134134 else throw("Only Dyzrupt Admin can call this dApp function")
135135
136136
137137
138138 @Callable(i)
139139 func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
140140 then true
141141 else (i.caller.bytes == adminAddress2))
142142 then true
143143 else (i.caller.bytes == adminAddress3))
144144 then if (profileExist(voteId))
145145 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
146146 else throw("Invalid ID")
147147 else throw("Only Dyzrupt Admin can call this dApp function")
148148
149149
150150
151151 @Callable(i)
152152 func withdraw (voteId) = {
153153 let voter = toBase58String(i.caller.bytes)
154154 if ((getVoter(voter, voteId) != ""))
155155 then if ((getVoteStatus(voteId) == "closed"))
156156 then {
157157 let currentKey = getVoterAmountKey(voter, voteId)
158158 let currentAmount = match getInteger(this, currentKey) {
159159 case a: Int =>
160160 a
161161 case _ =>
162162 throw("You didn't vote for this entrepreneur")
163163 }
164164 if ((currentAmount == 0))
165165 then throw("Seems you have previously withdrawn.")
166166 else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)]))
167167 }
168168 else throw("Can't withdraw vote amount while voting is still open.")
169169 else throw("You didn't vote for this entrepreneur")
170170 }
171171
172172

github/deemru/w8io/169f3d6 
82.01 ms