Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
openzeppelin-contracts-upgradeable
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
俞永鹏
openzeppelin-contracts-upgradeable
Commits
b14c9f4b
Commit
b14c9f4b
authored
Feb 25, 2019
by
Nicolás Venturo
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix SafeERC20.safeApprove bug, improve test coverage.
parent
fc17a1d9
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
5 additions
and
5 deletions
+5
-5
SafeERC20Helper.sol
contracts/mocks/SafeERC20Helper.sol
+4
-4
SafeERC20.sol
contracts/token/ERC20/SafeERC20.sol
+1
-1
No files found.
contracts/mocks/SafeERC20Helper.sol
View file @
b14c9f4b
...
...
@@ -32,7 +32,7 @@ contract ERC20FailingMock {
}
contract ERC20SucceedingMock {
uint256 private _allowance
;
mapping (address => uint256) private _allowances
;
// IERC20's functions are not pure, but these mock implementations are: to prevent Solidity from issuing warnings,
// we write to a dummy state variable.
...
...
@@ -54,11 +54,11 @@ contract ERC20SucceedingMock {
}
function setAllowance(uint256 allowance_) public {
_allowance = allowance_;
_allowance
s[msg.sender]
= allowance_;
}
function allowance(address, address) public view returns (uint256) {
return _allowance;
function allowance(address
owner
, address) public view returns (uint256) {
return _allowance
s[owner]
;
}
}
...
...
contracts/token/ERC20/SafeERC20.sol
View file @
b14c9f4b
...
...
@@ -24,7 +24,7 @@ library SafeERC20 {
// safeApprove should only be called when setting an initial allowance,
// or when resetting it to zero. To increase and decrease it, use
// 'safeIncreaseAllowance' and 'safeDecreaseAllowance'
require((value == 0) || (token.allowance(
msg.sender
, spender) == 0));
require((value == 0) || (token.allowance(
address(this)
, spender) == 0));
require(token.approve(spender, value));
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment