An enterprise-grade Java-based, Apache 2.0 licensed Ethereum client https://wiki.hyperledger.org/display/besu
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
besu/acceptance-tests/tests/contracts/CrossContractReader.sol

63 lines
2.0 KiB

/*
* Copyright 2019 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.
*
* SPDX-License-Identifier: Apache-2.0
*/
pragma solidity >=0.7.0 <0.9.0;
import "./EventEmitter.sol";
// compile with:
// solc CrossContractReader.sol --bin --abi --optimize --overwrite -o .
// then create web3j wrappers with:
Add new acceptance test to soak test BFT chains (#7023) * Add new acceptance test to soak test BFT chains Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Spotless Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Tidy up a little with re-usable start and stop functions with built in delays Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Add shanghai version of Simple Storage contract Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Put commented gradle code back in. Fix the web3j example commands in .sol files Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Spotless Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Set publication artifacts to avoid clash Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Exclude from regular acceptance tests Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Add shanghai fork to the test. Stall the chain for less time to reduce the time taken to mine new blocks Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Tidy up Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Update acceptance-tests/tests/shanghai/build.gradle Co-authored-by: Simon Dudley <simon.dudley@consensys.net> Signed-off-by: Matt Whitehead <matthew1001@hotmail.com> * Tidy up var names Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Fix ports for IBFT2 as well as QBFT Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Remove maven publish spec, disable jar building for shanghai contract project Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * web3j version Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Make fixed port optional when creating a BFT node Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> * Only check artifact coordinates for those starting 'org.*' Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> --------- Signed-off-by: Matthew Whitehead <matthew1001@gmail.com> Signed-off-by: Matt Whitehead <matthew1001@hotmail.com> Signed-off-by: Matt Whitehead <matthew.whitehead@kaleido.io> Co-authored-by: Simon Dudley <simon.dudley@consensys.net> Co-authored-by: Sally MacFarlane <macfarla.github@gmail.com>
6 months ago
// web3j generate solidity -b ./generated/CrossContractReader.bin -a ./generated/CrossContractReader.abi -o ../../../../../ -p org.hyperledger.besu.tests.web3j.generated
contract CrossContractReader {
uint counter;
event NewEventEmitter(
address contractAddress
);
function read(address emitter_address) view public returns (uint) {
EventEmitter em = EventEmitter(emitter_address);
return em.value();
}
function deploy() public {
EventEmitter em = new EventEmitter();
emit NewEventEmitter(address(em));
}
function deployRemote(address crossAddress) public {
CrossContractReader cross = CrossContractReader(crossAddress);
cross.deploy();
}
function increment() public {
counter++;
}
function incrementRemote(address crossAddress) public {
CrossContractReader cross = CrossContractReader(crossAddress);
cross.increment();
}
function destroy() public {
selfdestruct(payable(msg.sender));
}
function remoteDestroy(address crossAddress) public {
CrossContractReader cross = CrossContractReader(crossAddress);
cross.destroy();
}
}