Source Files Overview

Latest v2 Source files could be found under this repo :

https://github.com/velocore/velocore-contracts

src/

This defines Vault, the core of Velocore V2. Vault does not trust pools.

Diamond.yul: This is a custom diamond proxy that the Vault address will hold.

VaultStorage.sol: An abstract contract inherited by all facets. It defines storage getters.

SwapFacet.sol: A facet incorporating the primary logic.

AdminFacet.sol: A facet with administrative and deployment logic.

NFTHolderFacet.sol: A facet that implements NFT transfer callbacks.

src/lib

RPow.sol: A library for squaring exponentiation from MakerDAO DSS.

PoolBalanceLib.sol: A library manipulating PoolBalance, a wrapped bytes32 holding two uint128 values. This is used for pool balances.

Token.sol: A library abstracting tokens, defining Token as a wrapped bytes32 with token specs, id, and address. It defines functions like transfer, balance over them.

UncheckedMemory.sol: Offers functions to bypass boundedness checks. Defines array.u(index) and array.u(index, value) as getter and setter. Used extensively.

src/pools

These are peripheral contracts interfacing with the Vault.

Satellite.sol: An abstract contract with common methods for Vault interaction.

SatelliteUpgradeable.sol: Inherits from Satellite and ERC1967Upgrade.

Pool.sol: Inherits from Satellite. It defines methods for Vault interaction as a Pool.

PoolWithLPToken.sol: Inherits from Pool. It's a simple pool that can mint ERC20 LP tokens.

SingleTokenGauge.sol: Inherits from Pool. It's a straightforward gauge with a single staking token.

src/pools/constant-product

pool and factory for constant-product amm.

ConstantProductPool.sol

ConstantProductPoolFactory

ConstantProductLibrary.sol: a singleton contract for precise but expensive calculation of swap operations. used as a fallback method for extreme cases. deployed separately to make the contract size < 24kb

src/pools/wombat

amm described in the Wombat whitepaper. there is no factory

src/pools/vc

VC, the emission token, and veVC, the ve token, is also a pool.

src/deployment/DumbProxy.yul

a minimal proxy respecting ERC1967 proxy slot. used for VC and veVC

Last updated