feat(contracts): Emit WithdrawActionEvent for withdraw action [#130]#228
Open
agnesadoga-creator wants to merge 109 commits into
Open
feat(contracts): Emit WithdrawActionEvent for withdraw action [#130]#228agnesadoga-creator wants to merge 109 commits into
agnesadoga-creator wants to merge 109 commits into
Conversation
* feature/withdraw-unused-collateral * feature/withdraw-unused-collateral * feature/withdraw-unused-collateral
Co-authored-by: Yusuf Habib <109147010+manlikeHB@users.noreply.github.com>
* feature/resolve-market-oracle * feature/resolve-market-oracle
…ix-Protocol#71) Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
…tix-Protocol#74) Co-authored-by: Cursor <cursoragent@cursor.com>
onboarding fixes for expiration, deposit, withdraw docs, and positions errors
…es to public items
…itionAlreadySettled
- Define ValidationFailedEvent in events.rs with context and error_code fields - Add emit_validation_failed() helper function - Add test asserting event emission and field values
Replace flat Symbol constants (MARKETS_KEY, POSITIONS_KEY, ADMIN_KEY, COUNTER_KEY) with a contracttype StorageKey enum. No behavior change.
Add TODO(#issue) references near each emit_* call site explaining potential future improvements to the event payloads.
- Assert all error discriminant values match their documented ranges - Assert equality and inequality between variants - Assert ordering across error categories
Explicitly reject withdrawals when total_deposited is zero before computing locked collateral, preventing silent unwrap_or(0) fallthrough. Adds test_withdraw_zero_deposited_rejected to cover the rejection.
…rams HarnessError variants carry doc comments explaining the failure cause. MarketParams::default_valid provides a reusable baseline for integration tests, removing the need for repeated boilerplate setup.
Documents all arguments, return value, error variants, emitted event, and includes an inline example showing typical usage.
…ejected Defines PositionLimitExceededEvent in events.rs with market_id, user, and side_yes (which share side would go negative). update_position now emits the event before returning ShareBalanceBelowZero. Adds test_update_position_limit_exceeded_emits_event to assert emission.
Adds a Next.js frontend under apps/web, plus scripts to generate/publish 375 onboarding issues across the three Vatix repos. Updates CI and docs to include the new frontend workflow.
Add a no-layout-shift loading skeleton
…contract-improvements Onboarding/contract improvements
…ding-tasks Feature/onboarding tasks
…ct-tasks Onboarding/contract tasks
Documents deploy-testnet.sh as an echo guard in README.md with a note on what a real implementation should do, links it from the scripts README, and adds a comment in ci.yml explaining the contract Makefile build step. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Document the purpose of the format check step in CI - Explain that rustfmt.toml defines project-wide formatting rules - Help future maintainers understand why consistent formatting matters
…ol#113, Vatix-Protocol#114 Vatix-Protocol#111 [tooling] Add echo guard comment to invoke-example.sh - Added TODO comment explaining what the real contract invoke should do - Updated scripts/README to reference the echo guard Vatix-Protocol#112 [tooling] Add CI comment explaining CI workflow step - Added explanatory comments for Tests and Build steps in ci.yml Vatix-Protocol#113 [tooling] Document usage of README - Added ## Scripts section to README.md with invoke-example.sh docs - Includes example command and reference to scripts/README Vatix-Protocol#114 [tooling] Add echo guard comment to contract Makefile - Added TODO comments explaining what the real build/test should do - Linked from scripts/README under Tooling config Also: - Added vrickish.md to .gitignore
…tion-guard [contracts] Add validation guard in positions module
…clippy-lints docs: add Clippy lints section to README (Vatix-Protocol#116)
…rd-and-ci-comment tooling: add echo guard README section and CI build step comment
…mt-ci-comment feat(Vatix-Protocol#115): Add CI comment explaining rustfmt config step
…comment-deploy-sh tooling: add CI comment explaining deploy.sh step (Vatix-Protocol#109)
…o-guard-comment-clippy tooling: add echo guard comment to clippy lint step (Vatix-Protocol#108)
…t-deploy-testnet-sh tooling: document usage of deploy-testnet.sh in README (Vatix-Protocol#110)
…t-rustfmt-config tooling: document usage of rustfmt config in README (Vatix-Protocol#107)
…111_#112_#113_#114 Implement issues Vatix-Protocol#111, Vatix-Protocol#112, Vatix-Protocol#113, Vatix-Protocol#114
…todo-fee-calculation contracts: add TODO with issue link near fee calculation
[contracts] Add unit test case for expiration check
…tix-Protocol#117 Vatix-Protocol#118 Vatix-Protocol#119 Vatix-Protocol#120) - deploy.sh: add shebang and echo guard comment noting what real deployment should do - ci.yml: add explanatory comment for deploy-testnet.sh CI step (issue Vatix-Protocol#118); add invoke-example.sh CI step with echo guard comment (issue Vatix-Protocol#120) - scripts/README.md: expand deploy.sh and deploy-testnet.sh entries; add invoke-example.sh usage section with example command (issue Vatix-Protocol#119); link all echo guards back to the README (issues Vatix-Protocol#117, Vatix-Protocol#120) Closes Vatix-Protocol#117, Vatix-Protocol#118, Vatix-Protocol#119, Vatix-Protocol#120 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…18-119-120-tooling-docs feat(tooling): add echo guard comments and invoke-example.sh docs
…l#132) - parseWithdrawAmount: display string → raw bigint with decimal precision; null for invalid/non-positive inputs - formatWithdrawAmount: raw bigint → display string, trailing zeros trimmed - validateWithdrawAmount: validates numeric, ≤ balance; returns { valid, error? } for direct use in form error display - maxWithdrawDisplay: convenience wrapper for Max button population - TokenBalance and WithdrawValidationResult types fully exported - 12 unit tests covering all code paths in lib/__tests__/withdrawHelpers.test.ts Closes Vatix-Protocol#132
…ix-Protocol#131) Adds a step to CI that verifies README.md is present and non-empty, with a block comment explaining: - why the step exists (prevent documentation rot on main branch) - what it checks (absence or zero-byte README) - how to skip it for WIP PRs (skip-readme-check label) - maintenance pointer (update CONTRIBUTING.md when logic changes) Closes Vatix-Protocol#131
…Protocol#130) - events.rs: define WithdrawActionEvent { user (topic), market_id (topic), amount }; emit_withdraw_action() publishes it via .publish(env) - withdraw.rs: call emit_withdraw_action() on the success path after the token transfer and collateral accounting event, so indexers can subscribe to withdraw completions without filtering on collateral fields - Test in events.rs asserts the event is emitted with correct topic symbols, indexed address/market_id topics, and amount data field Closes Vatix-Protocol#130
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Defines and emits a dedicated
WithdrawActionEventin the withdraw module so indexers and off-chain listeners can subscribe to successful withdrawals without filtering on collateral accounting fields.Changes
contracts/market/src/events.rs:WithdrawActionEvent { user (indexed topic), market_id (indexed topic), amount }emit_withdraw_action(env, user, market_id, amount)functiontest_emit_withdraw_actionasserts event emission with correct topics and datacontracts/market/src/withdraw.rs:emit_withdraw_action()on the success path after the token transfer andemit_collateral_withdrawnAcceptance criteria
events.rsCloses #130