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

fix(ERC20Extended): only emit Approval on approve #14

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions foundry.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,9 @@ block_timestamp = 1_689_934_508
runs = 256

[profile.default.invariant]
runs = 256
depth = 15
runs = 512
depth = 25
fail_on_revert = true

[profile.production]
evm_version = "shanghai"
Expand Down
6 changes: 5 additions & 1 deletion src/ERC20Extended.sol
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ abstract contract ERC20Extended is IERC20Extended, ERC3009 {
*/
bytes32 public constant PERMIT_TYPEHASH = 0x6e71edae12b1b97f4d1f60370fef10105fa2faae0126114a169c64845d6126c9;

/// @inheritdoc IERC20
uint8 public immutable decimals;

/// @inheritdoc IERC20
Expand All @@ -43,6 +44,9 @@ abstract contract ERC20Extended is IERC20Extended, ERC3009 {
/// @inheritdoc IERC20
function approve(address spender_, uint256 amount_) external returns (bool success_) {
_approve(msg.sender, spender_, amount_);

emit Approval(msg.sender, spender_, amount_);

return true;
}

Expand Down Expand Up @@ -105,7 +109,7 @@ abstract contract ERC20Extended is IERC20Extended, ERC3009 {
\******************************************************************************************************************/

function _approve(address account_, address spender_, uint256 amount_) internal virtual {
emit Approval(account_, spender_, allowance[account_][spender_] = amount_);
allowance[account_][spender_] = amount_;
}

function _permit(
Expand Down
Loading
Loading