Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions contracts/liquidity/LiquidityPool.sol
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ interface IERC20 {

contract LiquidityPool {
uint256 public constant DIVISOR = 10000;
uint256 private constant UINT_MAX = type(uint256).max;

bool public initialized;
IMarket public market;
Expand Down Expand Up @@ -175,7 +174,7 @@ contract LiquidityPool {

unchecked {
uint256 c = _a * _b;
return c / _a == _b ? c : UINT_MAX;
return c / _a == _b ? c : type(uint256).max;
}
}

Expand Down Expand Up @@ -204,10 +203,12 @@ contract LiquidityPool {
reward = (_totalPrize * cumWeigths) / (DIVISOR * sharedBetween);
}

function getMarketPaymentIfWon() public view returns (uint256 marketPayment) {
function getMarketPaymentIfWon() public view returns (uint256) {
if (market.price() == 0) return totalDeposits;

uint256 maxPayment = market.price() * market.nextTokenID();
maxPayment = mulCap(maxPayment, betMultiplier);
marketPayment = totalDeposits < maxPayment ? totalDeposits : maxPayment;
return totalDeposits < maxPayment ? totalDeposits : maxPayment;
}

receive() external payable {
Expand Down