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
ba7a0f76
Commit
ba7a0f76
authored
Feb 08, 2017
by
Jorge Izquierdo
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'master' of
https://github.com/OpenZeppelin/zeppelin-solidity
into vesting
parents
ec6e728c
a72de719
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
60 additions
and
63 deletions
+60
-63
Pausable.sol
contracts/lifecycle/Pausable.sol
+2
-2
PausableMock.sol
contracts/test-helpers/PausableMock.sol
+4
-4
BasicToken.sol
contracts/token/BasicToken.sol
+0
-3
index.rst
docs/source/index.rst
+1
-1
pausable.rst
docs/source/pausable.rst
+1
-1
Pausable.js
test/Pausable.js
+52
-0
Stoppable.js
test/Stoppable.js
+0
-52
No files found.
contracts/lifecycle/
Stopp
able.sol
→
contracts/lifecycle/
Paus
able.sol
View file @
ba7a0f76
...
...
@@ -5,11 +5,11 @@ import "../ownership/Ownable.sol";
/*
*
Stopp
able
*
Paus
able
* Abstract contract that allows children to implement an
* emergency stop mechanism.
*/
contract
Stopp
able is Ownable {
contract
Paus
able is Ownable {
bool public stopped;
modifier stopInEmergency { if (!stopped) _; }
...
...
contracts/test-helpers/
Stopp
ableMock.sol
→
contracts/test-helpers/
Paus
ableMock.sol
View file @
ba7a0f76
pragma solidity ^0.4.4;
import '../lifecycle/
Stopp
able.sol';
import '../lifecycle/
Paus
able.sol';
// mock class using
Stopp
able
contract
StoppableMock is Stopp
able {
// mock class using
Paus
able
contract
PausableMock is Paus
able {
bool public drasticMeasureTaken;
uint public count;
function
Stopp
ableMock() {
function
Paus
ableMock() {
drasticMeasureTaken = false;
count = 0;
}
...
...
contracts/token/BasicToken.sol
View file @
ba7a0f76
...
...
@@ -14,9 +14,6 @@ contract BasicToken is ERC20Basic, SafeMath {
mapping(address => uint) balances;
function transfer(address _to, uint _value) {
if (balances[msg.sender] < _value) {
throw;
}
balances[msg.sender] = safeSub(balances[msg.sender], _value);
balances[_to] = safeAdd(balances[_to], _value);
Transfer(msg.sender, _to, _value);
...
...
docs/source/index.rst
View file @
ba7a0f76
...
...
@@ -26,7 +26,7 @@ The code is open-source, and `available on github <https://github.com/OpenZeppel
:caption: Smart Contracts
ownable
stopp
able
Paus
able
killable
claimable
migrations
...
...
docs/source/
stopp
able.rst
→
docs/source/
paus
able.rst
View file @
ba7a0f76
Stopp
able
Paus
able
=============================================
Base contract that provides an emergency stop mechanism.
...
...
test/Pausable.js
0 → 100644
View file @
ba7a0f76
contract
(
'Pausable'
,
function
(
accounts
)
{
it
(
"can perform normal process in non-emergency"
,
async
function
()
{
let
Pausable
=
await
PausableMock
.
new
();
let
count0
=
await
Pausable
.
count
();
assert
.
equal
(
count0
,
0
);
let
normalProcess
=
await
Pausable
.
normalProcess
();
let
count1
=
await
Pausable
.
count
();
assert
.
equal
(
count1
,
1
);
});
it
(
"can not perform normal process in emergency"
,
async
function
()
{
let
Pausable
=
await
PausableMock
.
new
();
let
emergencyStop
=
await
Pausable
.
emergencyStop
();
let
count0
=
await
Pausable
.
count
();
assert
.
equal
(
count0
,
0
);
let
normalProcess
=
await
Pausable
.
normalProcess
();
let
count1
=
await
Pausable
.
count
();
assert
.
equal
(
count1
,
0
);
});
it
(
"can not take drastic measure in non-emergency"
,
async
function
()
{
let
Pausable
=
await
PausableMock
.
new
();
let
drasticMeasure
=
await
Pausable
.
drasticMeasure
();
let
drasticMeasureTaken
=
await
Pausable
.
drasticMeasureTaken
();
assert
.
isFalse
(
drasticMeasureTaken
);
});
it
(
"can take a drastic measure in an emergency"
,
async
function
()
{
let
Pausable
=
await
PausableMock
.
new
();
let
emergencyStop
=
await
Pausable
.
emergencyStop
();
let
drasticMeasure
=
await
Pausable
.
drasticMeasure
();
let
drasticMeasureTaken
=
await
Pausable
.
drasticMeasureTaken
();
assert
.
isTrue
(
drasticMeasureTaken
);
});
it
(
"should resume allowing normal process after emergency is over"
,
async
function
()
{
let
Pausable
=
await
PausableMock
.
new
();
let
emergencyStop
=
await
Pausable
.
emergencyStop
();
let
release
=
await
Pausable
.
release
();
let
normalProcess
=
await
Pausable
.
normalProcess
();
let
count0
=
await
Pausable
.
count
();
assert
.
equal
(
count0
,
1
);
});
});
test/Stoppable.js
deleted
100644 → 0
View file @
ec6e728c
contract
(
'Stoppable'
,
function
(
accounts
)
{
it
(
"can perform normal process in non-emergency"
,
async
function
()
{
let
stoppable
=
await
StoppableMock
.
new
();
let
count0
=
await
stoppable
.
count
();
assert
.
equal
(
count0
,
0
);
let
normalProcess
=
await
stoppable
.
normalProcess
();
let
count1
=
await
stoppable
.
count
();
assert
.
equal
(
count1
,
1
);
});
it
(
"can not perform normal process in emergency"
,
async
function
()
{
let
stoppable
=
await
StoppableMock
.
new
();
let
emergencyStop
=
await
stoppable
.
emergencyStop
();
let
count0
=
await
stoppable
.
count
();
assert
.
equal
(
count0
,
0
);
let
normalProcess
=
await
stoppable
.
normalProcess
();
let
count1
=
await
stoppable
.
count
();
assert
.
equal
(
count1
,
0
);
});
it
(
"can not take drastic measure in non-emergency"
,
async
function
()
{
let
stoppable
=
await
StoppableMock
.
new
();
let
drasticMeasure
=
await
stoppable
.
drasticMeasure
();
let
drasticMeasureTaken
=
await
stoppable
.
drasticMeasureTaken
();
assert
.
isFalse
(
drasticMeasureTaken
);
});
it
(
"can take a drastic measure in an emergency"
,
async
function
()
{
let
stoppable
=
await
StoppableMock
.
new
();
let
emergencyStop
=
await
stoppable
.
emergencyStop
();
let
drasticMeasure
=
await
stoppable
.
drasticMeasure
();
let
drasticMeasureTaken
=
await
stoppable
.
drasticMeasureTaken
();
assert
.
isTrue
(
drasticMeasureTaken
);
});
it
(
"should resume allowing normal process after emergency is over"
,
async
function
()
{
let
stoppable
=
await
StoppableMock
.
new
();
let
emergencyStop
=
await
stoppable
.
emergencyStop
();
let
release
=
await
stoppable
.
release
();
let
normalProcess
=
await
stoppable
.
normalProcess
();
let
count0
=
await
stoppable
.
count
();
assert
.
equal
(
count0
,
1
);
});
});
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