Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
100 commits
Select commit Hold shift + click to select a range
bc2f6b3
interactive adapters
mazaletskiy Dec 28, 2020
e07917b
update author tag
mazaletskiy Jan 5, 2021
f7759ca
Fix stake function
mazaletskiy Jan 14, 2021
bc9516a
DD-1744 Fix comments
mazaletskiy Jan 21, 2021
8bf707e
delete yarn.lock
mazaletskiy Jan 21, 2021
5547be8
Merge pull request #133 from akropolisio/interactive
cr-igor Jan 21, 2021
683693d
added audits
cr-igor Jan 21, 2021
472bf2c
feature: integrate stake-dao assets to zerion
smitrajput Mar 2, 2021
003c265
fix: put CRV as component token for sdveCrv
smitrajput Mar 5, 2021
18386db
refactor: remove setSdveCrv()
smitrajput Mar 5, 2021
a57fa6e
refactor: rename sdveCrv to SD_VECRV
smitrajput Mar 5, 2021
4465da0
implement G-UNI interactive adapter
kassandraoftroy Jul 28, 2021
1728d35
revert changes to package-lock
kassandraoftroy Jul 28, 2021
1551e4b
fixed g-uni tests
sobolev-igor Jul 28, 2021
76566f6
implement suggested changes
kassandraoftroy Jul 28, 2021
e02b5b8
Merge pull request #160 from superarius/gelato-guni
sobolev-igor Jul 28, 2021
f3eb5c8
Add docs
Nov 22, 2021
54e8216
Fix link
Nov 22, 2021
ade1446
Fix link
Nov 22, 2021
face15f
Add CI/CD for docs
Nov 23, 2021
478e4a2
Update docs only for specific paths
Nov 24, 2021
e4854f9
Fix README
Nov 24, 2021
e3dcf56
Merge pull request #167 from zeriontech/add-docs
sobolev-igor Mar 22, 2022
d2eac0e
Bump apollo-server-core from 3.6.4 to 3.11.1
dependabot[bot] Feb 9, 2023
5b51333
Bump json5 and @nomiclabs/hardhat-waffle
dependabot[bot] Feb 12, 2023
881a91e
WIP
sobolev-igor Mar 27, 2024
ae42e4f
Add Blast deployment
sobolev-igor Mar 27, 2024
856b448
minor improvements
sobolev-igor Jul 19, 2024
7283630
deploy to taiko
sobolev-igor Sep 11, 2024
8880be7
Create funding.json
sobolev-igor Jun 4, 2024
c97e53b
Update naming
sobolev-igor Sep 11, 2024
6b8e86b
new deployment
sobolev-igor Sep 12, 2024
397f6ad
Add mode deployment info
sobolev-igor Sep 13, 2024
6194a61
chore: v3 forks
exception Jun 18, 2024
4506192
chore: uniswap death
exception Sep 5, 2024
6b18aae
finalize uni v3 caller
sobolev-igor Sep 5, 2024
b4f6b7f
upd linters
sobolev-igor Sep 5, 2024
e828c02
deploy univ3 caller on base
sobolev-igor Sep 18, 2024
91746d9
Docs: Replacement of the link to the social network
sashaphmn Sep 27, 2024
d1057a5
Update README.md
sobolev-igor Sep 27, 2024
eb2e771
xlayer deployment
sobolev-igor Sep 27, 2024
0ee3a2b
add ethereum deployment
sobolev-igor Oct 23, 2024
4aad803
add new chains
sobolev-igor Mar 27, 2025
ac88411
add sonic deployment
sobolev-igor May 14, 2025
a563055
automate deployment
sobolev-igor Jul 14, 2025
2aa547e
try to fix ci
sobolev-igor Jul 14, 2025
74a1099
Fix linter issues
sobolev-igor Jul 14, 2025
aa0e524
migrate tests to ethers v6 and ts
sobolev-igor Jul 15, 2025
4a2fd5f
tweak 137 network deployment to be able to play around
sobolev-igor Jul 15, 2025
3108f78
latest improvements
sobolev-igor Jul 15, 2025
317b126
try to stabilize ci
sobolev-igor Jul 15, 2025
d17fe3f
fix env
sobolev-igor Jul 15, 2025
ace715a
fix deploy action
sobolev-igor Jul 15, 2025
f26fee0
simplify config
sobolev-igor Jul 15, 2025
aec67cd
upd safe deployment tx
sobolev-igor Jul 15, 2025
2a9fa8a
make action push updates
sobolev-igor Jul 15, 2025
18cfe53
Update deployment.json [skip ci]
actions-user Jul 15, 2025
488582d
restore production values
sobolev-igor Jul 15, 2025
e72ca19
add plasma addresses
sobolev-igor Oct 17, 2025
163f44b
add plasma network info
sobolev-igor Oct 17, 2025
af20f44
Update deployment.json [skip ci]
actions-user Oct 20, 2025
15bcea8
Add new entries to deployment.json
sobolev-igor Oct 28, 2025
08fdd2e
Add hyperevm to network configurations
sobolev-igor Oct 28, 2025
ae0902a
add hyperevm deployment
sobolev-igor Oct 28, 2025
29119e1
upd package-lock
sobolev-igor Oct 28, 2025
2602be3
try to fix gh actions
sobolev-igor Oct 28, 2025
5249aa2
Try to update package-lock
sobolev-igor Oct 29, 2025
0080a04
try to fix package-lock
sobolev-igor Oct 29, 2025
8b6ea93
rollback deps
sobolev-igor Oct 29, 2025
78aa281
Add Katana network configuration to Hardhat
sobolev-igor Oct 29, 2025
17ff1db
Add new address mapping for 747474
sobolev-igor Oct 29, 2025
ec583cf
Update deployment.json [skip ci]
actions-user Oct 29, 2025
2644b32
Create SECURITY.md (#1)
Dargon789 Oct 30, 2025
dfd8dc2
Add monad settings
sobolev-igor Nov 24, 2025
405623d
Update deployment.json [skip ci]
actions-user Nov 24, 2025
76cd76b
Add new addresses to deployment.json
sobolev-igor Feb 6, 2026
5f12e9e
Add new address mapping to deployment.json
sobolev-igor Feb 6, 2026
8d4b868
Add megaeth and somnia networks to configuration
sobolev-igor Feb 6, 2026
99948f0
Update deployment.json [skip ci]
actions-user Feb 6, 2026
6d96435
Update deployment.json [skip ci]
actions-user Feb 6, 2026
3ad55a7
Fix broken link to Router documentation in index.md
VolodymyrBg Jul 17, 2025
fd9119d
Potential fix for code scanning alert no. 8: Workflow does not contai…
Dargon789 Feb 27, 2026
c4c3dde
Merge branch 'router' into dependabot/npm_and_yarn/json5-and-json5-an…
Dargon789 Feb 28, 2026
2cbf2c6
Update issue templates (#4)
Dargon789 Feb 28, 2026
c7da332
Potential fix for code scanning alert no. 12: Workflow does not conta…
Dargon789 Feb 28, 2026
888b090
Update contracts/interactiveAdapters/Akropolis/AdelStakingInteractive…
Dargon789 Feb 28, 2026
2a40567
Update docs/interacting.md
Dargon789 Feb 28, 2026
90da9be
Update docs/interacting.md
Dargon789 Feb 28, 2026
ff937a6
Update docs/interacting.md
Dargon789 Feb 28, 2026
0179851
Update docs/creating-your-adapters/read-only-adapters.md
Dargon789 Feb 28, 2026
2d2d2d5
Update test/interactiveAdapters/GUniInteractiveAdapter.js
Dargon789 Feb 28, 2026
6f08ed2
Update test/interactiveAdapters/GUniInteractiveAdapter.js
Dargon789 Feb 28, 2026
8ace165
Potential fix for code scanning alert no. 12: Workflow does not conta…
Dargon789 Feb 28, 2026
c89b0aa
Merge remote-tracking branch 'upstream/router' into router
Dargon789 Feb 28, 2026
8d50938
Merge branch 'rounter-old' into router
Dargon789 Feb 28, 2026
fab35e1
Merge remote-tracking branch 'origin/interactive-v1' into router
Dargon789 Feb 28, 2026
e235707
Potential fix for code scanning alert no. 12: Workflow does not conta…
Dargon789 Feb 28, 2026
b03f35a
Merge branch 'router' into deppendabot-01
Dargon789 Feb 28, 2026
16bcf92
Merge branch 'pr/150' into router
Dargon789 Feb 28, 2026
28bfed5
Create jekyll-gh-pages.yml (#8)
Dargon789 Feb 28, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
---
name: Bug report
about: Create a report to help us improve
title: ''
labels: 'bug'
assignees: ''

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:
1. Go to '...'
2. Click on '....'
3. Scroll down to '....'
4. See error

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**
If applicable, add screenshots to help explain your problem.

**Desktop (please complete the following information):**
- OS: [e.g. iOS]
- Browser: [e.g. Chrome, Safari]
- Version: [e.g. 22]

**Smartphone (please complete the following information):**
- Device: [e.g. iPhone6]
- OS: [e.g. iOS8.1]
- Browser: [e.g. Chrome, Safari]
- Browser [e.g. stock browser, safari]
- Version [e.g. 22]

**Additional context**
Add any other context about the problem here.
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE/custom.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
name: Custom issue template
about: Describe the purpose of this custom issue here.
title: ''
labels: ''
assignees: ''

---


20 changes: 20 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
name: Feature request
about: Suggest an idea for this project
title: ''
labels: 'enhancement'
assignees: ''

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Describe alternatives you've considered**
A clear and concise description of any alternative solutions or features you've considered.

**Additional context**
Add any other context or screenshots about the feature request here.
51 changes: 51 additions & 0 deletions .github/workflows/jekyll-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
# Sample workflow for building and deploying a Jekyll site to GitHub Pages
name: Deploy Jekyll with GitHub Pages dependencies preinstalled

on:
# Runs on pushes targeting the default branch
push:
branches: ["router"]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: "pages"
cancel-in-progress: false

jobs:
# Build job
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Pages
uses: actions/configure-pages@v5
- name: Build with Jekyll
uses: actions/jekyll-build-pages@v1
with:
source: ./
destination: ./_site
- name: Upload artifact
uses: actions/upload-pages-artifact@v3

# Deployment job
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
70 changes: 70 additions & 0 deletions .github/workflows/techdocs.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
name: Publish Docs

permissions:
contents: read

on:
push:
branches:
- master
- add-docs
paths:
- "docs/**"
- "mkdocs.yml"

jobs:
publish-techdocs-site:
runs-on: ubuntu-latest
permissions:
contents: read

env:
TECHDOCS_S3_BUCKET_NAME: ${{ secrets.TECHDOCS_S3_BUCKET_NAME }}
PUBLIC_S3_BUCKET_NAME: ${{ secrets.PUBLIC_S3_BUCKET_NAME }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
ENTITY_NAMESPACE: 'default'
ENTITY_KIND: 'Domain'
ENTITY_NAME: 'defi-sdk'

steps:
- name: Checkout code
uses: actions/checkout@v2

- uses: actions/setup-node@v2
- uses: actions/setup-python@v2

- name: setup java
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: '11'
- name: download, validate, install plantuml and its dependencies
run: |
curl -o plantuml.jar -L http://sourceforge.net/projects/plantuml/files/plantuml.1.2021.4.jar/download
echo "be498123d20eaea95a94b174d770ef94adfdca18 plantuml.jar" | sha1sum -c -
mv plantuml.jar /opt/plantuml.jar
mkdir -p "$HOME/.local/bin"
echo $'#!/bin/sh\n\njava -jar '/opt/plantuml.jar' ${@}' >> "$HOME/.local/bin/plantuml"
chmod +x "$HOME/.local/bin/plantuml"
echo "$HOME/.local/bin" >> $GITHUB_PATH
sudo apt-get install -y graphviz

- name: Install techdocs-cli
run: sudo npm install -g @techdocs/cli

- name: Install mkdocs and mkdocs plugins
run: python -m pip install mkdocs-techdocs-core==0.*

- name: Generate docs site
run: techdocs-cli generate --no-docker --verbose

- name: Upload public docs
run:
aws s3 rm s3://$PUBLIC_S3_BUCKET_NAME/defi-sdk --recursive && aws s3 cp site/ s3://$PUBLIC_S3_BUCKET_NAME/defi-sdk --recursive

- name: Upload techdocs
run:
techdocs-cli publish --publisher-type=awsS3 --storage-name=$TECHDOCS_S3_BUCKET_NAME --entity=$ENTITY_NAMESPACE/$ENTITY_KIND/$ENTITY_NAME

2 changes: 2 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ jobs:
coverage:
name: test
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- name: checkout
uses: actions/checkout@v3
Expand Down
92 changes: 35 additions & 57 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,20 @@
![](https://i.ibb.co/7QCQKPD/MEDIUM-FINAL.png)
[![Build status](https://github.com/zeriontech/defi-sdk/workflows/build/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:build)
[![Test status](https://github.com/zeriontech/defi-sdk/workflows/test/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:test)
[![Coverage status](https://github.com/zeriontech/defi-sdk/workflows/coverage/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:coverage)
[![Lint status](https://github.com/zeriontech/defi-sdk/workflows/lint/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:lint)
[![Build status](https://github.com/zeriontech/protocol-wrappers/workflows/build/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:build)
[![Test status](https://github.com/zeriontech/protocol-wrappers/workflows/test/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:test)
[![Coverage status](https://github.com/zeriontech/protocol-wrappers/workflows/coverage/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:coverage)
[![Lint status](https://github.com/zeriontech/protocol-wrappers/workflows/lint/badge.svg)](https://github.com/zeriontech/defi-sdk/actions?query=workflow:lint)
[![License](https://badgen.net/github/license/zeriontech/defi-sdk)](https://www.gnu.org/licenses/lgpl-3.0.en.html)
[![Discord](https://badgen.net/badge/zerion/Zerion?icon=discord&label=discord)](https://zerion.io/discord)
[![Twitter Follow](https://img.shields.io/twitter/follow/zerion?style=social)](https://x.com/intent/follow?screen_name=zerion)
[![Discord](https://badgen.net/badge/zerion/Zerion?icon=discord&label=discord)](https://go.zerion.io/discord)
[![Twitter Follow](https://badgen.net/twitter/follow/zerion_io?icon=twitter)](https://twitter.com/intent/follow?screen_name=zerion_io)

**DeFi SDK** is an open-source system of smart contracts that allows you to execute trades with ERC20 tokens and track balances on different protocols.
**DeFi SDK** is an open-source system of smart contracts designed for precise DeFi portfolio accounting. To put it simply, DeFi SDK is the on-chain *balanceOf* for DeFi protocols.

If you have any questions about DeFi SDK, feel free to reach out to us on our [Discord server](https://zerion.io/discord).
If you have any questions about DeFi SDK, feel free to reach out to us on our [Discord server](https://go.zerion.io/discord).

![](https://i.ibb.co/RC54SjL/defisdk.png)

## Features

**💸Trade any ERC20 tokens on L2 chains using single Router contract**
> See [How to swap ERC20 tokens using DeFi SDK Router](docs/router.md)

**💥Query user assets and debt deposited in DeFi protocols like *Maker, Aave, dYdX*, etc.**
> How much debt does `0xdead..beef` have on Compound?

Expand All @@ -27,83 +24,64 @@ If you have any questions about DeFi SDK, feel free to reach out to us on our [D
**✨Interact with multiple DeFi protocols in a unified way**
> See [How to interact with DeFi SDK contracts](docs/interacting.md)

## Trading Features
## Addresses

* Trade any ERC20 token
* Two types of amounts: absolute (usual amount) and relative (percentage of balance)
* Three types of `permit()` functions for approving tokens in the same transaction (EIP2612, DAI-like, Yearn-like)
* Two types of swaps: with fixed input amount or fixed output amount
* Two types of fees:
* **protocol fee** managed by the **Router** contract owner with possibility of one-time discounts requiring signature of an address with the special role
* **marketplace fee** managed by the transaction creator
* Relayed transactions requiring just an EIP712 signature of the user
**AdapterRegistry** contract is deployed to the mainnet and its source code is verified on [etherscan](https://etherscan.io/address/0x06fe76b2f432fdfecaef1a7d4f6c3d41b5861672#code).

## How to Add Your Adapter
All the deployed contracts' addresses are available [here](docs/addresses.md).

> Read-only and interactive adapters are maintained in [`master`](https://github.com/zeriontech/defi-sdk/tree/master) and [`interactive-updates`](https://github.com/zeriontech/defi-sdk/tree/interactive-updates) branches of **defi-sdk** repo respectively.

The full instructions on how to add a custom adapters may be found in our [docs](docs/creating-your-adapters/index.md).
## How to Add Your Adapter

If you have questions and/or want to add your adapter to Zerion reach out to us on our [Discord server](https://zerion.io/discord).
The full instructions on how to add a custom adapter to the **AdapterRegistry** contract may be found in our [docs](docs/creating-your-adapters/index.md).

## Addresses
If you have questions and/or want to add your adapter to Zerion reach out to us on our [Discord server](https://go.zerion.io/discord).

All the deployed contracts' addresses are available [here](docs/addresses.md).

## Security Vulnerabilities 🛡

If you discover a security vulnerability within DeFi SDK, please send us an e-mail at inbox@zerion.io.
All security vulnerabilities will be promptly addressed.

The project uses [Slither](https://github.com/crytic/slither) for security analysis.
It should be previously installed (e.g. via [pip](https://pypi.org/project/pip/)).

Run `npm run slither` to run security checks.
If you discover a security vulnerability within DeFi SDK, please send us an e-mail at inbox@zerion.io. All security vulnerabilities will be promptly addressed.

## Dev Notes

We use [Hardhat](https://github.com/NomicFoundation/hardhat), which runs tests extremely fast!

Also, we use [Truffle Dashboard](https://trufflesuite.com/docs/truffle/getting-started/using-the-truffle-dashboard/) for secure deployment.

### Installation
This project uses Truffle and web3js for all Ethereum interactions and testing.

Run `npm install` to install all the dependencies.
### Set environment
Rename `.env.sample` file to `.env`, and fill in the env variables.

### Deployment
`MNEMONIC` and `INFURA_API_KEY` are required for `core` and `adapters` tests.
`PRIVATE_KEY` is required for `interactiveAdapters` tests.

Run `npm run truffle-dashboard` to start the Truffle Dashboard.
### Compile contracts

Run `npm run deploy:router:truffle-dashboard` to deploy the **Router** contract.
Sign deployment transaction in your browser at `http://localhost:24012/`.
`npm run compile`

Fill in address of newly deployed contract to `scripts/deployment.js`.
### Run tests

The same instruction applies to the **SimpleCaller** contract with `deploy:sc:truffle-dashboard` command.
`npm run test:core` for `core` tests.
`npm run test:adapters` for `adapters` tests.
`npm run test:interactiveAdapters` for `interactiveAdapters` tests.

After filling in fee beneficiary for the chosen network in `scripts/deployment.js`, `initialize:router:truffle-dashboard` command may be run.
### Run Solidity code coverage

Run `npm run verify` to verify contract on any block explorer.
The respective `<BLOCK_EXPLORER>_API_KEY` filled in `.env` file is required for this step.
See the `hardhat.config.ts` file for the details (`etherscan` field of `config` variable uses these API keys).
`npm run coverage`

### Testing & Coverage
Currently, unsupported files are ignored.

The **Router** contract and its dependencies is fully covered with tests.
### Run Solidity and JS linters

Run `npm run test` and `npm run coverage` to run tests or coverage respectively.
`REPORT_GAS` filled in `.env` file enables/disables gas reports during tests.
`npm run lint`

### Linting
Currently, unsupported files are ignored.

Run `npm run lint` for both JS and Solidity linters.
### Run all the migrations scripts

Run `npm run lint:eslint` and `npm run lint:solhint` to run linter for JS and Solidity separately.
`npm run deploy:network`, `network` is either `development` or `mainnet`.

### Serve docs

`npm run docs:serve`

## License

All smart contracts are released under GNU LGPLv3 license.
All smart contracts are released under GNU LGPLv3.
19 changes: 19 additions & 0 deletions SECURITY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Security Policy

## Supported Versions

Use this section to tell people about which versions of your project are
currently being supported with security updates.

| Version | Supported |
| ------- | ------------------ |
| 5.1.x | :white_check_mark: |
| 5.0.x | :x: |
| 4.0.x | :white_check_mark: |
| < 4.0 | :x: |

## Reporting a Vulnerability

If you discover a security vulnerability within DeFi SDK, please send us an e-mail at inbox@zerion.io.

All security vulnerabilities will be promptly addressed.
Binary file not shown.
Binary file not shown.
Loading