-
Notifications
You must be signed in to change notification settings - Fork 173
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from WeBankFinTech/feature/transcation-by-group
Evidence supports multi-group transactions
- Loading branch information
Showing
26 changed files
with
868 additions
and
288 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright© (2018-2020) WeBank Co., Ltd. | ||
* | ||
* This file is part of weid-java-sdk. | ||
* | ||
* weid-java-sdk is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* weid-java-sdk is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with weid-java-sdk. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.webank.weid.constant; | ||
|
||
import org.apache.commons.lang3.StringUtils; | ||
|
||
import com.webank.weid.util.PropertyUtils; | ||
|
||
/** | ||
* cns 类型定义. | ||
* | ||
* @author v_wbgyang | ||
* | ||
*/ | ||
public enum CnsType { | ||
|
||
/** | ||
* 默认的cns定义,此cns用于weid主合约存储. | ||
*/ | ||
DEFAULT("allOrg", "v1.1"), | ||
|
||
/** | ||
* 共享cns定义,此cns可作为机构共享数据存储. | ||
*/ | ||
SHARE("share", "v1.1"); | ||
|
||
private static final String SPLIT_CHAR = "/"; | ||
|
||
private String name; | ||
|
||
private String version; | ||
|
||
CnsType(String name, String version) { | ||
this.name = getCnsName(name); | ||
this.version = version; | ||
} | ||
|
||
private String getCnsName(String name) { | ||
String profile = PropertyUtils.getProperty("cns.profile.active"); | ||
if (StringUtils.isNotBlank(profile)) { | ||
return profile + SPLIT_CHAR + name; | ||
} | ||
return name; | ||
} | ||
|
||
public String toString() { | ||
return name + SPLIT_CHAR + version; | ||
} | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getVersion() { | ||
return version; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
82 changes: 82 additions & 0 deletions
82
src/main/java/com/webank/weid/contract/deploy/DeployEvidence.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/* | ||
* Copyright© (2018-2020) WeBank Co., Ltd. | ||
* | ||
* This file is part of weid-java-sdk. | ||
* | ||
* weid-java-sdk is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Lesser General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* weid-java-sdk is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Lesser General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Lesser General Public License | ||
* along with weid-java-sdk. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package com.webank.weid.contract.deploy; | ||
|
||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
import com.webank.weid.config.FiscoConfig; | ||
import com.webank.weid.contract.deploy.v2.DeployEvidenceV2; | ||
|
||
/** | ||
* The Class DeployContract. | ||
* | ||
* @author tonychen | ||
*/ | ||
public abstract class DeployEvidence { | ||
|
||
/** | ||
* log4j. | ||
*/ | ||
private static final Logger logger = LoggerFactory.getLogger(DeployEvidence.class); | ||
|
||
/** | ||
* The Fisco Config bundle. | ||
*/ | ||
protected static final FiscoConfig fiscoConfig; | ||
|
||
static { | ||
fiscoConfig = new FiscoConfig(); | ||
if (!fiscoConfig.load()) { | ||
logger.error("[BaseService] Failed to load Fisco-BCOS blockchain node information."); | ||
System.exit(1); | ||
} | ||
} | ||
|
||
/** | ||
* The main method. | ||
* | ||
* @param args the arguments | ||
*/ | ||
public static void main(String[] args) { | ||
|
||
// args = new String[] {"2"}; | ||
|
||
if (args == null || args.length == 0) { | ||
logger.error("input param illegal"); | ||
System.exit(1); | ||
} | ||
|
||
String groupStr = args[0]; | ||
Integer groupId = Integer.parseInt(groupStr); | ||
|
||
String privateKey = null; | ||
if (args != null && args.length > 1) { | ||
privateKey = args[1]; | ||
} | ||
|
||
deployContract(privateKey, groupId); | ||
System.exit(0); | ||
} | ||
|
||
public static void deployContract(String privateKey, Integer groupId) { | ||
DeployEvidenceV2.deployContract(privateKey, groupId); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.