|
119 | 119 | (try! (is-dao-or-extension))
|
120 | 120 | ;; treasury must be a contract
|
121 | 121 | (asserts! (not (is-standard treasuryContract)) ERR_TREASURY_MUST_BE_CONTRACT)
|
| 122 | + ;; treasury must not be already set |
| 123 | + (asserts! (is-eq (var-get protocolTreasury) SELF) ERR_TREASURY_NOT_INITIALIZED) |
122 | 124 | ;; treasury cannot be the voting contract
|
123 | 125 | (asserts! (not (is-eq treasuryContract SELF)) ERR_TREASURY_CANNOT_BE_SELF)
|
124 |
| - ;; treasury cannot be the same value |
125 |
| - (asserts! (not (is-eq treasuryContract (var-get protocolTreasury))) ERR_TREASURY_ALREADY_SET) |
126 | 126 | (print {
|
127 | 127 | notification: "set-protocol-treasury",
|
128 | 128 | payload: {
|
|
141 | 141 | (try! (is-dao-or-extension))
|
142 | 142 | ;; token must be a contract
|
143 | 143 | (asserts! (not (is-standard tokenContract)) ERR_TOKEN_MUST_BE_CONTRACT)
|
| 144 | + ;; token must not be already set |
144 | 145 | (asserts! (is-eq (var-get votingToken) SELF) ERR_TOKEN_NOT_INITIALIZED)
|
145 |
| - (asserts! (is-eq (var-get votingToken) tokenContract) ERR_TOKEN_MISMATCH) |
146 | 146 | (print {
|
147 | 147 | notification: "set-voting-token",
|
148 | 148 | payload: {
|
|
199 | 199 | (define-public (vote-on-proposal (proposalId uint) (token <ft-trait>) (vote bool))
|
200 | 200 | (let
|
201 | 201 | (
|
202 |
| - (proposalRecord (unwrap! (map-get? Proposals proposalId) ERR_PROPOSAL_NOT_FOUND)) |
203 | 202 | (tokenContract (contract-of token))
|
204 | 203 | (senderBalance (try! (contract-call? token get-balance tx-sender)))
|
205 | 204 | )
|
|
208 | 207 | ;; token matches set voting token
|
209 | 208 | (asserts! (is-eq tokenContract (var-get votingToken)) ERR_TOKEN_MISMATCH)
|
210 | 209 | ;; caller has the required balance
|
211 |
| - (asserts! (> senderBalance u0) ERR_ZERO_VOTING_POWER) |
| 210 | + (asserts! (> senderBalance u0) ERR_INSUFFICIENT_BALANCE) |
| 211 | + ;; get proposal record |
| 212 | + (let |
| 213 | + ( |
| 214 | + (proposalRecord (unwrap! (map-get? Proposals proposalId) ERR_PROPOSAL_NOT_FOUND)) |
| 215 | + ) |
212 | 216 | ;; proposal is still active
|
213 | 217 | (asserts! (>= burn-block-height (get startBlock proposalRecord)) ERR_VOTE_TOO_SOON)
|
214 | 218 | (asserts! (< burn-block-height (get endBlock proposalRecord)) ERR_VOTE_TOO_LATE)
|
|
0 commit comments