-
Notifications
You must be signed in to change notification settings - Fork 130
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
zerofi integration #1407
base: master
Are you sure you want to change the base?
zerofi integration #1407
Conversation
|
||
#[derive(Copy, Clone, bytemuck::Pod, bytemuck::Zeroable)] | ||
#[repr(C)] | ||
pub struct Market { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would be good to preface this we ZerofiMarket so its clear what it's used for (there are multiple Market accounts in this program)
let market: Ref<Market> = Ref::map(data, |data| { | ||
bytemuck::from_bytes(&data[..std::mem::size_of::<Market>()]) | ||
}); | ||
if market.discriminator != 4 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont you have to check owner program id?
/// CHECK: checked in ix | ||
pub zerofi_program: AccountInfo<'info>, | ||
/// CHECK: checked in ix | ||
pub zerofi_market: AccountInfo<'info>, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would assert the owner
}; | ||
|
||
Ok(ExternalSpotFill { | ||
base_asset_amount_filled, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to make sure this is a multiple of step size
let max_quote_in = taker_quote_asset_amount.min(taker_max_quote_asset_amount); | ||
(max_quote_in, taker_base_asset_amount) | ||
} else { | ||
(taker_base_asset_amount, taker_quote_asset_amount) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why dont you need to account for taker_max_quote_asset_amount in this block?
Adds fulfillment via zerofi:
InitializeZerofiFulfillmentConfig
,UpdateZerofiFulfillmentConfig
SpotFulfillmentType::Zerofi
supported in spot fill instructions