ratio in process

This commit is contained in:
Samyak Jain 2019-06-16 19:35:30 +05:30
parent d4b16eb0e2
commit 89aa178b51

View File

@ -418,7 +418,12 @@ contract MakerHelper is Helper {
contract CompoundHelper is MakerHelper { contract CompoundHelper is MakerHelper {
address[] public cTokenAddr; struct CTokenData {
address cTokenAdd;
uint factor;
}
CTokenData[] public cTokenAddr;
event LogMint(address erc20, address cErc20, uint tokenAmt, address owner); event LogMint(address erc20, address cErc20, uint tokenAmt, address owner);
event LogRedeem(address erc20, address cErc20, uint tokenAmt, address owner); event LogRedeem(address erc20, address cErc20, uint tokenAmt, address owner);
@ -427,8 +432,8 @@ contract CompoundHelper is MakerHelper {
function getCompRatio() public returns (uint totalSupply, uint totalBorrow, uint ratio) { function getCompRatio() public returns (uint totalSupply, uint totalBorrow, uint ratio) {
for (uint i = 0; i < cTokenAddr.length; i++) { for (uint i = 0; i < cTokenAddr.length; i++) {
CTokenInterface cTokenContract = CTokenInterface(cTokenAddr[i]); CTokenInterface cTokenContract = CTokenInterface(cTokenAddr[i].cTokenAdd);
uint tokenPriceInEth = CompOracleInterface(getCompOracleAddress()).getUnderlyingPrice(cTokenAddr[i]); uint tokenPriceInEth = CompOracleInterface(getCompOracleAddress()).getUnderlyingPrice(cTokenAddr[i].cTokenAdd);
uint cTokenBal = cTokenContract.balanceOf(address(this)); uint cTokenBal = cTokenContract.balanceOf(address(this));
uint cTokenExchangeRate = cTokenContract.exchangeRateCurrent(); uint cTokenExchangeRate = cTokenContract.exchangeRateCurrent();
uint tokenSupply = wmul(cTokenBal, cTokenExchangeRate); uint tokenSupply = wmul(cTokenBal, cTokenExchangeRate);