Strike Validation Guide

This guide covers the validation functions for multi-leg option structures. These functions verify that strikes meet on-chain requirements before submitting RFQs.

Table of Contents

Overview

The on-chain option contracts enforce specific strike requirements for multi-leg structures. Submitting an RFQ with invalid strikes will cause the transaction to revert. Use these validation functions before submitting RFQs to catch errors early.

Importing

import {
  validateButterfly,
  validateCondor,
  validateIronCondor,
  validateRanger,
  type ValidationResult,
} from '@anthropic/thetanuts-sdk';

ValidationResult Type

All validation functions return a ValidationResult object:

Usage:

Validation Functions

validateButterfly

Validates strikes for CALL_FLYS and PUT_FLYS products.

On-Chain Requirement: The three strikes must be equidistant.

Examples:

On-Chain Reference: ButterflyCallSpreadOption.sol:71-74

validateCondor

Validates strikes for CALL_CONDOR and PUT_CONDOR products.

On-Chain Requirement: The two spread widths must be equal.

Examples:

On-Chain Reference: CallCondorOption.sol:69

validateIronCondor

Validates strikes for IRON_CONDOR products.

Strike Order: [putLower, putUpper, callLower, callUpper]

On-Chain Requirement: The put spread must not overlap with the call spread.

Examples:

On-Chain Reference: IronCondorOption.sol:77

validateRanger

Validates strikes for RANGER products.

Strike Order: [K0, K1, K2, K3]

On-Chain Requirements:

  1. All strike intervals must be equal: K1-K0 === K2-K1 === K3-K2

  2. There must be a gap between inner strikes: K1 < K2

Examples:

On-Chain Reference: RangerOption.sol:125-149

Error Handling

Best Practices

Always validate before calculating contracts or submitting RFQs:

Common Errors

Error
Cause
Solution

"requires exactly N strikes"

Wrong number of strikes

Check product type requirements

"must be equidistant"

Unequal intervals

Adjust strikes to be evenly spaced

"spread widths must be equal"

Condor with different widths

Make both spreads the same width

"must not overlap"

Iron condor spreads cross

Ensure putUpper <= callLower

"inner strikes must have gap"

Ranger with K1 >= K2

Ensure K1 < K2

Last updated