tx · GXakgudwXb6iNeXLgPb2CrJxYW48UHHTSKQDJCuZNP26 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu: -0.01400000 Waves 2020.11.24 10:05 [1279173] smart account 3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu > SELF 0.00000000 Waves
{ "type": 13, "id": "GXakgudwXb6iNeXLgPb2CrJxYW48UHHTSKQDJCuZNP26", "fee": 1400000, "feeAssetId": null, "timestamp": 1606201545389, "version": 2, "chainId": 84, "sender": "3N5rNyYSAsaP9QL2eQq286RhevB8msHFffu", "senderPublicKey": "CBTEuFN6ku1LNaPuGHHTMh2CBb3kPa5D73XXTJvKydun", "proofs": [ "4G6mW7iDKCSRgcfPVNuGaqfdSBh2mjjAoPfWZ8Y6XgeH2sqjYybiyLqtUxhWiwfRnXG3jvhSRixw1Ah9AwcYgHQe" ], "script": "base64:AAIDAAAAAAAAACwIARIHCgUICAgICBIECgIICBIDCgEIEgMKAQgSAwoBCBIAEgMKAQESAwoBAQAAABUAAAAABnVwVm90ZQIAAAAGdXB2b3RlAAAAAA1hZG1pbkFkZHJlc3MxAQAAABoBVDi2IViANlgIPSCUAVQpoGSXhJ2Tw/Y0iwAAAAANYWRtaW5BZGRyZXNzMgEAAAAaAVTlj1A9878YQ058BBZUI9QC+LwgFva37DoAAAAADWFkbWluQWRkcmVzczMBAAAAGgFUPo0bC5weIFiGP3KzAhxqwrizqd9EMgoVAAAAAAVkeXpJZAEAAAAgfqtB2c5SyrdhjTSeT2NUMvY45D97zjqBcAiarzFPFmsBAAAADWdldFByb2ZpbGVLZXkAAAABAAAAAmlkCQABLAAAAAIFAAAAAmlkAgAAABRfZW50cmVwcmVuZXVyUHJvZmlsZQEAAAAMZ2V0U3RhdHVzS2V5AAAAAQAAAAJpZAkAASwAAAACBQAAAAJpZAIAAAAHX3N0YXR1cwEAAAARZ2V0Vm90ZXJBbW91bnRLZXkAAAACAAAAAmlkAAAABnZvdGVJZAkAASwAAAACCQABLAAAAAIJAAEsAA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AwkAAAAAAAACBQAAAAxjdXJyZW50U3Rha2UAAAAAAAAAAAAJAAACAAAAAQIAAAAZWW91IGRvbid0IGhhdmUgYW55IHN0YWtlcwMJAAAAAAAAAgUAAAAJc3Rha2VQb29sAAAAAAAAAAAACQAAAgAAAAECAAAAM05vdGhpbmcgaW4gU3Rha2UgcG9vbCBhdCB0aGlzIHRpbWUuIFRyeSBhZ2FpbiBsYXRlcgMJAABmAAAAAgUAAAAGcmV3YXJkBQAAAAlzdGFrZVBvb2wJAAACAAAAAQIAAAAXTm8gcmV3YXJkcyBhdCB0aGlzIHRpbWUEAAAADG5ld1N0YWtlUG9vbAkAAGUAAAACBQAAAAlzdGFrZVBvb2wFAAAABnJld2FyZAQAAAAObmV3U3Rha2VBbW91bnQJAABlAAAAAgUAAAAMY3VycmVudFN0YWtlBQAAAAZyZXdhcmQJAQAAAAxTY3JpcHRSZXN1bHQAAAACCQEAAAAIV3JpdGVTZXQAAAABCQAETAAAAAIJAQAAAAlEYXRhRW50cnkAAAACCQEAAAAMZ2V0U3Rha2VyS2V5AAAAAQUAAAAGc3Rha2VyBQAAAA5uZXdTdGFrZUFtb3VudAkABEwAAAACCQEAAAAJRGF0YUVudHJ5AAAAAgkBAAAAD2dldFN0YWtlUG9vbEtleQAAAAAFAAAADG5ld1N0YWtlUG9vbAUAAAADbmlsCQEAAAALVHJhbnNmZXJTZXQAAAABCQAETAAAAAIJAQAAAA5TY3JpcHRUcmFuc2ZlcgAAAAMIBQAAAAFpAAAABmNhbGxlcgUAAAAGcmV3YXJkBQAAAAVkeXpJZAUAAAADbmlsAAAAANPbkTU=", "height": 1279173, "applicationStatus": "succeeded", "spentComplexity": 0 } View: original | compacted Prev: 6XH57mNapFhK5QeFe4fpMET2nkXmFf9d3z95KVKQVR9D Next: 3CHyyt5jbdWJLwefWPdFLsoULr7esVBNzRjDoaREYCPy Diff:
Old | New | Differences | |
---|---|---|---|
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let upVote = "upvote" | |
5 | 5 | ||
6 | - | let adminAddress = base58'3N5cTHzbHc9dyQuBfKMjFKaxcrmRq54XDLu' | |
6 | + | let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC' | |
7 | + | ||
8 | + | let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b' | |
9 | + | ||
10 | + | let adminAddress3 = base58'3Mucpi1K4FMVrZKnYEgjxQf5DkkBX7QrHoJ' | |
7 | 11 | ||
8 | 12 | let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G' | |
9 | - | ||
10 | - | func getStakePoolKey () = "stake_pool" | |
11 | - | ||
12 | - | ||
13 | - | func getStakePool () = match getInteger(this, getStakePoolKey()) { | |
14 | - | case a: Int => | |
15 | - | a | |
16 | - | case _ => | |
17 | - | 0 | |
18 | - | } | |
19 | - | ||
20 | - | ||
21 | - | func getStakerKey (staker) = (staker + "_stake") | |
22 | - | ||
23 | - | ||
24 | - | func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) { | |
25 | - | case a: Int => | |
26 | - | a | |
27 | - | case _ => | |
28 | - | 0 | |
29 | - | } | |
30 | - | ||
31 | 13 | ||
32 | 14 | func getProfileKey (id) = (id + "_entrepreneurProfile") | |
33 | 15 | ||
35 | 17 | func getStatusKey (id) = (id + "_status") | |
36 | 18 | ||
37 | 19 | ||
20 | + | func getVoterAmountKey (id,voteId) = (((id + "_") + voteId) + "_amount") | |
21 | + | ||
22 | + | ||
38 | 23 | func getVoteKey (id,type) = if ((type == "upvote")) | |
39 | 24 | then (id + "_upvote") | |
25 | + | else throw("Invalid vote type") | |
26 | + | ||
27 | + | ||
28 | + | func getVoteAmountKey (id,type) = if ((type == "upvote")) | |
29 | + | then (((id + "_") + type) + "_amount") | |
40 | 30 | else throw("Invalid vote type") | |
41 | 31 | ||
42 | 32 | ||
64 | 54 | } | |
65 | 55 | ||
66 | 56 | ||
57 | + | func getVoteAmountCount (voteId,vote) = match getInteger(this, getVoteAmountKey(voteId, vote)) { | |
58 | + | case a: Int => | |
59 | + | a | |
60 | + | case _ => | |
61 | + | 0 | |
62 | + | } | |
63 | + | ||
64 | + | ||
67 | 65 | func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote") | |
68 | 66 | ||
69 | 67 | ||
83 | 81 | } | |
84 | 82 | ||
85 | 83 | ||
84 | + | func getStakerKey (staker) = (staker + "_stake") | |
85 | + | ||
86 | + | ||
87 | + | func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) { | |
88 | + | case a: Int => | |
89 | + | a | |
90 | + | case _ => | |
91 | + | 0 | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | func getStakePoolKey () = "stake_pool" | |
96 | + | ||
97 | + | ||
98 | + | func getStakePool () = match getInteger(this, getStakePoolKey()) { | |
99 | + | case a: Int => | |
100 | + | a | |
101 | + | case _ => | |
102 | + | 0 | |
103 | + | } | |
104 | + | ||
105 | + | ||
86 | 106 | @Callable(i) | |
87 | - | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress)) | |
88 | - | then throw("Only Dyzrupt Admin can call this dApp function") | |
89 | - | else { | |
107 | + | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1)) | |
108 | + | then true | |
109 | + | else (i.caller.bytes == adminAddress2)) | |
110 | + | then true | |
111 | + | else (i.caller.bytes == adminAddress3)) | |
112 | + | then { | |
90 | 113 | let transactionId = toBase58String(i.transactionId) | |
91 | - | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")]) | |
114 | + | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getVoteAmountKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")]) | |
92 | 115 | } | |
116 | + | else throw("Only Dyzrupt Admin can call this dApp function") | |
93 | 117 | ||
94 | 118 | ||
95 | 119 | ||
96 | 120 | @Callable(i) | |
97 | 121 | func vote (voteId,vote) = { | |
98 | 122 | let pmt = extract(i.payment) | |
123 | + | let voter = toBase58String(i.caller.bytes) | |
99 | 124 | if ((pmt.amount == 0)) | |
100 | 125 | then throw("You cannot vote without paying voting fee") | |
101 | 126 | else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G')) | |
102 | 127 | then throw("You can only vote with DYZRUPT token") | |
103 | - | else if (canVote( | |
128 | + | else if (canVote(voter, voteId)) | |
104 | 129 | then if (profileExist(voteId)) | |
105 | 130 | then if ((getVoteStatus(voteId) == "open")) | |
106 | 131 | then if ((vote == upVote)) | |
107 | 132 | then { | |
108 | 133 | let voteCount = getVoteCount(voteId, vote) | |
134 | + | let voteAmountCount = getVoteAmountCount(voteId, vote) | |
109 | 135 | let newVoteCount = (voteCount + 1) | |
110 | - | ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
136 | + | let newVoteAmountCount = (voteAmountCount + pmt.amount) | |
137 | + | ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount), DataEntry(getVoteAmountKey(voteId, vote), newVoteAmountCount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
111 | 138 | } | |
112 | 139 | else throw("Not a valid vote value") | |
113 | 140 | else throw("This profile is not open for voting") | |
118 | 145 | ||
119 | 146 | ||
120 | 147 | @Callable(i) | |
121 | - | func openVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
122 | - | then throw("Only Dyzrupt Admin can call this dApp function") | |
123 | - | else if (profileExist(voteId)) | |
148 | + | func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1)) | |
149 | + | then true | |
150 | + | else (i.caller.bytes == adminAddress2)) | |
151 | + | then true | |
152 | + | else (i.caller.bytes == adminAddress3)) | |
153 | + | then if (profileExist(voteId)) | |
124 | 154 | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
125 | 155 | else throw("Invalid ID") | |
156 | + | else throw("Only Dyzrupt Admin can call this dApp function") | |
126 | 157 | ||
127 | 158 | ||
128 | 159 | ||
129 | 160 | @Callable(i) | |
130 | - | func closeVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
131 | - | then throw("Only Dyzrupt Admin can call this dApp function") | |
132 | - | else if (profileExist(voteId)) | |
161 | + | func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1)) | |
162 | + | then true | |
163 | + | else (i.caller.bytes == adminAddress2)) | |
164 | + | then true | |
165 | + | else (i.caller.bytes == adminAddress3)) | |
166 | + | then if (profileExist(voteId)) | |
133 | 167 | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
134 | 168 | else throw("Invalid ID") | |
169 | + | else throw("Only Dyzrupt Admin can call this dApp function") | |
170 | + | ||
171 | + | ||
172 | + | ||
173 | + | @Callable(i) | |
174 | + | func withdraw (voteId) = { | |
175 | + | let voter = toBase58String(i.caller.bytes) | |
176 | + | if ((getVoter(voter, voteId) != "")) | |
177 | + | then if ((getVoteStatus(voteId) == "closed")) | |
178 | + | then { | |
179 | + | let currentKey = getVoterAmountKey(voter, voteId) | |
180 | + | let currentAmount = match getInteger(this, currentKey) { | |
181 | + | case a: Int => | |
182 | + | a | |
183 | + | case _ => | |
184 | + | throw("You didn't vote for this entrepreneur") | |
185 | + | } | |
186 | + | if ((currentAmount == 0)) | |
187 | + | then throw("Seems you have previously withdrawn.") | |
188 | + | else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)])) | |
189 | + | } | |
190 | + | else throw("Can't withdraw vote amount while voting is still open.") | |
191 | + | else throw("You didn't vote for this entrepreneur") | |
192 | + | } | |
135 | 193 | ||
136 | 194 | ||
137 | 195 | ||
145 | 203 | then throw("You can only stake with DYZRUPT token") | |
146 | 204 | else { | |
147 | 205 | let currentStake = getCurrentStake(staker) | |
148 | - | let stakeableAmount = fraction(pmt.amount, 5, 100) | |
206 | + | let stakePercent = (20 / 100) | |
207 | + | let stakeableAmount = (pmt.amount * stakePercent) | |
149 | 208 | let amountToStake = (pmt.amount - stakeableAmount) | |
150 | 209 | let newStakedAmount = (currentStake + amountToStake) | |
151 | - | let stakePool = getStakePool() | |
152 | - | let newStakePool = (stakePool + stakeableAmount) | |
153 | - | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet(nil)) | |
210 | + | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
154 | 211 | } | |
155 | 212 | } | |
156 | 213 | ||
165 | 222 | else if ((amount > currentStake)) | |
166 | 223 | then throw("You can't withdraw an amount higher than you staked") | |
167 | 224 | else { | |
168 | - | let unstakeableAmount = fraction(amount, 10, 100) | |
169 | - | let amountToUnstake = (amount - unstakeableAmount) | |
170 | - | let newUnstakedAmount = (currentStake - amount) | |
171 | - | let stakePool = getStakePool() | |
172 | - | let newStakePool = (stakePool + unstakeableAmount) | |
173 | - | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newUnstakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(i.caller, amountToUnstake, dyzId)])) | |
225 | + | let newStakedAmount = (currentStake - amount) | |
226 | + | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount)]), TransferSet([ScriptTransfer(i.caller, amount, dyzId)])) | |
174 | 227 | } | |
175 | 228 | } | |
176 | 229 |
Old | New | Differences | |
---|---|---|---|
1 | 1 | {-# STDLIB_VERSION 3 #-} | |
2 | 2 | {-# SCRIPT_TYPE ACCOUNT #-} | |
3 | 3 | {-# CONTENT_TYPE DAPP #-} | |
4 | 4 | let upVote = "upvote" | |
5 | 5 | ||
6 | - | let adminAddress = base58'3N5cTHzbHc9dyQuBfKMjFKaxcrmRq54XDLu' | |
6 | + | let adminAddress1 = base58'3Mu5woJ54s7vHJgaeNcJ4C9ByfdmMF2jpjC' | |
7 | + | ||
8 | + | let adminAddress2 = base58'3NAqtCScgFynCuRLUoXm2BHTdu8suatCe7b' | |
9 | + | ||
10 | + | let adminAddress3 = base58'3Mucpi1K4FMVrZKnYEgjxQf5DkkBX7QrHoJ' | |
7 | 11 | ||
8 | 12 | let dyzId = base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G' | |
9 | - | ||
10 | - | func getStakePoolKey () = "stake_pool" | |
11 | - | ||
12 | - | ||
13 | - | func getStakePool () = match getInteger(this, getStakePoolKey()) { | |
14 | - | case a: Int => | |
15 | - | a | |
16 | - | case _ => | |
17 | - | 0 | |
18 | - | } | |
19 | - | ||
20 | - | ||
21 | - | func getStakerKey (staker) = (staker + "_stake") | |
22 | - | ||
23 | - | ||
24 | - | func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) { | |
25 | - | case a: Int => | |
26 | - | a | |
27 | - | case _ => | |
28 | - | 0 | |
29 | - | } | |
30 | - | ||
31 | 13 | ||
32 | 14 | func getProfileKey (id) = (id + "_entrepreneurProfile") | |
33 | 15 | ||
34 | 16 | ||
35 | 17 | func getStatusKey (id) = (id + "_status") | |
36 | 18 | ||
37 | 19 | ||
20 | + | func getVoterAmountKey (id,voteId) = (((id + "_") + voteId) + "_amount") | |
21 | + | ||
22 | + | ||
38 | 23 | func getVoteKey (id,type) = if ((type == "upvote")) | |
39 | 24 | then (id + "_upvote") | |
25 | + | else throw("Invalid vote type") | |
26 | + | ||
27 | + | ||
28 | + | func getVoteAmountKey (id,type) = if ((type == "upvote")) | |
29 | + | then (((id + "_") + type) + "_amount") | |
40 | 30 | else throw("Invalid vote type") | |
41 | 31 | ||
42 | 32 | ||
43 | 33 | func profileExist (id) = match getString(this, getProfileKey(id)) { | |
44 | 34 | case a: String => | |
45 | 35 | true | |
46 | 36 | case _ => | |
47 | 37 | false | |
48 | 38 | } | |
49 | 39 | ||
50 | 40 | ||
51 | 41 | func getVoteStatus (voteId) = match getString(this, getStatusKey(voteId)) { | |
52 | 42 | case a: String => | |
53 | 43 | a | |
54 | 44 | case _ => | |
55 | 45 | false | |
56 | 46 | } | |
57 | 47 | ||
58 | 48 | ||
59 | 49 | func getVoteCount (voteId,vote) = match getInteger(this, getVoteKey(voteId, vote)) { | |
60 | 50 | case a: Int => | |
61 | 51 | a | |
62 | 52 | case _ => | |
63 | 53 | throw("Not a valid vote ID") | |
64 | 54 | } | |
65 | 55 | ||
66 | 56 | ||
57 | + | func getVoteAmountCount (voteId,vote) = match getInteger(this, getVoteAmountKey(voteId, vote)) { | |
58 | + | case a: Int => | |
59 | + | a | |
60 | + | case _ => | |
61 | + | 0 | |
62 | + | } | |
63 | + | ||
64 | + | ||
67 | 65 | func getVoterKey (address,voteId) = ((((address + "_") + voteId) + "_") + "vote") | |
68 | 66 | ||
69 | 67 | ||
70 | 68 | func getVoter (address,voteId) = match getString(this, getVoterKey(address, voteId)) { | |
71 | 69 | case a: String => | |
72 | 70 | a | |
73 | 71 | case _ => | |
74 | 72 | "" | |
75 | 73 | } | |
76 | 74 | ||
77 | 75 | ||
78 | 76 | func canVote (address,voteId) = { | |
79 | 77 | let voter = getVoter(address, voteId) | |
80 | 78 | if ((voter == "")) | |
81 | 79 | then true | |
82 | 80 | else false | |
83 | 81 | } | |
84 | 82 | ||
85 | 83 | ||
84 | + | func getStakerKey (staker) = (staker + "_stake") | |
85 | + | ||
86 | + | ||
87 | + | func getCurrentStake (staker) = match getInteger(this, getStakerKey(staker)) { | |
88 | + | case a: Int => | |
89 | + | a | |
90 | + | case _ => | |
91 | + | 0 | |
92 | + | } | |
93 | + | ||
94 | + | ||
95 | + | func getStakePoolKey () = "stake_pool" | |
96 | + | ||
97 | + | ||
98 | + | func getStakePool () = match getInteger(this, getStakePoolKey()) { | |
99 | + | case a: Int => | |
100 | + | a | |
101 | + | case _ => | |
102 | + | 0 | |
103 | + | } | |
104 | + | ||
105 | + | ||
86 | 106 | @Callable(i) | |
87 | - | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if ((i.caller.bytes != adminAddress)) | |
88 | - | then throw("Only Dyzrupt Admin can call this dApp function") | |
89 | - | else { | |
107 | + | func addEntrepreneurProfile (name,avatar,bio,gender,location) = if (if (if ((i.caller.bytes == adminAddress1)) | |
108 | + | then true | |
109 | + | else (i.caller.bytes == adminAddress2)) | |
110 | + | then true | |
111 | + | else (i.caller.bytes == adminAddress3)) | |
112 | + | then { | |
90 | 113 | let transactionId = toBase58String(i.transactionId) | |
91 | - | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")]) | |
114 | + | WriteSet([DataEntry(getProfileKey(transactionId), ((((((((name + "_") + avatar) + "_") + bio) + "_") + gender) + "_") + location)), DataEntry(getVoteKey(transactionId, "upvote"), 0), DataEntry(getVoteAmountKey(transactionId, "upvote"), 0), DataEntry(getStatusKey(transactionId), "open")]) | |
92 | 115 | } | |
116 | + | else throw("Only Dyzrupt Admin can call this dApp function") | |
93 | 117 | ||
94 | 118 | ||
95 | 119 | ||
96 | 120 | @Callable(i) | |
97 | 121 | func vote (voteId,vote) = { | |
98 | 122 | let pmt = extract(i.payment) | |
123 | + | let voter = toBase58String(i.caller.bytes) | |
99 | 124 | if ((pmt.amount == 0)) | |
100 | 125 | then throw("You cannot vote without paying voting fee") | |
101 | 126 | else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G')) | |
102 | 127 | then throw("You can only vote with DYZRUPT token") | |
103 | - | else if (canVote( | |
128 | + | else if (canVote(voter, voteId)) | |
104 | 129 | then if (profileExist(voteId)) | |
105 | 130 | then if ((getVoteStatus(voteId) == "open")) | |
106 | 131 | then if ((vote == upVote)) | |
107 | 132 | then { | |
108 | 133 | let voteCount = getVoteCount(voteId, vote) | |
134 | + | let voteAmountCount = getVoteAmountCount(voteId, vote) | |
109 | 135 | let newVoteCount = (voteCount + 1) | |
110 | - | ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(toBase58String(i.caller.bytes), voteId), voteId)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
136 | + | let newVoteAmountCount = (voteAmountCount + pmt.amount) | |
137 | + | ScriptResult(WriteSet([DataEntry(getVoteKey(voteId, vote), newVoteCount), DataEntry(getVoterKey(voter, voteId), voteId), DataEntry(getVoterAmountKey(voter, voteId), pmt.amount), DataEntry(getVoteAmountKey(voteId, vote), newVoteAmountCount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
111 | 138 | } | |
112 | 139 | else throw("Not a valid vote value") | |
113 | 140 | else throw("This profile is not open for voting") | |
114 | 141 | else throw("Invalid Profile") | |
115 | 142 | else throw("You can't vote twice") | |
116 | 143 | } | |
117 | 144 | ||
118 | 145 | ||
119 | 146 | ||
120 | 147 | @Callable(i) | |
121 | - | func openVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
122 | - | then throw("Only Dyzrupt Admin can call this dApp function") | |
123 | - | else if (profileExist(voteId)) | |
148 | + | func openVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1)) | |
149 | + | then true | |
150 | + | else (i.caller.bytes == adminAddress2)) | |
151 | + | then true | |
152 | + | else (i.caller.bytes == adminAddress3)) | |
153 | + | then if (profileExist(voteId)) | |
124 | 154 | then WriteSet([DataEntry(getStatusKey(voteId), "open")]) | |
125 | 155 | else throw("Invalid ID") | |
156 | + | else throw("Only Dyzrupt Admin can call this dApp function") | |
126 | 157 | ||
127 | 158 | ||
128 | 159 | ||
129 | 160 | @Callable(i) | |
130 | - | func closeVote (voteId) = if ((i.caller.bytes != adminAddress)) | |
131 | - | then throw("Only Dyzrupt Admin can call this dApp function") | |
132 | - | else if (profileExist(voteId)) | |
161 | + | func closeVote (voteId) = if (if (if ((i.caller.bytes == adminAddress1)) | |
162 | + | then true | |
163 | + | else (i.caller.bytes == adminAddress2)) | |
164 | + | then true | |
165 | + | else (i.caller.bytes == adminAddress3)) | |
166 | + | then if (profileExist(voteId)) | |
133 | 167 | then WriteSet([DataEntry(getStatusKey(voteId), "closed")]) | |
134 | 168 | else throw("Invalid ID") | |
169 | + | else throw("Only Dyzrupt Admin can call this dApp function") | |
170 | + | ||
171 | + | ||
172 | + | ||
173 | + | @Callable(i) | |
174 | + | func withdraw (voteId) = { | |
175 | + | let voter = toBase58String(i.caller.bytes) | |
176 | + | if ((getVoter(voter, voteId) != "")) | |
177 | + | then if ((getVoteStatus(voteId) == "closed")) | |
178 | + | then { | |
179 | + | let currentKey = getVoterAmountKey(voter, voteId) | |
180 | + | let currentAmount = match getInteger(this, currentKey) { | |
181 | + | case a: Int => | |
182 | + | a | |
183 | + | case _ => | |
184 | + | throw("You didn't vote for this entrepreneur") | |
185 | + | } | |
186 | + | if ((currentAmount == 0)) | |
187 | + | then throw("Seems you have previously withdrawn.") | |
188 | + | else ScriptResult(WriteSet([DataEntry(currentKey, 0)]), TransferSet([ScriptTransfer(i.caller, currentAmount, dyzId)])) | |
189 | + | } | |
190 | + | else throw("Can't withdraw vote amount while voting is still open.") | |
191 | + | else throw("You didn't vote for this entrepreneur") | |
192 | + | } | |
135 | 193 | ||
136 | 194 | ||
137 | 195 | ||
138 | 196 | @Callable(i) | |
139 | 197 | func stake () = { | |
140 | 198 | let staker = toBase58String(i.caller.bytes) | |
141 | 199 | let pmt = extract(i.payment) | |
142 | 200 | if ((pmt.amount == 0)) | |
143 | 201 | then throw("Stake amount too low") | |
144 | 202 | else if ((pmt.assetId != base58'9XTqBQeJvdMs8VNHv6rXiJLJichg2acG7wCfYcTajQ1G')) | |
145 | 203 | then throw("You can only stake with DYZRUPT token") | |
146 | 204 | else { | |
147 | 205 | let currentStake = getCurrentStake(staker) | |
148 | - | let stakeableAmount = fraction(pmt.amount, 5, 100) | |
206 | + | let stakePercent = (20 / 100) | |
207 | + | let stakeableAmount = (pmt.amount * stakePercent) | |
149 | 208 | let amountToStake = (pmt.amount - stakeableAmount) | |
150 | 209 | let newStakedAmount = (currentStake + amountToStake) | |
151 | - | let stakePool = getStakePool() | |
152 | - | let newStakePool = (stakePool + stakeableAmount) | |
153 | - | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet(nil)) | |
210 | + | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount)]), TransferSet([ScriptTransfer(this, pmt.amount, dyzId)])) | |
154 | 211 | } | |
155 | 212 | } | |
156 | 213 | ||
157 | 214 | ||
158 | 215 | ||
159 | 216 | @Callable(i) | |
160 | 217 | func unstake (amount) = { | |
161 | 218 | let staker = toBase58String(i.caller.bytes) | |
162 | 219 | let currentStake = getCurrentStake(staker) | |
163 | 220 | if ((currentStake == 0)) | |
164 | 221 | then throw("You don't have any stakes") | |
165 | 222 | else if ((amount > currentStake)) | |
166 | 223 | then throw("You can't withdraw an amount higher than you staked") | |
167 | 224 | else { | |
168 | - | let unstakeableAmount = fraction(amount, 10, 100) | |
169 | - | let amountToUnstake = (amount - unstakeableAmount) | |
170 | - | let newUnstakedAmount = (currentStake - amount) | |
171 | - | let stakePool = getStakePool() | |
172 | - | let newStakePool = (stakePool + unstakeableAmount) | |
173 | - | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newUnstakedAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(i.caller, amountToUnstake, dyzId)])) | |
225 | + | let newStakedAmount = (currentStake - amount) | |
226 | + | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakedAmount)]), TransferSet([ScriptTransfer(i.caller, amount, dyzId)])) | |
174 | 227 | } | |
175 | 228 | } | |
176 | 229 | ||
177 | 230 | ||
178 | 231 | ||
179 | 232 | @Callable(i) | |
180 | 233 | func claimDailyStakeReward (reward) = { | |
181 | 234 | let staker = toBase58String(i.caller.bytes) | |
182 | 235 | let currentStake = getCurrentStake(staker) | |
183 | 236 | let stakePool = getStakePool() | |
184 | 237 | if ((currentStake == 0)) | |
185 | 238 | then throw("You don't have any stakes") | |
186 | 239 | else if ((stakePool == 0)) | |
187 | 240 | then throw("Nothing in Stake pool at this time. Try again later") | |
188 | 241 | else if ((reward > stakePool)) | |
189 | 242 | then throw("No rewards at this time") | |
190 | 243 | else { | |
191 | 244 | let newStakePool = (stakePool - reward) | |
192 | 245 | let newStakeAmount = (currentStake - reward) | |
193 | 246 | ScriptResult(WriteSet([DataEntry(getStakerKey(staker), newStakeAmount), DataEntry(getStakePoolKey(), newStakePool)]), TransferSet([ScriptTransfer(i.caller, reward, dyzId)])) | |
194 | 247 | } | |
195 | 248 | } | |
196 | 249 | ||
197 | 250 |
github/deemru/w8io/026f985 44.06 ms ◑