Skip to content
This repository was archived by the owner on Mar 18, 2026. It is now read-only.

Commit fb00c9f

Browse files
committed
fix: update action contracts formatting to match other contracts
Also updates error codes in prep for new extension, groups action errors with action proposals.
1 parent 0e87bcf commit fb00c9f

7 files changed

+88
-31
lines changed

contracts/dao/extensions/actions/aibtc-action-configure-timed-vault-dao.clar

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,26 @@
1+
;; title: aibtc-action-configure-timed-vault-dao
2+
;; version: 1.0.0
3+
;; summary: A predefined action to configure the DAO timed vaults.
4+
5+
;; traits
6+
;;
7+
18
(impl-trait .aibtc-dao-traits-v3.extension)
29
(impl-trait .aibtc-dao-traits-v3.action)
310

4-
(define-constant ERR_UNAUTHORIZED (err u10001))
5-
(define-constant ERR_INVALID_PARAMS (err u10002))
11+
;; constants
12+
;;
13+
14+
(define-constant ERR_NOT_DAO_OR_EXTENSION (err u1100))
15+
(define-constant ERR_INVALID_PARAMS (err u1101))
616

7-
(define-constant CFG_MESSAGE "Executed Action Proposal: Updated configuration in <%= it.dao_token_name %> timed vault extension")
17+
;; template variables
18+
;;
19+
20+
(define-constant CFG_MESSAGE "Executed Action Proposal: Updated configuration in DAO timed vault extension")
21+
22+
;; public functions
23+
;;
824

925
(define-public (callback (sender principal) (memo (buff 34))) (ok true))
1026

@@ -49,8 +65,11 @@
4965
)
5066
)
5167

68+
;; private functions
69+
;;
70+
5271
(define-private (is-dao-or-extension)
5372
(ok (asserts! (or (is-eq tx-sender .aibtc-base-dao)
54-
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_UNAUTHORIZED
73+
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_NOT_DAO_OR_EXTENSION
5574
))
5675
)

contracts/dao/extensions/actions/aibtc-action-configure-timed-vault-sbtc.clar

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
;; title: aibtc-action-configure-timed-vault-sbtc
2+
;; version: 1.0.0
3+
;; summary: A predefined action to configure the BTC timed vaults.
4+
15
(impl-trait .aibtc-dao-traits-v3.extension)
26
(impl-trait .aibtc-dao-traits-v3.action)
37

4-
(define-constant ERR_UNAUTHORIZED (err u10001))
5-
(define-constant ERR_INVALID_PARAMS (err u10002))
8+
(define-constant ERR_NOT_DAO_OR_EXTENSION (err u1100))
9+
(define-constant ERR_INVALID_PARAMS (err u1101))
610

711
(define-constant CFG_MESSAGE "Executed Action Proposal: Updated configuration in BTC timed vault extension")
812

@@ -51,6 +55,6 @@
5155

5256
(define-private (is-dao-or-extension)
5357
(ok (asserts! (or (is-eq tx-sender .aibtc-base-dao)
54-
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_UNAUTHORIZED
58+
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_NOT_DAO_OR_EXTENSION
5559
))
5660
)

contracts/dao/extensions/actions/aibtc-action-configure-timed-vault-stx.clar

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,12 @@
1+
;; title: aibtc-action-configure-timed-vault-stx
2+
;; version: 1.0.0
3+
;; summary: A predefined action to configure the STX timed vaults.
4+
15
(impl-trait .aibtc-dao-traits-v3.extension)
26
(impl-trait .aibtc-dao-traits-v3.action)
37

4-
(define-constant ERR_UNAUTHORIZED (err u10001))
5-
(define-constant ERR_INVALID_PARAMS (err u10002))
8+
(define-constant ERR_NOT_DAO_OR_EXTENSION (err u1100))
9+
(define-constant ERR_INVALID_PARAMS (err u1101))
610

711
(define-constant CFG_MESSAGE "Executed Action Proposal: Updated configuration in STX timed vault extension")
812

@@ -51,6 +55,6 @@
5155

5256
(define-private (is-dao-or-extension)
5357
(ok (asserts! (or (is-eq tx-sender .aibtc-base-dao)
54-
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_UNAUTHORIZED
58+
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_NOT_DAO_OR_EXTENSION
5559
))
5660
)

contracts/dao/extensions/actions/aibtc-action-pmt-dao-add-resource.clar

Lines changed: 22 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,27 @@
1+
;; title: aibtc-action-pmt-dao-add-resource
2+
;; version: 1.0.0
3+
;; summary: A predefined action to add a resource in the DAO payment processor extension.
4+
5+
;; traits
6+
;;
7+
18
(impl-trait .aibtc-dao-traits-v3.extension)
29
(impl-trait .aibtc-dao-traits-v3.action)
310

4-
(define-constant ERR_UNAUTHORIZED (err u10001))
5-
(define-constant ERR_INVALID_PARAMS (err u10002))
11+
;; constants
12+
;;
13+
14+
(define-constant ERR_NOT_DAO_OR_EXTENSION (err u1100))
15+
(define-constant ERR_INVALID_PARAMS (err u1101))
16+
17+
;; template variables
18+
;;
619

720
(define-constant CFG_MESSAGE "Executed Action Proposal: Added a resource in the DAO payment processor extension")
821

22+
;; public functions
23+
;;
24+
925
(define-public (callback (sender principal) (memo (buff 34))) (ok true))
1026

1127
(define-public (run (parameters (buff 2048)))
@@ -22,8 +38,11 @@
2238
)
2339
)
2440

41+
;; private functions
42+
;;
43+
2544
(define-private (is-dao-or-extension)
2645
(ok (asserts! (or (is-eq tx-sender .aibtc-base-dao)
27-
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_UNAUTHORIZED
46+
(contract-call? .aibtc-base-dao is-extension contract-caller)) ERR_NOT_DAO_OR_EXTENSION
2847
))
2948
)

contracts/dao/extensions/aibtc-operating-fund.clar

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,32 @@
11
;; title: aibtc-operating-fund
22
;; version: 2.0.0
3-
;; summary: TBD
3+
;; summary: An operations fund for the dao with a 2% allocation of the total supply.
44

5+
;; TODO - remove notes
56
;; this contract receives 2% of total supply at launch
67
;; this contract can receive DAO token, sBTC or STX from treasury
78
;; this contract can fund a timed vault when initialized
89

910
;; traits
1011
;;
12+
1113
(impl-trait .aibtc-dao-traits-v3.extension)
1214
(impl-trait .aibtc-dao-traits-v3.operating-fund)
1315

16+
(use-trait ft-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)
17+
1418
;; constants
1519
;;
1620

21+
;; contract details
1722
(define-constant DEPLOYED_BURN_BLOCK burn-block-height)
1823
(define-constant DEPLOYED_STACKS_BLOCK stacks-block-height)
1924
(define-constant SELF (as-contract tx-sender))
2025

2126
;; error messages
2227
(define-constant ERR_NOT_DAO_OR_EXTENSION (err u9000)) ;; TBD/check
28+
(define-constant ERR_UNKNOWN_ASSET (err u9001))
29+
(define-constant ERR_FETCHING_ASSET (err u9002))
2330

2431
;; template variables
2532
;;
@@ -31,9 +38,7 @@
3138
;; public functions
3239
;;
3340

34-
(define-public (callback (sender principal) (memo (buff 34)))
35-
(ok true)
36-
)
41+
(define-public (callback (sender principal) (memo (buff 34))) (ok true))
3742

3843
;; read only functions
3944
;;

contracts/dao/extensions/aibtc-treasury.clar

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@
44

55
;; traits
66
;;
7+
78
(impl-trait .aibtc-dao-traits-v3.extension)
89
(impl-trait .aibtc-dao-traits-v3.treasury)
910

1011
(use-trait ft-trait 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard.sip-010-trait)
11-
(use-trait nft-trait 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait.nft-trait)
1212

1313
;; constants
1414
;;
1515

16-
;; contract names
16+
;; contract details
1717
(define-constant DEPLOYED_BURN_BLOCK burn-block-height)
1818
(define-constant DEPLOYED_STACKS_BLOCK stacks-block-height)
1919
(define-constant SELF (as-contract tx-sender))
@@ -59,9 +59,7 @@
5959
;; public functions
6060
;;
6161

62-
(define-public (callback (sender principal) (memo (buff 34)))
63-
(ok true)
64-
)
62+
(define-public (callback (sender principal) (memo (buff 34))) (ok true))
6563

6664
;; add or update an asset to the allowed list
6765
(define-public (allow-asset (token principal) (enabled bool))

tests/error-codes.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ export enum ActionProposalsV2ErrCode {
4141
}
4242

4343
export enum ActionErrCode {
44-
ERR_UNAUTHORIZED = 10001,
44+
ERR_UNAUTHORIZED = 1100,
4545
ERR_INVALID_PARAMS,
4646
}
4747

@@ -113,7 +113,9 @@ export enum PaymentProcessorErrCode {
113113

114114
export enum TreasuryErrCode {
115115
ERR_NOT_DAO_OR_EXTENSION = 6000,
116-
ERR_UNKNOWN_ASSSET,
116+
ERR_UNKNOWN_ASSET,
117+
ERR_FETCHING_ASSET,
118+
ERR_PERIOD_ALREADY_CLAIMED,
117119
}
118120

119121
export enum TokenOwnerErrCode {
@@ -127,6 +129,19 @@ export enum DaoCharterErrCode {
127129
ERR_CHARTER_TOO_LONG,
128130
}
129131

132+
export enum UserAgentAccountErrCode {
133+
ERR_UNAUTHORIZED = 9000,
134+
ERR_UNKNOWN_ASSET,
135+
ERR_OPERATION_FAILED,
136+
ERR_BUY_SELL_NOT_ALLOWED,
137+
}
138+
139+
export enum OperatingFundErrCode {
140+
ERR_NOT_DAO_OR_EXTENSION = 10000,
141+
ERR_UNKNOWN_ASSET,
142+
ERR_FETCHING_ASSET,
143+
}
144+
130145
export enum TokenFaktoryErrCode {
131146
ERR_NOT_AUTHORIZED = 401,
132147
ERR_NOT_OWNER,
@@ -141,10 +156,3 @@ export enum TokenFaktoryDexErrCode {
141156
ERR_FETCHING_SELL_INFO,
142157
ERR_TOKEN_NOT_AUTH = 401,
143158
}
144-
145-
export enum UserAgentAccountErrCode {
146-
ERR_UNAUTHORIZED = 9000,
147-
ERR_UNKNOWN_ASSET,
148-
ERR_OPERATION_FAILED,
149-
ERR_BUY_SELL_NOT_ALLOWED,
150-
}

0 commit comments

Comments
 (0)