Skip to content

Commit

Permalink
Update nodeInfo
Browse files Browse the repository at this point in the history
  • Loading branch information
leej1012 committed May 22, 2024
1 parent 28d7a09 commit 4cd9205
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,12 @@ public class NodeInfoOffChain {
@Transient
private String progress;

@Transient
private Long totalPos;

@Transient
private Long maxAuthorize;

@Transient
private String userApy;
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
public class NodeInfoOffChainDto extends NodeInfoOffChain {

@Builder
public NodeInfoOffChainDto(String publicKey, String name, String address, String ontId, Integer nodeType, String introduction, String logoUrl, String region, BigDecimal longitude, BigDecimal latitude, String ip, String website, String socialMedia, String telegram, String twitter, String facebook, String openMail, String contactMail, Boolean openFlag, Integer verification, Integer contactInfoVerified, Integer feeSharingRatio, Integer ontologyHarbinger, Integer oldNode, Integer badActor, Integer risky, Integer status, String progress, String userApy) {
super(publicKey, name, address, ontId, nodeType, introduction, logoUrl, region, longitude, latitude, ip, website, socialMedia, telegram, twitter, facebook, openMail, contactMail, openFlag, verification, contactInfoVerified, feeSharingRatio, ontologyHarbinger, oldNode, badActor, risky, status, progress, userApy);
public NodeInfoOffChainDto(String publicKey, String name, String address, String ontId, Integer nodeType, String introduction, String logoUrl, String region, BigDecimal longitude, BigDecimal latitude, String ip, String website, String socialMedia, String telegram, String twitter, String facebook, String openMail, String contactMail, Boolean openFlag, Integer verification, Integer contactInfoVerified, Integer feeSharingRatio, Integer ontologyHarbinger, Integer oldNode, Integer badActor, Integer risky, Integer status, String progress, Long totalPos, Long maxAuthorize, String userApy) {
super(publicKey, name, address, ontId, nodeType, introduction, logoUrl, region, longitude, latitude, ip, website, socialMedia, telegram, twitter, facebook, openMail, contactMail, openFlag, verification, contactInfoVerified, feeSharingRatio, ontologyHarbinger, oldNode, badActor, risky, status, progress, totalPos, maxAuthorize, userApy);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ public class NodeStakeDto {

private boolean allowStake;

private long totalPos;

private long maxAuthorize;

private int currentRound;

// user apr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1606,6 +1606,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff
String nodeName = nodeInfoOffChain.getName();
String address = nodeInfoOffChain.getAddress();
String progress = nodeInfoOffChain.getProgress();
Long totalPos = Optional.ofNullable(nodeInfoOffChain.getTotalPos()).orElse(0L);
Long maxAuthorize = Optional.ofNullable(nodeInfoOffChain.getMaxAuthorize()).orElse(0L);
int nodeType = nodeInfoOffChain.getNodeType();
// 节点存在且质押进度没到100%,则可以质押
boolean allowStake = progress != null && !"100.00%".equals(progress);
Expand All @@ -1631,6 +1633,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff
dto.setNodeType(nodeType);
dto.setNodeState(nodeStatus);
dto.setAllowStake(allowStake);
dto.setTotalPos(totalPos);
dto.setMaxAuthorize(maxAuthorize);
dto.setCurrentRound(currentRound);
dto.setApr(userApy);
nodeStakeDtos.add(dto);
Expand All @@ -1645,6 +1649,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff
dto.setNodeType(nodeType);
dto.setNodeState(nodeStatus);
dto.setAllowStake(allowStake);
dto.setTotalPos(totalPos);
dto.setMaxAuthorize(maxAuthorize);
dto.setCurrentRound(currentRound);
dto.setApr(userApy);
nodeStakeDtos.add(dto);
Expand All @@ -1659,6 +1665,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff
dto.setNodeType(nodeType);
dto.setNodeState(nodeStatus);
dto.setAllowStake(allowStake);
dto.setTotalPos(totalPos);
dto.setMaxAuthorize(maxAuthorize);
dto.setCurrentRound(currentRound);
dto.setApr(userApy);
nodeStakeDtos.add(dto);
Expand All @@ -1674,6 +1682,8 @@ private void putStakingInfoList(String stakingInfo, NodeInfoOffChain nodeInfoOff
dto.setNodeType(nodeType);
dto.setNodeState(nodeStatus);
dto.setAllowStake(allowStake);
dto.setTotalPos(totalPos);
dto.setMaxAuthorize(maxAuthorize);
dto.setCurrentRound(currentRound);
dto.setApr(userApy);
nodeStakeDtos.add(dto);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,8 @@
a.address,
a.node_type,
b.progress,
b.total_pos,
b.max_authorize,
c.user_apy
FROM tbl_node_info_off_chain a
LEFT JOIN tbl_node_info_on_chain b ON a.public_key = b.public_key
Expand Down

0 comments on commit 4cd9205

Please sign in to comment.