# Gen Lender Ideas
- This line can revert which reverts the removal of the lender. Recommend turning it into a low level call which allows it still to be removed if it reverts.
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/Strategy.sol#L125
- This inner loop could be optimised to make it O(n) rather than O(n^2). just compute the order lowest to highest first. then withdraw linearly
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/Strategy.sol#L496
- Prepare migrate should work differently to prepare return. need more redundency
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/Strategy.sol#L593
- saving lenders in memory before all the loops would save quite a bit of gas. a bunch of similar gas savings throughout
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/Strategy.sol#L463
- This approval is never used:
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/GenericLender/GenericLenderBase.sol#L54
- should remove protected tokens from lender plugins
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/GenericLender/GenericLenderBase.sol#L84
- this should be reoordered so its obvious to user what they need to implement. as part of these functions are done for them in the lenderbase
https://github.com/flashfish0x/yearnV2-generic-lender-strat/blob/f55c63ef3feaa03fb61e262ed4954db3e7f1cddc/contracts/GenericLender/IGenericLender.sol#L4
- Would be nice to have an automated way of assigning weight to the lenders. On each harvest, or on some other method. This way, we avoid manual txs every week to move funds around based on better apr. Right now, strategy is just moving from lowest apr to highest apr lender.
- Make manual allocation more permament, like debt ratios on vaults. If we have set manual allocations, then use that to allocate funds, if not, rebalance using automated model.