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
5a42a450
Unverified
Commit
5a42a450
authored
Jan 18, 2018
by
Matt Condon
Committed by
GitHub
Jan 18, 2018
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #678 from ernestas2k/fix/rename-erc23-occurrences-to-erc223Mock#675
Rename ERC23 occurrences to ERC223
parents
a29fce9c
49adfea6
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
12 additions
and
13 deletions
+12
-13
ERC223TokenMock.sol
contracts/mocks/ERC223TokenMock.sol
+6
-7
HasNoTokens.sol
contracts/ownership/HasNoTokens.sol
+2
-2
HasNoTokens.test.js
test/ownership/HasNoTokens.test.js
+4
-4
No files found.
contracts/mocks/ERC23TokenMock.sol
→
contracts/mocks/ERC2
2
3TokenMock.sol
View file @
5a42a450
...
@@ -4,20 +4,19 @@ pragma solidity ^0.4.18;
...
@@ -4,20 +4,19 @@ pragma solidity ^0.4.18;
import "../token/BasicToken.sol";
import "../token/BasicToken.sol";
contract ERC23ContractInterface {
contract ERC2
2
3ContractInterface {
function tokenFallback(address _from, uint256 _value, bytes _data) external;
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
}
contract ERC223TokenMock is BasicToken {
contract ERC23TokenMock is BasicToken {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
function ERC23TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
totalSupply = initialBalance;
}
}
// ERC23 compatible transfer function (except the name)
// ERC2
2
3 compatible transfer function (except the name)
function transferERC23(address _to, uint256 _value, bytes _data) public
function transferERC2
2
3(address _to, uint256 _value, bytes _data) public
returns (bool success)
returns (bool success)
{
{
transfer(_to, _value);
transfer(_to, _value);
...
@@ -26,7 +25,7 @@ contract ERC23TokenMock is BasicToken {
...
@@ -26,7 +25,7 @@ contract ERC23TokenMock is BasicToken {
is_contract := not(iszero(extcodesize(_to)))
is_contract := not(iszero(extcodesize(_to)))
}
}
if (is_contract) {
if (is_contract) {
ERC2
3ContractInterface receiver = ERC
23ContractInterface(_to);
ERC2
23ContractInterface receiver = ERC2
23ContractInterface(_to);
receiver.tokenFallback(msg.sender, _value, _data);
receiver.tokenFallback(msg.sender, _value, _data);
}
}
return true;
return true;
...
...
contracts/ownership/HasNoTokens.sol
View file @
5a42a450
...
@@ -6,14 +6,14 @@ import "./CanReclaimToken.sol";
...
@@ -6,14 +6,14 @@ import "./CanReclaimToken.sol";
/**
/**
* @title Contracts that should not own Tokens
* @title Contracts that should not own Tokens
* @author Remco Bloemen <remco@2π.com>
* @author Remco Bloemen <remco@2π.com>
* @dev This blocks incoming ERC23 tokens to prevent accidental loss of tokens.
* @dev This blocks incoming ERC2
2
3 tokens to prevent accidental loss of tokens.
* Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
* Should tokens (any ERC20Basic compatible) end up in the contract, it allows the
* owner to reclaim the tokens.
* owner to reclaim the tokens.
*/
*/
contract HasNoTokens is CanReclaimToken {
contract HasNoTokens is CanReclaimToken {
/**
/**
* @dev Reject all ERC23 compatible tokens
* @dev Reject all ERC2
2
3 compatible tokens
* @param from_ address The address that is transferring the tokens
* @param from_ address The address that is transferring the tokens
* @param value_ uint256 the amount of the specified token
* @param value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
* @param data_ Bytes The data passed from the caller.
...
...
test/ownership/HasNoTokens.test.js
View file @
5a42a450
...
@@ -2,7 +2,7 @@
...
@@ -2,7 +2,7 @@
import
expectThrow
from
'../helpers/expectThrow'
;
import
expectThrow
from
'../helpers/expectThrow'
;
const
HasNoTokens
=
artifacts
.
require
(
'../contracts/lifecycle/HasNoTokens.sol'
);
const
HasNoTokens
=
artifacts
.
require
(
'../contracts/lifecycle/HasNoTokens.sol'
);
const
ERC2
3TokenMock
=
artifacts
.
require
(
'mocks/ERC
23TokenMock.sol'
);
const
ERC2
23TokenMock
=
artifacts
.
require
(
'mocks/ERC2
23TokenMock.sol'
);
contract
(
'HasNoTokens'
,
function
(
accounts
)
{
contract
(
'HasNoTokens'
,
function
(
accounts
)
{
let
hasNoTokens
=
null
;
let
hasNoTokens
=
null
;
...
@@ -11,7 +11,7 @@ contract('HasNoTokens', function (accounts) {
...
@@ -11,7 +11,7 @@ contract('HasNoTokens', function (accounts) {
beforeEach
(
async
()
=>
{
beforeEach
(
async
()
=>
{
// Create contract and token
// Create contract and token
hasNoTokens
=
await
HasNoTokens
.
new
();
hasNoTokens
=
await
HasNoTokens
.
new
();
token
=
await
ERC23TokenMock
.
new
(
accounts
[
0
],
100
);
token
=
await
ERC2
2
3TokenMock
.
new
(
accounts
[
0
],
100
);
// Force token into contract
// Force token into contract
await
token
.
transfer
(
hasNoTokens
.
address
,
10
);
await
token
.
transfer
(
hasNoTokens
.
address
,
10
);
...
@@ -19,8 +19,8 @@ contract('HasNoTokens', function (accounts) {
...
@@ -19,8 +19,8 @@ contract('HasNoTokens', function (accounts) {
assert
.
equal
(
startBalance
,
10
);
assert
.
equal
(
startBalance
,
10
);
});
});
it
(
'should not accept ERC23 tokens'
,
async
function
()
{
it
(
'should not accept ERC2
2
3 tokens'
,
async
function
()
{
await
expectThrow
(
token
.
transferERC23
(
hasNoTokens
.
address
,
10
,
''
));
await
expectThrow
(
token
.
transferERC2
2
3
(
hasNoTokens
.
address
,
10
,
''
));
});
});
it
(
'should allow owner to reclaim tokens'
,
async
function
()
{
it
(
'should allow owner to reclaim tokens'
,
async
function
()
{
...
...
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