test: added Deposit unit tests

This commit is contained in:
PedroCailleret
2022-12-04 22:13:54 -03:00
parent eb4cca9c12
commit 606406f889
23 changed files with 367 additions and 31 deletions

View File

@@ -11,6 +11,7 @@ contract Reputation is IReputation, Owned(msg.sender) {
uint256 public constant magicValue = 2.5e11;
// prettier-ignore
// solhint-disable no-inline-assembly
// solhint-disable-next-line no-empty-blocks
constructor(/* */) {/* */}

View File

@@ -7,4 +7,16 @@ contract MockToken is ERC20 {
constructor(uint256 supply) ERC20("MockBRL", "MBRL", 18) {
_mint(msg.sender, supply);
}
function mint(
address[] memory to,
uint256 value
) public virtual {
uint256 len = to.length;
uint256 j;
while (j < len) {
_mint(to[j], value);
++j;
}
}
}

View File

@@ -213,7 +213,7 @@ contract P2PIX is
uint256 spendLimit;
(spendLimit) = _limiter(userCredit);
if (l.amount > spendLimit)
if (l.amount > spendLimit || l.amount > 1e6)
revert AmountNotAllowed();
mapLocks[lockID] = l;
@@ -473,10 +473,12 @@ contract P2PIX is
assembly {
// first 32 bytes eq to array's length
let tLen := mload(_tokens)
// NoTokens()
if iszero(tLen) {
mstore(0x00, 0xdf957883)
revert(0x1c, 0x04)
}
// LengthMismatch()
if iszero(eq(tLen, mload(_states))) {
mstore(0x00, 0xff633a38)
revert(0x1c, 0x04)
@@ -489,6 +491,7 @@ contract P2PIX is
tLoc := add(tLoc, 0x20)
sLoc := add(sLoc, 0x20)
} {
// cache hashmap entry in scratch space
mstore(0x00, mload(tLoc))
mstore(0x20, allowedERC20s.slot)
let mapSlot := keccak256(0x00, 0x40)