revamped lock() conditionals
This commit is contained in:
parent
4281526d77
commit
9c15bfb38c
@ -167,6 +167,21 @@ contract P2PIX is BaseUtils {
|
|||||||
address sender; uint256 forwarder;
|
address sender; uint256 forwarder;
|
||||||
(sender, forwarder) = _isTrustedForwarder();
|
(sender, forwarder) = _isTrustedForwarder();
|
||||||
|
|
||||||
|
// 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);
|
||||||
|
|
||||||
|
} 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(
|
DT.Lock memory l = DT.Lock(
|
||||||
k,
|
k,
|
||||||
cCounter,
|
cCounter,
|
||||||
@ -177,30 +192,7 @@ contract P2PIX is BaseUtils {
|
|||||||
sender
|
sender
|
||||||
);
|
);
|
||||||
|
|
||||||
// transaction forwarding must leave `merkleProof` empty;
|
lockID = _addLock(bal, _amount, cCounter, l, t, k);
|
||||||
// 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);
|
|
||||||
|
|
||||||
/* */}/* */}/* */}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Lock release method that liquidate lock
|
/// @notice Lock release method that liquidate lock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user