CreateBank registers a commercial bank.
(ctx contractapi.TransactionContextInterface, name string)
| 65 | |
| 66 | // CreateBank registers a commercial bank. |
| 67 | func (s *SmartContract) CreateBank(ctx contractapi.TransactionContextInterface, name string) (*Bank, error) { |
| 68 | id, err := nextID(ctx, bankCounterKey) |
| 69 | if err != nil { |
| 70 | return nil, err |
| 71 | } |
| 72 | bank := &Bank{ID: id, Name: name} |
| 73 | if err := putJSON(ctx, bankKey(id), bank); err != nil { |
| 74 | return nil, err |
| 75 | } |
| 76 | return bank, nil |
| 77 | } |
| 78 | |
| 79 | // CreateCompany registers a company. |
| 80 | func (s *SmartContract) CreateCompany(ctx contractapi.TransactionContextInterface, name string) (*Company, error) { |