Synthetix Docs
  • User Docs
  • Synthetix Exchange
  • Leveraged Tokens
  • For Developers
  • Orientation
  • Synthetix Overview
  • Development Progress
  • V3 FAQ
  • For Developers
    • Technical Architecture
    • Quick Start
      • Base Quickstart
    • Smart Contracts
    • Data Platform
    • Data Dictionary
    • Addresses + ABIs
    • Deployment Info
      • Mainnet
      • Sepolia
      • Sepolia Carina
      • Optimism Mainnet
      • Base Mainnet Andromeda
      • Base Sepolia Andromeda
      • Arbitrum Mainnet
      • Arbitrum Sepolia
    • Smart Contract Audits
    • Perps Market
    • Spot Market
    • Developer FAQ
  • For Perp Integrators
    • 101
    • Perps V3
    • L1 Perp (BFP)
    • Base Andromeda
    • Perps Python SDK
    • Perps V3 Keepers
  • For Liquidity Integrators
    • Creating Accounts
    • Delegating Collateral
      • Liquidity Pools
    • Liquidity Positions
      • Minting and Burning snxUSD
      • Position Liquidations
    • Base LP Guide
  • For Liquidity Pool Managers
    • Creating and Configuring Pools and Vaults
    • Collateral Vaults
      • Vault Liquidations
    • Rewards Distributors
    • Credit and Debt Distribution
  • For Derivatives Market Builders
    • Build on v3
    • Market Development Guide
    • Build on v3 FAQ
    • Operating a Market
    • Registering a Market
  • For Governance Participants
    • Synthetix Governance
    • Elections
  • For Designers
    • Design Resources
Powered by GitBook
On this page
  • Router Generator
  • Storage Libraries
  • Video Overview
  1. For Developers

Technical Architecture

PreviousV3 FAQNextQuick Start

Last updated 10 months ago

Synthetix V3 consists of a collection of separate system. Each system includes a UUPS proxy contract, an automatically generated router contract, a series of module contracts, and a series of storage library contracts.

Router Generator

Router contracts are automatically generated using custom tooling which can be found in the utils/router folder in the Synthetix V3 repository. See the README there for more information.

Note that Etherscan does not yet have support for this proxy architecture when generating Read/Write Contract user interfaces. Instead, you can use a similar tool in the Cannon registry explorer.

Storage Libraries

Systems use a series of storage libraries, analogous to models in MVC frameworks. These contracts typically load and save a struct from a specified storage slot. See the Collateral Configuration storage library as an example.

Data runs a risk of corruption if a storage library is upgraded in an invalid way. (For example, rearranging the order of items in the struct will cause unintended side-effects.)

To protect against this, this Hardhat plug-in validates storage updates in the continuous integration pipeline.

Storage libraries are also not straightforward to interact with in unit testing. To help resolve this challenge, the plug-in also includes a generate-testable task which automatically creates a smart contract with getter and setter methods for the specified storage library.

Video Overview