Skip to content

feat(tholos): add set_bond_amount entrypoint and BondAmountUpdated event (#134) - #142

Closed
s6pa1rta3n-lab wants to merge 1 commit into
drydocs:mainfrom
s6pa1rta3n-lab:fix-issue-134
Closed

feat(tholos): add set_bond_amount entrypoint and BondAmountUpdated event (#134)#142
s6pa1rta3n-lab wants to merge 1 commit into
drydocs:mainfrom
s6pa1rta3n-lab:fix-issue-134

Conversation

@s6pa1rta3n-lab

Copy link
Copy Markdown

Description

Closes #134.

This PR introduces the set_bond_amount entrypoint to allow the contract admin to dynamically adjust the default bond required for new assertions as market conditions evolve.

Summary of Changes

  • Added BondAmountUpdated event struct emitting old_bond_amount: i128 and new_bond_amount: i128.
  • Implemented set_bond_amount(env: Env, new_bond_amount: i128) -> Result<(), Error> on Tholos:
    • Enforces admin authorization via admin.require_auth().
    • Rejects uninitialized contract states with Error::NotInitialized.
    • Validates 0 < new_bond_amount <= MAX_BOND_AMOUNT (returns Error::InvalidBondAmount).
    • Extends contract instance storage TTL via Self::touch_instance_ttl(&env).
    • Pause-exempt administrative function (callable while contract is paused).
    • Updates DataKey::BondAmount in instance storage.
    • Emits BondAmountUpdated event with old and new bond amounts.
  • Preserves snapshotted Assertion.bond on existing in-flight assertions (dispute deposits, finalization rewards, and resolve payouts remain intact).
  • Added comprehensive unit tests and proptest coverage in contracts/tholos/src/test.rs.
  • Updated docs/src/CONTRACT.md with function signatures and event definitions.

Testing

  • cargo fmt --check passed.
  • cargo clippy --workspace --all-targets -- -D warnings passed with 0 warnings.
  • cargo test passed across all workspace crates (80/80 passed).
  • cargo build -p tholos --target wasm32v1-none --release succeeded.

Payout Routing

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

@collinsezedike

Copy link
Copy Markdown
Collaborator

@s6pa1rta3n-lab Closing — #134 is assigned to JohnArayaE, not you.

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.

[Feature] bond_amount is immutable post-initialize in tholos v1

2 participants