Skip to content

Commit 0b2bbe0

Browse files
committed
Renamed whitelist to allowlist
1 parent 041afd7 commit 0b2bbe0

File tree

7 files changed

+37
-37
lines changed

7 files changed

+37
-37
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ This is a brief introduction to the structure of the contract, if you are intere
4242

4343
### Membership
4444

45-
The Member Contract is the entry point for other subcontracts, and it is an `ERC721` contract. It includes a simple whitelist invitation function and provides the `investMint(to)` method to ensure that external investors get a corresponding membership (similar to a board of managers)
45+
The Member Contract is the entry point for other subcontracts, and it is an `ERC721` contract. It includes a simple allowlist invitation function and provides the `investMint(to)` method to ensure that external investors get a corresponding membership (similar to a board of managers)
4646

4747
### Share
4848

contracts/core/Membership.sol

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ contract Membership is
191191

192192
revokeRole(PAUSER_ROLE, _msgSender());
193193
revokeRole(DEFAULT_ADMIN_ROLE, _msgSender());
194-
// reserved the INVITER_ROLE case we need it to modify the whitelist by a non-admin deployer address.
194+
// reserved the INVITER_ROLE case we need it to modify the allowlist by a non-admin deployer address.
195195
}
196196

197197
/**
@@ -209,7 +209,7 @@ contract Membership is
209209
}
210210

211211
/**
212-
* @dev Treasury could mint for a investor by pass the whitelist check
212+
* @dev Treasury could mint for a investor by pass the allowlist check
213213
*/
214214
function investMint(address to) external onlyRole(DEFAULT_ADMIN_ROLE) returns (uint256) {
215215
if (balanceOf(to) > 0) {
@@ -238,9 +238,9 @@ contract Membership is
238238
}
239239

240240
/**
241-
* @dev update whitelist by a back-end server bot
241+
* @dev update allowlist by a back-end server bot
242242
*/
243-
function updateWhitelist(bytes32 merkleTreeRoot_) public {
243+
function updateAllowlist(bytes32 merkleTreeRoot_) public {
244244
if (!hasRole(INVITER_ROLE, _msgSender())) revert Errors.NotInviter();
245245

246246
_merkleTreeRoot = merkleTreeRoot_;

contracts/interfaces/IMembership.sol

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ interface IMembership is IERC721, IERC721Enumerable {
1919

2020
function isInvestor(uint256 tokenId) external view returns (bool);
2121

22-
function updateWhitelist(bytes32 merkleTreeRoot_) external;
22+
function updateAllowlist(bytes32 merkleTreeRoot_) external;
2323

2424
function tokenURI(uint256 tokenId) external view returns (string memory);
2525

tests/governor.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ describe('Governor', function () {
2626
await deployments.fixture(['Mocks']);
2727
await contractsReady(this, true)();
2828

29-
this.voters = this.whitelistAccounts;
30-
this.votersAddresses = this.whitelistAddresses;
29+
this.voters = this.allowlistAccounts;
30+
this.votersAddresses = this.allowlistAddresses;
3131
this.receiver = await ethers.getContract('CallReceiverMock');
3232

3333
// Proposal for testing

tests/membership.js

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -131,42 +131,42 @@ describe('Membership', function () {
131131
});
132132
});
133133

134-
describe('#updateWhitelist', function () {
134+
describe('#updateAllowlist', function () {
135135
it('Should not updated by invalid account', async function () {
136136
await expect(
137137
this.membership
138138
.connect(await ethers.getSigner(this.accounts[1]))
139-
.updateWhitelist(this.rootHash)
139+
.updateAllowlist(this.rootHash)
140140
).to.be.revertedWith('NotInviter()');
141141
});
142142
});
143143

144144
describe('#mint', function () {
145-
it('Should able to mint NFT for account in whitelist', async function () {
146-
await this.membership.updateWhitelist(this.rootHash);
145+
it('Should able to mint NFT for account in allowlist', async function () {
146+
await this.membership.updateAllowlist(this.rootHash);
147147
await expect(this.membership.mint(this.proofs[0]))
148148
.to.changeTokenBalance(this.membership, this.ownerAddress, 1)
149149
.to.emit(this.membership, 'Transfer')
150150
.withArgs(zeroAddres, this.ownerAddress, 0);
151151
});
152152

153153
it('Should not able to mint NFT for an account more than once', async function () {
154-
await this.membership.updateWhitelist(this.rootHash);
154+
await this.membership.updateAllowlist(this.rootHash);
155155
await this.membership.mint(this.proofs[0]);
156156

157157
await expect(this.membership.mint(this.proofs[0])).to.be.revertedWith(
158158
'MembershipAlreadyClaimed()'
159159
);
160160
});
161161

162-
it('Should not able to mint NFT for account in whitelist with badProof', async function () {
163-
await this.membership.updateWhitelist(this.rootHash);
162+
it('Should not able to mint NFT for account in allowlist with badProof', async function () {
163+
await this.membership.updateAllowlist(this.rootHash);
164164

165165
await expect(this.membership.mint(this.badProof)).to.be.revertedWith('InvalidProof()');
166166
});
167167

168-
it('Should not able to mint NFT for account not in whitelist', async function () {
169-
await this.membership.updateWhitelist(this.rootHash);
168+
it('Should not able to mint NFT for account not in allowlist', async function () {
169+
await this.membership.updateAllowlist(this.rootHash);
170170

171171
await expect(
172172
this.membership.connect(await ethers.getSigner(this.accounts[4])).mint(this.badProof)
@@ -176,15 +176,15 @@ describe('Membership', function () {
176176

177177
describe('#tokenURI', function () {
178178
it('Should return a server-side token URI by default', async function () {
179-
await this.membership.updateWhitelist(this.rootHash);
179+
await this.membership.updateAllowlist(this.rootHash);
180180
await this.membership.mint(this.proofs[0]);
181181

182182
// Notice: hard code tokenId(0) here
183183
expect(await this.membership.tokenURI(0)).to.equal(`${_args[2].membership.baseTokenURI}0`);
184184
});
185185

186186
it('Should return a decentralized token URI after updated', async function () {
187-
await this.membership.updateWhitelist(this.rootHash);
187+
await this.membership.updateAllowlist(this.rootHash);
188188
await this.membership.mint(this.proofs[0]);
189189
await this.membership.updateTokenURI(0, _testJSONString);
190190

@@ -197,7 +197,7 @@ describe('Membership', function () {
197197

198198
describe('#pause', function () {
199199
it('Should not able to transfer tokens after paused', async function () {
200-
await this.membership.updateWhitelist(this.rootHash);
200+
await this.membership.updateAllowlist(this.rootHash);
201201
await this.membership.mint(this.proofs[0]);
202202
await this.membership.pause();
203203

@@ -207,14 +207,14 @@ describe('Membership', function () {
207207
});
208208

209209
it('Should able to mint tokens even after paused', async function () {
210-
await this.membership.updateWhitelist(this.rootHash);
210+
await this.membership.updateAllowlist(this.rootHash);
211211
await this.membership.mint(this.proofs[0]);
212212
await this.membership.pause();
213-
await this.membership.connect(this.whitelistAccounts[1]).mint(this.proofs[1]);
213+
await this.membership.connect(this.allowlistAccounts[1]).mint(this.proofs[1]);
214214

215215
// Notice: hard code tokenId(1) here
216-
expect(await this.membership.balanceOf(this.whitelistAddresses[1])).to.equal(1);
217-
expect(await this.membership.ownerOf(1)).to.equal(await this.whitelistAddresses[1]);
216+
expect(await this.membership.balanceOf(this.allowlistAddresses[1])).to.equal(1);
217+
expect(await this.membership.ownerOf(1)).to.equal(await this.allowlistAddresses[1]);
218218
});
219219
});
220220
});

tests/modules.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ describe('Modules', function () {
7373

7474
it('Should not be able to propose by unauth account', async function () {
7575
await expect(
76-
this.modules.payroll.connect(this.whitelistAccounts[2]).propose(...this.proposal)
76+
this.modules.payroll.connect(this.allowlistAccounts[2]).propose(...this.proposal)
7777
).to.be.revertedWith('NotOperator()');
7878
});
7979

@@ -99,7 +99,7 @@ describe('Modules', function () {
9999
this.modules.payroll,
100100
'ModuleProposalConfirmed'
101101
);
102-
await expect(this.modules.payroll.connect(this.whitelistAccounts[1]).confirm(id)).to.emit(
102+
await expect(this.modules.payroll.connect(this.allowlistAccounts[1]).confirm(id)).to.emit(
103103
this.modules.payroll,
104104
'ModuleProposalConfirmed'
105105
);
@@ -120,7 +120,7 @@ describe('Modules', function () {
120120
this.modules.payroll,
121121
'ModuleProposalConfirmed'
122122
);
123-
await expect(this.modules.payroll.connect(this.whitelistAccounts[1]).confirm(id)).to.emit(
123+
await expect(this.modules.payroll.connect(this.allowlistAccounts[1]).confirm(id)).to.emit(
124124
this.modules.payroll,
125125
'ModuleProposalConfirmed'
126126
);
@@ -185,7 +185,7 @@ describe('Modules', function () {
185185
'ModuleProposalConfirmed'
186186
);
187187
await expect(
188-
this.modules.payroll.connect(this.whitelistAccounts[1]).confirm(proposalId)
188+
this.modules.payroll.connect(this.allowlistAccounts[1]).confirm(proposalId)
189189
).to.emit(this.modules.payroll, 'ModuleProposalConfirmed');
190190

191191
await expect(this.modules.payroll.schedule(proposalId)).to.emit(

utils/helpers.js

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,18 @@ module.exports.setupProof = async function (context, _index = 4) {
66
const { deployer } = await getNamedAccounts();
77
const accounts = await getUnnamedAccounts();
88

9-
const whitelistAddresses = [deployer].concat(accounts.filter((_, idx) => idx < _index));
10-
const leafNodes = whitelistAddresses.map((adr) => keccak256(adr));
9+
const allowlistAddresses = [deployer].concat(accounts.filter((_, idx) => idx < _index));
10+
const leafNodes = allowlistAddresses.map((adr) => keccak256(adr));
1111
const merkleTree = new MerkleTree(leafNodes, keccak256, {
1212
sortPairs: true,
1313
});
1414

1515
const deps = {
1616
rootHash: merkleTree.getHexRoot(),
17-
proofs: whitelistAddresses.map((addr) => merkleTree.getHexProof(keccak256(addr))),
17+
proofs: allowlistAddresses.map((addr) => merkleTree.getHexProof(keccak256(addr))),
1818
badProof: merkleTree.getHexProof(keccak256(accounts[_index])),
19-
whitelistAddresses,
20-
whitelistAccounts: await Promise.all(whitelistAddresses.map((v) => ethers.getSigner(v))),
19+
allowlistAddresses,
20+
allowlistAccounts: await Promise.all(allowlistAddresses.map((v) => ethers.getSigner(v))),
2121
accounts,
2222
owner: await ethers.getSigner(deployer),
2323
ownerAddress: deployer,
@@ -42,15 +42,15 @@ module.exports.contractsReady = function (context, instantMint = false) {
4242
const governor = Governor.attach(await membership.governor());
4343

4444
if (instantMint) {
45-
await membership.updateWhitelist(context.rootHash);
45+
await membership.updateAllowlist(context.rootHash);
4646
await membership.setupGovernor();
4747

48-
// Do NOT use `context.whitelistAccounts.forEach` to avoid a block number change
48+
// Do NOT use `context.allowlistAccounts.forEach` to avoid a block number change
4949
await Promise.all(
50-
context.whitelistAccounts.map((account, idx) => {
50+
context.allowlistAccounts.map((account, idx) => {
5151
return Promise.all([
5252
membership.connect(account).mint(context.proofs[idx]),
53-
membership.connect(account).delegate(context.whitelistAddresses[idx]),
53+
membership.connect(account).delegate(context.allowlistAddresses[idx]),
5454
]);
5555
})
5656
);

0 commit comments

Comments
 (0)