From 9931736b293a08004123974ac832d1ceda339d16 Mon Sep 17 00:00:00 2001 From: crStiv Date: Fri, 17 Jan 2025 21:36:20 +0100 Subject: [PATCH 1/2] Update QuestFactory.sol --- contracts/QuestFactory.sol | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/contracts/QuestFactory.sol b/contracts/QuestFactory.sol index 1741bb26..3d343914 100644 --- a/contracts/QuestFactory.sol +++ b/contracts/QuestFactory.sol @@ -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; // Более точное деление uint256 protocolPayout; uint256 mintPayout; uint256 referrerPayout; if(ref_ == address(0)){ protocolPayout = oneThirdMintfee * 2; - mintPayout = oneThirdMintfee; + mintPayout = cachedMintFee - protocolPayout; // Остаток идет в mintPayout } else { protocolPayout = oneThirdMintfee; mintPayout = oneThirdMintfee; - referrerPayout = oneThirdMintfee; + referrerPayout = cachedMintFee - (protocolPayout + mintPayout); // Остаток идет в referrerPayout } protocolFeeRecipient.safeTransferETH(protocolPayout); @@ -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 {} -} \ No newline at end of file +} From e03cccacaf1402e8b5544388dc02310ab2c00ab6 Mon Sep 17 00:00:00 2001 From: crStiv Date: Fri, 17 Jan 2025 21:38:26 +0100 Subject: [PATCH 2/2] Update QuestFactory.sol --- contracts/QuestFactory.sol | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/contracts/QuestFactory.sol b/contracts/QuestFactory.sol index 3d343914..08b66103 100644 --- a/contracts/QuestFactory.sol +++ b/contracts/QuestFactory.sol @@ -906,18 +906,18 @@ contract QuestFactory is Initializable, LegacyStorage, OwnableRoles, IQuestFacto uint256 cachedMintFee = mintFee; require(cachedMintFee > 0, "Zero mint fee"); - uint256 oneThirdMintfee = (cachedMintFee * 1000) / 3000; // Более точное деление + uint256 oneThirdMintfee = (cachedMintFee * 1000) / 3000; // More precise division uint256 protocolPayout; uint256 mintPayout; uint256 referrerPayout; if(ref_ == address(0)){ protocolPayout = oneThirdMintfee * 2; - mintPayout = cachedMintFee - protocolPayout; // Остаток идет в mintPayout + mintPayout = cachedMintFee - protocolPayout; // The remainder goes to mintPayout } else { protocolPayout = oneThirdMintfee; mintPayout = oneThirdMintfee; - referrerPayout = cachedMintFee - (protocolPayout + mintPayout); // Остаток идет в referrerPayout + referrerPayout = cachedMintFee - (protocolPayout + mintPayout); // The remainder goes to referrerPayout } protocolFeeRecipient.safeTransferETH(protocolPayout);