revamped lock() conditionals
This commit is contained in:
parent
4281526d77
commit
ee470c0393
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user