> For the complete documentation index, see [llms.txt](https://delpho.gitbook.io/delpho-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://delpho.gitbook.io/delpho-docs/for-developers/write-functions.md).

# Write functions

This page describes the public write API for Delpho contracts.

\[PENDING: full ABI documentation to be populated from the deployed contract source.]

## Mint orchestrator

* `mint(address collateral, uint256 collateralAmount, uint256 mintAmount)` — deposit collateral and mint USDV.
* `addCollateral(address collateral, uint256 amount)` — deposit additional collateral to an existing position.
* `withdrawCollateral(address collateral, uint256 amount)` — withdraw collateral from an existing position. Bound by the maximum LTV.
* `repay(address collateral, uint256 amount)` — repay USDV against the debt.
* `closePosition(address collateral)` — repay all debt and withdraw all collateral.
* `setAutoDeleverage(address collateral, bool enabled)` — opt into or out of automatic deleveraging.

## sUSDV staking

* `stake(uint256 amount)` — stake USDV and receive sUSDV.
* `unstake(uint256 amount)` — return sUSDV and receive USDV plus accrued yield. Subject to the redemption window if any.

## Redemptions

* `redeem(uint256 usdvAmount)` — redeem USDV through the protocol's redemption ladder.

## Approvals

Standard ERC-20 `approve(spender, amount)` is required before calling `mint`, `stake`, or `repay` for the relevant tokens.

## Events

For event signatures and indexing patterns, see [Events and indexing](/delpho-docs/for-developers/events-and-indexing.md).
