Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use != 0 instead of > 0 #133

Merged
merged 1 commit into from
Jan 31, 2022
Merged
Show file tree
Hide file tree
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
24 changes: 12 additions & 12 deletions contracts/LaunchEvent.sol
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ contract LaunchEvent {
"LaunchEvent: issuer must be address zero"
);
require(
_maxAllocation > 0,
_maxAllocation != 0,
"LaunchEvent: max allocation must not be zero"
);

Expand Down Expand Up @@ -329,7 +329,7 @@ contract LaunchEvent {
{
require(msg.sender != issuer, "LaunchEvent: issuer cannot participate");
require(
msg.value > 0,
msg.value != 0,
"LaunchEvent: expected non-zero AVAX to deposit"
);

Expand All @@ -353,7 +353,7 @@ contract LaunchEvent {
user.balance = newAllocation;
avaxReserve += msg.value;

if (rJoeNeeded > 0) {
if (rJoeNeeded != 0) {
rJoe.burnFrom(msg.sender, rJoeNeeded);
}

Expand All @@ -368,7 +368,7 @@ contract LaunchEvent {
_currentPhase == Phase.PhaseOne || _currentPhase == Phase.PhaseTwo,
"LaunchEvent: unable to withdraw"
);
require(_amount > 0, "LaunchEvent: invalid withdraw amount");
require(_amount != 0, "LaunchEvent: invalid withdraw amount");
UserInfo storage user = getUserInfo[msg.sender];
require(
user.balance >= _amount,
Expand All @@ -381,7 +381,7 @@ contract LaunchEvent {

avaxReserve -= _amount;

if (feeAmount > 0) {
if (feeAmount != 0) {
_safeTransferAVAX(rocketJoeFactory.penaltyCollector(), feeAmount);
}
_safeTransferAVAX(msg.sender, amountMinusFee);
Expand All @@ -403,7 +403,7 @@ contract LaunchEvent {
0,
"LaunchEvent: liquid pair already exists"
);
require(avaxReserve > 0, "LaunchEvent: no avax balance");
require(avaxReserve != 0, "LaunchEvent: no avax balance");

uint256 tokenAllocated = tokenReserve;

Expand Down Expand Up @@ -451,7 +451,7 @@ contract LaunchEvent {
UserInfo storage user = getUserInfo[msg.sender];

uint256 balance = pairBalance(msg.sender);
require(balance > 0, "LaunchEvent: caller has no liquidity to claim");
require(balance != 0, "LaunchEvent: caller has no liquidity to claim");

user.hasWithdrawnPair = true;

Expand All @@ -469,7 +469,7 @@ contract LaunchEvent {
require(address(pair) != address(0), "LaunchEvent: pair not created");

uint256 amount = getIncentives(msg.sender);
require(amount > 0, "LaunchEvent: caller has no incentive to claim");
require(amount != 0, "LaunchEvent: caller has no incentive to claim");

UserInfo storage user = getUserInfo[msg.sender];
user.hasWithdrawnIncentives = true;
Expand All @@ -491,7 +491,7 @@ contract LaunchEvent {
if (msg.sender != issuer) {
UserInfo storage user = getUserInfo[msg.sender];
require(
user.balance > 0,
user.balance != 0,
"LaunchEvent: expected user to have non-zero balance to perform emergency withdraw"
);

Expand All @@ -514,7 +514,7 @@ contract LaunchEvent {

uint256 balance = pairBalance(msg.sender);
require(
balance > 0,
balance != 0,
"LaunchEvent: caller has no liquidity to claim"
);

Expand Down Expand Up @@ -553,12 +553,12 @@ contract LaunchEvent {
uint256 excessToken = token.balanceOf(address(this)) -
tokenReserve -
tokenIncentivesBalance;
if (excessToken > 0) {
if (excessToken != 0) {
token.safeTransfer(penaltyCollector, excessToken);
}

uint256 excessAvax = address(this).balance - avaxReserve;
if (excessAvax > 0) {
if (excessAvax != 0) {
_safeTransferAVAX(penaltyCollector, excessAvax);
}
}
Expand Down
2 changes: 1 addition & 1 deletion contracts/RocketJoeFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ contract RocketJoeFactory is
require(_token != address(0), "RJFactory: token can't be 0 address");
require(_token != wavax, "RJFactory: token can't be wavax");
require(
_tokenAmountIncludingIncentives > 0,
_tokenAmountIncludingIncentives != 0,
"RJFactory: token amount including incentives needs to be greater than 0"
);
require(
Expand Down
6 changes: 3 additions & 3 deletions contracts/RocketJoeStaking.sol
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ contract RocketJoeStaking is Initializable, OwnableUpgradeable {

updatePool();

if (user.amount > 0) {
if (user.amount != 0) {
uint256 pending = (user.amount * accRJoePerShare) /
PRECISION -
user.rewardDebt;
if (pending > 0) _safeRJoeTransfer(msg.sender, pending);
if (pending != 0) _safeRJoeTransfer(msg.sender, pending);
}
user.amount += _amount;
user.rewardDebt = (user.amount * accRJoePerShare) / PRECISION;
Expand Down Expand Up @@ -140,7 +140,7 @@ contract RocketJoeStaking is Initializable, OwnableUpgradeable {
user.amount -= _amount;
user.rewardDebt = (user.amount * accRJoePerShare) / PRECISION;

if (pending > 0) _safeRJoeTransfer(msg.sender, pending);
if (pending != 0) _safeRJoeTransfer(msg.sender, pending);
totalJoeStaked -= _amount;
joe.safeTransfer(msg.sender, _amount);
emit Withdraw(msg.sender, _amount);
Expand Down