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

Gas and fees #36

Closed
wants to merge 3 commits into from
Closed

Gas and fees #36

wants to merge 3 commits into from

Conversation

alcueca
Copy link
Owner

@alcueca alcueca commented Apr 10, 2024

The gas from each lender is simply calculated by wrapping flashLoan in gasleft(), and discounting the gas cost of the instructions in the callback.

The fees are extracted from tests and documentation.

README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
Comment on lines +147 to +149
uint256 startingGas = gasleft();
out = lender.flash(address(loanReceiver), asset, amount, "", this.onFlashLoan);
uint256 endingGas = gasleft();
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it'd be better to use something like https://github.com/marktoda/forge-gas-snapshot

Copy link
Owner Author

Choose a reason for hiding this comment

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

I can do that, do you want to block this until I get the time? Happy either way.

@alcueca alcueca closed this Apr 11, 2024
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.

2 participants