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
d957b880
Commit
d957b880
authored
May 24, 2019
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
make naming in ERC777 clearer
parent
fd3f2421
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
15 deletions
+16
-15
ERC777.sol
contracts/token/ERC777/ERC777.sol
+16
-15
No files found.
contracts/token/ERC777/ERC777.sol
View file @
d957b880
...
@@ -122,7 +122,7 @@ contract ERC777 is IERC777, IERC20 {
...
@@ -122,7 +122,7 @@ contract ERC777 is IERC777, IERC20 {
}
}
/**
/**
* @dev Returns the amount of tokens owned by an account (`
own
er`).
* @dev Returns the amount of tokens owned by an account (`
tokenHold
er`).
*/
*/
function balanceOf(address tokenHolder) public view returns (uint256) {
function balanceOf(address tokenHolder) public view returns (uint256) {
return _balances[tokenHolder];
return _balances[tokenHolder];
...
@@ -252,8 +252,8 @@ contract ERC777 is IERC777, IERC20 {
...
@@ -252,8 +252,8 @@ contract ERC777 is IERC777, IERC20 {
* not have allowance, and accounts with allowance may not be operators
* not have allowance, and accounts with allowance may not be operators
* themselves.
* themselves.
*/
*/
function allowance(address
own
er, address spender) public view returns (uint256) {
function allowance(address
hold
er, address spender) public view returns (uint256) {
return _allowances[
own
er][spender];
return _allowances[
hold
er][spender];
}
}
/**
/**
...
@@ -262,7 +262,8 @@ contract ERC777 is IERC777, IERC20 {
...
@@ -262,7 +262,8 @@ contract ERC777 is IERC777, IERC20 {
* Note that accounts cannot have allowance issued by their operators.
* Note that accounts cannot have allowance issued by their operators.
*/
*/
function approve(address spender, uint256 value) external returns (bool) {
function approve(address spender, uint256 value) external returns (bool) {
_approve(msg.sender, spender, value);
address holder = msg.sender;
_approve(holder, spender, value);
return true;
return true;
}
}
...
@@ -275,18 +276,18 @@ contract ERC777 is IERC777, IERC20 {
...
@@ -275,18 +276,18 @@ contract ERC777 is IERC777, IERC20 {
*
*
* Emits `Sent` and `Transfer` events.
* Emits `Sent` and `Transfer` events.
*/
*/
function transferFrom(address
sen
der, address recipient, uint256 amount) external returns (bool) {
function transferFrom(address
hol
der, address recipient, uint256 amount) external returns (bool) {
require(recipient != address(0), "ERC777: transfer to the zero address");
require(recipient != address(0), "ERC777: transfer to the zero address");
require(
sen
der != address(0), "ERC777: transfer from the zero address");
require(
hol
der != address(0), "ERC777: transfer from the zero address");
address
operato
r = msg.sender;
address
spende
r = msg.sender;
_callTokensToSend(
operator, sen
der, recipient, amount, "", "");
_callTokensToSend(
spender, hol
der, recipient, amount, "", "");
_move(
operator, sen
der, recipient, amount, "", "");
_move(
spender, hol
der, recipient, amount, "", "");
_approve(
sender, operator, _allowances[sender][operato
r].sub(amount));
_approve(
holder, spender, _allowances[holder][spende
r].sub(amount));
_callTokensReceived(
operator, sen
der, recipient, amount, "", "", false);
_callTokensReceived(
spender, hol
der, recipient, amount, "", "", false);
return true;
return true;
}
}
...
@@ -406,14 +407,14 @@ contract ERC777 is IERC777, IERC20 {
...
@@ -406,14 +407,14 @@ contract ERC777 is IERC777, IERC20 {
emit Transfer(from, to, amount);
emit Transfer(from, to, amount);
}
}
function _approve(address
own
er, address spender, uint256 value) private {
function _approve(address
hold
er, address spender, uint256 value) private {
// TODO: restore this require statement if this function becomes internal, or is called at a new callsite. It is
// TODO: restore this require statement if this function becomes internal, or is called at a new callsite. It is
// currently unnecessary.
// currently unnecessary.
//require(
own
er != address(0), "ERC777: approve from the zero address");
//require(
hold
er != address(0), "ERC777: approve from the zero address");
require(spender != address(0), "ERC777: approve to the zero address");
require(spender != address(0), "ERC777: approve to the zero address");
_allowances[
own
er][spender] = value;
_allowances[
hold
er][spender] = value;
emit Approval(
own
er, spender, value);
emit Approval(
hold
er, 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