-
Notifications
You must be signed in to change notification settings - Fork 1
/
Core_NASC.py
36 lines (32 loc) · 1.2 KB
/
Core_NASC.py
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
from boa.blockchain.vm.Neo.TriggerType import Application, Verification
from boa.blockchain.vm.Neo.Runtime import Notify, GetTrigger, CheckWitness
from boa.blockchain.vm.Neo.App import DynamicAppCall
from nas.wrappers.storage import Storage
from boa.blockchain.vm.Neo.Runtime import Notify
from nas.configuration.Administration import AdminConfiguration
from core_nas.configuration import init
def Main(operation, args):
"""
:Entry point of Core_NA SmartContract:
"""
trigger = GetTrigger()
if trigger == Verification:
# check if the invoker is the owner of this contract
configuration = AdminConfiguration()
is_owner = CheckWitness(configuration.root_admin)
# If owner, proceed
if is_owner:
return True
return False
elif trigger == Application:
storage = Storage()
if operation == 'init':
initialized = storage.load("Core_NASC_initialized")
if not initialized:
return init()
root_na = storage.load("root_NA")
if root_na:
return DynamicAppCall(root_na, operation, args)
else:
Notify("DynamicAppCall failed.")
return False