Skip to content

fix(globe-wallet): clean up SpendLimit and DailySpent in remove_asset (fixes #89) - #100

Closed
s6pa1rta3n-lab wants to merge 1 commit into
Orbit-Wal:mainfrom
s6pa1rta3n-lab:fix-issue-89
Closed

fix(globe-wallet): clean up SpendLimit and DailySpent in remove_asset (fixes #89)#100
s6pa1rta3n-lab wants to merge 1 commit into
Orbit-Wal:mainfrom
s6pa1rta3n-lab:fix-issue-89

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Summary

Fixes #89 by ensuring that GlobeWallet::remove_asset cleans up the corresponding persistent storage entries for SpendLimit(user, asset_code) and DailySpent(user, asset_code) when an asset is removed from a user's UserAssets list, matching the existing cleanup behavior in migrate_user_assets.

Changes

  • In GlobeWallet::remove_asset, explicitly call env.storage().persistent().remove(&DataKey::SpendLimit(user.clone(), asset_code.clone())) and env.storage().persistent().remove(&DataKey::DailySpent(user.clone(), asset_code.clone())).
  • Added unit test test_remove_asset_cleans_up_spend_limit_and_daily_spent proving that get_spend_limit returns to the default (0 / unlimited) and storage keys are completely removed after calling remove_asset.
  • Added unit test test_readding_previously_removed_asset_has_fresh_unconfigured_limit proving that re-adding a previously-removed asset starts with a fresh, unconfigured limit rather than inheriting the old one.
  • Verified that migrate_user_assets's cleanup continues to work with no regression.

Definition of Done Verification

  • remove_asset removes the corresponding SpendLimit and DailySpent entries for the removed asset
  • Test proving get_spend_limit returns to the default (0 / unlimited) after remove_asset
  • Test proving re-adding a previously-removed asset starts with a fresh, unconfigured limit rather than inheriting the old one
  • No regression to migrate_user_assets's existing equivalent cleanup
  • cargo test --workspace passes cleanly (71 tests in globe-wallet, 1 integration test, 11 tests in token-wrapper)

Payout Routing

  • EVM (Base/Arbitrum/Polygon/ETH): 0xF46C9F6d70C50BF81ef3588AB523a90a594a2F89
  • Stellar: GCL6OXAMLD75BMTINA6EMRUDWK5THQUSHMYNLSNBCJAPZJHNYJTUNIBC

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant