From a41576fc2613f0af15fd620b4fa630f63e7a6943 Mon Sep 17 00:00:00 2001 From: Gaith Hallak Date: Fri, 11 Nov 2022 20:56:42 +0300 Subject: [PATCH] Update docs --- docs/sophia_features.md | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/docs/sophia_features.md b/docs/sophia_features.md index 68ac6fa..973dc22 100644 --- a/docs/sophia_features.md +++ b/docs/sophia_features.md @@ -191,6 +191,17 @@ contract interface X : Z = entrypoint z() = 1 ``` +#### Adding or removing modifiers + +When a `contract` or a `contract interface` implements another `contract interface`, the `payable` and `stateful` modifiers can be kept or changed, both in the contract and in the entrypoints, according to the following rules: + +1. A `payable` contract or interface can implement a `payable` interface or a non-`payable` interface. +2. A non-`payable` contract or interface can only implement a non-`payable` interface, and cannot implement a `payable` interface. +3. A `payable` entrypoint can implement a `payable` entrypoint or a non-`payable` entrypoint. +4. A non-`payable` entrypoint can only implement a non-`payable` entrypoint, and cannot implement a `payable` entrypoint. +5. A non-`stateful` entrypoint can implement a `stateful` entrypoint or a non-`stateful` entrypoint. +6. A `stateful` entrypoint can only implement a `stateful` entrypoint, and cannot implement a non-`stateful` entrypoint. + #### Subtyping and variance Subtyping in Sophia follows common rules that take type variance into account. As described by [Wikipedia](https://en.wikipedia.org/wiki/Covariance_and_contravariance_(computer_science)),