Skip to content

Commit de6603a

Browse files
authored
Delete Context from DiamodERC20 (#60)
* Deleted Context * Updated versions
1 parent c024a09 commit de6603a

5 files changed

Lines changed: 10 additions & 17 deletions

File tree

contracts/diamond/tokens/ERC20/DiamondERC20.sol

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,7 @@ contract DiamondERC20 is DiamondERC20Storage {
2929
* @inheritdoc IERC20
3030
*/
3131
function transfer(address to_, uint256 amount_) public virtual override returns (bool) {
32-
address owner_ = _msgSender();
33-
34-
_transfer(owner_, to_, amount_);
32+
_transfer(msg.sender, to_, amount_);
3533

3634
return true;
3735
}
@@ -40,9 +38,7 @@ contract DiamondERC20 is DiamondERC20Storage {
4038
* @inheritdoc IERC20
4139
*/
4240
function approve(address spender_, uint256 amount_) public virtual override returns (bool) {
43-
address owner_ = _msgSender();
44-
45-
_approve(owner_, spender_, amount_);
41+
_approve(msg.sender, spender_, amount_);
4642

4743
return true;
4844
}
@@ -55,9 +51,7 @@ contract DiamondERC20 is DiamondERC20Storage {
5551
address to_,
5652
uint256 amount_
5753
) public virtual override returns (bool) {
58-
address spender_ = _msgSender();
59-
60-
_spendAllowance(from_, spender_, amount_);
54+
_spendAllowance(from_, msg.sender, amount_);
6155
_transfer(from_, to_, amount_);
6256

6357
return true;
@@ -70,7 +64,7 @@ contract DiamondERC20 is DiamondERC20Storage {
7064
address spender_,
7165
uint256 addedValue_
7266
) public virtual returns (bool) {
73-
address owner_ = _msgSender();
67+
address owner_ = msg.sender;
7468

7569
_approve(owner_, spender_, allowance(owner_, spender_) + addedValue_);
7670

@@ -84,7 +78,7 @@ contract DiamondERC20 is DiamondERC20Storage {
8478
address spender_,
8579
uint256 subtractedValue_
8680
) public virtual returns (bool) {
87-
address owner_ = _msgSender();
81+
address owner_ = msg.sender;
8882
uint256 currentAllowance_ = allowance(owner_, spender_);
8983

9084
require(currentAllowance_ >= subtractedValue_, "ERC20: decreased allowance below zero");

contracts/diamond/tokens/ERC20/DiamondERC20Storage.sol

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
// SPDX-License-Identifier: MIT
22
pragma solidity ^0.8.4;
33

4-
import {Context} from "@openzeppelin/contracts/utils/Context.sol";
54
import {IERC20} from "@openzeppelin/contracts/token/ERC20/IERC20.sol";
65
import {IERC20Metadata} from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol";
76

@@ -10,7 +9,7 @@ import {InitializableStorage} from "../../utils/InitializableStorage.sol";
109
/**
1110
* @notice This is an ERC20 token Storage contract with Diamond Standard support
1211
*/
13-
abstract contract DiamondERC20Storage is InitializableStorage, Context, IERC20, IERC20Metadata {
12+
abstract contract DiamondERC20Storage is InitializableStorage, IERC20, IERC20Metadata {
1413
bytes32 public constant DIAMOND_ERC20_STORAGE_SLOT =
1514
keccak256("diamond.standard.diamond.erc20.storage");
1615

contracts/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dlsl/dev-modules",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"license": "MIT",
55
"author": "Distributed Lab",
66
"readme": "README.md",

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "dlsl",
3-
"version": "2.5.1",
3+
"version": "2.5.2",
44
"license": "MIT",
55
"author": "Distributed Lab",
66
"description": "Solidity Development Modules by Distributed Lab",

0 commit comments

Comments
 (0)