Commit df2fa668 authored by aniket-engg's avatar aniket-engg

contracts updated

parent 0b59cf9d
'use strict' 'use strict'
const storage = `pragma solidity >=0.4.22 <0.7.0; const storage = `pragma solidity >=0.4.22 <0.8.0;
/** /**
* @title Storage * @title Storage
...@@ -27,7 +27,7 @@ contract Storage { ...@@ -27,7 +27,7 @@ contract Storage {
} }
}` }`
const owner = `pragma solidity >=0.4.22 <0.7.0; const owner = `pragma solidity >=0.4.22 <0.8.0;
/** /**
* @title Owner * @title Owner
...@@ -54,7 +54,7 @@ contract Owner { ...@@ -54,7 +54,7 @@ contract Owner {
/** /**
* @dev Set contract deployer as owner * @dev Set contract deployer as owner
*/ */
constructor() public { constructor() {
owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor owner = msg.sender; // 'msg.sender' is sender of current call, contract deployer for a constructor
emit OwnerSet(address(0), owner); emit OwnerSet(address(0), owner);
} }
...@@ -77,7 +77,7 @@ contract Owner { ...@@ -77,7 +77,7 @@ contract Owner {
} }
}` }`
const ballot = `pragma solidity >=0.4.22 <0.7.0; const ballot = `pragma solidity >=0.4.22 <0.8.0;
/** /**
* @title Ballot * @title Ballot
...@@ -109,7 +109,7 @@ contract Ballot { ...@@ -109,7 +109,7 @@ contract Ballot {
* @dev Create a new ballot to choose one of 'proposalNames'. * @dev Create a new ballot to choose one of 'proposalNames'.
* @param proposalNames names of proposals * @param proposalNames names of proposals
*/ */
constructor(bytes32[] memory proposalNames) public { constructor(bytes32[] memory proposalNames) {
chairperson = msg.sender; chairperson = msg.sender;
voters[chairperson].weight = 1; voters[chairperson].weight = 1;
...@@ -215,7 +215,7 @@ contract Ballot { ...@@ -215,7 +215,7 @@ contract Ballot {
} }
` `
const ballot_0_4_11 = `pragma solidity >=0.4.10 <0.7.0; const ballot_0_4_11 = `pragma solidity >=0.4.10 <0.8.0;
contract Ballot { contract Ballot {
struct Voter { struct Voter {
...@@ -281,7 +281,7 @@ contract Ballot { ...@@ -281,7 +281,7 @@ contract Ballot {
} }
}` }`
const ballotTest = `pragma solidity >=0.4.22 <0.7.0; const ballotTest = `pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
import "../3_Ballot.sol"; import "../3_Ballot.sol";
......
...@@ -178,7 +178,7 @@ const sources = [ ...@@ -178,7 +178,7 @@ const sources = [
{ {
'browser/blah.sol': { 'browser/blah.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.4.22 <0.8.0;
contract Kickstarter { contract Kickstarter {
...@@ -193,7 +193,7 @@ const sources = [ ...@@ -193,7 +193,7 @@ const sources = [
Project[] public projects; Project[] public projects;
constructor() public { constructor() {
} }
...@@ -236,7 +236,7 @@ const sources = [ ...@@ -236,7 +236,7 @@ const sources = [
{ {
'browser/locals.sol': { 'browser/locals.sol': {
content: ` content: `
pragma solidity ^0.6.0; pragma solidity ^0.7.0;
contract test { contract test {
function t () public { function t () public {
uint[] memory array = new uint[](150); uint[] memory array = new uint[](150);
......
...@@ -55,7 +55,7 @@ module.exports = { ...@@ -55,7 +55,7 @@ module.exports = {
const sources = [ const sources = [
{ {
'browser/signMassage.sol': {content: ` 'browser/signMassage.sol': {content: `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
contract SignMassageTest { contract SignMassageTest {
function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) { function testRecovery(bytes32 h, uint8 v, bytes32 r, bytes32 s) public pure returns (address) {
return ecrecover(h, v, r, s); return ecrecover(h, v, r, s);
......
...@@ -172,7 +172,7 @@ function runTests (browser: NightwatchBrowser) { ...@@ -172,7 +172,7 @@ function runTests (browser: NightwatchBrowser) {
.pause(500) .pause(500)
.scrollAndClick('#runTestsTabRunAction') .scrollAndClick('#runTestsTabRunAction')
.waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000) .waitForElementPresent('*[data-id="testTabSolidityUnitTestsOutputheader"]', 40000)
.waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 7000) .waitForElementPresent('#solidityUnittestsOutput div[class^="testPass"]', 10000)
.assert.containsText('#solidityUnittestsOutput', 'browser/tests/4_Ballot_test.sol') .assert.containsText('#solidityUnittestsOutput', 'browser/tests/4_Ballot_test.sol')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal') .assert.containsText('#solidityUnittestsOutput', '✓ Check winning proposal')
.assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value') .assert.containsText('#solidityUnittestsOutput', '✓ Check winnin proposal with return value')
...@@ -183,12 +183,12 @@ const sources = [ ...@@ -183,12 +183,12 @@ const sources = [
{ {
'browser/simple_storage.sol': { 'browser/simple_storage.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
contract SimpleStorage { contract SimpleStorage {
uint public storedData; uint public storedData;
constructor() public { constructor() {
storedData = 100; storedData = 100;
} }
...@@ -204,7 +204,7 @@ const sources = [ ...@@ -204,7 +204,7 @@ const sources = [
}, },
'browser/tests/simple_storage_test.sol': { 'browser/tests/simple_storage_test.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; import "remix_tests.sol";
import "../simple_storage.sol"; import "../simple_storage.sol";
...@@ -233,7 +233,7 @@ const sources = [ ...@@ -233,7 +233,7 @@ const sources = [
}, },
'browser/ks2a.sol': { 'browser/ks2a.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.4.22 <0.8.0;
contract Kickstarter { contract Kickstarter {
enum State { Started, Completed } enum State { Started, Completed }
...@@ -246,14 +246,14 @@ const sources = [ ...@@ -246,14 +246,14 @@ const sources = [
State state; State state;
mapping(address => uint) funders; // added mapping(address => uint) funders; // added
} }
uint numProjects;
Project[] public projects; Project[] public projects;
constructor() public { constructor() {
} }
function createProject(string memory name, uint goal) public { function createProject(string memory name, uint goal) public {
projects.length++; // new line projects.push(); // new line
Project storage project = projects[projects.length - 1]; Project storage project = projects[projects.length - 1];
project.name = name; project.name = name;
project.goal = goal; project.goal = goal;
...@@ -287,7 +287,7 @@ const sources = [ ...@@ -287,7 +287,7 @@ const sources = [
}, },
'browser/tests/ks2b_test.sol': { 'browser/tests/ks2b_test.sol': {
content: ` content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.4.22 <0.8.0;
pragma experimental ABIEncoderV2; pragma experimental ABIEncoderV2;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
...@@ -336,7 +336,7 @@ const sources = [ ...@@ -336,7 +336,7 @@ const sources = [
} }
function checkProjectIsFundable () public { function checkProjectIsFundable () public {
kickstarter.fundProject.value(120000)(0); kickstarter.fundProject{value:120000}(0);
(address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0); (address owner, string memory name, uint goal, uint fundsAvailable, uint amountContributed, Kickstarter.State state) = kickstarter.projects(0);
Assert.equal(amountContributed, 120000, "contributed amount is incorrect"); Assert.equal(amountContributed, 120000, "contributed amount is incorrect");
} }
...@@ -357,10 +357,10 @@ const sources = [ ...@@ -357,10 +357,10 @@ const sources = [
}, },
'browser/tests/deployError_test.sol': { 'browser/tests/deployError_test.sol': {
content: ` content: `
pragma solidity ^0.6.0; pragma solidity ^0.8.0;
contract failingDeploy { contract failingDeploy {
constructor() public { constructor() {
revert('Deploy Failed'); revert('Deploy Failed');
} }
} }
...@@ -368,7 +368,7 @@ const sources = [ ...@@ -368,7 +368,7 @@ const sources = [
}, },
'browser/tests/methodFailure_test.sol': { 'browser/tests/methodFailure_test.sol': {
content: ` content: `
pragma solidity ^0.6.0; pragma solidity ^0.8.0;
contract methodfailure { contract methodfailure {
function add(uint a, uint b) public { function add(uint a, uint b) public {
......
...@@ -6,7 +6,7 @@ import sauce from './sauce' ...@@ -6,7 +6,7 @@ import sauce from './sauce'
const sources = [ const sources = [
{ {
'browser/Untitled.sol': {content: ` 'browser/Untitled.sol': {content: `
pragma solidity >=0.4.22 <0.6.0; pragma solidity >=0.4.22 <0.8.0;
contract test1 { address test = tx.origin; } contract test1 { address test = tx.origin; }
contract test2 {} contract test2 {}
contract TooMuchGas { contract TooMuchGas {
......
...@@ -5,14 +5,14 @@ import sauce from './sauce' ...@@ -5,14 +5,14 @@ import sauce from './sauce'
const sources = [ const sources = [
{'browser/basic.sol': { content: {'browser/basic.sol': { content:
`pragma solidity >=0.2.0 <0.7.0; `pragma solidity >=0.2.0 <0.8.0;
/** /**
* @title Basic contract * @title Basic contract
*/ */
contract Basic { contract Basic {
uint someVar; uint someVar;
constructor() public {} constructor() {}
}` }`
}} }}
] ]
......
...@@ -63,7 +63,7 @@ class TestTabLogic { ...@@ -63,7 +63,7 @@ class TestTabLogic {
let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport)) let relative = remixPath.relative(this.currentPath, remixPath.dirname(fileToImport))
if (relative === '') relative = '.' if (relative === '') relative = '.'
const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.' const comment = hasCurrent ? `import "${relative}/${remixPath.basename(fileToImport)}";` : '// Import here the file to test.'
return `pragma solidity >=0.4.22 <0.7.0; return `pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; // this import is automatically injected by Remix. import "remix_tests.sol"; // this import is automatically injected by Remix.
${comment} ${comment}
......
...@@ -8,7 +8,7 @@ var vmCall = require('./vmCall') ...@@ -8,7 +8,7 @@ var vmCall = require('./vmCall')
var Debugger = require('../src/Ethdebugger') var Debugger = require('../src/Ethdebugger')
var compiler = require('solc') var compiler = require('solc')
var ballot = `pragma solidity >=0.4.22 <0.7.0; var ballot = `pragma solidity >=0.4.22 <0.8.0;
/** /**
* @title Ballot * @title Ballot
...@@ -40,7 +40,7 @@ contract Ballot { ...@@ -40,7 +40,7 @@ contract Ballot {
* @dev Create a new ballot to choose one of 'proposalNames'. * @dev Create a new ballot to choose one of 'proposalNames'.
* @param proposalNames names of proposals * @param proposalNames names of proposals
*/ */
constructor(bytes32[] memory proposalNames) public { constructor(bytes32[] memory proposalNames) {
uint p = 45; uint p = 45;
chairperson = msg.sender; chairperson = msg.sender;
address addressLocal = msg.sender; // copy of state variable address addressLocal = msg.sender; // copy of state variable
......
...@@ -376,7 +376,7 @@ const nestedArrayContract = `contract nestedArrayContractTest { ...@@ -376,7 +376,7 @@ const nestedArrayContract = `contract nestedArrayContractTest {
} }
}` }`
const deploySimpleLib = `pragma solidity >= 0.5.0 < 0.7.0; const deploySimpleLib = `pragma solidity >= 0.5.0 < 0.8.0;
library lib1 { library lib1 {
function getEmpty () public { function getEmpty () public {
...@@ -397,14 +397,14 @@ contract testContractLinkLibrary { ...@@ -397,14 +397,14 @@ contract testContractLinkLibrary {
} }
}` }`
const encodeFunctionCall = `pragma solidity >= 0.5.0 < 0.7.0; const encodeFunctionCall = `pragma solidity >= 0.5.0 < 0.8.0;
contract testContractLinkLibrary { contract testContractLinkLibrary {
function get (uint _p, string memory _o) public { function get (uint _p, string memory _o) public {
} }
}` }`
const fallbackAndReceiveFunction = `pragma solidity >= 0.5.0 < 0.7.0; const fallbackAndReceiveFunction = `pragma solidity >= 0.5.0 < 0.8.0;
contract fallbackAndReceiveFunctionContract { contract fallbackAndReceiveFunctionContract {
function get (uint _p, string memory _o) public { function get (uint _p, string memory _o) public {
......
module.exports = ` module.exports = `
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
library Assert { library Assert {
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
contract SimpleStorage { contract SimpleStorage {
uint public storedData; uint public storedData;
constructor() public { constructor() {
storedData = 100; storedData = 100;
} }
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
import "./simple_storage.sol"; import "./simple_storage.sol";
contract MyTest { contract MyTest {
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
contract SimpleStorage { contract SimpleStorage {
uint public storedData; uint public storedData;
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
import "./simple_storage.sol"; import "./simple_storage.sol";
contract MyTest { contract MyTest {
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
contract SimpleString { contract SimpleString {
string public storedData; string public storedData;
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
import "./simple_string.sol"; import "./simple_string.sol";
contract StringTest { contract StringTest {
......
// Copyright (c) 2016 Smart Contract Solutions, Inc. // Copyright (c) 2016 Smart Contract Solutions, Inc.
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
/** /**
......
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
import "./SafeMath.sol"; import "./SafeMath.sol";
/* /*
......
pragma solidity >=0.4.22 <0.7.0; pragma solidity >=0.4.22 <0.8.0;
import "remix_tests.sol"; import "remix_tests.sol";
import "./SafeMath.sol"; import "./SafeMath.sol";
import "./SafeMathProxy.sol"; import "./SafeMathProxy.sol";
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
import "../../examples_4/SafeMath.sol"; import "../../examples_4/SafeMath.sol";
import "../lib/EvenOdd.sol"; import "../lib/EvenOdd.sol";
...@@ -7,7 +7,7 @@ contract SimpleStorage is EvenOdd{ ...@@ -7,7 +7,7 @@ contract SimpleStorage is EvenOdd{
using SafeMath for uint256; using SafeMath for uint256;
uint public storedData; uint public storedData;
constructor() public { constructor() {
storedData = 100; storedData = 100;
} }
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
contract EvenOdd { contract EvenOdd {
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
import "./../contract/simple_storage.sol"; import "./../contract/simple_storage.sol";
contract StorageResolveTest { contract StorageResolveTest {
......
pragma solidity >= 0.5.0 < 0.7.0; pragma solidity >= 0.5.0 < 0.8.0;
contract IntegerTest { contract IntegerTest {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment