• This repository has been archived on 13/Jan/2023
  • Stars
    star
    418
  • Rank 103,606 (Top 3 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created almost 6 years ago
  • Updated over 2 years ago

Reviews

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

Repository Details

dYdX V2 Margin Trading Protocol

Ethereum Smart Contracts and TypeScript library used for the dYdX Solo Trading Protocol. Currently used by trade.dydx.exchange

Full Documentation at docs.dydx.exchange

Table of Contents

Documentation

Check out our full documentation at docs.dydx.exchange

Install

npm i -s @dydxprotocol/solo

Contracts

The current contract addresses can be found in deployed.json.

Contract Name Description
SoloMargin Main dYdX contract
PayableProxyForSoloMargin WETH wrapper proxy
DoubleExponentInterestSetter Sets interest rates
PolynomialInterestSetter Sets interest rates
Expiry Handles account expiries
ExpiryV2 Handles account expiries (version 2)
FinalSettlement Handles final settlement of all accounts
DaiPriceOracle Price oracle for DAI or SAI
WethPriceOracle Price oracle for WETH
UsdcPriceOracle Price oracle for USDC
AdminImpl SoloMargin library containing admin functions
OperationImpl SoloMargin library containing operation functions
LiquidatorProxyV1ForSoloMargin Proxy contract for liquidating other accounts
LimitOrders Contract for making limit orders using dYdX funds
StopLimitOrders Contract for making stop limit orders using dYdX funds
CanonicalOrders Contract for making canonical limit and canonical stop-limit orders using dYdX funds
SignedOperationProxy Contract for sending signed operations on behalf of another account owner
Refunder Allows sending of funds to other accounts
DaiMigrator Converts SAI positions to DAI positions

Security

Independent Audits

The smart contracts were audited independently by both Zeppelin Solutions and Bramah Systems.

Zeppelin Solutions Audit Report

Bramah Systems Audit Report

Code Coverage

All production smart contracts are tested and have 100% line and branch coverage.

Vulnerability Disclosure Policy

The disclosure of security vulnerabilities helps us ensure the security of our users.

How to report a security vulnerability?

If you believe you’ve found a security vulnerability in one of our contracts or platforms, send it to us by emailing [email protected]. Please include the following details with your report:

  • A description of the location and potential impact of the vulnerability.

  • A detailed description of the steps required to reproduce the vulnerability.

Scope

Any vulnerability not previously disclosed by us or our independent auditors in their reports.

Guidelines

We require that all reporters:

  • Make every effort to avoid privacy violations, degradation of user experience, disruption to production systems, and destruction of data during security testing.

  • Use the identified communication channels to report vulnerability information to us.

  • Keep information about any vulnerabilities you’ve discovered confidential between yourself and dYdX until we’ve had 30 days to resolve the issue.

If you follow these guidelines when reporting an issue to us, we commit to:

  • Not pursue or support any legal action related to your findings.

  • Work with you to understand and resolve the issue quickly (including an initial confirmation of your report within 72 hours of submission).

  • Grant a monetary reward based on the OWASP risk assessment methodology.

Development

Compile Contracts

Requires a running docker engine.

npm run build

Compile TypeScript

npm run build:js

Test

Requires a running docker engine.

Start test node:

docker-compose up

Deploy contracts to test node & run tests:

npm test

Just run tests (contracts must already be deployed to test node):

npm run test_only

Just deploy contracts to test node:

npm run deploy_test

Maintainers

License

Apache-2.0

More Repositories

1

liquidator

DEPRECATED [🤖💰 Bot to automatically liquidate dYdX accounts]
TypeScript
468
star
2

dydx-v3-python

Python client for dYdX (API v3)
Python
306
star
3

v4-chain

dydx v4 protocol
Go
221
star
4

protocol_v1

[DEPRECATED] Solidity Smart Contracts for the dYdX V1 Margin Trading Protocol
JavaScript
200
star
5

perpetual

Ethereum Smart Contracts and TypeScript library used for the dYdX Perpetual Contracts
TypeScript
170
star
6

dydx-python

dYdX Python Client for Limit Orders
Python
108
star
7

v3-client

TypeScript client for dYdX (v3 API).
TypeScript
108
star
8

v4-web

TypeScript
74
star
9

exchange-wrappers

💱🍬Collection of exchange wrapper contracts used by the dYdX Protocol
Solidity
70
star
10

v4-clients

JavaScript
61
star
11

starkex-lib

Cryptographic functions for dYdX (v3 API)
TypeScript
25
star
12

dydx.js

[DEPRECATED] TypeScript library for interacting with the dYdX V1 protocol
TypeScript
22
star
13

starkex-eth

library for interacting and parsing logs for the starkware smart contracts
TypeScript
22
star
14

v4-abacus

JavaScript
14
star
15

v4-documentation

MDX
11
star
16

v4-infrastructure

HCL
8
star
17

walletdirect

Direct communication between dApps and Wallets with deep links
Swift
7
star
18

v4-testnets

Shell
4
star
19

starkex-peripheral

Contracts for interacting with StarkEx-contracts
TypeScript
4
star
20

node-service-base-dev

Shared dev dependencies, development configuration, and utilities for Node libraries and services.
JavaScript
4
star
21

leverage-intuition

Jupyter Notebook
3
star
22

v4-localization

TypeScript
2
star
23

grpc-stream-client

Example Client for dYdX Full Node gRPC Streams
Python
2
star
24

v4-native-android

JavaScript
2
star
25

go-systemCheck

Go
1
star
26

systemCheck

TypeScript
1
star
27

py-systemCheck

Python
1
star
28

v4-latency-scripts

Python scripts that measure the latency of the dYdX chain software
Python
1
star
29

cartera-ios

Swift
1
star
30

v4-native-ios

JavaScript
1
star