mirror of
				https://github.com/Instadapp/yield-contract.git
				synced 2024-07-29 21:47:29 +00:00 
			
		
		
		
	fixed Usdc exchange rate logic
This commit is contained in:
		
							parent
							
								
									cc548cfb69
								
							
						
					
					
						commit
						9eab74bc40
					
				| 
						 | 
					@ -115,22 +115,23 @@ contract UsdcRateLogic is DSMath {
 | 
				
			||||||
        _netBalInEth = add(_netBalInEth, amtInETH);
 | 
					        _netBalInEth = add(_netBalInEth, amtInETH);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    function getNetDsaAssets(address _dsa) private returns (uint256 _netBalInEth) {
 | 
					    function getNetDsaAssetsInEth(address _dsa) private returns (uint256 _netBalInEth) {
 | 
				
			||||||
        _netBalInEth = _dsa.balance;
 | 
					 | 
				
			||||||
        _netBalInEth += getCompoundNetAssetsInEth(_dsa);
 | 
					        _netBalInEth += getCompoundNetAssetsInEth(_dsa);
 | 
				
			||||||
        _netBalInEth += getMakerNetAssetsInEth();
 | 
					        _netBalInEth += getMakerNetAssetsInEth();
 | 
				
			||||||
        _netBalInEth += getCurveNetAssetsInEth(_dsa);
 | 
					        _netBalInEth += getCurveNetAssetsInEth(_dsa);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    function getTotalToken() public returns (uint256) {
 | 
					    function getTotalToken() public returns (uint256 usdcBal) {
 | 
				
			||||||
        address _dsa = 0x0000000000000000000000000000000000000000;
 | 
					        address _dsa = 0x0000000000000000000000000000000000000000;
 | 
				
			||||||
        PriceFeedInterface priceFeedContract = PriceFeedInterface(PriceFeedAddr);
 | 
					        PriceFeedInterface priceFeedContract = PriceFeedInterface(PriceFeedAddr);
 | 
				
			||||||
        uint usdcPriceInETH = priceFeedContract.getPrice(usdcAddr);
 | 
					        uint usdcPriceInETH = priceFeedContract.getPrice(usdcAddr);
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        uint256 balInEth = poolToken.balance;
 | 
					        TokenInterface usdcToken = TokenInterface(usdcAddr);
 | 
				
			||||||
        balInEth += getNetDsaAssets(_dsa);
 | 
					        usdcBal = usdcToken.balanceOf(_dsa);
 | 
				
			||||||
        uint balInUsdc = wdiv(balInEth, usdcPriceInETH);
 | 
					        usdcBal += TokenInterface(usdcAddr).balanceOf(poolToken);
 | 
				
			||||||
        return balInUsdc;
 | 
					
 | 
				
			||||||
 | 
					        uint balInEth = getNetDsaAssetsInEth(_dsa);
 | 
				
			||||||
 | 
					        usdcBal += wdiv(balInEth, usdcPriceInETH);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					@ -139,6 +140,5 @@ contract UsdcRateLogic is DSMath {
 | 
				
			||||||
        vaultId = _vaultId;
 | 
					        vaultId = _vaultId;
 | 
				
			||||||
        dsa = _dsa;
 | 
					        dsa = _dsa;
 | 
				
			||||||
        vaultUrn = ManagerLike(managerAddr).urns(_vaultId);
 | 
					        vaultUrn = ManagerLike(managerAddr).urns(_vaultId);
 | 
				
			||||||
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user