Skip to content

Commit

Permalink
fix: prettier
Browse files Browse the repository at this point in the history
  • Loading branch information
jatZama committed Feb 28, 2024
1 parent 1a59e16 commit 7087165
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 10 deletions.
22 changes: 14 additions & 8 deletions contracts/EncryptedDEXPair.sol
Original file line number Diff line number Diff line change
Expand Up @@ -234,12 +234,16 @@ contract EncryptedDEXPair is EncryptedERC20 {
uint32 burnedTotal
)
{
if(TFHE.isInitialized(reserve0PendingAdd)) reserve0PendingAddDec = TFHE.decrypt(reserve0PendingAdd);
if(TFHE.isInitialized(reserve1PendingAdd)) reserve1PendingAddDec = TFHE.decrypt(reserve1PendingAdd);
if(TFHE.isInitialized(pendingTotalMints[currentTradingEpoch])) mintedTotal = TFHE.decrypt(pendingTotalMints[currentTradingEpoch]);
if(TFHE.isInitialized(pendingTotalToken0In[currentTradingEpoch])) amount0In = TFHE.decrypt(pendingTotalToken0In[currentTradingEpoch]);
if(TFHE.isInitialized(pendingTotalToken1In[currentTradingEpoch])) amount1In = TFHE.decrypt(pendingTotalToken1In[currentTradingEpoch]);
if(TFHE.isInitialized(pendingTotalBurns[currentTradingEpoch])) burnedTotal = TFHE.decrypt(pendingTotalBurns[currentTradingEpoch]);
if (TFHE.isInitialized(reserve0PendingAdd)) reserve0PendingAddDec = TFHE.decrypt(reserve0PendingAdd);
if (TFHE.isInitialized(reserve1PendingAdd)) reserve1PendingAddDec = TFHE.decrypt(reserve1PendingAdd);
if (TFHE.isInitialized(pendingTotalMints[currentTradingEpoch]))
mintedTotal = TFHE.decrypt(pendingTotalMints[currentTradingEpoch]);
if (TFHE.isInitialized(pendingTotalToken0In[currentTradingEpoch]))
amount0In = TFHE.decrypt(pendingTotalToken0In[currentTradingEpoch]);
if (TFHE.isInitialized(pendingTotalToken1In[currentTradingEpoch]))
amount1In = TFHE.decrypt(pendingTotalToken1In[currentTradingEpoch]);
if (TFHE.isInitialized(pendingTotalBurns[currentTradingEpoch]))
burnedTotal = TFHE.decrypt(pendingTotalBurns[currentTradingEpoch]);
}

function batchSettlement() external {
Expand Down Expand Up @@ -289,7 +293,8 @@ contract EncryptedDEXPair is EncryptedERC20 {
amount1InMinusFee +
reserve1 -
uint32(
(uint64(reserve1) * uint64(reserve0)) / (uint64(reserve0) + uint64(amount0InMinusFee) - uint64(amount0Out))
(uint64(reserve1) * uint64(reserve0)) /
(uint64(reserve0) + uint64(amount0InMinusFee) - uint64(amount0Out))
);
} else {
// here we do the opposite, first sell token0 at current token0 price then swap remaining token1 according to AMM formula
Expand All @@ -298,7 +303,8 @@ contract EncryptedDEXPair is EncryptedERC20 {
amount0InMinusFee +
reserve0 -
uint32(
(uint64(reserve0) * uint64(reserve1)) / (uint64(reserve1) + uint64(amount1InMinusFee) - uint64(amount1Out))
(uint64(reserve0) * uint64(reserve1)) /
(uint64(reserve1) + uint64(amount1InMinusFee) - uint64(amount1Out))
);
}
totalToken0ClaimableSwap[currentTradingEpoch] = amount0Out;
Expand Down
4 changes: 2 additions & 2 deletions test/EncryptedDEX/EncryptedDEX.ts
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ describe("Private DEX", function () {
await tx23.wait();
console.log("Eve submitted a swap order at tradingEpoch ", await pair.currentTradingEpoch(), "\n");

const tx24 = await pair.batchSettlement({ gasLimit : 10_000_000 });
const tx24 = await pair.batchSettlement({ gasLimit: 10_000_000 });
await tx24.wait();

console.log(
Expand Down Expand Up @@ -243,7 +243,7 @@ describe("Private DEX", function () {
balance = await getPrivateBalanceERC20(pairAddress, "carol");
console.log("Carol now owns a private balance of ", balance, " liquidity tokens \n");

const tx29 = await pair.batchSettlement({ gasLimit : 10_000_000 });
const tx29 = await pair.batchSettlement({ gasLimit: 10_000_000 });
await tx29.wait();

console.log(
Expand Down

0 comments on commit 7087165

Please sign in to comment.