dahlia-labs/squared

Onchain exchange for variance swaps.

Solidity

8

44 commits

updated Oct 30, 2025

See the code

README

Squared

The repository contains the smart contracts suite of Squared, an automated market maker that interacts with external lending markets to boostrap variance swaps on any ERC-20 token. The mechanism is competely onchain and works in the absence of an existing market and traditional market makers. Thereby enabling traders to hedge cryptocurrency volatilty and gamma risk associated with Uniswap liquidity provisioning. Beyond hedging, Squared acts as an oracle for realized volatility on any ERC-20 token.

The codebase is an implementation of the capped quadratic market maker that mimics a variance swap exposure. We were luckily enough to recieve a small grant from the Uniswap Foundation in 2022 to build Squared.

Installation

forge install dahlia-labs/squared

Local development

This project uses Foundry as the development framework.

Dependencies

forge install

@openzeppelin/contracts-upgrade
@transmissions11/solmate

CREATE2

The factory.sol deploys squared.sol to a predetermined address using .create2deploy()

Compilation

forge build

Test

forge test

Local setup

In order to test third party integrations such as interfaces, it is possible to set up a forked mainnet with several positions open

sh anvil.sh

then, in a separate terminal,

sh setup.sh
automated-market-maker
ethereum
hedging
solidity

Contributors

robertleifke

38 commits

kyscott18

6 commits

dahlia-labs/squared

Onchain exchange for variance swaps.

Solidity

8

44 commits

updated Oct 30, 2025

See the code

README

Squared

The repository contains the smart contracts suite of Squared, an automated market maker that interacts with external lending markets to boostrap variance swaps on any ERC-20 token. The mechanism is competely onchain and works in the absence of an existing market and traditional market makers. Thereby enabling traders to hedge cryptocurrency volatilty and gamma risk associated with Uniswap liquidity provisioning. Beyond hedging, Squared acts as an oracle for realized volatility on any ERC-20 token.

The codebase is an implementation of the capped quadratic market maker that mimics a variance swap exposure. We were luckily enough to recieve a small grant from the Uniswap Foundation in 2022 to build Squared.

Installation

forge install dahlia-labs/squared

Local development

This project uses Foundry as the development framework.

Dependencies

forge install

@openzeppelin/contracts-upgrade
@transmissions11/solmate

CREATE2

The factory.sol deploys squared.sol to a predetermined address using .create2deploy()

Compilation

forge build

Test

forge test

Local setup

In order to test third party integrations such as interfaces, it is possible to set up a forked mainnet with several positions open

sh anvil.sh

then, in a separate terminal,

sh setup.sh
automated-market-maker
ethereum
hedging
solidity

Contributors

robertleifke

38 commits

kyscott18

6 commits

Languages

Solidity

99.6%