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
ae73f1a5
Commit
ae73f1a5
authored
Jan 30, 2017
by
João Gabriel Carvalho
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Renamed files and replaced occurencies of 'Stoppable' to 'Pausable'
parent
26127ee3
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
60 additions
and
60 deletions
+60
-60
Pausable.sol
contracts/lifecycle/Pausable.sol
+2
-2
PausableMock.sol
contracts/test-helpers/PausableMock.sol
+4
-4
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 @
ae73f1a5
...
@@ -5,11 +5,11 @@ import "../ownership/Ownable.sol";
...
@@ -5,11 +5,11 @@ import "../ownership/Ownable.sol";
/*
/*
*
Stopp
able
*
Paus
able
* Abstract contract that allows children to implement an
* Abstract contract that allows children to implement an
* emergency stop mechanism.
* emergency stop mechanism.
*/
*/
contract
Stopp
able is Ownable {
contract
Paus
able is Ownable {
bool public stopped;
bool public stopped;
modifier stopInEmergency { if (!stopped) _; }
modifier stopInEmergency { if (!stopped) _; }
...
...
contracts/test-helpers/
Stopp
ableMock.sol
→
contracts/test-helpers/
Paus
ableMock.sol
View file @
ae73f1a5
pragma solidity ^0.4.4;
pragma solidity ^0.4.4;
import '../lifecycle/
Stopp
able.sol';
import '../lifecycle/
Paus
able.sol';
// mock class using
Stopp
able
// mock class using
Paus
able
contract
StoppableMock is Stopp
able {
contract
PausableMock is Paus
able {
bool public drasticMeasureTaken;
bool public drasticMeasureTaken;
uint public count;
uint public count;
function
Stopp
ableMock() {
function
Paus
ableMock() {
drasticMeasureTaken = false;
drasticMeasureTaken = false;
count = 0;
count = 0;
}
}
...
...
docs/source/index.rst
View file @
ae73f1a5
...
@@ -26,7 +26,7 @@ The code is open-source, and `available on github <https://github.com/OpenZeppel
...
@@ -26,7 +26,7 @@ The code is open-source, and `available on github <https://github.com/OpenZeppel
:caption: Smart Contracts
:caption: Smart Contracts
ownable
ownable
stopp
able
Paus
able
killable
killable
claimable
claimable
migrations
migrations
...
...
docs/source/
stopp
able.rst
→
docs/source/
paus
able.rst
View file @
ae73f1a5
Stopp
able
Paus
able
=============================================
=============================================
Base contract that provides an emergency stop mechanism.
Base contract that provides an emergency stop mechanism.
...
...
test/Pausable.js
0 → 100644
View file @
ae73f1a5
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 @
26127ee3
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