Skip to content

[Contracts] Bond: add admin two-step ownership transfer with timelock #360

@Baskarayelu

Description

@Baskarayelu

Description

CredenceBond::initialize sets DataKey::Admin once, but there is no way to rotate the admin afterward, and no protection against a fat-fingered transfer to a wrong/zero address. The admin holds slashing and fee-collection authority over real USDC, so admin rotation must exist and must be a deliberate two-step (propose/accept) flow, ideally with a timelock delay. The repo already has a timelock crate that can be leveraged.

Requirements and context

  • Secure: add propose_admin/accept_admin with pending-admin storage; new admin must require_auth to accept; reject zero/identity-equal addresses.
  • Optionally integrate the timelock contract for a delay between propose and accept.
  • Tested: only current admin proposes; only pending admin accepts; old admin loses authority after acceptance.
  • Documented: update docs/admin-roles.md and docs/governance.md.

Suggested execution

  • git checkout -b feature/bond-admin-two-step-transfer
  • Add PendingAdmin to DataKey and the two-step functions in ours.rs.
  • Write transfer-flow tests including timelock delay.
  • Update docs docs/admin-roles.md.
  • Add /// doc comments for the transfer flow.
  • Validate no single call can hijack admin.

Test and commit

  • Run cargo test.
  • Cover edge cases: propose to zero, accept by wrong account, double-accept.
  • Include test output and security notes.

Example commit message

feat: add two-step timelocked admin transfer to bond contract

Guidelines

  • Minimum 95% test coverage
  • Clear documentation
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programenhancementFeature enhancementsecuritySecurity hardening and auditssmart-contractSoroban/Rust smart contract worksorobanStellar Soroban specific

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions