Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wip: MintPoint base test #546

Open
wants to merge 1 commit into
base: feature/mint-point
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
79 changes: 79 additions & 0 deletions hardhat/test/MintPoint.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { expect } from "chai";
import { ethers, upgrades } from "hardhat";
import {
MintPoint,
// eslint-disable-next-line node/no-missing-import
} from "../typechain";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { BigNumberish, BytesLike, Signer, utils } from "ethers";

const DEFAULT_ADMIN_ROLE = ethers.constants.HashZero;
const MINTER_ROLE = utils.keccak256(utils.toUtf8Bytes("MINTER_ROLE"));

const deployMintPoint = async () => {
const MintPointFactory = await ethers.getContractFactory("MintPoint");
const deployedMintPoint: MintPoint = (await upgrades.deployProxy(
MintPointFactory,
[],
{
initializer: "initialize",
}
)) as any;
await deployedMintPoint.deployed();

console.log("mintPoint address:", deployedMintPoint.address);

return deployedMintPoint;
};

const deployAll = async () => {
const mintPoint = await deployMintPoint();
return [mintPoint];
};

describe("MintPoint", () => {
let mintPoint: MintPoint;

let organizer: SignerWithAddress;
let participant1: SignerWithAddress;

before(async () => {
[organizer, participant1] = await ethers.getSigners();
[mintPoint] = await deployAll();
});

describe("initialize", () => {
it("name", async () => {
expect(await mintPoint.name()).to.equal("MintPoint");
});

it("symbol", async () => {
expect(await mintPoint.symbol()).to.equal("MNT");
});

it("decimals", async () => {
expect(await mintPoint.tokenIds()).to.equal(1);
});

it("DEFAULT_ADMIN_ROLE", async () => {
expect(
await mintPoint.hasRole(DEFAULT_ADMIN_ROLE, organizer.address)
).to.equal(true);
});

it("MINTER_ROLE", async () => {
expect(await mintPoint.hasRole(MINTER_ROLE, organizer.address)).to.equal(
true
);
});
});

describe("mint", () => {
it("should mint a token", async () => {
await(
await mintPoint.connect(organizer)
.mint(participant1.address, 0, ethers.utils.parseEther("1"))
).wait();
});
});
});