---
# System prepended metadata

title: Untitled

---


GitHub 地址

https://github.com/dydxprotocol/solo


合约地址

MainNet

SoloMargin: 0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e


调用方法

获取 SoloMargin 实例

let solo;

SoloMargin.at('0x1E0447b19BB6EcFdAe1e4AE1694b0C3659614e4e').then((instance)=>{solo=instance})


获得实例地址

solo.address


获取现有市场数量

solo.getNumMarkets()


获取市场交易的代币地址

solo.getMarketTokenAddress(0) // WETH

solo.getMarketTokenAddress(1) // DAI


获取市场信息

solo.getMarket(1)


获取用户存入本金

solo.getAccountPar({owner:'0x32c6B5db05b98907A29BAeb7d09C79c95498B17a', number:0}, 1)


获取用户账户余额

solo.getAccountWei({owner:'0x32c6B5db05b98907A29BAeb7d09C79c95498B17a', number:0}, 1)

sign true是正的代表earn，false是负的代表lend


计算earn利率  //1代表DAI

earningsRate = solo.getEarningsRate()

interestRate = solo.getMarketInterestRate(1)

market = solo.getMarket(1)

borrow = market['totalPar']['borrow']

supply = market['totalPar']['supply']

secondRate = interestRate * ( borrow/supply ) * earningsRate
老版本

GitHub 地址：https://github.com/dydxprotocol/protocol_v1


合约地址：

Margin: 0x36bf21c8e661b21e6166e4385f574941fdc6caff

Vault: 0x5199071825CC1d6cd019B0D7D42B08106f6CF16D

TokenProxy: 0xeafd335c0e72bb89857972ee7a3ba90bd5a2f7fd


ETHWrapperForBucketLender: 0x4E28E1933d0d5AE3B1951b07648d245b2811Cf14