-
Notifications
You must be signed in to change notification settings - Fork 71
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
Add ability to update reserve configs #16
Conversation
042ab15
to
bdcdbc1
Compare
/// Specifies which config to change | ||
config_enum: u8, | ||
/// New value for the config | ||
new_value: u8, |
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.
Hm value type isn't always u8
(e.g. fees is ReserveFees
). Maybe we could pass in the entire ReserveConfig
?
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.
Yeah, was talking to devin about that yesterday. Yeah I suppose we can pass in the entire ReserveConfig
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.
Do you know of a less brittle way of doing this than just having a agreed upon ordered list of values?
Like, would we ever pass in a serialized json map or something?
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.
serialized map isn't that different from agreed upon order
let lending_market_authority_info = next_account_info(account_info_iter)?; | ||
let lending_market_owner_info = next_account_info(account_info_iter)?; | ||
|
||
let mut reserve = assert_uninitialized::<Reserve>(reserve_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.
prob don't want this (I get that it's WIP but might as well point out)
bdcdbc1
to
d365d6c
Compare
@@ -1108,3 +1189,40 @@ pub fn flash_loan( | |||
data: LendingInstruction::FlashLoan { amount }.pack(), | |||
} | |||
} | |||
|
|||
/// Creates a `UpdateObligationConfig` instruction. |
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.
oops idk why this is here lol
f83ff8f
to
850e526
Compare
program_id: &Pubkey, | ||
optimal_utilization_rate: u8, | ||
loan_to_value_ratio: u8, | ||
liquidation_bonus: u8, | ||
liquidation_threshold: u8, | ||
min_borrow_rate: u8, | ||
optimal_borrow_rate: u8, | ||
max_borrow_rate: u8, | ||
borrow_fee_wad: u64, | ||
flash_loan_fee_wad: u64, | ||
host_fee_percentage: u8, |
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.
can we not do this with passing a config: ReserveConfig the same was process_init_reserve
works?
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.
this would allow the validations that are right below to not be copy pasted and instead just have a validate_reserve_configs
function perhaps?
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.
That seems pretty reasonable
de7db5e
to
b3ccd1f
Compare
@@ -191,45 +195,7 @@ fn process_init_reserve( | |||
config: ReserveConfig, | |||
accounts: &[AccountInfo], | |||
) -> ProgramResult { | |||
if liquidity_amount == 0 { |
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.
this check shouldn't be deleted
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.
oops good catch
b3ccd1f
to
aaef4f5
Compare
WIP