Skip to content

Commit

Permalink
fix ext contract null
Browse files Browse the repository at this point in the history
  • Loading branch information
CodingCattwo committed Sep 27, 2021
1 parent b10db80 commit d3fcbba
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 d3fcbba

Please sign in to comment.