Skip to content

Commit 22b4cc2

Browse files
authored
[chore] renaming functions and contracts (#62)
1 parent 9d6d595 commit 22b4cc2

12 files changed

+87
-96
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ git checkout -b <your-branch-name>
6464
npm test
6565
```
6666

67-
7. Add and commit your changes, including a comprehensive commit message summarising your changes, then push changes to your fork. (e.g. Fixed formatting issue with ImmutableERC721PermissionedMintable.sol)
67+
7. Add and commit your changes, including a comprehensive commit message summarising your changes, then push changes to your fork. (e.g. Fixed formatting issue with ImmutableERC721Simple.sol)
6868

6969
```
7070
git add *

contracts/token/erc721/abstract/ERC721Hybrid.sol

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
6060
ERC721Psi._safeMint(to, quantity);
6161
}
6262

63-
function _batchMintByQuantity(Mint[] memory mints) internal {
63+
function _mintBatchByQuantity(Mint[] memory mints) internal {
6464
for (uint i = 0; i < mints.length; i++) {
6565
Mint memory m = mints[i];
6666
_mintByQuantity(m.to, m.quantity);
6767
}
6868
}
6969

70-
function _batchSafeMintByQuantity(Mint[] memory mints) internal {
70+
function _safeMintBatchByQuantity(Mint[] memory mints) internal {
7171
for (uint i = 0; i < mints.length; i++) {
7272
Mint memory m = mints[i];
7373
_safeMintByQuantity(m.to, m.quantity);
@@ -98,13 +98,13 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
9898
_idMintTotalSupply++;
9999
}
100100

101-
function _batchMintByID(address to, uint256[] memory tokenIds) internal {
101+
function _mintBatchByID(address to, uint256[] memory tokenIds) internal {
102102
for (uint i = 0; i < tokenIds.length; i++) {
103103
_mintByID(to, tokenIds[i]);
104104
}
105105
}
106106

107-
function _batchSafeMintByID(address to, uint256[] memory tokenIds) internal {
107+
function _safeMintBatchByID(address to, uint256[] memory tokenIds) internal {
108108
for (uint i = 0; i < tokenIds.length; i++) {
109109
_safeMintByID(to, tokenIds[i]);
110110
}
@@ -115,17 +115,17 @@ abstract contract ERC721Hybrid is ERC721PsiBurnable, ERC721, IImmutableERC721Err
115115
uint256[] tokenIds;
116116
}
117117

118-
function _batchMintByIDToMultiple(IDMint[] memory mints) internal {
118+
function _mintBatchByIDToMultiple(IDMint[] memory mints) internal {
119119
for (uint i = 0; i < mints.length; i++) {
120120
IDMint memory m = mints[i];
121-
_batchMintByID(m.to, m.tokenIds);
121+
_mintBatchByID(m.to, m.tokenIds);
122122
}
123123
}
124124

125-
function _batchSafeMintByIDToMultiple(IDMint[] memory mints) internal {
125+
function _safeMintBatchByIDToMultiple(IDMint[] memory mints) internal {
126126
for (uint i = 0; i < mints.length; i++) {
127127
IDMint memory m = mints[i];
128-
_batchSafeMintByID(m.to, m.tokenIds);
128+
_safeMintBatchByID(m.to, m.tokenIds);
129129
}
130130
}
131131

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import { ERC721 } from "@openzeppelin/contracts/token/ERC721/ERC721.sol";
66
import { MintingAccessControl } from "../abstract/MintingAccessControl.sol";
77
import { ImmutableERC721HybridBase } from "../abstract/ImmutableERC721HybridBase.sol";
88

9-
contract ImmutableERC721HybridPermissionedMintable is ImmutableERC721HybridBase {
9+
contract ImmutableERC721 is ImmutableERC721HybridBase {
1010

1111
constructor(
1212
address owner_,
@@ -21,11 +21,11 @@ contract ImmutableERC721HybridPermissionedMintable is ImmutableERC721HybridBase
2121
ImmutableERC721HybridBase(owner_, name_, symbol_, baseURI_, contractURI_, royaltyAllowlist_, royaltyReceiver_, feeNumerator_)
2222
{}
2323

24-
function mintByID(address to, uint256 tokenId) external onlyRole(MINTER_ROLE) {
24+
function mint(address to, uint256 tokenId) external onlyRole(MINTER_ROLE) {
2525
_mintByID(to, tokenId);
2626
}
2727

28-
function safeMintByID(address to, uint256 tokenId) external onlyRole(MINTER_ROLE) {
28+
function safeMint(address to, uint256 tokenId) external onlyRole(MINTER_ROLE) {
2929
_safeMintByID(to, tokenId);
3030
}
3131

@@ -37,20 +37,20 @@ contract ImmutableERC721HybridPermissionedMintable is ImmutableERC721HybridBase
3737
_safeMintByQuantity(to, quantity);
3838
}
3939

40-
function batchMintByQuantity(Mint[] memory mints) external onlyRole(MINTER_ROLE) {
41-
_batchMintByQuantity(mints);
40+
function mintBatchByQuantity(Mint[] memory mints) external onlyRole(MINTER_ROLE) {
41+
_mintBatchByQuantity(mints);
4242
}
4343

44-
function batchSafeMintByQuantity(Mint[] memory mints) external onlyRole(MINTER_ROLE) {
45-
_batchSafeMintByQuantity(mints);
44+
function safeMintBatchByQuantity(Mint[] memory mints) external onlyRole(MINTER_ROLE) {
45+
_safeMintBatchByQuantity(mints);
4646
}
4747

48-
function batchMintByIDToMultiple(IDMint[] memory mints) external onlyRole(MINTER_ROLE) {
49-
_batchMintByIDToMultiple(mints);
48+
function mintBatch(IDMint[] memory mints) external onlyRole(MINTER_ROLE) {
49+
_mintBatchByIDToMultiple(mints);
5050
}
5151

52-
function batchSafeMintByIDToMultiple(IDMint[] memory mints) external onlyRole(MINTER_ROLE) {
53-
_batchSafeMintByIDToMultiple(mints);
52+
function safeMintBatch(IDMint[] memory mints) external onlyRole(MINTER_ROLE) {
53+
_safeMintBatchByIDToMultiple(mints);
5454
}
5555

5656
function safeTransferFromBatch(TransferRequest calldata tr) external {

contracts/token/erc721/preset/ImmutableERC721PermissionedMintable.sol renamed to contracts/token/erc721/preset/ImmutableERC721Simple.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import "../abstract/ImmutableERC721Base.sol";
55
import "@openzeppelin/contracts/token/ERC721/extensions/ERC721Burnable.sol";
66
import "@openzeppelin/contracts/token/common/ERC2981.sol";
77

8-
contract ImmutableERC721PermissionedMintable is ImmutableERC721Base {
8+
contract ImmutableERC721Simple is ImmutableERC721Base {
99
/// ===== Constructor =====
1010

1111
/**

test/royalty-enforcement/AllowlistERC721TransfersApprovals.test.ts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect } from "chai";
22
import { ethers } from "hardhat";
33
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
44
import {
5-
ImmutableERC721PermissionedMintable,
5+
ImmutableERC721Simple,
66
MockMarketplace,
77
MockFactory,
88
RoyaltyAllowlist,
@@ -19,7 +19,7 @@ import {
1919
describe("Allowlisted ERC721 Transfers", function () {
2020
this.timeout(300_000); // 5 min
2121

22-
let erc721: ImmutableERC721PermissionedMintable;
22+
let erc721: ImmutableERC721Simple;
2323
let walletFactory: MockWalletFactory;
2424
let factory: MockFactory;
2525
let royaltyAllowlist: RoyaltyAllowlist;
@@ -58,9 +58,7 @@ describe("Allowlisted ERC721 Transfers", function () {
5858

5959
it("Should not allow contracts that do not implement the IRoyaltyAllowlist to be set", async function () {
6060
// Deploy another contract that implements IERC165, but not IRoyaltyAllowlist
61-
const factory = await ethers.getContractFactory(
62-
"ImmutableERC721PermissionedMintable"
63-
);
61+
const factory = await ethers.getContractFactory("ImmutableERC721Simple");
6462
const erc721Two = await factory.deploy(
6563
owner.address,
6664
"",

test/royalty-enforcement/HybridApproval.test.ts

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { expect } from "chai";
22
import { ethers } from "hardhat";
33
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
44
import {
5-
ImmutableERC721HybridPermissionedMintable,
5+
ImmutableERC721,
66
MockMarketplace,
77
MockFactory,
88
RoyaltyAllowlist,
@@ -17,7 +17,7 @@ import {
1717
} from "../utils/DeployHybridFixtures";
1818

1919
describe("Royalty Checks with Hybrid ERC721", function () {
20-
let erc721: ImmutableERC721HybridPermissionedMintable;
20+
let erc721: ImmutableERC721;
2121
let walletFactory: MockWalletFactory;
2222
let factory: MockFactory;
2323
let royaltyAllowlist: RoyaltyAllowlist;
@@ -56,9 +56,7 @@ describe("Royalty Checks with Hybrid ERC721", function () {
5656

5757
it("Should not allow contracts that do not implement the IRoyaltyAllowlist to be set", async function () {
5858
// Deploy another contract that implements IERC165, but not IRoyaltyAllowlist
59-
const factory = await ethers.getContractFactory(
60-
"ImmutableERC721HybridPermissionedMintable"
61-
);
59+
const factory = await ethers.getContractFactory("ImmutableERC721");
6260
const erc721Two = await factory.deploy(
6361
owner.address,
6462
"",
@@ -206,7 +204,7 @@ describe("Royalty Checks with Hybrid ERC721", function () {
206204
});
207205

208206
it("Should block transfers to a not allow listed address", async function () {
209-
await erc721.connect(minter).mintByID(minter.address, 1);
207+
await erc721.connect(minter).mint(minter.address, 1);
210208
await expect(
211209
erc721
212210
.connect(minter)
@@ -220,7 +218,7 @@ describe("Royalty Checks with Hybrid ERC721", function () {
220218
await royaltyAllowlist
221219
.connect(registrar)
222220
.addAddressToAllowlist([marketPlace.address]);
223-
await erc721.connect(minter).mintByID(minter.address, 4);
221+
await erc721.connect(minter).mint(minter.address, 4);
224222
await erc721.connect(minter).setApprovalForAll(marketPlace.address, true);
225223
expect(await erc721.balanceOf(accs[3].address)).to.be.equal(0);
226224
await marketPlace.connect(minter).executeTransfer(accs[3].address, 4);
@@ -250,8 +248,8 @@ describe("Royalty Checks with Hybrid ERC721", function () {
250248
saltThree
251249
);
252250
// Mint NFTs to the wallets
253-
await erc721.connect(minter).mintByID(deployedAddr, 10);
254-
await erc721.connect(minter).mintByID(deployedAddrTwo, 11);
251+
await erc721.connect(minter).mint(deployedAddr, 10);
252+
await erc721.connect(minter).mint(deployedAddrTwo, 11);
255253

256254
// Connect to wallets
257255
const wallet = await ethers.getContractAt("MockWallet", deployedAddr);
@@ -315,7 +313,7 @@ describe("Royalty Checks with Hybrid ERC721", function () {
315313
const { deployedAddr, salt, constructorByteCode } =
316314
await disguidedEOAFixture(erc721.address, factory, "0x1234");
317315
// Approve disguised EOA
318-
await erc721.connect(minter).mintByID(minter.address, 1);
316+
await erc721.connect(minter).mint(minter.address, 1);
319317
await erc721.connect(minter).setApprovalForAll(deployedAddr, true);
320318
// Deploy disguised EOA
321319
await factory.connect(accs[5]).deploy(salt, constructorByteCode);
@@ -350,7 +348,7 @@ describe("Royalty Checks with Hybrid ERC721", function () {
350348
accs[6].address
351349
);
352350
// Mint and transfer to receiver contract
353-
await erc721.connect(minter).mintByID(minter.address, 1);
351+
await erc721.connect(minter).mint(minter.address, 1);
354352
// Fails as transfer 'to' is now allowlisted
355353
await expect(
356354
erc721

test/royalty-enforcement/RoyaltyAllowlist.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
RegularAllowlistFixture,
77
} from "../utils/DeployRegularFixtures";
88
import {
9-
ImmutableERC721PermissionedMintable,
9+
ImmutableERC721Simple,
1010
MockMarketplace,
1111
RoyaltyAllowlist,
1212
MockWalletFactory,
@@ -19,7 +19,7 @@ describe("Royalty Enforcement Test Cases", function () {
1919
let owner: SignerWithAddress;
2020
let registrar: SignerWithAddress;
2121
let scWallet: SignerWithAddress;
22-
let erc721: ImmutableERC721PermissionedMintable;
22+
let erc721: ImmutableERC721Simple;
2323
let walletFactory: MockWalletFactory;
2424
let royaltyAllowlist: RoyaltyAllowlist;
2525
let marketPlace: MockMarketplace;

test/royalty-enforcement/RoyaltyMarketplace.test.ts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { expect } from "chai";
22
import { ethers } from "hardhat";
33
import { SignerWithAddress } from "@nomiclabs/hardhat-ethers/signers";
44
import {
5-
ImmutableERC721PermissionedMintable__factory,
6-
ImmutableERC721PermissionedMintable,
5+
ImmutableERC721Simple__factory,
6+
ImmutableERC721Simple,
77
RoyaltyAllowlist,
88
RoyaltyAllowlist__factory,
99
MockMarketplace__factory,
@@ -13,7 +13,7 @@ import {
1313
describe("Marketplace Royalty Enforcement", function () {
1414
this.timeout(300_000); // 5 min
1515

16-
let erc721: ImmutableERC721PermissionedMintable;
16+
let erc721: ImmutableERC721Simple;
1717
let royaltyAllowlist: RoyaltyAllowlist;
1818
let mockMarketplace: MockMarketplace;
1919
let owner: SignerWithAddress;
@@ -41,8 +41,8 @@ describe("Marketplace Royalty Enforcement", function () {
4141

4242
// Deploy ERC721 contract
4343
const erc721PresetFactory = (await ethers.getContractFactory(
44-
"ImmutableERC721PermissionedMintable"
45-
)) as ImmutableERC721PermissionedMintable__factory;
44+
"ImmutableERC721Simple"
45+
)) as ImmutableERC721Simple__factory;
4646

4747
erc721 = await erc721PresetFactory.deploy(
4848
owner.address,

0 commit comments

Comments
 (0)