revamped lock conditionals
This commit is contained in:
parent
a0e39bafab
commit
d5aee72bed
@ -215,6 +215,27 @@ contract P2PIX is
|
|||||||
mapLocks[cCounter].expirationBlock >= block.number
|
mapLocks[cCounter].expirationBlock >= block.number
|
||||||
) revert NotExpired();
|
) revert NotExpired();
|
||||||
|
|
||||||
|
if (merkleProof.length != 0) {
|
||||||
|
merkleVerify(
|
||||||
|
merkleProof,
|
||||||
|
sellerAllowList[k],
|
||||||
|
msg.sender
|
||||||
|
);
|
||||||
|
} else if (_amount > 1e2 ether) {
|
||||||
|
|
||||||
|
uint256 userCredit = userRecord[
|
||||||
|
_castAddrToKey(msg.sender)
|
||||||
|
];
|
||||||
|
|
||||||
|
uint256 spendLimit;
|
||||||
|
(spendLimit) = _limiter(userCredit / WAD);
|
||||||
|
|
||||||
|
if (
|
||||||
|
_amount > (spendLimit * WAD) ||
|
||||||
|
_amount > 1e6 ether
|
||||||
|
) revert AmountNotAllowed();
|
||||||
|
}
|
||||||
|
|
||||||
DT.Lock memory l = DT.Lock(
|
DT.Lock memory l = DT.Lock(
|
||||||
k,
|
k,
|
||||||
cCounter,
|
cCounter,
|
||||||
@ -228,48 +249,12 @@ contract P2PIX is
|
|||||||
address(t)
|
address(t)
|
||||||
);
|
);
|
||||||
|
|
||||||
if (merkleProof.length != 0) {
|
_addLock(bal, _amount, cCounter, l, t, k);
|
||||||
merkleVerify(
|
|
||||||
merkleProof,
|
|
||||||
sellerAllowList[k],
|
|
||||||
msg.sender
|
|
||||||
);
|
|
||||||
|
|
||||||
_addLock(bal, _amount, cCounter, l, t, k);
|
lockCounter++;
|
||||||
|
|
||||||
lockCounter++;
|
// Halt execution and output `lockID`.
|
||||||
|
return cCounter;
|
||||||
// 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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @notice Lock release method that liquidate lock
|
/// @notice Lock release method that liquidate lock
|
||||||
|
Loading…
x
Reference in New Issue
Block a user