-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathfunction.vy
More file actions
56 lines (42 loc) · 823 Bytes
/
function.vy
File metadata and controls
56 lines (42 loc) · 823 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# @version 0.3.9
num1: public(uint256)
num2: public(uint256)
@view
@internal
def _internal_view_function() -> uint256:
return 99
@view
@external
def external_view_function() -> uint256:
return self.num1
@view
@external
def view_internal_function() -> uint256:
return self._internal_view_function()
@pure
@external
def external_pure_function() -> uint256:
return 100
@internal
def _internal_function(_new_num: uint256):
self.num2 = _new_num
@external
def call_internal_function(_new_num: uint256):
self._internal_function(_new_num)
@external
def call_internal_view_function():
self.num2 = self._internal_view_function()
# payable 类型
@payable
@external
def receipt_eth():
pass
@payable
@external
def __default__():
pass
# 防重入
@nonreentrant("lock")
@external
def sensitive_function():
pass