fix_lint (#11)
Co-authored-by: Arthur Abeilice <afa7789@gmail.com> Reviewed-on: https://git.p2pix.co/doiim/p2pix-smart-contracts/pulls/11 Co-authored-by: arthur <abeilice@kosmos.org> Co-committed-by: arthur <abeilice@kosmos.org>
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
import "@nomicfoundation/hardhat-chai-matchers";
|
||||
import { loadFixture } from "@nomicfoundation/hardhat-network-helpers";
|
||||
import { SignerWithAddress } from "@nomicfoundation/hardhat-ethers/signers";
|
||||
import { expect } from "chai";
|
||||
import { ethers, network } from "hardhat";
|
||||
|
||||
@@ -8,14 +7,11 @@ import { Reputation } from "../src/types";
|
||||
import { curve, repFixture } from "./utils/fixtures";
|
||||
|
||||
describe("Reputation", () => {
|
||||
// contract deployer/admin
|
||||
let owner: SignerWithAddress;
|
||||
// Reputation Interface instance;
|
||||
let reputation: Reputation;
|
||||
|
||||
before("Set signers and reset network", async () => {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
||||
[owner] = await ethers.getSigners();
|
||||
await ethers.getSigners();
|
||||
|
||||
await network.provider.send("hardhat_reset");
|
||||
});
|
||||
|
||||
@@ -1,5 +1,3 @@
|
||||
/* eslint-disable no-useless-escape */
|
||||
|
||||
describe("_", () => {
|
||||
console.log(
|
||||
"/// ______ __\r\n/// .-----.|__ |.-----.|__|.--.--.\r\n/// | _ || __|| _ || ||_ _|\r\n/// | __||______|| __||__||__.__|\r\n/// |__| |__|\r\n///",
|
||||
|
||||
1085
test/p2pix.test.ts
1085
test/p2pix.test.ts
File diff suppressed because it is too large
Load Diff
@@ -4,15 +4,13 @@ import { ethers } from "hardhat";
|
||||
import keccak256 from "keccak256";
|
||||
import { MerkleTree } from "merkletreejs";
|
||||
|
||||
import {
|
||||
MockToken,
|
||||
Multicall,
|
||||
P2PIX,
|
||||
P2PIX__factory,
|
||||
Reputation,
|
||||
} from "../../src/types";
|
||||
import { MockToken, P2PIX__factory } from "../../src/types";
|
||||
|
||||
import { Call, RepFixture, P2PixAndReputation, DepositArgs, LockArgs, ReleaseArgs } from "./interfaces";
|
||||
import {
|
||||
Call,
|
||||
RepFixture,
|
||||
P2PixAndReputation,
|
||||
} from "./interfaces";
|
||||
|
||||
// exported constants
|
||||
export const getSignerAddrs = (
|
||||
@@ -22,18 +20,16 @@ export const getSignerAddrs = (
|
||||
return addrs.slice(0, amount).map(({ address }) => address);
|
||||
};
|
||||
|
||||
export const getBnFrom = (nums: number[]): BigInt[] => {
|
||||
export const getBnFrom = (nums: number[]): bigint[] => {
|
||||
const bns = nums.map(num => BigInt(num));
|
||||
return bns;
|
||||
};
|
||||
|
||||
export const getLockData = (
|
||||
addr: string,
|
||||
locks: BigInt[][],
|
||||
locks: bigint[][],
|
||||
): Call[] => {
|
||||
const iface = new ethers.Interface(
|
||||
P2PIX__factory.abi,
|
||||
);
|
||||
const iface = new ethers.Interface(P2PIX__factory.abi);
|
||||
return locks.map(lock => ({
|
||||
target: addr,
|
||||
callData: iface.encodeFunctionData("getLocksStatus", [
|
||||
@@ -71,8 +67,9 @@ export const curve = (x: number): number => {
|
||||
|
||||
// exported async functions
|
||||
export async function repFixture(): Promise<RepFixture> {
|
||||
const reputation = await ethers.deployContract("Reputation");
|
||||
return { reputation: await reputation.waitForDeployment() };
|
||||
const reputation =
|
||||
await ethers.deployContract("Reputation");
|
||||
return { reputation: await reputation.waitForDeployment() };
|
||||
}
|
||||
|
||||
export async function p2pixFixture(): Promise<P2PixAndReputation> {
|
||||
@@ -81,11 +78,12 @@ export async function p2pixFixture(): Promise<P2PixAndReputation> {
|
||||
await ethers.getSigners(),
|
||||
);
|
||||
|
||||
const reputation = await ethers.deployContract("Reputation");
|
||||
const reputation =
|
||||
await ethers.deployContract("Reputation");
|
||||
|
||||
const erc20 = await ethers.deployContract("MockToken", [
|
||||
ethers.parseEther("20000000") // 20M
|
||||
]) as MockToken;
|
||||
const erc20 = (await ethers.deployContract("MockToken", [
|
||||
ethers.parseEther("20000000"), // 20M
|
||||
])) as MockToken;
|
||||
|
||||
const p2pix = await ethers.deployContract("P2PIX", [
|
||||
10,
|
||||
|
||||
@@ -5,7 +5,6 @@ import {
|
||||
Reputation,
|
||||
} from "../../src/types";
|
||||
|
||||
|
||||
// exported interfaces
|
||||
export interface Deploys {
|
||||
signers: string[];
|
||||
@@ -17,29 +16,29 @@ export interface DepositArgs {
|
||||
pixTarget: string;
|
||||
allowlistRoot: string;
|
||||
token: string;
|
||||
amount: BigInt;
|
||||
amount: bigint;
|
||||
valid: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
export interface LockArgs {
|
||||
seller: string;
|
||||
token: string;
|
||||
amount: BigInt;
|
||||
amount: bigint;
|
||||
merkleProof: string[];
|
||||
expiredLocks: BigInt[];
|
||||
expiredLocks: bigint[];
|
||||
}
|
||||
|
||||
export interface ReleaseArgs {
|
||||
lockID: BigInt;
|
||||
lockID: bigint;
|
||||
pixTimestamp: string;
|
||||
signature: string;
|
||||
}
|
||||
|
||||
export interface Lock {
|
||||
counter: BigInt;
|
||||
expirationBlock: BigInt;
|
||||
counter: bigint;
|
||||
expirationBlock: bigint;
|
||||
pixTarget: string;
|
||||
amount: BigInt;
|
||||
amount: bigint;
|
||||
token: string;
|
||||
buyerAddress: string;
|
||||
seller: string;
|
||||
@@ -72,4 +71,4 @@ export interface MtcFixture {
|
||||
|
||||
export type P2PixAndReputation = P2pixFixture &
|
||||
RepFixture &
|
||||
MtcFixture;
|
||||
MtcFixture;
|
||||
|
||||
Reference in New Issue
Block a user