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
35363c01
Commit
35363c01
authored
Nov 23, 2016
by
Manuel Araoz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve docs of base contracts
parent
47d979aa
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
19 additions
and
29 deletions
+19
-29
Claimable.sol
contracts/Claimable.sol
+6
-2
Killable.sol
contracts/Killable.sol
+1
-1
Ownable.sol
contracts/Ownable.sol
+4
-1
PullPayment.sol
contracts/PullPayment.sol
+2
-0
SafeMath.sol
contracts/SafeMath.sol
+1
-0
Stoppable.sol
contracts/Stoppable.sol
+5
-0
TestOwnable.sol
test/TestOwnable.sol
+0
-25
No files found.
contracts/Claimable.sol
View file @
35363c01
pragma solidity ^0.4.0;
pragma solidity ^0.4.0;
import './Ownable.sol';
import './Ownable.sol';
/*
/*
* Claimable
* Claimable
* Extension for the Ownable contract, where the ownership needs to be claimed
*
* Extension for the Ownable contract, where the ownership needs to be claimed. This allows the new owner to accept the transfer.
*/
*/
contract Claimable is Ownable {
contract Claimable is Ownable {
address public pendingOwner;
address public pendingOwner;
...
...
contracts/Killable.sol
View file @
35363c01
...
@@ -3,7 +3,7 @@ import "./Ownable.sol";
...
@@ -3,7 +3,7 @@ import "./Ownable.sol";
/*
/*
* Killable
* Killable
* Base contract that can be killed by owner
* Base contract that can be killed by owner
. All funds in contract will be sent to the owner.
*/
*/
contract Killable is Ownable {
contract Killable is Ownable {
function kill() onlyOwner {
function kill() onlyOwner {
...
...
contracts/Ownable.sol
View file @
35363c01
pragma solidity ^0.4.4;
pragma solidity ^0.4.4;
/*
/*
* Ownable
* Ownable
* Base contract with an owner
*
* Base contract with an owner.
* Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner.
*/
*/
contract Ownable {
contract Ownable {
address public owner;
address public owner;
...
...
contracts/PullPayment.sol
View file @
35363c01
pragma solidity ^0.4.4;
pragma solidity ^0.4.4;
/*
/*
* PullPayment
* PullPayment
* Base contract supporting async send for pull payments.
* Base contract supporting async send for pull payments.
...
...
contracts/SafeMath.sol
View file @
35363c01
pragma solidity ^0.4.4;
pragma solidity ^0.4.4;
/**
/**
* Math operations with safety checks
* Math operations with safety checks
*/
*/
...
...
contracts/Stoppable.sol
View file @
35363c01
pragma solidity ^0.4.4;
pragma solidity ^0.4.4;
import "./Ownable.sol";
import "./Ownable.sol";
/*
/*
* Stoppable
* Stoppable
* Abstract contract that allows children to implement an
* Abstract contract that allows children to implement an
...
@@ -12,10 +15,12 @@ contract Stoppable is Ownable {
...
@@ -12,10 +15,12 @@ contract Stoppable is Ownable {
modifier stopInEmergency { if (!stopped) _; }
modifier stopInEmergency { if (!stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
modifier onlyInEmergency { if (stopped) _; }
// called by the owner on emergency, triggers stopped state
function emergencyStop() external onlyOwner {
function emergencyStop() external onlyOwner {
stopped = true;
stopped = true;
}
}
// called by the owner on end of emergency, returns to normal state
function release() external onlyOwner onlyInEmergency {
function release() external onlyOwner onlyInEmergency {
stopped = false;
stopped = false;
}
}
...
...
test/TestOwnable.sol
deleted
100644 → 0
View file @
47d979aa
pragma solidity ^0.4.4;
import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";
import "../contracts/Ownable.sol";
contract TestOwnable {
Ownable ownable = new Ownable();
function testHasOwner() {
Assert.isNotZero(ownable.owner(), "Ownable should have an owner upon creation.");
}
function testChangesOwner() {
address originalOwner = ownable.owner();
ownable.transfer(0x0);
Assert.notEqual(originalOwner, ownable.owner(), "Ownable should change owners after transfer.");
}
function testOnlyOwnerCanChangeOwner() {
Ownable deployedOwnable = Ownable(DeployedAddresses.Ownable());
address originalOwner = deployedOwnable.owner();
deployedOwnable.transfer(0x0);
Assert.equal(originalOwner, deployedOwnable.owner(), "Ownable should prevent non-owners from transfering");
}
}
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