revamped lock conditionals

This commit is contained in:
hueso 2023-05-21 17:46:14 -03:00
parent ce5f3e4265
commit 6c5b784782

View File

@ -179,6 +179,18 @@ contract P2PIX is BaseUtils, ReentrancyGuard {
mapLocks[cCounter].expirationBlock >= block.number
) revert NotExpired();
if (merkleProof.length != 0) {
_merkleVerify( merkleProof, sellerAllowList(k), msg.sender);
} else if (_amount > REPUTATION_LOWERBOUND) {
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,
@ -191,23 +203,7 @@ contract P2PIX is BaseUtils, ReentrancyGuard {
address(t)
);
if (merkleProof.length != 0) {
_merkleVerify( merkleProof, sellerAllowList(k), msg.sender);
lockID = _addLock(bal, _amount, cCounter, l, t, k);
} else {
if (l.amount <= REPUTATION_LOWERBOUND) {
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);
/* */}/* */}
}
/// @notice Lock release method that liquidate lock