Skip to content

Commit

Permalink
fix: update QuestBudget to remove referral fee arg
Browse files Browse the repository at this point in the history
  • Loading branch information
jonathandiep committed Jun 18, 2024
1 parent a259494 commit 15d2227
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 42 deletions.
7 changes: 2 additions & 5 deletions contracts/QuestBudget.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand All @@ -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());
Expand All @@ -175,8 +173,7 @@ contract QuestBudget is Budget, IERC1155Receiver, ReentrancyGuard {
questId_,
actionType_,
questName_,
projectName_,
referralRewardFee_
projectName_
);
}

Expand Down
26 changes: 1 addition & 25 deletions contracts/interfaces/IQuestFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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_,
Expand All @@ -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;
Expand Down
8 changes: 2 additions & 6 deletions test/QuestBudget.t.sol
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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
Expand All @@ -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());
Expand All @@ -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
Expand Down
9 changes: 3 additions & 6 deletions test/mocks/QuestFactoryMock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ contract QuestFactoryMock {
string questName;
string questType;
string projectName;
uint256 referralRewardFee;
}

QuestData public questData;
Expand Down Expand Up @@ -57,7 +56,7 @@ contract QuestFactoryMock {
return false;
}

function questFee() external view returns (uint16) {
function questFee() external pure returns (uint16) {
return 2000;
}

Expand All @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 15d2227

Please sign in to comment.