From 2f83188cb9dbe86e6a3131189f6b4ea0e8c13aff Mon Sep 17 00:00:00 2001 From: michaelessiet Date: Fri, 10 Jan 2025 20:07:46 +0100 Subject: [PATCH] fix: add descriptions to some drift vault schemas --- src/actions/drift/createVault.ts | 60 ++++++++++++++++--- src/actions/drift/depositIntoVault.ts | 5 +- .../drift/requestWithdrawalFromVault.ts | 5 +- 3 files changed, 59 insertions(+), 11 deletions(-) diff --git a/src/actions/drift/createVault.ts b/src/actions/drift/createVault.ts index 8262f0a..c0702c3 100644 --- a/src/actions/drift/createVault.ts +++ b/src/actions/drift/createVault.ts @@ -11,7 +11,17 @@ const createDriftVaultAction: Action = { examples: [ [ { - input: {}, + input: { + name: "My Drift Vault", + marketName: "SOL-SPOT", + redeemPeriod: 30, + maxTokens: 1000, + minDepositAmount: 100, + managementFee: 10, + profitShare: 5, + hurdleRate: 0.1, + permissioned: false, + }, output: { status: "success", message: "Drift vault created successfully", @@ -23,15 +33,47 @@ const createDriftVaultAction: Action = { ], ], schema: z.object({ - name: z.string().min(5, "Name must be at least 5 characters"), + name: z + .string() + .min(5, "Name must be at least 5 characters") + .describe("Has to be unique. 2 Vaults can not have the same name."), // regex matches SOL-SPOT - marketName: z.string().regex(/^([A-Za-z0-9]{2,7})-SPOT$/), - redeemPeriod: z.number().int().min(1, "Redeem period must be at least 1"), - maxTokens: z.number().int().min(100, "Max tokens must be at least 100"), - minDepositAmount: z.number().positive(), - managementFee: z.number().positive().max(20), - profitShare: z.number().positive().max(90).optional().default(5), - handleRate: z.number().optional(), + marketName: z + .string() + .regex(/^([A-Za-z0-9]{2,7})-SPOT$/) + .describe('Market name must be in the format "TOKEN-SPOT"'), + redeemPeriod: z + .number() + .int() + .min(1, "Redeem period must be at least 1") + .describe( + "Number of days to wait before funds deposited in a vault can be redeemed ", + ), + maxTokens: z + .number() + .int() + .min(100, "Max tokens must be at least 100") + .describe( + "The maximum amount of tokens the vault will be accomodating. For example some vaults have a cap at 10 million USDC", + ), + minDepositAmount: z.number().positive().describe("Minimum deposit amount"), + managementFee: z + .number() + .positive() + .max(20) + .describe( + "How much of a fee you'll be taking to manage depositors funds. This is in percentage e.g 2 for 2%", + ), + profitShare: z + .number() + .positive() + .max(90) + .optional() + .default(5) + .describe( + "How much of the profit you'll be sharing with depositors. This is in percentage e.g 2 for 2%. Defaults to 5%", + ), + hurdleRate: z.number().optional(), permissioned: z .boolean() .optional() diff --git a/src/actions/drift/depositIntoVault.ts b/src/actions/drift/depositIntoVault.ts index 3c44bb3..5dcd477 100644 --- a/src/actions/drift/depositIntoVault.ts +++ b/src/actions/drift/depositIntoVault.ts @@ -26,7 +26,10 @@ const depositIntoDriftVaultAction: Action = { ], schema: z.object({ vaultAddress: z.string(), - amount: z.number().positive(), + amount: z + .number() + .positive() + .describe("The amount in tokens you'd like to deposit into the vault"), }), handler: async (agent: SolanaAgentKit, input) => { try { diff --git a/src/actions/drift/requestWithdrawalFromVault.ts b/src/actions/drift/requestWithdrawalFromVault.ts index 789c58d..1739803 100644 --- a/src/actions/drift/requestWithdrawalFromVault.ts +++ b/src/actions/drift/requestWithdrawalFromVault.ts @@ -26,7 +26,10 @@ const requestWithdrawalFromVaultAction: Action = { ], schema: z.object({ vaultAddress: z.string(), - amount: z.number().positive(), + amount: z + .number() + .positive() + .describe("Amount of shares you would like to withdraw from the vault"), }), handler: async (agent: SolanaAgentKit, input) => { try {