-
Notifications
You must be signed in to change notification settings - Fork 12.3k
ERC6909Pausable #6174
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
base: master
Are you sure you want to change the base?
ERC6909Pausable #6174
Conversation
🦋 Changeset detectedLatest commit: 2700b3b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
WalkthroughThis pull request introduces ERC6909Pausable, a new abstract contract that integrates the ERC6909 token standard with pausable functionality. The contract overrides the Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
.changeset/full-chicken-beg.md(1 hunks)contracts/token/ERC6909/extensions/ERC6909Pausable.sol(1 hunks)test/token/ERC6909/extensions/ERC6909Pausable.test.js(1 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
test/token/ERC6909/extensions/ERC6909Pausable.test.js (2)
test/token/ERC1155/ERC1155.test.js (1)
operator(11-11)test/utils/Address.test.js (1)
recipient(12-12)
🔇 Additional comments (3)
.changeset/full-chicken-beg.md (1)
1-5: Changeset scope and message are appropriatePatch-level bump for
openzeppelin-soliditywith description "Implements ERC6909Pausable" correctly reflects the addition of a new extension plus tests.test/token/ERC6909/extensions/ERC6909Pausable.test.js (1)
1-55: Good fixture and pause-behavior coverageThe fixture wiring (
holder,operator,recipient,other) plusshouldBehaveLikeERC6909()gives you baseline ERC6909 behavior, and thewhen token is pausedblock correctly focuses on ensuring that transfer/mint/burn revert withEnforcedPausewhile operator management and read-only queries continue to work. This matches the expected semantics of a Pausable extension that guards_updateonly.contracts/token/ERC6909/extensions/ERC6909Pausable.sol (1)
9-32: Pausable integration via_updateoverride looks correct and consistentThe abstract
ERC6909Pausablethat inheritsERC6909andPausable, combined with thewhenNotPausedguard on_updatedelegating tosuper._update, cleanly ensures that transfers, mints, and burns go through the pause check while leaving approvals and view functions untouched. The documentation also correctly pushes implementing contracts to wire publicpause/unpausewith appropriate access control rather than baking in a policy here.
| describe('setOperator', function () { | ||
| it('approves an operator', async function () { | ||
| await this.token.connect(this.holder).setOperator(this.other, true); | ||
| expect(await this.token.isOperator(this.holder, this.other)).to.be.true; | ||
| }); | ||
|
|
||
| it('disapproves an operator', async function () { | ||
| await this.token.connect(this.holder).setOperator(this.other, false); | ||
| expect(await this.token.isOperator(this.holder, this.other)).to.be.false; | ||
| }); | ||
| }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
disapproves an operator test never makes other an operator
In this block, this.other is never approved before calling setOperator(this.other, false), so the test will pass even if disapproval is a no-op. To actually exercise revocation while paused, first approve other, then disapprove:
describe('setOperator', function () {
it('approves an operator', async function () {
await this.token.connect(this.holder).setOperator(this.other, true);
expect(await this.token.isOperator(this.holder, this.other)).to.be.true;
});
it('disapproves an operator', async function () {
- await this.token.connect(this.holder).setOperator(this.other, false);
- expect(await this.token.isOperator(this.holder, this.other)).to.be.false;
+ await this.token.connect(this.holder).setOperator(this.other, true);
+ await this.token.connect(this.holder).setOperator(this.other, false);
+ expect(await this.token.isOperator(this.holder, this.other)).to.be.false;
});
});This way the test guarantees that operator revocation still works while the token is paused.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| describe('setOperator', function () { | |
| it('approves an operator', async function () { | |
| await this.token.connect(this.holder).setOperator(this.other, true); | |
| expect(await this.token.isOperator(this.holder, this.other)).to.be.true; | |
| }); | |
| it('disapproves an operator', async function () { | |
| await this.token.connect(this.holder).setOperator(this.other, false); | |
| expect(await this.token.isOperator(this.holder, this.other)).to.be.false; | |
| }); | |
| }); | |
| describe('setOperator', function () { | |
| it('approves an operator', async function () { | |
| await this.token.connect(this.holder).setOperator(this.other, true); | |
| expect(await this.token.isOperator(this.holder, this.other)).to.be.true; | |
| }); | |
| it('disapproves an operator', async function () { | |
| await this.token.connect(this.holder).setOperator(this.other, true); | |
| await this.token.connect(this.holder).setOperator(this.other, false); | |
| expect(await this.token.isOperator(this.holder, this.other)).to.be.false; | |
| }); | |
| }); |
🤖 Prompt for AI Agents
In test/token/ERC6909/extensions/ERC6909Pausable.test.js around lines 57 to 67,
the "disapproves an operator" test never approves this.other before attempting
to disapprove it, so it can pass even if revocation is a no-op; update the test
to first call setOperator(this.other, true) (or otherwise ensure this.other is
an operator), then call setOperator(this.other, false) and assert isOperator
returns false to verify revocation works while paused.
This PR implemetns ERC6909Pausable in the OZ style
npx changeset add)