Add flag on reserve config to disable borrows#19
Conversation
fcc8b89 to
0c2f4ec
Compare
| let deposit_limit = value_of(arg_matches, "deposit_limit"); | ||
| let borrows_disabled_option = value_of(arg_matches, "borrows_disabled"); | ||
| let borrows_disabled = match borrows_disabled_option { | ||
| Some(v) => match v { |
There was a problem hiding this comment.
can't just do like unwrap_or(true)?
There was a problem hiding this comment.
Nope. A missing value is different from false. I made the CLI so that you don't have to specify every value every time you update the reserve config, you only specify the ones that you want to change. That makes it so that None, is different from False.
| Ok((pk, rest)) | ||
| } | ||
|
|
||
| fn unpack_bool(input: &[u8]) -> Result<(bool, &[u8]), ProgramError> { |
There was a problem hiding this comment.
is this gonna work to store up to 8 boolean configs if we want to add later?
There was a problem hiding this comment.
maybe lets implement this as borrow limit instead (and we can set it to 0)
0c2f4ec to
ded7622
Compare
| msg!("Borrow reserve is stale and must be refreshed in the current slot"); | ||
| return Err(LendingError::ReserveStale.into()); | ||
| } | ||
| if Decimal::from(liquidity_amount) |
There was a problem hiding this comment.
We should add a case for when borrow_limit == u64::MAX that just passes through. This is more of a nit since the token program stores amounts as u64 anyway, but it's good practice to have.
There was a problem hiding this comment.
we talked about this offline, same reason we didn't (the token program u64 cap)
There was a problem hiding this comment.
I see. We'd save a tiny bit of computation right?
Guess it's not too important either way.
There was a problem hiding this comment.
saving computation sometimes doesn't really matter right? worst case is all that matters so better to keep consistent compute so we dont accidentally introduce bugs that aren't caught cause edge case overcompute
Adds a flag to disable reserve borrows
Also updates the command line tool to be able to change it this