Skip to content

Commit

Permalink
Merge pull request #387 from CodingCattwo/dev
Browse files Browse the repository at this point in the history
fix ext contract null
  • Loading branch information
CodingCattwo authored Sep 27, 2021
2 parents 460b523 + d3fcbba commit fc984aa
Showing 1 changed file with 23 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -792,7 +792,18 @@ public List<TbUser> getContractManager(int groupId, String contractAddress) {
List<TbUser> resultUserList = new ArrayList<>();
// get deployAddress from external service
TbExternalContract extContract = extContractService.getByAddress(groupId, contractAddress);
String deployAddress = extContract.getDeployAddress();
String deployAddress;
if (extContract != null) {
deployAddress = extContract.getDeployAddress();
} else {
TbContract contract = this.queryContractByGroupIdAndAddress(groupId, contractAddress);
if (contract != null) {
deployAddress = contract.getDeployAddress();
} else {
log.warn("getContractManager get contract's deploy user address fail");
return resultUserList;
}
}
// check if address has private key
TbUser deployUser = userService.checkUserHasPk(groupId, deployAddress);
if (deployUser != null) {
Expand Down Expand Up @@ -824,4 +835,15 @@ public List<TbUser> getContractManager(int groupId, String contractAddress) {
}
return resultUserList;
}

public TbContract queryContractByGroupIdAndAddress(int groupId, String contractAddress) {
log.debug("start queryContractByGroupIdAndAddress groupId:{},contractAddress:{}", groupId, contractAddress);
ContractParam param = new ContractParam();
param.setGroupId(groupId);
param.setContractAddress(contractAddress);
TbContract contract = this.queryContract(param);
log.debug("end queryContractByGroupIdAndAddress contract:{}", contract);
return contract;

}
}

0 comments on commit fc984aa

Please sign in to comment.