From f64cc7b6aa24dfd3fcd3e6ba077bb3646bab6d06 Mon Sep 17 00:00:00 2001 From: dalaocu Date: 2020年8月28日 17:57:34 +0800 Subject: [PATCH 01/23] init --- README.md | 6 +- contracts/authority/acl/WEAclGuard.sol | 78 ++ contracts/authority/base/WEAuth.sol | 49 ++ contracts/authority/base/WEAuthority.sol | 20 + contracts/authority/base/WEBasicAuth.sol | 36 + .../biz_template/Evidence/Authentication.sol | 28 + contracts/biz_template/Evidence/Evidence.sol | 53 ++ .../Evidence/EvidenceRepository.sol | 23 + .../Evidence/RequestRepository.sol | 52 ++ contracts/biz_template/RewardPoint/Admin.sol | 27 + .../biz_template/RewardPoint/BasicAuth.sol | 31 + .../biz_template/RewardPoint/IssuerRole.sol | 35 + .../biz_template/RewardPoint/LibRoles.sol | 22 + .../biz_template/RewardPoint/LibSafeMath.sol | 17 + .../RewardPoint/RewardPointController.sol | 114 +++ .../RewardPoint/RewardPointData.sol | 57 ++ contracts/data_structures/LibAddressSet.sol | 66 ++ contracts/data_structures/LibBytes32Set.sol | 0 contracts/data_structures/LibBytesMap.sol | 82 +++ contracts/data_structures/LibDeque.sol | 109 +++ contracts/data_structures/LibLinkedList.sol | 126 ++++ .../data_structures/LibMaxHeapUint256.sol | 87 +++ .../data_structures/LibMinHeapUint256.sol | 87 +++ contracts/data_structures/LibQueue.sol | 55 ++ contracts/data_structures/LibStack.sol | 41 ++ contracts/types/LibAddress.sol | 133 ++++ contracts/types/LibArrayForUint256Utils.sol | 195 +++++ contracts/types/LibConverter.sol | 188 +++++ .../types/LibSafeMathForUint256Utils.sol | 76 ++ contracts/types/LibString.sol | 369 ++++++++++ docs/biz_templates/Evidence.md | 45 ++ docs/biz_templates/RewardPoint.md | 96 +++ docs/data_structures/LibAddressSet.md | 173 +++++ docs/data_structures/LibBytes32Set.md | 173 +++++ docs/data_structures/LibBytesMap.md | 111 +++ docs/data_structures/LibDeque.md | 244 +++++++ docs/data_structures/LibLinkedList.md | 196 +++++ docs/data_structures/LibMaxHeapUint256.md | 114 +++ docs/data_structures/LibMinHeapUint256.md | 114 +++ docs/data_structures/LibQueue.md | 119 ++++ docs/data_structures/LibStack.md | 117 +++ docs/types/LibAddress.md | 157 ++++ docs/types/LibArrayForUint256Utils.md | 328 +++++++++ docs/types/LibConverter.md | 214 ++++++ docs/types/LibSafeMathForUint256Utils.md | 256 +++++++ docs/types/LibString.md | 408 +++++++++++ .../evidence/DemoApplicationTests.java | 61 ++ java/wescott/.gitignore | 28 + java/wescott/HELP.md | 21 + java/wescott/build.gradle | 40 ++ java/wescott/config/user.jks | 0 .../gradle/wrapper/gradle-wrapper.properties | 5 + java/wescott/gradlew | 172 +++++ java/wescott/gradlew.bat | 84 +++ java/wescott/settings.gradle | 1 + .../webank/wescott/WescottApplication.java | 13 + .../config/SystemEnvironmentConfig.java | 48 ++ .../wescott/config/Web3jV2BeanConfig.java | 145 ++++ .../webank/wescott/constant/GasConstants.java | 33 + .../webank/wescott/contract/TestSafeMath.java | 152 ++++ .../contract/authority/WEAclGuard.java | 674 ++++++++++++++++++ .../wescott/contract/authority/WEAuth.java | 284 ++++++++ .../contract/authority/WEAuthority.java | 102 +++ .../contract/authority/WEBasicAuth.java | 187 +++++ .../webank/wescott/contract/point/Admin.java | 172 +++++ .../wescott/contract/point/BasicAuth.java | 154 ++++ .../wescott/contract/point/IssuerRole.java | 252 +++++++ .../contract/point/RewardPointController.java | 620 ++++++++++++++++ .../contract/point/RewardPointData.java | 567 +++++++++++++++ .../webank/wescott/tool/AddressListUtils.java | 42 ++ .../com/webank/wescott/tool/BytesUtils.java | 42 ++ .../webank/wescott/tool/CredentialUtils.java | 38 + .../webank/wescott/tool/JacksonException.java | 21 + .../com/webank/wescott/tool/JacksonUtils.java | 161 +++++ .../com/webank/wescott/tool/NameValueVO.java | 15 + .../src/main/resources/application.properties | 12 + java/wescott/src/main/resources/ca.crt | 20 + java/wescott/src/main/resources/node.crt | 33 + java/wescott/src/main/resources/node.key | 5 + java/wescott/src/main/resources/p1.jks | Bin 0 -> 660 bytes java/wescott/src/main/resources/p2.jks | Bin 0 -> 660 bytes java/wescott/src/main/resources/p3.jks | Bin 0 -> 698 bytes java/wescott/src/main/resources/user1.jks | Bin 0 -> 660 bytes java/wescott/src/main/resources/user2.jks | Bin 0 -> 659 bytes .../java/com/webank/wescott/BaseTests.java | 39 + .../wescott/authority/AclGuardTest.java | 103 +++ .../webank/wescott/safemath/SafeMathTest.java | 77 ++ .../wescott/template/point/AdminTest.java | 115 +++ test/TestQueue.sol | 22 + test/TestSafeMath.sol | 12 + test/TestSet.sol | 21 + 91 files changed, 9719 insertions(+), 1 deletion(-) create mode 100644 contracts/authority/acl/WEAclGuard.sol create mode 100644 contracts/authority/base/WEAuth.sol create mode 100644 contracts/authority/base/WEAuthority.sol create mode 100644 contracts/authority/base/WEBasicAuth.sol create mode 100644 contracts/biz_template/Evidence/Authentication.sol create mode 100644 contracts/biz_template/Evidence/Evidence.sol create mode 100644 contracts/biz_template/Evidence/EvidenceRepository.sol create mode 100644 contracts/biz_template/Evidence/RequestRepository.sol create mode 100644 contracts/biz_template/RewardPoint/Admin.sol create mode 100644 contracts/biz_template/RewardPoint/BasicAuth.sol create mode 100644 contracts/biz_template/RewardPoint/IssuerRole.sol create mode 100755 contracts/biz_template/RewardPoint/LibRoles.sol create mode 100644 contracts/biz_template/RewardPoint/LibSafeMath.sol create mode 100644 contracts/biz_template/RewardPoint/RewardPointController.sol create mode 100644 contracts/biz_template/RewardPoint/RewardPointData.sol create mode 100644 contracts/data_structures/LibAddressSet.sol create mode 100644 contracts/data_structures/LibBytes32Set.sol create mode 100644 contracts/data_structures/LibBytesMap.sol create mode 100644 contracts/data_structures/LibDeque.sol create mode 100644 contracts/data_structures/LibLinkedList.sol create mode 100644 contracts/data_structures/LibMaxHeapUint256.sol create mode 100644 contracts/data_structures/LibMinHeapUint256.sol create mode 100644 contracts/data_structures/LibQueue.sol create mode 100644 contracts/data_structures/LibStack.sol create mode 100644 contracts/types/LibAddress.sol create mode 100644 contracts/types/LibArrayForUint256Utils.sol create mode 100644 contracts/types/LibConverter.sol create mode 100644 contracts/types/LibSafeMathForUint256Utils.sol create mode 100644 contracts/types/LibString.sol create mode 100644 docs/biz_templates/Evidence.md create mode 100644 docs/biz_templates/RewardPoint.md create mode 100644 docs/data_structures/LibAddressSet.md create mode 100644 docs/data_structures/LibBytes32Set.md create mode 100644 docs/data_structures/LibBytesMap.md create mode 100644 docs/data_structures/LibDeque.md create mode 100644 docs/data_structures/LibLinkedList.md create mode 100644 docs/data_structures/LibMaxHeapUint256.md create mode 100644 docs/data_structures/LibMinHeapUint256.md create mode 100644 docs/data_structures/LibQueue.md create mode 100644 docs/data_structures/LibStack.md create mode 100644 docs/types/LibAddress.md create mode 100644 docs/types/LibArrayForUint256Utils.md create mode 100644 docs/types/LibConverter.md create mode 100644 docs/types/LibSafeMathForUint256Utils.md create mode 100644 docs/types/LibString.md create mode 100644 java/biz_templates/evidence/DemoApplicationTests.java create mode 100644 java/wescott/.gitignore create mode 100644 java/wescott/HELP.md create mode 100644 java/wescott/build.gradle create mode 100644 java/wescott/config/user.jks create mode 100644 java/wescott/gradle/wrapper/gradle-wrapper.properties create mode 100755 java/wescott/gradlew create mode 100644 java/wescott/gradlew.bat create mode 100644 java/wescott/settings.gradle create mode 100644 java/wescott/src/main/java/com/webank/wescott/WescottApplication.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java create mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java create mode 100644 java/wescott/src/main/resources/application.properties create mode 100644 java/wescott/src/main/resources/ca.crt create mode 100644 java/wescott/src/main/resources/node.crt create mode 100644 java/wescott/src/main/resources/node.key create mode 100644 java/wescott/src/main/resources/p1.jks create mode 100644 java/wescott/src/main/resources/p2.jks create mode 100644 java/wescott/src/main/resources/p3.jks create mode 100644 java/wescott/src/main/resources/user1.jks create mode 100644 java/wescott/src/main/resources/user2.jks create mode 100644 java/wescott/src/test/java/com/webank/wescott/BaseTests.java create mode 100644 java/wescott/src/test/java/com/webank/wescott/authority/AclGuardTest.java create mode 100644 java/wescott/src/test/java/com/webank/wescott/safemath/SafeMathTest.java create mode 100644 java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java create mode 100644 test/TestQueue.sol create mode 100644 test/TestSafeMath.sol create mode 100644 test/TestSet.sol diff --git a/README.md b/README.md index 482a63a4..b460ae21 100644 --- a/README.md +++ b/README.md @@ -1 +1,5 @@ -# sol-lib \ No newline at end of file +# WeScott + +#### 介绍 +webank smart contract open source tookit + diff --git a/contracts/authority/acl/WEAclGuard.sol b/contracts/authority/acl/WEAclGuard.sol new file mode 100644 index 00000000..a342aca3 --- /dev/null +++ b/contracts/authority/acl/WEAclGuard.sol @@ -0,0 +1,78 @@ +// This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program 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 General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.4.25; + +import "./base/WEAuth.sol"; + +contract WEAclGuard is WEAuth, WEAuthority { + bytes4 constant public ANY_SIG = bytes4(uint(-1)); + address constant public ANY_ADDRESS = address(bytes20(uint(-1))); + + mapping (address => mapping (address => mapping (bytes4 => bool))) _acl; + + event LogPermit( + address indexed src, + address indexed dst, + bytes4 indexed sig + ); + + event LogForbid( + address indexed src, + address indexed dst, + bytes4 indexed sig + ); + + constructor() public { + setOwner(msg.sender); + } + + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool) { + return _acl[src][dst][sig] + || _acl[src][dst][ANY_SIG] + || _acl[src][ANY_ADDRESS][sig] + || _acl[src][ANY_ADDRESS][ANY_SIG] + || _acl[ANY_ADDRESS][dst][sig] + || _acl[ANY_ADDRESS][dst][ANY_SIG] + || _acl[ANY_ADDRESS][ANY_ADDRESS][sig] + || _acl[ANY_ADDRESS][ANY_ADDRESS][ANY_SIG]; + } + + function permit(address src, address dst, bytes4 sig) public onlyAuthorized { + _acl[src][dst][sig] = true; + emit LogPermit(src, dst, sig); + } + + function forbid(address src, address dst, bytes4 sig) public onlyAuthorized { + _acl[src][dst][sig] = false; + emit LogForbid(src, dst, sig); + } + + function permit(address src, address dst, string sig) external { + permit(src, dst, bytes4(keccak256(sig))); + } + + function forbid(address src, address dst, string sig) external { + forbid(src, dst, bytes4(keccak256(sig))); + } + + function permitAny(address src, address dst) external { + permit(src, dst, ANY_SIG); + } + + function forbidAny(address src, address dst) external { + forbid(src, dst, ANY_SIG); + } +} diff --git a/contracts/authority/base/WEAuth.sol b/contracts/authority/base/WEAuth.sol new file mode 100644 index 00000000..ba04512c --- /dev/null +++ b/contracts/authority/base/WEAuth.sol @@ -0,0 +1,49 @@ + // This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program 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 General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.4.25; + +import "./WEBasicAuth.sol"; +import "./WEAuthority.sol"; + +contract WEAuth is WEBasicAuth { + WEAuthority public _authority; + + event LogSetAuthority (address indexed authority, address from, bytes4 sig); + + + function setAuthority(WEAuthority authority) + public + onlyAuthorized + { + _authority = authority; + emit LogSetAuthority(authority, msg.sender, msg.sig); + } + + modifier onlyAuthorized { + require(isAuthorized(msg.sender, msg.sig), "WEAuth: is not authorized"); + _; + } + + function isAuthorized(address src, bytes4 sig) public view returns (bool) { + if (src == address(this)) { + return true; + } else if (src == _owner) { + return true; + } else if (_authority == WEAuthority(0)) { + return false; + } else { + return _authority.canCall(src, this, sig); + } + } +} \ No newline at end of file diff --git a/contracts/authority/base/WEAuthority.sol b/contracts/authority/base/WEAuthority.sol new file mode 100644 index 00000000..2e741ac8 --- /dev/null +++ b/contracts/authority/base/WEAuthority.sol @@ -0,0 +1,20 @@ + // This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program 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 General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.4.25; + +contract WEAuthority { + function canCall( + address src, address dst, bytes4 sig + ) public view returns (bool); +} \ No newline at end of file diff --git a/contracts/authority/base/WEBasicAuth.sol b/contracts/authority/base/WEBasicAuth.sol new file mode 100644 index 00000000..e9a53334 --- /dev/null +++ b/contracts/authority/base/WEBasicAuth.sol @@ -0,0 +1,36 @@ + // This program is free software: you can redistribute it and/or modify +// it under the terms of the GNU General Public License as published by +// the Free Software Foundation, either version 3 of the License, or +// (at your option) any later version. + +// This program 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 General Public License for more details. + +// You should have received a copy of the GNU General Public License +// along with this program. If not, see . + +pragma solidity ^0.4.25; + +contract WEBasicAuth { + address public _owner; + event LogSetOwner(address indexed owner, address indexed oldOwner, address indexed contractAddress); + + constructor() public { + _owner = msg.sender; + } + + function setOwner(address owner) + public + onlyOwner + { + _owner = owner; + emit LogSetOwner(owner, _owner, this); + } + + modifier onlyOwner() { + require(msg.sender == _owner, "WEBasicAuth: only owner is authorized."); + _; + } +} \ No newline at end of file diff --git a/contracts/biz_template/Evidence/Authentication.sol b/contracts/biz_template/Evidence/Authentication.sol new file mode 100644 index 00000000..b9037412 --- /dev/null +++ b/contracts/biz_template/Evidence/Authentication.sol @@ -0,0 +1,28 @@ +pragma solidity ^0.4.25; + +contract Authentication{ + address public _owner; + mapping(address=>bool) private _acl; + + constructor() public{ + _owner = msg.sender; + } + + modifier onlyOwner(){ + require(msg.sender == _owner, "Not admin"); + _; + } + + modifier auth(){ + require(msg.sender == _owner || _acl[msg.sender]==true, "Not authenticated"); + _; + } + + function allow(address addr) public onlyOwner{ + _acl[addr] = true; + } + + function deny(address addr) public onlyOwner{ + _acl[addr] = false; + } +} diff --git a/contracts/biz_template/Evidence/Evidence.sol b/contracts/biz_template/Evidence/Evidence.sol new file mode 100644 index 00000000..63e4f39f --- /dev/null +++ b/contracts/biz_template/Evidence/Evidence.sol @@ -0,0 +1,53 @@ +pragma solidity ^0.4.25; + +import "./RequestRepository.sol"; +import "./EvidenceRepository.sol"; + +contract EvidenceController{ + RequestRepository public _requestRepo; + EvidenceRepository public _evidenceRepo; + + event CreateSaveRequest(bytes32 indexed hash, address creator); + event VoteSaveRequest(bytes32 indexed hash, address voter, bool complete); + event EvidenceSaved(bytes32 indexed hash); + + constructor(uint8 threshold, address[] voterArray) public{ + _requestRepo = new RequestRepository(threshold, voterArray); + _evidenceRepo = new EvidenceRepository(); + } + + modifier validateHash(bytes32 hash){ + require(hash != 0, "Not valid hash"); + _; + } + + function createSaveRequest(bytes32 hash, bytes ext) public validateHash(hash){ + _requestRepo.createSaveRequest(hash, msg.sender, ext); + emit CreateSaveRequest(hash, msg.sender); + } + + function voteSaveRequest(bytes32 hash) public validateHash(hash) returns(bool){ + bool b = _requestRepo.voteSaveRequest(hash, msg.sender); + if(!b) { + return false; + } + (bytes32 h, address creator, bytes memory ext, uint8 voted, uint8 threshold) = _requestRepo.getRequestData(hash); + bool passed = voted>= threshold; + emit VoteSaveRequest(hash, msg.sender, passed); + if(passed){ + _evidenceRepo.setData(hash, creator, now); + _requestRepo.deleteSaveRequest(hash); + emit EvidenceSaved(hash); + } + return true; + } + + function getRequestData(bytes32 hash) public view + returns(bytes32, address creator, bytes memory ext, uint8 voted, uint8 threshold){ + return _requestRepo.getRequestData(hash); + } + + function getEvidence(bytes32 hash) public view returns(bytes32 , address, uint){ + return _evidenceRepo.getData(hash); + } +} diff --git a/contracts/biz_template/Evidence/EvidenceRepository.sol b/contracts/biz_template/Evidence/EvidenceRepository.sol new file mode 100644 index 00000000..ee148363 --- /dev/null +++ b/contracts/biz_template/Evidence/EvidenceRepository.sol @@ -0,0 +1,23 @@ +pragma solidity ^0.4.25; +import "./Authentication.sol"; + +contract EvidenceRepository is Authentication { + struct EvidenceData{ + bytes32 hash; + address owner; + uint timestamp; + } + mapping(bytes32=>EvidenceData) private _evidences; + + function setData(bytes32 hash, address owner, uint timestamp) public auth { + _evidences[hash].hash = hash; + _evidences[hash].owner = owner; + _evidences[hash].timestamp = timestamp; + } + + function getData(bytes32 hash) public view returns(bytes32 , address, uint){ + EvidenceData storage evidence = _evidences[hash]; + require(evidence.hash == hash, "Evidence not exist"); + return (evidence.hash, evidence.owner, evidence.timestamp); + } +} diff --git a/contracts/biz_template/Evidence/RequestRepository.sol b/contracts/biz_template/Evidence/RequestRepository.sol new file mode 100644 index 00000000..c4792e2c --- /dev/null +++ b/contracts/biz_template/Evidence/RequestRepository.sol @@ -0,0 +1,52 @@ +pragma solidity ^0.4.25; + +import "./Authentication.sol"; + +contract RequestRepository is Authentication{ + struct SaveRequest{ + bytes32 hash; + address creator; + uint8 voted; + bytes ext; + mapping(address=>bool) status; + } + uint8 public _threshold; + mapping(bytes32=>SaveRequest) private _saveRequests; + mapping(address=>bool) private _voters; + + constructor(uint8 threshold, address[] voterArray) public{ + _threshold = threshold; + for(uint i=0;i bool) bearer; + } + + function add(Role storage role, address account) internal { + require(!has(role, account), "Roles: account already has role"); + role.bearer[account] = true; + } + + function remove(Role storage role, address account) internal { + require(has(role, account), "Roles: account does not have role"); + role.bearer[account] = false; + } + + function has(Role storage role, address account) internal view returns (bool) { + require(account != address(0), "Roles: account is the zero address"); + return role.bearer[account]; + } +} diff --git a/contracts/biz_template/RewardPoint/LibSafeMath.sol b/contracts/biz_template/RewardPoint/LibSafeMath.sol new file mode 100644 index 00000000..a8c6ce6c --- /dev/null +++ b/contracts/biz_template/RewardPoint/LibSafeMath.sol @@ -0,0 +1,17 @@ +pragma solidity ^0.4.25; + + +library LibSafeMath { + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a, "SafeMath: subtraction overflow"); + uint256 c = a - b; + + return c; + } + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c>= a, "SafeMath: addition overflow"); + + return c; + } +} diff --git a/contracts/biz_template/RewardPoint/RewardPointController.sol b/contracts/biz_template/RewardPoint/RewardPointController.sol new file mode 100644 index 00000000..bb2695cc --- /dev/null +++ b/contracts/biz_template/RewardPoint/RewardPointController.sol @@ -0,0 +1,114 @@ +pragma solidity ^0.4.25; + +import "./RewardPointData.sol"; +import "./BasicAuth.sol"; +import "./LibSafeMath.sol"; + +contract RewardPointController is BasicAuth { + using LibSafeMath for uint256; + + RewardPointData _rewardPointData; + + event LogRegister(address account); + event LogUnregister(address account); + event LogSend( address indexed from, address indexed to, uint256 value); + + constructor(address dataAddress) public { + _rewardPointData = RewardPointData(dataAddress); + } + + modifier accountExist(address addr) { + require(_rewardPointData.hasAccount(addr)==true && addr != address(0), "Only existed account!"); + _; + } + + modifier accountNotExist(address account) { + require(_rewardPointData.hasAccount(account)==false, "Account already existed!"); + _; + } + + modifier canUnregister(address account) { + require(_rewardPointData.hasAccount(account)==true && _rewardPointData.getBalance(account) == 0 , "Cann't unregister!"); + _; + } + + modifier checkAccount(address sender) { + require(msg.sender != sender && sender != address(0), "Can't transfer to illegal address!"); + _; + } + + modifier onlyIssuer() { + require(_rewardPointData.isIssuer(msg.sender), "IssuerRole: caller does not have the Issuer role"); + _; + } + + function register() accountNotExist(msg.sender) public returns (address) { + _rewardPointData.setAccount(msg.sender, true); + // init balances + _rewardPointData.setBalance(msg.sender, 0); + emit LogRegister(msg.sender); + } + + function unregister() canUnregister(msg.sender) public returns (address) { + _rewardPointData.setAccount(msg.sender, false); + emit LogUnregister(msg.sender); + } + + function isRegistered(address addr) public view returns (bool) { + return _rewardPointData.hasAccount(addr); + } + + function balance(address addr) public view returns (uint256) { + return _rewardPointData.getBalance(addr); + } + + function transfer(address toAddress, uint256 value) accountExist(msg.sender) accountExist(toAddress) checkAccount(toAddress) + public returns(bool b, uint256 balanceOfFrom, uint256 balanceOfTo) { + uint256 balance1 = _rewardPointData.getBalance(msg.sender); + balanceOfFrom = balance1.sub(value); + _rewardPointData.setBalance(msg.sender, balanceOfFrom); + uint256 balance2 = _rewardPointData.getBalance(toAddress); + balanceOfTo = balance2.add(value); + _rewardPointData.setBalance(toAddress, balanceOfTo); + emit LogSend(msg.sender, toAddress, value); + b = true; + } + + function destroy(uint256 value) accountExist(msg.sender) public returns (bool) { + uint256 totalAmount = _rewardPointData._totalAmount(); + totalAmount = totalAmount.sub(value); + _rewardPointData.setTotalAmount(totalAmount); + uint256 balance1 = _rewardPointData.getBalance(msg.sender); + balance1 = balance1.sub(value); + _rewardPointData.setBalance(msg.sender, balance1); + emit LogSend( msg.sender, address(0), value); + return true; + } + + + function issue(address account, uint256 value) public onlyIssuer accountExist(account) returns (bool) { + uint256 totalAmount = _rewardPointData._totalAmount(); + totalAmount = totalAmount.add(value); + _rewardPointData.setTotalAmount(totalAmount); + uint256 balance1 = _rewardPointData.getBalance(account); + balance1 = balance1.add(value); + _rewardPointData.setBalance(account, balance1); + emit LogSend( address(0), account, value); + return true; + } + + function isIssuer(address account) public view returns (bool) { + return _rewardPointData.isIssuer(account); + } + + function addIssuer(address account) public onlyIssuer returns (bool) { + _rewardPointData.addIssuer(account); + return true; + } + + function renounceIssuer() public returns (bool) { + _rewardPointData.renounceIssuer(msg.sender); + return true; + } +} + diff --git a/contracts/biz_template/RewardPoint/RewardPointData.sol b/contracts/biz_template/RewardPoint/RewardPointData.sol new file mode 100644 index 00000000..aa2349b9 --- /dev/null +++ b/contracts/biz_template/RewardPoint/RewardPointData.sol @@ -0,0 +1,57 @@ +pragma solidity ^0.4.25; + +import "./BasicAuth.sol"; +import "./IssuerRole.sol"; + +contract RewardPointData is BasicAuth, IssuerRole { + + mapping(address => uint256) private _balances; + mapping(address => bool) private _accounts; + uint256 public _totalAmount; + string public _description; + address _latestVersion; + + constructor(string memory description) public { + _description = description; + } + + modifier onlyLatestVersion() { + require(msg.sender == _latestVersion); + _; + } + + function upgradeVersion(address newVersion) public { + require(msg.sender == _owner); + _latestVersion = newVersion; + } + + + function setBalance(address a, uint256 value) onlyLatestVersion public returns (bool) { + _balances[a] = value; + return true; + } + + function setAccount(address a, bool b) onlyLatestVersion public returns (bool) { + _accounts[a] = b; + return true; + } + + function setTotalAmount(uint256 amount) onlyLatestVersion public returns (bool) { + _totalAmount = amount; + return true; + } + + function getAccountInfo(address account) public view returns (bool, uint256) { + return (_accounts[account], _balances[account]); + } + + function hasAccount(address account) public view returns(bool) { + return _accounts[account]; + } + + function getBalance(address account) public view returns (uint256) { + return _balances[account]; + } + +} + diff --git a/contracts/data_structures/LibAddressSet.sol b/contracts/data_structures/LibAddressSet.sol new file mode 100644 index 00000000..226d0fe6 --- /dev/null +++ b/contracts/data_structures/LibAddressSet.sol @@ -0,0 +1,66 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + + +library LibAddressSet { + + struct AddressSet { + mapping (address => uint256) indexMapping; + address[] values; + } + + function add(AddressSet storage self, address value) internal { + require(value != 0x0, "LibAddressSet: value can't be 0x0"); + require(!contains(self, value), "LibAddressSet: value already exists in the set."); + self.values.push(value); + self.indexMapping[value] = self.values.length; + } + + function contains(AddressSet storage self, address value) internal view returns (bool) { + return self.indexMapping[value] != 0; + } + + function remove(AddressSet storage self, address value) internal { + require(contains(self, value), "LibAddressSet: value doesn't exist."); + uint256 toDeleteindexMapping = self.indexMapping[value] - 1; + uint256 lastindexMapping = self.values.length - 1; + address lastValue = self.values[lastindexMapping]; + self.values[toDeleteindexMapping] = lastValue; + self.indexMapping[lastValue] = toDeleteindexMapping; + delete self.indexMapping[value]; + self.values.length--; + } + + function getSize(AddressSet storage self) internal view returns (uint256) { + return self.values.length; + } + + function get(AddressSet storage self, uint256 index) internal view returns (address){ + return self.values[index]; + } + + function getAll(AddressSet storage self) internal view returns(address[]) { + address[] memory output = new address[](self.values.length); + for (uint256 i; i < self.values.length; i++){ + output[i] = self.values[i]; + } + return output; + } + + +} \ No newline at end of file diff --git a/contracts/data_structures/LibBytes32Set.sol b/contracts/data_structures/LibBytes32Set.sol new file mode 100644 index 00000000..e69de29b diff --git a/contracts/data_structures/LibBytesMap.sol b/contracts/data_structures/LibBytesMap.sol new file mode 100644 index 00000000..4f3f90c1 --- /dev/null +++ b/contracts/data_structures/LibBytesMap.sol @@ -0,0 +1,82 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibBytesMap{ + + struct Map{ + mapping(bytes => uint256) index; + bytes[] keys; + bytes[] values; + } + + function put(Map storage map, bytes key, bytes value) internal { + uint256 idx = map.index[key]; + if(idx == 0){ + map.keys.push(key); + map.values.push(value); + map.index[key] = map.keys.length; + } + else{ + map.values[idx - 1] = value; + } + } + + function getKey(Map storage map, uint256 index) internal view returns(bytes){ + require(map.keys.length> index); + bytes memory key = map.keys[index - 1]; + return key; + } + + function getValue(Map storage map, bytes key) internal view returns(bytes){ + uint256 idx = map.index[key]; + bytes memory value = map.values[idx - 1]; + return value; + } + + function size(Map storage self) internal view returns(uint256) { + return self.keys.length; + } + + // -----------Iterative functions------------------ + function iterate_start(Map storage self) internal pure returns (uint256){ + return 1; + } + + function can_iterate(Map storage self, uint256 idx) internal view returns(bool){ + return self.keys.length>= idx; + } + + function iterate_next(Map storage self, uint256 idx) internal pure returns(uint256){ + return idx+1; + } +} + + + + + + + + + + + + + + + diff --git a/contracts/data_structures/LibDeque.sol b/contracts/data_structures/LibDeque.sol new file mode 100644 index 00000000..94a7bccc --- /dev/null +++ b/contracts/data_structures/LibDeque.sol @@ -0,0 +1,109 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +/** + * Doubly ended queue + * @author aaronchu + * */ + +library LibDeque{ + + struct Deque{ + mapping(int256 => bytes32) data; + int256 head; + int256 tail; + } + + function getSize(Deque storage self) internal view returns(uint256){ + if(self.head == self.tail) return 0; + return uint(self.tail - self.head - 1); + } + + function isEmpty(Deque storage self) internal view returns(bool){ + return self.head == self.tail; + } + + + function offerFirst(Deque storage self, bytes32 element) internal { + bool empty = self.tail == self.head; + self.data[self.head] = element; + self.head--; + if(empty) self.tail++; + } + + function offerLast(Deque storage self, bytes32 element) internal { + bool empty = self.tail == self.head; + self.data[self.tail] = element; + self.tail++; + if(empty) self.head--; + + } + + function pollFirst(Deque storage self) internal returns(bytes32 ret) { + require(!isEmpty(self)); + ret = self.data[++self.head]; + delete self.data[self.head]; + } + + function pollLast(Deque storage self) internal returns(bytes32 ret) { + require(!isEmpty(self)); + ret = self.data[--self.tail]; + delete self.data[self.tail]; + } + + function peekFirst(Deque storage self) internal view returns(bytes32 ret) { + require(!isEmpty(self)); + ret = self.data[self.head + 1]; + } + + function peekLast(Deque storage self) internal view returns(bytes32 ret){ + require(!isEmpty(self)); + ret = self.data[self.tail - 1]; + } + + + + function push(Deque storage self, bytes32 element) internal { + offerFirst(self, element); + } + + function pop(Deque storage self) internal returns(bytes32) { + return pollFirst(self); + } + +} + + + + + + + + + + + + + + + + + + + + diff --git a/contracts/data_structures/LibLinkedList.sol b/contracts/data_structures/LibLinkedList.sol new file mode 100644 index 00000000..6ca64ee8 --- /dev/null +++ b/contracts/data_structures/LibLinkedList.sol @@ -0,0 +1,126 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + + +library LibLinkedList { + + bytes32 constant private NULL = bytes32(0); + bool constant private PREV = false; + bool constant private NEXT = true; + + struct LinkedList{ + uint256 size; + bytes32 head; + bytes32 tail; + mapping(bytes32 => Node) indexs; + } + + struct Node{ + bytes32 prev; + bytes32 next; + bool exist; + } + + function getSize(LinkedList storage self) internal view returns(uint256){ + return self.size; + } + + function addNode(LinkedList storage self, bytes32 data) internal returns(LinkedList) { + require(data != bytes32(0)); + require(!self.indexs[data].exist); + if(self.size == 0){ + Node memory node = Node(NULL, NULL, true); + self.size = 1; + self.head = data; + self.tail = data; + self.indexs[data] = node; + } + else{ + Node memory newNode = Node(self.tail, NULL, true); + Node storage tail = extractNode(self, self.tail); + tail.next = data; + self.tail = data; + self.size++; + self.indexs[data] = newNode; + } + return self; + } + + function getPrev(LinkedList storage self, bytes32 data) internal view returns(bytes32){ + Node storage node = self.indexs[data]; + require(node.exist); + return node.prev; + } + + function getNext(LinkedList storage self, bytes32 data) internal view returns(bytes32){ + Node storage node = self.indexs[data]; + require(node.exist); + return node.next; + } + + + function removeNode(LinkedList storage self, bytes32 data) internal returns(LinkedList){ + Node storage node = extractNode(self, data); + require(node.exist); + Node storage prev = extractNode(self, node.prev); + Node storage next = extractNode(self, node.next); + if(prev.exist){ + prev.next = node.next; + } + else{ + self.head = node.next; + } + + if(next.exist){ + next.prev = node.prev; + } + else{ + self.tail = node.prev; + } + delete self.indexs[data]; + self.size--; + return self; + } + + + function getTail(LinkedList storage self) internal view returns(bytes32){ + return self.tail; + } + + function getHead(LinkedList storage self) internal view returns(bytes32){ + return self.head; + } + + function extractNode(LinkedList storage self, bytes32 data) private view returns(Node storage){ + return self.indexs[data]; + } + + + // -----------Iterative functions------------------ + function iterate_start(LinkedList storage self) internal view returns (bytes32){ + return self.head; + } + + function can_iterate(LinkedList storage self, bytes32 data) internal view returns(bool){ + return self.indexs[data].exist; + } + + function iterate_next(LinkedList storage self, bytes32 data) internal view returns(bytes32){ + return self.indexs[data].next; + } +} \ No newline at end of file diff --git a/contracts/data_structures/LibMaxHeapUint256.sol b/contracts/data_structures/LibMaxHeapUint256.sol new file mode 100644 index 00000000..ebfa532d --- /dev/null +++ b/contracts/data_structures/LibMaxHeapUint256.sol @@ -0,0 +1,87 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibMaxHeapUint256{ + + struct Heap{ + uint256[] data; + } + + function insert(Heap storage heap, uint256 value) internal{ + heap.data.push(value); + uint256 idx = heap.data.length - 1; + uint256 parent; + + while(idx> 0){ + parent = (idx - 1) / 2; + if(heap.data[parent]>= value){ + break; + } + //do sift-up + heap.data[idx] = heap.data[parent]; + heap.data[parent] = value; + idx = parent; + } + } + + function top(Heap storage heap) internal view returns (uint256){ + require(heap.data.length> 0); + return heap.data[0]; + } + + function extractTop(Heap storage heap) internal returns(uint256 top){ + require(heap.data.length> 0); + top = heap.data[0]; + uint256 last = heap.data[heap.data.length - 1]; + heap.data.length--; + if(heap.data.length == 0) return; + + heap.data[0] = last; + uint256 index = 0; + uint256 leftIdx; + uint256 rightIdx; + //Sift-down + uint256 swapValue; + uint256 swapIndex; + while(index < heap.data.length){ + leftIdx = 2 * index + 1; + rightIdx = 2 * index + 2; + swapValue = last; + swapIndex = index; + if(leftIdx < heap.data.length && swapValue < heap.data[leftIdx]){ + swapValue = heap.data[leftIdx]; + swapIndex = leftIdx; + } + + if(rightIdx < heap.data.length && swapValue < heap.data[rightIdx]){ + swapValue = heap.data[rightIdx]; + swapIndex = rightIdx; + } + + if(swapIndex == index) break; + heap.data[index] = swapValue; + heap.data[swapIndex] = last; + index = swapIndex; + } + } + + function getSize(Heap storage heap) internal view returns(uint256){ + return heap.data.length; + } + +} diff --git a/contracts/data_structures/LibMinHeapUint256.sol b/contracts/data_structures/LibMinHeapUint256.sol new file mode 100644 index 00000000..06bb3002 --- /dev/null +++ b/contracts/data_structures/LibMinHeapUint256.sol @@ -0,0 +1,87 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibMinHeapUint256{ + + struct Heap{ + uint256[] data; + } + + function insert(Heap storage heap, uint256 value) internal{ + heap.data.push(value); + uint256 idx = heap.data.length - 1; + uint256 parent; + + while(idx> 0){ + parent = (idx - 1) / 2; + if(heap.data[parent] <= value){ + break; + } + //do sift-up + heap.data[idx] = heap.data[parent]; + heap.data[parent] = value; + idx = parent; + } + } + + function top(Heap storage heap) internal view returns (uint256){ + require(heap.data.length> 0); + return heap.data[0]; + } + + function extractTop(Heap storage heap) internal returns(uint256 top){ + require(heap.data.length> 0); + top = heap.data[0]; + uint256 last = heap.data[heap.data.length - 1]; + heap.data.length--; + if(heap.data.length == 0) return; + + heap.data[0] = last; + uint256 index = 0; + uint256 leftIdx; + uint256 rightIdx; + //Sift-down + uint256 swapValue; + uint256 swapIndex; + while(index < heap.data.length){ + leftIdx = 2 * index + 1; + rightIdx = 2 * index + 2; + swapValue = last; + swapIndex = index; + if(leftIdx < heap.data.length && swapValue> heap.data[leftIdx]){ + swapValue = heap.data[leftIdx]; + swapIndex = leftIdx; + } + + if(rightIdx < heap.data.length && swapValue> heap.data[rightIdx]){ + swapValue = heap.data[rightIdx]; + swapIndex = rightIdx; + } + + if(swapIndex == index) break; + heap.data[index] = swapValue; + heap.data[swapIndex] = last; + index = swapIndex; + } + } + + function getSize(Heap storage heap) internal view returns(uint256){ + return heap.data.length; + } + +} diff --git a/contracts/data_structures/LibQueue.sol b/contracts/data_structures/LibQueue.sol new file mode 100644 index 00000000..38fa85d3 --- /dev/null +++ b/contracts/data_structures/LibQueue.sol @@ -0,0 +1,55 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibQueue{ + + + struct Queue{ + uint256 first; + uint256 last; + mapping(uint => bytes32) queue; + + } + + function enqueue(Queue storage queue, bytes32 data) public { + queue.last++; + queue.queue[queue.last] = data; + } + + function dequeue(Queue storage queue) public returns (bytes32) { + uint256 first = queue.first; + require(queue.last>= first); // non-empty queue + + bytes32 data = queue.queue[first]; + delete queue.queue[first]; + queue.first += 1; + return data; + } + + function element(Queue storage queue) public view returns (bytes32) { + uint256 first = queue.first; + require(queue.last>= first); // non-empty queue + bytes32 data = queue.queue[first]; + return data; + } + + + function getSize(Queue storage self) internal view returns(uint256){ + return self.last - self.first + 1; + } +} \ No newline at end of file diff --git a/contracts/data_structures/LibStack.sol b/contracts/data_structures/LibStack.sol new file mode 100644 index 00000000..bbf5f730 --- /dev/null +++ b/contracts/data_structures/LibStack.sol @@ -0,0 +1,41 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibStack{ + + + struct Stack{ + bytes32[] datas; + } + + + function push(Stack storage self, bytes32 data) internal{ + self.datas.push(data); + } + + function pop(Stack storage self) internal returns(bytes32){ + require(self.datas.length> 0); + bytes32 data = self.datas[self.datas.length - 1]; + self.datas.length--; + return data; + } + + function getSize(Stack storage self) internal view returns(uint256){ + return self.datas.length; + } +} \ No newline at end of file diff --git a/contracts/types/LibAddress.sol b/contracts/types/LibAddress.sol new file mode 100644 index 00000000..aa41b232 --- /dev/null +++ b/contracts/types/LibAddress.sol @@ -0,0 +1,133 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibAddress{ + + /* + *@dev + *@param + *@return + */ + function isContract(address account) internal view returns(bool) { + uint256 size; + assembly { size := extcodesize(addr) } + return size> 0; + } + + function isEmptyAddress(address addr) internal pure returns(bool){ + return addr == address(0); + } + + + function addressToBytes(address addr) internal pure returns (bytes memory){ + bytes20 addrBytes = bytes20(uint160(addr)); + bytes memory rtn = new bytes(20); + for(uint8 i=0;i<20;i++){ + rtn[i] = addrBytes[i]; + } + return rtn; + } + + + function bytesToAddress(bytes addrBytes) internal pure returns (address){ + require(isAddressType(addrBytes)); + //Convert binary to uint160 + uint160 intVal = 0; + intVal += uint8(addrBytes[0]); + for(uint8 i=1;i<20;i++){ + intVal <<= 8; + intVal += uint8(addrBytes[i]); + } + return address(intVal); + } + + + function addressToString(address addr) internal pure returns(string){ + //Convert addr to bytes + bytes20 value = bytes20(uint160(addr)); + bytes memory strBytes = new bytes(42); + //Encode hex prefix + strBytes[0] = '0'; + strBytes[1] = 'x'; + //Encode bytes usig hex encoding + for(uint i=0;i<20;i++){ + uint8 byteValue = uint8(value[i]); + strBytes[2 + (i<<1)] = encode(byteValue>> 4); + strBytes[3 + (i<<1)] = encode(byteValue & 0x0f); + } + return string(strBytes); + } + + function stringToAddress(string data) internal returns(address){ + bytes memory strBytes = bytes(data); + require(strBytes.length>= 39 && strBytes.length <= 42, "Not hex string"); + //Skip prefix + uint start = 0; + uint bytesBegin = 0; + if(strBytes[1] == 'x' || strBytes[1] == 'X'){ + start = 2; + } + //Special case: 0xabc. should be 0x0abc + uint160 addrValue = 0; + uint effectPayloadLen = strBytes.length - start; + if(effectPayloadLen == 39){ + addrValue += decode(strBytes[start++]); + bytesBegin++; + } + //Main loop + for(uint i=bytesBegin;i < 20; i++){ + addrValue <<= 8; + uint8 tmp1 = decode(strBytes[start]); + uint8 tmp2 = decode(strBytes[start+1]); + uint8 combined = (tmp1 << 4) + tmp2; + addrValue += combined; + start+=2; + } + + return address(addrValue); + } + + + //-----------HELPER METHOD--------------// + + //num represents a number from 0-15 and returns ascii representing [0-9A-Fa-f] + function encode(uint8 num) private pure returns(byte){ + //0-9 -> 0-9 + if(num>= 0 && num <= 9){ + return byte(num + 48); + } + //10-15 -> a-f + return byte(num + 87); + } + + //asc represents one of the char:[0-9A-Fa-f] and returns consperronding value from 0-15 + function decode(byte asc) private pure returns(uint8){ + uint8 val = uint8(asc); + //0-9 + if(val>= 48 && val <= 57){ + return val - 48; + } + //A-F + if(val>= 65 && val <= 70){ + return val - 55; + } + //a-f + return val - 87; + } + +} diff --git a/contracts/types/LibArrayForUint256Utils.sol b/contracts/types/LibArrayForUint256Utils.sol new file mode 100644 index 00000000..c52ec784 --- /dev/null +++ b/contracts/types/LibArrayForUint256Utils.sol @@ -0,0 +1,195 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +import "./LibSafeMathForUint256Utils.sol"; + +library LibArrayForUint256Utils { + + /** + * @dev Searches a sortd uint256 array and returns the first element index that + * match the key value, Time complexity O(log n) + * + * @param array is expected to be sorted in ascending order + * @param key is element + * + * @return if matches key in the array return true,else return false + * @return the first element index that match the key value,if not exist,return 0 + */ + function binarySearch(uint256[] storage array, uint256 key) internal view returns (bool, uint) { + if(array.length == 0){ + return (false, 0); + } + + uint256 low = 0; + uint256 high = array.length; + + while(low < high){ + uint256 mid = LibSafeMathForUint256Utils.average(low, high); + if(array[mid] == key){ + return (true, mid); + }else if (array[mid]> key) { + high = mid; + } else { + low = mid + 1; + } + } + + return (false, 0); + } + + function indexOf(uint256[] storage array, uint256 key) internal view returns (bool, uint256) { + + if(array.length == 0){ + return (false, 0); + } + + for(uint256 i = 0; i < array.length; i++){ + if(array[i] == key){ + return (true, i); + } + } + return (false, 0); + } + + function reverse(uint256[] storage array) internal { + uint256 temp; + for (uint i = 0; i < array.length / 2; i++) { + temp = array[i]; + array[i] = array[array.length - i]; + array[array.length - i] = temp; + } + } + + function equals(uint256[] a, uint256[] b) internal pure returns (bool){ + if(a.length != b.length){ + return false; + } + for(uint256 i = 0; i < a.length; i++){ + if(a[i] != b[i]){ + return false; + } + } + return true; + } + + function removeByIndex(uint256[] storage array, uint index) internal{ + require(index < array.length, "ArrayForUint256: index out of bounds"); + + while (index < array.length - 1) { + array[index] = array[index + 1]; + index++; + } + array.length--; + } + + function removeByValue(uint256[] storage array, uint256 value) internal{ + uint index; + bool isIn; + (isIn, index) = indexOf(array, value); + if(isIn){ + removeByIndex(array, index); + } + } + + function addValue(uint256[] storage array, uint256 value) internal{ + uint index; + bool isIn; + (isIn, index) = indexOf(array, value); + if(!isIn){ + array.push(value); + } + } + + function extend(uint256[] storage a, uint256[] storage b) internal { + if(!(b.length == 0)){ + for(uint i = 0; i < b.length; i++){ + a.push(b[i]); + } + } + } + + function distinct(uint256[] storage array) internal returns (uint256 length) { + bool contains; + uint index; + for (uint i = 0; i < array.length; i++) { + (contains, index) = indexOf(array, array[i]); + if (i> index) { + for (uint j = i; j < array.length - 1; j++){ + array[j] = array[j + 1]; + } + delete array[array.length - 1]; + array.length--; + i--; + } + } + length = array.length; + } + + function qsort(uint256[] storage array) internal view { + qsort(array, 0, array.length-1); + } + + function qsort(uint256[] storage array, uint256 begin, uint256 end) private view{ + if(end <= begin){ + return; + } + uint256 pivot = array[begin]; + array[begin] = array[end]; + array[end] = pivot; + + uint256 store = begin; + uint256 i = begin; + for(;i maxValue){ + maxValue = array[i]; + maxIndex = i; + } + } + } + + function min(uint256[] storage array) internal view returns (uint256 minValue, uint256 minIndex) { + minValue = array[0]; + minIndex = 0; + for(uint256 i = 0;i < array.length;i++){ + if(array[i] < minValue){ + minValue = array[i]; + minIndex = i; + } + } + } + +} diff --git a/contracts/types/LibConverter.sol b/contracts/types/LibConverter.sol new file mode 100644 index 00000000..fa7a90e5 --- /dev/null +++ b/contracts/types/LibConverter.sol @@ -0,0 +1,188 @@ +/* +# Copyright (C) 2017 alianse777 + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . +*/ + +pragma solidity ^0.4.25; + + +/** + * @dev Wrappers over Solidity's uintXX casting operators with added overflow + * checks. + * + * Downcasting from uint256 in Solidity does not revert on overflow. This can + * easily result in undesired exploitation or bugs, since developers usually + * assume that overflows raise errors. `SafeCast` restores this intuition by + * reverting the transaction when such an operation overflows. + * + * Using this library instead of the unchecked operations eliminates an entire + * class of bugs, so it's recommended to use it always. + * + * Can be combined with {SafeMath} to extend it to smaller types, by performing + * all math on `uint256` and then downcasting. + * + * _Available since v2.5.0._ + */ +library LibConverter { + + /** + * @dev Returns the downcasted uint128 from uint256, reverting on + * overflow (when the input is greater than largest uint128). + * + * Counterpart to Solidity's `uint128` operator. + * + * Requirements: + * + * - input must fit into 128 bits + */ + function toUint128(uint256 value) internal pure returns (uint128) { + require(value < 2**128, "SafeCast: value doesn\'t fit in 128 bits"); + return uint128(value); + } + + /** + * @dev Returns the downcasted uint64 from uint256, reverting on + * overflow (when the input is greater than largest uint64). + * + * Counterpart to Solidity's `uint64` operator. + * + * Requirements: + * + * - input must fit into 64 bits + */ + function toUint64(uint256 value) internal pure returns (uint64) { + require(value < 2**64, "SafeCast: value doesn\'t fit in 64 bits"); + return uint64(value); + } + + /** + * @dev Returns the downcasted uint32 from uint256, reverting on + * overflow (when the input is greater than largest uint32). + * + * Counterpart to Solidity's `uint32` operator. + * + * Requirements: + * + * - input must fit into 32 bits + */ + function toUint32(uint256 value) internal pure returns (uint32) { + require(value < 2**32, "SafeCast: value doesn\'t fit in 32 bits"); + return uint32(value); + } + + /** + * @dev Returns the downcasted uint16 from uint256, reverting on + * overflow (when the input is greater than largest uint16). + * + * Counterpart to Solidity's `uint16` operator. + * + * Requirements: + * + * - input must fit into 16 bits + */ + function toUint16(uint256 value) internal pure returns (uint16) { + require(value < 2**16, "SafeCast: value doesn\'t fit in 16 bits"); + return uint16(value); + } + + /** + * @dev Returns the downcasted uint8 from uint256, reverting on + * overflow (when the input is greater than largest uint8). + * + * Counterpart to Solidity's `uint8` operator. + * + * Requirements: + * + * - input must fit into 8 bits. + */ + function toUint8(uint256 value) internal pure returns (uint8) { + require(value < 2**8, "SafeCast: value doesn\'t fit in 8 bits"); + return uint8(value); + } + + /** + * @dev Convert unsigned int to c-string (bytes). + * @param v - uint to convert. + * @return bytes. + */ + function uintToBytes(uint v) internal pure returns (bytes) { + uint maxlength = 100; + bytes memory reversed = new bytes(maxlength); + uint i = 0; + while (v != 0) { + uint remainder = v % 10; + v = v / 10; + reversed[i % maxlength] = byte(48 + remainder); + i++; + } + bytes memory s = new bytes(i + 1); + for (uint j = 1; j <= i % maxlength; j++) { + s[j-1] = reversed[i - j]; + } + return bytes(s); + } + + + function bytesToInt(bytes b) internal pure returns (int result) { + uint i = 0; + uint tr = 0; + result = 0; + bool sign = false; + if(b[i] == "-") { + sign = true; + i++; + } else if(b[i] == "+") { + i++; + } + while(uint(b[b.length - tr - 1]) == 0x00) { + tr++; + } + for (;i < b.length - tr; i++) { + uint c = uint(b[i]); + if (c>= 48 && c <= 57) { + result *= 10; + result = result + int(c - 48); + } + } + if(sign) { + result *= -1; + } + } + + function intToBytes(int v) internal pure returns (bytes) { + uint maxlength = 100; + bytes memory reversed = new bytes(maxlength); + uint i = 0; + uint x; + if(v < 0) + x = uint(-v); + else + x = uint(v); + while (x != 0) { + uint remainder = uint(x % 10); + x = x / 10; + reversed[i % maxlength] = byte(48 + remainder); + i++; + } + if(v < 0) + reversed[(i++) % maxlength] = "-"; + bytes memory s = new bytes(i+1); + for (uint j = 1; j <= i % maxlength; j++) { + s[j - 1] = reversed[i - j]; + } + return bytes(s); + } +} + diff --git a/contracts/types/LibSafeMathForUint256Utils.sol b/contracts/types/LibSafeMathForUint256Utils.sol new file mode 100644 index 00000000..339c5c54 --- /dev/null +++ b/contracts/types/LibSafeMathForUint256Utils.sol @@ -0,0 +1,76 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibSafeMathForUint256Utils { + + function add(uint256 a, uint256 b) internal pure returns (uint256) { + uint256 c = a + b; + require(c>= a, "SafeMathForUint256: addition overflow"); + return c; + } + + function sub(uint256 a, uint256 b) internal pure returns (uint256) { + require(b <= a, "SafeMathForUint256: subtraction overflow"); + uint256 c = a - b; + return c; + } + + function mul(uint256 a, uint256 b) internal pure returns (uint256) { + if (a == 0 || b == 0) { + return 0; + } + + uint256 c = a * b; + require(c / a == b, "SafeMathForUint256: multiplication overflow"); + return c; + } + + function div(uint256 a, uint256 b) internal pure returns (uint256) { + require(b> 0, "SafeMathForUint256: division by zero"); + uint256 c = a / b; + return c; + } + + function mod(uint256 a, uint256 b) internal pure returns (uint256) { + require(b != 0, "SafeMathForUint256: modulo by zero"); + return a % b; + } + + function power(uint256 a, uint256 b) internal pure returns (uint256){ + + if(a == 0) return 0; + if(b == 0) return 1; + + uint256 c = 1; + for(uint256 i = 0; i < b; i++){ + c = mul(c, a); + } + } + + function max(uint256 a, uint256 b) internal pure returns (uint256) { + return a>= b ? a : b; + } + + function min(uint256 a, uint256 b) internal pure returns (uint256) { + return a < b ? a : b; + } + + function average(uint256 a, uint256 b) internal pure returns (uint256) { + return (a / 2) + (b / 2) + ((a % 2 + b % 2) / 2); + } +} diff --git a/contracts/types/LibString.sol b/contracts/types/LibString.sol new file mode 100644 index 00000000..381af818 --- /dev/null +++ b/contracts/types/LibString.sol @@ -0,0 +1,369 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + +pragma solidity ^0.4.25; + +library LibString{ + + + function lenOfChars(string src) internal pure returns(uint){ + uint i=0; + uint length = 0; + bytes memory string_rep = bytes(src); + //UTF-8 skip word + while (i b2) return 1; + if(b1 < b2) return -1; + } + //and length + if(selfb.length> otherb.length) return 1; + if(selfb.length < otherb.length) return -1; + return 0; + } + + function compareNocase(string self, string other) internal pure returns(int8){ + bytes memory selfb = bytes(self); + bytes memory otherb = bytes(other); + for(uint i=0;i= 'a' && ch1 <= 'z' && ch2>= 'a' && ch2 <= 'z'){ + if(ch1> ch2) return 1; + if(ch1 < ch2) return -1; + } + else{ + if(b1> b2) return 1; + if(b1 < b2) return -1; + } + } + + if(selfb.length> otherb.length) return 1; + if(selfb.length < otherb.length) return -1; + return 0; + } + + function toUppercase(string src) internal pure returns(string){ + bytes memory srcb = bytes(src); + for(uint i=0;i= 'a' && b <= 'z'){ + b &= ~0x20; + srcb[i] = b; + } + } + return src; + } + + function toLowercase(string src) internal pure returns(string){ + bytes memory srcb = bytes(src); + for(uint i=0;i= 'A' && b <= 'Z'){ + b |= 0x20; + srcb[i] = b; + } + } + return src; + } + + /** + * Index Of + * + * Locates and returns the position of a character within a string + * + * @param src When being used for a data type this is the extended object + * otherwise this is the string acting as the haystack to be + * searched + * @param value The needle to search for, at present this is currently + * limited to one character + * @return int The position of the needle starting from 0 and returning -1 + * in the case of no matches found + */ + function indexOf(string src, string value) + internal + pure + returns (int) { + return indexOf(src, value, 0); + } + + /** + * Index Of + * + * Locates and returns the position of a character within a string starting + * from a defined offset + * + * @param src When being used for a data type this is the extended object + * otherwise this is the string acting as the haystack to be + * searched + * @param value The needle to search for, at present this is currently + * limited to one character + * @param offset The starting point to start searching from which can start + * from 0, but must not exceed the length of the string + * @return int The position of the needle starting from 0 and returning -1 + * in the case of no matches found + */ + function indexOf(string src, string value, uint offset) + internal + pure + returns (int) { + bytes memory srcBytes = bytes(src); + bytes memory valueBytes = bytes(value); + + assert(valueBytes.length == 1); + + for (uint i = offset; i < srcBytes.length; i++) { + if (srcBytes[i] == valueBytes[0]) { + return int(i); + } + } + + return -1; + } + + /** + * String Split (Very high gas cost) + * + * Splits a string into an array of strings based off the delimiter value. + * Please note this can be quite a gas expensive function due to the use of + * storage so only use if really required. + * + * @param src When being used for a data type this is the extended object + * otherwise this is the string value to be split. + * @param separator The delimiter to split the string on which must be a single + * character + * @return string[] An array of values split based off the delimiter, but + * do not container the delimiter. + */ + function split(string src, string separator) + internal + pure + returns (string[] splitArr) { + bytes memory srcBytes = bytes(src); + + uint offset = 0; + uint splitsCount = 1; + while (offset < srcBytes.length - 1) { + int limit = indexOf(src, separator, offset); + if (limit == -1) + break; + else { + splitsCount++; + offset = uint(limit) + 1; + } + } + + splitArr = new string[](splitsCount); + + offset = 0; + splitsCount = 0; + while (offset < srcBytes.length - 1) { + + limit = indexOf(src, separator, offset); + if (limit == - 1) { + limit = int(srcBytes.length); + } + + string memory tmp = new string(uint(limit) - offset); + bytes memory tmpBytes = bytes(tmp); + + uint j = 0; + for (uint i = offset; i < uint(limit); i++) { + tmpBytes[j++] = srcBytes[i]; + } + offset = uint(limit) + 1; + splitArr[splitsCount++] = string(tmpBytes); + } + return splitArr; + } + + //------------HELPER FUNCTIONS---------------- + + function utf8CharBytesLength(bytes stringRep, uint ptr) internal pure returns(uint){ + if (stringRep[ptr]>>7==0) + return 1; + if (stringRep[ptr]>>5==0x6) + return 2; + if (stringRep[ptr]>>4==0xE) + return 3; + if (stringRep[ptr]>>3==0x1E) + return 4; + return 1; + } + + function memcpy(uint dest, uint src, uint len) private { + // Copy word-length chunks while possible + for(; len>= 32; len -= 32) { + assembly { + mstore(dest, mload(src)) + } + dest += 32; + src += 32; + } + + // Copy remaining bytes + uint mask = 256 ** (32 - len) - 1; + assembly { + let srcpart := and(mload(src), not(mask)) + let destpart := and(mload(dest), mask) + mstore(dest, or(destpart, srcpart)) + } + } + +} \ No newline at end of file diff --git a/docs/biz_templates/Evidence.md b/docs/biz_templates/Evidence.md new file mode 100644 index 00000000..3a25c08e --- /dev/null +++ b/docs/biz_templates/Evidence.md @@ -0,0 +1,45 @@ +## 存证模板背景说明 + +电子存证是一种用于保存证据的手段,应用场景很多,例如在版权领域,作者可以将作品指纹保存到电子存证机构,当出现版权纠纷时,可通过取证解决纠纷。存证、取证的关键环节是电子存证服务机构,如何保证它的可信性,即存证机构本身不会对存证数据进行破坏?传统的中心化存证机构很难解决这个问题,需要由区块链技术来解决。在区块链技术中,电子账本由各个节点共同维护,其内容由共识算法决定,单一节点无法篡改已达成共识的账本数据。这一不可篡改的特性是去中心化电子存证方案的核心。该方案中,存证数据不再存储于单一机构,而是分布式地存储在所有区块链节点上。 + +## 场景说明 + +本模板支持基于多签的存证场景。该场景中,包含几个角色:存证方、审核方、存储方、取证方: + + - 存证方:提交存证申请。 + - 审核方:审核存证申请,申请通过后交由存储方保存。 + - 存储方:保存存证数据。在去中心化方案中,由区块链上的智能合约充当存储方。 + - 取证方:提取存证数据。 + +## 接口 + +提供了三个合约:Evidence合约,EvidenceRepository合约,RequestRepository合约,Authentication合约。其中Evidence合约是对外服务合约,其余合约是辅助合约,用于数据和逻辑分离。 + +Evidence合约:对外服务的唯一接口。包含: + - createSaveRequest(byte32 hash, bytes ext): 存证方提交存证请求。hash是存证数据摘要,ext可选地存放说明信息 + - getRequestData(bytes32 hash): 审核方查看存证请求,以便审核。包括ext等信息 + - voteSaveRequest(bytes32 hash):审核方批准存证请求。投票全部通过后, + - getEvidence(bytes32 hash): 取证方查看存证数据,包括时间戳、持有人等信息 + +## 使用示例 + +假如现在要创建一个2-3投票的存证合约,然后上传存证、审核存证、查看存证,整个过程如下: + +合约初始化: + + - 管理员部署EvidenceRepository合约 + - 管理员部署RequestRepository合约,构造时传入threshold参数为2、voters列表为3个投票者 + - 管理员部署Evidence合约 + - 管理员调用EvidenceRepository.allow和RequestRepository.allow,参数传入Evidence合约地址,这一步是指定仅有Evidence合约可以调用EvidenceRepository和RequestRepository + +合约调用: + + - 存证方调用Evidence.createSaveRequest提交存证请求 + - 审核者调用Evidence.getRequestData查看存证请求;调用voteSaveRequest批准审核请求 + - 审核通过后,取证方调用Evidence.getEvidence查看存证数据 + + + + + + diff --git a/docs/biz_templates/RewardPoint.md b/docs/biz_templates/RewardPoint.md new file mode 100644 index 00000000..4578cae8 --- /dev/null +++ b/docs/biz_templates/RewardPoint.md @@ -0,0 +1,96 @@ +## 积分模板背景说明 + +在区块链的业务方案中,积分系统是非常常见的一种场景。 + +基于智能合约的积分系统,支持多家机构发行、用户注册、积分消费、积分销户、用户销户等多种功能。 + + +## 场景说明 + +典型的积分场景包括了以下角色: + + - 发行者:发行积分。 + - 用户:获得和消费积分,还可实现积分的转账。 + - 管理者:积分系统的管理者。 + +积分系统中包括了以下功能: + + - 创建积分系统 + - 注册:用户注册会员,只有经过注册的用户才能获得和消费积分。 + - 销户: 用户销户。只有积分为0的用户才能正常销户。 + - 添加发行者: 发行者具有发行积分的权利。 + - 发行积分: 支持定向发送到某个积分账户。 + - 删除发行者: 发行者可以注销自身的发行积分的权利。 + - 转账: 支持用户积分的互转和消费等。 + - 积分销毁: 用户可以销毁自己的积分。 + + +## 接口 + +主体为3个合约: Admin、RewardPointController、RewardPointData。 + +其中Admin为管理合约,提供合约部署和管理的接口: + + - 构造函数: 部署合约。默认部署合约的外部账户为资产发行者。 + - upgradeVersion(address newVersion) 更新数据的controller最新地址 + - _dataAddress() 查询数据合约的地址 + - _controllerAddress() 查询控制合约的地址 + +RewardPointController 提供了合约控制相关的接口: + + - addIssuer(address account) 添加资产发行者。只有资产发行者可以添加新的资产发行者。 + - issue(address account, uint256 value) 发行积分 + - isIssuer(address account) 判断是否是资产发行者。 + - addIssuer(address account) 添加发行者,只能由发行者添加。 + - renounceIssuer() 撤销发行者,只能撤销自己。 + - register() 普通用户账户注册。 + - unregister() 普通用户账户注销。 + - isRegistered(address addr) 判断普通用户是否注册。 + - balance(address addr) 查询普通用户的积分。 + - transfer(address toAddress, uint256 value) 往目标账户转积分 + - destroy(uint256 value) 销毁自己账户中的指定数量的积分 + +RewardPointData提供了底层的数据存储,不对外暴露直接访问的接口。 + +其他的合约为工具或辅助合约。 + +## 使用示例 + +整体流程如下: + +合约初始化: + + - 管理员部署Admin合约, 管理员在控制台中输入『deploy Admin』部署合约。 + - 管理员调用Admin合约的_controllerAddress()函数,获得RewardPointController合约的地址。 + +资产发行者维护: + + - 管理员使用 RewardPointController 合约的地址,加载RewardPointController合约。 + - 管理员默认为资产发行者,可以通过addIssuer添加其他发行者,通过renounceIssuer接口撤销自己发行者的权限。 + - 通过isIssuer接口查询某个用户是否为资产发行者。 + +账户注册: + + - 用户使用管理员发放的 RewardPointController 合约的地址,加载RewardPointController合约。 + - 用户使用RewardPointController合约中的register()接口注册账户。 + - 通过isRegistered判断是否已注册。 + +积分发行: + + - 用户使用RewardPointController的isIssuer函数判断自己是否为积分发行者。 + - 如果为是,用户通过issue接口定向发现积分。 + +积分操作: + + - 用户通过transfer接口实现积分转账。 + - 用户通过balance接口查询积分余额。 + - 用户通过destroy接口实现指定数额的账户积分的注销。 + +账户销户: + + - 用户通过unregister接口销户,只有积分余额为0的账户可以直接销户。 + + + + + diff --git a/docs/data_structures/LibAddressSet.md b/docs/data_structures/LibAddressSet.md new file mode 100644 index 00000000..9bea4850 --- /dev/null +++ b/docs/data_structures/LibAddressSet.md @@ -0,0 +1,173 @@ +# LibAddressSet.sol + +LibAddressSet 提供了存储Address类型的Set数据结构,支持包括add, remove, contains, get, getAll, size等方法。 + +## 使用方法 + +首先需要通过import引入LibAddressSet类库,然后通过"."进行方法调用,如下为调用LibAddressSet方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibAddressSet.sol"; + +contract TestSet { + using LibAddressSet for LibAddressSet.AddressSet; + LibAddressSet.AddressSet private addressSet; + + function testAddress() public { + addressSet.add(address(1)); + uint256 size = addressSet.size();//Expected to be 1 + } + +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *add(AddressSet storage self, address value) internal* | 往Set里添加元素。 +2 | *contains(AddressSet storage self, address value) internal view returns (bool)* | 判断Set里是否包含了元素value。 +3 | *remove(AddressSet storage self, address value) internal* | 删除Set中的元素。 +4 | *size(AddressSet storage self) internal view returns (uint256)* | 获取Set内元素数。 +5 | *get(AddressSet storage self, uint256 index) internal view returns (address)* | 查询某个Set的元素。 +6 | *getAll(AddressSet storage self) internal view returns(address[])* | 返回所有元素。 +7 | *destroy(Bytes32Set storage self) internal* | 销毁Set。 + +## API详情 + +### ***1. add 函数*** + +往Set里添加元素 + +#### 参数 + +- AddressSet: set容器 +- address: 元素 + +#### 返回值 + + +#### 实例 + +``` +pragma solidity ^0.4.25; + +import "./LibAddressSet.sol"; + +contract TestSet { + using LibAddressSet for LibAddressSet.AddressSet; + LibAddressSet.AddressSet private addressSet; + + function testAddress() public { + addressSet.add(address(1)); + } + +} +``` + +### ***2. contains 函数*** + +判断Set里是否包含了元素value。 + +#### 参数 + +- AddressSet: set容器 +- address: 元素 + +#### 返回值 +- bool: 是否包含 + +#### 实例 + +``` + bool b = addressSet.contains(address(1)); +``` + +### ***3. remove 函数*** + +删除Set中的指定元素 + +#### 参数 + +- AddressSet: set容器 +- address: 元素 + +#### 返回值 + + +#### 实例 + +``` + ddressSet.remove(address(1)); +``` + +### ***4. size 函数*** + +查询Set中的元素数量。 + +#### 参数 + +- AddressSet: set容器 + +#### 返回值 +- uint256: 元素数量 + +#### 实例 + +``` + uint256 setSize = addressSet.size(); +``` + +### ***5. get 函数*** + +查询Set中指定index的值 + +#### 参数 + +- AddressSet: set容器 +- uint256: index + +#### 返回值 +- address: 元素 + +#### 实例 + +``` + address value = addressSet.get(0); +``` + +### ***6. getAll 函数*** + +查询Set中所有的值,返回一个address[]数组 + +#### 参数 + +- AddressSet: set容器 + +#### 返回值 +- address[]: 所有元素值 + +#### 实例 + +``` + address[] values = addressSet.getAll(); +``` + +### ***7. destroy 函数*** + +销毁Set。 + +#### 参数 + +- AddressSet: set容器 + +#### 返回值 + +#### 实例 + +``` + addressSet.destroy(); +``` diff --git a/docs/data_structures/LibBytes32Set.md b/docs/data_structures/LibBytes32Set.md new file mode 100644 index 00000000..37829f45 --- /dev/null +++ b/docs/data_structures/LibBytes32Set.md @@ -0,0 +1,173 @@ +# LibBytes32Set.sol + +LibBytes32Set 提供了存储bytes32类型的Set数据结构,支持包括add, remove, contains, get, getAll, size等方法。 + +## 使用方法 + +首先需要通过import引入LibBytes32Set类库,然后通过"."进行方法调用,如下为调用LibBytes32Set方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibBytes32Set.sol"; + +contract TestSet { + using LibBytes32Set for LibBytes32Set.Bytes32Set; + LibBytes32Set.Bytes32Set private bytes32Set; + + function testBytes32() public { + bytes32Set.add(bytes32(1)); + uint256 size = bytes32Set.size();//Expected to be 1 + } + +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *add(Bytes32Set storage self, bytes32 value) internal* | 往Set里添加元素。 +2 | *contains(Bytes32Set storage self, bytes32 value) internal view returns (bool)* | 判断Set里是否包含了元素value。 +3 | *remove(Bytes32Set storage self, bytes32 value) internal* | 删除Set中的元素。 +4 | *size(Bytes32Set storage self) internal view returns (uint256)* | 获取Set内元素数。 +5 | *get(Bytes32Set storage self, uint256 index) internal view returns (Bytes32)* | 查询某个Set的元素。 +6 | *getAll(Bytes32Set storage self) internal view returns(bytes32[])* | 返回所有元素。 +7 | *destroy(Bytes32Set storage self) internal* | 销毁Set。 + +## API详情 + +### ***1. add 函数*** + +往Set里添加元素 + +#### 参数 + +- Bytes32Set: set容器 +- bytes32: 元素 + +#### 返回值 + + +#### 实例 + +``` +pragma solidity ^0.4.25; + +import "./LibBytes32Set.sol"; + +contract TestSet { + using LibBytes32Set for LibBytes32Set.Bytes32Set; + LibBytes32Set.Bytes32Set private Bytes32Set; + + function testBytes32() public { + bytes32Set.add(bytes32(1)); + } + +} +``` + +### ***2. contains 函数*** + +判断Set里是否包含了元素value。 + +#### 参数 + +- Bytes32Set: set容器 +- bytes32: 元素 + +#### 返回值 +- bool: 是否包含 + +#### 实例 + +``` + bool b = bytes32Set.contains(bytes32(1)); +``` + +### ***3. remove 函数*** + +删除Set中的指定元素 + +#### 参数 + +- Bytes32Set: set容器 +- bytes32: 元素 + +#### 返回值 + + +#### 实例 + +``` + ddressSet.remove(bytes32(1)); +``` + +### ***4. size 函数*** + +查询Set中的元素数量。 + +#### 参数 + +- Bytes32Set: set容器 + +#### 返回值 +- uint256: 元素数量 + +#### 实例 + +``` + uint256 setSize = bytes32Set.size(); +``` + +### ***5. get 函数*** + +查询Set中指定index的值 + +#### 参数 + +- Bytes32Set: set容器 +- uint256: index + +#### 返回值 +- bytes32: 元素 + +#### 实例 + +``` + bytes32 value = bytes32Set.get(0); +``` + +### ***6. getAll 函数*** + +查询Set中所有的值,返回一个bytes32[]数组 + +#### 参数 + +- Bytes32Set: set容器 + +#### 返回值 +- bytes32[]: 所有元素值 + +#### 实例 + +``` + bytes32[] values = bytes32Set.getAll(); +``` + +### ***7. destroy 函数*** + +销毁Set。 + +#### 参数 + +- Bytes32Set: set容器 + +#### 返回值 + +#### 实例 + +``` + bytes32Set.destroy(); +``` diff --git a/docs/data_structures/LibBytesMap.md b/docs/data_structures/LibBytesMap.md new file mode 100644 index 00000000..f842b2bb --- /dev/null +++ b/docs/data_structures/LibBytesMap.md @@ -0,0 +1,111 @@ +# LibBytesMap.sol + +LibBytesMap提供了基于bytes的可迭代、可查询的映射. + +## 使用方法 + +首先需要通过import引入LibBytesMap类库,然后通过"."进行方法调用,如下为调用例子: + +``` +pragma solidity ^0.4.25; + +import "./LibBytesMap.sol"; + +contract Test { + + using LibBytesMap for LibBytesMap.Map; + + LibBytesMap.Map private map; + + + function f(string key, string value) public { + + map.put(bytes(key),bytes(value)); + + + } +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *put(Map storage map, bytes key, bytes value) internal* | 存放键值对 +2 | *getValue(Map storage map, bytes key) internal view returns(bytes)* |根据key获取value +3 | *getKey(Map storage map, uint256 index) internal view returns(bytes)* |根据游标查询key +4 | *iterate_start(Map storage self) internal pure returns (uint256)* | 枚举key的游标 +5 | *can_iterate(Map storage self, uint256 idx) internal view returns(bool)* | 游标是否可用 +6 | *iterate_next(Map storage self, uint256 idx) internal pure returns(uint256)* | 下一个游标值 +7 | *size(Map storage self) internal view returns(uint256)* | 获得当前mapping的容量 + + +## API详情 + +### ***1. put 函数*** + +存放键值对 + +#### 参数 + +- bytes key: 键 +- bytes value:值 + + + +#### 实例 + +``` + function putExample(string key, string value) public { + + map.put(bytes(key),bytes(value)); + + } +``` +### ***2. getValue 函数*** + +查询值 + +#### 参数 + +- bytes key:键 + +#### 返回值 + +- bytes: 值 + +#### 实例 + +``` + function getExample(string key) public returns(bytes){ + bytes memory value = map.getValue(bytes(key)); + return value; + } + +``` +### ***3. 迭代函数 与 getKey函数*** + +#### 实例 + +``` + event Log(bytes key); + function iterate() public { + uint256 i = map.iterate_start(); + while(map.can_iterate(i)){ + emit Log(map.getKey(i)); + i = map.iterate_next(i); + } + + } +``` + +### ***4. size函数*** + +#### 实例 + +``` + function iterate() public { + uint256 i = map.size(); + + } +``` diff --git a/docs/data_structures/LibDeque.md b/docs/data_structures/LibDeque.md new file mode 100644 index 00000000..9f8b322a --- /dev/null +++ b/docs/data_structures/LibDeque.md @@ -0,0 +1,244 @@ +# LibDeque.sol + +LibDeque提供了双端队列。用户也可以像用栈一样使用它。 + +## 使用方法 + +首先需要通过import引入LibDeque类库,然后通过"."进行方法调用,如下为调用LibDeque方法的例子: + +``` +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Example{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function example() public returns(bytes32, bytes32){ + _deque.offerFirst(1); + _deque.offerLast(2); + emit Log(_deque.getSize());//Should be 2 + bytes32 first =_deque.pollFirst();//Shoud be 0x1 + bytes32 last = _deque.pollLast();//Should be 0x2 + emit Log(_deque.getSize());//Should be empty + return (first, last); + } + +} + +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *getSize(Deque storage self) internal view returns(uint256)* |获取元素数 +2 | *isEmpty(Deque storage self) internal view returns(bool)* |判断是否为空 +3 | *offerFirst(Deque storage self, bytes32 element) internal* | 将数据存入头部 +4 | *offerLast(Deque storage self, bytes32 element) internal* | 将数据存入尾部 +5 | *pollFirst(Deque storage self) internal returns(bytes32 ret)* |取出头部元素 +6 | *pollLast(Deque storage self) internal returns(bytes32 ret)* |取出尾部元素 +7 | *peekFirst(Deque storage self) internal view returns(bytes32 ret)* |查看头部元素 +8 | *peekLast(Deque storage self) internal view returns(bytes32 ret)* |查看尾部元素 +9 | *push(Deque storage self, bytes32 element) internal* |入栈 +10 | *pop(Deque storage self) internal returns(bytes32)* |出栈 + +## API详情 + +### ***1. getSize 函数*** + +查看元素数目 + +#### 参数 + +- Deque:队列 + +#### 返回值 + +- uint256: 元素数 + +#### 实例 + +``` + uint256 size = _deque.getSize(); +``` +### ***2. isEmpty 函数*** + +查看是否为空 + +#### 参数 + +- Deque:队列 + +#### 返回值 + +- bool 是否为空 + +#### 实例 + +``` + bool empty = _deque.isEmpty(); +``` + +### ***3. offerFirst 函数*** + +从头部存入元素。 + +#### 参数 + +- Deque:队列 +- bytes32: 元素 + +#### 实例 + +``` + _deque.offerFirst(1); + _deque.offerFirst(2); + uint256 size = _deque.getSize();//Should be 2 +``` + +### ***4. offerLast 函数*** + +从尾部存入元素。 + +#### 参数 + +- Deque:队列 +- bytes32: 元素 + +#### 实例 + +``` + _deque.offerLast(1); + _deque.offerLast(2); + uint256 size = _deque.getSize();//Should be 2 +``` + +### ***5. pollFirst 函数*** + +删除头部元素,并返回该元素。如果队列为空,则失败。 + +#### 参数 + +- Deque:队列 + + +#### 返回值 + +- bytes32: 头部元素 + +#### 实例 + +``` + _deque.offerLast(1); + _deque.offerLast(2); + bytes32 first = _deque.pollFirst();//Should be 0x1 + uint size = _deque.getSize();//Should be 1 +``` + +### ***6. pollLast 函数*** + +删除尾部元素,并返回该元素。如果队列为空,则失败。 + +#### 参数 + +- Deque:队列 + +#### 返回值 + +- bytes32: 尾部元素 + +#### 实例 + +``` + _deque.offerLast(1); + _deque.offerLast(2); + bytes32 first = _deque.pollLast();//Should be 0x2 + uint size = _deque.getSize();//Should be 1 +``` + + +### ***7. peekFirst 函数*** + +查看头部元素。如果队列为空,则失败。 + +#### 参数 + +- Deque:队列 + +#### 返回值 + +- bytes32: 头部元素 + +#### 实例 + +``` + _deque.offerLast(1); + _deque.offerLast(2); + bytes32 first = _deque.peekFirst();//Should be 0x1 + uint size = _deque.getSize();//Should be 2 +``` + +### ***8. peekLast 函数*** + +查看尾部元素。如果队列为空,则失败。 + +#### 参数 + +- Deque:队列 + +#### 返回值 + +- bytes32: 尾部元素 + +#### 实例 + +``` + _deque.offerLast(1); + _deque.offerLast(2); + bytes32 first = _deque.peekLast();//Should be 0x2 + uint size = _deque.getSize();//Should be 2 +``` + +### ***9. push 函数*** + +推入一个元素,就像使用栈一样。 + +#### 参数 + +- Deque:队列 +- bytes32: 元素 + +#### 实例 + +``` + _deque.push(1); +``` + +### ***10. pop 函数*** + +弹出一个元素,就像栈一样。如果队列为空,则失败。 + +#### 参数 + +- Deque:队列 + +#### 返回值 + +- bytes32: 元素 + +#### 实例 + +``` + _deque.push(1); + _deque.push(2); + bytes32 value = _deque.pop();//Should be 0x2 + bytes32 value2 = _deque.pop();//Should be 0x1 +``` + + diff --git a/docs/data_structures/LibLinkedList.md b/docs/data_structures/LibLinkedList.md new file mode 100644 index 00000000..1f3b410d --- /dev/null +++ b/docs/data_structures/LibLinkedList.md @@ -0,0 +1,196 @@ +# LibLinkedList.sol + +LibLinkedList提供了双向链表操作,包括链表更新、查询、迭代等。 + +## 使用方法 + +首先需要通过import引入LibLinkedList类库,然后通过"."进行方法调用,如下为添加元素的例子: +``` +pragma solidity ^0.4.25; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + + function add(uint256 d) public{ + self.addNode(bytes32(d)); + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *getSize(LinkedList storage self) internal view returns(uint256)* |获取链表元素数 +2 | *addNode(LinkedList storage self, bytes32 data) internal* |添加元素 +3 | *removeNode(LinkedList storage self, bytes32 data) internal returns(bytes32)* | 删除元素 +4 | *getPrev(LinkedList storage self, bytes32 data) internal view returns(bytes32)* | 获取一个元素的前一个元素 +5 | *getNext(LinkedList storage self, bytes32 data) internal view returns(bytes32)* | 获取一个元素的下一个元素 +6 | *getTail(LinkedList storage self) internal view returns(bytes32)* | 获取尾部元素 +7 | *getHead(LinkedList storage self) internal view returns(bytes32)* | 获取头部元素 +8 | *iterate_start(LinkedList storage self) internal view returns (bytes32)* | 链表迭代初始化 +9 | *can_iterate(LinkedList storage self, bytes32 data) internal view returns(bool)* | 迭代条件检查 +10 | *iterate_next(LinkedList storage self, bytes32 data) internal view returns(bytes32)* | 迭代下一个元素 + + +## API详情 + +### ***1. getSize 函数*** + +查询一个双向链表的元素数 + +#### 参数 + +- LinkedList:链表实例 + +#### 返回值 + +- uint256: 返回链表的当前元素数 + +#### 实例 + +``` +uint256 size = self.listSize(); +``` +### ***2. addNode 函数*** + +addNode函数用于添加一个元素,时间复杂度O(1) + +#### 参数 + +- LinkedList: 链表实例 +- bytes32: 元素值 + +#### 返回值 + +- LinkedList: 链表实例 + +#### 实例 + +``` +self.addNode(bytes32(1)); +``` + +### ***3. removeNode 函数*** + +removeNode函数用于从链表中删除一个元素,时间复杂度O(1) + +#### 参数 + +- LinkedList:链表实例 +- bytes32:待删除元素 + +#### 返回值 + +- LinkedList:链表实例 + +#### 实例 + +``` +self.addNode(bytes32(1)); +self.addNode(bytes32(2)); +self.removeNode(bytes32(2)); +``` + +### ***4. getPrev 函数*** + +getPrev用于取得一个元素的前一个元素。时间复杂度O(1) + +#### 参数 + +- LinkedList:链表实例 +- bytes32:当前元素值 + +#### 返回值 + +- bytes32:前一个元素值 + +#### 实例 + +``` +self.addNode(bytes32(1)); +self.addNode(bytes32(2)); +self.getPrev(bytes32(2));//Exptected to be 1 +``` + +### ***5. getNext 函数*** + +getNext用于取得一个元素的下一个函数。时间复杂度O(1) + +#### 参数 + +- LinkedList:链表实例 +- bytes32:当前元素值 + +#### 返回值 + +- bytes32:下一个元素值 + +#### 实例 + +``` +self.addNode(bytes32(1)); +self.addNode(bytes32(2)); +self.getNext(bytes32(1));//Exptected to be 2 +``` + +### ***6. getTail 函数*** + +getTail用于取得链表元素的尾部元素。时间复杂度O(1) + +#### 参数 + +- LinkedList:链表实例 + +#### 返回值 + +- bytes32:尾部元素值 + +#### 实例 + +``` +self.addNode(bytes32(1)); +self.addNode(bytes32(2)); +self.getTail();//Exptected to be 2 +``` + +### ***7. getHead 函数*** + +getHead用于取得链表元素的头部元素。时间复杂度O(1) + +#### 参数 + +- LinkedList:链表实例 + +#### 返回值 + +- bytes32:头部元素值 + +#### 实例 + +``` +self.addNode(bytes32(1)); +self.addNode(bytes32(2)); +self.getHead();//Exptected to be 1 +``` + +### ***8. 迭代函数*** + +迭代函数用于从头到尾迭代链表。 + +#### 实例 + +``` + bytes32 start = self.iterate_start(); + while(self.can_iterate(start)){ + //DO BIZ + + start = self.iterate_next(start); + } +``` diff --git a/docs/data_structures/LibMaxHeapUint256.md b/docs/data_structures/LibMaxHeapUint256.md new file mode 100644 index 00000000..85c4771e --- /dev/null +++ b/docs/data_structures/LibMaxHeapUint256.md @@ -0,0 +1,114 @@ +# LibMaxHeapUint256.sol + +LibMaxHeapUint256提供了最大堆的实现。 + +## 使用方法 + +首先需要通过import引入类库,然后通过"."进行方法调用,如下为调用例子: + +``` + +pragma solidity ^0.4.25; + +import "./LibMaxHeapUint256.sol"; + +contract Test { + + using LibMaxHeapUint256 for LibMaxHeapUint256.Heap; + + LibMaxHeapUint256.Heap private _heap; + + function insertExample(uint256 value) public returns(uint256) { + _heap.insert(value); + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *insert(Heap storage heap, uint256 value) internal* | 向堆中插入一个元素 +2 | *top(Heap storage heap) internal view returns (uint256)* |查询堆顶元素(最大值) +3 | *extractTop(Heap storage heap) internal returns(uint256 top)* |弹出堆顶元素(最大值) +4 | *getSize(Heap storage heap) internal view returns(uint256)* | 查询堆元素数 + +## API详情 + +### ***1. insert 函数*** + +向堆中插入一个元素 + +#### 参数 + +- Heap heap:堆 +- uint256 value:元素 + +#### 实例 + +``` + function insertExample(uint256 value) public returns(uint256) { + _heap.insert(value); + } + +``` +### ***2. top 函数*** + +查询堆顶 + +#### 参数 + +- Heap heap:堆 + +#### 返回值 + +- uint256: 堆顶元素 + +#### 实例 + +``` + function topExample() public returns(uint256 top) { + top = _heap.top(); + } + +``` +### ***3. extractTop 函数*** + +弹出堆顶元素 + +#### 参数 + +- Heap heap:堆 + +#### 返回值 + +- uint256: 堆顶元素 + +#### 实例 + +``` + function extractTopExample() public returns(uint256 top) { + top = _heap.extractTop(); + } +``` + +### ***4. getSize 函数*** + +获取堆元素数 + +#### 参数 + +- Heap heap:堆 + +#### 返回值 + +- uint256: 堆元素数 + +#### 实例 + +``` + function getSize() public returns(uint256 size) { + size = _heap.getSize(); + } +``` \ No newline at end of file diff --git a/docs/data_structures/LibMinHeapUint256.md b/docs/data_structures/LibMinHeapUint256.md new file mode 100644 index 00000000..1a934199 --- /dev/null +++ b/docs/data_structures/LibMinHeapUint256.md @@ -0,0 +1,114 @@ +# LibMinHeapUint256.sol + +LibMinHeapUint256提供了最小堆的实现。 + +## 使用方法 + +首先需要通过import引入类库,然后通过"."进行方法调用,如下为调用例子: + +``` + +pragma solidity ^0.4.25; + +import "./LibMinHeapUint256.sol"; + +contract Test { + + using LibMinHeapUint256 for LibMinHeapUint256.Heap; + + LibMinHeapUint256.Heap private _heap; + + function insertExample(uint256 value) public returns(uint256) { + _heap.insert(value); + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *insert(Heap storage heap, uint256 value) internal* | 向堆中插入一个元素 +2 | *top(Heap storage heap) internal view returns (uint256)* |查询堆顶元素(最小值) +3 | *extractTop(Heap storage heap) internal returns(uint256 top)* |弹出堆顶元素(最小值) +4 | *getSize(Heap storage heap) internal view returns(uint256)* | 查询堆元素数 + +## API详情 + +### ***1. insert 函数*** + +向堆中插入一个元素 + +#### 参数 + +- Heap heap:堆 +- uint256 value:元素 + +#### 实例 + +``` + function insertExample(uint256 value) public returns(uint256) { + _heap.insert(value); + } + +``` +### ***2. top 函数*** + +查询堆顶 + +#### 参数 + +- Heap heap:堆 + +#### 返回值 + +- uint256: 堆顶元素 + +#### 实例 + +``` + function topExample() public returns(uint256 top) { + top = _heap.top(); + } + +``` +### ***3. extractTop 函数*** + +弹出堆顶元素 + +#### 参数 + +- Heap heap:堆 + +#### 返回值 + +- uint256: 堆顶元素 + +#### 实例 + +``` + function extractTopExample() public returns(uint256 top) { + top = _heap.extractTop(); + } +``` + +### ***4. getSize 函数*** + +获取堆元素数 + +#### 参数 + +- Heap heap:堆 + +#### 返回值 + +- uint256: 堆元素数 + +#### 实例 + +``` + function getSize() public returns(uint256 size) { + size = _heap.getSize(); + } +``` \ No newline at end of file diff --git a/docs/data_structures/LibQueue.md b/docs/data_structures/LibQueue.md new file mode 100644 index 00000000..ef66d054 --- /dev/null +++ b/docs/data_structures/LibQueue.md @@ -0,0 +1,119 @@ +# LibQueue.sol + +LibQueue提供了FIFO队列数据结构。 + +## 使用方法 + +首先需要通过import引入LibQueue类库,然后通过"."进行方法调用,如下为调用LibQueue方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibQueue.sol"; + +contract Test { + + using LibQueue for LibQueue.Queue; + + LibQueue.Queue private queue; + + function f() public { + queue.enqueue(1); + queue.enqueue(2); + bytes32 pop = queue.dequeue();//Expected to be 1 + uint size = queue.getSize();//Expected to be 1 + } + +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *enqueue(Queue storage queue, bytes32 data) public* |入队 +2 | *dequeue(Queue storage queue) public returns (bytes32)* |出队 +3 | *getSize(Queue storage self) internal view returns(uint256)* | 获取队列元素数 +4 | *element(Queue storage queue) public view returns (bytes32)* | 查询下一个队列中的值,但不从queue中删除。 + +## API详情 + +### ***1. enqueue 函数*** + +入队 + +#### 参数 + +- Queue:队列 +- bytes32: 元素 + +#### 返回值 + + +#### 实例 + +``` + queue.enqueue(1); + queue.enqueue(2); +``` +### ***2. dequeue 函数*** + +出队一个元素 + +#### 参数 + +- Queue: 队列 + +#### 返回值 + +- bytes32:队列元素值 + +#### 实例 + +``` + queue.enqueue(1); + queue.enqueue(2); + bytes32 pop = queue.dequeue();//Expected to be 1 +``` + +### ***3. getSize 函数*** + +查询队列大小 + +#### 参数 + +- Queue: 队列 + +#### 返回值 + +- uint256: 队列大小 + +#### 实例 + +``` + stack.push(1); + stack.push(2); + uint size = queue.getSize();//Expected to be 2 +``` + +### ***4. element 函数*** + +查询队列中的下一个元素,如果队列为空,则函数查询不成功。 + +#### 参数 + +- Queue: 队列 + +#### 返回值 + +- bytes32:队列元素值 + +#### 实例 + +``` + queue.enqueue(1); + queue.enqueue(2); + bytes32 pop = queue.element();//Expected to be 1 +``` + diff --git a/docs/data_structures/LibStack.md b/docs/data_structures/LibStack.md new file mode 100644 index 00000000..ff9113f8 --- /dev/null +++ b/docs/data_structures/LibStack.md @@ -0,0 +1,117 @@ +# LibStack.sol + +LibStack提供了栈数据结构。 + +## 使用方法 + +首先需要通过import引入LibStack类库,然后通过"."进行方法调用,如下为调用LibStack方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibStack.sol"; + +contract Test { + + using LibStack for LibStack.Stack; + + LibStack.Stack private stack; + + function f() public { + stack.push(1); + stack.push(2); + bytes32 pop = stack.pop();//Expect to be 2 + uint size = stack.getSize();//Expected to be 1 + } + +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *push(Stack storage self, bytes32 data) internal* |压入一个元素 +2 | *pop(Stack storage self) internal returns(bytes32)* |弹出一个元素 +3 | *peek(Stack storage self) internal view returns(bytes32)* |查询栈顶元素 +4 | *getSize(Stack storage self) internal view returns(uint256)* | 获取栈元素数 + + +## API详情 + +### ***1. push 函数*** + +压入一个元素 + +#### 参数 + +- Stack:栈 +- bytes32: 元素 + +#### 返回值 + + +#### 实例 + +``` +stack.push(1); +``` +### ***2. pop 函数*** + +弹出一个元素 + +#### 参数 + +- Stack: 栈 + +#### 返回值 + +- bytes32:栈顶元素值 + +#### 实例 + +``` + stack.push(1); + stack.push(2); + bytes32 pop = stack.pop();//Expect to be 2 +``` + +### ***3. peek 函数*** + +查询栈顶元素 + +#### 参数 + +- Stack: 栈 + +#### 返回值 + +- bytes32:栈顶元素值 + +#### 实例 + +``` + stack.push(1); + stack.push(2); + bytes32 pop = stack.peek();//Expected to be 2 +``` + + +### ***4. getSize 函数*** + +获取元素数 + +#### 参数 + +- Stack: 栈 + +#### 返回值 + +- uint256: 栈包含的元素数 + +#### 实例 + +``` +uint256 size = stack.getSize(); +``` diff --git a/docs/types/LibAddress.md b/docs/types/LibAddress.md new file mode 100644 index 00000000..92341abd --- /dev/null +++ b/docs/types/LibAddress.md @@ -0,0 +1,157 @@ +# LibAddress.sol + +LibAddress提供了address数据类型的基本操作,相关API列表如下。 + +## 使用方法 + +首先需要通过import引入LibAddresss类库,然后通过"."进行方法调用,如下为调用isEmptyAddress方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibAddress.sol" + +contract test { + + function f(address account) returns(bool) { + if(!LibAddress.isEmptyAddress(account)) { + //TODO + } + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *isContract(address account) internal view returns(bool)* | 判断地址是否为合约地址 +2 | *isEmptyAddress(address addr) internal pure returns(bool)* |判断地址是否为空地址 +3 | *addressToBytes(address addr) internal pure returns (bytes memory)* |将address转化为bytes类型 +4 | *bytesToAddress(bytes addrBytes) internal pure returns (address)* | 将bytes类型转化为地址类型 +5 | *addressToString(address addr) internal pure returns(string)* | 将地址类型转化为string类型 +6 | *stringToAddress(string data) internal returns(address)* | 将string类型转化为address类型 + +## API详情 + +### ***1. isContract 方法*** + +isContract方法用于判断一个address是否为合约地址。 + +#### 参数 + +- account:地址 + +#### 返回值 + +- bool:返回bool型,当为合约账户地址时,返回true,反之,返回false。 + +#### 实例 + +``` +address myContract = "0x2177482819289293288f8d8s88f99f99s"; +if(LibAddress.isContract(myContract)){ + //TODO: +} +``` +### ***2. isEmptyAddress 方法*** + +isEmptyAddress方法用于判断一个address是否为空地址。 + +#### 参数 + +- addr:地址 + +#### 返回值 + +- bool:返回bool型,当为空地址时,返回true,反之,返回false。 + +#### 实例 + +``` +address addr = "0x00"; +if(!LibAddress.isEmptyAddress(addr)){ + //TODO: +} +``` +### ***3. addressToBytes 方法*** + +addressToBytes方法可以把一个地址类型转化为bytes类型。 + +#### 参数 + +- addr:地址 + +#### 返回值 + +- bytes:返回转化后的bytes值。 + +#### 实例 + +``` +address addr = "0xdfe34njfdkajfej9890f"; +bytes bs = LibAddress.addressToBytes(addr); +//TODO: +``` + +### ***4. bytesToAddress 方法*** + +bytesToAddress方法可以把一个bytes类型转化为address类型。 + +#### 参数 + +- bytes:字节数组 + +#### 返回值 + +- address:返回转化后的address值。 + +#### 实例 + +``` +bytes bs = "0xdfe34njfdkajfej9890f"; +address addr = LibAddress.bytesToAddress(bs); +//TODO: +``` + +### ***5. addressToString 方法*** + +addressToString方法可以把一个address类型转化为string类型。 + +#### 参数 + +- addr:地址 + +#### 返回值 + +- string:返回转化后的string值。 + +#### 实例 + +``` +address addr = "0xdfe34njfdkajfej9890f"; +string addrStr = LibAddress.addressToString(addr); +//TODO: +``` + +### ***6. stringToAddress 方法*** + +stringToAddress方法可以把一个string类型转化为address类型。 + +#### 参数 + +- string:字符串 + +#### 返回值 + +- address:返回转化后的address值。 + +#### 实例 + +``` +string str = "0xdfe34njfdkajfej9890f"; +address addr = LibAddress.stringToAddress(str); +//TODO: +``` + diff --git a/docs/types/LibArrayForUint256Utils.md b/docs/types/LibArrayForUint256Utils.md new file mode 100644 index 00000000..e4853d38 --- /dev/null +++ b/docs/types/LibArrayForUint256Utils.md @@ -0,0 +1,328 @@ +# LibArrayForUint256Utils.sol + +LibArrayForUint256Utils提供了Uint256数组的相关操作,包括查找、比较、移除、添加、翻转、合并、去重和排序等操作。 + +## 使用方法 + +首先需要通过import引LibArrayForUint256Utils类库,然后通过"."进行方法调用,如下为调用indexOf方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibArrayForUint256Utils.sol" + +contract test { + + function f(uint256[] storage array) public view returns(bool) { + uint256 key = 25; + bool flag; + uint index; + (flag, index) = LibArrayForUint256Utils.indexOf(array, key); + if(flag){ + //TODO: + } + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *binarySearch(uint256[] storage array, uint256 key) internal pure returns (bool, uint)* | 对一个升序的数组进行二分查找 +2 | *indexOf(uint256[] storage array, uint256 key) internal pure returns (bool, uint)* |对任意数组进行查找 +3 | *reverse(uint256[] storage array) internal* |对数组进行翻转操作 +4 | *equals(uint256 a[], uint256 b[]) internal pure returns (bool)* | 判断两个数组是否相同 +5 | *removeByIndex(uint256[] storage array, uint index) internal* | 根据索引删除数据元素 +6 | *removeByValue(uint256[] storage array, uint256 value) internal* | 根据值进行数据元素删除,只删除第一个匹配的元素 +7 | *addValue(uint256[] storage array, uint256 value) internal* | 当数组中不存在元素时,把元素添加在数组末尾 +8 | *extend(uint256[] storage a, uint256[] storage b) internal* | 合并两个数组,将第二个数组合并在第一个数组上 +9 | *distinct(uint256[] storage array) internal returns (uint256 length)* | 对数组进行去重操作 +10 | *qsort(uint256[] storage array) internal pure* | 对数组进行升序排列 +11 | *max(uint256[] storage array) internal view returns (uint256, uint256)* | 找出数组的最大值及index +12 | *min(uint256[] storage array) internal view returns (uint256, uint256)* | 找出数组的最小值及index + + +## API详情 + +### ***1. binarySearch 方法*** + +binarySearch对一个升序排列的数组进行二分查找,如果找到,则返回true,并返回第一个匹配的元素索引;反之,返回(false,0) + +#### 参数 + +- array:升序排列的数组 +- key:待查找的元素 + +#### 返回值 + +- bool:当找到元素,则返回true,反之,返回false; +- uint:当找到元素,返回第一个匹配的元素索引,反之返回0; + +#### 实例 + +``` +function f(uint256[] storage array) public view returns(bool) { + uint256 key = 25; + bool flag; + uint index; + (flag, index) = LibArrayForUint256Utils.binarySearch(array, key); + if(flag){ + //TODO: + } +} +``` +### ***2. indexOf 方法*** + +indexOf对任意数组进行查找,如果找到,则返回true,并返回第一个匹配的元素索引;反之,返回(false,0) + +#### 参数 + +- array:升序排列的数组 +- key:待查找的元素 + +#### 返回值 + +- bool:当找到元素,则返回true,反之,返回false; +- uint:当找到元素,返回第一个匹配的元素索引,反之返回0; + +#### 实例 + +``` +function f(uint256[] storage array) public view returns(bool) { + uint256 key = 25; + bool flag; + uint index; + (flag, index) = LibArrayForUint256Utils.indexOf(array, key); + if(flag){ + //TODO: + } +} +``` + +### ***3. reverse 方法*** + +reverse方法对任意数组进行元素翻转。 + +#### 参数 + +- array:数组 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f(uint256[] storage array) public view returns(bool) { + LibArrayForUint256Utils.reverse(array); + //TODO: +} +``` + +### ***4. equals 方法*** + +equals方法用于判断两个数组是否相等,当两个数组的元素完全相等时,则返回true,反之返回false。 + +#### 参数 + +- a:数组a +- b:数组b + +#### 返回值 + +- bool:当两个数组的元素完全相等时,则返回true,反之返回false + +#### 实例 + +``` +function f(uint256[] storage a, uint256[] storage b) public view returns(bool) { + bool flag = LibArrayForUint256Utils.equals(array); + if(flag){ + //TODO: + } +} +``` + +### ***5. removeByIndex 方法*** + +removeByIndex方法用于根据索引删除数组元素。当数据越界时报错,当元素不存在时,数组保持不变。 + +#### 参数 + +- array:数组 +- index:待删除的元素索引 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f(uint256[] storage a) public view returns(bool) { + uint index = 10; + LibArrayForUint256Utils.removeByIndex(array,index); + //TODO: +} +``` + +### ***6. removeByValue 方法*** + +removeByValue方法用于根据元素值删除数组元素。当数据越界时报错,当元素不存在时,数组保持不变,只删除第一个匹配的元素。 + +#### 参数 + +- array:数组 +- value:待删除的元素值 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f(uint256[] storage a) public view returns(bool) { + uint256 value = 100; + LibArrayForUint256Utils.removeByValue(array,value); + //TODO: +} +``` + +### ***7. addValue 方法*** + +addValue方法用于向数组中添加元素,且保持数组的元素唯一。当数组中已存在当前值,则不进行添加。 + +#### 参数 + +- array:数组 +- value:待添加的元素 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f(uint256[] storage a) public view returns(bool) { + uint256 value = 100; + LibArrayForUint256Utils.addValue(array,value); + //TODO: +} +``` + +### ***8. extend 方法*** + +extend方法用于合并两个数组,将第二个数组中的元素按照顺序追加到第一个数组后面。 + +#### 参数 + +- a:被追加数组 +- b:待追加数组 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f(uint256[] storage a, uint256[] storage b) public view returns(bool) { + LibArrayForUint256Utils.extend(a,b); + //TODO: +} +``` + +### ***9. distinct 方法*** + +distinct方法用于对数组进行去重操作。 + +#### 参数 + +- array:数组 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f() public view returns(bool) { + uint256 array = [1,2,1,3,4,5,4,7,10]; + LibArrayForUint256Utils.distinct(array); + //array = [1,2,3,4,5,7,10] +} +``` + +### ***10. qsort 方法*** + +qsort方法用于对数组进行快速排序。 + +#### 参数 + +- array:数组 + +#### 返回值 + +- 无 + +#### 实例 + +``` +function f() public view returns(bool) { + uint256 array = [1,5,3,7,4]; + LibArrayForUint256Utils.qsort(array); + //array = [1,3,4,5,7] +} +``` + +### ***11. max 方法*** + +对任意数组进行查找最大值,并返回最大值所在的index + +#### 参数 + +- array:待查找的数组 + +#### 返回值 + +- uint256:最大值; +- uint256:最大值的index; + +#### 实例 + +``` +function f(uint256[] storage array) public view returns(bool) { + uint256 value; + uint256 index; + (value, index) = LibArrayForUint256Utils.max(array); +} +``` + +### ***12. min 方法*** + +对任意数组进行查找最小值,并返回最小值所在的index + +#### 参数 + +- array:待查找的数组 + +#### 返回值 + +- uint256:最小值; +- uint256:最小值的index; + +#### 实例 + +``` +function f(uint256[] storage array) public view returns(bool) { + uint256 value; + uint256 index; + (value, index) = LibArrayForUint256Utils.min(array); +} +``` \ No newline at end of file diff --git a/docs/types/LibConverter.md b/docs/types/LibConverter.md new file mode 100644 index 00000000..5da08916 --- /dev/null +++ b/docs/types/LibConverter.md @@ -0,0 +1,214 @@ +# LibConverter.sol + +LibConverter提供各类solidity数据基本类型的转换,包括uint256转uint128、uint64、uint32等,uint256转bytes,int转bytes,bytes转int等转换方法。 + +## 使用方法 + +首先需要通过import引入LibConverter类库,调用库的相关方法: + +``` +pragma solidity ^0.4.25; + +import "./LibConverter.sol" + +contract test { + + function f() public view{ + uint256 a = 25; + uint16 b = LibConverter.uint256ToUint16(a); + //TODO: + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *uint256ToUint128(uint256 value) internal pure returns (uint128)* | 将uint256转为uint128类型 +2 | *uint256ToUint64(uint256 value) internal pure returns (uint64)* | 将uint256转为uint64类型 +3 | *uint256ToUint32(uint256 value) internal pure returns (uint32)* | 将uint256转为uint32类型 +4 | *uint256ToUint16(uint256 value) internal pure returns (uint16)* | 将uint256转为uint16类型 +5 | *uint256ToUint8(uint256 value) internal pure returns (uint8)* | 将uint256转为uint8类型 +6 | *uintToBytes(uint v) internal pure returns (bytes)* | 将uint转为bytes类型 +7 | *bytesToInt(bytes b) internal pure returns (int result)* | 将bytes转为int类型 +8 | *intToBytes(int v) internal pure returns (bytes)* | 将int转为bytes类型 + +## API详情 + +### ***1. uint256ToUint128 方法*** + +将uint256转为uint128类型,如超出uint128的最大值,则报错退出。 + +#### 参数 + +- uint256:转换数 + +#### 返回值 + +- uint128:返回转换结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint128 b = LibConverter.uint256ToUint128(a); + //TODO: +} +``` + +### ***2. uint256ToUint64 方法*** + +将uint256转为uint64类型,如超出uint64的最大值,则报错退出。 + +#### 参数 + +- uint256:转换数 + +#### 返回值 + +- uint64:返回转换结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint64 b = LibConverter.uint256ToUint64(a); + //TODO: +} +``` + +### ***3. uint256ToUint32 方法*** + +将uint256转为uint32类型,如超出uint32的最大值,则报错退出。 + +#### 参数 + +- uint256:转换数 + +#### 返回值 + +- uint32:返回转换结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint32 b = LibConverter.uint256ToUint32(a); + //TODO: +} +``` + +### ***4. uint256ToUint16 方法*** + +将uint256转为uint16类型,如超出uint16的最大值,则报错退出。 + +#### 参数 + +- uint256:转换数 + +#### 返回值 + +- uint16:返回转换结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint16 b = LibConverter.uint256ToUint16(a); + //TODO: +} +``` + +### ***5. uint256ToUint8 方法*** + +将uint256转为uint8类型,如超出uint8的最大值,则报错退出。 + +#### 参数 + +- uint256:转换数 + +#### 返回值 + +- uint8:返回转换结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint8 b = LibConverter.uint256ToUint8(a); + //TODO: +} +``` + +### ***5. uintToBytes 方法*** + +将uint256转为bytes类型。 + +#### 参数 + +- uint:转换数 + +#### 返回值 + +- bytes:转换结果 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + bytes b = LibConverter.uintToBytes(a); + //TODO: +} +``` + +### ***6. bytesToInt 方法*** + +将bytes转为uint256类型。 + +#### 参数 + +- bytes:转换字节 + +#### 返回值 + +- int:转换结果 + +#### 实例 + +``` +function f() public view{ + bytes a = "25"; + int b = LibConverter.bytesToInt(a); + //TODO: +} +``` + +### ***7. intToBytes 方法*** + +将int转为bytes类型。 + +#### 参数 + +- int:转换数 + +#### 返回值 + +- bytes:转换结果 + +#### 实例 + +``` +function f() public view{ + int a = 25; + bytes b = LibConverter.intToBytes(a); + //TODO: +} +``` diff --git a/docs/types/LibSafeMathForUint256Utils.md b/docs/types/LibSafeMathForUint256Utils.md new file mode 100644 index 00000000..5cfb681f --- /dev/null +++ b/docs/types/LibSafeMathForUint256Utils.md @@ -0,0 +1,256 @@ +# LibSafeMathForUint256Utils.sol + +LibSafeMathForUint256Utils提供了Uint256类型的相关计算操作,且保证数据的正确性和安全性,包括加法、减法、乘法、除法、取模、乘方、最大值、最小值和平均数等操作。 + +## 使用方法 + +首先需要通过import引LibSafeMathForUint256Utils类库,然后通过"."进行方法调用,如下为调用add方法的例子: + +``` +pragma solidity ^0.4.25; + +import "./LibSafeMathForUint256Utils.sol" + +contract test { + + function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.add(a,b); + //TODO: + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *add(uint256 a, uint256 b) internal pure returns (uint256)* | 加法操作 +2 | *sub(uint256 a, uint256 b) internal pure returns (uint256)* | 减法操作 +3 | *mul(uint256 a, uint256 b) internal pure returns (uint256)* | 乘法操作 +4 | *div(uint256 a, uint256 b) internal pure returns (uint256)* | 除法操作 +5 | *mod(uint256 a, uint256 b) internal pure returns (uint256)* | 取模操作 +6 | *power(uint256 a, uint256 b) internal pure returns (uint256)* | 乘方操作 +7 | *max(uint256 a, uint256 b) internal pure returns (uint256)* | 取最大值操作 +8 | *min(uint256 a, uint256 b) internal pure returns (uint256)* | 取最小值操作 +9 | *average(uint256 a, uint256 b) internal pure returns (uint256)* | 求平均数操作 + +## API详情 + +### ***1. add 方法*** + +add对两个数进行加法操作,返回相加之后的结果。 + +#### 参数 + +- a:加数 +- b:加数 + +#### 返回值 + +- uint256:返回相加的结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.add(a,b); + //TODO: +} +``` + +### ***2. sub 方法*** + +sub对两个数进行减法操作,返回相减之后的结果。 + +#### 参数 + +- a:被减数 +- b:减数 + +#### 返回值 + +- uint256:返回相减的结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.sub(a,b); + //TODO: +} +``` + +### ***3. mul 方法*** + +mul方法对两个数进行乘法操作,返回相乘之后的结果。 + +#### 参数 + +- a:被乘数 +- b:乘数 + +#### 返回值 + +- uint256:返回相乘的结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.mul(a,b); + //TODO: +} +``` + +### ***4. div 方法*** + +div方法对两个数进行除法操作,返回相除之后的结果。 + +#### 参数 + +- a:被除数 +- b:除数 + +#### 返回值 + +- uint256:返回相除的结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.div(a,b); + //TODO: +} +``` + +### ***5. mod 方法*** + +mod方法对两个数进行取模操作,返回取模之后的结果。 + +#### 参数 + +- a:被取模的数 +- b:模值 + +#### 返回值 + +- uint256:返回取模的结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.mod(a,b); + //TODO: +} +``` + +### ***5. power 方法*** + +power方法对两个数进行乘方操作,返回乘方之后的结果。 + +#### 参数 + +- a:基数 +- b:乘方值 + +#### 返回值 + +- uint256:返回乘方的结果。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.power(a,b); + //TODO: +} +``` + +### ***6. max 方法*** + +max方法对两个数进行比较,返回最大值。 + +#### 参数 + +- a:数值1 +- b:数值2 + +#### 返回值 + +- uint256:返回最大值。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.max(a,b); + //TODO: +} +``` + +### ***7. min 方法*** + +min方法对两个数进行比较,返回最小值。 + +#### 参数 + +- a:数值1 +- b:数值2 + +#### 返回值 + +- uint256:返回最小值。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.mix(a,b); + //TODO: +} +``` + +### ***8. average 方法*** + +average方法对两个数求平均值,返回平均值。 + +#### 参数 + +- a:数值1 +- b:数值2 + +#### 返回值 + +- uint256:返回平均值。 + +#### 实例 + +``` +function f() public view{ + uint256 a = 25; + uint256 b = 20; + uint256 c = LibSafeMathForUint256Utils.average(a,b); + //TODO: +} +``` diff --git a/docs/types/LibString.md b/docs/types/LibString.md new file mode 100644 index 00000000..4b9abcb6 --- /dev/null +++ b/docs/types/LibString.md @@ -0,0 +1,408 @@ +# LibString.sol + +LibString提供了常用的字符串操作。这些操作是基于字符的,而非字节。 + +## 使用方法 + +首先需要通过import引入LibString类库, 以下为使用示例 + +``` +pragma solidity ^0.4.25; + +import "./LibString.sol"; + +contract TestString { + + function f() public view returns(uint){ + string memory str = "字符串"; + uint len = LibString.lenOfChars(str);//Expected to be 3 + //TODO: + } +} +``` + + +## API列表 + +编号 | API | API描述 +---|---|--- +1 | *lenOfChars(string src) internal pure returns(uint)* | 获取字符个数 +2 | *lenOfBytes(string src) internal pure returns(uint)* | 获取字节个数 +3 | *startWith(string src, string prefix) internal pure returns(bool)* | 前缀串判断 +4 | *endWith(string src, string tail) internal pure returns(bool)* | 尾缀串判断 +5 | *equal(string self, string other)* | 两字符串是否相等 +6 | *equalNocase(string self, string other)* | 两字符串是否相等, 忽视大小写 +7 | *empty(string src) public pure returns(bool)* | 字符串是否为空 +8 | *concat(string self, string str) public returns (string _ret)* | 字符串拼接 +9 | *substrByCharIndex(string self, uint start, uint len) public returns (string)* | 取子字符串,下标是字符下标 +10 | *compare(string self, string other) internal pure returns (int)* | 比较两个字符串的大小 +11 | *compareNocase(string self, string other) internal pure returns (int)* | 比较两个字符串的大小,忽视大小写 +12 | *toUppercase(string src) internal pure returns(string)* | 转换为大写 +13 | *toLowercase(string src) internal pure returns(string)* | 转换为小写 +14 | *indexOf(string src, string value) internal pure returns (int)* | 查找字符串中是否含有子字符串 +15 | *indexOf(string src, string value, uint offset) internal pure returns (int)* | 查找字符串中是否含有子字符串 +16 | *split(string src, string separator) internal pure returns (string[])* | 字符串根据分隔符拆分成数组 + +## API详情 + +### ***1. lenOfChars 方法*** + +获取一个字符串所包含的字符数量 + +#### 参数 + +- src: 字符串 + +#### 返回值 + +- uint256:字符个数 + +#### 实例 + +``` + function f() public view{ + string memory str = "字符串"; + uint len = LibString.lenOfChars(str);//Expected to be 3 + //TODO: + } +``` + +### ***2. lenOfBytes 方法*** + +获取一个字符串所包含的字节数量 + +#### 参数 + +- src: 字符串 + +#### 返回值 + +- uint256:字节个数 + +#### 实例 + +``` + function f() public view{ + string memory str = "字符串"; + uint len = LibString.lenOfBytes(str);//Expected to be 9 + //TODO: + } +``` + +### ***3. startWith 方法*** + +startWith用于判断一个字符串是否为另一个字符串的前缀串 + +#### 参数 + +- src:字符串 +- prefix:子串 + +#### 返回值 + +- bool: prefix是否为src的前缀串 + +#### 实例 + +``` + function f() public view { + + bool r = LibString.startWith("abcd","ab");//Expected to be true + //TODO: + } +``` + +### ***4. endWith 方法*** + +endWith用于测试一个字符串是否为另一个字符串的尾缀串 + +#### 参数 + +- src: 字符串 +- tail:子串 + +#### 返回值 + +- bool: tail是否为src的尾缀串 + +#### 实例 + +``` + function f() public view { + + bool r = LibString.endWith("abcd","cd");//Expected to be true + //TODO: + } +``` + +### ***5. equal 方法*** + +用于判断两个字符串是否相等。 + +#### 参数 + +- self:字符串 +- other:字符串 + +#### 返回值 + +- bool: 两个字符串是否相等 + +#### 实例 + +``` + function f() public view { + + bool r = LibString.equal("abcd","abcd");//Expected to be true + //TODO: + } +``` + +### ***6. equalNocase 方法*** + +用于判断两个字符串是否相等。忽视大小写 + +#### 参数 + +- self:字符串 +- other:字符串 + +#### 返回值 + +- bool: 两个字符串是否相等。忽视大小写 + +#### 实例 + +``` + function f() public view { + + bool r = LibString.equal("abcd","ABCD");//Expected to be true + //TODO: + } +``` + +### ***7. empty 方法*** + +判断字符串是否为空串 + +#### 参数 + +- src: 待判断串 + +#### 返回值 + +- bool: 该字符串是否为空串 + +#### 实例 + +``` + function f() public view returns(bool, bool){ + + bool r1 = LibString.empty("abcd");//Expected to be false + bool r2 = LibString.empty("");//Expected to be true + //TODO: + return (r1,r2); + } +``` + +### ***8. concat 方法*** + +该方法连接两个字符串,并得到一个新的字符串。 + +#### 参数 + +- self:当前字符串 +- str:另一个字符串 + +#### 返回值 + +- string: 拼接所得字符串 + +#### 实例 + +``` + function f() public view { + string memory s1 = "ab"; + string memory s2 = "cd"; + string memory r = LibString.concat(s1,s2);//Exptected to be abcd + } +``` + +### ***9. substrByCharIndex方法*** + +substrByCharIndex方法用于提取子字符串。 + +#### 参数 + +- self:当前字符串 +- start:子串起点字符的下标 +- end: 字串的字符长度 + +#### 返回值 + +- string: 子串 + +#### 实例 + +``` + function f() public view returns(string) { + string memory full = "完整字符串"; + string memory sub = LibString.substrByCharIndex(full ,2, 3);//Expected to be 字符串 + return sub; + } +``` + +### ***10. compare 方法*** + +用于判断两个字符串的大小。 + +#### 参数 + +- self:字符串 +- other:字符串 + +#### 返回值 + +- int8: -1:左值小于右边,0:相等,1-左值大于右边 + +#### 实例 + +``` + function f() public view { + + int8 c = LibString.compare("abcd","abcd");// Expected to be 0 + } +``` + + +### ***11. compareNocase 方法*** + +用于判断两个字符串的大小。忽视大小写 + +#### 参数 + +- self:字符串 +- other:字符串 + +#### 返回值 + +- int8: -1:左值小于右边,0:相等,1-左值大于右边 + +#### 实例 + +``` + function f() public view { + + int8 c = LibString.compareNocase("abcd","ABCD");// Expected to be 0 + } +``` + +### ***12. toUppercase 方法*** + +转换成大写 + +#### 参数 + +- src: 字符串 + +#### 返回值 + +- string: 大写字符串 + +#### 实例 + +``` + function f() public view { + + string c = LibString.toUppercase("abcd");// Expected to be ABCD + } +``` + +### ***13. toLowercase 方法*** + +转换成小写 + +#### 参数 + +- src: 字符串 + +#### 返回值 + +- string: 小写字符串 + +#### 实例 + +``` + function f() public view { + + string c = LibString.toLowercase("ABCD");// Expected to be abcd + } +``` + +### ***14. indexOf 方法*** + +查找字符串中相同子字符串的位置 + +#### 参数 + +- string: 字符串 +- string: 子字符串 + +#### 返回值 + +- int: 返回字符串的位置,如不存在返回-1 + +#### 实例 + +``` + function f() public view { + + int c = LibString.indexOf("ABCD", "B");// Expected to be 1 + } +``` + +### ***15. indexOf 方法*** + +查找字符串中相同子字符串的位置 + +#### 参数 + +- string: 字符串 +- string: 子字符串 +- uint: 查找起始位置 + +#### 返回值 + +- int: 返回字符串的位置,如不存在返回-1 + +#### 实例 + +``` + function f() public view { + + int c = LibString.indexOf("ABCD", "B", 0);// Expected to be 1 + } +``` + + +### ***16. split 方法*** + +对字符串按照提供的隔断符分成一个string数组 + +#### 参数 + +- string: 字符串 +- string: 隔断符 + +#### 返回值 + +- string[]: 字符串数组 + +#### 实例 + +``` + function f() public view { + + string[] c = LibString.split("A,B,CD", ",");// Expected to be ["A", "B", "CD"] + } +``` \ No newline at end of file diff --git a/java/biz_templates/evidence/DemoApplicationTests.java b/java/biz_templates/evidence/DemoApplicationTests.java new file mode 100644 index 00000000..8bf8ca2c --- /dev/null +++ b/java/biz_templates/evidence/DemoApplicationTests.java @@ -0,0 +1,61 @@ +package com.example.demo; + +import com.example.demo.contracts.Evidence; +import com.example.demo.contracts.EvidenceRepository; +import com.example.demo.contracts.RequestRepository; +import org.fisco.bcos.web3j.crypto.ECKeyPair; +import org.fisco.bcos.web3j.crypto.gm.GenCredential; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.utils.Numeric; +import org.junit.jupiter.api.Test; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.context.SpringBootTest; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.List; + +@SpringBootTest +class DemoApplicationTests { + + @Autowired + private Web3j web3j; + + @Autowired + private ContractGasProvider contractGasProvider; + + @Test + void test() throws Exception{ + //准备用户 + ECKeyPair aUser = GenCredential.createKeyPair(); + ECKeyPair bUser = GenCredential.createKeyPair(); + ECKeyPair cUser = GenCredential.createKeyPair(); + + //部署基于2-3投票的合约 + BigInteger threshold = BigInteger.valueOf(2); + List voters = Arrays.asList(GenCredential.create(bUser).getAddress(), GenCredential.create(cUser).getAddress()); + EvidenceRepository storageContract = EvidenceRepository.deploy(web3j, GenCredential.create(aUser), contractGasProvider).send(); + RequestRepository voteRepository = RequestRepository.deploy(web3j, GenCredential.create(aUser), contractGasProvider, threshold, voters).send(); + Evidence evidenceA = Evidence.deploy(web3j, GenCredential.create(aUser), contractGasProvider, voteRepository.getContractAddress(), storageContract.getContractAddress()).send(); + storageContract.allow(evidenceA.getContractAddress()).send(); + voteRepository.allow(evidenceA.getContractAddress()).send(); + //A创建存证请求 + byte[] hash = Numeric.toBytesPadded(BigInteger.TEN, 32); + byte[] ext = Numeric.toBytesPadded(BigInteger.TEN, 1); + evidenceA.createSaveRequest(hash, ext).send(); + //B和C进行审核 + Evidence evidenceB = Evidence.load(evidenceA.getContractAddress(), web3j, GenCredential.create(bUser), contractGasProvider); + Evidence evidenceC = Evidence.load(evidenceA.getContractAddress(), web3j, GenCredential.create(cUser), contractGasProvider); + Object obj = evidenceB.getRequestData(hash).send(); + TransactionReceipt receipt = evidenceB.voteSaveRequest(hash).send(); + + evidenceC.voteSaveRequest(hash).send(); + //A取证 + Object evidence = evidenceA.getEvidence(hash).send(); + int i =0; + + } + +} diff --git a/java/wescott/.gitignore b/java/wescott/.gitignore new file mode 100644 index 00000000..0facf5e4 --- /dev/null +++ b/java/wescott/.gitignore @@ -0,0 +1,28 @@ +/target/ +!.mvn/wrapper/maven-wrapper.jar +/bin/ +/.gradle/ + + +### STS ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### IntelliJ IDEA ### +.idea +*.iws +*.iml +*.ipr + +### NetBeans ### +/nbproject/private/ +/build/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ diff --git a/java/wescott/HELP.md b/java/wescott/HELP.md new file mode 100644 index 00000000..9ab160fe --- /dev/null +++ b/java/wescott/HELP.md @@ -0,0 +1,21 @@ +# Getting Started + +### Reference Documentation +For further reference, please consider the following sections: + +* [Official Gradle documentation](https://docs.gradle.org) +* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/gradle-plugin/reference/html/) +* [Spring Web](https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) + +### Guides +The following guides illustrate how to use some features concretely: + +* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) +* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) +* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) + +### Additional Links +These additional references should also help you: + +* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) + diff --git a/java/wescott/build.gradle b/java/wescott/build.gradle new file mode 100644 index 00000000..dc23b399 --- /dev/null +++ b/java/wescott/build.gradle @@ -0,0 +1,40 @@ +plugins { + id 'org.springframework.boot' version '2.2.4.RELEASE' + id 'io.spring.dependency-management' version '1.0.9.RELEASE' + id 'java' + id 'eclipse' + id 'idea' +} + +group = 'com.webank' +version = '0.0.1-SNAPSHOT' +sourceCompatibility = '1.8' + +configurations { + compileOnly { + extendsFrom annotationProcessor + } +} + +repositories { + maven { url "http://maven.aliyun.com/nexus/content/groups/public/"} + maven { url "https://oss.sonatype.org/content/repositories/snapshots" } + maven { url "https://dl.bintray.com/ethereum/maven/" } + mavenLocal() + mavenCentral() +} + + +dependencies { + implementation 'org.springframework.boot:spring-boot-starter-web' + compileOnly 'org.projectlombok:lombok' + annotationProcessor 'org.projectlombok:lombok' + testImplementation('org.springframework.boot:spring-boot-starter-test') { + exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' + } + compile ('org.fisco-bcos:web3sdk:2.2.2') +} + +test { + useJUnitPlatform() +} diff --git a/java/wescott/config/user.jks b/java/wescott/config/user.jks new file mode 100644 index 00000000..e69de29b diff --git a/java/wescott/gradle/wrapper/gradle-wrapper.properties b/java/wescott/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 00000000..94920145 --- /dev/null +++ b/java/wescott/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,5 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/java/wescott/gradlew b/java/wescott/gradlew new file mode 100755 index 00000000..cccdd3d5 --- /dev/null +++ b/java/wescott/gradlew @@ -0,0 +1,172 @@ +#!/usr/bin/env sh + +############################################################################## +## +## Gradle start up script for UN*X +## +############################################################################## + +# Attempt to set APP_HOME +# Resolve links: 0ドル may be a link +PRG="0ドル" +# Need this for relative symlinks. +while [ -h "$PRG" ] ; do + ls=`ls -ld "$PRG"` + link=`expr "$ls" : '.*-> \(.*\)$'` + if expr "$link" : '/.*'> /dev/null; then + PRG="$link" + else + PRG=`dirname "$PRG"`"/$link" + fi +done +SAVED="`pwd`" +cd "`dirname \"$PRG\"`/">/dev/null +APP_HOME="`pwd -P`" +cd "$SAVED">/dev/null + +APP_NAME="Gradle" +APP_BASE_NAME=`basename "0ドル"` + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS="" + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD="maximum" + +warn () { + echo "$*" +} + +die () { + echo + echo "$*" + echo + exit 1 +} + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "`uname`" in + CYGWIN* ) + cygwin=true + ;; + Darwin* ) + darwin=true + ;; + MINGW* ) + msys=true + ;; + NONSTOP* ) + nonstop=true + ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD="$JAVA_HOME/jre/sh/java" + else + JAVACMD="$JAVA_HOME/bin/java" + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD="java" + which java>/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." +fi + +# Increase the maximum file descriptors if we can. +if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then + MAX_FD_LIMIT=`ulimit -H -n` + if [ $? -eq 0 ] ; then + if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then + MAX_FD="$MAX_FD_LIMIT" + fi + ulimit -n $MAX_FD + if [ $? -ne 0 ] ; then + warn "Could not set maximum file descriptor limit: $MAX_FD" + fi + else + warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" + fi +fi + +# For Darwin, add options to specify how the application appears in the dock +if $darwin; then + GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" +fi + +# For Cygwin, switch paths to Windows format before running java +if $cygwin ; then + APP_HOME=`cygpath --path --mixed "$APP_HOME"` + CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` + JAVACMD=`cygpath --unix "$JAVACMD"` + + # We build the pattern for arguments to be converted via cygpath + ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` + SEP="" + for dir in $ROOTDIRSRAW ; do + ROOTDIRS="$ROOTDIRS$SEP$dir" + SEP="|" + done + OURCYGPATTERN="(^($ROOTDIRS))" + # Add a user-defined pattern to the cygpath arguments + if [ "$GRADLE_CYGPATTERN" != "" ] ; then + OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" + fi + # Now convert the arguments - kludge to limit ourselves to /bin/sh + i=0 + for arg in "$@" ; do + CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` + CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option + + if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition + eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` + else + eval `echo args$i`="\"$arg\"" + fi + i=$((i+1)) + done + case $i in + (0) set -- ;; + (1) set -- "$args0" ;; + (2) set -- "$args0" "$args1" ;; + (3) set -- "$args0" "$args1" "$args2" ;; + (4) set -- "$args0" "$args1" "$args2" "$args3" ;; + (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; + (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; + (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; + (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; + (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; + esac +fi + +# Escape application args +save () { + for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done + echo " " +} +APP_ARGS=$(save "$@") + +# Collect all arguments for the java command, following the shell quoting and substitution rules +eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" + +# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong +if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then + cd "$(dirname "0ドル")" +fi + +exec "$JAVACMD" "$@" diff --git a/java/wescott/gradlew.bat b/java/wescott/gradlew.bat new file mode 100644 index 00000000..e95643d6 --- /dev/null +++ b/java/wescott/gradlew.bat @@ -0,0 +1,84 @@ +@if "%DEBUG%" == "" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%" == "" set DIRNAME=. +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS= + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version>NUL 2>&1 +if "%ERRORLEVEL%" == "0" goto init + +echo. +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto init + +echo. +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% +echo. +echo Please set the JAVA_HOME variable in your environment to match the +echo location of your Java installation. + +goto fail + +:init +@rem Get command-line arguments, handling Windows variants + +if not "%OS%" == "Windows_NT" goto win9xME_args + +:win9xME_args +@rem Slurp the command line arguments. +set CMD_LINE_ARGS= +set _SKIP=2 + +:win9xME_args_slurp +if "x%~1" == "x" goto execute + +set CMD_LINE_ARGS=%* + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% + +:end +@rem End local scope for the variables with windows NT shell +if "%ERRORLEVEL%"=="0" goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 +exit /b 1 + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/java/wescott/settings.gradle b/java/wescott/settings.gradle new file mode 100644 index 00000000..e99046c4 --- /dev/null +++ b/java/wescott/settings.gradle @@ -0,0 +1 @@ +rootProject.name = 'wescott' diff --git a/java/wescott/src/main/java/com/webank/wescott/WescottApplication.java b/java/wescott/src/main/java/com/webank/wescott/WescottApplication.java new file mode 100644 index 00000000..4c711e0c --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/WescottApplication.java @@ -0,0 +1,13 @@ +package com.webank.wescott; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class WescottApplication { + + public static void main(String[] args) { + SpringApplication.run(WescottApplication.class, args); + } + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java b/java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java new file mode 100644 index 00000000..37d88c4f --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java @@ -0,0 +1,48 @@ +/** + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.webank.wescott.config; + +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; + +import lombok.Data; + +/** + * System Environment Config. + * + * @Description: SystemEnvironmentConfig + * @author maojiayu + * @data Dec 28, 2018 5:21:48 PM + * + */ +@Configuration +@ConfigurationProperties("system") +@Data +@Order(2) +public class SystemEnvironmentConfig { + private String orgId; + private String nodeStr; + private int groupId; + + private String configPath; + + private String privateKey; + private int crawlBatchUnit = 1000; + + + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java b/java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java new file mode 100644 index 00000000..55ef009d --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java @@ -0,0 +1,145 @@ +/** + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.webank.wescott.config; + +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.security.Key; +import java.security.KeyStore; +import java.security.interfaces.ECPrivateKey; +import java.util.ArrayList; +import java.util.List; + +import org.apache.commons.io.FileUtils; +import org.apache.commons.lang3.StringUtils; +import org.fisco.bcos.channel.client.Service; +import org.fisco.bcos.channel.handler.ChannelConnections; +import org.fisco.bcos.channel.handler.GroupChannelConnectionsConfig; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.crypto.ECKeyPair; +import org.fisco.bcos.web3j.crypto.EncryptType; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.channel.ChannelEthereumService; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.gas.StaticGasProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.core.annotation.Order; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; + +import com.google.common.collect.Lists; +import com.webank.wescott.constant.GasConstants; + +import lombok.extern.slf4j.Slf4j; + +/** + * Web3jV2BeanConfig + * + * @Description: Web3jV2BeanConfig + * @author maojiayu + * @data Apr 16, 2019 11:13:23 AM + * + */ +@Slf4j +@Configuration +@Order(2) +public class Web3jV2BeanConfig { + + @Autowired + private SystemEnvironmentConfig systemEnvironmentConfig; + + @Bean + public Web3j getWeb3j() throws Exception { + ChannelEthereumService channelEthereumService = new ChannelEthereumService(); + Service service = getService(); + service.run(); + channelEthereumService.setChannelService(service); + // default sync transactions timeout: 30s + channelEthereumService.setTimeout(30000); + return Web3j.build(channelEthereumService, service.getGroupId()); + } + + @Bean + public Service getService() { + GroupChannelConnectionsConfig groupChannelConnectionsConfig = getGroupChannelConnections(); + Service channelService = new Service(); + channelService.setOrgID(systemEnvironmentConfig.getOrgId()); + channelService.setGroupId(systemEnvironmentConfig.getGroupId()); + channelService.setAllChannelConnections(groupChannelConnectionsConfig); + // set some default connect timeout seconds + channelService.setConnectSeconds(60); + channelService.setConnectSleepPerMillis(30); + + return channelService; + } + + @Bean + public GroupChannelConnectionsConfig getGroupChannelConnections() { + GroupChannelConnectionsConfig groupChannelConnectionsConfig = new GroupChannelConnectionsConfig(); + ChannelConnections con = new ChannelConnections(); + PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); + Resource ca = resolver.getResource("ca.crt"); + Resource nodeCrt = resolver.getResource("node.crt"); + Resource nodeKey = resolver.getResource("node.key"); + groupChannelConnectionsConfig.setCaCert(ca); + groupChannelConnectionsConfig.setSslCert(nodeCrt); + groupChannelConnectionsConfig.setSslKey(nodeKey); + ArrayList list = new ArrayList(); + List allChannelConnections = new ArrayList(); + String[] nodes = StringUtils.split(systemEnvironmentConfig.getNodeStr(), ";"); + for (int i = 0; i < nodes.length; i++) { + if (nodes[i].contains("@")) { + nodes[i] = StringUtils.substringAfter(nodes[i], "@"); + } + } + List nodesList = Lists.newArrayList(nodes); + list.addAll(nodesList); + list.stream().forEach(s -> { + log.info("connect address: {}", s); + }); + con.setConnectionsStr(list); + con.setGroupId(systemEnvironmentConfig.getGroupId()); + allChannelConnections.add(con); + groupChannelConnectionsConfig.setAllChannelConnections(allChannelConnections); + return groupChannelConnectionsConfig; + } + + @Bean + public EncryptType getEncryptType() { + // 0-RSA 1-Chinese + return new EncryptType(0); + } + + @Bean + public ContractGasProvider getContractGasProvider() { + return new StaticGasProvider(GasConstants.GAS_PRICE, GasConstants.GAS_LIMIT); + } + + public File loadFile(String filePath, String fileName) throws IOException { + File file = new File(filePath); + if (!file.exists()) { + InputStream stream = getClass().getClassLoader().getResourceAsStream(fileName); + FileUtils.copyInputStreamToFile(stream, file); + } + return file; + } + + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java b/java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java new file mode 100644 index 00000000..f707d6e2 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java @@ -0,0 +1,33 @@ +/** + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.webank.wescott.constant; + +import java.math.BigInteger; + +/** + * GasConstants, whose concept was extended from ETH. + * + * @Description: GasConstants + * @author maojiayu + * @data Dec 28, 2018 5:24:03 PM + * + */ +public class GasConstants { + public static final BigInteger GAS_PRICE = new BigInteger("30000000"); + public static final BigInteger GAS_LIMIT = new BigInteger("30000000"); + public static final BigInteger BLOCK_LIMIT = new BigInteger("30000000000"); + public static final BigInteger INITIAL_WEI_VALUE = new BigInteger("0"); +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java b/java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java new file mode 100644 index 00000000..0dbda133 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java @@ -0,0 +1,152 @@ +package com.webank.wescott.contract; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tuples.generated.Tuple2; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class TestSafeMath extends Contract { + public static String BINARY = "608060405234801561001057600080fd5b5060ee8061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680637c3ffef2146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b6000609f828460a790919063ffffffff16565b905092915050565b6000818301905082811015151560b957fe5b809050929150505600a165627a7a723058208b522c69a8d7dc7a5c88af6b77a7405619bdde9fa0bfd412fe6ed0a924824d680029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"a\",\"type\":\"uint256\"},{\"name\":\"b\",\"type\":\"uint256\"}],\"name\":\"testAdd\",\"outputs\":[{\"name\":\"c\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_TESTADD = "testAdd"; + + @Deprecated + protected TestSafeMath(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected TestSafeMath(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected TestSafeMath(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected TestSafeMath(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall

testAdd(BigInteger a, BigInteger b) { + final Function function = new Function( + FUNC_TESTADD, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(a), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(b)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void testAdd(BigInteger a, BigInteger b, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_TESTADD, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(a), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(b)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String testAddSeq(BigInteger a, BigInteger b) { + final Function function = new Function( + FUNC_TESTADD, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(a), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(b)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getTestAddInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_TESTADD, + Arrays.asList(), + Arrays.>asList(new TypeReference() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (BigInteger) results.get(0).getValue(), + (BigInteger) results.get(1).getValue() + ); + } + + public Tuple1 getTestAddOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_TESTADD, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (BigInteger) results.get(0).getValue() + ); + } + + @Deprecated + public static TestSafeMath load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new TestSafeMath(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static TestSafeMath load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new TestSafeMath(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static TestSafeMath load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new TestSafeMath(contractAddress, web3j, credentials, contractGasProvider); + } + + public static TestSafeMath load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new TestSafeMath(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(TestSafeMath.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(TestSafeMath.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(TestSafeMath.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(TestSafeMath.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java new file mode 100644 index 00000000..6a93a0e2 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java @@ -0,0 +1,674 @@ +package com.webank.wescott.contract.authority; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; +import org.fisco.bcos.web3j.abi.EventEncoder; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Event; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.abi.datatypes.Utf8String; +import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.Log; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tuples.generated.Tuple2; +import org.fisco.bcos.web3j.tuples.generated.Tuple3; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class WEAclGuard extends Contract { + public static String BINARY = "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506100693361006e640100000000026401000000009004565b61022d565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610158576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b611e8c8061023c6000396000f3006080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100eb5780631cbfa2cd1461012e578063214569b7146101a95780632936ff2b1461020c5780633f81a192146102755780637a9e5e4b146102cc5780639c21e9091461030f578063a2a52fd01461039b578063b2bdfa7b14610456578063b7009613146104ad578063bfc019c614610551578063c2205ee1146105dd578063d12d910214610634578063d9972b961461069d578063de63e70f14610721578063ff929a521461079c575b600080fd5b3480156100f757600080fd5b5061012c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107ff565b005b34801561013a57600080fd5b506101a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019082018035906020019190919293919293905050506109be565b005b3480156101b557600080fd5b5061020a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109eb565b005b34801561021857600080fd5b50610221610a39565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b34801561028157600080fd5b5061028a610a7c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102d857600080fd5b5061030d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610abf565b005b34801561031b57600080fd5b50610399600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610c89565b005b3480156103a757600080fd5b50610402600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610e8e565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b34801561046257600080fd5b5061046b610efa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b957600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610f1f565b604051808215151515815260200191505060405180910390f35b34801561055d57600080fd5b506105db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050611917565b005b3480156105e957600080fd5b506105f2611b1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561064057600080fd5b50610649611b42565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b3480156106a957600080fd5b50610707600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050611b6d565b604051808215151515815260200191505060405180910390f35b34801561072d57600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050611de5565b005b3480156107a857600080fd5b506107fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e12565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b6109e584848484604051808383808284378201915050925050506040518091039020610c89565b50505050565b610a3582827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c010000000000000000000000000000000000000000000000000000000002611917565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c01000000000000000000000000000000000000000000000000000000000281565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900481565b610aed336000357fffffffff0000000000000000000000000000000000000000000000000000000016611b6d565b1515610b61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167ff54834e369087f9b17bd2b73baa91085cfff591ffb3c11d2622f6cf92ae4cf6a336000357fffffffff0000000000000000000000000000000000000000000000000000000016604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019250505060405180910390a250565b610cb7336000357fffffffff0000000000000000000000000000000000000000000000000000000016611b6d565b1515610d2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff021916908315150217905550807bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ff59111baa782faa3d5c33db8fb4d455d406e73edcf0a852a70caa6c5843eae4c60405160405180910390a4505050565b6000816040518082805190602001908083835b602083101515610ec65780518252602082019150602081019050602083039250610ea1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff16806111195750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806112385750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806113965750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806114b55750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806116135750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806117715750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b8061190e5750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b90509392505050565b611945336000357fffffffff0000000000000000000000000000000000000000000000000000000016611b6d565b15156119b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b6001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff021916908315150217905550807bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fcfe11ceefe6478bea2ebfcd2f48064508489b9f54449e4bc1a2bd2afa359e01b60405160405180910390a4505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080357fffffffff0000000000000000000000000000000000000000000000000000000016905090565b60003073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bac5760019050611ddf565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c0a5760019050611ddf565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c6a5760009050611ddf565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b70096138430856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019350505050602060405180830381600087803b158015611da157600080fd5b505af1158015611db5573d6000803e3d6000fd5b505050506040513d6020811015611dcb57600080fd5b810190808051906020019092919050505090505b92915050565b611e0c84848484604051808383808284378201915050925050506040518091039020611917565b50505050565b611e5c82827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c010000000000000000000000000000000000000000000000000000000002610c89565b50505600a165627a7a723058204f6d7a9c985c7f9f6ddf197f689804819c6873b7ebfbb59ecc207af37d71c8b40029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"string\"}],\"name\":\"forbid\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"}],\"name\":\"permitAny\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ANY_SIG\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ANY_ADDRESS\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"forbid\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"sig\",\"type\":\"string\"}],\"name\":\"getSigFromStr\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"canCall\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"permit\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_authority\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSig\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"isAuthorized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"string\"}],\"name\":\"permit\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"}],\"name\":\"forbidAny\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"src\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"dst\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogPermit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"src\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"dst\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogForbid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"authority\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogSetAuthority\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"type\":\"event\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC_FORBID = "forbid"; + + public static final String FUNC_PERMITANY = "permitAny"; + + public static final String FUNC_ANY_SIG = "ANY_SIG"; + + public static final String FUNC_ANY_ADDRESS = "ANY_ADDRESS"; + + public static final String FUNC_SETAUTHORITY = "setAuthority"; + + public static final String FUNC_GETSIGFROMSTR = "getSigFromStr"; + + public static final String FUNC__OWNER = "_owner"; + + public static final String FUNC_CANCALL = "canCall"; + + public static final String FUNC_PERMIT = "permit"; + + public static final String FUNC__AUTHORITY = "_authority"; + + public static final String FUNC_GETSIG = "getSig"; + + public static final String FUNC_ISAUTHORIZED = "isAuthorized"; + + public static final String FUNC_FORBIDANY = "forbidAny"; + + public static final Event LOGPERMIT_EVENT = new Event("LogPermit", + Arrays.>asList(new TypeReference

(true) {}, new TypeReference
(true) {}, new TypeReference(true) {})); + ; + + public static final Event LOGFORBID_EVENT = new Event("LogForbid", + Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference(true) {})); + ; + + public static final Event LOGSETAUTHORITY_EVENT = new Event("LogSetAuthority", + Arrays.>asList(new TypeReference
(true) {}, new TypeReference
() {}, new TypeReference() {})); + ; + + public static final Event LOGSETOWNER_EVENT = new Event("LogSetOwner", + Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference
(true) {})); + ; + + @Deprecated + protected WEAclGuard(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected WEAclGuard(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected WEAclGuard(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected WEAclGuard(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall
setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
forbid(String src, String dst, String sig) { + final Function function = new Function( + FUNC_FORBID, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void forbid(String src, String dst, String sig, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_FORBID, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String forbidSeq(String src, String dst, String sig) { + final Function function = new Function( + FUNC_FORBID, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple3 getForbidAddressAddressStringInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_FORBID, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple3( + + (String) results.get(0).getValue(), + (String) results.get(1).getValue(), + (String) results.get(2).getValue() + ); + } + + public RemoteCall
permitAny(String src, String dst) { + final Function function = new Function( + FUNC_PERMITANY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void permitAny(String src, String dst, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_PERMITANY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String permitAnySeq(String src, String dst) { + final Function function = new Function( + FUNC_PERMITANY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getPermitAnyInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_PERMITANY, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (String) results.get(0).getValue(), + (String) results.get(1).getValue() + ); + } + + public RemoteCall ANY_SIG() { + final Function function = new Function(FUNC_ANY_SIG, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteCall ANY_ADDRESS() { + final Function function = new Function(FUNC_ANY_ADDRESS, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall
setAuthority(String authority) { + final Function function = new Function( + FUNC_SETAUTHORITY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setAuthority(String authority, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETAUTHORITY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setAuthoritySeq(String authority) { + final Function function = new Function( + FUNC_SETAUTHORITY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetAuthorityInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETAUTHORITY, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
forbid(String src, String dst, byte[] sig) { + final Function function = new Function( + FUNC_FORBID, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void forbid(String src, String dst, byte[] sig, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_FORBID, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String forbidSeq(String src, String dst, byte[] sig) { + final Function function = new Function( + FUNC_FORBID, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple3 getForbidAddressAddressBytes4Input(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_FORBID, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple3( + + (String) results.get(0).getValue(), + (String) results.get(1).getValue(), + (byte[]) results.get(2).getValue() + ); + } + + public RemoteCall getSigFromStr(String sig) { + final Function function = new Function(FUNC_GETSIGFROMSTR, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall canCall(String src, String dst, byte[] sig) { + final Function function = new Function(FUNC_CANCALL, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall
permit(String src, String dst, byte[] sig) { + final Function function = new Function( + FUNC_PERMIT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void permit(String src, String dst, byte[] sig, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_PERMIT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String permitSeq(String src, String dst, byte[] sig) { + final Function function = new Function( + FUNC_PERMIT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple3 getPermitAddressAddressBytes4Input(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_PERMIT, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple3( + + (String) results.get(0).getValue(), + (String) results.get(1).getValue(), + (byte[]) results.get(2).getValue() + ); + } + + public RemoteCall _authority() { + final Function function = new Function(FUNC__AUTHORITY, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall getSig() { + final Function function = new Function(FUNC_GETSIG, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + + public RemoteCall isAuthorized(String src, byte[] sig) { + final Function function = new Function(FUNC_ISAUTHORIZED, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall
permit(String src, String dst, String sig) { + final Function function = new Function( + FUNC_PERMIT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void permit(String src, String dst, String sig, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_PERMIT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String permitSeq(String src, String dst, String sig) { + final Function function = new Function( + FUNC_PERMIT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple3 getPermitAddressAddressStringInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_PERMIT, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple3( + + (String) results.get(0).getValue(), + (String) results.get(1).getValue(), + (String) results.get(2).getValue() + ); + } + + public RemoteCall
forbidAny(String src, String dst) { + final Function function = new Function( + FUNC_FORBIDANY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void forbidAny(String src, String dst, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_FORBIDANY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String forbidAnySeq(String src, String dst) { + final Function function = new Function( + FUNC_FORBIDANY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getForbidAnyInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_FORBIDANY, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (String) results.get(0).getValue(), + (String) results.get(1).getValue() + ); + } + + public List getLogPermitEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGPERMIT_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogPermitEventResponse typedResponse = new LogPermitEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.src = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.dst = (String) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.sig = (byte[]) eventValues.getIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogPermitEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGPERMIT_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogPermitEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGPERMIT_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getLogForbidEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGFORBID_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogForbidEventResponse typedResponse = new LogForbidEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.src = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.dst = (String) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.sig = (byte[]) eventValues.getIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogForbidEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGFORBID_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogForbidEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGFORBID_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getLogSetAuthorityEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGSETAUTHORITY_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogSetAuthorityEventResponse typedResponse = new LogSetAuthorityEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.authority = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.from = (String) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.sig = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogSetAuthorityEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogSetAuthorityEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getLogSetOwnerEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGSETOWNER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogSetOwnerEventResponse typedResponse = new LogSetOwnerEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.oldOwner = (String) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.contractAddress = (String) eventValues.getIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogSetOwnerEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogSetOwnerEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + @Deprecated + public static WEAclGuard load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new WEAclGuard(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static WEAclGuard load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new WEAclGuard(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static WEAclGuard load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new WEAclGuard(contractAddress, web3j, credentials, contractGasProvider); + } + + public static WEAclGuard load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new WEAclGuard(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEAclGuard.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEAclGuard.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEAclGuard.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEAclGuard.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } + + public static class LogPermitEventResponse { + public Log log; + + public String src; + + public String dst; + + public byte[] sig; + } + + public static class LogForbidEventResponse { + public Log log; + + public String src; + + public String dst; + + public byte[] sig; + } + + public static class LogSetAuthorityEventResponse { + public Log log; + + public String authority; + + public String from; + + public byte[] sig; + } + + public static class LogSetOwnerEventResponse { + public Log log; + + public String owner; + + public String oldOwner; + + public String contractAddress; + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java new file mode 100644 index 00000000..93f7f044 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java @@ -0,0 +1,284 @@ +package com.webank.wescott.contract.authority; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; +import org.fisco.bcos.web3j.abi.EventEncoder; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Event; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.Log; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class WEAuth extends Contract { + public static String BINARY = "6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108a2806100536000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100725780637a9e5e4b146100b5578063b2bdfa7b146100f8578063c2205ee11461014f578063d9972b96146101a6575b600080fd5b34801561007e57600080fd5b506100b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061022a565b005b3480156100c157600080fd5b506100f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103e9565b005b34801561010457600080fd5b5061010d6105b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561015b57600080fd5b506101646105d8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101b257600080fd5b50610210600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506105fe565b604051808215151515815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610314576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b610417336000357fffffffff00000000000000000000000000000000000000000000000000000000166105fe565b151561048b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167ff54834e369087f9b17bd2b73baa91085cfff591ffb3c11d2622f6cf92ae4cf6a336000357fffffffff0000000000000000000000000000000000000000000000000000000016604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019250505060405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561063d5760019050610870565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561069b5760019050610870565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156106fb5760009050610870565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b70096138430856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019350505050602060405180830381600087803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505050506040513d602081101561085c57600080fd5b810190808051906020019092919050505090505b929150505600a165627a7a723058209dd313d76e2d84bcd2a78c1b6671f351c7865888e11c0b9143d9901b8add919a0029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_authority\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"isAuthorized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"authority\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogSetAuthority\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"type\":\"event\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC_SETAUTHORITY = "setAuthority"; + + public static final String FUNC__OWNER = "_owner"; + + public static final String FUNC__AUTHORITY = "_authority"; + + public static final String FUNC_ISAUTHORIZED = "isAuthorized"; + + public static final Event LOGSETAUTHORITY_EVENT = new Event("LogSetAuthority", + Arrays.>asList(new TypeReference

(true) {}, new TypeReference
() {}, new TypeReference() {})); + ; + + public static final Event LOGSETOWNER_EVENT = new Event("LogSetOwner", + Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference
(true) {})); + ; + + @Deprecated + protected WEAuth(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected WEAuth(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected WEAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected WEAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall
setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
setAuthority(String authority) { + final Function function = new Function( + FUNC_SETAUTHORITY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setAuthority(String authority, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETAUTHORITY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setAuthoritySeq(String authority) { + final Function function = new Function( + FUNC_SETAUTHORITY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetAuthorityInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETAUTHORITY, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall _authority() { + final Function function = new Function(FUNC__AUTHORITY, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall isAuthorized(String src, byte[] sig) { + final Function function = new Function(FUNC_ISAUTHORIZED, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public List getLogSetAuthorityEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGSETAUTHORITY_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogSetAuthorityEventResponse typedResponse = new LogSetAuthorityEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.authority = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.from = (String) eventValues.getNonIndexedValues().get(0).getValue(); + typedResponse.sig = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogSetAuthorityEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogSetAuthorityEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getLogSetOwnerEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGSETOWNER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogSetOwnerEventResponse typedResponse = new LogSetOwnerEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.oldOwner = (String) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.contractAddress = (String) eventValues.getIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogSetOwnerEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogSetOwnerEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + @Deprecated + public static WEAuth load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new WEAuth(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static WEAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new WEAuth(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static WEAuth load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new WEAuth(contractAddress, web3j, credentials, contractGasProvider); + } + + public static WEAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new WEAuth(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEAuth.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEAuth.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEAuth.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEAuth.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } + + public static class LogSetAuthorityEventResponse { + public Log log; + + public String authority; + + public String from; + + public byte[] sig; + } + + public static class LogSetOwnerEventResponse { + public Log log; + + public String owner; + + public String oldOwner; + + public String contractAddress; + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java new file mode 100644 index 00000000..09a35d1d --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java @@ -0,0 +1,102 @@ +package com.webank.wescott.contract.authority; + +import java.math.BigInteger; +import java.util.Arrays; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class WEAuthority extends Contract { + public static String BINARY = ""; + + public static final String ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"canCall\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_CANCALL = "canCall"; + + @Deprecated + protected WEAuthority(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected WEAuthority(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected WEAuthority(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected WEAuthority(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall canCall(String src, String dst, byte[] sig) { + final Function function = new Function(FUNC_CANCALL, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), + new org.fisco.bcos.web3j.abi.datatypes.Address(dst), + new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + @Deprecated + public static WEAuthority load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new WEAuthority(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static WEAuthority load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new WEAuthority(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static WEAuthority load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new WEAuthority(contractAddress, web3j, credentials, contractGasProvider); + } + + public static WEAuthority load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new WEAuthority(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEAuthority.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEAuthority.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEAuthority.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEAuthority.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java new file mode 100644 index 00000000..97798d67 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java @@ -0,0 +1,187 @@ +package com.webank.wescott.contract.authority; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; +import org.fisco.bcos.web3j.abi.EventEncoder; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Event; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.Log; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class WEBasicAuth extends Contract { + public static String BINARY = "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102fb806100606000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af403514610051578063b2bdfa7b14610094575b600080fd5b34801561005d57600080fd5b50610092600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506100eb565b005b3480156100a057600080fd5b506100a96102aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a72305820d7c120dfe3cdd08ac066bb0f23c6fd66925584dbc66656aa36a3e2533fa0906a0029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"type\":\"event\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC__OWNER = "_owner"; + + public static final Event LOGSETOWNER_EVENT = new Event("LogSetOwner", + Arrays.>asList(new TypeReference

(true) {}, new TypeReference
(true) {}, new TypeReference
(true) {})); + ; + + @Deprecated + protected WEBasicAuth(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected WEBasicAuth(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected WEBasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected WEBasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall
setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public List getLogSetOwnerEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGSETOWNER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogSetOwnerEventResponse typedResponse = new LogSetOwnerEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.oldOwner = (String) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.contractAddress = (String) eventValues.getIndexedValues().get(2).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogSetOwnerEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogSetOwnerEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + @Deprecated + public static WEBasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new WEBasicAuth(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static WEBasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new WEBasicAuth(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static WEBasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new WEBasicAuth(contractAddress, web3j, credentials, contractGasProvider); + } + + public static WEBasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new WEBasicAuth(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEBasicAuth.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(WEBasicAuth.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEBasicAuth.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(WEBasicAuth.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } + + public static class LogSetOwnerEventResponse { + public Log log; + + public String owner; + + public String oldOwner; + + public String contractAddress; + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java new file mode 100644 index 00000000..b0281b0f --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java @@ -0,0 +1,172 @@ +package com.webank.wescott.contract.point; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class Admin extends Contract { + public static String BINARY = "608060405234801561001057600080fd5b50600080336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061005c61041d565b80806020018281038252600b8152602001807f506f696e74206f66205631000000000000000000000000000000000000000000815250602001915050604051809103906000f0801580156100b4573d6000803e3d6000fd5b50915081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661012361042d565b808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604051809103906000f080158015610175573d6000803e3d6000fd5b50905080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff1663d28eb963600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561027657600080fd5b505af115801561028a573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff166320694db0336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561032957600080fd5b505af115801561033d573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff166320694db0600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156103fe57600080fd5b505af1158015610412573d6000803e3d6000fd5b50505050505061043d565b60405161148a8061086583390190565b604051612d0f80611cef83390190565b6104198061044c6000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af40351461007257806361db384e146100b5578063632cd8b21461010c578063b2bdfa7b14610163578063cd5d2118146101ba575b600080fd5b34801561007e57600080fd5b506100b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610215565b005b3480156100c157600080fd5b506100ca6102d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561011857600080fd5b506101216102fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016f57600080fd5b50610178610321565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c657600080fd5b506101fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610346565b604051808215151515815260200191505060405180910390f35b61021e33610346565b1515610292576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561038557600190506103e8565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156103e357600190506103e8565b600090505b9190505600a165627a7a7230582015d4c3732f6f507d0dc500f95280e860e84adc762858c285c77a21e3f41b78e4002960806040523480156200001157600080fd5b506040516200148a3803806200148a83398101806040528101908080518201929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200009a336001620000ba6401000000000262000dd0179091906401000000009004565b8060059080519060200190620000b2929190620002cd565b50506200037c565b620000d58282620001a9640100000000026401000000009004565b1515156200014b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151562000276576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031057805160ff191683800117855562000341565b8280016001018555821562000341579182015b828111156200034057825182559160200191906001019062000323565b5b50905062000350919062000354565b5090565b6200037991905b80821115620003755760008160009055506001016200035b565b5090565b90565b6110fe806200038c6000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100e057806320694db0146101235780633bbeaab51461016657806360df8a1f146101915780637b510fe8146101d6578063877b9a6714610238578063b2bdfa7b14610293578063c510a9a8146102ea578063c8e40fbf1461032d578063cd5d211814610388578063cfa84dfe146103e3578063d28eb96314610473578063e30443bc146104b6578063e5c96aa41461051b578063f8b2cb4f14610582575b600080fd5b3480156100ec57600080fd5b50610121600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105d9565b005b34801561012f57600080fd5b50610164600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b005b34801561017257600080fd5b5061017b610796565b6040518082815260200191505060405180910390f35b34801561019d57600080fd5b506101bc6004803603810190808035906020019092919050505061079c565b604051808215151515815260200191505060405180910390f35b3480156101e257600080fd5b50610217600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061080a565b60405180831515151581526020018281526020019250505060405180910390f35b34801561024457600080fd5b50610279600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a3565b604051808215151515815260200191505060405180910390f35b34801561029f57600080fd5b506102a86108c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e5565b005b34801561033957600080fd5b5061036e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109e2565b604051808215151515815260200191505060405180910390f35b34801561039457600080fd5b506103c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a38565b604051808215151515815260200191505060405180910390f35b3480156103ef57600080fd5b506103f8610adf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7d565b005b3480156104c257600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1c565b604051808215151515815260200191505060405180910390f35b34801561052757600080fd5b50610568600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610cc8565b604051808215151515815260200191505060405180910390f35b34801561058e57600080fd5b506105c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d87565b6040518082815260200191505060405180910390f35b6105e233610a38565b1515610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106a2336108a3565b151561073c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b610750816001610dd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c260405160405180910390a250565b60045481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107fa57600080fd5b8160048190555060019050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b60006108b9826001610ead90919063ffffffff16565b9050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108ee336108a3565b1515610988576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b61099c816001610fd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5260405160405180910390a250565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a775760019050610ada565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ad55760019050610ada565b600090505b919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b755780601f10610b4a57610100808354040283529160200191610b75565b820191906000526020600020905b815481529060010190602001808311610b5857829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bd857600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7a57600080fd5b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d2657600080fd5b81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dda8282610ead565b151515610e4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610fda8282610ead565b1515611074576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c81526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a723058204eb54c60ac1182a7b2e92c819f0f5cbc428e055d397fb5a3a18f4e9c0c58853a0029608060405234801561001057600080fd5b50604051602080612d0f83398101806040528101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050612c4b806100c46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100ca5780631aa3a0081461010d57806320694db014610164578063867904b4146101bf578063877b9a6714610224578063938050e11461027f5780639d118770146102ae578063a9059cbb146102f3578063b2bdfa7b14610366578063c3c5a547146103bd578063cd5d211814610418578063e3d670d714610473578063e79a198f146104ca575b600080fd5b3480156100d657600080fd5b5061010b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610521565b005b34801561011957600080fd5b506101226105e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561017057600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c6565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b5061020a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c38565b604051808215151515815260200191505060405180910390f35b34801561023057600080fd5b50610265600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113a4565b604051808215151515815260200191505060405180910390f35b34801561028b57600080fd5b506102946114a5565b604051808215151515815260200191505060405180910390f35b3480156102ba57600080fd5b506102d960048036038101908080359060200190929190505050611583565b604051808215151515815260200191505060405180910390f35b3480156102ff57600080fd5b5061033e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b5c565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b34801561037257600080fd5b5061037b612457565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103c957600080fd5b506103fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061247c565b604051808215151515815260200191505060405180910390f35b34801561042457600080fd5b50610459600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061257d565b604051808215151515815260200191505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612624565b6040518082815260200191505060405180910390f35b3480156104d657600080fd5b506104df612725565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052a3361257d565b151561059e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003360001515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106a557600080fd5b505af11580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b81019080805190602001909291905050501515141515610757576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4163636f756e7420616c7265616479206578697374656421000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b15801561082157600080fd5b505af1158015610835573d6000803e3d6000fd5b505050506040513d602081101561084b57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc3360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092357600080fd5b505af1158015610937573d6000803e3d6000fd5b505050506040513d602081101561094d57600080fd5b8101908080519060200190929190505050507f68f0f1b8c9e91743a8bf9b77af08d152d1cb9ac31eb5b472bf6e16467254885533604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8557600080fd5b505af1158015610a99573d6000803e3d6000fd5b505050506040513d6020811015610aaf57600080fd5b81019080805190602001909291905050501515610b5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320694db0836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610c1757600080fd5b505af1158015610c2b573d6000803e3d6000fd5b5050505060019050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050506040513d6020811015610d2457600080fd5b81019080805190602001909291905050501515610dcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b8460011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050506040513d6020811015610ebb57600080fd5b81019080805190602001909291905050501515148015610f085750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515610f7c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561100257600080fd5b505af1158015611016573d6000803e3d6000fd5b505050506040513d602081101561102c57600080fd5b810190808051906020019092919050505092506110528584612b0b90919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156110e557600080fd5b505af11580156110f9573d6000803e3d6000fd5b505050506040513d602081101561110f57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156111de57600080fd5b505af11580156111f2573d6000803e3d6000fd5b505050506040513d602081101561120857600080fd5b8101908080519060200190929190505050915061122e8583612b0b90919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc87846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b505050506040513d602081101561131f57600080fd5b8101908080519060200190929190505050508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a36001935050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561146357600080fd5b505af1158015611477573d6000803e3d6000fd5b505050506040513d602081101561148d57600080fd5b81019080805190602001909291905050509050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c510a9a8336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561156457600080fd5b505af1158015611578573d6000803e3d6000fd5b505050506001905090565b60008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561164a57600080fd5b505af115801561165e573d6000803e3d6000fd5b505050506040513d602081101561167457600080fd5b810190808051906020019092919050505015151480156116c15750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611735576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156117bb57600080fd5b505af11580156117cf573d6000803e3d6000fd5b505050506040513d60208110156117e557600080fd5b8101908080519060200190929190505050925061180b8584612b9590919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b505050506040513d60208110156118c857600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561199757600080fd5b505af11580156119ab573d6000803e3d6000fd5b505050506040513d60208110156119c157600080fd5b810190808051906020019092919050505091506119e78583612b9590919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611aae57600080fd5b505af1158015611ac2573d6000803e3d6000fd5b505050506040513d6020811015611ad857600080fd5b810190808051906020019092919050505050600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a360019350505050919050565b60008060008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611c2657600080fd5b505af1158015611c3a573d6000803e3d6000fd5b505050506040513d6020811015611c5057600080fd5b81019080805190602001909291905050501515148015611c9d5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611d11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b8760011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611dd357600080fd5b505af1158015611de7573d6000803e3d6000fd5b505050506040513d6020811015611dfd57600080fd5b81019080805190602001909291905050501515148015611e4a5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611ebe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b888073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611f285750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611fc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f43616e2774207472616e7366657220746f20696c6c6567616c2061646472657381526020017f732100000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561207f57600080fd5b505af1158015612093573d6000803e3d6000fd5b505050506040513d60208110156120a957600080fd5b810190808051906020019092919050505094506120cf8986612b9590919063ffffffff16565b9650600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33896040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050506040513d60208110156121c057600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f8b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561228f57600080fd5b505af11580156122a3573d6000803e3d6000fd5b505050506040513d60208110156122b957600080fd5b810190808051906020019092919050505093506122df8985612b0b90919063ffffffff16565b9550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc8b886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b505050506040513d60208110156123d057600080fd5b8101908080519060200190929190505050508973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e358b6040518082815260200191505060405180910390a36001975050505050509250925092565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561253b57600080fd5b505af115801561254f573d6000803e3d6000fd5b505050506040513d602081101561256557600080fd5b81019080805190602001909291905050509050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125bc576001905061261f565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561261a576001905061261f565b600090505b919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156126e357600080fd5b505af11580156126f7573d6000803e3d6000fd5b505050506040513d602081101561270d57600080fd5b81019080805190602001909291905050509050919050565b60003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156127e957600080fd5b505af11580156127fd573d6000803e3d6000fd5b505050506040513d602081101561281357600080fd5b8101908080519060200190929190505050151514801561292a57506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b505050506040513d602081101561291757600080fd5b8101908080519060200190929190505050145b151561299e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43616e6e277420756e726567697374657221000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b158015612a6857600080fd5b505af1158015612a7c573d6000803e3d6000fd5b505050506040513d6020811015612a9257600080fd5b8101908080519060200190929190505050507f11854d1b3c0aa24c7c879af700c0089a48a48e9280bac11f5370b90b7cca481c33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000808284019050838110151515612b8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080838311151515612c10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b828403905080915050929150505600a165627a7a72305820cfedf668db5d3b6056013c182be0cada689b19a2ec06587b5d8073e895b335170029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_controllerAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_dataAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC__CONTROLLERADDRESS = "_controllerAddress"; + + public static final String FUNC__DATAADDRESS = "_dataAddress"; + + public static final String FUNC__OWNER = "_owner"; + + public static final String FUNC_AUTH = "auth"; + + @Deprecated + protected Admin(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected Admin(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected Admin(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected Admin(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall

setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall _controllerAddress() { + final Function function = new Function(FUNC__CONTROLLERADDRESS, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall _dataAddress() { + final Function function = new Function(FUNC__DATAADDRESS, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall auth(String src) { + final Function function = new Function(FUNC_AUTH, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + @Deprecated + public static Admin load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new Admin(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static Admin load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new Admin(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static Admin load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new Admin(contractAddress, web3j, credentials, contractGasProvider); + } + + public static Admin load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new Admin(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(Admin.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(Admin.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(Admin.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(Admin.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java new file mode 100644 index 00000000..2b60b112 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java @@ -0,0 +1,154 @@ +package com.webank.wescott.contract.point; + +import java.math.BigInteger; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class BasicAuth extends Contract { + public static String BINARY = "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610309806100606000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af40351461005c578063b2bdfa7b1461009f578063cd5d2118146100f6575b600080fd5b34801561006857600080fd5b5061009d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610151565b005b3480156100ab57600080fd5b506100b4610211565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561010257600080fd5b50610137600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610236565b604051808215151515815260200191505060405180910390f35b61015a33610236565b15156101ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561027557600190506102d8565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156102d357600190506102d8565b600090505b9190505600a165627a7a72305820b9aa5ba47e9edcb2f8998a6159d577e67d13ffa4be0dd9a833e4aec08a80776b0029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC__OWNER = "_owner"; + + public static final String FUNC_AUTH = "auth"; + + @Deprecated + protected BasicAuth(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected BasicAuth(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected BasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected BasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall

setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall auth(String src) { + final Function function = new Function(FUNC_AUTH, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + @Deprecated + public static BasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new BasicAuth(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static BasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new BasicAuth(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static BasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new BasicAuth(contractAddress, web3j, credentials, contractGasProvider); + } + + public static BasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new BasicAuth(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(BasicAuth.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(BasicAuth.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(BasicAuth.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(BasicAuth.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java new file mode 100644 index 00000000..b8f88857 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java @@ -0,0 +1,252 @@ +package com.webank.wescott.contract.point; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; +import org.fisco.bcos.web3j.abi.EventEncoder; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Event; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.Log; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class IssuerRole extends Contract { + public static String BINARY = ""; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"addIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerRemoved\",\"type\":\"event\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_ADDISSUER = "addIssuer"; + + public static final String FUNC_ISISSUER = "isIssuer"; + + public static final String FUNC_RENOUNCEISSUER = "renounceIssuer"; + + public static final Event ISSUERADDED_EVENT = new Event("IssuerAdded", + Arrays.>asList(new TypeReference

(true) {})); + ; + + public static final Event ISSUERREMOVED_EVENT = new Event("IssuerRemoved", + Arrays.>asList(new TypeReference
(true) {})); + ; + + @Deprecated + protected IssuerRole(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected IssuerRole(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected IssuerRole(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected IssuerRole(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall
addIssuer(String account) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void addIssuer(String account, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String addIssuerSeq(String account) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getAddIssuerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_ADDISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall isIssuer(String account) { + final Function function = new Function(FUNC_ISISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall
renounceIssuer(String account) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void renounceIssuer(String account, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String renounceIssuerSeq(String account) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getRenounceIssuerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_RENOUNCEISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public List getIssuerAddedEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(ISSUERADDED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + IssuerAddedEventResponse typedResponse = new IssuerAddedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerIssuerAddedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerIssuerAddedEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getIssuerRemovedEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(ISSUERREMOVED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + IssuerRemovedEventResponse typedResponse = new IssuerRemovedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerIssuerRemovedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerIssuerRemovedEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + @Deprecated + public static IssuerRole load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new IssuerRole(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static IssuerRole load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new IssuerRole(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static IssuerRole load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new IssuerRole(contractAddress, web3j, credentials, contractGasProvider); + } + + public static IssuerRole load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new IssuerRole(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(IssuerRole.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(IssuerRole.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(IssuerRole.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(IssuerRole.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } + + public static class IssuerAddedEventResponse { + public Log log; + + public String account; + } + + public static class IssuerRemovedEventResponse { + public Log log; + + public String account; + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java new file mode 100644 index 00000000..e92332a5 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java @@ -0,0 +1,620 @@ +package com.webank.wescott.contract.point; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; +import org.fisco.bcos.web3j.abi.EventEncoder; +import org.fisco.bcos.web3j.abi.FunctionEncoder; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Event; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.Log; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tuples.generated.Tuple2; +import org.fisco.bcos.web3j.tuples.generated.Tuple3; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class RewardPointController extends Contract { + public static String BINARY = "608060405234801561001057600080fd5b50604051602080612d0f83398101806040528101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050612c4b806100c46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100ca5780631aa3a0081461010d57806320694db014610164578063867904b4146101bf578063877b9a6714610224578063938050e11461027f5780639d118770146102ae578063a9059cbb146102f3578063b2bdfa7b14610366578063c3c5a547146103bd578063cd5d211814610418578063e3d670d714610473578063e79a198f146104ca575b600080fd5b3480156100d657600080fd5b5061010b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610521565b005b34801561011957600080fd5b506101226105e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561017057600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c6565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b5061020a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c38565b604051808215151515815260200191505060405180910390f35b34801561023057600080fd5b50610265600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113a4565b604051808215151515815260200191505060405180910390f35b34801561028b57600080fd5b506102946114a5565b604051808215151515815260200191505060405180910390f35b3480156102ba57600080fd5b506102d960048036038101908080359060200190929190505050611583565b604051808215151515815260200191505060405180910390f35b3480156102ff57600080fd5b5061033e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b5c565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b34801561037257600080fd5b5061037b612457565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103c957600080fd5b506103fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061247c565b604051808215151515815260200191505060405180910390f35b34801561042457600080fd5b50610459600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061257d565b604051808215151515815260200191505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612624565b6040518082815260200191505060405180910390f35b3480156104d657600080fd5b506104df612725565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052a3361257d565b151561059e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003360001515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106a557600080fd5b505af11580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b81019080805190602001909291905050501515141515610757576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4163636f756e7420616c7265616479206578697374656421000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b15801561082157600080fd5b505af1158015610835573d6000803e3d6000fd5b505050506040513d602081101561084b57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc3360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092357600080fd5b505af1158015610937573d6000803e3d6000fd5b505050506040513d602081101561094d57600080fd5b8101908080519060200190929190505050507f68f0f1b8c9e91743a8bf9b77af08d152d1cb9ac31eb5b472bf6e16467254885533604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8557600080fd5b505af1158015610a99573d6000803e3d6000fd5b505050506040513d6020811015610aaf57600080fd5b81019080805190602001909291905050501515610b5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320694db0836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610c1757600080fd5b505af1158015610c2b573d6000803e3d6000fd5b5050505060019050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050506040513d6020811015610d2457600080fd5b81019080805190602001909291905050501515610dcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b8460011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050506040513d6020811015610ebb57600080fd5b81019080805190602001909291905050501515148015610f085750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515610f7c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561100257600080fd5b505af1158015611016573d6000803e3d6000fd5b505050506040513d602081101561102c57600080fd5b810190808051906020019092919050505092506110528584612b0b90919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156110e557600080fd5b505af11580156110f9573d6000803e3d6000fd5b505050506040513d602081101561110f57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156111de57600080fd5b505af11580156111f2573d6000803e3d6000fd5b505050506040513d602081101561120857600080fd5b8101908080519060200190929190505050915061122e8583612b0b90919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc87846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b505050506040513d602081101561131f57600080fd5b8101908080519060200190929190505050508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a36001935050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561146357600080fd5b505af1158015611477573d6000803e3d6000fd5b505050506040513d602081101561148d57600080fd5b81019080805190602001909291905050509050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c510a9a8336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561156457600080fd5b505af1158015611578573d6000803e3d6000fd5b505050506001905090565b60008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561164a57600080fd5b505af115801561165e573d6000803e3d6000fd5b505050506040513d602081101561167457600080fd5b810190808051906020019092919050505015151480156116c15750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611735576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156117bb57600080fd5b505af11580156117cf573d6000803e3d6000fd5b505050506040513d60208110156117e557600080fd5b8101908080519060200190929190505050925061180b8584612b9590919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b505050506040513d60208110156118c857600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561199757600080fd5b505af11580156119ab573d6000803e3d6000fd5b505050506040513d60208110156119c157600080fd5b810190808051906020019092919050505091506119e78583612b9590919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611aae57600080fd5b505af1158015611ac2573d6000803e3d6000fd5b505050506040513d6020811015611ad857600080fd5b810190808051906020019092919050505050600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a360019350505050919050565b60008060008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611c2657600080fd5b505af1158015611c3a573d6000803e3d6000fd5b505050506040513d6020811015611c5057600080fd5b81019080805190602001909291905050501515148015611c9d5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611d11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b8760011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611dd357600080fd5b505af1158015611de7573d6000803e3d6000fd5b505050506040513d6020811015611dfd57600080fd5b81019080805190602001909291905050501515148015611e4a5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611ebe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b888073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611f285750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611fc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f43616e2774207472616e7366657220746f20696c6c6567616c2061646472657381526020017f732100000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561207f57600080fd5b505af1158015612093573d6000803e3d6000fd5b505050506040513d60208110156120a957600080fd5b810190808051906020019092919050505094506120cf8986612b9590919063ffffffff16565b9650600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33896040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050506040513d60208110156121c057600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f8b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561228f57600080fd5b505af11580156122a3573d6000803e3d6000fd5b505050506040513d60208110156122b957600080fd5b810190808051906020019092919050505093506122df8985612b0b90919063ffffffff16565b9550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc8b886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b505050506040513d60208110156123d057600080fd5b8101908080519060200190929190505050508973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e358b6040518082815260200191505060405180910390a36001975050505050509250925092565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561253b57600080fd5b505af115801561254f573d6000803e3d6000fd5b505050506040513d602081101561256557600080fd5b81019080805190602001909291905050509050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125bc576001905061261f565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561261a576001905061261f565b600090505b919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156126e357600080fd5b505af11580156126f7573d6000803e3d6000fd5b505050506040513d602081101561270d57600080fd5b81019080805190602001909291905050509050919050565b60003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156127e957600080fd5b505af11580156127fd573d6000803e3d6000fd5b505050506040513d602081101561281357600080fd5b8101908080519060200190929190505050151514801561292a57506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b505050506040513d602081101561291757600080fd5b8101908080519060200190929190505050145b151561299e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43616e6e277420756e726567697374657221000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b158015612a6857600080fd5b505af1158015612a7c573d6000803e3d6000fd5b505050506040513d6020811015612a9257600080fd5b8101908080519060200190929190505050507f11854d1b3c0aa24c7c879af700c0089a48a48e9280bac11f5370b90b7cca481c33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000808284019050838110151515612b8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080838311151515612c10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b828403905080915050929150505600a165627a7a72305820cfedf668db5d3b6056013c182be0cada689b19a2ec06587b5d8073e895b335170029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"register\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"addIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"issue\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"renounceIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"destroy\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"toAddress\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"b\",\"type\":\"bool\"},{\"name\":\"balanceOfFrom\",\"type\":\"uint256\"},{\"name\":\"balanceOfTo\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isRegistered\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"balance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"unregister\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"dataAddress\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"LogRegister\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"LogUnregister\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"LogSend\",\"type\":\"event\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC_REGISTER = "register"; + + public static final String FUNC_ADDISSUER = "addIssuer"; + + public static final String FUNC_ISSUE = "issue"; + + public static final String FUNC_ISISSUER = "isIssuer"; + + public static final String FUNC_RENOUNCEISSUER = "renounceIssuer"; + + public static final String FUNC_DESTROY = "destroy"; + + public static final String FUNC_TRANSFER = "transfer"; + + public static final String FUNC__OWNER = "_owner"; + + public static final String FUNC_ISREGISTERED = "isRegistered"; + + public static final String FUNC_AUTH = "auth"; + + public static final String FUNC_BALANCE = "balance"; + + public static final String FUNC_UNREGISTER = "unregister"; + + public static final Event LOGREGISTER_EVENT = new Event("LogRegister", + Arrays.>asList(new TypeReference

() {})); + ; + + public static final Event LOGUNREGISTER_EVENT = new Event("LogUnregister", + Arrays.>asList(new TypeReference
() {})); + ; + + public static final Event LOGSEND_EVENT = new Event("LogSend", + Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference() {})); + ; + + @Deprecated + protected RewardPointController(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected RewardPointController(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected RewardPointController(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected RewardPointController(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall
setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
register() { + final Function function = new Function( + FUNC_REGISTER, + Arrays.asList(), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void register(TransactionSucCallback callback) { + final Function function = new Function( + FUNC_REGISTER, + Arrays.asList(), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String registerSeq() { + final Function function = new Function( + FUNC_REGISTER, + Arrays.asList(), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getRegisterOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_REGISTER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
addIssuer(String account) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void addIssuer(String account, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String addIssuerSeq(String account) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getAddIssuerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_ADDISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public Tuple1 getAddIssuerOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_ADDISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall
issue(String account, BigInteger value) { + final Function function = new Function( + FUNC_ISSUE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void issue(String account, BigInteger value, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_ISSUE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String issueSeq(String account, BigInteger value) { + final Function function = new Function( + FUNC_ISSUE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getIssueInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_ISSUE, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (String) results.get(0).getValue(), + (BigInteger) results.get(1).getValue() + ); + } + + public Tuple1 getIssueOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_ISSUE, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall isIssuer(String account) { + final Function function = new Function(FUNC_ISISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall
renounceIssuer() { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void renounceIssuer(TransactionSucCallback callback) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String renounceIssuerSeq() { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getRenounceIssuerOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_RENOUNCEISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall
destroy(BigInteger value) { + final Function function = new Function( + FUNC_DESTROY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void destroy(BigInteger value, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_DESTROY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String destroySeq(BigInteger value) { + final Function function = new Function( + FUNC_DESTROY, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getDestroyInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_DESTROY, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (BigInteger) results.get(0).getValue() + ); + } + + public Tuple1 getDestroyOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_DESTROY, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall
transfer(String toAddress, BigInteger value) { + final Function function = new Function( + FUNC_TRANSFER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(toAddress), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void transfer(String toAddress, BigInteger value, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_TRANSFER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(toAddress), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String transferSeq(String toAddress, BigInteger value) { + final Function function = new Function( + FUNC_TRANSFER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(toAddress), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getTransferInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_TRANSFER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (String) results.get(0).getValue(), + (BigInteger) results.get(1).getValue() + ); + } + + public Tuple3 getTransferOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_TRANSFER, + Arrays.asList(), + Arrays.>asList(new TypeReference() {}, new TypeReference() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple3( + + (Boolean) results.get(0).getValue(), + (BigInteger) results.get(1).getValue(), + (BigInteger) results.get(2).getValue() + ); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall isRegistered(String addr) { + final Function function = new Function(FUNC_ISREGISTERED, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall auth(String src) { + final Function function = new Function(FUNC_AUTH, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall balance(String addr) { + final Function function = new Function(FUNC_BALANCE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteCall
unregister() { + final Function function = new Function( + FUNC_UNREGISTER, + Arrays.asList(), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void unregister(TransactionSucCallback callback) { + final Function function = new Function( + FUNC_UNREGISTER, + Arrays.asList(), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String unregisterSeq() { + final Function function = new Function( + FUNC_UNREGISTER, + Arrays.asList(), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getUnregisterOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_UNREGISTER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public List getLogRegisterEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGREGISTER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogRegisterEventResponse typedResponse = new LogRegisterEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogRegisterEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGREGISTER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogRegisterEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGREGISTER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getLogUnregisterEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGUNREGISTER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogUnregisterEventResponse typedResponse = new LogUnregisterEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogUnregisterEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGUNREGISTER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogUnregisterEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGUNREGISTER_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getLogSendEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(LOGSEND_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + LogSendEventResponse typedResponse = new LogSendEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue(); + typedResponse.to = (String) eventValues.getIndexedValues().get(1).getValue(); + typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerLogSendEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSEND_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerLogSendEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(LOGSEND_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + @Deprecated + public static RewardPointController load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new RewardPointController(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static RewardPointController load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new RewardPointController(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static RewardPointController load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new RewardPointController(contractAddress, web3j, credentials, contractGasProvider); + } + + public static RewardPointController load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new RewardPointController(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String dataAddress) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); + return deployRemoteCall(RewardPointController.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String dataAddress) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); + return deployRemoteCall(RewardPointController.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String dataAddress) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); + return deployRemoteCall(RewardPointController.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String dataAddress) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); + return deployRemoteCall(RewardPointController.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + public static class LogRegisterEventResponse { + public Log log; + + public String account; + } + + public static class LogUnregisterEventResponse { + public Log log; + + public String account; + } + + public static class LogSendEventResponse { + public Log log; + + public String from; + + public String to; + + public BigInteger value; + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java new file mode 100644 index 00000000..06d2f85a --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java @@ -0,0 +1,567 @@ +package com.webank.wescott.contract.point; + +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.concurrent.Callable; +import org.fisco.bcos.channel.client.TransactionSucCallback; +import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; +import org.fisco.bcos.web3j.abi.EventEncoder; +import org.fisco.bcos.web3j.abi.FunctionEncoder; +import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; +import org.fisco.bcos.web3j.abi.TypeReference; +import org.fisco.bcos.web3j.abi.datatypes.Address; +import org.fisco.bcos.web3j.abi.datatypes.Bool; +import org.fisco.bcos.web3j.abi.datatypes.Event; +import org.fisco.bcos.web3j.abi.datatypes.Function; +import org.fisco.bcos.web3j.abi.datatypes.Type; +import org.fisco.bcos.web3j.abi.datatypes.Utf8String; +import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.protocol.Web3j; +import org.fisco.bcos.web3j.protocol.core.RemoteCall; +import org.fisco.bcos.web3j.protocol.core.methods.response.Log; +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.fisco.bcos.web3j.tuples.generated.Tuple1; +import org.fisco.bcos.web3j.tuples.generated.Tuple2; +import org.fisco.bcos.web3j.tx.Contract; +import org.fisco.bcos.web3j.tx.TransactionManager; +import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; +import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; + +/** + *

Auto generated code. + *

Do not modify! + *

Please use the web3j command line tools, + * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the + * codegen module to update. + * + *

Generated with web3j version none. + */ +@SuppressWarnings("unchecked") +public class RewardPointData extends Contract { + public static String BINARY = "60806040523480156200001157600080fd5b506040516200148a3803806200148a83398101806040528101908080518201929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200009a336001620000ba6401000000000262000dd0179091906401000000009004565b8060059080519060200190620000b2929190620002cd565b50506200037c565b620000d58282620001a9640100000000026401000000009004565b1515156200014b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151562000276576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031057805160ff191683800117855562000341565b8280016001018555821562000341579182015b828111156200034057825182559160200191906001019062000323565b5b50905062000350919062000354565b5090565b6200037991905b80821115620003755760008160009055506001016200035b565b5090565b90565b6110fe806200038c6000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100e057806320694db0146101235780633bbeaab51461016657806360df8a1f146101915780637b510fe8146101d6578063877b9a6714610238578063b2bdfa7b14610293578063c510a9a8146102ea578063c8e40fbf1461032d578063cd5d211814610388578063cfa84dfe146103e3578063d28eb96314610473578063e30443bc146104b6578063e5c96aa41461051b578063f8b2cb4f14610582575b600080fd5b3480156100ec57600080fd5b50610121600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105d9565b005b34801561012f57600080fd5b50610164600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b005b34801561017257600080fd5b5061017b610796565b6040518082815260200191505060405180910390f35b34801561019d57600080fd5b506101bc6004803603810190808035906020019092919050505061079c565b604051808215151515815260200191505060405180910390f35b3480156101e257600080fd5b50610217600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061080a565b60405180831515151581526020018281526020019250505060405180910390f35b34801561024457600080fd5b50610279600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a3565b604051808215151515815260200191505060405180910390f35b34801561029f57600080fd5b506102a86108c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e5565b005b34801561033957600080fd5b5061036e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109e2565b604051808215151515815260200191505060405180910390f35b34801561039457600080fd5b506103c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a38565b604051808215151515815260200191505060405180910390f35b3480156103ef57600080fd5b506103f8610adf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7d565b005b3480156104c257600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1c565b604051808215151515815260200191505060405180910390f35b34801561052757600080fd5b50610568600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610cc8565b604051808215151515815260200191505060405180910390f35b34801561058e57600080fd5b506105c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d87565b6040518082815260200191505060405180910390f35b6105e233610a38565b1515610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106a2336108a3565b151561073c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b610750816001610dd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c260405160405180910390a250565b60045481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107fa57600080fd5b8160048190555060019050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b60006108b9826001610ead90919063ffffffff16565b9050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108ee336108a3565b1515610988576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b61099c816001610fd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5260405160405180910390a250565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a775760019050610ada565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ad55760019050610ada565b600090505b919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b755780601f10610b4a57610100808354040283529160200191610b75565b820191906000526020600020905b815481529060010190602001808311610b5857829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bd857600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7a57600080fd5b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d2657600080fd5b81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dda8282610ead565b151515610e4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610fda8282610ead565b1515611074576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c81526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a723058204eb54c60ac1182a7b2e92c819f0f5cbc428e055d397fb5a3a18f4e9c0c58853a0029"; + + public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"addIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_totalAmount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setTotalAmount\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountInfo\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasAccount\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_description\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newVersion\",\"type\":\"address\"}],\"name\":\"upgradeVersion\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"a\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"setBalance\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"a\",\"type\":\"address\"},{\"name\":\"b\",\"type\":\"bool\"}],\"name\":\"setAccount\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"description\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerRemoved\",\"type\":\"event\"}]"; + + public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); + + public static final String FUNC_SETOWNER = "setOwner"; + + public static final String FUNC_ADDISSUER = "addIssuer"; + + public static final String FUNC__TOTALAMOUNT = "_totalAmount"; + + public static final String FUNC_SETTOTALAMOUNT = "setTotalAmount"; + + public static final String FUNC_GETACCOUNTINFO = "getAccountInfo"; + + public static final String FUNC_ISISSUER = "isIssuer"; + + public static final String FUNC__OWNER = "_owner"; + + public static final String FUNC_RENOUNCEISSUER = "renounceIssuer"; + + public static final String FUNC_HASACCOUNT = "hasAccount"; + + public static final String FUNC_AUTH = "auth"; + + public static final String FUNC__DESCRIPTION = "_description"; + + public static final String FUNC_UPGRADEVERSION = "upgradeVersion"; + + public static final String FUNC_SETBALANCE = "setBalance"; + + public static final String FUNC_SETACCOUNT = "setAccount"; + + public static final String FUNC_GETBALANCE = "getBalance"; + + public static final Event ISSUERADDED_EVENT = new Event("IssuerAdded", + Arrays.>asList(new TypeReference

(true) {})); + ; + + public static final Event ISSUERREMOVED_EVENT = new Event("IssuerRemoved", + Arrays.>asList(new TypeReference
(true) {})); + ; + + @Deprecated + protected RewardPointData(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + protected RewardPointData(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, credentials, contractGasProvider); + } + + @Deprecated + protected RewardPointData(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + protected RewardPointData(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static TransactionDecoder getTransactionDecoder() { + return transactionDecoder; + } + + public RemoteCall
setOwner(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setOwner(String owner, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setOwnerSeq(String owner) { + final Function function = new Function( + FUNC_SETOWNER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETOWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
addIssuer(String account) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void addIssuer(String account, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String addIssuerSeq(String account) { + final Function function = new Function( + FUNC_ADDISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getAddIssuerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_ADDISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall _totalAmount() { + final Function function = new Function(FUNC__TOTALAMOUNT, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteCall
setTotalAmount(BigInteger amount) { + final Function function = new Function( + FUNC_SETTOTALAMOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(amount)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setTotalAmount(BigInteger amount, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETTOTALAMOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(amount)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setTotalAmountSeq(BigInteger amount) { + final Function function = new Function( + FUNC_SETTOTALAMOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(amount)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getSetTotalAmountInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETTOTALAMOUNT, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (BigInteger) results.get(0).getValue() + ); + } + + public Tuple1 getSetTotalAmountOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_SETTOTALAMOUNT, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall> getAccountInfo(String account) { + final Function function = new Function(FUNC_GETACCOUNTINFO, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Arrays.>asList(new TypeReference() {}, new TypeReference() {})); + return new RemoteCall>( + new Callable>() { + @Override + public Tuple2 call() throws Exception { + List results = executeCallMultipleValueReturn(function); + return new Tuple2( + (Boolean) results.get(0).getValue(), + (BigInteger) results.get(1).getValue()); + } + }); + } + + public RemoteCall isIssuer(String account) { + final Function function = new Function(FUNC_ISISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall _owner() { + final Function function = new Function(FUNC__OWNER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall
renounceIssuer(String account) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void renounceIssuer(String account, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String renounceIssuerSeq(String account) { + final Function function = new Function( + FUNC_RENOUNCEISSUER, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getRenounceIssuerInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_RENOUNCEISSUER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall hasAccount(String account) { + final Function function = new Function(FUNC_HASACCOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall auth(String src) { + final Function function = new Function(FUNC_AUTH, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Boolean.class); + } + + public RemoteCall _description() { + final Function function = new Function(FUNC__DESCRIPTION, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + + public RemoteCall
upgradeVersion(String newVersion) { + final Function function = new Function( + FUNC_UPGRADEVERSION, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(newVersion)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void upgradeVersion(String newVersion, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_UPGRADEVERSION, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(newVersion)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String upgradeVersionSeq(String newVersion) { + final Function function = new Function( + FUNC_UPGRADEVERSION, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(newVersion)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple1 getUpgradeVersionInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_UPGRADEVERSION, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (String) results.get(0).getValue() + ); + } + + public RemoteCall
setBalance(String a, BigInteger value) { + final Function function = new Function( + FUNC_SETBALANCE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setBalance(String a, BigInteger value, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETBALANCE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setBalanceSeq(String a, BigInteger value) { + final Function function = new Function( + FUNC_SETBALANCE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), + new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getSetBalanceInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETBALANCE, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (String) results.get(0).getValue(), + (BigInteger) results.get(1).getValue() + ); + } + + public Tuple1 getSetBalanceOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_SETBALANCE, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall
setAccount(String a, Boolean b) { + final Function function = new Function( + FUNC_SETACCOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), + new org.fisco.bcos.web3j.abi.datatypes.Bool(b)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public void setAccount(String a, Boolean b, TransactionSucCallback callback) { + final Function function = new Function( + FUNC_SETACCOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), + new org.fisco.bcos.web3j.abi.datatypes.Bool(b)), + Collections.>emptyList()); + asyncExecuteTransaction(function, callback); + } + + public String setAccountSeq(String a, Boolean b) { + final Function function = new Function( + FUNC_SETACCOUNT, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), + new org.fisco.bcos.web3j.abi.datatypes.Bool(b)), + Collections.>emptyList()); + return createTransactionSeq(function); + } + + public Tuple2 getSetAccountInput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getInput().substring(10); + final Function function = new Function(FUNC_SETACCOUNT, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple2( + + (String) results.get(0).getValue(), + (Boolean) results.get(1).getValue() + ); + } + + public Tuple1 getSetAccountOutput(TransactionReceipt transactionReceipt) { + String data = transactionReceipt.getOutput(); + final Function function = new Function(FUNC_SETACCOUNT, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; + return new Tuple1( + + (Boolean) results.get(0).getValue() + ); + } + + public RemoteCall getBalance(String account) { + final Function function = new Function(FUNC_GETBALANCE, + Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public List getIssuerAddedEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(ISSUERADDED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + IssuerAddedEventResponse typedResponse = new IssuerAddedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerIssuerAddedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerIssuerAddedEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + public List getIssuerRemovedEvents(TransactionReceipt transactionReceipt) { + List valueList = extractEventParametersWithLog(ISSUERREMOVED_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + IssuerRemovedEventResponse typedResponse = new IssuerRemovedEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); + responses.add(typedResponse); + } + return responses; + } + + public void registerIssuerRemovedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); + } + + public void registerIssuerRemovedEventLogFilter(EventLogPushWithDecodeCallback callback) { + String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); + registerEventLogPushFilter(ABI,BINARY,topic0,callback); + } + + @Deprecated + public static RewardPointData load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return new RewardPointData(contractAddress, web3j, credentials, gasPrice, gasLimit); + } + + @Deprecated + public static RewardPointData load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return new RewardPointData(contractAddress, web3j, transactionManager, gasPrice, gasLimit); + } + + public static RewardPointData load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return new RewardPointData(contractAddress, web3j, credentials, contractGasProvider); + } + + public static RewardPointData load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return new RewardPointData(contractAddress, web3j, transactionManager, contractGasProvider); + } + + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String description) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); + return deployRemoteCall(RewardPointData.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String description) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); + return deployRemoteCall(RewardPointData.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String description) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); + return deployRemoteCall(RewardPointData.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String description) { + String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); + return deployRemoteCall(RewardPointData.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); + } + + public static class IssuerAddedEventResponse { + public Log log; + + public String account; + } + + public static class IssuerRemovedEventResponse { + public Log log; + + public String account; + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java new file mode 100644 index 00000000..8fc2b2f5 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java @@ -0,0 +1,42 @@ +/** + * Copyright (C) 2018 WeBank, Inc. All Rights Reserved. + */ +package com.webank.wescott.tool; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.fisco.bcos.web3j.abi.datatypes.Address; + +/** + * String2AddressListUtils + * + * @Description: String2AddressListUtils + * @author maojiayu + * @date 2018年7月9日 下午9:36:06 + * + */ +public class AddressListUtils { + + public static List
toAddressList(List strList) { + if (strList.isEmpty()) { + return new ArrayList
(); + } else { + return strList.stream().map(str -> { + return new Address(str); + }).collect(Collectors.toList()); + } + } + + public static List addressToStrList(List
adressList) { + if (adressList.isEmpty()) { + return new ArrayList(); + } else { + return adressList.stream().map(addr -> { + return addr.toString().trim(); + }).collect(Collectors.toList()); + } + } + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java new file mode 100644 index 00000000..6875fc54 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java @@ -0,0 +1,42 @@ +package com.webank.wescott.tool; + +import org.apache.commons.codec.binary.StringUtils; +import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes16; +import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes2; +import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32; + +public class BytesUtils { + + public static Bytes32 stringToBytes32(String string) { + byte[] byteValue = string.getBytes(); + byte[] byteValueLen32 = new byte[32]; + System.arraycopy(byteValue, 0, byteValueLen32, 0, byteValue.length); + return new Bytes32(byteValueLen32); + } + + public static String Bytes32ToString(Bytes32 b) { + return StringUtils.newStringUsAscii(b.getValue()).trim(); + } + + public static Bytes16 stringToBytes16(String string) { + byte[] byteValue = string.getBytes(); + byte[] byteValueLen16 = new byte[16]; + System.arraycopy(byteValue, 0, byteValueLen16, 0, byteValue.length); + return new Bytes16(byteValueLen16); + } + + public static String Bytes16ToString(Bytes16 b) { + return StringUtils.newStringUsAscii(b.getValue()).trim(); + } + + public static Bytes2 stringToBytes2(String string) { + byte[] byteValue = string.getBytes(); + byte[] byteValueLen2 = new byte[2]; + System.arraycopy(byteValue, 0, byteValueLen2, 0, byteValue.length); + return new Bytes2(byteValueLen2); + } + + public static String Bytes2ToString(Bytes2 b) { + return StringUtils.newStringUsAscii(b.getValue()).trim(); + } +} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java new file mode 100644 index 00000000..0522d618 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java @@ -0,0 +1,38 @@ +package com.webank.wescott.tool; + +import java.io.InputStream; +import java.security.Key; +import java.security.KeyStore; +import java.security.interfaces.ECPrivateKey; + +import org.fisco.bcos.web3j.crypto.Credentials; +import org.fisco.bcos.web3j.crypto.ECKeyPair; +import org.springframework.core.io.Resource; +import org.springframework.core.io.support.PathMatchingResourcePatternResolver; +import org.springframework.core.io.support.ResourcePatternResolver; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class CredentialUtils { + + public static Credentials loadKey(String keyStoreFileName, String keyStorePassword, String keyPassword) + throws Exception { + KeyStore ks = KeyStore.getInstance("JKS"); + ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); + Resource cdResource = resolver.getResource(keyStoreFileName); + try (InputStream stream = cdResource.getInputStream()) { + ks.load(stream, keyStorePassword.toCharArray()); + Key key = ks.getKey("ec", keyPassword.toCharArray()); + ECKeyPair keyPair = ECKeyPair.create(((ECPrivateKey) key).getS()); + Credentials credentials = Credentials.create(keyPair); + if (credentials != null) { + return credentials; + } else { + log.error("秘钥参数输入有误!"); + } + } + return null; + } + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java b/java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java new file mode 100644 index 00000000..a233e9ab --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java @@ -0,0 +1,21 @@ +package com.webank.wescott.tool; + +public class JacksonException extends RuntimeException { + + public JacksonException() { + super(); + } + + public JacksonException(String message, Throwable cause) { + super(message, cause); + } + + public JacksonException(String message) { + super(message); + } + + public JacksonException(Throwable cause) { + super(cause); + } + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java new file mode 100644 index 00000000..4a2189a3 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java @@ -0,0 +1,161 @@ +package com.webank.wescott.tool; + +import java.io.IOException; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; + +import com.alibaba.fastjson.JSONArray; +import com.alibaba.fastjson.JSONObject; +import com.fasterxml.jackson.core.JsonParseException; +import com.fasterxml.jackson.core.JsonParser; +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.DeserializationFeature; +import com.fasterxml.jackson.databind.JavaType; +import com.fasterxml.jackson.databind.JsonMappingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.SerializationFeature; + +import lombok.extern.slf4j.Slf4j; + +@Slf4j +public class JacksonUtils { + public static ObjectMapper objectMapper = new ObjectMapper(); + + static { + objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); + objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); + objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); + } + + public static T fromJson(String json, Class clazz) { + try { + return fromJsonWithException(json, clazz); + } catch (Exception e) { + log.error("json is: " + json, e); + return null; + } + } + + public static T fromJson(String json, Class c, Class...t) { + try { + return fromJsonWithException(json, c, t); + } catch (IOException e) { + throw new JacksonException(e); + } + } + + public static T fromJson(String json, JavaType type) { + try { + return fromJsonWithException(json, type); + } catch (IOException e) { + throw new JacksonException(e); + } + } + + public static T fromJsonWithException(String json, Class clazz) + throws JsonParseException, JsonMappingException, IOException { + return objectMapper.readValue(json, clazz); + } + + public static T fromJsonWithException(String json, Class c, Class...t) + throws JsonParseException, JsonMappingException, IOException { + JavaType javaType = objectMapper.getTypeFactory().constructParametricType(c, t); + return objectMapper.readValue(json, javaType); + } + + public static T fromJsonWithException(String json, JavaType type) + throws JsonParseException, JsonMappingException, IOException { + T ret = (T) objectMapper.readValue(json, type); + return ret; + } + + public static List fromJsonList(String json, Class c) { + try { + return fromJsonListWithException(json, c); + } catch (IOException e) { + throw new JacksonException(e); + } + } + + public static List fromJsonListWithException(String json, Class c) throws IOException { + JavaType type = getCollectionType(ArrayList.class, c); + return (List) objectMapper.readValue(json, type); + } + + public static JavaType getCollectionType(Class collectionClass, Class...elementClasses) { + return objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); + } + + public static String toJsonWithException(Object o) throws JsonProcessingException { + return objectMapper.writeValueAsString(o); + } + + public static String toJson(Object o) { + try { + return toJsonWithException(o); + } catch (Exception e) { + throw new JacksonException(e); + } + } + + public static Map convertValue(Object req, Class keyClazz, Class valueClazz) { + Map ret = objectMapper.convertValue(req, + objectMapper.getTypeFactory().constructMapType(Map.class, keyClazz, valueClazz)); + return ret; + } + + public static T convertMap(Map map, Class retClazz) { + return objectMapper.convertValue(map, retClazz); + } + + public static void main(String[] args) throws Exception { + String json = "{\"name\": \"abc\",\"value\": [\"a\",\"b\",\"c\"]}"; + JavaType type = objectMapper.getTypeFactory().constructParametricType(NameValueVO.class, + objectMapper.getTypeFactory().constructParametricType(List.class, String.class)); + NameValueVO> vos = (NameValueVO>) objectMapper.readValue(json, type); + System.out.println(vos); + } + + public static T strToObject(String str, Class clazz) { + ObjectMapper mapper = new ObjectMapper(); + T t = null; + try { + t = mapper.readValue(str, clazz); + return t; + } catch (IOException e) { + e.printStackTrace(); + } + return t; + } + + // 对象转换为字符串 + public static String objectToStr(T t) { + ObjectMapper mapper = new ObjectMapper(); + String str = null; + try { + str = mapper.writeValueAsString(t); + } catch (IOException e) { + e.printStackTrace(); + } + return str; + } + + // json转化为对象list + public static List strToList(String str, Class clazz) { + JSONArray jsonArray = JSONArray.parseArray(str); + for (int i = 0; i < jsonArray.size(); i++) { + System.out.println(jsonArray.get(i)); + } + + T t = null; + List list = new ArrayList(); + for (int i = 0; i < jsonArray.size(); i++) { + String objStr = JSONObject.toJSONString(jsonArray.get(i)); + t = (T) JSONObject.parseObject(objStr, clazz); + list.add(t); + } + return list; + } + +} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java b/java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java new file mode 100644 index 00000000..00d2bdd7 --- /dev/null +++ b/java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java @@ -0,0 +1,15 @@ +package com.webank.wescott.tool; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Data +@NoArgsConstructor +@AllArgsConstructor +@Accessors(chain = true) +public class NameValueVO { + private String name; + private T value; +} diff --git a/java/wescott/src/main/resources/application.properties b/java/wescott/src/main/resources/application.properties new file mode 100644 index 00000000..232ac58f --- /dev/null +++ b/java/wescott/src/main/resources/application.properties @@ -0,0 +1,12 @@ +### Springboot server config +server.port=5310 +spring.jackson.date-format=yyyy-MM-dd HH:mm:ss +spring.jackson.time-zone=GMT+8 + +logging.level.org.fisco.bcos=INFO + +## System config +system.orgId=fb +system.nodeStr=node1@106.12.79.242:20201 +system.groupId=1 +system.configPath=config/ diff --git a/java/wescott/src/main/resources/ca.crt b/java/wescott/src/main/resources/ca.crt new file mode 100644 index 00000000..e30b6f68 --- /dev/null +++ b/java/wescott/src/main/resources/ca.crt @@ -0,0 +1,20 @@ +-----BEGIN CERTIFICATE----- +MIIDPTCCAiWgAwIBAgIJANw5ER1ZP/ArMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNV +BAMMBWNoYWluMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjAe +Fw0yMDAxMjEwMzM5NTRaFw0zMDAxMTgwMzM5NTRaMDUxDjAMBgNVBAMMBWNoYWlu +MRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjCCASIwDQYJKoZI +hvcNAQEBBQADggEPADCCAQoCggEBAOCuBfjLxboeKKRQ5Q6TGAllCo903tk3Q/VG +6TcNzPwZSQd8DZ3RFOfB4gSHvOHWxxy5MJ2325hn0wu399SR/AR6d2dYbvJ0L2D3 +U4X9sUOeFw8bYfhB8tcZSpKNh9aEjQsoXwP+vdtsl5BYWFj4I8QrNWtmMoPauwXK +LYc+v0dYaQPa0MrsDGW+t7ootSGbQWWQHi7q78KXrHwfpttupHlNKYhlXWqm5OB+ +7+mwNK2q2zDV9Fsh7p+VaDS1TxwJmQUJBYfzc48RGyl7bsQT371bvYYNvACTDMVj +O+MvABDpr5mgtkVv3Eu2AyxEcKugK69Yp06q6PF+/0lnKa34t4kCAwEAAaNQME4w +HQYDVR0OBBYEFIIa4SV9Yjz4l3/v43kqDR0bNBsmMB8GA1UdIwQYMBaAFIIa4SV9 +Yjz4l3/v43kqDR0bNBsmMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB +ALw3jzd8LgrUfy4kiF0kiz8fFTGj0BqF5ACi7gaGKj0vjGY6Xc1uANFe6yANT8ue +OMM42noWHe2NAbce9igeG9yKO1T3doxnmLa0OuoC/RZ3tycmd2PT8bsOSToIjdXr +4cLjKzts9k//V4la1VH2ZGOxs0Zh4FiJpd66FVtQK1fRkbEaK1NdxXXL3gZRTPA0 +57eEUREMKwtcR0K+tdFGxmW0SOxslm1hG6sfIFZIaFw+LUBA4sHqmtdd7cq8QP9L +gt2EnAI5gqyrEoClbMZO0RtuEAYScSZSPfPXK37bdu6pNT8Un7dGIKIDORs7Jq5I +Chwi0jxEl5C2nicr6OuIMks= +-----END CERTIFICATE----- diff --git a/java/wescott/src/main/resources/node.crt b/java/wescott/src/main/resources/node.crt new file mode 100644 index 00000000..1ee40544 --- /dev/null +++ b/java/wescott/src/main/resources/node.crt @@ -0,0 +1,33 @@ +-----BEGIN CERTIFICATE----- +MIICNzCCAR+gAwIBAgIJAIUN9Dhu9YdtMA0GCSqGSIb3DQEBCwUAMDcxDzANBgNV +BAMMBmFnZW5jeTETMBEGA1UECgwKZmlzY28tYmNvczEPMA0GA1UECwwGYWdlbmN5 +MB4XDTIwMDEyMTAzMzk1NVoXDTMwMDExODAzMzk1NVowMTEMMAoGA1UEAwwDc2Rr +MRMwEQYDVQQKDApmaXNjby1iY29zMQwwCgYDVQQLDANzZGswVjAQBgcqhkjOPQIB +BgUrgQQACgNCAARc27EPAi4Ody4UgNEY5dtws2oFfb+uDAwovTSquaMhQoyf6219 +F3szcq+ZxIeMygyX5J2vkQBQ1mVFy6tiblICoxowGDAJBgNVHRMEAjAAMAsGA1Ud +DwQEAwIF4DANBgkqhkiG9w0BAQsFAAOCAQEAftz2gRHXZEqYFXsEpAPk9L+bnHHb +1EWTLf9NR8A72n8YIEfOZVvODwOMduqKvZnLq9fZqCSqYoEzi/Lp2uLaNekZJyYS +aWo72QWNW+JBYJBLXrVh33bjZ/PN5+6bGhEYpCFX5FRUvlSkAsGCapR0gR0171Tf +dJwoXKWQkB+8eKxy6jUDddkuP+CSAapdOiXtS8VQPXXZWo991XDKJwi9Vu2XPuQh +BhW2XNWWHdBW36pLQwJsVNJ9y/JqBtS+ApKwKTGdM5kYqzUvk426LDKATlV1UFxF ++wMH7uO71BWarxjPhrNbx07B5AUANe0MGf9GlH0RlzKIeHtOSaAeJs7oKw== +-----END CERTIFICATE----- +-----BEGIN CERTIFICATE----- +MIIC/zCCAeegAwIBAgIJAIUN9Dhu9YdhMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNV +BAMMBWNoYWluMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjAe +Fw0yMDAxMjEwMzM5NTRaFw0zMDAxMTgwMzM5NTRaMDcxDzANBgNVBAMMBmFnZW5j +eTETMBEGA1UECgwKZmlzY28tYmNvczEPMA0GA1UECwwGYWdlbmN5MIIBIjANBgkq +hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwL6XgS1UZp4RRibvGyiCRs2EqQxNwynm +2QxU68KDScDmgTX9tYmVvNIa0ZDCEBTdWxb692FZJR8GkWPZPfrGls4aI0A+MGKA +MSf6tCD12f7tyBsy9aTV3iBpTKjUa557nAwcJDwZy2UmqNHZJ0pngqSBplxZDHXf +tnNSpBVD6Nji2wzb/01qzjuQx48pDgf9ugS135rnbZFRZIKOa50eI2CrAy7lVcJf +g7B329pmDc0LLIR9oWTT5tMyD1VH7IXjqUVw8FTi4vyJgqxcseGKgCz2EfCEvYFm +YWVnrCOZmJm6QnveiYXac+jKWobEvsuFAKoSnIAXjO8RTyFi697nUQIDAQABoxAw +DjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCzWDURfdccbSwXZina +xq/uQ0Nl4bUeHAKzy9tBEWGTb6wvBWwKP3vkq7lK3GD61TPYATCC/Sjg4EoKanPK +eXhUO5mbHUW5HKM3F+qhu7H4PPwL6KyITOScjTwm1TvG/2/wo596aZK3xPcs+Nty +8d97qjACB5KvnsVBKv0MLcoz/CrExrnDdHmB/UT9CO2LeqSHyhspek/XUSdVDyfq +sQYRIpnD0fWD6tk34C8Tn5ACcMNZDVXWfMUxPZzq1ueFH1QYSoup8rxqHu4THPAt +fwn+f3zztPI6mr+dnXi0dwY+CaUWUjJrY1FT+3qmQoepTcClkb+PieE0KnyFiVCz +4KMW +-----END CERTIFICATE----- diff --git a/java/wescott/src/main/resources/node.key b/java/wescott/src/main/resources/node.key new file mode 100644 index 00000000..7f5bde42 --- /dev/null +++ b/java/wescott/src/main/resources/node.key @@ -0,0 +1,5 @@ +-----BEGIN PRIVATE KEY----- +MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgu3eP3rcZK1ssiGzhiRBW +ejJ26ze8RdWgnV58R48hZtKhRANCAARc27EPAi4Ody4UgNEY5dtws2oFfb+uDAwo +vTSquaMhQoyf6219F3szcq+ZxIeMygyX5J2vkQBQ1mVFy6tiblIC +-----END PRIVATE KEY----- diff --git a/java/wescott/src/main/resources/p1.jks b/java/wescott/src/main/resources/p1.jks new file mode 100644 index 0000000000000000000000000000000000000000..599dc6e0438632e311526628f8bc77f433a67cc1 GIT binary patch literal 660 zcmezO_TO6u1_mY|W&~rV)MOwt|2W5{cp$&tpw@tojZ2%2k%dux+(;26o?^$zL?7j1je6tN=etW|!bw4H?Ufg>4 z%{SprmQ41}ukmsm-Cw_4c-r&&@UaK_85ドルEoL^SuBs=TQD`(Vf7OD4S>-&@)L30|hSR0WU}ymoQs-YEoiewjor28(n}ICSaf-&TC{~ zU}7ドル$U~X(~XcQ&EZ)9j_X=r3*0TrOB?U4q;Z0um4GBHBE%*@En?8Lz0pBVGr=l8~0 z@1ドル}T9|`U`xMhcZvG23S4ao^P4#&R#vFbl5-7ssH>m`GncWbA$tua*DwEoWBqz9?x z9$kx$XC*yetY{!_APWo)Sw0pq7Lf-@9eYkpmXm&0s&BKhWM5T5V$NaIP-gaIFmPj1 zWSDn=Cw(=?d*}bTszFP07X7~^f9dVZKTU1-W3MM#-D7pFJ_X5vjr{VbWj95t`8U^VYj>M$gx+XbxdzSW)CB zA%9xuT)XE5brG$LJLewI7O|+QeDm-{+(Na~oBz2ToV~ADq?G!;^V@fFyR%~ImpkmQ z;@{*ogPp`0p=WAf33SyZgC@pvKwP+hnTe5!iN)1b=Yata8;4e#2ドルnUTW+qk!gD698 z15P&PP!={}rsO;rheMdDI0MFE2XpuhctOgzgxShdlM?f?4WRS0z*TVk420{Vq)6X#TLBmX#-Hn@@uCLmtQVbI&eF+q@yKP qyIU=C?p(G?|Df|u1@Fumt`-SiIuW16;~RV{Pjl|(V%;_AF24XNgUhr4 literal 0 HcmV?d00001 diff --git a/java/wescott/src/main/resources/p3.jks b/java/wescott/src/main/resources/p3.jks new file mode 100644 index 0000000000000000000000000000000000000000..0332d46fea4c8cafbea1e9d69cfe8717a97c9ce4 GIT binary patch literal 698 zcmezO_TO6u1_mY|W&~rV)MOwtZPl6*ejvZzpw@tojZ2%2k%du{p72kifLx)EVFMK-tc-YvUr~n*IU*74Y!w` zI2Ua9W8JpKiu1`onNRpn@R=N?TX9t4^^%gk#xfgK*Qd`>cF~Hwd`0!Cd%*;Th30>h zj{R$S2zC-{gr2E^CD2tr44N3f0P)NP%uI|-Oe`@>E8ZFKuyJU$d7QIlVP;}wFvv6H zHsEAq4rO5zW^(p36g1!maX5rIiZc@P(lZh>VM6RkLQ)12AXQvEf=T)L>6xkV$@zK3 z`9&p}rMZUu2D~6SZeccvoFR_^7f66vm^nMOz(7Hq*U-Yyz{u3lz`)SdC`y9g$Pgr8 zU<2c_iu%kr^^ zv50)^b7z?_?aJyEr)Kc}dB3?S$ZygI)YxElXE1PKQc##O>49~$cF*o9a!+{um;Z8k zWZ*aNS7vvr*zfkq{|?P(QYf;oFJE+H+mEkTD{7|JuDZUxE?ssCchkNf-HO$}o9L$zww+cK`R2ZaHv%0RS}4;T8Y@ literal 0 HcmV?d00001 diff --git a/java/wescott/src/main/resources/user1.jks b/java/wescott/src/main/resources/user1.jks new file mode 100644 index 0000000000000000000000000000000000000000..867334d6a16987a27cfdaa516b462ab1bd582a7c GIT binary patch literal 660 zcmezO_TO6u1_mY|W&~rV)MOwt|2Xr%Z$N&%L9GEF8<#d4bmymzloq7_d+5b*vanv? zx2)#hDj)tFX0F^md+C2Y)#PaR!XT4(9M1@Pd?a3A2@_CMD)&8$t!R(FK@c0tO1=yha8F zhDL@4=EjDm7Eu!XMuvu#hDJsfPyw3S9%&%V#t!x=6C>2i%#7^JP7Evo!l_q&?k~2y zC|+mv_f+M+-?ruLlP;S5XnryE@TGL|xd}586}F4liXKbaR5ID{YgUlU;_yxTG<15q z7H#)`>UwaoqJg}DEHE@=`B=nQM9w!>+_{xm@9z8Fc<%afedz)j;cbr%%g4zO>gZesvS5WbF*Cj`ipu)4m+5`Z@>#u#wE;Fo|=@Hmu(0Y;6@i*R@EaK#S{fP|SwID7YI~%CFdIAAr%a4cFEcZ;GdnS`G%=;$d6+EnGLrkn zwQ}1o-y73Z?E2$vnO?A7U~MZpmHRP$LokDN&xbOm>7kzK>i5>4oM_%AzN?IzLCt)x zYt{C}iU#rqvcS-g assertEquals("uint256", entity.getType()), + () -> assertEquals(BigInteger.valueOf(2020), v)); + } + + public static void main(String[] args) { + + int id = 4 & 1; + System.out.println(id); + id |=0; + System.out.println(id); + + id= id ^ 1; + System.out.println(id); + + } + +} diff --git a/java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java b/java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java new file mode 100644 index 00000000..742cda81 --- /dev/null +++ b/java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java @@ -0,0 +1,115 @@ +/** + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package com.webank.wescott.template.point; + +import java.math.BigInteger; + +import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; + +import com.webank.wescott.BaseTests; +import com.webank.wescott.contract.point.Admin; +import com.webank.wescott.contract.point.RewardPointController; +import com.webank.wescott.contract.point.RewardPointData; + +/** + * AdminTest + * + * @Description: AdminTest + * @author maojiayu + * @data Apr 8, 2020 4:36:44 PM + * + */ +public class AdminTest extends BaseTests { + private Admin admin; + private RewardPointController controller; + private RewardPointData data; + + @BeforeEach + public void deploy() throws Exception { + admin = Admin.deploy(web3j, p1, contractGasProvider).send(); + Assertions.assertNotNull(admin); + String dataAddress = admin._dataAddress().send(); + Assertions.assertNotNull(dataAddress); + String controllerAddress = admin._controllerAddress().send(); + Assertions.assertNotNull(controllerAddress); + controller = RewardPointController.load(controllerAddress, web3j, p1, contractGasProvider); + data = RewardPointData.load(dataAddress, web3j, p1, contractGasProvider); + } + + @Test + public void test() throws Exception { + TransactionReceipt tr = controller.register().send(); + Assertions.assertEquals("0x0", tr.getStatus()); + tr = controller.issue(p1.getAddress(), BigInteger.valueOf(100)).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + BigInteger balance1 = controller.balance(p1.getAddress()).send(); + Assertions.assertEquals(100, balance1.intValue()); + + RewardPointController controllerP2 = + RewardPointController.load(controller.getContractAddress(), web3j, p2, contractGasProvider); + tr = controllerP2.register().send(); + Assertions.assertEquals("0x0", tr.getStatus()); + tr = controller.issue(p2.getAddress(), BigInteger.valueOf(200)).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + BigInteger balance2 = controller.balance(p2.getAddress()).send(); + Assertions.assertEquals(200, balance2.intValue()); + + // transfer + tr = controllerP2.transfer(p1.getAddress(), BigInteger.valueOf(50)).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + balance1 = controller.balance(p1.getAddress()).send(); + Assertions.assertEquals(150, balance1.intValue()); + balance2 = controller.balance(p2.getAddress()).send(); + Assertions.assertEquals(150, balance2.intValue()); + + // issue + Assertions.assertTrue(controllerP2.isIssuer(p1.getAddress()).send()); + Assertions.assertTrue(!controllerP2.isIssuer(p2.getAddress()).send()); + tr = controller.addIssuer(p2.getAddress()).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + tr = controllerP2.issue(p2.getAddress(), BigInteger.ONE).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + balance2 = controller.balance(p2.getAddress()).send(); + Assertions.assertEquals(151, balance2.intValue()); + tr = controllerP2.renounceIssuer().send(); + Assertions.assertEquals("0x0", tr.getStatus()); + Assertions.assertTrue(!controllerP2.isIssuer(p2.getAddress()).send()); + BigInteger total = data._totalAmount().send(); + Assertions.assertEquals(301, total.intValue()); + + // destroy + tr = controller.destroy(BigInteger.valueOf(50)).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + balance1 = controller.balance(p1.getAddress()).send(); + Assertions.assertEquals(100, balance1.intValue()); + total = data._totalAmount().send(); + Assertions.assertEquals(251, total.intValue()); + + // unregister + tr = controllerP2.unregister().send(); + Assertions.assertEquals("0x16", tr.getStatus()); + tr = controllerP2.transfer(p1.getAddress(), BigInteger.valueOf(151)).send(); + Assertions.assertEquals("0x0", tr.getStatus()); + tr = controllerP2.unregister().send(); + Assertions.assertEquals("0x0", tr.getStatus()); + Assertions.assertTrue(!data.isIssuer(p2.getAddress()).send()); + + } + +} diff --git a/test/TestQueue.sol b/test/TestQueue.sol new file mode 100644 index 00000000..621a469e --- /dev/null +++ b/test/TestQueue.sol @@ -0,0 +1,22 @@ +pragma solidity ^0.4.25; + +import "./LibQueue.sol"; + +contract TestQueue { + + using LibQueue for LibQueue.Queue; + + LibQueue.Queue private queue; + + constructor(){ + queue = LibQueue.newQueue(); + } + + function f() public { + queue.enqueue(1); + queue.enqueue(2); + bytes32 pop = queue.dequeue();//Expected to be 1 + uint size = queue.queueSize();//Expected to be 1 + } + +} diff --git a/test/TestSafeMath.sol b/test/TestSafeMath.sol new file mode 100644 index 00000000..6e088f10 --- /dev/null +++ b/test/TestSafeMath.sol @@ -0,0 +1,12 @@ +pragma solidity ^0.4.25; + +import "./LibSafeMath.sol"; + +contract TestSafeMath { + using LibSafeMath for uint256; + + function testAdd(uint256 a, uint256 b) external returns (uint256 c) { + //c = LibSafeMath.add(a,b); + c = a.add(b); + } +} \ No newline at end of file diff --git a/test/TestSet.sol b/test/TestSet.sol new file mode 100644 index 00000000..be9c08aa --- /dev/null +++ b/test/TestSet.sol @@ -0,0 +1,21 @@ +pragma solidity ^0.4.25; + +import "./LibAddressSet.sol"; +import "./LibBytes32Set.sol"; + +contract TestSet { + using LibAddressSet for LibAddressSet.AddressSet; + using LibBytes32Set for LibBytes32Set.Bytes32Set; + LibAddressSet.AddressSet private addressSet; + LibBytes32Set.Bytes32Set private bytes32Set; + + function testAddress() public { + addressSet.add(address(1)); + uint256 size = addressSet.size();//Expected to be 1 + } + + function testBytes32() public { + bytes32Set.add(bytes32(1)); + uint256 size = bytes32Set.size();//Expected to be 1 + } +} From 2c9e6b71e363143e5039e3316c12677dc24cdac0 Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 11:51:31 +0800 Subject: [PATCH 02/23] read fix structure --- README.md | 28 +- contracts/authority/acl/WEAclGuard.sol | 78 -- contracts/authority/base/WEAuth.sol | 49 -- contracts/authority/base/WEAuthority.sol | 20 - contracts/authority/base/WEBasicAuth.sol | 36 - .../evidence/DemoApplicationTests.java | 61 -- java/wescott/.gitignore | 28 - java/wescott/HELP.md | 21 - java/wescott/build.gradle | 40 -- java/wescott/config/user.jks | 0 .../gradle/wrapper/gradle-wrapper.properties | 5 - java/wescott/gradlew | 172 ----- java/wescott/gradlew.bat | 84 --- java/wescott/settings.gradle | 1 - .../webank/wescott/WescottApplication.java | 13 - .../config/SystemEnvironmentConfig.java | 48 -- .../wescott/config/Web3jV2BeanConfig.java | 145 ---- .../webank/wescott/constant/GasConstants.java | 33 - .../webank/wescott/contract/TestSafeMath.java | 152 ---- .../contract/authority/WEAclGuard.java | 674 ------------------ .../wescott/contract/authority/WEAuth.java | 284 -------- .../contract/authority/WEAuthority.java | 102 --- .../contract/authority/WEBasicAuth.java | 187 ----- .../webank/wescott/contract/point/Admin.java | 172 ----- .../wescott/contract/point/BasicAuth.java | 154 ---- .../wescott/contract/point/IssuerRole.java | 252 ------- .../contract/point/RewardPointController.java | 620 ---------------- .../contract/point/RewardPointData.java | 567 --------------- .../webank/wescott/tool/AddressListUtils.java | 42 -- .../com/webank/wescott/tool/BytesUtils.java | 42 -- .../webank/wescott/tool/CredentialUtils.java | 38 - .../webank/wescott/tool/JacksonException.java | 21 - .../com/webank/wescott/tool/JacksonUtils.java | 161 ----- .../com/webank/wescott/tool/NameValueVO.java | 15 - .../src/main/resources/application.properties | 12 - java/wescott/src/main/resources/ca.crt | 20 - java/wescott/src/main/resources/node.crt | 33 - java/wescott/src/main/resources/node.key | 5 - java/wescott/src/main/resources/p1.jks | Bin 660 -> 0 bytes java/wescott/src/main/resources/p2.jks | Bin 660 -> 0 bytes java/wescott/src/main/resources/p3.jks | Bin 698 -> 0 bytes java/wescott/src/main/resources/user1.jks | Bin 660 -> 0 bytes java/wescott/src/main/resources/user2.jks | Bin 659 -> 0 bytes .../java/com/webank/wescott/BaseTests.java | 39 - .../wescott/authority/AclGuardTest.java | 103 --- .../webank/wescott/safemath/SafeMathTest.java | 77 -- .../wescott/template/point/AdminTest.java | 115 --- 47 files changed, 25 insertions(+), 4724 deletions(-) delete mode 100644 contracts/authority/acl/WEAclGuard.sol delete mode 100644 contracts/authority/base/WEAuth.sol delete mode 100644 contracts/authority/base/WEAuthority.sol delete mode 100644 contracts/authority/base/WEBasicAuth.sol delete mode 100644 java/biz_templates/evidence/DemoApplicationTests.java delete mode 100644 java/wescott/.gitignore delete mode 100644 java/wescott/HELP.md delete mode 100644 java/wescott/build.gradle delete mode 100644 java/wescott/config/user.jks delete mode 100644 java/wescott/gradle/wrapper/gradle-wrapper.properties delete mode 100755 java/wescott/gradlew delete mode 100644 java/wescott/gradlew.bat delete mode 100644 java/wescott/settings.gradle delete mode 100644 java/wescott/src/main/java/com/webank/wescott/WescottApplication.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java delete mode 100644 java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java delete mode 100644 java/wescott/src/main/resources/application.properties delete mode 100644 java/wescott/src/main/resources/ca.crt delete mode 100644 java/wescott/src/main/resources/node.crt delete mode 100644 java/wescott/src/main/resources/node.key delete mode 100644 java/wescott/src/main/resources/p1.jks delete mode 100644 java/wescott/src/main/resources/p2.jks delete mode 100644 java/wescott/src/main/resources/p3.jks delete mode 100644 java/wescott/src/main/resources/user1.jks delete mode 100644 java/wescott/src/main/resources/user2.jks delete mode 100644 java/wescott/src/test/java/com/webank/wescott/BaseTests.java delete mode 100644 java/wescott/src/test/java/com/webank/wescott/authority/AclGuardTest.java delete mode 100644 java/wescott/src/test/java/com/webank/wescott/safemath/SafeMathTest.java delete mode 100644 java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java diff --git a/README.md b/README.md index b460ae21..9a7b6805 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,27 @@ -# WeScott +# 组件介绍 + +智能合约库模板,涵盖了从基础类型到上层业务的常见代码,用户可根据实际需要进行参考、复用。 + + +## 文档s +- [**中文**](https://toolkit-doc.readthedocs.io/zh_CN/latest/docs/WeBankBlockchain-Toolkit-Contract/index.html) + +## 贡献代码vv +欢迎参与本项目的社区建设: +- 如项目对您有帮助,欢迎点亮我们的小星星(点击项目左上方Star按钮)。 +- 欢迎提交代码(Pull requests)。 +- [提问和提交BUG](https://github.com/WeBankBlockchain/Toolkit-Contrcat/issues)。 +- 如果发现代码存在安全漏洞,请在[这里](https://security.webank.com)上报。 + + +![](https://media.githubusercontent.com/media/FISCO-BCOS/LargeFiles/master/images/QR_image.png) + + +## License +![license](http://img.shields.io/badge/license-Apache%20v2-blue.svg) + +开源协议为[Apache License 2.0](http://www.apache.org/licenses/). 详情参考[LICENSE](../LICENSE)。 + + -#### 介绍 -webank smart contract open source tookit diff --git a/contracts/authority/acl/WEAclGuard.sol b/contracts/authority/acl/WEAclGuard.sol deleted file mode 100644 index a342aca3..00000000 --- a/contracts/authority/acl/WEAclGuard.sol +++ /dev/null @@ -1,78 +0,0 @@ -// This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program 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 General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pragma solidity ^0.4.25; - -import "./base/WEAuth.sol"; - -contract WEAclGuard is WEAuth, WEAuthority { - bytes4 constant public ANY_SIG = bytes4(uint(-1)); - address constant public ANY_ADDRESS = address(bytes20(uint(-1))); - - mapping (address => mapping (address => mapping (bytes4 => bool))) _acl; - - event LogPermit( - address indexed src, - address indexed dst, - bytes4 indexed sig - ); - - event LogForbid( - address indexed src, - address indexed dst, - bytes4 indexed sig - ); - - constructor() public { - setOwner(msg.sender); - } - - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool) { - return _acl[src][dst][sig] - || _acl[src][dst][ANY_SIG] - || _acl[src][ANY_ADDRESS][sig] - || _acl[src][ANY_ADDRESS][ANY_SIG] - || _acl[ANY_ADDRESS][dst][sig] - || _acl[ANY_ADDRESS][dst][ANY_SIG] - || _acl[ANY_ADDRESS][ANY_ADDRESS][sig] - || _acl[ANY_ADDRESS][ANY_ADDRESS][ANY_SIG]; - } - - function permit(address src, address dst, bytes4 sig) public onlyAuthorized { - _acl[src][dst][sig] = true; - emit LogPermit(src, dst, sig); - } - - function forbid(address src, address dst, bytes4 sig) public onlyAuthorized { - _acl[src][dst][sig] = false; - emit LogForbid(src, dst, sig); - } - - function permit(address src, address dst, string sig) external { - permit(src, dst, bytes4(keccak256(sig))); - } - - function forbid(address src, address dst, string sig) external { - forbid(src, dst, bytes4(keccak256(sig))); - } - - function permitAny(address src, address dst) external { - permit(src, dst, ANY_SIG); - } - - function forbidAny(address src, address dst) external { - forbid(src, dst, ANY_SIG); - } -} diff --git a/contracts/authority/base/WEAuth.sol b/contracts/authority/base/WEAuth.sol deleted file mode 100644 index ba04512c..00000000 --- a/contracts/authority/base/WEAuth.sol +++ /dev/null @@ -1,49 +0,0 @@ - // This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program 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 General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pragma solidity ^0.4.25; - -import "./WEBasicAuth.sol"; -import "./WEAuthority.sol"; - -contract WEAuth is WEBasicAuth { - WEAuthority public _authority; - - event LogSetAuthority (address indexed authority, address from, bytes4 sig); - - - function setAuthority(WEAuthority authority) - public - onlyAuthorized - { - _authority = authority; - emit LogSetAuthority(authority, msg.sender, msg.sig); - } - - modifier onlyAuthorized { - require(isAuthorized(msg.sender, msg.sig), "WEAuth: is not authorized"); - _; - } - - function isAuthorized(address src, bytes4 sig) public view returns (bool) { - if (src == address(this)) { - return true; - } else if (src == _owner) { - return true; - } else if (_authority == WEAuthority(0)) { - return false; - } else { - return _authority.canCall(src, this, sig); - } - } -} \ No newline at end of file diff --git a/contracts/authority/base/WEAuthority.sol b/contracts/authority/base/WEAuthority.sol deleted file mode 100644 index 2e741ac8..00000000 --- a/contracts/authority/base/WEAuthority.sol +++ /dev/null @@ -1,20 +0,0 @@ - // This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program 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 General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pragma solidity ^0.4.25; - -contract WEAuthority { - function canCall( - address src, address dst, bytes4 sig - ) public view returns (bool); -} \ No newline at end of file diff --git a/contracts/authority/base/WEBasicAuth.sol b/contracts/authority/base/WEBasicAuth.sol deleted file mode 100644 index e9a53334..00000000 --- a/contracts/authority/base/WEBasicAuth.sol +++ /dev/null @@ -1,36 +0,0 @@ - // This program is free software: you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation, either version 3 of the License, or -// (at your option) any later version. - -// This program 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 General Public License for more details. - -// You should have received a copy of the GNU General Public License -// along with this program. If not, see . - -pragma solidity ^0.4.25; - -contract WEBasicAuth { - address public _owner; - event LogSetOwner(address indexed owner, address indexed oldOwner, address indexed contractAddress); - - constructor() public { - _owner = msg.sender; - } - - function setOwner(address owner) - public - onlyOwner - { - _owner = owner; - emit LogSetOwner(owner, _owner, this); - } - - modifier onlyOwner() { - require(msg.sender == _owner, "WEBasicAuth: only owner is authorized."); - _; - } -} \ No newline at end of file diff --git a/java/biz_templates/evidence/DemoApplicationTests.java b/java/biz_templates/evidence/DemoApplicationTests.java deleted file mode 100644 index 8bf8ca2c..00000000 --- a/java/biz_templates/evidence/DemoApplicationTests.java +++ /dev/null @@ -1,61 +0,0 @@ -package com.example.demo; - -import com.example.demo.contracts.Evidence; -import com.example.demo.contracts.EvidenceRepository; -import com.example.demo.contracts.RequestRepository; -import org.fisco.bcos.web3j.crypto.ECKeyPair; -import org.fisco.bcos.web3j.crypto.gm.GenCredential; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.utils.Numeric; -import org.junit.jupiter.api.Test; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.boot.test.context.SpringBootTest; - -import java.math.BigInteger; -import java.util.Arrays; -import java.util.List; - -@SpringBootTest -class DemoApplicationTests { - - @Autowired - private Web3j web3j; - - @Autowired - private ContractGasProvider contractGasProvider; - - @Test - void test() throws Exception{ - //准备用户 - ECKeyPair aUser = GenCredential.createKeyPair(); - ECKeyPair bUser = GenCredential.createKeyPair(); - ECKeyPair cUser = GenCredential.createKeyPair(); - - //部署基于2-3投票的合约 - BigInteger threshold = BigInteger.valueOf(2); - List voters = Arrays.asList(GenCredential.create(bUser).getAddress(), GenCredential.create(cUser).getAddress()); - EvidenceRepository storageContract = EvidenceRepository.deploy(web3j, GenCredential.create(aUser), contractGasProvider).send(); - RequestRepository voteRepository = RequestRepository.deploy(web3j, GenCredential.create(aUser), contractGasProvider, threshold, voters).send(); - Evidence evidenceA = Evidence.deploy(web3j, GenCredential.create(aUser), contractGasProvider, voteRepository.getContractAddress(), storageContract.getContractAddress()).send(); - storageContract.allow(evidenceA.getContractAddress()).send(); - voteRepository.allow(evidenceA.getContractAddress()).send(); - //A创建存证请求 - byte[] hash = Numeric.toBytesPadded(BigInteger.TEN, 32); - byte[] ext = Numeric.toBytesPadded(BigInteger.TEN, 1); - evidenceA.createSaveRequest(hash, ext).send(); - //B和C进行审核 - Evidence evidenceB = Evidence.load(evidenceA.getContractAddress(), web3j, GenCredential.create(bUser), contractGasProvider); - Evidence evidenceC = Evidence.load(evidenceA.getContractAddress(), web3j, GenCredential.create(cUser), contractGasProvider); - Object obj = evidenceB.getRequestData(hash).send(); - TransactionReceipt receipt = evidenceB.voteSaveRequest(hash).send(); - - evidenceC.voteSaveRequest(hash).send(); - //A取证 - Object evidence = evidenceA.getEvidence(hash).send(); - int i =0; - - } - -} diff --git a/java/wescott/.gitignore b/java/wescott/.gitignore deleted file mode 100644 index 0facf5e4..00000000 --- a/java/wescott/.gitignore +++ /dev/null @@ -1,28 +0,0 @@ -/target/ -!.mvn/wrapper/maven-wrapper.jar -/bin/ -/.gradle/ - - -### STS ### -.apt_generated -.classpath -.factorypath -.project -.settings -.springBeans -.sts4-cache - -### IntelliJ IDEA ### -.idea -*.iws -*.iml -*.ipr - -### NetBeans ### -/nbproject/private/ -/build/ -/nbbuild/ -/dist/ -/nbdist/ -/.nb-gradle/ diff --git a/java/wescott/HELP.md b/java/wescott/HELP.md deleted file mode 100644 index 9ab160fe..00000000 --- a/java/wescott/HELP.md +++ /dev/null @@ -1,21 +0,0 @@ -# Getting Started - -### Reference Documentation -For further reference, please consider the following sections: - -* [Official Gradle documentation](https://docs.gradle.org) -* [Spring Boot Gradle Plugin Reference Guide](https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/gradle-plugin/reference/html/) -* [Spring Web](https://docs.spring.io/spring-boot/docs/2.2.4.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications) - -### Guides -The following guides illustrate how to use some features concretely: - -* [Building a RESTful Web Service](https://spring.io/guides/gs/rest-service/) -* [Serving Web Content with Spring MVC](https://spring.io/guides/gs/serving-web-content/) -* [Building REST services with Spring](https://spring.io/guides/tutorials/bookmarks/) - -### Additional Links -These additional references should also help you: - -* [Gradle Build Scans – insights for your project's build](https://scans.gradle.com#gradle) - diff --git a/java/wescott/build.gradle b/java/wescott/build.gradle deleted file mode 100644 index dc23b399..00000000 --- a/java/wescott/build.gradle +++ /dev/null @@ -1,40 +0,0 @@ -plugins { - id 'org.springframework.boot' version '2.2.4.RELEASE' - id 'io.spring.dependency-management' version '1.0.9.RELEASE' - id 'java' - id 'eclipse' - id 'idea' -} - -group = 'com.webank' -version = '0.0.1-SNAPSHOT' -sourceCompatibility = '1.8' - -configurations { - compileOnly { - extendsFrom annotationProcessor - } -} - -repositories { - maven { url "http://maven.aliyun.com/nexus/content/groups/public/"} - maven { url "https://oss.sonatype.org/content/repositories/snapshots" } - maven { url "https://dl.bintray.com/ethereum/maven/" } - mavenLocal() - mavenCentral() -} - - -dependencies { - implementation 'org.springframework.boot:spring-boot-starter-web' - compileOnly 'org.projectlombok:lombok' - annotationProcessor 'org.projectlombok:lombok' - testImplementation('org.springframework.boot:spring-boot-starter-test') { - exclude group: 'org.junit.vintage', module: 'junit-vintage-engine' - } - compile ('org.fisco-bcos:web3sdk:2.2.2') -} - -test { - useJUnitPlatform() -} diff --git a/java/wescott/config/user.jks b/java/wescott/config/user.jks deleted file mode 100644 index e69de29b..00000000 diff --git a/java/wescott/gradle/wrapper/gradle-wrapper.properties b/java/wescott/gradle/wrapper/gradle-wrapper.properties deleted file mode 100644 index 94920145..00000000 --- a/java/wescott/gradle/wrapper/gradle-wrapper.properties +++ /dev/null @@ -1,5 +0,0 @@ -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.0.1-bin.zip -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists diff --git a/java/wescott/gradlew b/java/wescott/gradlew deleted file mode 100755 index cccdd3d5..00000000 --- a/java/wescott/gradlew +++ /dev/null @@ -1,172 +0,0 @@ -#!/usr/bin/env sh - -############################################################################## -## -## Gradle start up script for UN*X -## -############################################################################## - -# Attempt to set APP_HOME -# Resolve links: 0ドル may be a link -PRG="0ドル" -# Need this for relative symlinks. -while [ -h "$PRG" ] ; do - ls=`ls -ld "$PRG"` - link=`expr "$ls" : '.*-> \(.*\)$'` - if expr "$link" : '/.*'> /dev/null; then - PRG="$link" - else - PRG=`dirname "$PRG"`"/$link" - fi -done -SAVED="`pwd`" -cd "`dirname \"$PRG\"`/">/dev/null -APP_HOME="`pwd -P`" -cd "$SAVED">/dev/null - -APP_NAME="Gradle" -APP_BASE_NAME=`basename "0ドル"` - -# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -DEFAULT_JVM_OPTS="" - -# Use the maximum available, or set MAX_FD != -1 to use that value. -MAX_FD="maximum" - -warn () { - echo "$*" -} - -die () { - echo - echo "$*" - echo - exit 1 -} - -# OS specific support (must be 'true' or 'false'). -cygwin=false -msys=false -darwin=false -nonstop=false -case "`uname`" in - CYGWIN* ) - cygwin=true - ;; - Darwin* ) - darwin=true - ;; - MINGW* ) - msys=true - ;; - NONSTOP* ) - nonstop=true - ;; -esac - -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar - -# Determine the Java command to use to start the JVM. -if [ -n "$JAVA_HOME" ] ; then - if [ -x "$JAVA_HOME/jre/sh/java" ] ; then - # IBM's JDK on AIX uses strange locations for the executables - JAVACMD="$JAVA_HOME/jre/sh/java" - else - JAVACMD="$JAVA_HOME/bin/java" - fi - if [ ! -x "$JAVACMD" ] ; then - die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." - fi -else - JAVACMD="java" - which java>/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. - -Please set the JAVA_HOME variable in your environment to match the -location of your Java installation." -fi - -# Increase the maximum file descriptors if we can. -if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then - MAX_FD_LIMIT=`ulimit -H -n` - if [ $? -eq 0 ] ; then - if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then - MAX_FD="$MAX_FD_LIMIT" - fi - ulimit -n $MAX_FD - if [ $? -ne 0 ] ; then - warn "Could not set maximum file descriptor limit: $MAX_FD" - fi - else - warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" - fi -fi - -# For Darwin, add options to specify how the application appears in the dock -if $darwin; then - GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" -fi - -# For Cygwin, switch paths to Windows format before running java -if $cygwin ; then - APP_HOME=`cygpath --path --mixed "$APP_HOME"` - CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` - JAVACMD=`cygpath --unix "$JAVACMD"` - - # We build the pattern for arguments to be converted via cygpath - ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` - SEP="" - for dir in $ROOTDIRSRAW ; do - ROOTDIRS="$ROOTDIRS$SEP$dir" - SEP="|" - done - OURCYGPATTERN="(^($ROOTDIRS))" - # Add a user-defined pattern to the cygpath arguments - if [ "$GRADLE_CYGPATTERN" != "" ] ; then - OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" - fi - # Now convert the arguments - kludge to limit ourselves to /bin/sh - i=0 - for arg in "$@" ; do - CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` - CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option - - if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition - eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` - else - eval `echo args$i`="\"$arg\"" - fi - i=$((i+1)) - done - case $i in - (0) set -- ;; - (1) set -- "$args0" ;; - (2) set -- "$args0" "$args1" ;; - (3) set -- "$args0" "$args1" "$args2" ;; - (4) set -- "$args0" "$args1" "$args2" "$args3" ;; - (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; - (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; - (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; - (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; - (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; - esac -fi - -# Escape application args -save () { - for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done - echo " " -} -APP_ARGS=$(save "$@") - -# Collect all arguments for the java command, following the shell quoting and substitution rules -eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" - -# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong -if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then - cd "$(dirname "0ドル")" -fi - -exec "$JAVACMD" "$@" diff --git a/java/wescott/gradlew.bat b/java/wescott/gradlew.bat deleted file mode 100644 index e95643d6..00000000 --- a/java/wescott/gradlew.bat +++ /dev/null @@ -1,84 +0,0 @@ -@if "%DEBUG%" == "" @echo off -@rem ########################################################################## -@rem -@rem Gradle startup script for Windows -@rem -@rem ########################################################################## - -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal - -set DIRNAME=%~dp0 -if "%DIRNAME%" == "" set DIRNAME=. -set APP_BASE_NAME=%~n0 -set APP_HOME=%DIRNAME% - -@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. -set DEFAULT_JVM_OPTS= - -@rem Find java.exe -if defined JAVA_HOME goto findJavaFromJavaHome - -set JAVA_EXE=java.exe -%JAVA_EXE% -version>NUL 2>&1 -if "%ERRORLEVEL%" == "0" goto init - -echo. -echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:findJavaFromJavaHome -set JAVA_HOME=%JAVA_HOME:"=% -set JAVA_EXE=%JAVA_HOME%/bin/java.exe - -if exist "%JAVA_EXE%" goto init - -echo. -echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% -echo. -echo Please set the JAVA_HOME variable in your environment to match the -echo location of your Java installation. - -goto fail - -:init -@rem Get command-line arguments, handling Windows variants - -if not "%OS%" == "Windows_NT" goto win9xME_args - -:win9xME_args -@rem Slurp the command line arguments. -set CMD_LINE_ARGS= -set _SKIP=2 - -:win9xME_args_slurp -if "x%~1" == "x" goto execute - -set CMD_LINE_ARGS=%* - -:execute -@rem Setup the command line - -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar - -@rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% - -:end -@rem End local scope for the variables with windows NT shell -if "%ERRORLEVEL%"=="0" goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 -exit /b 1 - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega diff --git a/java/wescott/settings.gradle b/java/wescott/settings.gradle deleted file mode 100644 index e99046c4..00000000 --- a/java/wescott/settings.gradle +++ /dev/null @@ -1 +0,0 @@ -rootProject.name = 'wescott' diff --git a/java/wescott/src/main/java/com/webank/wescott/WescottApplication.java b/java/wescott/src/main/java/com/webank/wescott/WescottApplication.java deleted file mode 100644 index 4c711e0c..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/WescottApplication.java +++ /dev/null @@ -1,13 +0,0 @@ -package com.webank.wescott; - -import org.springframework.boot.SpringApplication; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -@SpringBootApplication -public class WescottApplication { - - public static void main(String[] args) { - SpringApplication.run(WescottApplication.class, args); - } - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java b/java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java deleted file mode 100644 index 37d88c4f..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/config/SystemEnvironmentConfig.java +++ /dev/null @@ -1,48 +0,0 @@ -/** - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.webank.wescott.config; - -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; - -import lombok.Data; - -/** - * System Environment Config. - * - * @Description: SystemEnvironmentConfig - * @author maojiayu - * @data Dec 28, 2018 5:21:48 PM - * - */ -@Configuration -@ConfigurationProperties("system") -@Data -@Order(2) -public class SystemEnvironmentConfig { - private String orgId; - private String nodeStr; - private int groupId; - - private String configPath; - - private String privateKey; - private int crawlBatchUnit = 1000; - - - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java b/java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java deleted file mode 100644 index 55ef009d..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/config/Web3jV2BeanConfig.java +++ /dev/null @@ -1,145 +0,0 @@ -/** - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.webank.wescott.config; - -import java.io.File; -import java.io.FileInputStream; -import java.io.IOException; -import java.io.InputStream; -import java.security.Key; -import java.security.KeyStore; -import java.security.interfaces.ECPrivateKey; -import java.util.ArrayList; -import java.util.List; - -import org.apache.commons.io.FileUtils; -import org.apache.commons.lang3.StringUtils; -import org.fisco.bcos.channel.client.Service; -import org.fisco.bcos.channel.handler.ChannelConnections; -import org.fisco.bcos.channel.handler.GroupChannelConnectionsConfig; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.crypto.ECKeyPair; -import org.fisco.bcos.web3j.crypto.EncryptType; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.channel.ChannelEthereumService; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.gas.StaticGasProvider; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; - -import com.google.common.collect.Lists; -import com.webank.wescott.constant.GasConstants; - -import lombok.extern.slf4j.Slf4j; - -/** - * Web3jV2BeanConfig - * - * @Description: Web3jV2BeanConfig - * @author maojiayu - * @data Apr 16, 2019 11:13:23 AM - * - */ -@Slf4j -@Configuration -@Order(2) -public class Web3jV2BeanConfig { - - @Autowired - private SystemEnvironmentConfig systemEnvironmentConfig; - - @Bean - public Web3j getWeb3j() throws Exception { - ChannelEthereumService channelEthereumService = new ChannelEthereumService(); - Service service = getService(); - service.run(); - channelEthereumService.setChannelService(service); - // default sync transactions timeout: 30s - channelEthereumService.setTimeout(30000); - return Web3j.build(channelEthereumService, service.getGroupId()); - } - - @Bean - public Service getService() { - GroupChannelConnectionsConfig groupChannelConnectionsConfig = getGroupChannelConnections(); - Service channelService = new Service(); - channelService.setOrgID(systemEnvironmentConfig.getOrgId()); - channelService.setGroupId(systemEnvironmentConfig.getGroupId()); - channelService.setAllChannelConnections(groupChannelConnectionsConfig); - // set some default connect timeout seconds - channelService.setConnectSeconds(60); - channelService.setConnectSleepPerMillis(30); - - return channelService; - } - - @Bean - public GroupChannelConnectionsConfig getGroupChannelConnections() { - GroupChannelConnectionsConfig groupChannelConnectionsConfig = new GroupChannelConnectionsConfig(); - ChannelConnections con = new ChannelConnections(); - PathMatchingResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - Resource ca = resolver.getResource("ca.crt"); - Resource nodeCrt = resolver.getResource("node.crt"); - Resource nodeKey = resolver.getResource("node.key"); - groupChannelConnectionsConfig.setCaCert(ca); - groupChannelConnectionsConfig.setSslCert(nodeCrt); - groupChannelConnectionsConfig.setSslKey(nodeKey); - ArrayList list = new ArrayList(); - List allChannelConnections = new ArrayList(); - String[] nodes = StringUtils.split(systemEnvironmentConfig.getNodeStr(), ";"); - for (int i = 0; i < nodes.length; i++) { - if (nodes[i].contains("@")) { - nodes[i] = StringUtils.substringAfter(nodes[i], "@"); - } - } - List nodesList = Lists.newArrayList(nodes); - list.addAll(nodesList); - list.stream().forEach(s -> { - log.info("connect address: {}", s); - }); - con.setConnectionsStr(list); - con.setGroupId(systemEnvironmentConfig.getGroupId()); - allChannelConnections.add(con); - groupChannelConnectionsConfig.setAllChannelConnections(allChannelConnections); - return groupChannelConnectionsConfig; - } - - @Bean - public EncryptType getEncryptType() { - // 0-RSA 1-Chinese - return new EncryptType(0); - } - - @Bean - public ContractGasProvider getContractGasProvider() { - return new StaticGasProvider(GasConstants.GAS_PRICE, GasConstants.GAS_LIMIT); - } - - public File loadFile(String filePath, String fileName) throws IOException { - File file = new File(filePath); - if (!file.exists()) { - InputStream stream = getClass().getClassLoader().getResourceAsStream(fileName); - FileUtils.copyInputStreamToFile(stream, file); - } - return file; - } - - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java b/java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java deleted file mode 100644 index f707d6e2..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/constant/GasConstants.java +++ /dev/null @@ -1,33 +0,0 @@ -/** - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.webank.wescott.constant; - -import java.math.BigInteger; - -/** - * GasConstants, whose concept was extended from ETH. - * - * @Description: GasConstants - * @author maojiayu - * @data Dec 28, 2018 5:24:03 PM - * - */ -public class GasConstants { - public static final BigInteger GAS_PRICE = new BigInteger("30000000"); - public static final BigInteger GAS_LIMIT = new BigInteger("30000000"); - public static final BigInteger BLOCK_LIMIT = new BigInteger("30000000000"); - public static final BigInteger INITIAL_WEI_VALUE = new BigInteger("0"); -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java b/java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java deleted file mode 100644 index 0dbda133..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/TestSafeMath.java +++ /dev/null @@ -1,152 +0,0 @@ -package com.webank.wescott.contract; - -import java.math.BigInteger; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tuples.generated.Tuple2; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class TestSafeMath extends Contract { - public static String BINARY = "608060405234801561001057600080fd5b5060ee8061001f6000396000f300608060405260043610603f576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff1680637c3ffef2146044575b600080fd5b348015604f57600080fd5b5060766004803603810190808035906020019092919080359060200190929190505050608c565b6040518082815260200191505060405180910390f35b6000609f828460a790919063ffffffff16565b905092915050565b6000818301905082811015151560b957fe5b809050929150505600a165627a7a723058208b522c69a8d7dc7a5c88af6b77a7405619bdde9fa0bfd412fe6ed0a924824d680029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"a\",\"type\":\"uint256\"},{\"name\":\"b\",\"type\":\"uint256\"}],\"name\":\"testAdd\",\"outputs\":[{\"name\":\"c\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_TESTADD = "testAdd"; - - @Deprecated - protected TestSafeMath(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected TestSafeMath(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected TestSafeMath(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected TestSafeMath(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall

testAdd(BigInteger a, BigInteger b) { - final Function function = new Function( - FUNC_TESTADD, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(a), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(b)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void testAdd(BigInteger a, BigInteger b, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_TESTADD, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(a), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(b)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String testAddSeq(BigInteger a, BigInteger b) { - final Function function = new Function( - FUNC_TESTADD, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(a), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(b)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getTestAddInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_TESTADD, - Arrays.asList(), - Arrays.>asList(new TypeReference() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (BigInteger) results.get(0).getValue(), - (BigInteger) results.get(1).getValue() - ); - } - - public Tuple1 getTestAddOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_TESTADD, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (BigInteger) results.get(0).getValue() - ); - } - - @Deprecated - public static TestSafeMath load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new TestSafeMath(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static TestSafeMath load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new TestSafeMath(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static TestSafeMath load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new TestSafeMath(contractAddress, web3j, credentials, contractGasProvider); - } - - public static TestSafeMath load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new TestSafeMath(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(TestSafeMath.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(TestSafeMath.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(TestSafeMath.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(TestSafeMath.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java deleted file mode 100644 index 6a93a0e2..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAclGuard.java +++ /dev/null @@ -1,674 +0,0 @@ -package com.webank.wescott.contract.authority; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; -import org.fisco.bcos.web3j.abi.EventEncoder; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Event; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.abi.datatypes.Utf8String; -import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.Log; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tuples.generated.Tuple2; -import org.fisco.bcos.web3j.tuples.generated.Tuple3; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class WEAclGuard extends Contract { - public static String BINARY = "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506100693361006e640100000000026401000000009004565b61022d565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610158576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b611e8c8061023c6000396000f3006080604052600436106100e6576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100eb5780631cbfa2cd1461012e578063214569b7146101a95780632936ff2b1461020c5780633f81a192146102755780637a9e5e4b146102cc5780639c21e9091461030f578063a2a52fd01461039b578063b2bdfa7b14610456578063b7009613146104ad578063bfc019c614610551578063c2205ee1146105dd578063d12d910214610634578063d9972b961461069d578063de63e70f14610721578063ff929a521461079c575b600080fd5b3480156100f757600080fd5b5061012c600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506107ff565b005b34801561013a57600080fd5b506101a7600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291908035906020019082018035906020019190919293919293905050506109be565b005b3480156101b557600080fd5b5061020a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109eb565b005b34801561021857600080fd5b50610221610a39565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b34801561028157600080fd5b5061028a610a7c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102d857600080fd5b5061030d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610abf565b005b34801561031b57600080fd5b50610399600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610c89565b005b3480156103a757600080fd5b50610402600480360381019080803590602001908201803590602001908080601f0160208091040260200160405190810160405280939291908181526020018383808284378201915050505050509192919290505050610e8e565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b34801561046257600080fd5b5061046b610efa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156104b957600080fd5b50610537600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050610f1f565b604051808215151515815260200191505060405180910390f35b34801561055d57600080fd5b506105db600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050611917565b005b3480156105e957600080fd5b506105f2611b1c565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561064057600080fd5b50610649611b42565b60405180827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200191505060405180910390f35b3480156106a957600080fd5b50610707600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19169060200190929190505050611b6d565b604051808215151515815260200191505060405180910390f35b34801561072d57600080fd5b5061079a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803590602001908201803590602001919091929391929390505050611de5565b005b3480156107a857600080fd5b506107fd600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050611e12565b005b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156108e9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b6109e584848484604051808383808284378201915050925050506040518091039020610c89565b50505050565b610a3582827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c010000000000000000000000000000000000000000000000000000000002611917565b5050565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c01000000000000000000000000000000000000000000000000000000000281565b7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900481565b610aed336000357fffffffff0000000000000000000000000000000000000000000000000000000016611b6d565b1515610b61576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167ff54834e369087f9b17bd2b73baa91085cfff591ffb3c11d2622f6cf92ae4cf6a336000357fffffffff0000000000000000000000000000000000000000000000000000000016604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019250505060405180910390a250565b610cb7336000357fffffffff0000000000000000000000000000000000000000000000000000000016611b6d565b1515610d2b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff021916908315150217905550807bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167ff59111baa782faa3d5c33db8fb4d455d406e73edcf0a852a70caa6c5843eae4c60405160405180910390a4505050565b6000816040518082805190602001908083835b602083101515610ec65780518252602082019150602081019050602083039250610ea1565b6001836020036101000a03801982511681845116808217855250505050505090500191505060405180910390209050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff16806111195750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806112385750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806113965750600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806114b55750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806116135750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b806117715750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b8061190e5750600260007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff6c01000000000000000000000000026c01000000000000000000000000900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060007fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c0100000000000000000000000000000000000000000000000000000000027bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060009054906101000a900460ff165b90509392505050565b611945336000357fffffffff0000000000000000000000000000000000000000000000000000000016611b6d565b15156119b9576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b6001600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000206000837bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff1916815260200190815260200160002060006101000a81548160ff021916908315150217905550807bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19168273ffffffffffffffffffffffffffffffffffffffff168473ffffffffffffffffffffffffffffffffffffffff167fcfe11ceefe6478bea2ebfcd2f48064508489b9f54449e4bc1a2bd2afa359e01b60405160405180910390a4505050565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600080357fffffffff0000000000000000000000000000000000000000000000000000000016905090565b60003073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611bac5760019050611ddf565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff161415611c0a5760019050611ddf565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff161415611c6a5760009050611ddf565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b70096138430856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019350505050602060405180830381600087803b158015611da157600080fd5b505af1158015611db5573d6000803e3d6000fd5b505050506040513d6020811015611dcb57600080fd5b810190808051906020019092919050505090505b92915050565b611e0c84848484604051808383808284378201915050925050506040518091039020611917565b50505050565b611e5c82827fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7c010000000000000000000000000000000000000000000000000000000002610c89565b50505600a165627a7a723058204f6d7a9c985c7f9f6ddf197f689804819c6873b7ebfbb59ecc207af37d71c8b40029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"string\"}],\"name\":\"forbid\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"}],\"name\":\"permitAny\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ANY_SIG\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"ANY_ADDRESS\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"forbid\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"sig\",\"type\":\"string\"}],\"name\":\"getSigFromStr\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"canCall\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"permit\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_authority\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"getSig\",\"outputs\":[{\"name\":\"\",\"type\":\"bytes4\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"isAuthorized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"string\"}],\"name\":\"permit\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"}],\"name\":\"forbidAny\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"src\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"dst\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogPermit\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"src\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"dst\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogForbid\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"authority\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogSetAuthority\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"type\":\"event\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC_FORBID = "forbid"; - - public static final String FUNC_PERMITANY = "permitAny"; - - public static final String FUNC_ANY_SIG = "ANY_SIG"; - - public static final String FUNC_ANY_ADDRESS = "ANY_ADDRESS"; - - public static final String FUNC_SETAUTHORITY = "setAuthority"; - - public static final String FUNC_GETSIGFROMSTR = "getSigFromStr"; - - public static final String FUNC__OWNER = "_owner"; - - public static final String FUNC_CANCALL = "canCall"; - - public static final String FUNC_PERMIT = "permit"; - - public static final String FUNC__AUTHORITY = "_authority"; - - public static final String FUNC_GETSIG = "getSig"; - - public static final String FUNC_ISAUTHORIZED = "isAuthorized"; - - public static final String FUNC_FORBIDANY = "forbidAny"; - - public static final Event LOGPERMIT_EVENT = new Event("LogPermit", - Arrays.>asList(new TypeReference

(true) {}, new TypeReference
(true) {}, new TypeReference(true) {})); - ; - - public static final Event LOGFORBID_EVENT = new Event("LogForbid", - Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference(true) {})); - ; - - public static final Event LOGSETAUTHORITY_EVENT = new Event("LogSetAuthority", - Arrays.>asList(new TypeReference
(true) {}, new TypeReference
() {}, new TypeReference() {})); - ; - - public static final Event LOGSETOWNER_EVENT = new Event("LogSetOwner", - Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference
(true) {})); - ; - - @Deprecated - protected WEAclGuard(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected WEAclGuard(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected WEAclGuard(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected WEAclGuard(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall
setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
forbid(String src, String dst, String sig) { - final Function function = new Function( - FUNC_FORBID, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void forbid(String src, String dst, String sig, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_FORBID, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String forbidSeq(String src, String dst, String sig) { - final Function function = new Function( - FUNC_FORBID, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple3 getForbidAddressAddressStringInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_FORBID, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple3( - - (String) results.get(0).getValue(), - (String) results.get(1).getValue(), - (String) results.get(2).getValue() - ); - } - - public RemoteCall
permitAny(String src, String dst) { - final Function function = new Function( - FUNC_PERMITANY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void permitAny(String src, String dst, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_PERMITANY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String permitAnySeq(String src, String dst) { - final Function function = new Function( - FUNC_PERMITANY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getPermitAnyInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_PERMITANY, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (String) results.get(0).getValue(), - (String) results.get(1).getValue() - ); - } - - public RemoteCall ANY_SIG() { - final Function function = new Function(FUNC_ANY_SIG, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, byte[].class); - } - - public RemoteCall ANY_ADDRESS() { - final Function function = new Function(FUNC_ANY_ADDRESS, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall
setAuthority(String authority) { - final Function function = new Function( - FUNC_SETAUTHORITY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setAuthority(String authority, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETAUTHORITY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setAuthoritySeq(String authority) { - final Function function = new Function( - FUNC_SETAUTHORITY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetAuthorityInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETAUTHORITY, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
forbid(String src, String dst, byte[] sig) { - final Function function = new Function( - FUNC_FORBID, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void forbid(String src, String dst, byte[] sig, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_FORBID, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String forbidSeq(String src, String dst, byte[] sig) { - final Function function = new Function( - FUNC_FORBID, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple3 getForbidAddressAddressBytes4Input(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_FORBID, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple3( - - (String) results.get(0).getValue(), - (String) results.get(1).getValue(), - (byte[]) results.get(2).getValue() - ); - } - - public RemoteCall getSigFromStr(String sig) { - final Function function = new Function(FUNC_GETSIGFROMSTR, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, byte[].class); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall canCall(String src, String dst, byte[] sig) { - final Function function = new Function(FUNC_CANCALL, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall
permit(String src, String dst, byte[] sig) { - final Function function = new Function( - FUNC_PERMIT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void permit(String src, String dst, byte[] sig, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_PERMIT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String permitSeq(String src, String dst, byte[] sig) { - final Function function = new Function( - FUNC_PERMIT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple3 getPermitAddressAddressBytes4Input(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_PERMIT, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple3( - - (String) results.get(0).getValue(), - (String) results.get(1).getValue(), - (byte[]) results.get(2).getValue() - ); - } - - public RemoteCall _authority() { - final Function function = new Function(FUNC__AUTHORITY, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall getSig() { - final Function function = new Function(FUNC_GETSIG, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, byte[].class); - } - - public RemoteCall isAuthorized(String src, byte[] sig) { - final Function function = new Function(FUNC_ISAUTHORIZED, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall
permit(String src, String dst, String sig) { - final Function function = new Function( - FUNC_PERMIT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void permit(String src, String dst, String sig, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_PERMIT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String permitSeq(String src, String dst, String sig) { - final Function function = new Function( - FUNC_PERMIT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.Utf8String(sig)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple3 getPermitAddressAddressStringInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_PERMIT, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple3( - - (String) results.get(0).getValue(), - (String) results.get(1).getValue(), - (String) results.get(2).getValue() - ); - } - - public RemoteCall
forbidAny(String src, String dst) { - final Function function = new Function( - FUNC_FORBIDANY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void forbidAny(String src, String dst, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_FORBIDANY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String forbidAnySeq(String src, String dst) { - final Function function = new Function( - FUNC_FORBIDANY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getForbidAnyInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_FORBIDANY, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (String) results.get(0).getValue(), - (String) results.get(1).getValue() - ); - } - - public List getLogPermitEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGPERMIT_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogPermitEventResponse typedResponse = new LogPermitEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.src = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.dst = (String) eventValues.getIndexedValues().get(1).getValue(); - typedResponse.sig = (byte[]) eventValues.getIndexedValues().get(2).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogPermitEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGPERMIT_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogPermitEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGPERMIT_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getLogForbidEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGFORBID_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogForbidEventResponse typedResponse = new LogForbidEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.src = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.dst = (String) eventValues.getIndexedValues().get(1).getValue(); - typedResponse.sig = (byte[]) eventValues.getIndexedValues().get(2).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogForbidEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGFORBID_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogForbidEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGFORBID_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getLogSetAuthorityEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGSETAUTHORITY_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogSetAuthorityEventResponse typedResponse = new LogSetAuthorityEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.authority = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.from = (String) eventValues.getNonIndexedValues().get(0).getValue(); - typedResponse.sig = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogSetAuthorityEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogSetAuthorityEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getLogSetOwnerEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGSETOWNER_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogSetOwnerEventResponse typedResponse = new LogSetOwnerEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.oldOwner = (String) eventValues.getIndexedValues().get(1).getValue(); - typedResponse.contractAddress = (String) eventValues.getIndexedValues().get(2).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogSetOwnerEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogSetOwnerEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - @Deprecated - public static WEAclGuard load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new WEAclGuard(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static WEAclGuard load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new WEAclGuard(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static WEAclGuard load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new WEAclGuard(contractAddress, web3j, credentials, contractGasProvider); - } - - public static WEAclGuard load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new WEAclGuard(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEAclGuard.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEAclGuard.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEAclGuard.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEAclGuard.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } - - public static class LogPermitEventResponse { - public Log log; - - public String src; - - public String dst; - - public byte[] sig; - } - - public static class LogForbidEventResponse { - public Log log; - - public String src; - - public String dst; - - public byte[] sig; - } - - public static class LogSetAuthorityEventResponse { - public Log log; - - public String authority; - - public String from; - - public byte[] sig; - } - - public static class LogSetOwnerEventResponse { - public Log log; - - public String owner; - - public String oldOwner; - - public String contractAddress; - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java deleted file mode 100644 index 93f7f044..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuth.java +++ /dev/null @@ -1,284 +0,0 @@ -package com.webank.wescott.contract.authority; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; -import org.fisco.bcos.web3j.abi.EventEncoder; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Event; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.Log; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class WEAuth extends Contract { - public static String BINARY = "6080604052336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506108a2806100536000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100725780637a9e5e4b146100b5578063b2bdfa7b146100f8578063c2205ee11461014f578063d9972b96146101a6575b600080fd5b34801561007e57600080fd5b506100b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061022a565b005b3480156100c157600080fd5b506100f6600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506103e9565b005b34801561010457600080fd5b5061010d6105b3565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561015b57600080fd5b506101646105d8565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101b257600080fd5b50610210600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080357bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191690602001909291905050506105fe565b604051808215151515815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610314576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b610417336000357fffffffff00000000000000000000000000000000000000000000000000000000166105fe565b151561048b576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260198152602001807f5745417574683a206973206e6f7420617574686f72697a65640000000000000081525060200191505060405180910390fd5b80600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508073ffffffffffffffffffffffffffffffffffffffff167ff54834e369087f9b17bd2b73baa91085cfff591ffb3c11d2622f6cf92ae4cf6a336000357fffffffff0000000000000000000000000000000000000000000000000000000016604051808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019250505060405180910390a250565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561063d5760019050610870565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168373ffffffffffffffffffffffffffffffffffffffff16141561069b5760019050610870565b600073ffffffffffffffffffffffffffffffffffffffff16600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1614156106fb5760009050610870565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663b70096138430856040518463ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001827bffffffffffffffffffffffffffffffffffffffffffffffffffffffff19167bffffffffffffffffffffffffffffffffffffffffffffffffffffffff191681526020019350505050602060405180830381600087803b15801561083257600080fd5b505af1158015610846573d6000803e3d6000fd5b505050506040513d602081101561085c57600080fd5b810190808051906020019092919050505090505b929150505600a165627a7a723058209dd313d76e2d84bcd2a78c1b6671f351c7865888e11c0b9143d9901b8add919a0029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"authority\",\"type\":\"address\"}],\"name\":\"setAuthority\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_authority\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"isAuthorized\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"authority\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"LogSetAuthority\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"type\":\"event\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC_SETAUTHORITY = "setAuthority"; - - public static final String FUNC__OWNER = "_owner"; - - public static final String FUNC__AUTHORITY = "_authority"; - - public static final String FUNC_ISAUTHORIZED = "isAuthorized"; - - public static final Event LOGSETAUTHORITY_EVENT = new Event("LogSetAuthority", - Arrays.>asList(new TypeReference

(true) {}, new TypeReference
() {}, new TypeReference() {})); - ; - - public static final Event LOGSETOWNER_EVENT = new Event("LogSetOwner", - Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference
(true) {})); - ; - - @Deprecated - protected WEAuth(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected WEAuth(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected WEAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected WEAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall
setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
setAuthority(String authority) { - final Function function = new Function( - FUNC_SETAUTHORITY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setAuthority(String authority, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETAUTHORITY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setAuthoritySeq(String authority) { - final Function function = new Function( - FUNC_SETAUTHORITY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(authority)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetAuthorityInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETAUTHORITY, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall _authority() { - final Function function = new Function(FUNC__AUTHORITY, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall isAuthorized(String src, byte[] sig) { - final Function function = new Function(FUNC_ISAUTHORIZED, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public List getLogSetAuthorityEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGSETAUTHORITY_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogSetAuthorityEventResponse typedResponse = new LogSetAuthorityEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.authority = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.from = (String) eventValues.getNonIndexedValues().get(0).getValue(); - typedResponse.sig = (byte[]) eventValues.getNonIndexedValues().get(1).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogSetAuthorityEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogSetAuthorityEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETAUTHORITY_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getLogSetOwnerEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGSETOWNER_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogSetOwnerEventResponse typedResponse = new LogSetOwnerEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.oldOwner = (String) eventValues.getIndexedValues().get(1).getValue(); - typedResponse.contractAddress = (String) eventValues.getIndexedValues().get(2).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogSetOwnerEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogSetOwnerEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - @Deprecated - public static WEAuth load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new WEAuth(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static WEAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new WEAuth(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static WEAuth load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new WEAuth(contractAddress, web3j, credentials, contractGasProvider); - } - - public static WEAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new WEAuth(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEAuth.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEAuth.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEAuth.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEAuth.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } - - public static class LogSetAuthorityEventResponse { - public Log log; - - public String authority; - - public String from; - - public byte[] sig; - } - - public static class LogSetOwnerEventResponse { - public Log log; - - public String owner; - - public String oldOwner; - - public String contractAddress; - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java deleted file mode 100644 index 09a35d1d..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEAuthority.java +++ /dev/null @@ -1,102 +0,0 @@ -package com.webank.wescott.contract.authority; - -import java.math.BigInteger; -import java.util.Arrays; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class WEAuthority extends Contract { - public static String BINARY = ""; - - public static final String ABI = "[{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"},{\"name\":\"dst\",\"type\":\"address\"},{\"name\":\"sig\",\"type\":\"bytes4\"}],\"name\":\"canCall\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_CANCALL = "canCall"; - - @Deprecated - protected WEAuthority(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected WEAuthority(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected WEAuthority(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected WEAuthority(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall canCall(String src, String dst, byte[] sig) { - final Function function = new Function(FUNC_CANCALL, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src), - new org.fisco.bcos.web3j.abi.datatypes.Address(dst), - new org.fisco.bcos.web3j.abi.datatypes.generated.Bytes4(sig)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - @Deprecated - public static WEAuthority load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new WEAuthority(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static WEAuthority load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new WEAuthority(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static WEAuthority load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new WEAuthority(contractAddress, web3j, credentials, contractGasProvider); - } - - public static WEAuthority load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new WEAuthority(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEAuthority.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEAuthority.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEAuthority.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEAuthority.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java b/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java deleted file mode 100644 index 97798d67..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/authority/WEBasicAuth.java +++ /dev/null @@ -1,187 +0,0 @@ -package com.webank.wescott.contract.authority; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; -import org.fisco.bcos.web3j.abi.EventEncoder; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Event; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.Log; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class WEBasicAuth extends Contract { - public static String BINARY = "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506102fb806100606000396000f30060806040526004361061004c576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af403514610051578063b2bdfa7b14610094575b600080fd5b34801561005d57600080fd5b50610092600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506100eb565b005b3480156100a057600080fd5b506100a96102aa565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156101d5576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260268152602001807f57454261736963417574683a206f6e6c79206f776e657220697320617574686f81526020017f72697a65642e000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055503073ffffffffffffffffffffffffffffffffffffffff166000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff167fe9babf7227595470b3626ae5ccf58b60155b302e762cffc79c52bfd8a800c53c60405160405180910390a450565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff16815600a165627a7a72305820d7c120dfe3cdd08ac066bb0f23c6fd66925584dbc66656aa36a3e2533fa0906a0029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"owner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"oldOwner\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"contractAddress\",\"type\":\"address\"}],\"name\":\"LogSetOwner\",\"type\":\"event\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC__OWNER = "_owner"; - - public static final Event LOGSETOWNER_EVENT = new Event("LogSetOwner", - Arrays.>asList(new TypeReference

(true) {}, new TypeReference
(true) {}, new TypeReference
(true) {})); - ; - - @Deprecated - protected WEBasicAuth(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected WEBasicAuth(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected WEBasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected WEBasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall
setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public List getLogSetOwnerEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGSETOWNER_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogSetOwnerEventResponse typedResponse = new LogSetOwnerEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.owner = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.oldOwner = (String) eventValues.getIndexedValues().get(1).getValue(); - typedResponse.contractAddress = (String) eventValues.getIndexedValues().get(2).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogSetOwnerEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogSetOwnerEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSETOWNER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - @Deprecated - public static WEBasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new WEBasicAuth(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static WEBasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new WEBasicAuth(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static WEBasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new WEBasicAuth(contractAddress, web3j, credentials, contractGasProvider); - } - - public static WEBasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new WEBasicAuth(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEBasicAuth.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(WEBasicAuth.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEBasicAuth.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(WEBasicAuth.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } - - public static class LogSetOwnerEventResponse { - public Log log; - - public String owner; - - public String oldOwner; - - public String contractAddress; - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java deleted file mode 100644 index b0281b0f..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/point/Admin.java +++ /dev/null @@ -1,172 +0,0 @@ -package com.webank.wescott.contract.point; - -import java.math.BigInteger; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class Admin extends Contract { - public static String BINARY = "608060405234801561001057600080fd5b50600080336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555061005c61041d565b80806020018281038252600b8152602001807f506f696e74206f66205631000000000000000000000000000000000000000000815250602001915050604051809103906000f0801580156100b4573d6000803e3d6000fd5b50915081600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1661012361042d565b808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050604051809103906000f080158015610175573d6000803e3d6000fd5b50905080600260006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055508173ffffffffffffffffffffffffffffffffffffffff1663d28eb963600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561027657600080fd5b505af115801561028a573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff166320694db0336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561032957600080fd5b505af115801561033d573d6000803e3d6000fd5b505050508173ffffffffffffffffffffffffffffffffffffffff166320694db0600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff166040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b1580156103fe57600080fd5b505af1158015610412573d6000803e3d6000fd5b50505050505061043d565b60405161148a8061086583390190565b604051612d0f80611cef83390190565b6104198061044c6000396000f30060806040526004361061006d576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af40351461007257806361db384e146100b5578063632cd8b21461010c578063b2bdfa7b14610163578063cd5d2118146101ba575b600080fd5b34801561007e57600080fd5b506100b3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610215565b005b3480156100c157600080fd5b506100ca6102d5565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561011857600080fd5b506101216102fb565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561016f57600080fd5b50610178610321565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156101c657600080fd5b506101fb600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610346565b604051808215151515815260200191505060405180910390f35b61021e33610346565b1515610292576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b600260009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561038557600190506103e8565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156103e357600190506103e8565b600090505b9190505600a165627a7a7230582015d4c3732f6f507d0dc500f95280e860e84adc762858c285c77a21e3f41b78e4002960806040523480156200001157600080fd5b506040516200148a3803806200148a83398101806040528101908080518201929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200009a336001620000ba6401000000000262000dd0179091906401000000009004565b8060059080519060200190620000b2929190620002cd565b50506200037c565b620000d58282620001a9640100000000026401000000009004565b1515156200014b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151562000276576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031057805160ff191683800117855562000341565b8280016001018555821562000341579182015b828111156200034057825182559160200191906001019062000323565b5b50905062000350919062000354565b5090565b6200037991905b80821115620003755760008160009055506001016200035b565b5090565b90565b6110fe806200038c6000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100e057806320694db0146101235780633bbeaab51461016657806360df8a1f146101915780637b510fe8146101d6578063877b9a6714610238578063b2bdfa7b14610293578063c510a9a8146102ea578063c8e40fbf1461032d578063cd5d211814610388578063cfa84dfe146103e3578063d28eb96314610473578063e30443bc146104b6578063e5c96aa41461051b578063f8b2cb4f14610582575b600080fd5b3480156100ec57600080fd5b50610121600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105d9565b005b34801561012f57600080fd5b50610164600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b005b34801561017257600080fd5b5061017b610796565b6040518082815260200191505060405180910390f35b34801561019d57600080fd5b506101bc6004803603810190808035906020019092919050505061079c565b604051808215151515815260200191505060405180910390f35b3480156101e257600080fd5b50610217600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061080a565b60405180831515151581526020018281526020019250505060405180910390f35b34801561024457600080fd5b50610279600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a3565b604051808215151515815260200191505060405180910390f35b34801561029f57600080fd5b506102a86108c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e5565b005b34801561033957600080fd5b5061036e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109e2565b604051808215151515815260200191505060405180910390f35b34801561039457600080fd5b506103c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a38565b604051808215151515815260200191505060405180910390f35b3480156103ef57600080fd5b506103f8610adf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7d565b005b3480156104c257600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1c565b604051808215151515815260200191505060405180910390f35b34801561052757600080fd5b50610568600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610cc8565b604051808215151515815260200191505060405180910390f35b34801561058e57600080fd5b506105c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d87565b6040518082815260200191505060405180910390f35b6105e233610a38565b1515610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106a2336108a3565b151561073c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b610750816001610dd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c260405160405180910390a250565b60045481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107fa57600080fd5b8160048190555060019050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b60006108b9826001610ead90919063ffffffff16565b9050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108ee336108a3565b1515610988576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b61099c816001610fd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5260405160405180910390a250565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a775760019050610ada565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ad55760019050610ada565b600090505b919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b755780601f10610b4a57610100808354040283529160200191610b75565b820191906000526020600020905b815481529060010190602001808311610b5857829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bd857600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7a57600080fd5b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d2657600080fd5b81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dda8282610ead565b151515610e4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610fda8282610ead565b1515611074576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c81526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a723058204eb54c60ac1182a7b2e92c819f0f5cbc428e055d397fb5a3a18f4e9c0c58853a0029608060405234801561001057600080fd5b50604051602080612d0f83398101806040528101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050612c4b806100c46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100ca5780631aa3a0081461010d57806320694db014610164578063867904b4146101bf578063877b9a6714610224578063938050e11461027f5780639d118770146102ae578063a9059cbb146102f3578063b2bdfa7b14610366578063c3c5a547146103bd578063cd5d211814610418578063e3d670d714610473578063e79a198f146104ca575b600080fd5b3480156100d657600080fd5b5061010b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610521565b005b34801561011957600080fd5b506101226105e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561017057600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c6565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b5061020a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c38565b604051808215151515815260200191505060405180910390f35b34801561023057600080fd5b50610265600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113a4565b604051808215151515815260200191505060405180910390f35b34801561028b57600080fd5b506102946114a5565b604051808215151515815260200191505060405180910390f35b3480156102ba57600080fd5b506102d960048036038101908080359060200190929190505050611583565b604051808215151515815260200191505060405180910390f35b3480156102ff57600080fd5b5061033e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b5c565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b34801561037257600080fd5b5061037b612457565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103c957600080fd5b506103fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061247c565b604051808215151515815260200191505060405180910390f35b34801561042457600080fd5b50610459600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061257d565b604051808215151515815260200191505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612624565b6040518082815260200191505060405180910390f35b3480156104d657600080fd5b506104df612725565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052a3361257d565b151561059e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003360001515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106a557600080fd5b505af11580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b81019080805190602001909291905050501515141515610757576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4163636f756e7420616c7265616479206578697374656421000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b15801561082157600080fd5b505af1158015610835573d6000803e3d6000fd5b505050506040513d602081101561084b57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc3360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092357600080fd5b505af1158015610937573d6000803e3d6000fd5b505050506040513d602081101561094d57600080fd5b8101908080519060200190929190505050507f68f0f1b8c9e91743a8bf9b77af08d152d1cb9ac31eb5b472bf6e16467254885533604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8557600080fd5b505af1158015610a99573d6000803e3d6000fd5b505050506040513d6020811015610aaf57600080fd5b81019080805190602001909291905050501515610b5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320694db0836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610c1757600080fd5b505af1158015610c2b573d6000803e3d6000fd5b5050505060019050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050506040513d6020811015610d2457600080fd5b81019080805190602001909291905050501515610dcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b8460011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050506040513d6020811015610ebb57600080fd5b81019080805190602001909291905050501515148015610f085750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515610f7c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561100257600080fd5b505af1158015611016573d6000803e3d6000fd5b505050506040513d602081101561102c57600080fd5b810190808051906020019092919050505092506110528584612b0b90919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156110e557600080fd5b505af11580156110f9573d6000803e3d6000fd5b505050506040513d602081101561110f57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156111de57600080fd5b505af11580156111f2573d6000803e3d6000fd5b505050506040513d602081101561120857600080fd5b8101908080519060200190929190505050915061122e8583612b0b90919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc87846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b505050506040513d602081101561131f57600080fd5b8101908080519060200190929190505050508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a36001935050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561146357600080fd5b505af1158015611477573d6000803e3d6000fd5b505050506040513d602081101561148d57600080fd5b81019080805190602001909291905050509050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c510a9a8336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561156457600080fd5b505af1158015611578573d6000803e3d6000fd5b505050506001905090565b60008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561164a57600080fd5b505af115801561165e573d6000803e3d6000fd5b505050506040513d602081101561167457600080fd5b810190808051906020019092919050505015151480156116c15750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611735576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156117bb57600080fd5b505af11580156117cf573d6000803e3d6000fd5b505050506040513d60208110156117e557600080fd5b8101908080519060200190929190505050925061180b8584612b9590919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b505050506040513d60208110156118c857600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561199757600080fd5b505af11580156119ab573d6000803e3d6000fd5b505050506040513d60208110156119c157600080fd5b810190808051906020019092919050505091506119e78583612b9590919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611aae57600080fd5b505af1158015611ac2573d6000803e3d6000fd5b505050506040513d6020811015611ad857600080fd5b810190808051906020019092919050505050600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a360019350505050919050565b60008060008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611c2657600080fd5b505af1158015611c3a573d6000803e3d6000fd5b505050506040513d6020811015611c5057600080fd5b81019080805190602001909291905050501515148015611c9d5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611d11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b8760011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611dd357600080fd5b505af1158015611de7573d6000803e3d6000fd5b505050506040513d6020811015611dfd57600080fd5b81019080805190602001909291905050501515148015611e4a5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611ebe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b888073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611f285750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611fc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f43616e2774207472616e7366657220746f20696c6c6567616c2061646472657381526020017f732100000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561207f57600080fd5b505af1158015612093573d6000803e3d6000fd5b505050506040513d60208110156120a957600080fd5b810190808051906020019092919050505094506120cf8986612b9590919063ffffffff16565b9650600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33896040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050506040513d60208110156121c057600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f8b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561228f57600080fd5b505af11580156122a3573d6000803e3d6000fd5b505050506040513d60208110156122b957600080fd5b810190808051906020019092919050505093506122df8985612b0b90919063ffffffff16565b9550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc8b886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b505050506040513d60208110156123d057600080fd5b8101908080519060200190929190505050508973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e358b6040518082815260200191505060405180910390a36001975050505050509250925092565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561253b57600080fd5b505af115801561254f573d6000803e3d6000fd5b505050506040513d602081101561256557600080fd5b81019080805190602001909291905050509050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125bc576001905061261f565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561261a576001905061261f565b600090505b919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156126e357600080fd5b505af11580156126f7573d6000803e3d6000fd5b505050506040513d602081101561270d57600080fd5b81019080805190602001909291905050509050919050565b60003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156127e957600080fd5b505af11580156127fd573d6000803e3d6000fd5b505050506040513d602081101561281357600080fd5b8101908080519060200190929190505050151514801561292a57506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b505050506040513d602081101561291757600080fd5b8101908080519060200190929190505050145b151561299e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43616e6e277420756e726567697374657221000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b158015612a6857600080fd5b505af1158015612a7c573d6000803e3d6000fd5b505050506040513d6020811015612a9257600080fd5b8101908080519060200190929190505050507f11854d1b3c0aa24c7c879af700c0089a48a48e9280bac11f5370b90b7cca481c33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000808284019050838110151515612b8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080838311151515612c10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b828403905080915050929150505600a165627a7a72305820cfedf668db5d3b6056013c182be0cada689b19a2ec06587b5d8073e895b335170029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_controllerAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_dataAddress\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC__CONTROLLERADDRESS = "_controllerAddress"; - - public static final String FUNC__DATAADDRESS = "_dataAddress"; - - public static final String FUNC__OWNER = "_owner"; - - public static final String FUNC_AUTH = "auth"; - - @Deprecated - protected Admin(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected Admin(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected Admin(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected Admin(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall

setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall _controllerAddress() { - final Function function = new Function(FUNC__CONTROLLERADDRESS, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall _dataAddress() { - final Function function = new Function(FUNC__DATAADDRESS, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall auth(String src) { - final Function function = new Function(FUNC_AUTH, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - @Deprecated - public static Admin load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new Admin(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static Admin load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new Admin(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static Admin load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new Admin(contractAddress, web3j, credentials, contractGasProvider); - } - - public static Admin load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new Admin(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(Admin.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(Admin.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(Admin.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(Admin.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java deleted file mode 100644 index 2b60b112..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/point/BasicAuth.java +++ /dev/null @@ -1,154 +0,0 @@ -package com.webank.wescott.contract.point; - -import java.math.BigInteger; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class BasicAuth extends Contract { - public static String BINARY = "608060405234801561001057600080fd5b50336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff160217905550610309806100606000396000f300608060405260043610610057576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af40351461005c578063b2bdfa7b1461009f578063cd5d2118146100f6575b600080fd5b34801561006857600080fd5b5061009d600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610151565b005b3480156100ab57600080fd5b506100b4610211565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561010257600080fd5b50610137600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610236565b604051808215151515815260200191505060405180910390f35b61015a33610236565b15156101ce576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561027557600190506102d8565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156102d357600190506102d8565b600090505b9190505600a165627a7a72305820b9aa5ba47e9edcb2f8998a6159d577e67d13ffa4be0dd9a833e4aec08a80776b0029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC__OWNER = "_owner"; - - public static final String FUNC_AUTH = "auth"; - - @Deprecated - protected BasicAuth(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected BasicAuth(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected BasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected BasicAuth(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall

setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall auth(String src) { - final Function function = new Function(FUNC_AUTH, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - @Deprecated - public static BasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new BasicAuth(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static BasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new BasicAuth(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static BasicAuth load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new BasicAuth(contractAddress, web3j, credentials, contractGasProvider); - } - - public static BasicAuth load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new BasicAuth(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(BasicAuth.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(BasicAuth.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(BasicAuth.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(BasicAuth.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java deleted file mode 100644 index b8f88857..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/point/IssuerRole.java +++ /dev/null @@ -1,252 +0,0 @@ -package com.webank.wescott.contract.point; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; -import org.fisco.bcos.web3j.abi.EventEncoder; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Event; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.Log; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class IssuerRole extends Contract { - public static String BINARY = ""; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"addIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerRemoved\",\"type\":\"event\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_ADDISSUER = "addIssuer"; - - public static final String FUNC_ISISSUER = "isIssuer"; - - public static final String FUNC_RENOUNCEISSUER = "renounceIssuer"; - - public static final Event ISSUERADDED_EVENT = new Event("IssuerAdded", - Arrays.>asList(new TypeReference

(true) {})); - ; - - public static final Event ISSUERREMOVED_EVENT = new Event("IssuerRemoved", - Arrays.>asList(new TypeReference
(true) {})); - ; - - @Deprecated - protected IssuerRole(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected IssuerRole(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected IssuerRole(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected IssuerRole(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall
addIssuer(String account) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void addIssuer(String account, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String addIssuerSeq(String account) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getAddIssuerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_ADDISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall isIssuer(String account) { - final Function function = new Function(FUNC_ISISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall
renounceIssuer(String account) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void renounceIssuer(String account, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String renounceIssuerSeq(String account) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getRenounceIssuerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_RENOUNCEISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public List getIssuerAddedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(ISSUERADDED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - IssuerAddedEventResponse typedResponse = new IssuerAddedEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerIssuerAddedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerIssuerAddedEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getIssuerRemovedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(ISSUERREMOVED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - IssuerRemovedEventResponse typedResponse = new IssuerRemovedEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerIssuerRemovedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerIssuerRemovedEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - @Deprecated - public static IssuerRole load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new IssuerRole(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static IssuerRole load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new IssuerRole(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static IssuerRole load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new IssuerRole(contractAddress, web3j, credentials, contractGasProvider); - } - - public static IssuerRole load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new IssuerRole(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return deployRemoteCall(IssuerRole.class, web3j, credentials, contractGasProvider, BINARY, ""); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(IssuerRole.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(IssuerRole.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return deployRemoteCall(IssuerRole.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); - } - - public static class IssuerAddedEventResponse { - public Log log; - - public String account; - } - - public static class IssuerRemovedEventResponse { - public Log log; - - public String account; - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java deleted file mode 100644 index e92332a5..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointController.java +++ /dev/null @@ -1,620 +0,0 @@ -package com.webank.wescott.contract.point; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; -import org.fisco.bcos.web3j.abi.EventEncoder; -import org.fisco.bcos.web3j.abi.FunctionEncoder; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Event; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.Log; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tuples.generated.Tuple2; -import org.fisco.bcos.web3j.tuples.generated.Tuple3; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class RewardPointController extends Contract { - public static String BINARY = "608060405234801561001057600080fd5b50604051602080612d0f83398101806040528101908080519060200190929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555080600160006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050612c4b806100c46000396000f3006080604052600436106100c5576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100ca5780631aa3a0081461010d57806320694db014610164578063867904b4146101bf578063877b9a6714610224578063938050e11461027f5780639d118770146102ae578063a9059cbb146102f3578063b2bdfa7b14610366578063c3c5a547146103bd578063cd5d211814610418578063e3d670d714610473578063e79a198f146104ca575b600080fd5b3480156100d657600080fd5b5061010b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610521565b005b34801561011957600080fd5b506101226105e1565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b34801561017057600080fd5b506101a5600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109c6565b604051808215151515815260200191505060405180910390f35b3480156101cb57600080fd5b5061020a600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c38565b604051808215151515815260200191505060405180910390f35b34801561023057600080fd5b50610265600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506113a4565b604051808215151515815260200191505060405180910390f35b34801561028b57600080fd5b506102946114a5565b604051808215151515815260200191505060405180910390f35b3480156102ba57600080fd5b506102d960048036038101908080359060200190929190505050611583565b604051808215151515815260200191505060405180910390f35b3480156102ff57600080fd5b5061033e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050611b5c565b6040518084151515158152602001838152602001828152602001935050505060405180910390f35b34801561037257600080fd5b5061037b612457565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156103c957600080fd5b506103fe600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061247c565b604051808215151515815260200191505060405180910390f35b34801561042457600080fd5b50610459600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061257d565b604051808215151515815260200191505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050612624565b6040518082815260200191505060405180910390f35b3480156104d657600080fd5b506104df612725565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b61052a3361257d565b151561059e576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b60003360001515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156106a557600080fd5b505af11580156106b9573d6000803e3d6000fd5b505050506040513d60208110156106cf57600080fd5b81019080805190602001909291905050501515141515610757576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260188152602001807f4163636f756e7420616c7265616479206578697374656421000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360016040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b15801561082157600080fd5b505af1158015610835573d6000803e3d6000fd5b505050506040513d602081101561084b57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc3360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561092357600080fd5b505af1158015610937573d6000803e3d6000fd5b505050506040513d602081101561094d57600080fd5b8101908080519060200190929190505050507f68f0f1b8c9e91743a8bf9b77af08d152d1cb9ac31eb5b472bf6e16467254885533604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610a8557600080fd5b505af1158015610a99573d6000803e3d6000fd5b505050506040513d6020811015610aaf57600080fd5b81019080805190602001909291905050501515610b5a576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166320694db0836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b158015610c1757600080fd5b505af1158015610c2b573d6000803e3d6000fd5b5050505060019050919050565b6000806000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610cfa57600080fd5b505af1158015610d0e573d6000803e3d6000fd5b505050506040513d6020811015610d2457600080fd5b81019080805190602001909291905050501515610dcf576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b8460011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015610e9157600080fd5b505af1158015610ea5573d6000803e3d6000fd5b505050506040513d6020811015610ebb57600080fd5b81019080805190602001909291905050501515148015610f085750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515610f7c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b15801561100257600080fd5b505af1158015611016573d6000803e3d6000fd5b505050506040513d602081101561102c57600080fd5b810190808051906020019092919050505092506110528584612b0b90919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b1580156110e557600080fd5b505af11580156110f9573d6000803e3d6000fd5b505050506040513d602081101561110f57600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f876040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156111de57600080fd5b505af11580156111f2573d6000803e3d6000fd5b505050506040513d602081101561120857600080fd5b8101908080519060200190929190505050915061122e8583612b0b90919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc87846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156112f557600080fd5b505af1158015611309573d6000803e3d6000fd5b505050506040513d602081101561131f57600080fd5b8101908080519060200190929190505050508573ffffffffffffffffffffffffffffffffffffffff16600073ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a36001935050505092915050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663877b9a67836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561146357600080fd5b505af1158015611477573d6000803e3d6000fd5b505050506040513d602081101561148d57600080fd5b81019080805190602001909291905050509050919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c510a9a8336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050600060405180830381600087803b15801561156457600080fd5b505af1158015611578573d6000803e3d6000fd5b505050506001905090565b60008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561164a57600080fd5b505af115801561165e573d6000803e3d6000fd5b505050506040513d602081101561167457600080fd5b810190808051906020019092919050505015151480156116c15750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611735576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16633bbeaab56040518163ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401602060405180830381600087803b1580156117bb57600080fd5b505af11580156117cf573d6000803e3d6000fd5b505050506040513d60208110156117e557600080fd5b8101908080519060200190929190505050925061180b8584612b9590919063ffffffff16565b9250600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff166360df8a1f846040518263ffffffff167c010000000000000000000000000000000000000000000000000000000002815260040180828152602001915050602060405180830381600087803b15801561189e57600080fd5b505af11580156118b2573d6000803e3d6000fd5b505050506040513d60208110156118c857600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561199757600080fd5b505af11580156119ab573d6000803e3d6000fd5b505050506040513d60208110156119c157600080fd5b810190808051906020019092919050505091506119e78583612b9590919063ffffffff16565b9150600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33846040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b158015611aae57600080fd5b505af1158015611ac2573d6000803e3d6000fd5b505050506040513d6020811015611ad857600080fd5b810190808051906020019092919050505050600073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e35876040518082815260200191505060405180910390a360019350505050919050565b60008060008060003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611c2657600080fd5b505af1158015611c3a573d6000803e3d6000fd5b505050506040513d6020811015611c5057600080fd5b81019080805190602001909291905050501515148015611c9d5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611d11576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b8760011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b158015611dd357600080fd5b505af1158015611de7573d6000803e3d6000fd5b505050506040513d6020811015611dfd57600080fd5b81019080805190602001909291905050501515148015611e4a5750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611ebe576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260158152602001807f4f6e6c792065786973746564206163636f756e7421000000000000000000000081525060200191505060405180910390fd5b888073ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff1614158015611f285750600073ffffffffffffffffffffffffffffffffffffffff168173ffffffffffffffffffffffffffffffffffffffff1614155b1515611fc2576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f43616e2774207472616e7366657220746f20696c6c6567616c2061646472657381526020017f732100000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f336040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561207f57600080fd5b505af1158015612093573d6000803e3d6000fd5b505050506040513d60208110156120a957600080fd5b810190808051906020019092919050505094506120cf8986612b9590919063ffffffff16565b9650600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc33896040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b15801561219657600080fd5b505af11580156121aa573d6000803e3d6000fd5b505050506040513d60208110156121c057600080fd5b810190808051906020019092919050505050600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f8b6040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561228f57600080fd5b505af11580156122a3573d6000803e3d6000fd5b505050506040513d60208110156122b957600080fd5b810190808051906020019092919050505093506122df8985612b0b90919063ffffffff16565b9550600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e30443bc8b886040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200182815260200192505050602060405180830381600087803b1580156123a657600080fd5b505af11580156123ba573d6000803e3d6000fd5b505050506040513d60208110156123d057600080fd5b8101908080519060200190929190505050508973ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff167fa343f361112b028dae2501770614271723be1d24c9f64fed2d4bd3ddf1c13e358b6040518082815260200191505060405180910390a36001975050505050509250925092565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b15801561253b57600080fd5b505af115801561254f573d6000803e3d6000fd5b505050506040513d602081101561256557600080fd5b81019080805190602001909291905050509050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614156125bc576001905061261f565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff16141561261a576001905061261f565b600090505b919050565b6000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156126e357600080fd5b505af11580156126f7573d6000803e3d6000fd5b505050506040513d602081101561270d57600080fd5b81019080805190602001909291905050509050919050565b60003360011515600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663c8e40fbf836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156127e957600080fd5b505af11580156127fd573d6000803e3d6000fd5b505050506040513d602081101561281357600080fd5b8101908080519060200190929190505050151514801561292a57506000600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663f8b2cb4f836040518263ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001915050602060405180830381600087803b1580156128ed57600080fd5b505af1158015612901573d6000803e3d6000fd5b505050506040513d602081101561291757600080fd5b8101908080519060200190929190505050145b151561299e576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260128152602001807f43616e6e277420756e726567697374657221000000000000000000000000000081525060200191505060405180910390fd5b600160009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1663e5c96aa43360006040518363ffffffff167c0100000000000000000000000000000000000000000000000000000000028152600401808373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020018215151515815260200192505050602060405180830381600087803b158015612a6857600080fd5b505af1158015612a7c573d6000803e3d6000fd5b505050506040513d6020811015612a9257600080fd5b8101908080519060200190929190505050507f11854d1b3c0aa24c7c879af700c0089a48a48e9280bac11f5370b90b7cca481c33604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390a15090565b6000808284019050838110151515612b8b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601b8152602001807f536166654d6174683a206164646974696f6e206f766572666c6f77000000000081525060200191505060405180910390fd5b8091505092915050565b600080838311151515612c10576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601e8152602001807f536166654d6174683a207375627472616374696f6e206f766572666c6f77000081525060200191505060405180910390fd5b828403905080915050929150505600a165627a7a72305820cfedf668db5d3b6056013c182be0cada689b19a2ec06587b5d8073e895b335170029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"register\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"addIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"issue\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"renounceIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"destroy\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"toAddress\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"transfer\",\"outputs\":[{\"name\":\"b\",\"type\":\"bool\"},{\"name\":\"balanceOfFrom\",\"type\":\"uint256\"},{\"name\":\"balanceOfTo\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"isRegistered\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"addr\",\"type\":\"address\"}],\"name\":\"balance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[],\"name\":\"unregister\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"dataAddress\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"LogRegister\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":false,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"LogUnregister\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"from\",\"type\":\"address\"},{\"indexed\":true,\"name\":\"to\",\"type\":\"address\"},{\"indexed\":false,\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"LogSend\",\"type\":\"event\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC_REGISTER = "register"; - - public static final String FUNC_ADDISSUER = "addIssuer"; - - public static final String FUNC_ISSUE = "issue"; - - public static final String FUNC_ISISSUER = "isIssuer"; - - public static final String FUNC_RENOUNCEISSUER = "renounceIssuer"; - - public static final String FUNC_DESTROY = "destroy"; - - public static final String FUNC_TRANSFER = "transfer"; - - public static final String FUNC__OWNER = "_owner"; - - public static final String FUNC_ISREGISTERED = "isRegistered"; - - public static final String FUNC_AUTH = "auth"; - - public static final String FUNC_BALANCE = "balance"; - - public static final String FUNC_UNREGISTER = "unregister"; - - public static final Event LOGREGISTER_EVENT = new Event("LogRegister", - Arrays.>asList(new TypeReference

() {})); - ; - - public static final Event LOGUNREGISTER_EVENT = new Event("LogUnregister", - Arrays.>asList(new TypeReference
() {})); - ; - - public static final Event LOGSEND_EVENT = new Event("LogSend", - Arrays.>asList(new TypeReference
(true) {}, new TypeReference
(true) {}, new TypeReference() {})); - ; - - @Deprecated - protected RewardPointController(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected RewardPointController(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected RewardPointController(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected RewardPointController(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall
setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
register() { - final Function function = new Function( - FUNC_REGISTER, - Arrays.asList(), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void register(TransactionSucCallback callback) { - final Function function = new Function( - FUNC_REGISTER, - Arrays.asList(), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String registerSeq() { - final Function function = new Function( - FUNC_REGISTER, - Arrays.asList(), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getRegisterOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_REGISTER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
addIssuer(String account) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void addIssuer(String account, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String addIssuerSeq(String account) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getAddIssuerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_ADDISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public Tuple1 getAddIssuerOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_ADDISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall
issue(String account, BigInteger value) { - final Function function = new Function( - FUNC_ISSUE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void issue(String account, BigInteger value, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_ISSUE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String issueSeq(String account, BigInteger value) { - final Function function = new Function( - FUNC_ISSUE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getIssueInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_ISSUE, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (String) results.get(0).getValue(), - (BigInteger) results.get(1).getValue() - ); - } - - public Tuple1 getIssueOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_ISSUE, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall isIssuer(String account) { - final Function function = new Function(FUNC_ISISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall
renounceIssuer() { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void renounceIssuer(TransactionSucCallback callback) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String renounceIssuerSeq() { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getRenounceIssuerOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_RENOUNCEISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall
destroy(BigInteger value) { - final Function function = new Function( - FUNC_DESTROY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void destroy(BigInteger value, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_DESTROY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String destroySeq(BigInteger value) { - final Function function = new Function( - FUNC_DESTROY, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getDestroyInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_DESTROY, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (BigInteger) results.get(0).getValue() - ); - } - - public Tuple1 getDestroyOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_DESTROY, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall
transfer(String toAddress, BigInteger value) { - final Function function = new Function( - FUNC_TRANSFER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(toAddress), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void transfer(String toAddress, BigInteger value, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_TRANSFER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(toAddress), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String transferSeq(String toAddress, BigInteger value) { - final Function function = new Function( - FUNC_TRANSFER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(toAddress), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getTransferInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_TRANSFER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (String) results.get(0).getValue(), - (BigInteger) results.get(1).getValue() - ); - } - - public Tuple3 getTransferOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_TRANSFER, - Arrays.asList(), - Arrays.>asList(new TypeReference() {}, new TypeReference() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple3( - - (Boolean) results.get(0).getValue(), - (BigInteger) results.get(1).getValue(), - (BigInteger) results.get(2).getValue() - ); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall isRegistered(String addr) { - final Function function = new Function(FUNC_ISREGISTERED, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall auth(String src) { - final Function function = new Function(FUNC_AUTH, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall balance(String addr) { - final Function function = new Function(FUNC_BALANCE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(addr)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); - } - - public RemoteCall
unregister() { - final Function function = new Function( - FUNC_UNREGISTER, - Arrays.asList(), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void unregister(TransactionSucCallback callback) { - final Function function = new Function( - FUNC_UNREGISTER, - Arrays.asList(), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String unregisterSeq() { - final Function function = new Function( - FUNC_UNREGISTER, - Arrays.asList(), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getUnregisterOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_UNREGISTER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public List getLogRegisterEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGREGISTER_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogRegisterEventResponse typedResponse = new LogRegisterEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogRegisterEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGREGISTER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogRegisterEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGREGISTER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getLogUnregisterEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGUNREGISTER_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogUnregisterEventResponse typedResponse = new LogUnregisterEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.account = (String) eventValues.getNonIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogUnregisterEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGUNREGISTER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogUnregisterEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGUNREGISTER_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getLogSendEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOGSEND_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - LogSendEventResponse typedResponse = new LogSendEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.from = (String) eventValues.getIndexedValues().get(0).getValue(); - typedResponse.to = (String) eventValues.getIndexedValues().get(1).getValue(); - typedResponse.value = (BigInteger) eventValues.getNonIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerLogSendEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSEND_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerLogSendEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(LOGSEND_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - @Deprecated - public static RewardPointController load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new RewardPointController(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static RewardPointController load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new RewardPointController(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static RewardPointController load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new RewardPointController(contractAddress, web3j, credentials, contractGasProvider); - } - - public static RewardPointController load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new RewardPointController(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String dataAddress) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); - return deployRemoteCall(RewardPointController.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String dataAddress) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); - return deployRemoteCall(RewardPointController.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String dataAddress) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); - return deployRemoteCall(RewardPointController.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String dataAddress) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(dataAddress))); - return deployRemoteCall(RewardPointController.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); - } - - public static class LogRegisterEventResponse { - public Log log; - - public String account; - } - - public static class LogUnregisterEventResponse { - public Log log; - - public String account; - } - - public static class LogSendEventResponse { - public Log log; - - public String from; - - public String to; - - public BigInteger value; - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java b/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java deleted file mode 100644 index 06d2f85a..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/contract/point/RewardPointData.java +++ /dev/null @@ -1,567 +0,0 @@ -package com.webank.wescott.contract.point; - -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.Collections; -import java.util.List; -import java.util.concurrent.Callable; -import org.fisco.bcos.channel.client.TransactionSucCallback; -import org.fisco.bcos.channel.event.filter.EventLogPushWithDecodeCallback; -import org.fisco.bcos.web3j.abi.EventEncoder; -import org.fisco.bcos.web3j.abi.FunctionEncoder; -import org.fisco.bcos.web3j.abi.FunctionReturnDecoder; -import org.fisco.bcos.web3j.abi.TypeReference; -import org.fisco.bcos.web3j.abi.datatypes.Address; -import org.fisco.bcos.web3j.abi.datatypes.Bool; -import org.fisco.bcos.web3j.abi.datatypes.Event; -import org.fisco.bcos.web3j.abi.datatypes.Function; -import org.fisco.bcos.web3j.abi.datatypes.Type; -import org.fisco.bcos.web3j.abi.datatypes.Utf8String; -import org.fisco.bcos.web3j.abi.datatypes.generated.Uint256; -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.protocol.Web3j; -import org.fisco.bcos.web3j.protocol.core.RemoteCall; -import org.fisco.bcos.web3j.protocol.core.methods.response.Log; -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.fisco.bcos.web3j.tuples.generated.Tuple1; -import org.fisco.bcos.web3j.tuples.generated.Tuple2; -import org.fisco.bcos.web3j.tx.Contract; -import org.fisco.bcos.web3j.tx.TransactionManager; -import org.fisco.bcos.web3j.tx.gas.ContractGasProvider; -import org.fisco.bcos.web3j.tx.txdecode.TransactionDecoder; - -/** - *

Auto generated code. - *

Do not modify! - *

Please use the web3j command line tools, - * or the org.fisco.bcos.web3j.codegen.SolidityFunctionWrapperGenerator in the - * codegen module to update. - * - *

Generated with web3j version none. - */ -@SuppressWarnings("unchecked") -public class RewardPointData extends Contract { - public static String BINARY = "60806040523480156200001157600080fd5b506040516200148a3803806200148a83398101806040528101908080518201929190505050336000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff1602179055506200009a336001620000ba6401000000000262000dd0179091906401000000009004565b8060059080519060200190620000b2929190620002cd565b50506200037c565b620000d58282620001a9640100000000026401000000009004565b1515156200014b576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415151562000276576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031057805160ff191683800117855562000341565b8280016001018555821562000341579182015b828111156200034057825182559160200191906001019062000323565b5b50905062000350919062000354565b5090565b6200037991905b80821115620003755760008160009055506001016200035b565b5090565b90565b6110fe806200038c6000396000f3006080604052600436106100db576000357c0100000000000000000000000000000000000000000000000000000000900463ffffffff16806313af4035146100e057806320694db0146101235780633bbeaab51461016657806360df8a1f146101915780637b510fe8146101d6578063877b9a6714610238578063b2bdfa7b14610293578063c510a9a8146102ea578063c8e40fbf1461032d578063cd5d211814610388578063cfa84dfe146103e3578063d28eb96314610473578063e30443bc146104b6578063e5c96aa41461051b578063f8b2cb4f14610582575b600080fd5b3480156100ec57600080fd5b50610121600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506105d9565b005b34801561012f57600080fd5b50610164600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610699565b005b34801561017257600080fd5b5061017b610796565b6040518082815260200191505060405180910390f35b34801561019d57600080fd5b506101bc6004803603810190808035906020019092919050505061079c565b604051808215151515815260200191505060405180910390f35b3480156101e257600080fd5b50610217600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919050505061080a565b60405180831515151581526020018281526020019250505060405180910390f35b34801561024457600080fd5b50610279600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108a3565b604051808215151515815260200191505060405180910390f35b34801561029f57600080fd5b506102a86108c0565b604051808273ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200191505060405180910390f35b3480156102f657600080fd5b5061032b600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506108e5565b005b34801561033957600080fd5b5061036e600480360381019080803573ffffffffffffffffffffffffffffffffffffffff1690602001909291905050506109e2565b604051808215151515815260200191505060405180910390f35b34801561039457600080fd5b506103c9600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610a38565b604051808215151515815260200191505060405180910390f35b3480156103ef57600080fd5b506103f8610adf565b6040518080602001828103825283818151815260200191508051906020019080838360005b8381101561043857808201518184015260208101905061041d565b50505050905090810190601f1680156104655780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b34801561047f57600080fd5b506104b4600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610b7d565b005b3480156104c257600080fd5b50610501600480360381019080803573ffffffffffffffffffffffffffffffffffffffff16906020019092919080359060200190929190505050610c1c565b604051808215151515815260200191505060405180910390f35b34801561052757600080fd5b50610568600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190803515159060200190929190505050610cc8565b604051808215151515815260200191505060405180910390f35b34801561058e57600080fd5b506105c3600480360381019080803573ffffffffffffffffffffffffffffffffffffffff169060200190929190505050610d87565b6040518082815260200191505060405180910390f35b6105e233610a38565b1515610656576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252600b8152602001807f4f6e6c79206f776e65722100000000000000000000000000000000000000000081525060200191505060405180910390fd5b806000806101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6106a2336108a3565b151561073c576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b610750816001610dd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167f05e7c881d716bee8cb7ed92293133ba156704252439e5c502c277448f04e20c260405160405180910390a250565b60045481565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff161415156107fa57600080fd5b8160048190555060019050919050565b600080600360008473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff1681526020019081526020016000205491509150915091565b60006108b9826001610ead90919063ffffffff16565b9050919050565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1681565b6108ee336108a3565b1515610988576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260308152602001807f497373756572526f6c653a2063616c6c657220646f6573206e6f74206861766581526020017f207468652049737375657220726f6c650000000000000000000000000000000081525060400191505060405180910390fd5b61099c816001610fd090919063ffffffff16565b8073ffffffffffffffffffffffffffffffffffffffff167faf66545c919a3be306ee446d8f42a9558b5b022620df880517bc9593ec0f2d5260405160405180910390a250565b6000600360008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff169050919050565b60003073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610a775760019050610ada565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff161415610ad55760019050610ada565b600090505b919050565b60058054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015610b755780601f10610b4a57610100808354040283529160200191610b75565b820191906000526020600020905b815481529060010190602001808311610b5857829003601f168201915b505050505081565b6000809054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610bd857600080fd5b80600660006101000a81548173ffffffffffffffffffffffffffffffffffffffff021916908373ffffffffffffffffffffffffffffffffffffffff16021790555050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610c7a57600080fd5b81600260008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020819055506001905092915050565b6000600660009054906101000a900473ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff163373ffffffffffffffffffffffffffffffffffffffff16141515610d2657600080fd5b81600360008573ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055506001905092915050565b6000600260008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff168152602001908152602001600020549050919050565b610dda8282610ead565b151515610e4f576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040180806020018281038252601f8152602001807f526f6c65733a206163636f756e7420616c72656164792068617320726f6c650081525060200191505060405180910390fd5b60018260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff0219169083151502179055505050565b60008073ffffffffffffffffffffffffffffffffffffffff168273ffffffffffffffffffffffffffffffffffffffff1614151515610f79576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260228152602001807f526f6c65733a206163636f756e7420697320746865207a65726f20616464726581526020017f737300000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b8260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060009054906101000a900460ff16905092915050565b610fda8282610ead565b1515611074576040517f08c379a00000000000000000000000000000000000000000000000000000000081526004018080602001828103825260218152602001807f526f6c65733a206163636f756e7420646f6573206e6f74206861766520726f6c81526020017f650000000000000000000000000000000000000000000000000000000000000081525060400191505060405180910390fd5b60008260000160008373ffffffffffffffffffffffffffffffffffffffff1673ffffffffffffffffffffffffffffffffffffffff16815260200190815260200160002060006101000a81548160ff02191690831515021790555050505600a165627a7a723058204eb54c60ac1182a7b2e92c819f0f5cbc428e055d397fb5a3a18f4e9c0c58853a0029"; - - public static final String ABI = "[{\"constant\":false,\"inputs\":[{\"name\":\"owner\",\"type\":\"address\"}],\"name\":\"setOwner\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"addIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_totalAmount\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"amount\",\"type\":\"uint256\"}],\"name\":\"setTotalAmount\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getAccountInfo\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"},{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"isIssuer\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_owner\",\"outputs\":[{\"name\":\"\",\"type\":\"address\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"renounceIssuer\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"hasAccount\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"src\",\"type\":\"address\"}],\"name\":\"auth\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[],\"name\":\"_description\",\"outputs\":[{\"name\":\"\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"newVersion\",\"type\":\"address\"}],\"name\":\"upgradeVersion\",\"outputs\":[],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"a\",\"type\":\"address\"},{\"name\":\"value\",\"type\":\"uint256\"}],\"name\":\"setBalance\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":false,\"inputs\":[{\"name\":\"a\",\"type\":\"address\"},{\"name\":\"b\",\"type\":\"bool\"}],\"name\":\"setAccount\",\"outputs\":[{\"name\":\"\",\"type\":\"bool\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"function\"},{\"constant\":true,\"inputs\":[{\"name\":\"account\",\"type\":\"address\"}],\"name\":\"getBalance\",\"outputs\":[{\"name\":\"\",\"type\":\"uint256\"}],\"payable\":false,\"stateMutability\":\"view\",\"type\":\"function\"},{\"inputs\":[{\"name\":\"description\",\"type\":\"string\"}],\"payable\":false,\"stateMutability\":\"nonpayable\",\"type\":\"constructor\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerAdded\",\"type\":\"event\"},{\"anonymous\":false,\"inputs\":[{\"indexed\":true,\"name\":\"account\",\"type\":\"address\"}],\"name\":\"IssuerRemoved\",\"type\":\"event\"}]"; - - public static final TransactionDecoder transactionDecoder = new TransactionDecoder(ABI, BINARY); - - public static final String FUNC_SETOWNER = "setOwner"; - - public static final String FUNC_ADDISSUER = "addIssuer"; - - public static final String FUNC__TOTALAMOUNT = "_totalAmount"; - - public static final String FUNC_SETTOTALAMOUNT = "setTotalAmount"; - - public static final String FUNC_GETACCOUNTINFO = "getAccountInfo"; - - public static final String FUNC_ISISSUER = "isIssuer"; - - public static final String FUNC__OWNER = "_owner"; - - public static final String FUNC_RENOUNCEISSUER = "renounceIssuer"; - - public static final String FUNC_HASACCOUNT = "hasAccount"; - - public static final String FUNC_AUTH = "auth"; - - public static final String FUNC__DESCRIPTION = "_description"; - - public static final String FUNC_UPGRADEVERSION = "upgradeVersion"; - - public static final String FUNC_SETBALANCE = "setBalance"; - - public static final String FUNC_SETACCOUNT = "setAccount"; - - public static final String FUNC_GETBALANCE = "getBalance"; - - public static final Event ISSUERADDED_EVENT = new Event("IssuerAdded", - Arrays.>asList(new TypeReference

(true) {})); - ; - - public static final Event ISSUERREMOVED_EVENT = new Event("IssuerRemoved", - Arrays.>asList(new TypeReference
(true) {})); - ; - - @Deprecated - protected RewardPointData(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - protected RewardPointData(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, credentials, contractGasProvider); - } - - @Deprecated - protected RewardPointData(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - protected RewardPointData(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static TransactionDecoder getTransactionDecoder() { - return transactionDecoder; - } - - public RemoteCall
setOwner(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setOwner(String owner, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setOwnerSeq(String owner) { - final Function function = new Function( - FUNC_SETOWNER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(owner)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetOwnerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETOWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
addIssuer(String account) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void addIssuer(String account, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String addIssuerSeq(String account) { - final Function function = new Function( - FUNC_ADDISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getAddIssuerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_ADDISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall _totalAmount() { - final Function function = new Function(FUNC__TOTALAMOUNT, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); - } - - public RemoteCall
setTotalAmount(BigInteger amount) { - final Function function = new Function( - FUNC_SETTOTALAMOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(amount)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setTotalAmount(BigInteger amount, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETTOTALAMOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(amount)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setTotalAmountSeq(BigInteger amount) { - final Function function = new Function( - FUNC_SETTOTALAMOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(amount)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getSetTotalAmountInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETTOTALAMOUNT, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (BigInteger) results.get(0).getValue() - ); - } - - public Tuple1 getSetTotalAmountOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_SETTOTALAMOUNT, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall> getAccountInfo(String account) { - final Function function = new Function(FUNC_GETACCOUNTINFO, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Arrays.>asList(new TypeReference() {}, new TypeReference() {})); - return new RemoteCall>( - new Callable>() { - @Override - public Tuple2 call() throws Exception { - List results = executeCallMultipleValueReturn(function); - return new Tuple2( - (Boolean) results.get(0).getValue(), - (BigInteger) results.get(1).getValue()); - } - }); - } - - public RemoteCall isIssuer(String account) { - final Function function = new Function(FUNC_ISISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall _owner() { - final Function function = new Function(FUNC__OWNER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall
renounceIssuer(String account) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void renounceIssuer(String account, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String renounceIssuerSeq(String account) { - final Function function = new Function( - FUNC_RENOUNCEISSUER, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getRenounceIssuerInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_RENOUNCEISSUER, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall hasAccount(String account) { - final Function function = new Function(FUNC_HASACCOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall auth(String src) { - final Function function = new Function(FUNC_AUTH, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(src)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, Boolean.class); - } - - public RemoteCall _description() { - final Function function = new Function(FUNC__DESCRIPTION, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, String.class); - } - - public RemoteCall
upgradeVersion(String newVersion) { - final Function function = new Function( - FUNC_UPGRADEVERSION, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(newVersion)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void upgradeVersion(String newVersion, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_UPGRADEVERSION, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(newVersion)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String upgradeVersionSeq(String newVersion) { - final Function function = new Function( - FUNC_UPGRADEVERSION, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(newVersion)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple1 getUpgradeVersionInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_UPGRADEVERSION, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (String) results.get(0).getValue() - ); - } - - public RemoteCall
setBalance(String a, BigInteger value) { - final Function function = new Function( - FUNC_SETBALANCE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setBalance(String a, BigInteger value, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETBALANCE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setBalanceSeq(String a, BigInteger value) { - final Function function = new Function( - FUNC_SETBALANCE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), - new org.fisco.bcos.web3j.abi.datatypes.generated.Uint256(value)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getSetBalanceInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETBALANCE, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (String) results.get(0).getValue(), - (BigInteger) results.get(1).getValue() - ); - } - - public Tuple1 getSetBalanceOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_SETBALANCE, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall
setAccount(String a, Boolean b) { - final Function function = new Function( - FUNC_SETACCOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), - new org.fisco.bcos.web3j.abi.datatypes.Bool(b)), - Collections.>emptyList()); - return executeRemoteCallTransaction(function); - } - - public void setAccount(String a, Boolean b, TransactionSucCallback callback) { - final Function function = new Function( - FUNC_SETACCOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), - new org.fisco.bcos.web3j.abi.datatypes.Bool(b)), - Collections.>emptyList()); - asyncExecuteTransaction(function, callback); - } - - public String setAccountSeq(String a, Boolean b) { - final Function function = new Function( - FUNC_SETACCOUNT, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(a), - new org.fisco.bcos.web3j.abi.datatypes.Bool(b)), - Collections.>emptyList()); - return createTransactionSeq(function); - } - - public Tuple2 getSetAccountInput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getInput().substring(10); - final Function function = new Function(FUNC_SETACCOUNT, - Arrays.asList(), - Arrays.>asList(new TypeReference
() {}, new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple2( - - (String) results.get(0).getValue(), - (Boolean) results.get(1).getValue() - ); - } - - public Tuple1 getSetAccountOutput(TransactionReceipt transactionReceipt) { - String data = transactionReceipt.getOutput(); - final Function function = new Function(FUNC_SETACCOUNT, - Arrays.asList(), - Arrays.>asList(new TypeReference() {})); - List results = FunctionReturnDecoder.decode(data, function.getOutputParameters());; - return new Tuple1( - - (Boolean) results.get(0).getValue() - ); - } - - public RemoteCall getBalance(String account) { - final Function function = new Function(FUNC_GETBALANCE, - Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Address(account)), - Arrays.>asList(new TypeReference() {})); - return executeRemoteCallSingleValueReturn(function, BigInteger.class); - } - - public List getIssuerAddedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(ISSUERADDED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - IssuerAddedEventResponse typedResponse = new IssuerAddedEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerIssuerAddedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerIssuerAddedEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERADDED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - public List getIssuerRemovedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(ISSUERREMOVED_EVENT, transactionReceipt); - ArrayList responses = new ArrayList(valueList.size()); - for (Contract.EventValuesWithLog eventValues : valueList) { - IssuerRemovedEventResponse typedResponse = new IssuerRemovedEventResponse(); - typedResponse.log = eventValues.getLog(); - typedResponse.account = (String) eventValues.getIndexedValues().get(0).getValue(); - responses.add(typedResponse); - } - return responses; - } - - public void registerIssuerRemovedEventLogFilter(String fromBlock, String toBlock, List otherTopcs, EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,fromBlock,toBlock,otherTopcs,callback); - } - - public void registerIssuerRemovedEventLogFilter(EventLogPushWithDecodeCallback callback) { - String topic0 = EventEncoder.encode(ISSUERREMOVED_EVENT); - registerEventLogPushFilter(ABI,BINARY,topic0,callback); - } - - @Deprecated - public static RewardPointData load(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { - return new RewardPointData(contractAddress, web3j, credentials, gasPrice, gasLimit); - } - - @Deprecated - public static RewardPointData load(String contractAddress, Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { - return new RewardPointData(contractAddress, web3j, transactionManager, gasPrice, gasLimit); - } - - public static RewardPointData load(String contractAddress, Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { - return new RewardPointData(contractAddress, web3j, credentials, contractGasProvider); - } - - public static RewardPointData load(String contractAddress, Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return new RewardPointData(contractAddress, web3j, transactionManager, contractGasProvider); - } - - public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider, String description) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); - return deployRemoteCall(RewardPointData.class, web3j, credentials, contractGasProvider, BINARY, encodedConstructor); - } - - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider, String description) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); - return deployRemoteCall(RewardPointData.class, web3j, transactionManager, contractGasProvider, BINARY, encodedConstructor); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit, String description) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); - return deployRemoteCall(RewardPointData.class, web3j, credentials, gasPrice, gasLimit, BINARY, encodedConstructor); - } - - @Deprecated - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit, String description) { - String encodedConstructor = FunctionEncoder.encodeConstructor(Arrays.asList(new org.fisco.bcos.web3j.abi.datatypes.Utf8String(description))); - return deployRemoteCall(RewardPointData.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, encodedConstructor); - } - - public static class IssuerAddedEventResponse { - public Log log; - - public String account; - } - - public static class IssuerRemovedEventResponse { - public Log log; - - public String account; - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java deleted file mode 100644 index 8fc2b2f5..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/tool/AddressListUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -/** - * Copyright (C) 2018 WeBank, Inc. All Rights Reserved. - */ -package com.webank.wescott.tool; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; - -import org.fisco.bcos.web3j.abi.datatypes.Address; - -/** - * String2AddressListUtils - * - * @Description: String2AddressListUtils - * @author maojiayu - * @date 2018年7月9日 下午9:36:06 - * - */ -public class AddressListUtils { - - public static List
toAddressList(List strList) { - if (strList.isEmpty()) { - return new ArrayList
(); - } else { - return strList.stream().map(str -> { - return new Address(str); - }).collect(Collectors.toList()); - } - } - - public static List addressToStrList(List
adressList) { - if (adressList.isEmpty()) { - return new ArrayList(); - } else { - return adressList.stream().map(addr -> { - return addr.toString().trim(); - }).collect(Collectors.toList()); - } - } - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java deleted file mode 100644 index 6875fc54..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/tool/BytesUtils.java +++ /dev/null @@ -1,42 +0,0 @@ -package com.webank.wescott.tool; - -import org.apache.commons.codec.binary.StringUtils; -import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes16; -import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes2; -import org.fisco.bcos.web3j.abi.datatypes.generated.Bytes32; - -public class BytesUtils { - - public static Bytes32 stringToBytes32(String string) { - byte[] byteValue = string.getBytes(); - byte[] byteValueLen32 = new byte[32]; - System.arraycopy(byteValue, 0, byteValueLen32, 0, byteValue.length); - return new Bytes32(byteValueLen32); - } - - public static String Bytes32ToString(Bytes32 b) { - return StringUtils.newStringUsAscii(b.getValue()).trim(); - } - - public static Bytes16 stringToBytes16(String string) { - byte[] byteValue = string.getBytes(); - byte[] byteValueLen16 = new byte[16]; - System.arraycopy(byteValue, 0, byteValueLen16, 0, byteValue.length); - return new Bytes16(byteValueLen16); - } - - public static String Bytes16ToString(Bytes16 b) { - return StringUtils.newStringUsAscii(b.getValue()).trim(); - } - - public static Bytes2 stringToBytes2(String string) { - byte[] byteValue = string.getBytes(); - byte[] byteValueLen2 = new byte[2]; - System.arraycopy(byteValue, 0, byteValueLen2, 0, byteValue.length); - return new Bytes2(byteValueLen2); - } - - public static String Bytes2ToString(Bytes2 b) { - return StringUtils.newStringUsAscii(b.getValue()).trim(); - } -} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java deleted file mode 100644 index 0522d618..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/tool/CredentialUtils.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.webank.wescott.tool; - -import java.io.InputStream; -import java.security.Key; -import java.security.KeyStore; -import java.security.interfaces.ECPrivateKey; - -import org.fisco.bcos.web3j.crypto.Credentials; -import org.fisco.bcos.web3j.crypto.ECKeyPair; -import org.springframework.core.io.Resource; -import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import org.springframework.core.io.support.ResourcePatternResolver; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class CredentialUtils { - - public static Credentials loadKey(String keyStoreFileName, String keyStorePassword, String keyPassword) - throws Exception { - KeyStore ks = KeyStore.getInstance("JKS"); - ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver(); - Resource cdResource = resolver.getResource(keyStoreFileName); - try (InputStream stream = cdResource.getInputStream()) { - ks.load(stream, keyStorePassword.toCharArray()); - Key key = ks.getKey("ec", keyPassword.toCharArray()); - ECKeyPair keyPair = ECKeyPair.create(((ECPrivateKey) key).getS()); - Credentials credentials = Credentials.create(keyPair); - if (credentials != null) { - return credentials; - } else { - log.error("秘钥参数输入有误!"); - } - } - return null; - } - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java b/java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java deleted file mode 100644 index a233e9ab..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/tool/JacksonException.java +++ /dev/null @@ -1,21 +0,0 @@ -package com.webank.wescott.tool; - -public class JacksonException extends RuntimeException { - - public JacksonException() { - super(); - } - - public JacksonException(String message, Throwable cause) { - super(message, cause); - } - - public JacksonException(String message) { - super(message); - } - - public JacksonException(Throwable cause) { - super(cause); - } - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java b/java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java deleted file mode 100644 index 4a2189a3..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/tool/JacksonUtils.java +++ /dev/null @@ -1,161 +0,0 @@ -package com.webank.wescott.tool; - -import java.io.IOException; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; - -import com.alibaba.fastjson.JSONArray; -import com.alibaba.fastjson.JSONObject; -import com.fasterxml.jackson.core.JsonParseException; -import com.fasterxml.jackson.core.JsonParser; -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.databind.DeserializationFeature; -import com.fasterxml.jackson.databind.JavaType; -import com.fasterxml.jackson.databind.JsonMappingException; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.fasterxml.jackson.databind.SerializationFeature; - -import lombok.extern.slf4j.Slf4j; - -@Slf4j -public class JacksonUtils { - public static ObjectMapper objectMapper = new ObjectMapper(); - - static { - objectMapper.disable(SerializationFeature.FAIL_ON_EMPTY_BEANS); - objectMapper.configure(JsonParser.Feature.ALLOW_UNQUOTED_CONTROL_CHARS, true); - objectMapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); - } - - public static T fromJson(String json, Class clazz) { - try { - return fromJsonWithException(json, clazz); - } catch (Exception e) { - log.error("json is: " + json, e); - return null; - } - } - - public static T fromJson(String json, Class c, Class...t) { - try { - return fromJsonWithException(json, c, t); - } catch (IOException e) { - throw new JacksonException(e); - } - } - - public static T fromJson(String json, JavaType type) { - try { - return fromJsonWithException(json, type); - } catch (IOException e) { - throw new JacksonException(e); - } - } - - public static T fromJsonWithException(String json, Class clazz) - throws JsonParseException, JsonMappingException, IOException { - return objectMapper.readValue(json, clazz); - } - - public static T fromJsonWithException(String json, Class c, Class...t) - throws JsonParseException, JsonMappingException, IOException { - JavaType javaType = objectMapper.getTypeFactory().constructParametricType(c, t); - return objectMapper.readValue(json, javaType); - } - - public static T fromJsonWithException(String json, JavaType type) - throws JsonParseException, JsonMappingException, IOException { - T ret = (T) objectMapper.readValue(json, type); - return ret; - } - - public static List fromJsonList(String json, Class c) { - try { - return fromJsonListWithException(json, c); - } catch (IOException e) { - throw new JacksonException(e); - } - } - - public static List fromJsonListWithException(String json, Class c) throws IOException { - JavaType type = getCollectionType(ArrayList.class, c); - return (List) objectMapper.readValue(json, type); - } - - public static JavaType getCollectionType(Class collectionClass, Class...elementClasses) { - return objectMapper.getTypeFactory().constructParametricType(collectionClass, elementClasses); - } - - public static String toJsonWithException(Object o) throws JsonProcessingException { - return objectMapper.writeValueAsString(o); - } - - public static String toJson(Object o) { - try { - return toJsonWithException(o); - } catch (Exception e) { - throw new JacksonException(e); - } - } - - public static Map convertValue(Object req, Class keyClazz, Class valueClazz) { - Map ret = objectMapper.convertValue(req, - objectMapper.getTypeFactory().constructMapType(Map.class, keyClazz, valueClazz)); - return ret; - } - - public static T convertMap(Map map, Class retClazz) { - return objectMapper.convertValue(map, retClazz); - } - - public static void main(String[] args) throws Exception { - String json = "{\"name\": \"abc\",\"value\": [\"a\",\"b\",\"c\"]}"; - JavaType type = objectMapper.getTypeFactory().constructParametricType(NameValueVO.class, - objectMapper.getTypeFactory().constructParametricType(List.class, String.class)); - NameValueVO> vos = (NameValueVO>) objectMapper.readValue(json, type); - System.out.println(vos); - } - - public static T strToObject(String str, Class clazz) { - ObjectMapper mapper = new ObjectMapper(); - T t = null; - try { - t = mapper.readValue(str, clazz); - return t; - } catch (IOException e) { - e.printStackTrace(); - } - return t; - } - - // 对象转换为字符串 - public static String objectToStr(T t) { - ObjectMapper mapper = new ObjectMapper(); - String str = null; - try { - str = mapper.writeValueAsString(t); - } catch (IOException e) { - e.printStackTrace(); - } - return str; - } - - // json转化为对象list - public static List strToList(String str, Class clazz) { - JSONArray jsonArray = JSONArray.parseArray(str); - for (int i = 0; i < jsonArray.size(); i++) { - System.out.println(jsonArray.get(i)); - } - - T t = null; - List list = new ArrayList(); - for (int i = 0; i < jsonArray.size(); i++) { - String objStr = JSONObject.toJSONString(jsonArray.get(i)); - t = (T) JSONObject.parseObject(objStr, clazz); - list.add(t); - } - return list; - } - -} diff --git a/java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java b/java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java deleted file mode 100644 index 00d2bdd7..00000000 --- a/java/wescott/src/main/java/com/webank/wescott/tool/NameValueVO.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.webank.wescott.tool; - -import lombok.AllArgsConstructor; -import lombok.Data; -import lombok.NoArgsConstructor; -import lombok.experimental.Accessors; - -@Data -@NoArgsConstructor -@AllArgsConstructor -@Accessors(chain = true) -public class NameValueVO { - private String name; - private T value; -} diff --git a/java/wescott/src/main/resources/application.properties b/java/wescott/src/main/resources/application.properties deleted file mode 100644 index 232ac58f..00000000 --- a/java/wescott/src/main/resources/application.properties +++ /dev/null @@ -1,12 +0,0 @@ -### Springboot server config -server.port=5310 -spring.jackson.date-format=yyyy-MM-dd HH:mm:ss -spring.jackson.time-zone=GMT+8 - -logging.level.org.fisco.bcos=INFO - -## System config -system.orgId=fb -system.nodeStr=node1@106.12.79.242:20201 -system.groupId=1 -system.configPath=config/ diff --git a/java/wescott/src/main/resources/ca.crt b/java/wescott/src/main/resources/ca.crt deleted file mode 100644 index e30b6f68..00000000 --- a/java/wescott/src/main/resources/ca.crt +++ /dev/null @@ -1,20 +0,0 @@ ------BEGIN CERTIFICATE----- -MIIDPTCCAiWgAwIBAgIJANw5ER1ZP/ArMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNV -BAMMBWNoYWluMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjAe -Fw0yMDAxMjEwMzM5NTRaFw0zMDAxMTgwMzM5NTRaMDUxDjAMBgNVBAMMBWNoYWlu -MRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjCCASIwDQYJKoZI -hvcNAQEBBQADggEPADCCAQoCggEBAOCuBfjLxboeKKRQ5Q6TGAllCo903tk3Q/VG -6TcNzPwZSQd8DZ3RFOfB4gSHvOHWxxy5MJ2325hn0wu399SR/AR6d2dYbvJ0L2D3 -U4X9sUOeFw8bYfhB8tcZSpKNh9aEjQsoXwP+vdtsl5BYWFj4I8QrNWtmMoPauwXK -LYc+v0dYaQPa0MrsDGW+t7ootSGbQWWQHi7q78KXrHwfpttupHlNKYhlXWqm5OB+ -7+mwNK2q2zDV9Fsh7p+VaDS1TxwJmQUJBYfzc48RGyl7bsQT371bvYYNvACTDMVj -O+MvABDpr5mgtkVv3Eu2AyxEcKugK69Yp06q6PF+/0lnKa34t4kCAwEAAaNQME4w -HQYDVR0OBBYEFIIa4SV9Yjz4l3/v43kqDR0bNBsmMB8GA1UdIwQYMBaAFIIa4SV9 -Yjz4l3/v43kqDR0bNBsmMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADggEB -ALw3jzd8LgrUfy4kiF0kiz8fFTGj0BqF5ACi7gaGKj0vjGY6Xc1uANFe6yANT8ue -OMM42noWHe2NAbce9igeG9yKO1T3doxnmLa0OuoC/RZ3tycmd2PT8bsOSToIjdXr -4cLjKzts9k//V4la1VH2ZGOxs0Zh4FiJpd66FVtQK1fRkbEaK1NdxXXL3gZRTPA0 -57eEUREMKwtcR0K+tdFGxmW0SOxslm1hG6sfIFZIaFw+LUBA4sHqmtdd7cq8QP9L -gt2EnAI5gqyrEoClbMZO0RtuEAYScSZSPfPXK37bdu6pNT8Un7dGIKIDORs7Jq5I -Chwi0jxEl5C2nicr6OuIMks= ------END CERTIFICATE----- diff --git a/java/wescott/src/main/resources/node.crt b/java/wescott/src/main/resources/node.crt deleted file mode 100644 index 1ee40544..00000000 --- a/java/wescott/src/main/resources/node.crt +++ /dev/null @@ -1,33 +0,0 @@ ------BEGIN CERTIFICATE----- -MIICNzCCAR+gAwIBAgIJAIUN9Dhu9YdtMA0GCSqGSIb3DQEBCwUAMDcxDzANBgNV -BAMMBmFnZW5jeTETMBEGA1UECgwKZmlzY28tYmNvczEPMA0GA1UECwwGYWdlbmN5 -MB4XDTIwMDEyMTAzMzk1NVoXDTMwMDExODAzMzk1NVowMTEMMAoGA1UEAwwDc2Rr -MRMwEQYDVQQKDApmaXNjby1iY29zMQwwCgYDVQQLDANzZGswVjAQBgcqhkjOPQIB -BgUrgQQACgNCAARc27EPAi4Ody4UgNEY5dtws2oFfb+uDAwovTSquaMhQoyf6219 -F3szcq+ZxIeMygyX5J2vkQBQ1mVFy6tiblICoxowGDAJBgNVHRMEAjAAMAsGA1Ud -DwQEAwIF4DANBgkqhkiG9w0BAQsFAAOCAQEAftz2gRHXZEqYFXsEpAPk9L+bnHHb -1EWTLf9NR8A72n8YIEfOZVvODwOMduqKvZnLq9fZqCSqYoEzi/Lp2uLaNekZJyYS -aWo72QWNW+JBYJBLXrVh33bjZ/PN5+6bGhEYpCFX5FRUvlSkAsGCapR0gR0171Tf -dJwoXKWQkB+8eKxy6jUDddkuP+CSAapdOiXtS8VQPXXZWo991XDKJwi9Vu2XPuQh -BhW2XNWWHdBW36pLQwJsVNJ9y/JqBtS+ApKwKTGdM5kYqzUvk426LDKATlV1UFxF -+wMH7uO71BWarxjPhrNbx07B5AUANe0MGf9GlH0RlzKIeHtOSaAeJs7oKw== ------END CERTIFICATE----- ------BEGIN CERTIFICATE----- -MIIC/zCCAeegAwIBAgIJAIUN9Dhu9YdhMA0GCSqGSIb3DQEBCwUAMDUxDjAMBgNV -BAMMBWNoYWluMRMwEQYDVQQKDApmaXNjby1iY29zMQ4wDAYDVQQLDAVjaGFpbjAe -Fw0yMDAxMjEwMzM5NTRaFw0zMDAxMTgwMzM5NTRaMDcxDzANBgNVBAMMBmFnZW5j -eTETMBEGA1UECgwKZmlzY28tYmNvczEPMA0GA1UECwwGYWdlbmN5MIIBIjANBgkq -hkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAwL6XgS1UZp4RRibvGyiCRs2EqQxNwynm -2QxU68KDScDmgTX9tYmVvNIa0ZDCEBTdWxb692FZJR8GkWPZPfrGls4aI0A+MGKA -MSf6tCD12f7tyBsy9aTV3iBpTKjUa557nAwcJDwZy2UmqNHZJ0pngqSBplxZDHXf -tnNSpBVD6Nji2wzb/01qzjuQx48pDgf9ugS135rnbZFRZIKOa50eI2CrAy7lVcJf -g7B329pmDc0LLIR9oWTT5tMyD1VH7IXjqUVw8FTi4vyJgqxcseGKgCz2EfCEvYFm -YWVnrCOZmJm6QnveiYXac+jKWobEvsuFAKoSnIAXjO8RTyFi697nUQIDAQABoxAw -DjAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBCwUAA4IBAQCzWDURfdccbSwXZina -xq/uQ0Nl4bUeHAKzy9tBEWGTb6wvBWwKP3vkq7lK3GD61TPYATCC/Sjg4EoKanPK -eXhUO5mbHUW5HKM3F+qhu7H4PPwL6KyITOScjTwm1TvG/2/wo596aZK3xPcs+Nty -8d97qjACB5KvnsVBKv0MLcoz/CrExrnDdHmB/UT9CO2LeqSHyhspek/XUSdVDyfq -sQYRIpnD0fWD6tk34C8Tn5ACcMNZDVXWfMUxPZzq1ueFH1QYSoup8rxqHu4THPAt -fwn+f3zztPI6mr+dnXi0dwY+CaUWUjJrY1FT+3qmQoepTcClkb+PieE0KnyFiVCz -4KMW ------END CERTIFICATE----- diff --git a/java/wescott/src/main/resources/node.key b/java/wescott/src/main/resources/node.key deleted file mode 100644 index 7f5bde42..00000000 --- a/java/wescott/src/main/resources/node.key +++ /dev/null @@ -1,5 +0,0 @@ ------BEGIN PRIVATE KEY----- -MIGEAgEAMBAGByqGSM49AgEGBSuBBAAKBG0wawIBAQQgu3eP3rcZK1ssiGzhiRBW -ejJ26ze8RdWgnV58R48hZtKhRANCAARc27EPAi4Ody4UgNEY5dtws2oFfb+uDAwo -vTSquaMhQoyf6219F3szcq+ZxIeMygyX5J2vkQBQ1mVFy6tiblIC ------END PRIVATE KEY----- diff --git a/java/wescott/src/main/resources/p1.jks b/java/wescott/src/main/resources/p1.jks deleted file mode 100644 index 599dc6e0438632e311526628f8bc77f433a67cc1..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmezO_TO6u1_mY|W&~rV)MOwt|2W5{cp$&tpw@tojZ2%2k%dux+(;26o?^$zL?7j1je6tN=etW|!bw4H?Ufg>4 z%{SprmQ41}ukmsm-Cw_4c-r&&@UaK_85ドルEoL^SuBs=TQD`(Vf7OD4S>-&@)L30|hSR0WU}ymoQs-YEoiewjor28(n}ICSaf-&TC{~ zU}7ドル$U~X(~XcQ&EZ)9j_X=r3*0TrOB?U4q;Z0um4GBHBE%*@En?8Lz0pBVGr=l8~0 z@1ドル}T9|`U`xMhcZvG23S4ao^P4#&R#vFbl5-7ssH>m`GncWbA$tua*DwEoWBqz9?x z9$kx$XC*yetY{!_APWo)Sw0pq7Lf-@9eYkpmXm&0s&BKhWM5T5V$NaIP-gaIFmPj1 zWSDn=Cw(=?d*}bTszFP07X7~^f9dVZKTU1-W3MM#-D7pFJ_X5vjr{VbWj95t`8U^VYj>M$gx+XbxdzSW)CB zA%9xuT)XE5brG$LJLewI7O|+QeDm-{+(Na~oBz2ToV~ADq?G!;^V@fFyR%~ImpkmQ z;@{*ogPp`0p=WAf33SyZgC@pvKwP+hnTe5!iN)1b=Yata8;4e#2ドルnUTW+qk!gD698 z15P&PP!={}rsO;rheMdDI0MFE2XpuhctOgzgxShdlM?f?4WRS0z*TVk420{Vq)6X#TLBmX#-Hn@@uCLmtQVbI&eF+q@yKP qyIU=C?p(G?|Df|u1@Fumt`-SiIuW16;~RV{Pjl|(V%;_AF24XNgUhr4 diff --git a/java/wescott/src/main/resources/p3.jks b/java/wescott/src/main/resources/p3.jks deleted file mode 100644 index 0332d46fea4c8cafbea1e9d69cfe8717a97c9ce4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 698 zcmezO_TO6u1_mY|W&~rV)MOwtZPl6*ejvZzpw@tojZ2%2k%du{p72kifLx)EVFMK-tc-YvUr~n*IU*74Y!w` zI2Ua9W8JpKiu1`onNRpn@R=N?TX9t4^^%gk#xfgK*Qd`>cF~Hwd`0!Cd%*;Th30>h zj{R$S2zC-{gr2E^CD2tr44N3f0P)NP%uI|-Oe`@>E8ZFKuyJU$d7QIlVP;}wFvv6H zHsEAq4rO5zW^(p36g1!maX5rIiZc@P(lZh>VM6RkLQ)12AXQvEf=T)L>6xkV$@zK3 z`9&p}rMZUu2D~6SZeccvoFR_^7f66vm^nMOz(7Hq*U-Yyz{u3lz`)SdC`y9g$Pgr8 zU<2c_iu%kr^^ zv50)^b7z?_?aJyEr)Kc}dB3?S$ZygI)YxElXE1PKQc##O>49~$cF*o9a!+{um;Z8k zWZ*aNS7vvr*zfkq{|?P(QYf;oFJE+H+mEkTD{7|JuDZUxE?ssCchkNf-HO$}o9L$zww+cK`R2ZaHv%0RS}4;T8Y@ diff --git a/java/wescott/src/main/resources/user1.jks b/java/wescott/src/main/resources/user1.jks deleted file mode 100644 index 867334d6a16987a27cfdaa516b462ab1bd582a7c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 660 zcmezO_TO6u1_mY|W&~rV)MOwt|2Xr%Z$N&%L9GEF8<#d4bmymzloq7_d+5b*vanv? zx2)#hDj)tFX0F^md+C2Y)#PaR!XT4(9M1@Pd?a3A2@_CMD)&8$t!R(FK@c0tO1=yha8F zhDL@4=EjDm7Eu!XMuvu#hDJsfPyw3S9%&%V#t!x=6C>2i%#7^JP7Evo!l_q&?k~2y zC|+mv_f+M+-?ruLlP;S5XnryE@TGL|xd}586}F4liXKbaR5ID{YgUlU;_yxTG<15q z7H#)`>UwaoqJg}DEHE@=`B=nQM9w!>+_{xm@9z8Fc<%afedz)j;cbr%%g4zO>gZesvS5WbF*Cj`ipu)4m+5`Z@>#u#wE;Fo|=@Hmu(0Y;6@i*R@EaK#S{fP|SwID7YI~%CFdIAAr%a4cFEcZ;GdnS`G%=;$d6+EnGLrkn zwQ}1o-y73Z?E2$vnO?A7U~MZpmHRP$LokDN&xbOm>7kzK>i5>4oM_%AzN?IzLCt)x zYt{C}iU#rqvcS-g assertEquals("uint256", entity.getType()), - () -> assertEquals(BigInteger.valueOf(2020), v)); - } - - public static void main(String[] args) { - - int id = 4 & 1; - System.out.println(id); - id |=0; - System.out.println(id); - - id= id ^ 1; - System.out.println(id); - - } - -} diff --git a/java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java b/java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java deleted file mode 100644 index 742cda81..00000000 --- a/java/wescott/src/test/java/com/webank/wescott/template/point/AdminTest.java +++ /dev/null @@ -1,115 +0,0 @@ -/** - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package com.webank.wescott.template.point; - -import java.math.BigInteger; - -import org.fisco.bcos.web3j.protocol.core.methods.response.TransactionReceipt; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeEach; -import org.junit.jupiter.api.Test; - -import com.webank.wescott.BaseTests; -import com.webank.wescott.contract.point.Admin; -import com.webank.wescott.contract.point.RewardPointController; -import com.webank.wescott.contract.point.RewardPointData; - -/** - * AdminTest - * - * @Description: AdminTest - * @author maojiayu - * @data Apr 8, 2020 4:36:44 PM - * - */ -public class AdminTest extends BaseTests { - private Admin admin; - private RewardPointController controller; - private RewardPointData data; - - @BeforeEach - public void deploy() throws Exception { - admin = Admin.deploy(web3j, p1, contractGasProvider).send(); - Assertions.assertNotNull(admin); - String dataAddress = admin._dataAddress().send(); - Assertions.assertNotNull(dataAddress); - String controllerAddress = admin._controllerAddress().send(); - Assertions.assertNotNull(controllerAddress); - controller = RewardPointController.load(controllerAddress, web3j, p1, contractGasProvider); - data = RewardPointData.load(dataAddress, web3j, p1, contractGasProvider); - } - - @Test - public void test() throws Exception { - TransactionReceipt tr = controller.register().send(); - Assertions.assertEquals("0x0", tr.getStatus()); - tr = controller.issue(p1.getAddress(), BigInteger.valueOf(100)).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - BigInteger balance1 = controller.balance(p1.getAddress()).send(); - Assertions.assertEquals(100, balance1.intValue()); - - RewardPointController controllerP2 = - RewardPointController.load(controller.getContractAddress(), web3j, p2, contractGasProvider); - tr = controllerP2.register().send(); - Assertions.assertEquals("0x0", tr.getStatus()); - tr = controller.issue(p2.getAddress(), BigInteger.valueOf(200)).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - BigInteger balance2 = controller.balance(p2.getAddress()).send(); - Assertions.assertEquals(200, balance2.intValue()); - - // transfer - tr = controllerP2.transfer(p1.getAddress(), BigInteger.valueOf(50)).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - balance1 = controller.balance(p1.getAddress()).send(); - Assertions.assertEquals(150, balance1.intValue()); - balance2 = controller.balance(p2.getAddress()).send(); - Assertions.assertEquals(150, balance2.intValue()); - - // issue - Assertions.assertTrue(controllerP2.isIssuer(p1.getAddress()).send()); - Assertions.assertTrue(!controllerP2.isIssuer(p2.getAddress()).send()); - tr = controller.addIssuer(p2.getAddress()).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - tr = controllerP2.issue(p2.getAddress(), BigInteger.ONE).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - balance2 = controller.balance(p2.getAddress()).send(); - Assertions.assertEquals(151, balance2.intValue()); - tr = controllerP2.renounceIssuer().send(); - Assertions.assertEquals("0x0", tr.getStatus()); - Assertions.assertTrue(!controllerP2.isIssuer(p2.getAddress()).send()); - BigInteger total = data._totalAmount().send(); - Assertions.assertEquals(301, total.intValue()); - - // destroy - tr = controller.destroy(BigInteger.valueOf(50)).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - balance1 = controller.balance(p1.getAddress()).send(); - Assertions.assertEquals(100, balance1.intValue()); - total = data._totalAmount().send(); - Assertions.assertEquals(251, total.intValue()); - - // unregister - tr = controllerP2.unregister().send(); - Assertions.assertEquals("0x16", tr.getStatus()); - tr = controllerP2.transfer(p1.getAddress(), BigInteger.valueOf(151)).send(); - Assertions.assertEquals("0x0", tr.getStatus()); - tr = controllerP2.unregister().send(); - Assertions.assertEquals("0x0", tr.getStatus()); - Assertions.assertTrue(!data.isIssuer(p2.getAddress()).send()); - - } - -} From 0f58c0bbb62434f92348628a03232b1e7fa6538b Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 11:55:43 +0800 Subject: [PATCH 03/23] fix dir --- test/TestQueue.sol | 22 ---------------------- test/TestSafeMath.sol | 12 ------------ test/TestSet.sol | 21 --------------------- 3 files changed, 55 deletions(-) delete mode 100644 test/TestQueue.sol delete mode 100644 test/TestSafeMath.sol delete mode 100644 test/TestSet.sol diff --git a/test/TestQueue.sol b/test/TestQueue.sol deleted file mode 100644 index 621a469e..00000000 --- a/test/TestQueue.sol +++ /dev/null @@ -1,22 +0,0 @@ -pragma solidity ^0.4.25; - -import "./LibQueue.sol"; - -contract TestQueue { - - using LibQueue for LibQueue.Queue; - - LibQueue.Queue private queue; - - constructor(){ - queue = LibQueue.newQueue(); - } - - function f() public { - queue.enqueue(1); - queue.enqueue(2); - bytes32 pop = queue.dequeue();//Expected to be 1 - uint size = queue.queueSize();//Expected to be 1 - } - -} diff --git a/test/TestSafeMath.sol b/test/TestSafeMath.sol deleted file mode 100644 index 6e088f10..00000000 --- a/test/TestSafeMath.sol +++ /dev/null @@ -1,12 +0,0 @@ -pragma solidity ^0.4.25; - -import "./LibSafeMath.sol"; - -contract TestSafeMath { - using LibSafeMath for uint256; - - function testAdd(uint256 a, uint256 b) external returns (uint256 c) { - //c = LibSafeMath.add(a,b); - c = a.add(b); - } -} \ No newline at end of file diff --git a/test/TestSet.sol b/test/TestSet.sol deleted file mode 100644 index be9c08aa..00000000 --- a/test/TestSet.sol +++ /dev/null @@ -1,21 +0,0 @@ -pragma solidity ^0.4.25; - -import "./LibAddressSet.sol"; -import "./LibBytes32Set.sol"; - -contract TestSet { - using LibAddressSet for LibAddressSet.AddressSet; - using LibBytes32Set for LibBytes32Set.Bytes32Set; - LibAddressSet.AddressSet private addressSet; - LibBytes32Set.Bytes32Set private bytes32Set; - - function testAddress() public { - addressSet.add(address(1)); - uint256 size = addressSet.size();//Expected to be 1 - } - - function testBytes32() public { - bytes32Set.add(bytes32(1)); - uint256 size = bytes32Set.size();//Expected to be 1 - } -} From 617df61dd23865a4f1860da436b7fe11df21ad8b Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 12:04:18 +0800 Subject: [PATCH 04/23] . --- contracts/{types => base_type}/LibAddress.sol | 0 contracts/{types => base_type}/LibArrayForUint256Utils.sol | 0 contracts/{types => base_type}/LibConverter.sol | 0 contracts/{types => base_type}/LibSafeMathForUint256Utils.sol | 0 contracts/{types => base_type}/LibString.sol | 0 contracts/{data_structures => data_structure}/LibAddressSet.sol | 0 contracts/{data_structures => data_structure}/LibBytes32Set.sol | 0 contracts/{data_structures => data_structure}/LibBytesMap.sol | 0 contracts/{data_structures => data_structure}/LibDeque.sol | 0 contracts/{data_structures => data_structure}/LibLinkedList.sol | 0 .../{data_structures => data_structure}/LibMaxHeapUint256.sol | 0 .../{data_structures => data_structure}/LibMinHeapUint256.sol | 0 contracts/{data_structures => data_structure}/LibQueue.sol | 0 contracts/{data_structures => data_structure}/LibStack.sol | 0 14 files changed, 0 insertions(+), 0 deletions(-) rename contracts/{types => base_type}/LibAddress.sol (100%) rename contracts/{types => base_type}/LibArrayForUint256Utils.sol (100%) rename contracts/{types => base_type}/LibConverter.sol (100%) rename contracts/{types => base_type}/LibSafeMathForUint256Utils.sol (100%) rename contracts/{types => base_type}/LibString.sol (100%) rename contracts/{data_structures => data_structure}/LibAddressSet.sol (100%) rename contracts/{data_structures => data_structure}/LibBytes32Set.sol (100%) rename contracts/{data_structures => data_structure}/LibBytesMap.sol (100%) rename contracts/{data_structures => data_structure}/LibDeque.sol (100%) rename contracts/{data_structures => data_structure}/LibLinkedList.sol (100%) rename contracts/{data_structures => data_structure}/LibMaxHeapUint256.sol (100%) rename contracts/{data_structures => data_structure}/LibMinHeapUint256.sol (100%) rename contracts/{data_structures => data_structure}/LibQueue.sol (100%) rename contracts/{data_structures => data_structure}/LibStack.sol (100%) diff --git a/contracts/types/LibAddress.sol b/contracts/base_type/LibAddress.sol similarity index 100% rename from contracts/types/LibAddress.sol rename to contracts/base_type/LibAddress.sol diff --git a/contracts/types/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol similarity index 100% rename from contracts/types/LibArrayForUint256Utils.sol rename to contracts/base_type/LibArrayForUint256Utils.sol diff --git a/contracts/types/LibConverter.sol b/contracts/base_type/LibConverter.sol similarity index 100% rename from contracts/types/LibConverter.sol rename to contracts/base_type/LibConverter.sol diff --git a/contracts/types/LibSafeMathForUint256Utils.sol b/contracts/base_type/LibSafeMathForUint256Utils.sol similarity index 100% rename from contracts/types/LibSafeMathForUint256Utils.sol rename to contracts/base_type/LibSafeMathForUint256Utils.sol diff --git a/contracts/types/LibString.sol b/contracts/base_type/LibString.sol similarity index 100% rename from contracts/types/LibString.sol rename to contracts/base_type/LibString.sol diff --git a/contracts/data_structures/LibAddressSet.sol b/contracts/data_structure/LibAddressSet.sol similarity index 100% rename from contracts/data_structures/LibAddressSet.sol rename to contracts/data_structure/LibAddressSet.sol diff --git a/contracts/data_structures/LibBytes32Set.sol b/contracts/data_structure/LibBytes32Set.sol similarity index 100% rename from contracts/data_structures/LibBytes32Set.sol rename to contracts/data_structure/LibBytes32Set.sol diff --git a/contracts/data_structures/LibBytesMap.sol b/contracts/data_structure/LibBytesMap.sol similarity index 100% rename from contracts/data_structures/LibBytesMap.sol rename to contracts/data_structure/LibBytesMap.sol diff --git a/contracts/data_structures/LibDeque.sol b/contracts/data_structure/LibDeque.sol similarity index 100% rename from contracts/data_structures/LibDeque.sol rename to contracts/data_structure/LibDeque.sol diff --git a/contracts/data_structures/LibLinkedList.sol b/contracts/data_structure/LibLinkedList.sol similarity index 100% rename from contracts/data_structures/LibLinkedList.sol rename to contracts/data_structure/LibLinkedList.sol diff --git a/contracts/data_structures/LibMaxHeapUint256.sol b/contracts/data_structure/LibMaxHeapUint256.sol similarity index 100% rename from contracts/data_structures/LibMaxHeapUint256.sol rename to contracts/data_structure/LibMaxHeapUint256.sol diff --git a/contracts/data_structures/LibMinHeapUint256.sol b/contracts/data_structure/LibMinHeapUint256.sol similarity index 100% rename from contracts/data_structures/LibMinHeapUint256.sol rename to contracts/data_structure/LibMinHeapUint256.sol diff --git a/contracts/data_structures/LibQueue.sol b/contracts/data_structure/LibQueue.sol similarity index 100% rename from contracts/data_structures/LibQueue.sol rename to contracts/data_structure/LibQueue.sol diff --git a/contracts/data_structures/LibStack.sol b/contracts/data_structure/LibStack.sol similarity index 100% rename from contracts/data_structures/LibStack.sol rename to contracts/data_structure/LibStack.sol From 41bccf1c96604c1eb95dd5efb66bc1e03a9d04bb Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 12:07:28 +0800 Subject: [PATCH 05/23] . --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9a7b6805..505c343b 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## 文档s - [**中文**](https://toolkit-doc.readthedocs.io/zh_CN/latest/docs/WeBankBlockchain-Toolkit-Contract/index.html) -## 贡献代码vv +## 贡献代码 欢迎参与本项目的社区建设: - 如项目对您有帮助,欢迎点亮我们的小星星(点击项目左上方Star按钮)。 - 欢迎提交代码(Pull requests)。 From c3b08c84c623751f16ff38c7d839c1d274a62f8f Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 18:31:25 +0800 Subject: [PATCH 06/23] make it compile for 0.6.10 --- contracts/base_type/LibAddress.sol | 35 +++----- .../base_type/LibArrayForUint256Utils.sol | 33 ++----- contracts/base_type/LibConverter.sol | 51 ++--------- .../base_type/LibSafeMathForUint256Utils.sol | 17 +--- contracts/base_type/LibString.sol | 87 +++++++------------ .../biz_template/Evidence/Authentication.sol | 2 +- .../{Evidence.sol => EvidenceController.sol} | 6 +- .../Evidence/EvidenceRepository.sol | 2 +- .../Evidence/RequestRepository.sol | 6 +- contracts/biz_template/RewardPoint/Admin.sol | 2 +- .../biz_template/RewardPoint/BasicAuth.sol | 2 +- .../biz_template/RewardPoint/IssuerRole.sol | 2 +- .../biz_template/RewardPoint/LibRoles.sol | 2 +- .../biz_template/RewardPoint/LibSafeMath.sol | 2 +- .../RewardPoint/RewardPointController.sol | 2 +- .../RewardPoint/RewardPointData.sol | 2 +- contracts/data_structure/LibAddressSet.sol | 9 +- contracts/data_structure/LibBytes32Set.sol | 0 contracts/data_structure/LibBytesMap.sol | 8 +- contracts/data_structure/LibDeque.sol | 6 +- contracts/data_structure/LibLinkedList.sol | 6 +- .../data_structure/LibMaxHeapUint256.sol | 5 +- .../data_structure/LibMinHeapUint256.sol | 6 +- contracts/data_structure/LibQueue.sol | 2 +- contracts/data_structure/LibStack.sol | 4 +- 25 files changed, 93 insertions(+), 206 deletions(-) rename contracts/biz_template/Evidence/{Evidence.sol => EvidenceController.sol} (90%) delete mode 100644 contracts/data_structure/LibBytes32Set.sol diff --git a/contracts/base_type/LibAddress.sol b/contracts/base_type/LibAddress.sol index aa41b232..110b6b9a 100644 --- a/contracts/base_type/LibAddress.sol +++ b/contracts/base_type/LibAddress.sol @@ -1,20 +1,5 @@ -/* - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibAddress{ @@ -25,7 +10,7 @@ library LibAddress{ */ function isContract(address account) internal view returns(bool) { uint256 size; - assembly { size := extcodesize(addr) } + assembly { size := extcodesize(account) } return size> 0; } @@ -42,14 +27,14 @@ library LibAddress{ } return rtn; } + - - function bytesToAddress(bytes addrBytes) internal pure returns (address){ - require(isAddressType(addrBytes)); + function bytesToAddress(bytes memory addrBytes) internal pure returns (address){ + require(addrBytes.length == 20); //Convert binary to uint160 uint160 intVal = 0; - intVal += uint8(addrBytes[0]); - for(uint8 i=1;i<20;i++){ + + for(uint8 i=0;i<20;i++){ intVal <<= 8; intVal += uint8(addrBytes[i]); } @@ -57,7 +42,7 @@ library LibAddress{ } - function addressToString(address addr) internal pure returns(string){ + function addressToString(address addr) internal pure returns(string memory){ //Convert addr to bytes bytes20 value = bytes20(uint160(addr)); bytes memory strBytes = new bytes(42); @@ -67,13 +52,13 @@ library LibAddress{ //Encode bytes usig hex encoding for(uint i=0;i<20;i++){ uint8 byteValue = uint8(value[i]); - strBytes[2 + (i<<1)] = encode(byteValue>> 4); + strBytes[2 + (i<<1)] = encode((byteValue>> 4) & 0x0f); strBytes[3 + (i<<1)] = encode(byteValue & 0x0f); } return string(strBytes); } - function stringToAddress(string data) internal returns(address){ + function stringToAddress(string memory data) internal returns(address){ bytes memory strBytes = bytes(data); require(strBytes.length>= 39 && strBytes.length <= 42, "Not hex string"); //Skip prefix diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index c52ec784..3e2504e3 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -1,20 +1,4 @@ -/* - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * */ - -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibSafeMathForUint256Utils.sol"; @@ -75,7 +59,7 @@ library LibArrayForUint256Utils { } } - function equals(uint256[] a, uint256[] b) internal pure returns (bool){ + function equals(uint256[] storage a, uint256[] storage b) internal view returns (bool){ if(a.length != b.length){ return false; } @@ -94,7 +78,7 @@ library LibArrayForUint256Utils { array[index] = array[index + 1]; index++; } - array.length--; + array.pop(); } function removeByValue(uint256[] storage array, uint256 value) internal{ @@ -128,23 +112,22 @@ library LibArrayForUint256Utils { uint index; for (uint i = 0; i < array.length; i++) { (contains, index) = indexOf(array, array[i]); - if (i> index) { - for (uint j = i; j < array.length - 1; j++){ + if (contains && index> i) { + for (uint j = index; j < array.length - 1; j++){ array[j] = array[j + 1]; } - delete array[array.length - 1]; - array.length--; + array.pop(); i--; } } length = array.length; } - function qsort(uint256[] storage array) internal view { + function qsort(uint256[] storage array) internal { qsort(array, 0, array.length-1); } - function qsort(uint256[] storage array, uint256 begin, uint256 end) private view{ + function qsort(uint256[] storage array, uint256 begin, uint256 end) private { if(end <= begin){ return; } diff --git a/contracts/base_type/LibConverter.sol b/contracts/base_type/LibConverter.sol index fa7a90e5..92ab41c7 100644 --- a/contracts/base_type/LibConverter.sol +++ b/contracts/base_type/LibConverter.sol @@ -1,40 +1,5 @@ -/* -# Copyright (C) 2017 alianse777 +pragma solidity ^0.6.10; -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see . -*/ - -pragma solidity ^0.4.25; - - -/** - * @dev Wrappers over Solidity's uintXX casting operators with added overflow - * checks. - * - * Downcasting from uint256 in Solidity does not revert on overflow. This can - * easily result in undesired exploitation or bugs, since developers usually - * assume that overflows raise errors. `SafeCast` restores this intuition by - * reverting the transaction when such an operation overflows. - * - * Using this library instead of the unchecked operations eliminates an entire - * class of bugs, so it's recommended to use it always. - * - * Can be combined with {SafeMath} to extend it to smaller types, by performing - * all math on `uint256` and then downcasting. - * - * _Available since v2.5.0._ - */ library LibConverter { /** @@ -117,12 +82,12 @@ library LibConverter { * @param v - uint to convert. * @return bytes. */ - function uintToBytes(uint v) internal pure returns (bytes) { + function uintToBytes(uint v) internal pure returns (bytes memory) { uint maxlength = 100; bytes memory reversed = new bytes(maxlength); uint i = 0; while (v != 0) { - uint remainder = v % 10; + uint8 remainder = uint8(v % 10); v = v / 10; reversed[i % maxlength] = byte(48 + remainder); i++; @@ -135,7 +100,7 @@ library LibConverter { } - function bytesToInt(bytes b) internal pure returns (int result) { + function bytesToInt(bytes memory b) internal pure returns (int result) { uint i = 0; uint tr = 0; result = 0; @@ -146,11 +111,11 @@ library LibConverter { } else if(b[i] == "+") { i++; } - while(uint(b[b.length - tr - 1]) == 0x00) { + while(uint8(b[b.length - tr - 1]) == 0x00) { tr++; } for (;i < b.length - tr; i++) { - uint c = uint(b[i]); + uint8 c = uint8(b[i]); if (c>= 48 && c <= 57) { result *= 10; result = result + int(c - 48); @@ -161,7 +126,7 @@ library LibConverter { } } - function intToBytes(int v) internal pure returns (bytes) { + function intToBytes(int v) internal pure returns (bytes memory) { uint maxlength = 100; bytes memory reversed = new bytes(maxlength); uint i = 0; @@ -171,7 +136,7 @@ library LibConverter { else x = uint(v); while (x != 0) { - uint remainder = uint(x % 10); + uint8 remainder = uint8(x % 10); x = x / 10; reversed[i % maxlength] = byte(48 + remainder); i++; diff --git a/contracts/base_type/LibSafeMathForUint256Utils.sol b/contracts/base_type/LibSafeMathForUint256Utils.sol index 339c5c54..dc39af05 100644 --- a/contracts/base_type/LibSafeMathForUint256Utils.sol +++ b/contracts/base_type/LibSafeMathForUint256Utils.sol @@ -1,20 +1,5 @@ -/* - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibSafeMathForUint256Utils { diff --git a/contracts/base_type/LibString.sol b/contracts/base_type/LibString.sol index 381af818..e0adf4e6 100644 --- a/contracts/base_type/LibString.sol +++ b/contracts/base_type/LibString.sol @@ -1,25 +1,9 @@ -/* - * Copyright 2014-2019 the original author or authors. - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - * */ - -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibString{ - function lenOfChars(string src) internal pure returns(uint){ + function lenOfChars(string memory src) internal pure returns(uint){ uint i=0; uint length = 0; bytes memory string_rep = bytes(src); @@ -32,13 +16,13 @@ library LibString{ return length; } - function lenOfBytes(string src) internal pure returns(uint){ + function lenOfBytes(string memory src) internal pure returns(uint){ bytes memory srcb = bytes(src); return srcb.length; } - function startWith(string src, string prefix) internal pure returns(bool){ + function startWith(string memory src, string memory prefix) internal pure returns(bool){ bytes memory src_rep = bytes(src); bytes memory prefix_rep = bytes(prefix); @@ -54,7 +38,7 @@ library LibString{ return true; } - function endWith(string src, string tail) internal pure returns(bool){ + function endWith(string memory src, string memory tail) internal pure returns(bool){ bytes memory src_rep = bytes(src); bytes memory tail_rep = bytes(tail); @@ -71,7 +55,7 @@ library LibString{ } - function equal(string self, string other) internal pure returns(bool){ + function equal(string memory self, string memory other) internal pure returns(bool){ bytes memory self_rep = bytes(self); bytes memory other_rep = bytes(other); @@ -85,23 +69,23 @@ library LibString{ return true; } - function equalNocase(string self, string other) internal pure returns(bool){ + function equalNocase(string memory self, string memory other) internal pure returns(bool){ return compareNocase(self, other) == 0; } - function empty(string src) internal pure returns(bool){ + function empty(string memory src) internal pure returns(bool){ bytes memory src_rep = bytes(src); if(src_rep.length == 0) return true; for(uint i=0;i= 'a' && b <= 'z'){ - b &= ~0x20; - srcb[i] = b; + b &= byte(0xDF);// -32 + srcb[i] = b ; } } return src; } - function toLowercase(string src) internal pure returns(string){ + function toLowercase(string memory src) internal pure returns(string memory){ bytes memory srcb = bytes(src); for(uint i=0;i>7==0) + function utf8CharBytesLength(bytes memory stringRep, uint ptr) internal pure returns(uint){ + + if ((stringRep[ptr]>>7)==byte(0)) return 1; - if (stringRep[ptr]>>5==0x6) + if ((stringRep[ptr]>>5)==byte(0x06)) return 2; - if (stringRep[ptr]>>4==0xE) + if ((stringRep[ptr]>>4)==byte(0x0e)) return 3; - if (stringRep[ptr]>>3==0x1E) + if ((stringRep[ptr]>>3)==byte(0x1e)) return 4; return 1; } diff --git a/contracts/biz_template/Evidence/Authentication.sol b/contracts/biz_template/Evidence/Authentication.sol index b9037412..434de4c6 100644 --- a/contracts/biz_template/Evidence/Authentication.sol +++ b/contracts/biz_template/Evidence/Authentication.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; contract Authentication{ address public _owner; diff --git a/contracts/biz_template/Evidence/Evidence.sol b/contracts/biz_template/Evidence/EvidenceController.sol similarity index 90% rename from contracts/biz_template/Evidence/Evidence.sol rename to contracts/biz_template/Evidence/EvidenceController.sol index 63e4f39f..896ef444 100644 --- a/contracts/biz_template/Evidence/Evidence.sol +++ b/contracts/biz_template/Evidence/EvidenceController.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./RequestRepository.sol"; import "./EvidenceRepository.sol"; @@ -11,7 +11,7 @@ contract EvidenceController{ event VoteSaveRequest(bytes32 indexed hash, address voter, bool complete); event EvidenceSaved(bytes32 indexed hash); - constructor(uint8 threshold, address[] voterArray) public{ + constructor(uint8 threshold, address[] memory voterArray) public{ _requestRepo = new RequestRepository(threshold, voterArray); _evidenceRepo = new EvidenceRepository(); } @@ -21,7 +21,7 @@ contract EvidenceController{ _; } - function createSaveRequest(bytes32 hash, bytes ext) public validateHash(hash){ + function createSaveRequest(bytes32 hash, bytes memory ext) public validateHash(hash){ _requestRepo.createSaveRequest(hash, msg.sender, ext); emit CreateSaveRequest(hash, msg.sender); } diff --git a/contracts/biz_template/Evidence/EvidenceRepository.sol b/contracts/biz_template/Evidence/EvidenceRepository.sol index ee148363..fa4002d3 100644 --- a/contracts/biz_template/Evidence/EvidenceRepository.sol +++ b/contracts/biz_template/Evidence/EvidenceRepository.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./Authentication.sol"; contract EvidenceRepository is Authentication { diff --git a/contracts/biz_template/Evidence/RequestRepository.sol b/contracts/biz_template/Evidence/RequestRepository.sol index c4792e2c..f56a16d5 100644 --- a/contracts/biz_template/Evidence/RequestRepository.sol +++ b/contracts/biz_template/Evidence/RequestRepository.sol @@ -1,4 +1,4 @@ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./Authentication.sol"; @@ -14,14 +14,14 @@ contract RequestRepository is Authentication{ mapping(bytes32=>SaveRequest) private _saveRequests; mapping(address=>bool) private _voters; - constructor(uint8 threshold, address[] voterArray) public{ + constructor(uint8 threshold, address[] memory voterArray) public{ _threshold = threshold; for(uint i=0;i index); bytes memory key = map.keys[index - 1]; return key; } - function getValue(Map storage map, bytes key) internal view returns(bytes){ + function getValue(Map storage map, bytes memory key) internal view returns(bytes memory){ uint256 idx = map.index[key]; bytes memory value = map.values[idx - 1]; return value; diff --git a/contracts/data_structure/LibDeque.sol b/contracts/data_structure/LibDeque.sol index 94a7bccc..51cef40f 100644 --- a/contracts/data_structure/LibDeque.sol +++ b/contracts/data_structure/LibDeque.sol @@ -1,4 +1,5 @@ -/* + +/* * Copyright 2014-2019 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -14,11 +15,10 @@ * limitations under the License. * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; /** * Doubly ended queue - * @author aaronchu * */ library LibDeque{ diff --git a/contracts/data_structure/LibLinkedList.sol b/contracts/data_structure/LibLinkedList.sol index 6ca64ee8..af8db9a6 100644 --- a/contracts/data_structure/LibLinkedList.sol +++ b/contracts/data_structure/LibLinkedList.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibLinkedList { @@ -40,7 +40,7 @@ library LibLinkedList { return self.size; } - function addNode(LinkedList storage self, bytes32 data) internal returns(LinkedList) { + function addNode(LinkedList storage self, bytes32 data) internal returns(LinkedList storage) { require(data != bytes32(0)); require(!self.indexs[data].exist); if(self.size == 0){ @@ -74,7 +74,7 @@ library LibLinkedList { } - function removeNode(LinkedList storage self, bytes32 data) internal returns(LinkedList){ + function removeNode(LinkedList storage self, bytes32 data) internal returns(LinkedList storage){ Node storage node = extractNode(self, data); require(node.exist); Node storage prev = extractNode(self, node.prev); diff --git a/contracts/data_structure/LibMaxHeapUint256.sol b/contracts/data_structure/LibMaxHeapUint256.sol index ebfa532d..011ebaff 100644 --- a/contracts/data_structure/LibMaxHeapUint256.sol +++ b/contracts/data_structure/LibMaxHeapUint256.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibMaxHeapUint256{ @@ -48,8 +48,7 @@ library LibMaxHeapUint256{ require(heap.data.length> 0); top = heap.data[0]; uint256 last = heap.data[heap.data.length - 1]; - heap.data.length--; - if(heap.data.length == 0) return; + heap.data.pop(); heap.data[0] = last; uint256 index = 0; diff --git a/contracts/data_structure/LibMinHeapUint256.sol b/contracts/data_structure/LibMinHeapUint256.sol index 06bb3002..7d52a68b 100644 --- a/contracts/data_structure/LibMinHeapUint256.sol +++ b/contracts/data_structure/LibMinHeapUint256.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibMinHeapUint256{ @@ -48,8 +48,8 @@ library LibMinHeapUint256{ require(heap.data.length> 0); top = heap.data[0]; uint256 last = heap.data[heap.data.length - 1]; - heap.data.length--; - if(heap.data.length == 0) return; + heap.data.pop(); + heap.data[0] = last; uint256 index = 0; diff --git a/contracts/data_structure/LibQueue.sol b/contracts/data_structure/LibQueue.sol index 38fa85d3..82fddc05 100644 --- a/contracts/data_structure/LibQueue.sol +++ b/contracts/data_structure/LibQueue.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibQueue{ diff --git a/contracts/data_structure/LibStack.sol b/contracts/data_structure/LibStack.sol index bbf5f730..86b6adf4 100644 --- a/contracts/data_structure/LibStack.sol +++ b/contracts/data_structure/LibStack.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; library LibStack{ @@ -31,7 +31,7 @@ library LibStack{ function pop(Stack storage self) internal returns(bytes32){ require(self.datas.length> 0); bytes32 data = self.datas[self.datas.length - 1]; - self.datas.length--; + self.datas.pop(); return data; } From 9d2f9470fda4c3e309e9fb9925317bd80400a106 Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 19:18:49 +0800 Subject: [PATCH 07/23] . --- contracts/base_type/LibAddress.sol | 17 +++- .../base_type/LibArrayForUint256Utils.sol | 34 ++++--- contracts/base_type/LibConverter.sol | 16 +++ .../base_type/LibSafeMathForUint256Utils.sol | 17 +++- contracts/base_type/LibString.sol | 16 +++ .../biz_template/Evidence/Authentication.sol | 16 +++ .../Evidence/EvidenceController.sol | 17 ++++ .../Evidence/EvidenceRepository.sol | 16 +++ .../Evidence/RequestRepository.sol | 16 +++ contracts/biz_template/RewardPoint/Admin.sol | 16 +++ .../biz_template/RewardPoint/BasicAuth.sol | 16 +++ .../biz_template/RewardPoint/IssuerRole.sol | 16 +++ .../biz_template/RewardPoint/LibRoles.sol | 16 +++ .../biz_template/RewardPoint/LibSafeMath.sol | 16 +++ .../RewardPoint/RewardPointController.sol | 16 +++ .../RewardPoint/RewardPointData.sol | 16 +++ contracts/default/Crypto.sol | 7 ++ contracts/default/HelloWorld.sol | 17 ++++ contracts/default/KVTableTest.sol | 49 ++++++++++ contracts/default/ShaTest.sol | 29 ++++++ contracts/default/Table.sol | 67 +++++++++++++ contracts/default/TableTest.sol | 98 +++++++++++++++++++ 22 files changed, 531 insertions(+), 13 deletions(-) create mode 100644 contracts/default/Crypto.sol create mode 100644 contracts/default/HelloWorld.sol create mode 100644 contracts/default/KVTableTest.sol create mode 100644 contracts/default/ShaTest.sol create mode 100644 contracts/default/Table.sol create mode 100644 contracts/default/TableTest.sol diff --git a/contracts/base_type/LibAddress.sol b/contracts/base_type/LibAddress.sol index 110b6b9a..bb8af16b 100644 --- a/contracts/base_type/LibAddress.sol +++ b/contracts/base_type/LibAddress.sol @@ -1,4 +1,19 @@ - +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + pragma solidity ^0.6.10; library LibAddress{ diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index 3e2504e3..cf38a254 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -1,3 +1,19 @@ +/* + * Copyright 2014-2019 the original author or authors. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * */ + pragma solidity ^0.6.10; import "./LibSafeMathForUint256Utils.sol"; @@ -36,7 +52,7 @@ library LibArrayForUint256Utils { return (false, 0); } - function indexOf(uint256[] storage array, uint256 key) internal view returns (bool, uint256) { + function firstIndexOf(uint256[] storage array, uint256 key) internal view returns (bool, uint256) { if(array.length == 0){ return (false, 0); @@ -84,7 +100,7 @@ library LibArrayForUint256Utils { function removeByValue(uint256[] storage array, uint256 value) internal{ uint index; bool isIn; - (isIn, index) = indexOf(array, value); + (isIn, index) = firstIndexOf(array, value); if(isIn){ removeByIndex(array, index); } @@ -93,7 +109,7 @@ library LibArrayForUint256Utils { function addValue(uint256[] storage array, uint256 value) internal{ uint index; bool isIn; - (isIn, index) = indexOf(array, value); + (isIn, index) = firstIndexOf(array, value); if(!isIn){ array.push(value); } @@ -111,7 +127,7 @@ library LibArrayForUint256Utils { bool contains; uint index; for (uint i = 0; i < array.length; i++) { - (contains, index) = indexOf(array, array[i]); + (contains, index) = firstIndexOf(array, array[i]); if (contains && index> i) { for (uint j = index; j < array.length - 1; j++){ array[j] = array[j + 1]; @@ -128,17 +144,13 @@ library LibArrayForUint256Utils { } function qsort(uint256[] storage array, uint256 begin, uint256 end) private { - if(end <= begin){ - return; - } - uint256 pivot = array[begin]; - array[begin] = array[end]; - array[end] = pivot; + if(start>= end) return; + uint256 pivot = array[end]; uint256 store = begin; uint256 i = begin; for(;i=0.4.24 <0.6.11; + +contract HelloWorld { + string name; + + constructor() public { + name = "Hello, World!"; + } + + function get() public view returns (string memory) { + return name; + } + + function set(string memory n) public { + name = n; + } +} \ No newline at end of file diff --git a/contracts/default/KVTableTest.sol b/contracts/default/KVTableTest.sol new file mode 100644 index 00000000..35b5d567 --- /dev/null +++ b/contracts/default/KVTableTest.sol @@ -0,0 +1,49 @@ +pragma solidity>=0.4.24 <0.6.11; + +import "./Table.sol"; + +contract KVTableTest { + event SetResult(int256 count); + + KVTableFactory tableFactory; + string constant TABLE_NAME = "t_kvtest"; + + constructor() public { + //The fixed address is 0x1010 for KVTableFactory + tableFactory = KVTableFactory(0x1010); + // the parameters of createTable are tableName,keyField,"vlaueFiled1,vlaueFiled2,vlaueFiled3,..." + tableFactory.createTable(TABLE_NAME, "id", "item_price,item_name"); + } + + //get record + function get(string memory id) public view returns (bool, int256, string memory) { + KVTable table = tableFactory.openTable(TABLE_NAME); + bool ok = false; + Entry entry; + (ok, entry) = table.get(id); + int256 item_price; + string memory item_name; + if (ok) { + item_price = entry.getInt("item_price"); + item_name = entry.getString("item_name"); + } + return (ok, item_price, item_name); + } + + //set record + function set(string memory id, int256 item_price, string memory item_name) + public + returns (int256) + { + KVTable table = tableFactory.openTable(TABLE_NAME); + Entry entry = table.newEntry(); + // the length of entry's field value should < 16MB + entry.set("id", id); + entry.set("item_price", item_price); + entry.set("item_name", item_name); + // the first parameter length of set should <= 255B + int256 count = table.set(id, entry); + emit SetResult(count); + return count; + } +} \ No newline at end of file diff --git a/contracts/default/ShaTest.sol b/contracts/default/ShaTest.sol new file mode 100644 index 00000000..7aeb24db --- /dev/null +++ b/contracts/default/ShaTest.sol @@ -0,0 +1,29 @@ +pragma solidity>=0.4.24 <0.6.11; + +pragma experimental ABIEncoderV2; + +import "./Crypto.sol"; + +contract ShaTest{ + bytes _data = "Hello, ShaTest"; + Crypto crypto; + + constructor() public { + crypto = Crypto(0x5006); + } + + function getSha256(bytes memory _memory) public returns(bytes32 result) + { + return sha256(_memory); + } + + function getKeccak256(bytes memory _memory) public returns(bytes32 result) + { + return keccak256(_memory); + } + + function getData() public view returns(bytes memory) + { + return _data; + } +} diff --git a/contracts/default/Table.sol b/contracts/default/Table.sol new file mode 100644 index 00000000..adaac40a --- /dev/null +++ b/contracts/default/Table.sol @@ -0,0 +1,67 @@ + +contract TableFactory { + function openTable(string memory) public view returns (Table) {} //open table + function createTable(string memory, string memory, string memory) public returns (int256) {} //create table +} + +//select condition +contract Condition { + function EQ(string memory, int256) public view{} + function EQ(string memory, string memory) public view{} + + function NE(string memory, int256) public view{} + function NE(string memory, string memory) public view{} + + function GT(string memory, int256) public view{} + function GE(string memory, int256) public view{} + + function LT(string memory, int256) public view{} + function LE(string memory, int256) public view{} + + function limit(int256) public view{} + function limit(int256, int256) public view{} +} + +//one record +contract Entry { + function getInt(string memory) public view returns (int256) {} + function getUInt(string memory) public view returns (uint256) {} + function getAddress(string memory) public view returns (address) {} + function getBytes64(string memory) public view returns (bytes1[64] memory) {} + function getBytes32(string memory) public view returns (bytes32) {} + function getString(string memory) public view returns (string memory) {} + + function set(string memory, int256) public {} + function set(string memory, uint256) public {} + function set(string memory, string memory) public {} + function set(string memory, address) public {} +} + +//record sets +contract Entries { + function get(int256) public view returns (Entry) {} + function size() public view returns (int256) {} +} + +//Table main contract +contract Table { + function select(string memory, Condition) public view returns (Entries) {} + function insert(string memory, Entry) public returns (int256) {} + function update(string memory, Entry, Condition) public returns (int256) {} + function remove(string memory, Condition) public returns (int256) {} + + function newEntry() public view returns (Entry) {} + function newCondition() public view returns (Condition) {} +} + +contract KVTableFactory { + function openTable(string memory) public view returns (KVTable) {} + function createTable(string memory, string memory, string memory) public returns (int256) {} +} + +//KVTable per permiary key has only one Entry +contract KVTable { + function get(string memory) public view returns (bool, Entry) {} + function set(string memory, Entry) public returns (int256) {} + function newEntry() public view returns (Entry) {} +} diff --git a/contracts/default/TableTest.sol b/contracts/default/TableTest.sol new file mode 100644 index 00000000..e21bd21f --- /dev/null +++ b/contracts/default/TableTest.sol @@ -0,0 +1,98 @@ +pragma solidity>=0.4.24 <0.6.11; +pragma experimental ABIEncoderV2; + +import "./Table.sol"; + +contract TableTest { + event CreateResult(int256 count); + event InsertResult(int256 count); + event UpdateResult(int256 count); + event RemoveResult(int256 count); + + TableFactory tableFactory; + string constant TABLE_NAME = "t_test"; + constructor() public { + tableFactory = TableFactory(0x1001); //The fixed address is 0x1001 for TableFactory + // the parameters of createTable are tableName,keyField,"vlaueFiled1,vlaueFiled2,vlaueFiled3,..." + tableFactory.createTable(TABLE_NAME, "name", "item_id,item_name"); + } + + //select records + function select(string memory name) + public + view + returns (string[] memory, int256[] memory, string[] memory) + { + Table table = tableFactory.openTable(TABLE_NAME); + + Condition condition = table.newCondition(); + + Entries entries = table.select(name, condition); + string[] memory user_name_bytes_list = new string[]( + uint256(entries.size()) + ); + int256[] memory item_id_list = new int256[](uint256(entries.size())); + string[] memory item_name_bytes_list = new string[]( + uint256(entries.size()) + ); + + for (int256 i = 0; i < entries.size(); ++i) { + Entry entry = entries.get(i); + + user_name_bytes_list[uint256(i)] = entry.getString("name"); + item_id_list[uint256(i)] = entry.getInt("item_id"); + item_name_bytes_list[uint256(i)] = entry.getString("item_name"); + } + + return (user_name_bytes_list, item_id_list, item_name_bytes_list); + } + //insert records + function insert(string memory name, int256 item_id, string memory item_name) + public + returns (int256) + { + Table table = tableFactory.openTable(TABLE_NAME); + + Entry entry = table.newEntry(); + entry.set("name", name); + entry.set("item_id", item_id); + entry.set("item_name", item_name); + + int256 count = table.insert(name, entry); + emit InsertResult(count); + + return count; + } + //update records + function update(string memory name, int256 item_id, string memory item_name) + public + returns (int256) + { + Table table = tableFactory.openTable(TABLE_NAME); + + Entry entry = table.newEntry(); + entry.set("item_name", item_name); + + Condition condition = table.newCondition(); + condition.EQ("name", name); + condition.EQ("item_id", item_id); + + int256 count = table.update(name, entry, condition); + emit UpdateResult(count); + + return count; + } + //remove records + function remove(string memory name, int256 item_id) public returns (int256) { + Table table = tableFactory.openTable(TABLE_NAME); + + Condition condition = table.newCondition(); + condition.EQ("name", name); + condition.EQ("item_id", item_id); + + int256 count = table.remove(name, condition); + emit RemoveResult(count); + + return count; + } +} From 2a5d205915e4f618f3ac1e74d0abadfc18763b2c Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月28日 19:45:34 +0800 Subject: [PATCH 08/23] . --- contracts/base_type/LibArrayForUint256Utils.sol | 10 +++++----- contracts/data_structure/LibQueue.sol | 11 +++++------ 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index cf38a254..ae8314c5 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -36,14 +36,14 @@ library LibArrayForUint256Utils { } uint256 low = 0; - uint256 high = array.length; + uint256 high = array.length-1; - while(low < high){ + while(low <= high){ uint256 mid = LibSafeMathForUint256Utils.average(low, high); if(array[mid] == key){ return (true, mid); }else if (array[mid]> key) { - high = mid; + high = mid - 1; } else { low = mid + 1; } @@ -116,7 +116,7 @@ library LibArrayForUint256Utils { } function extend(uint256[] storage a, uint256[] storage b) internal { - if(!(b.length == 0)){ + if(b.length != 0){ for(uint i = 0; i < b.length; i++){ a.push(b[i]); } @@ -144,7 +144,7 @@ library LibArrayForUint256Utils { } function qsort(uint256[] storage array, uint256 begin, uint256 end) private { - if(start>= end) return; + if(begin>= end) return; uint256 pivot = array[end]; uint256 store = begin; diff --git a/contracts/data_structure/LibQueue.sol b/contracts/data_structure/LibQueue.sol index 82fddc05..748570f3 100644 --- a/contracts/data_structure/LibQueue.sol +++ b/contracts/data_structure/LibQueue.sol @@ -21,19 +21,18 @@ library LibQueue{ struct Queue{ uint256 first; - uint256 last; + uint256 next; mapping(uint => bytes32) queue; } function enqueue(Queue storage queue, bytes32 data) public { - queue.last++; - queue.queue[queue.last] = data; + queue.queue[queue.next++] = data; } function dequeue(Queue storage queue) public returns (bytes32) { uint256 first = queue.first; - require(queue.last>= first); // non-empty queue + require(queue.next> first); // non-empty queue bytes32 data = queue.queue[first]; delete queue.queue[first]; @@ -43,13 +42,13 @@ library LibQueue{ function element(Queue storage queue) public view returns (bytes32) { uint256 first = queue.first; - require(queue.last>= first); // non-empty queue + require(queue.next> first); // non-empty queue bytes32 data = queue.queue[first]; return data; } function getSize(Queue storage self) internal view returns(uint256){ - return self.last - self.first + 1; + return self.next - self.first; } } \ No newline at end of file From a59264fe2df7b9b04e0b226394890ec2a25b56ce Mon Sep 17 00:00:00 2001 From: masonhunk Date: 2021年1月28日 22:52:34 +0800 Subject: [PATCH 09/23] . --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 505c343b..677ea7a5 100644 --- a/README.md +++ b/README.md @@ -3,14 +3,14 @@ 智能合约库模板,涵盖了从基础类型到上层业务的常见代码,用户可根据实际需要进行参考、复用。 -## 文档s +## 文档 - [**中文**](https://toolkit-doc.readthedocs.io/zh_CN/latest/docs/WeBankBlockchain-Toolkit-Contract/index.html) ## 贡献代码 欢迎参与本项目的社区建设: - 如项目对您有帮助,欢迎点亮我们的小星星(点击项目左上方Star按钮)。 - 欢迎提交代码(Pull requests)。 -- [提问和提交BUG](https://github.com/WeBankBlockchain/Toolkit-Contrcat/issues)。 +- [提问和提交BUG](https://github.com/WeBankBlockchain/SmartDev-Contract/issues)。 - 如果发现代码存在安全漏洞,请在[这里](https://security.webank.com)上报。 From 449bdb3d57ac06db795a56e56ecd5a52bdf092cc Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月29日 11:28:59 +0800 Subject: [PATCH 10/23] . --- README.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 677ea7a5..8ddc1658 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,15 @@ # 组件介绍 -智能合约库模板,涵盖了从基础类型到上层业务的常见代码,用户可根据实际需要进行参考、复用。 +智能合约库模板,涵盖了从基础类型到上层业务的常见代码,用户可根据实际需要进行参考、复用。内部包含几个模块: +[](https://toolkit-doc.readthedocs.io/zh_CN/latest/_images/wescott.png) + +## 环境要求 + +| 依赖软件 | 说明 |备注| +| --- | --- | --- | +| Solidity |>= 0.6.10 | 需使用0.6.10版本编译| +| Git | 下载需要使用Git | | ## 文档 - [**中文**](https://toolkit-doc.readthedocs.io/zh_CN/latest/docs/WeBankBlockchain-Toolkit-Contract/index.html) From 006ef50e2cf090523b667887f853d339e3fe6095 Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月29日 11:43:34 +0800 Subject: [PATCH 11/23] . --- docs/data_structures/LibAddressSet.md | 4 +-- docs/data_structures/LibBytes32Set.md | 4 +-- docs/data_structures/LibBytesMap.md | 2 +- docs/data_structures/LibLinkedList.md | 2 +- docs/data_structures/LibMaxHeapUint256.md | 2 +- docs/data_structures/LibMinHeapUint256.md | 2 +- docs/data_structures/LibQueue.md | 2 +- docs/data_structures/LibStack.md | 2 +- docs/default/Crypto.md | 38 +++++++++++++++++++++++ docs/types/LibAddress.md | 2 +- docs/types/LibArrayForUint256Utils.md | 2 +- docs/types/LibConverter.md | 2 +- docs/types/LibSafeMathForUint256Utils.md | 2 +- docs/types/LibString.md | 2 +- 14 files changed, 53 insertions(+), 15 deletions(-) create mode 100644 docs/default/Crypto.md diff --git a/docs/data_structures/LibAddressSet.md b/docs/data_structures/LibAddressSet.md index 9bea4850..e25a5416 100644 --- a/docs/data_structures/LibAddressSet.md +++ b/docs/data_structures/LibAddressSet.md @@ -7,7 +7,7 @@ LibAddressSet 提供了存储Address类型的Set数据结构,支持包括add, 首先需要通过import引入LibAddressSet类库,然后通过"."进行方法调用,如下为调用LibAddressSet方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibAddressSet.sol"; @@ -53,7 +53,7 @@ contract TestSet { #### 实例 ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibAddressSet.sol"; diff --git a/docs/data_structures/LibBytes32Set.md b/docs/data_structures/LibBytes32Set.md index 37829f45..da8764dd 100644 --- a/docs/data_structures/LibBytes32Set.md +++ b/docs/data_structures/LibBytes32Set.md @@ -7,7 +7,7 @@ LibBytes32Set 提供了存储bytes32类型的Set数据结构,支持包括add, 首先需要通过import引入LibBytes32Set类库,然后通过"."进行方法调用,如下为调用LibBytes32Set方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibBytes32Set.sol"; @@ -53,7 +53,7 @@ contract TestSet { #### 实例 ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibBytes32Set.sol"; diff --git a/docs/data_structures/LibBytesMap.md b/docs/data_structures/LibBytesMap.md index f842b2bb..4dee8dd4 100644 --- a/docs/data_structures/LibBytesMap.md +++ b/docs/data_structures/LibBytesMap.md @@ -7,7 +7,7 @@ LibBytesMap提供了基于bytes的可迭代、可查询的映射. 首先需要通过import引入LibBytesMap类库,然后通过"."进行方法调用,如下为调用例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibBytesMap.sol"; diff --git a/docs/data_structures/LibLinkedList.md b/docs/data_structures/LibLinkedList.md index 1f3b410d..7a12eb5e 100644 --- a/docs/data_structures/LibLinkedList.md +++ b/docs/data_structures/LibLinkedList.md @@ -6,7 +6,7 @@ LibLinkedList提供了双向链表操作,包括链表更新、查询、迭代 首先需要通过import引入LibLinkedList类库,然后通过"."进行方法调用,如下为添加元素的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibLinkedList.sol"; contract Test { diff --git a/docs/data_structures/LibMaxHeapUint256.md b/docs/data_structures/LibMaxHeapUint256.md index 85c4771e..1e45ee7e 100644 --- a/docs/data_structures/LibMaxHeapUint256.md +++ b/docs/data_structures/LibMaxHeapUint256.md @@ -8,7 +8,7 @@ LibMaxHeapUint256提供了最大堆的实现。 ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibMaxHeapUint256.sol"; diff --git a/docs/data_structures/LibMinHeapUint256.md b/docs/data_structures/LibMinHeapUint256.md index 1a934199..639d93b6 100644 --- a/docs/data_structures/LibMinHeapUint256.md +++ b/docs/data_structures/LibMinHeapUint256.md @@ -8,7 +8,7 @@ LibMinHeapUint256提供了最小堆的实现。 ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibMinHeapUint256.sol"; diff --git a/docs/data_structures/LibQueue.md b/docs/data_structures/LibQueue.md index ef66d054..33337ec8 100644 --- a/docs/data_structures/LibQueue.md +++ b/docs/data_structures/LibQueue.md @@ -7,7 +7,7 @@ LibQueue提供了FIFO队列数据结构。 首先需要通过import引入LibQueue类库,然后通过"."进行方法调用,如下为调用LibQueue方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibQueue.sol"; diff --git a/docs/data_structures/LibStack.md b/docs/data_structures/LibStack.md index ff9113f8..0b5a7383 100644 --- a/docs/data_structures/LibStack.md +++ b/docs/data_structures/LibStack.md @@ -7,7 +7,7 @@ LibStack提供了栈数据结构。 首先需要通过import引入LibStack类库,然后通过"."进行方法调用,如下为调用LibStack方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibStack.sol"; diff --git a/docs/default/Crypto.md b/docs/default/Crypto.md new file mode 100644 index 00000000..4f01b404 --- /dev/null +++ b/docs/default/Crypto.md @@ -0,0 +1,38 @@ +# Crypto.sol + +Crypto提供了密码学操作 + +## 使用方法 + +``` +pragma solidity ^0.6.10; + +pragma experimental ABIEncoderV2; + +import "./Crypto.sol"; + +contract ShaTest{ + bytes _data = "Hello, ShaTest"; + Crypto crypto; + + constructor() public { + crypto = Crypto(0x5006); + } + + function getSha256(bytes memory _memory) public returns(bytes32 result) + { + return sha256(_memory); + } + + function getKeccak256(bytes memory _memory) public returns(bytes32 result) + { + return keccak256(_memory); + } + + function getData() public view returns(bytes memory) + { + return _data; + } +} + +``` \ No newline at end of file diff --git a/docs/types/LibAddress.md b/docs/types/LibAddress.md index 92341abd..18759deb 100644 --- a/docs/types/LibAddress.md +++ b/docs/types/LibAddress.md @@ -7,7 +7,7 @@ LibAddress提供了address数据类型的基本操作,相关API列表如下。 首先需要通过import引入LibAddresss类库,然后通过"."进行方法调用,如下为调用isEmptyAddress方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibAddress.sol" diff --git a/docs/types/LibArrayForUint256Utils.md b/docs/types/LibArrayForUint256Utils.md index e4853d38..610973fc 100644 --- a/docs/types/LibArrayForUint256Utils.md +++ b/docs/types/LibArrayForUint256Utils.md @@ -7,7 +7,7 @@ LibArrayForUint256Utils提供了Uint256数组的相关操作,包括查找、 首先需要通过import引LibArrayForUint256Utils类库,然后通过"."进行方法调用,如下为调用indexOf方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibArrayForUint256Utils.sol" diff --git a/docs/types/LibConverter.md b/docs/types/LibConverter.md index 5da08916..43a6522f 100644 --- a/docs/types/LibConverter.md +++ b/docs/types/LibConverter.md @@ -7,7 +7,7 @@ LibConverter提供各类solidity数据基本类型的转换,包括uint256转ui 首先需要通过import引入LibConverter类库,调用库的相关方法: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibConverter.sol" diff --git a/docs/types/LibSafeMathForUint256Utils.md b/docs/types/LibSafeMathForUint256Utils.md index 5cfb681f..1460517a 100644 --- a/docs/types/LibSafeMathForUint256Utils.md +++ b/docs/types/LibSafeMathForUint256Utils.md @@ -7,7 +7,7 @@ LibSafeMathForUint256Utils提供了Uint256类型的相关计算操作,且保 首先需要通过import引LibSafeMathForUint256Utils类库,然后通过"."进行方法调用,如下为调用add方法的例子: ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibSafeMathForUint256Utils.sol" diff --git a/docs/types/LibString.md b/docs/types/LibString.md index 4b9abcb6..f02e5c42 100644 --- a/docs/types/LibString.md +++ b/docs/types/LibString.md @@ -7,7 +7,7 @@ LibString提供了常用的字符串操作。这些操作是基于字符的, 首先需要通过import引入LibString类库, 以下为使用示例 ``` -pragma solidity ^0.4.25; +pragma solidity ^0.6.10; import "./LibString.sol"; From 70cba2d1936c74617bdac8b77d2dbe3654b2288d Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年1月29日 18:07:56 +0800 Subject: [PATCH 12/23] . --- .../Evidence/Authentication.sol | 0 .../Evidence/EvidenceController.sol | 0 .../Evidence/EvidenceRepository.sol | 0 .../Evidence/RequestRepository.sol | 0 .../{biz_template => business_template}/RewardPoint/Admin.sol | 0 .../{biz_template => business_template}/RewardPoint/BasicAuth.sol | 0 .../RewardPoint/IssuerRole.sol | 0 .../{biz_template => business_template}/RewardPoint/LibRoles.sol | 0 .../RewardPoint/LibSafeMath.sol | 0 .../RewardPoint/RewardPointController.sol | 0 .../RewardPoint/RewardPointData.sol | 0 docs/{biz_templates => business_template}/Evidence.md | 0 docs/{biz_templates => business_template}/RewardPoint.md | 0 docs/{data_structures => data_structure}/LibAddressSet.md | 0 docs/{data_structures => data_structure}/LibBytes32Set.md | 0 docs/{data_structures => data_structure}/LibBytesMap.md | 0 docs/{data_structures => data_structure}/LibDeque.md | 0 docs/{data_structures => data_structure}/LibLinkedList.md | 0 docs/{data_structures => data_structure}/LibMaxHeapUint256.md | 0 docs/{data_structures => data_structure}/LibMinHeapUint256.md | 0 docs/{data_structures => data_structure}/LibQueue.md | 0 docs/{data_structures => data_structure}/LibStack.md | 0 22 files changed, 0 insertions(+), 0 deletions(-) rename contracts/{biz_template => business_template}/Evidence/Authentication.sol (100%) rename contracts/{biz_template => business_template}/Evidence/EvidenceController.sol (100%) rename contracts/{biz_template => business_template}/Evidence/EvidenceRepository.sol (100%) rename contracts/{biz_template => business_template}/Evidence/RequestRepository.sol (100%) rename contracts/{biz_template => business_template}/RewardPoint/Admin.sol (100%) rename contracts/{biz_template => business_template}/RewardPoint/BasicAuth.sol (100%) rename contracts/{biz_template => business_template}/RewardPoint/IssuerRole.sol (100%) rename contracts/{biz_template => business_template}/RewardPoint/LibRoles.sol (100%) mode change 100755 => 100644 rename contracts/{biz_template => business_template}/RewardPoint/LibSafeMath.sol (100%) rename contracts/{biz_template => business_template}/RewardPoint/RewardPointController.sol (100%) rename contracts/{biz_template => business_template}/RewardPoint/RewardPointData.sol (100%) rename docs/{biz_templates => business_template}/Evidence.md (100%) rename docs/{biz_templates => business_template}/RewardPoint.md (100%) rename docs/{data_structures => data_structure}/LibAddressSet.md (100%) rename docs/{data_structures => data_structure}/LibBytes32Set.md (100%) rename docs/{data_structures => data_structure}/LibBytesMap.md (100%) rename docs/{data_structures => data_structure}/LibDeque.md (100%) rename docs/{data_structures => data_structure}/LibLinkedList.md (100%) rename docs/{data_structures => data_structure}/LibMaxHeapUint256.md (100%) rename docs/{data_structures => data_structure}/LibMinHeapUint256.md (100%) rename docs/{data_structures => data_structure}/LibQueue.md (100%) rename docs/{data_structures => data_structure}/LibStack.md (100%) diff --git a/contracts/biz_template/Evidence/Authentication.sol b/contracts/business_template/Evidence/Authentication.sol similarity index 100% rename from contracts/biz_template/Evidence/Authentication.sol rename to contracts/business_template/Evidence/Authentication.sol diff --git a/contracts/biz_template/Evidence/EvidenceController.sol b/contracts/business_template/Evidence/EvidenceController.sol similarity index 100% rename from contracts/biz_template/Evidence/EvidenceController.sol rename to contracts/business_template/Evidence/EvidenceController.sol diff --git a/contracts/biz_template/Evidence/EvidenceRepository.sol b/contracts/business_template/Evidence/EvidenceRepository.sol similarity index 100% rename from contracts/biz_template/Evidence/EvidenceRepository.sol rename to contracts/business_template/Evidence/EvidenceRepository.sol diff --git a/contracts/biz_template/Evidence/RequestRepository.sol b/contracts/business_template/Evidence/RequestRepository.sol similarity index 100% rename from contracts/biz_template/Evidence/RequestRepository.sol rename to contracts/business_template/Evidence/RequestRepository.sol diff --git a/contracts/biz_template/RewardPoint/Admin.sol b/contracts/business_template/RewardPoint/Admin.sol similarity index 100% rename from contracts/biz_template/RewardPoint/Admin.sol rename to contracts/business_template/RewardPoint/Admin.sol diff --git a/contracts/biz_template/RewardPoint/BasicAuth.sol b/contracts/business_template/RewardPoint/BasicAuth.sol similarity index 100% rename from contracts/biz_template/RewardPoint/BasicAuth.sol rename to contracts/business_template/RewardPoint/BasicAuth.sol diff --git a/contracts/biz_template/RewardPoint/IssuerRole.sol b/contracts/business_template/RewardPoint/IssuerRole.sol similarity index 100% rename from contracts/biz_template/RewardPoint/IssuerRole.sol rename to contracts/business_template/RewardPoint/IssuerRole.sol diff --git a/contracts/biz_template/RewardPoint/LibRoles.sol b/contracts/business_template/RewardPoint/LibRoles.sol old mode 100755 new mode 100644 similarity index 100% rename from contracts/biz_template/RewardPoint/LibRoles.sol rename to contracts/business_template/RewardPoint/LibRoles.sol diff --git a/contracts/biz_template/RewardPoint/LibSafeMath.sol b/contracts/business_template/RewardPoint/LibSafeMath.sol similarity index 100% rename from contracts/biz_template/RewardPoint/LibSafeMath.sol rename to contracts/business_template/RewardPoint/LibSafeMath.sol diff --git a/contracts/biz_template/RewardPoint/RewardPointController.sol b/contracts/business_template/RewardPoint/RewardPointController.sol similarity index 100% rename from contracts/biz_template/RewardPoint/RewardPointController.sol rename to contracts/business_template/RewardPoint/RewardPointController.sol diff --git a/contracts/biz_template/RewardPoint/RewardPointData.sol b/contracts/business_template/RewardPoint/RewardPointData.sol similarity index 100% rename from contracts/biz_template/RewardPoint/RewardPointData.sol rename to contracts/business_template/RewardPoint/RewardPointData.sol diff --git a/docs/biz_templates/Evidence.md b/docs/business_template/Evidence.md similarity index 100% rename from docs/biz_templates/Evidence.md rename to docs/business_template/Evidence.md diff --git a/docs/biz_templates/RewardPoint.md b/docs/business_template/RewardPoint.md similarity index 100% rename from docs/biz_templates/RewardPoint.md rename to docs/business_template/RewardPoint.md diff --git a/docs/data_structures/LibAddressSet.md b/docs/data_structure/LibAddressSet.md similarity index 100% rename from docs/data_structures/LibAddressSet.md rename to docs/data_structure/LibAddressSet.md diff --git a/docs/data_structures/LibBytes32Set.md b/docs/data_structure/LibBytes32Set.md similarity index 100% rename from docs/data_structures/LibBytes32Set.md rename to docs/data_structure/LibBytes32Set.md diff --git a/docs/data_structures/LibBytesMap.md b/docs/data_structure/LibBytesMap.md similarity index 100% rename from docs/data_structures/LibBytesMap.md rename to docs/data_structure/LibBytesMap.md diff --git a/docs/data_structures/LibDeque.md b/docs/data_structure/LibDeque.md similarity index 100% rename from docs/data_structures/LibDeque.md rename to docs/data_structure/LibDeque.md diff --git a/docs/data_structures/LibLinkedList.md b/docs/data_structure/LibLinkedList.md similarity index 100% rename from docs/data_structures/LibLinkedList.md rename to docs/data_structure/LibLinkedList.md diff --git a/docs/data_structures/LibMaxHeapUint256.md b/docs/data_structure/LibMaxHeapUint256.md similarity index 100% rename from docs/data_structures/LibMaxHeapUint256.md rename to docs/data_structure/LibMaxHeapUint256.md diff --git a/docs/data_structures/LibMinHeapUint256.md b/docs/data_structure/LibMinHeapUint256.md similarity index 100% rename from docs/data_structures/LibMinHeapUint256.md rename to docs/data_structure/LibMinHeapUint256.md diff --git a/docs/data_structures/LibQueue.md b/docs/data_structure/LibQueue.md similarity index 100% rename from docs/data_structures/LibQueue.md rename to docs/data_structure/LibQueue.md diff --git a/docs/data_structures/LibStack.md b/docs/data_structure/LibStack.md similarity index 100% rename from docs/data_structures/LibStack.md rename to docs/data_structure/LibStack.md From 50b5315901d02bfde099267ebcc7f361065e6443 Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年2月26日 10:48:05 +0800 Subject: [PATCH 13/23] fix LibConverter --- docs/types/LibConverter.md | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/docs/types/LibConverter.md b/docs/types/LibConverter.md index 43a6522f..0c0e535a 100644 --- a/docs/types/LibConverter.md +++ b/docs/types/LibConverter.md @@ -15,7 +15,7 @@ contract test { function f() public view{ uint256 a = 25; - uint16 b = LibConverter.uint256ToUint16(a); + uint16 b = LibConverter.toUint16(a); //TODO: } } @@ -26,18 +26,18 @@ contract test { 编号 | API | API描述 ---|---|--- -1 | *uint256ToUint128(uint256 value) internal pure returns (uint128)* | 将uint256转为uint128类型 -2 | *uint256ToUint64(uint256 value) internal pure returns (uint64)* | 将uint256转为uint64类型 -3 | *uint256ToUint32(uint256 value) internal pure returns (uint32)* | 将uint256转为uint32类型 -4 | *uint256ToUint16(uint256 value) internal pure returns (uint16)* | 将uint256转为uint16类型 -5 | *uint256ToUint8(uint256 value) internal pure returns (uint8)* | 将uint256转为uint8类型 +1 | *toUint128(uint256 value) internal pure returns (uint128)* | 将uint256转为uint128类型 +2 | *toUint64(uint256 value) internal pure returns (uint64)* | 将uint256转为uint64类型 +3 | *toUint32(uint256 value) internal pure returns (uint32)* | 将uint256转为uint32类型 +4 | *toUint16(uint256 value) internal pure returns (uint16)* | 将uint256转为uint16类型 +5 | *toUint8(uint256 value) internal pure returns (uint8)* | 将uint256转为uint8类型 6 | *uintToBytes(uint v) internal pure returns (bytes)* | 将uint转为bytes类型 7 | *bytesToInt(bytes b) internal pure returns (int result)* | 将bytes转为int类型 8 | *intToBytes(int v) internal pure returns (bytes)* | 将int转为bytes类型 ## API详情 -### ***1. uint256ToUint128 方法*** +### ***1. toUint128 方法*** 将uint256转为uint128类型,如超出uint128的最大值,则报错退出。 @@ -54,12 +54,12 @@ contract test { ``` function f() public view{ uint256 a = 25; - uint128 b = LibConverter.uint256ToUint128(a); + uint128 b = LibConverter.toUint128(a); //TODO: } ``` -### ***2. uint256ToUint64 方法*** +### ***2. toUint64 方法*** 将uint256转为uint64类型,如超出uint64的最大值,则报错退出。 @@ -76,12 +76,12 @@ function f() public view{ ``` function f() public view{ uint256 a = 25; - uint64 b = LibConverter.uint256ToUint64(a); + uint64 b = LibConverter.toUint64(a); //TODO: } ``` -### ***3. uint256ToUint32 方法*** +### ***3. toUint32 方法*** 将uint256转为uint32类型,如超出uint32的最大值,则报错退出。 @@ -98,12 +98,12 @@ function f() public view{ ``` function f() public view{ uint256 a = 25; - uint32 b = LibConverter.uint256ToUint32(a); + uint32 b = LibConverter.toUint32(a); //TODO: } ``` -### ***4. uint256ToUint16 方法*** +### ***4. toUint16 方法*** 将uint256转为uint16类型,如超出uint16的最大值,则报错退出。 @@ -120,12 +120,12 @@ function f() public view{ ``` function f() public view{ uint256 a = 25; - uint16 b = LibConverter.uint256ToUint16(a); + uint16 b = LibConverter.toUint16(a); //TODO: } ``` -### ***5. uint256ToUint8 方法*** +### ***5. toUint8 方法*** 将uint256转为uint8类型,如超出uint8的最大值,则报错退出。 @@ -142,12 +142,12 @@ function f() public view{ ``` function f() public view{ uint256 a = 25; - uint8 b = LibConverter.uint256ToUint8(a); + uint8 b = LibConverter.toUint8(a); //TODO: } ``` -### ***5. uintToBytes 方法*** +### ***5. toBytes 方法*** 将uint256转为bytes类型。 From f934b854dd697fc124bf53838944d5fda3f624da Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年2月26日 16:29:19 +0800 Subject: [PATCH 14/23] . --- contracts/base_type/LibArrayForUint256Utils.sol | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index ae8314c5..b41d0637 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -70,8 +70,8 @@ library LibArrayForUint256Utils { uint256 temp; for (uint i = 0; i < array.length / 2; i++) { temp = array[i]; - array[i] = array[array.length - i]; - array[array.length - i] = temp; + array[i] = array[array.length - 1 - i]; + array[array.length - 1 - i] = temp; } } From b48d8796ef12364741c8c3dd535c8c7ef0057d6f Mon Sep 17 00:00:00 2001 From: aoronchu Date: 2021年2月26日 17:10:02 +0800 Subject: [PATCH 15/23] . --- contracts/base_type/LibArrayForUint256Utils.sol | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index b41d0637..e311166e 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -127,8 +127,16 @@ library LibArrayForUint256Utils { bool contains; uint index; for (uint i = 0; i < array.length; i++) { - (contains, index) = firstIndexOf(array, array[i]); - if (contains && index> i) { + bool contains = false; + uint256 index = 0; + for(uint j = i+1;j < array.length; j++){ + if(array[j] == array[i]){ + contains =true; + index = i; + break; + } + } + if (contains) { for (uint j = index; j < array.length - 1; j++){ array[j] = array[j + 1]; } @@ -144,7 +152,7 @@ library LibArrayForUint256Utils { } function qsort(uint256[] storage array, uint256 begin, uint256 end) private { - if(begin>= end) return; + if(begin>= end || end == uint256(-1)) return; uint256 pivot = array[end]; uint256 store = begin; From 36cd5292bf90702fb9bd90e6285acb66df14224e Mon Sep 17 00:00:00 2001 From: aoronchu Date: Mon, 1 Mar 2021 16:26:04 +0800 Subject: [PATCH 16/23] fix libstack --- contracts/data_structure/LibStack.sol | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/contracts/data_structure/LibStack.sol b/contracts/data_structure/LibStack.sol index 86b6adf4..574f99a1 100644 --- a/contracts/data_structure/LibStack.sol +++ b/contracts/data_structure/LibStack.sol @@ -35,6 +35,11 @@ library LibStack{ return data; } + function peek(Stack storage self) internal returns(bytes32){ + require(self.datas.length> 0); + bytes32 data = self.datas[self.datas.length - 1]; + return data; + } function getSize(Stack storage self) internal view returns(uint256){ return self.datas.length; } From 00f2c7788708ffe0e2c4c9b056eb0bf75d6af4a0 Mon Sep 17 00:00:00 2001 From: aoronchu Date: Mon, 1 Mar 2021 17:49:36 +0800 Subject: [PATCH 17/23] fix LibBytesMap --- contracts/data_structure/LibBytesMap.sol | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) diff --git a/contracts/data_structure/LibBytesMap.sol b/contracts/data_structure/LibBytesMap.sol index 2af0a2f3..896b0b66 100644 --- a/contracts/data_structure/LibBytesMap.sol +++ b/contracts/data_structure/LibBytesMap.sol @@ -48,7 +48,7 @@ library LibBytesMap{ return value; } - function size(Map storage self) internal view returns(uint256) { + function getSize(Map storage self) internal view returns(uint256) { return self.keys.length; } @@ -64,19 +64,8 @@ library LibBytesMap{ function iterate_next(Map storage self, uint256 idx) internal pure returns(uint256){ return idx+1; } -} - - - - - - - - - - - - - - - + function getKeyByIndex(Map storage map, uint256 idx) internal view returns(bytes memory){ + bytes memory key = map.keys[idx - 1]; + return key; + } +} \ No newline at end of file From 3cb75f332783c9f01a4ff57ac9db450048fd95d2 Mon Sep 17 00:00:00 2001 From: aoronchu Date: Tue, 2 Mar 2021 10:59:14 +0800 Subject: [PATCH 18/23] . --- contracts/default/Crypto.sol | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/contracts/default/Crypto.sol b/contracts/default/Crypto.sol index fee7ce7a..9979794b 100644 --- a/contracts/default/Crypto.sol +++ b/contracts/default/Crypto.sol @@ -1,7 +1,7 @@ contract Crypto { - function sm3(bytes data) public view returns(bytes32){} - function keccak256Hash(bytes data) public view returns(bytes32){} - function sm2Verify(bytes32 message, bytes publicKey, bytes32 r, bytes32 s) public view returns(bool, address){} - function curve25519VRFVerify(string input, string vrfPublicKey, string vrfProof) public view returns(bool,uint256){} + function sm3(bytes memory data) public view returns(bytes32){} + function keccak256Hash(bytes memory data) public view returns(bytes32){} + function sm2Verify(bytes32 message, bytes memory publicKey, bytes32 r, bytes32 s) public view returns(bool, address){} + function curve25519VRFVerify(string memory input, string memory vrfPublicKey, string memory vrfProof) public view returns(bool,uint256){} } \ No newline at end of file From 2bdc3e9055563b37144f93b09388207bf484a37e Mon Sep 17 00:00:00 2001 From: aoronchu Date: Thu, 4 Mar 2021 10:36:38 +0800 Subject: [PATCH 19/23] . --- contracts/base_type/LibAddress.sol | 2 +- contracts/base_type/LibArrayForUint256Utils.sol | 2 +- contracts/base_type/LibConverter.sol | 2 +- contracts/base_type/LibSafeMathForUint256Utils.sol | 2 +- contracts/base_type/LibString.sol | 2 +- contracts/business_template/Evidence/Authentication.sol | 2 +- contracts/business_template/Evidence/EvidenceController.sol | 2 +- contracts/business_template/Evidence/EvidenceRepository.sol | 2 +- contracts/business_template/Evidence/RequestRepository.sol | 2 +- contracts/business_template/RewardPoint/Admin.sol | 2 +- contracts/business_template/RewardPoint/BasicAuth.sol | 2 +- contracts/business_template/RewardPoint/IssuerRole.sol | 2 +- contracts/business_template/RewardPoint/LibRoles.sol | 2 +- contracts/business_template/RewardPoint/LibSafeMath.sol | 2 +- .../business_template/RewardPoint/RewardPointController.sol | 2 +- contracts/business_template/RewardPoint/RewardPointData.sol | 2 +- contracts/data_structure/LibAddressSet.sol | 2 +- contracts/data_structure/LibBytesMap.sol | 2 +- contracts/data_structure/LibDeque.sol | 2 +- contracts/data_structure/LibLinkedList.sol | 2 +- contracts/data_structure/LibMaxHeapUint256.sol | 2 +- contracts/data_structure/LibMinHeapUint256.sol | 2 +- contracts/data_structure/LibQueue.sol | 2 +- contracts/data_structure/LibStack.sol | 2 +- 24 files changed, 24 insertions(+), 24 deletions(-) diff --git a/contracts/base_type/LibAddress.sol b/contracts/base_type/LibAddress.sol index bb8af16b..482b0804 100644 --- a/contracts/base_type/LibAddress.sol +++ b/contracts/base_type/LibAddress.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibAddress{ diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index e311166e..6ceb4a34 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibSafeMathForUint256Utils.sol"; diff --git a/contracts/base_type/LibConverter.sol b/contracts/base_type/LibConverter.sol index 1639a3b4..517e7591 100644 --- a/contracts/base_type/LibConverter.sol +++ b/contracts/base_type/LibConverter.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibConverter { diff --git a/contracts/base_type/LibSafeMathForUint256Utils.sol b/contracts/base_type/LibSafeMathForUint256Utils.sol index f65bf3bc..435200bd 100644 --- a/contracts/base_type/LibSafeMathForUint256Utils.sol +++ b/contracts/base_type/LibSafeMathForUint256Utils.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibSafeMathForUint256Utils { diff --git a/contracts/base_type/LibString.sol b/contracts/base_type/LibString.sol index 4e1c18cd..48cd6ff2 100644 --- a/contracts/base_type/LibString.sol +++ b/contracts/base_type/LibString.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibString{ diff --git a/contracts/business_template/Evidence/Authentication.sol b/contracts/business_template/Evidence/Authentication.sol index df4f1e29..1b941068 100644 --- a/contracts/business_template/Evidence/Authentication.sol +++ b/contracts/business_template/Evidence/Authentication.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; contract Authentication{ address public _owner; diff --git a/contracts/business_template/Evidence/EvidenceController.sol b/contracts/business_template/Evidence/EvidenceController.sol index 48b90d61..3d53093d 100644 --- a/contracts/business_template/Evidence/EvidenceController.sol +++ b/contracts/business_template/Evidence/EvidenceController.sol @@ -15,7 +15,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./RequestRepository.sol"; import "./EvidenceRepository.sol"; diff --git a/contracts/business_template/Evidence/EvidenceRepository.sol b/contracts/business_template/Evidence/EvidenceRepository.sol index 16f47e33..3fed90aa 100644 --- a/contracts/business_template/Evidence/EvidenceRepository.sol +++ b/contracts/business_template/Evidence/EvidenceRepository.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./Authentication.sol"; contract EvidenceRepository is Authentication { diff --git a/contracts/business_template/Evidence/RequestRepository.sol b/contracts/business_template/Evidence/RequestRepository.sol index d44d36d7..940e1efc 100644 --- a/contracts/business_template/Evidence/RequestRepository.sol +++ b/contracts/business_template/Evidence/RequestRepository.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./Authentication.sol"; diff --git a/contracts/business_template/RewardPoint/Admin.sol b/contracts/business_template/RewardPoint/Admin.sol index 35fbfec2..e5c98cd5 100644 --- a/contracts/business_template/RewardPoint/Admin.sol +++ b/contracts/business_template/RewardPoint/Admin.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity 0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./BasicAuth.sol"; import "./RewardPointController.sol"; diff --git a/contracts/business_template/RewardPoint/BasicAuth.sol b/contracts/business_template/RewardPoint/BasicAuth.sol index 4544de81..6f1247fb 100644 --- a/contracts/business_template/RewardPoint/BasicAuth.sol +++ b/contracts/business_template/RewardPoint/BasicAuth.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity 0.6.10; +pragma solidity>=0.4.24 <0.6.11; contract BasicAuth { address public _owner; diff --git a/contracts/business_template/RewardPoint/IssuerRole.sol b/contracts/business_template/RewardPoint/IssuerRole.sol index c7e4c9b9..30f8dbe2 100644 --- a/contracts/business_template/RewardPoint/IssuerRole.sol +++ b/contracts/business_template/RewardPoint/IssuerRole.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibRoles.sol"; diff --git a/contracts/business_template/RewardPoint/LibRoles.sol b/contracts/business_template/RewardPoint/LibRoles.sol index 676bccdd..94e8f358 100644 --- a/contracts/business_template/RewardPoint/LibRoles.sol +++ b/contracts/business_template/RewardPoint/LibRoles.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibRoles { struct Role { diff --git a/contracts/business_template/RewardPoint/LibSafeMath.sol b/contracts/business_template/RewardPoint/LibSafeMath.sol index 7ddbc714..cfc8cdad 100644 --- a/contracts/business_template/RewardPoint/LibSafeMath.sol +++ b/contracts/business_template/RewardPoint/LibSafeMath.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibSafeMath { diff --git a/contracts/business_template/RewardPoint/RewardPointController.sol b/contracts/business_template/RewardPoint/RewardPointController.sol index be338ddf..a68b4d55 100644 --- a/contracts/business_template/RewardPoint/RewardPointController.sol +++ b/contracts/business_template/RewardPoint/RewardPointController.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./RewardPointData.sol"; import "./BasicAuth.sol"; diff --git a/contracts/business_template/RewardPoint/RewardPointData.sol b/contracts/business_template/RewardPoint/RewardPointData.sol index f085b501..5eb8c477 100644 --- a/contracts/business_template/RewardPoint/RewardPointData.sol +++ b/contracts/business_template/RewardPoint/RewardPointData.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./BasicAuth.sol"; import "./IssuerRole.sol"; diff --git a/contracts/data_structure/LibAddressSet.sol b/contracts/data_structure/LibAddressSet.sol index e4c06be6..308cc37f 100644 --- a/contracts/data_structure/LibAddressSet.sol +++ b/contracts/data_structure/LibAddressSet.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibAddressSet { diff --git a/contracts/data_structure/LibBytesMap.sol b/contracts/data_structure/LibBytesMap.sol index 896b0b66..3a662332 100644 --- a/contracts/data_structure/LibBytesMap.sol +++ b/contracts/data_structure/LibBytesMap.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibBytesMap{ diff --git a/contracts/data_structure/LibDeque.sol b/contracts/data_structure/LibDeque.sol index 51cef40f..cf775834 100644 --- a/contracts/data_structure/LibDeque.sol +++ b/contracts/data_structure/LibDeque.sol @@ -15,7 +15,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; /** * Doubly ended queue diff --git a/contracts/data_structure/LibLinkedList.sol b/contracts/data_structure/LibLinkedList.sol index af8db9a6..f7298fb7 100644 --- a/contracts/data_structure/LibLinkedList.sol +++ b/contracts/data_structure/LibLinkedList.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibLinkedList { diff --git a/contracts/data_structure/LibMaxHeapUint256.sol b/contracts/data_structure/LibMaxHeapUint256.sol index 011ebaff..a18a4c98 100644 --- a/contracts/data_structure/LibMaxHeapUint256.sol +++ b/contracts/data_structure/LibMaxHeapUint256.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibMaxHeapUint256{ diff --git a/contracts/data_structure/LibMinHeapUint256.sol b/contracts/data_structure/LibMinHeapUint256.sol index 7d52a68b..0e5254e6 100644 --- a/contracts/data_structure/LibMinHeapUint256.sol +++ b/contracts/data_structure/LibMinHeapUint256.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibMinHeapUint256{ diff --git a/contracts/data_structure/LibQueue.sol b/contracts/data_structure/LibQueue.sol index 748570f3..854c07d6 100644 --- a/contracts/data_structure/LibQueue.sol +++ b/contracts/data_structure/LibQueue.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibQueue{ diff --git a/contracts/data_structure/LibStack.sol b/contracts/data_structure/LibStack.sol index 574f99a1..8928a766 100644 --- a/contracts/data_structure/LibStack.sol +++ b/contracts/data_structure/LibStack.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; library LibStack{ From b2d7ed23522175dbe1c8dd8e09e2a7b036bc1aab Mon Sep 17 00:00:00 2001 From: aoronchu Date: Thu, 4 Mar 2021 10:40:15 +0800 Subject: [PATCH 20/23] . --- contracts/base_type/LibAddress.sol | 2 +- contracts/base_type/LibArrayForUint256Utils.sol | 2 +- contracts/base_type/LibConverter.sol | 2 +- contracts/base_type/LibSafeMathForUint256Utils.sol | 2 +- contracts/base_type/LibString.sol | 2 +- contracts/business_template/Evidence/Authentication.sol | 2 +- contracts/business_template/Evidence/EvidenceController.sol | 2 +- contracts/business_template/Evidence/EvidenceRepository.sol | 2 +- contracts/business_template/Evidence/RequestRepository.sol | 2 +- contracts/business_template/RewardPoint/Admin.sol | 2 +- contracts/business_template/RewardPoint/BasicAuth.sol | 2 +- contracts/business_template/RewardPoint/IssuerRole.sol | 2 +- contracts/business_template/RewardPoint/LibRoles.sol | 2 +- contracts/business_template/RewardPoint/LibSafeMath.sol | 2 +- .../business_template/RewardPoint/RewardPointController.sol | 2 +- contracts/business_template/RewardPoint/RewardPointData.sol | 2 +- contracts/data_structure/LibAddressSet.sol | 2 +- contracts/data_structure/LibBytesMap.sol | 2 +- contracts/data_structure/LibDeque.sol | 2 +- contracts/data_structure/LibLinkedList.sol | 2 +- contracts/data_structure/LibMaxHeapUint256.sol | 2 +- contracts/data_structure/LibMinHeapUint256.sol | 2 +- contracts/data_structure/LibQueue.sol | 2 +- contracts/data_structure/LibStack.sol | 2 +- contracts/default/HelloWorld.sol | 2 +- contracts/default/KVTableTest.sol | 2 +- contracts/default/ShaTest.sol | 2 +- contracts/default/TableTest.sol | 2 +- 28 files changed, 28 insertions(+), 28 deletions(-) diff --git a/contracts/base_type/LibAddress.sol b/contracts/base_type/LibAddress.sol index 482b0804..c6d78b4e 100644 --- a/contracts/base_type/LibAddress.sol +++ b/contracts/base_type/LibAddress.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibAddress{ diff --git a/contracts/base_type/LibArrayForUint256Utils.sol b/contracts/base_type/LibArrayForUint256Utils.sol index 6ceb4a34..c6efd70a 100644 --- a/contracts/base_type/LibArrayForUint256Utils.sol +++ b/contracts/base_type/LibArrayForUint256Utils.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./LibSafeMathForUint256Utils.sol"; diff --git a/contracts/base_type/LibConverter.sol b/contracts/base_type/LibConverter.sol index 517e7591..0a8ca669 100644 --- a/contracts/base_type/LibConverter.sol +++ b/contracts/base_type/LibConverter.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibConverter { diff --git a/contracts/base_type/LibSafeMathForUint256Utils.sol b/contracts/base_type/LibSafeMathForUint256Utils.sol index 435200bd..b83c43e2 100644 --- a/contracts/base_type/LibSafeMathForUint256Utils.sol +++ b/contracts/base_type/LibSafeMathForUint256Utils.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibSafeMathForUint256Utils { diff --git a/contracts/base_type/LibString.sol b/contracts/base_type/LibString.sol index 48cd6ff2..31f859c3 100644 --- a/contracts/base_type/LibString.sol +++ b/contracts/base_type/LibString.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibString{ diff --git a/contracts/business_template/Evidence/Authentication.sol b/contracts/business_template/Evidence/Authentication.sol index 1b941068..35ba0f52 100644 --- a/contracts/business_template/Evidence/Authentication.sol +++ b/contracts/business_template/Evidence/Authentication.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; contract Authentication{ address public _owner; diff --git a/contracts/business_template/Evidence/EvidenceController.sol b/contracts/business_template/Evidence/EvidenceController.sol index 3d53093d..7afc2ce8 100644 --- a/contracts/business_template/Evidence/EvidenceController.sol +++ b/contracts/business_template/Evidence/EvidenceController.sol @@ -15,7 +15,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./RequestRepository.sol"; import "./EvidenceRepository.sol"; diff --git a/contracts/business_template/Evidence/EvidenceRepository.sol b/contracts/business_template/Evidence/EvidenceRepository.sol index 3fed90aa..bfbac88c 100644 --- a/contracts/business_template/Evidence/EvidenceRepository.sol +++ b/contracts/business_template/Evidence/EvidenceRepository.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./Authentication.sol"; contract EvidenceRepository is Authentication { diff --git a/contracts/business_template/Evidence/RequestRepository.sol b/contracts/business_template/Evidence/RequestRepository.sol index 940e1efc..f6501a08 100644 --- a/contracts/business_template/Evidence/RequestRepository.sol +++ b/contracts/business_template/Evidence/RequestRepository.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./Authentication.sol"; diff --git a/contracts/business_template/RewardPoint/Admin.sol b/contracts/business_template/RewardPoint/Admin.sol index e5c98cd5..f973c796 100644 --- a/contracts/business_template/RewardPoint/Admin.sol +++ b/contracts/business_template/RewardPoint/Admin.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./BasicAuth.sol"; import "./RewardPointController.sol"; diff --git a/contracts/business_template/RewardPoint/BasicAuth.sol b/contracts/business_template/RewardPoint/BasicAuth.sol index 6f1247fb..8a99a142 100644 --- a/contracts/business_template/RewardPoint/BasicAuth.sol +++ b/contracts/business_template/RewardPoint/BasicAuth.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; contract BasicAuth { address public _owner; diff --git a/contracts/business_template/RewardPoint/IssuerRole.sol b/contracts/business_template/RewardPoint/IssuerRole.sol index 30f8dbe2..bca27795 100644 --- a/contracts/business_template/RewardPoint/IssuerRole.sol +++ b/contracts/business_template/RewardPoint/IssuerRole.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./LibRoles.sol"; diff --git a/contracts/business_template/RewardPoint/LibRoles.sol b/contracts/business_template/RewardPoint/LibRoles.sol index 94e8f358..e33cb47b 100644 --- a/contracts/business_template/RewardPoint/LibRoles.sol +++ b/contracts/business_template/RewardPoint/LibRoles.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibRoles { struct Role { diff --git a/contracts/business_template/RewardPoint/LibSafeMath.sol b/contracts/business_template/RewardPoint/LibSafeMath.sol index cfc8cdad..0deff2da 100644 --- a/contracts/business_template/RewardPoint/LibSafeMath.sol +++ b/contracts/business_template/RewardPoint/LibSafeMath.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibSafeMath { diff --git a/contracts/business_template/RewardPoint/RewardPointController.sol b/contracts/business_template/RewardPoint/RewardPointController.sol index a68b4d55..b04fdcda 100644 --- a/contracts/business_template/RewardPoint/RewardPointController.sol +++ b/contracts/business_template/RewardPoint/RewardPointController.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./RewardPointData.sol"; import "./BasicAuth.sol"; diff --git a/contracts/business_template/RewardPoint/RewardPointData.sol b/contracts/business_template/RewardPoint/RewardPointData.sol index 5eb8c477..b0ef20c4 100644 --- a/contracts/business_template/RewardPoint/RewardPointData.sol +++ b/contracts/business_template/RewardPoint/RewardPointData.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./BasicAuth.sol"; import "./IssuerRole.sol"; diff --git a/contracts/data_structure/LibAddressSet.sol b/contracts/data_structure/LibAddressSet.sol index 308cc37f..5fd4cb5d 100644 --- a/contracts/data_structure/LibAddressSet.sol +++ b/contracts/data_structure/LibAddressSet.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibAddressSet { diff --git a/contracts/data_structure/LibBytesMap.sol b/contracts/data_structure/LibBytesMap.sol index 3a662332..68fc29f1 100644 --- a/contracts/data_structure/LibBytesMap.sol +++ b/contracts/data_structure/LibBytesMap.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibBytesMap{ diff --git a/contracts/data_structure/LibDeque.sol b/contracts/data_structure/LibDeque.sol index cf775834..ee13db91 100644 --- a/contracts/data_structure/LibDeque.sol +++ b/contracts/data_structure/LibDeque.sol @@ -15,7 +15,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; /** * Doubly ended queue diff --git a/contracts/data_structure/LibLinkedList.sol b/contracts/data_structure/LibLinkedList.sol index f7298fb7..971ccf9c 100644 --- a/contracts/data_structure/LibLinkedList.sol +++ b/contracts/data_structure/LibLinkedList.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibLinkedList { diff --git a/contracts/data_structure/LibMaxHeapUint256.sol b/contracts/data_structure/LibMaxHeapUint256.sol index a18a4c98..54c70a33 100644 --- a/contracts/data_structure/LibMaxHeapUint256.sol +++ b/contracts/data_structure/LibMaxHeapUint256.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibMaxHeapUint256{ diff --git a/contracts/data_structure/LibMinHeapUint256.sol b/contracts/data_structure/LibMinHeapUint256.sol index 0e5254e6..6aeea319 100644 --- a/contracts/data_structure/LibMinHeapUint256.sol +++ b/contracts/data_structure/LibMinHeapUint256.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibMinHeapUint256{ diff --git a/contracts/data_structure/LibQueue.sol b/contracts/data_structure/LibQueue.sol index 854c07d6..12aeb712 100644 --- a/contracts/data_structure/LibQueue.sol +++ b/contracts/data_structure/LibQueue.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibQueue{ diff --git a/contracts/data_structure/LibStack.sol b/contracts/data_structure/LibStack.sol index 8928a766..9b9c41a2 100644 --- a/contracts/data_structure/LibStack.sol +++ b/contracts/data_structure/LibStack.sol @@ -14,7 +14,7 @@ * limitations under the License. * */ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; library LibStack{ diff --git a/contracts/default/HelloWorld.sol b/contracts/default/HelloWorld.sol index 9d48d3d5..9ba9451c 100644 --- a/contracts/default/HelloWorld.sol +++ b/contracts/default/HelloWorld.sol @@ -1,4 +1,4 @@ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; contract HelloWorld { string name; diff --git a/contracts/default/KVTableTest.sol b/contracts/default/KVTableTest.sol index 35b5d567..3aa42ee0 100644 --- a/contracts/default/KVTableTest.sol +++ b/contracts/default/KVTableTest.sol @@ -1,4 +1,4 @@ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; import "./Table.sol"; diff --git a/contracts/default/ShaTest.sol b/contracts/default/ShaTest.sol index 7aeb24db..50105476 100644 --- a/contracts/default/ShaTest.sol +++ b/contracts/default/ShaTest.sol @@ -1,4 +1,4 @@ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; pragma experimental ABIEncoderV2; diff --git a/contracts/default/TableTest.sol b/contracts/default/TableTest.sol index e21bd21f..da9811c7 100644 --- a/contracts/default/TableTest.sol +++ b/contracts/default/TableTest.sol @@ -1,4 +1,4 @@ -pragma solidity>=0.4.24 <0.6.11; +pragma solidity>=0.4.24 <0.6.11; pragma experimental ABIEncoderV2; import "./Table.sol"; From 69c51764fe5c0f09ccc9f93c3614686b808bf2fe Mon Sep 17 00:00:00 2001 From: aoronchu Date: Thu, 4 Mar 2021 17:07:04 +0800 Subject: [PATCH 21/23] . --- contracts/business_template/RewardPoint/IssuerRole.sol | 2 +- .../business_template/RewardPoint/RewardPointController.sol | 6 +++--- contracts/data_structure/LibQueue.sol | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/contracts/business_template/RewardPoint/IssuerRole.sol b/contracts/business_template/RewardPoint/IssuerRole.sol index bca27795..d07f3e38 100644 --- a/contracts/business_template/RewardPoint/IssuerRole.sol +++ b/contracts/business_template/RewardPoint/IssuerRole.sol @@ -39,7 +39,7 @@ contract IssuerRole { return _issuers.has(account); } - function addIssuer(address account) public onlyIssuer { + function addIssuer(address account) public { _issuers.add(account); emit IssuerAdded(account); } diff --git a/contracts/business_template/RewardPoint/RewardPointController.sol b/contracts/business_template/RewardPoint/RewardPointController.sol index b04fdcda..d00e8be0 100644 --- a/contracts/business_template/RewardPoint/RewardPointController.sol +++ b/contracts/business_template/RewardPoint/RewardPointController.sol @@ -78,7 +78,7 @@ contract RewardPointController is BasicAuth { return _rewardPointData.getBalance(addr); } - function transfer(address toAddress, uint256 value) accountExist(msg.sender) accountExist(toAddress) checkAccount(toAddress) + function transfer(address toAddress, uint256 value) accountExist(msg.sender) accountExist(toAddress) public returns(bool b, uint256 balanceOfFrom, uint256 balanceOfTo) { uint256 balance1 = _rewardPointData.getBalance(msg.sender); balanceOfFrom = balance1.sub(value); @@ -102,7 +102,7 @@ contract RewardPointController is BasicAuth { } - function issue(address account, uint256 value) public onlyIssuer accountExist(account) returns (bool) { + function issue(address account, uint256 value) public accountExist(account) returns (bool) { uint256 totalAmount = _rewardPointData._totalAmount(); totalAmount = totalAmount.add(value); _rewardPointData.setTotalAmount(totalAmount); @@ -117,7 +117,7 @@ contract RewardPointController is BasicAuth { return _rewardPointData.isIssuer(account); } - function addIssuer(address account) public onlyIssuer returns (bool) { + function addIssuer(address account) public returns (bool) { _rewardPointData.addIssuer(account); return true; } diff --git a/contracts/data_structure/LibQueue.sol b/contracts/data_structure/LibQueue.sol index 12aeb712..d53073bc 100644 --- a/contracts/data_structure/LibQueue.sol +++ b/contracts/data_structure/LibQueue.sol @@ -26,11 +26,11 @@ library LibQueue{ } - function enqueue(Queue storage queue, bytes32 data) public { + function enqueue(Queue storage queue, bytes32 data) internal { queue.queue[queue.next++] = data; } - function dequeue(Queue storage queue) public returns (bytes32) { + function dequeue(Queue storage queue) internal returns (bytes32) { uint256 first = queue.first; require(queue.next> first); // non-empty queue @@ -40,7 +40,7 @@ library LibQueue{ return data; } - function element(Queue storage queue) public view returns (bytes32) { + function element(Queue storage queue) internal view returns (bytes32) { uint256 first = queue.first; require(queue.next> first); // non-empty queue bytes32 data = queue.queue[first]; From be1cd280daba0e2e522091e36fde018d476a5888 Mon Sep 17 00:00:00 2001 From: aoronchu Date: Fri, 5 Mar 2021 11:09:54 +0800 Subject: [PATCH 22/23] . --- docs/data_structure/LibAddressSet.md | 104 ++++++--- docs/data_structure/LibBytesMap.md | 73 ++++--- docs/data_structure/LibDeque.md | 183 +++++++++++++--- docs/data_structure/LibLinkedList.md | 144 +++++++++++-- docs/data_structure/LibMaxHeapUint256.md | 2 +- docs/data_structure/LibMinHeapUint256.md | 2 +- docs/data_structure/LibQueue.md | 72 +++++-- docs/data_structure/LibStack.md | 76 +++++-- docs/data_structure/data_structure.lnk | Bin 0 -> 1526 bytes docs/default/Crypto.md | 2 +- docs/types/LibAddress.md | 21 +- docs/types/LibArrayForUint256Utils.md | 264 +++++++++++++++++------ docs/types/LibConverter.md | 8 +- docs/types/LibSafeMathForUint256Utils.md | 2 +- docs/types/LibString.md | 76 +++---- 15 files changed, 784 insertions(+), 245 deletions(-) create mode 100644 docs/data_structure/data_structure.lnk diff --git a/docs/data_structure/LibAddressSet.md b/docs/data_structure/LibAddressSet.md index e25a5416..ea923615 100644 --- a/docs/data_structure/LibAddressSet.md +++ b/docs/data_structure/LibAddressSet.md @@ -7,19 +7,21 @@ LibAddressSet 提供了存储Address类型的Set数据结构,支持包括add, 首先需要通过import引入LibAddressSet类库,然后通过"."进行方法调用,如下为调用LibAddressSet方法的例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibAddressSet.sol"; -contract TestSet { +contract Test { using LibAddressSet for LibAddressSet.AddressSet; LibAddressSet.AddressSet private addressSet; + event Log(uint256 size); + function testAddress() public { addressSet.add(address(1)); - uint256 size = addressSet.size();//Expected to be 1 + uint256 size = addressSet.getSize();//Expected to be 1 + emit Log(size); } - } ``` @@ -34,7 +36,6 @@ contract TestSet { 4 | *size(AddressSet storage self) internal view returns (uint256)* | 获取Set内元素数。 5 | *get(AddressSet storage self, uint256 index) internal view returns (address)* | 查询某个Set的元素。 6 | *getAll(AddressSet storage self) internal view returns(address[])* | 返回所有元素。 -7 | *destroy(Bytes32Set storage self) internal* | 销毁Set。 ## API详情 @@ -53,16 +54,20 @@ contract TestSet { #### 实例 ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibAddressSet.sol"; -contract TestSet { +contract Test { using LibAddressSet for LibAddressSet.AddressSet; LibAddressSet.AddressSet private addressSet; + event Log(uint256 size); + function testAddress() public { addressSet.add(address(1)); + uint256 size = addressSet.getSize();//Expected to be 1 + emit Log(size); } } @@ -83,7 +88,22 @@ contract TestSet { #### 实例 ``` - bool b = addressSet.contains(address(1)); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibAddressSet.sol"; + +contract Test { + using LibAddressSet for LibAddressSet.AddressSet; + LibAddressSet.AddressSet private addressSet; + + event Log(bool b); + + function testAddress() public { + addressSet.add(address(1)); + emit Log(addressSet.contains(address(1)));//Expected true + } + +} ``` ### ***3. remove 函数*** @@ -101,10 +121,26 @@ contract TestSet { #### 实例 ``` - ddressSet.remove(address(1)); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibAddressSet.sol"; + +contract Test { + using LibAddressSet for LibAddressSet.AddressSet; + LibAddressSet.AddressSet private addressSet; + + event Log(bool b); + + function testAddress() public { + addressSet.add(address(1)); + addressSet.remove(address(1)); + emit Log(addressSet.contains(address(1))); + } + +} ``` -### ***4. size 函数*** +### ***4. getSize 函数*** 查询Set中的元素数量。 @@ -118,7 +154,7 @@ contract TestSet { #### 实例 ``` - uint256 setSize = addressSet.size(); + uint256 setSize = addressSet.getSize(); ``` ### ***5. get 函数*** @@ -136,7 +172,23 @@ contract TestSet { #### 实例 ``` - address value = addressSet.get(0); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibAddressSet.sol"; + +contract Test { + using LibAddressSet for LibAddressSet.AddressSet; + LibAddressSet.AddressSet private addressSet; + + event Log(bool b); + + function testAddress() public returns(address) { + addressSet.add(address(1)); + addressSet.add(address(2)); + return addressSet.get(1);//Expected be 2 + } + +} ``` ### ***6. getAll 函数*** @@ -153,21 +205,21 @@ contract TestSet { #### 实例 ``` - address[] values = addressSet.getAll(); -``` - -### ***7. destroy 函数*** - -销毁Set。 - -#### 参数 +pragma solidity>=0.4.24 <0.6.11; -- AddressSet: set容器 +import "./LibAddressSet.sol"; -#### 返回值 +contract Test { + using LibAddressSet for LibAddressSet.AddressSet; + LibAddressSet.AddressSet private addressSet; -#### 实例 + event Log(bool b); + + function testAddress() public returns(address[] memory) { + addressSet.add(address(1)); + addressSet.add(address(2)); + return addressSet.getAll();//Expected be 2 + } -``` - addressSet.destroy(); -``` +} +``` \ No newline at end of file diff --git a/docs/data_structure/LibBytesMap.md b/docs/data_structure/LibBytesMap.md index 4dee8dd4..af12bfcb 100644 --- a/docs/data_structure/LibBytesMap.md +++ b/docs/data_structure/LibBytesMap.md @@ -7,7 +7,7 @@ LibBytesMap提供了基于bytes的可迭代、可查询的映射. 首先需要通过import引入LibBytesMap类库,然后通过"."进行方法调用,如下为调用例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibBytesMap.sol"; @@ -18,12 +18,15 @@ contract Test { LibBytesMap.Map private map; - function f(string key, string value) public { - + event Log(uint256 size); + function f() public { + string memory key = "key"; + string memory value = "value"; map.put(bytes(key),bytes(value)); - + emit Log(map.getSize()); } +} ``` @@ -51,17 +54,6 @@ contract Test { - bytes key: 键 - bytes value:值 - - -#### 实例 - -``` - function putExample(string key, string value) public { - - map.put(bytes(key),bytes(value)); - - } -``` ### ***2. getValue 函数*** 查询值 @@ -77,35 +69,66 @@ contract Test { #### 实例 ``` - function getExample(string key) public returns(bytes){ - bytes memory value = map.getValue(bytes(key)); - return value; - } +pragma solidity>=0.4.24 <0.6.11; + +import "./LibBytesMap.sol"; + +contract Test { + + using LibBytesMap for LibBytesMap.Map; + LibBytesMap.Map private map; + + event Log(string val); + function f() public { + string memory key = "k"; + string memory value = "v"; + map.put(bytes(key),bytes(value)); + emit Log(string(map.getValue(bytes(key))));//Expected to be v + } +} ``` + ### ***3. 迭代函数 与 getKey函数*** #### 实例 ``` - event Log(bytes key); - function iterate() public { +pragma solidity>=0.4.24 <0.6.11; + +import "./LibBytesMap.sol"; + +contract Test { + + using LibBytesMap for LibBytesMap.Map; + + LibBytesMap.Map private map; + + + event Log(bytes key, uint256 index); + event Debug(uint256 index, bool can); + function f() public { + map.put(bytes("k1"),bytes("v1")); + map.put(bytes("k2"),bytes("v2")); + map.put(bytes("k3"),bytes("v3")); + uint256 i = map.iterate_start(); + while(map.can_iterate(i)){ - emit Log(map.getKey(i)); + emit Log(map.getKeyByIndex(i), i); i = map.iterate_next(i); } - } +} ``` -### ***4. size函数*** +### ***4. getSize*** #### 实例 ``` function iterate() public { - uint256 i = map.size(); + uint256 i = map.getSize(); } ``` diff --git a/docs/data_structure/LibDeque.md b/docs/data_structure/LibDeque.md index 9f8b322a..28d5b98b 100644 --- a/docs/data_structure/LibDeque.md +++ b/docs/data_structure/LibDeque.md @@ -11,16 +11,16 @@ pragma solidity>=0.4.22 <0.7.0; import "./LibDeque.sol"; -contract Example{ +contract Test{ using LibDeque for LibDeque.Deque; LibDeque.Deque private _deque; event Log(uint size); - function example() public returns(bytes32, bytes32){ - _deque.offerFirst(1); - _deque.offerLast(2); + function f() public returns(bytes32, bytes32){ + _deque.offerFirst(bytes32(uint256(1))); + _deque.offerLast(bytes32(uint256(2))); emit Log(_deque.getSize());//Should be 2 bytes32 first =_deque.pollFirst();//Shoud be 0x1 bytes32 last = _deque.pollLast();//Should be 0x2 @@ -97,9 +97,24 @@ contract Example{ #### 实例 ``` - _deque.offerFirst(1); - _deque.offerFirst(2); - uint256 size = _deque.getSize();//Should be 2 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + + function f() public{ + _deque.offerFirst(bytes32(uint256(1))); + emit Log(_deque.getSize());//Should be 1 + } +} + ``` ### ***4. offerLast 函数*** @@ -114,9 +129,24 @@ contract Example{ #### 实例 ``` - _deque.offerLast(1); - _deque.offerLast(2); - uint256 size = _deque.getSize();//Should be 2 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + + function f() public{ + _deque.offerLast(bytes32(uint256(2))); + emit Log(_deque.getSize());//Should be 1 + } +} + ``` ### ***5. pollFirst 函数*** @@ -135,10 +165,25 @@ contract Example{ #### 实例 ``` - _deque.offerLast(1); - _deque.offerLast(2); - bytes32 first = _deque.pollFirst();//Should be 0x1 - uint size = _deque.getSize();//Should be 1 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function f() public returns(bytes32){ + _deque.offerFirst(bytes32(uint256(1))); + _deque.offerLast(bytes32(uint256(2))); + bytes32 r = _deque.pollFirst();//Should be 1 + emit Log(_deque.getSize());//Should be 1 + return (r); + } +} ``` ### ***6. pollLast 函数*** @@ -156,10 +201,25 @@ contract Example{ #### 实例 ``` - _deque.offerLast(1); - _deque.offerLast(2); - bytes32 first = _deque.pollLast();//Should be 0x2 - uint size = _deque.getSize();//Should be 1 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function f() public returns(bytes32){ + _deque.offerFirst(bytes32(uint256(1))); + _deque.offerLast(bytes32(uint256(2))); + bytes32 r = _deque.pollLast();//Should be 2 + emit Log(_deque.getSize());//Should be 1 + return (r); + } +} ``` @@ -178,10 +238,25 @@ contract Example{ #### 实例 ``` - _deque.offerLast(1); - _deque.offerLast(2); - bytes32 first = _deque.peekFirst();//Should be 0x1 - uint size = _deque.getSize();//Should be 2 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function f() public returns(bytes32){ + _deque.offerFirst(bytes32(uint256(1))); + _deque.offerLast(bytes32(uint256(2))); + bytes32 r = _deque.peekFirst();//Should be 1 + emit Log(_deque.getSize());//Should be 2 + return (r); + } +} ``` ### ***8. peekLast 函数*** @@ -199,10 +274,25 @@ contract Example{ #### 实例 ``` - _deque.offerLast(1); - _deque.offerLast(2); - bytes32 first = _deque.peekLast();//Should be 0x2 - uint size = _deque.getSize();//Should be 2 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function f() public returns(bytes32){ + _deque.offerFirst(bytes32(uint256(1))); + _deque.offerLast(bytes32(uint256(2))); + bytes32 r = _deque.peekLast();//Should be 2 + emit Log(_deque.getSize());//Should be 2 + return (r); + } +} ``` ### ***9. push 函数*** @@ -217,7 +307,23 @@ contract Example{ #### 实例 ``` - _deque.push(1); +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function f() public returns(bytes32){ + _deque.push(bytes32(uint256(1))); + _deque.push(bytes32(uint256(2))); + emit Log(_deque.getSize());//Should be 2 + } +} ``` ### ***10. pop 函数*** @@ -235,10 +341,25 @@ contract Example{ #### 实例 ``` - _deque.push(1); - _deque.push(2); - bytes32 value = _deque.pop();//Should be 0x2 - bytes32 value2 = _deque.pop();//Should be 0x1 +pragma solidity>=0.4.22 <0.7.0; + +import "./LibDeque.sol"; + +contract Test{ + + using LibDeque for LibDeque.Deque; + + LibDeque.Deque private _deque; + + event Log(uint size); + function f() public returns(bytes32){ + _deque.push(bytes32(uint256(1))); + _deque.push(bytes32(uint256(2))); + bytes32 pop = _deque.pop();//Should be 2 + emit Log(_deque.getSize());//Should be 1 + return pop; + } +} ``` diff --git a/docs/data_structure/LibLinkedList.md b/docs/data_structure/LibLinkedList.md index 7a12eb5e..6de808b3 100644 --- a/docs/data_structure/LibLinkedList.md +++ b/docs/data_structure/LibLinkedList.md @@ -6,7 +6,7 @@ LibLinkedList提供了双向链表操作,包括链表更新、查询、迭代 首先需要通过import引入LibLinkedList类库,然后通过"."进行方法调用,如下为添加元素的例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibLinkedList.sol"; contract Test { @@ -16,8 +16,8 @@ contract Test { LibLinkedList.LinkedList self; - function add(uint256 d) public{ - self.addNode(bytes32(d)); + function add() public{ + self.addNode(bytes32(uint(2))); } } ``` @@ -56,7 +56,7 @@ contract Test { #### 实例 ``` -uint256 size = self.listSize(); +uint256 size = self.getSize(); ``` ### ***2. addNode 函数*** @@ -74,7 +74,22 @@ addNode函数用于添加一个元素,时间复杂度O(1) #### 实例 ``` -self.addNode(bytes32(1)); +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(uint size); + function f() public{ + self.addNode(bytes32(uint(2))); + uint size = self.getSize(); + emit Log(size);//Expected to be 1 + } +} ``` ### ***3. removeNode 函数*** @@ -93,9 +108,23 @@ removeNode函数用于从链表中删除一个元素,时间复杂度O(1) #### 实例 ``` -self.addNode(bytes32(1)); -self.addNode(bytes32(2)); -self.removeNode(bytes32(2)); +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(uint size); + function f() public{ + self.addNode(bytes32(uint(2))); + self.removeNode(bytes32(uint(2))); + uint size = self.getSize(); + emit Log(size);//Expected to be 0 + } +} ``` ### ***4. getPrev 函数*** @@ -114,9 +143,23 @@ getPrev用于取得一个元素的前一个元素。时间复杂度O(1) #### 实例 ``` -self.addNode(bytes32(1)); -self.addNode(bytes32(2)); -self.getPrev(bytes32(2));//Exptected to be 1 +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(uint size); + function f() public returns(bytes32){ + self.addNode(bytes32(uint(1))); + self.addNode(bytes32(uint(2))); + bytes32 prev = self.getPrev(bytes32(uint(2)));//Expected to be 1 + return prev; + } +} ``` ### ***5. getNext 函数*** @@ -135,9 +178,23 @@ getNext用于取得一个元素的下一个函数。时间复杂度O(1) #### 实例 ``` -self.addNode(bytes32(1)); -self.addNode(bytes32(2)); -self.getNext(bytes32(1));//Exptected to be 2 +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(uint size); + function f() public returns(bytes32){ + self.addNode(bytes32(uint(1))); + self.addNode(bytes32(uint(2))); + bytes32 next = self.getNext(bytes32(uint(1)));//Expected to be 2 + return next; + } +} ``` ### ***6. getTail 函数*** @@ -155,9 +212,23 @@ getTail用于取得链表元素的尾部元素。时间复杂度O(1) #### 实例 ``` -self.addNode(bytes32(1)); -self.addNode(bytes32(2)); -self.getTail();//Exptected to be 2 +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(uint size); + function f() public returns(bytes32){ + self.addNode(bytes32(uint(1))); + self.addNode(bytes32(uint(2))); + bytes32 next = self.getTail();//Expected to be 2 + return next; + } +} ``` ### ***7. getHead 函数*** @@ -175,9 +246,23 @@ getHead用于取得链表元素的头部元素。时间复杂度O(1) #### 实例 ``` -self.addNode(bytes32(1)); -self.addNode(bytes32(2)); -self.getHead();//Exptected to be 1 +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(uint size); + function f() public returns(bytes32){ + self.addNode(bytes32(uint(1))); + self.addNode(bytes32(uint(2))); + bytes32 next = self.getHead();//Expected to be 1 + return next; + } +} ``` ### ***8. 迭代函数*** @@ -187,10 +272,25 @@ self.getHead();//Exptected to be 1 #### 实例 ``` +pragma solidity>=0.4.24 <0.6.11; +import "./LibLinkedList.sol"; + +contract Test { + + using LibLinkedList for LibLinkedList.LinkedList; + + LibLinkedList.LinkedList self; + + event Log(bytes32 val); + function f() public{ + self.addNode(bytes32(uint(1))); + self.addNode(bytes32(uint(2))); + self.addNode(bytes32(uint(3))); bytes32 start = self.iterate_start(); while(self.can_iterate(start)){ - //DO BIZ - + emit Log(start);//Shoud be 1 ,2, 3 start = self.iterate_next(start); } + } +} ``` diff --git a/docs/data_structure/LibMaxHeapUint256.md b/docs/data_structure/LibMaxHeapUint256.md index 1e45ee7e..89036a1b 100644 --- a/docs/data_structure/LibMaxHeapUint256.md +++ b/docs/data_structure/LibMaxHeapUint256.md @@ -8,7 +8,7 @@ LibMaxHeapUint256提供了最大堆的实现。 ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibMaxHeapUint256.sol"; diff --git a/docs/data_structure/LibMinHeapUint256.md b/docs/data_structure/LibMinHeapUint256.md index 639d93b6..74215448 100644 --- a/docs/data_structure/LibMinHeapUint256.md +++ b/docs/data_structure/LibMinHeapUint256.md @@ -8,7 +8,7 @@ LibMinHeapUint256提供了最小堆的实现。 ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibMinHeapUint256.sol"; diff --git a/docs/data_structure/LibQueue.md b/docs/data_structure/LibQueue.md index 33337ec8..49d57b6d 100644 --- a/docs/data_structure/LibQueue.md +++ b/docs/data_structure/LibQueue.md @@ -7,7 +7,7 @@ LibQueue提供了FIFO队列数据结构。 首先需要通过import引入LibQueue类库,然后通过"."进行方法调用,如下为调用LibQueue方法的例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibQueue.sol"; @@ -18,8 +18,8 @@ contract Test { LibQueue.Queue private queue; function f() public { - queue.enqueue(1); - queue.enqueue(2); + queue.enqueue(bytes32(uint(1))); + queue.enqueue(bytes32(uint(1))); bytes32 pop = queue.dequeue();//Expected to be 1 uint size = queue.getSize();//Expected to be 1 } @@ -54,8 +54,24 @@ contract Test { #### 实例 ``` - queue.enqueue(1); - queue.enqueue(2); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibQueue.sol"; + +contract Test { + + using LibQueue for LibQueue.Queue; + + LibQueue.Queue private queue; + + function f() public returns(uint) { + queue.enqueue(bytes32(uint(1))); + queue.enqueue(bytes32(uint(2))); + uint size = queue.getSize();//Expected to be 2 + return (size); + } + +} ``` ### ***2. dequeue 函数*** @@ -72,9 +88,25 @@ contract Test { #### 实例 ``` - queue.enqueue(1); - queue.enqueue(2); - bytes32 pop = queue.dequeue();//Expected to be 1 +pragma solidity>=0.4.24 <0.6.11; + +import "./LibQueue.sol"; + +contract Test { + + using LibQueue for LibQueue.Queue; + + LibQueue.Queue private queue; + + function f() public returns(bytes32, uint) { + queue.enqueue(bytes32(uint(1))); + queue.enqueue(bytes32(uint(2))); + bytes32 head = queue.dequeue();//Expteced to be 1 + uint size = queue.getSize();//Expected to be 1 + return (head, size); + } + +} ``` ### ***3. getSize 函数*** @@ -92,8 +124,6 @@ contract Test { #### 实例 ``` - stack.push(1); - stack.push(2); uint size = queue.getSize();//Expected to be 2 ``` @@ -112,8 +142,24 @@ contract Test { #### 实例 ``` - queue.enqueue(1); - queue.enqueue(2); - bytes32 pop = queue.element();//Expected to be 1 +pragma solidity>=0.4.24 <0.6.11; + +import "./LibQueue.sol"; + +contract Test { + + using LibQueue for LibQueue.Queue; + + LibQueue.Queue private queue; + + function f() public returns(bytes32, uint) { + queue.enqueue(bytes32(uint(1))); + queue.enqueue(bytes32(uint(2))); + bytes32 head = queue.element();//Expteced to be 1 + uint size = queue.getSize();//Expected to be 2 + return (head, size); + } + +} ``` diff --git a/docs/data_structure/LibStack.md b/docs/data_structure/LibStack.md index 0b5a7383..06db0cfc 100644 --- a/docs/data_structure/LibStack.md +++ b/docs/data_structure/LibStack.md @@ -7,7 +7,8 @@ LibStack提供了栈数据结构。 首先需要通过import引入LibStack类库,然后通过"."进行方法调用,如下为调用LibStack方法的例子: ``` -pragma solidity ^0.6.10; + +pragma solidity>=0.4.24 <0.6.11; import "./LibStack.sol"; @@ -17,14 +18,15 @@ contract Test { LibStack.Stack private stack; - function f() public { - stack.push(1); - stack.push(2); + function f() public returns(bytes32, uint) { + stack.push(bytes32(uint(1))); + stack.push(bytes32(uint(2))); bytes32 pop = stack.pop();//Expect to be 2 uint size = stack.getSize();//Expected to be 1 + return (pop, size); } - } + ``` @@ -55,7 +57,24 @@ contract Test { #### 实例 ``` -stack.push(1); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibStack.sol"; + +contract Test { + + using LibStack for LibStack.Stack; + + LibStack.Stack private stack; + + function f() public returns(uint ) { + + stack.push(bytes32(uint(2))); + uint size = stack.getSize();//Expected to be 1 + return size; + } + +} ``` ### ***2. pop 函数*** @@ -72,9 +91,26 @@ stack.push(1); #### 实例 ``` - stack.push(1); - stack.push(2); - bytes32 pop = stack.pop();//Expect to be 2 + +pragma solidity>=0.4.24 <0.6.11; + +import "./LibStack.sol"; + +contract Test { + + using LibStack for LibStack.Stack; + + LibStack.Stack private stack; + + function f() public returns(bytes32, uint) { + stack.push(bytes32(uint(1))); + stack.push(bytes32(uint(2))); + bytes32 pop = stack.pop();//Expect to be 2 + uint size = stack.getSize();//Expected to be 1 + return (pop, size); + } +} + ``` ### ***3. peek 函数*** @@ -92,9 +128,25 @@ stack.push(1); #### 实例 ``` - stack.push(1); - stack.push(2); - bytes32 pop = stack.peek();//Expected to be 2 + +pragma solidity>=0.4.24 <0.6.11; + +import "./LibStack.sol"; + +contract Test { + + using LibStack for LibStack.Stack; + + LibStack.Stack private stack; + + function f() public returns(bytes32, uint) { + stack.push(bytes32(uint(1))); + stack.push(bytes32(uint(2))); + bytes32 top = stack.peek();//Expect to be 2 + uint size = stack.getSize();//Expected to be 2 + return (top, size); + } +} ``` diff --git a/docs/data_structure/data_structure.lnk b/docs/data_structure/data_structure.lnk new file mode 100644 index 0000000000000000000000000000000000000000..5e53714db3bb53e94d447c5d1aa84d03f9da7dc1 GIT binary patch literal 1526 zcmcIkUr1A76#vb{e^g$}M9t+W!iA_)g4DDWoenhrTvr&~(Cc-%HQj2vLj!{%Dk2kK zd3l1PG)TUGl!m`Qg{;hbK<9ma|kfo$g@3vobe9itmiojnjs2r4hft`vl~g zOd}a6FqcYUqljWfp|&Uy&!q|Ia;SD+2XF|9h{fWotmd2}e3DN#$Kv8iZjQXFY0dlf zx-K}N!VVwkRiwca@>weyD+To0I%Jo#quZ@G6}#+k0b>jW#}PBg=S`yLOGU;Gfe`N5R(_xq1?*E%X&Uz zCVz4)NoI>4N9U8s+wY#eWROnG!8<7vabzgywmrttsve)b`acwea&p-5nbn`h3}5;w zpp#-&32pFd8Thmee3T2h!Y)D|A&bC`#B&jWM=v3bz;W024N_f!>Pl;6A*hprjUuhS zTWNLarEq1W)p-;npC0M2a-&<2)~kgezocioy(`sy<{`@-w@b16@?6}vfu(xrhf&vd zW_)(%Lfq8-K-ZOJvqhdu83_m{CUk}i8=dD;`z8XTBjl^FrKx4!^zvgBuGNkQrnirI zPwl=)`<+abo(-v(dhn_$vmzyhchky1hv9;r4v!i!6vn(xab!xjz0vefgle@#g3^7l z<{og%c9weqmrpi{batnoj5-q@&jo(|oj$jc&8~t2<*myxl&@==^;snpaguh$c>SEf z@!UPF7|VxeQl9uR+4v!Snv2Nosd+Nf{C~>w?_I<(@hbm1;1ap!swzxov5z?p^2f^i g2K2OVX9EkN_3PnB@lPiz@4e^@^z6Ag%lj+i7X%$b6951J literal 0 HcmV?d00001 diff --git a/docs/default/Crypto.md b/docs/default/Crypto.md index 4f01b404..83e7ad35 100644 --- a/docs/default/Crypto.md +++ b/docs/default/Crypto.md @@ -5,7 +5,7 @@ Crypto提供了密码学操作 ## 使用方法 ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; pragma experimental ABIEncoderV2; diff --git a/docs/types/LibAddress.md b/docs/types/LibAddress.md index 18759deb..c02bd84b 100644 --- a/docs/types/LibAddress.md +++ b/docs/types/LibAddress.md @@ -7,7 +7,7 @@ LibAddress提供了address数据类型的基本操作,相关API列表如下。 首先需要通过import引入LibAddresss类库,然后通过"."进行方法调用,如下为调用isEmptyAddress方法的例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibAddress.sol" @@ -50,7 +50,7 @@ isContract方法用于判断一个address是否为合约地址。 #### 实例 ``` -address myContract = "0x2177482819289293288f8d8s88f99f99s"; +address myContract = 0xE0f5206BBD039e7b0592d8918820024e2a7437b9; if(LibAddress.isContract(myContract)){ //TODO: } @@ -70,7 +70,8 @@ isEmptyAddress方法用于判断一个address是否为空地址。 #### 实例 ``` -address addr = "0x00"; + +address addr = address(0); if(!LibAddress.isEmptyAddress(addr)){ //TODO: } @@ -90,8 +91,8 @@ addressToBytes方法可以把一个地址类型转化为bytes类型。 #### 实例 ``` -address addr = "0xdfe34njfdkajfej9890f"; -bytes bs = LibAddress.addressToBytes(addr); +address addr = 0xE0f5206BBD039e7b0592d8918820024e2a7437b9; +bytes memory bs = LibAddress.addressToBytes(addr); //TODO: ``` @@ -101,7 +102,7 @@ bytesToAddress方法可以把一个bytes类型转化为address类型。 #### 参数 -- bytes:字节数组 +- bytes:字节数组。要求20字节。 #### 返回值 @@ -110,7 +111,7 @@ bytesToAddress方法可以把一个bytes类型转化为address类型。 #### 实例 ``` -bytes bs = "0xdfe34njfdkajfej9890f"; +bytes memory bs = new bytes(20); address addr = LibAddress.bytesToAddress(bs); //TODO: ``` @@ -130,8 +131,8 @@ addressToString方法可以把一个address类型转化为string类型。 #### 实例 ``` -address addr = "0xdfe34njfdkajfej9890f"; -string addrStr = LibAddress.addressToString(addr); +address addr = 0xE0f5206BBD039e7b0592d8918820024e2a7437b9; +string memory addrStr = LibAddress.addressToString(addr); //TODO: ``` @@ -150,7 +151,7 @@ stringToAddress方法可以把一个string类型转化为address类型。 #### 实例 ``` -string str = "0xdfe34njfdkajfej9890f"; +string memory str = "0xE0f5206BBD039e7b0592d8918820024e2a7437b9"; address addr = LibAddress.stringToAddress(str); //TODO: ``` diff --git a/docs/types/LibArrayForUint256Utils.md b/docs/types/LibArrayForUint256Utils.md index 610973fc..106f2625 100644 --- a/docs/types/LibArrayForUint256Utils.md +++ b/docs/types/LibArrayForUint256Utils.md @@ -7,20 +7,23 @@ LibArrayForUint256Utils提供了Uint256数组的相关操作,包括查找、 首先需要通过import引LibArrayForUint256Utils类库,然后通过"."进行方法调用,如下为调用indexOf方法的例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; -import "./LibArrayForUint256Utils.sol" +import "./LibArrayForUint256Utils.sol"; contract test { - function f(uint256[] storage array) public view returns(bool) { - uint256 key = 25; + uint[] private array; + + function f() public returns(bool, uint) { + array = new uint[](3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + uint256 key = 3; bool flag; uint index; - (flag, index) = LibArrayForUint256Utils.indexOf(array, key); - if(flag){ - //TODO: - } + return LibArrayForUint256Utils.firstIndexOf(array, key);//Expected (true, 2) } } ``` @@ -63,19 +66,29 @@ binarySearch对一个升序排列的数组进行二分查找,如果找到, #### 实例 ``` -function f(uint256[] storage array) public view returns(bool) { - uint256 key = 25; - bool flag; - uint index; - (flag, index) = LibArrayForUint256Utils.binarySearch(array, key); - if(flag){ - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(bool, uint) { + array = new uint[](3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + uint256 key = 3; + bool flag; + uint index; + return LibArrayForUint256Utils.binarySearch(array, key);//Expected (true, 2) } } ``` -### ***2. indexOf 方法*** +### ***2. firstIndexOf 方法*** -indexOf对任意数组进行查找,如果找到,则返回true,并返回第一个匹配的元素索引;反之,返回(false,0) +对任意数组进行查找,如果找到,则返回true,并返回第一个匹配的元素索引;反之,返回(false,0) #### 参数 @@ -90,13 +103,23 @@ indexOf对任意数组进行查找,如果找到,则返回true,并返回第 #### 实例 ``` -function f(uint256[] storage array) public view returns(bool) { - uint256 key = 25; - bool flag; - uint index; - (flag, index) = LibArrayForUint256Utils.indexOf(array, key); - if(flag){ - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(bool, uint) { + array = new uint[](3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + uint256 key = 3; + bool flag; + uint index; + return LibArrayForUint256Utils.firstIndexOf(array, key);//Expected (true, 2) } } ``` @@ -116,9 +139,21 @@ reverse方法对任意数组进行元素翻转。 #### 实例 ``` -function f(uint256[] storage array) public view returns(bool) { - LibArrayForUint256Utils.reverse(array); - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public { + array = new uint[](3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + LibArrayForUint256Utils.reverse(array);//array becomes 3 2 1 + } } ``` @@ -138,10 +173,24 @@ equals方法用于判断两个数组是否相等,当两个数组的元素完 #### 实例 ``` -function f(uint256[] storage a, uint256[] storage b) public view returns(bool) { - bool flag = LibArrayForUint256Utils.equals(array); - if(flag){ - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array1; + uint[] private array2; + + function f() public returns(bool) { + array1 = new uint[](3); + array1[0] = 1; + array1[1] = 2; + + array2 = new uint[](3); + array2[0] = 1; + array2[1] = 2; + return LibArrayForUint256Utils.equals(array1, array2); } } ``` @@ -162,10 +211,22 @@ removeByIndex方法用于根据索引删除数组元素。当数据越界时报 #### 实例 ``` -function f(uint256[] storage a) public view returns(bool) { - uint index = 10; - LibArrayForUint256Utils.removeByIndex(array,index); - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint) { + array = new uint[](3); + array[0] = 1; + array[1] = 2; + array[2] = 3; + LibArrayForUint256Utils.removeByIndex(array,0); + return array.length;//Expect 2 + } } ``` @@ -185,10 +246,22 @@ removeByValue方法用于根据元素值删除数组元素。当数据越界时 #### 实例 ``` -function f(uint256[] storage a) public view returns(bool) { - uint256 value = 100; - LibArrayForUint256Utils.removeByValue(array,value); - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint) { + array = new uint[](3); + array[0] = 1; + array[1] = 2; + array[2] = 2; + LibArrayForUint256Utils.removeByValue(array,2); + return array.length;//Expect 2 + } } ``` @@ -208,10 +281,19 @@ addValue方法用于向数组中添加元素,且保持数组的元素唯一。 #### 实例 ``` -function f(uint256[] storage a) public view returns(bool) { - uint256 value = 100; - LibArrayForUint256Utils.addValue(array,value); - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint) { + array = new uint[](0); + LibArrayForUint256Utils.addValue(array,2); + return array.length;//Expect 1 + } } ``` @@ -231,9 +313,21 @@ extend方法用于合并两个数组,将第二个数组中的元素按照顺 #### 实例 ``` -function f(uint256[] storage a, uint256[] storage b) public view returns(bool) { - LibArrayForUint256Utils.extend(a,b); - //TODO: +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + uint[] private array2; + + function f() public returns(uint) { + array = new uint[](2); + array2 = new uint[](2); + LibArrayForUint256Utils.extend(array,array2); + return array.length;//Expect 4 + } } ``` @@ -252,10 +346,22 @@ distinct方法用于对数组进行去重操作。 #### 实例 ``` -function f() public view returns(bool) { - uint256 array = [1,2,1,3,4,5,4,7,10]; - LibArrayForUint256Utils.distinct(array); - //array = [1,2,3,4,5,7,10] +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint) { + array = new uint[](3); + array[0] = 2; + array[1] = 2; + array[2] = 2; + LibArrayForUint256Utils.distinct(array); + return array.length;//Expect 1 + } } ``` @@ -274,10 +380,22 @@ qsort方法用于对数组进行快速排序。 #### 实例 ``` -function f() public view returns(bool) { - uint256 array = [1,5,3,7,4]; - LibArrayForUint256Utils.qsort(array); - //array = [1,3,4,5,7] +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint,uint,uint) { + array = new uint[](3); + array[0] = 3; + array[1] = 2; + array[2] = 1; + LibArrayForUint256Utils.qsort(array); + return (array[0], array[1], array[2]);//expect 1,2,3 + } } ``` @@ -297,10 +415,21 @@ function f() public view returns(bool) { #### 实例 ``` -function f(uint256[] storage array) public view returns(bool) { - uint256 value; - uint256 index; - (value, index) = LibArrayForUint256Utils.max(array); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint, uint) { + array = new uint[](3); + array[0] = 3; + array[1] = 2; + array[2] = 1; + return LibArrayForUint256Utils.max(array);//3 , 0 + } } ``` @@ -320,9 +449,20 @@ function f(uint256[] storage array) public view returns(bool) { #### 实例 ``` -function f(uint256[] storage array) public view returns(bool) { - uint256 value; - uint256 index; - (value, index) = LibArrayForUint256Utils.min(array); +pragma solidity>=0.4.24 <0.6.11; + +import "./LibArrayForUint256Utils.sol"; + +contract test { + + uint[] private array; + + function f() public returns(uint, uint) { + array = new uint[](3); + array[0] = 3; + array[1] = 2; + array[2] = 1; + return LibArrayForUint256Utils.min(array);//1 , 2 + } } ``` \ No newline at end of file diff --git a/docs/types/LibConverter.md b/docs/types/LibConverter.md index 0c0e535a..981a65d8 100644 --- a/docs/types/LibConverter.md +++ b/docs/types/LibConverter.md @@ -7,7 +7,7 @@ LibConverter提供各类solidity数据基本类型的转换,包括uint256转ui 首先需要通过import引入LibConverter类库,调用库的相关方法: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibConverter.sol" @@ -164,7 +164,7 @@ function f() public view{ ``` function f() public view{ uint256 a = 25; - bytes b = LibConverter.uintToBytes(a); + bytes memory b = LibConverter.uintToBytes(a); //TODO: } ``` @@ -185,7 +185,7 @@ function f() public view{ ``` function f() public view{ - bytes a = "25"; + bytes memory a = "25"; int b = LibConverter.bytesToInt(a); //TODO: } @@ -208,7 +208,7 @@ function f() public view{ ``` function f() public view{ int a = 25; - bytes b = LibConverter.intToBytes(a); + bytes memory b = LibConverter.intToBytes(a); //TODO: } ``` diff --git a/docs/types/LibSafeMathForUint256Utils.md b/docs/types/LibSafeMathForUint256Utils.md index 1460517a..a0a6f31d 100644 --- a/docs/types/LibSafeMathForUint256Utils.md +++ b/docs/types/LibSafeMathForUint256Utils.md @@ -7,7 +7,7 @@ LibSafeMathForUint256Utils提供了Uint256类型的相关计算操作,且保 首先需要通过import引LibSafeMathForUint256Utils类库,然后通过"."进行方法调用,如下为调用add方法的例子: ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibSafeMathForUint256Utils.sol" diff --git a/docs/types/LibString.md b/docs/types/LibString.md index f02e5c42..c847b786 100644 --- a/docs/types/LibString.md +++ b/docs/types/LibString.md @@ -7,16 +7,16 @@ LibString提供了常用的字符串操作。这些操作是基于字符的, 首先需要通过import引入LibString类库, 以下为使用示例 ``` -pragma solidity ^0.6.10; +pragma solidity>=0.4.24 <0.6.11; import "./LibString.sol"; contract TestString { - function f() public view returns(uint){ + function f() public view returns(uint ){ string memory str = "字符串"; uint len = LibString.lenOfChars(str);//Expected to be 3 - //TODO: + return len; } } ``` @@ -60,10 +60,10 @@ contract TestString { #### 实例 ``` - function f() public view{ + function f() public view returns(uint ){ string memory str = "字符串"; uint len = LibString.lenOfChars(str);//Expected to be 3 - //TODO: + return len; } ``` @@ -82,10 +82,10 @@ contract TestString { #### 实例 ``` - function f() public view{ + function f() public view returns(uint ){ string memory str = "字符串"; uint len = LibString.lenOfBytes(str);//Expected to be 9 - //TODO: + return len; } ``` @@ -105,10 +105,9 @@ startWith用于判断一个字符串是否为另一个字符串的前缀串 #### 实例 ``` - function f() public view { - + function f() public view returns(bool){ bool r = LibString.startWith("abcd","ab");//Expected to be true - //TODO: + return r; } ``` @@ -128,10 +127,9 @@ endWith用于测试一个字符串是否为另一个字符串的尾缀串 #### 实例 ``` - function f() public view { - - bool r = LibString.endWith("abcd","cd");//Expected to be true - //TODO: + function f() public view returns(bool){ + bool r = LibString.startWith("abcd","cd");//Expected to be true + return r; } ``` @@ -151,10 +149,9 @@ endWith用于测试一个字符串是否为另一个字符串的尾缀串 #### 实例 ``` - function f() public view { - + function f() public view returns(bool){ bool r = LibString.equal("abcd","abcd");//Expected to be true - //TODO: + return r; } ``` @@ -174,10 +171,9 @@ endWith用于测试一个字符串是否为另一个字符串的尾缀串 #### 实例 ``` - function f() public view { - - bool r = LibString.equal("abcd","ABCD");//Expected to be true - //TODO: + function f() public view returns(bool){ + bool r = LibString.equalNocase("abcd","ABCD");//Expected to be true + return r; } ``` @@ -196,7 +192,7 @@ endWith用于测试一个字符串是否为另一个字符串的尾缀串 #### 实例 ``` - function f() public view returns(bool, bool){ + function f() public returns(bool, bool){ bool r1 = LibString.empty("abcd");//Expected to be false bool r2 = LibString.empty("");//Expected to be true @@ -221,10 +217,10 @@ endWith用于测试一个字符串是否为另一个字符串的尾缀串 #### 实例 ``` - function f() public view { + function f() public returns(string memory){ string memory s1 = "ab"; string memory s2 = "cd"; - string memory r = LibString.concat(s1,s2);//Exptected to be abcd + return LibString.concat(s1,s2);//Exptected to be abcd } ``` @@ -245,7 +241,7 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view returns(string) { + function f() public returns(string memory) { string memory full = "完整字符串"; string memory sub = LibString.substrByCharIndex(full ,2, 3);//Expected to be 字符串 return sub; @@ -268,7 +264,7 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + function f() public view returns(int8){ int8 c = LibString.compare("abcd","abcd");// Expected to be 0 } @@ -291,9 +287,9 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + function f() public view returns(int8){ - int8 c = LibString.compareNocase("abcd","ABCD");// Expected to be 0 + int8 c = LibString.compareNocase("abcd","abcd");// Expected to be 0 } ``` @@ -312,9 +308,10 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + function f() public view returns(string memory) { - string c = LibString.toUppercase("abcd");// Expected to be ABCD + string memory c = LibString.toUppercase("abcd");// Expected to be ABCD + return c; } ``` @@ -333,9 +330,10 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + function f() public view returns(string memory) { - string c = LibString.toLowercase("ABCD");// Expected to be abcd + string memory c = LibString.toLowercase("ABCD");// Expected to be abcd + return c; } ``` @@ -355,9 +353,10 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + function f() public view returns(int) { int c = LibString.indexOf("ABCD", "B");// Expected to be 1 + return c; } ``` @@ -378,9 +377,11 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + function f() public view returns(int){ int c = LibString.indexOf("ABCD", "B", 0);// Expected to be 1 + return c; + } ``` @@ -401,8 +402,11 @@ substrByCharIndex方法用于提取子字符串。 #### 实例 ``` - function f() public view { + + function f() public view returns(string[] memory){ + + string[] memory c = LibString.split("A,B,CD", ",");// Expected to be ["A", "B", "CD"] + return c; - string[] c = LibString.split("A,B,CD", ",");// Expected to be ["A", "B", "CD"] } ``` \ No newline at end of file From fc412faf832681d754f9d23ff0fcd5a653ab2c08 Mon Sep 17 00:00:00 2001 From: aoronchu Date: Tue, 9 Mar 2021 16:08:52 +0800 Subject: [PATCH 23/23] . --- docs/data_structure/LibBytes32Set.md | 173 --------------------------- 1 file changed, 173 deletions(-) delete mode 100644 docs/data_structure/LibBytes32Set.md diff --git a/docs/data_structure/LibBytes32Set.md b/docs/data_structure/LibBytes32Set.md deleted file mode 100644 index da8764dd..00000000 --- a/docs/data_structure/LibBytes32Set.md +++ /dev/null @@ -1,173 +0,0 @@ -# LibBytes32Set.sol - -LibBytes32Set 提供了存储bytes32类型的Set数据结构,支持包括add, remove, contains, get, getAll, size等方法。 - -## 使用方法 - -首先需要通过import引入LibBytes32Set类库,然后通过"."进行方法调用,如下为调用LibBytes32Set方法的例子: - -``` -pragma solidity ^0.6.10; - -import "./LibBytes32Set.sol"; - -contract TestSet { - using LibBytes32Set for LibBytes32Set.Bytes32Set; - LibBytes32Set.Bytes32Set private bytes32Set; - - function testBytes32() public { - bytes32Set.add(bytes32(1)); - uint256 size = bytes32Set.size();//Expected to be 1 - } - -} -``` - - -## API列表 - -编号 | API | API描述 ----|---|--- -1 | *add(Bytes32Set storage self, bytes32 value) internal* | 往Set里添加元素。 -2 | *contains(Bytes32Set storage self, bytes32 value) internal view returns (bool)* | 判断Set里是否包含了元素value。 -3 | *remove(Bytes32Set storage self, bytes32 value) internal* | 删除Set中的元素。 -4 | *size(Bytes32Set storage self) internal view returns (uint256)* | 获取Set内元素数。 -5 | *get(Bytes32Set storage self, uint256 index) internal view returns (Bytes32)* | 查询某个Set的元素。 -6 | *getAll(Bytes32Set storage self) internal view returns(bytes32[])* | 返回所有元素。 -7 | *destroy(Bytes32Set storage self) internal* | 销毁Set。 - -## API详情 - -### ***1. add 函数*** - -往Set里添加元素 - -#### 参数 - -- Bytes32Set: set容器 -- bytes32: 元素 - -#### 返回值 - - -#### 实例 - -``` -pragma solidity ^0.6.10; - -import "./LibBytes32Set.sol"; - -contract TestSet { - using LibBytes32Set for LibBytes32Set.Bytes32Set; - LibBytes32Set.Bytes32Set private Bytes32Set; - - function testBytes32() public { - bytes32Set.add(bytes32(1)); - } - -} -``` - -### ***2. contains 函数*** - -判断Set里是否包含了元素value。 - -#### 参数 - -- Bytes32Set: set容器 -- bytes32: 元素 - -#### 返回值 -- bool: 是否包含 - -#### 实例 - -``` - bool b = bytes32Set.contains(bytes32(1)); -``` - -### ***3. remove 函数*** - -删除Set中的指定元素 - -#### 参数 - -- Bytes32Set: set容器 -- bytes32: 元素 - -#### 返回值 - - -#### 实例 - -``` - ddressSet.remove(bytes32(1)); -``` - -### ***4. size 函数*** - -查询Set中的元素数量。 - -#### 参数 - -- Bytes32Set: set容器 - -#### 返回值 -- uint256: 元素数量 - -#### 实例 - -``` - uint256 setSize = bytes32Set.size(); -``` - -### ***5. get 函数*** - -查询Set中指定index的值 - -#### 参数 - -- Bytes32Set: set容器 -- uint256: index - -#### 返回值 -- bytes32: 元素 - -#### 实例 - -``` - bytes32 value = bytes32Set.get(0); -``` - -### ***6. getAll 函数*** - -查询Set中所有的值,返回一个bytes32[]数组 - -#### 参数 - -- Bytes32Set: set容器 - -#### 返回值 -- bytes32[]: 所有元素值 - -#### 实例 - -``` - bytes32[] values = bytes32Set.getAll(); -``` - -### ***7. destroy 函数*** - -销毁Set。 - -#### 参数 - -- Bytes32Set: set容器 - -#### 返回值 - -#### 实例 - -``` - bytes32Set.destroy(); -```

AltStyle によって変換されたページ (->オリジナル) /