Skip to content
Open
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions contracts/mocks/ERC3525Mock.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import "../utils/StringConvertor.sol";
contract ERC3525Mock is ERC3525Upgradeable {

using StringConvertor for uint256;
using Strings for uint256;

/**
* @notice Properties of the slot, which determine the value of slot.
Expand Down
1 change: 1 addition & 0 deletions hardhat.config.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require("@nomicfoundation/hardhat-toolbox");
require("@nomiclabs/hardhat-ethers");

module.exports = {
solidity: {
Expand Down
76 changes: 38 additions & 38 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"@nomicfoundation/hardhat-chai-matchers": "^1.0.3",
"@nomicfoundation/hardhat-network-helpers": "^1.0.4",
"@nomicfoundation/hardhat-toolbox": "^1.0.2",
"@nomiclabs/hardhat-ethers": "^2.2.0",
"dotenv": "^16.0.1",
"eslint": "^8.23.0",
"eslint-config-prettier": "^8.5.0",
Expand All @@ -34,6 +35,7 @@
"eslint-plugin-node": "^11.1.0",
"eslint-plugin-prettier": "^4.2.1",
"eslint-plugin-promise": "^6.0.1",
"ethers": "^5.7.1",
"hardhat": "^2.10.2",
"hardhat-contract-sizer": "^2.6.1",
"hardhat-tracer": "^1.1.0-rc.8",
Expand Down
15 changes: 8 additions & 7 deletions test/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { BigNumber } from "ethers";
import { expect } from "chai";
import { ethers } from "hardhat";
import { ERC3525BurnableUpgradeable } from "../typechain";
import { ERC3525BurnableUpgradeable } from "../typechain-types/contracts";
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
import { TokenData, ZERO_ADDRESS } from "./lib/constants";
const hre = require("hardhat");
const { ethers } = hre;

describe("ERC3525", function () {
const deploy = async (): Promise<ERC3525BurnableUpgradeable> => {
Expand Down Expand Up @@ -83,7 +84,7 @@ describe("ERC3525", function () {

expect(await t.erc3525["balanceOf(address)"](t.owner)).to.eq(t.id);
expect(await t.erc3525.ownerOf(t.id)).to.eq(t.owner);
await expect(t.erc3525.ownerOf(5)).revertedWith(
await expect(t.erc3525.ownerOf(5)).rejectedWith(
"ERC3525: owner query for nonexistent token"
);
expect(await t.erc3525["balanceOf(uint256)"](t.id)).to.eq(t.balance);
Expand Down Expand Up @@ -117,8 +118,8 @@ describe("ERC3525", function () {
expect(await t.erc3525.getApproved(t.id)).to.eq(approval.address);
await expect(
t.erc3525["approve(address,uint256)"](approval.address, 5)
).revertedWith("ERC3525: owner query for nonexistent token");
await expect(t.erc3525.getApproved(6)).revertedWith(
).rejectedWith("ERC3525: owner query for nonexistent token");
await expect(t.erc3525.getApproved(6)).rejectedWith(
"ERC3525: approved query for nonexistent token"
);
});
Expand Down Expand Up @@ -170,15 +171,15 @@ describe("ERC3525", function () {
approval.address,
t.balance
)
).revertedWith("ERC3525: approve caller is not owner nor approved for all");
).rejectedWith("ERC3525: approve caller is not owner nor approved for all");

await expect(
t.erc3525["transferFrom(address,address,uint256)"](
approval.address,
other.address,
t.id
)
).revertedWith("ERC3525: transfer caller is not owner nor approved");
).rejectedWith("ERC3525: transfer caller is not owner nor approved");
});

it("transfer id should be success after setApprovalForAll", async () => {
Expand Down
2 changes: 1 addition & 1 deletion test/lib/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { BigNumber } from "ethers";
import { ERC3525BurnableUpgradeable } from "../../typechain";
import { ERC3525BurnableUpgradeable } from "../../typechain-types/contracts";

export const ZERO_ADDRESS = "0x0000000000000000000000000000000000000000";
export const ZERO_TOKEN_ID = 0;
Expand Down