mirror of https://github.com/status-im/nimplay.git
Update basics.md
This commit is contained in:
parent
bb2177c071
commit
e45a672739
|
@ -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()`.
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue