From bb0a6e35f4e87b9f5456c7eb059e7adc8475e865 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Joseph-Andr=C3=A9=20Turk?= Date: Fri, 8 Mar 2024 11:43:57 +0100 Subject: [PATCH] chore: refactored _mint in DEX contract --- contracts/EncryptedDEXPair.sol | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/contracts/EncryptedDEXPair.sol b/contracts/EncryptedDEXPair.sol index 9870dc3..206695f 100644 --- a/contracts/EncryptedDEXPair.sol +++ b/contracts/EncryptedDEXPair.sol @@ -189,12 +189,16 @@ contract EncryptedDEXPair is EncryptedERC20 { function claimMint(uint256 tradingEpoch, address user) external { require(tradingEpoch < currentTradingEpoch, "tradingEpoch is not settled yet"); + _mint(tradingEpoch, user); + pendingMints[tradingEpoch][user] = ZERO; + } + + function _mint(uint256 tradingEpoch, address user) internal { if (tradingEpoch == 0) { balances[user] = TFHE.sub(balances[user] + pendingMints[tradingEpoch][user], MINIMIMUM_LIQUIDITY); // this could never underflow from the contract logic } else { balances[user] = balances[user] + pendingMints[tradingEpoch][user]; } - pendingMints[tradingEpoch][user] = ZERO; } function claimBurn(uint256 tradingEpoch, address user) external {