• Stars
    star
    117
  • Rank 301,758 (Top 6 %)
  • Language
    TypeScript
  • License
    MIT License
  • Created over 3 years ago
  • Updated 16 days ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Synthetix v3

codecov

Package Coverage
@synthetixio/core-utils codecov
@synthetixio/core-contracts codecov
@synthetixio/core-modules codecov
@synthetixio/main codecov

Documentation

Please refer to the Official Documentation for high level concepts of the Synthetix v3 protocol, as well as auto generated docs from natspec.

Package structure

This is a monorepo with the following folder structure and packages:

.
├── markets                      // Standalone projects that extend the core Synthetix protocol with markets.
│   ├── legacy-market            // Market that connects Synthetix's v2 and v3 versions.
│   └── perps-market             // Market extension for perps.
│   └── spot-market              // Market extension for spot synths.
│   └── bfp-market               // Market extension for eth l1 perp.
│
├── protocol                     // Core Synthetix protocol projects.
│   ├── governance               // Governance contracts for on chain voting.
│   ├── oracle-manager           // Composable oracle and price provider for the core protocol.
│   └── synthetix                // Core protocol (to be extended by markets).
│
└── utils                        // Utilities, plugins, tooling.
    ├── common-config            // Common npm and hardhat configuration for multiple packages in the monorepo.
    ├── core-contracts           // Standard contract implementations like ERC20, adapted for custom router storage.
    ├── core-modules             // Modules intended to be reused between multiple router based projects.
    ├── core-utils               // Simple Javascript/Typescript utilities that are used in other packages (e.g. test utils, etc).
    ├── deps                     // Dependency handling (e.g. mismatched, circular etc.)
    ├── docgen                   // Auto-generate docs from natspec etc.
    ├── hardhat-storage          // Hardhat plugin used to detect storage collisions between proxy implementations.
    └── sample-project           // Sample project based on router proxy and cannon.

Router Proxy

All projects in this monorepo that involve contracts use a proxy architecture developed by Synthetix referred to as the "Router Proxy". It is basically a way to merge several contracts, which we call "modules", into a single implementation contract which is the router itself. This router is used as the implementation of the main proxy of the system.

See the Router README for more details.

⚠️ When using the Router as an implementation of a UUPS Universal Upgradeable Proxy Standard be aware that any of the public functions defined in the Proxy could clash and override any of the Router modules functions. A malicious proxy owner could use this type of obfuscation to have users run code which they do not want to run. You can imagine scenarios where the function names do not look similar but share a function selector. ⚠️

Information for Developers

If you intend to develop in this repository, please read the following items.

Installation Requirements

  • Foundry
  • NPM version 8
  • Node version 16

Console logs in contracts

In the contracts, use import "hardhat/console.sol";, then run DEBUG=cannon:cli:rpc yarn test.

Deployment Guide

Deployment of the protocol is managed in the synthetix-deployments repository.

To prepare for system upgrades, this repository is used to release new versions of the protocol and markets.

Preparing a Release

Setup Cannon

  • Run yarn upgrade-interactive and make sure that @usecannon/cli and hardhat-cannon and updated to the latest versions.
  • After installing for the first time, run yarn cannon:setup to configure a reliable IPFS URL for publishing packages and any other preferred settings.

Setup npm

  • Unless npm whoami returns an npm account with publishing permissions for the @synthetixio organization, confirm an @synthetixio npm publishing key is set as $NPM_TOKEN in the .env file or prepend NPM_TOKEN=_ to the command used for publishing below.

Publish Dev Release

  • Confirm you are on the development branch you’d like to release and that there are no git changes git diff --exit-code .
  • Publish the release with yarn publish:dev for the pre-release (no git tag, version looks like 1.2.3-<GIT_SHA>.0)
  • If you aren't using an EIP-1193 compatible wallet, prepend CANNON_PRIVATE_KEY=<PRIVATE_KEY> to the following command.
  • In the directory for each package you’d like to publish to cannon, run yarn deploy
  • After successful publish, there should be no diff in git. But if there is a diff - make sure you reset any changes, fix publishing issues and re-publish again. Double-check all the package.json files, revert dependencies' version changes back to "workspaces:*".

Publish Official Release

Each step is necessary, do not skip any steps.

  • Verify what has changed since the last release

    yarn changed
  • Confirm you are on the main branch and that there are no git changes git diff --exit-code . and you have write access to main branch

    git fetch --all
    git checkout main
    git pull
    git diff --exit-code .
  • Publish the release with yarn publish:release. (After successful publish, there should be no diff in git.)

  • If you aren't using an EIP-1193 compatible wallet, prepend CANNON_PRIVATE_KEY=<PRIVATE_KEY> to the following command.

  • In the directory for each package you’d like to publish to cannon, run yarn deploy

More Repositories

1

synthetix

Synthetix Solidity smart contracts
JavaScript
1,177
star
2

synpress

Synpress is e2e testing framework based on Cypress.io and playwright with support for metamask.
JavaScript
570
star
3

synthetix-exchange

The Synthetix Exchange dApp code
TypeScript
121
star
4

SIPs

The Synthetix Improvement Proposal repository
Jupyter Notebook
104
star
5

staking

A dAPP for minting, burning, and earning on the Synthetix Protocol.
TypeScript
81
star
6

synthetix-mintr

Synthetix's Mintr v2.0: Lock up SNX to mint sUSD, claim weekly SNX and sUSD rewards for staking in the system..
JavaScript
75
star
7

synthetix-js

[deprecated] Please use https://github.com/Synthetixio/js-monorepo/tree/master/packages/contracts-interface
JavaScript
63
star
8

synthetix-subgraph

All sources for the handful of Synthetix subgraphs indexed by The Graph
TypeScript
61
star
9

js-monorepo

Standard JS conventions and utilities for working with Synthetix
TypeScript
31
star
10

cannon

Develop and test your smart contracts with existing protocols and tools inspired by Docker and Terraform
TypeScript
28
star
11

synthetix-data

A utility to query for data on Synthetix usage
JavaScript
24
star
12

simulation

Agent-based model of the proposed stablecoin.
Python
23
star
13

codegen-graph-ts

Create generated code based on a subgraph from The Graph
TypeScript
21
star
14

synthetix-website

Synthetix website powered by next.js + typescript
TypeScript
17
star
15

synthetix-docs

System and developer documentation for Synthetix
JavaScript
17
star
16

snx-grants-dao

TypeScript
16
star
17

perps-keepers

Keepers incentivised to maintain health on Synthetix Perps
TypeScript
16
star
18

synthetix-node

JavaScript
12
star
19

synthetix-v3-labs

Free experimentation on v3 components
Solidity
11
star
20

number-guessing-game

Example market for Synthetix v3
Solidity
11
star
21

hardhat-interact

Execute commands on deployed contracts using a helpful TUI. Inspired by `hardhat inteteract` command on https://github.com/Synthetixio/synthetix
TypeScript
10
star
22

kwenta

DEPRECATED. Please use: https://github.com/Kwenta/kwenta
TypeScript
10
star
23

synthetix-assets

Synthetix Assets
10
star
24

v3ui

Synthetix V3 UI Monorepo
TypeScript
10
star
25

js

BETA: Javascript library for interacting with the Synthetix protocol
TypeScript
9
star
26

optimistic-trader

Demo app to script your L2 bot
JavaScript
9
star
27

synthetix-dashboard

Synthetix Dashboard website
CSS
9
star
28

futures-keepers

TypeScript
8
star
29

vanity-contract

Tool to mine vanity ETH contract address
JavaScript
8
star
30

synthetix-deployments

Infrastructure-as-code definition for Synthetix contracts on all of its deployed networks
JavaScript
7
star
31

python-sdk

A python SDK for interactions with the Synthetix protocol
Python
7
star
32

contract-linker

Auto-linking to Synthetix contracts
JavaScript
5
star
33

tokenvest

JavaScript
5
star
34

synthetix-sandbox

Solidity
5
star
35

docker-sec-tools

Docker container based on docker-node with security-oriented tools included.
Dockerfile
4
star
36

Synthetix-Gitbook-v3

4
star
37

bfp-market

swsteth <> 1x short eth. l1 perp
TypeScript
4
star
38

deprecated-whitepaper

DEPRECATED - The old Havven White Paper
TeX
4
star
39

snx-v3-prototype

TypeScript
4
star
40

data

Create and host a database replica of activity on the Synthetix protocol
HTML
4
star
41

synthetix-scripts

A set of cli utilities for the Synthetix protocol
JavaScript
4
star
42

docker-e2e

Docker container based on docker-node with e2e-related tools included.
Dockerfile
3
star
43

synthetix-shaula-frontend

UI to interact with the new Synthetix Shaula release containing Multi-Collateral Loans and Shorting features.
JavaScript
2
star
44

synthetix-utility

Utility smart contracts to be used with the Synthetix dApps
2
star
45

synthetix-translations

Synthetix Translations module! Internationalization inside the Synthetix dApp ecosystem
JavaScript
2
star
46

synthetix-delegate

Synthetix Delegate
TypeScript
2
star
47

example-rewards-distributor

Example repository for deploying a rewards distributor
Solidity
2
star
48

perps-event-decoder

Decode perps transaction events
JavaScript
2
star
49

docker-node

Docker containers based on official node images used across Synthetix repositories for CI purposes.
Dockerfile
2
star
50

utility-contracts

A collection of useful smart contract components. (internal)
Python
2
star
51

synthetix-router

TypeScript
2
star
52

spartan-council

Custom Contract for issuing NFT tokens for SIP 93: Supersede SIP-90 to Delegated Council Governance.
JavaScript
2
star
53

fork

Simple utility to fork the Synthetix protocol for testing and benchmarking
JavaScript
1
star
54

ui

react ui components
TypeScript
1
star
55

docker-shared

Shared resources used across Synthetix docker images.
JavaScript
1
star
56

js-template

A starter project for JS-based projects (predominantly nodejs)
JavaScript
1
star
57

safe-synthetix-module

Customization for Gnosis Safes used to govern Synthetix protocol
Solidity
1
star
58

snx-ambassadors-dapp

The dApp for the delegation of voting powers to the SNX Ambassadors
TypeScript
1
star
59

stats

TypeScript
1
star
60

roadmap

Roadmap
1
star
61

ipfs-follower

Scripts for automatic ipfs-cluster-follower node installation
Shell
1
star
62

v3-markets-prototype

TypeScript
1
star
63

litepapers

All the Synthetix Litepaper versions that have been published in the past.
1
star
64

cannon-plugin-router

Cannon Plugin for generating Router
JavaScript
1
star
65

Synthetix-Gitbook-Docs

1
star
66

perps-ecosystem

TypeScript
1
star
67

trusted-multicall-forwarder

ERC-2771 compliant trusted forwarder including Multicall3 functionality with error bubbling
Solidity
1
star
68

sample-v3-keeper

Prototype V3 keeper using the Synthetix Python SDK
Python
1
star
69

sdk-playground

Tools and scripts using the Synthetix python sdk
Python
1
star
70

erc7412

Reference implementation for ERC-7412
Solidity
1
star
71

providers

Javascript library for handling providers on Layer 1 & Optimism Layer 2
TypeScript
1
star
72

snax-core

1
star