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

Add ability to update reserve configs #16

Merged
merged 1 commit into from
Jul 20, 2021
Merged

Add ability to update reserve configs #16

merged 1 commit into from
Jul 20, 2021

Conversation

DaSichuan
Copy link

WIP

@DaSichuan DaSichuan force-pushed the admin_controls branch 2 times, most recently from 042ab15 to bdcdbc1 Compare July 15, 2021 06:50
/// Specifies which config to change
config_enum: u8,
/// New value for the config
new_value: u8,
Copy link
Member

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?

Copy link
Author

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

Copy link
Author

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?

Copy link
Member

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)?;
Copy link
Member

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)

@@ -1108,3 +1189,40 @@ pub fn flash_loan(
data: LendingInstruction::FlashLoan { amount }.pack(),
}
}

/// Creates a `UpdateObligationConfig` instruction.
Copy link
Author

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

@DaSichuan DaSichuan force-pushed the admin_controls branch 2 times, most recently from f83ff8f to 850e526 Compare July 15, 2021 22:37
@DaSichuan DaSichuan changed the title WIP Add ability to update reserve configs Jul 15, 2021
@DaSichuan DaSichuan changed the base branch from master to staging July 16, 2021 01:20
Comment on lines 2028 to 2038
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,
Copy link
Member

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?

Copy link
Member

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?

Copy link
Author

Choose a reason for hiding this comment

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

That seems pretty reasonable

@DaSichuan DaSichuan force-pushed the admin_controls branch 2 times, most recently from de7db5e to b3ccd1f Compare July 19, 2021 22:08
@@ -191,45 +195,7 @@ fn process_init_reserve(
config: ReserveConfig,
accounts: &[AccountInfo],
) -> ProgramResult {
if liquidity_amount == 0 {
Copy link
Member

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

Copy link
Author

Choose a reason for hiding this comment

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

oops good catch

@DaSichuan DaSichuan merged commit 3f00ace into staging Jul 20, 2021
@DaSichuan DaSichuan deleted the admin_controls branch July 20, 2021 20:53
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.

3 participants