Home

Awesome

<p align="center"><img src="https://s3.amazonaws.com/dydx-assets/logo_large_white.png" width="256" /></p> <div align="center"> <a href="https://circleci.com/gh/dydxprotocol/workflows/solo/tree/master" style="text-decoration:none;"> <img src="https://img.shields.io/circleci/project/github/dydxprotocol/solo.svg" alt='CI' /> </a> <a href='https://www.npmjs.com/package/@dydxprotocol/solo' style="text-decoration:none;"> <img src='https://img.shields.io/npm/v/@dydxprotocol/solo.svg' alt='NPM' /> </a> <a href='https://coveralls.io/github/dydxprotocol/solo' style="text-decoration:none;"> <img src='https://coveralls.io/repos/github/dydxprotocol/solo/badge.svg?t=toKMwT' alt='Coverage Status' /> </a> <a href='https://github.com/dydxprotocol/solo/blob/master/LICENSE' style="text-decoration:none;"> <img src='https://img.shields.io/github/license/dydxprotocol/protocol.svg?longCache=true' alt='License' /> </a> <a href='https://t.me/joinchat/GBnMlBb9mQblQck2pThTgw' style="text-decoration:none;"> <img src='https://img.shields.io/badge/chat-on%20telegram-9cf.svg?longCache=true' alt='Telegram' /> </a> </div>

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 NameDescription
SoloMarginMain dYdX contract
PayableProxyForSoloMarginWETH wrapper proxy
DoubleExponentInterestSetterSets interest rates
PolynomialInterestSetterSets interest rates
ExpiryHandles account expiries
ExpiryV2Handles account expiries (version 2)
FinalSettlementHandles final settlement of all accounts
DaiPriceOraclePrice oracle for DAI or SAI
WethPriceOraclePrice oracle for WETH
UsdcPriceOraclePrice oracle for USDC
AdminImplSoloMargin library containing admin functions
OperationImplSoloMargin library containing operation functions
LiquidatorProxyV1ForSoloMarginProxy contract for liquidating other accounts
LimitOrdersContract for making limit orders using dYdX funds
StopLimitOrdersContract for making stop limit orders using dYdX funds
CanonicalOrdersContract for making canonical limit and canonical stop-limit orders using dYdX funds
SignedOperationProxyContract for sending signed operations on behalf of another account owner
RefunderAllows sending of funds to other accounts
DaiMigratorConverts 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 security@dydx.exchange. Please include the following details with your report:

Scope

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

Guidelines

We require that all reporters:

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

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