Skip to content

test(energy-token): validate SEP-41 metadata and trustline edge cases#721

Merged
AnnabelJoe merged 2 commits into
AnnabelJoe:mainfrom
katecatherina:feat/560-sep41-edge-cases
Jul 3, 2026
Merged

test(energy-token): validate SEP-41 metadata and trustline edge cases#721
AnnabelJoe merged 2 commits into
AnnabelJoe:mainfrom
katecatherina:feat/560-sep41-edge-cases

Conversation

@katecatherina

Copy link
Copy Markdown
Contributor

Closes #560

Summary

Adds comprehensive SEP-41 compliance tests for the energy_token contract covering metadata correctness and trustline edge cases:

Metadata validation

  • test_sep41_name_is_correct — name returns "SolarProof kWh"
  • test_sep41_symbol_is_correct — symbol returns "SKWH"
  • test_sep41_decimals_is_three — decimals returns 3

Trustline / default-state edge cases

  • test_sep41_zero_balance_unknown_account — uninitialized address has balance 0 (SEP-41 implicit trustline)
  • test_sep41_allowance_defaults_to_zero — no prior approval → allowance is 0

Invalid-amount edge cases

  • test_sep41_approve_negative_amount_panics
  • test_sep41_transfer_zero_amount_panics
  • test_sep41_burn_zero_amount_panics
  • test_sep41_transfer_from_zero_amount_panics
  • test_sep41_burn_from_zero_amount_panics

Behavioral edge cases

  • test_sep41_transfer_to_self — balance unchanged after self-transfer
  • test_sep41_allowance_not_shared_between_spenders — independent allowances per spender
  • test_sep41_total_supply_after_multiple_mints — supply accumulates correctly across recipients
  • test_sep41_decimals_conversion_1kwh — 1000 units = 1 kWh at 3 decimals

Testing

cd apps/contracts && cargo test -p energy-token

Checklist

  • Tests added to energy_token/src/lib.rs
  • No production code changed

@drips-wave

drips-wave Bot commented Jun 29, 2026

Copy link
Copy Markdown

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

@AnnabelJoe AnnabelJoe merged commit 0a158b2 into AnnabelJoe:main Jul 3, 2026
3 of 19 checks passed
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.

Validate SEP-41 token metadata and trustline edge cases

2 participants