54 lines
1.5 KiB
JavaScript
54 lines
1.5 KiB
JavaScript
const NftBuner = artifacts.require("NftBuner");
|
|
const BEBadge = artifacts.require("BEBadge");
|
|
const NFTSbt = artifacts.require("NFTSbt");
|
|
const {
|
|
BN,
|
|
constants,
|
|
expectEvent,
|
|
expectRevert,
|
|
} = require("@openzeppelin/test-helpers");
|
|
const Web3 = require("web3");
|
|
|
|
contract("NftBuner", (accounts) => {
|
|
let nftBuner;
|
|
let badge;
|
|
let sbt;
|
|
const owner = accounts[0];
|
|
const user = accounts[1];
|
|
const executor = accounts[2];
|
|
let web3 = new Web3(Web3.givenProvider);
|
|
|
|
beforeEach(async () => {
|
|
badge = await BEBadge.new("CRYPTO ELITE'S HERO", "HERO", 0);
|
|
sbt = await NFTSbt.new("CRYPTO ELITE'S HERO", "SBT", 0);
|
|
nftBuner = await NftBuner.new();
|
|
await badge.setBurnRole(nftBuner.address);
|
|
await sbt.setBurnRole(nftBuner.address);
|
|
});
|
|
|
|
it("should burn the badge", async () => {
|
|
await badge.batchMint(user, 2, { from: owner });
|
|
const receipt = await nftBuner.brunBadge(
|
|
badge.address,
|
|
[1, 2],
|
|
{ from: user }
|
|
);
|
|
|
|
const balanceOfUser = await badge.balanceOf(user);
|
|
assert.equal(balanceOfUser, 0, "Incorrect user balance");
|
|
});
|
|
|
|
it("should burn the sbt", async () => {
|
|
await sbt.batchMint(user, 2, { from: owner });
|
|
await sbt.setApprovalForAll(nftBuner.address, true, { from: user });
|
|
const receipt = await nftBuner.burnSbt(
|
|
sbt.address,
|
|
[1, 2],
|
|
{ from: user }
|
|
);
|
|
console.log(receipt);
|
|
|
|
const balanceOfUser = await sbt.balanceOf(user);
|
|
assert.equal(balanceOfUser, 0, "Incorrect user balance");
|
|
});
|
|
}); |