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
815d9e1f
Commit
815d9e1f
authored
Nov 21, 2017
by
Alejandro Santander
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Replace constant with view/pure
parent
e6213767
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
22 additions
and
22 deletions
+22
-22
.node-xmlhttprequest-sync-22450
.node-xmlhttprequest-sync-22450
+0
-0
DayLimit.sol
contracts/DayLimit.sol
+1
-1
ECRecovery.sol
contracts/ECRecovery.sol
+1
-1
MerkleProof.sol
contracts/MerkleProof.sol
+1
-1
CappedCrowdsale.sol
contracts/crowdsale/CappedCrowdsale.sol
+2
-2
Crowdsale.sol
contracts/crowdsale/Crowdsale.sol
+2
-2
RefundableCrowdsale.sol
contracts/crowdsale/RefundableCrowdsale.sol
+1
-1
Math.sol
contracts/math/Math.sol
+4
-4
SafeMath.sol
contracts/math/SafeMath.sol
+4
-4
BasicToken.sol
contracts/token/BasicToken.sol
+1
-1
ERC20.sol
contracts/token/ERC20.sol
+1
-1
ERC20Basic.sol
contracts/token/ERC20Basic.sol
+1
-1
StandardToken.sol
contracts/token/StandardToken.sol
+1
-1
TokenVesting.sol
contracts/token/TokenVesting.sol
+2
-2
No files found.
.node-xmlhttprequest-sync-22450
deleted
100644 → 0
View file @
e6213767
contracts/DayLimit.sol
View file @
815d9e1f
...
...
@@ -59,7 +59,7 @@ contract DayLimit {
* @dev Private function to determine today's index
* @return uint256 of today's index.
*/
function today() private
constant
returns (uint256) {
function today() private
view
returns (uint256) {
return now / 1 days;
}
...
...
contracts/ECRecovery.sol
View file @
815d9e1f
...
...
@@ -14,7 +14,7 @@ library ECRecovery {
* @param hash bytes32 message, the hash is the signed message. What is recovered is the signer address.
* @param sig bytes signature, the signature is generated using web3.eth.sign()
*/
function recover(bytes32 hash, bytes sig) public
constant
returns (address) {
function recover(bytes32 hash, bytes sig) public
pure
returns (address) {
bytes32 r;
bytes32 s;
uint8 v;
...
...
contracts/MerkleProof.sol
View file @
815d9e1f
...
...
@@ -13,7 +13,7 @@ library MerkleProof {
* @param _root Merkle root
* @param _leaf Leaf of Merkle tree
*/
function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf)
constant
returns (bool) {
function verifyProof(bytes _proof, bytes32 _root, bytes32 _leaf)
pure
returns (bool) {
// Check if proof length is a multiple of 32
if (_proof.length % 32 != 0) return false;
...
...
contracts/crowdsale/CappedCrowdsale.sol
View file @
815d9e1f
...
...
@@ -19,14 +19,14 @@ contract CappedCrowdsale is Crowdsale {
// overriding Crowdsale#validPurchase to add extra cap logic
// @return true if investors can buy at the moment
function validPurchase() internal
constant
returns (bool) {
function validPurchase() internal
view
returns (bool) {
bool withinCap = weiRaised.add(msg.value) <= cap;
return super.validPurchase() && withinCap;
}
// overriding Crowdsale#hasEnded to add cap logic
// @return true if crowdsale event has ended
function hasEnded() public
constant
returns (bool) {
function hasEnded() public
view
returns (bool) {
bool capReached = weiRaised >= cap;
return super.hasEnded() || capReached;
}
...
...
contracts/crowdsale/Crowdsale.sol
View file @
815d9e1f
...
...
@@ -91,14 +91,14 @@ contract Crowdsale {
}
// @return true if the transaction can buy tokens
function validPurchase() internal
constant
returns (bool) {
function validPurchase() internal
view
returns (bool) {
bool withinPeriod = now >= startTime && now <= endTime;
bool nonZeroPurchase = msg.value != 0;
return withinPeriod && nonZeroPurchase;
}
// @return true if crowdsale event has ended
function hasEnded() public
constant
returns (bool) {
function hasEnded() public
view
returns (bool) {
return now > endTime;
}
...
...
contracts/crowdsale/RefundableCrowdsale.sol
View file @
815d9e1f
...
...
@@ -53,7 +53,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
super.finalization();
}
function goalReached() public
constant
returns (bool) {
function goalReached() public
view
returns (bool) {
return weiRaised >= goal;
}
...
...
contracts/math/Math.sol
View file @
815d9e1f
...
...
@@ -6,19 +6,19 @@ pragma solidity ^0.4.18;
*/
library Math {
function max64(uint64 a, uint64 b) internal
constant
returns (uint64) {
function max64(uint64 a, uint64 b) internal
pure
returns (uint64) {
return a >= b ? a : b;
}
function min64(uint64 a, uint64 b) internal
constant
returns (uint64) {
function min64(uint64 a, uint64 b) internal
pure
returns (uint64) {
return a < b ? a : b;
}
function max256(uint256 a, uint256 b) internal
constant
returns (uint256) {
function max256(uint256 a, uint256 b) internal
pure
returns (uint256) {
return a >= b ? a : b;
}
function min256(uint256 a, uint256 b) internal
constant
returns (uint256) {
function min256(uint256 a, uint256 b) internal
pure
returns (uint256) {
return a < b ? a : b;
}
}
contracts/math/SafeMath.sol
View file @
815d9e1f
...
...
@@ -6,7 +6,7 @@ pragma solidity ^0.4.18;
* @dev Math operations with safety checks that throw on error
*/
library SafeMath {
function mul(uint256 a, uint256 b) internal
constant
returns (uint256) {
function mul(uint256 a, uint256 b) internal
pure
returns (uint256) {
if (a == 0) {
return 0;
}
...
...
@@ -15,19 +15,19 @@ library SafeMath {
return c;
}
function div(uint256 a, uint256 b) internal
constant
returns (uint256) {
function div(uint256 a, uint256 b) internal
pure
returns (uint256) {
// assert(b > 0); // Solidity automatically throws when dividing by 0
uint256 c = a / b;
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
return c;
}
function sub(uint256 a, uint256 b) internal
constant
returns (uint256) {
function sub(uint256 a, uint256 b) internal
pure
returns (uint256) {
assert(b <= a);
return a - b;
}
function add(uint256 a, uint256 b) internal
constant
returns (uint256) {
function add(uint256 a, uint256 b) internal
pure
returns (uint256) {
uint256 c = a + b;
assert(c >= a);
return c;
...
...
contracts/token/BasicToken.sol
View file @
815d9e1f
...
...
@@ -35,7 +35,7 @@ contract BasicToken is ERC20Basic {
* @param _owner The address to query the the balance of.
* @return An uint256 representing the amount owned by the passed address.
*/
function balanceOf(address _owner) public
constant
returns (uint256 balance) {
function balanceOf(address _owner) public
view
returns (uint256 balance) {
return balances[_owner];
}
...
...
contracts/token/ERC20.sol
View file @
815d9e1f
...
...
@@ -9,7 +9,7 @@ import './ERC20Basic.sol';
* @dev see https://github.com/ethereum/EIPs/issues/20
*/
contract ERC20 is ERC20Basic {
function allowance(address owner, address spender) public
constant
returns (uint256);
function allowance(address owner, address spender) public
view
returns (uint256);
function transferFrom(address from, address to, uint256 value) public returns (bool);
function approve(address spender, uint256 value) public returns (bool);
event Approval(address indexed owner, address indexed spender, uint256 value);
...
...
contracts/token/ERC20Basic.sol
View file @
815d9e1f
...
...
@@ -8,7 +8,7 @@ pragma solidity ^0.4.18;
*/
contract ERC20Basic {
uint256 public totalSupply;
function balanceOf(address who) public
constant
returns (uint256);
function balanceOf(address who) public
view
returns (uint256);
function transfer(address to, uint256 value) public returns (bool);
event Transfer(address indexed from, address indexed to, uint256 value);
}
contracts/token/StandardToken.sol
View file @
815d9e1f
...
...
@@ -57,7 +57,7 @@ contract StandardToken is ERC20, BasicToken {
* @param _spender address The address which will spend the funds.
* @return A uint256 specifying the amount of tokens still available for the spender.
*/
function allowance(address _owner, address _spender) public
constant
returns (uint256) {
function allowance(address _owner, address _spender) public
view
returns (uint256) {
return allowed[_owner][_spender];
}
...
...
contracts/token/TokenVesting.sol
View file @
815d9e1f
...
...
@@ -91,7 +91,7 @@ contract TokenVesting is Ownable {
* @dev Calculates the amount that has already vested but hasn't been released yet.
* @param token ERC20 token which is being vested
*/
function releasableAmount(ERC20Basic token) public
constant
returns (uint256) {
function releasableAmount(ERC20Basic token) public
view
returns (uint256) {
return vestedAmount(token).sub(released[token]);
}
...
...
@@ -99,7 +99,7 @@ contract TokenVesting is Ownable {
* @dev Calculates the amount that has already vested.
* @param token ERC20 token which is being vested
*/
function vestedAmount(ERC20Basic token) public
constant
returns (uint256) {
function vestedAmount(ERC20Basic token) public
view
returns (uint256) {
uint256 currentBalance = token.balanceOf(this);
uint256 totalBalance = currentBalance.add(released[token]);
...
...
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