Skip to main content

BiatecCLAMM Error Codes Reference

This document provides a comprehensive reference of all error codes used in the BiatecCLAMM smart contract system. Understanding these error codes will help developers debug issues and provide better user experiences.

Error Code Format

Error codes follow a consistent format:

  • Short codes: 3-4 character codes prefixed with E_ or ERR-
  • Example: E_CONFIG, ERR-LOW-VER

Core Contract Errors

BiatecClammPool

Configuration and Initialization Errors

CodeDescriptionCauseResolution
E_CONFIGConfiguration app mismatchProvided config app ID doesn't match registered configVerify correct config app reference
E_UPDATERNot authorized updaterSender is not the authorized updater addressUse correct updater account
E_SENDERUnauthorized senderSender not authorized for this operationUse authorized account (creator, executive, etc.)
E_PRICE_MAXBootstrap already calledCannot bootstrap twicePool already initialized
E_PRICEInvalid pricePrice must be greater than zeroSet valid price values
E_FEEBootstrap already doneFee already set, cannot bootstrap againPool already initialized
E_PAUSEDServices pausedProtocol is currently paused by adminWait for unpause or contact admin
E_STAKING_PRICEInvalid staking pool priceSame-asset pools require flat price rangeSet priceMin === priceMax for staking pools
E_PRICE_RANGEInvalid price intervalStandard pools require priceMin < priceMaxUse expanding price bounds
E_ASSET_ORDERInvalid asset orderAsset A must be less than Asset BEnsure assetA.id < assetB.id

Liquidity and Balance Errors

CodeDescriptionCauseResolution
E_ZERO_LIQZero liquidityLiquidity is zero before divisionEnsure pool has liquidity
E_ZERO_DENOMZero denominatorDenominator in calculation is zeroCheck input parameters
ERR-LIQ-DROPLiquidity drop exceededLiquidity decreased more than allowedCheck for rounding errors or state inconsistency
ERR-TOO-MUCHExcessive withdrawalAttempting to withdraw more than availableReduce withdrawal amount
ERR-BALANCE-CHECK-1Balance check failed (Asset A)Asset A balance inconsistentCheck pool state
ERR-BALANCE-CHECK-2Balance check failed (Asset B)Asset B balance inconsistentCheck pool state

Identity and Verification Errors

CodeDescriptionCauseResolution
ERR-INVALID-CONFIGInvalid config appConfig app doesn't match pool's registered configUse correct config app reference
ERR-WRONG-IDENTWrong identity providerIdentity provider doesn't match configUse correct identity provider
ERR-USER-LOCKEDUser account lockedUser account is locked by identity providerContact support to unlock
ERR-LOW-VERVerification class too lowUser's verification class below minimumComplete required KYC verification
ERR-HIGH-VERVerification class out of boundsVerification class exceeds maximum (4)Check identity provider data

Swap Errors

CodeDescriptionCauseResolution
E_ASSET_AInvalid Asset AAsset A doesn't match pool's Asset AUse correct asset
E_ASSET_BInvalid Asset BAsset B doesn't match pool's Asset BUse correct asset
Swaps not allowed in staking poolsSwap attempt in staking poolCannot swap in same-asset poolsUse add/remove liquidity instead
Minimum to receive is not metSlippage protection triggeredOutput less than minimumToReceiveIncrease slippage tolerance or retry

BiatecConfigProvider

CodeDescriptionCauseResolution
Only addressUdpater setup in the config can update applicationUnauthorized update attemptSender is not the updaterUse authorized updater address
E_PAUSEDServices pausedProtocol paused globallyWait for admin to unpause

BiatecIdentityProvider

CodeDescriptionCauseResolution
Configuration app does not matchConfig mismatchProvided config doesn't match registeredUse correct config app
Only addressUdpater setup in the config can update applicationUnauthorized updateNot the authorized updaterUse updater account
ERR_PAUSEDServices pausedProtocol currently pausedWait for unpause
FeeMultiplierBase must be set properlyInvalid fee multiplierFee multiplier must equal SCALESet feeMultiplierBase to SCALE (1000000000)
Verification class out of boundsInvalid verification classClass must be 0-4Use valid verification class

BiatecPoolProvider

CodeDescriptionCauseResolution
E_CONFIGConfig mismatchProvided config doesn't match registeredUse registered config app
Configuration app does not matchConfig app mismatchWrong config app providedVerify config app ID
Only addressUdpater setup in the config can update applicationUnauthorized updateSender not authorized updaterUse updater account
ERR_PAUSEDServices pausedProtocol is pausedWait for admin action
Pool already registeredDuplicate pool registrationPool or config already existsCheck existing pools

Common Error Scenarios

Pool Creation Failures

Error: E_STAKING_PRICE

Cause: Creating a staking pool (assetA === assetB) with priceMin !== priceMax
Solution: For staking pools, set priceMin = priceMax = 1000000000 (SCALE)

Error: E_CONFIG in deployPool

Cause: Attempting to deploy pool with non-registered config app
Solution: Use the canonical config app registered with the pool provider

Swap Failures

Error: ERR-LOW-VER

Cause: User's verification class insufficient for pool requirements
Solution: Complete additional KYC/identity verification to raise class

Error: Swaps not allowed in staking pools

Cause: Attempting to swap in a B-ALGO or B-USDC staking pool
Solution: Use distributeExcessAssets for rewards, add/remove liquidity only

Error: Minimum to receive is not met

Cause: Price moved unfavorably during transaction, slippage protection triggered
Solution: Increase minimumToReceive tolerance or wait for better price

Liquidity Provision Failures

Error: E_ZERO_LIQ

Cause: Attempting operation when pool has zero liquidity
Solution: Initialize pool with liquidity first

Error: ERR-LIQ-DROP

Cause: Liquidity calculation resulted in unacceptable decrease
Solution: Check for calculation errors or rounding issues

Administrative Operation Failures

Error: E_UPDATER or E_SENDER

Cause: Trying to perform admin function without proper authorization
Solution: Use the designated admin account (addressUpdater, addressExecutiveFee, etc.)

Error: E_PAUSED

Cause: Protocol-wide pause is active
Solution: Wait for admin to unpause services, or contact protocol governance

Error Handling Best Practices

For Developers

  1. Always Check Config: Ensure all app references (config, identity, pool provider) are correct
  2. Validate Inputs: Check asset IDs, amounts, and slippage parameters before submission
  3. Handle Pause State: Check if protocol is paused before attempting operations
  4. Use Try-Catch: Wrap contract calls in try-catch and parse error messages
  5. Log Errors: Log full error context for debugging

For Users

  1. Identity Verification: Ensure your account has sufficient verification class
  2. Slippage Tolerance: Set appropriate slippage protection for volatile markets
  3. Pool Type: Understand difference between liquidity pools and staking pools
  4. Account Status: Verify your account is not locked before transactions

Debugging Tips

Finding Error Context

When an error occurs:

  1. Check Transaction Logs: Use Algorand indexer to view transaction details
  2. Verify App References: Ensure all application IDs match expected values
  3. Check Global State: Read global state of config/identity/pool apps
  4. Inspect Box Storage: Verify box references are included in transaction
  5. Review Recent Changes: Check if protocol was recently updated or paused

Common Misconfigurations

  • Wrong Config App: Using testnet config on mainnet or vice versa
  • Missing Box References: Forgetting to include required box references
  • Incorrect App Order: Apps must be in correct order in foreign apps array
  • Insufficient Fees: Not enough fees for complex operations requiring opcode budget increases

Error Recovery

For Recoverable Errors

Most errors are recoverable by correcting the issue and retrying:

  • Identity verification: Complete required KYC
  • Config errors: Use correct app references
  • Slippage: Adjust tolerance and retry
  • Pause: Wait for services to resume

For Unrecoverable Errors

Some errors require admin intervention:

  • Account locked: Contact identity provider
  • Protocol paused: Wait for governance decision
  • Contract bugs: Report to developers

Support

If you encounter an error not documented here or need assistance:

  1. GitHub Issues: Open issue with full error details
  2. Documentation: Check docs/ folder for guides
  3. Audit Reports: Review audits/ folder for known issues
  4. Community: Join community channels for support

Last Updated: 2025-10-28 Version: 1.0 Maintained By: BiatecCLAMM Team