# Templar Liquidator Configuration # ============================================ # REQUIRED # ============================================ SIGNER_ACCOUNT_ID=your-account.near SIGNER_KEY=ed25519:YOUR_PRIVATE_KEY_HERE REGISTRY_ACCOUNT_IDS=v1.tmplr.near # ============================================ # NETWORK # ============================================ NETWORK=mainnet RPC_URL=https://free.rpc.fastnear.com # ============================================ # LIQUIDATION STRATEGY # ============================================ # Liquidation strategies (mutually exclusive - choose ONE): # 1. Percentage-based (default if neither is set): # - Set PARTIAL_LIQUIDATION_PERCENTAGE (1-100) # - Uses percentage of available liquidatable collateral per liquidation # - If not set, defaults to 100% (liquidate maximum allowed) # - Example: 50 = use 50% of available liquidatable collateral # 2. Fixed amount: # - Set FIXED_LIQUIDATION_AMOUNT_USD # - Uses a fixed USD amount per liquidation iteration # - Works across all USD-based markets (USDC, USDT, DAI, Stellar USDC via OMNI, etc.) # - Example: 100 = liquidate $100 USD worth per iteration # Percentage of available liquidatable collateral (1-100) # Mutually exclusive with FIXED_LIQUIDATION_AMOUNT_USD # If both not set, defaults to 100% # Example: 50 = use 50% of available liquidatable collateral per liquidation # PARTIAL_LIQUIDATION_PERCENTAGE=50 # Fixed liquidation amount in USD # Mutually exclusive with PARTIAL_LIQUIDATION_PERCENTAGE # Works across all USD-based markets regardless of decimals # The liquidator automatically converts to the correct raw units based on each market's asset decimals # Example: 100 = liquidate $100 USD worth per iteration # FIXED_LIQUIDATION_AMOUNT_USD=100 # Enable loop liquidation - repeatedly liquidate until position is healthy # When true and a position remains liquidatable after one liquidation, will continue # liquidating in a loop until position becomes healthy or runs out of funds # Default: false LOOP_LIQUIDATION=false # Maximum iterations for loop liquidation (safety limit to prevent infinite loops) # Only applies when LOOP_LIQUIDATION=true # Default: 10 MAX_LOOP_ITERATIONS=10 # Minimum profit margin in basis points # Examples: 50 = 0.5%, 100 = 1%, 200 = 2% # Default: 50 (0.5%) MIN_PROFIT_BPS=50 # ============================================ # COLLATERAL STRATEGY # ============================================ # Collateral strategy: "hold" or "swap-to-borrow" # - hold: Keep all received collateral (no swaps) # - swap-to-borrow: Swap collateral back to borrow assets (assets used for liquidations) # Default: hold COLLATERAL_STRATEGY=hold # ============================================ # SWAP PROVIDER CONFIGURATION # ============================================ # 1-Click API token (optional but recommended to avoid 0.1% fee) # ONECLICK_API_TOKEN=your_jwt_token_here # Ref Finance contract # Mainnet: v2.ref-finance.near # Testnet: v2.ref-dev.testnet REF_CONTRACT=v2.ref-finance.near # Minimum USD value to attempt a swap (JIT or batch) # Amounts below this threshold are skipped and left for the next batch swap cycle # Default: 10.0 MIN_SWAP_VALUE_USD=10.0 # Enable batch swap of accumulated collateral at the start of each liquidation round # When true, swaps all collateral holdings above MIN_SWAP_VALUE_USD before scanning for liquidations # Default: true BATCH_SWAP_ON_CYCLE_START=true # Maximum retry attempts for transient swap errors (includes first attempt) # Default: 3 SWAP_RETRY_ATTEMPTS=3 # Base delay in milliseconds for swap retry exponential backoff (2s, 4s, 8s …) # Default: 2000 SWAP_RETRY_BASE_DELAY_MS=2000 # ============================================ # INTERVALS # ============================================ # Liquidation scan interval (seconds) # How often to scan markets for liquidation opportunities # Default: 600 (10 minutes) LIQUIDATION_SCAN_INTERVAL=600 # Registry refresh interval (seconds) # How often to check for new markets # Default: 3600 (1 hour) REGISTRY_REFRESH_INTERVAL=3600 # ============================================ # OPTIONAL # ============================================ # Transaction timeout in seconds # Maximum time to wait for a transaction to complete # Default: 60 TRANSACTION_TIMEOUT=60 # Concurrency for operations # Maximum number of concurrent operations # Default: 10 CONCURRENCY=10 # ============================================ # MARKET FILTERING # ============================================ # Allowed collateral assets (comma-separated) # If specified, ONLY markets with these collateral assets will be processed # If empty, all assets are allowed (unless in ignored list) # Examples: # - NEP-141: nep141:btc.omft.near # - NEP-245: nep245:intents.near:nep141:btc.omft.near #ALLOWED_COLLATERAL_ASSETS=nep141:btc.omft.near,nep141:wrap.near # Ignored collateral assets (comma-separated) # Markets with these collateral assets will be filtered out # Examples: # - Ignore stNEAR: nep141:meta-pool.near # - Ignore LINEAR: nep141:linear-protocol.near IGNORED_COLLATERAL_ASSETS=nep141:meta-pool.near # ============================================ # TESTING & DEBUGGING # ============================================ # Dry run mode - scan and log without executing # When true, scans for liquidations but doesn't execute transactions # Default: false DRY_RUN=true # Logging RUST_LOG=info # ============================================ # ORACLE PRICE UPDATES # ============================================ # Pyth Hermes API URL for fetching latest price data # Mainnet: https://hermes.pyth.network # Testnet: https://hermes-beta.pyth.network # Default: https://hermes.pyth.network PYTH_HERMES_URL=https://hermes.pyth.network # Auto-update stale Pyth prices before liquidations # When enabled, the liquidator will fetch latest prices from Hermes and push to oracle if needed # Requires SIGNER_ACCOUNT_ID and SIGNER_KEY to be configured # Cost: ~0.001-0.002 NEAR per update transaction (unused deposit is refunded) # Default: false AUTO_UPDATE_PRICES=false