Skip to content
This repository has been archived by the owner on Nov 17, 2023. It is now read-only.

Commit

Permalink
code cleanup – naming and slither recommendations
Browse files Browse the repository at this point in the history
  • Loading branch information
iainnash committed Aug 1, 2023
1 parent 75cd962 commit 9e847bb
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 18 deletions.
8 changes: 4 additions & 4 deletions src/ProtocolRewards.sol
Original file line number Diff line number Diff line change
Expand Up @@ -150,15 +150,15 @@ contract ProtocolRewards is IProtocolRewards, EIP712 {
balanceOf[owner] -= amount;
}

emit Withdraw(owner, amount);

(bool success, ) = owner.call{value: amount, gas: WITHDRAW_GAS_LIMIT}(
""
);

if (!success) {
revert TRANSFER_FAILED();
}

emit Withdraw(owner, amount);
}

function withdrawWithSig(
Expand Down Expand Up @@ -203,14 +203,14 @@ contract ProtocolRewards is IProtocolRewards, EIP712 {
balanceOf[owner] -= amount;
}

emit Withdraw(owner, amount);

(bool success, ) = owner.call{value: amount, gas: WITHDRAW_GAS_LIMIT}(
""
);

if (!success) {
revert TRANSFER_FAILED();
}

emit Withdraw(owner, amount);
}
}
2 changes: 1 addition & 1 deletion src/abstract/ERC721/ERC721RewardsStorageV1.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ pragma solidity 0.8.17;

abstract contract ERC721RewardsStorageV1 {
address public createReferral;
}
}
24 changes: 12 additions & 12 deletions src/abstract/RewardSplits.sol
Original file line number Diff line number Diff line change
Expand Up @@ -22,16 +22,16 @@ abstract contract RewardSplits {
uint256 internal constant CREATE_REFERRAL_PAID_MINT_REWARD = 0.000222 ether;
uint256 internal constant ZORA_PAID_MINT_REWARD = 0.000222 ether;

address internal immutable ZORA_REWARD_RECIPIENT;
IProtocolRewards internal immutable PROTOCOL_REWARDS;
address internal immutable zoraRewardRecipient;
IProtocolRewards internal immutable protocolRewards;

constructor(address _protocolRewards, address _zoraRewardRecipient) payable {
if (_protocolRewards == address(0) || _zoraRewardRecipient == address(0)) {
revert INVALID_ADDRESS_ZERO();
}

PROTOCOL_REWARDS = IProtocolRewards(_protocolRewards);
ZORA_REWARD_RECIPIENT = _zoraRewardRecipient;
protocolRewards = IProtocolRewards(_protocolRewards);
zoraRewardRecipient = _zoraRewardRecipient;
}

function computeTotalReward(uint256 numTokens) public pure returns (uint256) {
Expand Down Expand Up @@ -88,14 +88,14 @@ abstract contract RewardSplits {
) = computeFreeMintRewards(numTokens);

if (mintReferral == address(0)) {
mintReferral = ZORA_REWARD_RECIPIENT;
mintReferral = zoraRewardRecipient;
}

if (createReferral == address(0)) {
createReferral = ZORA_REWARD_RECIPIENT;
createReferral = zoraRewardRecipient;
}

PROTOCOL_REWARDS.depositRewards{ value: totalReward }(
protocolRewards.depositRewards{ value: totalReward }(
creator,
creatorReward,
mintReferral,
Expand All @@ -104,7 +104,7 @@ abstract contract RewardSplits {
createReferralReward,
creator,
firstMinterReward,
ZORA_REWARD_RECIPIENT,
zoraRewardRecipient,
zoraReward
);
}
Expand All @@ -120,14 +120,14 @@ abstract contract RewardSplits {
computePaidMintRewards(numTokens);

if (mintReferral == address(0)) {
mintReferral = ZORA_REWARD_RECIPIENT;
mintReferral = zoraRewardRecipient;
}

if (createReferral == address(0)) {
createReferral = ZORA_REWARD_RECIPIENT;
createReferral = zoraRewardRecipient;
}

PROTOCOL_REWARDS.depositRewards{ value: totalReward }(
protocolRewards.depositRewards{ value: totalReward }(
address(0),
0,
mintReferral,
Expand All @@ -136,7 +136,7 @@ abstract contract RewardSplits {
createReferralReward,
creator,
firstMinterReward,
ZORA_REWARD_RECIPIENT,
zoraRewardRecipient,
zoraReward
);
}
Expand Down
2 changes: 1 addition & 1 deletion test/ProtocolRewardsTest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ contract ProtocolRewardsTest is Test {
function setUp() public virtual {
protocolRewards = new ProtocolRewards();

vm.label(address(protocolRewards), "PROTOCOL_REWARDS");
vm.label(address(protocolRewards), "protocolRewards");

collector = makeAddr("collector");
creator = makeAddr("creator");
Expand Down

0 comments on commit 9e847bb

Please sign in to comment.