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
e8519381
Commit
e8519381
authored
Apr 25, 2017
by
maurelian
Committed by
maurelian
May 24, 2017
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add natspec comments to four ownership contracts
parent
b788f33c
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
61 additions
and
16 deletions
+61
-16
Claimable.sol
contracts/ownership/Claimable.sol
+16
-4
Contactable.sol
contracts/ownership/Contactable.sol
+12
-5
DelayedClaimable.sol
contracts/ownership/DelayedClaimable.sol
+14
-3
Ownable.sol
contracts/ownership/Ownable.sol
+19
-4
No files found.
contracts/ownership/Claimable.sol
View file @
e8519381
...
@@ -4,14 +4,18 @@ pragma solidity ^0.4.8;
...
@@ -4,14 +4,18 @@ pragma solidity ^0.4.8;
import './Ownable.sol';
import './Ownable.sol';
/*
/*
*
* Claimable
*
@title
Claimable
*
*
@dev 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.
* This allows the new owner to accept the transfer.
*/
*/
contract Claimable is Ownable {
contract Claimable is Ownable {
address public pendingOwner;
address public pendingOwner;
/**
* @dev The onlyPendingOwner modifier throws if called by any account other than the
* pendingOwner.
*/
modifier onlyPendingOwner() {
modifier onlyPendingOwner() {
if (msg.sender != pendingOwner) {
if (msg.sender != pendingOwner) {
throw;
throw;
...
@@ -19,10 +23,18 @@ contract Claimable is Ownable {
...
@@ -19,10 +23,18 @@ contract Claimable is Ownable {
_;
_;
}
}
/**
* @dev The transferOwnership function allows the current owner to set the pendingOwner
* address.
* @param pendingOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
function transferOwnership(address newOwner) onlyOwner {
pendingOwner = newOwner;
pendingOwner = newOwner;
}
}
/**
* @dev The claimOwnership function allows the pendingOwner address to finalize the transfer.
*/
function claimOwnership() onlyPendingOwner {
function claimOwnership() onlyPendingOwner {
owner = pendingOwner;
owner = pendingOwner;
pendingOwner = 0x0;
pendingOwner = 0x0;
...
...
contracts/ownership/Contactable.sol
View file @
e8519381
pragma solidity ^0.4.8;
pragma solidity ^0.4.8;
import './Ownable.sol';
import './Ownable.sol';
/*
* Contactable token
/**
* Basic version of a contactable contract
* @title Contactable token
* @dev Basic version of a contactable contract, allowing the owner to provide a string with their
* contact information.
*/
*/
contract Contactable is Ownable{
contract Contactable is Ownable{
string public contactInformation;
string public contactInformation;
function setContactInformation(string info) onlyOwner{
/**
* @dev The setContactInformation() function allows the current owner to transfer control of the
* contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function setContactInformation(string info) onlyOwner{
contactInformation = info;
contactInformation = info;
}
}
...
...
contracts/ownership/DelayedClaimable.sol
View file @
e8519381
...
@@ -4,15 +4,22 @@ pragma solidity ^0.4.8;
...
@@ -4,15 +4,22 @@ pragma solidity ^0.4.8;
import './Claimable.sol';
import './Claimable.sol';
/*
/**
* DelayedClaimable
* @title DelayedClaimable
* Extension for the Claimable contract, where the ownership needs to be claimed before/after certain block number
* @dev Extension for the Claimable contract, where the ownership needs to be claimed before/after
* a certain block number.
*/
*/
contract DelayedClaimable is Claimable {
contract DelayedClaimable is Claimable {
uint public end;
uint public end;
uint public start;
uint public start;
/**
* @dev the setLimits function can be used to specify the time period during which a pending
* owner can claim ownership.
* @params _start The earliest time ownership can be claimed
* @params _end The latest time ownership can be claimed.
*/
function setLimits(uint _start, uint _end) onlyOwner {
function setLimits(uint _start, uint _end) onlyOwner {
if (_start > _end)
if (_start > _end)
throw;
throw;
...
@@ -20,6 +27,10 @@ contract DelayedClaimable is Claimable {
...
@@ -20,6 +27,10 @@ contract DelayedClaimable is Claimable {
start = _start;
start = _start;
}
}
/**
* @dev setLimit() modifier throws if called by any account other than the owner.
*/
function claimOwnership() onlyPendingOwner {
function claimOwnership() onlyPendingOwner {
if ((block.number > end) || (block.number < start))
if ((block.number > end) || (block.number < start))
throw;
throw;
...
...
contracts/ownership/Ownable.sol
View file @
e8519381
pragma solidity ^0.4.8;
pragma solidity ^0.4.8;
/*
/*
*
* Ownable
*
@title
Ownable
*
*
*
Base contract with an owner.
*
@dev The Ownable contract has an owner address, and provides basic authorization control
*
Provides onlyOwner modifier, which prevents function from running if it is called by anyone other than the owner
.
*
functions, this simplifies the implementation of "user permissions"
.
*/
*/
contract Ownable {
contract Ownable {
address public owner;
address public owner;
/**
* @dev The Ownable constructor sets the original `owner` of the contract to the sender
* account.
*/
function Ownable() {
function Ownable() {
owner = msg.sender;
owner = msg.sender;
}
}
/**
* @dev The onlyOwner modifier throws if called by any account other than the owner.
*/
modifier onlyOwner() {
modifier onlyOwner() {
if (msg.sender != owner) {
if (msg.sender != owner) {
throw;
throw;
...
@@ -21,6 +30,12 @@ contract Ownable {
...
@@ -21,6 +30,12 @@ contract Ownable {
_;
_;
}
}
/**
* @dev The transferOwnership function allows the current owner to transfer control of the
* contract to a newOwner.
* @param newOwner The address to transfer ownership to.
*/
function transferOwnership(address newOwner) onlyOwner {
function transferOwnership(address newOwner) onlyOwner {
if (newOwner != address(0)) {
if (newOwner != address(0)) {
owner = newOwner;
owner = newOwner;
...
...
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