Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tx gasprice sysconfig support auth #825

Merged
merged 3 commits into from
Feb 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading