diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index 56569e5..118e6f4 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -167,6 +167,18 @@ contract P2PIX is BaseUtils { address sender; uint256 forwarder; (sender, forwarder) = _isTrustedForwarder(); + if (merkleProof.length != 0) { + _merkleVerify( merkleProof, sellerAllowList(k), msg.sender); + + } else if (_amount > REPUTATION_LOWERBOUND && forwarder == 0) { + + uint256 userCredit = userRecord[_castAddrToKey(msg.sender)]; + uint256 spendLimit; (spendLimit) = _limiter(userCredit / WAD); + if ( + _amount > (spendLimit * WAD) || _amount > LOCKAMOUNT_UPPERBOUND + ) revert AmountNotAllowed(); + } + DT.Lock memory l = DT.Lock( k, cCounter, @@ -177,30 +189,7 @@ contract P2PIX is BaseUtils { sender ); - // transaction forwarding must leave `merkleProof` empty; - // otherwise, the trustedForwarder must be previously added - // to a seller whitelist. - if (merkleProof.length != 0) { - _merkleVerify(merkleProof, sellerAllowList(k), sender); - lockID = _addLock(bal, _amount, cCounter, l, t, k); - - } else { - if (l.amount <= REPUTATION_LOWERBOUND) { - lockID = _addLock(bal, _amount, cCounter, l, t, k); - - } else { - if (forwarder != 0) { - lockID = _addLock(bal, _amount, cCounter, l, t, k); - } else { - uint256 userCredit = userRecord[_castAddrToKey(msg.sender)]; - uint256 spendLimit; (spendLimit) = _limiter(userCredit / WAD); - if ( - l.amount > (spendLimit * WAD) || - l.amount > LOCKAMOUNT_UPPERBOUND - ) revert AmountNotAllowed(); - lockID = _addLock(bal, _amount, cCounter, l, t, k); - - /* */}/* */}/* */} + lockID = _addLock(bal, _amount, cCounter, l, t, k); } /// @notice Lock release method that liquidate lock