Skip to content

feat: wire full EURC token support into fund and pay instructions#179

Merged
Nursca merged 2 commits into
Invoice-Liquidity-Network:mainfrom
bytebinders:feat/eurc-support
Jun 1, 2026
Merged

feat: wire full EURC token support into fund and pay instructions#179
Nursca merged 2 commits into
Invoice-Liquidity-Network:mainfrom
bytebinders:feat/eurc-support

Conversation

@bytebinders
Copy link
Copy Markdown
Contributor

What was done:

  • Configuration Update: Updated the Config struct and the update_config() function to explicitly store and manage usdc_sac_address and eurc_sac_address on-chain.
  • Initialization Refactor: Standardized the initialize() function to require all primary token addresses (USDC, EURC, XLM) as mandatory arguments, ensuring these assets are automatically allowlisted at deployment.
  • Token Precision & Helpers: Implemented dedicated EURC helpers, including is_eurc_token() and normalize_eurc_amount(), to ensure consistency with USDC's 6-decimal precision logic.
  • Core Instruction Wiring: Updated fund_invoice() and mark_paid() to use the invoice-locked token address for TokenClient instantiation, enabling seamless multi-token support for EURC operations.
  • Allowlist Hardening: Enhanced is_approved_token() to check both the dynamic persistent allowlist and the "wired" primary tokens in the contract configuration.
  • Test Suite Updates:
    • Updated over 20 test files (including tests_security.rs, tests_fuzz.rs, and tests_stress.rs) to accommodate the new initialize signature.
    • Expanded tests_multi_token.rs with:
      • test_eurc_lifecycle: Verifies full funding and settlement path for EURC.
      • test_eurc_token_support_is_wired_in_config: Confirms configuration storage and retrieval.
      • test_cross_token_mismatch_is_physically_impossible: Validates strict token isolation per invoice.

Why it was done:

To fulfill the roadmap requirement for full EURC support alongside USDC and XLM. This ensures the contract correctly validates and processes EURC transactions with the appropriate precision, offering more flexibility for freelancers and payers within the Invoice Liquidity Network.

How it was verified:

  • Implemented and passed comprehensive functional tests in tests_multi_token.rs covering EURC funding and payment.
  • Updated all existing test suites to ensure zero regression after the configuration and initialization refactor.
  • Manually audited the token client selection logic in fund_invoice and mark_paid to ensure zero cross-token leakage.

Summary of Changes:

File Action Description
config.rs Modified Added usdc_sac_address and eurc_sac_address to Config.
lib.rs Modified Updated initialization, core logic, and added EURC precision helpers.
tests_multi_token.rs Modified Added lifecycle and wiring verification tests for EURC.
test.rs Modified Updated global test setup for new initialization signature.
tests_*.rs Modified Updated all 23 test modules to support updated contract setup.

Closes #16

@drips-wave
Copy link
Copy Markdown

drips-wave Bot commented Jun 1, 2026

@bytebinders 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

@Nursca Nursca merged commit 70bc0ce into Invoice-Liquidity-Network:main Jun 1, 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.

Add EURC token support to fund_invoice() and mark_paid()

2 participants