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

Collateralization Limits Final #177

Merged
merged 25 commits into from
Dec 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
06b2cc2
wip
0xripleys Sep 18, 2023
3d3d94f
inlining kind of worked
0xripleys Sep 19, 2023
0fc5ca5
minor progress
0xripleys Sep 20, 2023
dcfcec8
saturating sub, add attributed_borrow_limit parameter
0xripleys Nov 15, 2023
ec5798f
all tests passing
0xripleys Nov 15, 2023
2bb22cb
basic test
0xripleys Nov 15, 2023
9862576
saturating sub test
0xripleys Nov 15, 2023
0b0164f
block borrows if borrow attribution limit is reached. also update borrow
0xripleys Nov 16, 2023
e1b5f35
test blocking borrows
0xripleys Nov 16, 2023
fd3cd2d
clippy
0xripleys Nov 16, 2023
b21d831
writing compute unit test
0xripleys Nov 17, 2023
5d78df7
clippy
0xripleys Nov 17, 2023
d9b8c5c
refactor borrow attribution calculation
0xripleys Nov 22, 2023
d7f3e78
refactoring borrow + fixing borrow tests
0xripleys Nov 22, 2023
87d265f
block on withdraw if borrow attribution limits are exceeded
0xripleys Nov 22, 2023
0cc73b7
fix cli
0xripleys Nov 22, 2023
25b05b9
clippy and fmt
0xripleys Nov 22, 2023
74069a2
adding true borrowed value to obligation
0xripleys Nov 23, 2023
7b0ffe7
track borrow attribution changes on a full liquidation
0xripleys Nov 23, 2023
c5b4d2b
set initial borrow attribution limit value to u64::MAX
0xripleys Nov 23, 2023
d40ca60
optionally error if attribution limit is exceeded
0xripleys Nov 29, 2023
70710d0
rename true borrow value to unweighted borrow value
0xripleys Nov 29, 2023
e1b3978
account for program upgrade in borrow attribution calculation
0xripleys Nov 29, 2023
57a24c1
Collateralization Limits Part 2 (#172)
0xripleys Dec 16, 2023
55dcdee
clippy
0xripleys Dec 17, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions token-lending/cli/src/lending_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ impl SolendState {
self.obligation_pubkey,
withdraw_reserve.lending_market,
self.obligation.owner,
self.obligation
.deposits
.iter()
.map(|d| d.deposit_reserve)
.collect(),
));

instructions
Expand Down
6 changes: 6 additions & 0 deletions token-lending/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1143,6 +1143,10 @@ fn main() {
let reserve_type = value_of(arg_matches, "reserve_type").unwrap();
let scaled_price_offset_bps = value_of(arg_matches, "scaled_price_offset_bps").unwrap();
let extra_oracle_pubkey = pubkey_of(arg_matches, "extra_oracle_pubkey").unwrap();
let attributed_borrow_limit_open =
value_of(arg_matches, "attributed_borrow_limit_open").unwrap();
let attributed_borrow_limit_close =
value_of(arg_matches, "attributed_borrow_limit_close").unwrap();

let borrow_fee_wad = (borrow_fee * WAD as f64) as u64;
let flash_loan_fee_wad = (flash_loan_fee * WAD as f64) as u64;
Expand Down Expand Up @@ -1198,6 +1202,8 @@ fn main() {
reserve_type,
scaled_price_offset_bps,
extra_oracle_pubkey: Some(extra_oracle_pubkey),
attributed_borrow_limit_open,
attributed_borrow_limit_close,
},
source_liquidity_pubkey,
source_liquidity_owner_keypair,
Expand Down
Loading
Loading