From e45a67273976f70ee5a3a0385abbf330cec26c87 Mon Sep 17 00:00:00 2001 From: Jacques Wagener Date: Thu, 7 Nov 2019 11:59:46 +0200 Subject: [PATCH] Update basics.md --- docs/basics.md | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/docs/basics.md b/docs/basics.md index b97a360..436bd57 100644 --- a/docs/basics.md +++ b/docs/basics.md @@ -89,3 +89,19 @@ contract("Registry"): proc get_name*(k: bytes32): bytes32 {.self.} = self.names[k] ``` + +# Default / Fallback Function + +To define a Fallback function, add function to your contract named `default`. + +```nim + +contract("Default"): + proc default*() = + rever(nil, 0) + # execute on all transactions +``` + +If no Fallback is declared the fallback function causes a `revert()`. + +