Skip to content

Commit

Permalink
remove extra claim events
Browse files Browse the repository at this point in the history
  • Loading branch information
waynehoover committed Oct 30, 2023
1 parent 42acf9d commit b90e65a
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 83 deletions.
40 changes: 0 additions & 40 deletions contracts/QuestFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -577,23 +577,6 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto
currentQuest.questAddress,
claimData_.extraData
);

emit Quest1155Claimed(
claimData_.claimer, currentQuest.questAddress, claimData_.questId, questContract_.rewardToken(), questContract_.tokenId()
);

if (claimData_.ref != address(0)) {
emit QuestClaimedReferred(
claimData_.claimer,
currentQuest.questAddress,
claimData_.questId,
questContract_.rewardToken(),
questContract_.tokenId(),
claimData_.ref,
3333, //referralFee,
mintFee
);
}
}

/// @dev claim rewards with a referral address
Expand Down Expand Up @@ -625,27 +608,6 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto
currentQuest.questAddress,
claimData_.extraData
);

emit QuestClaimed(
claimData_.claimer,
currentQuest.questAddress,
claimData_.questId,
questContract_.rewardToken(),
questContract_.rewardAmountInWei()
);

if (claimData_.ref != address(0)) {
emit QuestClaimedReferred(
claimData_.claimer,
currentQuest.questAddress,
claimData_.questId,
questContract_.rewardToken(),
questContract_.rewardAmountInWei(),
claimData_.ref,
3333, //referralFee,
mintFee
);
}
}

/// @dev Internal function to create an erc20 quest
Expand Down Expand Up @@ -724,8 +686,6 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto
mintFeeRecipient_.safeTransferETH(mintPayout);
if(referrerPayout != 0) ref_.safeTransferETH(referrerPayout);

emit MintFeePaid(questId_, protocolFeeRecipient, protocolPayout, mintFeeRecipient_, mintPayout, ref_, referrerPayout);

return string(abi.encodePacked(
', "claimFee": "', cachedMintFee.toString(),
'", "claimFeePayouts": [{"name": "protocolPayout", "address": "', protocolFeeRecipient.toHexString(),
Expand Down
33 changes: 0 additions & 33 deletions contracts/interfaces/IQuestFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -90,39 +90,6 @@ interface IQuestFactory {
address indexed questAddress,
string extraData
);
event Quest1155Claimed(
address indexed recipient,
address indexed questAddress,
string questId,
address rewardToken,
uint256 tokenId
);
event QuestClaimed(
address indexed recipient,
address indexed questAddress,
string questId,
address rewardToken,
uint256 rewardAmountInWei
);
event QuestClaimedReferred(
address indexed recipient,
address indexed questAddress,
string questId,
address rewardToken,
uint256 rewardAmountInWeiOrTokenId,
address referrer,
uint16 referralFee,
uint256 mintFeeEthWei
);
event MintFeePaid(
string questId,
address rabbitHoleAddress,
uint256 rabbitHoleAmountWei,
address questCreatorAddress,
uint256 questCreatorAmountWei,
address referrerAddress,
uint256 referrerAmountWei
);
event QuestCreated(
address indexed creator,
address indexed contractAddress,
Expand Down
20 changes: 10 additions & 10 deletions test/QuestFactory.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -402,11 +402,11 @@ contract TestQuestFactory is Test, Errors, Events, TestUtils {

// assert QuestClaimedData event
Vm.Log[] memory entries = vm.getRecordedLogs();
assertEq(entries.length, 6);
assertEq(entries[3].topics[0], keccak256("QuestClaimedData(address,address,string)"));
assertEq(entries[3].topics[1], bytes32(uint256(uint160(participant))));
assertEq(entries[3].topics[2], bytes32(uint256(uint160(questAddress))));
assertEq(abi.decode(entries[3].data, (string)), finalJson);
assertEq(entries.length, 3);
assertEq(entries[2].topics[0], keccak256("QuestClaimedData(address,address,string)"));
assertEq(entries[2].topics[1], bytes32(uint256(uint160(participant))));
assertEq(entries[2].topics[2], bytes32(uint256(uint160(questAddress))));
assertEq(abi.decode(entries[2].data, (string)), finalJson);
}

function test_claim_with_bytes_no_referrer() public{
Expand Down Expand Up @@ -458,11 +458,11 @@ contract TestQuestFactory is Test, Errors, Events, TestUtils {

// assert QuestClaimedData event
Vm.Log[] memory entries = vm.getRecordedLogs();
assertEq(entries.length, 5, "log length");
assertEq(entries[3].topics[0], keccak256("QuestClaimedData(address,address,string)"));
assertEq(entries[3].topics[1], bytes32(uint256(uint160(participant))));
assertEq(entries[3].topics[2], bytes32(uint256(uint160(questAddress))));
assertEq(abi.decode(entries[3].data, (string)), finalJson);
assertEq(entries.length, 3, "log length");
assertEq(entries[2].topics[0], keccak256("QuestClaimedData(address,address,string)"));
assertEq(entries[2].topics[1], bytes32(uint256(uint160(participant))));
assertEq(entries[2].topics[2], bytes32(uint256(uint160(questAddress))));
assertEq(abi.decode(entries[2].data, (string)), finalJson);
}

function test_claim_with_claimRewards_without_referrer() public{
Expand Down

0 comments on commit b90e65a

Please sign in to comment.