> ## Documentation Index
> Fetch the complete documentation index at: https://docs.vanna.finance/llms.txt
> Use this file to discover all available pages before exploring further.

# Blend Controller

> Current testnet implementation, behavior, authorization, and Rust signatures.

BlendController supports `Supply` and `Withdraw` against the configured Blend pool and registered reserve tokens. It authenticates AccountManager, resolves token tracking metadata, and calls Blend through SmartAccount-authorized callbacks.

Supply uses Blend request type 0; withdraw uses type 1. Input amounts use WAD and are converted to reserve-native units. Receipt changes are derived from Blend positions and synchronized through authorized tracking-token operations and underlying caches.

`withdraw_all_to` batches reserve exits and sends underlying to the supplied recipient. Liquidation uses this path to pay Blend collateral directly to the liquidator. It verifies that requested supply positions have fully exited and burns remaining tracking receipts.

The contract exposes capability, execution, Registry, and admin-upgrade methods. The constructor argument order differs from ControllerFacade: verify the signatures below.

## Function signatures

These signatures are copied from the reviewed Rust implementation. `env` is supplied by Soroban and is not a transaction argument. `Result` errors and panics must be handled by the caller; simulation does not guarantee later execution. Public methods include privileged and internal-contract callbacks, not just user entrypoints.

### \_\_constructor

```rust theme={null}
pub fn __constructor(env: Env, registry: Address, admin: Address)
```

### upgrade

```rust theme={null}
pub fn upgrade(env: &Env, new_wasm_hash: BytesN<32>)
```

### can\_call

```rust theme={null}
pub fn can_call(
        env: &Env,
        target: Address,
        action: ExternalAction,
        tokens: Vec<Address>,
    ) -> (bool, Vec<Address>, Vec<Address>)
```

### execute

```rust theme={null}
pub fn execute(
        env: &Env,
        account: Address,
        action: ExternalAction,
        tokens: Vec<Address>,
        amounts: Vec<u128>,
        _min_out: u128,
    ) -> TokenDeltas
```

### withdraw\_all\_to

```rust theme={null}
pub fn withdraw_all_to(
        env: &Env,
        account: Address,
        recipient: Address,
        target: Address,
        tokens: Vec<Address>,
    )
```

### get\_registry

```rust theme={null}
pub fn get_registry(env: &Env) -> Address
```

## Source reference

* `Protocol_V1_Soroban_testnet/contracts/BlendControllerContract/src/controller.rs`
