Skip to content

Add customizable fee receiver to ERC20FlashMint#3327

Merged
frangio merged 9 commits into
OpenZeppelin:masterfrom
mazenkhalil:fix/erc3156-flash-loans-extension-improvement-#3316
May 6, 2022
Merged

Add customizable fee receiver to ERC20FlashMint#3327
frangio merged 9 commits into
OpenZeppelin:masterfrom
mazenkhalil:fix/erc3156-flash-loans-extension-improvement-#3316

Conversation

@mazenkhalil
Copy link
Copy Markdown
Contributor

@mazenkhalil mazenkhalil commented Apr 7, 2022

Fixes #3316
Allow implementers to set the address for which the flash loan fee amount is transferred to. Instead of burning the loan fee.

PR Checklist

  • Tests
  • Documentation
  • Changelog entry

@mazenkhalil mazenkhalil changed the title ERC3156 Flash loans extension #3316 ERC3156 Flash loans extension improvement #3316 Apr 7, 2022
Copy link
Copy Markdown
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

This is looking pretty good, thank you. Some minor comments.

Comment thread contracts/mocks/ERC20FlashMintFeeReceiverMock.sol Outdated
Comment thread contracts/mocks/ERC20FlashMintMock.sol Outdated
Comment thread contracts/token/ERC20/extensions/ERC20FlashMint.sol Outdated
Comment thread contracts/token/ERC20/extensions/ERC20FlashMint.sol Outdated
@frangio frangio changed the title ERC3156 Flash loans extension improvement #3316 Add customizable fee receiver to ERC20FlashMint Apr 7, 2022
Comment thread test/token/ERC20/extensions/ERC20FlashMint.test.js Outdated
Comment thread test/token/ERC20/extensions/ERC20FlashMint.test.js Outdated
Comment thread test/token/ERC20/extensions/ERC20FlashMint.test.js Outdated
}

function flashFee(address token, uint256 amount) public view virtual override returns (uint256) {
super.flashFee(token, amount);
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This super call is not needed and can be confusing, even if it is just a mock.

Copy link
Copy Markdown
Contributor Author

@mazenkhalil mazenkhalil Apr 11, 2022

Choose a reason for hiding this comment

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

The purpose of this super call is to cover the validation defined in the super implementation. I have opened another ticket to fix the flashFee function #3331. Upon that change this super call won't be required anymore.

Amxx
Amxx previously requested changes Apr 11, 2022
Copy link
Copy Markdown
Collaborator

@Amxx Amxx left a comment

Choose a reason for hiding this comment

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

Great work overall. There are a few things regarding testing that can be improved.

We also need a Changelog entry before we merge that PR.

@frangio frangio dismissed Amxx’s stale review April 12, 2022 23:27

Comments have been addressed

@frangio frangio enabled auto-merge (squash) April 12, 2022 23:27
frangio
frangio previously approved these changes Apr 12, 2022
Copy link
Copy Markdown
Contributor

@frangio frangio left a comment

Choose a reason for hiding this comment

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

Thank you @mazenkhalil. This looks good.

@Amxx Amxx added this to the 4.7 milestone May 2, 2022
@frangio frangio disabled auto-merge May 6, 2022 21:46
@frangio frangio merged commit 3b9381d into OpenZeppelin:master May 6, 2022
@mazenkhalil mazenkhalil deleted the fix/erc3156-flash-loans-extension-improvement-#3316 branch May 9, 2022 08:29
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.

ERC3156 Flash loans extension improvement

3 participants