Skip to content

feat(contracts): extract admin functions and emit AdminParamsChanged events#125

Merged
PeterOche merged 2 commits intodegenspot:mainfrom
phertyameen:AdminParamsChangedEvent
Mar 24, 2026
Merged

feat(contracts): extract admin functions and emit AdminParamsChanged events#125
PeterOche merged 2 commits intodegenspot:mainfrom
phertyameen:AdminParamsChangedEvent

Conversation

@phertyameen
Copy link
Copy Markdown
Contributor

@phertyameen phertyameen commented Mar 24, 2026

Summary

Extracts all administrative functions into admin.rs and replaces the
existing per-field events with a single unified AdminParamsChanged event
so the indexer can subscribe to one topic and be notified of any admin
parameter mutation.

Changes

src/admin.rs (new file)

  • set_admin - transfer admin privileges
  • set_outcome_manager - replace outcome manager
  • set_fee - set protocol fee in basis points (new), guards against
    values > 10,000 (100%)

src/events.rs

  • Replaces emit_admin_changed / emit_outcome_manager_changed with
    emit_admin_params_changed_address and emit_admin_params_changed_u32
  • Both emit on topic ("call_registry", "admin_params_changed")
  • Exports PARAM_ADMIN, PARAM_OUTCOME_MANAGER, PARAM_FEE_BPS
    constants for the indexer to match against without magic strings

src/types.rs

  • Adds fee_bps: u32 to ContractConfig (default 0 in initialize)

src/lib.rs

  • Adds mod admin
  • Delegates set_admin / set_outcome_manager to admin.rs
  • Exposes new set_fee entry-point
  • Seeds fee_bps: 0 in initialize

Event schema

Field Type Description
param Symbol Which field changed: admin, outcome_manager, fee_bps
changed_by Address Admin address that authorised the change
old_value Address|u32 Previous value
new_value Address|u32 New value

Testing

  • set_admin - config updated, event payload correct
  • set_outcome_manager - config updated, event payload correct
  • set_fee - config updated, event payload correct
  • set_fee(0) - valid
  • set_fee(10_000) - valid boundary
  • set_fee(10_001) - panics with expected message
  • All existing tests still pass (cargo test)

Closes #120

@drips-wave
Copy link
Copy Markdown

drips-wave bot commented Mar 24, 2026

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

@PeterOche
Copy link
Copy Markdown
Contributor

@phertyameen some checks were not successful

@PeterOche PeterOche merged commit cc41079 into degenspot:main Mar 24, 2026
3 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.

Emit Administrative Config Events

2 participants