tx · 8zETtHEGFeQC7sj9BVa8oWJXRAake1TwX9zFQgnECrps

3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu:  -0.01400000 Waves

2020.09.12 14:16 [1174032] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves

{ "type": 13, "id": "8zETtHEGFeQC7sj9BVa8oWJXRAake1TwX9zFQgnECrps", "fee": 1400000, "feeAssetId": null, "timestamp": 1599909400253, "version": 2, "chainId": 84, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "3N8nV7cL5UK15hs2jpCmkhGoqsxnuhEF3g3qSbr4SBumYUVByhJRQcKdNRZKJEz9dP73KhPQ44YJgFK4CNe7pQtk" ], "script": "base64:AAIDAAAAAAAAACAIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgSAwoBCAAAAA8AAAAABnVwVm90ZQIAAAAGdXB2b3RlAAAAAA1hZG1pbkFkZHJlc3MxAQAAABoBVDi2IViANlgIPSCUAVQpoGSXhJ2Tw/Y0iwAAAAANYWRtaW5BZGRyZXNzMgEAAAAaAVTlj1A9878YQ058BBZUI9QC+LwgFva37DoAAAAADWFkbWluQWRkcmVzczMBAAAAGgFUrs609CRmf+XvZDjrx5XoefavLLpzyJEYAAAAAAVkeXpJZAEAAAAgfqtB2c5SyrdhjTSeT2NUMvY45D97zjqBcAiarzFPFmsBAAAADWdldFByb2ZpbGVLZXkAAAABAAAAAmlkCQABLAAAAAIFAAAAAmlkAgAAABRfZW50cmVwcmVuZXVyUHJvZmlsZQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAHX3N0YXR1cwEAAAARZ2V0Vm90ZXJBbW91bnRLZXkAAAACAAAAAmlkAAAABnZvdGVJZAkAASwAAAACCQABLAAAAAIJAAEsAAAAAgUAAAACaWQCAAAAAV8F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bWF0Y2gwCQAEGgAAAAIFAAAABHRoaXMFAAAACmN1cnJlbnRLZXkDCQAAAQAAAAIFAAAAByRtYXRjaDACAAAAA0ludAQAAAABYQUAAAAHJG1hdGNoMAUAAAABYQkAAAIAAAABAgAAACVZb3UgZGlkbid0IHZvdGUgZm9yIHRoaXMgZW50cmVwcmVuZXVyAwkAAAAAAAACBQAAAA1jdXJyZW50QW1vdW50AAAAAAAAAAAACQAAAgAAAAECAAAAJFNlZW1zIHlvdSBoYXZlIHByZXZpb3VzbHkgd2l0aGRyYXduLgkBAAAADFNjcmlwdFJlc3VsdAAAAAIJAQAAAAhXcml0ZVNldAAAAAEJAARMAAAAAgkBAAAACURhdGFFbnRyeQAAAAIFAAAACmN1cnJlbnRLZXkAAAAAAAAAAAAFAAAAA25pbAkBAAAAC1RyYW5zZmVyU2V0AAAAAQkABEwAAAACCQEAAAAOU2NyaXB0VHJhbnNmZXIAAAADCAUAAAABaQAAAAZjYWxsZXIFAAAADWN1cnJlbnRBbW91bnQFAAAABWR5eklkBQAAAANuaWwJAAACAAAAAQIAAAA2Q2FuJ3Qgd2l0aGRyYXcgdm90ZSBhbW91bnQgd2hpbGUgdm90aW5nIGlzIHN0aWxsIG9wZW4uCQAAAgAAAAECAAAAJVlvdSBkaWRuJ3Qgdm90ZSBmb3IgdGhpcyBlbnRyZXByZW5ldXIAAAAAp6muOw==", "height": 1174032, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: C7WcVVowR6tq4aiRVXHGkRjuMDfbqf8DoEQtW6iPDXLF Next: E4aoksrWnw8boxv9HHcMfHyseXHTXVpm2VcnyJ1t94db Diff:
OldNewDifferences
6969
7070
7171 @Callable(i)
72-func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes != adminAddress1))
72+func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1))
7373 then true
74- else (i.caller.bytes != adminAddress2))
74+ else (i.caller.bytes == adminAddress2))
7575 then true
76- else (i.caller.bytes != adminAddress3))
77- then throw("Only Dyzrupt Admin can call this dApp function")
78- else {
76+ else (i.caller.bytes == adminAddress3))
77+ then {
7978 let transactionId = toBase58String(i.transactionId)
8079 WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
8180 }
81+ else throw("Only Dyzrupt Admin can call this dApp function")
8282
8383
8484
108108
109109
110110 @Callable(i)
111-func openVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1))
111+func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
112112 then true
113- else (i.caller.bytes != adminAddress2))
113+ else (i.caller.bytes == adminAddress2))
114114 then true
115- else (i.caller.bytes != adminAddress3))
116- then throw("Only Dyzrupt Admin can call this dApp function")
117- else if (profileExist(voteId))
115+ else (i.caller.bytes == adminAddress3))
116+ then if (profileExist(voteId))
118117 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
119118 else throw("Invalid ID")
119+ else throw("Only Dyzrupt Admin can call this dApp function")
120120
121121
122122
123123 @Callable(i)
124-func closeVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1))
124+func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
125125 then true
126- else (i.caller.bytes != adminAddress2))
126+ else (i.caller.bytes == adminAddress2))
127127 then true
128- else (i.caller.bytes != adminAddress3))
129- then throw("Only Dyzrupt Admin can call this dApp function")
130- else if (profileExist(voteId))
128+ else (i.caller.bytes == adminAddress3))
129+ then if (profileExist(voteId))
131130 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
132131 else throw("Invalid ID")
132+ else throw("Only Dyzrupt Admin can call this dApp function")
133133
134134
135135
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'3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu'
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 profileExist (id) = match getString(this, getProfileKey(id)) {
2929 case a: String =>
3030 true
3131 case _ =>
3232 false
3333 }
3434
3535
3636 func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) {
3737 case a: String =>
3838 a
3939 case _ =>
4040 false
4141 }
4242
4343
4444 func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) {
4545 case a: Int =>
4646 a
4747 case _ =>
4848 throw("Not a valid vote ID")
4949 }
5050
5151
5252 func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote")
5353
5454
5555 func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) {
5656 case a: String =>
5757 a
5858 case _ =>
5959 ""
6060 }
6161
6262
6363 func canVote (address,voteId) = {
6464 let voter = getVoter(address, voteId)
6565 if ((voter == ""))
6666 then true
6767 else false
6868 }
6969
7070
7171 @Callable(i)
72-func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes != adminAddress1))
72+func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1))
7373 then true
74- else (i.caller.bytes != adminAddress2))
74+ else (i.caller.bytes == adminAddress2))
7575 then true
76- else (i.caller.bytes != adminAddress3))
77- then throw("Only Dyzrupt Admin can call this dApp function")
78- else {
76+ else (i.caller.bytes == adminAddress3))
77+ then {
7978 let transactionId = toBase58String(i.transactionId)
8079 WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")])
8180 }
81+ else throw("Only Dyzrupt Admin can call this dApp function")
8282
8383
8484
8585 @Callable(i)
8686 func vote (voteId,vote) = {
8787 let pmt = extract(i.payment)
8888 let voter = toBase58String(i.caller.bytes)
8989 if ((pmt.amount == 0))
9090 then throw("You cannot vote without paying voting fee")
9191 else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G'))
9292 then throw("You can only vote with DYZRUPT token")
9393 else if (canVote(voter, voteId))
9494 then if (profileExist(voteId))
9595 then if ((getVoteStatus(voteId) == "open"))
9696 then if ((vote == upVote))
9797 then {
9898 let voteCount = getVoteCount(voteId, vote)
9999 let newVoteCount = (voteCount + 1)
100100 ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)]))
101101 }
102102 else throw("Not a valid vote value")
103103 else throw("This profile is not open for voting")
104104 else throw("Invalid Profile")
105105 else throw("You can't vote twice")
106106 }
107107
108108
109109
110110 @Callable(i)
111-func openVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1))
111+func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
112112 then true
113- else (i.caller.bytes != adminAddress2))
113+ else (i.caller.bytes == adminAddress2))
114114 then true
115- else (i.caller.bytes != adminAddress3))
116- then throw("Only Dyzrupt Admin can call this dApp function")
117- else if (profileExist(voteId))
115+ else (i.caller.bytes == adminAddress3))
116+ then if (profileExist(voteId))
118117 then WriteSet([DataEntry(getStatusKey(voteId), "open")])
119118 else throw("Invalid ID")
119+ else throw("Only Dyzrupt Admin can call this dApp function")
120120
121121
122122
123123 @Callable(i)
124-func closeVote (voteId) = if (if (if ((i.caller.bytes != adminAddress1))
124+func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1))
125125 then true
126- else (i.caller.bytes != adminAddress2))
126+ else (i.caller.bytes == adminAddress2))
127127 then true
128- else (i.caller.bytes != adminAddress3))
129- then throw("Only Dyzrupt Admin can call this dApp function")
130- else if (profileExist(voteId))
128+ else (i.caller.bytes == adminAddress3))
129+ then if (profileExist(voteId))
131130 then WriteSet([DataEntry(getStatusKey(voteId), "closed")])
132131 else throw("Invalid ID")
132+ else throw("Only Dyzrupt Admin can call this dApp function")
133133
134134
135135
136136 @Callable(i)
137137 func withdraw (voteId) = {
138138 let voter = toBase58String(i.caller.bytes)
139139 if ((getVoter(voter, voteId) != ""))
140140 then if ((getVoteStatus(voteId) == "closed"))
141141 then {
142142 let currentKey = getVoterAmountKey(voter, voteId)
143143 let currentAmount = match getInteger(this, currentKey) {
144144 case a: Int =>
145145 a
146146 case _ =>
147147 throw("You didn't vote for this entrepreneur")
148148 }
149149 if ((currentAmount == 0))
150150 then throw("Seems you have previously withdrawn.")
151151 else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)]))
152152 }
153153 else throw("Can't withdraw vote amount while voting is still open.")
154154 else throw("You didn't vote for this entrepreneur")
155155 }
156156
157157

github/deemru/w8io/026f985 
31.61 ms