> For the complete documentation index, see [llms.txt](https://liquify-6.gitbook.io/liquify-docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://liquify-6.gitbook.io/liquify-docs/technical-information/methods-and-manifests.md).

# Methods and Manifests

This page documents all methods available in the Liquify smart contract. Always interact through the Interface Component for stability.

***

## Instant Unstaking Methods

### liquify\_unstake

Instantly converts LSUs to XRD using available liquidity.

**Signature**

```rust
pub fn liquify_unstake(
    &mut self, 
    lsu_bucket: FungibleBucket, 
    max_iterations: u8
) -> (Bucket, FungibleBucket)
```

**Parameters**

**`lsu_bucket`** - LSUs from any Radix validator

* Minimum value: 0 XRD worth (configurable)
* Maximum value: 10,000,000 XRD worth (configurable)
* Must be native Radix validator LSU

**`max_iterations`** - Maximum liquidity positions to check

* Recommended: 25-30 for typical orders
* Maximum effective: \~50 (gas constraints)
* Higher = better price but more gas
* Each iteration: \~0.02 XRD gas cost

**Returns**

`(Bucket, FungibleBucket)` - Tuple containing:

1. XRD received (after discounts and fees)
2. Remaining LSUs if liquidity exhausted

**Order Matching Logic**

1. Iterates through liquidity positions by best discount first
2. Fills orders at progressively worse discounts
3. Stops when LSUs exhausted or iteration limit reached
4. Small orders (<1,000 XRD) only match non-automated positions

**Platform Fee**

* 0.05% deducted from XRD output
* Applied after discount calculation

#### liquify\_unstake Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw"
    Address("resource_tdx_2_1thx59p0wau0nqcp4ux96lupk7epnf8l8crcfpsv3s8hc2duy9zsspv")
    Decimal("100")
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1thx59p0wau0nqcp4ux96lupk7epnf8l8crcfpsv3s8hc2duy9zsspv")
    Bucket("lsu_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "liquify_unstake"
    Bucket("lsu_bucket")
    25u8
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

### liquify\_unstake\_off\_ledger

Unstakes using pre-computed order matching for optimal rates.

**Signature**

```rust
pub fn liquify_unstake_off_ledger(
    &mut self, 
    lsu_bucket: FungibleBucket, 
    order_keys: Vec<u128>
) -> (Bucket, FungibleBucket)
```

**Parameters**

**`lsu_bucket`** - LSUs to unstake

* Same limits as `liquify_unstake`
* Must be native Radix validator LSU

**`order_keys`** - Pre-computed AVL tree keys

* Source: From indexer or `get_raw_buy_list_range`
* Order: Best discount first for optimal pricing
* Format: 128-bit unsigned integers
* Invalid keys are skipped silently

**Returns**

`(Bucket, FungibleBucket)` - Tuple containing:

1. XRD received (after discounts and fees)
2. Remaining LSUs if liquidity exhausted

**Advantages Over On-Ledger**

* No iteration limit (can check 100+ positions)
* Optimal price discovery via off-chain computation
* More gas efficient for large orders
* Deterministic execution

#### liquify\_unstake\_off\_ledger Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw"
    Address("resource_tdx_2_1thx59p0wau0nqcp4ux96lupk7epnf8l8crcfpsv3s8hc2duy9zsspv")
    Decimal("100")
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1thx59p0wau0nqcp4ux96lupk7epnf8l8crcfpsv3s8hc2duy9zsspv")
    Bucket("lsu_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "liquify_unstake_off_ledger"
    Bucket("lsu_bucket")
    Array<U128>(
        340282366920938463463374607431768211456u128,
        340282366920938463463374607431768211457u128,
        340282366920938463463374607431768211458u128
    )
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

## Liquidity Provider Methods

### add\_liquidity

Deposits XRD to provide liquidity for instant unstaking.

**Signature**

```rust
pub fn add_liquidity(
    &mut self, 
    xrd_bucket: Bucket, 
    discount: Decimal, 
    auto_unstake: bool, 
    auto_refill: bool, 
    refill_threshold: Decimal,
    automation_fee: Decimal
) -> NonFungibleBucket
```

**Parameters**

**`xrd_bucket`** - Bucket containing XRD tokens

* Minimum: 10,000 XRD (configurable with owner badge)
* Maximum: No limit

**`discount`** - Discount rate as decimal (not percentage)

* Range: 0.00 to 0.05 (0% to 5%)
* Increments: 0.00025 (0.025% steps)
* Example: 0.01 = 1% discount

**`auto_unstake`** - Enable automatic unstaking of received LSUs

* `true`: LSUs are immediately unstaked and fills are returned as stake claim NFTs
* `false`: LSUs are held for manual collection

**`auto_refill`** - Enable automatic liquidity refilling

* Requires: `auto_unstake` must be `true`
* `true`: Claimable XRD automatically re-adds to liquidity when another use calls the&#x20;
* `false`: Manual processing required

**`refill_threshold`** - Minimum XRD to trigger auto-refill

* Minimum: 10,000 XRD (configurable by admin)
* Must be less than total position value
* Recommended: 50-90% of position size

**`automation_fee`** - XRD fee for automation processors

* Recommended: 5-10 XRD
* Higher fees = more incentive for others to help automate liquidity
* Paid per automation cycle

**Returns**

`NonFungibleBucket` - Liquidity Receipt NFT tracking your position

#### add\_liquidity Manifest

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw"
    Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
    Decimal("50000")
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
    Bucket("xrd_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "add_liquidity"
    Bucket("xrd_bucket")
    Decimal("0.01")
    true
    true
    Decimal("20000")
    Decimal("7")
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

### increase\_liquidity

Adds more XRD to an existing liquidity position.

**Signature**

```rust
pub fn increase_liquidity(
    &mut self, 
    receipt_bucket: Bucket, 
    xrd_bucket: Bucket
) -> Bucket
```

**Parameters**

**`receipt_bucket`** - Your Liquidity Receipt NFT

* Must contain exactly one NFT
* NFT must be from this Liquify instance

**`xrd_bucket`** - Additional XRD to add

* Current + new must be ≥ minimum liquidity (10,000 XRD)
* No maximum limit

**Returns**

`Bucket` - The same Liquidity Receipt NFT

**Effects**

* Position moves to back of queue at same discount level
* Maintains all automation settings

#### increase\_liquidity Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw_non_fungibles"
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#")
    )
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw"
    Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
    Decimal("20000")
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1tknxxxxxxxxxradxrdxxxxxxxxx009923554798xxxxxxxxxtfd2jc")
    Bucket("xrd_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "increase_liquidity"
    Bucket("receipt_bucket")
    Bucket("xrd_bucket")
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;

```

***

### remove\_liquidity

Withdraws available XRD from liquidity position(s).

**Signature**

```rust
pub fn remove_liquidity(
    &mut self, 
    liquidity_receipt_bucket: Bucket
) -> (Bucket, Bucket)
```

**Parameters**

**`liquidity_receipt_bucket`** - One or more Liquidity Receipt NFTs

* Can process multiple receipts in one transaction
* Only available liquidity is withdrawn

**Returns**

`(Bucket, Bucket)` - Tuple containing:

1. XRD withdrawn from all positions
2. Receipt NFTs returned&#x20;

**Effects**

* Only withdraws available liquidity (not in active orders)
* Removes positions from order queue
* Disables auto\_refill if enabled
* Fills for this receipt must be collected separately

#### remove\_liquidity Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw_non_fungibles"
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#"),
        NonFungibleLocalId("#456#")
    )
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "remove_liquidity"
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

### collect\_fills

Collects LSUs or stake claim NFTs from filled orders.

**Signature**

```rust
pub fn collect_fills(
    &mut self, 
    liquidity_receipt_bucket: Bucket, 
    number_of_fills_to_collect: u64
) -> (Vec<Bucket>, Bucket)
```

**Parameters**

**`liquidity_receipt_bucket`** - One or more Liquidity Receipt NFTs

* Processes receipts sequentially
* Stops when fill limit reached

**`number_of_fills_to_collect`** - Maximum fills to process

* Recommended: 50-100
* Each fill costs: \~0.03 XRD gas
* Applies across all receipts

**Returns**

`(Vec<Bucket>, Bucket)` - Tuple containing:

1. Vector of collected asset buckets
2. Receipt NFTs returned unchanged

**Collected Assets**

* If `auto_unstake=false`: Original LSUs
* If `auto_unstake=true`: Stake claim NFTs (unstake receipts)

**Multi-Receipt Processing**

* Processes receipts in order provided
* Continues until limit reached
* May partially process last receipt

#### collect\_fills Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw_non_fungibles"
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#"),
        NonFungibleLocalId("#456#")
    )
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "collect_fills"
    Bucket("receipt_bucket")
    50u64
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

## Automation Methods

### cycle\_liquidity

Processes automated liquidity refills for eligible positions.

**Signature**

```rust
pub fn cycle_liquidity(
    &mut self, 
    receipt_ids: Vec<NonFungibleLocalId>
) -> FungibleBucket
```

**Parameters**

**`receipt_ids`** - NFT IDs to process

* Format: Include hashes (e.g., "#123#")
* Maximum recommended: 5-10 per transaction
* Order: Process highest fee positions first

**Returns**

`FungibleBucket` - Collected automation fees in XRD

**Processing Logic**

1. Checks each receipt for eligibility:
   * `auto_refill` must be enabled
   * Claimable XRD ≥ `refill_threshold`
   * Has claimable fills (past unbonding)
2. Claims all XRD from stake claims
3. Deducts automation fee
4. Re-adds remaining XRD to liquidity
5. Moves position to back of queue

**Iteration Limits**

* Max fills per cycle: 50 (configurable by admin)
* Processes receipts sequentially
* Skips receipts that can't be fully processed
* Exception: First receipt can be partially processed

#### cycle\_liquidity Manifest&#x20;

```rust
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "cycle_liquidity"
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#"),
        NonFungibleLocalId("#456#"),
        NonFungibleLocalId("#789#"),
        NonFungibleLocalId("#1011#"),
        NonFungibleLocalId("#1213#")
    )
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

### update\_auto\_refill\_status

Toggles auto-refill for a position.

**Signature**

```rust
pub fn update_auto_refill_status(
    &mut self, 
    receipt_bucket: Bucket, 
    auto_refill: bool
) -> Bucket
```

**Parameters**

**`receipt_bucket`** - Single Liquidity Receipt NFT

**`auto_refill`** - New status

* Can only enable if `auto_unstake=true`
* Disabling removes from automation queue

**Returns**

`Bucket` - The same Receipt NFT

#### update\_auto\_refill\_status Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw_non_fungibles"
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#")
    )
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "update_auto_refill_status"
    Bucket("receipt_bucket")
    true
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

### update\_refill\_threshold

Changes refill threshold for a position.

**Signature**

```rust
pub fn update_refill_threshold(
    &mut self, 
    receipt_bucket: Bucket, 
    refill_threshold: Decimal
) -> Bucket
```

**Parameters**

**`receipt_bucket`** - Single Liquidity Receipt NFT

**`refill_threshold`** - New threshold in XRD

* Minimum: 10,000 XRD (configurable by admin)
* Must be less than total position value

**Returns**

`Bucket` - The same Receipt NFT

#### update\_refill\_threshold Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw_non_fungibles"
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#")
    )
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "update_refill_threshold"
    Bucket("receipt_bucket")
    Decimal("30000")
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

### update\_automation\_fee

Updates fee offered to automation processors.

**Signature**

```rust
pub fn update_automation_fee(
    &mut self, 
    receipt_bucket: Bucket, 
    automation_fee: Decimal
) -> Bucket
```

**Parameters**

**`receipt_bucket`** - Single Liquidity Receipt NFT

**`automation_fee`** - New fee in XRD

* Can be any positive amount
* Higher fees incentivize faster processing

**Returns**

`Bucket` - The same Receipt NFT

#### update\_automation\_fee Manifest&#x20;

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "withdraw_non_fungibles"
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Array<NonFungibleLocalId>(
        NonFungibleLocalId("#123#")
    )
;
TAKE_ALL_FROM_WORKTOP
    Address("resource_tdx_2_1n2nsqg5eaeq8xqhz38kxq5tznvsglddzlqdxcfj7tc6u8t02uan99n")
    Bucket("receipt_bucket")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "update_automation_fee"
    Bucket("receipt_bucket")
    Decimal("10")
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```

***

## Getter Methods

### get\_claimable\_xrd

Queries claimable XRD for a liquidity position.

**Signature**

```rust
pub fn get_claimable_xrd(
    &self, 
    receipt_id: NonFungibleLocalId
) -> (Decimal, u64, Decimal, Decimal)
```

**Parameters**

**`receipt_id`** - NFT ID with hashes (e.g., "#123#")

**Returns**

`(Decimal, u64, Decimal, Decimal)` - Tuple containing:

1. `claimable_now` - XRD claimable immediately
2. `total_fills` - Number of fills to collect
3. `stake_value` - Total value in stake claims
4. `lsu_value` - Total LSU redemption value

#### get\_claimable\_xrd Manifest&#x20;

```rust
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "get_claimable_xrd"
    NonFungibleLocalId("#123#")
;
```

***

### get\_receipt\_detail

Gets complete position information.

**Signature**

```rust
pub fn get_receipt_detail(
    &self, 
    receipt_id: NonFungibleLocalId
) -> ReceiptDetailData
```

**Parameters**

**`receipt_id`** - NFT ID with hashes (e.g., "#123#")

**Returns**

`ReceiptDetailData` - Complete position information:

```rust
struct ReceiptDetailData {
    receipt_id: NonFungibleLocalId,     // The NFT ID
    discount: Decimal,                  // Discount rate (0.01 = 1%)
    auto_unstake: bool,                 // Auto-unstake enabled
    auto_refill: bool,                  // Auto-refill enabled
    refill_threshold: Decimal,          // Refill trigger amount
    xrd_liquidity_available: Decimal,   // Available for orders
    xrd_liquidity_filled: Decimal,      // Historical volume
    liquidity_ahead: Decimal,           // XRD ahead in queue
    fills_to_collect: u64,              // Pending collections
    last_added_epoch: u32,              // Last modification
    claimable_xrd: Decimal,             // Claimable now
    total_stake_claim_value: Decimal,   // Total in stake claims
    total_lsu_redemption_value: Decimal,// Total LSU value
    automation_fee: Decimal             // Fee offered
}
```

***

#### get\_receipt\_detail Maniest

```rust
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "get_receipt_detail"
    NonFungibleLocalId("#123#")
;
```

### get\_raw\_buy\_list\_range

Returns raw order book data for indexing.

**Signature**

```rust
pub fn get_raw_buy_list_range(
    &self, 
    start_index: u64, 
    count: u64
) -> Vec<(u128, NonFungibleGlobalId)>
```

**Parameters**

**`start_index`** - Starting position in order book

* 0-based indexing
* Use for pagination

**`count`** - Number of entries to return

* Maximum limited by gas

**Returns**

`Vec<(u128, NonFungibleGlobalId)>` - Pairs of:

1. AVL tree key (encodes discount, auto\_unstake, position, ID)
2. Receipt global ID

**Key Structure**

```
[16 bits: discount][16 bits: auto_unstake][64 bits: position][32 bits: receipt_id]
```

#### get\_raw\_buy\_list\_range Manifest

```rust
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "get_raw_buy_list_range"
    0u64
    100u64
;
```

### get\_active\_liquidity\_positions

Returns detailed info for active positions.

**Signature**

```rust
pub fn get_active_liquidity_positions(
    &self, 
    start_index: u64, 
    count: u64
) -> Vec<ReceiptDetailData>
```

**Parameters**

**`start_index`** - Starting position

* 0-based indexing

**`count`** - Number to return

* Limited by gas

**Returns**

`Vec<ReceiptDetailData>` - Full details for each active position in order book

#### get\_active\_liquidity\_positions Manifest

```rust
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "get_active_liquidity_positions"
    0u64
    50u64
;
```

### get\_automation\_ready\_receipts

Finds positions ready for automated processing.

**Signature**

```rust
pub fn get_automation_ready_receipts(
    &self, 
    start_index: u64, 
    batch_size: u64
) -> Vec<AutomationReadyReceipt>
```

**Parameters**

**`start_index`** - Starting position in automation queue

* 1-based indexing
* Use for pagination

**`batch_size`** - Number to return

* Recommended: 10-20
* Maximum: 100
* Larger batches = more gas

**Returns**

`Vec<AutomationReadyReceipt>` - Ready positions with:

```rust
struct AutomationReadyReceipt {
    receipt_id: NonFungibleLocalId,
    discount: Decimal,
    fills_to_collect: u64,
    claimable_xrd: Decimal,
    refill_threshold: Decimal,
    automation_fee: Decimal
}
```

**Eligibility Criteria**

* Has `auto_refill` enabled
* Claimable XRD ≥ refill threshold
* Has matured stake claims

#### get\_automation\_ready\_receipts Manifest&#x20;

```rust
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "get_automation_ready_receipts"
    1u64
    20u64
;
```

## Admin Methods

### set\_component\_status

Enables or disables new liquidity deposits.

**Signature**

```rust
pub fn set_component_status(&mut self, status: bool)
```

**Authorization Required**: Owner badge

**Parameters**

**`status`** - Component status

* `false`: Prevents new `add_liquidity` calls
* `true`: Normal operation

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "set_component_status"
    true
;
```

***

### set\_platform\_fee

Sets the fee charged on unstaking operations.

**Signature**

```rust
pub fn set_platform_fee(&mut self, fee: Decimal)
```

**Authorization Required**: Owner badge

**Parameters**

**`fee`** - Fee as decimal

* Example: 0.0005 = 0.05%
* Reasonable range: 0.01% - 0.5%

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "set_platform_fee"
    Decimal("0.0005")
;
```

***

### set\_minimum\_liquidity

Sets minimum XRD required for liquidity positions.

**Signature**

```rust
pub fn set_minimum_liquidity(&mut self, min: Decimal)
```

**Authorization Required**: Owner badge

**Parameters**

**`min`** - Minimum XRD amount

* Default: 10,000 XRD
* Trade-off: Higher = more efficient, less accessible

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "set_minimum_liquidity"
    Decimal("10000")
;
```

***

### set\_unstake\_value\_range

Sets min/max values for unstaking operations.

**Signature**

```rust
pub fn set_unstake_value_range(
    &mut self, 
    min: Decimal, 
    max: Decimal
)
```

**Authorization Required**: Owner badge

**Parameters**

**`min`** - Minimum unstake value in XRD

* Default: 0 XRD

**`max`** - Maximum unstake value in XRD

* Default: 10,000,000 XRD

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "set_unstake_value_range"
    Decimal("0")
    Decimal("10000000")
;
```

***

### set\_small\_order\_threshold

Sets threshold for small order routing.

**Signature**

```rust
pub fn set_small_order_threshold(&mut self, threshold: Decimal)
```

**Authorization Required**: Owner badge

**Parameters**

**`threshold`** - XRD value threshold

* Default: 1,000 XRD
* Orders below only match manual positions

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "set_small_order_threshold"
    Decimal("1000")
;
```

***

### set\_max\_fills\_per\_cycle

Sets maximum fills processed per automation cycle.

**Signature**

```rust
pub fn set_max_fills_per_cycle(&mut self, max_fills: u64)
```

**Authorization Required**: Owner badge

**Parameters**

**`max_fills`** - Maximum fills per cycle

* Default: 50
* Trade-off: Higher = more gas, fewer transactions

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "set_max_fills_per_cycle"
    50u64
;
```

***

### collect\_platform\_fees

Withdraws accumulated platform fees.

**Signature**

```rust
pub fn collect_platform_fees(&mut self) -> Bucket
```

**Authorization Required**: Owner badge

**Returns**

`Bucket` - All accumulated platform fees in XRD

```rust
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "create_proof_of_amount"
    Address("resource_tdx_2_1tkckx9fynl0f3jfpntqxnzl6qc4w3jq96tqfslvdedwhaeseajtw9g")
    Decimal("1")
;
CALL_METHOD
    Address("component_tdx_2_1cz5zn7d5yl5usqvgmxcqpgztzhayes7nyt8vqy2y3huqujwclpxjfw")
    "collect_platform_fees"
;
CALL_METHOD
    Address("account_tdx_2_1298qr4yymzfvjfqn48f5k00r79snw695zln0lxele0c2jgrwsdhwkc")
    "deposit_batch"
    Expression("ENTIRE_WORKTOP")
;
```
