Fixed PPS function for 0 totalSupply
@@ -186,8 +186,12 @@ contract AffiliateTokenGatedUpgradeable is ERC20Upgradeable, BaseWrapperUpgradea
}
function pricePerShare() public view returns (uint256) {
+ if (totalSupply() == 0) {
+ return 0;
+ } else {
return totalVaultBalance(address(this)).mul(10**uint256(decimals())).div(totalSupply());
}
+ }
function totalWrapperBalance(address account) public view returns (uint256 balance) {
return balanceOf(account).mul(pricePerShare()).div(10**uint256(decimals()));
