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
dcf1f8d2
Commit
dcf1f8d2
authored
Jan 15, 2018
by
Ernestas Prisakaru
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename ERC23 occurrences to ERC223
parent
c7f2138d
Show 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 @
dcf1f8d2
...
...
@@ -4,20 +4,19 @@ pragma solidity ^0.4.18;
import "../token/BasicToken.sol";
contract ERC23ContractInterface {
contract ERC2
2
3ContractInterface {
function tokenFallback(address _from, uint256 _value, bytes _data) external;
}
contract ERC223TokenMock is BasicToken {
contract ERC23TokenMock is BasicToken {
function ERC23TokenMock(address initialAccount, uint256 initialBalance) public {
function ERC223TokenMock(address initialAccount, uint256 initialBalance) public {
balances[initialAccount] = initialBalance;
totalSupply = initialBalance;
}
// ERC23 compatible transfer function (except the name)
function transferERC23(address _to, uint256 _value, bytes _data) public
// ERC2
2
3 compatible transfer function (except the name)
function transferERC2
2
3(address _to, uint256 _value, bytes _data) public
returns (bool success)
{
transfer(_to, _value);
...
...
@@ -26,7 +25,7 @@ contract ERC23TokenMock is BasicToken {
is_contract := not(iszero(extcodesize(_to)))
}
if (is_contract) {
ERC2
3ContractInterface receiver = ERC
23ContractInterface(_to);
ERC2
23ContractInterface receiver = ERC2
23ContractInterface(_to);
receiver.tokenFallback(msg.sender, _value, _data);
}
return true;
...
...
contracts/ownership/HasNoTokens.sol
View file @
dcf1f8d2
...
...
@@ -6,14 +6,14 @@ import "./CanReclaimToken.sol";
/**
* @title Contracts that should not own Tokens
* @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
* owner to reclaim the tokens.
*/
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 value_ uint256 the amount of the specified token
* @param data_ Bytes The data passed from the caller.
...
...
test/ownership/HasNoTokens.test.js
View file @
dcf1f8d2
...
...
@@ -2,7 +2,7 @@
import
expectThrow
from
'../helpers/expectThrow'
;
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
)
{
let
hasNoTokens
=
null
;
...
...
@@ -11,7 +11,7 @@ contract('HasNoTokens', function (accounts) {
beforeEach
(
async
()
=>
{
// Create contract and token
hasNoTokens
=
await
HasNoTokens
.
new
();
token
=
await
ERC23TokenMock
.
new
(
accounts
[
0
],
100
);
token
=
await
ERC2
2
3TokenMock
.
new
(
accounts
[
0
],
100
);
// Force token into contract
await
token
.
transfer
(
hasNoTokens
.
address
,
10
);
...
...
@@ -19,8 +19,8 @@ contract('HasNoTokens', function (accounts) {
assert
.
equal
(
startBalance
,
10
);
});
it
(
'should not accept ERC23 tokens'
,
async
function
()
{
await
expectThrow
(
token
.
transferERC23
(
hasNoTokens
.
address
,
10
,
''
));
it
(
'should not accept ERC2
2
3 tokens'
,
async
function
()
{
await
expectThrow
(
token
.
transferERC2
2
3
(
hasNoTokens
.
address
,
10
,
''
));
});
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