feat(cct-sdk): Add mint/burn role management ops - #402
Conversation
|
You must have Developer access to commit code to Chainlink Labs on Vercel. If you contact an administrator and receive Developer access, commit again to see your changes. Learn more: https://vercel.com/docs/accounts/team-members-and-roles/access-roles#team-level-roles |
mervin-link
left a comment
There was a problem hiding this comment.
Approved ✅
Tested all ops in sepolia:
- Grant mint role ✅
- Grant burn role ✅
- Grant mint and burn roles ✅
- Revoke mint role ✅
- Revoke burn role ✅
Question
- What is the plan for supporting v2.0 tokens? Since their mint/burn authorization uses
AccessControlrather thanisMinter/isBurnerplusowner(), I’m concerned we’ll need to duplicate these readers and operations per version.
Overview✅ APPROVE — 0 blockers, 0 correctness majors. Correct, type-safe, contract-grounded, and live-proven. Adds 5 EVM token role ops ( Contract grounding:
Family gating: Live Sepolia verification: All ops (grant/revoke/combined/no-op/owner/family) proven on real throwaway v1.5.1 token [COMMENT 1/6] 🔴 HIGH (DX/Coverage) — Version mismatch trap: ops reject the token
|
[COMMENT 2/6] 🟡 Coordination — Collides with sibling DAPP-11353 on
|
[COMMENT 3/6] 🟡 Medium (DX) — No in-SDK source for the token these ops requireSince Impact: Users reach these ops and have no in-SDK way to produce a compatible token (v2 Fix: Document where the compatible v1.5.1/v1.6.2 Example note: |
[COMMENT 4/6] 🔵 Low (Arch) — Public API surface widened via
|
[COMMENT 5/6] 🔵 Low (Test) — Cover the two op-specific branchesThe role tests cover basic encode/submit/non-owner paths but don't explicitly cover:
Both paths are now live-proven and important for correctness. Add unit test cases for each to the test file so the no-op guards and type validation are explicitly covered in CI. Examples (pseudocode): // No-op guard: grant again
it('rejects grant when recipient already holds the role', async () => {
await grantMintRole({ token, account: A }).execute()
await expect(
grantMintRole({ token, account: A }).execute()
).rejects.toThrow(CCTParamsInvalidError)
})
// Family gate: v2 token
it('rejects v2 CrossChainToken (AccessControl, not onlyOwner)', async () => {
const v2Token = await deployToken() // returns v2.0.0 CrossChainToken
await expect(
grantMintRole({ token: v2Token, account: A }).execute()
).rejects.toThrow(CCTContractTypeInvalidError)
}) |
[COMMENT 6/6] 🔵 Nits
Example: /**
* Grants the BURNER_ROLE to an account on a BurnMintERC677 token.
*
* To grant both MINTER_ROLE and BURNER_ROLE in one transaction, use {@link grantMintAndBurnRoles}.
*
* @remarks
* The token must be a BurnMintERC677 (FactoryBurnMintERC20 v1.5.1 or v1.6.2).
* The Solana equivalent is `setTokenAuthority` on SPL tokens.
*
* @see {@link deployTokenPool} — primary use case
*/ |
CI Test Report✅ 2521/2527 tests passed (651 suites) in 5m 30s SummaryCoverage report |
What
generateUnsigned<Op>and<op>, plus theisMinter/isBurnerandownerreads they gate onWhy
Testing