Skip to content

Commit

Permalink
add in minPriceIncraseCalc to simplify rentAllCards
Browse files Browse the repository at this point in the history
  • Loading branch information
Splidge committed Aug 25, 2021
1 parent 40c0468 commit e01dbf4
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions contracts/RCMarket.sol
Original file line number Diff line number Diff line change
Expand Up @@ -697,9 +697,7 @@ contract RCMarket is Initializable, NativeMetaTransaction, IRCMarket {
if (card[i].cardPrice == 0) {
_actualSumOfPrices += MIN_RENTAL_VALUE;
} else {
_actualSumOfPrices +=
(card[i].cardPrice * (minimumPriceIncreasePercent + 100)) /
100;
_actualSumOfPrices += minPriceIncreaseCalc(card[i].cardPrice);
}
}
require(_actualSumOfPrices <= _maxSumOfPrices, "Prices too high");
Expand All @@ -708,10 +706,7 @@ contract RCMarket is Initializable, NativeMetaTransaction, IRCMarket {
if (ownerOf(i) != msgSender()) {
uint256 _newPrice;
if (card[i].cardPrice > 0) {
_newPrice =
(card[i].cardPrice *
(minimumPriceIncreasePercent + 100)) /
100;
_newPrice = minPriceIncreaseCalc(card[i].cardPrice);
} else {
_newPrice = MIN_RENTAL_VALUE;
}
Expand Down Expand Up @@ -1130,6 +1125,14 @@ contract RCMarket is Initializable, NativeMetaTransaction, IRCMarket {
return tokenIds[_card];
}

function minPriceIncreaseCalc(uint256 _oldPrice)
internal
view
returns (uint256 _newPrice)
{
_newPrice = (_oldPrice * (minimumPriceIncreasePercent + 100)) / 100;
}

/*╔═════════════════════════════════╗
║ VIEW FUNCTIONS ║
╚═════════════════════════════════╝*/
Expand Down

0 comments on commit e01dbf4

Please sign in to comment.