mirror of
https://github.com/hyperledger/fabric-samples.git
synced 2026-06-17 15:35:09 +00:00
Rename token-account-based Directory to token-erc-20
FAB-18275 Signed-off-by: Julian Castrence <juliancastrence@ibm.com>
This commit is contained in:
parent
d3bc97fae2
commit
1829666e3a
15 changed files with 12 additions and 12 deletions
|
|
@ -41,7 +41,7 @@ Additional samples demonstrate various Fabric use cases and application patterns
|
|||
| -------------|------------------------------|------------------|
|
||||
| [Commercial paper](commercial-paper) | Explore a use case and detailed application development tutorial in which two organizations use a blockchain network to trade commercial paper. | [Commercial paper tutorial](https://hyperledger-fabric.readthedocs.io/en/latest/tutorial/commercial_paper.html) |
|
||||
| [Off chain data](off_chain_data) | Learn how to use the Peer channel-based event services to build an off-chain database for reporting and analytics. | [Peer channel-based event services](https://hyperledger-fabric.readthedocs.io/en/latest/peer_event_services.html) |
|
||||
| [Token account-based](token-account-based) | Smart contract demonstrating how to create and transfer fungible tokens using an account-based model. | [README](token-account-based/README.md) |
|
||||
| [Token ERC-20](token-erc-20) | Smart contract demonstrating how to create and transfer fungible tokens using an account-based model. | [README](token-erc-20/README.md) |
|
||||
| [Token UTXO](token-utxo) | Smart contract demonstrating how to create and transfer fungible tokens using a UTXO (unspent transaction output) model. | [README](token-utxo/README.md) |
|
||||
| [High throughput](high-throughput) | Learn how you can design your smart contract to avoid transaction collisions in high volume environments. | [README](high-throughput/README.md) |
|
||||
| [Chaincode](chaincode) | A set of other sample smart contracts, many of which were used in tutorials prior to the asset transfer sample series. | |
|
||||
|
|
|
|||
|
|
@ -1,5 +0,0 @@
|
|||
module github.com/hyperledger/fabric-samples/token-account-based/chaincode-go
|
||||
|
||||
go 1.14
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.1.0
|
||||
|
|
@ -33,12 +33,12 @@ You can use the test network script to deploy the account-based token contract t
|
|||
|
||||
**For a Go Contract:**
|
||||
```
|
||||
./network.sh deployCC -ccn token_account -ccp ../token-account-based/chaincode-go/
|
||||
./network.sh deployCC -ccn token_account -ccp ../token-erc-20/chaincode-go/
|
||||
```
|
||||
|
||||
**For a JavaScript Contract:**
|
||||
```
|
||||
./network.sh deployCC -ccn token_account -ccp ../token-account-based/chaincode-javascript/ -ccl javascript
|
||||
./network.sh deployCC -ccn token_account -ccp ../token-erc-20/chaincode-javascript/ -ccl javascript
|
||||
```
|
||||
|
||||
The above command deploys the go chaincode with short name `token_account`. The smart contract will use the default endorsement policy of majority of channel members.
|
||||
|
|
@ -311,7 +311,7 @@ func (s *SmartContract) TransferFrom(ctx contractapi.TransactionContextInterface
|
|||
// Dependant functions include Transfer and TransferFrom.
|
||||
func transferHelper(ctx contractapi.TransactionContextInterface, from string, to string, value int) error {
|
||||
|
||||
if value < 0 { // transfer of 0 is allowed in ERC20, so just validate against negative amounts
|
||||
if value < 0 { // transfer of 0 is allowed in ERC-20, so just validate against negative amounts
|
||||
return fmt.Errorf("transfer amount cannot be negative")
|
||||
}
|
||||
|
||||
5
token-erc-20/chaincode-go/go.mod
Normal file
5
token-erc-20/chaincode-go/go.mod
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
module github.com/hyperledger/fabric-samples/token-erc-20/chaincode-go
|
||||
|
||||
go 1.14
|
||||
|
||||
require github.com/hyperledger/fabric-contract-api-go v1.1.0
|
||||
|
|
@ -8,16 +8,16 @@ import (
|
|||
"log"
|
||||
|
||||
"github.com/hyperledger/fabric-contract-api-go/contractapi"
|
||||
"github.com/hyperledger/fabric-samples/token-account-based/chaincode-go/chaincode"
|
||||
"github.com/hyperledger/fabric-samples/token-erc-20/chaincode-go/chaincode"
|
||||
)
|
||||
|
||||
func main() {
|
||||
tokenChaincode, err := contractapi.NewChaincode(&chaincode.SmartContract{})
|
||||
if err != nil {
|
||||
log.Panicf("Error creating token-account-based chaincode: %v", err)
|
||||
log.Panicf("Error creating token-erc-20 chaincode: %v", err)
|
||||
}
|
||||
|
||||
if err := tokenChaincode.Start(); err != nil {
|
||||
log.Panicf("Error starting token-account-based chaincode: %v", err)
|
||||
log.Panicf("Error starting token-erc-20 chaincode: %v", err)
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue