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

@@ -9,4 +9,7 @@ export enum P2PixErrors {
TxAlreadyUsed = "TxAlreadyUsed",
InvalidSigner = "InvalidSigner",
UNAUTHORIZED = "UNAUTHORIZED",
TokenDenied = "TokenDenied",
NoTokens = "NoTokens",
LengthMismatch = "LengthMismatch",
}

View File

@@ -1,5 +1,5 @@
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { Signer } from "ethers";
import { BigNumber, Signer } from "ethers";
import { ethers } from "hardhat";
// import keccak256 from "keccak256";
@@ -11,6 +11,25 @@ import {
} from "../../src/types";
// exported interfaces
export interface Deposit {
remaining: BigNumber;
pixTarget: string;
seller: string;
token: string;
valid: boolean;
}
export interface Lock {
depositID: string;
relayerPremium: string;
amount: string;
expirationBlock: string;
buyerAddress: string;
relayerTarget: string;
relayerAddress: string;
}
export interface P2pixFixture {
p2pix: P2PIX;
erc20: MockToken;
@@ -95,7 +114,7 @@ export async function p2pixFixture(): Promise<P2PixAndReputation> {
const P2PIX = await ethers.getContractFactory("P2PIX");
const p2pix = (await P2PIX.deploy(
4,
10,
validSigners,
reputation.address,
[erc20.address],