Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,12 @@
"jito",
"Jito",
"Offramp",
"offramp"
"offramp",
"offramps",
"zkcompression",
"ZKCompression",
"Tasktool",
"clippy"
],
"ignorePaths": [
"node_modules",
Expand Down
6 changes: 4 additions & 2 deletions light-token/defi/programs.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
description: "Build high-performance DeFi programs with rent-free accounts"
---

The Light-SDK pays rent-exemption for your PDAs, token accounts, and mints (98%

Check warning on line 6 in light-token/defi/programs.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/programs.mdx#L6

Did you really mean 'PDAs'?
cost savings). Your program logic stays the same.

## What Changes
Expand Down Expand Up @@ -271,7 +271,7 @@
</Accordion>

## Step 5: Instructions
Replace `spl_token` with `light_token` instructions as you need. The API is a superset of SPL-token so switching is straightforward.

Check warning on line 274 in light-token/defi/programs.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/programs.mdx#L274

Did you really mean 'superset'?

Examples include: `MintToCpi`, `TransferCpi`, `TransferInterfaceCpi`,
`CreateTokenAccountCpi`, and `CreateTokenAtaCpi`.
Expand Down Expand Up @@ -488,7 +488,7 @@
The SDK pays the rent-exemption cost. Inactive (cold) accounts auto-compress. Your program only ever interacts with hot accounts.
Clients can load cold accounts back when needed via `create_load_instructions`.

Under the hood, clients use `AccountInterface` - a superset of Solana's `Account` that unifies hot and cold state. See [Router Integration](./routers) for details.

Check warning on line 491 in light-token/defi/programs.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/programs.mdx#L491

Did you really mean 'superset'?

Check warning on line 491 in light-token/defi/programs.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/programs.mdx#L491

Did you really mean 'Solana's'?

| | Hot (active) | Cold (inactive) |
|---|---|---|
Expand All @@ -512,10 +512,12 @@
attacks, even if the account is currently cold. </Accordion>

<Accordion title="Who triggers compression?"> Miners automatically compress when
virtual rent is below threshold (eg 24h without write bump). </Accordion>
virtual rent is below threshold (e.g., multiple epochs without any writes). In
practice, cold markets should be rare. The common path (hot) has no extra
overhead and does not increase CU or txn size. </Accordion>

<Accordion title="Can active pools get compressed?">
No. Any write bumps the virtual rent balance. Active accounts never compress.
No. Any write bumps the virtual rent balance. Active accounts do not get compressed.
</Accordion>

<Accordion title="Do I need to run infrastructure?"> No. Helius and Triton run
Expand Down
11 changes: 7 additions & 4 deletions light-token/defi/routers.mdx
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
---
title: "Router Integration"
description: "Add support for rent-free AMMs on Solana."

Check warning on line 3 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L3

Did you really mean 'AMMs'?

Check warning on line 3 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L3

Did you really mean 'Solana'?
---

1. Use `get_account_interface` instead of `get_account` to store `AccountInterface`.
2. Use the AMM's LightProgramInterface trait to dynamically prepend load

Check warning on line 7 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L7

Did you really mean 'AMM's'?
instructions if the market is cold.


## Step 1: Use `get_account_interface`

`get_account_interface` is a new RPC endpoint that returns a superset of

Check warning on line 13 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L13

Did you really mean 'superset'?
`get_account`. `AccountInterface` stores additional info `Option<ColdContext>`
that you will need later.

Expand Down Expand Up @@ -46,7 +46,7 @@
This trait helps you:

1. Maintain a cache of `&[AccountInterface]`
2. Load cold accounts into the onchain account space when building Swap transactions.

Check warning on line 49 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L49

Did you really mean 'onchain'?

```rust
// Program implements this.
Expand Down Expand Up @@ -143,7 +143,7 @@
|------|--------|---------|
| `Rpc` trait | `light-client` | RPC client with `get_account_interface` methods |
| `AccountInterface` | `light-client` | Unified hot/cold account type |
| `LightProgramInterface` | `light-client` | Trait that program SDKs implement |

Check warning on line 146 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L146

Did you really mean 'SDKs'?
| `AccountSpec` | `light-client` | Specifies account load requirements |

### Reference Implementation
Expand All @@ -164,19 +164,22 @@
| Quote | Works | Works |
| Swap | Direct | Load first / Bundle |
| Latency | Normal | +0-200ms* |
| Tx size | Normal | +100-2400 bytes*|

Check warning on line 167 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L167

Did you really mean 'Tx'?
| CU | Normal | +15k-400k CU*|

Latency, tx size, and CU depend on the number and type of cold accounts.

Check warning on line 170 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L170

Did you really mean 'tx'?

### When does a market go cold?
A market is "cold" after it has been compressed by a miner. Accounts become
eligible for compression when inactive (e.g., after 24h without lamport bumps
from fee payers), causing the virtual rent balance to fall below threshold.
eligible for compression only after extended inactivity (e.g., multiple epochs
without any writes), causing the virtual rent balance to fall below threshold.

**In practice, cold markets should be rare.** The common path (hot) has no extra
overhead and does not increase CU or txn size.

Check warning on line 178 in light-token/defi/routers.mdx

View check run for this annotation

Mintlify / Mintlify Validation (luminouslabs-cc5545c6) - vale-spellcheck

light-token/defi/routers.mdx#L178

Did you really mean 'txn'?

**To ensure swaps execute regardless of whether the market is hot or cold,
always prepend `create_load_instructions` to the swap transaction. This no-ops
if the market is hot.**
always call `create_load_instructions` when building the swap instructions. It
simply no-ops if the market is hot.**

---
## Error Handling
Expand Down
Loading