IssueCoin increases the central-bank supply.
(ctx contractapi.TransactionContextInterface, amount string)
| 91 | |
| 92 | // IssueCoin increases the central-bank supply. |
| 93 | func (s *SmartContract) IssueCoin(ctx contractapi.TransactionContextInterface, amount string) (*Transaction, error) { |
| 94 | value, err := parsePositiveAmount(amount) |
| 95 | if err != nil { |
| 96 | return nil, err |
| 97 | } |
| 98 | |
| 99 | centerBank, err := readCenterBank(ctx) |
| 100 | if err != nil { |
| 101 | return nil, err |
| 102 | } |
| 103 | centerBank.TotalNumber += value |
| 104 | centerBank.RestNumber += value |
| 105 | if err := putJSON(ctx, centerBankKey, centerBank); err != nil { |
| 106 | return nil, err |
| 107 | } |
| 108 | return recordTransaction(ctx, 0, 0, 0, 0, value) |
| 109 | } |
| 110 | |
| 111 | // IssueCoinToBank transfers issued currency from the central bank to a commercial bank. |
| 112 | func (s *SmartContract) IssueCoinToBank(ctx contractapi.TransactionContextInterface, bankID string, amount string) (*Transaction, error) { |
nothing calls this directly
no test coverage detected