add dodoBalanceOf and fix balanceOf
This commit is contained in:
@@ -221,12 +221,8 @@ contract vDODOToken is InitializableOwnable {
|
|||||||
vDODOSupply = IERC20(_DODO_TOKEN_).balanceOf(address(this)) / _DODO_RATIO_;
|
vDODOSupply = IERC20(_DODO_TOKEN_).balanceOf(address(this)) / _DODO_RATIO_;
|
||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address account) public view returns (uint256 dodoAmount) {
|
function balanceOf(address account) public view returns (uint256 vDODOAmount) {
|
||||||
UserInfo memory user = userInfo[account];
|
vDODOAmount = dodoBalanceOf(account) / _DODO_RATIO_;
|
||||||
dodoAmount = DecimalMath
|
|
||||||
.mulFloor(uint256(user.stakingPower), getLatestAlpha())
|
|
||||||
.mul(_DODO_RATIO_)
|
|
||||||
.sub(user.credit);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function availableBalanceOf(address account) public view returns (uint256 balance) {
|
function availableBalanceOf(address account) public view returns (uint256 balance) {
|
||||||
@@ -238,6 +234,13 @@ contract vDODOToken is InitializableOwnable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function dodoBalanceOf(address account) public view returns (uint256 dodoAmount) {
|
||||||
|
UserInfo memory user = userInfo[account];
|
||||||
|
dodoAmount = DecimalMath.mulFloor(uint256(user.stakingPower), getLatestAlpha()).sub(
|
||||||
|
user.credit
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
function transfer(address to, uint256 vDODOAmount) public returns (bool) {
|
function transfer(address to, uint256 vDODOAmount) public returns (bool) {
|
||||||
_updateAlpha();
|
_updateAlpha();
|
||||||
_transfer(msg.sender, to, vDODOAmount);
|
_transfer(msg.sender, to, vDODOAmount);
|
||||||
|
|||||||
Reference in New Issue
Block a user