-
Notifications
You must be signed in to change notification settings - Fork 66
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
Charles naut #32
base: master
Are you sure you want to change the base?
Charles naut #32
Conversation
@@ -1,6 +1,39 @@ | |||
//SPDX-License-Identifier: Unlicense | |||
pragma solidity ^0.8.4; | |||
|
|||
import "@openzeppelin/contracts/token/ERC20/ERC20.sol"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Better to use ERC20 interface here than complete implementation
|
||
function deposit(uint _amount) external { | ||
require(_amount > 0, "Amount must be greater than 0"); | ||
require(token.balanceOf(msg.sender) >= _amount, "Attemped to deposit amount greater than balance"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This condition is checked in transferFrom
function and is redundant here
|
||
_mint(msg.sender, _amount); | ||
|
||
emit Minted(_amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_mint already emits an event indicating a mint - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol#L267
|
||
transfer(msg.sender, _amount); | ||
|
||
emit Burned(_amount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_burn also emits an event indicating a burn - https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol#L295
No description provided.