You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardexpand all lines: docs/concepts/imports.md
+6-6
Original file line number
Diff line number
Diff line change
@@ -4,7 +4,7 @@ The simplest use-case for imports is wanting to call a function that is an `@exp
4
4
5
5
__NOTE:__`from x import y` and starred imports are not supported at this time. Importing a smart contract imports all of the `@export` functions from it and none of the variables.
6
6
7
-
complex_app.py
7
+
complex_app.py (Smart Contract)
8
8
```python
9
9
@export
10
10
defreturn_1():
@@ -19,7 +19,7 @@ def return_3():
19
19
return3
20
20
```
21
21
22
-
import_example.py
22
+
import_example.py (Smart Contract)
23
23
```python
24
24
import complex_app
25
25
@@ -43,7 +43,7 @@ To do this, we have to use the `importlib` in the Contracting standard library.
43
43
44
44
This function behaves similar to the analogous `importlib` function included in the Python standard library. Calling it will return a module object that has only the `@export` functions available to call and pass arguments to.
45
45
46
-
token_1.py
46
+
token_1.py (Smart Contract)
47
47
```python
48
48
balances = Hash()
49
49
@construct
@@ -58,7 +58,7 @@ def send(amount, to):
58
58
balances[to] += amount
59
59
```
60
60
61
-
token_2.py
61
+
token_2.py (Smart Contract)
62
62
```python
63
63
balances = Hash()
64
64
@construct
@@ -73,7 +73,7 @@ def send(amount, to):
73
73
balances[to] += amount
74
74
```
75
75
76
-
exchange.py
76
+
exchange.py (Smart Contract)
77
77
```python
78
78
@export
79
79
defsend(token, amount, to):
@@ -87,7 +87,7 @@ Luckily, both contracts have the same interface and have a function called `send
87
87
88
88
A smart contract can define an interface to enforce contracts against. Enforcement can be on the functions and/or the variables. Enforcement is 'weak' in the sense that a contract can have additional functions or variables and still succeed an interface test.
0 commit comments