Update basics.md

This commit is contained in:
Jacques Wagener 2019-11-07 11:59:46 +02:00 committed by GitHub
parent bb2177c071
commit e45a672739
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 16 additions and 0 deletions

View File

@ -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()`.