Skip to content

Commit 22a1eb5

Browse files
committed
improve docs
1 parent 0b83607 commit 22a1eb5

12 files changed

+287
-703
lines changed

docs/addresses.md

+43-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
# Addresses
22

3+
## Router
4+
5+
Router address is [0xd7F1Dd5D49206349CaE8b585fcB0Ce3D96f1696F](https://blockscan.com/address/0xd7F1Dd5D49206349CaE8b585fcB0Ce3D96f1696F){target=_blank} on all the supported chains.
6+
37
## AdapterRegistry
4-
AdapterRegistry address is [0x06FE76B2f432fdfEcAEf1a7d4f6C3d41B5861672](https://etherscan.io/address/0x06fe76b2f432fdfecaef1a7d4f6c3d41b5861672){target=_blank}
58

6-
## Protocol Adapters
9+
AdapterRegistry address for read-only adapters is [0x06FE76B2f432fdfEcAEf1a7d4f6C3d41B5861672](https://etherscan.io/address/0x06fe76b2f432fdfecaef1a7d4f6c3d41b5861672){target=_blank}.
10+
11+
AdapterRegistry address for interactive adapters is [0xaDfc6460233221eCa99daC25d00f98d32eA3989e](https://etherscan.io/address/0xaDfc6460233221eCa99daC25d00f98d32eA3989e){target=_blank}.
12+
13+
## Read-only Protocol Adapters
714

815
| Contract Name | Address |
916
| :------------ | :------ |
@@ -51,3 +58,37 @@ AdapterRegistry address is [0x06FE76B2f432fdfEcAEf1a7d4f6C3d41B5861672](https://
5158
| UniswapV1TokenAdapter | [0xb260687cc277c0BFF48c9C482c16BC62f4eBa927](https://etherscan.io/address/0xb260687cc277c0BFF48c9C482c16BC62f4eBa927){target=_blank} |
5259
| ERC20TokenAdapter | [0x85609AfE45eE16e52aCB33b8AD103531fC959647](https://etherscan.io/address/0x85609AfE45eE16e52aCB33b8AD103531fC959647){target=_blank} |
5360

61+
## Interactive Adapters
62+
63+
| Contract Name | Address |
64+
| :------------ | :------ |
65+
| WETHAssetAdapter | [0x445830226347ef75867502e00e8D663842114F19](https://etherscan.io/address/0x445830226347ef75867502e00e8D663842114F19){target=_blank} |
66+
| UniswapAssetAdapter | [0xE1F28c0D8527eb28784bA15F6FF0A4371d7598E1](https://etherscan.io/address/0xE1F28c0D8527eb28784bA15F6FF0A4371d7598E1){target=_blank} |
67+
| UniswapExchangeAdapter | [0xE1F28c0D8527eb28784bA15F6FF0A4371d7598E1](https://etherscan.io/address/0xE1F28c0D8527eb28784bA15F6FF0A4371d7598E1){target=_blank} |
68+
| SushiSwapExchangeAdapter | [0x3b862d6f9ef92D3fF2142EC80A8968895B09127F](https://etherscan.io/address/0x3b862d6f9ef92D3fF2142EC80A8968895B09127F){target=_blank} |
69+
| CompoundAssetAdapter | [0xb8d9Ee15858799f9205a8d119C5050540feED6A5](https://etherscan.io/address/0xb8d9Ee15858799f9205a8d119C5050540feED6A5){target=_blank} |
70+
| AaveAssetAdapter | [0x77515760f30121Ea22D1cB9Fedcd5DD1BD8d3f15](https://etherscan.io/address/0x77515760f30121Ea22D1cB9Fedcd5DD1BD8d3f15){target=_blank} |
71+
| AaveV2AssetAdapter | [0x30EC4Ba79d951FA780b3B09158002854B6067847](https://etherscan.io/address/0x30EC4Ba79d951FA780b3B09158002854B6067847){target=_blank} |
72+
| CurveAssetAdapter | [0x1CeeA546AB6A3A3ee7Bc24cB1fac9e9Fe39a7368](https://etherscan.io/address/0x1CeeA546AB6A3A3ee7Bc24cB1fac9e9Fe39a7368){target=_blank} |
73+
| CurveExchangeAdapter | [0x8Da0A907a1bdbB440D1fdb450672a8C003bc4f3A](https://etherscan.io/address/0x8Da0A907a1bdbB440D1fdb450672a8C003bc4f3A){target=_blank} |
74+
| BalancerAssetAdapter | [0xD893569CEf4AE3603bb7d688ca9d9C7111706cb3](https://etherscan.io/address/0xD893569CEf4AE3603bb7d688ca9d9C7111706cb3){target=_blank} |
75+
| BalancerV2AssetAdapter | [0x6E02147cef2f078Da89f5913363C90420D934799](https://etherscan.io/address/0x6E02147cef2f078Da89f5913363C90420D934799){target=_blank} |
76+
| YEarnAssetAdapter | [0x3516CA4cB19ECcc401a9C0D13C7fDb6b73990979](https://etherscan.io/address/0x3516CA4cB19ECcc401a9C0D13C7fDb6b73990979){target=_blank} |
77+
| TokenSetRebalancingAssetAdapter | [0xab1C497D853296881FE65BeD48861eFD6CeB74Ee](https://etherscan.io/address/0xab1C497D853296881FE65BeD48861eFD6CeB74Ee){target=_blank} |
78+
| TokenSetNavAssetAdapter | [0x76Ee466c5957310cfB793AC21097FE5786665961](https://etherscan.io/address/0x76Ee466c5957310cfB793AC21097FE5786665961){target=_blank} |
79+
| TokenSetBasicAssetAdapter | [0xAd748736E9436C8CB155a1F37c725C5a5170ba4A](https://etherscan.io/address/0xAd748736E9436C8CB155a1F37c725C5a5170ba4A){target=_blank} |
80+
| BalancerMultiinputAssetAdapter | [0x0A1D55a66F89b683163FefC7AaCD83fECc9872B1](https://etherscan.io/address/0x0A1D55a66F89b683163FefC7AaCD83fECc9872B1){target=_blank} |
81+
| OneInchV2ExchangeAdapter | [0x2BcDedbEB99Fb3B9383Fd686faAbDb6172FC6503](https://etherscan.io/address/0x2BcDedbEB99Fb3B9383Fd686faAbDb6172FC6503){target=_blank} |
82+
| OneInchV3ExchangeAdapter | [0xe6189b3Ad3Fb3fAa87A336F00c93ECd3ac25d80d](https://etherscan.io/address/0xe6189b3Ad3Fb3fAa87A336F00c93ECd3ac25d80d){target=_blank} |
83+
| OneInchLPAssetAdapter | [0xD8f929FB13DAe09AAb49d812b8D0c80682d53696](https://etherscan.io/address/0xD8f929FB13DAe09AAb49d812b8D0c80682d53696){target=_blank} |
84+
| ZeroExExchangeAdapter | [0xe8C49A47f4385cCb6C90F5Fb0c0Aedc7E6e79EB0](https://etherscan.io/address/0xe8C49A47f4385cCb6C90F5Fb0c0Aedc7E6e79EB0){target=_blank} |
85+
| DodoAssetAdapter | [0xC9d30Ea2188eF0525b6328173FC9101539D2AA5A](https://etherscan.io/address/0xC9d30Ea2188eF0525b6328173FC9101539D2AA5A){target=_blank} |
86+
| DodoV2AssetAdapter | [0x278e57924Cd50cbE436586b35b8a1D5df9181165](https://etherscan.io/address/0x278e57924Cd50cbE436586b35b8a1D5df9181165){target=_blank} |
87+
| OUSDAssetAdapter | [0xAA048b52c765222008072472c5C2c2D47C02b4f1](https://etherscan.io/address/0xAA048b52c765222008072472c5C2c2D47C02b4f1){target=_blank} |
88+
| AlphaHomoraV2AssetAdapter | [0x31eb370a944213482B1B8990dC5A196d06b63F84](https://etherscan.io/address/0x31eb370a944213482B1B8990dC5A196d06b63F84){target=_blank} |
89+
| AmunBasketAssetAdapter | [0xe07C8e0f18083E66C65522Befc29887231ca3629](https://etherscan.io/address/0xe07C8e0f18083E66C65522Befc29887231ca3629){target=_blank} |
90+
| AmunLendingAssetAdapter | [0x784d97c29Ef870eB5D94c90B146d86d829384FC6](https://etherscan.io/address/0x784d97c29Ef870eB5D94c90B146d86d829384FC6){target=_blank} |
91+
| AmunLiquidityAssetAdapter | [0xc63e807bC6D65b84971b0A8CF8A673e551C9F85a](https://etherscan.io/address/0xc63e807bC6D65b84971b0A8CF8A673e551C9F85a){target=_blank} |
92+
| ZeroExOrdersV2ExchangeAdapter | [0x288C14e3C6ECC8EeeCb5DDAb9a600591b7aD966E](https://etherscan.io/address/0x288C14e3C6ECC8EeeCb5DDAb9a600591b7aD966E){target=_blank} |
93+
| GUniAssetAdapter | [0x57551aba668a66d07Ffed72f4c09c2dA5223E4e4](https://etherscan.io/address/0x57551aba668a66d07Ffed72f4c09c2dA5223E4e4){target=_blank} |
94+
| UniswapV3ExchangeAdapter | [0xC65756160866FCB7644e9AaC6C4B5832Da3A1c4b](https://etherscan.io/address/0xC65756160866FCB7644e9AaC6C4B5832Da3A1c4b){target=_blank} |

docs/architecture.md

+22-3
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,35 @@
11
# Architecture
22

3+
## Read-only adapters
4+
35
- **ProtocolAdapter** is a special contract for every protocol. Its main purpose is to wrap all the protocol interactions.
46
There are different types of protocol adapters:
57
- "Asset" adapter returns the amount of the account's tokens held on the protocol and the
68
- "Debt" adapter returns the amount of the account's debt to the protocol.
79

8-
Some protocols do not use "simple" ERC20 tokens but instead have complex derivatives, for example the Compound protocol has CTokens. The **ProtocolAdapter** contract also provides information about the type of tokens used within it.
10+
Some protocols do not use "simple" ERC20 tokens but instead have complex derivatives, for example the Compound protocol has CTokens.
11+
The **ProtocolAdapter** contract also provides information about the type of tokens used within it.
912

1013
- **TokenAdapter** is a contract for every derivative token type (e.g cTokens, aTokens, yTokens, etc.)
11-
Its main purpose is to provide ERC20-style token metadata as well as information about the underlying ERC20 tokens (like DAI for cDAI). Namely, it provides addresses, types and rates of underlying tokens.
14+
Its main purpose is to provide ERC20-style token metadata as well as information about the underlying ERC20 tokens (like DAI for cDAI).
15+
Namely, it provides addresses, types and rates of underlying tokens.
1216

1317
- **AdapterRegistry** is a contract that a) maintains a list of *ProtocolAdapters* and *TokenAdapters* and b) is called to fetch user balances.
1418

19+
More detailed documentation about contracts can be found in [reading](./reading.md) from DeFi SDK.
20+
21+
## Interactive adapters
22+
23+
- An interactive adapter is the unified interface for multiple protocols. It has two main functions:
24+
- `deposit()` function is used to deposit assets to a protocol.
25+
- `withdraw()` function is used to withdraw assets from a protocol.
26+
27+
More detailed documentation about contracts can be found in [interacting](./interacting.md) with DeFi SDK.
28+
29+
## Router
30+
31+
- Router contract is used for trades on multiple chains.
32+
It acts like a single endpoint for all the trades on L2 chains in Zerion.
33+
It uses multiple liquidity sources, interactive adapters may be used as one of liquidity source.
1534

16-
More detailed documentation about contracts can be found in [adapters](supported-protocols/read-only-adapters.md) and [AdapterRegistry](supported-protocols/adapter-registry.md) documentation.
35+
More detailed documentation about [Router](./router.md) contract.

docs/creating-your-adapters/index.md

-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ The fastest way for Zerion app to support your protocol is to create a DeFi SDK
88

99
Read-only adapters help Zerion track your protocol's data on-chain. By creating a read-only adapter, your protocol token and positions would be visible for all Zerion users. If you just need to integrate tracking of your protocol in Zerion, head over to the guide [here](read-only-adapters.md).
1010

11-
1211
## Create an interactive adapter
1312

1413
If you want to create a full support for your protocol in Zerion, you might want to create an interactive adapter for the DeFi SDK. Once you implement it and our team enables it on our side, Zerion users will be able to deposit and withdraw money from your protocol. Ready to get your protocol in front of all Zerion users? [Jump right in](interactive-adapters.md).
15-

docs/creating-your-adapters/interactive-adapters.md

-4
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,13 @@
55
!!! note ""
66
The current version of code for interactive adapters is placed in [`interactive-updates`](https://github.com/zeriontech/defi-sdk/tree/interactive-updates){target="_blank"} branch.
77

8-
98
To create new token adapter, one has to implement [**InteractiveAdapter**](https://github.com/zeriontech/defi-sdk/blob/interactive-updates/contracts/interactiveAdapters/InteractiveAdapter.sol){target="_blank"} interface. It inherits [**ProtocolAdapter**](https://github.com/zeriontech/defi-sdk/blob/interactive-updates/contracts/adapters/ProtocolAdapter.sol){target="_blank"}, so one has to implement it, too.
109

1110
**InteractiveAdapters** should implement 2 main functions: `deposit()` and `withdraw()`.
1211

1312
!!! note ""
1413
**InteractiveAdapters** should not have any storage variables used within deposit and withdraw functions. Use `internal constant` or `immutable constant`.
1514

16-
1715
```solidity
1816
function deposit(TokenAmount[] calldata tokenAmounts, bytes calldata data)
1917
external
@@ -27,7 +25,6 @@ function deposit(TokenAmount[] calldata tokenAmounts, bytes calldata data)
2725
!!! note ""
2826
Add `require()` if length of `tokenAmounts` should be fixed. Use the abbreviation of the contract name to use in `revert()`/`require()` errors \(later referred to as ABBR\_OF\_NAME\).
2927

30-
3128
Usually, `tokenAmounts` are decomposed in `token` and `amount` like that:
3229

3330
```solidity
@@ -70,4 +67,3 @@ Remove names of unused arguments.
7067
Use `npx prettier ./contracts/**/*.sol --write` to fix linter issues.
7168

7269
Add tests for interactions it `test/` directory, use Uniswap, Weth, and other required adapters.
73-

docs/creating-your-adapters/read-only-adapters.md

+1-7
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ To create new protocol adapter, one has to implement [ProtocolAdapter](https://g
1515
```solidity
1616
adapterType() returns (string)
1717
```
18+
1819
The function has no arguments and MUST return type of the adapter:
1920

2021
- "Asset" in case the adapter returns the amount of account's tokens held on the protocol;
@@ -35,8 +36,6 @@ getBalance(address token, address account) returns (int256)
3536

3637
The function has two arguments of `address` type: the first one is token address and the second one is account address. The function MUST return balance of given asset held on the protocol for the given account.
3738

38-
---
39-
4039
### `TokenAdapter`
4140

4241
To create new protocol adapter, one has to implement [TokenAdapter](https://github.com/zeriontech/defi-sdk/blob/master/contracts/adapters/TokenAdapter.sol){target="_blank"} interface.
@@ -62,15 +61,10 @@ The function has the only argument – token address. The function MUST return a
6261

6362
After the adapters are deployed and tested, one can contact Zerion team in order to add the adapters to **AdapterRegistry** contract.
6463

65-
---
66-
6764
### Tests
6865

6966
To get a PR merged, one should write tests for all the functions implemented. Examples may be found in the [repo](https://github.com/zeriontech/defi-sdk/tree/master/test){target="_blank"}.
7067

71-
---
72-
7368
### Migrations scripts
7469

7570
In case ProtocolAdapter should work with the short list of tokens, these tokens should be added to the list of supported tokens in ProtocolAdapterRegistry contract. In order to do that, one should add tokens in PR's comments.
76-

docs/index.md

+12-2
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,20 @@ If you have any questions about DeFi SDK, feel free to reach out to us on our [D
99
## Features
1010

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

1415
**📊Get the underlying components of complex derivative ERC20 tokens**
15-
> How much `cUSDC` vs `ETH` does `ETHMACOAPY` have?
16+
17+
How much `cUSDC` vs `ETH` does `ETHMACOAPY` have?
18+
19+
> Both cases are described in [How to get read-only data from DeFi SDK contracts](reading.md)
1620
1721
**✨Interact with multiple DeFi protocols in a unified way**
22+
23+
Use one interface to deposit tokens for lending, LP pools, etc.
24+
1825
> See [How to interact with DeFi SDK contracts](interacting.md)
26+
27+
**💸Trade on L2 chains using one contract**
28+
> Read [Router](router.md) documentation

0 commit comments

Comments
 (0)