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

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

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

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

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

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

  • 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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

get_receipt_detail

Gets complete position information.

Signature

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:

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

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

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

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

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

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

get_automation_ready_receipts

Finds positions ready for automated processing.

Signature

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:

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

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

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

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

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%

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

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

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

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

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

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

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

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

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

pub fn collect_platform_fees(&mut self) -> Bucket

Authorization Required: Owner badge

Returns

Bucket - All accumulated platform fees in XRD

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")
;

Last updated