Invariant Function
The Invariant Function is the mathematical core of an automated market maker that defines the relationship between assets and remains constant during trades. Whether it is the simple constant product formula or a more complex multi-asset invariant, this function dictates how the pool behaves and how prices are calculated.
It acts as the ground truth for the smart contract, ensuring that the pool remains solvent and that all trades are executed according to the protocol's rules. By changing the invariant function, developers can create different types of markets, such as those for stablecoins or correlated assets, that offer unique trading characteristics.
It is the fundamental building block of the decentralized exchange architecture, enabling the automation of market making.