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

# Nest Leverage Precheck

Validate and prepare a pUSD leverage loop on Plume Network (chain 98866). Checks balances, approvals, oracle price, Morpho liquidity, and simulates the loop. Ideal for: leverage strategies, yield optimization, DeFi automation on Plume.

![Nest Leverage Precheck logo](https://cdn.b3.fun/b3os-icons/plume.svg)
Catalog action EVM Onchain wallet Gas

Validate and prepare a pUSD leverage loop on Plume Network (chain 98866). Checks balances, approvals, oracle price, Morpho liquidity, and simulates the loop. Ideal for: leverage strategies, yield optimization, DeFi automation on Plume.

**Review wallet and value movement**

This action can require a wallet connector, gas, token movement, or an external side effect. Test with simulation or a controlled amount before using it in a live workflow.

## At a Glance

| Field | Value |
| --- | --- |
| Action ID | `nest-leverage-precheck` |
| Category | EVM Onchain |
| Connector | `wallet` |
| Requires gas | Yes |
| Funds movement | None declared |
| Tags | `defi`, `plume`, `leverage`, `lending`, `vault`, `morpho`, `onchain`, `yield` |

## Payload Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `initialCapital` | `string` | Yes | Initial pUSD capital in human-readable units \(e.g., "100" for 100 pUSD\). |
| `maxLoops` | `number` | No | Maximum number of leverage iterations \(default: 15\). |
| `safetyBufferBps` | `number` | No | Safety buffer in basis points below LLTV \(default: 200 = 2%\). |
| `minAmount` | `string` | No | Minimum pUSD amount per iteration in human-readable units \(default: "0.01"\). |

## Result Schema

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `canProceed` | `boolean` | Yes | Whether the leverage loop can proceed. |
| `reason` | `string` | No | Reason if canProceed is false. |
| `walletAddress` | `string` | No | The wallet address used. |
| `pusdBalance` | `string` | No | Current pUSD balance in wei. |
| `morphoLiquidity` | `string` | No | Available Morpho lending pool liquidity in wei. |
| `oraclePrice` | `string` | No | Morpho oracle price at ORACLE_PRICE_SCALE \(10^36\). |
| `exchangeRate` | `string` | No | Nest vault pUSD/nTBILL exchange rate at WAD scale. |
| `targetLtvWad` | `string` | No | Target LTV in WAD scale \(LLTV * \(1 - safetyBuffer\)\). |
| `initialCapitalWei` | `string` | No | Initial capital converted to wei. |
| `minAmountWei` | `string` | No | Minimum amount converted to wei. |
| `currentPosition` | `object` | No | Current Morpho position. |
| `simulation` | `object \| null` | No | Loop simulation results. Null when canProceed is false due to insufficient gas. |
| `iterationArray` | `array` | No | Array of iteration indices for for-each node. |
| `approvals` | `object \| null` | No | Token approval transaction hashes. Null when canProceed is false due to insufficient gas. |

## Examples

**Workflow node**

```json
{
  "type": "nest-leverage-precheck",
  "payload": {
    "initialCapital": "example-initialCapital"
  },
  "children": [],
  "connector": {
    "type": "wallet",
    "id": "conn_wallet"
  }
}
```
  **Test with API**

```bash
curl -X POST "https://api.b3os.org/v1/actions/nest-leverage-precheck/test" \
  -H "Authorization: Bearer YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "inputs": {
    "initialCapital": "example-initialCapital"
  }
}'
```

**Use expressions for dynamic values**

Payload fields can use workflow expressions such as `{{$trigger.body.amount}}`, `{{$nodes.fetch.result.price}}`, and `{{$props.asset}}` when the value should come from a trigger, prior node, or reusable workflow prop.