aboutsummaryrefslogtreecommitdiffstats
path: root/test/compilationTests/milestonetracker
diff options
context:
space:
mode:
Diffstat (limited to 'test/compilationTests/milestonetracker')
-rw-r--r--test/compilationTests/milestonetracker/MilestoneTracker.sol60
-rw-r--r--test/compilationTests/milestonetracker/RLP.sol78
2 files changed, 69 insertions, 69 deletions
diff --git a/test/compilationTests/milestonetracker/MilestoneTracker.sol b/test/compilationTests/milestonetracker/MilestoneTracker.sol
index 318330df..545acb0a 100644
--- a/test/compilationTests/milestonetracker/MilestoneTracker.sol
+++ b/test/compilationTests/milestonetracker/MilestoneTracker.sol
@@ -108,11 +108,11 @@ contract MilestoneTracker {
/// @param _arbitrator Address assigned to be the arbitrator
/// @param _donor Address assigned to be the donor
/// @param _recipient Address assigned to be the recipient
- function MilestoneTracker (
+ constructor (
address _arbitrator,
address _donor,
address _recipient
- ) {
+ ) public {
arbitrator = _arbitrator;
donor = _donor;
recipient = _recipient;
@@ -124,7 +124,7 @@ contract MilestoneTracker {
/////////
/// @return The number of milestones ever created even if they were canceled
- function numberOfMilestones() constant returns (uint) {
+ function numberOfMilestones() public view returns (uint) {
return milestones.length;
}
@@ -135,19 +135,19 @@ contract MilestoneTracker {
/// @notice `onlyArbitrator` Reassigns the arbitrator to a new address
/// @param _newArbitrator The new arbitrator
- function changeArbitrator(address _newArbitrator) onlyArbitrator {
+ function changeArbitrator(address _newArbitrator) public onlyArbitrator {
arbitrator = _newArbitrator;
}
/// @notice `onlyDonor` Reassigns the `donor` to a new address
/// @param _newDonor The new donor
- function changeDonor(address _newDonor) onlyDonor {
+ function changeDonor(address _newDonor) public onlyDonor {
donor = _newDonor;
}
/// @notice `onlyRecipient` Reassigns the `recipient` to a new address
/// @param _newRecipient The new recipient
- function changeRecipient(address _newRecipient) onlyRecipient {
+ function changeRecipient(address _newRecipient) public onlyRecipient {
recipient = _newRecipient;
}
@@ -176,10 +176,10 @@ contract MilestoneTracker {
/// address paymentSource,
/// bytes payData,
function proposeMilestones(bytes _newMilestones
- ) onlyRecipient campaignNotCanceled {
+ ) public onlyRecipient campaignNotCanceled {
proposedMilestones = _newMilestones;
changingMilestones = true;
- NewMilestoneListProposed();
+ emit NewMilestoneListProposed();
}
@@ -189,23 +189,23 @@ contract MilestoneTracker {
/// @notice `onlyRecipient` Cancels the proposed milestones and reactivates
/// the previous set of milestones
- function unproposeMilestones() onlyRecipient campaignNotCanceled {
+ function unproposeMilestones() public onlyRecipient campaignNotCanceled {
delete proposedMilestones;
changingMilestones = false;
- NewMilestoneListUnproposed();
+ emit NewMilestoneListUnproposed();
}
/// @notice `onlyDonor` Approves the proposed milestone list
- /// @param _hashProposals The sha3() of the proposed milestone list's
+ /// @param _hashProposals The keccak256() of the proposed milestone list's
/// bytecode; this confirms that the `donor` knows the set of milestones
/// they are approving
function acceptProposedMilestones(bytes32 _hashProposals
- ) onlyDonor campaignNotCanceled {
+ ) public onlyDonor campaignNotCanceled {
uint i;
if (!changingMilestones) throw;
- if (sha3(proposedMilestones) != _hashProposals) throw;
+ if (keccak256(proposedMilestones) != _hashProposals) throw;
// Cancel all the unfinished milestones
for (i=0; i<milestones.length; i++) {
@@ -216,22 +216,22 @@ contract MilestoneTracker {
// Decode the RLP encoded milestones and add them to the milestones list
bytes memory mProposedMilestones = proposedMilestones;
- var itmProposals = mProposedMilestones.toRLPItem(true);
+ RLP.RLPItem memory itmProposals = mProposedMilestones.toRLPItem(true);
if (!itmProposals.isList()) throw;
- var itrProposals = itmProposals.iterator();
+ RLP.Iterator memory itrProposals = itmProposals.iterator();
while(itrProposals.hasNext()) {
- var itmProposal = itrProposals.next();
+ RLP.RLPItem memory itmProposal = itrProposals.next();
Milestone milestone = milestones[milestones.length ++];
if (!itmProposal.isList()) throw;
- var itrProposal = itmProposal.iterator();
+ RLP.Iterator memory itrProposal = itmProposal.iterator();
milestone.description = itrProposal.next().toAscii();
milestone.url = itrProposal.next().toAscii();
@@ -249,14 +249,14 @@ contract MilestoneTracker {
delete proposedMilestones;
changingMilestones = false;
- NewMilestoneListAccepted();
+ emit NewMilestoneListAccepted();
}
/// @notice `onlyRecipientOrLeadLink`Marks a milestone as DONE and
/// ready for review
/// @param _idMilestone ID of the milestone that has been completed
function markMilestoneComplete(uint _idMilestone)
- campaignNotCanceled notChanging
+ public campaignNotCanceled notChanging
{
if (_idMilestone >= milestones.length) throw;
Milestone milestone = milestones[_idMilestone];
@@ -268,13 +268,13 @@ contract MilestoneTracker {
if (now > milestone.maxCompletionDate) throw;
milestone.status = MilestoneStatus.Completed;
milestone.doneTime = now;
- ProposalStatusChanged(_idMilestone, milestone.status);
+ emit ProposalStatusChanged(_idMilestone, milestone.status);
}
/// @notice `onlyReviewer` Approves a specific milestone
/// @param _idMilestone ID of the milestone that is approved
function approveCompletedMilestone(uint _idMilestone)
- campaignNotCanceled notChanging
+ public campaignNotCanceled notChanging
{
if (_idMilestone >= milestones.length) throw;
Milestone milestone = milestones[_idMilestone];
@@ -289,7 +289,7 @@ contract MilestoneTracker {
/// state
/// @param _idMilestone ID of the milestone that is being rejected
function rejectMilestone(uint _idMilestone)
- campaignNotCanceled notChanging
+ public campaignNotCanceled notChanging
{
if (_idMilestone >= milestones.length) throw;
Milestone milestone = milestones[_idMilestone];
@@ -297,7 +297,7 @@ contract MilestoneTracker {
(milestone.status != MilestoneStatus.Completed)) throw;
milestone.status = MilestoneStatus.AcceptedAndInProgress;
- ProposalStatusChanged(_idMilestone, milestone.status);
+ emit ProposalStatusChanged(_idMilestone, milestone.status);
}
/// @notice `onlyRecipientOrLeadLink` Sends the milestone payment as
@@ -305,7 +305,7 @@ contract MilestoneTracker {
/// `reviewTime` has elapsed
/// @param _idMilestone ID of the milestone to be paid out
function requestMilestonePayment(uint _idMilestone
- ) campaignNotCanceled notChanging {
+ ) public campaignNotCanceled notChanging {
if (_idMilestone >= milestones.length) throw;
Milestone milestone = milestones[_idMilestone];
if ( (msg.sender != milestone.milestoneLeadLink)
@@ -321,7 +321,7 @@ contract MilestoneTracker {
/// @notice `onlyRecipient` Cancels a previously accepted milestone
/// @param _idMilestone ID of the milestone to be canceled
function cancelMilestone(uint _idMilestone)
- onlyRecipient campaignNotCanceled notChanging
+ public onlyRecipient campaignNotCanceled notChanging
{
if (_idMilestone >= milestones.length) throw;
Milestone milestone = milestones[_idMilestone];
@@ -330,14 +330,14 @@ contract MilestoneTracker {
throw;
milestone.status = MilestoneStatus.Canceled;
- ProposalStatusChanged(_idMilestone, milestone.status);
+ emit ProposalStatusChanged(_idMilestone, milestone.status);
}
/// @notice `onlyArbitrator` Forces a milestone to be paid out as long as it
/// has not been paid or canceled
/// @param _idMilestone ID of the milestone to be paid out
function arbitrateApproveMilestone(uint _idMilestone
- ) onlyArbitrator campaignNotCanceled notChanging {
+ ) public onlyArbitrator campaignNotCanceled notChanging {
if (_idMilestone >= milestones.length) throw;
Milestone milestone = milestones[_idMilestone];
if ((milestone.status != MilestoneStatus.AcceptedAndInProgress) &&
@@ -348,9 +348,9 @@ contract MilestoneTracker {
/// @notice `onlyArbitrator` Cancels the entire campaign voiding all
/// milestones.
- function arbitrateCancelCampaign() onlyArbitrator campaignNotCanceled {
+ function arbitrateCancelCampaign() public onlyArbitrator campaignNotCanceled {
campaignCanceled = true;
- CampaignCanceled();
+ emit CampaignCanceled();
}
// @dev This internal function is executed when the milestone is paid out
@@ -362,6 +362,6 @@ contract MilestoneTracker {
milestone.status = MilestoneStatus.AuthorizedForPayment;
if (!milestone.paymentSource.call.value(0)(milestone.payData))
throw;
- ProposalStatusChanged(_idMilestone, milestone.status);
+ emit ProposalStatusChanged(_idMilestone, milestone.status);
}
}
diff --git a/test/compilationTests/milestonetracker/RLP.sol b/test/compilationTests/milestonetracker/RLP.sol
index 1b8cd1cb..e96bb332 100644
--- a/test/compilationTests/milestonetracker/RLP.sol
+++ b/test/compilationTests/milestonetracker/RLP.sol
@@ -30,10 +30,10 @@ library RLP {
/* 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)) {
- var ptr = self._unsafe_nextPtr;
- var itemLength = _itemLength(ptr);
+ uint ptr = self._unsafe_nextPtr;
+ uint itemLength = _itemLength(ptr);
subItem._unsafe_memPtr = ptr;
subItem._unsafe_length = itemLength;
self._unsafe_nextPtr = ptr + itemLength;
@@ -42,15 +42,15 @@ library RLP {
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);
if(strict && !_validate(subItem))
throw;
return;
}
- function hasNext(Iterator memory self) internal constant returns (bool) {
- var item = self._unsafe_item;
+ function hasNext(Iterator memory self) internal view returns (bool) {
+ RLPItem memory item = self._unsafe_item;
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.
/// @param self The RLP encoded bytes.
/// @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;
if (len == 0) {
return RLPItem(0, 0);
@@ -75,8 +75,8 @@ library RLP {
/// @param self The RLP encoded bytes.
/// @param strict Will throw if the data is not RLP encoded.
/// @return An RLPItem
- function toRLPItem(bytes memory self, bool strict) internal constant returns (RLPItem memory) {
- var item = toRLPItem(self);
+ function toRLPItem(bytes memory self, bool strict) internal view returns (RLPItem memory) {
+ RLPItem memory item = toRLPItem(self);
if(strict) {
uint len = self.length;
if(_payloadOffset(item) > len)
@@ -92,14 +92,14 @@ library RLP {
/// @dev Check if the RLP item is null.
/// @param self The RLP item.
/// @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;
}
/// @dev Check if the RLP item is a list.
/// @param self The RLP item.
/// @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)
return false;
uint memPtr = self._unsafe_memPtr;
@@ -111,7 +111,7 @@ library RLP {
/// @dev Check if the RLP item is data.
/// @param self The RLP item.
/// @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)
return false;
uint memPtr = self._unsafe_memPtr;
@@ -123,7 +123,7 @@ library RLP {
/// @dev Check if the RLP item is empty (string or list).
/// @param self The RLP item.
/// @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))
return false;
uint b0;
@@ -137,7 +137,7 @@ library RLP {
/// @dev Get the number of items in an RLP encoded list.
/// @param self The RLP item.
/// @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))
return 0;
uint b0;
@@ -158,7 +158,7 @@ library RLP {
/// @dev Create an iterator.
/// @param self The RLP 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))
throw;
uint ptr = self._unsafe_memPtr + _payloadOffset(self);
@@ -169,8 +169,8 @@ library RLP {
/// @dev Return the RLP encoded bytes.
/// @param self The RLPItem.
/// @return The bytes.
- function toBytes(RLPItem memory self) internal constant returns (bytes memory bts) {
- var len = self._unsafe_length;
+ function toBytes(RLPItem memory self) internal returns (bytes memory bts) {
+ uint len = self._unsafe_length;
if (len == 0)
return;
bts = new bytes(len);
@@ -181,10 +181,10 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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))
throw;
- var (rStartPos, len) = _decode(self);
+ (uint rStartPos, uint len) = _decode(self);
bts = new bytes(len);
_copyToBytes(rStartPos, bts, len);
}
@@ -193,12 +193,12 @@ library RLP {
/// Warning: This is inefficient, as it requires that the list is read twice.
/// @param self The RLP item.
/// @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))
throw;
- var numItems = items(self);
+ uint numItems = items(self);
list = new RLPItem[](numItems);
- var it = iterator(self);
+ Iterator memory it = iterator(self);
uint idx;
while(hasNext(it)) {
list[idx] = next(it);
@@ -210,10 +210,10 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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))
throw;
- var (rStartPos, len) = _decode(self);
+ (uint rStartPos, uint len) = _decode(self);
bytes memory bts = new bytes(len);
_copyToBytes(rStartPos, bts, len);
str = string(bts);
@@ -223,10 +223,10 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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))
throw;
- var (rStartPos, len) = _decode(self);
+ (uint rStartPos, uint len) = _decode(self);
if (len > 32 || len == 0)
throw;
assembly {
@@ -238,10 +238,10 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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))
throw;
- var (rStartPos, len) = _decode(self);
+ (uint rStartPos, uint len) = _decode(self);
if (len != 1)
throw;
uint temp;
@@ -257,10 +257,10 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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))
throw;
- var (rStartPos, len) = _decode(self);
+ (uint rStartPos, uint len) = _decode(self);
if (len != 1)
throw;
uint8 temp;
@@ -274,7 +274,7 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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));
}
@@ -282,7 +282,7 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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));
}
@@ -290,10 +290,10 @@ library RLP {
/// RLPItem is a list.
/// @param self The RLPItem.
/// @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))
throw;
- var (rStartPos, len) = _decode(self);
+ (uint rStartPos, uint len) = _decode(self);
if (len != 20)
throw;
assembly {
@@ -302,7 +302,7 @@ library RLP {
}
// 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)
return 0;
uint b0;
@@ -320,7 +320,7 @@ library RLP {
}
// 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;
assembly {
b0 := byte(0, mload(memPtr))
@@ -348,7 +348,7 @@ library RLP {
}
// 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))
throw;
uint b0;
@@ -376,7 +376,7 @@ library RLP {
}
// 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,
// we can write entire words, and just overwrite any excess.
assembly {
@@ -400,7 +400,7 @@ library RLP {
}
// 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.
uint b0;
uint b1;