Skip to content

Commit

Permalink
tx gasprice sysconfig support auth (#825)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenlinlee authored Feb 5, 2024
1 parent d10504e commit b24e47e
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
7 changes: 7 additions & 0 deletions src/main/java/console/auth/AuthImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import console.ConsoleInitializer;
import console.common.ConsoleUtils;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.List;
Expand All @@ -22,6 +23,7 @@
import org.fisco.bcos.sdk.v3.transaction.codec.decode.ReceiptParser;
import org.fisco.bcos.sdk.v3.transaction.model.exception.ContractException;
import org.fisco.bcos.sdk.v3.transaction.model.exception.TransactionException;
import org.fisco.bcos.sdk.v3.transaction.tools.Convert;
import org.fisco.bcos.sdk.v3.utils.AddressUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
Expand Down Expand Up @@ -222,6 +224,11 @@ public void createSetSysConfigProposal(ConsoleInitializer consoleInitializer, St
throws Exception {
String key = params[1];
String value = params[2];
if (params.length > 3 && key.equals(SystemConfigService.TX_GAS_PRICE)) {
Convert.Unit unit = Convert.Unit.fromString(params[3]);
BigDecimal weiValue = Convert.toWei(value, unit);
value = weiValue.toBigIntegerExact().toString();
}

BigInteger proposalId = authManager.createSetSysConfigProposal(key, value);
System.out.println("Set system config proposal created, ID is: " + proposalId);
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/console/command/category/AuthOpCommand.java
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,7 @@ public Map<String, CommandInfo> getAllCommandInfo(boolean isWasm) {
.getAuthFace()
.createSetSysConfigProposal(consoleInitializer, params),
2,
2,
3,
false,
false,
true);
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/console/precompiled/PrecompiledImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -124,9 +124,7 @@ public void setSystemConfigByKey(ConsoleInitializer consoleInitializer, String[]
if (params.length > 3 && key.equals(SystemConfigService.TX_GAS_PRICE)) {
Convert.Unit unit = Convert.Unit.fromString(params[3]);
BigDecimal weiValue = Convert.toWei(value, unit);
System.out.println("weiValue: " + weiValue);
value = weiValue.toBigIntegerExact().toString();
System.out.println("value: " + value);
}
RetCode retCode = this.systemConfigService.setValueByKey(key, value);
ConsoleUtils.printJson(retCode.toString());
Expand Down

0 comments on commit b24e47e

Please sign in to comment.