Deploy and Build

This section lists the addresses of Valantis' core protocol contracts and Module factories. It also provides examples on how to deploy working Pools with Modules.

Deployments

Ethereum (mainnet)

Protocol Factory: 0x29939b3b2aD83882174a50DFD80a3B6329C4a603 Sovereign Pool Factory: 0xa68d6c59Cf3048292dc4EC1F76ED9DEf8b6F9617 Validly Factories: Deploy a Validly pool on Ethereum Mainnet LIVE Sovereign Pool - WETH/USDC HOT AMM Module: 0xD9a406DBC1a301B0D2eD5bA0d9398c4debe68202

Arbitrum

Protocol Factory: 0x7c4fdA6476c0fd90ef9FB13919615F37Fb61dC3A Sovereign Pool Factory: 0x8392E8F0fffE031B841Ba6db06c44F7Be3EE8F26 Validly Factories: Deploy a Validly pool on Arbitrum

LIVE Sovereign Pool - WETH/USDC HOT AMM Module: 0xc0c80150750d7a2852147b06c4fbc065bf1e0838

Ink

Protocol Factory: 0xe00eC9684c1f140a7E7319F66FdD4c99989FE330 Sovereign Pool Factory: 0xb2bB5c89aF186D88De011042063BB4e924031cbF Validly Factories: Deploy a Validly pool on Ink

Base

Protocol Factory: 0x739714B766b0e4Af30794980c4CB2A9150E6AeeC Sovereign Pool Factory: 0xcAC5E476a3cbE6545FB726ea4c583ace92fd5aab

Mantle

Sovereign Pool Factory: 0x739714B766b0e4Af30794980c4CB2A9150E6AeeC

Morph L2

Protocol Factory: 0xAfCEb567BcbA93C0922B22Cde454d9A6AADc3fc5 Sovereign Pool Factory: 0xb9cE972C7Ab91F22482cC2CAFb7badaf6F1F8949

Sovereign Pool: Build your own DEX

This example is for developers wanting to use Valantis' Sovereign Pool as base smart contract infrastructure in order to build a custom DEX on Ethereum mainnet.

// Valantis Protocol Factory on Ethereum mainnet
// IProtocolFactory can be imported from valantis-core: 
// https://github.com/ValantisLabs/valantis-core/blob/main/src/protocol-factory/interfaces/IProtocolFactory.sol
// Similar process for other EVM chains, only requires changing factory addresses.
IProtocolFactory protocolFactory = IProtocolFactory(0x29939b3b2aD83882174a50DFD80a3B6329C4a603);

// Initialize struct containing pool's initialization parameters.
// Can be imported from valantis-core:
// https://github.com/ValantisLabs/valantis-core/blob/main/src/pools/structs/SovereignPoolStructs.sol#L8-L20
SovereignPoolConstructorArgs poolArgs;

// Address of pool's token0 and token1.
poolArgs.token0 = 0x...;
poolArgs.token1 = 0x...;

// Address of pool manager
// This is only required to whitelist the Liquidity Module address after deployment,
// It can be reset to zero address afterwards (yielding an immutable pool)
poolArgs.poolManager = 0x...;

// This is the address where pool reserves are stored
// (e.g. any external Vault or Singleton).
// In this example we want to use the pool as the location of token0 and token1 reserves,
// similar to traditional DEXes which have pools as token pairs,
// hence pass it as zero address.
poolArgs.sovereignVault = address(0);

// The pool is configured with a constant swap fee of 5 basis-points.
// Pool manager can change this at any time by adding a custom Swap Fee Module.
poolArgs.defaultSwapFeeBips = 5;

// Deploy Sovereign Pool
address pool = protocolFactory.deploySovereignPool(poolArgs);

// As a developer, the pricing logic of your custom DEX was built as a Liquidity Module.
// See Sovereign Pool docs for more details about its required interface.
address liquidityModule = 0x...;

// Initialize the pool with the custom Liquidity Module deployment
pool.setALM(liquidityModule);

// (Optional), set other modules in the pool, such as Oracle Module or Swap Fee Module
// This is helpful in case there are other domain specific modules whose logic
// can be reused and composed with the Liquidity Module without any changes.

/// ...

// Make pool immutable by revoking pool manager role
pool.setPoolManager(address(0));

Validly Module: Deploy an AMM

Example on how to deploy a Sovereign Pool setup with the Validly Liquidity Module, configured to use Solidly's stable invariant formula, allowing low-slippage trading between USDC and USDT on Ethereum mainnet:

// Validly Factory address, 5 bips fee tier, on Ethereum mainnet
// IValidlyFactory can be imported from:
// https://github.com/ValantisLabs/Validly/blob/main/src/interfaces/IValidlyFactory.sol
IValidlyFactory validlyFactory = IValidlyFactory(0x1896d56F083ec50988d7F9edf204c2AE08b4409a);


// IMPORTANT: Ensure that token0 and token1 are ordered (token0 < token1)
// USDC
address token0 = 0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48;
// USDT
address token1 = 0xdAC17F958D2ee523a2206206994597C13D831ec7;

// Deploys the AMM logic using Solidly's stable invariant formula,
// suitable for low slippage trading between stablecoins
// See Validly docs and https://github.com/ValantisLabs/Validly/blob/main/src/Validly.sol#L347-L353
address isStable = true;

// Automatically deploys a Sovereign Pool with the Validly Liquidity Module
address validly = validlyFactory.createPair(token0, token1, isStable);

// Retrieve address of its respective Sovereign Pool
bytes32 poolKey = keccak256(abi.encode(token0, token1, isStable));
address pool = validlyFactory.pools(poolKey);

Last updated