Skip to content

Remove Mento dependencies, repoint stable tokens to IERC20CeloTokens#777

Merged
pahor167 merged 1 commit into
masterfrom
martinvol/removeMentoDependencies
Jun 15, 2026
Merged

Remove Mento dependencies, repoint stable tokens to IERC20CeloTokens#777
pahor167 merged 1 commit into
masterfrom
martinvol/removeMentoDependencies

Conversation

@martinvol

@martinvol martinvol commented May 26, 2026

Copy link
Copy Markdown
Contributor

Summary

Removes ContractKit's dependency on the Mento web3 ABIs (Reserve, StableToken), which are no longer generated by the monorepo @celo/abis package, and repoints the Celo stable tokens onto the new consolidated IERC20CeloTokens ABI.

Changes

  • Remove Reserve support. Deletes the ReserveWrapper and every reference to it (contract-cache, kit, proxy, and the CeloContract.Reserve enum in base).
  • Repoint stable tokens to IERC20CeloTokens. The StableToken / StableTokenBRL / StableTokenEUR factories (web3-contract-cache, mini-contract-cache), the StableTokenWrapper contract type, and the proxy ABI (proxy.ts) now import from @celo/abis/web3/IERC20CeloTokens instead of the removed @celo/abis/web3/mento/* paths.

Dependency on celo-monorepo

This PR depends on celo-org/celo-monorepo#11745, which introduces the new IERC20CeloTokens interface and stops generating the Mento ABIs in @celo/abis. This PR cannot be merged until that lands and a new @celo/abis version containing IERC20CeloTokens is published and pinned here.

Kept as a draft until the monorepo change is merged and released.


PR-Codex overview

This PR removes the dependency on the Reserve and StableToken ABIs from the ContractKit, replacing them with a new stableTokenViemAbi. It simplifies the architecture by eliminating the ReserveWrapper and related components, streamlining the stable token contracts.

Detailed summary

  • Deleted Reserve.ts, Reserve.test.ts, and ReserveWrapper.
  • Removed CeloContract.Reserve and related configurations.
  • Introduced stableTokenViemAbi, combining erc20Abi with Celo-specific methods.
  • Updated stable token contracts to use stableTokenViemAbi.
  • Modified various files to reflect the removal of Reserve and adjustments to stable token references.

✨ Ask PR-Codex anything about this PR by commenting with /codex {your question}

@gitguardian

gitguardian Bot commented May 26, 2026

Copy link
Copy Markdown

️✅ There are no secrets present in this pull request anymore.

If these secrets were true positive and are still valid, we highly recommend you to revoke them.
While these secrets were previously flagged, we no longer have a reference to the
specific commits where they were detected. Once a secret has been leaked into a git
repository, you should consider it compromised, even if it was deleted immediately.
Find here more information about risks.


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

@changeset-bot

changeset-bot Bot commented May 26, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 3a094d2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 4 packages
Name Type
@celo/contractkit Major
@celo/celocli Minor
@celo/explorer Patch
@celo/governance Patch

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

Comment thread package.json Outdated
"typescript": "5.3.3"
},
"resolutions": {
"@celo/abis": "file:/Users/martinvol/celo/celo-monorepo/packages/protocol/abis/celo-abis-13.0.0-post-audit.0.tgz",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will not work in the CI, this has to be reverted once the new version ABI's are published after celo-org/celo-monorepo#11745 gets merged

…t stables to viem erc20 + ICeloToken

Removes ContractKit's dependency on the Mento Reserve and StableToken ABIs
without waiting on a new @celo/abis that exposes a consolidated interface.

- Add stable-token-abi.ts: stableTokenViemAbi = viem erc20Abi + transferWithComment
  (ICeloToken) + StableToken owner/mint/burn/increase|decreaseAllowance/initialize,
  inlined verbatim from the generated ABI. Self-contained, no Mento import.
- Repoint StableToken/StableTokenEUR/StableTokenBRL (contract-factory-cache,
  mini-contract-cache), StableTokenWrapper, the proxy init map, and the CLI
  stable-tokens helpers onto stableTokenViemAbi.
- Remove ReserveWrapper, CeloContract.Reserve, getReserve(), NetworkConfig.reserve,
  and the ReserveProxy init entry; delete Reserve.ts/Reserve.test.ts.
- Drop the now-unused @ts-expect-error in transfer-stable-base and the Reserve
  blocks from the network:parameters/contracts snapshots.

Supersedes the IERC20CeloTokens approach in #777 (that interface is not published
in any @celo/abis version).
@pahor167 pahor167 force-pushed the martinvol/removeMentoDependencies branch from f16e99f to 3a094d2 Compare June 15, 2026 16:11
@pahor167 pahor167 marked this pull request as ready for review June 15, 2026 16:14
@pahor167 pahor167 requested a review from a team as a code owner June 15, 2026 16:14

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3a094d2d53

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// (which @celo/abis is dropping). transferWithComment comes from ICeloToken;
// owner/mint/burn/increase|decreaseAllowance/initialize are the StableToken
// admin + proxy-init methods, inlined verbatim from the generated ABI.
const celoStableExtrasAbi = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Add TransferComment to stable token ABI

When callers read comments from stable-token transfers via StableTokenWrapper.getPastEvents('TransferComment', ...) or viem getContractEvents, this composed ABI no longer contains the Celo TransferComment event, so those calls now throw or cannot decode the logs even though transferWithComment is still exposed. The previous StableToken ABI included the ICeloToken event; add it to celoStableExtrasAbi alongside the function so commented stable transfers remain observable.

Useful? React with 👍 / 👎.

@github-actions

github-actions Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

size-limit report 📦

Path Size
import * from '@celo/core' (csj) 1.81 KB (0%)
import * from '@celo/core' (esm) 1.56 KB (0%)

@codecov

codecov Bot commented Jun 15, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 85.71429% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 68.34%. Comparing base (95a84a4) to head (3a094d2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #777      +/-   ##
==========================================
- Coverage   68.99%   68.34%   -0.65%     
==========================================
  Files          97      152      +55     
  Lines        4438     8824    +4386     
  Branches      973     1712     +739     
==========================================
+ Hits         3062     6031    +2969     
- Misses       1307     2721    +1414     
- Partials       69       72       +3     
Components Coverage Δ
celocli ∅ <ø> (∅)
sdk 67.22% <85.71%> (-2.12%) ⬇️
wallets 73.68% <ø> (∅)
viem-sdks 94.15% <ø> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pahor167 pahor167 merged commit f5482b5 into master Jun 15, 2026
26 of 54 checks passed
@pahor167 pahor167 deleted the martinvol/removeMentoDependencies branch June 15, 2026 16:39
@github-actions github-actions Bot mentioned this pull request Jun 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants