mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4397 from ethereum/dropConstantKeywordTests
Test updates for dropping the constant keyword.
This commit is contained in:
commit
4649f9202a
@ -10,7 +10,7 @@ contract Factory {
|
|||||||
/// @return Returns number of instantiations by creator.
|
/// @return Returns number of instantiations by creator.
|
||||||
function getInstantiationCount(address creator)
|
function getInstantiationCount(address creator)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
return instantiations[creator].length;
|
return instantiations[creator].length;
|
||||||
|
@ -241,7 +241,7 @@ contract MultiSigWallet {
|
|||||||
/// @return Confirmation status.
|
/// @return Confirmation status.
|
||||||
function isConfirmed(uint transactionId)
|
function isConfirmed(uint transactionId)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
uint count = 0;
|
uint count = 0;
|
||||||
@ -285,7 +285,7 @@ contract MultiSigWallet {
|
|||||||
/// @return Number of confirmations.
|
/// @return Number of confirmations.
|
||||||
function getConfirmationCount(uint transactionId)
|
function getConfirmationCount(uint transactionId)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint count)
|
returns (uint count)
|
||||||
{
|
{
|
||||||
for (uint i=0; i<owners.length; i++)
|
for (uint i=0; i<owners.length; i++)
|
||||||
@ -299,7 +299,7 @@ contract MultiSigWallet {
|
|||||||
/// @return Total number of transactions after filters are applied.
|
/// @return Total number of transactions after filters are applied.
|
||||||
function getTransactionCount(bool pending, bool executed)
|
function getTransactionCount(bool pending, bool executed)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint count)
|
returns (uint count)
|
||||||
{
|
{
|
||||||
for (uint i=0; i<transactionCount; i++)
|
for (uint i=0; i<transactionCount; i++)
|
||||||
@ -312,7 +312,7 @@ contract MultiSigWallet {
|
|||||||
/// @return List of owner addresses.
|
/// @return List of owner addresses.
|
||||||
function getOwners()
|
function getOwners()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (address[])
|
returns (address[])
|
||||||
{
|
{
|
||||||
return owners;
|
return owners;
|
||||||
@ -323,7 +323,7 @@ contract MultiSigWallet {
|
|||||||
/// @return Returns array of owner addresses.
|
/// @return Returns array of owner addresses.
|
||||||
function getConfirmations(uint transactionId)
|
function getConfirmations(uint transactionId)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (address[] _confirmations)
|
returns (address[] _confirmations)
|
||||||
{
|
{
|
||||||
address[] memory confirmationsTemp = new address[](owners.length);
|
address[] memory confirmationsTemp = new address[](owners.length);
|
||||||
@ -347,7 +347,7 @@ contract MultiSigWallet {
|
|||||||
/// @return Returns array of transaction IDs.
|
/// @return Returns array of transaction IDs.
|
||||||
function getTransactionIds(uint from, uint to, bool pending, bool executed)
|
function getTransactionIds(uint from, uint to, bool pending, bool executed)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint[] _transactionIds)
|
returns (uint[] _transactionIds)
|
||||||
{
|
{
|
||||||
uint[] memory transactionIdsTemp = new uint[](transactionCount);
|
uint[] memory transactionIdsTemp = new uint[](transactionCount);
|
||||||
|
@ -85,7 +85,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
|
|||||||
/// @return Returns amount.
|
/// @return Returns amount.
|
||||||
function calcMaxWithdraw()
|
function calcMaxWithdraw()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
if (now > lastDay + 24 hours)
|
if (now > lastDay + 24 hours)
|
||||||
|
@ -59,7 +59,7 @@ contract TestToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function allowance(address _owner, address _spender)
|
function allowance(address _owner, address _spender)
|
||||||
constant
|
view
|
||||||
public
|
public
|
||||||
returns (uint256 remaining)
|
returns (uint256 remaining)
|
||||||
{
|
{
|
||||||
@ -67,7 +67,7 @@ contract TestToken {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address _owner)
|
function balanceOf(address _owner)
|
||||||
constant
|
view
|
||||||
public
|
public
|
||||||
returns (uint256 balance)
|
returns (uint256 balance)
|
||||||
{
|
{
|
||||||
|
@ -81,7 +81,7 @@ contract ico is safeMath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function ICObonus() public constant returns(uint256 bonus) {
|
function ICObonus() public view returns(uint256 bonus) {
|
||||||
/*
|
/*
|
||||||
Query of current bonus
|
Query of current bonus
|
||||||
|
|
||||||
@ -113,7 +113,7 @@ contract ico is safeMath {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkInterest(address addr) public constant returns(uint256 amount) {
|
function checkInterest(address addr) public view returns(uint256 amount) {
|
||||||
/*
|
/*
|
||||||
Query of compound interest
|
Query of compound interest
|
||||||
|
|
||||||
@ -355,7 +355,7 @@ contract ico is safeMath {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getIcoReward(uint256 value) public constant returns (uint256 reward) {
|
function getIcoReward(uint256 value) public view returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Expected token volume at token purchase
|
Expected token volume at token purchase
|
||||||
|
|
||||||
@ -368,7 +368,7 @@ contract ico is safeMath {
|
|||||||
if ( reward < 5e6) { return 0; }
|
if ( reward < 5e6) { return 0; }
|
||||||
}
|
}
|
||||||
|
|
||||||
function isICO() public constant returns (bool success) {
|
function isICO() public view returns (bool success) {
|
||||||
return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed );
|
return startBlock <= block.number && block.number <= icoDelay && ( ! aborted ) && ( ! closed );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,7 +2,7 @@ pragma solidity ^0.4.11;
|
|||||||
|
|
||||||
contract abstractModuleHandler {
|
contract abstractModuleHandler {
|
||||||
function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) {}
|
function transfer(address from, address to, uint256 value, bool fee) external returns (bool success) {}
|
||||||
function balanceOf(address owner) public constant returns (bool success, uint256 value) {}
|
function balanceOf(address owner) public view returns (bool success, uint256 value) {}
|
||||||
}
|
}
|
||||||
|
|
||||||
contract module {
|
contract module {
|
||||||
@ -127,7 +127,7 @@ contract module {
|
|||||||
if ( moduleStatus != status.Connected ) { return false; }
|
if ( moduleStatus != status.Connected ) { return false; }
|
||||||
return addr == moduleHandlerAddress;
|
return addr == moduleHandlerAddress;
|
||||||
}
|
}
|
||||||
function isActive() public constant returns (bool success, bool active) {
|
function isActive() public view returns (bool success, bool active) {
|
||||||
/*
|
/*
|
||||||
Check self for ready for functions or not.
|
Check self for ready for functions or not.
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ contract abstractModule {
|
|||||||
function disconnectModule() external returns (bool success) {}
|
function disconnectModule() external returns (bool success) {}
|
||||||
function replaceModule(address addr) external returns (bool success) {}
|
function replaceModule(address addr) external returns (bool success) {}
|
||||||
function disableModule(bool forever) external returns (bool success) {}
|
function disableModule(bool forever) external returns (bool success) {}
|
||||||
function isActive() public constant returns (bool success) {}
|
function isActive() public view returns (bool success) {}
|
||||||
function replaceModuleHandler(address newHandler) external returns (bool success) {}
|
function replaceModuleHandler(address newHandler) external returns (bool success) {}
|
||||||
function transferEvent(address from, address to, uint256 value) external returns (bool success) {}
|
function transferEvent(address from, address to, uint256 value) external returns (bool success) {}
|
||||||
function newSchellingRoundEvent(uint256 roundID, uint256 reward) external returns (bool success) {}
|
function newSchellingRoundEvent(uint256 roundID, uint256 reward) external returns (bool success) {}
|
||||||
@ -81,7 +81,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
}
|
}
|
||||||
modules[id] = input;
|
modules[id] = input;
|
||||||
}
|
}
|
||||||
function getModuleAddressByName(string name) public constant returns( bool success, bool found, address addr ) {
|
function getModuleAddressByName(string name) public view returns( bool success, bool found, address addr ) {
|
||||||
/*
|
/*
|
||||||
Search by name for module. The result is an Ethereum address.
|
Search by name for module. The result is an Ethereum address.
|
||||||
|
|
||||||
@ -94,7 +94,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
if ( _success && _found ) { return (true, true, modules[_id].addr); }
|
if ( _success && _found ) { return (true, true, modules[_id].addr); }
|
||||||
return (true, false, address(0x00));
|
return (true, false, address(0x00));
|
||||||
}
|
}
|
||||||
function getModuleIDByHash(bytes32 hashOfName) public constant returns( bool success, bool found, uint256 id ) {
|
function getModuleIDByHash(bytes32 hashOfName) public view returns( bool success, bool found, uint256 id ) {
|
||||||
/*
|
/*
|
||||||
Search by hash of name in the module array. The result is an index array.
|
Search by hash of name in the module array. The result is an index array.
|
||||||
|
|
||||||
@ -109,7 +109,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
}
|
}
|
||||||
return (true, false, 0);
|
return (true, false, 0);
|
||||||
}
|
}
|
||||||
function getModuleIDByName(string name) public constant returns( bool success, bool found, uint256 id ) {
|
function getModuleIDByName(string name) public view returns( bool success, bool found, uint256 id ) {
|
||||||
/*
|
/*
|
||||||
Search by name for module. The result is an index array.
|
Search by name for module. The result is an index array.
|
||||||
|
|
||||||
@ -125,7 +125,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
}
|
}
|
||||||
return (true, false, 0);
|
return (true, false, 0);
|
||||||
}
|
}
|
||||||
function getModuleIDByAddress(address addr) public constant returns( bool success, bool found, uint256 id ) {
|
function getModuleIDByAddress(address addr) public view returns( bool success, bool found, uint256 id ) {
|
||||||
/*
|
/*
|
||||||
Search by ethereum address for module. The result is an index array.
|
Search by ethereum address for module. The result is an index array.
|
||||||
|
|
||||||
@ -298,7 +298,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function balanceOf(address owner) public constant returns (bool success, uint256 value) {
|
function balanceOf(address owner) public view returns (bool success, uint256 value) {
|
||||||
/*
|
/*
|
||||||
Query of token balance.
|
Query of token balance.
|
||||||
|
|
||||||
@ -310,7 +310,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, token(modules[_id].addr).balanceOf(owner));
|
return (true, token(modules[_id].addr).balanceOf(owner));
|
||||||
}
|
}
|
||||||
function totalSupply() public constant returns (bool success, uint256 value) {
|
function totalSupply() public view returns (bool success, uint256 value) {
|
||||||
/*
|
/*
|
||||||
Query of the whole token amount.
|
Query of the whole token amount.
|
||||||
|
|
||||||
@ -321,7 +321,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, token(modules[_id].addr).totalSupply());
|
return (true, token(modules[_id].addr).totalSupply());
|
||||||
}
|
}
|
||||||
function isICO() public constant returns (bool success, bool ico) {
|
function isICO() public view returns (bool success, bool ico) {
|
||||||
/*
|
/*
|
||||||
Query of ICO state
|
Query of ICO state
|
||||||
|
|
||||||
@ -332,7 +332,7 @@ contract moduleHandler is multiOwner, announcementTypes {
|
|||||||
require( _success && _found );
|
require( _success && _found );
|
||||||
return (true, token(modules[_id].addr).isICO());
|
return (true, token(modules[_id].addr).isICO());
|
||||||
}
|
}
|
||||||
function getCurrentSchellingRoundID() public constant returns (bool success, uint256 round) {
|
function getCurrentSchellingRoundID() public view returns (bool success, uint256 round) {
|
||||||
/*
|
/*
|
||||||
Query of number of the actual Schelling round.
|
Query of number of the actual Schelling round.
|
||||||
|
|
||||||
|
@ -38,13 +38,13 @@ contract multiOwner is safeMath {
|
|||||||
/*
|
/*
|
||||||
Constants
|
Constants
|
||||||
*/
|
*/
|
||||||
function ownersForChange() public constant returns (uint256 owners) {
|
function ownersForChange() public view returns (uint256 owners) {
|
||||||
return ownerCount * 75 / 100;
|
return ownerCount * 75 / 100;
|
||||||
}
|
}
|
||||||
function calcDoHash(string job, bytes32 data) public constant returns (bytes32 hash) {
|
function calcDoHash(string job, bytes32 data) public pure returns (bytes32 hash) {
|
||||||
return keccak256(abi.encodePacked(job, data));
|
return keccak256(abi.encodePacked(job, data));
|
||||||
}
|
}
|
||||||
function validDoHash(bytes32 doHash) public constant returns (bool valid) {
|
function validDoHash(bytes32 doHash) public view returns (bool valid) {
|
||||||
return doDB[doHash].length > 0;
|
return doDB[doHash].length > 0;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
|
@ -140,7 +140,7 @@ contract premium is module, safeMath {
|
|||||||
emit Approval(msg.sender, spender, amount);
|
emit Approval(msg.sender, spender, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowance(address owner, address spender) constant returns (uint256 remaining, uint256 nonce) {
|
function allowance(address owner, address spender) view returns (uint256 remaining, uint256 nonce) {
|
||||||
/*
|
/*
|
||||||
Get the quantity of tokens given to be used
|
Get the quantity of tokens given to be used
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ contract premium is module, safeMath {
|
|||||||
return _codeLength > 0;
|
return _codeLength > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address owner) constant returns (uint256 value) {
|
function balanceOf(address owner) view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Token balance query
|
Token balance query
|
||||||
|
|
||||||
@ -329,7 +329,7 @@ contract premium is module, safeMath {
|
|||||||
return db.balanceOf(owner);
|
return db.balanceOf(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
function totalSupply() constant returns (uint256 value) {
|
function totalSupply() view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Total token quantity query
|
Total token quantity query
|
||||||
|
|
||||||
|
@ -147,7 +147,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
else { return false; }
|
else { return false; }
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function getUserDetails(address addr, uint256 schellingRound) public constant returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) {
|
function getUserDetails(address addr, uint256 schellingRound) public view returns (address ProviderAddress, uint256 ProviderHeight, uint256 ConnectedOn, uint256 value) {
|
||||||
/*
|
/*
|
||||||
Collecting the datas of the client.
|
Collecting the datas of the client.
|
||||||
|
|
||||||
@ -168,7 +168,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
value = clients[addr].supply[schellingRound];
|
value = clients[addr].supply[schellingRound];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function rightForInterest(uint256 value, bool priv) internal returns (bool) {
|
function rightForInterest(uint256 value, bool priv) internal view returns (bool) {
|
||||||
/*
|
/*
|
||||||
the share from the token emission.
|
the share from the token emission.
|
||||||
In case is a private provider it has to be checked if it has enough connected capital to be able to accept share from the token emission.
|
In case is a private provider it has to be checked if it has enough connected capital to be able to accept share from the token emission.
|
||||||
@ -299,7 +299,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
providers[addr].data[currHeight].currentRate = rate;
|
providers[addr].data[currHeight].currentRate = rate;
|
||||||
emit EProviderDetailsChanged(addr, currHeight, website, country, info, rate, admin);
|
emit EProviderDetailsChanged(addr, currHeight, website, country, info, rate, admin);
|
||||||
}
|
}
|
||||||
function getProviderInfo(address addr, uint256 height) public constant returns (string name, string website, string country, string info, uint256 create) {
|
function getProviderInfo(address addr, uint256 height) public view returns (string name, string website, string country, string info, uint256 create) {
|
||||||
/*
|
/*
|
||||||
for the infos of the provider.
|
for the infos of the provider.
|
||||||
In case the height is unknown then the system will use the last known height.
|
In case the height is unknown then the system will use the last known height.
|
||||||
@ -321,7 +321,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
info = providers[addr].data[height].info;
|
info = providers[addr].data[height].info;
|
||||||
create = providers[addr].data[height].create;
|
create = providers[addr].data[height].create;
|
||||||
}
|
}
|
||||||
function getProviderDetails(address addr, uint256 height) public constant returns (uint8 rate, bool isForRent, uint256 clientsCount, bool priv, bool getInterest, bool valid) {
|
function getProviderDetails(address addr, uint256 height) public view returns (uint8 rate, bool isForRent, uint256 clientsCount, bool priv, bool getInterest, bool valid) {
|
||||||
/*
|
/*
|
||||||
Asking for the datas of the provider.
|
Asking for the datas of the provider.
|
||||||
In case the height is unknown then the system will use the last known height.
|
In case the height is unknown then the system will use the last known height.
|
||||||
@ -345,7 +345,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
getInterest = rightForInterest(getProviderCurrentSupply(addr), providers[addr].data[height].priv );
|
getInterest = rightForInterest(getProviderCurrentSupply(addr), providers[addr].data[height].priv );
|
||||||
valid = providers[addr].data[height].valid;
|
valid = providers[addr].data[height].valid;
|
||||||
}
|
}
|
||||||
function getProviderCurrentSupply(address addr) internal returns (uint256) {
|
function getProviderCurrentSupply(address addr) internal view returns (uint256) {
|
||||||
/*
|
/*
|
||||||
Inner function for polling the current height and the current quantity of the connected capital of the schelling round.
|
Inner function for polling the current height and the current quantity of the connected capital of the schelling round.
|
||||||
|
|
||||||
@ -469,7 +469,7 @@ contract provider is module, safeMath, announcementTypes {
|
|||||||
delete clients[msg.sender].providerConnected;
|
delete clients[msg.sender].providerConnected;
|
||||||
emit EClientLost(msg.sender, provider, currHeight, bal);
|
emit EClientLost(msg.sender, provider, currHeight, bal);
|
||||||
}
|
}
|
||||||
function checkReward(address addr) public constant returns (uint256 reward) {
|
function checkReward(address addr) public returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Polling the share from the token emission for clients and for providers.
|
Polling the share from the token emission for clients and for providers.
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ contract publisher is announcementTypes, module, safeMath {
|
|||||||
super.registerModuleHandler(moduleHandler);
|
super.registerModuleHandler(moduleHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
function Announcements(uint256 id) public constant returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string Announcement, string Link, bool Opposited, string _str, uint256 _uint, address _addr) {
|
function Announcements(uint256 id) public view returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string Announcement, string Link, bool Opposited, string _str, uint256 _uint, address _addr) {
|
||||||
/*
|
/*
|
||||||
Announcement data query
|
Announcement data query
|
||||||
|
|
||||||
@ -101,7 +101,7 @@ contract publisher is announcementTypes, module, safeMath {
|
|||||||
_addr = announcements[id]._addr;
|
_addr = announcements[id]._addr;
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkOpposited(uint256 weight, bool oppositable) public constant returns (bool success) {
|
function checkOpposited(uint256 weight, bool oppositable) public view returns (bool success) {
|
||||||
/*
|
/*
|
||||||
Veto check
|
Veto check
|
||||||
|
|
||||||
|
@ -54,7 +54,7 @@ contract schellingDB is safeMath, schellingVars {
|
|||||||
Funds
|
Funds
|
||||||
*/
|
*/
|
||||||
mapping(address => uint256) private funds;
|
mapping(address => uint256) private funds;
|
||||||
function getFunds(address _owner) constant returns(bool, uint256) {
|
function getFunds(address _owner) view returns(bool, uint256) {
|
||||||
return (true, funds[_owner]);
|
return (true, funds[_owner]);
|
||||||
}
|
}
|
||||||
function setFunds(address _owner, uint256 _amount) isOwner external returns(bool) {
|
function setFunds(address _owner, uint256 _amount) isOwner external returns(bool) {
|
||||||
@ -65,7 +65,7 @@ contract schellingDB is safeMath, schellingVars {
|
|||||||
Rounds
|
Rounds
|
||||||
*/
|
*/
|
||||||
_rounds[] private rounds;
|
_rounds[] private rounds;
|
||||||
function getRound(uint256 _id) constant returns(bool, uint256, uint256, uint256, uint256, bool) {
|
function getRound(uint256 _id) view returns(bool, uint256, uint256, uint256, uint256, bool) {
|
||||||
if ( rounds.length <= _id ) { return (false, 0, 0, 0, 0, false); }
|
if ( rounds.length <= _id ) { return (false, 0, 0, 0, 0, false); }
|
||||||
else { return (true, rounds[_id].totalAboveWeight, rounds[_id].totalBelowWeight, rounds[_id].reward, rounds[_id].blockHeight, rounds[_id].voted); }
|
else { return (true, rounds[_id].totalAboveWeight, rounds[_id].totalBelowWeight, rounds[_id].reward, rounds[_id].blockHeight, rounds[_id].voted); }
|
||||||
}
|
}
|
||||||
@ -76,14 +76,14 @@ contract schellingDB is safeMath, schellingVars {
|
|||||||
rounds[_id] = _rounds(_totalAboveWeight, _totalBelowWeight, _reward, _blockHeight, _voted);
|
rounds[_id] = _rounds(_totalAboveWeight, _totalBelowWeight, _reward, _blockHeight, _voted);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function getCurrentRound() constant returns(bool, uint256) {
|
function getCurrentRound() view returns(bool, uint256) {
|
||||||
return (true, rounds.length-1);
|
return (true, rounds.length-1);
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
Voter
|
Voter
|
||||||
*/
|
*/
|
||||||
mapping(address => _voter) private voter;
|
mapping(address => _voter) private voter;
|
||||||
function getVoter(address _owner) constant returns(bool success, uint256 roundID,
|
function getVoter(address _owner) view returns(bool success, uint256 roundID,
|
||||||
bytes32 hash, voterStatus status, bool voteResult, uint256 rewards) {
|
bytes32 hash, voterStatus status, bool voteResult, uint256 rewards) {
|
||||||
roundID = voter[_owner].roundID;
|
roundID = voter[_owner].roundID;
|
||||||
hash = voter[_owner].hash;
|
hash = voter[_owner].hash;
|
||||||
@ -106,7 +106,7 @@ contract schellingDB is safeMath, schellingVars {
|
|||||||
Schelling Token emission
|
Schelling Token emission
|
||||||
*/
|
*/
|
||||||
mapping(uint256 => uint256) private schellingExpansion;
|
mapping(uint256 => uint256) private schellingExpansion;
|
||||||
function getSchellingExpansion(uint256 _id) constant returns(bool, uint256) {
|
function getSchellingExpansion(uint256 _id) view returns(bool, uint256) {
|
||||||
return (true, schellingExpansion[_id]);
|
return (true, schellingExpansion[_id]);
|
||||||
}
|
}
|
||||||
function setSchellingExpansion(uint256 _id, uint256 _expansion) isOwner external returns(bool) {
|
function setSchellingExpansion(uint256 _id, uint256 _expansion) isOwner external returns(bool) {
|
||||||
@ -121,7 +121,7 @@ contract schellingDB is safeMath, schellingVars {
|
|||||||
currentSchellingRound = _id;
|
currentSchellingRound = _id;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
function getCurrentSchellingRound() constant returns(bool, uint256) {
|
function getCurrentSchellingRound() view returns(bool, uint256) {
|
||||||
return (true, currentSchellingRound);
|
return (true, currentSchellingRound);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -183,7 +183,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
voter.rewards
|
voter.rewards
|
||||||
) );
|
) );
|
||||||
}
|
}
|
||||||
function getVoter(address addr) internal returns (_voter) {
|
function getVoter(address addr) internal view returns (_voter) {
|
||||||
(bool a, uint256 b, bytes32 c, schellingVars.voterStatus d, bool e, uint256 f) = db.getVoter(addr);
|
(bool a, uint256 b, bytes32 c, schellingVars.voterStatus d, bool e, uint256 f) = db.getVoter(addr);
|
||||||
require( a );
|
require( a );
|
||||||
return _voter(b, c, d, e, f);
|
return _voter(b, c, d, e, f);
|
||||||
@ -221,7 +221,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function setCurrentSchellingRound(uint256 id) internal {
|
function setCurrentSchellingRound(uint256 id) internal {
|
||||||
require( db.setCurrentSchellingRound(id) );
|
require( db.setCurrentSchellingRound(id) );
|
||||||
}
|
}
|
||||||
function getCurrentSchellingRound() internal returns(uint256) {
|
function getCurrentSchellingRound() internal view returns(uint256) {
|
||||||
(bool a, uint256 b) = db.getCurrentSchellingRound();
|
(bool a, uint256 b) = db.getCurrentSchellingRound();
|
||||||
require( a );
|
require( a );
|
||||||
return b;
|
return b;
|
||||||
@ -229,7 +229,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
function setSchellingExpansion(uint256 id, uint256 amount) internal {
|
function setSchellingExpansion(uint256 id, uint256 amount) internal {
|
||||||
require( db.setSchellingExpansion(id, amount) );
|
require( db.setSchellingExpansion(id, amount) );
|
||||||
}
|
}
|
||||||
function getSchellingExpansion(uint256 id) internal returns(uint256) {
|
function getSchellingExpansion(uint256 id) internal view returns(uint256) {
|
||||||
(bool a, uint256 b) = db.getSchellingExpansion(id);
|
(bool a, uint256 b) = db.getSchellingExpansion(id);
|
||||||
require( a );
|
require( a );
|
||||||
return b;
|
return b;
|
||||||
@ -417,7 +417,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
setVoter(msg.sender, voter);
|
setVoter(msg.sender, voter);
|
||||||
}
|
}
|
||||||
function checkReward() public constant returns (uint256 reward) {
|
function checkReward() public view returns (uint256 reward) {
|
||||||
/*
|
/*
|
||||||
Withdraw of the amount of the prize (it’s only information).
|
Withdraw of the amount of the prize (it’s only information).
|
||||||
|
|
||||||
@ -496,7 +496,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
|
|
||||||
require( moduleHandler(moduleHandlerAddress).transfer(address(this), msg.sender, funds, true) );
|
require( moduleHandler(moduleHandlerAddress).transfer(address(this), msg.sender, funds, true) );
|
||||||
}
|
}
|
||||||
function getCurrentSchellingRoundID() public constant returns (uint256) {
|
function getCurrentSchellingRoundID() public view returns (uint256) {
|
||||||
/*
|
/*
|
||||||
Number of actual Schelling round.
|
Number of actual Schelling round.
|
||||||
|
|
||||||
@ -504,7 +504,7 @@ contract schelling is module, announcementTypes, schellingVars {
|
|||||||
*/
|
*/
|
||||||
return getCurrentSchellingRound();
|
return getCurrentSchellingRound();
|
||||||
}
|
}
|
||||||
function getSchellingRound(uint256 id) public constant returns (uint256 expansion) {
|
function getSchellingRound(uint256 id) public view returns (uint256 expansion) {
|
||||||
/*
|
/*
|
||||||
Amount of token emission of the Schelling round.
|
Amount of token emission of the Schelling round.
|
||||||
|
|
||||||
|
@ -155,7 +155,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
emit Approval(msg.sender, spender, amount);
|
emit Approval(msg.sender, spender, amount);
|
||||||
}
|
}
|
||||||
|
|
||||||
function allowance(address owner, address spender) constant returns (uint256 remaining, uint256 nonce) {
|
function allowance(address owner, address spender) view returns (uint256 remaining, uint256 nonce) {
|
||||||
/*
|
/*
|
||||||
Get the quantity of tokens given to be used
|
Get the quantity of tokens given to be used
|
||||||
|
|
||||||
@ -386,7 +386,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function getTransactionFee(uint256 value) public constant returns (bool success, uint256 fee) {
|
function getTransactionFee(uint256 value) public view returns (bool success, uint256 fee) {
|
||||||
/*
|
/*
|
||||||
Transaction fee query.
|
Transaction fee query.
|
||||||
|
|
||||||
@ -472,7 +472,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
return _codeLength > 0;
|
return _codeLength > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function balanceOf(address owner) constant returns (uint256 value) {
|
function balanceOf(address owner) view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Token balance query
|
Token balance query
|
||||||
|
|
||||||
@ -483,7 +483,7 @@ contract token is safeMath, module, announcementTypes {
|
|||||||
return db.balanceOf(owner);
|
return db.balanceOf(owner);
|
||||||
}
|
}
|
||||||
|
|
||||||
function totalSupply() constant returns (uint256 value) {
|
function totalSupply() view returns (uint256 value) {
|
||||||
/*
|
/*
|
||||||
Total token quantity query
|
Total token quantity query
|
||||||
|
|
||||||
|
@ -61,7 +61,7 @@ contract tokenDB is safeMath, ownedDB {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function getAllowance(address owner, address spender) constant returns(bool success, uint256 remaining, uint256 nonce) {
|
function getAllowance(address owner, address spender) view returns(bool success, uint256 remaining, uint256 nonce) {
|
||||||
/*
|
/*
|
||||||
Get allowance from the database.
|
Get allowance from the database.
|
||||||
|
|
||||||
|
@ -45,7 +45,7 @@ contract CategoricalEvent is Event {
|
|||||||
/// @return Event hash
|
/// @return Event hash
|
||||||
function getEventHash()
|
function getEventHash()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bytes32)
|
returns (bytes32)
|
||||||
{
|
{
|
||||||
return keccak256(abi.encodePacked(collateralToken, oracle, outcomeTokens.length));
|
return keccak256(abi.encodePacked(collateralToken, oracle, outcomeTokens.length));
|
||||||
|
@ -90,7 +90,7 @@ contract Event {
|
|||||||
/// @return Outcome count
|
/// @return Outcome count
|
||||||
function getOutcomeCount()
|
function getOutcomeCount()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint8)
|
returns (uint8)
|
||||||
{
|
{
|
||||||
return uint8(outcomeTokens.length);
|
return uint8(outcomeTokens.length);
|
||||||
@ -100,7 +100,7 @@ contract Event {
|
|||||||
/// @return Outcome tokens
|
/// @return Outcome tokens
|
||||||
function getOutcomeTokens()
|
function getOutcomeTokens()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (OutcomeToken[])
|
returns (OutcomeToken[])
|
||||||
{
|
{
|
||||||
return outcomeTokens;
|
return outcomeTokens;
|
||||||
@ -110,7 +110,7 @@ contract Event {
|
|||||||
/// @return Outcome token distribution
|
/// @return Outcome token distribution
|
||||||
function getOutcomeTokenDistribution(address owner)
|
function getOutcomeTokenDistribution(address owner)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint[] outcomeTokenDistribution)
|
returns (uint[] outcomeTokenDistribution)
|
||||||
{
|
{
|
||||||
outcomeTokenDistribution = new uint[](outcomeTokens.length);
|
outcomeTokenDistribution = new uint[](outcomeTokens.length);
|
||||||
@ -120,7 +120,7 @@ contract Event {
|
|||||||
|
|
||||||
/// @dev Calculates and returns event hash
|
/// @dev Calculates and returns event hash
|
||||||
/// @return Event hash
|
/// @return Event hash
|
||||||
function getEventHash() public constant returns (bytes32);
|
function getEventHash() public view returns (bytes32);
|
||||||
|
|
||||||
/// @dev Exchanges sender's winning outcome tokens for collateral tokens
|
/// @dev Exchanges sender's winning outcome tokens for collateral tokens
|
||||||
/// @return Sender's winnings
|
/// @return Sender's winnings
|
||||||
|
@ -79,7 +79,7 @@ contract ScalarEvent is Event {
|
|||||||
/// @return Event hash
|
/// @return Event hash
|
||||||
function getEventHash()
|
function getEventHash()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bytes32)
|
returns (bytes32)
|
||||||
{
|
{
|
||||||
return keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound));
|
return keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound));
|
||||||
|
@ -24,7 +24,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @return Cost
|
/// @return Cost
|
||||||
function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint cost)
|
returns (uint cost)
|
||||||
{
|
{
|
||||||
require(market.eventContract().getOutcomeCount() > 1);
|
require(market.eventContract().getOutcomeCount() > 1);
|
||||||
@ -59,7 +59,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @return Profit
|
/// @return Profit
|
||||||
function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint profit)
|
returns (uint profit)
|
||||||
{
|
{
|
||||||
require(market.eventContract().getOutcomeCount() > 1);
|
require(market.eventContract().getOutcomeCount() > 1);
|
||||||
@ -85,7 +85,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @return Marginal price of an outcome as a fixed point number
|
/// @return Marginal price of an outcome as a fixed point number
|
||||||
function calcMarginalPrice(Market market, uint8 outcomeTokenIndex)
|
function calcMarginalPrice(Market market, uint8 outcomeTokenIndex)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint price)
|
returns (uint price)
|
||||||
{
|
{
|
||||||
require(market.eventContract().getOutcomeCount() > 1);
|
require(market.eventContract().getOutcomeCount() > 1);
|
||||||
@ -110,7 +110,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @return Cost level
|
/// @return Cost level
|
||||||
function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding)
|
function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding)
|
||||||
private
|
private
|
||||||
constant
|
view
|
||||||
returns(int costLevel)
|
returns(int costLevel)
|
||||||
{
|
{
|
||||||
// The cost function is C = b * log(sum(exp(q/b) for q in quantities)).
|
// The cost function is C = b * log(sum(exp(q/b) for q in quantities)).
|
||||||
@ -131,7 +131,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @return A result structure composed of the sum, the offset used, and the summand associated with the supplied index
|
/// @return A result structure composed of the sum, the offset used, and the summand associated with the supplied index
|
||||||
function sumExpOffset(int logN, int[] netOutcomeTokensSold, uint funding, uint8 outcomeIndex)
|
function sumExpOffset(int logN, int[] netOutcomeTokensSold, uint funding, uint8 outcomeIndex)
|
||||||
private
|
private
|
||||||
constant
|
view
|
||||||
returns (uint sum, int offset, uint outcomeExpTerm)
|
returns (uint sum, int offset, uint outcomeExpTerm)
|
||||||
{
|
{
|
||||||
// Naive calculation of this causes an overflow
|
// Naive calculation of this causes an overflow
|
||||||
@ -170,7 +170,7 @@ contract LMSRMarketMaker is MarketMaker {
|
|||||||
/// @return Net outcome tokens sold by market
|
/// @return Net outcome tokens sold by market
|
||||||
function getNetOutcomeTokensSold(Market market)
|
function getNetOutcomeTokensSold(Market market)
|
||||||
private
|
private
|
||||||
constant
|
view
|
||||||
returns (int[] quantities)
|
returns (int[] quantities)
|
||||||
{
|
{
|
||||||
quantities = new int[](market.eventContract().getOutcomeCount());
|
quantities = new int[](market.eventContract().getOutcomeCount());
|
||||||
|
@ -8,7 +8,7 @@ contract MarketMaker {
|
|||||||
/*
|
/*
|
||||||
* Public functions
|
* Public functions
|
||||||
*/
|
*/
|
||||||
function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint);
|
function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public view returns (uint);
|
||||||
function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint);
|
function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public view returns (uint);
|
||||||
function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public constant returns (uint);
|
function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public view returns (uint);
|
||||||
}
|
}
|
||||||
|
@ -43,5 +43,5 @@ contract Market {
|
|||||||
function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost) public returns (uint);
|
function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost) public returns (uint);
|
||||||
function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint);
|
function sell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint);
|
||||||
function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint);
|
function shortSell(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint minProfit) public returns (uint);
|
||||||
function calcMarketFee(uint outcomeTokenCost) public constant returns (uint);
|
function calcMarketFee(uint outcomeTokenCost) public view returns (uint);
|
||||||
}
|
}
|
||||||
|
@ -186,7 +186,7 @@ contract StandardMarket is Market {
|
|||||||
/// @return Fee for trade
|
/// @return Fee for trade
|
||||||
function calcMarketFee(uint outcomeTokenCost)
|
function calcMarketFee(uint outcomeTokenCost)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
return outcomeTokenCost * fee / FEE_RANGE;
|
return outcomeTokenCost * fee / FEE_RANGE;
|
||||||
|
@ -72,7 +72,7 @@ contract CentralizedOracle is Oracle {
|
|||||||
/// @return Is outcome set?
|
/// @return Is outcome set?
|
||||||
function isOutcomeSet()
|
function isOutcomeSet()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return isSet;
|
return isSet;
|
||||||
@ -82,7 +82,7 @@ contract CentralizedOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getOutcome()
|
function getOutcome()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
return outcome;
|
return outcome;
|
||||||
|
@ -44,7 +44,7 @@ contract DifficultyOracle is Oracle {
|
|||||||
/// @return Is outcome set?
|
/// @return Is outcome set?
|
||||||
function isOutcomeSet()
|
function isOutcomeSet()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
// Difficulty is always bigger than 0
|
// Difficulty is always bigger than 0
|
||||||
@ -55,7 +55,7 @@ contract DifficultyOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getOutcome()
|
function getOutcome()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
return int(difficulty);
|
return int(difficulty);
|
||||||
|
@ -151,7 +151,7 @@ contract FutarchyOracle is Oracle {
|
|||||||
/// @return Is outcome set?
|
/// @return Is outcome set?
|
||||||
function isOutcomeSet()
|
function isOutcomeSet()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return isSet;
|
return isSet;
|
||||||
@ -161,7 +161,7 @@ contract FutarchyOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getOutcome()
|
function getOutcome()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
return int(winningMarketIndex);
|
return int(winningMarketIndex);
|
||||||
|
@ -32,6 +32,7 @@ contract MajorityOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getStatusAndOutcome()
|
function getStatusAndOutcome()
|
||||||
public
|
public
|
||||||
|
view
|
||||||
returns (bool outcomeSet, int outcome)
|
returns (bool outcomeSet, int outcome)
|
||||||
{
|
{
|
||||||
uint i;
|
uint i;
|
||||||
@ -69,7 +70,7 @@ contract MajorityOracle is Oracle {
|
|||||||
/// @return Is outcome set?
|
/// @return Is outcome set?
|
||||||
function isOutcomeSet()
|
function isOutcomeSet()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
(bool outcomeSet, ) = getStatusAndOutcome();
|
(bool outcomeSet, ) = getStatusAndOutcome();
|
||||||
@ -80,7 +81,7 @@ contract MajorityOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getOutcome()
|
function getOutcome()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
(, int winningOutcome) = getStatusAndOutcome();
|
(, int winningOutcome) = getStatusAndOutcome();
|
||||||
|
@ -4,6 +4,6 @@ pragma solidity ^0.4.11;
|
|||||||
/// @title Abstract oracle contract - Functions to be implemented by oracles
|
/// @title Abstract oracle contract - Functions to be implemented by oracles
|
||||||
contract Oracle {
|
contract Oracle {
|
||||||
|
|
||||||
function isOutcomeSet() public constant returns (bool);
|
function isOutcomeSet() public view returns (bool);
|
||||||
function getOutcome() public constant returns (int);
|
function getOutcome() public view returns (int);
|
||||||
}
|
}
|
||||||
|
@ -84,7 +84,7 @@ contract SignedMessageOracle is Oracle {
|
|||||||
/// @return Is outcome set?
|
/// @return Is outcome set?
|
||||||
function isOutcomeSet()
|
function isOutcomeSet()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return isSet;
|
return isSet;
|
||||||
@ -94,7 +94,7 @@ contract SignedMessageOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getOutcome()
|
function getOutcome()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
return outcome;
|
return outcome;
|
||||||
|
@ -144,6 +144,7 @@ contract UltimateOracle is Oracle {
|
|||||||
/// @return Is challenge period over?
|
/// @return Is challenge period over?
|
||||||
function isChallengePeriodOver()
|
function isChallengePeriodOver()
|
||||||
public
|
public
|
||||||
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return forwardedOutcomeSetTimestamp != 0 && now.sub(forwardedOutcomeSetTimestamp) > challengePeriod;
|
return forwardedOutcomeSetTimestamp != 0 && now.sub(forwardedOutcomeSetTimestamp) > challengePeriod;
|
||||||
@ -153,6 +154,7 @@ contract UltimateOracle is Oracle {
|
|||||||
/// @return Is front runner period over?
|
/// @return Is front runner period over?
|
||||||
function isFrontRunnerPeriodOver()
|
function isFrontRunnerPeriodOver()
|
||||||
public
|
public
|
||||||
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return frontRunnerSetTimestamp != 0 && now.sub(frontRunnerSetTimestamp) > frontRunnerPeriod;
|
return frontRunnerSetTimestamp != 0 && now.sub(frontRunnerSetTimestamp) > frontRunnerPeriod;
|
||||||
@ -162,6 +164,7 @@ contract UltimateOracle is Oracle {
|
|||||||
/// @return Is challenged?
|
/// @return Is challenged?
|
||||||
function isChallenged()
|
function isChallenged()
|
||||||
public
|
public
|
||||||
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return frontRunnerSetTimestamp != 0;
|
return frontRunnerSetTimestamp != 0;
|
||||||
@ -171,7 +174,7 @@ contract UltimateOracle is Oracle {
|
|||||||
/// @return Is outcome set?
|
/// @return Is outcome set?
|
||||||
function isOutcomeSet()
|
function isOutcomeSet()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return isChallengePeriodOver() && !isChallenged()
|
return isChallengePeriodOver() && !isChallenged()
|
||||||
@ -182,7 +185,7 @@ contract UltimateOracle is Oracle {
|
|||||||
/// @return Outcome
|
/// @return Outcome
|
||||||
function getOutcome()
|
function getOutcome()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
if (isFrontRunnerPeriodOver())
|
if (isFrontRunnerPeriodOver())
|
||||||
|
@ -73,7 +73,7 @@ contract StandardToken is Token {
|
|||||||
/// @return Remaining allowance for spender
|
/// @return Remaining allowance for spender
|
||||||
function allowance(address owner, address spender)
|
function allowance(address owner, address spender)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
return allowances[owner][spender];
|
return allowances[owner][spender];
|
||||||
@ -84,7 +84,7 @@ contract StandardToken is Token {
|
|||||||
/// @return Balance of owner
|
/// @return Balance of owner
|
||||||
function balanceOf(address owner)
|
function balanceOf(address owner)
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
return balances[owner];
|
return balances[owner];
|
||||||
@ -94,7 +94,7 @@ contract StandardToken is Token {
|
|||||||
/// @return Total supply
|
/// @return Total supply
|
||||||
function totalSupply()
|
function totalSupply()
|
||||||
public
|
public
|
||||||
constant
|
view
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
return totalTokens;
|
return totalTokens;
|
||||||
|
@ -17,7 +17,7 @@ contract Token {
|
|||||||
function transfer(address to, uint value) public returns (bool);
|
function transfer(address to, uint value) public returns (bool);
|
||||||
function transferFrom(address from, address to, uint value) public returns (bool);
|
function transferFrom(address from, address to, uint value) public returns (bool);
|
||||||
function approve(address spender, uint value) public returns (bool);
|
function approve(address spender, uint value) public returns (bool);
|
||||||
function balanceOf(address owner) public constant returns (uint);
|
function balanceOf(address owner) public view returns (uint);
|
||||||
function allowance(address owner, address spender) public constant returns (uint);
|
function allowance(address owner, address spender) public view returns (uint);
|
||||||
function totalSupply() public constant returns (uint);
|
function totalSupply() public view returns (uint);
|
||||||
}
|
}
|
||||||
|
@ -22,7 +22,7 @@ library Math {
|
|||||||
/// @return e**x
|
/// @return e**x
|
||||||
function exp(int x)
|
function exp(int x)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
// revert if x is > MAX_POWER, where
|
// revert if x is > MAX_POWER, where
|
||||||
@ -107,7 +107,7 @@ library Math {
|
|||||||
/// @return ln(x)
|
/// @return ln(x)
|
||||||
function ln(uint x)
|
function ln(uint x)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
require(x > 0);
|
require(x > 0);
|
||||||
@ -157,7 +157,7 @@ library Math {
|
|||||||
/// @return logarithmic value
|
/// @return logarithmic value
|
||||||
function floorLog2(uint x)
|
function floorLog2(uint x)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (int lo)
|
returns (int lo)
|
||||||
{
|
{
|
||||||
lo = -64;
|
lo = -64;
|
||||||
@ -178,7 +178,7 @@ library Math {
|
|||||||
/// @return Maximum number
|
/// @return Maximum number
|
||||||
function max(int[] nums)
|
function max(int[] nums)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (int max)
|
returns (int max)
|
||||||
{
|
{
|
||||||
require(nums.length > 0);
|
require(nums.length > 0);
|
||||||
@ -194,7 +194,7 @@ library Math {
|
|||||||
/// @return Did no overflow occur?
|
/// @return Did no overflow occur?
|
||||||
function safeToAdd(uint a, uint b)
|
function safeToAdd(uint a, uint b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return a + b >= a;
|
return a + b >= a;
|
||||||
@ -206,7 +206,7 @@ library Math {
|
|||||||
/// @return Did no underflow occur?
|
/// @return Did no underflow occur?
|
||||||
function safeToSub(uint a, uint b)
|
function safeToSub(uint a, uint b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return a >= b;
|
return a >= b;
|
||||||
@ -218,7 +218,7 @@ library Math {
|
|||||||
/// @return Did no overflow occur?
|
/// @return Did no overflow occur?
|
||||||
function safeToMul(uint a, uint b)
|
function safeToMul(uint a, uint b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return b == 0 || a * b / b == a;
|
return b == 0 || a * b / b == a;
|
||||||
@ -230,7 +230,7 @@ library Math {
|
|||||||
/// @return Sum
|
/// @return Sum
|
||||||
function add(uint a, uint b)
|
function add(uint a, uint b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
require(safeToAdd(a, b));
|
require(safeToAdd(a, b));
|
||||||
@ -243,7 +243,7 @@ library Math {
|
|||||||
/// @return Difference
|
/// @return Difference
|
||||||
function sub(uint a, uint b)
|
function sub(uint a, uint b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
require(safeToSub(a, b));
|
require(safeToSub(a, b));
|
||||||
@ -256,7 +256,7 @@ library Math {
|
|||||||
/// @return Product
|
/// @return Product
|
||||||
function mul(uint a, uint b)
|
function mul(uint a, uint b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (uint)
|
returns (uint)
|
||||||
{
|
{
|
||||||
require(safeToMul(a, b));
|
require(safeToMul(a, b));
|
||||||
@ -269,7 +269,7 @@ library Math {
|
|||||||
/// @return Did no overflow occur?
|
/// @return Did no overflow occur?
|
||||||
function safeToAdd(int a, int b)
|
function safeToAdd(int a, int b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return (b >= 0 && a + b >= a) || (b < 0 && a + b < a);
|
return (b >= 0 && a + b >= a) || (b < 0 && a + b < a);
|
||||||
@ -281,7 +281,7 @@ library Math {
|
|||||||
/// @return Did no underflow occur?
|
/// @return Did no underflow occur?
|
||||||
function safeToSub(int a, int b)
|
function safeToSub(int a, int b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return (b >= 0 && a - b <= a) || (b < 0 && a - b > a);
|
return (b >= 0 && a - b <= a) || (b < 0 && a - b > a);
|
||||||
@ -293,7 +293,7 @@ library Math {
|
|||||||
/// @return Did no overflow occur?
|
/// @return Did no overflow occur?
|
||||||
function safeToMul(int a, int b)
|
function safeToMul(int a, int b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (bool)
|
returns (bool)
|
||||||
{
|
{
|
||||||
return (b == 0) || (a * b / b == a);
|
return (b == 0) || (a * b / b == a);
|
||||||
@ -305,7 +305,7 @@ library Math {
|
|||||||
/// @return Sum
|
/// @return Sum
|
||||||
function add(int a, int b)
|
function add(int a, int b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
require(safeToAdd(a, b));
|
require(safeToAdd(a, b));
|
||||||
@ -318,7 +318,7 @@ library Math {
|
|||||||
/// @return Difference
|
/// @return Difference
|
||||||
function sub(int a, int b)
|
function sub(int a, int b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
require(safeToSub(a, b));
|
require(safeToSub(a, b));
|
||||||
@ -331,7 +331,7 @@ library Math {
|
|||||||
/// @return Product
|
/// @return Product
|
||||||
function mul(int a, int b)
|
function mul(int a, int b)
|
||||||
public
|
public
|
||||||
constant
|
pure
|
||||||
returns (int)
|
returns (int)
|
||||||
{
|
{
|
||||||
require(safeToMul(a, b));
|
require(safeToMul(a, b));
|
||||||
|
@ -124,7 +124,7 @@ contract MilestoneTracker {
|
|||||||
/////////
|
/////////
|
||||||
|
|
||||||
/// @return The number of milestones ever created even if they were canceled
|
/// @return The number of milestones ever created even if they were canceled
|
||||||
function numberOfMilestones() constant returns (uint) {
|
function numberOfMilestones() view returns (uint) {
|
||||||
return milestones.length;
|
return milestones.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ library RLP {
|
|||||||
|
|
||||||
/* Iterator */
|
/* Iterator */
|
||||||
|
|
||||||
function next(Iterator memory self) internal constant returns (RLPItem memory subItem) {
|
function next(Iterator memory self) internal view returns (RLPItem memory subItem) {
|
||||||
if(hasNext(self)) {
|
if(hasNext(self)) {
|
||||||
uint ptr = self._unsafe_nextPtr;
|
uint ptr = self._unsafe_nextPtr;
|
||||||
uint itemLength = _itemLength(ptr);
|
uint itemLength = _itemLength(ptr);
|
||||||
@ -42,14 +42,14 @@ library RLP {
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
function next(Iterator memory self, bool strict) internal constant returns (RLPItem memory subItem) {
|
function next(Iterator memory self, bool strict) internal view returns (RLPItem memory subItem) {
|
||||||
subItem = next(self);
|
subItem = next(self);
|
||||||
if(strict && !_validate(subItem))
|
if(strict && !_validate(subItem))
|
||||||
throw;
|
throw;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasNext(Iterator memory self) internal constant returns (bool) {
|
function hasNext(Iterator memory self) internal view returns (bool) {
|
||||||
RLPItem memory item = self._unsafe_item;
|
RLPItem memory item = self._unsafe_item;
|
||||||
return self._unsafe_nextPtr < item._unsafe_memPtr + item._unsafe_length;
|
return self._unsafe_nextPtr < item._unsafe_memPtr + item._unsafe_length;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ library RLP {
|
|||||||
/// @dev Creates an RLPItem from an array of RLP encoded bytes.
|
/// @dev Creates an RLPItem from an array of RLP encoded bytes.
|
||||||
/// @param self The RLP encoded bytes.
|
/// @param self The RLP encoded bytes.
|
||||||
/// @return An RLPItem
|
/// @return An RLPItem
|
||||||
function toRLPItem(bytes memory self) internal constant returns (RLPItem memory) {
|
function toRLPItem(bytes memory self) internal view returns (RLPItem memory) {
|
||||||
uint len = self.length;
|
uint len = self.length;
|
||||||
if (len == 0) {
|
if (len == 0) {
|
||||||
return RLPItem(0, 0);
|
return RLPItem(0, 0);
|
||||||
@ -75,7 +75,7 @@ library RLP {
|
|||||||
/// @param self The RLP encoded bytes.
|
/// @param self The RLP encoded bytes.
|
||||||
/// @param strict Will throw if the data is not RLP encoded.
|
/// @param strict Will throw if the data is not RLP encoded.
|
||||||
/// @return An RLPItem
|
/// @return An RLPItem
|
||||||
function toRLPItem(bytes memory self, bool strict) internal constant returns (RLPItem memory) {
|
function toRLPItem(bytes memory self, bool strict) internal view returns (RLPItem memory) {
|
||||||
RLPItem memory item = toRLPItem(self);
|
RLPItem memory item = toRLPItem(self);
|
||||||
if(strict) {
|
if(strict) {
|
||||||
uint len = self.length;
|
uint len = self.length;
|
||||||
@ -92,14 +92,14 @@ library RLP {
|
|||||||
/// @dev Check if the RLP item is null.
|
/// @dev Check if the RLP item is null.
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return 'true' if the item is null.
|
/// @return 'true' if the item is null.
|
||||||
function isNull(RLPItem memory self) internal constant returns (bool ret) {
|
function isNull(RLPItem memory self) internal view returns (bool ret) {
|
||||||
return self._unsafe_length == 0;
|
return self._unsafe_length == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// @dev Check if the RLP item is a list.
|
/// @dev Check if the RLP item is a list.
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return 'true' if the item is a list.
|
/// @return 'true' if the item is a list.
|
||||||
function isList(RLPItem memory self) internal constant returns (bool ret) {
|
function isList(RLPItem memory self) internal view returns (bool ret) {
|
||||||
if (self._unsafe_length == 0)
|
if (self._unsafe_length == 0)
|
||||||
return false;
|
return false;
|
||||||
uint memPtr = self._unsafe_memPtr;
|
uint memPtr = self._unsafe_memPtr;
|
||||||
@ -111,7 +111,7 @@ library RLP {
|
|||||||
/// @dev Check if the RLP item is data.
|
/// @dev Check if the RLP item is data.
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return 'true' if the item is data.
|
/// @return 'true' if the item is data.
|
||||||
function isData(RLPItem memory self) internal constant returns (bool ret) {
|
function isData(RLPItem memory self) internal view returns (bool ret) {
|
||||||
if (self._unsafe_length == 0)
|
if (self._unsafe_length == 0)
|
||||||
return false;
|
return false;
|
||||||
uint memPtr = self._unsafe_memPtr;
|
uint memPtr = self._unsafe_memPtr;
|
||||||
@ -123,7 +123,7 @@ library RLP {
|
|||||||
/// @dev Check if the RLP item is empty (string or list).
|
/// @dev Check if the RLP item is empty (string or list).
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return 'true' if the item is null.
|
/// @return 'true' if the item is null.
|
||||||
function isEmpty(RLPItem memory self) internal constant returns (bool ret) {
|
function isEmpty(RLPItem memory self) internal view returns (bool ret) {
|
||||||
if(isNull(self))
|
if(isNull(self))
|
||||||
return false;
|
return false;
|
||||||
uint b0;
|
uint b0;
|
||||||
@ -137,7 +137,7 @@ library RLP {
|
|||||||
/// @dev Get the number of items in an RLP encoded list.
|
/// @dev Get the number of items in an RLP encoded list.
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return The number of items.
|
/// @return The number of items.
|
||||||
function items(RLPItem memory self) internal constant returns (uint) {
|
function items(RLPItem memory self) internal view returns (uint) {
|
||||||
if (!isList(self))
|
if (!isList(self))
|
||||||
return 0;
|
return 0;
|
||||||
uint b0;
|
uint b0;
|
||||||
@ -158,7 +158,7 @@ library RLP {
|
|||||||
/// @dev Create an iterator.
|
/// @dev Create an iterator.
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return An 'Iterator' over the item.
|
/// @return An 'Iterator' over the item.
|
||||||
function iterator(RLPItem memory self) internal constant returns (Iterator memory it) {
|
function iterator(RLPItem memory self) internal view returns (Iterator memory it) {
|
||||||
if (!isList(self))
|
if (!isList(self))
|
||||||
throw;
|
throw;
|
||||||
uint ptr = self._unsafe_memPtr + _payloadOffset(self);
|
uint ptr = self._unsafe_memPtr + _payloadOffset(self);
|
||||||
@ -169,7 +169,7 @@ library RLP {
|
|||||||
/// @dev Return the RLP encoded bytes.
|
/// @dev Return the RLP encoded bytes.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The bytes.
|
/// @return The bytes.
|
||||||
function toBytes(RLPItem memory self) internal constant returns (bytes memory bts) {
|
function toBytes(RLPItem memory self) internal returns (bytes memory bts) {
|
||||||
uint len = self._unsafe_length;
|
uint len = self._unsafe_length;
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return;
|
return;
|
||||||
@ -181,7 +181,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toData(RLPItem memory self) internal constant returns (bytes memory bts) {
|
function toData(RLPItem memory self) internal returns (bytes memory bts) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
(uint rStartPos, uint len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
@ -193,7 +193,7 @@ library RLP {
|
|||||||
/// Warning: This is inefficient, as it requires that the list is read twice.
|
/// Warning: This is inefficient, as it requires that the list is read twice.
|
||||||
/// @param self The RLP item.
|
/// @param self The RLP item.
|
||||||
/// @return Array of RLPItems.
|
/// @return Array of RLPItems.
|
||||||
function toList(RLPItem memory self) internal constant returns (RLPItem[] memory list) {
|
function toList(RLPItem memory self) internal view returns (RLPItem[] memory list) {
|
||||||
if(!isList(self))
|
if(!isList(self))
|
||||||
throw;
|
throw;
|
||||||
uint numItems = items(self);
|
uint numItems = items(self);
|
||||||
@ -210,7 +210,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toAscii(RLPItem memory self) internal constant returns (string memory str) {
|
function toAscii(RLPItem memory self) internal returns (string memory str) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
(uint rStartPos, uint len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
@ -223,7 +223,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toUint(RLPItem memory self) internal constant returns (uint data) {
|
function toUint(RLPItem memory self) internal view returns (uint data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
(uint rStartPos, uint len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
@ -238,7 +238,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toBool(RLPItem memory self) internal constant returns (bool data) {
|
function toBool(RLPItem memory self) internal view returns (bool data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
(uint rStartPos, uint len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
@ -257,7 +257,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toByte(RLPItem memory self) internal constant returns (byte data) {
|
function toByte(RLPItem memory self) internal view returns (byte data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
(uint rStartPos, uint len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
@ -274,7 +274,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toInt(RLPItem memory self) internal constant returns (int data) {
|
function toInt(RLPItem memory self) internal view returns (int data) {
|
||||||
return int(toUint(self));
|
return int(toUint(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,7 +282,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toBytes32(RLPItem memory self) internal constant returns (bytes32 data) {
|
function toBytes32(RLPItem memory self) internal view returns (bytes32 data) {
|
||||||
return bytes32(toUint(self));
|
return bytes32(toUint(self));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -290,7 +290,7 @@ library RLP {
|
|||||||
/// RLPItem is a list.
|
/// RLPItem is a list.
|
||||||
/// @param self The RLPItem.
|
/// @param self The RLPItem.
|
||||||
/// @return The decoded string.
|
/// @return The decoded string.
|
||||||
function toAddress(RLPItem memory self) internal constant returns (address data) {
|
function toAddress(RLPItem memory self) internal view returns (address data) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
(uint rStartPos, uint len) = _decode(self);
|
(uint rStartPos, uint len) = _decode(self);
|
||||||
@ -302,7 +302,7 @@ library RLP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the payload offset.
|
// Get the payload offset.
|
||||||
function _payloadOffset(RLPItem memory self) private constant returns (uint) {
|
function _payloadOffset(RLPItem memory self) private view returns (uint) {
|
||||||
if(self._unsafe_length == 0)
|
if(self._unsafe_length == 0)
|
||||||
return 0;
|
return 0;
|
||||||
uint b0;
|
uint b0;
|
||||||
@ -320,7 +320,7 @@ library RLP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get the full length of an RLP item.
|
// Get the full length of an RLP item.
|
||||||
function _itemLength(uint memPtr) private constant returns (uint len) {
|
function _itemLength(uint memPtr) private view returns (uint len) {
|
||||||
uint b0;
|
uint b0;
|
||||||
assembly {
|
assembly {
|
||||||
b0 := byte(0, mload(memPtr))
|
b0 := byte(0, mload(memPtr))
|
||||||
@ -348,7 +348,7 @@ library RLP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Get start position and length of the data.
|
// Get start position and length of the data.
|
||||||
function _decode(RLPItem memory self) private constant returns (uint memPtr, uint len) {
|
function _decode(RLPItem memory self) private view returns (uint memPtr, uint len) {
|
||||||
if(!isData(self))
|
if(!isData(self))
|
||||||
throw;
|
throw;
|
||||||
uint b0;
|
uint b0;
|
||||||
@ -376,7 +376,7 @@ library RLP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Assumes that enough memory has been allocated to store in target.
|
// Assumes that enough memory has been allocated to store in target.
|
||||||
function _copyToBytes(uint btsPtr, bytes memory tgt, uint btsLen) private constant {
|
function _copyToBytes(uint btsPtr, bytes memory tgt, uint btsLen) private {
|
||||||
// Exploiting the fact that 'tgt' was the last thing to be allocated,
|
// Exploiting the fact that 'tgt' was the last thing to be allocated,
|
||||||
// we can write entire words, and just overwrite any excess.
|
// we can write entire words, and just overwrite any excess.
|
||||||
assembly {
|
assembly {
|
||||||
@ -400,7 +400,7 @@ library RLP {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check that an RLP item is valid.
|
// Check that an RLP item is valid.
|
||||||
function _validate(RLPItem memory self) private constant returns (bool ret) {
|
function _validate(RLPItem memory self) private view returns (bool ret) {
|
||||||
// Check that RLP is well-formed.
|
// Check that RLP is well-formed.
|
||||||
uint b0;
|
uint b0;
|
||||||
uint b1;
|
uint b1;
|
||||||
|
@ -59,7 +59,7 @@ contract DayLimit {
|
|||||||
* @dev Private function to determine today's index
|
* @dev Private function to determine today's index
|
||||||
* @return uint256 of 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;
|
return now / 1 days;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,14 +18,14 @@ contract CappedCrowdsale is Crowdsale {
|
|||||||
|
|
||||||
// overriding Crowdsale#validPurchase to add extra cap logic
|
// overriding Crowdsale#validPurchase to add extra cap logic
|
||||||
// @return true if investors can buy at the moment
|
// @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;
|
bool withinCap = weiRaised.add(msg.value) <= cap;
|
||||||
return super.validPurchase() && withinCap;
|
return super.validPurchase() && withinCap;
|
||||||
}
|
}
|
||||||
|
|
||||||
// overriding Crowdsale#hasEnded to add cap logic
|
// overriding Crowdsale#hasEnded to add cap logic
|
||||||
// @return true if crowdsale event has ended
|
// @return true if crowdsale event has ended
|
||||||
function hasEnded() public constant returns (bool) {
|
function hasEnded() public view returns (bool) {
|
||||||
bool capReached = weiRaised >= cap;
|
bool capReached = weiRaised >= cap;
|
||||||
return super.hasEnded() || capReached;
|
return super.hasEnded() || capReached;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +92,7 @@ contract Crowdsale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @return true if the transaction can buy tokens
|
// @return true if the transaction can buy tokens
|
||||||
function validPurchase() internal constant returns (bool) {
|
function validPurchase() internal view returns (bool) {
|
||||||
uint256 current = block.number;
|
uint256 current = block.number;
|
||||||
bool withinPeriod = current >= startBlock && current <= endBlock;
|
bool withinPeriod = current >= startBlock && current <= endBlock;
|
||||||
bool nonZeroPurchase = msg.value != 0;
|
bool nonZeroPurchase = msg.value != 0;
|
||||||
@ -100,7 +100,7 @@ contract Crowdsale {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// @return true if crowdsale event has ended
|
// @return true if crowdsale event has ended
|
||||||
function hasEnded() public constant returns (bool) {
|
function hasEnded() public view returns (bool) {
|
||||||
return block.number > endBlock;
|
return block.number > endBlock;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ contract RefundableCrowdsale is FinalizableCrowdsale {
|
|||||||
super.finalization();
|
super.finalization();
|
||||||
}
|
}
|
||||||
|
|
||||||
function goalReached() public constant returns (bool) {
|
function goalReached() public view returns (bool) {
|
||||||
return weiRaised >= goal;
|
return weiRaised >= goal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,19 +6,19 @@ pragma solidity ^0.4.11;
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
library Math {
|
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;
|
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;
|
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;
|
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;
|
return a < b ? a : b;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -6,25 +6,25 @@ pragma solidity ^0.4.11;
|
|||||||
* @dev Math operations with safety checks that throw on error
|
* @dev Math operations with safety checks that throw on error
|
||||||
*/
|
*/
|
||||||
library SafeMath {
|
library SafeMath {
|
||||||
function mul(uint256 a, uint256 b) internal returns (uint256) {
|
function mul(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
uint256 c = a * b;
|
uint256 c = a * b;
|
||||||
assert(a == 0 || c / a == b);
|
assert(a == 0 || c / a == b);
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
function div(uint256 a, uint256 b) internal returns (uint256) {
|
function div(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
// assert(b > 0); // Solidity automatically throws when dividing by 0
|
// assert(b > 0); // Solidity automatically throws when dividing by 0
|
||||||
uint256 c = a / b;
|
uint256 c = a / b;
|
||||||
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
|
// assert(a == b * c + a % b); // There is no case in which this doesn't hold
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
function sub(uint256 a, uint256 b) internal returns (uint256) {
|
function sub(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
assert(b <= a);
|
assert(b <= a);
|
||||||
return a - b;
|
return a - b;
|
||||||
}
|
}
|
||||||
|
|
||||||
function add(uint256 a, uint256 b) internal returns (uint256) {
|
function add(uint256 a, uint256 b) internal pure returns (uint256) {
|
||||||
uint256 c = a + b;
|
uint256 c = a + b;
|
||||||
assert(c >= a);
|
assert(c >= a);
|
||||||
return c;
|
return c;
|
||||||
|
@ -96,7 +96,7 @@ contract Shareable {
|
|||||||
* @param ownerIndex uint256 The index of the owner
|
* @param ownerIndex uint256 The index of the owner
|
||||||
* @return The address of the owner
|
* @return The address of the owner
|
||||||
*/
|
*/
|
||||||
function getOwner(uint256 ownerIndex) external constant returns (address) {
|
function getOwner(uint256 ownerIndex) external view returns (address) {
|
||||||
return address(owners[ownerIndex + 1]);
|
return address(owners[ownerIndex + 1]);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -105,7 +105,7 @@ contract Shareable {
|
|||||||
* @param _addr address The address which you want to check.
|
* @param _addr address The address which you want to check.
|
||||||
* @return True if the address is an owner and fase otherwise.
|
* @return True if the address is an owner and fase otherwise.
|
||||||
*/
|
*/
|
||||||
function isOwner(address _addr) constant returns (bool) {
|
function isOwner(address _addr) view returns (bool) {
|
||||||
return ownerIndex[_addr] > 0;
|
return ownerIndex[_addr] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +115,7 @@ contract Shareable {
|
|||||||
* @param _owner The owner address.
|
* @param _owner The owner address.
|
||||||
* @return True if the owner has confirmed and false otherwise.
|
* @return True if the owner has confirmed and false otherwise.
|
||||||
*/
|
*/
|
||||||
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
|
function hasConfirmed(bytes32 _operation, address _owner) view returns (bool) {
|
||||||
PendingState memory pending = pendings[_operation];
|
PendingState memory pending = pendings[_operation];
|
||||||
uint256 index = ownerIndex[_owner];
|
uint256 index = ownerIndex[_owner];
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ contract BasicToken is ERC20Basic {
|
|||||||
* @param _owner The address to query the the balance of.
|
* @param _owner The address to query the the balance of.
|
||||||
* @return An uint256 representing the amount owned by the passed address.
|
* @return An uint256 representing the amount owned by the passed address.
|
||||||
*/
|
*/
|
||||||
function balanceOf(address _owner) constant returns (uint256 balance) {
|
function balanceOf(address _owner) view returns (uint256 balance) {
|
||||||
return balances[_owner];
|
return balances[_owner];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,7 +9,7 @@ import './ERC20Basic.sol';
|
|||||||
* @dev see https://github.com/ethereum/EIPs/issues/20
|
* @dev see https://github.com/ethereum/EIPs/issues/20
|
||||||
*/
|
*/
|
||||||
contract ERC20 is ERC20Basic {
|
contract ERC20 is ERC20Basic {
|
||||||
function allowance(address owner, address spender) constant returns (uint256);
|
function allowance(address owner, address spender) view returns (uint256);
|
||||||
function transferFrom(address from, address to, uint256 value);
|
function transferFrom(address from, address to, uint256 value);
|
||||||
function approve(address spender, uint256 value);
|
function approve(address spender, uint256 value);
|
||||||
event Approval(address indexed owner, address indexed spender, uint256 value);
|
event Approval(address indexed owner, address indexed spender, uint256 value);
|
||||||
|
@ -8,7 +8,7 @@ pragma solidity ^0.4.11;
|
|||||||
*/
|
*/
|
||||||
contract ERC20Basic {
|
contract ERC20Basic {
|
||||||
uint256 public totalSupply;
|
uint256 public totalSupply;
|
||||||
function balanceOf(address who) constant returns (uint256);
|
function balanceOf(address who) view returns (uint256);
|
||||||
function transfer(address to, uint256 value);
|
function transfer(address to, uint256 value);
|
||||||
event Transfer(address indexed from, address indexed to, uint256 value);
|
event Transfer(address indexed from, address indexed to, uint256 value);
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ import "./ERC20.sol";
|
|||||||
* LimitedTransferToken has been designed to allow for different limiting factors,
|
* LimitedTransferToken has been designed to allow for different limiting factors,
|
||||||
* this can be achieved by recursively calling super.transferableTokens() until the base class is
|
* this can be achieved by recursively calling super.transferableTokens() until the base class is
|
||||||
* hit. For example:
|
* hit. For example:
|
||||||
* function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
|
* function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
||||||
* return min256(unlockedTokens, super.transferableTokens(holder, time));
|
* return min256(unlockedTokens, super.transferableTokens(holder, time));
|
||||||
* }
|
* }
|
||||||
* A working example is VestedToken.sol:
|
* A working example is VestedToken.sol:
|
||||||
@ -51,7 +51,7 @@ contract LimitedTransferToken is ERC20 {
|
|||||||
* @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
|
* @dev Overwriting transferableTokens(address holder, uint64 time) is the way to provide the
|
||||||
* specific logic for limiting token transferability for a holder over time.
|
* specific logic for limiting token transferability for a holder over time.
|
||||||
*/
|
*/
|
||||||
function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
|
function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
||||||
return balanceOf(holder);
|
return balanceOf(holder);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ contract StandardToken is ERC20, BasicToken {
|
|||||||
* @param _spender address The address which will spend the funds.
|
* @param _spender address The address which will spend the funds.
|
||||||
* @return A uint256 specifing the amount of tokens still avaible for the spender.
|
* @return A uint256 specifing the amount of tokens still avaible for the spender.
|
||||||
*/
|
*/
|
||||||
function allowance(address _owner, address _spender) constant returns (uint256 remaining) {
|
function allowance(address _owner, address _spender) view returns (uint256 remaining) {
|
||||||
return allowed[_owner][_spender];
|
return allowed[_owner][_spender];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -106,7 +106,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @param time uint64 The specific time.
|
* @param time uint64 The specific time.
|
||||||
* @return An uint256 representing a holder's total amount of transferable tokens.
|
* @return An uint256 representing a holder's total amount of transferable tokens.
|
||||||
*/
|
*/
|
||||||
function transferableTokens(address holder, uint64 time) constant public returns (uint256) {
|
function transferableTokens(address holder, uint64 time) view public returns (uint256) {
|
||||||
uint256 grantIndex = tokenGrantsCount(holder);
|
uint256 grantIndex = tokenGrantsCount(holder);
|
||||||
|
|
||||||
if (grantIndex == 0) return balanceOf(holder); // shortcut for holder without grants
|
if (grantIndex == 0) return balanceOf(holder); // shortcut for holder without grants
|
||||||
@ -130,7 +130,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @param _holder The holder of the grants.
|
* @param _holder The holder of the grants.
|
||||||
* @return A uint256 representing the total amount of grants.
|
* @return A uint256 representing the total amount of grants.
|
||||||
*/
|
*/
|
||||||
function tokenGrantsCount(address _holder) constant returns (uint256 index) {
|
function tokenGrantsCount(address _holder) view returns (uint256 index) {
|
||||||
return grants[_holder].length;
|
return grants[_holder].length;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -163,7 +163,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
uint256 time,
|
uint256 time,
|
||||||
uint256 start,
|
uint256 start,
|
||||||
uint256 cliff,
|
uint256 cliff,
|
||||||
uint256 vesting) constant returns (uint256)
|
uint256 vesting) view returns (uint256)
|
||||||
{
|
{
|
||||||
// Shortcuts for before cliff and after vesting cases.
|
// Shortcuts for before cliff and after vesting cases.
|
||||||
if (time < cliff) return 0;
|
if (time < cliff) return 0;
|
||||||
@ -192,7 +192,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @return Returns all the values that represent a TokenGrant(address, value, start, cliff,
|
* @return Returns all the values that represent a TokenGrant(address, value, start, cliff,
|
||||||
* revokability, burnsOnRevoke, and vesting) plus the vested value at the current time.
|
* revokability, burnsOnRevoke, and vesting) plus the vested value at the current time.
|
||||||
*/
|
*/
|
||||||
function tokenGrant(address _holder, uint256 _grantId) constant returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) {
|
function tokenGrant(address _holder, uint256 _grantId) view returns (address granter, uint256 value, uint256 vested, uint64 start, uint64 cliff, uint64 vesting, bool revokable, bool burnsOnRevoke) {
|
||||||
TokenGrant grant = grants[_holder][_grantId];
|
TokenGrant grant = grants[_holder][_grantId];
|
||||||
|
|
||||||
granter = grant.granter;
|
granter = grant.granter;
|
||||||
@ -212,7 +212,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @param time The time to be checked
|
* @param time The time to be checked
|
||||||
* @return An uint256 representing the amount of vested tokens of a specific grant at a specific time.
|
* @return An uint256 representing the amount of vested tokens of a specific grant at a specific time.
|
||||||
*/
|
*/
|
||||||
function vestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
|
function vestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) {
|
||||||
return calculateVestedTokens(
|
return calculateVestedTokens(
|
||||||
grant.value,
|
grant.value,
|
||||||
uint256(time),
|
uint256(time),
|
||||||
@ -229,7 +229,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @return An uint256 representing the amount of non vested tokens of a specifc grant on the
|
* @return An uint256 representing the amount of non vested tokens of a specifc grant on the
|
||||||
* passed time frame.
|
* passed time frame.
|
||||||
*/
|
*/
|
||||||
function nonVestedTokens(TokenGrant grant, uint64 time) private constant returns (uint256) {
|
function nonVestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) {
|
||||||
return grant.value.sub(vestedTokens(grant, time));
|
return grant.value.sub(vestedTokens(grant, time));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +238,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
|
|||||||
* @param holder address The address of the holder
|
* @param holder address The address of the holder
|
||||||
* @return An uint256 representing the date of the last transferable tokens.
|
* @return An uint256 representing the date of the last transferable tokens.
|
||||||
*/
|
*/
|
||||||
function lastTokenIsTransferableDate(address holder) constant public returns (uint64 date) {
|
function lastTokenIsTransferableDate(address holder) view public returns (uint64 date) {
|
||||||
date = uint64(now);
|
date = uint64(now);
|
||||||
uint256 grantIndex = grants[holder].length;
|
uint256 grantIndex = grants[holder].length;
|
||||||
for (uint256 i = 0; i < grantIndex; i++) {
|
for (uint256 i = 0; i < grantIndex; i++) {
|
||||||
|
@ -43,20 +43,20 @@ static char const* registrarCode = R"DELIMITER(
|
|||||||
pragma solidity ^0.4.0;
|
pragma solidity ^0.4.0;
|
||||||
|
|
||||||
contract NameRegister {
|
contract NameRegister {
|
||||||
function addr(string _name) constant returns (address o_owner);
|
function addr(string _name) view returns (address o_owner);
|
||||||
function name(address _owner) constant returns (string o_name);
|
function name(address _owner) view returns (string o_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
contract Registrar is NameRegister {
|
contract Registrar is NameRegister {
|
||||||
event Changed(string indexed name);
|
event Changed(string indexed name);
|
||||||
event PrimaryChanged(string indexed name, address indexed addr);
|
event PrimaryChanged(string indexed name, address indexed addr);
|
||||||
|
|
||||||
function owner(string _name) constant returns (address o_owner);
|
function owner(string _name) view returns (address o_owner);
|
||||||
function addr(string _name) constant returns (address o_address);
|
function addr(string _name) view returns (address o_address);
|
||||||
function subRegistrar(string _name) constant returns (address o_subRegistrar);
|
function subRegistrar(string _name) view returns (address o_subRegistrar);
|
||||||
function content(string _name) constant returns (bytes32 o_content);
|
function content(string _name) view returns (bytes32 o_content);
|
||||||
|
|
||||||
function name(address _owner) constant returns (string o_name);
|
function name(address _owner) view returns (string o_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
contract AuctionSystem {
|
contract AuctionSystem {
|
||||||
@ -201,11 +201,11 @@ contract GlobalRegistrar is Registrar, AuctionSystem {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function owner(string _name) constant returns (address) { return m_toRecord[_name].owner; }
|
function owner(string _name) view returns (address) { return m_toRecord[_name].owner; }
|
||||||
function addr(string _name) constant returns (address) { return m_toRecord[_name].primary; }
|
function addr(string _name) view returns (address) { return m_toRecord[_name].primary; }
|
||||||
function subRegistrar(string _name) constant returns (address) { return m_toRecord[_name].subRegistrar; }
|
function subRegistrar(string _name) view returns (address) { return m_toRecord[_name].subRegistrar; }
|
||||||
function content(string _name) constant returns (bytes32) { return m_toRecord[_name].content; }
|
function content(string _name) view returns (bytes32) { return m_toRecord[_name].content; }
|
||||||
function name(address _addr) constant returns (string o_name) { return m_toName[_addr]; }
|
function name(address _addr) view returns (string o_name) { return m_toName[_addr]; }
|
||||||
|
|
||||||
mapping (address => string) m_toName;
|
mapping (address => string) m_toName;
|
||||||
mapping (string => Record) m_toRecord;
|
mapping (string => Record) m_toRecord;
|
||||||
|
@ -58,10 +58,10 @@ pragma solidity ^0.4.0;
|
|||||||
contract Registrar {
|
contract Registrar {
|
||||||
event Changed(string indexed name);
|
event Changed(string indexed name);
|
||||||
|
|
||||||
function owner(string _name) constant returns (address o_owner);
|
function owner(string _name) view returns (address o_owner);
|
||||||
function addr(string _name) constant returns (address o_address);
|
function addr(string _name) view returns (address o_address);
|
||||||
function subRegistrar(string _name) constant returns (address o_subRegistrar);
|
function subRegistrar(string _name) view returns (address o_subRegistrar);
|
||||||
function content(string _name) constant returns (bytes32 o_content);
|
function content(string _name) view returns (bytes32 o_content);
|
||||||
}
|
}
|
||||||
|
|
||||||
contract FixedFeeRegistrar is Registrar {
|
contract FixedFeeRegistrar is Registrar {
|
||||||
@ -104,20 +104,20 @@ contract FixedFeeRegistrar is Registrar {
|
|||||||
emit Changed(_name);
|
emit Changed(_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
function record(string _name) constant returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) {
|
function record(string _name) view returns (address o_addr, address o_subRegistrar, bytes32 o_content, address o_owner) {
|
||||||
Record rec = m_record(_name);
|
Record rec = m_record(_name);
|
||||||
o_addr = rec.addr;
|
o_addr = rec.addr;
|
||||||
o_subRegistrar = rec.subRegistrar;
|
o_subRegistrar = rec.subRegistrar;
|
||||||
o_content = rec.content;
|
o_content = rec.content;
|
||||||
o_owner = rec.owner;
|
o_owner = rec.owner;
|
||||||
}
|
}
|
||||||
function addr(string _name) constant returns (address) { return m_record(_name).addr; }
|
function addr(string _name) view returns (address) { return m_record(_name).addr; }
|
||||||
function subRegistrar(string _name) constant returns (address) { return m_record(_name).subRegistrar; }
|
function subRegistrar(string _name) view returns (address) { return m_record(_name).subRegistrar; }
|
||||||
function content(string _name) constant returns (bytes32) { return m_record(_name).content; }
|
function content(string _name) view returns (bytes32) { return m_record(_name).content; }
|
||||||
function owner(string _name) constant returns (address) { return m_record(_name).owner; }
|
function owner(string _name) view returns (address) { return m_record(_name).owner; }
|
||||||
|
|
||||||
Record[2**253] m_recordData;
|
Record[2**253] m_recordData;
|
||||||
function m_record(string _name) constant internal returns (Record storage o_record) {
|
function m_record(string _name) view internal returns (Record storage o_record) {
|
||||||
return m_recordData[uint(keccak256(bytes(_name))) / 8];
|
return m_recordData[uint(keccak256(bytes(_name))) / 8];
|
||||||
}
|
}
|
||||||
uint constant c_fee = 69 ether;
|
uint constant c_fee = 69 ether;
|
||||||
|
@ -177,7 +177,7 @@ contract multiowned {
|
|||||||
return m_ownerIndex[uint(_addr)] > 0;
|
return m_ownerIndex[uint(_addr)] > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function hasConfirmed(bytes32 _operation, address _owner) constant returns (bool) {
|
function hasConfirmed(bytes32 _operation, address _owner) view returns (bool) {
|
||||||
PendingState pending = m_pending[_operation];
|
PendingState pending = m_pending[_operation];
|
||||||
uint ownerIndex = m_ownerIndex[uint(_owner)];
|
uint ownerIndex = m_ownerIndex[uint(_owner)];
|
||||||
|
|
||||||
@ -319,7 +319,7 @@ contract daylimit is multiowned {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// determines today's index.
|
// determines today's index.
|
||||||
function today() private constant returns (uint) { return now / 1 days; }
|
function today() private view returns (uint) { return now / 1 days; }
|
||||||
|
|
||||||
// FIELDS
|
// FIELDS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user