diff --git a/CHANGELOG.md b/CHANGELOG.md index 7e62d45..ecda692 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,19 @@ All notable changes to this project will be documented in this file. +## [[2.0.0]](https://github.com/iExecBlockchainComputing/iexec-commons-poco/releases/tag/v2.0.0) 2023 + +### New Features +- Upgrade `web3j` dependency from 4.8.9 to 4.9.7. (#8) +- Regenerate all wrappers with new web3j cli version. (#8) +- Update the readme file with the generation instructions. (#8) +- Add `PLEASE_CONTRIBUTE_AND_FINALIZE` to `TaskNotificationType`. (#9) +- Add `com.iexec.commmons.poco.order` package. (#10) +- Add `com.iexec.commons.poco.eip712` package. (#11) +- Add `MatchOrdersTests` on nethermind `poco-chain`. (#12) +### Bug Fixes +- Set `protected` visibility on abstract classes constructors. (#13) + ## [[1.0.2]](https://github.com/iExecBlockchainComputing/iexec-commons-poco/releases/tag/v1.0.2) 2023-04-11 ### Bug Fixes diff --git a/README.md b/README.md index d49f2fb..5b848fc 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,41 @@ # iexec-commons-poco PoCo Java wrappers for the iExec platform + + +## Steps to generate Java Wrappers for Smart Contracts + +First you need to install last version of Web3j CLI, the simplest way to install the Web3j CLI is via the following script: + +``` +curl -L get.web3j.io | sh && source ~/.web3j/source.sh +``` +Verify the installation was successful +``` +web3j -v +Version: 1.4.2 +``` + +After, you need to clone `Poco-dev` repository +``` +git clone https://github.com/iExecBlockchainComputing/PoCo-dev/ +cd PoCo-dev +git checkout x.y.z +``` + +Edit script `generateContractWrappers` and check lines *15* and *18*. If necessary, adjust the directories to match your local work tree. +``` shell +#Put here the PoCo-dev directory that contains smart contracts (JSON files) +POCO_DEV_CONTRACTS_DIRECTORY=${HOME}/iexecdev/PoCo-dev/build/contracts/ + +#Put here the src/main/java/ directory of commons-poco project +COMMONS_POCO_WRAPPER_DIRECTORY=${HOME}/iexecdev/iexec-commons-poco/src/main/java/ +``` + +Clean `IexecLibOrders_v5.OrderOperationEnum` references from `IexecLibOrders_v5.json` with your favorite editor(Only in abi node). + +You can now run the script +``` shell +./generateContractWrappers App AppRegistry Dataset DatasetRegistry Ownable Workerpool WorkerpoolRegistry IexecInterfaceTokenABILegacy IexecLibOrders_v5 +``` + +After this execution and if no error has occurred, you must rename `IexecInterfaceTokenABILegacy.java` to `IexecHubContract.java` and also rename the java class. diff --git a/build.gradle b/build.gradle index a646087..7ef41c7 100644 --- a/build.gradle +++ b/build.gradle @@ -31,7 +31,9 @@ repositories { dependencies { implementation platform('org.springframework.boot:spring-boot-dependencies:2.6.14') - api 'org.web3j:core:4.8.9' + + // web3j + api 'org.web3j:core:4.9.7' // apache commons.lang3 implementation 'org.apache.commons:commons-lang3' @@ -39,23 +41,25 @@ dependencies { // multiaddresses (IPFS) implementation 'com.github.multiformats:java-multiaddr:v1.4.6' - //jaxb required with Java 11 + // jaxb required with Java 11 DataTypeConverter in BytesUtils implementation 'javax.xml.bind:jaxb-api' // failsafe implementation 'net.jodah:failsafe:2.4.4' - //TODO Migrate from Awaitility to Failsafe everywhere + //TODO Migrate from Awaitility to Failsafe everywhere implementation 'org.awaitility:awaitility' - //json - implementation 'javax.validation:validation-api' - + // javax annotations like PostConstruct implementation 'javax.annotation:javax.annotation-api' // tests testImplementation 'org.junit.jupiter:junit-jupiter' testImplementation 'org.mockito:mockito-junit-jupiter' testImplementation 'org.assertj:assertj-core' + testImplementation 'org.testcontainers:junit-jupiter:1.17.2' + + // logback + testRuntimeOnly 'ch.qos.logback:logback-classic' } java { diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..7c4ea27 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,5 @@ +services: + poco-chain: + image: docker-regis.iex.ec/poco-chain:native-v5.4.2-5s + expose: + - "8545" diff --git a/generateContractWrappers b/generateContractWrappers new file mode 100755 index 0000000..f512b0a --- /dev/null +++ b/generateContractWrappers @@ -0,0 +1,59 @@ +#!/usr/bin/env bash + +################################################################### +#Script Name : generateContractWrappers +#Description : Script to facilitate the generation of java wrappers +#Args : list of smart contracts json files without extension +#Exemple : ./generateContractWrappers App AppRegistry +#Author : iExec +################################################################### + +set -Eeuo pipefail + + +#Put here the PoCo-dev directory that contains smart contracts (JSON files) +POCO_DEV_CONTRACTS_DIRECTORY=${HOME}/iexecdev/PoCo-dev/build/contracts/ + +#Put here the src/main/java/ directory of commons-poco project +COMMONS_POCO_WRAPPER_DIRECTORY=${HOME}/iexecdev/iexec-commons-poco/src/main/java/ + +#Put here the java package for commons-poco Wrappers +COMMONS_POCO_PACKAGE='com.iexec.commons.poco.contract.generated' + + +check_mandatory_dependency(){ + CMDS="web3j" + + for i in $CMDS + do + command -v $i >/dev/null && continue || { echo "$i command not found."; exit 1; } + done +} + +check_mandatory_directory(){ + if [ ! -d "$1" ]; + then + echo "$1 directory does not exist." + exit 1 + fi +} + +generate_wrapper() { + if test -f "$POCO_DEV_CONTRACTS_DIRECTORY$1.json"; then + web3j generate truffle --truffle-json $POCO_DEV_CONTRACTS_DIRECTORY$1.json -o $COMMONS_POCO_WRAPPER_DIRECTORY -p $COMMONS_POCO_PACKAGE + else + echo "Missing $POCO_DEV_CONTRACTS_DIRECTORY$1.json file" + exit 1 + fi +} + + +check_mandatory_dependency +check_mandatory_directory $POCO_DEV_CONTRACTS_DIRECTORY +check_mandatory_directory $COMMONS_POCO_WRAPPER_DIRECTORY + + +for var in "$@" +do + generate_wrapper $var +done diff --git a/gradle.properties b/gradle.properties index 6058f60..5afd1ed 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ -version=1.0.2 +version=2.0.0 nexusUser nexusPassword diff --git a/lombok.config b/lombok.config new file mode 100644 index 0000000..189c0be --- /dev/null +++ b/lombok.config @@ -0,0 +1,3 @@ +# This file is generated by the 'io.freefair.lombok' Gradle plugin +config.stopBubbling = true +lombok.addLombokGeneratedAnnotation = true diff --git a/src/main/java/com/iexec/commons/poco/chain/IexecHubAbstractService.java b/src/main/java/com/iexec/commons/poco/chain/IexecHubAbstractService.java index fa919b0..d545ead 100644 --- a/src/main/java/com/iexec/commons/poco/chain/IexecHubAbstractService.java +++ b/src/main/java/com/iexec/commons/poco/chain/IexecHubAbstractService.java @@ -83,21 +83,13 @@ public abstract class IexecHubAbstractService { // /!\ TODO remove expired task descriptions private final Map taskDescriptions = new HashMap<>(); - public IexecHubAbstractService(Credentials credentials, - Web3jAbstractService web3jAbstractService, - String iexecHubAddress) { + protected IexecHubAbstractService( + Credentials credentials, + Web3jAbstractService web3jAbstractService, + String iexecHubAddress) { this(credentials, web3jAbstractService, iexecHubAddress, Duration.ofMillis(DEFAULT_BLOCK_TIME), 6, 3); } - @Deprecated - public IexecHubAbstractService(Credentials credentials, - Web3jAbstractService web3jAbstractService, - String iexecHubAddress, - int nbBlocksToWaitPerRetry, - int maxRetries) { - this(credentials, web3jAbstractService, iexecHubAddress, Duration.ofMillis(DEFAULT_BLOCK_TIME), nbBlocksToWaitPerRetry, maxRetries); - } - /** * Base constructor for the IexecHubAbstractService * @param credentials credentials for sending transaction @@ -107,12 +99,13 @@ public IexecHubAbstractService(Credentials credentials, * @param nbBlocksToWaitPerRetry nb block to wait per retry * @param maxRetries maximum reties */ - public IexecHubAbstractService(Credentials credentials, - Web3jAbstractService web3jAbstractService, - String iexecHubAddress, - Duration blockTime, - int nbBlocksToWaitPerRetry, - int maxRetries) { + protected IexecHubAbstractService( + Credentials credentials, + Web3jAbstractService web3jAbstractService, + String iexecHubAddress, + Duration blockTime, + int nbBlocksToWaitPerRetry, + int maxRetries) { this.credentials = credentials; this.web3jAbstractService = web3jAbstractService; this.iexecHubAddress = iexecHubAddress; diff --git a/src/main/java/com/iexec/commons/poco/chain/Web3jAbstractService.java b/src/main/java/com/iexec/commons/poco/chain/Web3jAbstractService.java index 7e49e87..21220a8 100644 --- a/src/main/java/com/iexec/commons/poco/chain/Web3jAbstractService.java +++ b/src/main/java/com/iexec/commons/poco/chain/Web3jAbstractService.java @@ -42,7 +42,7 @@ @Slf4j public abstract class Web3jAbstractService { - private static final long GAS_LIMIT_CAP = 500000; + static final long GAS_LIMIT_CAP = 1000000; private final float gasPriceMultiplier; private final long gasPriceCap; private final boolean isSidechain; @@ -53,7 +53,7 @@ public abstract class Web3jAbstractService { * Apart from initializing usual business entities, it initializes a single * and shared web3j instance. This inner web3j instance allows to connect to * a remote blockchain node. - * + *

* If reusing a whole web3j instance between calls might be overkilled, it * is important to use a single and shared HttpService. * The usage of a single HttpService ensures the creation of a single @@ -65,10 +65,11 @@ public abstract class Web3jAbstractService { * @param gasPriceCap gas price cap * @param isSidechain true if iExec native chain, false if iExec token chain */ - public Web3jAbstractService(String chainNodeAddress, - float gasPriceMultiplier, - long gasPriceCap, - boolean isSidechain) { + protected Web3jAbstractService( + String chainNodeAddress, + float gasPriceMultiplier, + long gasPriceCap, + boolean isSidechain) { this.chainNodeAddress = chainNodeAddress; this.gasPriceMultiplier = gasPriceMultiplier; this.gasPriceCap = gasPriceCap; @@ -328,7 +329,7 @@ static BigInteger getGasLimitForFunction(String functionName) { gasLimit = 100000;//seen 56333 break; case FUNC_FINALIZE: - gasLimit = 3000000;//seen 175369 (242641 in reopen case) + gasLimit = 300000;//seen 175369 (242641 in reopen case) break; case FUNC_REOPEN: gasLimit = 500000;//seen 43721 diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/App.java b/src/main/java/com/iexec/commons/poco/contract/generated/App.java index 02bc7ea..f5a65d2 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/App.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/App.java @@ -43,11 +43,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class App extends Contract { - public static final String BINARY = "0x608060405234801561001057600080fd5b50610a19806100206000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806384aaf12e1161006657806384aaf12e146101c157806386c02c8f146101db5780638da5cb5b14610416578063e30d26a81461041e578063f8c2ceb31461042657610093565b80633121db1c14610098578063358982a31461011857806339e75d45146101955780637b1039991461019d575b600080fd5b610116600480360360408110156100ae57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156100d857600080fd5b8201836020820111156100ea57600080fd5b803590602001918460018302840111600160201b8311171561010b57600080fd5b50909250905061042e565b005b6101206104d7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610120610564565b6101a56105bf565b604080516001600160a01b039092168252519081900360200190f35b6101c96105ce565b60408051918252519081900360200190f35b610116600480360360a08110156101f157600080fd5b810190602081018135600160201b81111561020b57600080fd5b82018360208201111561021d57600080fd5b803590602001918460018302840111600160201b8311171561023e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561029057600080fd5b8201836020820111156102a257600080fd5b803590602001918460018302840111600160201b831117156102c357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561031557600080fd5b82018360208201111561032757600080fd5b803590602001918460018302840111600160201b8311171561034857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092958435959094909350604081019250602001359050600160201b8111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460018302840111600160201b831117156103d557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105d4945050505050565b6101a5610639565b6101206106b7565b610120610712565b33610437610639565b6001600160a01b031614610492576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104d28383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061076a92505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b820191906000526020600020905b81548152906001019060200180831161053f57829003601f168201915b505050505081565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6000546001600160a01b031681565b60045481565b6105dd336108d5565b84516105f090600190602088019061094b565b50835161060490600290602087019061094b565b50825161061890600390602086019061094b565b506004829055805161063190600590602084019061094b565b505050505050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561068557600080fd5b505afa158015610699573d6000803e3d6000fd5b505050506040513d60208110156106af57600080fd5b505190505b90565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156107d057600080fd5b505afa1580156107e4573d6000803e3d6000fd5b505050506040513d60208110156107fa57600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610859578181015183820152602001610841565b50505050905090810190601f1680156108865780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156108a557600080fd5b505af11580156108b9573d6000803e3d6000fd5b505050506040513d60208110156108cf57600080fd5b50505050565b6000546001600160a01b031615610929576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061098c57805160ff19168380011785556109b9565b828001600101855582156109b9579182015b828111156109b957825182559160200191906001019061099e565b506109c59291506109c9565b5090565b6106b491905b808211156109c557600081556001016109cf56fea26469706673582212202c608028e7b360813229f9625eab7667f24b1287646c4519461e6f424260575c64736f6c63430006060033"; + public static final String BINARY = "0x608060405234801561001057600080fd5b50610a13806100206000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806384aaf12e1161006657806384aaf12e146101c157806386c02c8f146101db5780638da5cb5b14610416578063e30d26a81461041e578063f8c2ceb31461042657610093565b80633121db1c14610098578063358982a31461011857806339e75d45146101955780637b1039991461019d575b600080fd5b610116600480360360408110156100ae57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156100d857600080fd5b8201836020820111156100ea57600080fd5b803590602001918460018302840111600160201b8311171561010b57600080fd5b50909250905061042e565b005b6101206104d7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610120610564565b6101a56105bf565b604080516001600160a01b039092168252519081900360200190f35b6101c96105ce565b60408051918252519081900360200190f35b610116600480360360a08110156101f157600080fd5b810190602081018135600160201b81111561020b57600080fd5b82018360208201111561021d57600080fd5b803590602001918460018302840111600160201b8311171561023e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561029057600080fd5b8201836020820111156102a257600080fd5b803590602001918460018302840111600160201b831117156102c357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561031557600080fd5b82018360208201111561032757600080fd5b803590602001918460018302840111600160201b8311171561034857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092958435959094909350604081019250602001359050600160201b8111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460018302840111600160201b831117156103d557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105d4945050505050565b6101a5610639565b6101206106b6565b610120610711565b33610437610639565b6001600160a01b031614610492576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104d28383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061076992505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b820191906000526020600020905b81548152906001019060200180831161053f57829003601f168201915b505050505081565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6000546001600160a01b031681565b60045481565b6105dd336108d4565b84516105f090600190602088019061094a565b50835161060490600290602087019061094a565b50825161061890600390602086019061094a565b506004829055805161063190600590602084019061094a565b505050505050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561068557600080fd5b505afa158015610699573d6000803e3d6000fd5b505050506040513d60208110156106af57600080fd5b5051905090565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156107cf57600080fd5b505afa1580156107e3573d6000803e3d6000fd5b505050506040513d60208110156107f957600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610858578181015183820152602001610840565b50505050905090810190601f1680156108855780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156108a457600080fd5b505af11580156108b8573d6000803e3d6000fd5b505050506040513d60208110156108ce57600080fd5b50505050565b6000546001600160a01b031615610928576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061098b57805160ff19168380011785556109b8565b828001600101855582156109b8579182015b828111156109b857825182559160200191906001019061099d565b506109c49291506109c8565b5090565b5b808211156109c457600081556001016109c956fea264697066735822122012cd65f4ede94e135c36736a4f3e06a2064ff660d877205baf80f8c7a120a96b64736f6c634300060c0033"; public static final String FUNC_M_APPCHECKSUM = "m_appChecksum"; diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/AppRegistry.java b/src/main/java/com/iexec/commons/poco/contract/generated/AppRegistry.java index c3a789a..c880e33 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/AppRegistry.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/AppRegistry.java @@ -54,11 +54,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class AppRegistry extends Contract { - public static final String BINARY = "0x60806040523480156200001157600080fd5b506040516200002090620002f1565b604051809103906000f0801580156200003d573d6000803e3d6000fd5b50604080518082018252601f81527f6945786563204170706c69636174696f6e2052656769737472792028563529006020808301919091528251808401909352600b83526a694578656341707073563560a81b90830152908181620000b26301ffc9a760e01b6001600160e01b036200026716565b8151620000c7906006906020850190620002ff565b508051620000dd906007906020840190620002ff565b50620000f96380ac58cd60e01b6001600160e01b036200026716565b62000114635b5e139f60e01b6001600160e01b036200026716565b6200012f63780e9d6360e01b6001600160e01b036200026716565b5060009050620001476001600160e01b03620002ec16565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600b80546001600160a01b0319166001600160a01b038516179055604051620001c16020820162000384565b601f1982820381018352601f909101166040528051620001eb91600c9160209190910190620002ff565b50600c60405180828054600181600116156101000203166002900480156200024d5780601f106200022a5761010080835404028352918201916200024d565b820191906000526020600020905b81548152906001019060200180831162000238575b5050604051908190039020600d5550620003af9350505050565b6001600160e01b03198082161415620002c7576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b335b90565b610a39806200332783390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200034257805160ff191683800117855562000372565b8280016001018555821562000372579182015b828111156200037257825182559160200191906001019062000355565b506200038092915062000392565b5090565b6103cd8062003d6083390190565b620002ee91905b8082111562000380576000815560010162000399565b612f6880620003bf6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80636fa59bbc1161010f578063c3c5a547116100a2578063e985e9c511610071578063e985e9c51461097e578063ee97f7f3146109ac578063eee39111146109b4578063f2fde38b146109bc576101e5565b8063c3c5a547146107a3578063c4d66de8146107c9578063c87b56dd146107ef578063e92118ed1461080c576101e5565b80638da5cb5b116100de5780638da5cb5b146106a157806395d89b41146106a9578063a22cb465146106b1578063b88d4fde146106df576101e5565b80636fa59bbc1461066357806370a082311461066b578063715018a6146106915780637c2b2e7114610699576101e5565b80632f745c59116101875780634f6ccce7116101565780634f6ccce7146105b357806355f804b3146105d05780636352211e1461063e5780636c0360eb1461065b576101e5565b80632f745c59146103615780633121db1c1461038d5780633f7868ff1461040b57806342842e0e1461057d576101e5565b8063095ea7b3116101c3578063095ea7b3146102db578063158ef93e1461030957806318160ddd1461031157806323b872dd1461032b576101e5565b806301ffc9a7146101ea57806306fdde0314610225578063081812fc146102a2575b600080fd5b6102116004803603602081101561020057600080fd5b50356001600160e01b0319166109e2565b604080519115158252519081900360200190f35b61022d610a05565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026757818101518382015260200161024f565b50505050905090810190601f1680156102945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102bf600480360360208110156102b857600080fd5b5035610a9c565b604080516001600160a01b039092168252519081900360200190f35b610307600480360360408110156102f157600080fd5b506001600160a01b038135169060200135610afe565b005b610211610bd9565b610319610be9565b60408051918252519081900360200190f35b6103076004803603606081101561034157600080fd5b506001600160a01b03813581169160208101359091169060400135610bfa565b6103196004803603604081101561037757600080fd5b506001600160a01b038135169060200135610c51565b610307600480360360408110156103a357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103cd57600080fd5b8201836020820111156103df57600080fd5b803590602001918460018302840111600160201b8311171561040057600080fd5b509092509050610c82565b6102bf600480360360c081101561042157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561044b57600080fd5b82018360208201111561045d57600080fd5b803590602001918460018302840111600160201b8311171561047e57600080fd5b919390929091602081019035600160201b81111561049b57600080fd5b8201836020820111156104ad57600080fd5b803590602001918460018302840111600160201b831117156104ce57600080fd5b919390929091602081019035600160201b8111156104eb57600080fd5b8201836020820111156104fd57600080fd5b803590602001918460018302840111600160201b8311171561051e57600080fd5b91939092823592604081019060200135600160201b81111561053f57600080fd5b82018360208201111561055157600080fd5b803590602001918460018302840111600160201b8311171561057257600080fd5b509092509050610d1a565b6103076004803603606081101561059357600080fd5b506001600160a01b03813581169160208101359091169060400135610e22565b610319600480360360208110156105c957600080fd5b5035610e3d565b610307600480360360208110156105e657600080fd5b810190602081018135600160201b81111561060057600080fd5b82018360208201111561061257600080fd5b803590602001918460018302840111600160201b8311171561063357600080fd5b509092509050610e59565b6102bf6004803603602081101561065457600080fd5b5035610ef4565b61022d610f22565b61022d610f83565b6103196004803603602081101561068157600080fd5b50356001600160a01b0316611011565b610307611079565b6102bf61111b565b6102bf61112a565b61022d611139565b610307600480360360408110156106c757600080fd5b506001600160a01b038135169060200135151561119a565b610307600480360360808110156106f557600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561072f57600080fd5b82018360208201111561074157600080fd5b803590602001918460018302840111600160201b8311171561076257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061129f945050505050565b610211600480360360208110156107b957600080fd5b50356001600160a01b03166112fd565b610307600480360360208110156107df57600080fd5b50356001600160a01b03166113ab565b61022d6004803603602081101561080557600080fd5b503561144b565b6102bf600480360360c081101561082257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561084c57600080fd5b82018360208201111561085e57600080fd5b803590602001918460018302840111600160201b8311171561087f57600080fd5b919390929091602081019035600160201b81111561089c57600080fd5b8201836020820111156108ae57600080fd5b803590602001918460018302840111600160201b831117156108cf57600080fd5b919390929091602081019035600160201b8111156108ec57600080fd5b8201836020820111156108fe57600080fd5b803590602001918460018302840111600160201b8311171561091f57600080fd5b91939092823592604081019060200135600160201b81111561094057600080fd5b82018360208201111561095257600080fd5b803590602001918460018302840111600160201b8311171561097357600080fd5b5090925090506116f2565b6102116004803603604081101561099457600080fd5b506001600160a01b03813581169160200135166117eb565b6102bf611819565b610319611828565b610307600480360360208110156109d257600080fd5b50356001600160a01b031661182e565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a915780601f10610a6657610100808354040283529160200191610a91565b820191906000526020600020905b815481529060010190602001808311610a7457829003601f168201915b505050505090505b90565b6000610aa782611927565b610ae25760405162461bcd60e51b815260040180806020018281038252602c815260200180612e3d602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610b0982610ef4565b9050806001600160a01b0316836001600160a01b03161415610b5c5760405162461bcd60e51b8152600401808060200182810382526021815260200180612ee16021913960400191505060405180910390fd5b806001600160a01b0316610b6e61193a565b6001600160a01b03161480610b8f5750610b8f81610b8a61193a565b6117eb565b610bca5760405162461bcd60e51b8152600401808060200182810382526038815260200180612d906038913960400191505060405180910390fd5b610bd4838361193e565b505050565b600e54600160a01b900460ff1681565b6000610bf560026119ac565b905090565b610c0b610c0561193a565b826119b7565b610c465760405162461bcd60e51b8152600401808060200182810382526031815260200180612f026031913960400191505060405180910390fd5b610bd4838383611a5b565b6001600160a01b0382166000908152600160205260408120610c79908363ffffffff611bb916565b90505b92915050565b610c8a61193a565b600a546001600160a01b03908116911614610cda576040805162461bcd60e51b81526020600482018190526024820152600080516020612e69833981519152604482015290519081900360640190fd5b610bd48383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611bc592505050565b6000610e138b610e0e8c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8f018190048102820181019092528d815292508d91508c908190840183828082843760009201919091525050604080516020601f8d018190048102820181019092528b81528d935091508b908b9081908401838280828437600092019190915250611d2a92505050565b611f10565b9b9a5050505050505050505050565b610bd48383836040518060200160405280600081525061129f565b600080610e5160028463ffffffff61213a16565b509392505050565b610e6161193a565b600a546001600160a01b03908116911614610eb1576040805162461bcd60e51b81526020600482018190526024820152600080516020612e69833981519152604482015290519081900360640190fd5b610ef082828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061215692505050565b5050565b6000610c7c82604051806060016040528060298152602001612df2602991396002919063ffffffff61216916565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a915780601f10610a6657610100808354040283529160200191610a91565b600c805460408051602060026001851615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156110095780601f10610fde57610100808354040283529160200191611009565b820191906000526020600020905b815481529060010190602001808311610fec57829003601f168201915b505050505081565b60006001600160a01b0382166110585760405162461bcd60e51b815260040180806020018281038252602a815260200180612dc8602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610c7c906119ac565b61108161193a565b600a546001600160a01b039081169116146110d1576040805162461bcd60e51b81526020600482018190526024820152600080516020612e69833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600e546001600160a01b031681565b600a546001600160a01b031690565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a915780601f10610a6657610100808354040283529160200191610a91565b6111a261193a565b6001600160a01b0316826001600160a01b03161415611208576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b806005600061121561193a565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff19169215159290921790915561125961193a565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b6112b06112aa61193a565b836119b7565b6112eb5760405162461bcd60e51b8152600401808060200182810382526031815260200180612f026031913960400191505060405180910390fd5b6112f784848484612180565b50505050565b6000611311826001600160a01b0316611927565b80610c7c5750600e546001600160a01b031615801590610c7c5750600e546040805163c3c5a54760e01b81526001600160a01b0385811660048301529151919092169163c3c5a547916024808301926020929190829003018186803b15801561137957600080fd5b505afa15801561138d573d6000803e3d6000fd5b505050506040513d60208110156113a357600080fd5b505192915050565b6113b361193a565b600a546001600160a01b03908116911614611403576040805162461bcd60e51b81526020600482018190526024820152600080516020612e69833981519152604482015290519081900360640190fd5b600e54600160a01b900460ff161561141a57600080fd5b600e8054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b0392909216919091179055565b606061145682611927565b6114915760405162461bcd60e51b815260040180806020018281038252602f815260200180612eb2602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156115265780601f106114fb57610100808354040283529160200191611526565b820191906000526020600020905b81548152906001019060200180831161150957829003601f168201915b50506009549394505050506002600019610100600184161502019091160461154f579050610a00565b8051156116205760098160405160200180838054600181600116156101000203166002900480156115b75780601f106115955761010080835404028352918201916115b7565b820191906000526020600020905b8154815290600101906020018083116115a3575b5050825160208401908083835b602083106115e35780518252601f1990920191602091820191016115c4565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050610a00565b600961162b846121d2565b60405160200180838054600181600116156101000203166002900480156116895780601f10611667576101008083540402835291820191611689565b820191906000526020600020905b815481529060010190602001808311611675575b5050825160208401908083835b602083106116b55780518252601f199092019160209182019101611696565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b6000610e138b6117e68c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8f018190048102820181019092528d815292508d91508c908190840183828082843760009201919091525050604080516020601f8d018190048102820181019092528b81528d935091508b908b9081908401838280828437600092019190915250611d2a92505050565b6122ad565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600b546001600160a01b031681565b600d5481565b61183661193a565b600a546001600160a01b03908116911614611886576040805162461bcd60e51b81526020600482018190526024820152600080516020612e69833981519152604482015290519081900360640190fd5b6001600160a01b0381166118cb5760405162461bcd60e51b8152600401808060200182810382526026815260200180612d1a6026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610c7c60028363ffffffff61235716565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061197382610ef4565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610c7c82612363565b60006119c282611927565b6119fd5760405162461bcd60e51b815260040180806020018281038252602c815260200180612d64602c913960400191505060405180910390fd5b6000611a0883610ef4565b9050806001600160a01b0316846001600160a01b03161480611a435750836001600160a01b0316611a3884610a9c565b6001600160a01b0316145b80611a535750611a5381856117eb565b949350505050565b826001600160a01b0316611a6e82610ef4565b6001600160a01b031614611ab35760405162461bcd60e51b8152600401808060200182810382526029815260200180612e896029913960400191505060405180910390fd5b6001600160a01b038216611af85760405162461bcd60e51b8152600401808060200182810382526024815260200180612d406024913960400191505060405180910390fd5b611b03838383610bd4565b611b0e60008261193e565b6001600160a01b0383166000908152600160205260409020611b36908263ffffffff61236716565b506001600160a01b0382166000908152600160205260409020611b5f908263ffffffff61237316565b50611b726002828463ffffffff61237f16565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610c798383612395565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b158015611c2b57600080fd5b505afa158015611c3f573d6000803e3d6000fd5b505050506040513d6020811015611c5557600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015611cb4578181015183820152602001611c9c565b50505050905090810190601f168015611ce15780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015611d0057600080fd5b505af1158015611d14573d6000803e3d6000fd5b505050506040513d60208110156112f757600080fd5b60608585858585604051602401808060200180602001806020018681526020018060200185810385528a818151815260200191508051906020019080838360005b83811015611d83578181015183820152602001611d6b565b50505050905090810190601f168015611db05780820380516001836020036101000a031916815260200191505b5085810384528951815289516020918201918b019080838360005b83811015611de3578181015183820152602001611dcb565b50505050905090810190601f168015611e105780820380516001836020036101000a031916815260200191505b5085810383528851815288516020918201918a019080838360005b83811015611e43578181015183820152602001611e2b565b50505050905090810190601f168015611e705780820380516001836020036101000a031916815260200191505b50858103825286518152865160209182019188019080838360005b83811015611ea3578181015183820152602001611e8b565b50505050905090810190601f168015611ed05780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166386c02c8f60e01b1790529a505050505050505050505095945050505050565b600080612043600084866040516020018083805190602001908083835b60208310611f4c5780518252601f199092019160209182019101611f2d565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b03166001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120395780601f1061200e57610100808354040283529160200191612039565b820191906000526020600020905b81548152906001019060200180831161201c57829003601f168201915b50505050506123f9565b600b546040805163347d5e2560e21b81526001600160a01b0392831660048201818152602483019384528851604484015288519596509386169463d1f5789494919389939091606490910190602085019080838360005b838110156120b257818101518382015260200161209a565b50505050905090810190601f1680156120df5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156120ff57600080fd5b505af1158015612113573d6000803e3d6000fd5b5050505061212a84826001600160a01b031661250a565b6001600160a01b03169392505050565b60008080806121498686612644565b9097909650945050505050565b8051610ef0906009906020840190612c2d565b60006121768484846126bf565b90505b9392505050565b61218b848484611a5b565b61219784848484612789565b6112f75760405162461bcd60e51b8152600401808060200182810382526032815260200180612ce86032913960400191505060405180910390fd5b6060816121f757506040805180820190915260018152600360fc1b6020820152610a00565b8160005b811561220f57600101600a820491506121fb565b60608167ffffffffffffffff8111801561222857600080fd5b506040519080825280601f01601f191660200182016040528015612253576020820181803683370190505b50859350905060001982015b83156122a457600a840660300160f81b8282806001900393508151811061228257fe5b60200101906001600160f81b031916908160001a905350600a8404935061225f565b50949350505050565b60008061234683856040516020018083805190602001908083835b602083106122e75780518252601f1990920191602091820191016122c8565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b03166001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600d546129c4565b6001600160a01b0316949350505050565b6000610c7983836129d1565b5490565b6000610c7983836129e9565b6000610c798383612aaf565b600061217684846001600160a01b038516612af9565b815460009082106123d75760405162461bcd60e51b8152600401808060200182810382526022815260200180612cc66022913960400191505060405180910390fd5b8260000182815481106123e657fe5b9060005260206000200154905092915050565b60008084471015612451576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b82516124a4576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116612176576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b6001600160a01b038216612565576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61256e81611927565b156125c0576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6125cc60008383610bd4565b6001600160a01b03821660009081526001602052604090206125f4908263ffffffff61237316565b506126076002828463ffffffff61237f16565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8154600090819083106126885760405162461bcd60e51b8152600401808060200182810382526022815260200180612e1b6022913960400191505060405180910390fd5b600084600001848154811061269957fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b6000828152600184016020526040812054828161275a5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561271f578181015183820152602001612707565b50505050905090810190601f16801561274c5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061276d57fe5b9060005260206000209060020201600101549150509392505050565b600061279d846001600160a01b0316612b90565b6127a957506001611a53565b600060606001600160a01b038616630a85bd0160e11b6127c761193a565b89888860405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b83811015612840578181015183820152602001612828565b50505050905090810190601f16801561286d5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909a16999099178952518151919890975087965094509250829150849050835b602083106128d55780518252601f1990920191602091820191016128b6565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612937576040519150601f19603f3d011682016040523d82523d6000602084013e61293c565b606091505b50915091508161298d578051156129565780518082602001fd5b60405162461bcd60e51b8152600401808060200182810382526032815260200180612ce86032913960400191505060405180910390fd5b60008180602001905160208110156129a457600080fd5b50516001600160e01b031916630a85bd0160e11b149350611a5392505050565b6000610c79838330612bc9565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015612aa55783546000198083019190810190600090879083908110612a1c57fe5b9060005260206000200154905080876000018481548110612a3957fe5b600091825260208083209091019290925582815260018981019092526040902090840190558654879080612a6957fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610c7c565b6000915050610c7c565b6000612abb83836129d1565b612af157508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c7c565b506000610c7c565b600082815260018401602052604081205480612b5e575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055612179565b82856000016001830381548110612b7157fe5b9060005260206000209060020201600101819055506000915050612179565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611a53575050151592915050565b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff19166021820152603581019490945260558085019390935280518085039093018352607590930190925280519101206001600160a01b031690565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612c6e57805160ff1916838001178555612c9b565b82800160010185558215612c9b579182015b82811115612c9b578251825591602001919060010190612c80565b50612ca7929150612cab565b5090565b610a9991905b80821115612ca75760008155600101612cb156fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a2646970667358221220e159d4d4119eb84e646d90db0c07075b9ae228a700a8527458cbfb27be841aab64736f6c63430006060033608060405234801561001057600080fd5b50610a19806100206000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806384aaf12e1161006657806384aaf12e146101c157806386c02c8f146101db5780638da5cb5b14610416578063e30d26a81461041e578063f8c2ceb31461042657610093565b80633121db1c14610098578063358982a31461011857806339e75d45146101955780637b1039991461019d575b600080fd5b610116600480360360408110156100ae57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156100d857600080fd5b8201836020820111156100ea57600080fd5b803590602001918460018302840111600160201b8311171561010b57600080fd5b50909250905061042e565b005b6101206104d7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610120610564565b6101a56105bf565b604080516001600160a01b039092168252519081900360200190f35b6101c96105ce565b60408051918252519081900360200190f35b610116600480360360a08110156101f157600080fd5b810190602081018135600160201b81111561020b57600080fd5b82018360208201111561021d57600080fd5b803590602001918460018302840111600160201b8311171561023e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561029057600080fd5b8201836020820111156102a257600080fd5b803590602001918460018302840111600160201b831117156102c357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561031557600080fd5b82018360208201111561032757600080fd5b803590602001918460018302840111600160201b8311171561034857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092958435959094909350604081019250602001359050600160201b8111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460018302840111600160201b831117156103d557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105d4945050505050565b6101a5610639565b6101206106b7565b610120610712565b33610437610639565b6001600160a01b031614610492576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104d28383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061076a92505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b820191906000526020600020905b81548152906001019060200180831161053f57829003601f168201915b505050505081565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6000546001600160a01b031681565b60045481565b6105dd336108d5565b84516105f090600190602088019061094b565b50835161060490600290602087019061094b565b50825161061890600390602086019061094b565b506004829055805161063190600590602084019061094b565b505050505050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561068557600080fd5b505afa158015610699573d6000803e3d6000fd5b505050506040513d60208110156106af57600080fd5b505190505b90565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156107d057600080fd5b505afa1580156107e4573d6000803e3d6000fd5b505050506040513d60208110156107fa57600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610859578181015183820152602001610841565b50505050905090810190601f1680156108865780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156108a557600080fd5b505af11580156108b9573d6000803e3d6000fd5b505050506040513d60208110156108cf57600080fd5b50505050565b6000546001600160a01b031615610929576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061098c57805160ff19168380011785556109b9565b828001600101855582156109b9579182015b828111156109b957825182559160200191906001019061099e565b506109c59291506109c9565b5090565b6106b491905b808211156109c557600081556001016109cf56fea264697066735822122029671adde1aa03bc79d19c942ceb07f7c04ddff4a21030803a219b55731202e064736f6c63430006060033608060405234801561001057600080fd5b506103ad806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f6100ef565b005b61002f6100ef565b61002f6004803603604081101561004f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561007a57600080fd5b82018360208201111561008c57600080fd5b803590602001918460018302840111640100000000831117156100ae57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610109945050505050565b6100f7610107565b61010761010261022c565b610251565b565b600061011361022c565b6001600160a01b03161461012657600080fd5b60405180602361031a82396040519081900360230190207f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c314905061016757fe5b61017082610275565b805115610228576000826001600160a01b0316826040518082805190602001908083835b602083106101b35780518252601f199092019160209182019101610194565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610213576040519150601f19603f3d011682016040523d82523d6000602084013e610218565b606091505b505090508061022657600080fd5b505b5050565b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35490565b3660008037600080366000845af43d6000803e808015610270573d6000f35b3d6000fd5b61027e816102dd565b6102b95760405162461bcd60e51b815260040180806020018281038252603b81526020018061033d603b913960400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061031157508115155b94935050505056fe6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e746174696f6e43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220f6164f6912557c387cf208aaa14810eeb1b62762a39d81eba25618c416e3a55b64736f6c63430006060033"; + public static final String BINARY = "0x60806040523480156200001157600080fd5b506040516200002090620002c3565b604051809103906000f0801580156200003d573d6000803e3d6000fd5b50604080518082018252601f81527f6945786563204170706c69636174696f6e2052656769737472792028563529006020808301919091528251808401909352600b83526a694578656341707073563560a81b90830152908181620000a96301ffc9a760e01b6200023a565b8151620000be906006906020850190620002d1565b508051620000d4906007906020840190620002d1565b50620000e76380ac58cd60e01b6200023a565b620000f9635b5e139f60e01b6200023a565b6200010b63780e9d6360e01b6200023a565b50600090506200011a620002bf565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600b80546001600160a01b0319166001600160a01b038516179055604051620001946020820162000356565b601f1982820381018352601f909101166040528051620001be91600c9160209190910190620002d1565b50600c6040518082805460018160011615610100020316600290048015620002205780601f10620001fd57610100808354040283529182019162000220565b820191906000526020600020905b8154815290600101906020018083116200020b575b5050604051908190039020600d55506200037b9350505050565b6001600160e01b031980821614156200029a576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b3390565b610a33806200338d83390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031457805160ff191683800117855562000344565b8280016001018555821562000344579182015b828111156200034457825182559160200191906001019062000327565b506200035292915062000364565b5090565b6103338062003dc083390190565b5b8082111562000352576000815560010162000365565b613002806200038b6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80636fa59bbc1161010f578063c3c5a547116100a2578063e985e9c511610071578063e985e9c51461097e578063ee97f7f3146109ac578063eee39111146109b4578063f2fde38b146109bc576101e5565b8063c3c5a547146107a3578063c4d66de8146107c9578063c87b56dd146107ef578063e92118ed1461080c576101e5565b80638da5cb5b116100de5780638da5cb5b146106a157806395d89b41146106a9578063a22cb465146106b1578063b88d4fde146106df576101e5565b80636fa59bbc1461066357806370a082311461066b578063715018a6146106915780637c2b2e7114610699576101e5565b80632f745c59116101875780634f6ccce7116101565780634f6ccce7146105b357806355f804b3146105d05780636352211e1461063e5780636c0360eb1461065b576101e5565b80632f745c59146103615780633121db1c1461038d5780633f7868ff1461040b57806342842e0e1461057d576101e5565b8063095ea7b3116101c3578063095ea7b3146102db578063158ef93e1461030957806318160ddd1461031157806323b872dd1461032b576101e5565b806301ffc9a7146101ea57806306fdde0314610225578063081812fc146102a2575b600080fd5b6102116004803603602081101561020057600080fd5b50356001600160e01b0319166109e2565b604080519115158252519081900360200190f35b61022d610a05565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026757818101518382015260200161024f565b50505050905090810190601f1680156102945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102bf600480360360208110156102b857600080fd5b5035610a9b565b604080516001600160a01b039092168252519081900360200190f35b610307600480360360408110156102f157600080fd5b506001600160a01b038135169060200135610afd565b005b610211610bd8565b610319610be8565b60408051918252519081900360200190f35b6103076004803603606081101561034157600080fd5b506001600160a01b03813581169160208101359091169060400135610bf9565b6103196004803603604081101561037757600080fd5b506001600160a01b038135169060200135610c50565b610307600480360360408110156103a357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103cd57600080fd5b8201836020820111156103df57600080fd5b803590602001918460018302840111600160201b8311171561040057600080fd5b509092509050610c7b565b6102bf600480360360c081101561042157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561044b57600080fd5b82018360208201111561045d57600080fd5b803590602001918460018302840111600160201b8311171561047e57600080fd5b919390929091602081019035600160201b81111561049b57600080fd5b8201836020820111156104ad57600080fd5b803590602001918460018302840111600160201b831117156104ce57600080fd5b919390929091602081019035600160201b8111156104eb57600080fd5b8201836020820111156104fd57600080fd5b803590602001918460018302840111600160201b8311171561051e57600080fd5b91939092823592604081019060200135600160201b81111561053f57600080fd5b82018360208201111561055157600080fd5b803590602001918460018302840111600160201b8311171561057257600080fd5b509092509050610d13565b6103076004803603606081101561059357600080fd5b506001600160a01b03813581169160208101359091169060400135610e1b565b610319600480360360208110156105c957600080fd5b5035610e36565b610307600480360360208110156105e657600080fd5b810190602081018135600160201b81111561060057600080fd5b82018360208201111561061257600080fd5b803590602001918460018302840111600160201b8311171561063357600080fd5b509092509050610e4c565b6102bf6004803603602081101561065457600080fd5b5035610ee7565b61022d610f0f565b61022d610f70565b6103196004803603602081101561068157600080fd5b50356001600160a01b0316610ffe565b610307611066565b6102bf611108565b6102bf611117565b61022d611126565b610307600480360360408110156106c757600080fd5b506001600160a01b0381351690602001351515611187565b610307600480360360808110156106f557600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561072f57600080fd5b82018360208201111561074157600080fd5b803590602001918460018302840111600160201b8311171561076257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061128c945050505050565b610211600480360360208110156107b957600080fd5b50356001600160a01b03166112ea565b610307600480360360208110156107df57600080fd5b50356001600160a01b0316611398565b61022d6004803603602081101561080557600080fd5b5035611438565b6102bf600480360360c081101561082257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561084c57600080fd5b82018360208201111561085e57600080fd5b803590602001918460018302840111600160201b8311171561087f57600080fd5b919390929091602081019035600160201b81111561089c57600080fd5b8201836020820111156108ae57600080fd5b803590602001918460018302840111600160201b831117156108cf57600080fd5b919390929091602081019035600160201b8111156108ec57600080fd5b8201836020820111156108fe57600080fd5b803590602001918460018302840111600160201b8311171561091f57600080fd5b91939092823592604081019060200135600160201b81111561094057600080fd5b82018360208201111561095257600080fd5b803590602001918460018302840111600160201b8311171561097357600080fd5b5090925090506116df565b6102116004803603604081101561099457600080fd5b506001600160a01b03813581169160200135166117d8565b6102bf611806565b610319611815565b610307600480360360208110156109d257600080fd5b50356001600160a01b031661181b565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a915780601f10610a6657610100808354040283529160200191610a91565b820191906000526020600020905b815481529060010190602001808311610a7457829003601f168201915b5050505050905090565b6000610aa682611914565b610ae15760405162461bcd60e51b815260040180806020018281038252602c815260200180612ed7602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b6000610b0882610ee7565b9050806001600160a01b0316836001600160a01b03161415610b5b5760405162461bcd60e51b8152600401808060200182810382526021815260200180612f7b6021913960400191505060405180910390fd5b806001600160a01b0316610b6d611921565b6001600160a01b03161480610b8e5750610b8e81610b89611921565b6117d8565b610bc95760405162461bcd60e51b8152600401808060200182810382526038815260200180612e2a6038913960400191505060405180910390fd5b610bd38383611925565b505050565b600e54600160a01b900460ff1681565b6000610bf46002611993565b905090565b610c0a610c04611921565b8261199e565b610c455760405162461bcd60e51b8152600401808060200182810382526031815260200180612f9c6031913960400191505060405180910390fd5b610bd3838383611a42565b6001600160a01b0382166000908152600160205260408120610c729083611b8e565b90505b92915050565b610c83611921565b600a546001600160a01b03908116911614610cd3576040805162461bcd60e51b81526020600482018190526024820152600080516020612f03833981519152604482015290519081900360640190fd5b610bd38383838080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b9a92505050565b6000610e0c8b610e078c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8f018190048102820181019092528d815292508d91508c908190840183828082843760009201919091525050604080516020601f8d018190048102820181019092528b81528d935091508b908b9081908401838280828437600092019190915250611cff92505050565b611ee5565b9b9a5050505050505050505050565b610bd38383836040518060200160405280600081525061128c565b600080610e44600284612106565b509392505050565b610e54611921565b600a546001600160a01b03908116911614610ea4576040805162461bcd60e51b81526020600482018190526024820152600080516020612f03833981519152604482015290519081900360640190fd5b610ee382828080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061212292505050565b5050565b6000610c7582604051806060016040528060298152602001612e8c6029913960029190612135565b60098054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a915780601f10610a6657610100808354040283529160200191610a91565b600c805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610ff65780601f10610fcb57610100808354040283529160200191610ff6565b820191906000526020600020905b815481529060010190602001808311610fd957829003601f168201915b505050505081565b60006001600160a01b0382166110455760405162461bcd60e51b815260040180806020018281038252602a815260200180612e62602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610c7590611993565b61106e611921565b600a546001600160a01b039081169116146110be576040805162461bcd60e51b81526020600482018190526024820152600080516020612f03833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600e546001600160a01b031681565b600a546001600160a01b031690565b60078054604080516020601f6002600019610100600188161502019095169490940493840181900481028201810190925282815260609390929091830182828015610a915780601f10610a6657610100808354040283529160200191610a91565b61118f611921565b6001600160a01b0316826001600160a01b031614156111f5576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000611202611921565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155611246611921565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b61129d611297611921565b8361199e565b6112d85760405162461bcd60e51b8152600401808060200182810382526031815260200180612f9c6031913960400191505060405180910390fd5b6112e48484848461214c565b50505050565b60006112fe826001600160a01b0316611914565b80610c755750600e546001600160a01b031615801590610c755750600e546040805163c3c5a54760e01b81526001600160a01b0385811660048301529151919092169163c3c5a547916024808301926020929190829003018186803b15801561136657600080fd5b505afa15801561137a573d6000803e3d6000fd5b505050506040513d602081101561139057600080fd5b505192915050565b6113a0611921565b600a546001600160a01b039081169116146113f0576040805162461bcd60e51b81526020600482018190526024820152600080516020612f03833981519152604482015290519081900360640190fd5b600e54600160a01b900460ff161561140757600080fd5b600e8054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b0392909216919091179055565b606061144382611914565b61147e5760405162461bcd60e51b815260040180806020018281038252602f815260200180612f4c602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156115135780601f106114e857610100808354040283529160200191611513565b820191906000526020600020905b8154815290600101906020018083116114f657829003601f168201915b50506009549394505050506002600019610100600184161502019091160461153c579050610a00565b80511561160d5760098160405160200180838054600181600116156101000203166002900480156115a45780601f106115825761010080835404028352918201916115a4565b820191906000526020600020905b815481529060010190602001808311611590575b5050825160208401908083835b602083106115d05780518252601f1990920191602091820191016115b1565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050610a00565b60096116188461219e565b60405160200180838054600181600116156101000203166002900480156116765780601f10611654576101008083540402835291820191611676565b820191906000526020600020905b815481529060010190602001808311611662575b5050825160208401908083835b602083106116a25780518252601f199092019160209182019101611683565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b6000610e0c8b6117d38c8c8080601f016020809104026020016040519081016040528093929190818152602001838380828437600081840152601f19601f820116905080830192505050505050508b8b8080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8f018190048102820181019092528d815292508d91508c908190840183828082843760009201919091525050604080516020601f8d018190048102820181019092528b81528d935091508b908b9081908401838280828437600092019190915250611cff92505050565b612279565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600b546001600160a01b031681565b600d5481565b611823611921565b600a546001600160a01b03908116911614611873576040805162461bcd60e51b81526020600482018190526024820152600080516020612f03833981519152604482015290519081900360640190fd5b6001600160a01b0381166118b85760405162461bcd60e51b8152600401808060200182810382526026815260200180612d8e6026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610c7560028361231a565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061195a82610ee7565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610c7582612326565b60006119a982611914565b6119e45760405162461bcd60e51b815260040180806020018281038252602c815260200180612dfe602c913960400191505060405180910390fd5b60006119ef83610ee7565b9050806001600160a01b0316846001600160a01b03161480611a2a5750836001600160a01b0316611a1f84610a9b565b6001600160a01b0316145b80611a3a5750611a3a81856117d8565b949350505050565b826001600160a01b0316611a5582610ee7565b6001600160a01b031614611a9a5760405162461bcd60e51b8152600401808060200182810382526029815260200180612f236029913960400191505060405180910390fd5b6001600160a01b038216611adf5760405162461bcd60e51b8152600401808060200182810382526024815260200180612db46024913960400191505060405180910390fd5b611aea838383610bd3565b611af5600082611925565b6001600160a01b0383166000908152600160205260409020611b17908261232a565b506001600160a01b0382166000908152600160205260409020611b3a9082612336565b50611b4760028284612342565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610c728383612358565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b158015611c0057600080fd5b505afa158015611c14573d6000803e3d6000fd5b505050506040513d6020811015611c2a57600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015611c89578181015183820152602001611c71565b50505050905090810190601f168015611cb65780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015611cd557600080fd5b505af1158015611ce9573d6000803e3d6000fd5b505050506040513d60208110156112e457600080fd5b60608585858585604051602401808060200180602001806020018681526020018060200185810385528a818151815260200191508051906020019080838360005b83811015611d58578181015183820152602001611d40565b50505050905090810190601f168015611d855780820380516001836020036101000a031916815260200191505b5085810384528951815289516020918201918b019080838360005b83811015611db8578181015183820152602001611da0565b50505050905090810190601f168015611de55780820380516001836020036101000a031916815260200191505b5085810383528851815288516020918201918a019080838360005b83811015611e18578181015183820152602001611e00565b50505050905090810190601f168015611e455780820380516001836020036101000a031916815260200191505b50858103825286518152865160209182019188019080838360005b83811015611e78578181015183820152602001611e60565b50505050905090810190601f168015611ea55780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b03166386c02c8f60e01b1790529a505050505050505050505095945050505050565b60008061200f600084866040516020018083805190602001908083835b60208310611f215780518252601f199092019160209182019101611f02565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600c8054600181600116156101000203166002900480601f0160208091040260200160405190810160405280929190818152602001828054600181600116156101000203166002900480156120055780601f10611fda57610100808354040283529160200191612005565b820191906000526020600020905b815481529060010190602001808311611fe857829003601f168201915b50505050506123bc565b600b546040805163347d5e2560e21b81526001600160a01b0392831660048201818152602483019384528851604484015288519596509386169463d1f5789494919389939091606490910190602085019080838360005b8381101561207e578181015183820152602001612066565b50505050905090810190601f1680156120ab5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b1580156120cb57600080fd5b505af11580156120df573d6000803e3d6000fd5b505050506120f684826001600160a01b03166124cd565b6001600160a01b03169392505050565b600080808061211586866125fb565b9097909650945050505050565b8051610ee3906009906020840190612ca6565b6000612142848484612676565b90505b9392505050565b612157848484611a42565b61216384848484612740565b6112e45760405162461bcd60e51b8152600401808060200182810382526032815260200180612d5c6032913960400191505060405180910390fd5b6060816121c357506040805180820190915260018152600360fc1b6020820152610a00565b8160005b81156121db57600101600a820491506121c7565b60608167ffffffffffffffff811180156121f457600080fd5b506040519080825280601f01601f19166020018201604052801561221f576020820181803683370190505b50859350905060001982015b831561227057600a840660300160f81b8282806001900393508151811061224e57fe5b60200101906001600160f81b031916908160001a905350600a8404935061222b565b50949350505050565b60008061230983856040516020018083805190602001908083835b602083106122b35780518252601f199092019160209182019101612294565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600d546128a8565b6001600160a01b0316949350505050565b6000610c7283836128b5565b5490565b6000610c7283836128cd565b6000610c728383612993565b600061214284846001600160a01b0385166129dd565b8154600090821061239a5760405162461bcd60e51b8152600401808060200182810382526022815260200180612d3a6022913960400191505060405180910390fd5b8260000182815481106123a957fe5b9060005260206000200154905092915050565b60008084471015612414576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b8251612467576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116612142576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b6001600160a01b038216612528576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61253181611914565b15612583576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b61258f60008383610bd3565b6001600160a01b03821660009081526001602052604090206125b19082612336565b506125be60028284612342565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b81546000908190831061263f5760405162461bcd60e51b8152600401808060200182810382526022815260200180612eb56022913960400191505060405180910390fd5b600084600001848154811061265057fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816127115760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156126d65781810151838201526020016126be565b50505050905090810190601f1680156127035780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061272457fe5b9060005260206000209060020201600101549150509392505050565b6000612754846001600160a01b0316612a74565b61276057506001611a3a565b606061286e630a85bd0160e11b612775611921565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156127dc5781810151838201526020016127c4565b50505050905090810190601f1680156128095780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612d5c603291396001600160a01b0388169190612a7a565b9050600081806020019051602081101561288757600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6000610c72838330612a89565b60009081526001919091016020526040902054151590565b60008181526001830160205260408120548015612989578354600019808301919081019060009087908390811061290057fe5b906000526020600020015490508087600001848154811061291d57fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061294d57fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610c75565b6000915050610c75565b600061299f83836128b5565b6129d557508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610c75565b506000610c75565b600082815260018401602052604081205480612a42575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055612145565b82856000016001830381548110612a5557fe5b9060005260206000209060020201600101819055506000915050612145565b3b151590565b60606121428484600085612ae4565b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff191660218201526035810194909452605580850193909352805180850390930183526075909301909252805191012090565b606082471015612b255760405162461bcd60e51b8152600401808060200182810382526026815260200180612dd86026913960400191505060405180910390fd5b612b2e85612a74565b612b7f576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b60208310612bbe5780518252601f199092019160209182019101612b9f565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612c20576040519150601f19603f3d011682016040523d82523d6000602084013e612c25565b606091505b5091509150612c35828286612c40565b979650505050505050565b60608315612c4f575081612145565b825115612c5f5782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156126d65781810151838201526020016126be565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f10612ce757805160ff1916838001178555612d14565b82800160010185558215612d14579182015b82811115612d14578251825591602001919060010190612cf9565b50612d20929150612d24565b5090565b5b80821115612d205760008155600101612d2556fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212204814635ba72d72365be9c60aba29717a3dc033311ba13fd12b550d2ebaceeaf164736f6c634300060c0033608060405234801561001057600080fd5b50610a13806100206000396000f3fe608060405234801561001057600080fd5b50600436106100935760003560e01c806384aaf12e1161006657806384aaf12e146101c157806386c02c8f146101db5780638da5cb5b14610416578063e30d26a81461041e578063f8c2ceb31461042657610093565b80633121db1c14610098578063358982a31461011857806339e75d45146101955780637b1039991461019d575b600080fd5b610116600480360360408110156100ae57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156100d857600080fd5b8201836020820111156100ea57600080fd5b803590602001918460018302840111600160201b8311171561010b57600080fd5b50909250905061042e565b005b6101206104d7565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561015a578181015183820152602001610142565b50505050905090810190601f1680156101875780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b610120610564565b6101a56105bf565b604080516001600160a01b039092168252519081900360200190f35b6101c96105ce565b60408051918252519081900360200190f35b610116600480360360a08110156101f157600080fd5b810190602081018135600160201b81111561020b57600080fd5b82018360208201111561021d57600080fd5b803590602001918460018302840111600160201b8311171561023e57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561029057600080fd5b8201836020820111156102a257600080fd5b803590602001918460018302840111600160201b831117156102c357600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295949360208101935035915050600160201b81111561031557600080fd5b82018360208201111561032757600080fd5b803590602001918460018302840111600160201b8311171561034857600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092958435959094909350604081019250602001359050600160201b8111156103a257600080fd5b8201836020820111156103b457600080fd5b803590602001918460018302840111600160201b831117156103d557600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506105d4945050505050565b6101a5610639565b6101206106b6565b610120610711565b33610437610639565b6001600160a01b031614610492576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104d28383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061076992505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b820191906000526020600020905b81548152906001019060200180831161053f57829003601f168201915b505050505081565b6003805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6000546001600160a01b031681565b60045481565b6105dd336108d4565b84516105f090600190602088019061094a565b50835161060490600290602087019061094a565b50825161061890600390602086019061094a565b506004829055805161063190600590602084019061094a565b505050505050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561068557600080fd5b505afa158015610699573d6000803e3d6000fd5b505050506040513d60208110156106af57600080fd5b5051905090565b6005805460408051602060026001851615610100026000190190941693909304601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b6002805460408051602060018416156101000260001901909316849004601f8101849004840282018401909252818152929183018282801561055c5780601f106105315761010080835404028352916020019161055c565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156107cf57600080fd5b505afa1580156107e3573d6000803e3d6000fd5b505050506040513d60208110156107f957600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610858578181015183820152602001610840565b50505050905090810190601f1680156108855780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b1580156108a457600080fd5b505af11580156108b8573d6000803e3d6000fd5b505050506040513d60208110156108ce57600080fd5b50505050565b6000546001600160a01b031615610928576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061098b57805160ff19168380011785556109b8565b828001600101855582156109b8579182015b828111156109b857825182559160200191906001019061099d565b506109c49291506109c8565b5090565b5b808211156109c457600081556001016109c956fea264697066735822122012cd65f4ede94e135c36736a4f3e06a2064ff660d877205baf80f8c7a120a96b64736f6c634300060c0033608060405234801561001057600080fd5b50610313806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f6100ef565b005b61002f6100ef565b61002f6004803603604081101561004f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561007a57600080fd5b82018360208201111561008c57600080fd5b803590602001918460018302840111640100000000831117156100ae57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610109945050505050565b6100f7610107565b6101076101026101eb565b610210565b565b60006101136101eb565b6001600160a01b03161461012657600080fd5b61012f82610234565b8051156101e7576000826001600160a01b0316826040518082805190602001908083835b602083106101725780518252601f199092019160209182019101610153565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146101d2576040519150601f19603f3d011682016040523d82523d6000602084013e6101d7565b606091505b50509050806101e557600080fd5b505b5050565b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35490565b3660008037600080366000845af43d6000803e80801561022f573d6000f35b3d6000fd5b61023d8161029c565b6102785760405162461bcd60e51b815260040180806020018281038252603b8152602001806102a3603b913960400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c355565b3b15159056fe43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212203178a2011c46abc2765f1016c5d417892138b904850d3e7866a1bfdfd1f3a76364736f6c634300060c0033"; public static final String FUNC_APPROVE = "approve"; @@ -141,6 +141,8 @@ public class AppRegistry extends Contract { static { _addresses = new HashMap(); _addresses.put("1", "0xB1C52075b276f87b1834919167312221d50c9D16"); + _addresses.put("133", "0xB1C52075b276f87b1834919167312221d50c9D16"); + _addresses.put("134", "0xB1C52075b276f87b1834919167312221d50c9D16"); _addresses.put("3", "0xB1C52075b276f87b1834919167312221d50c9D16"); _addresses.put("4", "0xB1C52075b276f87b1834919167312221d50c9D16"); _addresses.put("5", "0xB1C52075b276f87b1834919167312221d50c9D16"); @@ -165,8 +167,8 @@ protected AppRegistry(String contractAddress, Web3j web3j, TransactionManager tr super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } - public List getApprovalEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); + public static List getApprovalEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalEventResponse typedResponse = new ApprovalEventResponse(); @@ -200,8 +202,8 @@ public Flowable approvalEventFlowable(DefaultBlockParamet return approvalEventFlowable(filter); } - public List getApprovalForAllEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVALFORALL_EVENT, transactionReceipt); + public static List getApprovalForAllEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVALFORALL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalForAllEventResponse typedResponse = new ApprovalForAllEventResponse(); @@ -235,8 +237,8 @@ public Flowable approvalForAllEventFlowable(Default return approvalForAllEventFlowable(filter); } - public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); + public static List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); @@ -268,8 +270,8 @@ public Flowable ownershipTransferredEventFlow return ownershipTransferredEventFlowable(filter); } - public List getTransferEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); + public static List getTransferEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TransferEventResponse typedResponse = new TransferEventResponse(); diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/Dataset.java b/src/main/java/com/iexec/commons/poco/contract/generated/Dataset.java index e5ce079..59c6b54 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/Dataset.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/Dataset.java @@ -43,11 +43,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class Dataset extends Contract { - public static final String BINARY = "0x608060405234801561001057600080fd5b50610806806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637b1039991161005b5780637b1039991461019b5780638c2b1e2f146101bf5780638da5cb5b146102ee578063a61ca6c5146102f65761007d565b80630847c431146100825780631ba99d7e146100ff5780633121db1c14610119575b600080fd5b61008a6102fe565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c45781810151838201526020016100ac565b50505050905090810190601f1680156100f15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010761038b565b60408051918252519081900360200190f35b6101996004803603604081101561012f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561015a57600080fd5b82018360208201111561016c57600080fd5b8035906020019184600183028401116401000000008311171561018e57600080fd5b509092509050610391565b005b6101a361043a565b604080516001600160a01b039092168252519081900360200190f35b610199600480360360608110156101d557600080fd5b8101906020810181356401000000008111156101f057600080fd5b82018360208201111561020257600080fd5b8035906020019184600183028401116401000000008311171561022457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561027757600080fd5b82018360208201111561028957600080fd5b803590602001918460018302840111640100000000831117156102ab57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610449915050565b6101a3610481565b61008a6104ff565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103835780601f1061035857610100808354040283529160200191610383565b820191906000526020600020905b81548152906001019060200180831161036657829003601f168201915b505050505081565b60035481565b3361039a610481565b6001600160a01b0316146103f5576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104358383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055792505050565b505050565b6000546001600160a01b031681565b610452336106c2565b8251610465906001906020860190610738565b508151610479906002906020850190610738565b506003555050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b1580156104cd57600080fd5b505afa1580156104e1573d6000803e3d6000fd5b505050506040513d60208110156104f757600080fd5b505190505b90565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103835780601f1061035857610100808354040283529160200191610383565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105bd57600080fd5b505afa1580156105d1573d6000803e3d6000fd5b505050506040513d60208110156105e757600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b8381101561064657818101518382015260200161062e565b50505050905090810190601f1680156106735780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069257600080fd5b505af11580156106a6573d6000803e3d6000fd5b505050506040513d60208110156106bc57600080fd5b50505050565b6000546001600160a01b031615610716576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077957805160ff19168380011785556107a6565b828001600101855582156107a6579182015b828111156107a657825182559160200191906001019061078b565b506107b29291506107b6565b5090565b6104fc91905b808211156107b257600081556001016107bc56fea26469706673582212205a97b2fc595c24ec15f1c328b4ffef569dda7a95d444ccbd5d419390d6f7171d64736f6c63430006060033"; + public static final String BINARY = "0x608060405234801561001057600080fd5b50610800806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637b1039991161005b5780637b1039991461019b5780638c2b1e2f146101bf5780638da5cb5b146102ee578063a61ca6c5146102f65761007d565b80630847c431146100825780631ba99d7e146100ff5780633121db1c14610119575b600080fd5b61008a6102fe565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c45781810151838201526020016100ac565b50505050905090810190601f1680156100f15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010761038b565b60408051918252519081900360200190f35b6101996004803603604081101561012f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561015a57600080fd5b82018360208201111561016c57600080fd5b8035906020019184600183028401116401000000008311171561018e57600080fd5b509092509050610391565b005b6101a361043a565b604080516001600160a01b039092168252519081900360200190f35b610199600480360360608110156101d557600080fd5b8101906020810181356401000000008111156101f057600080fd5b82018360208201111561020257600080fd5b8035906020019184600183028401116401000000008311171561022457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561027757600080fd5b82018360208201111561028957600080fd5b803590602001918460018302840111640100000000831117156102ab57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610449915050565b6101a3610481565b61008a6104fe565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103835780601f1061035857610100808354040283529160200191610383565b820191906000526020600020905b81548152906001019060200180831161036657829003601f168201915b505050505081565b60035481565b3361039a610481565b6001600160a01b0316146103f5576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104358383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055692505050565b505050565b6000546001600160a01b031681565b610452336106c1565b8251610465906001906020860190610737565b508151610479906002906020850190610737565b506003555050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b1580156104cd57600080fd5b505afa1580156104e1573d6000803e3d6000fd5b505050506040513d60208110156104f757600080fd5b5051905090565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103835780601f1061035857610100808354040283529160200191610383565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105bc57600080fd5b505afa1580156105d0573d6000803e3d6000fd5b505050506040513d60208110156105e657600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b8381101561064557818101518382015260200161062d565b50505050905090810190601f1680156106725780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b50505050565b6000546001600160a01b031615610715576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077857805160ff19168380011785556107a5565b828001600101855582156107a5579182015b828111156107a557825182559160200191906001019061078a565b506107b19291506107b5565b5090565b5b808211156107b157600081556001016107b656fea26469706673582212208aad60c5c395586eae24c2085271598f521e67b913bfb818248179112053f04564736f6c634300060c0033"; public static final String FUNC_M_DATASETCHECKSUM = "m_datasetChecksum"; diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/DatasetRegistry.java b/src/main/java/com/iexec/commons/poco/contract/generated/DatasetRegistry.java index 549554a..2471c57 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/DatasetRegistry.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/DatasetRegistry.java @@ -22,6 +22,7 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; +import java.util.HashMap; import java.util.List; import org.web3j.abi.EventEncoder; import org.web3j.abi.TypeReference; @@ -36,6 +37,7 @@ import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; import org.web3j.protocol.core.DefaultBlockParameter; +import org.web3j.protocol.core.RemoteCall; import org.web3j.protocol.core.RemoteFunctionCall; import org.web3j.protocol.core.methods.request.EthFilter; import org.web3j.protocol.core.methods.response.BaseEventResponse; @@ -52,11 +54,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.7.0. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class DatasetRegistry extends Contract { - public static final String BINARY = "Bin file was not provided"; + public static final String BINARY = "0x60806040523480156200001157600080fd5b506040516200002090620002c7565b604051809103906000f0801580156200003d573d6000803e3d6000fd5b50604080518082018252601b81527f69457865632044617461736574205265676973747279202856352900000000006020808301919091528251808401909352600f83526e69457865634461746173657473563560881b90830152908181620000ad6301ffc9a760e01b6200023e565b8151620000c2906006906020850190620002d5565b508051620000d8906007906020840190620002d5565b50620000eb6380ac58cd60e01b6200023e565b620000fd635b5e139f60e01b6200023e565b6200010f63780e9d6360e01b6200023e565b50600090506200011e620002c3565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600b80546001600160a01b0319166001600160a01b03851617905560405162000198602082016200035a565b601f1982820381018352601f909101166040528051620001c291600c9160209190910190620002d5565b50600c6040518082805460018160011615610100020316600290048015620002245780601f106200020157610100808354040283529182019162000224565b820191906000526020600020905b8154815290600101906020018083116200020f575b5050604051908190039020600d55506200037f9350505050565b6001600160e01b031980821614156200029e576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b3390565b610820806200306a83390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031857805160ff191683800117855562000348565b8280016001018555821562000348579182015b82811115620003485782518255916020019190600101906200032b565b506200035692915062000368565b5090565b610333806200388a83390190565b5b8082111562000356576000815560010162000369565b612cdb806200038f6000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80636fa59bbc1161010f578063c3c5a547116100a2578063ee97f7f311610071578063ee97f7f314610796578063eee391111461079e578063f2fde38b146107a6578063fe17fc7a146107cc576101e5565b8063c3c5a547146106ff578063c4d66de814610725578063c87b56dd1461074b578063e985e9c514610768576101e5565b80638da5cb5b116100de5780638da5cb5b146105fd57806395d89b4114610605578063a22cb4651461060d578063b88d4fde1461063b576101e5565b80636fa59bbc146105bf57806370a08231146105c7578063715018a6146105ed5780637c2b2e71146105f5576101e5565b80632f745c59116101875780634f6ccce7116101565780634f6ccce71461050f57806355f804b31461052c5780636352211e1461059a5780636c0360eb146105b7576101e5565b80632f745c59146103615780633121db1c1461038d5780633354bcdb1461040b57806342842e0e146104d9576101e5565b8063095ea7b3116101c3578063095ea7b3146102db578063158ef93e1461030957806318160ddd1461031157806323b872dd1461032b576101e5565b806301ffc9a7146101ea57806306fdde0314610225578063081812fc146102a2575b600080fd5b6102116004803603602081101561020057600080fd5b50356001600160e01b03191661089a565b604080519115158252519081900360200190f35b61022d6108bd565b6040805160208082528351818301528351919283929083019185019080838360005b8381101561026757818101518382015260200161024f565b50505050905090810190601f1680156102945780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102bf600480360360208110156102b857600080fd5b5035610953565b604080516001600160a01b039092168252519081900360200190f35b610307600480360360408110156102f157600080fd5b506001600160a01b0381351690602001356109b5565b005b610211610a90565b610319610aa0565b60408051918252519081900360200190f35b6103076004803603606081101561034157600080fd5b506001600160a01b03813581169160208101359091169060400135610ab1565b6103196004803603604081101561037757600080fd5b506001600160a01b038135169060200135610b08565b610307600480360360408110156103a357600080fd5b6001600160a01b038235169190810190604081016020820135600160201b8111156103cd57600080fd5b8201836020820111156103df57600080fd5b803590602001918460018302840111600160201b8311171561040057600080fd5b509092509050610b33565b6102bf6004803603608081101561042157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561044b57600080fd5b82018360208201111561045d57600080fd5b803590602001918460018302840111600160201b8311171561047e57600080fd5b919390929091602081019035600160201b81111561049b57600080fd5b8201836020820111156104ad57600080fd5b803590602001918460018302840111600160201b831117156104ce57600080fd5b919350915035610bcb565b610307600480360360608110156104ef57600080fd5b506001600160a01b03813581169160208101359091169060400135610c56565b6103196004803603602081101561052557600080fd5b5035610c71565b6103076004803603602081101561054257600080fd5b810190602081018135600160201b81111561055c57600080fd5b82018360208201111561056e57600080fd5b803590602001918460018302840111600160201b8311171561058f57600080fd5b509092509050610c87565b6102bf600480360360208110156105b057600080fd5b5035610d22565b61022d610d4a565b61022d610dab565b610319600480360360208110156105dd57600080fd5b50356001600160a01b0316610e39565b610307610ea1565b6102bf610f43565b6102bf610f52565b61022d610f61565b6103076004803603604081101561062357600080fd5b506001600160a01b0381351690602001351515610fc2565b6103076004803603608081101561065157600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561068b57600080fd5b82018360208201111561069d57600080fd5b803590602001918460018302840111600160201b831117156106be57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295506110c7945050505050565b6102116004803603602081101561071557600080fd5b50356001600160a01b0316611125565b6103076004803603602081101561073b57600080fd5b50356001600160a01b03166111d3565b61022d6004803603602081101561076157600080fd5b5035611273565b6102116004803603604081101561077e57600080fd5b506001600160a01b038135811691602001351661151a565b6102bf611548565b610319611557565b610307600480360360208110156107bc57600080fd5b50356001600160a01b031661155d565b6102bf600480360360808110156107e257600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561080c57600080fd5b82018360208201111561081e57600080fd5b803590602001918460018302840111600160201b8311171561083f57600080fd5b919390929091602081019035600160201b81111561085c57600080fd5b82018360208201111561086e57600080fd5b803590602001918460018302840111600160201b8311171561088f57600080fd5b919350915035611656565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109495780601f1061091e57610100808354040283529160200191610949565b820191906000526020600020905b81548152906001019060200180831161092c57829003601f168201915b5050505050905090565b600061095e826116d6565b6109995760405162461bcd60e51b815260040180806020018281038252602c815260200180612bb0602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b60006109c082610d22565b9050806001600160a01b0316836001600160a01b03161415610a135760405162461bcd60e51b8152600401808060200182810382526021815260200180612c546021913960400191505060405180910390fd5b806001600160a01b0316610a256116e3565b6001600160a01b03161480610a465750610a4681610a416116e3565b61151a565b610a815760405162461bcd60e51b8152600401808060200182810382526038815260200180612b036038913960400191505060405180910390fd5b610a8b83836116e7565b505050565b600e54600160a01b900460ff1681565b6000610aac6002611755565b905090565b610ac2610abc6116e3565b82611760565b610afd5760405162461bcd60e51b8152600401808060200182810382526031815260200180612c756031913960400191505060405180910390fd5b610a8b838383611804565b6001600160a01b0382166000908152600160205260408120610b2a9083611950565b90505b92915050565b610b3b6116e3565b600a546001600160a01b03908116911614610b8b576040805162461bcd60e51b81526020600482018190526024820152600080516020612bdc833981519152604482015290519081900360640190fd5b610a8b8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061195c92505050565b6000610c4b87610c4688888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8c018190048102820181019092528a815292508a9150899081908401838280828437600092019190915250899250611ac1915050565b611bd8565b979650505050505050565b610a8b838383604051806020016040528060008152506110c7565b600080610c7f600284611df9565b509392505050565b610c8f6116e3565b600a546001600160a01b03908116911614610cdf576040805162461bcd60e51b81526020600482018190526024820152600080516020612bdc833981519152604482015290519081900360640190fd5b610d1e82828080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611e1592505050565b5050565b6000610b2d82604051806060016040528060298152602001612b656029913960029190611e28565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109495780601f1061091e57610100808354040283529160200191610949565b600c805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610e315780601f10610e0657610100808354040283529160200191610e31565b820191906000526020600020905b815481529060010190602001808311610e1457829003601f168201915b505050505081565b60006001600160a01b038216610e805760405162461bcd60e51b815260040180806020018281038252602a815260200180612b3b602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610b2d90611755565b610ea96116e3565b600a546001600160a01b03908116911614610ef9576040805162461bcd60e51b81526020600482018190526024820152600080516020612bdc833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600e546001600160a01b031681565b600a546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156109495780601f1061091e57610100808354040283529160200191610949565b610fca6116e3565b6001600160a01b0316826001600160a01b03161415611030576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b806005600061103d6116e3565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff1916921515929092179091556110816116e3565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b6110d86110d26116e3565b83611760565b6111135760405162461bcd60e51b8152600401808060200182810382526031815260200180612c756031913960400191505060405180910390fd5b61111f84848484611e35565b50505050565b6000611139826001600160a01b03166116d6565b80610b2d5750600e546001600160a01b031615801590610b2d5750600e546040805163c3c5a54760e01b81526001600160a01b0385811660048301529151919092169163c3c5a547916024808301926020929190829003018186803b1580156111a157600080fd5b505afa1580156111b5573d6000803e3d6000fd5b505050506040513d60208110156111cb57600080fd5b505192915050565b6111db6116e3565b600a546001600160a01b0390811691161461122b576040805162461bcd60e51b81526020600482018190526024820152600080516020612bdc833981519152604482015290519081900360640190fd5b600e54600160a01b900460ff161561124257600080fd5b600e8054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b0392909216919091179055565b606061127e826116d6565b6112b95760405162461bcd60e51b815260040180806020018281038252602f815260200180612c25602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084526060939283018282801561134e5780601f106113235761010080835404028352916020019161134e565b820191906000526020600020905b81548152906001019060200180831161133157829003601f168201915b5050600954939450505050600260001961010060018416150201909116046113775790506108b8565b8051156114485760098160405160200180838054600181600116156101000203166002900480156113df5780601f106113bd5761010080835404028352918201916113df565b820191906000526020600020905b8154815290600101906020018083116113cb575b5050825160208401908083835b6020831061140b5780518252601f1990920191602091820191016113ec565b6001836020036101000a038019825116818451168082178552505050505050905001925050506040516020818303038152906040529150506108b8565b600961145384611e87565b60405160200180838054600181600116156101000203166002900480156114b15780601f1061148f5761010080835404028352918201916114b1565b820191906000526020600020905b81548152906001019060200180831161149d575b5050825160208401908083835b602083106114dd5780518252601f1990920191602091820191016114be565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600b546001600160a01b031681565b600d5481565b6115656116e3565b600a546001600160a01b039081169116146115b5576040805162461bcd60e51b81526020600482018190526024820152600080516020612bdc833981519152604482015290519081900360640190fd5b6001600160a01b0381166115fa5760405162461bcd60e51b8152600401808060200182810382526026815260200180612a676026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6000610c4b876116d188888080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525050604080516020601f8c018190048102820181019092528a815292508a9150899081908401838280828437600092019190915250899250611ac1915050565b611f62565b6000610b2d600283612003565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061171c82610d22565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610b2d8261200f565b600061176b826116d6565b6117a65760405162461bcd60e51b815260040180806020018281038252602c815260200180612ad7602c913960400191505060405180910390fd5b60006117b183610d22565b9050806001600160a01b0316846001600160a01b031614806117ec5750836001600160a01b03166117e184610953565b6001600160a01b0316145b806117fc57506117fc818561151a565b949350505050565b826001600160a01b031661181782610d22565b6001600160a01b03161461185c5760405162461bcd60e51b8152600401808060200182810382526029815260200180612bfc6029913960400191505060405180910390fd5b6001600160a01b0382166118a15760405162461bcd60e51b8152600401808060200182810382526024815260200180612a8d6024913960400191505060405180910390fd5b6118ac838383610a8b565b6118b76000826116e7565b6001600160a01b03831660009081526001602052604090206118d99082612013565b506001600160a01b03821660009081526001602052604090206118fc908261201f565b506119096002828461202b565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610b2a8383612041565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156119c257600080fd5b505afa1580156119d6573d6000803e3d6000fd5b505050506040513d60208110156119ec57600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015611a4b578181015183820152602001611a33565b50505050905090810190601f168015611a785780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015611a9757600080fd5b505af1158015611aab573d6000803e3d6000fd5b505050506040513d602081101561111f57600080fd5b6060838383604051602401808060200180602001848152602001838103835286818151815260200191508051906020019080838360005b83811015611b10578181015183820152602001611af8565b50505050905090810190601f168015611b3d5780820380516001836020036101000a031916815260200191505b50838103825285518152855160209182019187019080838360005b83811015611b70578181015183820152602001611b58565b50505050905090810190601f168015611b9d5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316638c2b1e2f60e01b17905296505050505050505b9392505050565b600080611d02600084866040516020018083805190602001908083835b60208310611c145780518252601f199092019160209182019101611bf5565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611cf85780601f10611ccd57610100808354040283529160200191611cf8565b820191906000526020600020905b815481529060010190602001808311611cdb57829003601f168201915b50505050506120a5565b600b546040805163347d5e2560e21b81526001600160a01b0392831660048201818152602483019384528851604484015288519596509386169463d1f5789494919389939091606490910190602085019080838360005b83811015611d71578181015183820152602001611d59565b50505050905090810190601f168015611d9e5780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015611dbe57600080fd5b505af1158015611dd2573d6000803e3d6000fd5b50505050611de984826001600160a01b03166121b6565b6001600160a01b03169392505050565b6000808080611e0886866122e4565b9097909650945050505050565b8051610d1e90600990602084019061297f565b60006117fc84848461235f565b611e40848484611804565b611e4c84848484612429565b61111f5760405162461bcd60e51b8152600401808060200182810382526032815260200180612a356032913960400191505060405180910390fd5b606081611eac57506040805180820190915260018152600360fc1b60208201526108b8565b8160005b8115611ec457600101600a82049150611eb0565b60608167ffffffffffffffff81118015611edd57600080fd5b506040519080825280601f01601f191660200182016040528015611f08576020820181803683370190505b50859350905060001982015b8315611f5957600a840660300160f81b82828060019003935081518110611f3757fe5b60200101906001600160f81b031916908160001a905350600a84049350611f14565b50949350505050565b600080611ff283856040516020018083805190602001908083835b60208310611f9c5780518252601f199092019160209182019101611f7d565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600d54612591565b6001600160a01b0316949350505050565b6000610b2a838361259e565b5490565b6000610b2a83836125b6565b6000610b2a838361267c565b60006117fc84846001600160a01b0385166126c6565b815460009082106120835760405162461bcd60e51b8152600401808060200182810382526022815260200180612a136022913960400191505060405180910390fd5b82600001828154811061209257fe5b9060005260206000200154905092915050565b600080844710156120fd576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b8251612150576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b0381166117fc576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b6001600160a01b038216612211576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b61221a816116d6565b1561226c576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b61227860008383610a8b565b6001600160a01b038216600090815260016020526040902061229a908261201f565b506122a76002828461202b565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b8154600090819083106123285760405162461bcd60e51b8152600401808060200182810382526022815260200180612b8e6022913960400191505060405180910390fd5b600084600001848154811061233957fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816123fa5760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b838110156123bf5781810151838201526020016123a7565b50505050905090810190601f1680156123ec5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061240d57fe5b9060005260206000209060020201600101549150509392505050565b600061243d846001600160a01b031661275d565b612449575060016117fc565b6060612557630a85bd0160e11b61245e6116e3565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156124c55781810151838201526020016124ad565b50505050905090810190601f1680156124f25780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612a35603291396001600160a01b0388169190612763565b9050600081806020019051602081101561257057600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b6000610b2a838330612772565b60009081526001919091016020526040902054151590565b6000818152600183016020526040812054801561267257835460001980830191908101906000908790839081106125e957fe5b906000526020600020015490508087600001848154811061260657fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061263657fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610b2d565b6000915050610b2d565b6000612688838361259e565b6126be57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610b2d565b506000610b2d565b60008281526001840160205260408120548061272b575050604080518082018252838152602080820184815286546001818101895560008981528481209551600290930290950191825591519082015586548684528188019092529290912055611bd1565b8285600001600183038154811061273e57fe5b9060005260206000209060020201600101819055506000915050611bd1565b3b151590565b60606117fc84846000856127cd565b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff191660218201526035810194909452605580850193909352805180850390930183526075909301909252805191012090565b60608247101561280e5760405162461bcd60e51b8152600401808060200182810382526026815260200180612ab16026913960400191505060405180910390fd5b6128178561275d565b612868576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106128a75780518252601f199092019160209182019101612888565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612909576040519150601f19603f3d011682016040523d82523d6000602084013e61290e565b606091505b5091509150610c4b82828660608315612928575081611bd1565b8251156129385782518084602001fd5b60405162461bcd60e51b81526020600482018181528451602484015284518593919283926044019190850190808383600083156123bf5781810151838201526020016123a7565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106129c057805160ff19168380011785556129ed565b828001600101855582156129ed579182015b828111156129ed5782518255916020019190600101906129d2565b506129f99291506129fd565b5090565b5b808211156129f957600081556001016129fe56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f2061646472657373416464726573733a20696e73756666696369656e742062616c616e636520666f722063616c6c4552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a2646970667358221220d1942d08462d7f585ac3fda9d64924768e7011bee048b6876983f64b6b8516cb64736f6c634300060c0033608060405234801561001057600080fd5b50610800806100206000396000f3fe608060405234801561001057600080fd5b506004361061007d5760003560e01c80637b1039991161005b5780637b1039991461019b5780638c2b1e2f146101bf5780638da5cb5b146102ee578063a61ca6c5146102f65761007d565b80630847c431146100825780631ba99d7e146100ff5780633121db1c14610119575b600080fd5b61008a6102fe565b6040805160208082528351818301528351919283929083019185019080838360005b838110156100c45781810151838201526020016100ac565b50505050905090810190601f1680156100f15780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b61010761038b565b60408051918252519081900360200190f35b6101996004803603604081101561012f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561015a57600080fd5b82018360208201111561016c57600080fd5b8035906020019184600183028401116401000000008311171561018e57600080fd5b509092509050610391565b005b6101a361043a565b604080516001600160a01b039092168252519081900360200190f35b610199600480360360608110156101d557600080fd5b8101906020810181356401000000008111156101f057600080fd5b82018360208201111561020257600080fd5b8035906020019184600183028401116401000000008311171561022457600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929594936020810193503591505064010000000081111561027757600080fd5b82018360208201111561028957600080fd5b803590602001918460018302840111640100000000831117156102ab57600080fd5b91908080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152509295505091359250610449915050565b6101a3610481565b61008a6104fe565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103835780601f1061035857610100808354040283529160200191610383565b820191906000526020600020905b81548152906001019060200180831161036657829003601f168201915b505050505081565b60035481565b3361039a610481565b6001600160a01b0316146103f5576040805162461bcd60e51b815260206004820152601760248201527f63616c6c6572206973206e6f7420746865206f776e6572000000000000000000604482015290519081900360640190fd5b6104358383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055692505050565b505050565b6000546001600160a01b031681565b610452336106c1565b8251610465906001906020860190610737565b508151610479906002906020850190610737565b506003555050565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b1580156104cd57600080fd5b505afa1580156104e1573d6000803e3d6000fd5b505050506040513d60208110156104f757600080fd5b5051905090565b6002805460408051602060018416156101000260001901909316849004601f810184900484028201840190925281815292918301828280156103835780601f1061035857610100808354040283529160200191610383565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105bc57600080fd5b505afa1580156105d0573d6000803e3d6000fd5b505050506040513d60208110156105e657600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b8381101561064557818101518382015260200161062d565b50505050905090810190601f1680156106725780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069157600080fd5b505af11580156106a5573d6000803e3d6000fd5b505050506040513d60208110156106bb57600080fd5b50505050565b6000546001600160a01b031615610715576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077857805160ff19168380011785556107a5565b828001600101855582156107a5579182015b828111156107a557825182559160200191906001019061078a565b506107b19291506107b5565b5090565b5b808211156107b157600081556001016107b656fea26469706673582212208aad60c5c395586eae24c2085271598f521e67b913bfb818248179112053f04564736f6c634300060c0033608060405234801561001057600080fd5b50610313806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f6100ef565b005b61002f6100ef565b61002f6004803603604081101561004f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561007a57600080fd5b82018360208201111561008c57600080fd5b803590602001918460018302840111640100000000831117156100ae57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610109945050505050565b6100f7610107565b6101076101026101eb565b610210565b565b60006101136101eb565b6001600160a01b03161461012657600080fd5b61012f82610234565b8051156101e7576000826001600160a01b0316826040518082805190602001908083835b602083106101725780518252601f199092019160209182019101610153565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146101d2576040519150601f19603f3d011682016040523d82523d6000602084013e6101d7565b606091505b50509050806101e557600080fd5b505b5050565b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35490565b3660008037600080366000845af43d6000803e80801561022f573d6000f35b3d6000fd5b61023d8161029c565b6102785760405162461bcd60e51b815260040180806020018281038252603b8152602001806102a3603b913960400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c355565b3b15159056fe43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212203178a2011c46abc2765f1016c5d417892138b904850d3e7866a1bfdfd1f3a76364736f6c634300060c0033"; public static final String FUNC_APPROVE = "approve"; @@ -134,6 +136,19 @@ public class DatasetRegistry extends Contract { Arrays.>asList(new TypeReference

(true) {}, new TypeReference
(true) {}, new TypeReference(true) {})); ; + protected static final HashMap _addresses; + + static { + _addresses = new HashMap(); + _addresses.put("1", "0x799DAa22654128d0C64d5b79eac9283008158730"); + _addresses.put("133", "0x799DAa22654128d0C64d5b79eac9283008158730"); + _addresses.put("134", "0x799DAa22654128d0C64d5b79eac9283008158730"); + _addresses.put("3", "0x799DAa22654128d0C64d5b79eac9283008158730"); + _addresses.put("4", "0x799DAa22654128d0C64d5b79eac9283008158730"); + _addresses.put("5", "0x799DAa22654128d0C64d5b79eac9283008158730"); + _addresses.put("42", "0x799DAa22654128d0C64d5b79eac9283008158730"); + } + @Deprecated protected DatasetRegistry(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); @@ -152,8 +167,8 @@ protected DatasetRegistry(String contractAddress, Web3j web3j, TransactionManage super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } - public List getApprovalEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); + public static List getApprovalEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalEventResponse typedResponse = new ApprovalEventResponse(); @@ -187,8 +202,8 @@ public Flowable approvalEventFlowable(DefaultBlockParamet return approvalEventFlowable(filter); } - public List getApprovalForAllEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVALFORALL_EVENT, transactionReceipt); + public static List getApprovalForAllEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVALFORALL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalForAllEventResponse typedResponse = new ApprovalForAllEventResponse(); @@ -222,8 +237,8 @@ public Flowable approvalForAllEventFlowable(Default return approvalForAllEventFlowable(filter); } - public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); + public static List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); @@ -255,8 +270,8 @@ public Flowable ownershipTransferredEventFlow return ownershipTransferredEventFlowable(filter); } - public List getTransferEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); + public static List getTransferEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TransferEventResponse typedResponse = new TransferEventResponse(); @@ -293,7 +308,7 @@ public Flowable transferEventFlowable(DefaultBlockParamet public RemoteFunctionCall approve(String to, BigInteger tokenId) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_APPROVE, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, to), + Arrays.asList(new org.web3j.abi.datatypes.Address(to), new org.web3j.abi.datatypes.generated.Uint256(tokenId)), Collections.>emptyList()); return executeRemoteCallTransaction(function); @@ -301,7 +316,7 @@ public RemoteFunctionCall approve(String to, BigInteger toke public RemoteFunctionCall balanceOf(String owner) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_BALANCEOF, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, owner)), + Arrays.asList(new org.web3j.abi.datatypes.Address(owner)), Arrays.>asList(new TypeReference() {})); return executeRemoteCallSingleValueReturn(function, BigInteger.class); } @@ -323,7 +338,7 @@ public RemoteFunctionCall getApproved(BigInteger tokenId) { public RemoteFunctionCall initialize(String _previous) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_INITIALIZE, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, _previous)), + Arrays.asList(new org.web3j.abi.datatypes.Address(_previous)), Collections.>emptyList()); return executeRemoteCallTransaction(function); } @@ -337,15 +352,15 @@ public RemoteFunctionCall initialized() { public RemoteFunctionCall isApprovedForAll(String owner, String operator) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ISAPPROVEDFORALL, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, owner), - new org.web3j.abi.datatypes.Address(160, operator)), + Arrays.asList(new org.web3j.abi.datatypes.Address(owner), + new org.web3j.abi.datatypes.Address(operator)), Arrays.>asList(new TypeReference() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } public RemoteFunctionCall isRegistered(String _entry) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ISREGISTERED, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, _entry)), + Arrays.asList(new org.web3j.abi.datatypes.Address(_entry)), Arrays.>asList(new TypeReference() {})); return executeRemoteCallSingleValueReturn(function, Boolean.class); } @@ -410,8 +425,8 @@ public RemoteFunctionCall renounceOwnership() { public RemoteFunctionCall safeTransferFrom(String from, String to, BigInteger tokenId) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_safeTransferFrom, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, from), - new org.web3j.abi.datatypes.Address(160, to), + Arrays.asList(new org.web3j.abi.datatypes.Address(from), + new org.web3j.abi.datatypes.Address(to), new org.web3j.abi.datatypes.generated.Uint256(tokenId)), Collections.>emptyList()); return executeRemoteCallTransaction(function); @@ -420,8 +435,8 @@ public RemoteFunctionCall safeTransferFrom(String from, Stri public RemoteFunctionCall safeTransferFrom(String from, String to, BigInteger tokenId, byte[] _data) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_safeTransferFrom, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, from), - new org.web3j.abi.datatypes.Address(160, to), + Arrays.asList(new org.web3j.abi.datatypes.Address(from), + new org.web3j.abi.datatypes.Address(to), new org.web3j.abi.datatypes.generated.Uint256(tokenId), new org.web3j.abi.datatypes.DynamicBytes(_data)), Collections.>emptyList()); @@ -431,7 +446,7 @@ public RemoteFunctionCall safeTransferFrom(String from, Stri public RemoteFunctionCall setApprovalForAll(String operator, Boolean approved) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_SETAPPROVALFORALL, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, operator), + Arrays.asList(new org.web3j.abi.datatypes.Address(operator), new org.web3j.abi.datatypes.Bool(approved)), Collections.>emptyList()); return executeRemoteCallTransaction(function); @@ -448,7 +463,7 @@ public RemoteFunctionCall setBaseURI(String _baseURI) { public RemoteFunctionCall setName(String _ens, String _name) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_SETNAME, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, _ens), + Arrays.asList(new org.web3j.abi.datatypes.Address(_ens), new org.web3j.abi.datatypes.Utf8String(_name)), Collections.>emptyList()); return executeRemoteCallTransaction(function); @@ -477,7 +492,7 @@ public RemoteFunctionCall tokenByIndex(BigInteger index) { public RemoteFunctionCall tokenOfOwnerByIndex(String owner, BigInteger index) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_TOKENOFOWNERBYINDEX, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, owner), + Arrays.asList(new org.web3j.abi.datatypes.Address(owner), new org.web3j.abi.datatypes.generated.Uint256(index)), Arrays.>asList(new TypeReference() {})); return executeRemoteCallSingleValueReturn(function, BigInteger.class); @@ -500,8 +515,8 @@ public RemoteFunctionCall totalSupply() { public RemoteFunctionCall transferFrom(String from, String to, BigInteger tokenId) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_TRANSFERFROM, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, from), - new org.web3j.abi.datatypes.Address(160, to), + Arrays.asList(new org.web3j.abi.datatypes.Address(from), + new org.web3j.abi.datatypes.Address(to), new org.web3j.abi.datatypes.generated.Uint256(tokenId)), Collections.>emptyList()); return executeRemoteCallTransaction(function); @@ -510,7 +525,7 @@ public RemoteFunctionCall transferFrom(String from, String t public RemoteFunctionCall transferOwnership(String newOwner) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_TRANSFEROWNERSHIP, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, newOwner)), + Arrays.asList(new org.web3j.abi.datatypes.Address(newOwner)), Collections.>emptyList()); return executeRemoteCallTransaction(function); } @@ -518,7 +533,7 @@ public RemoteFunctionCall transferOwnership(String newOwner) public RemoteFunctionCall createDataset(String _datasetOwner, String _datasetName, byte[] _datasetMultiaddr, byte[] _datasetChecksum) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_CREATEDATASET, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, _datasetOwner), + Arrays.asList(new org.web3j.abi.datatypes.Address(_datasetOwner), new org.web3j.abi.datatypes.Utf8String(_datasetName), new org.web3j.abi.datatypes.DynamicBytes(_datasetMultiaddr), new org.web3j.abi.datatypes.generated.Bytes32(_datasetChecksum)), @@ -528,7 +543,7 @@ public RemoteFunctionCall createDataset(String _datasetOwner public RemoteFunctionCall predictDataset(String _datasetOwner, String _datasetName, byte[] _datasetMultiaddr, byte[] _datasetChecksum) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_PREDICTDATASET, - Arrays.asList(new org.web3j.abi.datatypes.Address(160, _datasetOwner), + Arrays.asList(new org.web3j.abi.datatypes.Address(_datasetOwner), new org.web3j.abi.datatypes.Utf8String(_datasetName), new org.web3j.abi.datatypes.DynamicBytes(_datasetMultiaddr), new org.web3j.abi.datatypes.generated.Bytes32(_datasetChecksum)), @@ -554,6 +569,32 @@ public static DatasetRegistry load(String contractAddress, Web3j web3j, Transact return new DatasetRegistry(contractAddress, web3j, transactionManager, contractGasProvider); } + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(DatasetRegistry.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(DatasetRegistry.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(DatasetRegistry.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(DatasetRegistry.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } + + protected String getStaticDeployedAddress(String networkId) { + return _addresses.get(networkId); + } + + public static String getPreviouslyDeployedAddress(String networkId) { + return _addresses.get(networkId); + } + public static class ApprovalEventResponse extends BaseEventResponse { public String owner; diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/IexecHubContract.java b/src/main/java/com/iexec/commons/poco/contract/generated/IexecHubContract.java index ac61d38..daac150 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/IexecHubContract.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/IexecHubContract.java @@ -25,13 +25,16 @@ import java.util.HashMap; import java.util.List; import java.util.concurrent.Callable; +import java.util.stream.Collectors; import org.web3j.abi.EventEncoder; import org.web3j.abi.TypeReference; import org.web3j.abi.datatypes.Address; import org.web3j.abi.datatypes.Bool; import org.web3j.abi.datatypes.DynamicArray; import org.web3j.abi.datatypes.DynamicBytes; +import org.web3j.abi.datatypes.DynamicStruct; import org.web3j.abi.datatypes.Event; +import org.web3j.abi.datatypes.StaticStruct; import org.web3j.abi.datatypes.Type; import org.web3j.abi.datatypes.Utf8String; import org.web3j.abi.datatypes.generated.Bytes32; @@ -63,12 +66,14 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class IexecHubContract extends Contract { public static final String BINARY = "0x"; + public static final String FUNC_UNISWAPV2ROUTER = "UniswapV2Router"; + public static final String FUNC_ALLOWANCE = "allowance"; public static final String FUNC_APPREGISTRY = "appregistry"; @@ -79,6 +84,14 @@ public class IexecHubContract extends Contract { public static final String FUNC_BALANCEOF = "balanceOf"; + public static final String FUNC_BROADCASTAPPORDER = "broadcastAppOrder"; + + public static final String FUNC_BROADCASTDATASETORDER = "broadcastDatasetOrder"; + + public static final String FUNC_BROADCASTREQUESTORDER = "broadcastRequestOrder"; + + public static final String FUNC_BROADCASTWORKERPOOLORDER = "broadcastWorkerpoolOrder"; + public static final String FUNC_CALLBACKGAS = "callbackgas"; public static final String FUNC_CLAIM = "claim"; @@ -105,12 +118,26 @@ public class IexecHubContract extends Contract { public static final String FUNC_DEPOSIT = "deposit"; + public static final String FUNC_DEPOSITETH = "depositEth"; + + public static final String FUNC_DEPOSITETHFOR = "depositEthFor"; + public static final String FUNC_DEPOSITFOR = "depositFor"; public static final String FUNC_DEPOSITFORARRAY = "depositForArray"; + public static final String FUNC_DOMAIN = "domain"; + public static final String FUNC_EIP712DOMAIN_SEPARATOR = "eip712domain_separator"; + public static final String FUNC_ESTIMATEDEPOSITETHSENT = "estimateDepositEthSent"; + + public static final String FUNC_ESTIMATEDEPOSITTOKENWANTED = "estimateDepositTokenWanted"; + + public static final String FUNC_ESTIMATEWITHDRAWETHWANTED = "estimateWithdrawEthWanted"; + + public static final String FUNC_ESTIMATEWITHDRAWTOKENSENT = "estimateWithdrawTokenSent"; + public static final String FUNC_FINAL_DEADLINE_RATIO = "final_deadline_ratio"; public static final String FUNC_FINALIZE = "finalize"; @@ -135,6 +162,18 @@ public class IexecHubContract extends Contract { public static final String FUNC_KITTY_RATIO = "kitty_ratio"; + public static final String FUNC_MANAGEAPPORDER = "manageAppOrder"; + + public static final String FUNC_MANAGEDATASETORDER = "manageDatasetOrder"; + + public static final String FUNC_MANAGEREQUESTORDER = "manageRequestOrder"; + + public static final String FUNC_MANAGEWORKERPOOLORDER = "manageWorkerpoolOrder"; + + public static final String FUNC_MATCHORDERS = "matchOrders"; + + public static final String FUNC_MATCHORDERSWITHETH = "matchOrdersWithEth"; + public static final String FUNC_NAME = "name"; public static final String FUNC_OWNER = "owner"; @@ -147,12 +186,24 @@ public class IexecHubContract extends Contract { public static final String FUNC_REOPEN = "reopen"; + public static final String FUNC_REQUESTTOKEN = "requestToken"; + + public static final String FUNC_REQUESTTOKENFOR = "requestTokenFor"; + public static final String FUNC_RESULTFOR = "resultFor"; public static final String FUNC_REVEAL = "reveal"; public static final String FUNC_REVEAL_DEADLINE_RATIO = "reveal_deadline_ratio"; + public static final String FUNC_SAFEDEPOSITETH = "safeDepositEth"; + + public static final String FUNC_SAFEDEPOSITETHFOR = "safeDepositEthFor"; + + public static final String FUNC_SAFEWITHDRAWETH = "safeWithdrawEth"; + + public static final String FUNC_SAFEWITHDRAWETHTO = "safeWithdrawEthTo"; + public static final String FUNC_SETCALLBACKGAS = "setCallbackGas"; public static final String FUNC_SETNAME = "setName"; @@ -181,16 +232,24 @@ public class IexecHubContract extends Contract { public static final String FUNC_VERIFYSIGNATURE = "verifySignature"; + public static final String FUNC_VIEWACCOUNT = "viewAccount"; + public static final String FUNC_VIEWACCOUNTABILEGACY = "viewAccountABILegacy"; + public static final String FUNC_VIEWCATEGORY = "viewCategory"; + public static final String FUNC_VIEWCATEGORYABILEGACY = "viewCategoryABILegacy"; public static final String FUNC_VIEWCONFIGABILEGACY = "viewConfigABILegacy"; public static final String FUNC_VIEWCONSUMED = "viewConsumed"; + public static final String FUNC_VIEWCONTRIBUTION = "viewContribution"; + public static final String FUNC_VIEWCONTRIBUTIONABILEGACY = "viewContributionABILegacy"; + public static final String FUNC_VIEWDEAL = "viewDeal"; + public static final String FUNC_VIEWDEALABILEGACY_PT1 = "viewDealABILegacy_pt1"; public static final String FUNC_VIEWDEALABILEGACY_PT2 = "viewDealABILegacy_pt2"; @@ -199,10 +258,18 @@ public class IexecHubContract extends Contract { public static final String FUNC_VIEWSCORE = "viewScore"; + public static final String FUNC_VIEWTASK = "viewTask"; + public static final String FUNC_VIEWTASKABILEGACY = "viewTaskABILegacy"; public static final String FUNC_WITHDRAW = "withdraw"; + public static final String FUNC_WITHDRAWETH = "withdrawEth"; + + public static final String FUNC_WITHDRAWETHTO = "withdrawEthTo"; + + public static final String FUNC_WITHDRAWTO = "withdrawTo"; + public static final String FUNC_WORKERPOOL_STAKE_RATIO = "workerpool_stake_ratio"; public static final String FUNC_WORKERPOOLREGISTRY = "workerpoolregistry"; @@ -215,6 +282,22 @@ public class IexecHubContract extends Contract { Arrays.>asList(new TypeReference

(true) {}, new TypeReference
(true) {}, new TypeReference() {})); ; + public static final Event BROADCASTAPPORDER_EVENT = new Event("BroadcastAppOrder", + Arrays.>asList(new TypeReference() {})); + ; + + public static final Event BROADCASTDATASETORDER_EVENT = new Event("BroadcastDatasetOrder", + Arrays.>asList(new TypeReference() {})); + ; + + public static final Event BROADCASTREQUESTORDER_EVENT = new Event("BroadcastRequestOrder", + Arrays.>asList(new TypeReference() {})); + ; + + public static final Event BROADCASTWORKERPOOLORDER_EVENT = new Event("BroadcastWorkerpoolOrder", + Arrays.>asList(new TypeReference() {})); + ; + public static final Event CLOSEDAPPORDER_EVENT = new Event("ClosedAppOrder", Arrays.>asList(new TypeReference() {})); ; @@ -339,8 +422,8 @@ protected IexecHubContract(String contractAddress, Web3j web3j, TransactionManag super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } - public List getAccurateContributionEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(ACCURATECONTRIBUTION_EVENT, transactionReceipt); + public static List getAccurateContributionEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(ACCURATECONTRIBUTION_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { AccurateContributionEventResponse typedResponse = new AccurateContributionEventResponse(); @@ -372,8 +455,8 @@ public Flowable accurateContributionEventFlow return accurateContributionEventFlowable(filter); } - public List getApprovalEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); + public static List getApprovalEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalEventResponse typedResponse = new ApprovalEventResponse(); @@ -407,8 +490,132 @@ public Flowable approvalEventFlowable(DefaultBlockParamet return approvalEventFlowable(filter); } - public List getClosedAppOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(CLOSEDAPPORDER_EVENT, transactionReceipt); + public static List getBroadcastAppOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(BROADCASTAPPORDER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + BroadcastAppOrderEventResponse typedResponse = new BroadcastAppOrderEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.apporder = (AppOrder) eventValues.getNonIndexedValues().get(0); + responses.add(typedResponse); + } + return responses; + } + + public Flowable broadcastAppOrderEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(new Function() { + @Override + public BroadcastAppOrderEventResponse apply(Log log) { + Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(BROADCASTAPPORDER_EVENT, log); + BroadcastAppOrderEventResponse typedResponse = new BroadcastAppOrderEventResponse(); + typedResponse.log = log; + typedResponse.apporder = (AppOrder) eventValues.getNonIndexedValues().get(0); + return typedResponse; + } + }); + } + + public Flowable broadcastAppOrderEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(BROADCASTAPPORDER_EVENT)); + return broadcastAppOrderEventFlowable(filter); + } + + public static List getBroadcastDatasetOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(BROADCASTDATASETORDER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + BroadcastDatasetOrderEventResponse typedResponse = new BroadcastDatasetOrderEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.datasetorder = (DatasetOrder) eventValues.getNonIndexedValues().get(0); + responses.add(typedResponse); + } + return responses; + } + + public Flowable broadcastDatasetOrderEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(new Function() { + @Override + public BroadcastDatasetOrderEventResponse apply(Log log) { + Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(BROADCASTDATASETORDER_EVENT, log); + BroadcastDatasetOrderEventResponse typedResponse = new BroadcastDatasetOrderEventResponse(); + typedResponse.log = log; + typedResponse.datasetorder = (DatasetOrder) eventValues.getNonIndexedValues().get(0); + return typedResponse; + } + }); + } + + public Flowable broadcastDatasetOrderEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(BROADCASTDATASETORDER_EVENT)); + return broadcastDatasetOrderEventFlowable(filter); + } + + public static List getBroadcastRequestOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(BROADCASTREQUESTORDER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + BroadcastRequestOrderEventResponse typedResponse = new BroadcastRequestOrderEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.requestorder = (RequestOrder) eventValues.getNonIndexedValues().get(0); + responses.add(typedResponse); + } + return responses; + } + + public Flowable broadcastRequestOrderEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(new Function() { + @Override + public BroadcastRequestOrderEventResponse apply(Log log) { + Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(BROADCASTREQUESTORDER_EVENT, log); + BroadcastRequestOrderEventResponse typedResponse = new BroadcastRequestOrderEventResponse(); + typedResponse.log = log; + typedResponse.requestorder = (RequestOrder) eventValues.getNonIndexedValues().get(0); + return typedResponse; + } + }); + } + + public Flowable broadcastRequestOrderEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(BROADCASTREQUESTORDER_EVENT)); + return broadcastRequestOrderEventFlowable(filter); + } + + public static List getBroadcastWorkerpoolOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(BROADCASTWORKERPOOLORDER_EVENT, transactionReceipt); + ArrayList responses = new ArrayList(valueList.size()); + for (Contract.EventValuesWithLog eventValues : valueList) { + BroadcastWorkerpoolOrderEventResponse typedResponse = new BroadcastWorkerpoolOrderEventResponse(); + typedResponse.log = eventValues.getLog(); + typedResponse.workerpoolorder = (WorkerpoolOrder) eventValues.getNonIndexedValues().get(0); + responses.add(typedResponse); + } + return responses; + } + + public Flowable broadcastWorkerpoolOrderEventFlowable(EthFilter filter) { + return web3j.ethLogFlowable(filter).map(new Function() { + @Override + public BroadcastWorkerpoolOrderEventResponse apply(Log log) { + Contract.EventValuesWithLog eventValues = extractEventParametersWithLog(BROADCASTWORKERPOOLORDER_EVENT, log); + BroadcastWorkerpoolOrderEventResponse typedResponse = new BroadcastWorkerpoolOrderEventResponse(); + typedResponse.log = log; + typedResponse.workerpoolorder = (WorkerpoolOrder) eventValues.getNonIndexedValues().get(0); + return typedResponse; + } + }); + } + + public Flowable broadcastWorkerpoolOrderEventFlowable(DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) { + EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress()); + filter.addSingleTopic(EventEncoder.encode(BROADCASTWORKERPOOLORDER_EVENT)); + return broadcastWorkerpoolOrderEventFlowable(filter); + } + + public static List getClosedAppOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(CLOSEDAPPORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ClosedAppOrderEventResponse typedResponse = new ClosedAppOrderEventResponse(); @@ -438,8 +645,8 @@ public Flowable closedAppOrderEventFlowable(Default return closedAppOrderEventFlowable(filter); } - public List getClosedDatasetOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(CLOSEDDATASETORDER_EVENT, transactionReceipt); + public static List getClosedDatasetOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(CLOSEDDATASETORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ClosedDatasetOrderEventResponse typedResponse = new ClosedDatasetOrderEventResponse(); @@ -469,8 +676,8 @@ public Flowable closedDatasetOrderEventFlowable return closedDatasetOrderEventFlowable(filter); } - public List getClosedRequestOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(CLOSEDREQUESTORDER_EVENT, transactionReceipt); + public static List getClosedRequestOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(CLOSEDREQUESTORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ClosedRequestOrderEventResponse typedResponse = new ClosedRequestOrderEventResponse(); @@ -500,8 +707,8 @@ public Flowable closedRequestOrderEventFlowable return closedRequestOrderEventFlowable(filter); } - public List getClosedWorkerpoolOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(CLOSEDWORKERPOOLORDER_EVENT, transactionReceipt); + public static List getClosedWorkerpoolOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(CLOSEDWORKERPOOLORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ClosedWorkerpoolOrderEventResponse typedResponse = new ClosedWorkerpoolOrderEventResponse(); @@ -531,8 +738,8 @@ public Flowable closedWorkerpoolOrderEventFl return closedWorkerpoolOrderEventFlowable(filter); } - public List getCreateCategoryEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(CREATECATEGORY_EVENT, transactionReceipt); + public static List getCreateCategoryEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(CREATECATEGORY_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { CreateCategoryEventResponse typedResponse = new CreateCategoryEventResponse(); @@ -568,8 +775,8 @@ public Flowable createCategoryEventFlowable(Default return createCategoryEventFlowable(filter); } - public List getFaultyContributionEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(FAULTYCONTRIBUTION_EVENT, transactionReceipt); + public static List getFaultyContributionEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(FAULTYCONTRIBUTION_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { FaultyContributionEventResponse typedResponse = new FaultyContributionEventResponse(); @@ -601,8 +808,8 @@ public Flowable faultyContributionEventFlowable return faultyContributionEventFlowable(filter); } - public List getLockEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(LOCK_EVENT, transactionReceipt); + public static List getLockEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(LOCK_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { LockEventResponse typedResponse = new LockEventResponse(); @@ -634,8 +841,8 @@ public Flowable lockEventFlowable(DefaultBlockParameter start return lockEventFlowable(filter); } - public List getOrdersMatchedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(ORDERSMATCHED_EVENT, transactionReceipt); + public static List getOrdersMatchedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(ORDERSMATCHED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { OrdersMatchedEventResponse typedResponse = new OrdersMatchedEventResponse(); @@ -675,8 +882,8 @@ public Flowable ordersMatchedEventFlowable(DefaultBl return ordersMatchedEventFlowable(filter); } - public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); + public static List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); @@ -708,8 +915,8 @@ public Flowable ownershipTransferredEventFlow return ownershipTransferredEventFlowable(filter); } - public List getRewardEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(REWARD_EVENT, transactionReceipt); + public static List getRewardEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(REWARD_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { RewardEventResponse typedResponse = new RewardEventResponse(); @@ -743,8 +950,8 @@ public Flowable rewardEventFlowable(DefaultBlockParameter s return rewardEventFlowable(filter); } - public List getSchedulerNoticeEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(SCHEDULERNOTICE_EVENT, transactionReceipt); + public static List getSchedulerNoticeEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SCHEDULERNOTICE_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { SchedulerNoticeEventResponse typedResponse = new SchedulerNoticeEventResponse(); @@ -776,8 +983,8 @@ public Flowable schedulerNoticeEventFlowable(Defau return schedulerNoticeEventFlowable(filter); } - public List getSeizeEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(SEIZE_EVENT, transactionReceipt); + public static List getSeizeEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SEIZE_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { SeizeEventResponse typedResponse = new SeizeEventResponse(); @@ -811,8 +1018,8 @@ public Flowable seizeEventFlowable(DefaultBlockParameter sta return seizeEventFlowable(filter); } - public List getSignedAppOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(SIGNEDAPPORDER_EVENT, transactionReceipt); + public static List getSignedAppOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SIGNEDAPPORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { SignedAppOrderEventResponse typedResponse = new SignedAppOrderEventResponse(); @@ -842,8 +1049,8 @@ public Flowable signedAppOrderEventFlowable(Default return signedAppOrderEventFlowable(filter); } - public List getSignedDatasetOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(SIGNEDDATASETORDER_EVENT, transactionReceipt); + public static List getSignedDatasetOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SIGNEDDATASETORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { SignedDatasetOrderEventResponse typedResponse = new SignedDatasetOrderEventResponse(); @@ -873,8 +1080,8 @@ public Flowable signedDatasetOrderEventFlowable return signedDatasetOrderEventFlowable(filter); } - public List getSignedRequestOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(SIGNEDREQUESTORDER_EVENT, transactionReceipt); + public static List getSignedRequestOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SIGNEDREQUESTORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { SignedRequestOrderEventResponse typedResponse = new SignedRequestOrderEventResponse(); @@ -904,8 +1111,8 @@ public Flowable signedRequestOrderEventFlowable return signedRequestOrderEventFlowable(filter); } - public List getSignedWorkerpoolOrderEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(SIGNEDWORKERPOOLORDER_EVENT, transactionReceipt); + public static List getSignedWorkerpoolOrderEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(SIGNEDWORKERPOOLORDER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { SignedWorkerpoolOrderEventResponse typedResponse = new SignedWorkerpoolOrderEventResponse(); @@ -935,8 +1142,8 @@ public Flowable signedWorkerpoolOrderEventFl return signedWorkerpoolOrderEventFlowable(filter); } - public List getTaskClaimedEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKCLAIMED_EVENT, transactionReceipt); + public static List getTaskClaimedEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKCLAIMED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskClaimedEventResponse typedResponse = new TaskClaimedEventResponse(); @@ -966,8 +1173,8 @@ public Flowable taskClaimedEventFlowable(DefaultBlockP return taskClaimedEventFlowable(filter); } - public List getTaskConsensusEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKCONSENSUS_EVENT, transactionReceipt); + public static List getTaskConsensusEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKCONSENSUS_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskConsensusEventResponse typedResponse = new TaskConsensusEventResponse(); @@ -999,8 +1206,8 @@ public Flowable taskConsensusEventFlowable(DefaultBl return taskConsensusEventFlowable(filter); } - public List getTaskContributeEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKCONTRIBUTE_EVENT, transactionReceipt); + public static List getTaskContributeEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKCONTRIBUTE_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskContributeEventResponse typedResponse = new TaskContributeEventResponse(); @@ -1034,8 +1241,8 @@ public Flowable taskContributeEventFlowable(Default return taskContributeEventFlowable(filter); } - public List getTaskFinalizeEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKFINALIZE_EVENT, transactionReceipt); + public static List getTaskFinalizeEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKFINALIZE_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskFinalizeEventResponse typedResponse = new TaskFinalizeEventResponse(); @@ -1067,8 +1274,8 @@ public Flowable taskFinalizeEventFlowable(DefaultBloc return taskFinalizeEventFlowable(filter); } - public List getTaskInitializeEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKINITIALIZE_EVENT, transactionReceipt); + public static List getTaskInitializeEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKINITIALIZE_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskInitializeEventResponse typedResponse = new TaskInitializeEventResponse(); @@ -1100,8 +1307,8 @@ public Flowable taskInitializeEventFlowable(Default return taskInitializeEventFlowable(filter); } - public List getTaskReopenEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKREOPEN_EVENT, transactionReceipt); + public static List getTaskReopenEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKREOPEN_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskReopenEventResponse typedResponse = new TaskReopenEventResponse(); @@ -1131,8 +1338,8 @@ public Flowable taskReopenEventFlowable(DefaultBlockPar return taskReopenEventFlowable(filter); } - public List getTaskRevealEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TASKREVEAL_EVENT, transactionReceipt); + public static List getTaskRevealEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TASKREVEAL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TaskRevealEventResponse typedResponse = new TaskRevealEventResponse(); @@ -1166,8 +1373,8 @@ public Flowable taskRevealEventFlowable(DefaultBlockPar return taskRevealEventFlowable(filter); } - public List getTransferEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); + public static List getTransferEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TransferEventResponse typedResponse = new TransferEventResponse(); @@ -1201,8 +1408,8 @@ public Flowable transferEventFlowable(DefaultBlockParamet return transferEventFlowable(filter); } - public List getUnlockEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(UNLOCK_EVENT, transactionReceipt); + public static List getUnlockEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(UNLOCK_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { UnlockEventResponse typedResponse = new UnlockEventResponse(); @@ -1234,6 +1441,13 @@ public Flowable unlockEventFlowable(DefaultBlockParameter s return unlockEventFlowable(filter); } + public RemoteFunctionCall UniswapV2Router() { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_UNISWAPV2ROUTER, + Arrays.asList(), + Arrays.>asList(new TypeReference
() {})); + return executeRemoteCallSingleValueReturn(function, String.class); + } + public RemoteFunctionCall allowance(String param0, String param1) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ALLOWANCE, Arrays.asList(new org.web3j.abi.datatypes.Address(param0), @@ -1275,6 +1489,38 @@ public RemoteFunctionCall balanceOf(String param0) { return executeRemoteCallSingleValueReturn(function, BigInteger.class); } + public RemoteFunctionCall broadcastAppOrder(AppOrder param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_BROADCASTAPPORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall broadcastDatasetOrder(DatasetOrder param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_BROADCASTDATASETORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall broadcastRequestOrder(RequestOrder param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_BROADCASTREQUESTORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall broadcastWorkerpoolOrder(WorkerpoolOrder param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_BROADCASTWORKERPOOLORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + public RemoteFunctionCall callbackgas() { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_CALLBACKGAS, Arrays.asList(), @@ -1397,6 +1643,22 @@ public RemoteFunctionCall deposit(BigInteger param0) { return executeRemoteCallTransaction(function); } + public RemoteFunctionCall depositEth(BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_DEPOSITETH, + Arrays.asList(), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + + public RemoteFunctionCall depositEthFor(String param0, BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_DEPOSITETHFOR, + Arrays.asList(new org.web3j.abi.datatypes.Address(param0)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + public RemoteFunctionCall depositFor(BigInteger param0, String param1) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_DEPOSITFOR, @@ -1419,6 +1681,13 @@ public RemoteFunctionCall depositForArray(List p return executeRemoteCallTransaction(function); } + public RemoteFunctionCall domain() { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_DOMAIN, + Arrays.asList(), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, EIP712Domain.class); + } + public RemoteFunctionCall eip712domain_separator() { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_EIP712DOMAIN_SEPARATOR, Arrays.asList(), @@ -1426,6 +1695,34 @@ public RemoteFunctionCall eip712domain_separator() { return executeRemoteCallSingleValueReturn(function, byte[].class); } + public RemoteFunctionCall estimateDepositEthSent(BigInteger param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ESTIMATEDEPOSITETHSENT, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall estimateDepositTokenWanted(BigInteger param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ESTIMATEDEPOSITTOKENWANTED, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall estimateWithdrawEthWanted(BigInteger param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ESTIMATEWITHDRAWETHWANTED, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + + public RemoteFunctionCall estimateWithdrawTokenSent(BigInteger param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_ESTIMATEWITHDRAWTOKENSENT, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, BigInteger.class); + } + public RemoteFunctionCall final_deadline_ratio() { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_FINAL_DEADLINE_RATIO, Arrays.asList(), @@ -1530,6 +1827,60 @@ public RemoteFunctionCall kitty_ratio() { return executeRemoteCallSingleValueReturn(function, BigInteger.class); } + public RemoteFunctionCall manageAppOrder(AppOrderOperation param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_MANAGEAPPORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall manageDatasetOrder(DatasetOrderOperation param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_MANAGEDATASETORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall manageRequestOrder(RequestOrderOperation param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_MANAGEREQUESTORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall manageWorkerpoolOrder(WorkerpoolOrderOperation param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_MANAGEWORKERPOOLORDER, + Arrays.asList(param0), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall matchOrders(AppOrder param0, DatasetOrder param1, WorkerpoolOrder param2, RequestOrder param3) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_MATCHORDERS, + Arrays.asList(param0, + param1, + param2, + param3), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall matchOrdersWithEth(AppOrder param0, DatasetOrder param1, WorkerpoolOrder param2, RequestOrder param3, BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_MATCHORDERSWITHETH, + Arrays.asList(param0, + param1, + param2, + param3), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + public RemoteFunctionCall name() { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_NAME, Arrays.asList(), @@ -1579,6 +1930,23 @@ public RemoteFunctionCall reopen(byte[] param0) { return executeRemoteCallTransaction(function); } + public RemoteFunctionCall requestToken(BigInteger param0, BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_REQUESTTOKEN, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + + public RemoteFunctionCall requestTokenFor(BigInteger param0, String param1, BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_REQUESTTOKENFOR, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0), + new org.web3j.abi.datatypes.Address(param1)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + public RemoteFunctionCall resultFor(byte[] param0) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_RESULTFOR, Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(param0)), @@ -1602,6 +1970,42 @@ public RemoteFunctionCall reveal_deadline_ratio() { return executeRemoteCallSingleValueReturn(function, BigInteger.class); } + public RemoteFunctionCall safeDepositEth(BigInteger param0, BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_SAFEDEPOSITETH, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + + public RemoteFunctionCall safeDepositEthFor(BigInteger param0, String param1, BigInteger weiValue) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_SAFEDEPOSITETHFOR, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0), + new org.web3j.abi.datatypes.Address(param1)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function, weiValue); + } + + public RemoteFunctionCall safeWithdrawEth(BigInteger param0, BigInteger param1) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_SAFEWITHDRAWETH, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0), + new org.web3j.abi.datatypes.generated.Uint256(param1)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall safeWithdrawEthTo(BigInteger param0, BigInteger param1, String param2) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_SAFEWITHDRAWETHTO, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0), + new org.web3j.abi.datatypes.generated.Uint256(param1), + new org.web3j.abi.datatypes.Address(param2)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + public RemoteFunctionCall setCallbackGas(BigInteger param0) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( FUNC_SETCALLBACKGAS, @@ -1716,6 +2120,13 @@ public RemoteFunctionCall verifySignature(String param0, byte[] param1, return executeRemoteCallSingleValueReturn(function, Boolean.class); } + public RemoteFunctionCall viewAccount(String param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWACCOUNT, + Arrays.asList(new org.web3j.abi.datatypes.Address(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Account.class); + } + public RemoteFunctionCall> viewAccountABILegacy(String _user) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWACCOUNTABILEGACY, Arrays.asList(new org.web3j.abi.datatypes.Address(_user)), @@ -1732,6 +2143,13 @@ public Tuple2 call() throws Exception { }); } + public RemoteFunctionCall viewCategory(BigInteger param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWCATEGORY, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Category.class); + } + public RemoteFunctionCall> viewCategoryABILegacy(BigInteger _catid) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWCATEGORYABILEGACY, Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(_catid)), @@ -1776,6 +2194,14 @@ public RemoteFunctionCall viewConsumed(byte[] param0) { return executeRemoteCallSingleValueReturn(function, BigInteger.class); } + public RemoteFunctionCall viewContribution(byte[] param0, String param1) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWCONTRIBUTION, + Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(param0), + new org.web3j.abi.datatypes.Address(param1)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Contribution.class); + } + public RemoteFunctionCall> viewContributionABILegacy(byte[] _taskid, String _worker) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWCONTRIBUTIONABILEGACY, Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(_taskid), @@ -1795,6 +2221,13 @@ public Tuple4 call() throws Exception { }); } + public RemoteFunctionCall viewDeal(byte[] param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWDEAL, + Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Deal.class); + } + public RemoteFunctionCall> viewDealABILegacy_pt1(byte[] _id) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWDEALABILEGACY_PT1, Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(_id)), @@ -1852,7 +2285,13 @@ public RemoteFunctionCall viewScore(String param0) { return executeRemoteCallSingleValueReturn(function, BigInteger.class); } - @SuppressWarnings("unchecked") + public RemoteFunctionCall viewTask(byte[] param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWTASK, + Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(param0)), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, Task.class); + } + public RemoteFunctionCall, byte[]>> viewTaskABILegacy(byte[] _taskid) { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_VIEWTASKABILEGACY, Arrays.asList(new org.web3j.abi.datatypes.generated.Bytes32(_taskid)), @@ -1887,6 +2326,32 @@ public RemoteFunctionCall withdraw(BigInteger param0) { return executeRemoteCallTransaction(function); } + public RemoteFunctionCall withdrawEth(BigInteger param0) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_WITHDRAWETH, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall withdrawEthTo(BigInteger param0, String param1) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_WITHDRAWETHTO, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0), + new org.web3j.abi.datatypes.Address(param1)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + + public RemoteFunctionCall withdrawTo(BigInteger param0, String param1) { + final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function( + FUNC_WITHDRAWTO, + Arrays.asList(new org.web3j.abi.datatypes.generated.Uint256(param0), + new org.web3j.abi.datatypes.Address(param1)), + Collections.>emptyList()); + return executeRemoteCallTransaction(function); + } + public RemoteFunctionCall workerpool_stake_ratio() { final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(FUNC_WORKERPOOL_STAKE_RATIO, Arrays.asList(), @@ -1945,6 +2410,663 @@ public static String getPreviouslyDeployedAddress(String networkId) { return _addresses.get(networkId); } + public static class AppOrder extends DynamicStruct { + public String app; + + public BigInteger appprice; + + public BigInteger volume; + + public byte[] tag; + + public String datasetrestrict; + + public String workerpoolrestrict; + + public String requesterrestrict; + + public byte[] salt; + + public byte[] sign; + + public AppOrder(String app, BigInteger appprice, BigInteger volume, byte[] tag, String datasetrestrict, String workerpoolrestrict, String requesterrestrict, byte[] salt, byte[] sign) { + super(new org.web3j.abi.datatypes.Address(app), + new org.web3j.abi.datatypes.generated.Uint256(appprice), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.Address(datasetrestrict), + new org.web3j.abi.datatypes.Address(workerpoolrestrict), + new org.web3j.abi.datatypes.Address(requesterrestrict), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.app = app; + this.appprice = appprice; + this.volume = volume; + this.tag = tag; + this.datasetrestrict = datasetrestrict; + this.workerpoolrestrict = workerpoolrestrict; + this.requesterrestrict = requesterrestrict; + this.salt = salt; + this.sign = sign; + } + + public AppOrder(Address app, Uint256 appprice, Uint256 volume, Bytes32 tag, Address datasetrestrict, Address workerpoolrestrict, Address requesterrestrict, Bytes32 salt, DynamicBytes sign) { + super(app, appprice, volume, tag, datasetrestrict, workerpoolrestrict, requesterrestrict, salt, sign); + this.app = app.getValue(); + this.appprice = appprice.getValue(); + this.volume = volume.getValue(); + this.tag = tag.getValue(); + this.datasetrestrict = datasetrestrict.getValue(); + this.workerpoolrestrict = workerpoolrestrict.getValue(); + this.requesterrestrict = requesterrestrict.getValue(); + this.salt = salt.getValue(); + this.sign = sign.getValue(); + } + } + + public static class DatasetOrder extends DynamicStruct { + public String dataset; + + public BigInteger datasetprice; + + public BigInteger volume; + + public byte[] tag; + + public String apprestrict; + + public String workerpoolrestrict; + + public String requesterrestrict; + + public byte[] salt; + + public byte[] sign; + + public DatasetOrder(String dataset, BigInteger datasetprice, BigInteger volume, byte[] tag, String apprestrict, String workerpoolrestrict, String requesterrestrict, byte[] salt, byte[] sign) { + super(new org.web3j.abi.datatypes.Address(dataset), + new org.web3j.abi.datatypes.generated.Uint256(datasetprice), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.Address(apprestrict), + new org.web3j.abi.datatypes.Address(workerpoolrestrict), + new org.web3j.abi.datatypes.Address(requesterrestrict), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.dataset = dataset; + this.datasetprice = datasetprice; + this.volume = volume; + this.tag = tag; + this.apprestrict = apprestrict; + this.workerpoolrestrict = workerpoolrestrict; + this.requesterrestrict = requesterrestrict; + this.salt = salt; + this.sign = sign; + } + + public DatasetOrder(Address dataset, Uint256 datasetprice, Uint256 volume, Bytes32 tag, Address apprestrict, Address workerpoolrestrict, Address requesterrestrict, Bytes32 salt, DynamicBytes sign) { + super(dataset, datasetprice, volume, tag, apprestrict, workerpoolrestrict, requesterrestrict, salt, sign); + this.dataset = dataset.getValue(); + this.datasetprice = datasetprice.getValue(); + this.volume = volume.getValue(); + this.tag = tag.getValue(); + this.apprestrict = apprestrict.getValue(); + this.workerpoolrestrict = workerpoolrestrict.getValue(); + this.requesterrestrict = requesterrestrict.getValue(); + this.salt = salt.getValue(); + this.sign = sign.getValue(); + } + } + + public static class RequestOrder extends DynamicStruct { + public String app; + + public BigInteger appmaxprice; + + public String dataset; + + public BigInteger datasetmaxprice; + + public String workerpool; + + public BigInteger workerpoolmaxprice; + + public String requester; + + public BigInteger volume; + + public byte[] tag; + + public BigInteger category; + + public BigInteger trust; + + public String beneficiary; + + public String callback; + + public String params; + + public byte[] salt; + + public byte[] sign; + + public RequestOrder(String app, BigInteger appmaxprice, String dataset, BigInteger datasetmaxprice, String workerpool, BigInteger workerpoolmaxprice, String requester, BigInteger volume, byte[] tag, BigInteger category, BigInteger trust, String beneficiary, String callback, String params, byte[] salt, byte[] sign) { + super(new org.web3j.abi.datatypes.Address(app), + new org.web3j.abi.datatypes.generated.Uint256(appmaxprice), + new org.web3j.abi.datatypes.Address(dataset), + new org.web3j.abi.datatypes.generated.Uint256(datasetmaxprice), + new org.web3j.abi.datatypes.Address(workerpool), + new org.web3j.abi.datatypes.generated.Uint256(workerpoolmaxprice), + new org.web3j.abi.datatypes.Address(requester), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.generated.Uint256(category), + new org.web3j.abi.datatypes.generated.Uint256(trust), + new org.web3j.abi.datatypes.Address(beneficiary), + new org.web3j.abi.datatypes.Address(callback), + new org.web3j.abi.datatypes.Utf8String(params), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.app = app; + this.appmaxprice = appmaxprice; + this.dataset = dataset; + this.datasetmaxprice = datasetmaxprice; + this.workerpool = workerpool; + this.workerpoolmaxprice = workerpoolmaxprice; + this.requester = requester; + this.volume = volume; + this.tag = tag; + this.category = category; + this.trust = trust; + this.beneficiary = beneficiary; + this.callback = callback; + this.params = params; + this.salt = salt; + this.sign = sign; + } + + public RequestOrder(Address app, Uint256 appmaxprice, Address dataset, Uint256 datasetmaxprice, Address workerpool, Uint256 workerpoolmaxprice, Address requester, Uint256 volume, Bytes32 tag, Uint256 category, Uint256 trust, Address beneficiary, Address callback, Utf8String params, Bytes32 salt, DynamicBytes sign) { + super(app, appmaxprice, dataset, datasetmaxprice, workerpool, workerpoolmaxprice, requester, volume, tag, category, trust, beneficiary, callback, params, salt, sign); + this.app = app.getValue(); + this.appmaxprice = appmaxprice.getValue(); + this.dataset = dataset.getValue(); + this.datasetmaxprice = datasetmaxprice.getValue(); + this.workerpool = workerpool.getValue(); + this.workerpoolmaxprice = workerpoolmaxprice.getValue(); + this.requester = requester.getValue(); + this.volume = volume.getValue(); + this.tag = tag.getValue(); + this.category = category.getValue(); + this.trust = trust.getValue(); + this.beneficiary = beneficiary.getValue(); + this.callback = callback.getValue(); + this.params = params.getValue(); + this.salt = salt.getValue(); + this.sign = sign.getValue(); + } + } + + public static class WorkerpoolOrder extends DynamicStruct { + public String workerpool; + + public BigInteger workerpoolprice; + + public BigInteger volume; + + public byte[] tag; + + public BigInteger category; + + public BigInteger trust; + + public String apprestrict; + + public String datasetrestrict; + + public String requesterrestrict; + + public byte[] salt; + + public byte[] sign; + + public WorkerpoolOrder(String workerpool, BigInteger workerpoolprice, BigInteger volume, byte[] tag, BigInteger category, BigInteger trust, String apprestrict, String datasetrestrict, String requesterrestrict, byte[] salt, byte[] sign) { + super(new org.web3j.abi.datatypes.Address(workerpool), + new org.web3j.abi.datatypes.generated.Uint256(workerpoolprice), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.generated.Uint256(category), + new org.web3j.abi.datatypes.generated.Uint256(trust), + new org.web3j.abi.datatypes.Address(apprestrict), + new org.web3j.abi.datatypes.Address(datasetrestrict), + new org.web3j.abi.datatypes.Address(requesterrestrict), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.workerpool = workerpool; + this.workerpoolprice = workerpoolprice; + this.volume = volume; + this.tag = tag; + this.category = category; + this.trust = trust; + this.apprestrict = apprestrict; + this.datasetrestrict = datasetrestrict; + this.requesterrestrict = requesterrestrict; + this.salt = salt; + this.sign = sign; + } + + public WorkerpoolOrder(Address workerpool, Uint256 workerpoolprice, Uint256 volume, Bytes32 tag, Uint256 category, Uint256 trust, Address apprestrict, Address datasetrestrict, Address requesterrestrict, Bytes32 salt, DynamicBytes sign) { + super(workerpool, workerpoolprice, volume, tag, category, trust, apprestrict, datasetrestrict, requesterrestrict, salt, sign); + this.workerpool = workerpool.getValue(); + this.workerpoolprice = workerpoolprice.getValue(); + this.volume = volume.getValue(); + this.tag = tag.getValue(); + this.category = category.getValue(); + this.trust = trust.getValue(); + this.apprestrict = apprestrict.getValue(); + this.datasetrestrict = datasetrestrict.getValue(); + this.requesterrestrict = requesterrestrict.getValue(); + this.salt = salt.getValue(); + this.sign = sign.getValue(); + } + } + + public static class EIP712Domain extends DynamicStruct { + public String name; + + public String version; + + public BigInteger chainId; + + public String verifyingContract; + + public EIP712Domain(String name, String version, BigInteger chainId, String verifyingContract) { + super(new org.web3j.abi.datatypes.Utf8String(name), + new org.web3j.abi.datatypes.Utf8String(version), + new org.web3j.abi.datatypes.generated.Uint256(chainId), + new org.web3j.abi.datatypes.Address(verifyingContract)); + this.name = name; + this.version = version; + this.chainId = chainId; + this.verifyingContract = verifyingContract; + } + + public EIP712Domain(Utf8String name, Utf8String version, Uint256 chainId, Address verifyingContract) { + super(name, version, chainId, verifyingContract); + this.name = name.getValue(); + this.version = version.getValue(); + this.chainId = chainId.getValue(); + this.verifyingContract = verifyingContract.getValue(); + } + } + + public static class Account extends StaticStruct { + public BigInteger stake; + + public BigInteger locked; + + public Account(BigInteger stake, BigInteger locked) { + super(new org.web3j.abi.datatypes.generated.Uint256(stake), + new org.web3j.abi.datatypes.generated.Uint256(locked)); + this.stake = stake; + this.locked = locked; + } + + public Account(Uint256 stake, Uint256 locked) { + super(stake, locked); + this.stake = stake.getValue(); + this.locked = locked.getValue(); + } + } + + public static class Category extends DynamicStruct { + public String name; + + public String description; + + public BigInteger workClockTimeRef; + + public Category(String name, String description, BigInteger workClockTimeRef) { + super(new org.web3j.abi.datatypes.Utf8String(name), + new org.web3j.abi.datatypes.Utf8String(description), + new org.web3j.abi.datatypes.generated.Uint256(workClockTimeRef)); + this.name = name; + this.description = description; + this.workClockTimeRef = workClockTimeRef; + } + + public Category(Utf8String name, Utf8String description, Uint256 workClockTimeRef) { + super(name, description, workClockTimeRef); + this.name = name.getValue(); + this.description = description.getValue(); + this.workClockTimeRef = workClockTimeRef.getValue(); + } + } + + public static class Contribution extends StaticStruct { + public BigInteger status; + + public byte[] resultHash; + + public byte[] resultSeal; + + public String enclaveChallenge; + + public BigInteger weight; + + public Contribution(BigInteger status, byte[] resultHash, byte[] resultSeal, String enclaveChallenge, BigInteger weight) { + super(new org.web3j.abi.datatypes.generated.Uint8(status), + new org.web3j.abi.datatypes.generated.Bytes32(resultHash), + new org.web3j.abi.datatypes.generated.Bytes32(resultSeal), + new org.web3j.abi.datatypes.Address(enclaveChallenge), + new org.web3j.abi.datatypes.generated.Uint256(weight)); + this.status = status; + this.resultHash = resultHash; + this.resultSeal = resultSeal; + this.enclaveChallenge = enclaveChallenge; + this.weight = weight; + } + + public Contribution(Uint8 status, Bytes32 resultHash, Bytes32 resultSeal, Address enclaveChallenge, Uint256 weight) { + super(status, resultHash, resultSeal, enclaveChallenge, weight); + this.status = status.getValue(); + this.resultHash = resultHash.getValue(); + this.resultSeal = resultSeal.getValue(); + this.enclaveChallenge = enclaveChallenge.getValue(); + this.weight = weight.getValue(); + } + } + + public static class Resource extends StaticStruct { + public String pointer; + + public String owner; + + public BigInteger price; + + public Resource(String pointer, String owner, BigInteger price) { + super(new org.web3j.abi.datatypes.Address(pointer), + new org.web3j.abi.datatypes.Address(owner), + new org.web3j.abi.datatypes.generated.Uint256(price)); + this.pointer = pointer; + this.owner = owner; + this.price = price; + } + + public Resource(Address pointer, Address owner, Uint256 price) { + super(pointer, owner, price); + this.pointer = pointer.getValue(); + this.owner = owner.getValue(); + this.price = price.getValue(); + } + } + + public static class Task extends DynamicStruct { + public BigInteger status; + + public byte[] dealid; + + public BigInteger idx; + + public BigInteger timeref; + + public BigInteger contributionDeadline; + + public BigInteger revealDeadline; + + public BigInteger finalDeadline; + + public byte[] consensusValue; + + public BigInteger revealCounter; + + public BigInteger winnerCounter; + + public List contributors; + + public byte[] resultDigest; + + public byte[] results; + + public BigInteger resultsTimestamp; + + public byte[] resultsCallback; + + public Task(BigInteger status, byte[] dealid, BigInteger idx, BigInteger timeref, BigInteger contributionDeadline, BigInteger revealDeadline, BigInteger finalDeadline, byte[] consensusValue, BigInteger revealCounter, BigInteger winnerCounter, List contributors, byte[] resultDigest, byte[] results, BigInteger resultsTimestamp, byte[] resultsCallback) { + super(new org.web3j.abi.datatypes.generated.Uint8(status), + new org.web3j.abi.datatypes.generated.Bytes32(dealid), + new org.web3j.abi.datatypes.generated.Uint256(idx), + new org.web3j.abi.datatypes.generated.Uint256(timeref), + new org.web3j.abi.datatypes.generated.Uint256(contributionDeadline), + new org.web3j.abi.datatypes.generated.Uint256(revealDeadline), + new org.web3j.abi.datatypes.generated.Uint256(finalDeadline), + new org.web3j.abi.datatypes.generated.Bytes32(consensusValue), + new org.web3j.abi.datatypes.generated.Uint256(revealCounter), + new org.web3j.abi.datatypes.generated.Uint256(winnerCounter), + new org.web3j.abi.datatypes.DynamicArray( + org.web3j.abi.datatypes.Address.class, + org.web3j.abi.Utils.typeMap(contributors, org.web3j.abi.datatypes.Address.class)), + new org.web3j.abi.datatypes.generated.Bytes32(resultDigest), + new org.web3j.abi.datatypes.DynamicBytes(results), + new org.web3j.abi.datatypes.generated.Uint256(resultsTimestamp), + new org.web3j.abi.datatypes.DynamicBytes(resultsCallback)); + this.status = status; + this.dealid = dealid; + this.idx = idx; + this.timeref = timeref; + this.contributionDeadline = contributionDeadline; + this.revealDeadline = revealDeadline; + this.finalDeadline = finalDeadline; + this.consensusValue = consensusValue; + this.revealCounter = revealCounter; + this.winnerCounter = winnerCounter; + this.contributors = contributors; + this.resultDigest = resultDigest; + this.results = results; + this.resultsTimestamp = resultsTimestamp; + this.resultsCallback = resultsCallback; + } + + public Task(Uint8 status, Bytes32 dealid, Uint256 idx, Uint256 timeref, Uint256 contributionDeadline, Uint256 revealDeadline, Uint256 finalDeadline, Bytes32 consensusValue, Uint256 revealCounter, Uint256 winnerCounter, DynamicArray
contributors, Bytes32 resultDigest, DynamicBytes results, Uint256 resultsTimestamp, DynamicBytes resultsCallback) { + super(status, dealid, idx, timeref, contributionDeadline, revealDeadline, finalDeadline, consensusValue, revealCounter, winnerCounter, contributors, resultDigest, results, resultsTimestamp, resultsCallback); + this.status = status.getValue(); + this.dealid = dealid.getValue(); + this.idx = idx.getValue(); + this.timeref = timeref.getValue(); + this.contributionDeadline = contributionDeadline.getValue(); + this.revealDeadline = revealDeadline.getValue(); + this.finalDeadline = finalDeadline.getValue(); + this.consensusValue = consensusValue.getValue(); + this.revealCounter = revealCounter.getValue(); + this.winnerCounter = winnerCounter.getValue(); + this.contributors = contributors.getValue().stream().map(v -> v.getValue()).collect(Collectors.toList()); + this.resultDigest = resultDigest.getValue(); + this.results = results.getValue(); + this.resultsTimestamp = resultsTimestamp.getValue(); + this.resultsCallback = resultsCallback.getValue(); + } + } + + public static class AppOrderOperation extends DynamicStruct { + public AppOrder order; + + public BigInteger operation; + + public byte[] sign; + + public AppOrderOperation(AppOrder order, BigInteger operation, byte[] sign) { + super(order, + new org.web3j.abi.datatypes.generated.Uint8(operation), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.order = order; + this.operation = operation; + this.sign = sign; + } + + public AppOrderOperation(AppOrder order, Uint8 operation, DynamicBytes sign) { + super(order, operation, sign); + this.order = order; + this.operation = operation.getValue(); + this.sign = sign.getValue(); + } + } + + public static class DatasetOrderOperation extends DynamicStruct { + public DatasetOrder order; + + public BigInteger operation; + + public byte[] sign; + + public DatasetOrderOperation(DatasetOrder order, BigInteger operation, byte[] sign) { + super(order, + new org.web3j.abi.datatypes.generated.Uint8(operation), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.order = order; + this.operation = operation; + this.sign = sign; + } + + public DatasetOrderOperation(DatasetOrder order, Uint8 operation, DynamicBytes sign) { + super(order, operation, sign); + this.order = order; + this.operation = operation.getValue(); + this.sign = sign.getValue(); + } + } + + public static class RequestOrderOperation extends DynamicStruct { + public RequestOrder order; + + public BigInteger operation; + + public byte[] sign; + + public RequestOrderOperation(RequestOrder order, BigInteger operation, byte[] sign) { + super(order, + new org.web3j.abi.datatypes.generated.Uint8(operation), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.order = order; + this.operation = operation; + this.sign = sign; + } + + public RequestOrderOperation(RequestOrder order, Uint8 operation, DynamicBytes sign) { + super(order, operation, sign); + this.order = order; + this.operation = operation.getValue(); + this.sign = sign.getValue(); + } + } + + public static class WorkerpoolOrderOperation extends DynamicStruct { + public WorkerpoolOrder order; + + public BigInteger operation; + + public byte[] sign; + + public WorkerpoolOrderOperation(WorkerpoolOrder order, BigInteger operation, byte[] sign) { + super(order, + new org.web3j.abi.datatypes.generated.Uint8(operation), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.order = order; + this.operation = operation; + this.sign = sign; + } + + public WorkerpoolOrderOperation(WorkerpoolOrder order, Uint8 operation, DynamicBytes sign) { + super(order, operation, sign); + this.order = order; + this.operation = operation.getValue(); + this.sign = sign.getValue(); + } + } + + public static class Deal extends DynamicStruct { + public Resource app; + + public Resource dataset; + + public Resource workerpool; + + public BigInteger trust; + + public BigInteger category; + + public byte[] tag; + + public String requester; + + public String beneficiary; + + public String callback; + + public String params; + + public BigInteger startTime; + + public BigInteger botFirst; + + public BigInteger botSize; + + public BigInteger workerStake; + + public BigInteger schedulerRewardRatio; + + public Deal(Resource app, Resource dataset, Resource workerpool, BigInteger trust, BigInteger category, byte[] tag, String requester, String beneficiary, String callback, String params, BigInteger startTime, BigInteger botFirst, BigInteger botSize, BigInteger workerStake, BigInteger schedulerRewardRatio) { + super(app, + dataset, + workerpool, + new org.web3j.abi.datatypes.generated.Uint256(trust), + new org.web3j.abi.datatypes.generated.Uint256(category), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.Address(requester), + new org.web3j.abi.datatypes.Address(beneficiary), + new org.web3j.abi.datatypes.Address(callback), + new org.web3j.abi.datatypes.Utf8String(params), + new org.web3j.abi.datatypes.generated.Uint256(startTime), + new org.web3j.abi.datatypes.generated.Uint256(botFirst), + new org.web3j.abi.datatypes.generated.Uint256(botSize), + new org.web3j.abi.datatypes.generated.Uint256(workerStake), + new org.web3j.abi.datatypes.generated.Uint256(schedulerRewardRatio)); + this.app = app; + this.dataset = dataset; + this.workerpool = workerpool; + this.trust = trust; + this.category = category; + this.tag = tag; + this.requester = requester; + this.beneficiary = beneficiary; + this.callback = callback; + this.params = params; + this.startTime = startTime; + this.botFirst = botFirst; + this.botSize = botSize; + this.workerStake = workerStake; + this.schedulerRewardRatio = schedulerRewardRatio; + } + + public Deal(Resource app, Resource dataset, Resource workerpool, Uint256 trust, Uint256 category, Bytes32 tag, Address requester, Address beneficiary, Address callback, Utf8String params, Uint256 startTime, Uint256 botFirst, Uint256 botSize, Uint256 workerStake, Uint256 schedulerRewardRatio) { + super(app, dataset, workerpool, trust, category, tag, requester, beneficiary, callback, params, startTime, botFirst, botSize, workerStake, schedulerRewardRatio); + this.app = app; + this.dataset = dataset; + this.workerpool = workerpool; + this.trust = trust.getValue(); + this.category = category.getValue(); + this.tag = tag.getValue(); + this.requester = requester.getValue(); + this.beneficiary = beneficiary.getValue(); + this.callback = callback.getValue(); + this.params = params.getValue(); + this.startTime = startTime.getValue(); + this.botFirst = botFirst.getValue(); + this.botSize = botSize.getValue(); + this.workerStake = workerStake.getValue(); + this.schedulerRewardRatio = schedulerRewardRatio.getValue(); + } + } + public static class AccurateContributionEventResponse extends BaseEventResponse { public String worker; @@ -1959,6 +3081,22 @@ public static class ApprovalEventResponse extends BaseEventResponse { public BigInteger value; } + public static class BroadcastAppOrderEventResponse extends BaseEventResponse { + public AppOrder apporder; + } + + public static class BroadcastDatasetOrderEventResponse extends BaseEventResponse { + public DatasetOrder datasetorder; + } + + public static class BroadcastRequestOrderEventResponse extends BaseEventResponse { + public RequestOrder requestorder; + } + + public static class BroadcastWorkerpoolOrderEventResponse extends BaseEventResponse { + public WorkerpoolOrder workerpoolorder; + } + public static class ClosedAppOrderEventResponse extends BaseEventResponse { public byte[] appHash; } diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/IexecLibOrders_v5.java b/src/main/java/com/iexec/commons/poco/contract/generated/IexecLibOrders_v5.java index 3093feb..30785d5 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/IexecLibOrders_v5.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/IexecLibOrders_v5.java @@ -18,6 +18,7 @@ import java.math.BigInteger; import java.util.Arrays; +import java.util.HashMap; import org.web3j.abi.TypeReference; import org.web3j.abi.datatypes.Address; import org.web3j.abi.datatypes.DynamicBytes; @@ -29,6 +30,7 @@ import org.web3j.abi.datatypes.generated.Uint256; import org.web3j.crypto.Credentials; import org.web3j.protocol.Web3j; +import org.web3j.protocol.core.RemoteCall; import org.web3j.protocol.core.RemoteFunctionCall; import org.web3j.tx.Contract; import org.web3j.tx.TransactionManager; @@ -41,11 +43,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.7.0. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class IexecLibOrders_v5 extends Contract { - public static final String BINARY = "Bin file was not provided"; + public static final String BINARY = "0x610f58610026600b82828239805160001a60731461001957fe5b30600052607381538281f3fe73000000000000000000000000000000000000000030146080604052600436106101205760003560e01c8063735f5619116100ac5780639a6f72ee1161007b5780639a6f72ee146101fb578063b75cdd5314610203578063c49f91d31461020b578063c4b7bfc314610213578063fed985fe1461021b57610120565b8063735f5619146101ba57806374147c4d146101c25780637c0d54d3146101d55780638ac03f33146101e857610120565b806359b123db116100f357806359b123db1461017c5780635b559f6a1461018457806365db1dbb146101975780636cf30b8b1461019f5780636f84d2da146101b257610120565b806311b2eee214610125578063207dbbfe1461014e57806320aabe53146101565780634118eb9814610169575b600080fd5b610138610133366004610aa7565b61022e565b6040516101459190610d7b565b60405180910390f35b6101386102ac565b610138610164366004610b82565b6102d0565b610138610177366004610a6d565b610315565b610138610345565b610138610192366004610c54565b610369565b610138610399565b6101386101ad366004610a6d565b6103bd565b6101386103ed565b610138610411565b6101386101d0366004610ad9565b610435565b6101386101e3366004610aa7565b610491565b6101386101f6366004610c22565b6104f2565b6101386105c0565b6101386105e4565b610138610608565b61013861062c565b610138610229366004610cc6565b610650565b80516020808301516040808501516060860151608087015160a088015160c089015160e08a0151955160009961028f997f6cfc932a5a3d22c4359295b9f433edff52b60703fa47690a04a83e40933dd47c9991989197969594939201610dbf565b604051602081830303815290604052805190602001209050919050565b7f60815a0eeec47dddf1615fe53b31d016c31444e01b9d796db365443a6445d00881565b80516000907f0ded7b52c2d77595a40d242eca751df172b18e686326dbbed3f4748828af77c790610300906104f2565b60208085015160405161028f94939201610e96565b80516000907f075eb6f7578ff4292c241bd2484cd5c1d5e6ecc2ddd3317e1d8176b5a45865ec906103009061022e565b7f322d980b7d7a6a1f7c39ff0c5445da6ae1d8e0393ff0dd468c8be3e2c864438881565b80516000907f322d980b7d7a6a1f7c39ff0c5445da6ae1d8e0393ff0dd468c8be3e2c86443889061030090610650565b7faa3429fb281b34691803133d3d978a75bb77c617ed6bc9aa162b9b30920022bb81565b80516000907f0638bb0702457e2b4b01be8a202579b8bf97e587fb4f2cc4d4aad01f21a06ee09061030090610491565b7f6cfc932a5a3d22c4359295b9f433edff52b60703fa47690a04a83e40933dd47c81565b7f0ded7b52c2d77595a40d242eca751df172b18e686326dbbed3f4748828af77c781565b60007f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f60001b8260000151805190602001208360200151805190602001208460400151856060015160405160200161028f959493929190610e6a565b80516020808301516040808501516060860151608087015160a088015160c089015160e08a0151955160009961028f997f60815a0eeec47dddf1615fe53b31d016c31444e01b9d796db365443a6445d0089991989197969594939201610dbf565b80516020808301516040808501516060860151608087015160a08801519351600097610547977ff24e853034a3a450aba845a82914fbb564ad85accca6cf62be112a154520fae0979196919594939201610d84565b60408051601f198184030181529082905260c084015160e08501516101008601516101208701516101408801516101608901516101808a01516101a08b015180516020918201206101c08d0151999a6105a29a919201610d27565b60408051601f198184030181529082905261028f9291602001610cf8565b7ff24e853034a3a450aba845a82914fbb564ad85accca6cf62be112a154520fae081565b7f0638bb0702457e2b4b01be8a202579b8bf97e587fb4f2cc4d4aad01f21a06ee081565b7f8b73c3c69bb8fe3d512ecc4cf759cc79239f7b179b0ffacaa9a75d522b39400f81565b7f075eb6f7578ff4292c241bd2484cd5c1d5e6ecc2ddd3317e1d8176b5a45865ec81565b80516020808301516040808501516060860151608087015160a088015160c089015160e08a01516101008b01516101208c0151975160009b61028f9b7faa3429fb281b34691803133d3d978a75bb77c617ed6bc9aa162b9b30920022bb9b919a91999897969594939201610e0d565b80356001600160a01b03811681146106d657600080fd5b92915050565b600082601f8301126106ec578081fd5b81356001600160401b03811115610701578182fd5b610714601f8201601f1916602001610ebc565b915080825283602082850101111561072b57600080fd5b8060208401602084013760009082016020015292915050565b600060608284031215610755578081fd5b61075f6060610ebc565b905081356001600160401b038082111561077857600080fd5b610784858386016107c9565b83526020840135915061079682610f12565b81602084015260408401359150808211156107b057600080fd5b506107bd848285016106dc565b60408301525092915050565b60006101208083850312156107dc578182fd5b6107e581610ebc565b9150506107f283836106bf565b815260208201356020820152604082013560408201526060820135606082015261081f83608084016106bf565b60808201526108318360a084016106bf565b60a08201526108438360c084016106bf565b60c082015260e082013560e0820152610100808301356001600160401b0381111561086d57600080fd5b610879858286016106dc565b82840152505092915050565b6000610200808385031215610898578182fd5b6108a181610ebc565b9150506108ae83836106bf565b8152602082013560208201526108c783604084016106bf565b6040820152606082013560608201526108e383608084016106bf565b608082015260a082013560a08201526108ff8360c084016106bf565b60c082015260e0828101359082015261010080830135908201526101208083013590820152610140808301359082015261016061093e848285016106bf565b90820152610180610951848483016106bf565b908201526101a0828101356001600160401b038082111561097157600080fd5b61097d868387016106dc565b838501526101c0925082850135838501526101e09250828501359150808211156109a657600080fd5b50610879858286016106dc565b60006101608083850312156109c6578182fd5b6109cf81610ebc565b9150506109dc83836106bf565b81526020820135602082015260408201356040820152606082013560608201526080820135608082015260a082013560a0820152610a1d8360c084016106bf565b60c0820152610a2f8360e084016106bf565b60e0820152610100610a43848285016106bf565b908201526101208281013590820152610140808301356001600160401b0381111561086d57600080fd5b600060208284031215610a7e578081fd5b81356001600160401b03811115610a93578182fd5b610a9f84828501610744565b949350505050565b600060208284031215610ab8578081fd5b81356001600160401b03811115610acd578182fd5b610a9f848285016107c9565b600060208284031215610aea578081fd5b81356001600160401b0380821115610b00578283fd5b9083019060808286031215610b13578283fd5b610b1d6080610ebc565b823582811115610b2b578485fd5b610b37878286016106dc565b825250602083013582811115610b4b578485fd5b610b57878286016106dc565b60208301525060408301356040820152610b7486606085016106bf565b606082015295945050505050565b600060208284031215610b93578081fd5b81356001600160401b0380821115610ba9578283fd5b9083019060608286031215610bbc578283fd5b610bc66060610ebc565b823582811115610bd4578485fd5b610be087828601610885565b8252506020830135610bf181610f12565b6020820152604083013582811115610c07578485fd5b610c13878286016106dc565b60408301525095945050505050565b600060208284031215610c33578081fd5b81356001600160401b03811115610c48578182fd5b610a9f84828501610885565b600060208284031215610c65578081fd5b81356001600160401b0380821115610c7b578283fd5b9083019060608286031215610c8e578283fd5b610c986060610ebc565b823582811115610ca6578485fd5b610cb2878286016109b3565b825250602083013560028110610bf1578485fd5b600060208284031215610cd7578081fd5b81356001600160401b03811115610cec578182fd5b610a9f848285016109b3565b60008351610d0a818460208801610ee2565b835190830190610d1e818360208801610ee2565b01949350505050565b6001600160a01b03998a1681526020810198909852604088019690965260608701949094526080860192909252851660a085015290931660c083015260e08201929092526101008101919091526101200190565b90815260200190565b9687526001600160a01b03958616602088015260408701949094529184166060860152608085015290911660a083015260c082015260e00190565b9889526001600160a01b0397881660208a0152604089019690965260608801949094526080870192909252841660a0860152831660c085015290911660e08301526101008201526101200190565b9a8b526001600160a01b03998a1660208c015260408b019890985260608a0196909652608089019490945260a088019290925260c0870152841660e086015283166101008501529091166101208301526101408201526101600190565b9485526020850193909352604084019190915260608301526001600160a01b0316608082015260a00190565b838152602081018390526060810160028310610eae57fe5b826040830152949350505050565b6040518181016001600160401b0381118282101715610eda57600080fd5b604052919050565b60005b83811015610efd578181015183820152602001610ee5565b83811115610f0c576000848401525b50505050565b60028110610f1f57600080fd5b5056fea2646970667358221220f931fee53ab4964c6e3c949568cd82906592a6e72926f189f5741e9b2aeda34564736f6c634300060c0033"; public static final String FUNC_APPORDEROPERATION_TYPEHASH = "APPORDEROPERATION_TYPEHASH"; @@ -67,6 +69,12 @@ public class IexecLibOrders_v5 extends Contract { public static final String FUNC_hash = "hash"; + protected static final HashMap _addresses; + + static { + _addresses = new HashMap(); + } + @Deprecated protected IexecLibOrders_v5(String contractAddress, Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit); @@ -155,6 +163,13 @@ public RemoteFunctionCall hash(DatasetOrder _datasetorder) { return executeRemoteCallSingleValueReturn(function, byte[].class); } + public RemoteFunctionCall hash(RequestOrderOperation _requestorderoperation) { + final Function function = new Function(FUNC_hash, + Arrays.asList(_requestorderoperation), + Arrays.>asList(new TypeReference() {})); + return executeRemoteCallSingleValueReturn(function, byte[].class); + } + public RemoteFunctionCall hash(DatasetOrderOperation _datasetorderoperation) { final Function function = new Function(FUNC_hash, Arrays.asList(_datasetorderoperation), @@ -222,8 +237,33 @@ public static IexecLibOrders_v5 load(String contractAddress, Web3j web3j, Transa return new IexecLibOrders_v5(contractAddress, web3j, transactionManager, contractGasProvider); } - public static class DatasetOrder extends DynamicStruct { + public static RemoteCall deploy(Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) { + return deployRemoteCall(IexecLibOrders_v5.class, web3j, credentials, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(IexecLibOrders_v5.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); + } + + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(IexecLibOrders_v5.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + + @Deprecated + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { + return deployRemoteCall(IexecLibOrders_v5.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); + } + + protected String getStaticDeployedAddress(String networkId) { + return _addresses.get(networkId); + } + public static String getPreviouslyDeployedAddress(String networkId) { + return _addresses.get(networkId); + } + + public static class DatasetOrder extends DynamicStruct { public String dataset; public BigInteger datasetprice; @@ -243,7 +283,15 @@ public static class DatasetOrder extends DynamicStruct { public byte[] sign; public DatasetOrder(String dataset, BigInteger datasetprice, BigInteger volume, byte[] tag, String apprestrict, String workerpoolrestrict, String requesterrestrict, byte[] salt, byte[] sign) { - super(new org.web3j.abi.datatypes.Address(dataset),new org.web3j.abi.datatypes.generated.Uint256(datasetprice),new org.web3j.abi.datatypes.generated.Uint256(volume),new org.web3j.abi.datatypes.generated.Bytes32(tag),new org.web3j.abi.datatypes.Address(apprestrict),new org.web3j.abi.datatypes.Address(workerpoolrestrict),new org.web3j.abi.datatypes.Address(requesterrestrict),new org.web3j.abi.datatypes.generated.Bytes32(salt),new org.web3j.abi.datatypes.DynamicBytes(sign)); + super(new org.web3j.abi.datatypes.Address(dataset), + new org.web3j.abi.datatypes.generated.Uint256(datasetprice), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.Address(apprestrict), + new org.web3j.abi.datatypes.Address(workerpoolrestrict), + new org.web3j.abi.datatypes.Address(requesterrestrict), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); this.dataset = dataset; this.datasetprice = datasetprice; this.volume = volume; @@ -256,7 +304,7 @@ public DatasetOrder(String dataset, BigInteger datasetprice, BigInteger volume, } public DatasetOrder(Address dataset, Uint256 datasetprice, Uint256 volume, Bytes32 tag, Address apprestrict, Address workerpoolrestrict, Address requesterrestrict, Bytes32 salt, DynamicBytes sign) { - super(dataset,datasetprice,volume,tag,apprestrict,workerpoolrestrict,requesterrestrict,salt,sign); + super(dataset, datasetprice, volume, tag, apprestrict, workerpoolrestrict, requesterrestrict, salt, sign); this.dataset = dataset.getValue(); this.datasetprice = datasetprice.getValue(); this.volume = volume.getValue(); @@ -269,6 +317,95 @@ public DatasetOrder(Address dataset, Uint256 datasetprice, Uint256 volume, Bytes } } + public static class RequestOrder extends DynamicStruct { + public String app; + + public BigInteger appmaxprice; + + public String dataset; + + public BigInteger datasetmaxprice; + + public String workerpool; + + public BigInteger workerpoolmaxprice; + + public String requester; + + public BigInteger volume; + + public byte[] tag; + + public BigInteger category; + + public BigInteger trust; + + public String beneficiary; + + public String callback; + + public String params; + + public byte[] salt; + + public byte[] sign; + + public RequestOrder(String app, BigInteger appmaxprice, String dataset, BigInteger datasetmaxprice, String workerpool, BigInteger workerpoolmaxprice, String requester, BigInteger volume, byte[] tag, BigInteger category, BigInteger trust, String beneficiary, String callback, String params, byte[] salt, byte[] sign) { + super(new org.web3j.abi.datatypes.Address(app), + new org.web3j.abi.datatypes.generated.Uint256(appmaxprice), + new org.web3j.abi.datatypes.Address(dataset), + new org.web3j.abi.datatypes.generated.Uint256(datasetmaxprice), + new org.web3j.abi.datatypes.Address(workerpool), + new org.web3j.abi.datatypes.generated.Uint256(workerpoolmaxprice), + new org.web3j.abi.datatypes.Address(requester), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.generated.Uint256(category), + new org.web3j.abi.datatypes.generated.Uint256(trust), + new org.web3j.abi.datatypes.Address(beneficiary), + new org.web3j.abi.datatypes.Address(callback), + new org.web3j.abi.datatypes.Utf8String(params), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.app = app; + this.appmaxprice = appmaxprice; + this.dataset = dataset; + this.datasetmaxprice = datasetmaxprice; + this.workerpool = workerpool; + this.workerpoolmaxprice = workerpoolmaxprice; + this.requester = requester; + this.volume = volume; + this.tag = tag; + this.category = category; + this.trust = trust; + this.beneficiary = beneficiary; + this.callback = callback; + this.params = params; + this.salt = salt; + this.sign = sign; + } + + public RequestOrder(Address app, Uint256 appmaxprice, Address dataset, Uint256 datasetmaxprice, Address workerpool, Uint256 workerpoolmaxprice, Address requester, Uint256 volume, Bytes32 tag, Uint256 category, Uint256 trust, Address beneficiary, Address callback, Utf8String params, Bytes32 salt, DynamicBytes sign) { + super(app, appmaxprice, dataset, datasetmaxprice, workerpool, workerpoolmaxprice, requester, volume, tag, category, trust, beneficiary, callback, params, salt, sign); + this.app = app.getValue(); + this.appmaxprice = appmaxprice.getValue(); + this.dataset = dataset.getValue(); + this.datasetmaxprice = datasetmaxprice.getValue(); + this.workerpool = workerpool.getValue(); + this.workerpoolmaxprice = workerpoolmaxprice.getValue(); + this.requester = requester.getValue(); + this.volume = volume.getValue(); + this.tag = tag.getValue(); + this.category = category.getValue(); + this.trust = trust.getValue(); + this.beneficiary = beneficiary.getValue(); + this.callback = callback.getValue(); + this.params = params.getValue(); + this.salt = salt.getValue(); + this.sign = sign.getValue(); + } + } + public static class WorkerpoolOrder extends DynamicStruct { public String workerpool; @@ -293,7 +430,17 @@ public static class WorkerpoolOrder extends DynamicStruct { public byte[] sign; public WorkerpoolOrder(String workerpool, BigInteger workerpoolprice, BigInteger volume, byte[] tag, BigInteger category, BigInteger trust, String apprestrict, String datasetrestrict, String requesterrestrict, byte[] salt, byte[] sign) { - super(new org.web3j.abi.datatypes.Address(workerpool),new org.web3j.abi.datatypes.generated.Uint256(workerpoolprice),new org.web3j.abi.datatypes.generated.Uint256(volume),new org.web3j.abi.datatypes.generated.Bytes32(tag),new org.web3j.abi.datatypes.generated.Uint256(category),new org.web3j.abi.datatypes.generated.Uint256(trust),new org.web3j.abi.datatypes.Address(apprestrict),new org.web3j.abi.datatypes.Address(datasetrestrict),new org.web3j.abi.datatypes.Address(requesterrestrict),new org.web3j.abi.datatypes.generated.Bytes32(salt),new org.web3j.abi.datatypes.DynamicBytes(sign)); + super(new org.web3j.abi.datatypes.Address(workerpool), + new org.web3j.abi.datatypes.generated.Uint256(workerpoolprice), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.generated.Uint256(category), + new org.web3j.abi.datatypes.generated.Uint256(trust), + new org.web3j.abi.datatypes.Address(apprestrict), + new org.web3j.abi.datatypes.Address(datasetrestrict), + new org.web3j.abi.datatypes.Address(requesterrestrict), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); this.workerpool = workerpool; this.workerpoolprice = workerpoolprice; this.volume = volume; @@ -308,7 +455,7 @@ public WorkerpoolOrder(String workerpool, BigInteger workerpoolprice, BigInteger } public WorkerpoolOrder(Address workerpool, Uint256 workerpoolprice, Uint256 volume, Bytes32 tag, Uint256 category, Uint256 trust, Address apprestrict, Address datasetrestrict, Address requesterrestrict, Bytes32 salt, DynamicBytes sign) { - super(workerpool,workerpoolprice,volume,tag,category,trust,apprestrict,datasetrestrict,requesterrestrict,salt,sign); + super(workerpool, workerpoolprice, volume, tag, category, trust, apprestrict, datasetrestrict, requesterrestrict, salt, sign); this.workerpool = workerpool.getValue(); this.workerpoolprice = workerpoolprice.getValue(); this.volume = volume.getValue(); @@ -343,7 +490,15 @@ public static class AppOrder extends DynamicStruct { public byte[] sign; public AppOrder(String app, BigInteger appprice, BigInteger volume, byte[] tag, String datasetrestrict, String workerpoolrestrict, String requesterrestrict, byte[] salt, byte[] sign) { - super(new org.web3j.abi.datatypes.Address(app),new org.web3j.abi.datatypes.generated.Uint256(appprice),new org.web3j.abi.datatypes.generated.Uint256(volume),new org.web3j.abi.datatypes.generated.Bytes32(tag),new org.web3j.abi.datatypes.Address(datasetrestrict),new org.web3j.abi.datatypes.Address(workerpoolrestrict),new org.web3j.abi.datatypes.Address(requesterrestrict),new org.web3j.abi.datatypes.generated.Bytes32(salt),new org.web3j.abi.datatypes.DynamicBytes(sign)); + super(new org.web3j.abi.datatypes.Address(app), + new org.web3j.abi.datatypes.generated.Uint256(appprice), + new org.web3j.abi.datatypes.generated.Uint256(volume), + new org.web3j.abi.datatypes.generated.Bytes32(tag), + new org.web3j.abi.datatypes.Address(datasetrestrict), + new org.web3j.abi.datatypes.Address(workerpoolrestrict), + new org.web3j.abi.datatypes.Address(requesterrestrict), + new org.web3j.abi.datatypes.generated.Bytes32(salt), + new org.web3j.abi.datatypes.DynamicBytes(sign)); this.app = app; this.appprice = appprice; this.volume = volume; @@ -356,7 +511,7 @@ public AppOrder(String app, BigInteger appprice, BigInteger volume, byte[] tag, } public AppOrder(Address app, Uint256 appprice, Uint256 volume, Bytes32 tag, Address datasetrestrict, Address workerpoolrestrict, Address requesterrestrict, Bytes32 salt, DynamicBytes sign) { - super(app,appprice,volume,tag,datasetrestrict,workerpoolrestrict,requesterrestrict,salt,sign); + super(app, appprice, volume, tag, datasetrestrict, workerpoolrestrict, requesterrestrict, salt, sign); this.app = app.getValue(); this.appprice = appprice.getValue(); this.volume = volume.getValue(); @@ -379,7 +534,10 @@ public static class EIP712Domain extends DynamicStruct { public String verifyingContract; public EIP712Domain(String name, String version, BigInteger chainId, String verifyingContract) { - super(new org.web3j.abi.datatypes.Utf8String(name),new org.web3j.abi.datatypes.Utf8String(version),new org.web3j.abi.datatypes.generated.Uint256(chainId),new org.web3j.abi.datatypes.Address(verifyingContract)); + super(new org.web3j.abi.datatypes.Utf8String(name), + new org.web3j.abi.datatypes.Utf8String(version), + new org.web3j.abi.datatypes.generated.Uint256(chainId), + new org.web3j.abi.datatypes.Address(verifyingContract)); this.name = name; this.version = version; this.chainId = chainId; @@ -387,7 +545,7 @@ public EIP712Domain(String name, String version, BigInteger chainId, String veri } public EIP712Domain(Utf8String name, Utf8String version, Uint256 chainId, Address verifyingContract) { - super(name,version,chainId,verifyingContract); + super(name, version, chainId, verifyingContract); this.name = name.getValue(); this.version = version.getValue(); this.chainId = chainId.getValue(); @@ -395,76 +553,21 @@ public EIP712Domain(Utf8String name, Utf8String version, Uint256 chainId, Addres } } - public static class RequestOrder extends DynamicStruct { - public String app; - - public BigInteger appmaxprice; - - public String dataset; - - public BigInteger datasetmaxprice; - - public String workerpool; - - public BigInteger workerpoolmaxprice; - - public String requester; - - public BigInteger volume; - - public byte[] tag; - - public BigInteger category; - - public BigInteger trust; - - public String beneficiary; - - public String callback; - - public String params; - - public byte[] salt; + public static class RequestOrderOperation extends DynamicStruct { + public RequestOrder order; public byte[] sign; - public RequestOrder(String app, BigInteger appmaxprice, String dataset, BigInteger datasetmaxprice, String workerpool, BigInteger workerpoolmaxprice, String requester, BigInteger volume, byte[] tag, BigInteger category, BigInteger trust, String beneficiary, String callback, String params, byte[] salt, byte[] sign) { - super(new org.web3j.abi.datatypes.Address(app),new org.web3j.abi.datatypes.generated.Uint256(appmaxprice),new org.web3j.abi.datatypes.Address(dataset),new org.web3j.abi.datatypes.generated.Uint256(datasetmaxprice),new org.web3j.abi.datatypes.Address(workerpool),new org.web3j.abi.datatypes.generated.Uint256(workerpoolmaxprice),new org.web3j.abi.datatypes.Address(requester),new org.web3j.abi.datatypes.generated.Uint256(volume),new org.web3j.abi.datatypes.generated.Bytes32(tag),new org.web3j.abi.datatypes.generated.Uint256(category),new org.web3j.abi.datatypes.generated.Uint256(trust),new org.web3j.abi.datatypes.Address(beneficiary),new org.web3j.abi.datatypes.Address(callback),new org.web3j.abi.datatypes.Utf8String(params),new org.web3j.abi.datatypes.generated.Bytes32(salt),new org.web3j.abi.datatypes.DynamicBytes(sign)); - this.app = app; - this.appmaxprice = appmaxprice; - this.dataset = dataset; - this.datasetmaxprice = datasetmaxprice; - this.workerpool = workerpool; - this.workerpoolmaxprice = workerpoolmaxprice; - this.requester = requester; - this.volume = volume; - this.tag = tag; - this.category = category; - this.trust = trust; - this.beneficiary = beneficiary; - this.callback = callback; - this.params = params; - this.salt = salt; + public RequestOrderOperation(RequestOrder order, byte[] sign) { + super(order, + new org.web3j.abi.datatypes.DynamicBytes(sign)); + this.order = order; this.sign = sign; } - public RequestOrder(Address app, Uint256 appmaxprice, Address dataset, Uint256 datasetmaxprice, Address workerpool, Uint256 workerpoolmaxprice, Address requester, Uint256 volume, Bytes32 tag, Uint256 category, Uint256 trust, Address beneficiary, Address callback, Utf8String params, Bytes32 salt, DynamicBytes sign) { - super(app,appmaxprice,dataset,datasetmaxprice,workerpool,workerpoolmaxprice,requester,volume,tag,category,trust,beneficiary,callback,params,salt,sign); - this.app = app.getValue(); - this.appmaxprice = appmaxprice.getValue(); - this.dataset = dataset.getValue(); - this.datasetmaxprice = datasetmaxprice.getValue(); - this.workerpool = workerpool.getValue(); - this.workerpoolmaxprice = workerpoolmaxprice.getValue(); - this.requester = requester.getValue(); - this.volume = volume.getValue(); - this.tag = tag.getValue(); - this.category = category.getValue(); - this.trust = trust.getValue(); - this.beneficiary = beneficiary.getValue(); - this.callback = callback.getValue(); - this.params = params.getValue(); - this.salt = salt.getValue(); + public RequestOrderOperation(RequestOrder order, DynamicBytes sign) { + super(order, sign); + this.order = order; this.sign = sign.getValue(); } } @@ -475,13 +578,14 @@ public static class DatasetOrderOperation extends DynamicStruct { public byte[] sign; public DatasetOrderOperation(DatasetOrder order, byte[] sign) { - super(order,new org.web3j.abi.datatypes.DynamicBytes(sign)); + super(order, + new org.web3j.abi.datatypes.DynamicBytes(sign)); this.order = order; this.sign = sign; } public DatasetOrderOperation(DatasetOrder order, DynamicBytes sign) { - super(order,sign); + super(order, sign); this.order = order; this.sign = sign.getValue(); } @@ -493,13 +597,14 @@ public static class WorkerpoolOrderOperation extends DynamicStruct { public byte[] sign; public WorkerpoolOrderOperation(WorkerpoolOrder order, byte[] sign) { - super(order,new org.web3j.abi.datatypes.DynamicBytes(sign)); + super(order, + new org.web3j.abi.datatypes.DynamicBytes(sign)); this.order = order; this.sign = sign; } public WorkerpoolOrderOperation(WorkerpoolOrder order, DynamicBytes sign) { - super(order,sign); + super(order, sign); this.order = order; this.sign = sign.getValue(); } @@ -511,13 +616,14 @@ public static class AppOrderOperation extends DynamicStruct { public byte[] sign; public AppOrderOperation(AppOrder order, byte[] sign) { - super(order,new org.web3j.abi.datatypes.DynamicBytes(sign)); + super(order, + new org.web3j.abi.datatypes.DynamicBytes(sign)); this.order = order; this.sign = sign; } public AppOrderOperation(AppOrder order, DynamicBytes sign) { - super(order,sign); + super(order, sign); this.order = order; this.sign = sign.getValue(); } diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/Ownable.java b/src/main/java/com/iexec/commons/poco/contract/generated/Ownable.java index 62f807c..1816e7e 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/Ownable.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/Ownable.java @@ -49,7 +49,7 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class Ownable extends Contract { @@ -89,8 +89,8 @@ protected Ownable(String contractAddress, Web3j web3j, TransactionManager transa super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } - public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); + public static List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); @@ -167,15 +167,15 @@ public static RemoteCall deploy(Web3j web3j, Credentials credentials, C return deployRemoteCall(Ownable.class, web3j, credentials, contractGasProvider, BINARY, ""); } - public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { - return deployRemoteCall(Ownable.class, web3j, transactionManager, contractGasProvider, BINARY, ""); - } - @Deprecated public static RemoteCall deploy(Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall(Ownable.class, web3j, credentials, gasPrice, gasLimit, BINARY, ""); } + public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) { + return deployRemoteCall(Ownable.class, web3j, transactionManager, contractGasProvider, BINARY, ""); + } + @Deprecated public static RemoteCall deploy(Web3j web3j, TransactionManager transactionManager, BigInteger gasPrice, BigInteger gasLimit) { return deployRemoteCall(Ownable.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, ""); diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/Workerpool.java b/src/main/java/com/iexec/commons/poco/contract/generated/Workerpool.java index 8ee856e..be64ea6 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/Workerpool.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/Workerpool.java @@ -51,11 +51,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class Workerpool extends Contract { - public static final String BINARY = "0x608060405234801561001057600080fd5b50610809806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146101ca578063b55e75af146101d2578063f199413c146101da578063f62d1888146101fd57610088565b80633121db1c1461008d578063584feb3a1461010f5780637b1039991461018c57806387639c68146101b0575b600080fd5b61010d600480360360408110156100a357600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ce57600080fd5b8201836020820111156100e057600080fd5b8035906020019184600183028401116401000000008311171561010257600080fd5b5090925090506102a3565b005b610117610346565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610151578181015183820152602001610139565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101946103d3565b604080516001600160a01b039092168252519081900360200190f35b6101b86103e2565b60408051918252519081900360200190f35b6101946103e8565b6101b8610466565b61010d600480360360408110156101f057600080fd5b508035906020013561046c565b61010d6004803603602081101561021357600080fd5b81019060208101813564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610530945050505050565b336102ac6103e8565b6001600160a01b031614610301576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b6103418383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055a92505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103cb5780601f106103a0576101008083540402835291602001916103cb565b820191906000526020600020905b8154815290600101906020018083116103ae57829003601f168201915b505050505081565b6000546001600160a01b031681565b60035481565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b505190505b90565b60025481565b336104756103e8565b6001600160a01b0316146104ca576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b60648111156104d857600080fd5b60025460035460408051928352602083018590528281019190915260608201839052517f61f37ef3a6d587ce2d6be79492e1fac570f2745787015db7ed95ad4397b05c1e9181900360800190a1600291909155600355565b610539336106c5565b805161054c90600190602084019061073b565b5050601e6002556001600355565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105c057600080fd5b505afa1580156105d4573d6000803e3d6000fd5b505050506040513d60208110156105ea57600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610649578181015183820152602001610631565b50505050905090810190601f1680156106765780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069557600080fd5b505af11580156106a9573d6000803e3d6000fd5b505050506040513d60208110156106bf57600080fd5b50505050565b6000546001600160a01b031615610719576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077c57805160ff19168380011785556107a9565b828001600101855582156107a9579182015b828111156107a957825182559160200191906001019061078e565b506107b59291506107b9565b5090565b61046391905b808211156107b557600081556001016107bf56fea264697066735822122018fc57db17dda04ce8d113e03376f297c311647dfae2b7176bb7f7e53af0983164736f6c63430006060033"; + public static final String BINARY = "0x608060405234801561001057600080fd5b50610803806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146101ca578063b55e75af146101d2578063f199413c146101da578063f62d1888146101fd57610088565b80633121db1c1461008d578063584feb3a1461010f5780637b1039991461018c57806387639c68146101b0575b600080fd5b61010d600480360360408110156100a357600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ce57600080fd5b8201836020820111156100e057600080fd5b8035906020019184600183028401116401000000008311171561010257600080fd5b5090925090506102a3565b005b610117610346565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610151578181015183820152602001610139565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101946103d3565b604080516001600160a01b039092168252519081900360200190f35b6101b86103e2565b60408051918252519081900360200190f35b6101946103e8565b6101b8610465565b61010d600480360360408110156101f057600080fd5b508035906020013561046b565b61010d6004803603602081101561021357600080fd5b81019060208101813564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061052f945050505050565b336102ac6103e8565b6001600160a01b031614610301576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b6103418383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055992505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103cb5780601f106103a0576101008083540402835291602001916103cb565b820191906000526020600020905b8154815290600101906020018083116103ae57829003601f168201915b505050505081565b6000546001600160a01b031681565b60035481565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b5051905090565b60025481565b336104746103e8565b6001600160a01b0316146104c9576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b60648111156104d757600080fd5b60025460035460408051928352602083018590528281019190915260608201839052517f61f37ef3a6d587ce2d6be79492e1fac570f2745787015db7ed95ad4397b05c1e9181900360800190a1600291909155600355565b610538336106c4565b805161054b90600190602084019061073a565b5050601e6002556001600355565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105bf57600080fd5b505afa1580156105d3573d6000803e3d6000fd5b505050506040513d60208110156105e957600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069457600080fd5b505af11580156106a8573d6000803e3d6000fd5b505050506040513d60208110156106be57600080fd5b50505050565b6000546001600160a01b031615610718576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077b57805160ff19168380011785556107a8565b828001600101855582156107a8579182015b828111156107a857825182559160200191906001019061078d565b506107b49291506107b8565b5090565b5b808211156107b457600081556001016107b956fea2646970667358221220d2b34187ab09e98b89d77588c079af93b8b4d5b067ee463dcbc2f15a416a33e864736f6c634300060c0033"; public static final String FUNC_M_SCHEDULERREWARDRATIOPOLICY = "m_schedulerRewardRatioPolicy"; @@ -101,8 +101,8 @@ protected Workerpool(String contractAddress, Web3j web3j, TransactionManager tra super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } - public List getPolicyUpdateEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(POLICYUPDATE_EVENT, transactionReceipt); + public static List getPolicyUpdateEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(POLICYUPDATE_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { PolicyUpdateEventResponse typedResponse = new PolicyUpdateEventResponse(); diff --git a/src/main/java/com/iexec/commons/poco/contract/generated/WorkerpoolRegistry.java b/src/main/java/com/iexec/commons/poco/contract/generated/WorkerpoolRegistry.java index ad652c5..846acd4 100644 --- a/src/main/java/com/iexec/commons/poco/contract/generated/WorkerpoolRegistry.java +++ b/src/main/java/com/iexec/commons/poco/contract/generated/WorkerpoolRegistry.java @@ -54,11 +54,11 @@ * or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the * codegen module to update. * - *

Generated with web3j version 4.5.16. + *

Generated with web3j version 1.4.2. */ @SuppressWarnings("rawtypes") public class WorkerpoolRegistry extends Contract { - public static final String BINARY = "0x60806040523480156200001157600080fd5b506040516200002090620002f7565b604051809103906000f0801580156200003d573d6000803e3d6000fd5b50604080518082018252601e81527f694578656320576f726b6572706f6f6c20526567697374727920285635290000602080830191909152825180840190935260118352706945786563576f726b6572706f6f6c563560781b90830152908181620000b86301ffc9a760e01b6001600160e01b036200026d16565b8151620000cd90600690602085019062000305565b508051620000e390600790602084019062000305565b50620000ff6380ac58cd60e01b6001600160e01b036200026d16565b6200011a635b5e139f60e01b6001600160e01b036200026d16565b6200013563780e9d6360e01b6001600160e01b036200026d16565b50600090506200014d6001600160e01b03620002f216565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600b80546001600160a01b0319166001600160a01b038516179055604051620001c7602082016200038a565b601f1982820381018352601f909101166040528051620001f191600c916020919091019062000305565b50600c6040518082805460018160011615610100020316600290048015620002535780601f106200023057610100808354040283529182019162000253565b820191906000526020600020905b8154815290600101906020018083116200023e575b5050604051908190039020600d5550620003b59350505050565b6001600160e01b03198082161415620002cd576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b335b90565b6108298062002e9783390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200034857805160ff191683800117855562000378565b8280016001018555821562000378579182015b82811115620003785782518255916020019190600101906200035b565b506200038692915062000398565b5090565b6103cd80620036c083390190565b620002f491905b808211156200038657600081556001016200039f565b612ad280620003c56000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80636fa59bbc1161010f578063c3c5a547116100a2578063e985e9c511610071578063e985e9c514610796578063ee97f7f3146107c4578063eee39111146107cc578063f2fde38b146107d4576101e5565b8063c3c5a547146106af578063c4d66de8146106d5578063c87b56dd146106fb578063e40238f414610718576101e5565b80638da5cb5b116100de5780638da5cb5b146105ad57806395d89b41146105b5578063a22cb465146105bd578063b88d4fde146105eb576101e5565b80636fa59bbc1461056f57806370a0823114610577578063715018a61461059d5780637c2b2e71146105a5576101e5565b806323b872dd116101875780634f6ccce7116101565780634f6ccce7146104bf57806355f804b3146104dc5780636352211e1461054a5780636c0360eb14610567576101e5565b806323b872dd146103a95780632f745c59146103df5780633121db1c1461040b57806342842e0e14610489576101e5565b8063081812fc116101c3578063081812fc1461033c578063095ea7b314610359578063158ef93e1461038757806318160ddd1461038f576101e5565b806301ffc9a7146101ea578063064a6c2a1461022557806306fdde03146102bf575b600080fd5b6102116004803603602081101561020057600080fd5b50356001600160e01b0319166107fa565b604080519115158252519081900360200190f35b6102a36004803603604081101561023b57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561026557600080fd5b82018360208201111561027757600080fd5b803590602001918460018302840111600160201b8311171561029857600080fd5b50909250905061081d565b604080516001600160a01b039092168252519081900360200190f35b6102c7610871565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103015781810151838201526020016102e9565b50505050905090810190601f16801561032e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102a36004803603602081101561035257600080fd5b5035610908565b6103856004803603604081101561036f57600080fd5b506001600160a01b03813516906020013561096a565b005b610211610a45565b610397610a55565b60408051918252519081900360200190f35b610385600480360360608110156103bf57600080fd5b506001600160a01b03813581169160208101359091169060400135610a66565b610397600480360360408110156103f557600080fd5b506001600160a01b038135169060200135610abd565b6103856004803603604081101561042157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561044b57600080fd5b82018360208201111561045d57600080fd5b803590602001918460018302840111600160201b8311171561047e57600080fd5b509092509050610aee565b6103856004803603606081101561049f57600080fd5b506001600160a01b03813581169160208101359091169060400135610b86565b610397600480360360208110156104d557600080fd5b5035610ba1565b610385600480360360208110156104f257600080fd5b810190602081018135600160201b81111561050c57600080fd5b82018360208201111561051e57600080fd5b803590602001918460018302840111600160201b8311171561053f57600080fd5b509092509050610bbd565b6102a36004803603602081101561056057600080fd5b5035610c58565b6102c7610c86565b6102c7610ce7565b6103976004803603602081101561058d57600080fd5b50356001600160a01b0316610d75565b610385610ddd565b6102a3610e7f565b6102a3610e8e565b6102c7610e9d565b610385600480360360408110156105d357600080fd5b506001600160a01b0381351690602001351515610efe565b6103856004803603608081101561060157600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561063b57600080fd5b82018360208201111561064d57600080fd5b803590602001918460018302840111600160201b8311171561066e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550611003945050505050565b610211600480360360208110156106c557600080fd5b50356001600160a01b0316611061565b610385600480360360208110156106eb57600080fd5b50356001600160a01b031661110f565b6102c76004803603602081101561071157600080fd5b50356111af565b6102a36004803603604081101561072e57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561075857600080fd5b82018360208201111561076a57600080fd5b803590602001918460018302840111600160201b8311171561078b57600080fd5b509092509050611456565b610211600480360360408110156107ac57600080fd5b506001600160a01b03813581169160200135166114a0565b6102a36114ce565b6103976114dd565b610385600480360360208110156107ea57600080fd5b50356001600160a01b03166114e3565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60006108678461086285858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115dc92505050565b611681565b90505b9392505050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108fd5780601f106108d2576101008083540402835291602001916108fd565b820191906000526020600020905b8154815290600101906020018083116108e057829003601f168201915b505050505090505b90565b60006109138261172b565b61094e5760405162461bcd60e51b815260040180806020018281038252602c8152602001806129a7602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061097582610c58565b9050806001600160a01b0316836001600160a01b031614156109c85760405162461bcd60e51b8152600401808060200182810382526021815260200180612a4b6021913960400191505060405180910390fd5b806001600160a01b03166109da61173e565b6001600160a01b031614806109fb57506109fb816109f661173e565b6114a0565b610a365760405162461bcd60e51b81526004018080602001828103825260388152602001806128fa6038913960400191505060405180910390fd5b610a408383611742565b505050565b600e54600160a01b900460ff1681565b6000610a6160026117b0565b905090565b610a77610a7161173e565b826117bb565b610ab25760405162461bcd60e51b8152600401808060200182810382526031815260200180612a6c6031913960400191505060405180910390fd5b610a4083838361185f565b6001600160a01b0382166000908152600160205260408120610ae5908363ffffffff6119bd16565b90505b92915050565b610af661173e565b600a546001600160a01b03908116911614610b46576040805162461bcd60e51b815260206004820181905260248201526000805160206129d3833981519152604482015290519081900360640190fd5b610a408383838080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506119c992505050565b610a4083838360405180602001604052806000815250611003565b600080610bb560028463ffffffff611b2e16565b509392505050565b610bc561173e565b600a546001600160a01b03908116911614610c15576040805162461bcd60e51b815260206004820181905260248201526000805160206129d3833981519152604482015290519081900360640190fd5b610c5482828080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b4a92505050565b5050565b6000610ae88260405180606001604052806029815260200161295c602991396002919063ffffffff611b5d16565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108fd5780601f106108d2576101008083540402835291602001916108fd565b600c805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d6d5780601f10610d4257610100808354040283529160200191610d6d565b820191906000526020600020905b815481529060010190602001808311610d5057829003601f168201915b505050505081565b60006001600160a01b038216610dbc5760405162461bcd60e51b815260040180806020018281038252602a815260200180612932602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610ae8906117b0565b610de561173e565b600a546001600160a01b03908116911614610e35576040805162461bcd60e51b815260206004820181905260248201526000805160206129d3833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600e546001600160a01b031681565b600a546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108fd5780601f106108d2576101008083540402835291602001916108fd565b610f0661173e565b6001600160a01b0316826001600160a01b03161415610f6c576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000610f7961173e565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610fbd61173e565b60408051841515815290516001600160a01b0392909216917f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c319181900360200190a35050565b61101461100e61173e565b836117bb565b61104f5760405162461bcd60e51b8152600401808060200182810382526031815260200180612a6c6031913960400191505060405180910390fd5b61105b84848484611b6a565b50505050565b6000611075826001600160a01b031661172b565b80610ae85750600e546001600160a01b031615801590610ae85750600e546040805163c3c5a54760e01b81526001600160a01b0385811660048301529151919092169163c3c5a547916024808301926020929190829003018186803b1580156110dd57600080fd5b505afa1580156110f1573d6000803e3d6000fd5b505050506040513d602081101561110757600080fd5b505192915050565b61111761173e565b600a546001600160a01b03908116911614611167576040805162461bcd60e51b815260206004820181905260248201526000805160206129d3833981519152604482015290519081900360640190fd5b600e54600160a01b900460ff161561117e57600080fd5b600e8054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b0392909216919091179055565b60606111ba8261172b565b6111f55760405162461bcd60e51b815260040180806020018281038252602f815260200180612a1c602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f600260001961010060018616150201909316929092049182018490048402810184019094528084526060939283018282801561128a5780601f1061125f5761010080835404028352916020019161128a565b820191906000526020600020905b81548152906001019060200180831161126d57829003601f168201915b5050600954939450505050600260001961010060018416150201909116046112b3579050610818565b80511561138457600981604051602001808380546001816001161561010002031660029004801561131b5780601f106112f957610100808354040283529182019161131b565b820191906000526020600020905b815481529060010190602001808311611307575b5050825160208401908083835b602083106113475780518252601f199092019160209182019101611328565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050610818565b600961138f84611bbc565b60405160200180838054600181600116156101000203166002900480156113ed5780601f106113cb5761010080835404028352918201916113ed565b820191906000526020600020905b8154815290600101906020018083116113d9575b5050825160208401908083835b602083106114195780518252601f1990920191602091820191016113fa565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b60006108678461149b85858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115dc92505050565b611c97565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600b546001600160a01b031681565b600d5481565b6114eb61173e565b600a546001600160a01b0390811691161461153b576040805162461bcd60e51b815260206004820181905260248201526000805160206129d3833981519152604482015290519081900360640190fd5b6001600160a01b0381166115805760405162461bcd60e51b81526004018080602001828103825260268152602001806128846026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6060816040516024018080602001828103825283818151815260200191508051906020019080838360005b8381101561161f578181015183820152602001611607565b50505050905090810190601f16801561164c5780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316631ec5a31160e31b1790529350505050919050565b60008061171a83856040516020018083805190602001908083835b602083106116bb5780518252601f19909201916020918201910161169c565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b03166001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600d54611ec1565b6001600160a01b0316949350505050565b6000610ae860028363ffffffff611ece16565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061177782610c58565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610ae882611eda565b60006117c68261172b565b6118015760405162461bcd60e51b815260040180806020018281038252602c8152602001806128ce602c913960400191505060405180910390fd5b600061180c83610c58565b9050806001600160a01b0316846001600160a01b031614806118475750836001600160a01b031661183c84610908565b6001600160a01b0316145b80611857575061185781856114a0565b949350505050565b826001600160a01b031661187282610c58565b6001600160a01b0316146118b75760405162461bcd60e51b81526004018080602001828103825260298152602001806129f36029913960400191505060405180910390fd5b6001600160a01b0382166118fc5760405162461bcd60e51b81526004018080602001828103825260248152602001806128aa6024913960400191505060405180910390fd5b611907838383610a40565b611912600082611742565b6001600160a01b038316600090815260016020526040902061193a908263ffffffff611ede16565b506001600160a01b0382166000908152600160205260409020611963908263ffffffff611eea16565b506119766002828463ffffffff611ef616565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610ae58383611f0c565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b158015611a2f57600080fd5b505afa158015611a43573d6000803e3d6000fd5b505050506040513d6020811015611a5957600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015611ab8578181015183820152602001611aa0565b50505050905090810190601f168015611ae55780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015611b0457600080fd5b505af1158015611b18573d6000803e3d6000fd5b505050506040513d602081101561105b57600080fd5b6000808080611b3d8686611f70565b9097909650945050505050565b8051610c54906009906020840190612797565b6000610867848484611feb565b611b7584848461185f565b611b81848484846120b5565b61105b5760405162461bcd60e51b81526004018080602001828103825260328152602001806128526032913960400191505060405180910390fd5b606081611be157506040805180820190915260018152600360fc1b6020820152610818565b8160005b8115611bf957600101600a82049150611be5565b60608167ffffffffffffffff81118015611c1257600080fd5b506040519080825280601f01601f191660200182016040528015611c3d576020820181803683370190505b50859350905060001982015b8315611c8e57600a840660300160f81b82828060019003935081518110611c6c57fe5b60200101906001600160f81b031916908160001a905350600a84049350611c49565b50949350505050565b600080611dca600084866040516020018083805190602001908083835b60208310611cd35780518252601f199092019160209182019101611cb4565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b03166001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611dc05780601f10611d9557610100808354040283529160200191611dc0565b820191906000526020600020905b815481529060010190602001808311611da357829003601f168201915b50505050506122f0565b600b546040805163347d5e2560e21b81526001600160a01b0392831660048201818152602483019384528851604484015288519596509386169463d1f5789494919389939091606490910190602085019080838360005b83811015611e39578181015183820152602001611e21565b50505050905090810190601f168015611e665780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015611e8657600080fd5b505af1158015611e9a573d6000803e3d6000fd5b50505050611eb184826001600160a01b0316612401565b6001600160a01b03169392505050565b6000610ae583833061253b565b6000610ae5838361259f565b5490565b6000610ae583836125b7565b6000610ae5838361267d565b600061086784846001600160a01b0385166126c7565b81546000908210611f4e5760405162461bcd60e51b81526004018080602001828103825260228152602001806128306022913960400191505060405180910390fd5b826000018281548110611f5d57fe5b9060005260206000200154905092915050565b815460009081908310611fb45760405162461bcd60e51b81526004018080602001828103825260228152602001806129856022913960400191505060405180910390fd5b6000846000018481548110611fc557fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816120865760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561204b578181015183820152602001612033565b50505050905090810190601f1680156120785780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061209957fe5b9060005260206000209060020201600101549150509392505050565b60006120c9846001600160a01b031661275e565b6120d557506001611857565b600060606001600160a01b038616630a85bd0160e11b6120f361173e565b89888860405160240180856001600160a01b03166001600160a01b03168152602001846001600160a01b03166001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b8381101561216c578181015183820152602001612154565b50505050905090810190601f1680156121995780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529181526020820180516001600160e01b03166001600160e01b0319909a16999099178952518151919890975087965094509250829150849050835b602083106122015780518252601f1990920191602091820191016121e2565b6001836020036101000a0380198251168184511680821785525050505050509050019150506000604051808303816000865af19150503d8060008114612263576040519150601f19603f3d011682016040523d82523d6000602084013e612268565b606091505b5091509150816122b9578051156122825780518082602001fd5b60405162461bcd60e51b81526004018080602001828103825260328152602001806128526032913960400191505060405180910390fd5b60008180602001905160208110156122d057600080fd5b50516001600160e01b031916630a85bd0160e11b14935061185792505050565b60008084471015612348576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b825161239b576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116610867576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b6001600160a01b03821661245c576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6124658161172b565b156124b7576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6124c360008383610a40565b6001600160a01b03821660009081526001602052604090206124eb908263ffffffff611eea16565b506124fe6002828463ffffffff611ef616565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff19166021820152603581019490945260558085019390935280518085039093018352607590930190925280519101206001600160a01b031690565b60009081526001919091016020526040902054151590565b6000818152600183016020526040812054801561267357835460001980830191908101906000908790839081106125ea57fe5b906000526020600020015490508087600001848154811061260757fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061263757fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610ae8565b6000915050610ae8565b6000612689838361259f565b6126bf57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ae8565b506000610ae8565b60008281526001840160205260408120548061272c57505060408051808201825283815260208082018481528654600181810189556000898152848120955160029093029095019182559151908201558654868452818801909252929091205561086a565b8285600001600183038154811061273f57fe5b906000526020600020906002020160010181905550600091505061086a565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470818114801590611857575050151592915050565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106127d857805160ff1916838001178555612805565b82800160010185558215612805579182015b828111156128055782518255916020019190600101906127ea565b50612811929150612815565b5090565b61090591905b80821115612811576000815560010161281b56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a26469706673582212202b78ce7067a118f1f61689b90c38e69118be34d3bf01afdf88b5918963dd713564736f6c63430006060033608060405234801561001057600080fd5b50610809806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146101ca578063b55e75af146101d2578063f199413c146101da578063f62d1888146101fd57610088565b80633121db1c1461008d578063584feb3a1461010f5780637b1039991461018c57806387639c68146101b0575b600080fd5b61010d600480360360408110156100a357600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ce57600080fd5b8201836020820111156100e057600080fd5b8035906020019184600183028401116401000000008311171561010257600080fd5b5090925090506102a3565b005b610117610346565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610151578181015183820152602001610139565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101946103d3565b604080516001600160a01b039092168252519081900360200190f35b6101b86103e2565b60408051918252519081900360200190f35b6101946103e8565b6101b8610466565b61010d600480360360408110156101f057600080fd5b508035906020013561046c565b61010d6004803603602081101561021357600080fd5b81019060208101813564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610530945050505050565b336102ac6103e8565b6001600160a01b031614610301576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b6103418383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055a92505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103cb5780601f106103a0576101008083540402835291602001916103cb565b820191906000526020600020905b8154815290600101906020018083116103ae57829003601f168201915b505050505081565b6000546001600160a01b031681565b60035481565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b505190505b90565b60025481565b336104756103e8565b6001600160a01b0316146104ca576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b60648111156104d857600080fd5b60025460035460408051928352602083018590528281019190915260608201839052517f61f37ef3a6d587ce2d6be79492e1fac570f2745787015db7ed95ad4397b05c1e9181900360800190a1600291909155600355565b610539336106c5565b805161054c90600190602084019061073b565b5050601e6002556001600355565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105c057600080fd5b505afa1580156105d4573d6000803e3d6000fd5b505050506040513d60208110156105ea57600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610649578181015183820152602001610631565b50505050905090810190601f1680156106765780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069557600080fd5b505af11580156106a9573d6000803e3d6000fd5b505050506040513d60208110156106bf57600080fd5b50505050565b6000546001600160a01b031615610719576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077c57805160ff19168380011785556107a9565b828001600101855582156107a9579182015b828111156107a957825182559160200191906001019061078e565b506107b59291506107b9565b5090565b61046391905b808211156107b557600081556001016107bf56fea264697066735822122018fc57db17dda04ce8d113e03376f297c311647dfae2b7176bb7f7e53af0983164736f6c63430006060033608060405234801561001057600080fd5b506103ad806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f6100ef565b005b61002f6100ef565b61002f6004803603604081101561004f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561007a57600080fd5b82018360208201111561008c57600080fd5b803590602001918460018302840111640100000000831117156100ae57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610109945050505050565b6100f7610107565b61010761010261022c565b610251565b565b600061011361022c565b6001600160a01b03161461012657600080fd5b60405180602361031a82396040519081900360230190207f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c314905061016757fe5b61017082610275565b805115610228576000826001600160a01b0316826040518082805190602001908083835b602083106101b35780518252601f199092019160209182019101610194565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d8060008114610213576040519150601f19603f3d011682016040523d82523d6000602084013e610218565b606091505b505090508061022657600080fd5b505b5050565b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35490565b3660008037600080366000845af43d6000803e808015610270573d6000f35b3d6000fd5b61027e816102dd565b6102b95760405162461bcd60e51b815260040180806020018281038252603b81526020018061033d603b913960400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c355565b6000813f7fc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a47081811480159061031157508115155b94935050505056fe6f72672e7a657070656c696e6f732e70726f78792e696d706c656d656e746174696f6e43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a2646970667358221220f6164f6912557c387cf208aaa14810eeb1b62762a39d81eba25618c416e3a55b64736f6c63430006060033"; + public static final String BINARY = "0x60806040523480156200001157600080fd5b506040516200002090620002c9565b604051809103906000f0801580156200003d573d6000803e3d6000fd5b50604080518082018252601e81527f694578656320576f726b6572706f6f6c20526567697374727920285635290000602080830191909152825180840190935260118352706945786563576f726b6572706f6f6c563560781b90830152908181620000af6301ffc9a760e01b62000240565b8151620000c4906006906020850190620002d7565b508051620000da906007906020840190620002d7565b50620000ed6380ac58cd60e01b62000240565b620000ff635b5e139f60e01b62000240565b6200011163780e9d6360e01b62000240565b506000905062000120620002c5565b600a80546001600160a01b0319166001600160a01b038316908117909155604051919250906000907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908290a350600b80546001600160a01b0319166001600160a01b0385161790556040516200019a602082016200035c565b601f1982820381018352601f909101166040528051620001c491600c9160209190910190620002d7565b50600c6040518082805460018160011615610100020316600290048015620002265780601f106200020357610100808354040283529182019162000226565b820191906000526020600020905b81548152906001019060200180831162000211575b5050604051908190039020600d5550620003819350505050565b6001600160e01b03198082161415620002a0576040805162461bcd60e51b815260206004820152601c60248201527f4552433136353a20696e76616c696420696e7465726661636520696400000000604482015290519081900360640190fd5b6001600160e01b0319166000908152602081905260409020805460ff19166001179055565b3390565b6108238062002e9283390190565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f106200031a57805160ff19168380011785556200034a565b828001600101855582156200034a579182015b828111156200034a5782518255916020019190600101906200032d565b50620003589291506200036a565b5090565b61033380620036b583390190565b5b808211156200035857600081556001016200036b565b612b0180620003916000396000f3fe608060405234801561001057600080fd5b50600436106101e55760003560e01c80636fa59bbc1161010f578063c3c5a547116100a2578063e985e9c511610071578063e985e9c514610796578063ee97f7f3146107c4578063eee39111146107cc578063f2fde38b146107d4576101e5565b8063c3c5a547146106af578063c4d66de8146106d5578063c87b56dd146106fb578063e40238f414610718576101e5565b80638da5cb5b116100de5780638da5cb5b146105ad57806395d89b41146105b5578063a22cb465146105bd578063b88d4fde146105eb576101e5565b80636fa59bbc1461056f57806370a0823114610577578063715018a61461059d5780637c2b2e71146105a5576101e5565b806323b872dd116101875780634f6ccce7116101565780634f6ccce7146104bf57806355f804b3146104dc5780636352211e1461054a5780636c0360eb14610567576101e5565b806323b872dd146103a95780632f745c59146103df5780633121db1c1461040b57806342842e0e14610489576101e5565b8063081812fc116101c3578063081812fc1461033c578063095ea7b314610359578063158ef93e1461038757806318160ddd1461038f576101e5565b806301ffc9a7146101ea578063064a6c2a1461022557806306fdde03146102bf575b600080fd5b6102116004803603602081101561020057600080fd5b50356001600160e01b0319166107fa565b604080519115158252519081900360200190f35b6102a36004803603604081101561023b57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561026557600080fd5b82018360208201111561027757600080fd5b803590602001918460018302840111600160201b8311171561029857600080fd5b50909250905061081d565b604080516001600160a01b039092168252519081900360200190f35b6102c7610871565b6040805160208082528351818301528351919283929083019185019080838360005b838110156103015781810151838201526020016102e9565b50505050905090810190601f16801561032e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6102a36004803603602081101561035257600080fd5b5035610907565b6103856004803603604081101561036f57600080fd5b506001600160a01b038135169060200135610969565b005b610211610a44565b610397610a54565b60408051918252519081900360200190f35b610385600480360360608110156103bf57600080fd5b506001600160a01b03813581169160208101359091169060400135610a65565b610397600480360360408110156103f557600080fd5b506001600160a01b038135169060200135610abc565b6103856004803603604081101561042157600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561044b57600080fd5b82018360208201111561045d57600080fd5b803590602001918460018302840111600160201b8311171561047e57600080fd5b509092509050610ae7565b6103856004803603606081101561049f57600080fd5b506001600160a01b03813581169160208101359091169060400135610b7f565b610397600480360360208110156104d557600080fd5b5035610b9a565b610385600480360360208110156104f257600080fd5b810190602081018135600160201b81111561050c57600080fd5b82018360208201111561051e57600080fd5b803590602001918460018302840111600160201b8311171561053f57600080fd5b509092509050610bb0565b6102a36004803603602081101561056057600080fd5b5035610c4b565b6102c7610c73565b6102c7610cd4565b6103976004803603602081101561058d57600080fd5b50356001600160a01b0316610d62565b610385610dca565b6102a3610e6c565b6102a3610e7b565b6102c7610e8a565b610385600480360360408110156105d357600080fd5b506001600160a01b0381351690602001351515610eeb565b6103856004803603608081101561060157600080fd5b6001600160a01b03823581169260208101359091169160408201359190810190608081016060820135600160201b81111561063b57600080fd5b82018360208201111561064d57600080fd5b803590602001918460018302840111600160201b8311171561066e57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610ff0945050505050565b610211600480360360208110156106c557600080fd5b50356001600160a01b031661104e565b610385600480360360208110156106eb57600080fd5b50356001600160a01b03166110fc565b6102c76004803603602081101561071157600080fd5b503561119c565b6102a36004803603604081101561072e57600080fd5b6001600160a01b038235169190810190604081016020820135600160201b81111561075857600080fd5b82018360208201111561076a57600080fd5b803590602001918460018302840111600160201b8311171561078b57600080fd5b509092509050611443565b610211600480360360408110156107ac57600080fd5b506001600160a01b038135811691602001351661148d565b6102a36114bb565b6103976114ca565b610385600480360360208110156107ea57600080fd5b50356001600160a01b03166114d0565b6001600160e01b0319811660009081526020819052604090205460ff165b919050565b60006108678461086285858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115c992505050565b61166e565b90505b9392505050565b60068054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108fd5780601f106108d2576101008083540402835291602001916108fd565b820191906000526020600020905b8154815290600101906020018083116108e057829003601f168201915b5050505050905090565b60006109128261170f565b61094d5760405162461bcd60e51b815260040180806020018281038252602c8152602001806129d6602c913960400191505060405180910390fd5b506000908152600460205260409020546001600160a01b031690565b600061097482610c4b565b9050806001600160a01b0316836001600160a01b031614156109c75760405162461bcd60e51b8152600401808060200182810382526021815260200180612a7a6021913960400191505060405180910390fd5b806001600160a01b03166109d961171c565b6001600160a01b031614806109fa57506109fa816109f561171c565b61148d565b610a355760405162461bcd60e51b81526004018080602001828103825260388152602001806129296038913960400191505060405180910390fd5b610a3f8383611720565b505050565b600e54600160a01b900460ff1681565b6000610a60600261178e565b905090565b610a76610a7061171c565b82611799565b610ab15760405162461bcd60e51b8152600401808060200182810382526031815260200180612a9b6031913960400191505060405180910390fd5b610a3f83838361183d565b6001600160a01b0382166000908152600160205260408120610ade9083611989565b90505b92915050565b610aef61171c565b600a546001600160a01b03908116911614610b3f576040805162461bcd60e51b81526020600482018190526024820152600080516020612a02833981519152604482015290519081900360640190fd5b610a3f8383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061199592505050565b610a3f83838360405180602001604052806000815250610ff0565b600080610ba8600284611afa565b509392505050565b610bb861171c565b600a546001600160a01b03908116911614610c08576040805162461bcd60e51b81526020600482018190526024820152600080516020612a02833981519152604482015290519081900360640190fd5b610c4782828080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250611b1692505050565b5050565b6000610ae18260405180606001604052806029815260200161298b6029913960029190611b29565b60098054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108fd5780601f106108d2576101008083540402835291602001916108fd565b600c805460408051602060026001851615610100026000190190941693909304601f81018490048402820184019092528181529291830182828015610d5a5780601f10610d2f57610100808354040283529160200191610d5a565b820191906000526020600020905b815481529060010190602001808311610d3d57829003601f168201915b505050505081565b60006001600160a01b038216610da95760405162461bcd60e51b815260040180806020018281038252602a815260200180612961602a913960400191505060405180910390fd5b6001600160a01b0382166000908152600160205260409020610ae19061178e565b610dd261171c565b600a546001600160a01b03908116911614610e22576040805162461bcd60e51b81526020600482018190526024820152600080516020612a02833981519152604482015290519081900360640190fd5b600a546040516000916001600160a01b0316907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e0908390a3600a80546001600160a01b0319169055565b600e546001600160a01b031681565b600a546001600160a01b031690565b60078054604080516020601f60026000196101006001881615020190951694909404938401819004810282018101909252828152606093909290918301828280156108fd5780601f106108d2576101008083540402835291602001916108fd565b610ef361171c565b6001600160a01b0316826001600160a01b03161415610f59576040805162461bcd60e51b815260206004820152601960248201527f4552433732313a20617070726f766520746f2063616c6c657200000000000000604482015290519081900360640190fd5b8060056000610f6661171c565b6001600160a01b03908116825260208083019390935260409182016000908120918716808252919093529120805460ff191692151592909217909155610faa61171c565b6001600160a01b03167f17307eab39ab6107e8899845ad3d59bd9653f200f220920489ca2b5937696c318360405180821515815260200191505060405180910390a35050565b611001610ffb61171c565b83611799565b61103c5760405162461bcd60e51b8152600401808060200182810382526031815260200180612a9b6031913960400191505060405180910390fd5b61104884848484611b36565b50505050565b6000611062826001600160a01b031661170f565b80610ae15750600e546001600160a01b031615801590610ae15750600e546040805163c3c5a54760e01b81526001600160a01b0385811660048301529151919092169163c3c5a547916024808301926020929190829003018186803b1580156110ca57600080fd5b505afa1580156110de573d6000803e3d6000fd5b505050506040513d60208110156110f457600080fd5b505192915050565b61110461171c565b600a546001600160a01b03908116911614611154576040805162461bcd60e51b81526020600482018190526024820152600080516020612a02833981519152604482015290519081900360640190fd5b600e54600160a01b900460ff161561116b57600080fd5b600e8054600160a01b60ff60a01b19909116176001600160a01b0319166001600160a01b0392909216919091179055565b60606111a78261170f565b6111e25760405162461bcd60e51b815260040180806020018281038252602f815260200180612a4b602f913960400191505060405180910390fd5b60008281526008602090815260409182902080548351601f60026000196101006001861615020190931692909204918201849004840281018401909452808452606093928301828280156112775780601f1061124c57610100808354040283529160200191611277565b820191906000526020600020905b81548152906001019060200180831161125a57829003601f168201915b5050600954939450505050600260001961010060018416150201909116046112a0579050610818565b8051156113715760098160405160200180838054600181600116156101000203166002900480156113085780601f106112e6576101008083540402835291820191611308565b820191906000526020600020905b8154815290600101906020018083116112f4575b5050825160208401908083835b602083106113345780518252601f199092019160209182019101611315565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050610818565b600961137c84611b88565b60405160200180838054600181600116156101000203166002900480156113da5780601f106113b85761010080835404028352918201916113da565b820191906000526020600020905b8154815290600101906020018083116113c6575b5050825160208401908083835b602083106114065780518252601f1990920191602091820191016113e7565b6001836020036101000a03801982511681845116808217855250505050505090500192505050604051602081830303815290604052915050919050565b60006108678461148885858080601f0160208091040260200160405190810160405280939291908181526020018383808284376000920191909152506115c992505050565b611c63565b6001600160a01b03918216600090815260056020908152604080832093909416825291909152205460ff1690565b600b546001600160a01b031681565b600d5481565b6114d861171c565b600a546001600160a01b03908116911614611528576040805162461bcd60e51b81526020600482018190526024820152600080516020612a02833981519152604482015290519081900360640190fd5b6001600160a01b03811661156d5760405162461bcd60e51b81526004018080602001828103825260268152602001806128b36026913960400191505060405180910390fd5b600a546040516001600160a01b038084169216907f8be0079c531659141344cd1fd0a4f28419497f9722a3daafe3b4186f6b6457e090600090a3600a80546001600160a01b0319166001600160a01b0392909216919091179055565b6060816040516024018080602001828103825283818151815260200191508051906020019080838360005b8381101561160c5781810151838201526020016115f4565b50505050905090810190601f1680156116395780820380516001836020036101000a031916815260200191505b5060408051601f198184030181529190526020810180516001600160e01b0316631ec5a31160e31b1790529350505050919050565b6000806116fe83856040516020018083805190602001908083835b602083106116a85780518252601f199092019160209182019101611689565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600d54611e84565b6001600160a01b0316949350505050565b6000610ae1600283611e91565b3390565b600081815260046020526040902080546001600160a01b0319166001600160a01b038416908117909155819061175582610c4b565b6001600160a01b03167f8c5be1e5ebec7d5bd14f71427d1e84f3dd0314c0f7b2291e5b200ac8c7c3b92560405160405180910390a45050565b6000610ae182611e9d565b60006117a48261170f565b6117df5760405162461bcd60e51b815260040180806020018281038252602c8152602001806128fd602c913960400191505060405180910390fd5b60006117ea83610c4b565b9050806001600160a01b0316846001600160a01b031614806118255750836001600160a01b031661181a84610907565b6001600160a01b0316145b806118355750611835818561148d565b949350505050565b826001600160a01b031661185082610c4b565b6001600160a01b0316146118955760405162461bcd60e51b8152600401808060200182810382526029815260200180612a226029913960400191505060405180910390fd5b6001600160a01b0382166118da5760405162461bcd60e51b81526004018080602001828103825260248152602001806128d96024913960400191505060405180910390fd5b6118e5838383610a3f565b6118f0600082611720565b6001600160a01b03831660009081526001602052604090206119129082611ea1565b506001600160a01b03821660009081526001602052604090206119359082611ead565b5061194260028284611eb9565b5080826001600160a01b0316846001600160a01b03167fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef60405160405180910390a4505050565b6000610ade8383611ecf565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156119fb57600080fd5b505afa158015611a0f573d6000803e3d6000fd5b505050506040513d6020811015611a2557600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015611a84578181015183820152602001611a6c565b50505050905090810190601f168015611ab15780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b158015611ad057600080fd5b505af1158015611ae4573d6000803e3d6000fd5b505050506040513d602081101561104857600080fd5b6000808080611b098686611f33565b9097909650945050505050565b8051610c479060099060208401906127cb565b6000610867848484611fae565b611b4184848461183d565b611b4d84848484612078565b6110485760405162461bcd60e51b81526004018080602001828103825260328152602001806128816032913960400191505060405180910390fd5b606081611bad57506040805180820190915260018152600360fc1b6020820152610818565b8160005b8115611bc557600101600a82049150611bb1565b60608167ffffffffffffffff81118015611bde57600080fd5b506040519080825280601f01601f191660200182016040528015611c09576020820181803683370190505b50859350905060001982015b8315611c5a57600a840660300160f81b82828060019003935081518110611c3857fe5b60200101906001600160f81b031916908160001a905350600a84049350611c15565b50949350505050565b600080611d8d600084866040516020018083805190602001908083835b60208310611c9f5780518252601f199092019160209182019101611c80565b6001836020036101000a038019825116818451168082178552505050505050905001826001600160a01b031660601b81526014019250505060405160208183030381529060405280519060200120600c8054600181600116156101000203166002900480601f016020809104026020016040519081016040528092919081815260200182805460018160011615610100020316600290048015611d835780601f10611d5857610100808354040283529160200191611d83565b820191906000526020600020905b815481529060010190602001808311611d6657829003601f168201915b50505050506121e0565b600b546040805163347d5e2560e21b81526001600160a01b0392831660048201818152602483019384528851604484015288519596509386169463d1f5789494919389939091606490910190602085019080838360005b83811015611dfc578181015183820152602001611de4565b50505050905090810190601f168015611e295780820380516001836020036101000a031916815260200191505b509350505050600060405180830381600087803b158015611e4957600080fd5b505af1158015611e5d573d6000803e3d6000fd5b50505050611e7484826001600160a01b03166122f1565b6001600160a01b03169392505050565b6000610ade83833061241f565b6000610ade838361247a565b5490565b6000610ade8383612492565b6000610ade8383612558565b600061086784846001600160a01b0385166125a2565b81546000908210611f115760405162461bcd60e51b815260040180806020018281038252602281526020018061285f6022913960400191505060405180910390fd5b826000018281548110611f2057fe5b9060005260206000200154905092915050565b815460009081908310611f775760405162461bcd60e51b81526004018080602001828103825260228152602001806129b46022913960400191505060405180910390fd5b6000846000018481548110611f8857fe5b906000526020600020906002020190508060000154816001015492509250509250929050565b600082815260018401602052604081205482816120495760405162461bcd60e51b81526004018080602001828103825283818151815260200191508051906020019080838360005b8381101561200e578181015183820152602001611ff6565b50505050905090810190601f16801561203b5780820380516001836020036101000a031916815260200191505b509250505060405180910390fd5b5084600001600182038154811061205c57fe5b9060005260206000209060020201600101549150509392505050565b600061208c846001600160a01b0316612639565b61209857506001611835565b60606121a6630a85bd0160e11b6120ad61171c565b88878760405160240180856001600160a01b03168152602001846001600160a01b0316815260200183815260200180602001828103825283818151815260200191508051906020019080838360005b838110156121145781810151838201526020016120fc565b50505050905090810190601f1680156121415780820380516001836020036101000a031916815260200191505b5095505050505050604051602081830303815290604052906001600160e01b0319166020820180516001600160e01b038381831617835250505050604051806060016040528060328152602001612881603291396001600160a01b038816919061263f565b905060008180602001905160208110156121bf57600080fd5b50516001600160e01b031916630a85bd0160e11b1492505050949350505050565b60008084471015612238576040805162461bcd60e51b815260206004820152601d60248201527f437265617465323a20696e73756666696369656e742062616c616e6365000000604482015290519081900360640190fd5b825161228b576040805162461bcd60e51b815260206004820181905260248201527f437265617465323a2062797465636f6465206c656e677468206973207a65726f604482015290519081900360640190fd5b8383516020850187f590506001600160a01b038116610867576040805162461bcd60e51b815260206004820152601960248201527f437265617465323a204661696c6564206f6e206465706c6f7900000000000000604482015290519081900360640190fd5b6001600160a01b03821661234c576040805162461bcd60e51b815260206004820181905260248201527f4552433732313a206d696e7420746f20746865207a65726f2061646472657373604482015290519081900360640190fd5b6123558161170f565b156123a7576040805162461bcd60e51b815260206004820152601c60248201527f4552433732313a20746f6b656e20616c7265616479206d696e74656400000000604482015290519081900360640190fd5b6123b360008383610a3f565b6001600160a01b03821660009081526001602052604090206123d59082611ead565b506123e260028284611eb9565b5060405181906001600160a01b038416906000907fddf252ad1be2c89b69c2b068fc378daa952ba7f163c4a11628f55a4df523b3ef908290a45050565b604080516001600160f81b031960208083019190915260609390931b6bffffffffffffffffffffffff191660218201526035810194909452605580850193909352805180850390930183526075909301909252805191012090565b60009081526001919091016020526040902054151590565b6000818152600183016020526040812054801561254e57835460001980830191908101906000908790839081106124c557fe5b90600052602060002001549050808760000184815481106124e257fe5b60009182526020808320909101929092558281526001898101909252604090209084019055865487908061251257fe5b60019003818190600052602060002001600090559055866001016000878152602001908152602001600020600090556001945050505050610ae1565b6000915050610ae1565b6000612564838361247a565b61259a57508154600181810184556000848152602080822090930184905584548482528286019093526040902091909155610ae1565b506000610ae1565b60008281526001840160205260408120548061260757505060408051808201825283815260208082018481528654600181810189556000898152848120955160029093029095019182559151908201558654868452818801909252929091205561086a565b8285600001600183038154811061261a57fe5b906000526020600020906002020160010181905550600091505061086a565b3b151590565b606061086784846000858561265385612639565b6126a4576040805162461bcd60e51b815260206004820152601d60248201527f416464726573733a2063616c6c20746f206e6f6e2d636f6e7472616374000000604482015290519081900360640190fd5b60006060866001600160a01b031685876040518082805190602001908083835b602083106126e35780518252601f1990920191602091820191016126c4565b6001836020036101000a03801982511681845116808217855250505050505090500191505060006040518083038185875af1925050503d8060008114612745576040519150601f19603f3d011682016040523d82523d6000602084013e61274a565b606091505b509150915061275a828286612765565b979650505050505050565b6060831561277457508161086a565b8251156127845782518084602001fd5b60405162461bcd60e51b815260206004820181815284516024840152845185939192839260440191908501908083836000831561200e578181015183820152602001611ff6565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061280c57805160ff1916838001178555612839565b82800160010185558215612839579182015b8281111561283957825182559160200191906001019061281e565b50612845929150612849565b5090565b5b80821115612845576000815560010161284a56fe456e756d657261626c655365743a20696e646578206f7574206f6620626f756e64734552433732313a207472616e7366657220746f206e6f6e20455243373231526563656976657220696d706c656d656e7465724f776e61626c653a206e6577206f776e657220697320746865207a65726f20616464726573734552433732313a207472616e7366657220746f20746865207a65726f20616464726573734552433732313a206f70657261746f7220717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76652063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f76656420666f7220616c6c4552433732313a2062616c616e636520717565727920666f7220746865207a65726f20616464726573734552433732313a206f776e657220717565727920666f72206e6f6e6578697374656e7420746f6b656e456e756d657261626c654d61703a20696e646578206f7574206f6620626f756e64734552433732313a20617070726f76656420717565727920666f72206e6f6e6578697374656e7420746f6b656e4f776e61626c653a2063616c6c6572206973206e6f7420746865206f776e65724552433732313a207472616e73666572206f6620746f6b656e2074686174206973206e6f74206f776e4552433732314d657461646174613a2055524920717565727920666f72206e6f6e6578697374656e7420746f6b656e4552433732313a20617070726f76616c20746f2063757272656e74206f776e65724552433732313a207472616e736665722063616c6c6572206973206e6f74206f776e6572206e6f7220617070726f766564a2646970667358221220fd01fbd009c5a558e530492662e0db8819674b346a5f2f13f6128f14087264a064736f6c634300060c0033608060405234801561001057600080fd5b50610803806100206000396000f3fe608060405234801561001057600080fd5b50600436106100885760003560e01c80638da5cb5b1161005b5780638da5cb5b146101ca578063b55e75af146101d2578063f199413c146101da578063f62d1888146101fd57610088565b80633121db1c1461008d578063584feb3a1461010f5780637b1039991461018c57806387639c68146101b0575b600080fd5b61010d600480360360408110156100a357600080fd5b6001600160a01b0382351691908101906040810160208201356401000000008111156100ce57600080fd5b8201836020820111156100e057600080fd5b8035906020019184600183028401116401000000008311171561010257600080fd5b5090925090506102a3565b005b610117610346565b6040805160208082528351818301528351919283929083019185019080838360005b83811015610151578181015183820152602001610139565b50505050905090810190601f16801561017e5780820380516001836020036101000a031916815260200191505b509250505060405180910390f35b6101946103d3565b604080516001600160a01b039092168252519081900360200190f35b6101b86103e2565b60408051918252519081900360200190f35b6101946103e8565b6101b8610465565b61010d600480360360408110156101f057600080fd5b508035906020013561046b565b61010d6004803603602081101561021357600080fd5b81019060208101813564010000000081111561022e57600080fd5b82018360208201111561024057600080fd5b8035906020019184600183028401116401000000008311171561026257600080fd5b91908080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525092955061052f945050505050565b336102ac6103e8565b6001600160a01b031614610301576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b6103418383838080601f01602080910402602001604051908101604052809392919081815260200183838082843760009201919091525061055992505050565b505050565b60018054604080516020600284861615610100026000190190941693909304601f810184900484028201840190925281815292918301828280156103cb5780601f106103a0576101008083540402835291602001916103cb565b820191906000526020600020905b8154815290600101906020018083116103ae57829003601f168201915b505050505081565b6000546001600160a01b031681565b60035481565b60008054604080516331a9108f60e11b815230600482015290516001600160a01b0390921691636352211e91602480820192602092909190829003018186803b15801561043457600080fd5b505afa158015610448573d6000803e3d6000fd5b505050506040513d602081101561045e57600080fd5b5051905090565b60025481565b336104746103e8565b6001600160a01b0316146104c9576040805162461bcd60e51b815260206004820152601760248201527631b0b63632b91034b9903737ba103a34329037bbb732b960491b604482015290519081900360640190fd5b60648111156104d757600080fd5b60025460035460408051928352602083018590528281019190915260608201839052517f61f37ef3a6d587ce2d6be79492e1fac570f2745787015db7ed95ad4397b05c1e9181900360800190a1600291909155600355565b610538336106c4565b805161054b90600190602084019061073a565b5050601e6002556001600355565b604080516302571be360e01b81527f91d1777781884d03a6757a803996e38de2a42967fb37eeaca72729271025a9e2600482015290516001600160a01b038416916302571be3916024808301926020929190829003018186803b1580156105bf57600080fd5b505afa1580156105d3573d6000803e3d6000fd5b505050506040513d60208110156105e957600080fd5b505160405163c47f002760e01b81526020600482018181528451602484015284516001600160a01b039094169363c47f002793869383926044909201919085019080838360005b83811015610648578181015183820152602001610630565b50505050905090810190601f1680156106755780820380516001836020036101000a031916815260200191505b5092505050602060405180830381600087803b15801561069457600080fd5b505af11580156106a8573d6000803e3d6000fd5b505050506040513d60208110156106be57600080fd5b50505050565b6000546001600160a01b031615610718576040805162461bcd60e51b8152602060048201526013602482015272185b1c9958591e481a5b9a5d1a585b1a5e9959606a1b604482015290519081900360640190fd5b600080546001600160a01b0319166001600160a01b0392909216919091179055565b828054600181600116156101000203166002900490600052602060002090601f016020900481019282601f1061077b57805160ff19168380011785556107a8565b828001600101855582156107a8579182015b828111156107a857825182559160200191906001019061078d565b506107b49291506107b8565b5090565b5b808211156107b457600081556001016107b956fea2646970667358221220d2b34187ab09e98b89d77588c079af93b8b4d5b067ee463dcbc2f15a416a33e864736f6c634300060c0033608060405234801561001057600080fd5b50610313806100206000396000f3fe6080604052600436106100225760003560e01c8063d1f578941461003957610031565b366100315761002f6100ef565b005b61002f6100ef565b61002f6004803603604081101561004f57600080fd5b6001600160a01b03823516919081019060408101602082013564010000000081111561007a57600080fd5b82018360208201111561008c57600080fd5b803590602001918460018302840111640100000000831117156100ae57600080fd5b91908080601f016020809104026020016040519081016040528093929190818152602001838380828437600092019190915250929550610109945050505050565b6100f7610107565b6101076101026101eb565b610210565b565b60006101136101eb565b6001600160a01b03161461012657600080fd5b61012f82610234565b8051156101e7576000826001600160a01b0316826040518082805190602001908083835b602083106101725780518252601f199092019160209182019101610153565b6001836020036101000a038019825116818451168082178552505050505050905001915050600060405180830381855af49150503d80600081146101d2576040519150601f19603f3d011682016040523d82523d6000602084013e6101d7565b606091505b50509050806101e557600080fd5b505b5050565b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c35490565b3660008037600080366000845af43d6000803e80801561022f573d6000f35b3d6000fd5b61023d8161029c565b6102785760405162461bcd60e51b815260040180806020018281038252603b8152602001806102a3603b913960400191505060405180910390fd5b7f7050c9e0f4ca769c69bd3a8ef740bc37934f8e2c036e5a723fd8ee048ed3f8c355565b3b15159056fe43616e6e6f742073657420612070726f787920696d706c656d656e746174696f6e20746f2061206e6f6e2d636f6e74726163742061646472657373a26469706673582212203178a2011c46abc2765f1016c5d417892138b904850d3e7866a1bfdfd1f3a76364736f6c634300060c0033"; public static final String FUNC_APPROVE = "approve"; @@ -141,6 +141,8 @@ public class WorkerpoolRegistry extends Contract { static { _addresses = new HashMap(); _addresses.put("1", "0xC76A18c78B7e530A165c5683CB1aB134E21938B4"); + _addresses.put("133", "0xC76A18c78B7e530A165c5683CB1aB134E21938B4"); + _addresses.put("134", "0xC76A18c78B7e530A165c5683CB1aB134E21938B4"); _addresses.put("3", "0xC76A18c78B7e530A165c5683CB1aB134E21938B4"); _addresses.put("4", "0xC76A18c78B7e530A165c5683CB1aB134E21938B4"); _addresses.put("5", "0xC76A18c78B7e530A165c5683CB1aB134E21938B4"); @@ -165,8 +167,8 @@ protected WorkerpoolRegistry(String contractAddress, Web3j web3j, TransactionMan super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider); } - public List getApprovalEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); + public static List getApprovalEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVAL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalEventResponse typedResponse = new ApprovalEventResponse(); @@ -200,8 +202,8 @@ public Flowable approvalEventFlowable(DefaultBlockParamet return approvalEventFlowable(filter); } - public List getApprovalForAllEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(APPROVALFORALL_EVENT, transactionReceipt); + public static List getApprovalForAllEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(APPROVALFORALL_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { ApprovalForAllEventResponse typedResponse = new ApprovalForAllEventResponse(); @@ -235,8 +237,8 @@ public Flowable approvalForAllEventFlowable(Default return approvalForAllEventFlowable(filter); } - public List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); + public static List getOwnershipTransferredEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(OWNERSHIPTRANSFERRED_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { OwnershipTransferredEventResponse typedResponse = new OwnershipTransferredEventResponse(); @@ -268,8 +270,8 @@ public Flowable ownershipTransferredEventFlow return ownershipTransferredEventFlowable(filter); } - public List getTransferEvents(TransactionReceipt transactionReceipt) { - List valueList = extractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); + public static List getTransferEvents(TransactionReceipt transactionReceipt) { + List valueList = staticExtractEventParametersWithLog(TRANSFER_EVENT, transactionReceipt); ArrayList responses = new ArrayList(valueList.size()); for (Contract.EventValuesWithLog eventValues : valueList) { TransferEventResponse typedResponse = new TransferEventResponse(); diff --git a/src/main/java/com/iexec/commons/poco/eip712/EIP712.java b/src/main/java/com/iexec/commons/poco/eip712/EIP712.java new file mode 100644 index 0000000..bf48cc1 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/EIP712.java @@ -0,0 +1,53 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import com.fasterxml.jackson.annotation.JsonProperty; +import org.web3j.crypto.ECKeyPair; + +import java.util.List; +import java.util.Map; + +@JsonIgnoreProperties(ignoreUnknown = true) +public interface EIP712 { + + @JsonProperty("types") + Map> getTypes(); + + @JsonProperty("domain") + EIP712Domain getDomain(); + + @JsonProperty("primaryType") + String getPrimaryType(); + + @JsonProperty("message") + M getMessage(); + + @JsonIgnore + String getMessageHash(); + + @JsonIgnore + List getMessageTypeParams(); + + @JsonIgnore + String getHash(); + + String signMessage(ECKeyPair ecKeyPair); + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/EIP712Domain.java b/src/main/java/com/iexec/commons/poco/eip712/EIP712Domain.java new file mode 100644 index 0000000..956ebab --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/EIP712Domain.java @@ -0,0 +1,125 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.fasterxml.jackson.annotation.JsonInclude; +import com.iexec.commons.poco.utils.HashUtils; +import lombok.Getter; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + +/** + * Represents the {@code EIP712Domain} part of an EIP-712 compliant data structure. + *

+ * This class allows to: + *

    + *
  • describe a domain with the correct fields + *
  • represent the domain structure as string like {@code EIP712Domain(string name,string version,unit256 chainId)} + *
  • compute the {@code domainSeparator}, the hash of the concatenation of the domain structure hash and the hash of field values + *
+ */ +@Slf4j +@Getter +public class EIP712Domain { + + public static final String primaryType = "EIP712Domain"; + + private final String name; + private final String version; + private final long chainId; + + @JsonInclude(value = JsonInclude.Include.NON_NULL) + private final String verifyingContract; + + public EIP712Domain() { + this("", "", 0L, null); + } + + public EIP712Domain(long chainId, String verifyingContract) { + this("iExecODB", "5.0.0", chainId, verifyingContract); + } + + public EIP712Domain(String name, String version, long chainId, String verifyingContract) { + this.name = name; + this.version = version; + this.chainId = chainId; + this.verifyingContract = verifyingContract; + } + + @JsonIgnore + public List getTypes() { + List types = new ArrayList<>( + Arrays.asList( + new TypeParam("name", "string"), + new TypeParam("version", "string"), + new TypeParam("chainId", "uint256") + ) + ); + + if (StringUtils.isNotEmpty(this.verifyingContract)) { + types.add(new TypeParam("verifyingContract", "address")); + } + return types; + } + + /** + * Gets the representation of the EIP712Domain instance. + * @return The {@code EIP712Domain(string name,string version,uint256 chainId,...)} string + */ + @JsonIgnore + public String getDomainType() { + return primaryType + "(" + + getTypes().stream().map(TypeParam::toDescription) + .collect(Collectors.joining(",")) + ")"; + } + + /** + * Gets the {@code domainSeparator} of an EIP-712 compliant data structure. + *

+ * It concatenates the hash of {@link #getDomainType()} and the hash of each field value for the current instance. + * The result of this concatenation is then hashed. + * @return The computed hash. + */ + @JsonIgnore + public String getDomainSeparator() { + String domainType = getDomainType(); + log.debug("{}", domainType); + log.debug("name {}, version {}, chainId {}, verifyingContract {}", name, version, chainId, verifyingContract); + + if (StringUtils.isNotEmpty(this.verifyingContract)) { + return HashUtils.concatenateAndHash( + EIP712Utils.encodeData(domainType), + EIP712Utils.encodeData(name), + EIP712Utils.encodeData(version), + EIP712Utils.encodeData(chainId), + EIP712Utils.encodeData(verifyingContract)); + } + + return HashUtils.concatenateAndHash( + EIP712Utils.encodeData(domainType), + EIP712Utils.encodeData(name), + EIP712Utils.encodeData(version), + EIP712Utils.encodeData(chainId)); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/EIP712Entity.java b/src/main/java/com/iexec/commons/poco/eip712/EIP712Entity.java new file mode 100644 index 0000000..f157c7a --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/EIP712Entity.java @@ -0,0 +1,101 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import com.iexec.commons.poco.utils.HashUtils; +import com.iexec.commons.poco.utils.SignatureUtils; +import lombok.NoArgsConstructor; +import lombok.extern.slf4j.Slf4j; +import org.web3j.crypto.ECKeyPair; + +import java.util.*; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +@Slf4j +@NoArgsConstructor +public abstract class EIP712Entity implements EIP712 { + + private Map> types; + private EIP712Domain domain; + private M message; + + protected EIP712Entity(EIP712Domain domain, M message) { + this.domain = domain; + this.message = message; + this.types = Map.of( + EIP712Domain.primaryType, domain.getTypes(), + getPrimaryType(), getMessageTypeParams() + ); + } + + @Override + public Map> getTypes() { + return new HashMap<>(types); + } + + @Override + public EIP712Domain getDomain() { + return domain; + } + + @Override + public M getMessage() { + return message; + } + + @Override + public String getHash() { + String domainSeparator = getDomain().getDomainSeparator(); + String messageHash = getMessageHash(); + log.info("domainSeparator {}", domainSeparator); + log.info("messageHash {}", messageHash); + String hash = HashUtils.concatenateAndHash( + "0x1901", + domainSeparator, + messageHash); + log.info("hash {}", hash); + return hash; + } + + public String hashMessageValues(Object... values) { + String type = getPrimaryType() + "(" + getMessageTypeParams().stream() + .map(TypeParam::toDescription) + .collect(Collectors.joining(",")) + ")"; + //MyEntity(address param1, string param2, ..) + String[] encodedValues = Stream.concat(Stream.of(type), Arrays.stream(values)) + .map(EIP712Utils::encodeData) + .toArray(String[]::new); + if (log.isDebugEnabled()) { + log.debug("{}", type); + for (String value : encodedValues) { + log.debug("{}", value); + } + } + return HashUtils.concatenateAndHash(encodedValues); + } + + public String signMessage(ECKeyPair ecKeyPair) { + return SignatureUtils.signAsString(this.getHash(), ecKeyPair); + } + + @JsonIgnore + public List getDomainTypeParams() { + return new ArrayList<>(types.get(EIP712Domain.primaryType)); + } +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/EIP712Utils.java b/src/main/java/com/iexec/commons/poco/eip712/EIP712Utils.java new file mode 100644 index 0000000..a5e51c0 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/EIP712Utils.java @@ -0,0 +1,80 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.iexec.commons.poco.utils.BytesUtils; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +/** + * See https://medium.com/metamask/eip712-is-coming-what-to-expect-and-how-to-use-it-bb92fd1a7a26 + */ +public class EIP712Utils { + + private EIP712Utils() { + throw new UnsupportedOperationException(); + } + + public static String encodeData(Object param) { + if (param.getClass().equals(String.class)) { + if (Numeric.containsHexPrefix((String) param)) { + return encodeHexString((String) param); // 0x < bytes32 + } else { + return encodeUTF8String((String) param); // ascii + } + } else if (param.getClass().equals(Long.class)) { + return encodeLong((Long) param); + } else if (param.getClass().equals(BigInteger.class)) { + return encodeBigInteger((BigInteger) param); + } else if (param.getClass().equals(byte[].class)) { + return encodeByteArray((byte[]) param); + } + return ""; + } + + static String encodeUTF8String(String string) { + return Hash.sha3String(string); + } + + static String encodeHexString(String hexString) { + if (!BytesUtils.isHexString(hexString)) { + return ""; + } + if (BytesUtils.stringToBytes(hexString).length > 32) { + return ""; + } + return Numeric.toHexString(Numeric.toBytesPadded(Numeric.toBigInt(hexString), 32)); + } + + static String encodeLong(Long longValue) { + return Numeric.toHexString(Numeric.toBytesPadded(BigInteger.valueOf(longValue), 32)); + } + + static String encodeBigInteger(BigInteger bigInteger) { + return Numeric.toHexString(Numeric.toBytesPadded(bigInteger, 32)); + } + + static String encodeByteArray(byte[] byteArray) { + if (byteArray == null || byteArray.length != BytesUtils.BYTES_32_SIZE) { + return ""; + } + return Numeric.toHexString(byteArray); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/OrderSigner.java b/src/main/java/com/iexec/commons/poco/eip712/OrderSigner.java new file mode 100644 index 0000000..a6aa9ec --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/OrderSigner.java @@ -0,0 +1,97 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.iexec.commons.poco.eip712.entity.EIP712AppOrder; +import com.iexec.commons.poco.eip712.entity.EIP712DatasetOrder; +import com.iexec.commons.poco.eip712.entity.EIP712RequestOrder; +import com.iexec.commons.poco.eip712.entity.EIP712WorkerpoolOrder; +import com.iexec.commons.poco.order.AppOrder; +import com.iexec.commons.poco.order.DatasetOrder; +import com.iexec.commons.poco.order.RequestOrder; +import com.iexec.commons.poco.order.WorkerpoolOrder; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; +import org.web3j.crypto.ECKeyPair; + +@Slf4j +public class OrderSigner { + + private final EIP712Domain eip712Domain; + private final ECKeyPair ecKeyPair; + + public OrderSigner( + int chainId, + String verifyingContract, + ECKeyPair ecKeyPair + ) { + this.ecKeyPair = ecKeyPair; + eip712Domain = new EIP712Domain(chainId, verifyingContract); + } + + public AppOrder signAppOrder(AppOrder appOrder) { + if (appOrder == null) { + return null; + } + String signature = new EIP712AppOrder(eip712Domain, appOrder) + .signMessage(ecKeyPair); + if (StringUtils.isEmpty(signature)) { + log.error("Empty signature [appOrder:{}]", appOrder); + return null; + } + return appOrder.withSignature(signature); + } + + public WorkerpoolOrder signWorkerpoolOrder(WorkerpoolOrder workerpoolOrder) { + if (workerpoolOrder == null) { + return null; + } + String signature = new EIP712WorkerpoolOrder(eip712Domain, workerpoolOrder) + .signMessage(ecKeyPair); + if (StringUtils.isEmpty(signature)) { + log.error("Empty signature [workerpoolOrder:{}]", workerpoolOrder); + return null; + } + return workerpoolOrder.withSignature(signature); + } + + public DatasetOrder signDatasetOrder(DatasetOrder datasetOrder) { + if (datasetOrder == null) { + return null; + } + String signature = new EIP712DatasetOrder(eip712Domain, datasetOrder) + .signMessage(ecKeyPair); + if (StringUtils.isEmpty(signature)) { + log.error("Empty signature [datasetOrder:{}]", datasetOrder); + return null; + } + return datasetOrder.withSignature(signature); + } + + public RequestOrder signRequestOrder(RequestOrder requestOrder) { + if (requestOrder == null) { + return null; + } + String signature = new EIP712RequestOrder(eip712Domain, requestOrder) + .signMessage(ecKeyPair); + if (StringUtils.isEmpty(signature)) { + log.error("Empty signature [requestOrder:{}]", requestOrder); + return null; + } + return requestOrder.withSignature(signature); + } +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/TypeParam.java b/src/main/java/com/iexec/commons/poco/eip712/TypeParam.java new file mode 100644 index 0000000..9e4d6c3 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/TypeParam.java @@ -0,0 +1,45 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Describe a single member of a struct in an EIP-712 compliant data types description. + *

+ * This is part of {@code typeHash = keccak256(encodeType(typeOf(s)))} where {@code encodeType} is + * {@code structName(paramType<1> paramName<1>,...,paramType paramName)}. + */ +@Data +@NoArgsConstructor +@AllArgsConstructor +public class TypeParam { + + private String name; + private String type; + + /** + * Gets the description of a single parameter as a String. + * @return The {@code " "} string + */ + public String toDescription() { + return type + " " + name; + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/entity/Challenge.java b/src/main/java/com/iexec/commons/poco/eip712/entity/Challenge.java new file mode 100644 index 0000000..83a8ae1 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/entity/Challenge.java @@ -0,0 +1,33 @@ +/* + * Copyright 2022-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import lombok.AllArgsConstructor; +import lombok.Builder; +import lombok.Data; +import lombok.NoArgsConstructor; + +/** + * Represents the Challenge type in an EIP-712 compliant challenge. + */ +@Data +@Builder +@AllArgsConstructor +@NoArgsConstructor +public class Challenge { + private String challenge; +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712AppOrder.java b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712AppOrder.java new file mode 100644 index 0000000..8c35990 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712AppOrder.java @@ -0,0 +1,69 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.eip712.EIP712Entity; +import com.iexec.commons.poco.eip712.TypeParam; +import com.iexec.commons.poco.order.AppOrder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Arrays; +import java.util.List; + +@Getter +@NoArgsConstructor +public class EIP712AppOrder extends EIP712Entity { + + public EIP712AppOrder(EIP712Domain domain, AppOrder appOrder) { + super(domain, appOrder); + } + + @Override + public String getPrimaryType() { + return "AppOrder"; + } + + @Override + public List getMessageTypeParams() { + return Arrays.asList( + new TypeParam("app", "address"), + new TypeParam("appprice", "uint256"), + new TypeParam("volume", "uint256"), + new TypeParam("tag", "bytes32"), + new TypeParam("datasetrestrict", "address"), + new TypeParam("workerpoolrestrict", "address"), + new TypeParam("requesterrestrict", "address"), + new TypeParam("salt", "bytes32")); + } + + @Override + public String getMessageHash() { + return hashMessageValues( + getMessage().getApp(), + getMessage().getAppprice(), + getMessage().getVolume(), + getMessage().getTag(), + getMessage().getDatasetrestrict(), + getMessage().getWorkerpoolrestrict(), + getMessage().getRequesterrestrict(), + getMessage().getSalt() + ); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712Challenge.java b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712Challenge.java new file mode 100644 index 0000000..cc774e5 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712Challenge.java @@ -0,0 +1,58 @@ +/* + * Copyright 2022-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.eip712.EIP712Entity; +import com.iexec.commons.poco.eip712.TypeParam; +import lombok.NoArgsConstructor; + +import java.util.Collections; +import java.util.List; + +/** + * EIP-712 compliant challenge based on {@link Challenge} type and {@link EIP712Domain}. + *

+ * In the current implementation, {@link EIP712Domain} fields are {@code name}, {@code version} and {@code chainID}. + * There is no {@code verifyingContract}. + */ +@NoArgsConstructor +public class EIP712Challenge extends EIP712Entity { + + public EIP712Challenge(EIP712Domain domain, Challenge message) { + super(domain, message); + } + + public String getPrimaryType() { + return "Challenge"; + } + + @Override + public List getMessageTypeParams() { + return Collections.singletonList( + new TypeParam("challenge", "string") + ); + } + + @Override + public String getMessageHash() { + return hashMessageValues( + getMessage().getChallenge() + ); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712DatasetOrder.java b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712DatasetOrder.java new file mode 100644 index 0000000..8af34d6 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712DatasetOrder.java @@ -0,0 +1,69 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.eip712.EIP712Entity; +import com.iexec.commons.poco.eip712.TypeParam; +import com.iexec.commons.poco.order.DatasetOrder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Arrays; +import java.util.List; + +@Getter +@NoArgsConstructor +public class EIP712DatasetOrder extends EIP712Entity { + + public EIP712DatasetOrder(EIP712Domain domain, DatasetOrder datasetOrder) { + super(domain, datasetOrder); + } + + @Override + public String getPrimaryType() { + return "DatasetOrder"; + } + + @Override + public List getMessageTypeParams() { + return Arrays.asList( + new TypeParam("dataset", "address"), + new TypeParam("datasetprice", "uint256"), + new TypeParam("volume", "uint256"), + new TypeParam("tag", "bytes32"), + new TypeParam("apprestrict", "address"), + new TypeParam("workerpoolrestrict", "address"), + new TypeParam("requesterrestrict", "address"), + new TypeParam("salt", "bytes32")); + } + + @Override + public String getMessageHash() { + return hashMessageValues( + getMessage().getDataset(), + getMessage().getDatasetprice(), + getMessage().getVolume(), + getMessage().getTag(), + getMessage().getApprestrict(), + getMessage().getWorkerpoolrestrict(), + getMessage().getRequesterrestrict(), + getMessage().getSalt() + ); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712RequestOrder.java b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712RequestOrder.java new file mode 100644 index 0000000..44c5a66 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712RequestOrder.java @@ -0,0 +1,83 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.eip712.EIP712Entity; +import com.iexec.commons.poco.eip712.TypeParam; +import com.iexec.commons.poco.order.RequestOrder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Arrays; +import java.util.List; + +@Getter +@NoArgsConstructor +public class EIP712RequestOrder extends EIP712Entity { + + public EIP712RequestOrder(EIP712Domain domain, RequestOrder requestOrder) { + super(domain, requestOrder); + } + + @Override + public String getPrimaryType() { + return "RequestOrder"; + } + + @Override + public List getMessageTypeParams() { + return Arrays.asList( + new TypeParam("app", "address"), + new TypeParam("appmaxprice", "uint256"), + new TypeParam("dataset", "address"), + new TypeParam("datasetmaxprice", "uint256"), + new TypeParam("workerpool", "address"), + new TypeParam("workerpoolmaxprice", "uint256"), + new TypeParam("requester", "address"), + new TypeParam("volume", "uint256"), + new TypeParam("tag", "bytes32"), + new TypeParam("category", "uint256"), + new TypeParam("trust", "uint256"), + new TypeParam("beneficiary", "address"), + new TypeParam("callback", "address"), + new TypeParam("params", "string"), + new TypeParam("salt", "bytes32")); + } + + @Override + public String getMessageHash() { + return hashMessageValues( + getMessage().getApp(), + getMessage().getAppmaxprice(), + getMessage().getDataset(), + getMessage().getDatasetmaxprice(), + getMessage().getWorkerpool(), + getMessage().getWorkerpoolmaxprice(), + getMessage().getRequester(), + getMessage().getVolume(), + getMessage().getTag(), + getMessage().getCategory(), + getMessage().getTrust(), + getMessage().getBeneficiary(), + getMessage().getCallback(), + getMessage().getParams(), + getMessage().getSalt() + ); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712WorkerpoolOrder.java b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712WorkerpoolOrder.java new file mode 100644 index 0000000..9c40604 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/eip712/entity/EIP712WorkerpoolOrder.java @@ -0,0 +1,73 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.eip712.EIP712Entity; +import com.iexec.commons.poco.eip712.TypeParam; +import com.iexec.commons.poco.order.WorkerpoolOrder; +import lombok.Getter; +import lombok.NoArgsConstructor; + +import java.util.Arrays; +import java.util.List; + +@Getter +@NoArgsConstructor +public class EIP712WorkerpoolOrder extends EIP712Entity { + + public EIP712WorkerpoolOrder(EIP712Domain domain, WorkerpoolOrder workerpoolOrder) { + super(domain, workerpoolOrder); + } + + @Override + public String getPrimaryType() { + return "WorkerpoolOrder"; + } + + @Override + public List getMessageTypeParams() { + return Arrays.asList( + new TypeParam("workerpool", "address"), + new TypeParam("workerpoolprice", "uint256"), + new TypeParam("volume", "uint256"), + new TypeParam("tag", "bytes32"), + new TypeParam("category", "uint256"), + new TypeParam("trust", "uint256"), + new TypeParam("apprestrict", "address"), + new TypeParam("datasetrestrict", "address"), + new TypeParam("requesterrestrict", "address"), + new TypeParam("salt", "bytes32")); + } + + @Override + public String getMessageHash() { + return hashMessageValues( + getMessage().getWorkerpool(), + getMessage().getWorkerpoolprice(), + getMessage().getVolume(), + getMessage().getTag(), + getMessage().getCategory(), + getMessage().getTrust(), + getMessage().getApprestrict(), + getMessage().getDatasetrestrict(), + getMessage().getRequesterrestrict(), + getMessage().getSalt() + ); + } + +} diff --git a/src/main/java/com/iexec/commons/poco/notification/TaskNotificationType.java b/src/main/java/com/iexec/commons/poco/notification/TaskNotificationType.java index 1569119..f0ea251 100644 --- a/src/main/java/com/iexec/commons/poco/notification/TaskNotificationType.java +++ b/src/main/java/com/iexec/commons/poco/notification/TaskNotificationType.java @@ -19,15 +19,16 @@ public enum TaskNotificationType { PLEASE_CONTINUE, - PLEASE_WAIT, // subscribe & do nothing (wait) + PLEASE_WAIT, // subscribe & do nothing (wait) PLEASE_START, PLEASE_DOWNLOAD_APP, PLEASE_DOWNLOAD_DATA, PLEASE_COMPUTE, - PLEASE_CONTRIBUTE, // subscribe & contribute if result found, else compute - PLEASE_REVEAL, // subscribe & reveal - PLEASE_UPLOAD, // subscribe & upload result - PLEASE_COMPLETE, // complete + unsubscribe - PLEASE_ABORT, // abort + unsubscribe + PLEASE_CONTRIBUTE, // subscribe & contribute if result found, else compute + PLEASE_REVEAL, // subscribe & reveal + PLEASE_UPLOAD, // subscribe & upload result + PLEASE_CONTRIBUTE_AND_FINALIZE, // contribute & finalize on-chain + PLEASE_COMPLETE, // complete + unsubscribe + PLEASE_ABORT, // abort + unsubscribe } diff --git a/src/main/java/com/iexec/commons/poco/order/AppOrder.java b/src/main/java/com/iexec/commons/poco/order/AppOrder.java new file mode 100644 index 0000000..d86e10b --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/order/AppOrder.java @@ -0,0 +1,87 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.Value; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +@Value +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@JsonDeserialize(builder = AppOrder.AppOrderBuilder.class) +public class AppOrder extends Order { + + String app; + BigInteger appprice; + String datasetrestrict; + String workerpoolrestrict; + String requesterrestrict; + + @Builder + AppOrder( + String app, + BigInteger appprice, + BigInteger volume, + String tag, + String datasetrestrict, + String workerpoolrestrict, + String requesterrestrict, + String salt, + String sign) { + super(volume, tag, salt, sign); + this.app = app; + this.appprice = appprice; + this.datasetrestrict = toLowerCase(datasetrestrict); + this.workerpoolrestrict = toLowerCase(workerpoolrestrict); + this.requesterrestrict = toLowerCase(requesterrestrict); + } + + @JsonPOJOBuilder(withPrefix = "") + public static class AppOrderBuilder{} + + @Override + public AppOrder withSignature(String signature) { + return new AppOrder( + this.app, this.appprice, + this.volume, this.tag, + this.datasetrestrict, this.workerpoolrestrict, this.requesterrestrict, + this.salt, signature + ); + } + + public IexecHubContract.AppOrder toHubContract() { + return new IexecHubContract.AppOrder( + this.app, + this.appprice, + this.volume, + Numeric.hexStringToByteArray(this.tag), + this.datasetrestrict, + this.workerpoolrestrict, + this.requesterrestrict, + Numeric.hexStringToByteArray(this.salt), + Numeric.hexStringToByteArray(this.sign) + ); + } +} diff --git a/src/main/java/com/iexec/commons/poco/order/DatasetOrder.java b/src/main/java/com/iexec/commons/poco/order/DatasetOrder.java new file mode 100644 index 0000000..f301f7d --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/order/DatasetOrder.java @@ -0,0 +1,86 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.Value; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +@Value +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@JsonDeserialize(builder = DatasetOrder.DatasetOrderBuilder.class) +public class DatasetOrder extends Order { + + String dataset; + BigInteger datasetprice; + String apprestrict; + String workerpoolrestrict; + String requesterrestrict; + + @Builder + DatasetOrder( + String dataset, + BigInteger datasetprice, + BigInteger volume, + String tag, + String apprestrict, + String workerpoolrestrict, + String requesterrestrict, + String salt, + String sign) { + super(volume, tag, salt, sign); + this.dataset = dataset; + this.datasetprice = datasetprice; + this.apprestrict = toLowerCase(apprestrict); + this.workerpoolrestrict = toLowerCase(workerpoolrestrict); + this.requesterrestrict = toLowerCase(requesterrestrict); + } + + @JsonPOJOBuilder(withPrefix = "") + public static class DatasetOrderBuilder{} + + public DatasetOrder withSignature(String signature) { + return new DatasetOrder( + this.dataset, this.datasetprice, + this.volume, this.tag, + this.apprestrict, this.workerpoolrestrict, this.requesterrestrict, + this.salt, signature + ); + } + + public IexecHubContract.DatasetOrder toHubContract() { + return new IexecHubContract.DatasetOrder( + this.dataset, + this.datasetprice, + this.volume, + Numeric.hexStringToByteArray(this.tag), + this.apprestrict, + this.workerpoolrestrict, + this.requesterrestrict, + Numeric.hexStringToByteArray(this.salt), + Numeric.hexStringToByteArray(this.sign) + ); + } +} diff --git a/src/main/java/com/iexec/commons/poco/order/Order.java b/src/main/java/com/iexec/commons/poco/order/Order.java new file mode 100644 index 0000000..8d4e6d0 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/order/Order.java @@ -0,0 +1,51 @@ +/* + * Copyright 2020 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.annotation.JsonIgnore; +import lombok.AccessLevel; +import lombok.AllArgsConstructor; +import lombok.Getter; + +import java.math.BigInteger; + +@Getter +@AllArgsConstructor(access = AccessLevel.PROTECTED) +public abstract class Order { + + protected final BigInteger volume; + protected final String tag; + protected final String salt; + protected final String sign; + + @JsonIgnore + public boolean isSigned() { + return sign != null && !sign.isEmpty(); + } + + /** + * Converts all characters to Lowercase or returns empty + * @param s String to convert + * @return the String, converted to lowercase or an empty string + */ + public String toLowerCase(String s) { + return s != null ? s.toLowerCase() : ""; + } + + public abstract Order withSignature(String signature); + +} diff --git a/src/main/java/com/iexec/commons/poco/order/OrderTag.java b/src/main/java/com/iexec/commons/poco/order/OrderTag.java new file mode 100644 index 0000000..6fbf0a0 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/order/OrderTag.java @@ -0,0 +1,41 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.iexec.commons.poco.tee.TeeUtils; +import com.iexec.commons.poco.utils.BytesUtils; +import lombok.Getter; + +@Getter +public enum OrderTag { + + STANDARD(BytesUtils.EMPTY_HEX_STRING_32), + TEE_SCONE(TeeUtils.TEE_SCONE_ONLY_TAG), + TEE_GRAMINE(TeeUtils.TEE_GRAMINE_ONLY_TAG); + + private final String value; + + OrderTag(String value) { + this.value = value; + } + + @Override + public String toString() { + return this.value; + } + +} diff --git a/src/main/java/com/iexec/commons/poco/order/RequestOrder.java b/src/main/java/com/iexec/commons/poco/order/RequestOrder.java new file mode 100644 index 0000000..d9fd86a --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/order/RequestOrder.java @@ -0,0 +1,116 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.Value; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +@Value +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@JsonDeserialize(builder = RequestOrder.RequestOrderBuilder.class) +public class RequestOrder extends Order { + + String app; + BigInteger appmaxprice; + String dataset; + BigInteger datasetmaxprice; + String workerpool; + BigInteger workerpoolmaxprice; + String requester; + BigInteger category; + BigInteger trust; + String beneficiary; + String callback; + String params; + + @Builder + RequestOrder( + String app, + BigInteger appmaxprice, + String dataset, + BigInteger datasetmaxprice, + String workerpool, + BigInteger workerpoolmaxprice, + String requester, + BigInteger volume, + String tag, + BigInteger category, + BigInteger trust, + String beneficiary, + String callback, + String params, + String salt, + String sign) { + super(volume, tag, salt, sign); + this.app = toLowerCase(app); + this.appmaxprice = appmaxprice; + this.dataset = toLowerCase(dataset); + this.datasetmaxprice = datasetmaxprice; + this.workerpool = toLowerCase(workerpool); + this.workerpoolmaxprice = workerpoolmaxprice; + this.requester = toLowerCase(requester); + this.category = category; + this.trust = trust; + this.beneficiary = toLowerCase(beneficiary); + this.callback = toLowerCase(callback); + this.params = params; + } + + @JsonPOJOBuilder(withPrefix = "") + public static class RequestOrderBuilder{} + + @Override + public RequestOrder withSignature(String signature) { + return new RequestOrder( + this.app, this.appmaxprice, + this.dataset, this.datasetmaxprice, + this.workerpool, this.workerpoolmaxprice, + this.requester, this.volume, this.tag, this.category, + this.trust, this.beneficiary, this.callback, this.params, this.salt, signature + ); + } + + public IexecHubContract.RequestOrder toHubContract() { + return new IexecHubContract.RequestOrder( + this.app, + this.appmaxprice, + this.dataset, + this.datasetmaxprice, + this.workerpool, + this.workerpoolmaxprice, + this.requester, + this.volume, + Numeric.hexStringToByteArray(this.tag), + this.category, + this.trust, + this.beneficiary, + this.callback, + this.params, + Numeric.hexStringToByteArray(this.salt), + Numeric.hexStringToByteArray(this.sign) + ); + } +} diff --git a/src/main/java/com/iexec/commons/poco/order/WorkerpoolOrder.java b/src/main/java/com/iexec/commons/poco/order/WorkerpoolOrder.java new file mode 100644 index 0000000..5504632 --- /dev/null +++ b/src/main/java/com/iexec/commons/poco/order/WorkerpoolOrder.java @@ -0,0 +1,95 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.databind.annotation.JsonDeserialize; +import com.fasterxml.jackson.databind.annotation.JsonPOJOBuilder; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import lombok.Builder; +import lombok.EqualsAndHashCode; +import lombok.ToString; +import lombok.Value; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +@Value +@EqualsAndHashCode(callSuper = true) +@ToString(callSuper = true) +@JsonDeserialize(builder = WorkerpoolOrder.WorkerpoolOrderBuilder.class) +public class WorkerpoolOrder extends Order { + + String workerpool; + BigInteger workerpoolprice; + BigInteger trust; + BigInteger category; + String apprestrict; + String datasetrestrict; + String requesterrestrict; + + @Builder + WorkerpoolOrder( + String workerpool, + BigInteger workerpoolprice, + BigInteger volume, + String tag, + BigInteger category, + BigInteger trust, + String apprestrict, + String datasetrestrict, + String requesterrestrict, + String salt, + String sign) { + super(volume, tag, salt, sign); + this.workerpool = workerpool; + this.workerpoolprice = workerpoolprice; + this.category = category; + this.trust = trust; + this.apprestrict = toLowerCase(apprestrict); + this.datasetrestrict = toLowerCase(datasetrestrict); + this.requesterrestrict = toLowerCase(requesterrestrict); + } + + @JsonPOJOBuilder(withPrefix = "") + public static class WorkerpoolOrderBuilder{} + + @Override + public WorkerpoolOrder withSignature(String signature) { + return new WorkerpoolOrder( + this.workerpool, this.workerpoolprice, + this.volume, this.tag, this.category, this.trust, + this.apprestrict, this.datasetrestrict, this.requesterrestrict, + this.salt, signature + ); + } + + public IexecHubContract.WorkerpoolOrder toHubContract() { + return new IexecHubContract.WorkerpoolOrder( + this.workerpool, + this.workerpoolprice, + this.volume, + Numeric.hexStringToByteArray(this.tag), + this.category, + this.trust, + this.apprestrict, + this.datasetrestrict, + this.requesterrestrict, + Numeric.hexStringToByteArray(this.salt), + Numeric.hexStringToByteArray(this.sign) + ); + } +} diff --git a/src/test/java/com/iexec/commons/poco/chain/Web3jAbstractServiceTest.java b/src/test/java/com/iexec/commons/poco/chain/Web3jAbstractServiceTest.java index d099cd1..a6da5d9 100644 --- a/src/test/java/com/iexec/commons/poco/chain/Web3jAbstractServiceTest.java +++ b/src/test/java/com/iexec/commons/poco/chain/Web3jAbstractServiceTest.java @@ -20,6 +20,7 @@ import java.math.BigInteger; +import static com.iexec.commons.poco.chain.Web3jAbstractService.GAS_LIMIT_CAP; import static com.iexec.commons.poco.contract.generated.DatasetRegistry.FUNC_CREATEDATASET; import static com.iexec.commons.poco.contract.generated.IexecHubContract.*; import static org.junit.jupiter.api.Assertions.assertEquals; @@ -40,7 +41,7 @@ void getGasLimitForFunction() { BigInteger.valueOf(100000)); assertEquals(Web3jAbstractService .getGasLimitForFunction(FUNC_FINALIZE), - BigInteger.valueOf(3000000)); + BigInteger.valueOf(300000)); assertEquals(Web3jAbstractService .getGasLimitForFunction(FUNC_REOPEN), BigInteger.valueOf(500000)); @@ -49,7 +50,7 @@ void getGasLimitForFunction() { BigInteger.valueOf(700000)); assertEquals(Web3jAbstractService .getGasLimitForFunction("randomfunction"), - BigInteger.valueOf(500000)); + BigInteger.valueOf(GAS_LIMIT_CAP)); } -} \ No newline at end of file +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/EIP712DomainTest.java b/src/test/java/com/iexec/commons/poco/eip712/EIP712DomainTest.java new file mode 100644 index 0000000..443f6ad --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/EIP712DomainTest.java @@ -0,0 +1,92 @@ +/* + * Copyright 2021-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.utils.HashUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; +import java.nio.charset.StandardCharsets; + +import static org.assertj.core.api.Assertions.assertThat; + +class EIP712DomainTest { + + private static final String DOMAIN_NAME = "iExec Custom Module Domain"; + private static final String DOMAIN_VERSION = "1"; + private static final long DOMAIN_CHAIN_ID = 2; + private static final String DOMAIN_VERIFYING_CONTRACT = "0x0000000000000000000000000000000000000001"; + private static final ObjectMapper mapper = new ObjectMapper(); + + @Test + void shouldGetDomainWithVerifyingContract() throws JsonProcessingException { + EIP712Domain domain = new EIP712Domain(DOMAIN_NAME, DOMAIN_VERSION, DOMAIN_CHAIN_ID, DOMAIN_VERIFYING_CONTRACT); + String jsonString = mapper.writeValueAsString(domain); + assertThat(jsonString) + .isEqualTo("{" + + "\"name\":\"iExec Custom Module Domain\"," + + "\"version\":\"1\"," + + "\"chainId\":2," + + "\"verifyingContract\":\"0x0000000000000000000000000000000000000001\"}"); + assertThat(domain.getDomainType()) + .isEqualTo("EIP712Domain(string name,string version,uint256 chainId,address verifyingContract)"); + String domainSeparator = HashUtils.concatenateAndHash( + Numeric.toHexString(Hash.sha3(domain.getDomainType().getBytes(StandardCharsets.UTF_8))), + Numeric.toHexString(Hash.sha3(domain.getName().getBytes(StandardCharsets.UTF_8))), + Numeric.toHexString(Hash.sha3(domain.getVersion().getBytes(StandardCharsets.UTF_8))), + Numeric.toHexString(Numeric.toBytesPadded(BigInteger.valueOf(domain.getChainId()), 32)), + Numeric.toHexString(Numeric.toBytesPadded(Numeric.toBigInt(domain.getVerifyingContract()), 32))); + assertThat(domain.getDomainSeparator()) + .isEqualTo(domainSeparator) + .isEqualTo("0xb3b1dcc957351eff67866cbc947be104a71d09ff7e146a2c42e8f7edc2bf501c"); + EIP712Domain deserializedDomain = mapper.readValue(jsonString, EIP712Domain.class); + assertThat(deserializedDomain) + .usingRecursiveComparison() + .isEqualTo(domain); + } + + @Test + void shouldGetDomainWithoutVerifyingContract() throws JsonProcessingException { + EIP712Domain domain = new EIP712Domain(DOMAIN_NAME, DOMAIN_VERSION, DOMAIN_CHAIN_ID, null); + String jsonString = mapper.writeValueAsString(domain); + assertThat(jsonString) + .isEqualTo("{" + + "\"name\":\"iExec Custom Module Domain\"," + + "\"version\":\"1\"," + + "\"chainId\":2" + + "}"); + assertThat(domain.getDomainType()) + .isEqualTo("EIP712Domain(string name,string version,uint256 chainId)"); + String domainSeparator = HashUtils.concatenateAndHash( + Numeric.toHexString(Hash.sha3(domain.getDomainType().getBytes(StandardCharsets.UTF_8))), + Numeric.toHexString(Hash.sha3(domain.getName().getBytes(StandardCharsets.UTF_8))), + Numeric.toHexString(Hash.sha3(domain.getVersion().getBytes(StandardCharsets.UTF_8))), + Numeric.toHexString(Numeric.toBytesPadded(BigInteger.valueOf(domain.getChainId()), 32))); + assertThat(domain.getDomainSeparator()) + .isEqualTo(domainSeparator) + .isEqualTo("0xc1ca0800eccc218e09b4b90ca3ba732ee9a923d115f880316caf56c466c0bc34"); + EIP712Domain deserializedDomain = mapper.readValue(jsonString, EIP712Domain.class); + assertThat(deserializedDomain) + .usingRecursiveComparison() + .isEqualTo(domain); + } + +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/EIP712UtilsTest.java b/src/test/java/com/iexec/commons/poco/eip712/EIP712UtilsTest.java new file mode 100644 index 0000000..7a4ae71 --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/EIP712UtilsTest.java @@ -0,0 +1,92 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.iexec.commons.poco.utils.BytesUtils; +import org.assertj.core.api.Assertions; +import org.junit.jupiter.api.Test; + +import java.math.BigInteger; + +class EIP712UtilsTest { + + @Test + void encodeUTF8String() { + String someText = "some text"; + Assertions.assertThat(EIP712Utils.encodeData(someText)) + .isEqualTo(EIP712Utils.encodeUTF8String(someText)) + .isEqualTo("0x46ba1b442d3606a3437800ee7ae5a0249756405e676739b46aa8f6e85b13fe2b"); + } + + @Test + void encodeHexString() { + String param = "0x000000000000000000000000000000000000000000000000000000000000000a"; + Assertions.assertThat(EIP712Utils.encodeData(param)) + .isEqualTo(EIP712Utils.encodeHexString(param)) + .isEqualTo(param); + } + + @Test + void encodeHexStringIfLowerThanBytes32() { + String param = "0x0a"; + Assertions.assertThat(EIP712Utils.encodeData(param)) + .isEqualTo(EIP712Utils.encodeHexString(param)) + .isEqualTo("0x000000000000000000000000000000000000000000000000000000000000000a"); + } + + @Test + void shouldNotEncodeHexStringSinceNotHex() { + String param = "xyz"; + Assertions.assertThat(EIP712Utils.encodeHexString(param)).isEmpty(); + } + + @Test + void shouldNotEncodeHexStringSinceMoreThanBytes32() { + String param = "0x000000000000000000000000000000000000000000000000000000000000000a" + "0b"; + Assertions.assertThat(EIP712Utils.encodeHexString(param)).isEmpty(); + } + + @Test + void encodeLong() { + Long param = 11L; + Assertions.assertThat(EIP712Utils.encodeData(param)) + .isEqualTo(EIP712Utils.encodeLong(param)) + .isEqualTo("0x000000000000000000000000000000000000000000000000000000000000000b"); + } + + @Test + void encodeBigInteger() { + BigInteger param = BigInteger.valueOf(12); + Assertions.assertThat(EIP712Utils.encodeData(param)) + .isEqualTo(EIP712Utils.encodeBigInteger(param)) + .isEqualTo("0x000000000000000000000000000000000000000000000000000000000000000c"); + } + + @Test + void encodeByteArray() { + String param = "0x000000000000000000000000000000000000000000000000000000000000000d"; + Assertions.assertThat(EIP712Utils.encodeData(BytesUtils.stringToBytes(param))) + .isEqualTo(EIP712Utils.encodeByteArray(BytesUtils.stringToBytes(param))) + .isEqualTo(param); + } + + @Test + void shouldNotEncodeByteArraySinceNotBytes32() { + String param = "0x0a"; + Assertions.assertThat(EIP712Utils.encodeByteArray(BytesUtils.stringToBytes(param))).isEmpty(); + } +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/OrderSignerTests.java b/src/test/java/com/iexec/commons/poco/eip712/OrderSignerTests.java new file mode 100644 index 0000000..39a5946 --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/OrderSignerTests.java @@ -0,0 +1,142 @@ +/* + * Copyright 2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712; + +import com.iexec.commons.poco.order.AppOrder; +import com.iexec.commons.poco.order.DatasetOrder; +import com.iexec.commons.poco.order.RequestOrder; +import com.iexec.commons.poco.order.WorkerpoolOrder; +import lombok.SneakyThrows; +import org.junit.jupiter.api.BeforeEach; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.ECKeyPair; +import org.web3j.crypto.Keys; + +import java.math.BigInteger; + +import static org.assertj.core.api.Assertions.assertThat; +import static org.assertj.core.api.Assertions.assertThatThrownBy; + +class OrderSignerTests { + + private OrderSigner orderSigner; + + @BeforeEach + @SneakyThrows + public void init() { + ECKeyPair ecKeyPair = Keys.createEcKeyPair(); + orderSigner = new OrderSigner(65535, "0x1", ecKeyPair); + } + + @Test + void shouldNotSignNullOrders() { + assertThat(orderSigner.signAppOrder(null)).isNull(); + assertThat(orderSigner.signDatasetOrder(null)).isNull(); + assertThat(orderSigner.signRequestOrder(null)).isNull(); + assertThat(orderSigner.signWorkerpoolOrder(null)).isNull(); + } + + @Test + void shouldNotSignEmptyOrders() { + AppOrder appOrder = AppOrder.builder().build(); + assertThatThrownBy(() -> orderSigner.signAppOrder(appOrder)) + .isInstanceOf(NullPointerException.class); + DatasetOrder datasetOrder = DatasetOrder.builder().build(); + assertThatThrownBy(() -> orderSigner.signDatasetOrder(datasetOrder)) + .isInstanceOf(NullPointerException.class); + RequestOrder requestOrder = RequestOrder.builder().build(); + assertThatThrownBy(() -> orderSigner.signRequestOrder(requestOrder)) + .isInstanceOf(NullPointerException.class); + WorkerpoolOrder workerpoolOrder = WorkerpoolOrder.builder().build(); + assertThatThrownBy(() -> orderSigner.signWorkerpoolOrder(workerpoolOrder)) + .isInstanceOf(NullPointerException.class); + } + + @Test + void shouldSignAppOrder() { + AppOrder appOrder = AppOrder.builder() + .app("") + .appprice(BigInteger.TEN) + .volume(BigInteger.ONE) + .tag("") + .datasetrestrict("") + .requesterrestrict("") + .workerpoolrestrict("") + .salt("") + .sign("") + .build(); + assertThat(orderSigner.signAppOrder(appOrder)).isNotNull(); + } + + @Test + void shouldSignDatasetOrder() { + DatasetOrder datasetOrder = DatasetOrder.builder() + .dataset("") + .datasetprice(BigInteger.TEN) + .volume(BigInteger.ONE) + .tag("") + .apprestrict("") + .requesterrestrict("") + .workerpoolrestrict("") + .salt("") + .sign("") + .build(); + assertThat(orderSigner.signDatasetOrder(datasetOrder)).isNotNull(); + } + + @Test + void shouldSignRequestOrder() { + RequestOrder requestOrder = RequestOrder.builder() + .app("") + .appmaxprice(BigInteger.TEN) + .dataset("") + .datasetmaxprice(BigInteger.TEN) + .workerpool("") + .workerpoolmaxprice(BigInteger.TEN) + .requester("") + .volume(BigInteger.ONE) + .tag("") + .category(BigInteger.ZERO) + .trust(BigInteger.ONE) + .beneficiary("") + .callback("") + .params("") + .salt("") + .sign("") + .build(); + assertThat(orderSigner.signRequestOrder(requestOrder)).isNotNull(); + } + + @Test + void shouldSignWorkerpoolOrder() { + WorkerpoolOrder workerpoolOrder = WorkerpoolOrder.builder() + .workerpool("") + .workerpoolprice(BigInteger.TEN) + .volume(BigInteger.ONE) + .tag("") + .category(BigInteger.ZERO) + .trust(BigInteger.ONE) + .apprestrict("") + .datasetrestrict("") + .requesterrestrict("") + .salt("") + .sign("") + .build(); + assertThat(orderSigner.signWorkerpoolOrder(workerpoolOrder)).isNotNull(); + } + +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712AppOrderTest.java b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712AppOrderTest.java new file mode 100644 index 0000000..2201457 --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712AppOrderTest.java @@ -0,0 +1,86 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.order.AppOrder; +import com.iexec.commons.poco.utils.BytesUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.CipherException; +import org.web3j.crypto.ECKeyPair; +import org.web3j.crypto.WalletUtils; + +import java.io.IOException; +import java.math.BigInteger; + +import static org.assertj.core.api.Assertions.assertThat; + +class EIP712AppOrderTest { + + private final ObjectMapper mapper = new ObjectMapper(); + private final EIP712Domain DOMAIN = new EIP712Domain(133, "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f"); + private final AppOrder APP_ORDER = AppOrder.builder() + .app("0x2EbD509d777B187E8394566bA6ec093B9dd73DF1") + .appprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag("0x0000000000000000000000000000000000000000000000000000000000000000") + .datasetrestrict(BytesUtils.EMPTY_ADDRESS) + .workerpoolrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt("0xbe858b0eee90cf2e85297bd3df81373f6b4de20c67a3e1f5db1a9d5be8abc3c4") + .build(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + EIP712AppOrder eip712AppOrder = new EIP712AppOrder(DOMAIN, APP_ORDER); + String jsonString = mapper.writeValueAsString(eip712AppOrder); + EIP712AppOrder deserializedEip712AppOrder = mapper.readValue(jsonString, EIP712AppOrder.class); + assertThat(deserializedEip712AppOrder).usingRecursiveComparison().isEqualTo(eip712AppOrder); + } + + /** + * Expected signature string could also be found with: + *

+ * iexec order sign --app --chain 133 \ + * --keystoredir /home/$USER/iexecdev/iexec-common/src/test/resources/ \ + * --wallet-file wallet.json --password whatever + *

+ * Note: Don't forget to update salt + */ + @Test + void signAppOrderEIP712() { + EIP712AppOrder eip712AppOrder = new EIP712AppOrder(DOMAIN, APP_ORDER); + String signatureString = eip712AppOrder.signMessage(getWallet()); + assertThat(signatureString) + .isEqualTo("0x82c2d8a5f59f1088eb0b9a627c367ae7dae1772c8bd98c394699ae24830611e1171026f4e28d2c60302c34a04c60c4fc2f1363e165072dca04a9f203734978671c"); + } + + private ECKeyPair getWallet() { + try { + return WalletUtils.loadCredentials( + "whatever", + "src/test/resources/wallet.json") + .getEcKeyPair(); + } catch (IOException | CipherException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712ChallengeTests.java b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712ChallengeTests.java new file mode 100644 index 0000000..e71784d --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712ChallengeTests.java @@ -0,0 +1,124 @@ +/* + * Copyright 2022-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.eip712.TypeParam; +import com.iexec.commons.poco.utils.HashUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; +import java.util.List; + +import static org.assertj.core.api.Assertions.assertThat; + +class EIP712ChallengeTests { + + private final ObjectMapper mapper = new ObjectMapper(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + Challenge challenge = Challenge.builder().challenge("challenge").build(); + EIP712Domain domain = new EIP712Domain(); + EIP712Challenge eip712Challenge = new EIP712Challenge(domain, challenge); + String jsonString = mapper.writeValueAsString(eip712Challenge); + EIP712Challenge deserializedChallenge = mapper.readValue(jsonString, EIP712Challenge.class); + assertThat(deserializedChallenge).usingRecursiveComparison().isEqualTo(eip712Challenge); + } + + @Test + void shouldReturnJsonString() throws JsonProcessingException { + Challenge challenge = Challenge.builder().challenge("challenge").build(); + EIP712Domain domain = new EIP712Domain("COMMON", "1", 15L, null); + EIP712Challenge eip712Challenge = new EIP712Challenge(domain, challenge); + assertThat(mapper.writeValueAsString(eip712Challenge)) + .isNotEmpty() + .isEqualTo("{\"types\":{\"EIP712Domain\":[" + + "{\"name\":\"name\",\"type\":\"string\"}," + + "{\"name\":\"version\",\"type\":\"string\"}," + + "{\"name\":\"chainId\",\"type\":\"uint256\"}" + + "]," + + "\"Challenge\":[{\"name\":\"challenge\",\"type\":\"string\"}]}," + + "\"domain\":{\"name\":\"COMMON\",\"version\":\"1\",\"chainId\":15}," + + "\"message\":{\"challenge\":\"challenge\"}," + + "\"primaryType\":\"Challenge\"}"); + String domainType = "EIP712Domain(string name,string version,uint256 chainId)"; + String domainSeparator = HashUtils.concatenateAndHash( + Numeric.toHexString(Hash.sha3(domainType.getBytes())), + Numeric.toHexString(Hash.sha3(domain.getName().getBytes())), + Numeric.toHexString(Hash.sha3(domain.getVersion().getBytes())), + Numeric.toHexString(Numeric.toBytesPadded(BigInteger.valueOf(domain.getChainId()), 32))); + assertThat(eip712Challenge.getDomain().getDomainSeparator()) + .isEqualTo(domainSeparator) + .isEqualTo("0x032ca689dd6e3f3369c7a74aae8b74a5cf8d5deb2511d68755eed205595e57a5"); + String messageType = "Challenge(string challenge)"; + String messageHash = HashUtils.concatenateAndHash( + Numeric.toHexString(Hash.sha3(messageType.getBytes())), + Numeric.toHexString(Hash.sha3("challenge".getBytes()))); + assertThat(eip712Challenge.getMessageHash()) + .isEqualTo(messageHash) + .isEqualTo("0xffa80746e15229833c32e80aa3a3c161e0c5a0e47ff6fd68e713c8501a1456e5"); + String hash = HashUtils.concatenateAndHash( + "0x1901", + domainSeparator, + messageHash); + assertThat(eip712Challenge.getHash()) + .isEqualTo(hash) + .isEqualTo("0xea5ec041da81859f2c04a4876d5999ed8e66ad221b5b8699ca91f6814693a80e"); + } + + @Test + void shouldValidateDomainTypeParams() { + Challenge challenge = Challenge.builder().challenge("abcd").build(); + EIP712Domain domain = new EIP712Domain("OTHER DOMAIN", "2", 13L, null); + EIP712Challenge eip712Challenge = new EIP712Challenge(domain, challenge); + assertThat(eip712Challenge.getDomainTypeParams()) + .isEqualTo(List.of( + new TypeParam("name", "string"), + new TypeParam("version", "string"), + new TypeParam("chainId", "uint256"))); + String domainType = "EIP712Domain(string name,string version,uint256 chainId)"; + String domainSeparator = HashUtils.concatenateAndHash( + Numeric.toHexString(Hash.sha3(domainType.getBytes())), + Numeric.toHexString(Hash.sha3(domain.getName().getBytes())), + Numeric.toHexString(Hash.sha3(domain.getVersion().getBytes())), + Numeric.toHexString(Numeric.toBytesPadded(BigInteger.valueOf(domain.getChainId()), 32))); + assertThat(eip712Challenge.getDomain().getDomainSeparator()) + .isEqualTo(domainSeparator) + .isEqualTo("0x1ab64efc51b26dc09fa88c5377082acb34c14b43948c78d6a1472c0308a40aab"); + } + + @Test + void shouldValidateTypeParams() { + Challenge challenge = Challenge.builder().challenge("abcd").build(); + EIP712Domain domain = new EIP712Domain("OTHER DOMAIN", "2", 13L, null); + EIP712Challenge eip712Challenge = new EIP712Challenge(domain, challenge); + assertThat(eip712Challenge.getMessageTypeParams()) + .isEqualTo(List.of(new TypeParam("challenge", "string"))); + String messageType = "Challenge(string challenge)"; + String messageHash = HashUtils.concatenateAndHash( + Numeric.toHexString(Hash.sha3(messageType.getBytes())), + Numeric.toHexString(Hash.sha3("abcd".getBytes()))); + assertThat(eip712Challenge.getMessageHash()) + .isEqualTo(messageHash) + .isEqualTo("0x58c09e3e047920707563968aa3b3d1782e643869669d82283250c6ef75c8792f"); + } +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712DatasetOrderTest.java b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712DatasetOrderTest.java new file mode 100644 index 0000000..872cbd8 --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712DatasetOrderTest.java @@ -0,0 +1,86 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.order.DatasetOrder; +import com.iexec.commons.poco.utils.BytesUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.CipherException; +import org.web3j.crypto.ECKeyPair; +import org.web3j.crypto.WalletUtils; + +import java.io.IOException; +import java.math.BigInteger; + +import static org.assertj.core.api.Assertions.assertThat; + +class EIP712DatasetOrderTest { + + private final ObjectMapper mapper = new ObjectMapper(); + private final EIP712Domain DOMAIN = new EIP712Domain(133, "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f"); + private final DatasetOrder DATASET_ORDER = DatasetOrder.builder() + .dataset("0x2550E5B60f48742aBce2275F34417e7cBf5AcA86") + .datasetprice(BigInteger.valueOf(0)) + .volume(BigInteger.valueOf(1000000)) + .tag("0x0000000000000000000000000000000000000000000000000000000000000001") + .apprestrict(BytesUtils.EMPTY_ADDRESS) + .workerpoolrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt("0xc49d07f99c47096900653b6ade4ccde4c52f773a5ad68f1da0a47c993cad4595") + .build(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + EIP712DatasetOrder eip712DatasetOrder = new EIP712DatasetOrder(DOMAIN, DATASET_ORDER); + String jsonString = mapper.writeValueAsString(eip712DatasetOrder); + EIP712DatasetOrder deserializedEip712DatasetOrder = mapper.readValue(jsonString, EIP712DatasetOrder.class); + assertThat(deserializedEip712DatasetOrder).usingRecursiveComparison().isEqualTo(eip712DatasetOrder); + } + + /** + * Expected signature string could also be found with: + *

+ * iexec order sign --dataset --chain 133 \ + * --keystoredir /home/$USER/iexecdev/iexec-common/src/test/resources/ \ + * --wallet-file wallet.json --password whatever + *

+ * Note: Don't forget to update salt + */ + @Test + void signDatasetOrderEIP712() { + EIP712DatasetOrder eip712DatasetOrder = new EIP712DatasetOrder(DOMAIN, DATASET_ORDER); + String signatureString = eip712DatasetOrder.signMessage(getWallet()); + assertThat(signatureString) + .isEqualTo("0x94661cab25380e7a6e1c20762988f6f854c5123a17ad27c65580d7c3edcfa2025a9d255c679c4cf7d489560917c17d3af3da83737b3722824918d39aecfedf711c"); + } + + private ECKeyPair getWallet() { + try { + return WalletUtils.loadCredentials( + "whatever", + "./src/test/resources/wallet.json") + .getEcKeyPair(); + } catch (IOException | CipherException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712RequestOrderTest.java b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712RequestOrderTest.java new file mode 100644 index 0000000..d5a39cf --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712RequestOrderTest.java @@ -0,0 +1,95 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.order.RequestOrder; +import com.iexec.commons.poco.utils.BytesUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.CipherException; +import org.web3j.crypto.ECKeyPair; +import org.web3j.crypto.WalletUtils; + +import java.io.IOException; +import java.math.BigInteger; + +import static org.assertj.core.api.Assertions.assertThat; + +class EIP712RequestOrderTest { + + private final ObjectMapper mapper = new ObjectMapper(); + private final EIP712Domain DOMAIN = new EIP712Domain(133, "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f"); + + private final RequestOrder REQUEST_ORDER = RequestOrder.builder() + .app("0x6709CAe77CDa2cbA8Cb90A4F5a4eFfb5c8Fe8367") + .appmaxprice(BigInteger.ZERO) + .dataset(BytesUtils.EMPTY_ADDRESS) + .datasetmaxprice(BigInteger.ZERO) + .workerpool("0x506fA5EaCa52B5d2F133452a45FFA68aD1CfB3C5") + .workerpoolmaxprice(BigInteger.ZERO) + .requester("0x1ec09e1782a43a770d54e813379c730e0b29ad4b") + .volume(BigInteger.ONE) + .tag(BytesUtils.toByte32HexString(0x1)) // any tag here + .category(BigInteger.ZERO) + .trust(BigInteger.ZERO) + .beneficiary(BytesUtils.EMPTY_ADDRESS) + .callback(BytesUtils.EMPTY_ADDRESS) + .params("{\"iexec_tee_post_compute_fingerprint\":\"76bfdee97e692b729e989694f3a566cf0e1de95fc456ff5ee88c75b1cb865e33|1eb627c1c94bbca03178b099b13fb4d1|13076027fc67accba753a3ed2edf03227dfd013b450d68833a5589ec44132100\",\"iexec_tee_post_compute_image\":\"iexechub/tee-worker-post-compute:1.0.0\",\"iexec_result_storage_provider\":\"ipfs\",\"iexec_result_storage_proxy\":\"https://result.viviani.iex.ec\",\"iexec_result_encryption\":false,\"iexec_input_files\":[],\"iexec_args\":\"Alice\"}") + .salt("0xee5c64cd59eaa084f59dbaa8f20b87260c4d6ac35c83214da657681bfe4e7632") + .build(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + EIP712RequestOrder eip712RequestOrder = new EIP712RequestOrder(DOMAIN, REQUEST_ORDER); + String jsonString = mapper.writeValueAsString(eip712RequestOrder); + EIP712RequestOrder deserializedEip712RequestOrder = mapper.readValue(jsonString, EIP712RequestOrder.class); + assertThat(deserializedEip712RequestOrder).usingRecursiveComparison().isEqualTo(eip712RequestOrder); + } + + /** + * Expected signature string could also be found with: + *

+ * iexec order sign --request --chain 133 \ + * --keystoredir /home/$USER/iexecdev/iexec-common/src/test/resources/ \ + * --wallet-file wallet.json --password whatever + *

+ * Note: Don't forget to update salt + */ + @Test + void signRequestOrderEIP712() { + EIP712RequestOrder eip712RequestOrder = new EIP712RequestOrder(DOMAIN, REQUEST_ORDER); + + String signatureString = eip712RequestOrder.signMessage(getWallet()); + assertThat(signatureString) + .isEqualTo("0x611511fa5169dff40f7b4c0013e9f149e79dfddacd80a19852a1e9b42294eaef4329367f01eb48930f990a418befed0c5634e493809f2e9a6a60727137964df51c"); + } + + private ECKeyPair getWallet() { + try { + return WalletUtils.loadCredentials( + "whatever", + "src/test/resources/wallet.json") + .getEcKeyPair(); + } catch (IOException | CipherException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712WorkerpoolOrderTest.java b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712WorkerpoolOrderTest.java new file mode 100644 index 0000000..8e7a54a --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/eip712/entity/EIP712WorkerpoolOrderTest.java @@ -0,0 +1,88 @@ +/* + * Copyright 2020-2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.eip712.entity; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.eip712.EIP712Domain; +import com.iexec.commons.poco.order.WorkerpoolOrder; +import com.iexec.commons.poco.utils.BytesUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.CipherException; +import org.web3j.crypto.ECKeyPair; +import org.web3j.crypto.WalletUtils; + +import java.io.IOException; +import java.math.BigInteger; + +import static org.assertj.core.api.Assertions.assertThat; + +class EIP712WorkerpoolOrderTest { + + private final ObjectMapper mapper = new ObjectMapper(); + private final EIP712Domain DOMAIN = new EIP712Domain(133, "0x3eca1B216A7DF1C7689aEb259fFB83ADFB894E7f"); + private final WorkerpoolOrder WORKERPOOL_ORDER = WorkerpoolOrder.builder() + .workerpool("0x53Ef1328a96E40E125bca15b9a4da045C5e63E1A") + .workerpoolprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag("0x0000000000000000000000000000000000000000000000000000000000000000") + .category(BigInteger.ZERO) + .trust(BigInteger.ZERO) + .datasetrestrict(BytesUtils.EMPTY_ADDRESS) + .apprestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt("0x40af1a4975ca6ca7285d7738e51c8da91a9daee4a23fb45d105068be56f85e56") + .build(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + EIP712WorkerpoolOrder eip712WorkerpoolOrder = new EIP712WorkerpoolOrder(DOMAIN, WORKERPOOL_ORDER); + String jsonString = mapper.writeValueAsString(eip712WorkerpoolOrder); + EIP712WorkerpoolOrder deserializedEip712WorkerPoolOrder = mapper.readValue(jsonString, EIP712WorkerpoolOrder.class); + assertThat(deserializedEip712WorkerPoolOrder).usingRecursiveComparison().isEqualTo(eip712WorkerpoolOrder); + } + + /** + * Expected signature string could also be found with: + *

+ * iexec order sign --workerpool --chain 133 \ + * --keystoredir /home/$USER/iexecdev/iexec-common/src/test/resources/ \ + * --wallet-file wallet.json --password whatever + *

+ * Note: Don't forget to update salt + */ + @Test + void signWorkerpoolOrderEIP712() { + EIP712WorkerpoolOrder eip712WorkerpoolOrder = new EIP712WorkerpoolOrder(DOMAIN, WORKERPOOL_ORDER); + String signatureString = eip712WorkerpoolOrder.signMessage(getWallet()); + assertThat(signatureString) + .isEqualTo("0x18bb5dbf608ade315c9e81f0b89929a93aa36aee0a1d51e9119c66799af126596c6cfd1e676ea394e346c616710a675388d5b270a195e494e75d107c87a45dce1c"); + } + + private ECKeyPair getWallet() { + try { + return WalletUtils.loadCredentials( + "whatever", + "./src/test/resources/wallet.json") + .getEcKeyPair(); + } catch (IOException | CipherException e) { + e.printStackTrace(); + } + return null; + } + +} diff --git a/src/test/java/com/iexec/commons/poco/itest/MatchOrdersTests.java b/src/test/java/com/iexec/commons/poco/itest/MatchOrdersTests.java new file mode 100644 index 0000000..f99e218 --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/itest/MatchOrdersTests.java @@ -0,0 +1,191 @@ +/* + * Copyright 2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.itest; + +import com.iexec.commons.poco.chain.DealParams; +import com.iexec.commons.poco.chain.IexecHubAbstractService; +import com.iexec.commons.poco.chain.Web3jAbstractService; +import com.iexec.commons.poco.eip712.OrderSigner; +import com.iexec.commons.poco.order.*; +import com.iexec.commons.poco.utils.BytesUtils; +import lombok.extern.slf4j.Slf4j; +import org.junit.jupiter.api.*; +import org.testcontainers.containers.DockerComposeContainer; +import org.testcontainers.junit.jupiter.Container; +import org.testcontainers.junit.jupiter.Testcontainers; +import org.web3j.crypto.CipherException; +import org.web3j.crypto.Credentials; +import org.web3j.crypto.Hash; +import org.web3j.crypto.WalletUtils; +import org.web3j.protocol.core.methods.response.TransactionReceipt; + +import java.io.File; +import java.io.IOException; +import java.math.BigInteger; +import java.util.Map; +import java.util.TreeMap; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +@Slf4j +@Tag("itest") +@Testcontainers +class MatchOrdersTests { + + private static final String IEXEC_HUB_ADDRESS = "0xC129e7917b7c7DeDfAa5Fff1FB18d5D7050fE8ca"; + + private Credentials credentials; + private IexecHubService iexecHubService; + private Web3jService web3jService; + private OrderSigner signer; + + @Container + static DockerComposeContainer environment = new DockerComposeContainer<>(new File("docker-compose.yml")) + .withExposedService("poco-chain", 8545); + + @BeforeEach + void init() throws CipherException, IOException { + credentials = WalletUtils.loadCredentials("whatever", "src/test/resources/wallet.json"); + web3jService = new Web3jService(); + iexecHubService = new IexecHubService(credentials, web3jService); + signer = new OrderSigner(65535, IEXEC_HUB_ADDRESS, credentials.getEcKeyPair()); + } + + @Test + void shouldMatchOrder() throws Exception { + String appAddress = iexecHubService.createApp( + "my-app", + "multiAddress", + "DOCKER", + BytesUtils.EMPTY_HEX_STRING_32, + "{}" + ); + assertThat(appAddress).isEqualTo("0x0677c9ad40e1c3508b40bfb1c4749cc9bd63933f"); + + String datasetAddress = iexecHubService.createDataset( + "my-dataset", + "multiAddress", + BytesUtils.EMPTY_HEX_STRING_32 + ); + assertThat(datasetAddress).isEqualTo("0xe203f571c8d7d2abcf5e406d20965e3889662f5e"); + + String workerpoolAddress = iexecHubService.createWorkerpool("my-workerpool"); + assertThat(workerpoolAddress).isEqualTo("0x74c6683f7bc258946e01e278b2842c99a0c7896a"); + + AppOrder appOrder = AppOrder.builder() + .app(appAddress) + .appprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag(OrderTag.TEE_SCONE.getValue()) + .datasetrestrict(BytesUtils.EMPTY_ADDRESS) + .workerpoolrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String("abcd")) + .build(); + + AppOrder signedAppOrder = signer.signAppOrder(appOrder); + assertThat(signedAppOrder.getSign()) + .isEqualTo("0x18e0f7a382513a74e90763dc755c0751121316073b0f4cb6a5481580696574ec3e0060c166bc1b764079d233236ff59e88bcb74bbe7c941d2cdf7204f5fc89061b"); + + DatasetOrder datasetOrder = DatasetOrder.builder() + .dataset(datasetAddress) + .datasetprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag(OrderTag.TEE_SCONE.getValue()) + .apprestrict(BytesUtils.EMPTY_ADDRESS) + .workerpoolrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String("abcd")) + .build(); + + DatasetOrder signedDatasetOrder = signer.signDatasetOrder(datasetOrder); + assertThat(signedDatasetOrder.getSign()) + .isEqualTo("0x529ea0d91a7f1cc373c34c7ec43cd132238b052abbf74c379f15d930fe0bf66d00907b58ba2bbe9e1f73aeb02e08da6a4e6915dba7ed4eb54a56b2d319ec987b1b"); + + WorkerpoolOrder workerpoolOrder = WorkerpoolOrder.builder() + .workerpool(workerpoolAddress) + .workerpoolprice(BigInteger.TEN) + .volume(BigInteger.ONE) + .tag(OrderTag.TEE_SCONE.getValue()) + .category(BigInteger.ZERO) + .trust(BigInteger.ONE) + .apprestrict(BytesUtils.EMPTY_ADDRESS) + .datasetrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String("abcd")) + .build(); + WorkerpoolOrder signedWorkerpoolOrder = signer.signWorkerpoolOrder(workerpoolOrder); + assertThat(signedWorkerpoolOrder.getSign()) + .isEqualTo("0x52ce5afec8e142ea9217bd818796c7b4b1ab1e1ebebf532b59ebc3ae15c56efb5c55e1b3c79fa3929ae1bf3895b926f47316dac8a7a484c8db05068d31e8038f1c"); + + TreeMap iexecSecrets = new TreeMap<>(Map.of( + "1", "first-secret", + "2", "second-secret", + "3", "third-secret")); + DealParams dealParams = DealParams.builder() + .iexecDeveloperLoggerEnabled(true) + .iexecResultEncryption(true) + .iexecResultStorageProvider("ipfs") + .iexecResultStorageProxy("http://result-proxy:13200") + .iexecSecrets(iexecSecrets) + .build(); + RequestOrder requestOrder = RequestOrder.builder() + .app(appOrder.getApp()) + .appmaxprice(appOrder.getAppprice()) + .dataset(datasetOrder.getDataset()) + .datasetmaxprice(datasetOrder.getDatasetprice()) + .workerpool(workerpoolOrder.getWorkerpool()) + .workerpoolmaxprice(workerpoolOrder.getWorkerpoolprice()) + .requester(credentials.getAddress()) + .volume(BigInteger.ONE) + .tag(OrderTag.TEE_SCONE.getValue()) + .category(BigInteger.ZERO) + .trust(BigInteger.ONE) + .beneficiary(credentials.getAddress()) + .callback(BytesUtils.EMPTY_ADDRESS) + .params(dealParams.toJsonString()) + .salt(Hash.sha3String("abcd")) + .build(); + RequestOrder signedRequestOrder = signer.signRequestOrder(requestOrder); + assertThat(signedRequestOrder.getSign()) + .isEqualTo("0xdcb9d67a92d09362bf774dbf3259d04ea6d7e8e44b66db71cb03acc834c7955a515efb05afe9c461f25225f32b89972bffc05257c0662189c4edde014683859c1c"); + + TransactionReceipt receipt = iexecHubService + .getHubContract(web3jService.getWritingContractGasProvider(), 65535L) + .matchOrders( + signedAppOrder.toHubContract(), + signedDatasetOrder.toHubContract(), + signedWorkerpoolOrder.toHubContract(), + signedRequestOrder.toHubContract() + ).send(); + + assertThat(receipt).isNotNull(); + assertThat(receipt.isStatusOK()).isTrue(); + } + + static class IexecHubService extends IexecHubAbstractService { + public IexecHubService(Credentials credentials, Web3jAbstractService web3jAbstractService) { + super(credentials, web3jAbstractService, IEXEC_HUB_ADDRESS); + } + } + + static class Web3jService extends Web3jAbstractService { + public Web3jService() { + super("http://localhost:" + environment.getServicePort("poco-chain", 8545), 1.0f, 22000000000L, true); + } + } +} diff --git a/src/test/java/com/iexec/commons/poco/order/AppOrderTests.java b/src/test/java/com/iexec/commons/poco/order/AppOrderTests.java new file mode 100644 index 0000000..92da4ed --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/order/AppOrderTests.java @@ -0,0 +1,72 @@ +/* + * Copyright 2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import com.iexec.commons.poco.utils.BytesUtils; +import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +import static org.assertj.core.api.Assertions.assertThat; + +@Slf4j +class AppOrderTests { + + private static final ObjectMapper mapper = new ObjectMapper(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + AppOrder appOrder = AppOrder.builder().build(); + String jsonString = mapper.writeValueAsString(appOrder); + assertThat(jsonString).isEqualTo("{\"volume\":null,\"tag\":null,\"salt\":null,\"sign\":null," + + "\"app\":null,\"appprice\":null,\"datasetrestrict\":\"\",\"workerpoolrestrict\":\"\",\"requesterrestrict\":\"\"}"); + AppOrder parsedAppOrder = mapper.readValue(jsonString, AppOrder.class); + assertThat(parsedAppOrder).usingRecursiveComparison().isEqualTo(appOrder); + } + + @Test + void shouldCastToHubContract() { + AppOrder appOrder = AppOrder.builder() + .app("0x1") + .appprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag(OrderTag.STANDARD.getValue()) + .datasetrestrict(BytesUtils.EMPTY_ADDRESS) + .workerpoolrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String(RandomStringUtils.randomAlphanumeric(20))) + .sign("0x0") + .build(); + IexecHubContract.AppOrder web3jAppOrder = appOrder.toHubContract(); + assertThat(web3jAppOrder.app).isEqualTo(appOrder.getApp()); + assertThat(web3jAppOrder.appprice).isEqualTo(appOrder.getAppprice()); + assertThat(web3jAppOrder.volume).isEqualTo(appOrder.getVolume()); + assertThat(web3jAppOrder.tag).isEqualTo(Numeric.hexStringToByteArray(appOrder.getTag())); + assertThat(web3jAppOrder.datasetrestrict).isEqualTo(appOrder.getDatasetrestrict()); + assertThat(web3jAppOrder.workerpoolrestrict).isEqualTo(appOrder.getWorkerpoolrestrict()); + assertThat(web3jAppOrder.requesterrestrict).isEqualTo(appOrder.getRequesterrestrict()); + assertThat(web3jAppOrder.salt).isEqualTo(Numeric.hexStringToByteArray(appOrder.getSalt())); + } + +} diff --git a/src/test/java/com/iexec/commons/poco/order/DatasetOrderTests.java b/src/test/java/com/iexec/commons/poco/order/DatasetOrderTests.java new file mode 100644 index 0000000..15209dd --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/order/DatasetOrderTests.java @@ -0,0 +1,70 @@ +/* + * Copyright 2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import com.iexec.commons.poco.utils.BytesUtils; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +class DatasetOrderTests { + + private static final ObjectMapper mapper = new ObjectMapper(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + DatasetOrder datasetOrder = DatasetOrder.builder().build(); + String jsonString = mapper.writeValueAsString(datasetOrder); + assertThat(jsonString).isEqualTo("{\"volume\":null,\"tag\":null,\"salt\":null,\"sign\":null," + + "\"dataset\":null,\"datasetprice\":null,\"apprestrict\":\"\",\"workerpoolrestrict\":\"\",\"requesterrestrict\":\"\"}"); + DatasetOrder parsedDatasetOrder = mapper.readValue(jsonString, DatasetOrder.class); + assertThat(parsedDatasetOrder).usingRecursiveComparison().isEqualTo(datasetOrder); + } + + @Test + void shouldCastToHubContract() { + DatasetOrder datasetOrder = DatasetOrder.builder() + .dataset("0x1") + .datasetprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag(OrderTag.STANDARD.getValue()) + .apprestrict(BytesUtils.EMPTY_ADDRESS) + .workerpoolrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String(RandomStringUtils.randomAlphanumeric(20))) + .sign("0x0") + .build(); + IexecHubContract.DatasetOrder web3jDatasetOrder = datasetOrder.toHubContract(); + assertThat(web3jDatasetOrder.dataset).isEqualTo(datasetOrder.getDataset()); + assertThat(web3jDatasetOrder.datasetprice).isEqualTo(datasetOrder.getDatasetprice()); + assertThat(web3jDatasetOrder.volume).isEqualTo(datasetOrder.getVolume()); + assertThat(web3jDatasetOrder.tag).isEqualTo(Numeric.hexStringToByteArray(datasetOrder.getTag())); + assertThat(web3jDatasetOrder.apprestrict).isEqualTo(datasetOrder.getApprestrict()); + assertThat(web3jDatasetOrder.workerpoolrestrict).isEqualTo(datasetOrder.getWorkerpoolrestrict()); + assertThat(web3jDatasetOrder.requesterrestrict).isEqualTo(datasetOrder.getRequesterrestrict()); + assertThat(web3jDatasetOrder.salt).isEqualTo(Numeric.hexStringToByteArray(datasetOrder.getSalt())); + } + +} diff --git a/src/test/java/com/iexec/commons/poco/order/RequestOrderTests.java b/src/test/java/com/iexec/commons/poco/order/RequestOrderTests.java new file mode 100644 index 0000000..ecbba5f --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/order/RequestOrderTests.java @@ -0,0 +1,84 @@ +/* + * Copyright 2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import com.iexec.commons.poco.utils.BytesUtils; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +class RequestOrderTests { + + private static final ObjectMapper mapper = new ObjectMapper(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + RequestOrder requestOrder = RequestOrder.builder().build(); + String jsonString = mapper.writeValueAsString(requestOrder); + assertThat(jsonString).isEqualTo("{\"volume\":null,\"tag\":null,\"salt\":null,\"sign\":null," + + "\"app\":\"\",\"appmaxprice\":null,\"dataset\":\"\",\"datasetmaxprice\":null,\"workerpool\":\"\",\"workerpoolmaxprice\":null," + + "\"requester\":\"\",\"category\":null,\"trust\":null,\"beneficiary\":\"\",\"callback\":\"\",\"params\":null}"); + RequestOrder parsedRequestOrder = mapper.readValue(jsonString, RequestOrder.class); + assertThat(parsedRequestOrder).usingRecursiveComparison().isEqualTo(requestOrder); + } + + @Test + void shouldCastToHubContract() { + RequestOrder requestOrder = RequestOrder.builder() + .app("0x1") + .appmaxprice(BigInteger.TEN) + .dataset("0x2") + .datasetmaxprice(BigInteger.TEN) + .workerpool("0x3") + .workerpoolmaxprice(BigInteger.TEN) + .requester("0x4") + .volume(BigInteger.ONE) + .tag(OrderTag.STANDARD.getValue()) + .category(BigInteger.ZERO) + .trust(BigInteger.ONE) + .beneficiary("0x5") + .callback(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String(RandomStringUtils.randomAlphanumeric(20))) + .sign("0x0") + .build(); + IexecHubContract.RequestOrder web3jRequestOrder = requestOrder.toHubContract(); + assertThat(web3jRequestOrder.app).isEqualTo(requestOrder.getApp()); + assertThat(web3jRequestOrder.appmaxprice).isEqualTo(requestOrder.getAppmaxprice()); + assertThat(web3jRequestOrder.dataset).isEqualTo(requestOrder.getDataset()); + assertThat(web3jRequestOrder.datasetmaxprice).isEqualTo(requestOrder.getDatasetmaxprice()); + assertThat(web3jRequestOrder.workerpool).isEqualTo(requestOrder.getWorkerpool()); + assertThat(web3jRequestOrder.workerpoolmaxprice).isEqualTo(requestOrder.getWorkerpoolmaxprice()); + assertThat(web3jRequestOrder.requester).isEqualTo(requestOrder.getRequester()); + assertThat(web3jRequestOrder.volume).isEqualTo(requestOrder.getVolume()); + assertThat(web3jRequestOrder.tag).isEqualTo(Numeric.hexStringToByteArray(requestOrder.getTag())); + assertThat(web3jRequestOrder.category).isEqualTo(requestOrder.getCategory()); + assertThat(web3jRequestOrder.trust).isEqualTo(requestOrder.getTrust()); + assertThat(web3jRequestOrder.beneficiary).isEqualTo(requestOrder.getBeneficiary()); + assertThat(web3jRequestOrder.callback).isEqualTo(requestOrder.getCallback()); + assertThat(web3jRequestOrder.params).isEqualTo(requestOrder.getParams()); + assertThat(web3jRequestOrder.salt).isEqualTo(Numeric.hexStringToByteArray(requestOrder.getSalt())); + } + +} diff --git a/src/test/java/com/iexec/commons/poco/order/WorkerpoolOrderTests.java b/src/test/java/com/iexec/commons/poco/order/WorkerpoolOrderTests.java new file mode 100644 index 0000000..c3297a9 --- /dev/null +++ b/src/test/java/com/iexec/commons/poco/order/WorkerpoolOrderTests.java @@ -0,0 +1,74 @@ +/* + * Copyright 2023 IEXEC BLOCKCHAIN TECH + * + * 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.iexec.commons.poco.order; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.iexec.commons.poco.contract.generated.IexecHubContract; +import com.iexec.commons.poco.utils.BytesUtils; +import org.apache.commons.lang3.RandomStringUtils; +import org.junit.jupiter.api.Test; +import org.web3j.crypto.Hash; +import org.web3j.utils.Numeric; + +import java.math.BigInteger; + +import static org.assertj.core.api.AssertionsForClassTypes.assertThat; + +class WorkerpoolOrderTests { + + private static final ObjectMapper mapper = new ObjectMapper(); + + @Test + void shouldSerializeAndDeserialize() throws JsonProcessingException { + WorkerpoolOrder workerpoolOrder = WorkerpoolOrder.builder().build(); + String jsonString = mapper.writeValueAsString(workerpoolOrder); + assertThat(jsonString).isEqualTo("{\"volume\":null,\"tag\":null,\"salt\":null,\"sign\":null," + + "\"workerpool\":null,\"workerpoolprice\":null,\"trust\":null,\"category\":null,\"apprestrict\":\"\",\"datasetrestrict\":\"\",\"requesterrestrict\":\"\"}"); + WorkerpoolOrder parsedWorkerpoolOrder = mapper.readValue(jsonString, WorkerpoolOrder.class); + assertThat(parsedWorkerpoolOrder).usingRecursiveComparison().isEqualTo(workerpoolOrder); + } + + @Test + void shouldCastToHubContract() { + WorkerpoolOrder workerpoolOrder = WorkerpoolOrder.builder() + .workerpool("0x1") + .workerpoolprice(BigInteger.ZERO) + .volume(BigInteger.ONE) + .tag(OrderTag.STANDARD.getValue()) + .category(BigInteger.ZERO) + .trust(BigInteger.ONE) + .apprestrict(BytesUtils.EMPTY_ADDRESS) + .datasetrestrict(BytesUtils.EMPTY_ADDRESS) + .requesterrestrict(BytesUtils.EMPTY_ADDRESS) + .salt(Hash.sha3String(RandomStringUtils.randomAlphanumeric(20))) + .sign("0x0") + .build(); + IexecHubContract.WorkerpoolOrder web3jWorkerpoolOrder = workerpoolOrder.toHubContract(); + assertThat(web3jWorkerpoolOrder.workerpool).isEqualTo(workerpoolOrder.getWorkerpool()); + assertThat(web3jWorkerpoolOrder.workerpoolprice).isEqualTo(workerpoolOrder.getWorkerpoolprice()); + assertThat(web3jWorkerpoolOrder.volume).isEqualTo(workerpoolOrder.getVolume()); + assertThat(web3jWorkerpoolOrder.tag).isEqualTo(Numeric.hexStringToByteArray(workerpoolOrder.getTag())); + assertThat(web3jWorkerpoolOrder.category).isEqualTo(workerpoolOrder.getCategory()); + assertThat(web3jWorkerpoolOrder.trust).isEqualTo(workerpoolOrder.getTrust()); + assertThat(web3jWorkerpoolOrder.apprestrict).isEqualTo(workerpoolOrder.getApprestrict()); + assertThat(web3jWorkerpoolOrder.datasetrestrict).isEqualTo(workerpoolOrder.getDatasetrestrict()); + assertThat(web3jWorkerpoolOrder.requesterrestrict).isEqualTo(workerpoolOrder.getRequesterrestrict()); + assertThat(web3jWorkerpoolOrder.salt).isEqualTo(Numeric.hexStringToByteArray(workerpoolOrder.getSalt())); + } + +} diff --git a/src/test/resources/wallet.json b/src/test/resources/wallet.json new file mode 100644 index 0000000..27ffe42 --- /dev/null +++ b/src/test/resources/wallet.json @@ -0,0 +1,21 @@ +{ + "address": "000a9c787a972f70f0903890e266f41c795c4dca", + "id": "10a5105f-d83e-4dd5-89b8-d5b470330e29", + "version": 3, + "Crypto": { + "cipher": "aes-128-ctr", + "cipherparams": { + "iv": "29ff2f5f088592183fe151e69bd125ff" + }, + "ciphertext": "fb3222978811bc053964f229d63ee30f71126ab0af781cda4483f2a25096f0bd", + "kdf": "scrypt", + "kdfparams": { + "salt": "9920c0d162772a166aebad00ec4f925270670879dee42574fae033363ba400c6", + "n": 131072, + "dklen": 32, + "p": 1, + "r": 8 + }, + "mac": "8a2458428220a2169b01dbe8ad7c03f245c4121449e696749e3126b06353c5e1" + } +}