aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Beregszaszi <alex@rtfs.hu>2017-02-12 23:21:32 +0800
committerAlex Beregszaszi <alex@rtfs.hu>2017-03-18 01:06:51 +0800
commit3f1468142badd2717596a4cd78f6f347b78010d7 (patch)
tree67c7fc5daa24a7ff803e7a1b99088694f63de2a2
parentcfab70fd89e98f9301838682b28b9e400e1b2632 (diff)
downloaddexon-solidity-3f1468142badd2717596a4cd78f6f347b78010d7.tar.gz
dexon-solidity-3f1468142badd2717596a4cd78f6f347b78010d7.tar.zst
dexon-solidity-3f1468142badd2717596a4cd78f6f347b78010d7.zip
Document interfaces
-rw-r--r--docs/contracts.rst27
1 files changed, 27 insertions, 0 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 2ee04675..33627b92 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -922,6 +922,33 @@ Such contracts cannot be compiled (even if they contain implemented functions al
If a contract inherits from an abstract contract and does not implement all non-implemented functions by overriding, it will itself be abstract.
+.. index:: ! contract;interface, ! interface contract
+
+**********
+Interfaces
+**********
+
+Interfaces are similar to abstract contracts, but they cannot have any functions implemented. There are further restrictions:
+
+#. Cannot inherit other contracts or interfaces.
+#. Cannot define variables.
+#. Cannot define structs.
+
+Some of these restrictions might be lifted in the future.
+
+Interfaces are basically limited to what the Contract ABI can represent and the conversion between the ABI and
+an Interface should be possible without any information loss.
+
+Interfaces are denoted by their own keyword:
+
+::
+
+ interface Token {
+ function transfer(address recipient, uint amount);
+ }
+
+Contracts can inherit interfaces as they would inherit other contracts.
+
.. index:: ! library, callcode, delegatecall
.. _libraries: