Fix test contract modifiers

pull/754/head
Dominik Muhs 6 years ago
parent fc132c7a30
commit d226755ae9
  1. 2
      tests/testdata/input_contracts/ether_send.sol
  2. 16
      tests/testdata/input_contracts/exceptions.sol
  3. 2
      tests/testdata/input_contracts/kinds_of_calls.sol
  4. 2
      tests/testdata/input_contracts/overflow.sol
  5. 16
      tests/testdata/input_contracts/rubixi.sol
  6. 2
      tests/testdata/input_contracts/underflow.sol

@ -27,7 +27,7 @@ contract Crowdfunding {
balances[msg.sender] += msg.value;
}
function getBalance() public returns (uint) {
function getBalance() public view returns (uint) {
return balances[msg.sender];
}

@ -5,39 +5,39 @@ contract Exceptions {
uint256[8] myarray;
function assert1() public {
function assert1() public pure {
uint256 i = 1;
assert(i == 0);
}
function assert2() public {
function assert2() public pure {
uint256 i = 1;
assert(i > 0);
}
function assert3(uint256 input) public {
function assert3(uint256 input) public pure {
assert(input != 23);
}
function requireisfine(uint256 input) public {
function requireisfine(uint256 input) public pure {
require(input != 23);
}
function divisionby0(uint256 input) public {
function divisionby0(uint256 input) public pure {
uint256 i = 1/input;
}
function thisisfine(uint256 input) public {
function thisisfine(uint256 input) public pure {
if (input > 0) {
uint256 i = 1/input;
}
}
function arrayaccess(uint256 index) public {
function arrayaccess(uint256 index) public view {
uint256 i = myarray[index];
}
function thisisalsofind(uint256 index) public {
function thisisalsofind(uint256 index) public view {
if (index < 8) {
uint256 i = myarray[index];
}

@ -9,7 +9,7 @@ contract D {
_e.call(abi.encode(bytes4(keccak256("setN(uint256)")), _n));
}
function callcodeSetN(address _e, uint _n) public {
function callcodeSetN(address _e, uint _n) public view {
_e.staticcall(abi.encode(bytes4(keccak256("setN(uint256)")), _n));
}

@ -17,7 +17,7 @@ contract Over {
return true;
}
function balanceOf(address _owner) public returns (uint balance) {
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
}

@ -73,38 +73,38 @@ contract Rubixi {
}
//Functions to provide information to end-user using JSON interface or other interfaces
function currentMultiplier() public returns (uint multiplier, string memory info) {
function currentMultiplier() public view returns (uint multiplier, string memory info) {
multiplier = pyramidMultiplier;
info = "This multiplier applies to you as soon as transaction is received, may be lowered to hasten payouts or increased if payouts are fast enough. Due to no float or decimals, multiplier is x100 for a fractional multiplier e.g. 250 is actually a 2.5x multiplier. Capped at 3x max and 1.2x min.";
}
function currentFeePercentage() public returns (uint fee, string memory info) {
function currentFeePercentage() public view returns (uint fee, string memory info) {
fee = feePercent;
info = "Shown in % form. Fee is halved(50%) for amounts equal or greater than 50 ethers. (Fee may change, but is capped to a maximum of 10%)";
}
function currentPyramidBalanceApproximately() public returns (uint pyramidBalance, string memory info) {
function currentPyramidBalanceApproximately() public view returns (uint pyramidBalance, string memory info) {
pyramidBalance = balance / 1 ether;
info = "All balance values are measured in Ethers, note that due to no decimal placing, these values show up as integers only, within the contract itself you will get the exact decimal value you are supposed to";
}
function nextPayoutWhenPyramidBalanceTotalsApproximately() public returns (uint balancePayout) {
function nextPayoutWhenPyramidBalanceTotalsApproximately() public view returns (uint balancePayout) {
balancePayout = participants[payoutOrder].payout / 1 ether;
}
function feesSeperateFromBalanceApproximately() public returns (uint fees) {
function feesSeperateFromBalanceApproximately() public view returns (uint fees) {
fees = collectedFees / 1 ether;
}
function totalParticipants() public returns (uint count) {
function totalParticipants() public view returns (uint count) {
count = participants.length;
}
function numberOfParticipantsWaitingForPayout() public returns (uint count) {
function numberOfParticipantsWaitingForPayout() public view returns (uint count) {
count = participants.length - payoutOrder;
}
function participantDetails(uint orderInPyramid) public returns (address addr, uint payout) {
function participantDetails(uint orderInPyramid) public view returns (address addr, uint payout) {
if (orderInPyramid <= participants.length) {
addr = participants[orderInPyramid].etherAddress;
payout = participants[orderInPyramid].payout / 1 ether;

@ -17,7 +17,7 @@ contract Under {
return true;
}
function balanceOf(address _owner) public returns (uint balance) {
function balanceOf(address _owner) public view returns (uint balance) {
return balances[_owner];
}
}
Loading…
Cancel
Save