Skip to content

Conversation

@tonylee08
Copy link
Collaborator

No description provided.

tonylee08 and others added 30 commits June 11, 2025 14:58
…pgraded package (#380)

* improve env handling to support struct tag for upgraded package

* rename handlers

* update Sui deps

* update docker

* update deps after rebase
* add snapshot tests

* add test

* update deps after rebase
* update move-binding deps

* fixup after rebase
* start metrics server

* fix fmt
* v2

* add tag
* work

* margin_pool skeleton

* fix unit tests

* add borrow_index

* add supply entry optimization

* format
* suins mvr updates

* fix path
* margin pool helpers

* margin pool cleanup

* margin pool cleanup

* update assert
* margin registry

* formatting

* risk ratio limit

* default risk params

* update risk params function fixes
* Margin pool into temp branch (#414)

* margin pool helpers

* margin pool cleanup

* margin pool cleanup

* Margin registry into temp branch (#415)

* margin registry

* formatting

* margin manager

* cleanup

* formatting and cleanup

* refactor based on comments

* abort liquidation functions
* pool proxy

* updated to trading manager

* proxy functions

* manager check

* cleanup

* limit deep managers from staking

* pool proxy

* clenaup

* cleanup
* margin registry with deepbook pool

* rm

* lock

* address comments
* Margin pool into temp branch (#414)

* margin pool helpers

* margin pool cleanup

* margin pool cleanup

* Margin registry into temp branch (#415)

* margin registry

* formatting

* margin manager

* cleanup

* formatting and cleanup

* basic liquidation rewards, wip

* formatting

* liquidation reward working concept

* cleanup

* draft version

* helper function restructure

* loan default

* liquidation rewards

* use more accurate calculation of loan repaid

* liquidation and pool rewards added

* account for liquidation reward when calculating usd amount to repay

* margin

* basic default functionality

* LiquidationEvent update

* formatting

* rebase updates

* refactor based on comments

* latest changes

* abort liquidation functions

* refactor, add events for margin pool

* pool liquidation reward event

* reformat oracles and functions

* same asset repay proportionally

* canceling all orders and withdrawing must be done regardless

* cleanup

* default loop

* add constants

* update formula

* cleanup

* move to constants file

* increase swap percent

* margin registry tests

* limit isolated margin

* fix max risk ratio formula

* new liquidation logic

* bug fix

* update return to manager info

* cleanup

* cleanup

* refined default logic

* test

* implement max slippage parameter

* cleanup

* update tests for risk param changes

* update function name

* Flexible Liquidation (#424)

* working liquidation concept

* option updates

* flexible liquidation

* cleanup

* liquidation events

* comments

* rebase with main

* cleanup

* move to constants
* enable and disable logic

* cleanup

* pool configs

* basic registration

* simplify registry

* cleanup

* reduce-only

* cleanup

* update supply cap

* cleanup

* address comments and cleanup
* basic interest rate model

* state update before interest params

* protocol spread added

* complete protocol spread

* cleanup

* same index

* address comments

* checks for max borrow percent
sb- and others added 12 commits November 13, 2025 13:54
* update margin events for indexer

* fix server

* update snapshot for loan borrowed

* add checkpoint

* add packages

* new snapshot
* update margin events for indexer

* fix server

* update snapshot for loan borrowed

* add checkpoint

* add margin manager endpoint
* authorize margin

* tests

* lockfile

* formatting

* margin

* cleanup

* cleanup

* cleanup

* cleanup

* update comment

* tests and cleanup
* add margin manager states endpoint
* Add 7 missing margin events to indexer

- Add MaintainerFeesWithdrawn, ProtocolFeesWithdrawn, SupplierCapMinted, SupplyReferralMinted (margin_pool)
- Add PauseCapUpdated (margin_registry)
- Add ProtocolFeesIncreasedEvent, ReferralFeesClaimedEvent (protocol_fees)
- Add event models, handlers, database schemas, and server endpoints
- Add database indexes for all new tables
- Add tests with checkpoint data for events that exist on testnet
- Add script to check event existence across all package versions
* initial liquidation

* share liquidation vault

* cleanup and formatting

* cleanup

* cleanup

* formatter test for liquidation

* read only function fix

* protection
* oracle protection

* oracle tests

* additional protection

* oracle

* fix tests

* cleanup
* deprecated functions

* register manager

* lockfile

* use new function

* cleanup

* update test name

* test
* add margin to default indexer packages

* cargo fmt
* github action for testnet deploy

* use pin-github-action
* new margin package

* read only functions

* upgrade
tonylee08 and others added 8 commits November 19, 2025 14:08
* Add events for P&L calculation

Add DepositCollateralEvent. Move deposit logic into deposit_int public package function. Use deposit_int in borrow functions.
Update public deposit function to:
1. Receive base and quote oracles;
2. Emit DepositCollateralEvent when either base or quote asset is deposited.

Add WithdrawCollateralEvent. Emit WithdrawCollateralEvent on user's base or quote asset withdrawal.

Enrich LiquidationEvent with assets, debts and oracle prices data.

* Add comments

---------

Co-authored-by: bathord <[email protected]>
* tests

* tests

* cleanup

* cleanup

* working

* formatting

* deprecation warning

* core tests deprecation warning
* transfer funds

* update
* unregister margin manager

* test

* better tests
* add deepbook_pool_id to server

* Refactor deepbook_pool_id handling in margin_manager_created function
* Add config support to DeepbookPoolRegistered

- Introduced a new `config` field in the `DeepbookPoolRegistered` struct to store pool configuration.
- Updated the event handler to serialize the `config` field into JSON format for database storage.
- Modified database schema to include a `config_json` column in the `deepbook_pool_registered` table.
- Added migration scripts for adding and removing the `config_json` column.
- Updated tests to reflect changes in the data structure and ensure proper functionality.

* cargo fmt for reader
sb- and others added 3 commits November 25, 2025 12:36
* fix deploy action
* Add health and status endpoints to DeepBook Server

- Introduced a health check endpoint (`/`) that returns HTTP 200 if the server is running.
- Added a status endpoint (`/status`) that provides detailed information about the indexer's health, including checkpoint lag and synchronization status.
- Updated the OpenAPI specification to include the new endpoints and their responses.
- Enhanced the README with usage examples for the new health and status endpoints.
- Implemented a method to fetch watermarks and calculate health metrics for indexer pipelines.

* Enhance indexer health status endpoint with customizable thresholds

- Added support for custom health thresholds via query parameters (`max_checkpoint_lag` and `max_time_lag_seconds`) in the `/status` endpoint.
- Updated OpenAPI specification to reflect new parameters and response fields.
- Modified server logic to compute health status based on client-provided thresholds.
- Enhanced README with examples for using the new query parameters and updated response structure.
@sb- sb- deployed to production November 25, 2025 22:03 — with GitHub Actions Active
sb- added 2 commits December 2, 2025 12:34
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.

10 participants