Skip to content

Commit

Permalink
remove nft quest fee
Browse files Browse the repository at this point in the history
  • Loading branch information
waynehoover committed Nov 15, 2023
1 parent e1b3e77 commit 4e0a4b4
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 35 deletions.
48 changes: 24 additions & 24 deletions .gas-snapshot
Original file line number Diff line number Diff line change
Expand Up @@ -16,71 +16,71 @@ ProtocolRewardsTest:test_withdraw() (gas: 34148)
ProtocolRewardsTest:test_withdrawFor() (gas: 28858)
ProtocolRewardsTest:test_withdrawForFullBalance() (gas: 29017)
ProtocolRewardsTest:test_withdrawFullBalance() (gas: 32031)
TestQuest1155:test_RevertIf_initialize_EndTimeInPast() (gas: 2187471)
TestQuest1155:test_RevertIf_initialize_EndTimeLessThanOrEqualToStartTime() (gas: 2185401)
TestQuest1155:test_RevertIf_initialize_EndTimeInPast() (gas: 2177047)
TestQuest1155:test_RevertIf_initialize_EndTimeLessThanOrEqualToStartTime() (gas: 2174977)
TestQuest1155:test_RevertIf_not_enough_eth() (gas: 63799)
TestQuest1155:test_RevertIf_not_enough_tokens() (gas: 27823)
TestQuest1155:test_RevertIf_pause_Unauthorized() (gas: 13520)
TestQuest1155:test_RevertIf_singleClaim_NotQuestFactory() (gas: 82389)
TestQuest1155:test_RevertIf_singleClaim_NotQuestFactory() (gas: 82249)
TestQuest1155:test_RevertIf_singleClaim_NotStarted() (gas: 85125)
TestQuest1155:test_RevertIf_singleClaim_whenNotPaused() (gas: 105396)
TestQuest1155:test_RevertIf_unpause_Unauthorized() (gas: 13517)
TestQuest1155:test_RevertIf_withdrawRemainingToken_AlreadyWithdrawn() (gas: 136227)
TestQuest1155:test_RevertIf_withdrawRemainingToken_NotEnded() (gas: 91605)
TestQuest1155:test_RevertIf_withdrawRemainingToken_NotQueued() (gas: 21133)
TestQuest1155:test_RevertIf_withdrawRemainingToken_NotQueued() (gas: 21127)
TestQuest1155:test_initialize() (gas: 49323)
TestQuest1155:test_maxProtocolReward() (gas: 16863)
TestQuest1155:test_pause() (gas: 41906)
TestQuest1155:test_queue() (gas: 72943)
TestQuest1155:test_singleClaim() (gas: 178257)
TestQuest1155:test_singleClaim() (gas: 141727)
TestQuest1155:test_unpause() (gas: 31710)
TestQuest1155:test_withdrawRemainingTokens() (gas: 135331)
TestQuest:test_RevertIf_initialize_EndTimeInPast() (gas: 1627078)
TestQuest:test_RevertIf_initialize_EndTimeLessThanOrEqualToStartTime() (gas: 1624465)
TestQuest:test_RevertIf_initialize_EndTimeInPast() (gas: 1605829)
TestQuest:test_RevertIf_initialize_EndTimeLessThanOrEqualToStartTime() (gas: 1603216)
TestQuest:test_RevertIf_pause_Unauthorized() (gas: 13586)
TestQuest:test_RevertIf_refund_InvalidRefundToken() (gas: 20441)
TestQuest:test_RevertIf_refund_Unauthorized() (gas: 15804)
TestQuest:test_RevertIf_singleClaim_NotQuestFactory() (gas: 29685)
TestQuest:test_RevertIf_singleClaim_NotStarted() (gas: 25863)
TestQuest:test_RevertIf_singleClaim_whenNotPaused() (gas: 54588)
TestQuest:test_RevertIf_singleClaim_NotQuestFactory() (gas: 24632)
TestQuest:test_RevertIf_singleClaim_NotStarted() (gas: 25085)
TestQuest:test_RevertIf_singleClaim_whenNotPaused() (gas: 45285)
TestQuest:test_RevertIf_unpause_Unauthorized() (gas: 13518)
TestQuest:test_RevertIf_withdrawRemainingToken_AlreadyWithdrawn() (gas: 80211)
TestQuest:test_RevertIf_withdrawRemainingToken_NotEnded() (gas: 16012)
TestQuest:test_fuzz_protocolFee(uint256) (runs: 256, μ: 56759, ~: 56898)
TestQuest:test_fuzz_protocolFee(uint256) (runs: 256, μ: 56756, ~: 56898)
TestQuest:test_fuzz_receiptRedeemers(uint256) (runs: 256, μ: 42665, ~: 43754)
TestQuest:test_fuzz_singleClaim(uint256,uint256,uint256,uint256) (runs: 256, μ: 2573351, ~: 2573889)
TestQuest:test_fuzz_withdrawRemainingTokens(uint16,uint256,uint256,uint16) (runs: 256, μ: 7360502, ~: 7299071)
TestQuest:test_fuzz_singleClaim(uint256,uint256,uint256,uint256) (runs: 256, μ: 2551752, ~: 2552334)
TestQuest:test_fuzz_withdrawRemainingTokens(uint16,uint256,uint256,uint16) (runs: 256, μ: 7299328, ~: 7282240)
TestQuest:test_getRewardAmount() (gas: 12406)
TestQuest:test_getRewardToken() (gas: 12619)
TestQuest:test_initialize() (gas: 66477)
TestQuest:test_maxProtocolReward() (gas: 22294)
TestQuest:test_maxTotalRewards() (gas: 16953)
TestQuest:test_pause() (gas: 39825)
TestQuest:test_refund() (gas: 630202)
TestQuest:test_singleClaim() (gas: 96080)
TestQuest:test_singleClaim() (gas: 93710)
TestQuest:test_singleClaim_stream() (gas: 210)
TestQuest:test_totalTransferAmount() (gas: 19746)
TestQuest:test_unpause() (gas: 29988)
TestQuest:test_withdrawRemainingTokens() (gas: 131166)
TestQuestFactory:test_RevertIf_claim_AddressAlreadyMinted() (gas: 754092)
TestQuestFactory:test_RevertIf_claim_AddressAlreadyMinted() (gas: 753722)
TestQuestFactory:test_RevertIf_claim_InvalidHash() (gas: 581117)
TestQuestFactory:test_RevertIf_claim_InvalidMintFee() (gas: 575729)
TestQuestFactory:test_RevertIf_claim_QuestEnded() (gas: 629507)
TestQuestFactory:test_RevertIf_claim_QuestNotStarted() (gas: 628800)
TestQuestFactory:test_RevertIf_claim_QuestEnded() (gas: 629279)
TestQuestFactory:test_RevertIf_claim_QuestNotStarted() (gas: 628822)
TestQuestFactory:test_RevertIf_create1155QuestAndQueue_MsgValueLessThanQuestNFTFee() (gas: 98029)
TestQuestFactory:test_RevertIf_createQuestAndQueue_Erc20QuestAddressNotSet() (gas: 88780)
TestQuestFactory:test_RevertIf_createQuestAndQueue_QuestIdUsed() (gas: 553462)
TestQuestFactory:test_RevertIf_createQuestAndQueue_RewardNotAllowed() (gas: 67273)
TestQuestFactory:test_claim_with_bytes() (gas: 872112)
TestQuestFactory:test_claim_with_bytes_no_referrer() (gas: 826268)
TestQuestFactory:test_claim_with_claim1155Rewards_with_referrer() (gas: 755304)
TestQuestFactory:test_claim_with_claim1155Rewards_without_referrer() (gas: 712093)
TestQuestFactory:test_claim_with_claimRewards_with_referrer() (gas: 786342)
TestQuestFactory:test_claim_with_claimRewards_without_referrer() (gas: 743131)
TestQuestFactory:test_claim_with_bytes() (gas: 871742)
TestQuestFactory:test_claim_with_bytes_no_referrer() (gas: 825898)
TestQuestFactory:test_claim_with_claim1155Rewards_with_referrer() (gas: 747768)
TestQuestFactory:test_claim_with_claim1155Rewards_without_referrer() (gas: 704557)
TestQuestFactory:test_claim_with_claimRewards_with_referrer() (gas: 785972)
TestQuestFactory:test_claim_with_claimRewards_without_referrer() (gas: 742761)
TestQuestFactory:test_create1155QuestAndQueue() (gas: 513118)
TestQuestFactory:test_createERC20StreamQuest() (gas: 580611)
TestQuestFactory:test_createQuestAndQueue() (gas: 558398)
TestQuestFactory:test_fuzz_claim(string,uint256,uint256) (runs: 256, μ: 817532, ~: 806154)
TestQuestFactory:test_fuzz_claim(string,uint256,uint256) (runs: 256, μ: 817197, ~: 805784)
TestQuestFactory:test_initialize() (gas: 23408)
TestQuestFactory:test_questData() (gas: 568436)
TestRabbitHoleTickets:test_RevertIf_mint_OnlyMinter() (gas: 16218)
Expand Down
8 changes: 3 additions & 5 deletions contracts/Quest.sol
Original file line number Diff line number Diff line change
Expand Up @@ -141,15 +141,13 @@ contract Quest is ReentrancyGuardUpgradeable, PausableUpgradeable, Ownable, IQue
function singleClaim(address account_)
external
virtual
nonReentrant
onlyStarted
whenNotEnded
whenNotPaused
whenNotEnded
onlyStarted
onlyQuestFactory
{
uint256 totalRedeemableRewards = rewardAmountInWei;
_transferRewards(account_, totalRedeemableRewards);
redeemedTokens = redeemedTokens + 1;
_transferRewards(account_, rewardAmountInWei);
}

/// @notice Function to withdraw the remaining tokens in the contract, distributes the protocol fee and returns remaining tokens to owner
Expand Down
2 changes: 0 additions & 2 deletions contracts/Quest1155.sol
Original file line number Diff line number Diff line change
Expand Up @@ -129,12 +129,10 @@ contract Quest1155 is ERC1155Holder, ReentrancyGuardUpgradeable, PausableUpgrade
whenNotPaused
whenNotEnded
onlyStarted
onlyQueued
onlyQuestFactory
{
redeemedTokens = redeemedTokens + 1;
_transferRewards(account_, 1);
if (questFee > 0) protocolFeeRecipient.safeTransferETH(questFee);
}

/// @notice Unpauses the Quest
Expand Down
2 changes: 1 addition & 1 deletion contracts/QuestFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -604,7 +604,7 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto
IQuestOwnable questContract_ = IQuestOwnable(currentQuest.questAddress);

currentQuest.addressMinted[claimData_.claimer] = true;
++currentQuest.numberMinted;
++currentQuest.numberMinted; // we can remove this and look at redeemedTokens on the Quest instead
questContract_.singleClaim(claimData_.claimer);

if (mintFee > 0) {
Expand Down
2 changes: 1 addition & 1 deletion test/Quest1155.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ contract TestQuest1155 is Test, Errors, Events {

assertEq(
protocolFeeRecipient.balance,
protocolFeeRecipientOGBalance + QUEST_FEE,
protocolFeeRecipientOGBalance,
"participant should have received the reward in ETH"
);
assertEq(
Expand Down
4 changes: 2 additions & 2 deletions test/QuestFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -282,7 +282,7 @@ contract TestQuestFactory is Test, Errors, Events, TestUtils {

// claim fee & nft quset fee rewards
assertEq(questCreator.balance - questCreatorBeforeBalance, MINT_FEE / 3, "questCreator mint fee");
assertEq(protocolFeeRecipient.balance, (MINT_FEE / 3) + NFT_QUEST_FEE, "protocolFeeRecipient mint fee");
assertEq(protocolFeeRecipient.balance, (MINT_FEE / 3), "protocolFeeRecipient mint fee");
assertEq(referrer.balance, MINT_FEE / 3, "referrer mint fee");
}

Expand Down Expand Up @@ -315,7 +315,7 @@ contract TestQuestFactory is Test, Errors, Events, TestUtils {

// claim fee & nft quset fee rewards
assertEq(questCreator.balance - questCreatorBeforeBalance, MINT_FEE / 3, "questCreator mint fee");
assertEq(protocolFeeRecipient.balance, (MINT_FEE / 3) * 2 + NFT_QUEST_FEE, "protocolFeeRecipient mint fee");
assertEq(protocolFeeRecipient.balance, (MINT_FEE / 3) * 2, "protocolFeeRecipient mint fee");

vm.stopPrank();
}
Expand Down

0 comments on commit 4e0a4b4

Please sign in to comment.