Skip to content

Commit

Permalink
Merge pull request #12 from aibtcdev/feat/add-dao-skeleton
Browse files Browse the repository at this point in the history
Implement collective functionality
  • Loading branch information
whoabuddy authored Jan 10, 2025
2 parents 262b246 + 47d6a99 commit 0ce4f13
Show file tree
Hide file tree
Showing 104 changed files with 1,973 additions and 695 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/clarinet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ jobs:
uses: docker://hirosystems/clarinet:latest
with:
args: check
- name: "Verify test file for each contract file"
run: bash ./tests/check-test-coverage.sh
- name: "Setup Node.js"
uses: actions/setup-node@v4
with:
Expand All @@ -35,4 +37,4 @@ jobs:
uses: codecov/codecov-action@v3
with:
files: ./coverage.lcov
verbose: true
verbose: true
284 changes: 249 additions & 35 deletions Clarinet.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,103 +22,317 @@ contract_id = 'SP2PABAF9FTAJYNFZH93XENAJ8FVY99RRM50D2JG9.nft-trait'
[[project.requirements]]
contract_id = 'SP3FBR2AGK5H9QBDH3EEN6DF8EK8JY7RX8QJ5SVTE.sip-010-trait-ft-standard'

[[project.requirements]]
contract_id = 'ST3VXT52QEQPZ5246A16RFNMR1PRJ96JK6YYX37N8.sip-010-trait-ft-standard'

[[project.requirements]]
contract_id = 'ST000000000000000000002AMW42H.pox-4'

[[project.requirements]]
contract_id = 'ST295MNE41DC74QYCPRS8N37YYMC06N6Q3VQDZ6G1.xyk-core-v-1-2'

[[project.requirements]]
contract_id = 'ST295MNE41DC74QYCPRS8N37YYMC06N6Q3VQDZ6G1.token-stx-v-1-2'

[[project.requirements]]
contract_id = 'ST3VXT52QEQPZ5246A16RFNMR1PRJ96JK6YYX37N8.xyk-pool-trait-v-1-2'

# airdrop nft contracts

[contracts.aibtcdev-airdrop-1]
path = 'contracts/aibtcdev-airdrop-1.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtcdev-airdrop-2]
path = 'contracts/aibtcdev-airdrop-2.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

# dao base contract

[contracts.aibtcdev-base-dao]
path = 'contracts/dao/aibtcdev-base-dao.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

# dao extensions

[contracts.aibtc-action-proposals]
path = 'contracts/dao/extensions/aibtc-action-proposals.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-bank-account]
path = 'contracts/dao/extensions/aibtc-bank-account.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-bitflow-pool]
path = 'contracts/dao/extensions/aibtc-bitflow-pool.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-core-proposals]
path = 'contracts/dao/extensions/aibtc-core-proposals.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-onchain-messaging]
path = 'contracts/dao/extensions/aibtc-onchain-messaging.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-payments-invoices]
path = 'contracts/dao/extensions/aibtc-payments-invoices.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-token]
path = 'contracts/dao/extensions/aibtc-token.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-token-dex]
path = 'contracts/dao/extensions/aibtc-token-dex.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-token-owner]
path = 'contracts/dao/extensions/aibtc-token-owner.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury]
path = 'contracts/dao/extensions/aibtc-treasury.clar'
clarity_version = 2
epoch = 3.0

# dao actions (as extensions)

[contracts.aibtc-action-send-message]
path = 'contracts/dao/extensions/actions/aibtc-action-send-message.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-action-set-account-holder]
path = 'contracts/dao/extensions/actions/aibtc-action-set-account-holder.clar'
clarity_version = 2
epoch = 3.0

# dao proposals

[contracts.aibtc-prop001-bootstrap]
path = 'contracts/dao/proposals/aibtc-prop001-bootstrap.clar'
[contracts.aibtc-bank-account-deposit-stx]
path = 'contracts/dao/proposals/aibtc-bank-account-deposit-stx.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

# dao extensions
[contracts.aibtc-bank-account-initialize-new-account]
path = 'contracts/dao/proposals/aibtc-bank-account-initialize-new-account.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-ext001-actions]
path = 'contracts/dao/extensions/aibtc-ext001-actions.clar'
[contracts.aibtc-bank-account-override-last-withdrawal-block]
path = 'contracts/dao/proposals/aibtc-bank-account-override-last-withdrawal-block.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtc-ext002-bank-account]
path = 'contracts/dao/extensions/aibtc-ext002-bank-account.clar'
[contracts.aibtc-bank-account-set-account-holder]
path = 'contracts/dao/proposals/aibtc-bank-account-set-account-holder.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtc-ext003-direct-execute]
path = 'contracts/dao/extensions/aibtc-ext003-direct-execute.clar'
[contracts.aibtc-bank-account-set-withdrawal-amount]
path = 'contracts/dao/proposals/aibtc-bank-account-set-withdrawal-amount.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtc-ext004-messaging]
path = 'contracts/dao/extensions/aibtc-ext004-messaging.clar'
[contracts.aibtc-bank-account-set-withdrawal-period]
path = 'contracts/dao/proposals/aibtc-bank-account-set-withdrawal-period.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtc-ext005-payments]
path = 'contracts/dao/extensions/aibtc-ext005-payments.clar'
[contracts.aibtc-bank-account-withdraw-stx]
path = 'contracts/dao/proposals/aibtc-bank-account-withdraw-stx.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtc-ext006-treasury]
path = 'contracts/dao/extensions/aibtc-ext006-treasury.clar'
[contracts.aibtc-base-add-new-extension]
path = 'contracts/dao/proposals/aibtc-base-add-new-extension.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

# dao traits
[contracts.aibtc-base-bootstrap-initialization]
path = 'contracts/dao/proposals/aibtc-base-bootstrap-initialization.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtcdev-dao-v1]
path = 'contracts/dao/traits/aibtcdev-dao-v1.clar'
[contracts.aibtc-base-disable-extension]
path = 'contracts/dao/proposals/aibtc-base-disable-extension.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-base-enable-extension]
path = 'contracts/dao/proposals/aibtc-base-enable-extension.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-base-replace-extension]
path = 'contracts/dao/proposals/aibtc-base-replace-extension.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-onchain-messaging-send]
path = 'contracts/dao/proposals/aibtc-onchain-messaging-send.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-payments-invoices-add-resource]
path = 'contracts/dao/proposals/aibtc-payments-invoices-add-resource.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtc-payments-invoices-pay-invoice-by-resource-name]
path = 'contracts/dao/proposals/aibtc-payments-invoices-pay-invoice-by-resource-name.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-payments-invoices-pay-invoice]
path = 'contracts/dao/proposals/aibtc-payments-invoices-pay-invoice.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-payments-invoices-set-payment-address]
path = 'contracts/dao/proposals/aibtc-payments-invoices-set-payment-address.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-payments-invoices-toggle-resource-by-name]
path = 'contracts/dao/proposals/aibtc-payments-invoices-toggle-resource-by-name.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-payments-invoices-toggle-resource]
path = 'contracts/dao/proposals/aibtc-payments-invoices-toggle-resource.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-token-owner-set-token-uri]
path = 'contracts/dao/proposals/aibtc-token-owner-set-token-uri.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-token-owner-transfer-ownership]
path = 'contracts/dao/proposals/aibtc-token-owner-transfer-ownership.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-allow-asset]
path = 'contracts/dao/proposals/aibtc-treasury-allow-asset.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-delegate-stx]
path = 'contracts/dao/proposals/aibtc-treasury-delegate-stx.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-deposit-ft]
path = 'contracts/dao/proposals/aibtc-treasury-deposit-ft.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-deposit-nft]
path = 'contracts/dao/proposals/aibtc-treasury-deposit-nft.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-deposit-stx]
path = 'contracts/dao/proposals/aibtc-treasury-deposit-stx.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-freeze-asset]
path = 'contracts/dao/proposals/aibtc-treasury-freeze-asset.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-revoke-delegation]
path = 'contracts/dao/proposals/aibtc-treasury-revoke-delegation.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-withdraw-ft]
path = 'contracts/dao/proposals/aibtc-treasury-withdraw-ft.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-withdraw-nft]
path = 'contracts/dao/proposals/aibtc-treasury-withdraw-nft.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-treasury-withdraw-stx]
path = 'contracts/dao/proposals/aibtc-treasury-withdraw-stx.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-action-proposals-set-protocol-treasury]
path = 'contracts/dao/proposals/aibtc-action-proposals-set-protocol-treasury.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-action-proposals-set-voting-token]
path = 'contracts/dao/proposals/aibtc-action-proposals-set-voting-token.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-core-proposals-set-protocol-treasury]
path = 'contracts/dao/proposals/aibtc-core-proposals-set-protocol-treasury.clar'
clarity_version = 2
epoch = 3.0

[contracts.aibtc-core-proposals-set-voting-token]
path = 'contracts/dao/proposals/aibtc-core-proposals-set-voting-token.clar'
clarity_version = 2
epoch = 3.0

# dao traits

[contracts.aibtcdev-dao-traits-v1]
path = 'contracts/dao/traits/aibtcdev-dao-traits-v1.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.aibtcdev-dao-v1]
path = 'contracts/dao/traits/aibtcdev-dao-v1.clar'
clarity_version = 2
epoch = 3.0

# testing utilities

[contracts.test-treasury]
path = 'contracts/test/aibtc-treasury.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.external-proxy]
path = 'contracts/test/proxy.clar'
deployer = 'wallet_1'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.proxy]
path = 'contracts/test/proxy.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.test-proxy]
path = 'contracts/test/proxy.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0

[contracts.test-token]
path = 'contracts/test/sip010-token.clar'
clarity_version = 2
epoch = 2.5
epoch = 3.0
20 changes: 20 additions & 0 deletions contracts/dao/extensions/actions/aibtc-action-send-message.clar
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
(impl-trait .aibtcdev-dao-traits-v1.extension)
(impl-trait .aibtcdev-dao-traits-v1.action)

(define-constant ERR_UNAUTHORIZED (err u10001))
(define-constant ERR_INVALID_PARAMS (err u10002))

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

(define-public (run (parameters (buff 2048)))
(begin
(try! (is-dao-or-extension))
(contract-call? .aibtc-onchain-messaging send (unwrap! (from-consensus-buff? (string-ascii 2043) parameters) ERR_INVALID_PARAMS) true)
)
)

(define-private (is-dao-or-extension)
(ok (asserts! (or (is-eq tx-sender .aibtcdev-base-dao)
(contract-call? .aibtcdev-base-dao is-extension contract-caller)) ERR_UNAUTHORIZED
))
)
Loading

0 comments on commit 0ce4f13

Please sign in to comment.