test(energy-token): validate SEP-41 metadata and trustline edge cases#721
Merged
AnnabelJoe merged 2 commits intoJul 3, 2026
Merged
Conversation
|
@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! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #560
Summary
Adds comprehensive SEP-41 compliance tests for the
energy_tokencontract 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 returns3Trustline / default-state edge cases
test_sep41_zero_balance_unknown_account— uninitialized address has balance0(SEP-41 implicit trustline)test_sep41_allowance_defaults_to_zero— no prior approval → allowance is0Invalid-amount edge cases
test_sep41_approve_negative_amount_panicstest_sep41_transfer_zero_amount_panicstest_sep41_burn_zero_amount_panicstest_sep41_transfer_from_zero_amount_panicstest_sep41_burn_from_zero_amount_panicsBehavioral edge cases
test_sep41_transfer_to_self— balance unchanged after self-transfertest_sep41_allowance_not_shared_between_spenders— independent allowances per spendertest_sep41_total_supply_after_multiple_mints— supply accumulates correctly across recipientstest_sep41_decimals_conversion_1kwh— 1000 units = 1 kWh at 3 decimalsTesting
Checklist
energy_token/src/lib.rs