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

[Hacken 2022-11-25 Medium #1] Inefficient Gas Model #33

Closed
zhongfu opened this issue Dec 1, 2022 · 0 comments · Fixed by #49
Closed

[Hacken 2022-11-25 Medium #1] Inefficient Gas Model #33

zhongfu opened this issue Dec 1, 2022 · 0 comments · Fixed by #49
Labels
sev:p2 Medium type:enhancement Good-to-have features or fixes

Comments

@zhongfu
Copy link
Contributor

zhongfu commented Dec 1, 2022

The Funnel smart contract imports and uses the ERC20 contract directly for the _baseToken storage variable.

The FunnelFactory smart contract imports the Funnel contract directly to use it in the initialization process.

It is best practice to use interfaces when interacting with external contracts.

Importing and using an ERC20 smart contract directly may lead to higher deployment Gas expenses when deploying new funnels.

Importing contracts directly increases the bytecode size of the deployed smart contract.

Paths

./src/Funnel.sol
./src/FunnelFactory.sol

Recommendation

Consider using the IERC20 interface for the _baseToken variable in the Funnel contract. Consider using the IFunnel interface, with an additional declaration of the initialize() function, in the FunnelFactory contract.

Status

New

@zhongfu zhongfu added type:enhancement Good-to-have features or fixes sev:p2 Medium labels Dec 1, 2022
@zhongfu zhongfu added this to the Hacken Audit 2022-11-25 milestone Dec 1, 2022
@zlace0x zlace0x linked a pull request Dec 5, 2022 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sev:p2 Medium type:enhancement Good-to-have features or fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant