Comments (4)
Thanks for the suggestions ! Here are some thoughts about them :
- I think it depends on the use case. So for each use cases it's only a couple of functions but in the end it adds up. For example, you could also want the same fonctions but for each other end point, and then you could want to duplicate those to have the cases with/without interest accrued, etc. The design choice for Blue was to make the code as simple as possible to allow for an easiest integration by looking at the code. For the use cases you are mentioning, it requires calling one conversion fonction, with the result of the functions for the proper balances (all of those functions are available in the libs, including for getting up-to-date balances)
- Interesting suggestion, we can it discuss in the PR. It would be nice to have an example of use case
- For the use case you mention you could call supplyCollateral and borrow in the callback, which would allow you to do the transfer of collateral at the end. Do you see other use cases that this misses ?
from morpho-blue.
Thanks for the suggestions ! Here are some thoughts about them :
1. I think it depends on the use case. So for each use cases it's only a couple of functions but in the end it adds up. For example, you could also want the same fonctions but for each other end point, and then you could want to duplicate those to have the cases with/without interest accrued, etc. The design choice for Blue was to make the code as simple as possible to allow for an easiest integration by looking at the code. For the use cases you are mentioning, it requires calling one conversion fonction, with the result of the functions for the proper balances (all of those functions are available in the libs, including for getting up-to-date balances) 2. Interesting suggestion, we can it discuss in the PR. It would be nice to have an example pf use case. 3. For the use case you mention you could call supplyCollateral and borrow in the callback, which would allow you to do the transfer of collateral at the end. Do you see other use cases that this misses ?
The problem on 3 is that we need to swap first to find out exactly how much collateral we have. This is due to externalising the swap calculation so that we can benefit from swap aggregator (we just receive the swapBytes to execte on the smart contract size) and very few aggregators supporting you to specify how much you want as the output of the swap
from morpho-blue.
Ok very clear, I understand how that would make it easier. In the end you still need to check for slippage though, so I assume that you at least have a ballpark of the collateral that you are getting.
Additionally, adding a callback to borrow
would not be free and security implications would need to be considered. In particular, in the current state, just moving the health check to the end of the function also moves the oracle call after the callback. Right now the argument of the safety of callbacks is that they happen in a valid state, after everything except transfers which is ok because we don't use balances in the code (so it can only revert on transfers). That argument would not hold anymore
from morpho-blue.
Agree with @QGarchery's POV on 1. and 3.
Closing this one and we let's discuss 2. directly in #570
from morpho-blue.
Related Issues (20)
- Unnecessary cast HOT 1
- Revert silent invariant tests HOT 1
- Add return bytes to callbacks
- Restore invariants in CI
- The Cantina security review has a "draft" overlay HOT 1
- Test living vertigo mutations HOT 5
- `MorphoBalancesLib.expectedBorrowAssets` may return a value greater than `totalBorrowAssets` HOT 4
- IRM zero
- `changePrank` is deprecated HOT 2
- re-add the certora rule removed in #642
- remove the test tree
- Should `expectedAssets` precise the rounding HOT 2
- Cantina Managed report is still draft HOT 1
- Fix NPMjs deployment
- Update whitepaper with correct market naming HOT 1
- are you deploy to Sepolia Testnet yet? HOT 1
- Morpho pinned to solc 0.8.19 make it incompatible with latest OpenZeppelin HOT 6
- boundUnhealthyPosition does not use amountCollateral at all
- `forge t` failing on `main`
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from morpho-blue.