mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Merge pull request #4500 from ethereum/v050-interface-functions-must-be-external
[BREAKING] interface functions must be external
This commit is contained in:
+2
-1
@@ -1150,6 +1150,7 @@ Interfaces
|
||||
Interfaces are similar to abstract contracts, but they cannot have any functions implemented. There are further restrictions:
|
||||
|
||||
- Cannot inherit other contracts or interfaces.
|
||||
- All declared functions must be external.
|
||||
- Cannot define constructor.
|
||||
- Cannot define variables.
|
||||
- Cannot define structs.
|
||||
@@ -1167,7 +1168,7 @@ Interfaces are denoted by their own keyword:
|
||||
pragma solidity ^0.4.11;
|
||||
|
||||
interface Token {
|
||||
function transfer(address recipient, uint amount) public;
|
||||
function transfer(address recipient, uint amount) external;
|
||||
}
|
||||
|
||||
Contracts can inherit interfaces as they would inherit other contracts.
|
||||
|
||||
@@ -203,7 +203,7 @@ Now someone tricks you into sending ether to the address of this attack wallet:
|
||||
pragma solidity >0.4.24;
|
||||
|
||||
interface TxUserWallet {
|
||||
function transferTo(address dest, uint amount) public;
|
||||
function transferTo(address dest, uint amount) external;
|
||||
}
|
||||
|
||||
contract TxAttackWallet {
|
||||
|
||||
Reference in New Issue
Block a user