Skip to main content
Function:
{package}::vault_api::create_and_fund_vault
ABI Object:
const functionAbi: MoveFunction = {
  name: "create_and_fund_vault",
  visibility: "private",
  is_entry: true,
  is_view: false,
  generic_type_params: [],
  params: [
    "&signer",
    "0x1::object::Object<{package}::dex_accounts::Subaccount>",
    "0x1::object::Object<0x1::fungible_asset::Metadata>",
    "0x1::string::String",
    "0x1::string::String",
    "vector<0x1::string::String>",
    "0x1::string::String",
    "0x1::string::String",
    "0x1::string::String",
    "u64",
    "u64",
    "u64",
    "u64",
    "bool",
    "bool",
  ],
  return: [],
};
Parameters:
  • signer - The account signer
  • funded_from_dex_subaccount - The subaccount used to fund the vault
  • contribution_asset_type - The fungible asset metadata for contributions
  • vault_name - Vault name (String)
  • vault_description - Vault description (String)
  • vault_social_links - Vault social links (vector of Strings). Array format: [xUrl, discordUrl] where each element is a string URL or empty string
  • vault_share_symbol - Vault share symbol (String)
  • vault_share_icon_uri - Vault share icon URI (String)
  • vault_share_project_uri - Vault share project URI (String)
  • fee_bps - Fee in basis points (u64). Maximum: 1000 (10%)
  • fee_interval_s - Fee interval in seconds (u64). Minimum: 2,592,000 (30 days). Maximum: 31,536,000 (365 days)
  • contribution_lockup_duration_s - Lockup duration in seconds (u64). Contributors cannot redeem until this period elapses
  • initial_funding - Initial funding amount (u64)
  • accepts_contributions - Whether vault accepts contributions (bool)
  • delegate_to_creator - Whether to delegate to creator (bool)
Example:
const transaction = await aptos.transaction.build.simple({
  sender: account.accountAddress,
  data: {
    function: `${PACKAGE}::vault_api::create_and_fund_vault`,
    typeArguments: [],
    functionArguments: [
      "0x123...abc", // subaccountAddr (funded_from_dex_subaccount)
      "0x456...def", // contributionAssetType (USDC metadata object address)
      "My Trading Vault", // vaultName
      "A managed vault for algorithmic trading strategies", // vaultDescription
      ["https://x.com/myvault", "https://discord.gg/myvault"], // vaultSocialLinks (vector: [xUrl, discordUrl])
      "MTV", // vaultShareSymbol
      "https://example.com/icon.png", // vaultShareIconUri
      "https://example.com/vault", // vaultShareProjectUri
      500, // feeBps (500 = 5%, max: 1000 = 10%)
      2592000, // feeIntervalS (30 days in seconds, min: 2,592,000, max: 31,536,000)
      0, // contributionLockupDurationS (0 = no lockup)
      100000000, // initialFunding (100 USDC with 6 decimals)
      true, // acceptsContributions
      true, // delegateToCreator
    ],
  },
});