diff options
Diffstat (limited to 'test/compilationTests/gnosis')
17 files changed, 57 insertions, 53 deletions
diff --git a/test/compilationTests/gnosis/Events/CategoricalEvent.sol b/test/compilationTests/gnosis/Events/CategoricalEvent.sol index 0f5196e8..4815e315 100644 --- a/test/compilationTests/gnosis/Events/CategoricalEvent.sol +++ b/test/compilationTests/gnosis/Events/CategoricalEvent.sol @@ -45,7 +45,7 @@ contract CategoricalEvent is Event { /// @return Event hash function getEventHash() public - constant + view returns (bytes32) { return keccak256(abi.encodePacked(collateralToken, oracle, outcomeTokens.length)); diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol index a6edb778..177f61df 100644 --- a/test/compilationTests/gnosis/Events/Event.sol +++ b/test/compilationTests/gnosis/Events/Event.sol @@ -90,7 +90,7 @@ contract Event { /// @return Outcome count function getOutcomeCount() public - constant + view returns (uint8) { return uint8(outcomeTokens.length); @@ -100,7 +100,7 @@ contract Event { /// @return Outcome tokens function getOutcomeTokens() public - constant + view returns (OutcomeToken[]) { return outcomeTokens; @@ -110,7 +110,7 @@ contract Event { /// @return Outcome token distribution function getOutcomeTokenDistribution(address owner) public - constant + view returns (uint[] outcomeTokenDistribution) { outcomeTokenDistribution = new uint[](outcomeTokens.length); @@ -120,7 +120,7 @@ contract Event { /// @dev Calculates and returns 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 /// @return Sender's winnings diff --git a/test/compilationTests/gnosis/Events/ScalarEvent.sol b/test/compilationTests/gnosis/Events/ScalarEvent.sol index d5cbef14..832c2ab1 100644 --- a/test/compilationTests/gnosis/Events/ScalarEvent.sol +++ b/test/compilationTests/gnosis/Events/ScalarEvent.sol @@ -79,7 +79,7 @@ contract ScalarEvent is Event { /// @return Event hash function getEventHash() public - constant + view returns (bytes32) { return keccak256(abi.encodePacked(collateralToken, oracle, lowerBound, upperBound)); diff --git a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol index 344dd8d2..cf4fcd7d 100644 --- a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol +++ b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol @@ -24,7 +24,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Cost function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public - constant + view returns (uint cost) { require(market.eventContract().getOutcomeCount() > 1); @@ -59,7 +59,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Profit function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public - constant + view returns (uint profit) { require(market.eventContract().getOutcomeCount() > 1); @@ -85,7 +85,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Marginal price of an outcome as a fixed point number function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public - constant + view returns (uint price) { require(market.eventContract().getOutcomeCount() > 1); @@ -110,7 +110,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Cost level function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding) private - constant + view returns(int costLevel) { // 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 function sumExpOffset(int logN, int[] netOutcomeTokensSold, uint funding, uint8 outcomeIndex) private - constant + view returns (uint sum, int offset, uint outcomeExpTerm) { // Naive calculation of this causes an overflow @@ -170,7 +170,7 @@ contract LMSRMarketMaker is MarketMaker { /// @return Net outcome tokens sold by market function getNetOutcomeTokensSold(Market market) private - constant + view returns (int[] quantities) { quantities = new int[](market.eventContract().getOutcomeCount()); diff --git a/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol b/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol index 3162ce64..ef5942cd 100644 --- a/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol +++ b/test/compilationTests/gnosis/MarketMakers/MarketMaker.sol @@ -8,7 +8,7 @@ contract MarketMaker { /* * Public functions */ - function calcCost(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint); - function calcProfit(Market market, uint8 outcomeTokenIndex, uint outcomeTokenCount) public constant returns (uint); - function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) 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 view returns (uint); + function calcMarginalPrice(Market market, uint8 outcomeTokenIndex) public view returns (uint); } diff --git a/test/compilationTests/gnosis/Markets/Market.sol b/test/compilationTests/gnosis/Markets/Market.sol index 635b14db..7bcecfe5 100644 --- a/test/compilationTests/gnosis/Markets/Market.sol +++ b/test/compilationTests/gnosis/Markets/Market.sol @@ -43,5 +43,5 @@ contract Market { function buy(uint8 outcomeTokenIndex, uint outcomeTokenCount, uint maxCost) 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 calcMarketFee(uint outcomeTokenCost) public constant returns (uint); + function calcMarketFee(uint outcomeTokenCost) public view returns (uint); } diff --git a/test/compilationTests/gnosis/Markets/StandardMarket.sol b/test/compilationTests/gnosis/Markets/StandardMarket.sol index 84f30386..0a9f77db 100644 --- a/test/compilationTests/gnosis/Markets/StandardMarket.sol +++ b/test/compilationTests/gnosis/Markets/StandardMarket.sol @@ -186,7 +186,7 @@ contract StandardMarket is Market { /// @return Fee for trade function calcMarketFee(uint outcomeTokenCost) public - constant + view returns (uint) { return outcomeTokenCost * fee / FEE_RANGE; diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol index 362c514c..de182a61 100644 --- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol +++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol @@ -72,7 +72,7 @@ contract CentralizedOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isSet; @@ -82,7 +82,7 @@ contract CentralizedOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return outcome; diff --git a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol index 94fc70ca..3d801da1 100644 --- a/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/DifficultyOracle.sol @@ -44,7 +44,7 @@ contract DifficultyOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { // Difficulty is always bigger than 0 @@ -55,7 +55,7 @@ contract DifficultyOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return int(difficulty); diff --git a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol index 7105f247..cf851f5b 100644 --- a/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol +++ b/test/compilationTests/gnosis/Oracles/FutarchyOracle.sol @@ -151,7 +151,7 @@ contract FutarchyOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isSet; @@ -161,7 +161,7 @@ contract FutarchyOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return int(winningMarketIndex); diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol index 24cf9dea..d8097370 100644 --- a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol +++ b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol @@ -32,6 +32,7 @@ contract MajorityOracle is Oracle { /// @return Outcome function getStatusAndOutcome() public + view returns (bool outcomeSet, int outcome) { uint i; @@ -69,7 +70,7 @@ contract MajorityOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { (bool outcomeSet, ) = getStatusAndOutcome(); @@ -80,7 +81,7 @@ contract MajorityOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { (, int winningOutcome) = getStatusAndOutcome(); diff --git a/test/compilationTests/gnosis/Oracles/Oracle.sol b/test/compilationTests/gnosis/Oracles/Oracle.sol index cf96eb9f..450aff00 100644 --- a/test/compilationTests/gnosis/Oracles/Oracle.sol +++ b/test/compilationTests/gnosis/Oracles/Oracle.sol @@ -4,6 +4,6 @@ pragma solidity ^0.4.11; /// @title Abstract oracle contract - Functions to be implemented by oracles contract Oracle { - function isOutcomeSet() public constant returns (bool); - function getOutcome() public constant returns (int); + function isOutcomeSet() public view returns (bool); + function getOutcome() public view returns (int); } diff --git a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol index 121824ff..284f420e 100644 --- a/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol +++ b/test/compilationTests/gnosis/Oracles/SignedMessageOracle.sol @@ -84,7 +84,7 @@ contract SignedMessageOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isSet; @@ -94,7 +94,7 @@ contract SignedMessageOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { return outcome; diff --git a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol index dd66c9ab..b7cc231c 100644 --- a/test/compilationTests/gnosis/Oracles/UltimateOracle.sol +++ b/test/compilationTests/gnosis/Oracles/UltimateOracle.sol @@ -144,6 +144,7 @@ contract UltimateOracle is Oracle { /// @return Is challenge period over? function isChallengePeriodOver() public + view returns (bool) { return forwardedOutcomeSetTimestamp != 0 && now.sub(forwardedOutcomeSetTimestamp) > challengePeriod; @@ -153,6 +154,7 @@ contract UltimateOracle is Oracle { /// @return Is front runner period over? function isFrontRunnerPeriodOver() public + view returns (bool) { return frontRunnerSetTimestamp != 0 && now.sub(frontRunnerSetTimestamp) > frontRunnerPeriod; @@ -162,6 +164,7 @@ contract UltimateOracle is Oracle { /// @return Is challenged? function isChallenged() public + view returns (bool) { return frontRunnerSetTimestamp != 0; @@ -171,7 +174,7 @@ contract UltimateOracle is Oracle { /// @return Is outcome set? function isOutcomeSet() public - constant + view returns (bool) { return isChallengePeriodOver() && !isChallenged() @@ -182,7 +185,7 @@ contract UltimateOracle is Oracle { /// @return Outcome function getOutcome() public - constant + view returns (int) { if (isFrontRunnerPeriodOver()) diff --git a/test/compilationTests/gnosis/Tokens/StandardToken.sol b/test/compilationTests/gnosis/Tokens/StandardToken.sol index b7d0d37a..5fb20210 100644 --- a/test/compilationTests/gnosis/Tokens/StandardToken.sol +++ b/test/compilationTests/gnosis/Tokens/StandardToken.sol @@ -73,7 +73,7 @@ contract StandardToken is Token { /// @return Remaining allowance for spender function allowance(address owner, address spender) public - constant + view returns (uint) { return allowances[owner][spender]; @@ -84,7 +84,7 @@ contract StandardToken is Token { /// @return Balance of owner function balanceOf(address owner) public - constant + view returns (uint) { return balances[owner]; @@ -94,7 +94,7 @@ contract StandardToken is Token { /// @return Total supply function totalSupply() public - constant + view returns (uint) { return totalTokens; diff --git a/test/compilationTests/gnosis/Tokens/Token.sol b/test/compilationTests/gnosis/Tokens/Token.sol index 19bb618b..70ecdff7 100644 --- a/test/compilationTests/gnosis/Tokens/Token.sol +++ b/test/compilationTests/gnosis/Tokens/Token.sol @@ -17,7 +17,7 @@ contract Token { function transfer(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 balanceOf(address owner) public constant returns (uint); - function allowance(address owner, address spender) public constant returns (uint); - function totalSupply() public constant returns (uint); + function balanceOf(address owner) public view returns (uint); + function allowance(address owner, address spender) public view returns (uint); + function totalSupply() public view returns (uint); } diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol index 95d95346..93456c33 100644 --- a/test/compilationTests/gnosis/Utils/Math.sol +++ b/test/compilationTests/gnosis/Utils/Math.sol @@ -22,7 +22,7 @@ library Math { /// @return e**x function exp(int x) public - constant + pure returns (uint) { // revert if x is > MAX_POWER, where @@ -107,7 +107,7 @@ library Math { /// @return ln(x) function ln(uint x) public - constant + pure returns (int) { require(x > 0); @@ -157,7 +157,7 @@ library Math { /// @return logarithmic value function floorLog2(uint x) public - constant + pure returns (int lo) { lo = -64; @@ -178,7 +178,7 @@ library Math { /// @return Maximum number function max(int[] nums) public - constant + pure returns (int max) { require(nums.length > 0); @@ -194,7 +194,7 @@ library Math { /// @return Did no overflow occur? function safeToAdd(uint a, uint b) public - constant + pure returns (bool) { return a + b >= a; @@ -206,7 +206,7 @@ library Math { /// @return Did no underflow occur? function safeToSub(uint a, uint b) public - constant + pure returns (bool) { return a >= b; @@ -218,7 +218,7 @@ library Math { /// @return Did no overflow occur? function safeToMul(uint a, uint b) public - constant + pure returns (bool) { return b == 0 || a * b / b == a; @@ -230,7 +230,7 @@ library Math { /// @return Sum function add(uint a, uint b) public - constant + pure returns (uint) { require(safeToAdd(a, b)); @@ -243,7 +243,7 @@ library Math { /// @return Difference function sub(uint a, uint b) public - constant + pure returns (uint) { require(safeToSub(a, b)); @@ -256,7 +256,7 @@ library Math { /// @return Product function mul(uint a, uint b) public - constant + pure returns (uint) { require(safeToMul(a, b)); @@ -269,7 +269,7 @@ library Math { /// @return Did no overflow occur? function safeToAdd(int a, int b) public - constant + pure returns (bool) { return (b >= 0 && a + b >= a) || (b < 0 && a + b < a); @@ -281,7 +281,7 @@ library Math { /// @return Did no underflow occur? function safeToSub(int a, int b) public - constant + pure returns (bool) { return (b >= 0 && a - b <= a) || (b < 0 && a - b > a); @@ -293,7 +293,7 @@ library Math { /// @return Did no overflow occur? function safeToMul(int a, int b) public - constant + pure returns (bool) { return (b == 0) || (a * b / b == a); @@ -305,7 +305,7 @@ library Math { /// @return Sum function add(int a, int b) public - constant + pure returns (int) { require(safeToAdd(a, b)); @@ -318,7 +318,7 @@ library Math { /// @return Difference function sub(int a, int b) public - constant + pure returns (int) { require(safeToSub(a, b)); @@ -331,7 +331,7 @@ library Math { /// @return Product function mul(int a, int b) public - constant + pure returns (int) { require(safeToMul(a, b)); |