Adds an API for vault owners to create a new vault by cloning an existing vault's configuration (type, capacity, rates, metadata, and multi-sig settings) while resetting all financial state.
Power users who run multiple similar vaults previously had to re-enter the same settings manually. Cloning copies the template configuration in one step and starts the new vault with zero deposits and a fresh approval count.
- #440:
POST /v1/vaults/:vaultId/clone— authenticated endpoint for vault owners VaultsService.cloneVaultFromTemplate— deep-copies config fields; resetstotalDeposits,status(ACTIVE), andcurrentApprovalsCloneVaultDto— optional customvaultName(defaults to{source name} (Copy))- Integration tests for success, custom name, not found, and unauthorized clone
- Authenticate as a user who owns a vault with non-default settings (capacity, interest, multi-sig, etc.).
POST /v1/vaults/{vaultId}/clonewith an empty body or{ "vaultName": "My Clone" }.- Expect
201and a new vault ID with matching config buttotalDeposits: 0,status: ACTIVE,currentApprovals: 0. GET /v1/vaults/my-vaults— confirm both source and clone appear.- Clone another user's vault — expect
401. - Clone a non-existent vault ID — expect
404.
N/A — API-only change.
- None.
Closes HarvestFinance#440
- Code builds successfully
- Tests added/updated
- No console errors
- Documentation updated (if needed)