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

Make pool & addresses provider immutable #81

Merged
merged 4 commits into from
Jan 5, 2023
Merged

Make pool & addresses provider immutable #81

merged 4 commits into from
Jan 5, 2023

Conversation

Rubilmax
Copy link
Collaborator

@Rubilmax Rubilmax commented Jan 3, 2023

Pull Request

Issue(s) fixed

This pull request fixes nothing

@Rubilmax Rubilmax changed the title Rebase pool supply/borrow index Rebase stEth pool supply/borrow index Jan 3, 2023
@Rubilmax Rubilmax marked this pull request as ready for review January 3, 2023 15:46
@pakim249CAL
Copy link
Contributor

pakim249CAL commented Jan 3, 2023

I'm just wondering as I've never been clear on this point. Is there no way that we can do this without having to store our own rebase index? This asset should only be supplied as collateral, so it should only ever be on pool. In that case, what is stopping us from just imitating the pool logic?

@Rubilmax
Copy link
Collaborator Author

Rubilmax commented Jan 3, 2023

I'm just wondering as I've never been clear on this point. Is there no way that we can do this without having to store our own rebase index? This asset should only be supplied as collateral, so it should only ever be on pool. In that case, what is stopping us from just imitating the pool logic?

I agree this asset is only supposed to be supplied as collateral, because:

  • Morpho cannot borrow it from the pool, hence if borrow was enabled users lending it couldn't withdraw at anytime
  • Users cannot borrow it, so there's no point in storing it as supply

Then we could only store it as collateral, but we need to have a way to prevent users from supplying it for anything else than collateral.
I see 2 solutions:

  1. if (configuration.isBorrowingEnabled()) revert Errors.CollateralOnly();

  2. if (underlying == Constants.ST_ETH) revert Errors.CollateralOnly();

  3. has the benefit of being generic, but perhaps too generic

What do you think?

@pakim249CAL
Copy link
Contributor

I prefer solution 2 for now, since this is really just a very special case that the matching parts of the protocol are not built for.

Copy link
Contributor

@MerlinEgalite MerlinEgalite left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One thing to remember is that Aave V3 is deployed yet so the only way to test it is on an L2 where the stETH is not there.

Can we try to think about something which is more scalable? I'll reflect on this too

src/libraries/Constants.sol Outdated Show resolved Hide resolved
src/ExitPositionsManager.sol Outdated Show resolved Hide resolved
src/EntryPositionsManager.sol Outdated Show resolved Hide resolved
src/libraries/PoolLib.sol Outdated Show resolved Hide resolved
src/MorphoStorage.sol Outdated Show resolved Hide resolved
src/MorphoGetters.sol Outdated Show resolved Hide resolved
@Rubilmax Rubilmax marked this pull request as draft January 3, 2023 16:59
@Rubilmax Rubilmax changed the title Rebase stEth pool supply/borrow index Make pool & addresses provider immutables Jan 4, 2023
@Rubilmax Rubilmax changed the title Make pool & addresses provider immutables Make pool & addresses provider immutable Jan 4, 2023
@Rubilmax Rubilmax marked this pull request as ready for review January 4, 2023 12:25
src/MorphoStorage.sol Show resolved Hide resolved
@Rubilmax Rubilmax merged commit d31a24f into main Jan 5, 2023
@Rubilmax Rubilmax deleted the feat/ib-token branch January 5, 2023 10:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants