📌 Description
asset_fee(env, asset) collapses storage::get_asset_fee's Option<u32> into a plain u32 via effective_fee_bps, so a caller cannot tell whether an asset is explicitly overridden to 0 bps via set_asset_fee(asset, 0) or simply has no override and happens to inherit a global fee() of 0. This is the same "collapsed Option" ambiguity that motivated is_anchor_active for anchors, applied to fee overrides.
🧩 Requirements and context
- Add
has_asset_fee_override(env, asset) -> bool returning whether storage::get_asset_fee is Some(_).
- Do not change
asset_fee's existing collapsing behavior — this is an additive, non-breaking view.
- Cover both the override-present-at-zero and no-override-at-zero-global-fee cases in
src/test.rs.
🛠️ Suggested execution
- Add the new entrypoint to
src/lib.rs, delegating to storage::get_asset_fee(&env, &asset).is_some().
- Add regression tests in
src/test.rs for: no override + global fee 0bps, explicit override of 0bps, explicit override of a nonzero rate, and after clear_asset_fee.
- Document the distinction in the README fee section.
✅ Acceptance criteria
🔒 Security notes
Fee-override ambiguity is primarily an off-chain auditing gap rather than a direct fund-safety bug, but clear override visibility helps catch a misconfigured admin action (e.g. an accidental 0 bps override) before it is exploited via high-volume settlements.
📋 Guidelines
- Minimum 95% test coverage
- Clear documentation
- Timeframe: 96 hours
📌 Description
asset_fee(env, asset)collapsesstorage::get_asset_fee'sOption<u32>into a plainu32viaeffective_fee_bps, so a caller cannot tell whether an asset is explicitly overridden to0bps viaset_asset_fee(asset, 0)or simply has no override and happens to inherit a globalfee()of0. This is the same "collapsed Option" ambiguity that motivatedis_anchor_activefor anchors, applied to fee overrides.🧩 Requirements and context
has_asset_fee_override(env, asset) -> boolreturning whetherstorage::get_asset_feeisSome(_).asset_fee's existing collapsing behavior — this is an additive, non-breaking view.src/test.rs.🛠️ Suggested execution
src/lib.rs, delegating tostorage::get_asset_fee(&env, &asset).is_some().src/test.rsfor: no override + global fee 0bps, explicit override of 0bps, explicit override of a nonzero rate, and afterclear_asset_fee.✅ Acceptance criteria
has_asset_fee_overridereturnstrueonly whenset_asset_feehas been called and not yet cleared for that asset.clear_asset_feeflips the result back tofalse.asset_fee's existing return value and callers are unaffected.🔒 Security notes
Fee-override ambiguity is primarily an off-chain auditing gap rather than a direct fund-safety bug, but clear override visibility helps catch a misconfigured admin action (e.g. an accidental 0 bps override) before it is exploited via high-volume settlements.
📋 Guidelines