Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Collateral fees only should not get worse when you add more collateral #964

Open
wants to merge 30 commits into
base: dev
Choose a base branch
from

Conversation

brittcyr
Copy link
Contributor

No description provided.

farnyser and others added 28 commits March 20, 2024 15:25
liquidator: split TCS triggering and liquidation job

Concurrent execution of candidate lookup and tx building/sending
- Also added an health assertion IX to protect liqor in multi liquidation scenario
- And a timeout for jupiter v6 queries (avoid blocking liquidation because of slow TCS)
…oundation#924)

* liquidator: forcefully exit process if snapshot job die

* client: return snapshot_job join handle so it can be watched for early unexpected exit
…ion#939)

This is necessary for new liquidator feature of rebalancing using limit orders:
We need to close the token and market slot so that it's available for new liquidation, but at the same time, it's possible that the min order quantity for a given market is still bigger than allowed max withdrawal.
Co-authored-by: CanardMandarin <thibault.marboud@gmail.com>
Co-authored-by: Tyler <tjshipe@gmail.com>
Co-authored-by: Christian Kamm <mail@ckamm.de>
Co-authored-by: Serge Farny <serge.farny@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
Co-authored-by: microwavedcola1 <microwavedcola@gmail.com>
This ensures casts of local variables don't run into alignment
differences.
@@ -93,7 +113,24 @@ pub fn token_charge_collateral_fees(ctx: Context<TokenChargeCollateralFees>) ->
continue;
}

let fee = token_balance * scaling * I80F48::from_num(bank.collateral_fee_per_day);
let token_balance = token_position.native(&bank);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

read the balance from the token_balances array here - position.native() doesn't include reserved serum/obv2 amounts, perp amounts etc

@microwavedcola1 microwavedcola1 changed the title Collateral fees only should not get worse when you add more collateral WIP: Collateral fees only should not get worse when you add more collateral Aug 9, 2024
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.

5 participants