Skip to content

bigz/init-lp-pool #1565

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

Open
wants to merge 97 commits into
base: master
Choose a base branch
from
Open

bigz/init-lp-pool #1565

wants to merge 97 commits into from

Conversation

0xbigz
Copy link
Member

@0xbigz 0xbigz commented Apr 8, 2025

No description provided.

0xbigz and others added 30 commits April 8, 2025 13:06
* add get_swap_amount, get_swap_fees, get_weight

* update accounts

* add back ts

* rebase

* add constituent swap fees
* add initializeLpPool test

* add check for constituent target weights

let num_constituents = constituent_target_base.len();
for datum in constituent_target_base.iter() {
msg!("weight datum: {:?}", datum);
Copy link
Member

Choose a reason for hiding this comment

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

need to do an audit of all the msg to figure out which ones we want vs arent useful

constituent.constituent_derivative_index
);
if constituent.constituent_index != lp_pool.usdc_consituent_index
&& constituent.constituent_derivative_index != lp_pool.usdc_consituent_index as i16
Copy link
Member

Choose a reason for hiding this comment

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

if usdc_consituent_index is 0, will constituent.constituent_derivative_index != lp_pool.usdc_consituent_inde cause issues?

Copy link
Member

Choose a reason for hiding this comment

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

shouldnt cause issues -- this is meant to pick up USDC and other stables. is there a corner case you're thinking of that isnt handled?

in_constituent.sync_token_balance(ctx.accounts.constituent_in_token_account.amount);
out_constituent.sync_token_balance(ctx.accounts.constituent_out_token_account.amount);

Ok(())
Copy link
Member

Choose a reason for hiding this comment

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

should think of any invariants to enforce on this call. anything moving token balance is good to have extra invariants around

ctx.accounts.spot_market_vault.reload()?;
spot_market.validate_max_token_deposits_and_borrows(false)?;

Ok(())
Copy link
Member

Choose a reason for hiding this comment

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

check the deposit + token amount same before and after

pub state: Box<Account<'info, State>>,
#[account(
mut,
constraint = admin.key() == admin_hot_wallet::id() || admin.key() == state.admin
Copy link
Member

Choose a reason for hiding this comment

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

should this eventually be permissionless to allow more lp swaps?

NourAlharithi and others added 8 commits July 6, 2025 12:49
* grid search

* grid search swap test
* low hanging fruit comments

* remove pda checks and store lp pool on zero copy accounts

* parameterize depeg threshold

* make description in lp pool event

* update idl for event change
* add swap fee unit tests

* remove linear inventory fee component
* fixing the main settle test and settle function

* all current tests pass

* update msg occurrences
* refactor settle pnl to modularize and add tests

* more cargo tests
* use oracle staleness threshold for staleness

* add spot market vault invariant
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