Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions contracts/QuestFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -904,18 +904,20 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto
function processMintFee(address ref_, address mintFeeRecipient_, string memory questId_) private returns (string memory) {
returnChange();
uint256 cachedMintFee = mintFee;
uint256 oneThirdMintfee = cachedMintFee / 3;
require(cachedMintFee > 0, "Zero mint fee");

uint256 oneThirdMintfee = (cachedMintFee * 1000) / 3000; // More precise division
uint256 protocolPayout;
uint256 mintPayout;
uint256 referrerPayout;

if(ref_ == address(0)){
protocolPayout = oneThirdMintfee * 2;
mintPayout = oneThirdMintfee;
mintPayout = cachedMintFee - protocolPayout; // The remainder goes to mintPayout
} else {
protocolPayout = oneThirdMintfee;
mintPayout = oneThirdMintfee;
referrerPayout = oneThirdMintfee;
referrerPayout = cachedMintFee - (protocolPayout + mintPayout); // The remainder goes to referrerPayout
}

protocolFeeRecipient.safeTransferETH(protocolPayout);
Expand Down Expand Up @@ -1019,4 +1021,4 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto

// Fallback function to receive ETH when other functions are not available
fallback() external payable {}
}
}