mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Tests/Docs: changing type of msg.sender and tx.origin into address
And also making the type of address(literal) as non-payable address.
This commit is contained in:
@@ -114,7 +114,7 @@ to receive their money - contracts cannot activate themselves.
|
||||
// before `send` returns.
|
||||
pendingReturns[msg.sender] = 0;
|
||||
|
||||
if (!msg.sender.send(amount)) {
|
||||
if (!payable(msg.sender).send(amount)) {
|
||||
// No need to call throw here, just reset the amount owing
|
||||
pendingReturns[msg.sender] = amount;
|
||||
return false;
|
||||
@@ -280,7 +280,7 @@ invalid bids.
|
||||
// the same deposit.
|
||||
bidToCheck.blindedBid = bytes32(0);
|
||||
}
|
||||
msg.sender.transfer(refund);
|
||||
payable(msg.sender).transfer(refund);
|
||||
}
|
||||
|
||||
/// Withdraw a bid that was overbid.
|
||||
@@ -293,7 +293,7 @@ invalid bids.
|
||||
// conditions -> effects -> interaction).
|
||||
pendingReturns[msg.sender] = 0;
|
||||
|
||||
msg.sender.transfer(amount);
|
||||
payable(msg.sender).transfer(amount);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,13 +159,13 @@ The full contract
|
||||
|
||||
require(recoverSigner(message, signature) == owner);
|
||||
|
||||
msg.sender.transfer(amount);
|
||||
payable(msg.sender).transfer(amount);
|
||||
}
|
||||
|
||||
/// destroy the contract and reclaim the leftover funds.
|
||||
function shutdown() public {
|
||||
require(msg.sender == owner);
|
||||
selfdestruct(msg.sender);
|
||||
selfdestruct(payable(msg.sender));
|
||||
}
|
||||
|
||||
/// signature methods.
|
||||
@@ -347,7 +347,7 @@ The full contract
|
||||
constructor (address payable _recipient, uint256 duration)
|
||||
payable
|
||||
{
|
||||
sender = msg.sender;
|
||||
sender = payable(msg.sender);
|
||||
recipient = _recipient;
|
||||
expiration = block.timestamp + duration;
|
||||
}
|
||||
|
||||
@@ -74,7 +74,7 @@ you can use state machine-like constructs inside a contract.
|
||||
// Division will truncate if it is an odd number.
|
||||
// Check via multiplication that it wasn't an odd number.
|
||||
constructor() payable {
|
||||
seller = msg.sender;
|
||||
seller = payable(msg.sender);
|
||||
value = msg.value / 2;
|
||||
require((2 * value) == msg.value, "Value has to be even.");
|
||||
}
|
||||
@@ -107,7 +107,7 @@ you can use state machine-like constructs inside a contract.
|
||||
payable
|
||||
{
|
||||
emit PurchaseConfirmed();
|
||||
buyer = msg.sender;
|
||||
buyer = payable(msg.sender);
|
||||
state = State.Locked;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user