initialize the contract, put some important info into the storage in the blockchain :return:
()
| 84 | return False |
| 85 | |
| 86 | def 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 | |
| 110 | def name(): |