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
3fd51955
Commit
3fd51955
authored
Jan 28, 2019
by
Francisco Giordano
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
remove StandardToken (unnecessary duplicate effort)
parent
491fb5ac
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
0 additions
and
135 deletions
+0
-135
StandardToken.sol
contracts/examples/StandardToken.sol
+0
-42
StandardToken.test.js
test/examples/StandardToken.test.js
+0
-93
No files found.
contracts/examples/StandardToken.sol
deleted
100644 → 0
View file @
491fb5ac
pragma solidity ^0.5.0;
import "zos-lib/contracts/Initializable.sol";
import "../token/ERC20/ERC20Detailed.sol";
import "../token/ERC20/ERC20Mintable.sol";
import "../token/ERC20/ERC20Pausable.sol";
/**
* @title Standard ERC20 token, with minting and pause functionality.
*
*/
contract StandardToken is Initializable, ERC20Detailed, ERC20Mintable, ERC20Pausable {
function initialize(
string memory name, string memory symbol, uint8 decimals, uint256 initialSupply, address initialHolder,
address[] memory minters, address[] memory pausers, address sender
) public initializer {
ERC20Detailed.initialize(name, symbol, decimals);
// Mint the initial supply
if (initialSupply > 0) { // To allow passing a null address when not doing any initial supply
_mint(initialHolder, initialSupply);
}
// Initialize the minter and pauser roles, and renounce them
ERC20Mintable.initialize(sender);
_removeMinter(sender);
ERC20Pausable.initialize(sender);
_removePauser(sender);
// Add the requested minters and pausers (this can be done after renouncing since
// these are the internal calls)
for (uint256 i = 0; i < minters.length; ++i) {
_addMinter(minters[i]);
}
for (uint256 i = 0; i < pausers.length; ++i) {
_addPauser(pausers[i]);
}
}
}
test/examples/StandardToken.test.js
deleted
100644 → 0
View file @
491fb5ac
const
{
shouldBehaveLikeERC20Mintable
}
=
require
(
'../token/ERC20/behaviors/ERC20Mintable.behavior'
);
const
{
BN
}
=
require
(
'openzeppelin-test-helpers'
);
const
StandardToken
=
artifacts
.
require
(
'StandardToken'
);
contract
(
'StandardToken'
,
function
([
_
,
deployer
,
initialHolder
,
minterA
,
minterB
,
pauserA
,
pauserB
,
anyone
,
...
otherAccounts
])
{
const
name
=
'StdToken'
;
const
symbol
=
'STDT'
;
const
decimals
=
new
BN
(
'18'
);
const
initialSupply
=
new
BN
(
'300'
);
const
minters
=
[
minterA
,
minterB
];
const
pausers
=
[
pauserA
,
pauserB
];
const
ZERO_ADDRESS
=
'0x0000000000000000000000000000000000000000'
;
beforeEach
(
async
function
()
{
this
.
token
=
await
StandardToken
.
new
({
from
:
deployer
});
});
async
function
initialize
(
token
,
name
,
symbol
,
decimals
,
initialSupply
,
initialHolder
,
minters
,
pausers
,
from
)
{
const
signature
=
'initialize(string,string,uint8,uint256,address,address[],address[],address)'
;
const
args
=
[
name
,
symbol
,
decimals
,
initialSupply
,
initialHolder
,
minters
,
pausers
,
from
];
await
token
.
methods
[
signature
](...
args
,
{
from
});
}
context
(
'with all arguments'
,
function
()
{
beforeEach
(
async
function
()
{
await
initialize
(
this
.
token
,
name
,
symbol
,
decimals
,
initialSupply
,
initialHolder
,
minters
,
pausers
,
deployer
);
});
it
(
'initializes metadata'
,
async
function
()
{
(
await
this
.
token
.
name
()).
should
.
equal
(
name
);
(
await
this
.
token
.
symbol
()).
should
.
equal
(
symbol
);
(
await
this
.
token
.
decimals
()).
should
.
be
.
bignumber
.
equal
(
decimals
);
});
it
(
'assigns the initial supply to the initial holder'
,
async
function
()
{
(
await
this
.
token
.
balanceOf
(
initialHolder
)).
should
.
be
.
bignumber
.
equal
(
initialSupply
);
});
describe
(
'mintability'
,
function
()
{
beforeEach
(
function
()
{
this
.
contract
=
this
.
token
;
});
it
(
'all minters have the minter role'
,
async
function
()
{
for
(
const
minter
of
minters
)
{
(
await
this
.
token
.
isMinter
(
minter
)).
should
.
equal
(
true
);
}
});
shouldBehaveLikeERC20Mintable
(
minterA
,
otherAccounts
);
});
describe
(
'pausability'
,
function
()
{
beforeEach
(
function
()
{
this
.
contract
=
this
.
token
;
});
it
(
'all pausers have the minter role'
,
async
function
()
{
for
(
const
pauser
of
pausers
)
{
(
await
this
.
token
.
isPauser
(
pauser
)).
should
.
equal
(
true
);
}
});
});
});
it
(
'can be created with zero initial balance'
,
async
function
()
{
await
initialize
(
this
.
token
,
name
,
symbol
,
decimals
,
new
BN
(
0
),
ZERO_ADDRESS
,
minters
,
pausers
,
deployer
);
(
await
this
.
token
.
balanceOf
(
initialHolder
)).
should
.
be
.
bignumber
.
equal
(
'0'
);
});
it
(
'can be created with no minters'
,
async
function
()
{
await
initialize
(
this
.
token
,
name
,
symbol
,
decimals
,
initialSupply
,
initialHolder
,
[],
pausers
,
deployer
);
for
(
const
minter
of
minters
)
{
(
await
this
.
token
.
isMinter
(
minter
)).
should
.
equal
(
false
);
}
});
it
(
'can be created with no pausers'
,
async
function
()
{
await
initialize
(
this
.
token
,
name
,
symbol
,
decimals
,
initialSupply
,
initialHolder
,
minters
,
[],
deployer
);
for
(
const
pauser
of
pausers
)
{
(
await
this
.
token
.
isPauser
(
pauser
)).
should
.
equal
(
false
);
}
});
});
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