Smart contract acceptance test (#296)

* Upgrade Web3j to 3.6.0

* Correcting ErrorProne exclusion regex

* Deploying the simple storage contract

* Web3j to 4.0.1

* Verifying the transaction receipt
CJ Hare 6 years ago committed by GitHub
parent 14a8f3780a
commit 1e779438b3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 44
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/condition/eth/EthGetTransactionReceiptEquals.java
  2. 9
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/jsonrpc/Eth.java
  3. 2
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/acceptance/dsl/transaction/DeploySmartContractTransaction.java
  4. 57
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/DeploySmartContractAcceptanceTest.java
  5. 9
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/EventEmitter.sol
  6. 21
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/EventEmitterAcceptanceTest.java
  7. 29
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/SimpleStorage.sol
  8. 2
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/generated/EventEmitter.bin
  9. 164
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/generated/EventEmitter.java
  10. 1
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/generated/SimpleStorage.abi
  11. 1
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/generated/SimpleStorage.bin
  12. 169
      acceptance-tests/src/test/java/tech/pegasys/pantheon/tests/web3j/generated/SimpleStorage.java
  13. 2
      build.gradle
  14. 2
      gradle/versions.gradle

@ -0,0 +1,44 @@
/*
* Copyright 2018 ConsenSys AG.
*
* 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 tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth;
import static org.assertj.core.api.Assertions.assertThat;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.Node;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthGetTransactionReceiptTransaction;
import java.util.Optional;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
public class EthGetTransactionReceiptEquals implements Condition {
private final EthGetTransactionReceiptTransaction transaction;
private final TransactionReceipt expectedReceipt;
public EthGetTransactionReceiptEquals(
final EthGetTransactionReceiptTransaction transaction,
final TransactionReceipt expectedReceipt) {
this.transaction = transaction;
this.expectedReceipt = expectedReceipt;
}
@Override
public void verify(final Node node) {
final Optional<TransactionReceipt> response = node.execute(transaction);
assertThat(response.isPresent()).isTrue();
assertThat(response.get()).isEqualTo(expectedReceipt);
}
}

@ -14,6 +14,7 @@ package tech.pegasys.pantheon.tests.acceptance.dsl.jsonrpc;
import tech.pegasys.pantheon.ethereum.core.Hash;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.Condition;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.EthGetTransactionReceiptEquals;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthAccountsException;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthGetTransactionReceiptIsAbsent;
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectEthGetWorkException;
@ -21,6 +22,8 @@ import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.ExpectSuccessful
import tech.pegasys.pantheon.tests.acceptance.dsl.condition.eth.SanityCheckEthGetWorkValues;
import tech.pegasys.pantheon.tests.acceptance.dsl.transaction.eth.EthTransactions;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
public class Eth {
private final EthTransactions transactions;
@ -50,4 +53,10 @@ public class Eth {
return new ExpectEthGetTransactionReceiptIsAbsent(
transactions.getTransactionReceipt(transactionHash));
}
public Condition expectTransactionReceipt(
final String transactionHash, final TransactionReceipt receipt) {
return new EthGetTransactionReceiptEquals(
transactions.getTransactionReceipt(transactionHash), receipt);
}
}

@ -30,7 +30,7 @@ public class DeploySmartContractTransaction<T extends Contract> implements Trans
private final Class<T> clazz;
public DeploySmartContractTransaction(final Class<T> clazz) {
DeploySmartContractTransaction(final Class<T> clazz) {
this.clazz = clazz;
}

@ -0,0 +1,57 @@
/*
* Copyright 2018 ConsenSys AG.
*
* 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 tech.pegasys.pantheon.tests.web3j;
import static org.assertj.core.api.Assertions.assertThat;
import tech.pegasys.pantheon.tests.acceptance.dsl.AcceptanceTestBase;
import tech.pegasys.pantheon.tests.acceptance.dsl.node.PantheonNode;
import tech.pegasys.pantheon.tests.web3j.generated.SimpleStorage;
import java.util.Optional;
import org.junit.Before;
import org.junit.Test;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
public class DeploySmartContractAcceptanceTest extends AcceptanceTestBase {
private PantheonNode minerNode;
@Before
public void setUp() throws Exception {
minerNode = pantheon.createMinerNode("miner-node");
cluster.start(minerNode);
}
@Test
public void deployContractReceiptMustMatchEthGetTransactionReceipt() {
final SimpleStorage contract =
minerNode.execute(transactions.createSmartContract(SimpleStorage.class));
assertThat(contract).isNotNull();
final Optional<TransactionReceipt> receipt = contract.getTransactionReceipt();
assertThat(receipt).isNotNull();
assertThat(receipt.isPresent()).isTrue();
final TransactionReceipt transactionReceipt = receipt.get();
assertThat(transactionReceipt.getTransactionHash()).isNotNull();
// Contract transaction has no 'to' address or contract address
assertThat(transactionReceipt.getTo()).isNull();
assertThat(transactionReceipt.getContractAddress()).isNotBlank();
minerNode.verify(
eth.expectTransactionReceipt(transactionReceipt.getTransactionHash(), transactionReceipt));
}
}

@ -10,11 +10,12 @@
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
pragma solidity ^0.4.0;
pragma solidity >=0.4.0 <0.6.0;
// compile with:
// solc EventEmitter.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate ./generated/EventEmitter.bin ./generated/EventEmitter.abi -o ../../../../../ -p tech.pegasys.pantheon.tests.web3j.generated
// web3j solidity generate -b ./generated/EventEmitter.bin -a ./generated/EventEmitter.abi -o ../../../../../ -p tech.pegasys.pantheon.tests.web3j.generated
contract EventEmitter {
address owner;
event stored(address _to, uint _amount);
@ -31,11 +32,11 @@ contract EventEmitter {
_sender = msg.sender;
}
function value() constant public returns (uint) {
function value() view public returns (uint) {
return _value;
}
function sender() constant public returns (address) {
function sender() view public returns (address) {
return _sender;
}
}

@ -13,6 +13,7 @@
package tech.pegasys.pantheon.tests.web3j;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
@ -24,11 +25,12 @@ import tech.pegasys.pantheon.tests.web3j.generated.EventEmitter.StoredEventRespo
import java.math.BigInteger;
import java.util.concurrent.atomic.AtomicBoolean;
import io.reactivex.Flowable;
import io.reactivex.disposables.Disposable;
import org.junit.Before;
import org.junit.Test;
import org.web3j.protocol.core.methods.request.EthFilter;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import rx.Observable;
/*
* This class is based around the EventEmitter solidity contract
@ -48,16 +50,19 @@ public class EventEmitterAcceptanceTest extends AcceptanceTestBase {
final EventEmitter eventEmitter =
node.execute(transactions.createSmartContract(EventEmitter.class));
final Observable<StoredEventResponse> storedEventResponseObservable =
eventEmitter.storedEventObservable(new EthFilter());
final Flowable<StoredEventResponse> storedEventResponseObservable =
eventEmitter.storedEventFlowable(new EthFilter());
final AtomicBoolean subscriptionReceived = new AtomicBoolean(false);
storedEventResponseObservable.subscribe(
storedEventResponse -> {
subscriptionReceived.set(true);
assertEquals(BigInteger.valueOf(12), storedEventResponse._amount);
});
final Disposable subscription =
storedEventResponseObservable.subscribe(
storedEventResponse -> {
subscriptionReceived.set(true);
assertEquals(BigInteger.valueOf(12), storedEventResponse._amount);
});
assertFalse(subscription.isDisposed());
final TransactionReceipt receipt = eventEmitter.store(BigInteger.valueOf(12)).send();

@ -0,0 +1,29 @@
/*
* Copyright 2018 ConsenSys AG.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
pragma solidity >=0.4.0 <0.6.0;
// compile with:
// solc SimpleStorage.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
// web3j solidity generate -b ./generated/SimpleStorage.bin -a ./generated/SimpleStorage.abi -o ../../../../../ -p tech.pegasys.pantheon.tests.web3j.generated
contract SimpleStorage {
uint data;
function set(uint value) public {
data = value;
}
function get() public view returns (uint) {
return data;
}
}

@ -1 +1 @@
608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610187806100326000396000f3006080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce1461009c575b600080fd5b34801561006757600080fd5b506100706100da565b60408051918252519081900360200190f35b34801561008e57600080fd5b5061009a6004356100e0565b005b3480156100a857600080fd5b506100b161013f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a72305820f958aea7922a9538be4c34980ad3171806aad2d3fedb62682cef2ca4e1f1f3120029
608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610199806100326000396000f3fe6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce146100ae575b600080fd5b34801561006757600080fd5b506100706100ec565b60408051918252519081900360200190f35b34801561008e57600080fd5b506100ac600480360360208110156100a557600080fd5b50356100f2565b005b3480156100ba57600080fd5b506100c3610151565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff169056fea165627a7a72305820c7f729cb24e05c221f5aa913700793994656f233fe2ce3b9fd9a505ea17e8d8a0029

@ -18,6 +18,7 @@ import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import io.reactivex.Flowable;
import org.web3j.abi.EventEncoder;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Address;
@ -34,8 +35,7 @@ import org.web3j.protocol.core.methods.response.Log;
import org.web3j.protocol.core.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
import rx.Observable;
import rx.functions.Func1;
import org.web3j.tx.gas.ContractGasProvider;
/**
* Auto generated code.
@ -46,12 +46,12 @@ import rx.functions.Func1;
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the <a
* href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 3.5.0.
* <p>Generated with web3j version 4.0.1.
*/
@SuppressWarnings("rawtypes")
public class EventEmitter extends Contract {
private static final String BINARY =
"608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610187806100326000396000f3006080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce1461009c575b600080fd5b34801561006757600080fd5b506100706100da565b60408051918252519081900360200190f35b34801561008e57600080fd5b5061009a6004356100e0565b005b3480156100a857600080fd5b506100b161013f565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff16905600a165627a7a72305820f958aea7922a9538be4c34980ad3171806aad2d3fedb62682cef2ca4e1f1f3120029";
"608060405234801561001057600080fd5b5060008054600160a060020a03191633179055610199806100326000396000f3fe6080604052600436106100565763ffffffff7c01000000000000000000000000000000000000000000000000000000006000350416633fa4f245811461005b5780636057361d1461008257806367e404ce146100ae575b600080fd5b34801561006757600080fd5b506100706100ec565b60408051918252519081900360200190f35b34801561008e57600080fd5b506100ac600480360360208110156100a557600080fd5b50356100f2565b005b3480156100ba57600080fd5b506100c3610151565b6040805173ffffffffffffffffffffffffffffffffffffffff9092168252519081900360200190f35b60025490565b604080513381526020810183905281517fc9db20adedc6cf2b5d25252b101ab03e124902a73fcb12b753f3d1aaa2d8f9f5929181900390910190a16002556001805473ffffffffffffffffffffffffffffffffffffffff191633179055565b60015473ffffffffffffffffffffffffffffffffffffffff169056fea165627a7a72305820c7f729cb24e05c221f5aa913700793994656f233fe2ce3b9fd9a505ea17e8d8a0029";
public static final String FUNC_VALUE = "value";
@ -63,26 +63,44 @@ public class EventEmitter extends Contract {
new Event(
"stored",
Arrays.<TypeReference<?>>asList(
new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));
new TypeReference<Address>() {}, new TypeReference<Uint256>() {}));;
@Deprecated
protected EventEmitter(
final String contractAddress,
final Web3j web3j,
final Credentials credentials,
final BigInteger gasPrice,
final BigInteger gasLimit) {
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}
protected EventEmitter(
final String contractAddress,
final Web3j web3j,
final TransactionManager transactionManager,
final BigInteger gasPrice,
final BigInteger gasLimit) {
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
@Deprecated
protected EventEmitter(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
protected EventEmitter(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall<BigInteger> value() {
final Function function =
new Function(
@ -92,7 +110,7 @@ public class EventEmitter extends Contract {
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
public RemoteCall<TransactionReceipt> store(final BigInteger _amount) {
public RemoteCall<TransactionReceipt> store(BigInteger _amount) {
final Function function =
new Function(
FUNC_STORE,
@ -110,30 +128,12 @@ public class EventEmitter extends Contract {
return executeRemoteCallSingleValueReturn(function, String.class);
}
public static RemoteCall<EventEmitter> deploy(
final Web3j web3j,
final Credentials credentials,
final BigInteger gasPrice,
final BigInteger gasLimit) {
return deployRemoteCall(EventEmitter.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
public static RemoteCall<EventEmitter> deploy(
final Web3j web3j,
final TransactionManager transactionManager,
final BigInteger gasPrice,
final BigInteger gasLimit) {
return deployRemoteCall(
EventEmitter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
public List<StoredEventResponse> getStoredEvents(final TransactionReceipt transactionReceipt) {
final List<Contract.EventValuesWithLog> valueList =
public List<StoredEventResponse> getStoredEvents(TransactionReceipt transactionReceipt) {
List<Contract.EventValuesWithLog> valueList =
extractEventParametersWithLog(STORED_EVENT, transactionReceipt);
final ArrayList<StoredEventResponse> responses =
new ArrayList<StoredEventResponse>(valueList.size());
for (final Contract.EventValuesWithLog eventValues : valueList) {
final StoredEventResponse typedResponse = new StoredEventResponse();
ArrayList<StoredEventResponse> responses = new ArrayList<StoredEventResponse>(valueList.size());
for (Contract.EventValuesWithLog eventValues : valueList) {
StoredEventResponse typedResponse = new StoredEventResponse();
typedResponse.log = eventValues.getLog();
typedResponse._to = (String) eventValues.getNonIndexedValues().get(0).getValue();
typedResponse._amount = (BigInteger) eventValues.getNonIndexedValues().get(1).getValue();
@ -142,16 +142,16 @@ public class EventEmitter extends Contract {
return responses;
}
public Observable<StoredEventResponse> storedEventObservable(final EthFilter filter) {
public Flowable<StoredEventResponse> storedEventFlowable(EthFilter filter) {
return web3j
.ethLogObservable(filter)
.ethLogFlowable(filter)
.map(
new Func1<Log, StoredEventResponse>() {
new io.reactivex.functions.Function<Log, StoredEventResponse>() {
@Override
public StoredEventResponse call(final Log log) {
final Contract.EventValuesWithLog eventValues =
public StoredEventResponse apply(Log log) {
Contract.EventValuesWithLog eventValues =
extractEventParametersWithLog(STORED_EVENT, log);
final StoredEventResponse typedResponse = new StoredEventResponse();
StoredEventResponse typedResponse = new StoredEventResponse();
typedResponse.log = log;
typedResponse._to = (String) eventValues.getNonIndexedValues().get(0).getValue();
typedResponse._amount =
@ -161,31 +161,77 @@ public class EventEmitter extends Contract {
});
}
public Observable<StoredEventResponse> storedEventObservable(
final DefaultBlockParameter startBlock, final DefaultBlockParameter endBlock) {
final EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
public Flowable<StoredEventResponse> storedEventFlowable(
DefaultBlockParameter startBlock, DefaultBlockParameter endBlock) {
EthFilter filter = new EthFilter(startBlock, endBlock, getContractAddress());
filter.addSingleTopic(EventEncoder.encode(STORED_EVENT));
return storedEventObservable(filter);
return storedEventFlowable(filter);
}
@Deprecated
public static EventEmitter load(
final String contractAddress,
final Web3j web3j,
final Credentials credentials,
final BigInteger gasPrice,
final BigInteger gasLimit) {
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
return new EventEmitter(contractAddress, web3j, credentials, gasPrice, gasLimit);
}
@Deprecated
public static EventEmitter load(
final String contractAddress,
final Web3j web3j,
final TransactionManager transactionManager,
final BigInteger gasPrice,
final BigInteger gasLimit) {
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
return new EventEmitter(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public static EventEmitter load(
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
return new EventEmitter(contractAddress, web3j, credentials, contractGasProvider);
}
public static EventEmitter load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
return new EventEmitter(contractAddress, web3j, transactionManager, contractGasProvider);
}
public static RemoteCall<EventEmitter> deploy(
Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return deployRemoteCall(
EventEmitter.class, web3j, credentials, contractGasProvider, BINARY, "");
}
public static RemoteCall<EventEmitter> deploy(
Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
return deployRemoteCall(
EventEmitter.class, web3j, transactionManager, contractGasProvider, BINARY, "");
}
@Deprecated
public static RemoteCall<EventEmitter> deploy(
Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(EventEmitter.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
@Deprecated
public static RemoteCall<EventEmitter> deploy(
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
return deployRemoteCall(
EventEmitter.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
public static class StoredEventResponse {
public Log log;

@ -0,0 +1 @@
[{"constant":false,"inputs":[{"name":"value","type":"uint256"}],"name":"set","outputs":[],"payable":false,"stateMutability":"nonpayable","type":"function"},{"constant":true,"inputs":[],"name":"get","outputs":[{"name":"","type":"uint256"}],"payable":false,"stateMutability":"view","type":"function"}]

@ -0,0 +1 @@
608060405234801561001057600080fd5b5060d08061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146075575b600080fd5b348015605857600080fd5b50607360048036036020811015606d57600080fd5b50356099565b005b348015608057600080fd5b506087609e565b60408051918252519081900360200190f35b600055565b6000549056fea165627a7a72305820cb1d0935d14b589300b12fcd0ab849a7e9019c81da24d6daa4f6b2f003d1b0180029

@ -0,0 +1,169 @@
/*
* Copyright 2018 ConsenSys AG.
*
* 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 tech.pegasys.pantheon.tests.web3j.generated;
import java.math.BigInteger;
import java.util.Arrays;
import java.util.Collections;
import org.web3j.abi.TypeReference;
import org.web3j.abi.datatypes.Function;
import org.web3j.abi.datatypes.Type;
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.methods.response.TransactionReceipt;
import org.web3j.tx.Contract;
import org.web3j.tx.TransactionManager;
import org.web3j.tx.gas.ContractGasProvider;
/**
* Auto generated code.
*
* <p><strong>Do not modify!</strong>
*
* <p>Please use the <a href="https://docs.web3j.io/command_line.html">web3j command line tools</a>,
* or the org.web3j.codegen.SolidityFunctionWrapperGenerator in the <a
* href="https://github.com/web3j/web3j/tree/master/codegen">codegen module</a> to update.
*
* <p>Generated with web3j version 4.0.1.
*/
@SuppressWarnings("rawtypes")
public class SimpleStorage extends Contract {
private static final String BINARY =
"608060405234801561001057600080fd5b5060d08061001f6000396000f3fe60806040526004361060485763ffffffff7c010000000000000000000000000000000000000000000000000000000060003504166360fe47b18114604d5780636d4ce63c146075575b600080fd5b348015605857600080fd5b50607360048036036020811015606d57600080fd5b50356099565b005b348015608057600080fd5b506087609e565b60408051918252519081900360200190f35b600055565b6000549056fea165627a7a72305820cb1d0935d14b589300b12fcd0ab849a7e9019c81da24d6daa4f6b2f003d1b0180029";
public static final String FUNC_SET = "set";
public static final String FUNC_GET = "get";
@Deprecated
protected SimpleStorage(
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, credentials, gasPrice, gasLimit);
}
protected SimpleStorage(
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, credentials, contractGasProvider);
}
@Deprecated
protected SimpleStorage(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
super(BINARY, contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
protected SimpleStorage(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
super(BINARY, contractAddress, web3j, transactionManager, contractGasProvider);
}
public RemoteCall<TransactionReceipt> set(BigInteger value) {
final Function function =
new Function(
FUNC_SET,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(value)),
Collections.<TypeReference<?>>emptyList());
return executeRemoteCallTransaction(function);
}
public RemoteCall<BigInteger> get() {
final Function function =
new Function(
FUNC_GET,
Arrays.<Type>asList(),
Arrays.<TypeReference<?>>asList(new TypeReference<Uint256>() {}));
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}
@Deprecated
public static SimpleStorage load(
String contractAddress,
Web3j web3j,
Credentials credentials,
BigInteger gasPrice,
BigInteger gasLimit) {
return new SimpleStorage(contractAddress, web3j, credentials, gasPrice, gasLimit);
}
@Deprecated
public static SimpleStorage load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
return new SimpleStorage(contractAddress, web3j, transactionManager, gasPrice, gasLimit);
}
public static SimpleStorage load(
String contractAddress,
Web3j web3j,
Credentials credentials,
ContractGasProvider contractGasProvider) {
return new SimpleStorage(contractAddress, web3j, credentials, contractGasProvider);
}
public static SimpleStorage load(
String contractAddress,
Web3j web3j,
TransactionManager transactionManager,
ContractGasProvider contractGasProvider) {
return new SimpleStorage(contractAddress, web3j, transactionManager, contractGasProvider);
}
public static RemoteCall<SimpleStorage> deploy(
Web3j web3j, Credentials credentials, ContractGasProvider contractGasProvider) {
return deployRemoteCall(
SimpleStorage.class, web3j, credentials, contractGasProvider, BINARY, "");
}
@Deprecated
public static RemoteCall<SimpleStorage> deploy(
Web3j web3j, Credentials credentials, BigInteger gasPrice, BigInteger gasLimit) {
return deployRemoteCall(
SimpleStorage.class, web3j, credentials, gasPrice, gasLimit, BINARY, "");
}
public static RemoteCall<SimpleStorage> deploy(
Web3j web3j, TransactionManager transactionManager, ContractGasProvider contractGasProvider) {
return deployRemoteCall(
SimpleStorage.class, web3j, transactionManager, contractGasProvider, BINARY, "");
}
@Deprecated
public static RemoteCall<SimpleStorage> deploy(
Web3j web3j,
TransactionManager transactionManager,
BigInteger gasPrice,
BigInteger gasLimit) {
return deployRemoteCall(
SimpleStorage.class, web3j, transactionManager, gasPrice, gasLimit, BINARY, "");
}
}

@ -154,7 +154,7 @@ allprojects {
]
options.errorprone {
excludedPaths '.*/(generated|.*ReferenceTest_.*)'
excludedPaths '.*/(generated/*.*|.*ReferenceTest_.*)'
check('FutureReturnValueIgnored', CheckSeverity.OFF)
check('InsecureCryptoUsage', CheckSeverity.WARN)
check('FieldCanBeFinal', CheckSeverity.WARN)

@ -51,7 +51,7 @@ dependencyManagement {
dependency('org.openjdk.jmh:jmh-core:1.21')
dependency('org.openjdk.jmh:jmh-generator-annprocess:1.21')
dependency('org.web3j:core:3.5.0')
dependency('org.web3j:core:4.0.1')
dependency("com.google.errorprone:error_prone_check_api:2.3.1")
dependency("com.google.errorprone:error_prone_core:2.3.1")
dependency("com.google.errorprone:error_prone_annotation:2.3.1")

Loading…
Cancel
Save