From 8968b7aee747e1ea03efa3d53b8f5489c5dc2864 Mon Sep 17 00:00:00 2001 From: leej1012 Date: Fri, 31 May 2024 15:02:08 +0800 Subject: [PATCH] Update node info --- .../github/ontio/model/dto/NodeManagementDto.java | 2 ++ .../ontio/service/impl/NodesServiceImpl.java | 8 ++++++++ .../java/com/github/ontio/util/ConstantParam.java | 15 ++++----------- .../com/github/ontio/util/OntologySDKService.java | 5 +++++ 4 files changed, 19 insertions(+), 11 deletions(-) diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeManagementDto.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeManagementDto.java index 3ced8613..74637220 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeManagementDto.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/model/dto/NodeManagementDto.java @@ -36,6 +36,8 @@ public class NodeManagementDto { private String cap = "0"; + private String reward = "0"; + private String withdrawableAmount; private String lockedAmount; diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java index 8cc76586..cf6e3699 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/service/impl/NodesServiceImpl.java @@ -39,6 +39,7 @@ import org.springframework.util.StringUtils; import java.math.BigDecimal; +import java.math.RoundingMode; import java.util.*; import java.util.stream.Collectors; @@ -1065,6 +1066,13 @@ public ResponseBean getNodeOnChainConfig(String address, String publicKey) { long promisePos = sdk.getPromisePos(publicKey); nodeManagementDto.setPromiseStake(String.valueOf(promisePos)); + String splitFeeStr = sdk.getSplitFee(address); + if (StringUtils.hasLength(splitFeeStr)) { + JSONObject splitFee = JSONObject.parseObject(splitFeeStr); + String reward = splitFee.getBigDecimal("amount").divide(ConstantParam.NINE_BIT_DECIMAL, 9, RoundingMode.DOWN).stripTrailingZeros().toPlainString(); + nodeManagementDto.setReward(reward); + } + String attributesStr = sdk.getAttributes(publicKey); if (StringUtils.hasLength(attributesStr)) { JSONObject attributes = JSONObject.parseObject(attributesStr); diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/util/ConstantParam.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/util/ConstantParam.java index 3abab4c5..469b7ee9 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/util/ConstantParam.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/util/ConstantParam.java @@ -54,25 +54,18 @@ public class ConstantParam { public static final String OEP8_PUMPKIN_PREFIX = "pumpkin"; - public static final BigDecimal ZERO = BigDecimal.ZERO; + public static final BigDecimal NINE_BIT_DECIMAL = new BigDecimal("1000000000"); - public static final BigDecimal ONG_SECONDMAKE = new BigDecimal("5"); - - - public static final BigDecimal ONT_TOTAL = new BigDecimal("1000000000"); + public static final BigDecimal ONT_TOTAL = NINE_BIT_DECIMAL; - public static final BigDecimal ONG_TOTAL = ONT_TOTAL; + public static final BigDecimal ONG_TOTAL = NINE_BIT_DECIMAL; - public static final BigDecimal NEW_ONT_DECIMAL = ONT_TOTAL; + public static final BigDecimal NEW_ONT_DECIMAL = NINE_BIT_DECIMAL; public static final BigDecimal NEW_ONG_DECIMAL = new BigDecimal("1000000000000000000"); - - public static final String GO_TOTALSUPPLY_URL = "/getAssetHolder"; - - public static final List SPECIALADDRLIST = Arrays.asList( //团队锁仓地址 "AKac3Bd6usdivrnNN8tyRcDZN94vpaoAu2", diff --git a/back-end-projects/Explorer/src/main/java/com/github/ontio/util/OntologySDKService.java b/back-end-projects/Explorer/src/main/java/com/github/ontio/util/OntologySDKService.java index 18b49cf3..2e64033d 100644 --- a/back-end-projects/Explorer/src/main/java/com/github/ontio/util/OntologySDKService.java +++ b/back-end-projects/Explorer/src/main/java/com/github/ontio/util/OntologySDKService.java @@ -666,6 +666,11 @@ public long getPromisePos(String publicKey) { return 0; } + public String getSplitFee(String address) throws Exception { + OntSdk ontSdk = getOntSdk(); + return ontSdk.nativevm().governance().getSplitFeeAddress(address); + } + public int getPreConsensusCount() { try { Configuration preConfiguration = getPreConfiguration();