Skip to content

Commit

Permalink
rename transferFrom to transferBalance
Browse files Browse the repository at this point in the history
  • Loading branch information
wenlinlee committed Jan 10, 2024
1 parent 79f3083 commit 1ed2959
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 10 deletions.
6 changes: 3 additions & 3 deletions src/main/java/console/command/category/BalanceOpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -41,11 +41,11 @@ public class BalanceOpCommand extends BasicCategoryCommand {

public static final CommandInfo TRANSFER_FROM =
new CommandInfo(
"transferFrom",
"transferBalance",
"Transfer balance from one account to another",
HelpInfo::transferFromHelp,
HelpInfo::transferBalanceHelp,
(consoleInitializer, params, pwd) ->
consoleInitializer.getPrecompiledFace().transferFrom(params),
consoleInitializer.getPrecompiledFace().transferBalance(params),
3,
3);
public static final CommandInfo REGISTER_CALLER =
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/console/command/model/HelpInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -487,9 +487,9 @@ public static void subBalanceHelp() {
System.out.println("* amount -- The amount of token to sub.");
}

public static void transferFromHelp() {
public static void transferBalanceHelp() {
System.out.println("Transfer token from address A to address B");
System.out.println("Usage: \ntransferFrom fromAddress toAddress amount [unit]");
System.out.println("Usage: \ntransferBalance fromAddress toAddress amount");
System.out.println("* fromAddress -- The address of the sender.");
System.out.println("* toAddress -- The address of the receiver.");
System.out.println("* amount -- The amount of token to transfer.");
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/console/precompiled/PrecompiledFace.java
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ void setSystemConfigByKey(ConsoleInitializer consoleInitializer, String[] params

void subBalance(String[] params) throws Exception;

void transferFrom(String[] params) throws Exception;
void transferBalance(String[] params) throws Exception;

void registerBalancePrecompiledCaller(String[] params) throws Exception;

Expand Down
7 changes: 3 additions & 4 deletions src/main/java/console/precompiled/PrecompiledImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ public void subBalance(String[] params) throws Exception {
}
}

public void transferFrom(String[] params) throws Exception {
public void transferBalance(String[] params) throws Exception {

Check notice

Code scanning / CodeQL

Missing Override annotation Note

This method overrides
PrecompiledFace.transferBalance
; it is advisable to add an Override annotation.
String from = params[1];
String to = params[2];
BigInteger amount =
Expand All @@ -801,10 +801,9 @@ public void transferFrom(String[] params) throws Exception {
logger.info("transferFrom: {}, retCode {}", from, retCode);
// parse the result
if (retCode == PrecompiledRetCode.CODE_SUCCESS) {
System.out.println(
"transferFrom " + from + " success. You can use 'getBalance' to check");
System.out.println("transferBalance success. You can use getBalance to check");
} else {
System.out.println("transferFrom " + from + " failed ");
System.out.println("transferBalance failed." + retCode.getMessage());
ConsoleUtils.printJson(retCode.toString());
}
}
Expand Down

0 comments on commit 1ed2959

Please sign in to comment.