Skip to content

Commit

Permalink
Merge pull request #214 from yg3630536/bugfix/deploy-evidence-by-groupId
Browse files Browse the repository at this point in the history
* fixed bug for deploy evidence by groupId
  • Loading branch information
chaoxinhu committed May 26, 2020
2 parents 0041adc + 76523ea commit c292386
Showing 1 changed file with 3 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ public class DeployEvidenceV2 extends AddressProcess {
* The credentials.
*/
private static Credentials credentials;

/**
* web3j object.
*/
private static Web3j web3j;

/**
* Inits the credentials.
Expand Down Expand Up @@ -83,18 +78,15 @@ private static String initCredentials(String inputPrivateKey) {
return credentials.getEcKeyPair().getPrivateKey().toString();
}

protected static void initWeb3j(Integer groupId) {
if (web3j == null) {
web3j = (Web3j) BaseService.getWeb3j(groupId);
}
protected static Web3j getWeb3j(Integer groupId) {
return (Web3j) BaseService.getWeb3j(groupId);
}

public static String deployContract(
String inputPrivateKey,
Integer groupId,
boolean instantEnable
) {
initWeb3j(groupId);
String privateKey = initCredentials(inputPrivateKey);
String evidenceAddress = deployEvidenceContractsNew(groupId);
// 将地址注册到cns中
Expand Down Expand Up @@ -138,7 +130,7 @@ private static String deployEvidenceContractsNew(Integer groupId) {
try {
EvidenceContract evidenceContract =
EvidenceContract.deploy(
web3j,
getWeb3j(groupId),
credentials,
new StaticGasProvider(WeIdConstant.GAS_PRICE, WeIdConstant.GAS_LIMIT)
).send();
Expand Down

0 comments on commit c292386

Please sign in to comment.