From 15d222769d38cb5cb20326a68f44bda4c6b8d176 Mon Sep 17 00:00:00 2001 From: Jonathan Diep Date: Tue, 18 Jun 2024 13:34:41 -0700 Subject: [PATCH] fix: update `QuestBudget` to remove referral fee arg --- contracts/QuestBudget.sol | 7 ++----- contracts/interfaces/IQuestFactory.sol | 26 +------------------------- test/QuestBudget.t.sol | 8 ++------ test/mocks/QuestFactoryMock.sol | 9 +++------ 4 files changed, 8 insertions(+), 42 deletions(-) diff --git a/contracts/QuestBudget.sol b/contracts/QuestBudget.sol index 3a6aa150..1221bf75 100644 --- a/contracts/QuestBudget.sol +++ b/contracts/QuestBudget.sol @@ -145,7 +145,6 @@ contract QuestBudget is Budget, IERC1155Receiver, ReentrancyGuard { /// @param actionType_ The action type for the quest /// @param questName_ The name of the quest /// @param projectName_ The name of the project/protocol used for the quest - /// @param referralRewardFee_ The fee amount for referrals. The value is counted against the `rewardAmount` /// @return address the quest contract address function createERC20Quest( uint32 txHashChainId_, @@ -157,8 +156,7 @@ contract QuestBudget is Budget, IERC1155Receiver, ReentrancyGuard { string memory questId_, string memory actionType_, string memory questName_, - string memory projectName_, - uint256 referralRewardFee_ + string memory projectName_ ) public virtual onlyAuthorized returns (address) { uint256 maxTotalRewards = totalParticipants_ * rewardAmount_; uint256 questFee = uint256(IQuestFactory(questFactory).questFee()); @@ -175,8 +173,7 @@ contract QuestBudget is Budget, IERC1155Receiver, ReentrancyGuard { questId_, actionType_, questName_, - projectName_, - referralRewardFee_ + projectName_ ); } diff --git a/contracts/interfaces/IQuestFactory.sol b/contracts/interfaces/IQuestFactory.sol index ac9b2cda..c1eaf5ac 100644 --- a/contracts/interfaces/IQuestFactory.sol +++ b/contracts/interfaces/IQuestFactory.sol @@ -208,16 +208,7 @@ interface IQuestFactory { string memory questName_, string memory projectName_ ) external returns (address); - function createERC20Quest( - address rewardTokenAddress_, - uint256 endTime_, - uint256 startTime_, - uint256 totalParticipants_, - uint256 rewardAmount_, - string memory questId_, - string memory actionType_, - string memory questName_ - ) external returns (address); // deprecated + function create1155QuestAndQueue( address rewardTokenAddress_, uint256 endTime_, @@ -228,21 +219,6 @@ interface IQuestFactory { string memory ) external payable returns (address); - function createERC20Quest( - uint32 txHashChainId_, - address rewardTokenAddress_, - uint256 endTime_, - uint256 startTime_, - uint256 totalParticipants_, - uint256 rewardAmount_, - string calldata questId_, - string calldata actionType_, - string calldata questName_, - string calldata projectName_, - uint256 referralRewardFee_ - ) external returns (address); - - function claimOptimized(bytes calldata signature_, bytes calldata data_) external payable; function cancelQuest(string calldata questId_) external; diff --git a/test/QuestBudget.t.sol b/test/QuestBudget.t.sol index 7f90f61a..63face66 100644 --- a/test/QuestBudget.t.sol +++ b/test/QuestBudget.t.sol @@ -383,7 +383,6 @@ contract QuestBudgetTest is Test, TestUtils, IERC1155Receiver { string memory actionType_ = "testAction"; string memory questName_ = "Test Quest"; string memory projectName_ = "Test Project"; - uint256 referralRewardFee_ = 10 ether; uint256 maxTotalRewards = totalParticipants_ * rewardAmount_; uint256 questFee = uint256(mockQuestFactory.questFee()); @@ -407,8 +406,7 @@ contract QuestBudgetTest is Test, TestUtils, IERC1155Receiver { questId_, actionType_, questName_, - projectName_, - referralRewardFee_ + projectName_ ); // Ensure the returned quest address is not the zero address @@ -434,7 +432,6 @@ contract QuestBudgetTest is Test, TestUtils, IERC1155Receiver { string memory actionType_ = "testAction"; string memory questName_ = "Test Quest"; string memory projectName_ = "Test Project"; - uint256 referralRewardFee_ = 10 ether; uint256 maxTotalRewards = totalParticipants_ * rewardAmount_; uint256 questFee = uint256(mockQuestFactory.questFee()); @@ -458,8 +455,7 @@ contract QuestBudgetTest is Test, TestUtils, IERC1155Receiver { questId_, actionType_, questName_, - projectName_, - referralRewardFee_ + projectName_ ); // Ensure the returned quest address is not the zero address diff --git a/test/mocks/QuestFactoryMock.sol b/test/mocks/QuestFactoryMock.sol index 0d6c5bdf..507c6d87 100644 --- a/test/mocks/QuestFactoryMock.sol +++ b/test/mocks/QuestFactoryMock.sol @@ -19,7 +19,6 @@ contract QuestFactoryMock { string questName; string questType; string projectName; - uint256 referralRewardFee; } QuestData public questData; @@ -57,7 +56,7 @@ contract QuestFactoryMock { return false; } - function questFee() external view returns (uint16) { + function questFee() external pure returns (uint16) { return 2000; } @@ -72,8 +71,7 @@ contract QuestFactoryMock { string memory questId_, string memory actionType_, string memory questName_, - string memory projectName_, - uint256 referralRewardFee_ + string memory projectName_ ) external returns (address) { uint256 maxTotalRewards = totalParticipants_ * rewardAmount_; uint256 maxProtocolReward = (maxTotalRewards * 2000) / 10_000; // Assuming questFee is 2000 @@ -89,8 +87,7 @@ contract QuestFactoryMock { actionType: actionType_, questName: questName_, questType: "erc20", - projectName: projectName_, - referralRewardFee: referralRewardFee_ + projectName: projectName_ }); // Transfer rewardAmount_ tokens from the caller to this contract