MCPcopy Create free account
hub / github.com/DNAProject/DNA / init

Function init

wasmtest/contracts-cplus/test_oep4.py:86–107  ·  view source on GitHub ↗

initialize the contract, put some important info into the storage in the blockchain :return:

()

Source from the content-addressed store, hash-verified

84 return False
85
86def init():
87 """
88 initialize the contract, put some important info into the storage in the blockchain
89 :return:
90 """
91
92 if len(OWNER) != 20:
93 Notify(["Owner illegal!"])
94 return False
95 if Get(ctx,SUPPLY_KEY):
96 Notify("Already initialized!")
97 return False
98 else:
99 total = TOTAL_AMOUNT
100 Put(ctx,SUPPLY_KEY,total)
101 Put(ctx,concat(BALANCE_PREFIX,OWNER),total)
102
103 # Notify(["transfer", "", Base58ToAddress(OWNER), total])
104 # ownerBase58 = AddressToBase58(OWNER)
105 TransferEvent("", OWNER, total)
106
107 return True
108
109
110def name():

Callers 1

MainFunction · 0.70

Calls 1

NotifyFunction · 0.85

Tested by

no test coverage detected