aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChase McDermott <chasemcd1745@tamu.edu>2018-07-15 05:42:01 +0800
committerChase McDermott <chasemcd1745@tamu.edu>2018-07-15 05:42:43 +0800
commit3267adcd14ba10e27a4b177e771fca9c9ab39646 (patch)
tree1c9b69f82d2af0e7eaf56b17188014b541b66ce8
parent31e56f9f9976cee44f000226318dca566f0f0b79 (diff)
downloaddexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar
dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.gz
dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.bz2
dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.lz
dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.xz
dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.tar.zst
dexon-solidity-3267adcd14ba10e27a4b177e771fca9c9ab39646.zip
Added default data locations to docs and other external tests.
-rw-r--r--docs/abi-spec.rst8
-rw-r--r--docs/assembly.rst8
-rw-r--r--docs/contracts.rst6
-rw-r--r--docs/frequently-asked-questions.rst11
-rw-r--r--docs/solidity-by-example.rst8
-rw-r--r--docs/types.rst20
-rw-r--r--test/compilationTests/MultiSigWallet/MultiSigWallet.sol12
-rw-r--r--test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol2
-rw-r--r--test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol2
-rw-r--r--test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol2
-rw-r--r--test/compilationTests/corion/ico.sol2
-rw-r--r--test/compilationTests/corion/moduleHandler.sol10
-rw-r--r--test/compilationTests/corion/multiOwner.sol4
-rw-r--r--test/compilationTests/corion/premium.sol4
-rw-r--r--test/compilationTests/corion/provider.sol2
-rw-r--r--test/compilationTests/corion/publisher.sol2
-rw-r--r--test/compilationTests/corion/schelling.sol16
-rw-r--r--test/compilationTests/corion/token.sol4
-rw-r--r--test/compilationTests/gnosis/Events/Event.sol4
-rw-r--r--test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol6
-rw-r--r--test/compilationTests/gnosis/Oracles/CentralizedOracle.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/MajorityOracle.sol2
-rw-r--r--test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol2
-rw-r--r--test/compilationTests/gnosis/Utils/Math.sol2
-rw-r--r--test/compilationTests/milestonetracker/MilestoneTracker.sol2
-rw-r--r--test/compilationTests/stringutils/strings.sol52
-rw-r--r--test/compilationTests/zeppelin/MultisigWallet.sol2
-rw-r--r--test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/Contactable.sol2
-rw-r--r--test/compilationTests/zeppelin/ownership/Shareable.sol2
-rw-r--r--test/compilationTests/zeppelin/token/VestedToken.sol4
32 files changed, 104 insertions, 105 deletions
diff --git a/docs/abi-spec.rst b/docs/abi-spec.rst
index ab1650d8..5f6d7d50 100644
--- a/docs/abi-spec.rst
+++ b/docs/abi-spec.rst
@@ -193,9 +193,9 @@ Given the contract:
pragma solidity ^0.4.16;
contract Foo {
- function bar(bytes3[2]) public pure {}
+ function bar(bytes3[2] memory) public pure {}
function baz(uint32 x, bool y) public pure returns (bool r) { r = x > 32 || y; }
- function sam(bytes, bool, uint[]) public pure {}
+ function sam(bytes memory, bool, uint[] memory) public pure {}
}
@@ -490,8 +490,8 @@ As an example, the code
contract Test {
struct S { uint a; uint[] b; T[] c; }
struct T { uint x; uint y; }
- function f(S s, T t, uint a) public { }
- function g() public returns (S s, T t, uint a) {}
+ function f(S memory s, T memory t, uint a) public { }
+ function g() public returns (S memory s, T memory t, uint a) {}
}
would result in the JSON:
diff --git a/docs/assembly.rst b/docs/assembly.rst
index cf114c12..ec6ac876 100644
--- a/docs/assembly.rst
+++ b/docs/assembly.rst
@@ -54,7 +54,7 @@ idea is that assembly libraries will be used to enhance the language in such way
pragma solidity ^0.4.0;
library GetCode {
- function at(address _addr) public view returns (bytes o_code) {
+ function at(address _addr) public view returns (bytes memory o_code) {
assembly {
// retrieve the size of the code, this needs assembly
let size := extcodesize(_addr)
@@ -83,7 +83,7 @@ you really know what you are doing.
library VectorSum {
// This function is less efficient because the optimizer currently fails to
// remove the bounds checks in array access.
- function sumSolidity(uint[] _data) public view returns (uint o_sum) {
+ function sumSolidity(uint[] memory _data) public view returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i)
o_sum += _data[i];
}
@@ -91,7 +91,7 @@ you really know what you are doing.
// We know that we only access the array in bounds, so we can avoid the check.
// 0x20 needs to be added to an array because the first slot contains the
// array length.
- function sumAsm(uint[] _data) public view returns (uint o_sum) {
+ function sumAsm(uint[] memory _data) public view returns (uint o_sum) {
for (uint i = 0; i < _data.length; ++i) {
assembly {
o_sum := add(o_sum, mload(add(add(_data, 0x20), mul(i, 0x20))))
@@ -100,7 +100,7 @@ you really know what you are doing.
}
// Same as above, but accomplish the entire code within inline assembly.
- function sumPureAsm(uint[] _data) public view returns (uint o_sum) {
+ function sumPureAsm(uint[] memory _data) public view returns (uint o_sum) {
assembly {
// Load the length (first 32 bytes)
let len := mload(_data)
diff --git a/docs/contracts.rst b/docs/contracts.rst
index fa6df6bf..ea41cb54 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -1295,12 +1295,12 @@ custom types without the overhead of external function calls:
uint[] limbs;
}
- function fromUint(uint x) internal pure returns (bigint r) {
+ function fromUint(uint x) internal pure returns (bigint memory r) {
r.limbs = new uint[](1);
r.limbs[0] = x;
}
- function add(bigint _a, bigint _b) internal pure returns (bigint r) {
+ function add(bigint memory _a, bigint memory _b) internal pure returns (bigint memory r) {
r.limbs = new uint[](max(_a.limbs.length, _b.limbs.length));
uint carry = 0;
for (uint i = 0; i < r.limbs.length; ++i) {
@@ -1323,7 +1323,7 @@ custom types without the overhead of external function calls:
}
}
- function limb(bigint _a, uint _limb) internal pure returns (uint) {
+ function limb(bigint memory _a, uint _limb) internal pure returns (uint) {
return _limb < _a.limbs.length ? _a.limbs[_limb] : 0;
}
diff --git a/docs/frequently-asked-questions.rst b/docs/frequently-asked-questions.rst
index 17e71747..36eaf534 100644
--- a/docs/frequently-asked-questions.rst
+++ b/docs/frequently-asked-questions.rst
@@ -85,7 +85,7 @@ Example::
pragma solidity ^0.4.16;
contract C {
- function f() public pure returns (uint8[5]) {
+ function f() public pure returns (uint8[5] memory) {
string[4] memory adaArr = ["This", "is", "an", "array"];
return ([1, 2, 3, 4, 5]);
}
@@ -445,7 +445,7 @@ independent copies will be created::
h(x);
}
- function g(uint[20] y) internal pure {
+ function g(uint[20] memory y) internal pure {
y[2] = 3;
}
@@ -455,10 +455,9 @@ independent copies will be created::
}
The call to ``g(x)`` will not have an effect on ``x`` because it needs
-to create an independent copy of the storage value in memory
-(the default storage location is memory). On the other hand,
-``h(x)`` successfully modifies ``x`` because only a reference
-and not a copy is passed.
+to create an independent copy of the storage value in memory.
+On the other hand, ``h(x)`` successfully modifies ``x`` because only
+a reference and not a copy is passed.
Sometimes, when I try to change the length of an array with ex: ``arrayname.length = 7;`` I get a compiler error ``Value must be an lvalue``. Why?
==================================================================================================================================================
diff --git a/docs/solidity-by-example.rst b/docs/solidity-by-example.rst
index b1985426..0ee6c4df 100644
--- a/docs/solidity-by-example.rst
+++ b/docs/solidity-by-example.rst
@@ -66,7 +66,7 @@ of votes.
Proposal[] public proposals;
/// Create a new ballot to choose one of `proposalNames`.
- constructor(bytes32[] proposalNames) public {
+ constructor(bytes32[] memory proposalNames) public {
chairperson = msg.sender;
voters[chairperson].weight = 1;
@@ -452,9 +452,9 @@ high or low invalid bids.
/// correctly blinded invalid bids and for all bids except for
/// the totally highest.
function reveal(
- uint[] _values,
- bool[] _fake,
- bytes32[] _secret
+ uint[] memory _values,
+ bool[] memory _fake,
+ bytes32[] memory _secret
)
public
onlyAfter(biddingEnd)
diff --git a/docs/types.rst b/docs/types.rst
index 16445a34..46e1a869 100644
--- a/docs/types.rst
+++ b/docs/types.rst
@@ -471,11 +471,11 @@ Another example that uses external function types::
}
Request[] requests;
event NewRequest(uint);
- function query(bytes data, function(bytes memory) external callback) public {
+ function query(bytes memory data, function(bytes memory) external callback) public {
requests.push(Request(data, callback));
emit NewRequest(requests.length - 1);
}
- function reply(uint requestID, bytes response) public {
+ function reply(uint requestID, bytes memory response) public {
// Here goes the check that the reply comes from a trusted source
requests[requestID].callback(response);
}
@@ -486,7 +486,7 @@ Another example that uses external function types::
function buySomething() {
oracle.query("USD", this.oracleResponse);
}
- function oracleResponse(bytes response) public {
+ function oracleResponse(bytes memory response) public {
require(
msg.sender == address(oracle),
"Only oracle can call this."
@@ -540,7 +540,7 @@ memory-stored reference type do not create a copy.
uint[] x; // the data location of x is storage
// the data location of memoryArray is memory
- function f(uint[] memoryArray) public {
+ function f(uint[] memory memoryArray) public {
x = memoryArray; // works, copies the whole array to storage
uint[] storage y = x; // works, assigns a pointer, data location of y is storage
y[7]; // fine, returns the 8th element
@@ -557,7 +557,7 @@ memory-stored reference type do not create a copy.
}
function g(uint[] storage storageArray) internal {}
- function h(uint[] memoryArray) public {}
+ function h(uint[] memory memoryArray) public {}
}
Summary
@@ -646,7 +646,7 @@ assigned to a variable right away.
function f() public pure {
g([uint(1), 2, 3]);
}
- function g(uint[3] _data) public pure {
+ function g(uint[3] memory _data) public pure {
// ...
}
}
@@ -713,7 +713,7 @@ Members
bool[2][] m_pairsOfFlags;
// newPairs is stored in memory - the default for function arguments
- function setAllFlagPairs(bool[2][] newPairs) public {
+ function setAllFlagPairs(bool[2][] memory newPairs) public {
// assignment to a storage array replaces the complete array
m_pairsOfFlags = newPairs;
}
@@ -739,7 +739,7 @@ Members
bytes m_byteData;
- function byteArrays(bytes data) public {
+ function byteArrays(bytes memory data) public {
// byte arrays ("bytes") are different as they are stored without padding,
// but can be treated identical to "uint8[]"
m_byteData = data;
@@ -748,11 +748,11 @@ Members
delete m_byteData[2];
}
- function addFlag(bool[2] flag) public returns (uint) {
+ function addFlag(bool[2] memory flag) public returns (uint) {
return m_pairsOfFlags.push(flag);
}
- function createMemoryArray(uint size) public pure returns (bytes) {
+ function createMemoryArray(uint size) public pure returns (bytes memory) {
// Dynamic memory arrays are created using `new`:
uint[2][] memory arrayOfPairs = new uint[2][](size);
// Create a dynamic byte array:
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol
index c2a6c3ef..0261e068 100644
--- a/test/compilationTests/MultiSigWallet/MultiSigWallet.sol
+++ b/test/compilationTests/MultiSigWallet/MultiSigWallet.sol
@@ -103,7 +103,7 @@ contract MultiSigWallet {
/// @dev Contract constructor sets initial owners and required number of confirmations.
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
- constructor(address[] _owners, uint _required)
+ constructor(address[] memory _owners, uint _required)
public
validRequirement(_owners.length, _required)
{
@@ -185,7 +185,7 @@ contract MultiSigWallet {
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
- function submitTransaction(address destination, uint value, bytes data)
+ function submitTransaction(address destination, uint value, bytes memory data)
public
returns (uint transactionId)
{
@@ -261,7 +261,7 @@ contract MultiSigWallet {
/// @param value Transaction ether value.
/// @param data Transaction data payload.
/// @return Returns transaction ID.
- function addTransaction(address destination, uint value, bytes data)
+ function addTransaction(address destination, uint value, bytes memory data)
internal
notNull(destination)
returns (uint transactionId)
@@ -313,7 +313,7 @@ contract MultiSigWallet {
function getOwners()
public
view
- returns (address[])
+ returns (address[] memory)
{
return owners;
}
@@ -324,7 +324,7 @@ contract MultiSigWallet {
function getConfirmations(uint transactionId)
public
view
- returns (address[] _confirmations)
+ returns (address[] memory _confirmations)
{
address[] memory confirmationsTemp = new address[](owners.length);
uint count = 0;
@@ -348,7 +348,7 @@ contract MultiSigWallet {
function getTransactionIds(uint from, uint to, bool pending, bool executed)
public
view
- returns (uint[] _transactionIds)
+ returns (uint[] memory _transactionIds)
{
uint[] memory transactionIdsTemp = new uint[](transactionCount);
uint count = 0;
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol
index cb58ab1c..16219aa2 100644
--- a/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol
+++ b/test/compilationTests/MultiSigWallet/MultiSigWalletFactory.sol
@@ -11,7 +11,7 @@ contract MultiSigWalletFactory is Factory {
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @return Returns wallet address.
- function create(address[] _owners, uint _required)
+ function create(address[] memory _owners, uint _required)
public
returns (address wallet)
{
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol
index c1b1d7ea..69e94fd5 100644
--- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol
+++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimit.sol
@@ -19,7 +19,7 @@ contract MultiSigWalletWithDailyLimit is MultiSigWallet {
/// @param _owners List of initial owners.
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
- constructor(address[] _owners, uint _required, uint _dailyLimit)
+ constructor(address[] memory _owners, uint _required, uint _dailyLimit)
public
MultiSigWallet(_owners, _required)
{
diff --git a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol
index 8a2efa32..e4cfc031 100644
--- a/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol
+++ b/test/compilationTests/MultiSigWallet/MultiSigWalletWithDailyLimitFactory.sol
@@ -12,7 +12,7 @@ contract MultiSigWalletWithDailyLimitFactory is Factory {
/// @param _required Number of required confirmations.
/// @param _dailyLimit Amount in wei, which can be withdrawn without confirmations on a daily basis.
/// @return Returns wallet address.
- function create(address[] _owners, uint _required, uint _dailyLimit)
+ function create(address[] memory _owners, uint _required, uint _dailyLimit)
public
returns (address wallet)
{
diff --git a/test/compilationTests/corion/ico.sol b/test/compilationTests/corion/ico.sol
index abb6020b..2f60e0fe 100644
--- a/test/compilationTests/corion/ico.sol
+++ b/test/compilationTests/corion/ico.sol
@@ -50,7 +50,7 @@ contract ico is safeMath {
uint256 public totalMint;
uint256 public totalPremiumMint;
- constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] genesisAddr, uint256[] genesisValue) public {
+ constructor(address foundation, address priceSet, uint256 exchangeRate, uint256 startBlockNum, address[] memory genesisAddr, uint256[] memory genesisValue) public {
/*
Installation function.
diff --git a/test/compilationTests/corion/moduleHandler.sol b/test/compilationTests/corion/moduleHandler.sol
index fddd2a29..ce53114b 100644
--- a/test/compilationTests/corion/moduleHandler.sol
+++ b/test/compilationTests/corion/moduleHandler.sol
@@ -36,7 +36,7 @@ contract moduleHandler is multiOwner, announcementTypes {
uint256 debugModeUntil = block.number + 1000000;
- constructor(address[] newOwners) multiOwner(newOwners) public {}
+ constructor(address[] memory newOwners) multiOwner(newOwners) public {}
function load(address foundation, bool forReplace, address Token, address Premium, address Publisher, address Schelling, address Provider) public {
/*
Loading modulest to ModuleHandler.
@@ -60,7 +60,7 @@ contract moduleHandler is multiOwner, announcementTypes {
addModule( modules_s(Schelling, keccak256('Schelling'), false, true), ! forReplace);
addModule( modules_s(Provider, keccak256('Provider'), true, true), ! forReplace);
}
- function addModule(modules_s input, bool call) internal {
+ function addModule(modules_s memory input, bool call) internal {
/*
Inside function for registration of the modules in the database.
If the call is false, won't happen any direct call.
@@ -81,7 +81,7 @@ contract moduleHandler is multiOwner, announcementTypes {
}
modules[id] = input;
}
- function getModuleAddressByName(string name) public view returns( bool success, bool found, address addr ) {
+ function getModuleAddressByName(string memory name) public view returns( bool success, bool found, address addr ) {
/*
Search by name for module. The result is an Ethereum address.
@@ -109,7 +109,7 @@ contract moduleHandler is multiOwner, announcementTypes {
}
return (true, false, 0);
}
- function getModuleIDByName(string name) public view returns( bool success, bool found, uint256 id ) {
+ function getModuleIDByName(string memory name) public view returns( bool success, bool found, uint256 id ) {
/*
Search by name for module. The result is an index array.
@@ -177,7 +177,7 @@ contract moduleHandler is multiOwner, announcementTypes {
require( abstractModule(modules[_id].addr).replaceModule(newModule) );
return true;
}
-
+
function newModule(string name, address addr, bool schellingEvent, bool transferEvent) external returns (bool success) {
/*
Adding new module to the database. Can be called only by the Publisher contract.
diff --git a/test/compilationTests/corion/multiOwner.sol b/test/compilationTests/corion/multiOwner.sol
index 337467db..ecc51ac3 100644
--- a/test/compilationTests/corion/multiOwner.sol
+++ b/test/compilationTests/corion/multiOwner.sol
@@ -12,7 +12,7 @@ contract multiOwner is safeMath {
/*
Constructor
*/
- constructor(address[] newOwners) public {
+ constructor(address[] memory newOwners) public {
for ( uint256 a=0 ; a<newOwners.length ; a++ ) {
_addOwner(newOwners[a]);
}
@@ -41,7 +41,7 @@ contract multiOwner is safeMath {
function ownersForChange() public view returns (uint256 owners) {
return ownerCount * 75 / 100;
}
- function calcDoHash(string job, bytes32 data) public pure returns (bytes32 hash) {
+ function calcDoHash(string memory job, bytes32 data) public pure returns (bytes32 hash) {
return keccak256(abi.encodePacked(job, data));
}
function validDoHash(bytes32 doHash) public view returns (bool valid) {
diff --git a/test/compilationTests/corion/premium.sol b/test/compilationTests/corion/premium.sol
index e1f12ed0..45fe7666 100644
--- a/test/compilationTests/corion/premium.sol
+++ b/test/compilationTests/corion/premium.sol
@@ -40,7 +40,7 @@ contract premium is module, safeMath {
mapping(address => bool) public genesis;
- constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] genesisAddr, uint256[] genesisValue) public {
+ constructor(bool forReplace, address moduleHandler, address dbAddress, address icoContractAddr, address[] memory genesisAddr, uint256[] memory genesisValue) public {
/*
Setup function.
If an ICOaddress is defined then the balance of the genesis addresses will be set as well.
@@ -246,7 +246,7 @@ contract premium is module, safeMath {
return true;
}
- function transferToContract(address from, address to, uint256 amount, bytes extraData) internal {
+ function transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal {
/*
Inner function in order to transact a contract.
diff --git a/test/compilationTests/corion/provider.sol b/test/compilationTests/corion/provider.sol
index 35ade69f..3327ba8a 100644
--- a/test/compilationTests/corion/provider.sol
+++ b/test/compilationTests/corion/provider.sol
@@ -299,7 +299,7 @@ contract provider is module, safeMath, announcementTypes {
providers[addr].data[currHeight].currentRate = rate;
emit EProviderDetailsChanged(addr, currHeight, website, country, info, rate, admin);
}
- function getProviderInfo(address addr, uint256 height) public view returns (string name, string website, string country, string info, uint256 create) {
+ function getProviderInfo(address addr, uint256 height) public view returns (string memory name, string memory website, string memory country, string memory info, uint256 create) {
/*
for the infos of the provider.
In case the height is unknown then the system will use the last known height.
diff --git a/test/compilationTests/corion/publisher.sol b/test/compilationTests/corion/publisher.sol
index 44bc5964..575b99a8 100644
--- a/test/compilationTests/corion/publisher.sol
+++ b/test/compilationTests/corion/publisher.sol
@@ -70,7 +70,7 @@ contract publisher is announcementTypes, module, safeMath {
super.registerModuleHandler(moduleHandler);
}
- 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) {
+ function Announcements(uint256 id) public view returns (uint256 Type, uint256 Start, uint256 End, bool Closed, string memory Announcement, string memory Link, bool Opposited, string memory _str, uint256 _uint, address _addr) {
/*
Announcement data query
diff --git a/test/compilationTests/corion/schelling.sol b/test/compilationTests/corion/schelling.sol
index b8beaa3a..f236d378 100644
--- a/test/compilationTests/corion/schelling.sol
+++ b/test/compilationTests/corion/schelling.sol
@@ -174,7 +174,7 @@ contract schelling is module, announcementTypes, schellingVars {
function setFunds(address addr, uint256 amount) internal {
require( db.setFunds(addr, amount) );
}
- function setVoter(address owner, _voter voter) internal {
+ function setVoter(address owner, _voter memory voter) internal {
require( db.setVoter(owner,
voter.roundID,
voter.hash,
@@ -182,13 +182,13 @@ contract schelling is module, announcementTypes, schellingVars {
voter.voteResult,
voter.rewards
) );
- }
- function getVoter(address addr) internal view returns (_voter) {
+ }
+ function getVoter(address addr) internal view returns (_voter memory) {
(bool a, uint256 b, bytes32 c, schellingVars.voterStatus d, bool e, uint256 f) = db.getVoter(addr);
require( a );
return _voter(b, c, d, e, f);
}
- function setRound(uint256 id, _rounds round) internal {
+ function setRound(uint256 id, _rounds memory round) internal {
require( db.setRound(id,
round.totalAboveWeight,
round.totalBelowWeight,
@@ -197,8 +197,8 @@ contract schelling is module, announcementTypes, schellingVars {
round.voted
) );
}
- function pushRound(_rounds round) internal returns (uint256) {
- (bool a, uint256 b) = db.pushRound(
+ function pushRound(_rounds memory round) internal returns (uint256) {
+ (bool a, uint256 b) = db.pushRound(
round.totalAboveWeight,
round.totalBelowWeight,
round.reward,
@@ -208,7 +208,7 @@ contract schelling is module, announcementTypes, schellingVars {
require( a );
return b;
}
- function getRound(uint256 id) internal returns (_rounds) {
+ function getRound(uint256 id) internal returns (_rounds memory) {
(bool a, uint256 b, uint256 c, uint256 d, uint256 e, bool f) = db.getRound(id);
require( a );
return _rounds(b, c, d, e, f);
@@ -529,7 +529,7 @@ contract schelling is module, announcementTypes, schellingVars {
return belowW;
}
}
- function isWinner(_rounds round, bool aboveVote) internal returns (bool) {
+ function isWinner(_rounds memory round, bool aboveVote) internal returns (bool) {
/*
Inside function for calculating the result of the game.
diff --git a/test/compilationTests/corion/token.sol b/test/compilationTests/corion/token.sol
index 8ca18083..6c8f6f24 100644
--- a/test/compilationTests/corion/token.sol
+++ b/test/compilationTests/corion/token.sol
@@ -48,7 +48,7 @@ contract token is safeMath, module, announcementTypes {
mapping(address => bool) public genesis;
- constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] genesisAddr, uint256[] genesisValue) public payable {
+ constructor(bool forReplace, address moduleHandler, address dbAddr, address icoContractAddr, address exchangeContractAddress, address[] memory genesisAddr, uint256[] memory genesisValue) public payable {
/*
Installation function
@@ -288,7 +288,7 @@ contract token is safeMath, module, announcementTypes {
return true;
}
- function _transferToContract(address from, address to, uint256 amount, bytes extraData) internal {
+ function _transferToContract(address from, address to, uint256 amount, bytes memory extraData) internal {
/*
Internal function to start transactions to a contract
diff --git a/test/compilationTests/gnosis/Events/Event.sol b/test/compilationTests/gnosis/Events/Event.sol
index 177f61df..5b1a550c 100644
--- a/test/compilationTests/gnosis/Events/Event.sol
+++ b/test/compilationTests/gnosis/Events/Event.sol
@@ -101,7 +101,7 @@ contract Event {
function getOutcomeTokens()
public
view
- returns (OutcomeToken[])
+ returns (OutcomeToken[] memory)
{
return outcomeTokens;
}
@@ -111,7 +111,7 @@ contract Event {
function getOutcomeTokenDistribution(address owner)
public
view
- returns (uint[] outcomeTokenDistribution)
+ returns (uint[] memory outcomeTokenDistribution)
{
outcomeTokenDistribution = new uint[](outcomeTokens.length);
for (uint8 i = 0; i < outcomeTokenDistribution.length; i++)
diff --git a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol
index cf4fcd7d..4ad285eb 100644
--- a/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol
+++ b/test/compilationTests/gnosis/MarketMakers/LMSRMarketMaker.sol
@@ -108,7 +108,7 @@ contract LMSRMarketMaker is MarketMaker {
/// @param netOutcomeTokensSold Net outcome tokens sold by market
/// @param funding Initial funding for market
/// @return Cost level
- function calcCostLevel(int logN, int[] netOutcomeTokensSold, uint funding)
+ function calcCostLevel(int logN, int[] memory netOutcomeTokensSold, uint funding)
private
view
returns(int costLevel)
@@ -129,7 +129,7 @@ contract LMSRMarketMaker is MarketMaker {
/// @param funding Initial funding for market
/// @param outcomeIndex Index of exponential term to extract (for use by marginal price function)
/// @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[] memory netOutcomeTokensSold, uint funding, uint8 outcomeIndex)
private
view
returns (uint sum, int offset, uint outcomeExpTerm)
@@ -171,7 +171,7 @@ contract LMSRMarketMaker is MarketMaker {
function getNetOutcomeTokensSold(Market market)
private
view
- returns (int[] quantities)
+ returns (int[] memory quantities)
{
quantities = new int[](market.eventContract().getOutcomeCount());
for (uint8 i = 0; i < quantities.length; i++)
diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol
index de182a61..e175dfdb 100644
--- a/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/CentralizedOracle.sol
@@ -34,7 +34,7 @@ contract CentralizedOracle is Oracle {
*/
/// @dev Constructor sets owner address and IPFS hash
/// @param _ipfsHash Hash identifying off chain event description
- constructor(address _owner, bytes _ipfsHash)
+ constructor(address _owner, bytes memory _ipfsHash)
public
{
// Description hash cannot be null
diff --git a/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol b/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol
index ca4e37d2..be632070 100644
--- a/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol
+++ b/test/compilationTests/gnosis/Oracles/CentralizedOracleFactory.sol
@@ -17,7 +17,7 @@ contract CentralizedOracleFactory {
/// @dev Creates a new centralized oracle contract
/// @param ipfsHash Hash identifying off chain event description
/// @return Oracle contract
- function createCentralizedOracle(bytes ipfsHash)
+ function createCentralizedOracle(bytes memory ipfsHash)
public
returns (CentralizedOracle centralizedOracle)
{
diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol
index d8097370..4dc1760d 100644
--- a/test/compilationTests/gnosis/Oracles/MajorityOracle.sol
+++ b/test/compilationTests/gnosis/Oracles/MajorityOracle.sol
@@ -16,7 +16,7 @@ contract MajorityOracle is Oracle {
*/
/// @dev Allows to create an oracle for a majority vote based on other oracles
/// @param _oracles List of oracles taking part in the majority vote
- constructor(Oracle[] _oracles)
+ constructor(Oracle[] memory _oracles)
public
{
// At least 2 oracles should be defined
diff --git a/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol b/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol
index 3c02fef4..dbbccc4c 100644
--- a/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol
+++ b/test/compilationTests/gnosis/Oracles/MajorityOracleFactory.sol
@@ -17,7 +17,7 @@ contract MajorityOracleFactory {
/// @dev Creates a new majority oracle contract
/// @param oracles List of oracles taking part in the majority vote
/// @return Oracle contract
- function createMajorityOracle(Oracle[] oracles)
+ function createMajorityOracle(Oracle[] memory oracles)
public
returns (MajorityOracle majorityOracle)
{
diff --git a/test/compilationTests/gnosis/Utils/Math.sol b/test/compilationTests/gnosis/Utils/Math.sol
index 93456c33..47edcba4 100644
--- a/test/compilationTests/gnosis/Utils/Math.sol
+++ b/test/compilationTests/gnosis/Utils/Math.sol
@@ -176,7 +176,7 @@ library Math {
/// @dev Returns maximum of an array
/// @param nums Numbers to look through
/// @return Maximum number
- function max(int[] nums)
+ function max(int[] memory nums)
public
pure
returns (int max)
diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol
index bc182f9d..c123862f 100644
--- a/test/compilationTests/milestonetracker/MilestoneTracker.sol
+++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol
@@ -175,7 +175,7 @@ contract MilestoneTracker {
/// uint reviewTime
/// address paymentSource,
/// bytes payData,
- function proposeMilestones(bytes _newMilestones
+ function proposeMilestones(bytes memory _newMilestones
) public onlyRecipient campaignNotCanceled {
proposedMilestones = _newMilestones;
changingMilestones = true;
diff --git a/test/compilationTests/stringutils/strings.sol b/test/compilationTests/stringutils/strings.sol
index fc46ec5a..390fb5d9 100644
--- a/test/compilationTests/stringutils/strings.sol
+++ b/test/compilationTests/stringutils/strings.sol
@@ -63,7 +63,7 @@ library strings {
* @param self The string to make a slice from.
* @return A newly allocated slice containing the entire string.
*/
- function toSlice(string self) internal returns (slice) {
+ function toSlice(string memory self) internal returns (slice memory) {
uint ptr;
assembly {
ptr := add(self, 0x20)
@@ -109,7 +109,7 @@ library strings {
* @return A new slice containing the value of the input argument up to the
* first null.
*/
- function toSliceB32(bytes32 self) internal returns (slice ret) {
+ function toSliceB32(bytes32 self) internal returns (slice memory ret) {
// Allocate space for `self` in memory, copy it there, and point ret at it
assembly {
let ptr := mload(0x40)
@@ -125,7 +125,7 @@ library strings {
* @param self The slice to copy.
* @return A new slice containing the same data as `self`.
*/
- function copy(slice self) internal returns (slice) {
+ function copy(slice memory self) internal returns (slice memory) {
return slice(self._len, self._ptr);
}
@@ -134,7 +134,7 @@ library strings {
* @param self The slice to copy.
* @return A newly allocated string containing the slice's text.
*/
- function toString(slice self) internal returns (string) {
+ function toString(slice memory self) internal returns (string memory) {
string memory ret = new string(self._len);
uint retptr;
assembly { retptr := add(ret, 32) }
@@ -151,7 +151,7 @@ library strings {
* @param self The slice to operate on.
* @return The length of the slice in runes.
*/
- function len(slice self) internal returns (uint) {
+ function len(slice memory self) internal returns (uint) {
// Starting at ptr-31 means the LSB will be the byte we care about
uint ptr = self._ptr - 31;
uint end = ptr + self._len;
@@ -181,7 +181,7 @@ library strings {
* @param self The slice to operate on.
* @return True if the slice is empty, False otherwise.
*/
- function empty(slice self) internal returns (bool) {
+ function empty(slice memory self) internal returns (bool) {
return self._len == 0;
}
@@ -194,7 +194,7 @@ library strings {
* @param other The second slice to compare.
* @return The result of the comparison.
*/
- function compare(slice self, slice other) internal returns (int) {
+ function compare(slice memory self, slice memory other) internal returns (int) {
uint shortest = self._len;
if (other._len < self._len)
shortest = other._len;
@@ -227,7 +227,7 @@ library strings {
* @param self The second slice to compare.
* @return True if the slices are equal, false otherwise.
*/
- function equals(slice self, slice other) internal returns (bool) {
+ function equals(slice memory self, slice memory other) internal returns (bool) {
return compare(self, other) == 0;
}
@@ -238,7 +238,7 @@ library strings {
* @param rune The slice that will contain the first rune.
* @return `rune`.
*/
- function nextRune(slice self, slice rune) internal returns (slice) {
+ function nextRune(slice memory self, slice memory rune) internal returns (slice memory) {
rune._ptr = self._ptr;
if (self._len == 0) {
@@ -280,7 +280,7 @@ library strings {
* @param self The slice to operate on.
* @return A slice containing only the first rune from `self`.
*/
- function nextRune(slice self) internal returns (slice ret) {
+ function nextRune(slice memory self) internal returns (slice memory ret) {
nextRune(self, ret);
}
@@ -289,7 +289,7 @@ library strings {
* @param self The slice to operate on.
* @return The number of the first codepoint in the slice.
*/
- function ord(slice self) internal returns (uint ret) {
+ function ord(slice memory self) internal returns (uint ret) {
if (self._len == 0) {
return 0;
}
@@ -338,7 +338,7 @@ library strings {
* @param self The slice to hash.
* @return The hash of the slice.
*/
- function keccak(slice self) internal returns (bytes32 ret) {
+ function keccak(slice memory self) internal returns (bytes32 ret) {
assembly {
ret := keccak256(mload(add(self, 32)), mload(self))
}
@@ -350,7 +350,7 @@ library strings {
* @param needle The slice to search for.
* @return True if the slice starts with the provided text, false otherwise.
*/
- function startsWith(slice self, slice needle) internal returns (bool) {
+ function startsWith(slice memory self, slice memory needle) internal returns (bool) {
if (self._len < needle._len) {
return false;
}
@@ -376,7 +376,7 @@ library strings {
* @param needle The slice to search for.
* @return `self`
*/
- function beyond(slice self, slice needle) internal returns (slice) {
+ function beyond(slice memory self, slice memory needle) internal returns (slice memory) {
if (self._len < needle._len) {
return self;
}
@@ -405,7 +405,7 @@ library strings {
* @param needle The slice to search for.
* @return True if the slice starts with the provided text, false otherwise.
*/
- function endsWith(slice self, slice needle) internal returns (bool) {
+ function endsWith(slice memory self, slice memory needle) internal returns (bool) {
if (self._len < needle._len) {
return false;
}
@@ -433,7 +433,7 @@ library strings {
* @param needle The slice to search for.
* @return `self`
*/
- function until(slice self, slice needle) internal returns (slice) {
+ function until(slice memory self, slice memory needle) internal returns (slice memory) {
if (self._len < needle._len) {
return self;
}
@@ -542,7 +542,7 @@ library strings {
* @param needle The text to search for.
* @return `self`.
*/
- function find(slice self, slice needle) internal returns (slice) {
+ function find(slice memory self, slice memory needle) internal returns (slice memory) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
self._len -= ptr - self._ptr;
self._ptr = ptr;
@@ -557,7 +557,7 @@ library strings {
* @param needle The text to search for.
* @return `self`.
*/
- function rfind(slice self, slice needle) internal returns (slice) {
+ function rfind(slice memory self, slice memory needle) internal returns (slice memory) {
uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
self._len = ptr - self._ptr;
return self;
@@ -573,7 +573,7 @@ library strings {
* @param token An output parameter to which the first token is written.
* @return `token`.
*/
- function split(slice self, slice needle, slice token) internal returns (slice) {
+ function split(slice memory self, slice memory needle, slice memory token) internal returns (slice memory) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = self._ptr;
token._len = ptr - self._ptr;
@@ -596,7 +596,7 @@ library strings {
* @param needle The text to search for in `self`.
* @return The part of `self` up to the first occurrence of `delim`.
*/
- function split(slice self, slice needle) internal returns (slice token) {
+ function split(slice memory self, slice memory needle) internal returns (slice memory token) {
split(self, needle, token);
}
@@ -610,7 +610,7 @@ library strings {
* @param token An output parameter to which the first token is written.
* @return `token`.
*/
- function rsplit(slice self, slice needle, slice token) internal returns (slice) {
+ function rsplit(slice memory self, slice memory needle, slice memory token) internal returns (slice memory) {
uint ptr = rfindPtr(self._len, self._ptr, needle._len, needle._ptr);
token._ptr = ptr;
token._len = self._len - (ptr - self._ptr);
@@ -632,7 +632,7 @@ library strings {
* @param needle The text to search for in `self`.
* @return The part of `self` after the last occurrence of `delim`.
*/
- function rsplit(slice self, slice needle) internal returns (slice token) {
+ function rsplit(slice memory self, slice memory needle) internal returns (slice memory token) {
rsplit(self, needle, token);
}
@@ -642,7 +642,7 @@ library strings {
* @param needle The text to search for in `self`.
* @return The number of occurrences of `needle` found in `self`.
*/
- function count(slice self, slice needle) internal returns (uint count) {
+ function count(slice memory self, slice memory needle) internal returns (uint count) {
uint ptr = findPtr(self._len, self._ptr, needle._len, needle._ptr) + needle._len;
while (ptr <= self._ptr + self._len) {
count++;
@@ -656,7 +656,7 @@ library strings {
* @param needle The text to search for in `self`.
* @return True if `needle` is found in `self`, false otherwise.
*/
- function contains(slice self, slice needle) internal returns (bool) {
+ function contains(slice memory self, slice memory needle) internal returns (bool) {
return rfindPtr(self._len, self._ptr, needle._len, needle._ptr) != self._ptr;
}
@@ -667,7 +667,7 @@ library strings {
* @param other The second slice to concatenate.
* @return The concatenation of the two strings.
*/
- function concat(slice self, slice other) internal returns (string) {
+ function concat(slice memory self, slice memory other) internal returns (string memory) {
string memory ret = new string(self._len + other._len);
uint retptr;
assembly { retptr := add(ret, 32) }
@@ -684,7 +684,7 @@ library strings {
* @return A newly allocated string containing all the slices in `parts`,
* joined with `self`.
*/
- function join(slice self, slice[] parts) internal returns (string) {
+ function join(slice memory self, slice[] memory parts) internal returns (string memory) {
if (parts.length == 0)
return "";
diff --git a/test/compilationTests/zeppelin/MultisigWallet.sol b/test/compilationTests/zeppelin/MultisigWallet.sol
index e8e8d05d..2d6a064a 100644
--- a/test/compilationTests/zeppelin/MultisigWallet.sol
+++ b/test/compilationTests/zeppelin/MultisigWallet.sol
@@ -25,7 +25,7 @@ contract MultisigWallet is Multisig, Shareable, DayLimit {
* @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved.
*/
- constructor(address[] _owners, uint256 _required, uint256 _daylimit)
+ constructor(address[] memory _owners, uint256 _required, uint256 _daylimit)
Shareable(_owners, _required)
DayLimit(_daylimit) public { }
diff --git a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol
index 0b19eb71..51f6b68e 100644
--- a/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol
+++ b/test/compilationTests/zeppelin/lifecycle/TokenDestructible.sol
@@ -21,7 +21,7 @@ contract TokenDestructible is Ownable {
* @notice The called token contracts could try to re-enter this contract. Only
supply token contracts you trust.
*/
- function destroy(address[] tokens) public onlyOwner {
+ function destroy(address[] memory tokens) public onlyOwner {
// Transfer tokens to owner
for(uint256 i = 0; i < tokens.length; i++) {
diff --git a/test/compilationTests/zeppelin/ownership/Contactable.sol b/test/compilationTests/zeppelin/ownership/Contactable.sol
index 11b0e1dd..5f781e13 100644
--- a/test/compilationTests/zeppelin/ownership/Contactable.sol
+++ b/test/compilationTests/zeppelin/ownership/Contactable.sol
@@ -15,7 +15,7 @@ contract Contactable is Ownable{
* @dev Allows the owner to set a string with their contact information.
* @param info The contact information to attach to the contract.
*/
- function setContactInformation(string info) public onlyOwner{
+ function setContactInformation(string memory info) public onlyOwner{
contactInformation = info;
}
}
diff --git a/test/compilationTests/zeppelin/ownership/Shareable.sol b/test/compilationTests/zeppelin/ownership/Shareable.sol
index d44f63b8..4a6b32f0 100644
--- a/test/compilationTests/zeppelin/ownership/Shareable.sol
+++ b/test/compilationTests/zeppelin/ownership/Shareable.sol
@@ -59,7 +59,7 @@ contract Shareable {
* @param _owners A list of owners.
* @param _required The amount required for a transaction to be approved.
*/
- constructor(address[] _owners, uint256 _required) public {
+ constructor(address[] memory _owners, uint256 _required) public {
owners[1] = msg.sender;
ownerIndex[msg.sender] = 1;
for (uint256 i = 0; i < _owners.length; ++i) {
diff --git a/test/compilationTests/zeppelin/token/VestedToken.sol b/test/compilationTests/zeppelin/token/VestedToken.sol
index 48818c3f..2ee2713d 100644
--- a/test/compilationTests/zeppelin/token/VestedToken.sol
+++ b/test/compilationTests/zeppelin/token/VestedToken.sol
@@ -212,7 +212,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @param time The time to be checked
* @return An uint256 representing the amount of vested tokens of a specific grant at a specific time.
*/
- function vestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) {
+ function vestedTokens(TokenGrant memory grant, uint64 time) private view returns (uint256) {
return calculateVestedTokens(
grant.value,
uint256(time),
@@ -229,7 +229,7 @@ contract VestedToken is StandardToken, LimitedTransferToken {
* @return An uint256 representing the amount of non vested tokens of a specific grant on the
* passed time frame.
*/
- function nonVestedTokens(TokenGrant grant, uint64 time) private view returns (uint256) {
+ function nonVestedTokens(TokenGrant memory grant, uint64 time) private view returns (uint256) {
return grant.value.sub(vestedTokens(grant, time));
}