Constant Function

Definition ∞ A Constant Function, in the context of blockchain and decentralized finance, refers to a mathematical relationship that maintains a specific invariant property within a smart contract or automated market maker. This function ensures that certain conditions or ratios hold true despite changes in underlying variables. It is fundamental to the design of many liquidity pools and stablecoin mechanisms. The preservation of this invariant permits predictable asset exchange.
Context ∞ Understanding constant functions is vital for comprehending how decentralized exchanges and lending protocols maintain liquidity and manage asset prices without central intermediaries. News often covers exploits or vulnerabilities that arise when these functions are improperly implemented or when external market forces strain their invariant properties. The efficacy of a constant function directly impacts the stability and reliability of a DeFi protocol.