Skip to content

Commit 3591b07

Browse files
committed
fix: set 144 block delay on core proposals
give a little time for liquidity
1 parent 2b704e9 commit 3591b07

File tree

3 files changed

+8
-1
lines changed

3 files changed

+8
-1
lines changed

contracts/dao/extensions/aibtc-core-proposals.clar

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
(define-constant SELF (as-contract tx-sender))
1919
(define-constant VOTING_PERIOD u144) ;; 144 Bitcoin blocks, ~1 day
2020
(define-constant VOTING_QUORUM u95) ;; 95% of liquid supply
21+
(define-constant DEPLOYED_AT burn-block-height)
2122

2223
;; error messages
2324
(define-constant ERR_NOT_DAO_OR_EXTENSION (err u3000))
@@ -32,6 +33,7 @@
3233
(define-constant ERR_VOTE_TOO_SOON (err u3009))
3334
(define-constant ERR_VOTE_TOO_LATE (err u3010))
3435
(define-constant ERR_ALREADY_VOTED (err u3011))
36+
(define-constant ERR_FIRST_VOTING_PERIOD (err u3012))
3537

3638
;; contracts used for voting calculations
3739
(define-constant VOTING_TOKEN_DEX .aibtc-token-dex)
@@ -78,6 +80,8 @@
7880
(proposalContract (contract-of proposal))
7981
(liquidTokens (try! (get-liquid-supply block-height)))
8082
)
83+
;; at least one voting period passed
84+
(asserts! (>= burn-block-height (+ DEPLOYED_AT VOTING_PERIOD)) ERR_FIRST_VOTING_PERIOD)
8185
;; caller has the required balance
8286
(asserts! (> (unwrap! (contract-call? .aibtc-token get-balance tx-sender) ERR_FETCHING_TOKEN_DATA) u0) ERR_INSUFFICIENT_BALANCE)
8387
;; proposal was not already executed

tests/dao/extensions/aibtc-onchain-messaging.test.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ describe(`extension: ${contractName}`, () => {
5555
const proposalContractAddress = `${deployer}.${proposalContractName}`;
5656

5757
// fund accounts for creating and voting on proposals
58+
// TODO: consolidate as fundVoters()
5859
const getDaoTokensReceipts = [
5960
getDaoTokens(deployer, deployer, 100000000), // 100 STX
6061
getDaoTokens(deployer, address1, 50000000), // 50 STX
@@ -93,7 +94,8 @@ describe(`extension: ${contractName}`, () => {
9394
expect(constructReceipt.result).toBeOk(Cl.bool(true));
9495

9596
// progress the chain for at-block calls
96-
simnet.mineEmptyBlocks(10);
97+
// and to pass first core proposal voting period
98+
simnet.mineEmptyBlocks(144);
9799

98100
// pass proposal
99101
const concludeProposalReceipt = passCoreProposal(

tests/error-codes.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ export enum CoreProposalErrCode {
4545
ERR_VOTE_TOO_SOON,
4646
ERR_VOTE_TOO_LATE,
4747
ERR_ALREADY_VOTED,
48+
ERR_FIRST_VOTING_PERIOD,
4849
}
4950

5051
export enum OnchainMessagingErrCode {

0 commit comments

Comments
 (0)