bond to override lock limit
This commit is contained in:
@@ -44,4 +44,5 @@ abstract contract Constants {
|
||||
uint256 constant MAXBALANCE_UPPERBOUND = 1e8 ether;
|
||||
uint256 constant REPUTATION_LOWERBOUND = 1e2 ether;
|
||||
uint256 constant LOCKAMOUNT_UPPERBOUND = 1e6 ether;
|
||||
uint256 constant BOND_DIVISOR = 4; // 6,25%
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ library DataTypes {
|
||||
ERC20 token;
|
||||
address buyerAddress;
|
||||
address seller;
|
||||
bool bond;
|
||||
}
|
||||
|
||||
// prettier-ignore
|
||||
|
||||
@@ -135,7 +135,8 @@ contract P2PIX is BaseUtils {
|
||||
ERC20 token,
|
||||
uint80 amount,
|
||||
bytes32[] calldata merkleProof,
|
||||
uint256[] calldata expiredLocks
|
||||
uint256[] calldata expiredLocks,
|
||||
bool bond
|
||||
) public nonReentrant returns (uint256 lockID) {
|
||||
unlockExpired(expiredLocks);
|
||||
|
||||
@@ -154,10 +155,17 @@ contract P2PIX is BaseUtils {
|
||||
|
||||
bytes32 _pixTarget = getPixTarget(seller, token);
|
||||
|
||||
// transaction forwarding must leave `merkleProof` empty;
|
||||
// otherwise, the trustedForwarder must be previously added
|
||||
// to a seller whitelist.
|
||||
if (merkleProof.length != 0) {
|
||||
if (bond){
|
||||
SafeTransferLib.safeTransferFrom(
|
||||
token,
|
||||
_msgSender(),
|
||||
address(this),
|
||||
amount >> BOND_DIVISOR
|
||||
);
|
||||
} else if (merkleProof.length != 0) {
|
||||
// transaction forwarding must leave `merkleProof` empty;
|
||||
// otherwise, the trustedForwarder must be previously added
|
||||
// to a seller whitelist.
|
||||
_merkleVerify( merkleProof, sellerAllowList(seller), _msgSender());
|
||||
|
||||
} else if ( amount > REPUTATION_LOWERBOUND && msg.sender == _msgSender() ) {
|
||||
@@ -178,7 +186,8 @@ contract P2PIX is BaseUtils {
|
||||
amount,
|
||||
token,
|
||||
_msgSender(),
|
||||
seller
|
||||
seller,
|
||||
bond
|
||||
);
|
||||
|
||||
_addLock(bal, l);
|
||||
@@ -237,7 +246,7 @@ contract P2PIX is BaseUtils {
|
||||
SafeTransferLib.safeTransfer(
|
||||
t,
|
||||
l.buyerAddress,
|
||||
lockAmount
|
||||
l.bond ? lockAmount + lockAmount >> BOND_DIVISOR : lockAmount
|
||||
);
|
||||
|
||||
emit LockReleased(l.buyerAddress, lockID, lockAmount);
|
||||
|
||||
Reference in New Issue
Block a user