Skip to content

Commit e17ee77

Browse files
authored
Merge pull request #250 from ekpyron/addressPayable
Change ``address`` to ``address payable`` where needed.
2 parents 495ca2d + 70136c5 commit e17ee77

File tree

3 files changed

+27
-25
lines changed

3 files changed

+27
-25
lines changed

test/DAO/DAO.sol

Lines changed: 21 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ contract DAOInterface {
5353
uint public lastTimeMinQuorumMet;
5454

5555
// Address of the curator
56-
address public curator;
56+
address payable public curator;
5757
// The whitelist: List of addresses the DAO is allowed to send ether to
5858
mapping (address => bool) public allowedRecipients;
5959

@@ -100,7 +100,7 @@ contract DAOInterface {
100100
// The address where the `amount` will go to if the proposal is accepted
101101
// or if `newCurator` is true, the proposed Curator of
102102
// the new DAO).
103-
address recipient;
103+
address payable recipient;
104104
// The amount to transfer to `recipient` if the proposal is accepted.
105105
uint amount;
106106
// A plain text description of the proposal
@@ -130,7 +130,7 @@ contract DAOInterface {
130130
// Simple mapping to check if a shareholder has voted against it
131131
mapping (address => bool) votedNo;
132132
// Address of the shareholder who created the proposal
133-
address creator;
133+
address payable creator;
134134
}
135135

136136
// Used only in the case of a newCurator proposal.
@@ -162,7 +162,7 @@ contract DAOInterface {
162162
/// counted from.
163163
// This is the constructor: it can not be overloaded so it is commented out
164164
// function DAO(
165-
// address _curator,
165+
// address payable _curator,
166166
// DAO_Creator _daoCreator,
167167
// uint _proposalDeposit,
168168
// uint _minTokensToCreate,
@@ -174,7 +174,7 @@ contract DAOInterface {
174174
// );
175175

176176
/// @notice Create Token with `msg.sender` as the beneficiary
177-
function () external;
177+
function () external payable;
178178

179179

180180
/// @dev This function is used to send ether back
@@ -197,7 +197,7 @@ contract DAOInterface {
197197
/// a new Curator or not
198198
/// @return The proposal ID. Needed for voting on the proposal
199199
function newProposal(
200-
address _recipient,
200+
address payable _recipient,
201201
uint _amount,
202202
string memory _description,
203203
bytes memory _transactionData,
@@ -215,7 +215,7 @@ contract DAOInterface {
215215
/// @return Whether the proposal ID matches the transaction data or not
216216
function checkProposalCode(
217217
uint _proposalID,
218-
address _recipient,
218+
address payable _recipient,
219219
uint _amount,
220220
bytes memory _transactionData
221221
) public view returns (bool _codeChecksOut);
@@ -253,14 +253,14 @@ contract DAOInterface {
253253
/// of the sender.
254254
function splitDAO(
255255
uint _proposalID,
256-
address _newCurator
256+
address payable _newCurator
257257
) public returns (bool _success);
258258

259259
/// @dev can only be called by the DAO itself through a proposal
260260
/// updates the contract of the DAO by sending all ether and rewardTokens
261261
/// to the new DAO. The new DAO needs to be approved by the Curator
262262
/// @param _newContract the address of the new contract
263-
function newContract(address _newContract) public;
263+
function newContract(address payable _newContract) public;
264264

265265

266266
/// @notice Add a new possible recipient `_recipient` to the whitelist so
@@ -290,7 +290,7 @@ contract DAOInterface {
290290
/// @notice Withdraw `_account`'s portion of the reward from `rewardAccount`
291291
/// to `_account`'s balance
292292
/// @return Whether the call was successful
293-
function withdrawRewardFor(address _account) internal returns (bool _success);
293+
function withdrawRewardFor(address payable _account) internal returns (bool _success);
294294

295295
/// @notice Send `_amount` tokens to `_to` from `msg.sender`. Prior to this
296296
/// getMyReward() is called.
@@ -306,7 +306,7 @@ contract DAOInterface {
306306
/// @param _amount The amount of tokens to be transfered
307307
/// @return Whether the transfer was successful or not
308308
function transferFromWithoutReward(
309-
address _from,
309+
address payable _from,
310310
address _to,
311311
uint256 _amount
312312
) public returns (bool success);
@@ -355,7 +355,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
355355
}
356356

357357
constructor(
358-
address _curator,
358+
address payable _curator,
359359
DAO_Creator _daoCreator,
360360
uint _proposalDeposit,
361361
uint _minTokensToCreate,
@@ -389,7 +389,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
389389
allowedRecipients[curator] = true;
390390
}
391391

392-
function () external {
392+
function () external payable {
393393
if (now < closingTime + creationGracePeriod && msg.sender != address(extraBalance))
394394
createTokenProxy(msg.sender);
395395
else
@@ -403,7 +403,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
403403

404404

405405
function newProposal(
406-
address _recipient,
406+
address payable _recipient,
407407
uint _amount,
408408
string memory _description,
409409
bytes memory _transactionData,
@@ -476,7 +476,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
476476

477477
function checkProposalCode(
478478
uint _proposalID,
479-
address _recipient,
479+
address payable _recipient,
480480
uint _amount,
481481
bytes memory _transactionData
482482
) public view returns (bool _codeChecksOut) {
@@ -621,7 +621,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
621621

622622
function splitDAO(
623623
uint _proposalID,
624-
address _newCurator
624+
address payable _newCurator
625625
) onlyTokenholders public returns (bool _success) {
626626

627627
Proposal storage p = proposals[_proposalID];
@@ -694,7 +694,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
694694
return true;
695695
}
696696

697-
function newContract(address _newContract) public {
697+
function newContract(address payable _newContract) public {
698698
if (msg.sender != address(this) || !allowedRecipients[_newContract]) return;
699699
// move all ether
700700
(bool success,) = _newContract.call.value(address(this).balance)("");
@@ -740,7 +740,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
740740
}
741741

742742

743-
function withdrawRewardFor(address _account) noEther internal returns (bool _success) {
743+
function withdrawRewardFor(address payable _account) noEther internal returns (bool _success) {
744744
if ((balanceOf(_account) * rewardAccount.accumulatedInput()) / totalSupply < paidOut[_account])
745745
revert();
746746

@@ -794,7 +794,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
794794

795795

796796
function transferFromWithoutReward(
797-
address _from,
797+
address payable _from,
798798
address _to,
799799
uint256 _value
800800
) public returns (bool success) {
@@ -878,7 +878,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
878878
}
879879
}
880880

881-
function createNewDAO(address _newCurator) internal returns (DAO _newDAO) {
881+
function createNewDAO(address payable _newCurator) internal returns (DAO _newDAO) {
882882
emit NewCurator(_newCurator);
883883
return daoCreator.createDAO(
884884
_newCurator,
@@ -919,7 +919,7 @@ contract DAO is DAOInterface, Token, TokenCreation {
919919

920920
contract DAO_Creator {
921921
function createDAO(
922-
address _curator,
922+
address payable _curator,
923923
uint _proposalDeposit,
924924
uint _minTokensToCreate,
925925
uint _closingTime,

test/DAO/ManagedAccount.sol

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ contract ManagedAccountInterface {
3333
/// @param _amount The amount of wei to send to `_recipient`
3434
/// @param _recipient The address to receive `_amount` of wei
3535
/// @return True if the send completed
36-
function payOut(address _recipient, uint _amount) public returns (bool);
36+
function payOut(address payable _recipient, uint _amount) public returns (bool);
3737

3838
event PayOut(address indexed _recipient, uint _amount);
3939
}
@@ -54,7 +54,7 @@ contract ManagedAccount is ManagedAccountInterface{
5454
accumulatedInput += msg.value;
5555
}
5656

57-
function payOut(address _recipient, uint _amount) public returns (bool) {
57+
function payOut(address payable _recipient, uint _amount) public returns (bool) {
5858
if (msg.sender != owner || (payOwnerOnly && _recipient != owner))
5959
revert();
6060
(bool success,) = _recipient.call.value(_amount)("");

test/DAO/TokenCreation.sol

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ contract TokenCreationInterface {
6565
/// @notice Create Token with `_tokenHolder` as the initial owner of the Token
6666
/// @param _tokenHolder The address of the Tokens's recipient
6767
/// @return Whether the token creation was successful
68-
function createTokenProxy(address _tokenHolder) payable public returns (bool success);
68+
function createTokenProxy(address payable _tokenHolder) payable public returns (bool success);
6969

7070
/// @notice Refund `msg.sender` in the case the Token Creation did
7171
/// not reach its minimum fueling goal
@@ -100,7 +100,7 @@ contract TokenCreation is TokenCreationInterface, Token {
100100

101101
}
102102

103-
function createTokenProxy(address _tokenHolder) payable public returns (bool success) {
103+
function createTokenProxy(address payable _tokenHolder) payable public returns (bool success) {
104104
if (now < closingTime && msg.value > 0
105105
&& (privateCreation == 0x0000000000000000000000000000000000000000 || privateCreation == msg.sender)) {
106106

@@ -150,4 +150,6 @@ contract TokenCreation is TokenCreationInterface, Token {
150150
return 30;
151151
}
152152
}
153+
function() external payable {
154+
}
153155
}

0 commit comments

Comments
 (0)