From e412897f1160a3d721d78a40a1df33620a4ca501 Mon Sep 17 00:00:00 2001 From: hueso Date: Fri, 24 Feb 2023 16:39:04 -0300 Subject: [PATCH] revamped lock conditionals --- contracts/p2pix.sol | 51 ++++++++++++++++----------------------------- 1 file changed, 18 insertions(+), 33 deletions(-) diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index a74d21b..3e04eee 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -234,42 +234,27 @@ contract P2PIX is sellerAllowList[k], msg.sender ); + } else if (l.amount > 1e2 ether) { + + uint256 userCredit = userRecord[ + _castAddrToKey(msg.sender) + ]; - _addLock(bal, _amount, cCounter, l, t, k); + uint256 spendLimit; + (spendLimit) = _limiter(userCredit / WAD); - lockCounter++; - - // Halt execution and output `lockID`. - return cCounter; - } else { - if (l.amount <= 1e2 ether) { - _addLock(bal, _amount, cCounter, l, t, k); - - lockCounter++; - - // Halt execution and output `lockID`. - return cCounter; - } else { - uint256 userCredit = userRecord[ - _castAddrToKey(msg.sender) - ]; - - uint256 spendLimit; - (spendLimit) = _limiter(userCredit / WAD); - - if ( - l.amount > (spendLimit * WAD) || - l.amount > 1e6 ether - ) revert AmountNotAllowed(); - - _addLock(bal, _amount, cCounter, l, t, k); - - lockCounter++; - - // Halt execution and output `lockID`. - return cCounter; - } + if ( + l.amount > (spendLimit * WAD) || + l.amount > 1e6 ether + ) revert AmountNotAllowed(); } + + _addLock(bal, _amount, cCounter, l, t, k); + + lockCounter++; + + // Halt execution and output `lockID`. + return cCounter; } /// @notice Lock release method that liquidate lock