/// @notice Withdraw without caring about rewards. EMERGENCY ONLY. /// @param _pid the pool id function emergencyWithdraw(uint256 _pid) public nonReentrant { PoolInfo storage pool = poolInfo[_pid]; UserInfo storage user = userInfo[_pid][msg.sender];
/** * @notice function to check if user's collateral position is solvent * @dev returns (true, 0) if the token is not a valid collateral * @param _user address of the user * @param _token address of the token * @param _open open a position or close a position * @return solvent * @return debtAmount total debt amount including interests */ function isSolvent( address _user, ERC20 _token, bool _open ) external view returns (bool solvent, uint256 debtAmount) { return _isSolvent(_user, _token, _open); }
/** * @notice function to check if user's collateral position is solvent * @dev returns (true, 0) if the token is not a valid collateral * @param _user address of the user * @param _token address of the token * @param _open open a position or close a position * @return solvent * @return debtAmount total debt amount including interests */ function _isSolvent( address _user, ERC20 _token, bool _open ) internal view returns (bool solvent, uint256 debtAmount) { uint256 debtShare = userPositions[_token][_user].debtShare;
// fast path if (debtShare == 0) return (true, 0);