Signed-off-by: Renjith K N <renjith@gmail.com>

ERC20 token review fix

Signed-off-by: renjithkn@gmail.com <renjithkn@gmail.com>
This commit is contained in:
renjithkn@gmail.com 2022-02-01 06:22:14 +00:00
parent 0af0a83b3f
commit 1b72161da2
3 changed files with 11 additions and 11 deletions

View file

@ -1,6 +1,7 @@
/*
* SPDX-License-Identifier: Apache-2.0
*/
package org.example;
import org.hyperledger.fabric.contract.Context;
@ -35,7 +36,7 @@ public final class TokenERC20Contract implements ContractInterface {
/**
* @Desc Return the name of the token - e.g. "MyToken". The original function name is `name` in
* @Desc: Return the name of the token - e.g. "MyToken". The original function name is `name` in
* ERC20 specification. However, 'name' conflicts with a parameter `name` in `Contract` class. As
* a work around, we use `TokenName` as an alternative function name.
* @param ctx the transaction context
@ -189,6 +190,14 @@ public final class TokenERC20Contract implements ContractInterface {
}
/**
*
* @param ctx
* @param _from
* @param _to
* @param _value
*/
private void doTransfer(final Context ctx, final String _from, final String _to, long _value) {
if (_from.equalsIgnoreCase(_to)) {

View file

@ -7,7 +7,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
//import org.hyperledger.fabric.samples.fabcar.TestUtil;
import org.hyperledger.fabric.protos.msp.Identities.SerializedIdentity;
import org.hyperledger.fabric.protos.peer.ChaincodeEventPackage;

View file

@ -299,15 +299,7 @@ public class TokenERC20ContractTest {
@Test
public void allowanceTransferFromTest() throws Exception {
/*
* ChaincodeStub localStub = new ChaincodeStubNaiveImpl(); ((ChaincodeStubNaiveImpl)
* localStub).setCertificate(ChaincodeStubNaiveImpl.CERT_WITH_DNS); Context localCtx =
* mock(Context.class); ClientIdentity localidentity = new ClientIdentity(localStub);
* when(localCtx.getClientIdentity()).thenReturn(localidentity);
* when(localCtx.getStub()).thenReturn(localStub);
*/
String spender = "x509::CN=User1@org2.example.com, L=San Francisco, ST=California,"
String spender = "x509::CN=User1@org2.example.com, L=San Francisco, ST=California,"
+ " C=US::CN=ca.org2.example.com, O=org2.example.com, L=San Francisco, ST=California, C=US";
contract.approve(ctx, spender, "200");