Skip to content

feat(merkle_bridge): integrate carbon_asset minting cross-contract call (#521) - #585

Closed
Francis6-git wants to merge 6 commits into
CarbonScribe:mainfrom
Francis6-git:feature/carbon-asset-mint-integration-issue-521
Closed

feat(merkle_bridge): integrate carbon_asset minting cross-contract call (#521)#585
Francis6-git wants to merge 6 commits into
CarbonScribe:mainfrom
Francis6-git:feature/carbon-asset-mint-integration-issue-521

Conversation

@Francis6-git

Copy link
Copy Markdown
Contributor

Summary

This PR completes the deferred cross-contract integration between merkle_bridge and carbon_asset. Previously, mint_wrapped performed Merkle proof verification but only incremented an isolated local counter instead of minting actual tokens on carbon_asset.

With this change, mint_wrapped consumes the configured CarbonAssetContract address, executes a guarded cross-contract mint call, and persists/emits the real canonical token ID returned by carbon_asset.

Changes Made

  • WASM Import: Imported carbon_asset.wasm into merkle_bridge/src/lib.rs via contractimport!.
  • Error Handling: Added MerkleBridgeError::MintFailed (code 10) to handle trapped or non-success cross-contract calls safely.
  • Cross-Contract Minting:
    • Refactored mint_wrapped to fetch the configured address using get_carbon_asset_contract.
    • Replaced local NextTokenId generation with env.try_invoke_contract calling carbon_asset::mint.
    • Mapped call failures to MerkleBridgeError::MintFailed.
  • State & Events: Updated CreditBridgedEvent and local storage mappings to record the canonical token_id returned by carbon_asset. Added get_token_id helper.
  • Test Suite & Tooling:
    • Added unit and integration tests covering successful minting, missing CarbonAssetNotSet configuration, and cross-contract MintFailed errors.
    • Retained full regression coverage for existing Merkle proof verification logic.
    • Added build-carbon-asset-wasm.ps1 helper script for fixture builds.

Verification

  • Run cargo test in stellar-core/verifiable-registry/contracts/merkle_bridge/ to verify all proof verification, error mapping, and contract integration tests pass.
  • Confirmed zero local-only token ID counters remain disconnected from carbon_asset.

Closes #521

@drips-wave

drips-wave Bot commented Aug 25, 2026

Copy link
Copy Markdown

@Francis6-git Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@Oluwaseyi89

Oluwaseyi89 commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

@Francis6-git who authorize you to modify a workflow file. I will not merge this PR until you go and copy the exact workflow file from our main branch and delete your local version of it; pasting our version there.

@Oluwaseyi89 Oluwaseyi89 closed this Sep 2, 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.

Implement actual carbon_asset mint integration in merkle_bridge

2 participants