diff --git a/agent-tools-ts b/agent-tools-ts index 7c1b7129..3667c3cf 160000 --- a/agent-tools-ts +++ b/agent-tools-ts @@ -1 +1 @@ -Subproject commit 7c1b712966aac53ddd96e841db1c77af296fde62 +Subproject commit 3667c3cff526c6608711f44c274c3fe35b02b9db diff --git a/tools/dao_ext_action_proposals.py b/tools/dao_ext_action_proposals.py index eceb1e92..2b590bb1 100644 --- a/tools/dao_ext_action_proposals.py +++ b/tools/dao_ext_action_proposals.py @@ -12,279 +12,6 @@ class DaoBaseInput(BaseModel): pass - -class ProposeActionAddResourceInput(BaseModel): - """Input schema for proposing to add a resource action.""" - - action_proposals_voting_extension: str = Field( - ..., - description="Contract principal where the DAO creates action proposals for voting by DAO members.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-proposals-v2" - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2" - ], - ) - action_proposal_contract_to_execute: str = Field( - ..., - description="Contract principal of the action proposal that executes adding a resource to the DAO.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-add-resource" - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-add-resource" - ], - ) - dao_token_contract_address: str = Field( - ..., - description="Contract principal of the token used by the DAO for voting", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) - resource_name: str = Field(..., description="Name of the resource to add") - resource_description: str = Field(..., description="Description of the resource") - resource_price: int = Field(..., description="Price of the resource in microstacks") - resource_url: Optional[str] = Field( - None, - description="Optional URL associated with the resource", - examples=["https://www.example.com/resource"], - ) - memo: Optional[str] = Field( - None, - description="Optional memo to include with the proposal", - examples=["Adding a new consultation resource for the DAO"], - ) - - -class ProposeActionAddResourceTool(BaseTool): - name: str = "dao_propose_action_add_resource" - description: str = ( - "This creates a proposal that DAO members can vote on to add the new resource to the " - " DAO resource contract with specified name, description, price, and optional URL." - ) - args_schema: Type[BaseModel] = ProposeActionAddResourceInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - resource_name: str, - resource_description: str, - resource_price: int, - resource_url: Optional[str] = None, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to propose adding a resource.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [ - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - resource_name, - resource_description, - str(resource_price), - ] - - if resource_url: - args.append(resource_url) - - if memo: - if not resource_url: - args.append("") # Add empty URL if not provided but memo is - args.append(memo) - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/action-proposals/public", - "propose-action-add-resource.ts", - *args, - ) - - def _run( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - resource_name: str, - resource_description: str, - resource_price: int, - resource_url: Optional[str] = None, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to propose adding a resource.""" - return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - resource_name, - resource_description, - resource_price, - resource_url, - memo, - **kwargs, - ) - - async def _arun( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - resource_name: str, - resource_description: str, - resource_price: int, - resource_url: Optional[str] = None, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - resource_name, - resource_description, - resource_price, - resource_url, - memo, - **kwargs, - ) - - -class ProposeActionAllowAssetInput(BaseModel): - """Input schema for proposing to allow an asset action.""" - - action_proposals_voting_extension: str = Field( - ..., - description="Contract principal where the DAO creates action proposals for voting by DAO members.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-proposals-v2", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", - ], - ) - action_proposal_contract_to_execute: str = Field( - ..., - description="Contract principal of the action proposal that executes allowing an asset in the DAO treasury.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-allow-asset", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", - ], - ) - dao_token_contract_address: str = Field( - ..., - description="Contract principal of the token used by the DAO for voting", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) - dao_token_contract_address_to_allow: str = Field( - ..., - description="Contract principal of the token to allow", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) - memo: Optional[str] = Field( - None, - description="Optional memo to include with the proposal", - examples=["Allow new token for DAO treasury operations"], - ) - - -class ProposeActionAllowAssetTool(BaseTool): - name: str = "dao_propose_action_allow_asset" - description: str = ( - "This creates a proposal that DAO members can vote on to allow a specific " - " token contract to be used within the DAO treasury contract." - ) - args_schema: Type[BaseModel] = ProposeActionAllowAssetInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - dao_token_contract_address_to_allow: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to propose allowing an asset.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [ - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - dao_token_contract_address_to_allow, - ] - - if memo: - args.append(memo) - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/action-proposals/public", - "propose-action-allow-asset.ts", - *args, - ) - - def _run( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - dao_token_contract_address_to_allow: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to propose allowing an asset.""" - return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - dao_token_contract_address_to_allow, - memo, - **kwargs, - ) - - async def _arun( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - dao_token_contract_address_to_allow: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - dao_token_contract_address_to_allow, - memo, - **kwargs, - ) - - class ProposeActionSendMessageInput(BaseModel): """Input schema for proposing to send a message action.""" @@ -406,11 +133,10 @@ async def _arun( **kwargs, ) +class VoteOnActionProposalInput(BaseModel): + """Input schema for voting on an action proposal.""" -class ProposeActionSetAccountHolderInput(BaseModel): - """Input schema for proposing to set account holder action.""" - - action_proposals_voting_extension: str = Field( + dao_action_proposal_voting_contract: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -418,45 +144,18 @@ class ProposeActionSetAccountHolderInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - action_proposal_contract_to_execute: str = Field( - ..., - description="Contract principal of the action proposal that executes setting the account holder in a DAO timed vault.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-set-account-holder", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-set-account-holder", - ], - ) - dao_token_contract_address: str = Field( - ..., - description="Contract principal of the token used by the DAO for voting", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) - account_holder: str = Field( - ..., - description="Address of the new account holder", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18", - "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM", - "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM.contract", - ], - ) - memo: Optional[str] = Field( - None, - description="Optional memo to include with the proposal", - examples=["Setting new account holder for DAO vault"], - ) + proposal_id: int = Field(..., description="ID of the proposal to vote on") + vote_for: bool = Field(..., description="True for yes/for, False for no/against") -class ProposeActionSetAccountHolderTool(BaseTool): - name: str = "dao_propose_action_set_account_holder" +class VoteOnActionProposalTool(BaseTool): + name: str = "dao_action_vote_on_proposal" description: str = ( - "This creates a proposal that DAO members can vote on to change the account holder " - "in a DAO timed vault to a specified standard or contract address." + "Vote on an existing action proposal in the DAO. " + "Allows casting a vote (true/false) on a specific proposal ID " + "in the provided action proposals contract." ) - args_schema: Type[BaseModel] = ProposeActionSetAccountHolderInput + args_schema: Type[BaseModel] = VoteOnActionProposalInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -466,75 +165,55 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - account_holder: str, - memo: Optional[str] = None, + dao_action_proposal_voting_contract: str, + proposal_id: int, + vote_for: bool, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose setting a new account holder.""" + """Execute the tool to vote on an action proposal.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - account_holder, + dao_action_proposal_voting_contract, + str(proposal_id), + str(vote_for).lower(), ] - if memo: - args.append(memo) - return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/public", - "propose-action-set-account-holder.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/public", + "vote-on-action-proposal.ts", *args, ) def _run( self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - account_holder: str, - memo: Optional[str] = None, + dao_action_proposal_voting_contract: str, + proposal_id: int, + vote_for: bool, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose setting a new account holder.""" + """Execute the tool to vote on an action proposal.""" return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - account_holder, - memo, - **kwargs, + dao_action_proposal_voting_contract, proposal_id, vote_for, **kwargs ) async def _arun( self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - account_holder: str, - memo: Optional[str] = None, + dao_action_proposal_voting_contract: str, + proposal_id: int, + vote_for: bool, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - account_holder, - memo, - **kwargs, + dao_action_proposal_voting_contract, proposal_id, vote_for, **kwargs ) -class ProposeActionSetWithdrawalAmountInput(BaseModel): - """Input schema for proposing to set withdrawal amount action.""" +class ConcludeActionProposalInput(BaseModel): + """Input schema for concluding an action proposal.""" action_proposals_voting_extension: str = Field( ..., @@ -544,12 +223,14 @@ class ProposeActionSetWithdrawalAmountInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) + proposal_id: int = Field(..., description="ID of the proposal to conclude") action_proposal_contract_to_execute: str = Field( ..., - description="Contract principal of the action proposal that executes setting the withdrawal amount in a DAO timed vault.", + description="Contract principal of the original action proposal submitted for execution as part of the proposal", examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-set-withdrawal-amount", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-set-withdrawal-amount", + "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-send-message", + "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-set-account-holder", + "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-toggle-resource", ], ) dao_token_contract_address: str = Field( @@ -560,25 +241,15 @@ class ProposeActionSetWithdrawalAmountInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", ], ) - withdrawal_amount: int = Field( - ..., - description="New withdrawal amount to set in microSTX", - examples=["50000000"], # 50 STX - ) - memo: Optional[str] = Field( - None, - description="Optional memo to include with the proposal", - examples=["Updating withdrawal amount to 50 STX"], - ) -class ProposeActionSetWithdrawalAmountTool(BaseTool): - name: str = "dao_propose_action_set_withdrawal_amount" +class ConcludeActionProposalTool(BaseTool): + name: str = "dao_action_conclude_proposal" description: str = ( - "This creates a proposal that DAO members can vote on to change the withdrawal amount " - " to a specified number of microSTX in a DAO timed vault." + "Conclude an existing action proposal in the DAO. " + "This finalizes the proposal and executes the action if the vote passed." ) - args_schema: Type[BaseModel] = ProposeActionSetWithdrawalAmountInput + args_schema: Type[BaseModel] = ConcludeActionProposalInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -589,74 +260,65 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, dao_token_contract_address: str, - withdrawal_amount: int, - memo: Optional[str] = None, + proposal_id: int, + action_proposal_contract_to_execute: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose setting a new withdrawal amount.""" + """Execute the tool to conclude an action proposal.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ action_proposals_voting_extension, + str(proposal_id), action_proposal_contract_to_execute, dao_token_contract_address, - str(withdrawal_amount), ] - if memo: - args.append(memo) - return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/public", - "propose-action-set-withdrawal-amount.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/public", + "conclude-action-proposal.ts", *args, ) def _run( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, dao_token_contract_address: str, - withdrawal_amount: int, - memo: Optional[str] = None, + proposal_id: int, + action_proposal_contract_to_execute: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose setting a new withdrawal amount.""" + """Execute the tool to conclude an action proposal.""" return self._deploy( action_proposals_voting_extension, - action_proposal_contract_to_execute, dao_token_contract_address, - withdrawal_amount, - memo, + proposal_id, + action_proposal_contract_to_execute, **kwargs, ) async def _arun( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, dao_token_contract_address: str, - withdrawal_amount: int, - memo: Optional[str] = None, + proposal_id: int, + action_proposal_contract_to_execute: str, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" return self._deploy( action_proposals_voting_extension, - action_proposal_contract_to_execute, dao_token_contract_address, - withdrawal_amount, - memo, + proposal_id, + action_proposal_contract_to_execute, **kwargs, ) - -class ProposeActionSetWithdrawalPeriodInput(BaseModel): - """Input schema for proposing to set withdrawal period action.""" +class GetLiquidSupplyInput(BaseModel): + """Input schema for getting the liquid supply.""" action_proposals_voting_extension: str = Field( ..., @@ -666,41 +328,18 @@ class ProposeActionSetWithdrawalPeriodInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - action_proposal_contract_to_execute: str = Field( - ..., - description="Contract principal of the action proposal that executes setting the withdrawal period in a DAO timed vault.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-set-withdrawal-period", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-set-withdrawal-period", - ], - ) - dao_token_contract_address: str = Field( - ..., - description="Contract principal of the token used by the DAO for voting", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) - withdrawal_period: int = Field( - ..., - description="New withdrawal period to set in Bitcoin blocks", - examples=["144"], # 1 day in BTC blocks - ) - memo: Optional[str] = Field( - None, - description="Optional memo to include with the proposal", - examples=["Updating withdrawal period to 1 day (144 blocks)"], + stacks_block_height: int = Field( + ..., description="Stacks block height to query the liquid supply at" ) -class ProposeActionSetWithdrawalPeriodTool(BaseTool): - name: str = "dao_propose_action_set_withdrawal_period" +class GetLiquidSupplyTool(BaseTool): + name: str = "dao_action_get_liquid_supply" description: str = ( - "This creates a proposal that DAO members can vote on to change the withdrawal period " - " to a specified number of Bitcoin blocks in a DAO timed vault." + "Get the liquid supply of the DAO token at a specific Stacks block height. " + "Returns the total amount of tokens that are liquid at that block." ) - args_schema: Type[BaseModel] = ProposeActionSetWithdrawalPeriodInput + args_schema: Type[BaseModel] = GetLiquidSupplyInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -711,76 +350,52 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - withdrawal_period: int, - memo: Optional[str] = None, + stacks_block_height: int, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose setting a new withdrawal period.""" + """Execute the tool to get the liquid supply.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - str(withdrawal_period), + str(stacks_block_height), ] - if memo: - args.append(memo) - return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/public", - "propose-action-set-withdrawal-period.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-liquid-supply.ts", *args, ) def _run( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - withdrawal_period: int, - memo: Optional[str] = None, + stacks_block_height: int, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose setting a new withdrawal period.""" + """Execute the tool to get the liquid supply.""" return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - withdrawal_period, - memo, - **kwargs, + action_proposals_voting_extension, stacks_block_height, **kwargs ) async def _arun( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - withdrawal_period: int, - memo: Optional[str] = None, + stacks_block_height: int, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - withdrawal_period, - memo, - **kwargs, + action_proposals_voting_extension, stacks_block_height, **kwargs ) -class VoteOnActionProposalInput(BaseModel): - """Input schema for voting on an action proposal.""" +class GetProposalInput(BaseModel): + """Input schema for getting proposal data.""" - dao_action_proposal_voting_contract: str = Field( + action_proposals_voting_extension: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -788,18 +403,16 @@ class VoteOnActionProposalInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - proposal_id: int = Field(..., description="ID of the proposal to vote on") - vote_for: bool = Field(..., description="True for yes/for, False for no/against") + proposal_id: int = Field(..., description="ID of the proposal to retrieve") -class VoteOnActionProposalTool(BaseTool): - name: str = "dao_action_vote_on_proposal" +class GetProposalTool(BaseTool): + name: str = "dao_action_get_proposal" description: str = ( - "Vote on an existing action proposal in the DAO. " - "Allows casting a vote (true/false) on a specific proposal ID " - "in the provided action proposals contract." + "Get the data for a specific proposal from the DAO action proposals contract. " + "Returns all stored information about the proposal if it exists." ) - args_schema: Type[BaseModel] = VoteOnActionProposalInput + args_schema: Type[BaseModel] = GetProposalInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -809,55 +422,47 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - dao_action_proposal_voting_contract: str, + action_proposals_voting_extension: str, proposal_id: int, - vote_for: bool, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to vote on an action proposal.""" + """Execute the tool to get proposal data.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - dao_action_proposal_voting_contract, + action_proposals_voting_extension, str(proposal_id), - str(vote_for).lower(), ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/public", - "vote-on-action-proposal.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-proposal.ts", *args, ) def _run( self, - dao_action_proposal_voting_contract: str, + action_proposals_voting_extension: str, proposal_id: int, - vote_for: bool, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to vote on an action proposal.""" - return self._deploy( - dao_action_proposal_voting_contract, proposal_id, vote_for, **kwargs - ) + """Execute the tool to get proposal data.""" + return self._deploy(action_proposals_voting_extension, proposal_id, **kwargs) async def _arun( self, - dao_action_proposal_voting_contract: str, + action_proposals_voting_extension: str, proposal_id: int, - vote_for: bool, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" - return self._deploy( - dao_action_proposal_voting_contract, proposal_id, vote_for, **kwargs - ) + return self._deploy(action_proposals_voting_extension, proposal_id, **kwargs) -class ConcludeActionProposalInput(BaseModel): - """Input schema for concluding an action proposal.""" +class GetVotingConfigurationInput(BaseModel): + """Input schema for getting voting configuration.""" action_proposals_voting_extension: str = Field( ..., @@ -867,33 +472,15 @@ class ConcludeActionProposalInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - proposal_id: int = Field(..., description="ID of the proposal to conclude") - action_proposal_contract_to_execute: str = Field( - ..., - description="Contract principal of the original action proposal submitted for execution as part of the proposal", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-send-message", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-set-account-holder", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-toggle-resource", - ], - ) - dao_token_contract_address: str = Field( - ..., - description="Contract principal of the token used by the DAO for voting", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) -class ConcludeActionProposalTool(BaseTool): - name: str = "dao_action_conclude_proposal" +class GetVotingConfigurationTool(BaseTool): + name: str = "dao_action_get_voting_configuration" description: str = ( - "Conclude an existing action proposal in the DAO. " - "This finalizes the proposal and executes the action if the vote passed." + "Get the voting configuration from the DAO action proposals contract. " + "Returns the current voting parameters and settings used for proposals." ) - args_schema: Type[BaseModel] = ConcludeActionProposalInput + args_schema: Type[BaseModel] = GetVotingConfigurationInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -904,66 +491,42 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, action_proposals_voting_extension: str, - dao_token_contract_address: str, - proposal_id: int, - action_proposal_contract_to_execute: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to conclude an action proposal.""" + """Execute the tool to get voting configuration.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ action_proposals_voting_extension, - str(proposal_id), - action_proposal_contract_to_execute, - dao_token_contract_address, ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/public", - "conclude-action-proposal.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-voting-configuration.ts", *args, ) def _run( self, action_proposals_voting_extension: str, - dao_token_contract_address: str, - proposal_id: int, - action_proposal_contract_to_execute: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to conclude an action proposal.""" - return self._deploy( - action_proposals_voting_extension, - dao_token_contract_address, - proposal_id, - action_proposal_contract_to_execute, - **kwargs, - ) + """Execute the tool to get voting configuration.""" + return self._deploy(action_proposals_voting_extension, **kwargs) async def _arun( self, action_proposals_voting_extension: str, - dao_token_contract_address: str, - proposal_id: int, - action_proposal_contract_to_execute: str, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" - return self._deploy( - action_proposals_voting_extension, - dao_token_contract_address, - proposal_id, - action_proposal_contract_to_execute, - **kwargs, - ) + return self._deploy(action_proposals_voting_extension, **kwargs) -class ProposeActionToggleResourceInput(BaseModel): - """Input schema for proposing to toggle a resource action.""" +class GetVotingPowerInput(BaseModel): + """Input schema for getting voting power.""" action_proposals_voting_extension: str = Field( ..., @@ -973,41 +536,21 @@ class ProposeActionToggleResourceInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - action_proposal_contract_to_execute: str = Field( - ..., - description="Contract principal of the action proposal that executes toggling a resource in the DAO.", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-action-toggle-resource", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-toggle-resource", - ], - ) - dao_token_contract_address: str = Field( - ..., - description="Contract principal of the token used by the DAO for voting", - examples=[ - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-faktory", - "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-faktory", - ], - ) - resource_name: str = Field( + proposal_id: int = Field(..., description="ID of the proposal to check") + voter_address: str = Field( ..., - description="Name of the resource to toggle", - examples=["apiv1", "protected-content", "1hr consulting"], - ) - memo: Optional[str] = Field( - None, - description="Optional memo to include with the proposal", - examples=["Toggling availability of consulting resource"], + description="Address of the voter to check voting power for", + examples=["ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18"], ) -class ProposeActionToggleResourceTool(BaseTool): - name: str = "dao_propose_action_toggle_resource" +class GetVotingPowerTool(BaseTool): + name: str = "dao_action_get_voting_power" description: str = ( - "This creates a proposal that DAO members can vote on to enable or disable " - "whether a specific resource can be paid for in the DAO resource contract." + "Get the voting power of a specific address for a proposal. " + "Returns the number of votes the address can cast on the given proposal." ) - args_schema: Type[BaseModel] = ProposeActionToggleResourceInput + args_schema: Type[BaseModel] = GetVotingPowerInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -1018,76 +561,44 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - resource_name: str, - memo: Optional[str] = None, + proposal_id: int, + voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to propose toggling a resource.""" + """Execute the tool to get voting power.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - resource_name, + str(proposal_id), + voter_address, ] - if memo: - args.append(memo) - return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/public", - "propose-action-toggle-resource-by-name.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-voting-power.ts", *args, ) def _run( self, action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - resource_name: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to propose toggling a resource.""" - return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - resource_name, - memo, - **kwargs, - ) - - async def _arun( - self, - action_proposals_voting_extension: str, - action_proposal_contract_to_execute: str, - dao_token_contract_address: str, - resource_name: str, - memo: Optional[str] = None, + proposal_id: int, + voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Async version of the tool.""" + """Execute the tool to get voting power.""" return self._deploy( - action_proposals_voting_extension, - action_proposal_contract_to_execute, - dao_token_contract_address, - resource_name, - memo, - **kwargs, + action_proposals_voting_extension, proposal_id, voter_address, **kwargs ) -class GetLiquidSupplyInput(BaseModel): - """Input schema for getting the liquid supply.""" +class VetoActionProposalInput(BaseModel): + """Input schema for vetoing an action proposal.""" - action_proposals_voting_extension: str = Field( + dao_action_proposal_voting_contract: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -1095,18 +606,17 @@ class GetLiquidSupplyInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - stacks_block_height: int = Field( - ..., description="Stacks block height to query the liquid supply at" - ) + proposal_id: int = Field(..., description="ID of the proposal to veto") -class GetLiquidSupplyTool(BaseTool): - name: str = "dao_action_get_liquid_supply" +class VetoActionProposalTool(BaseTool): + name: str = "dao_action_veto_proposal" description: str = ( - "Get the liquid supply of the DAO token at a specific Stacks block height. " - "Returns the total amount of tokens that are liquid at that block." + "Veto an existing action proposal in the DAO. " + "Allows casting a veto vote on a specific proposal ID " + "in the provided action proposals contract." ) - args_schema: Type[BaseModel] = GetLiquidSupplyInput + args_schema: Type[BaseModel] = VetoActionProposalInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -1116,53 +626,53 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - action_proposals_voting_extension: str, - stacks_block_height: int, + dao_action_proposal_voting_contract: str, + proposal_id: int, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get the liquid supply.""" + """Execute the tool to veto an action proposal.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - action_proposals_voting_extension, - str(stacks_block_height), + dao_action_proposal_voting_contract, + str(proposal_id), ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/read-only", - "get-liquid-supply.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/public", + "veto-action-proposal.ts", *args, ) def _run( self, - action_proposals_voting_extension: str, - stacks_block_height: int, + dao_action_proposal_voting_contract: str, + proposal_id: int, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get the liquid supply.""" + """Execute the tool to veto an action proposal.""" return self._deploy( - action_proposals_voting_extension, stacks_block_height, **kwargs + dao_action_proposal_voting_contract, proposal_id, **kwargs ) async def _arun( self, - action_proposals_voting_extension: str, - stacks_block_height: int, + dao_action_proposal_voting_contract: str, + proposal_id: int, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" return self._deploy( - action_proposals_voting_extension, stacks_block_height, **kwargs + dao_action_proposal_voting_contract, proposal_id, **kwargs ) -class GetProposalInput(BaseModel): - """Input schema for getting proposal data.""" +class GetTotalProposalsInput(BaseModel): + """Input schema for getting total proposals data.""" - action_proposals_voting_extension: str = Field( + dao_action_proposal_voting_contract: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -1170,16 +680,15 @@ class GetProposalInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) - proposal_id: int = Field(..., description="ID of the proposal to retrieve") -class GetProposalTool(BaseTool): - name: str = "dao_action_get_proposal" +class GetTotalProposalsTool(BaseTool): + name: str = "dao_action_get_total_proposals" description: str = ( - "Get the data for a specific proposal from the DAO action proposals contract. " - "Returns all stored information about the proposal if it exists." + "Get the total proposals data from the DAO action proposals contract. " + "Returns counts of proposals and last proposal block information." ) - args_schema: Type[BaseModel] = GetProposalInput + args_schema: Type[BaseModel] = GetTotalProposalsInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -1189,49 +698,45 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - action_proposals_voting_extension: str, - proposal_id: int, + dao_action_proposal_voting_contract: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get proposal data.""" + """Execute the tool to get total proposals data.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - action_proposals_voting_extension, - str(proposal_id), + dao_action_proposal_voting_contract, ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/read-only", - "get-proposal.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-total-proposals.ts", *args, ) def _run( self, - action_proposals_voting_extension: str, - proposal_id: int, + dao_action_proposal_voting_contract: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get proposal data.""" - return self._deploy(action_proposals_voting_extension, proposal_id, **kwargs) + """Execute the tool to get total proposals data.""" + return self._deploy(dao_action_proposal_voting_contract, **kwargs) async def _arun( self, - action_proposals_voting_extension: str, - proposal_id: int, + dao_action_proposal_voting_contract: str, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" - return self._deploy(action_proposals_voting_extension, proposal_id, **kwargs) + return self._deploy(dao_action_proposal_voting_contract, **kwargs) -class GetTotalVotesInput(BaseModel): - """Input schema for getting total votes for a voter.""" +class GetVetoVoteRecordInput(BaseModel): + """Input schema for getting a veto vote record.""" - action_proposals_voting_extension: str = Field( + dao_action_proposal_voting_contract: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -1240,16 +745,20 @@ class GetTotalVotesInput(BaseModel): ], ) proposal_id: int = Field(..., description="ID of the proposal to check") - voter_address: str = Field(..., description="Address of the voter to check") + voter_address: str = Field( + ..., + description="Address of the voter to check the veto vote record for", + examples=["ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18"], + ) -class GetTotalVotesTool(BaseTool): - name: str = "dao_action_get_total_votes" +class GetVetoVoteRecordTool(BaseTool): + name: str = "dao_action_get_veto_vote_record" description: str = ( - "Get the total votes cast by a specific voter on a proposal. " - "Returns the number of votes the voter has cast on the given proposal." + "Get the veto vote record for a specific voter on a proposal. " + "Returns the amount of veto votes if a record exists, otherwise null." ) - args_schema: Type[BaseModel] = GetTotalVotesInput + args_schema: Type[BaseModel] = GetVetoVoteRecordInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -1259,57 +768,63 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, proposal_id: int, voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get total votes.""" + """Execute the tool to get a veto vote record.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - action_proposals_voting_extension, + dao_action_proposal_voting_contract, str(proposal_id), voter_address, ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/read-only", - "get-total-votes.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-veto-vote-record.ts", *args, ) def _run( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, proposal_id: int, voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get total votes.""" + """Execute the tool to get a veto vote record.""" return self._deploy( - action_proposals_voting_extension, proposal_id, voter_address, **kwargs + dao_action_proposal_voting_contract, + proposal_id, + voter_address, + **kwargs, ) async def _arun( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, proposal_id: int, voter_address: str, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" return self._deploy( - action_proposals_voting_extension, proposal_id, voter_address, **kwargs + dao_action_proposal_voting_contract, + proposal_id, + voter_address, + **kwargs, ) -class GetVotingConfigurationInput(BaseModel): - """Input schema for getting voting configuration.""" +class GetVoteRecordInput(BaseModel): + """Input schema for getting a vote record.""" - action_proposals_voting_extension: str = Field( + dao_action_proposal_voting_contract: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -1317,15 +832,21 @@ class GetVotingConfigurationInput(BaseModel): "ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.t3st-action-proposals-v2", ], ) + proposal_id: int = Field(..., description="ID of the proposal to check") + voter_address: str = Field( + ..., + description="Address of the voter to check the vote record for", + examples=["ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18"], + ) -class GetVotingConfigurationTool(BaseTool): - name: str = "dao_action_get_voting_configuration" +class GetVoteRecordTool(BaseTool): + name: str = "dao_action_get_vote_record" description: str = ( - "Get the voting configuration from the DAO action proposals contract. " - "Returns the current voting parameters and settings used for proposals." + "Get the vote record for a specific voter on a proposal. " + "Returns the vote (true/false) and amount if a record exists, otherwise null." ) - args_schema: Type[BaseModel] = GetVotingConfigurationInput + args_schema: Type[BaseModel] = GetVoteRecordInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -1335,46 +856,63 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, + proposal_id: int, + voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get voting configuration.""" + """Execute the tool to get a vote record.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - action_proposals_voting_extension, + dao_action_proposal_voting_contract, + str(proposal_id), + voter_address, ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/read-only", - "get-voting-configuration.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-vote-record.ts", *args, ) def _run( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, + proposal_id: int, + voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get voting configuration.""" - return self._deploy(action_proposals_voting_extension, **kwargs) + """Execute the tool to get a vote record.""" + return self._deploy( + dao_action_proposal_voting_contract, + proposal_id, + voter_address, + **kwargs, + ) async def _arun( self, - action_proposals_voting_extension: str, - dao_token_contract_address: str, + dao_action_proposal_voting_contract: str, + proposal_id: int, + voter_address: str, **kwargs, ) -> Dict[str, Any]: """Async version of the tool.""" - return self._deploy(action_proposals_voting_extension, **kwargs) + return self._deploy( + dao_action_proposal_voting_contract, + proposal_id, + voter_address, + **kwargs, + ) -class GetVotingPowerInput(BaseModel): - """Input schema for getting voting power.""" +class GetVoteRecordsInput(BaseModel): + """Input schema for getting vote records (vote and veto vote).""" - action_proposals_voting_extension: str = Field( + dao_action_proposal_voting_contract: str = Field( ..., description="Contract principal where the DAO creates action proposals for voting by DAO members.", examples=[ @@ -1385,18 +923,19 @@ class GetVotingPowerInput(BaseModel): proposal_id: int = Field(..., description="ID of the proposal to check") voter_address: str = Field( ..., - description="Address of the voter to check voting power for", + description="Address of the voter to check vote records for", examples=["ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18"], ) -class GetVotingPowerTool(BaseTool): - name: str = "dao_action_get_voting_power" +class GetVoteRecordsTool(BaseTool): + name: str = "dao_action_get_vote_records" description: str = ( - "Get the voting power of a specific address for a proposal. " - "Returns the number of votes the address can cast on the given proposal." + "Get both the regular vote record and veto vote record for a specific voter on a proposal. " + "Returns an object containing 'voteRecord' (vote and amount, or null) and " + "'vetoVoteRecord' (amount, or null)." ) - args_schema: Type[BaseModel] = GetVotingPowerInput + args_schema: Type[BaseModel] = GetVoteRecordsInput return_direct: bool = False wallet_id: Optional[UUID] = None @@ -1406,38 +945,56 @@ def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): def _deploy( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, proposal_id: int, voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get voting power.""" + """Execute the tool to get vote records.""" if self.wallet_id is None: return {"success": False, "message": "Wallet ID is required", "data": None} args = [ - action_proposals_voting_extension, + dao_action_proposal_voting_contract, str(proposal_id), voter_address, ] return BunScriptRunner.bun_run( self.wallet_id, - "aibtc-dao/extensions/action-proposals/read-only", - "get-voting-power.ts", + "aibtc-cohort-0/dao-tools/extensions/action-proposal-voting/read-only", + "get-vote-records.ts", *args, ) def _run( self, - action_proposals_voting_extension: str, + dao_action_proposal_voting_contract: str, proposal_id: int, voter_address: str, **kwargs, ) -> Dict[str, Any]: - """Execute the tool to get voting power.""" + """Execute the tool to get vote records.""" return self._deploy( - action_proposals_voting_extension, proposal_id, voter_address, **kwargs + dao_action_proposal_voting_contract, + proposal_id, + voter_address, + **kwargs, + ) + + async def _arun( + self, + dao_action_proposal_voting_contract: str, + proposal_id: int, + voter_address: str, + **kwargs, + ) -> Dict[str, Any]: + """Async version of the tool.""" + return self._deploy( + dao_action_proposal_voting_contract, + proposal_id, + voter_address, + **kwargs, ) async def _arun( diff --git a/tools/dao_ext_core_proposals.py b/tools/dao_ext_core_proposals.py deleted file mode 100644 index 7fc11821..00000000 --- a/tools/dao_ext_core_proposals.py +++ /dev/null @@ -1,236 +0,0 @@ -from typing import Any, Dict, Optional, Type -from uuid import UUID - -from langchain.tools import BaseTool -from pydantic import BaseModel, Field - -from tools.bun import BunScriptRunner - - -class GenerateCoreProposalInput(BaseModel): - """Input schema for generating a core proposal.""" - - dao_deployer_address: str = Field( - ..., - description="The address of the DAO deployer", - example="ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM", - ) - dao_token_symbol: str = Field( - ..., - description="The token symbol for the DAO", - example="aibtc", - ) - proposal_contract_name: str = Field( - ..., - description="The name of the proposal contract", - example="aibtc-treasury-withdraw-stx", - ) - proposal_args: Dict[str, str] = Field( - ..., - description="Arguments for the proposal in key-value format", - example={ - "stx_amount": "1000000", - "recipient_address": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM", - }, - ) - generate_files: bool = Field( - False, - description="Whether to generate and save proposal files", - ) - - -class GenerateCoreProposalTool(BaseTool): - name: str = "dao_generate_core_proposal" - description: str = ( - "Generate a core proposal for the DAO. " - "This will create the proposal contract but not deploy it. " - "Returns the generated proposal details if successful." - ) - args_schema: Type[BaseModel] = GenerateCoreProposalInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - dao_deployer_address: str, - dao_token_symbol: str, - proposal_contract_name: str, - proposal_args: Dict[str, str], - generate_files: bool = False, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to generate a core proposal.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [ - dao_deployer_address, - dao_token_symbol, - proposal_contract_name, - str(proposal_args).replace("'", '"'), # Convert Python dict to JSON string - str(generate_files).lower(), - ] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/core-proposals", - "generate-core-proposal.ts", - *args, - ) - - def _run( - self, - dao_deployer_address: str, - dao_token_symbol: str, - proposal_contract_name: str, - proposal_args: Dict[str, str], - generate_files: bool = False, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to generate a core proposal.""" - return self._deploy( - dao_deployer_address, - dao_token_symbol, - proposal_contract_name, - proposal_args, - generate_files, - **kwargs, - ) - - async def _arun( - self, - dao_deployer_address: str, - dao_token_symbol: str, - proposal_contract_name: str, - proposal_args: Dict[str, str], - generate_files: bool = False, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy( - dao_deployer_address, - dao_token_symbol, - proposal_contract_name, - proposal_args, - generate_files, - **kwargs, - ) - - -class DeployCoreProposalInput(BaseModel): - """Input schema for deploying a core proposal.""" - - dao_deployer_address: str = Field( - ..., - description="The address of the DAO deployer", - example="ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM", - ) - dao_token_symbol: str = Field( - ..., - description="The token symbol for the DAO", - example="aibtc", - ) - proposal_contract_name: str = Field( - ..., - description="The name of the proposal contract", - example="aibtc-treasury-withdraw-stx", - ) - proposal_args: Dict[str, str] = Field( - ..., - description="Arguments for the proposal in key-value format", - example={ - "stx_amount": "1000000", - "recipient_address": "ST1PQHQKV0RJXZFY1DGX8MNSNYVE3VGZJSRTPGZGM", - }, - ) - generate_files: bool = Field( - False, - description="Whether to generate and save proposal files", - ) - - -class DeployCoreProposalTool(BaseTool): - name: str = "dao_deploy_core_proposal" - description: str = ( - "Deploy a core proposal for the DAO. " - "This will generate and deploy the proposal contract. " - "This is a required step before proposing. " - "Returns the deployment details if successful." - ) - args_schema: Type[BaseModel] = DeployCoreProposalInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - dao_deployer_address: str, - dao_token_symbol: str, - proposal_contract_name: str, - proposal_args: Dict[str, str], - generate_files: bool = False, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to deploy a core proposal.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [ - dao_deployer_address, - dao_token_symbol, - proposal_contract_name, - str(proposal_args).replace("'", '"'), # Convert Python dict to JSON string - str(generate_files).lower(), - ] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/core-proposals", - "deploy-core-proposal.ts", - *args, - ) - - def _run( - self, - dao_deployer_address: str, - dao_token_symbol: str, - proposal_contract_name: str, - proposal_args: Dict[str, str], - generate_files: bool = False, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to deploy a core proposal.""" - return self._deploy( - dao_deployer_address, - dao_token_symbol, - proposal_contract_name, - proposal_args, - generate_files, - **kwargs, - ) - - async def _arun( - self, - dao_deployer_address: str, - dao_token_symbol: str, - proposal_contract_name: str, - proposal_args: Dict[str, str], - generate_files: bool = False, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy( - dao_deployer_address, - dao_token_symbol, - proposal_contract_name, - proposal_args, - generate_files, - **kwargs, - ) diff --git a/tools/dao_ext_onchain_messaging.py b/tools/dao_ext_onchain_messaging.py deleted file mode 100644 index 7bbb7219..00000000 --- a/tools/dao_ext_onchain_messaging.py +++ /dev/null @@ -1,73 +0,0 @@ -from typing import Any, Dict, Optional, Type -from uuid import UUID - -from langchain.tools import BaseTool -from pydantic import BaseModel, Field - -from tools.bun import BunScriptRunner - - -class SendMessageInput(BaseModel): - """Input schema for sending an onchain message.""" - - messaging_contract: str = Field( - ..., - description="Contract principal of the messaging contract for the DAO", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.dao-onchain-messaging", - ) - message: str = Field(..., description="Message to send") - - -class SendMessageTool(BaseTool): - name: str = "dao_messaging_send" - description: str = ( - "Send a message through the DAO's onchain messaging system. " - "Messages are stored permanently on the blockchain and can be viewed by anyone." - ) - args_schema: Type[BaseModel] = SendMessageInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - messaging_contract: str, - message: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to send a message.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [ - messaging_contract, - message, - ] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/onchain-messaging/public", - "send-message.ts", - *args, - ) - - def _run( - self, - messaging_contract: str, - message: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to send a message.""" - return self._deploy(messaging_contract, message, **kwargs) - - async def _arun( - self, - messaging_contract: str, - message: str, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(messaging_contract, message, **kwargs) diff --git a/tools/dao_ext_payments_invoices.py b/tools/dao_ext_payments_invoices.py deleted file mode 100644 index 919ecae3..00000000 --- a/tools/dao_ext_payments_invoices.py +++ /dev/null @@ -1,338 +0,0 @@ -from typing import Any, Dict, Optional, Type -from uuid import UUID - -from langchain.tools import BaseTool -from pydantic import BaseModel, Field - -from tools.bun import BunScriptRunner - - -class GetInvoiceInput(BaseModel): - """Input schema for getting invoice details.""" - - payments_invoices_contract: str = Field( - ..., - description="Contract principal of the payments and invoices contract", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-payments-invoices", - ) - invoice_index: int = Field(..., description="Index of the invoice to retrieve") - - -class GetInvoiceTool(BaseTool): - name: str = "dao_get_invoice" - description: str = ( - "Get details of a specific invoice from the DAO's payments and invoices system. " - "Returns the full invoice data if it exists." - ) - args_schema: Type[BaseModel] = GetInvoiceInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - payments_invoices_contract: str, - invoice_index: int, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get invoice details.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [payments_invoices_contract, str(invoice_index)] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/payments-invoices/read-only", - "get-invoice.ts", - *args, - ) - - def _run( - self, - payments_invoices_contract: str, - invoice_index: int, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get invoice details.""" - return self._deploy(payments_invoices_contract, invoice_index, **kwargs) - - async def _arun( - self, - payments_invoices_contract: str, - invoice_index: int, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(payments_invoices_contract, invoice_index, **kwargs) - - -class GetResourceInput(BaseModel): - """Input schema for getting resource details.""" - - payments_invoices_contract: str = Field( - ..., - description="Contract principal of the payments and invoices contract", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-payments-invoices", - ) - resource_index: int = Field(..., description="Index of the resource to retrieve") - - -class GetResourceTool(BaseTool): - name: str = "dao_get_resource" - description: str = ( - "Get details of a specific resource from the DAO's payments and invoices system. " - "Returns the full resource data if it exists." - ) - args_schema: Type[BaseModel] = GetResourceInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - payments_invoices_contract: str, - resource_index: int, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get resource details.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [payments_invoices_contract, str(resource_index)] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/payments-invoices/read-only", - "get-resource.ts", - *args, - ) - - def _run( - self, - payments_invoices_contract: str, - resource_index: int, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get resource details.""" - return self._deploy(payments_invoices_contract, resource_index, **kwargs) - - async def _arun( - self, - payments_invoices_contract: str, - resource_index: int, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(payments_invoices_contract, resource_index, **kwargs) - - -class GetResourceByNameInput(BaseModel): - """Input schema for getting resource details by name.""" - - payments_invoices_contract: str = Field( - ..., - description="Contract principal of the payments and invoices contract", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-payments-invoices", - ) - resource_name: str = Field(..., description="Name of the resource to retrieve") - - -class GetResourceByNameTool(BaseTool): - name: str = "dao_get_resource_by_name" - description: str = ( - "Get details of a specific resource by its name from the DAO's payments and invoices system. " - "Returns the full resource data if it exists." - ) - args_schema: Type[BaseModel] = GetResourceByNameInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - payments_invoices_contract: str, - resource_name: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get resource details by name.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [payments_invoices_contract, resource_name] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/payments-invoices/read-only", - "get-resource-by-name.ts", - *args, - ) - - def _run( - self, - payments_invoices_contract: str, - resource_name: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get resource details by name.""" - return self._deploy(payments_invoices_contract, resource_name, **kwargs) - - async def _arun( - self, - payments_invoices_contract: str, - resource_name: str, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(payments_invoices_contract, resource_name, **kwargs) - - -class PayInvoiceInput(BaseModel): - """Input schema for paying an invoice.""" - - payments_invoices_contract: str = Field( - ..., - description="Contract principal of the payments and invoices contract", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-payments-invoices", - ) - resource_index: int = Field(..., description="Index of the resource to pay for") - memo: Optional[str] = Field( - None, description="Optional memo to include with the payment" - ) - - -class PayInvoiceTool(BaseTool): - name: str = "dao_pay_invoice" - description: str = ( - "Pay an invoice for a specific resource in the DAO's payments and invoices system. " - "Optionally includes a memo with the payment." - ) - args_schema: Type[BaseModel] = PayInvoiceInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - payments_invoices_contract: str, - resource_index: int, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to pay an invoice.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [payments_invoices_contract, str(resource_index)] - if memo: - args.append(memo) - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/payments-invoices/public", - "pay-invoice.ts", - *args, - ) - - def _run( - self, - payments_invoices_contract: str, - resource_index: int, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to pay an invoice.""" - return self._deploy(payments_invoices_contract, resource_index, memo, **kwargs) - - async def _arun( - self, - payments_invoices_contract: str, - resource_index: int, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(payments_invoices_contract, resource_index, memo, **kwargs) - - -class PayInvoiceByResourceNameInput(BaseModel): - """Input schema for paying an invoice by resource name.""" - - payments_invoices_contract: str = Field( - ..., - description="Contract principal of the payments and invoices contract", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-payments-invoices", - ) - resource_name: str = Field(..., description="Name of the resource to pay for") - memo: Optional[str] = Field( - None, description="Optional memo to include with the payment" - ) - - -class PayInvoiceByResourceNameTool(BaseTool): - name: str = "dao_pay_invoice_by_resource_name" - description: str = ( - "Pay an invoice for a specific resource by its name in the DAO's payments and invoices system. " - "Optionally includes a memo with the payment." - ) - args_schema: Type[BaseModel] = PayInvoiceByResourceNameInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - payments_invoices_contract: str, - resource_name: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to pay an invoice by resource name.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [payments_invoices_contract, resource_name] - if memo: - args.append(memo) - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/payments-invoices/public", - "pay-invoice-by-resource-name.ts", - *args, - ) - - def _run( - self, - payments_invoices_contract: str, - resource_name: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to pay an invoice by resource name.""" - return self._deploy(payments_invoices_contract, resource_name, memo, **kwargs) - - async def _arun( - self, - payments_invoices_contract: str, - resource_name: str, - memo: Optional[str] = None, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(payments_invoices_contract, resource_name, memo, **kwargs) diff --git a/tools/dao_ext_timed_vault.py b/tools/dao_ext_timed_vault.py deleted file mode 100644 index 60c44025..00000000 --- a/tools/dao_ext_timed_vault.py +++ /dev/null @@ -1,188 +0,0 @@ -from typing import Any, Dict, Optional, Type -from uuid import UUID - -from langchain.tools import BaseTool -from pydantic import BaseModel, Field - -from tools.bun import BunScriptRunner - - -class GetAccountTermsInput(BaseModel): - """Input schema for getting timed vault terms.""" - - timed_vault_contract: str = Field( - ..., - description="Contract principal of the timed vault", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-timed-vault", - ) - - -class GetAccountTermsTool(BaseTool): - name: str = "dao_timedvault_get_account_terms" - description: str = ( - "Get the current terms of the DAO's timed vault. " - "Returns information about withdrawal limits, periods, and account holder." - ) - args_schema: Type[BaseModel] = GetAccountTermsInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - timed_vault_contract: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get account terms.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [timed_vault_contract] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/timed-vault/read-only", - "get-account-terms.ts", - *args, - ) - - def _run( - self, - timed_vault_contract: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to get account terms.""" - return self._deploy(timed_vault_contract, **kwargs) - - async def _arun( - self, - timed_vault_contract: str, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(timed_vault_contract, **kwargs) - - -class DepositSTXInput(BaseModel): - """Input schema for depositing STX.""" - - timed_vault_contract: str = Field( - ..., - description="Contract principal of the timed vault", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-timed-vault", - ) - amount: int = Field(..., description="Amount of STX to deposit in microstacks") - - -class DepositSTXTool(BaseTool): - name: str = "dao_timedvault_deposit_stx" - description: str = ( - "Deposit STX into the DAO's timed vault. " - "The amount should be specified in microstacks (1 STX = 1,000,000 microstacks)." - ) - args_schema: Type[BaseModel] = DepositSTXInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - timed_vault_contract: str, - amount: int, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to deposit STX.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [timed_vault_contract, str(amount)] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/timed-vault/public", - "deposit-stx.ts", - *args, - ) - - def _run( - self, - timed_vault_contract: str, - amount: int, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to deposit STX.""" - return self._deploy(timed_vault_contract, amount, **kwargs) - - async def _arun( - self, - timed_vault_contract: str, - amount: int, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(timed_vault_contract, amount, **kwargs) - - -class WithdrawSTXInput(BaseModel): - """Input schema for withdrawing STX.""" - - timed_vault_contract: str = Field( - ..., - description="Contract principal of the timed vault", - example="ST3YT0XW92E6T2FE59B2G5N2WNNFSBZ6MZKQS5D18.faces-timed-vault", - ) - - -class WithdrawSTXTool(BaseTool): - name: str = "dao_timedvault_withdraw_stx" - description: str = ( - "Withdraw STX from the DAO's timed vault. " - "This will withdraw the maximum allowed amount based on the account terms." - ) - args_schema: Type[BaseModel] = WithdrawSTXInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy( - self, - timed_vault_contract: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to withdraw STX.""" - if self.wallet_id is None: - return {"success": False, "message": "Wallet ID is required", "data": None} - - args = [timed_vault_contract] - - return BunScriptRunner.bun_run( - self.wallet_id, - "aibtc-dao/extensions/timed-vault/public", - "withdraw-stx.ts", - *args, - ) - - def _run( - self, - timed_vault_contract: str, - **kwargs, - ) -> Dict[str, Any]: - """Execute the tool to withdraw STX.""" - return self._deploy(timed_vault_contract, **kwargs) - - async def _arun( - self, - timed_vault_contract: str, - **kwargs, - ) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(timed_vault_contract, **kwargs) diff --git a/tools/tools_factory.py b/tools/tools_factory.py index b888915f..7125d2f7 100644 --- a/tools/tools_factory.py +++ b/tools/tools_factory.py @@ -9,44 +9,24 @@ from .agent_account import AgentAccountDeployTool from .bitflow import BitflowExecuteTradeTool -from .coinmarketcap import GetBitcoinData from .contracts import ContractSIP10InfoTool, FetchContractSourceTool -from .dao_deployments import ContractDAODeployTool from .dao_ext_action_proposals import ( ConcludeActionProposalTool, GetLiquidSupplyTool, GetProposalTool, - GetTotalVotesTool, + GetTotalProposalsTool, + GetVoteRecordTool, + GetVoteRecordsTool, + GetVetoVoteRecordTool, GetVotingConfigurationTool, GetVotingPowerTool, - ProposeActionAddResourceTool, - ProposeActionAllowAssetTool, ProposeActionSendMessageTool, - ProposeActionSetAccountHolderTool, - ProposeActionSetWithdrawalAmountTool, - ProposeActionSetWithdrawalPeriodTool, - ProposeActionToggleResourceTool, + VetoActionProposalTool, VoteOnActionProposalTool, ) from .dao_ext_charter import ( GetCurrentDaoCharterTool, - GetCurrentDaoCharterVersionTool, - GetDaoCharterTool, ) -from .dao_ext_core_proposals import ( - DeployCoreProposalTool, - GenerateCoreProposalTool, -) -from .dao_ext_payments_invoices import ( - GetInvoiceTool, - GetResourceByNameTool, - GetResourceTool, - PayInvoiceByResourceNameTool, - PayInvoiceTool, -) -from .dao_ext_timed_vault import DepositSTXTool as TimedVaultDepositSTXTool -from .dao_ext_timed_vault import GetAccountTermsTool, WithdrawSTXTool -from .dao_ext_treasury import GetAllowedAssetTool, IsAllowedAssetTool from .database import ( AddScheduledTaskTool, DeleteScheduledTaskTool, @@ -70,7 +50,6 @@ from .telegram import SendTelegramNotificationTool from .transactions import ( StacksTransactionByAddressTool, - StacksTransactionStatusTool, StacksTransactionTool, ) from .twitter import TwitterPostTweetTool @@ -123,56 +102,23 @@ def initialize_tools( logger.warning(f"Failed to get wallet for agent {agent_id}: {e}") tools = { - "coinmarketcap_get_market_data": GetBitcoinData(), + "bitflow_execute_trade": BitflowExecuteTradeTool(wallet_id), - "contracts_get_sip10_info": ContractSIP10InfoTool(wallet_id), - "contracts_deploy_dao": ContractDAODeployTool(wallet_id), + "contracts_fetch_sip10_info": ContractSIP10InfoTool(wallet_id), "contracts_fetch_source_code": FetchContractSourceTool(wallet_id), - "dao_coreproposals_generate_proposal": GenerateCoreProposalTool(wallet_id), - "dao_coreproposals_deploy_proposal": DeployCoreProposalTool(wallet_id), - "dao_actionproposals_conclude_proposal": ConcludeActionProposalTool(wallet_id), - "dao_actionproposals_get_liquid_supply": GetLiquidSupplyTool(wallet_id), - "dao_actionproposals_get_proposal": GetProposalTool(wallet_id), - "dao_actionproposals_get_total_votes": GetTotalVotesTool(wallet_id), - "dao_actionproposals_get_voting_configuration": GetVotingConfigurationTool( - wallet_id - ), - "dao_actionproposals_get_voting_power": GetVotingPowerTool(wallet_id), - "dao_actionproposals_vote_on_proposal": VoteOnActionProposalTool(wallet_id), - "dao_actionproposals_propose_add_resource": ProposeActionAddResourceTool( - wallet_id - ), - "dao_actionproposals_propose_allow_asset": ProposeActionAllowAssetTool( - wallet_id - ), - "dao_actionproposals_propose_send_message": ProposeActionSendMessageTool( - wallet_id - ), - "dao_actionproposals_propose_set_account_holder": ProposeActionSetAccountHolderTool( - wallet_id - ), - "dao_actionproposals_propose_set_withdrawal_amount": ProposeActionSetWithdrawalAmountTool( - wallet_id - ), - "dao_actionproposals_propose_set_withdrawal_period": ProposeActionSetWithdrawalPeriodTool( - wallet_id - ), - "dao_actionproposals_propose_toggle_resource": ProposeActionToggleResourceTool( - wallet_id - ), - "dao_timedvault_get_account_terms": GetAccountTermsTool(wallet_id), - "dao_timedvault_deposit_stx": TimedVaultDepositSTXTool(wallet_id), - "dao_timedvault_withdraw_stx": WithdrawSTXTool(wallet_id), - "dao_charter_get_current": GetCurrentDaoCharterTool(wallet_id), - "dao_charter_get_current_version": GetCurrentDaoCharterVersionTool(wallet_id), - "dao_charter_get_version": GetDaoCharterTool(wallet_id), - "dao_payments_get_invoice": GetInvoiceTool(wallet_id), - "dao_payments_get_resource": GetResourceTool(wallet_id), - "dao_payments_get_resource_by_name": GetResourceByNameTool(wallet_id), - "dao_payments_pay_invoice": PayInvoiceTool(wallet_id), - "dao_payments_pay_invoice_by_resource": PayInvoiceByResourceNameTool(wallet_id), - "dao_treasury_get_allowed_asset": GetAllowedAssetTool(wallet_id), - "dao_treasury_is_allowed_asset": IsAllowedAssetTool(wallet_id), + "dao_action_conclude_proposal": ConcludeActionProposalTool(wallet_id), + "dao_action_get_liquid_supply": GetLiquidSupplyTool(wallet_id), + "dao_action_get_proposal": GetProposalTool(wallet_id), + "dao_action_get_total_proposals": GetTotalProposalsTool(wallet_id), + "dao_action_get_veto_vote_record": GetVetoVoteRecordTool(wallet_id), + "dao_action_get_vote_record": GetVoteRecordTool(wallet_id), + "dao_action_get_vote_records": GetVoteRecordsTool(wallet_id), + "dao_action_get_voting_configuration": GetVotingConfigurationTool(wallet_id), + "dao_action_get_voting_power": GetVotingPowerTool(wallet_id), + "dao_action_veto_proposal": VetoActionProposalTool(wallet_id), + "dao_action_vote_on_proposal": VoteOnActionProposalTool(wallet_id), + "dao_charter_get_current_charter": GetCurrentDaoCharterTool(wallet_id), + "dao_propose_action_send_message": ProposeActionSendMessageTool(wallet_id), "database_add_scheduled_task": AddScheduledTaskTool(profile_id, agent_id), "database_get_dao_list": GetDAOListTool(), "database_get_dao_get_by_name": GetDAOByNameTool(), @@ -186,7 +132,6 @@ def initialize_tools( "lunarcrush_get_token_metrics": LunarCrushTokenMetricsTool(), "lunarcrush_search": SearchLunarCrushTool(), "lunarcrush_get_token_metadata": LunarCrushTokenMetadataTool(), - "stacks_get_transaction_status": StacksTransactionStatusTool(wallet_id), "stacks_get_transaction_details": StacksTransactionTool(wallet_id), "stacks_get_transactions_by_address": StacksTransactionByAddressTool(wallet_id), "stacks_get_contract_info": STXGetContractInfoTool(), diff --git a/tools/transactions.py b/tools/transactions.py index 431f798b..94ee8a75 100644 --- a/tools/transactions.py +++ b/tools/transactions.py @@ -7,57 +7,6 @@ from .bun import BunScriptRunner - -class StacksTransactionStatusInput(BaseModel): - """Input schema for checking Stacks transaction status.""" - - transaction_id: str = Field( - ..., description="The ID of the transaction to check the status for." - ) - - -class StacksTransactionStatusTool(BaseTool): - name: str = "stacks_transaction_status" - description: str = ( - "Get the current status of a Stacks blockchain transaction using its ID. " - "Returns success status and transaction details if available." - ) - args_schema: Type[BaseModel] = StacksTransactionStatusInput - return_direct: bool = False - wallet_id: Optional[UUID] = None - - def __init__(self, wallet_id: Optional[UUID] = None, **kwargs): - super().__init__(**kwargs) - self.wallet_id = wallet_id - - def _deploy(self, transaction_id: str, **kwargs) -> Dict[str, Any]: - """Execute the tool to check transaction status.""" - if self.wallet_id is None: - return { - "success": False, - "error": "Wallet ID is required", - "output": "", - } - try: - result = BunScriptRunner.bun_run( - self.wallet_id, - "stacks-transactions", - "get-transaction-status.ts", - transaction_id, - ) - return result - except Exception as e: - return {"output": None, "error": str(e), "success": False} - - def _run(self, transaction_id: str, **kwargs) -> Dict[str, Any]: - """Execute the tool to check transaction status.""" - return self._deploy(transaction_id, **kwargs) - - async def _arun(self, transaction_id: str, **kwargs) -> Dict[str, Any]: - """Async version of the tool.""" - return self._deploy(transaction_id, **kwargs) - - class StacksTransactionInput(BaseModel): """Input schema for retrieving detailed Stacks transaction information."""