Skip to content

Commit

Permalink
Borrow proxy with PodOperation behavior (#1854)
Browse files Browse the repository at this point in the history
* add borrow behavior

* reversing

* fix compiling
  • Loading branch information
lemunozm authored Jun 3, 2024
1 parent 2aac41b commit c6dea28
Show file tree
Hide file tree
Showing 3 changed files with 78 additions and 72 deletions.
50 changes: 26 additions & 24 deletions runtime/altair/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -537,30 +537,32 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::proxy { .. }))
|| !matches!(c, RuntimeCall::Proxy(..))
}
ProxyType::Borrow => matches!(
c,
RuntimeCall::Loans(pallet_loans::Call::create { .. }) |
RuntimeCall::Loans(pallet_loans::Call::borrow { .. }) |
RuntimeCall::Loans(pallet_loans::Call::repay { .. }) |
RuntimeCall::Loans(pallet_loans::Call::write_off { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_loan_mutation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::close { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_write_off_policy { .. }) |
RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::propose_transfer_debt { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_transfer_debt { .. }) |
// Borrowers should be able to close and execute an epoch
// in order to get liquidity from repayments in previous epochs.
RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch_all{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch{..}) |
// Borrowers should be able to swap back and forth between local currencies and their variants
RuntimeCall::TokenMux(pallet_token_mux::Call::burn {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::deposit {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::match_swap {..})
),
ProxyType::Borrow => {
matches!(
c,
RuntimeCall::Loans(pallet_loans::Call::create { .. }) |
RuntimeCall::Loans(pallet_loans::Call::borrow { .. }) |
RuntimeCall::Loans(pallet_loans::Call::repay { .. }) |
RuntimeCall::Loans(pallet_loans::Call::write_off { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_loan_mutation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::close { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_write_off_policy { .. }) |
RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::propose_transfer_debt { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_transfer_debt { .. }) |
// Borrowers should be able to close and execute an epoch
// in order to get liquidity from repayments in previous epochs.
RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch_all{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch{..}) |
// Borrowers should be able to swap back and forth between local currencies and their variants
RuntimeCall::TokenMux(pallet_token_mux::Call::burn {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::deposit {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::match_swap {..})
) | ProxyType::PodOperation.filter(c)
}
ProxyType::Invest => matches!(
c,
RuntimeCall::Investments(pallet_investments::Call::update_invest_order{..}) |
Expand Down
50 changes: 26 additions & 24 deletions runtime/centrifuge/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -671,30 +671,32 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::proxy { .. }))
|| !matches!(c, RuntimeCall::Proxy(..))
}
ProxyType::Borrow => matches!(
c,
RuntimeCall::Loans(pallet_loans::Call::create { .. }) |
RuntimeCall::Loans(pallet_loans::Call::borrow { .. }) |
RuntimeCall::Loans(pallet_loans::Call::repay { .. }) |
RuntimeCall::Loans(pallet_loans::Call::write_off { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_loan_mutation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::close { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_write_off_policy { .. }) |
RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::propose_transfer_debt { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_transfer_debt { .. }) |
// Borrowers should be able to close and execute an epoch
// in order to get liquidity from repayments in previous epochs.
RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch_all{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch{..}) |
// Borrowers should be able to swap back and forth between local currencies and their variants
RuntimeCall::TokenMux(pallet_token_mux::Call::burn {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::deposit {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::match_swap {..})
),
ProxyType::Borrow => {
matches!(
c,
RuntimeCall::Loans(pallet_loans::Call::create { .. }) |
RuntimeCall::Loans(pallet_loans::Call::borrow { .. }) |
RuntimeCall::Loans(pallet_loans::Call::repay { .. }) |
RuntimeCall::Loans(pallet_loans::Call::write_off { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_loan_mutation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::close { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_write_off_policy { .. }) |
RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::propose_transfer_debt { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_transfer_debt { .. }) |
// Borrowers should be able to close and execute an epoch
// in order to get liquidity from repayments in previous epochs.
RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution{..}) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch_all{..}) |
RuntimeCall::Utility(pallet_utility::Call::batch{..}) |
// Borrowers should be able to swap back and forth between local currencies and their variants
RuntimeCall::TokenMux(pallet_token_mux::Call::burn {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::deposit {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::match_swap {..})
) | ProxyType::PodOperation.filter(c)
}
ProxyType::Invest => matches!(
c,
RuntimeCall::Investments(pallet_investments::Call::update_invest_order{..}) |
Expand Down
50 changes: 26 additions & 24 deletions runtime/development/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -545,30 +545,32 @@ impl InstanceFilter<RuntimeCall> for ProxyType {
matches!(c, RuntimeCall::Proxy(pallet_proxy::Call::proxy { .. }))
|| !matches!(c, RuntimeCall::Proxy(..))
}
ProxyType::Borrow => matches!(
c,
RuntimeCall::Loans(pallet_loans::Call::create { .. }) |
RuntimeCall::Loans(pallet_loans::Call::borrow { .. }) |
RuntimeCall::Loans(pallet_loans::Call::repay { .. }) |
RuntimeCall::Loans(pallet_loans::Call::write_off { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_loan_mutation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::close { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_write_off_policy { .. }) |
RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::propose_transfer_debt { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_transfer_debt { .. }) |
// Borrowers should be able to close and execute an epoch
// in order to get liquidity from repayments in previous epochs.
RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch { .. }) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution { .. }) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch { .. }) |
RuntimeCall::Utility(pallet_utility::Call::batch_all { .. }) |
RuntimeCall::Utility(pallet_utility::Call::batch { .. }) |
// Borrowers should be able to swap back and forth between local currencies and their variants
RuntimeCall::TokenMux(pallet_token_mux::Call::burn {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::deposit {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::match_swap {..})
),
ProxyType::Borrow => {
matches!(
c,
RuntimeCall::Loans(pallet_loans::Call::create { .. }) |
RuntimeCall::Loans(pallet_loans::Call::borrow { .. }) |
RuntimeCall::Loans(pallet_loans::Call::repay { .. }) |
RuntimeCall::Loans(pallet_loans::Call::write_off { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_loan_mutation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::close { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_write_off_policy { .. }) |
RuntimeCall::Loans(pallet_loans::Call::update_portfolio_valuation { .. }) |
RuntimeCall::Loans(pallet_loans::Call::propose_transfer_debt { .. }) |
RuntimeCall::Loans(pallet_loans::Call::apply_transfer_debt { .. }) |
// Borrowers should be able to close and execute an epoch
// in order to get liquidity from repayments in previous epochs.
RuntimeCall::PoolSystem(pallet_pool_system::Call::close_epoch { .. }) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::submit_solution { .. }) |
RuntimeCall::PoolSystem(pallet_pool_system::Call::execute_epoch { .. }) |
RuntimeCall::Utility(pallet_utility::Call::batch_all { .. }) |
RuntimeCall::Utility(pallet_utility::Call::batch { .. }) |
// Borrowers should be able to swap back and forth between local currencies and their variants
RuntimeCall::TokenMux(pallet_token_mux::Call::burn {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::deposit {..}) |
RuntimeCall::TokenMux(pallet_token_mux::Call::match_swap {..})
) | ProxyType::PodOperation.filter(c)
}
ProxyType::Invest => matches!(
c,
RuntimeCall::Investments(pallet_investments::Call::update_invest_order{..}) |
Expand Down

0 comments on commit c6dea28

Please sign in to comment.