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

Chainlink for ERC4626 factorized #16

Merged
merged 27 commits into from
Oct 16, 2023
Merged

Conversation

QGarchery
Copy link
Contributor

@QGarchery QGarchery commented Oct 9, 2023

ONLY THE VAULT TESTS:
Screenshot from 2023-10-10 11-22-22

WITHOUT THE VAULT TESTS (and without the WBTC tests, because they get skipped for some reason):
Screenshot from 2023-10-10 12-00-44

@QGarchery QGarchery self-assigned this Oct 9, 2023
@QGarchery QGarchery changed the base branch from main to feat/chainlink October 9, 2023 09:24
@QGarchery QGarchery mentioned this pull request Oct 9, 2023
@QGarchery QGarchery marked this pull request as ready for review October 9, 2023 09:43
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.

I'm not 100% sure that it's better.

Btw do you any gas cost study on this change?

src/interfaces/ERC4626Interface.sol Outdated Show resolved Hide resolved
src/libraries/VaultLib.sol Outdated Show resolved Hide resolved
@Rubilmax
Copy link
Contributor

I'm not 100% sure that it's better.

Btw do you any gas cost study on this change?

Beyond gas cost, it's just less lines of code for the same complexity. And I do mean the same complexity: if separated, there's is still the possibility to set a ERC4626 and no quote or base feed so it's really just the same mechanics. I don't get why we'd not do this multi-purpose oracle wrapper

@MerlinEgalite
Copy link
Contributor

Beyond gas cost, it's just less lines of code for the same complexity. And I do mean the same complexity: if separated, there's is still the possibility to set a ERC4626 and no quote or base feed so it's really just the same mechanics. I don't get why we'd not do this multi-purpose oracle wrapper

It's at least more confusing for reviewers and auditors to me. So I still think it adds a bit of complexity for them.

I'm not against it though.

A gas cost study would have been nice to add least know what is the total cost of triggering the oracle compared to the "yaourt nature" version (without vaults and without multiple oracles).

Copy link
Contributor

@Jean-Grimal Jean-Grimal left a comment

Choose a reason for hiding this comment

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

I'm in favor of this implementation (having all in one contract) but I think we should add a comment to explain that the vault parameter is related to the case where the collateral asset is a ERC4626 token.
Currently it's not clear enough imo

@MerlinEgalite
Copy link
Contributor

MerlinEgalite commented Oct 10, 2023

Wait the difference is more than 10k ? I'm not sure how to interpret it 😅

@QGarchery
Copy link
Contributor Author

Wait the difference is more than 10k ? I'm not sure how to interpret it 😅

I changed the description multiple times (won't do it anymore), so maybe you are referring to an older version. Keep in mind that we should compare the PRs, for the purpose of this choice.

As for why this is so costly to take into account the price of a vault, I'm assuming it is because the accounting warms multiple slots (things like totals shares, total assets, ...)

@MerlinEgalite
Copy link
Contributor

I changed the description multiple times (won't do it anymore), so maybe you are referring to an older version. Keep in mind that we should compare the PRs, for the purpose of this choice.

As for why this is so costly to take into account the price of a vault, I'm assuming it is because the accounting warms multiple slots (things like totals shares, total assets, ...)

Ok now I understand it better!

src/ChainlinkOracle.sol Show resolved Hide resolved
src/ChainlinkOracle.sol Outdated Show resolved Hide resolved
src/interfaces/IERC4626.sol Outdated Show resolved Hide resolved
src/libraries/VaultLib.sol Outdated Show resolved Hide resolved
src/libraries/VaultLib.sol Show resolved Hide resolved
src/ChainlinkOracle.sol Outdated Show resolved Hide resolved
Copy link
Contributor Author

@QGarchery QGarchery left a comment

Choose a reason for hiding this comment

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

Can't approve but LGTM

src/libraries/ErrorsLib.sol Outdated Show resolved Hide resolved
src/libraries/ErrorsLib.sol Outdated Show resolved Hide resolved
@MathisGD MathisGD merged commit 9a4dc3c into feat/chainlink Oct 16, 2023
2 checks passed
@MathisGD MathisGD deleted the feat/chainlink-factorized branch October 16, 2023 09:13
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.

5 participants