From 5c989e3596b7b68706437ee60a3f243c8e00eadf Mon Sep 17 00:00:00 2001 From: hueso Date: Mon, 27 Feb 2023 15:15:51 -0300 Subject: [PATCH] added lock bonds (hardcoded to 6,25%) --- contracts/p2pix.sol | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/contracts/p2pix.sol b/contracts/p2pix.sol index f68bc1e..456c2e3 100644 --- a/contracts/p2pix.sol +++ b/contracts/p2pix.sol @@ -222,7 +222,9 @@ contract P2PIX is msg.sender ); } else if (_amount > 1e2 ether) { - + if (_amount > 1e6 ether) + revert AmountNotAllowed(); + uint256 userCredit = userRecord[ _castAddrToKey(msg.sender) ]; @@ -230,10 +232,15 @@ contract P2PIX is uint256 spendLimit; (spendLimit) = _limiter(userCredit / WAD); - if ( - _amount > (spendLimit * WAD) || - _amount > 1e6 ether - ) revert AmountNotAllowed(); + if (_amount > (spendLimit * WAD)) { + SafeTransferLib.safeTransferFrom( + t, + msg.sender, + address(this), + _amount >> 4 // 6,25% + ); + _amount += _amount >> 4; + } } DT.Lock memory l = DT.Lock(