InitLedger creates the central bank and its initial issued balance.
(ctx contractapi.TransactionContextInterface, name string, total string)
| 51 | |
| 52 | // InitLedger creates the central bank and its initial issued balance. |
| 53 | func (s *SmartContract) InitLedger(ctx contractapi.TransactionContextInterface, name string, total string) (*CenterBank, error) { |
| 54 | amount, err := parsePositiveAmount(total) |
| 55 | if err != nil { |
| 56 | return nil, err |
| 57 | } |
| 58 | |
| 59 | centerBank := &CenterBank{Name: name, TotalNumber: amount, RestNumber: amount} |
| 60 | if err := putJSON(ctx, centerBankKey, centerBank); err != nil { |
| 61 | return nil, err |
| 62 | } |
| 63 | return centerBank, nil |
| 64 | } |
| 65 | |
| 66 | // CreateBank registers a commercial bank. |
| 67 | func (s *SmartContract) CreateBank(ctx contractapi.TransactionContextInterface, name string) (*Bank, error) { |
nothing calls this directly
no test coverage detected