fix: add descriptions to some drift vault schemas

This commit is contained in:
michaelessiet
2025-01-10 20:07:46 +01:00
parent 315ce64eed
commit 2f83188cb9
3 changed files with 59 additions and 11 deletions

View File

@@ -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()

View File

@@ -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 {

View File

@@ -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 {