AIBTC Working Group
  • AIBTC
  • Prompt2DAO
  • AIBTC Contracts
    • DAO Base Layer
    • DAO Extensions
      • Action Proposal Voting
      • Core Proposal Voting
      • DAO Charter
      • Onchain Messaging
      • Payment Processor
      • Timed Vault
      • Token Owner
      • Treasury
    • DAO Proposals
      • Action Proposals
      • Core Proposals
    • Agent Account
  • Agent Tools
    • Overview
    • Available Tools
      • Smart Wallet Tools
      • Agent Wallet Tools
      • DAO Tools
      • Database Tools
      • Faktory Tools
  • AIBTC Cache
    • Overview
    • Contract Calls
      • API Design
      • Endpoints
        • Decode Clarity Value
        • Read-Only Function Calls
        • Contract ABI
        • Known ABI Contracts
      • Clarity Value Types
      • Integration Examples
    • Cache Services
    • Error Handling
    • Utilities
  • Prompting
    • Action Proposal Prompts
    • Smart Wallet Prompts
  • Links
    • Common Terms
    • Our App
    • Discord
    • GitHub
    • Prompt2DAO on X
    • AIBTC on X
  • Documentation Templates
    • Smart Contract Documentation
    • Cache Service Documentation
    • Cache Endpoint Documentation
    • Agent Tool Documentation
    • Prompting Documentation
  • Example Implementations
    • Smart Contract Example
    • Cache Service Example
    • Cache Endpoint Example
    • Agent Tool Example
Powered by GitBook
On this page
  • Key Features
  • Quick Reference
  • How It Works
  • Public Functions
  • callback
  • set-token-uri
  • transfer-ownership
  • Private Functions
  • is-dao-or-extension
  • Error Handling
  • Security Considerations
  • Integration Examples
  • Updating Token URI Through a Proposal
  • Transferring Token Ownership
  • Related Contracts
  • Review Checklist
  • Versioning and Updates
  1. AIBTC Contracts
  2. DAO Extensions

Token Owner

Extension that provides management functions for the DAO token

PreviousTimed VaultNextTreasury

Last updated 29 days ago

The Token Owner extension (aibtc-token-owner) provides management functions for the DAO token, allowing the DAO to control token metadata and ownership through governance. This extension serves as the authorized interface between the DAO and its token contract, ensuring that token configuration changes can only be executed through proper governance channels.

Key Features

  • Token URI Management: Updates the token's metadata URI through governance

  • Ownership Control: Allows the DAO to transfer token contract ownership

  • Permission Gating: Ensures only the DAO or authorized extensions can modify token settings

  • Contract Interoperability: Interfaces between the DAO and token contract using proper permissions

Quick Reference

Property
Value

Contract Name

aibtc-token-owner

Version

1.0.0

Implements

extension, token-owner traits

Key Parameters

None (stateless extension)

How It Works

The Token Owner extension acts as an authorized intermediary between the DAO and its token contract. When the DAO approves a proposal to update token settings, it calls the appropriate function on this extension. The extension verifies the caller is authorized (either the DAO itself or another approved extension), then uses as-contract to call the token contract with the proper permissions.

Public Functions

callback

Purpose: Standard extension callback function required by the extension trait

Parameters:

  • sender: principal - The principal that triggered the callback

  • memo: (buff 34) - Optional memo data

Returns: (response bool) - Returns true on success

Example:

(contract-call? .aibtc-token-owner callback tx-sender 0x)

set-token-uri

Purpose: Updates the token's URI metadata, which controls how the token appears in wallets and explorers

Parameters:

  • value: (string-utf8 256) - The new URI string for the token metadata

Returns: (response bool) - Returns true on success or an error

Example:

(contract-call? .aibtc-token-owner set-token-uri "https://example.com/token-metadata.json")

This function can only be called by the DAO or an authorized extension. It updates the token's metadata URI, which typically points to a JSON file containing token information like name, symbol, description, and image.

transfer-ownership

Purpose: Transfers token contract ownership to a new principal

Parameters:

  • new-owner: principal - The principal that will become the new token contract owner

Returns: (response bool) - Returns true on success or an error

Example:

(contract-call? .aibtc-token-owner transfer-ownership 'SP2ZNGJ85ENDY6QRHQ5P2D4FXKGZWCKTB2T0Z55KS)

This function allows the DAO to transfer ownership of the token contract to a new principal, which could be useful during contract upgrades or governance changes.

Private Functions

is-dao-or-extension

Purpose: Internal authorization check to ensure only the DAO or authorized extensions can call sensitive functions

Parameters: None

Returns: (response bool) - Returns ok true if authorized, or err u7000 if unauthorized

Error Handling

Error Code
Constant
Description
Resolution

u7000

ERR_UNAUTHORIZED

Caller is not the DAO or a valid extension

Ensure the function is called through proper DAO governance

Security Considerations

  • Authorization Control: All management functions are protected by the is-dao-or-extension check, ensuring only authorized entities can modify token settings

  • Contract-Call Pattern: Uses the as-contract pattern to make calls to the token contract with the extension's authority

  • Governance Protection: Changes to token settings require going through the DAO's proposal and voting process

  • No Direct State: The extension maintains no state of its own, reducing attack surface

  • Limited Functionality: The extension provides only the minimum necessary functions for token management

Integration Examples

Updating Token URI Through a Proposal

;; Example proposal to update the token URI
(contract-call? .aibtc-base-dao submit-proposal
  .aibtc-token-owner
  'set-token-uri
  (list "https://arweave.net/newTokenMetadata")
  none
  u0
)

Transferring Token Ownership

;; Example proposal to transfer token ownership
(contract-call? .aibtc-base-dao submit-proposal
  .aibtc-token-owner
  'transfer-ownership
  (list 'SP2ZNGJ85ENDY6QRHQ5P2D4FXKGZWCKTB2T0Z55KS)
  none
  u0
)

Related Contracts

Review Checklist

Versioning and Updates

  • Last Updated: April 2025

  • Contract Version: 1.0.0

  • Documentation Version: 1.1.0

  • Changes from Previous Version: Updated to match new documentation template format

: The token contract managed by this extension

: The core DAO contract that authorizes this extension

: Defines the traits implemented by this extension

aibtc-token
aibtc-base-dao
aibtc-dao-traits-v3