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

refactor(reallocate): use sum of assets #114

Merged
merged 3 commits into from
Sep 29, 2023
Merged

Conversation

Rubilmax
Copy link
Contributor

This solution has the benefit of not relying on balanceOf

Besides that, it saves 1.4k gas on avg in hardhat tests. It's ridiculous though: <= 0.3% of tx cost

@Rubilmax Rubilmax marked this pull request as ready for review September 26, 2023 15:57
Base automatically changed from feat/shares-allocation to main September 27, 2023 17:54
src/MetaMorpho.sol Outdated Show resolved Hide resolved
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.

Btw it seems that we're not testing that INSUFFICIENT_IDLE is logged

@Jean-Grimal
Copy link
Contributor

I'm in favor of this implementation. I think it saves a lot of gas

@Rubilmax
Copy link
Contributor Author

I'm in favor of this implementation. I think it saves a lot of gas

It depends on what you consider "a lot of", see this PR's description ^^

@Jean-Grimal
Copy link
Contributor

I'm in favor of this implementation. I think it saves a lot of gas

It depends on what you consider "a lot of", see this PR's description ^^

Yes mb I hadn't read it. It's weird that the savings are that low thought

@Rubilmax Rubilmax merged commit 8b04450 into main Sep 29, 2023
6 checks passed
@Rubilmax Rubilmax deleted the refactor/no-balanceOf branch September 29, 2023 11:49
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