You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
**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.
11
14
12
15
If you have any questions about DeFi SDK, feel free to reach out to us on our [Discord server](https://go.zerion.io/discord).
13
16
14
17
## Features
15
18
16
-
#### 💥Query user assets and debt deposited in DeFi protocols like *Maker, Aave, Curve*, etc.
17
-
> How much debt does `0xdead..beef` have on Curve Y pool?
18
-
#### 📊Get the underlying components of complex derivative ERC20 tokens
19
+
20
+
#### 💥Query user assets and debt deposited in DeFi protocols like *Maker, Aave, dYdX*, etc.
21
+
> How much debt does `0xdead..beef` have on Compound?
22
+
#### 📊Get the underlying components of complex derivative ERC20 tokens
19
23
> How much `cUSDC` vs `ETH` does `ETHMACOAPY` have?
20
24
#### ✨Interact with multiple DeFi protocols in a unified way (coming soon)
21
25
> See [What’s next for DeFi SDK](#whats-next-for-defi-sdk-)
@@ -33,11 +37,14 @@ If you have any questions about DeFi SDK, feel free to reach out to us on our [D
33
37
34
38
### Fetch Compound debt and collateral
35
39
36
-
As of now, to get all cTokens along with a user's debt on Compound you need to perform over 10 calls to the Ethereum node to different contracts or rely on a centralized API. With DeFi SDK, you can call one function `getProtocolBalances(account, ["Compound"])` on the `api.zerion.eth` smart contract to get all borrowed and supplied tokens.
40
+
As of now, to get all cTokens along with a user's debt on Compound you need to perform over 10 calls to the Ethereum node to different contracts or rely on a centralized API. With DeFi SDK, you can call
Sometimes, a DeFi token contains several other tokens, and to calculate their price, you need to know their underlying assets. For example, a `Uniswap V1 cDAI pool` consists of `ETH` and `cDAI`. `cDAI`, in turn, has `DAI` as an underlying token. With DeFi SDK you can call
104
-
```solidity
111
+
112
+
```solidity
105
113
// Uniswap V1 cDAI pool
106
114
getFinalFullTokenBalance('0x34E89740adF97C3A9D3f63Cc2cE4a914382c230b', "Uniswap V1 pool token")
107
115
```
116
+
117
+
and fetch the decomposition of UNI-token into ERC20 tokens, like `ETH` and `DAI`
118
+
108
119
```javascript
109
-
100ETH
110
-
0.1DAI
120
+
0.98ETH
121
+
215.6DAI
111
122
```
112
-
and fetch the decomposition of UNI-token into ERC20 tokens, like `ETH` and `DAI`.
113
123
114
124
### Get account balances across all supported DeFi protocols
115
125
116
126
In case you want to get account balances across all supported DeFi protocols, you can call
|[Curve](./contracts/adapters/curve)| Exchange liquidity pool for stablecoin trading. Supports Compound, Y, and BUSD pools. |[Asset adapter](./contracts/adapters/curve/CurveAdapter.sol)|["Curve pool token"](contracts/adapters/curve/CurveTokenAdapter.sol)|
147
160
|[dYdX](./contracts/adapters/dydx)| Decentralized trading platform. All 4 markets (WETH, SAI, USDC, DAI) are supported. |[Asset adapter](./contracts/adapters/dydx/DyDxAssetAdapter.sol) <br> [Debt adapter](./contracts/adapters/dydx/DyDxDebtAdapter.sol)| — |
161
+
|[Idle](./contracts/adapters/idle)| Yield aggregator for lending platforms. |[Asset adapter](./contracts/adapters/idle/IdleAdapter.sol)|["IdleToken"](./contracts/adapters/idle/IdleTokenAdapter.sol)|
148
162
|[iearn.finance (v2/v3)](./contracts/adapters/iearn)| Yield aggregator for lending platforms. Protocol adapter is duplicated for v2 and v3 versions of protocol. |[Asset adapter](./contracts/adapters/iearn/IearnAdapter.sol)|["YToken"](./contracts/adapters/iearn/IearnTokenAdapter.sol)|
149
-
|[idle.finance](./contracts/adapters/idle)| Yield aggregator for lending platforms. |[Asset adapter](./contracts/adapters/idle/IdleAdapter.sol)|["IdleToken"](./contracts/adapters/idle/IdleTokenAdapter.sol)|
150
163
|[Chai](./contracts/adapters/maker)| A simple ERC20 wrapper over the Dai Savings Rate. |[Asset adapter](./contracts/adapters/maker/ChaiAdapter.sol)|["Chai token"](./contracts/adapters/maker/ChaiTokenAdapter.sol)|
151
164
|[DSR](./contracts/adapters/maker)| Decentralized lending protocol by MakerDAO. |[Asset adapter](./contracts/adapters/maker/DSRAdapter.sol)| — |
0 commit comments