mirror of
https://github.com/Instadapp/dsa-resolvers-deprecated.git
synced 2024-07-29 22:38:16 +00:00
Added perSharePrice of ytoken
This commit is contained in:
parent
19d87d7cb2
commit
c5374d83b9
|
@ -13,6 +13,7 @@ interface ICurveZap {
|
||||||
}
|
}
|
||||||
|
|
||||||
interface YTokenInterface {
|
interface YTokenInterface {
|
||||||
|
function balanceOf(address) external view returns (uint256);
|
||||||
function getPricePerFullShare() external view returns (uint256 amount);
|
function getPricePerFullShare() external view returns (uint256 amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,6 +227,12 @@ contract Resolver is CurveHelpers {
|
||||||
unitAmt = getWithdrawtUnitAmt(token, tokenAmt, curveAmt, slippage);
|
unitAmt = getWithdrawtUnitAmt(token, tokenAmt, curveAmt, slippage);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct yTokenData {
|
||||||
|
uint yPoolBal;
|
||||||
|
uint tokenPoolbal;
|
||||||
|
uint sharePrice;
|
||||||
|
}
|
||||||
|
|
||||||
function getPosition(
|
function getPosition(
|
||||||
address user
|
address user
|
||||||
) public view returns (
|
) public view returns (
|
||||||
|
@ -233,10 +240,10 @@ contract Resolver is CurveHelpers {
|
||||||
uint totalSupply,
|
uint totalSupply,
|
||||||
uint virtualPrice,
|
uint virtualPrice,
|
||||||
uint userShare,
|
uint userShare,
|
||||||
uint poolyDaiBal,
|
yTokenData memory poolyDai,
|
||||||
uint poolyUsdcBal,
|
yTokenData memory poolyUsdc,
|
||||||
uint poolyUsdtBal,
|
yTokenData memory poolyUsdt,
|
||||||
uint poolyTusdBal,
|
yTokenData memory poolyTusd,
|
||||||
uint stakedBal,
|
uint stakedBal,
|
||||||
uint rewardsEarned,
|
uint rewardsEarned,
|
||||||
uint yfiBal
|
uint yfiBal
|
||||||
|
@ -247,10 +254,10 @@ contract Resolver is CurveHelpers {
|
||||||
userShare = wdiv(userBal, totalSupply);
|
userShare = wdiv(userBal, totalSupply);
|
||||||
ICurve curveContract = ICurve(getCurveSwapAddr());
|
ICurve curveContract = ICurve(getCurveSwapAddr());
|
||||||
virtualPrice = curveContract.get_virtual_price();
|
virtualPrice = curveContract.get_virtual_price();
|
||||||
poolyDaiBal = TokenInterface(curveContract.coins(0)).balanceOf(getCurveSwapAddr());
|
poolyDai = getCurveYBalance(curveContract.coins(0));
|
||||||
poolyUsdcBal = TokenInterface(curveContract.coins(1)).balanceOf(getCurveSwapAddr());
|
poolyUsdc = getCurveYBalance(curveContract.coins(1));
|
||||||
poolyUsdtBal = TokenInterface(curveContract.coins(2)).balanceOf(getCurveSwapAddr());
|
poolyUsdt = getCurveYBalance(curveContract.coins(2));
|
||||||
poolyTusdBal = TokenInterface(curveContract.coins(3)).balanceOf(getCurveSwapAddr());
|
poolyTusd = getCurveYBalance(curveContract.coins(3));
|
||||||
// Staking Details.
|
// Staking Details.
|
||||||
(stakedBal, rewardsEarned, yfiBal) = getStakingPosition(user);
|
(stakedBal, rewardsEarned, yfiBal) = getStakingPosition(user);
|
||||||
}
|
}
|
||||||
|
@ -265,6 +272,13 @@ contract Resolver is CurveHelpers {
|
||||||
rewardsEarned = stakingContract.earned(user);
|
rewardsEarned = stakingContract.earned(user);
|
||||||
yfiBal = TokenInterface(getYFItoken()).balanceOf(user);
|
yfiBal = TokenInterface(getYFItoken()).balanceOf(user);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getCurveYBalance(address tToken) public view returns (yTokenData memory ytoken) {
|
||||||
|
uint yPoolBal = YTokenInterface(tToken).balanceOf(getCurveSwapAddr());
|
||||||
|
uint sharePrice = YTokenInterface(tToken).getPricePerFullShare();
|
||||||
|
uint rawTokenPoolBal = wmul(yPoolBal, sharePrice);
|
||||||
|
return yTokenData(yPoolBal, rawTokenPoolBal, sharePrice);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user