Skip to content

Commit

Permalink
Web3j update (Consensys#39)
Browse files Browse the repository at this point in the history
Fix mis-naming. Change from RLP to ABI. Functions and parameters are ABI encoded, and not RLP encoded.
  • Loading branch information
drinkcoffee authored Nov 4, 2021
1 parent 80fbeab commit 29b0f2a
Show file tree
Hide file tree
Showing 82 changed files with 420 additions and 420 deletions.
24 changes: 12 additions & 12 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ commands:
- run:
name: Check out Web3j
command: |
git clone https://github.com/drinkcoffee/web3j-rlp.git ../web3j-rlp
git --git-dir=../web3j-rlp/.git rev-parse HEAD > ../web3j-rlp/headcommit
git clone https://github.com/drinkcoffee/web3j-abi.git ../web3j-abi
git --git-dir=../web3j-abi/.git rev-parse HEAD > ../web3j-abi/headcommit
- restore_cache:
name: Restore cached Web3j gradle dependencies
keys:
- deps-web3j-{{ checksum "../web3j-rlp/build.gradle" }}
- deps-web3j-{{ checksum "../web3j-abi/build.gradle" }}
- deps-web3j
- restore_cache:
name: Restore cached GPACT gradle dependencies
Expand All @@ -21,8 +21,8 @@ commands:
- restore_cache:
name: Restore gradle build cache
keys: # by decreasing rate of change...
- build-cache-{{ checksum "../web3j-rlp/headcommit" }}-{{ .Revision }}
- build-cache-{{ checksum "../web3j-rlp/headcommit" }}
- build-cache-{{ checksum "../web3j-abi/headcommit" }}-{{ .Revision }}
- build-cache-{{ checksum "../web3j-abi/headcommit" }}
- build-cache
- run:
name: Install Solidity
Expand Down Expand Up @@ -68,14 +68,14 @@ jobs:
command: |
pushd .
# Build our Web3j
cd ../web3j-rlp
cd ../web3j-abi
./gradlew --parallel --stacktrace --info --build-cache installDist
popd
# Build the gpact
./gradlew --parallel --stacktrace --info --build-cache clean compileJava compileTestJava assemble
- save_cache:
name: Caching Web3j gradle dependencies
key: deps-web3j-{{ checksum "../web3j-rlp/build.gradle" }}
key: deps-web3j-{{ checksum "../web3j-abi/build.gradle" }}
paths:
- ../web3j/.gradle
- save_cache:
Expand All @@ -85,15 +85,15 @@ jobs:
- .gradle
- save_cache:
name: Caching gradle build cache
key: build-cache-{{ checksum "../besu/headcommit" }}-{{ checksum "../web3j-rlp/headcommit" }}-{{ .Revision }}
key: build-cache-{{ checksum "../besu/headcommit" }}-{{ checksum "../web3j-abi/headcommit" }}-{{ .Revision }}
paths:
- ~/.gradle

# - persist_to_workspace:
# root: ~/
# paths:
# - ./gpact
# - ./web3j-rlp
# - ./web3j-abi
# - ./besu/build/install
# - store_artifacts:
# name: Distribution artifacts
Expand All @@ -113,7 +113,7 @@ jobs:
name: Build web3j
command: |
# Build our Web3j
cd ../web3j-rlp
cd ../web3j-abi
./gradlew --parallel --stacktrace --info --build-cache installDist
- setup_remote_docker:
version: 20.10.6
Expand Down Expand Up @@ -189,13 +189,13 @@ jobs:
steps:
# The home directory is: /home/circleci/project
# gpact is cloned to: /home/circleci/project/.
# web3j is cloned to: /home/circleci/web3j-rlp
# web3j is cloned to: /home/circleci/web3j-abi
- prepare
- run:
name: Build web3j
command: |
# Build our Web3j
cd ../web3j-rlp
cd ../web3j-abi
./gradlew --parallel --stacktrace --info --build-cache installDist
- run:
name: Create and Start blockchains
Expand Down
12 changes: 6 additions & 6 deletions application/atomic-appcontracts/erc20/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,12 @@ dependencies {
// implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.12.0'
//
//
implementation files('../../../../web3j-rlp/abi/build/libs/abi-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-rlp/core/build/libs/core-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-rlp/crypto/build/libs/crypto-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-rlp/rlp/build/libs/rlp-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-rlp/utils/build/libs/utils-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-rlp/tuples/build/libs/tuples-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-abi/abi/build/libs/abi-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-abi/core/build/libs/core-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-abi/crypto/build/libs/crypto-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-abi/rlp/build/libs/rlp-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-abi/utils/build/libs/utils-4.8.5-SNAPSHOT.jar')
implementation files('../../../../web3j-abi/tuples/build/libs/tuples-4.8.5-SNAPSHOT.jar')
implementation "io.reactivex.rxjava2:rxjava:2.2.2"

testImplementation project (path: ':common')
Expand Down
2 changes: 1 addition & 1 deletion application/atomic-appcontracts/erc20/gen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ OUTPUTDIR=$HERE/src/main/java
TESTOUTPUTDIR=$HERE/src/test/java
PACKAGE=net.consensys.gpact.appcontracts.atomic.erc20.soliditywrappers
#WEB3J=web3j
WEB3J=../web3j-rlp/codegen/build/install/codegen/bin/codegen
WEB3J=../web3j-abi/codegen/build/install/codegen/bin/codegen

solc $CONTRACTSDIR/presets/LockableERC20PresetFixedSupply.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
solc $CONTRACTSDIR/presets/LockableERC20PresetMinterPauser.sol --allow-paths . --bin --abi --optimize -o $BUILDDIR --overwrite
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ public RemoteFunctionCall<byte[]> DEFAULT_ADMIN_ROLE() {
return executeRemoteCallSingleValueReturn(function, byte[].class);
}

public String getRLP_DEFAULT_ADMIN_ROLE() {
public String getABI_DEFAULT_ADMIN_ROLE() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_DEFAULT_ADMIN_ROLE,
Arrays.<Type>asList(),
Expand All @@ -520,7 +520,7 @@ public RemoteFunctionCall<byte[]> MAPPING_ROLE() {
return executeRemoteCallSingleValueReturn(function, byte[].class);
}

public String getRLP_MAPPING_ROLE() {
public String getABI_MAPPING_ROLE() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_MAPPING_ROLE,
Arrays.<Type>asList(),
Expand All @@ -535,7 +535,7 @@ public RemoteFunctionCall<byte[]> PAUSER_ROLE() {
return executeRemoteCallSingleValueReturn(function, byte[].class);
}

public String getRLP_PAUSER_ROLE() {
public String getABI_PAUSER_ROLE() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_PAUSER_ROLE,
Arrays.<Type>asList(),
Expand All @@ -551,7 +551,7 @@ public RemoteFunctionCall<TransactionReceipt> addApprovedRootBcId(BigInteger _bc
return executeRemoteCallTransaction(function);
}

public String getRLP_addApprovedRootBcId(BigInteger _bcId) {
public String getABI_addApprovedRootBcId(BigInteger _bcId) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_ADDAPPROVEDROOTBCID,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId)),
Expand All @@ -570,7 +570,7 @@ public RemoteFunctionCall<TransactionReceipt> addContractFirstMapping(String _th
return executeRemoteCallTransaction(function);
}

public String getRLP_addContractFirstMapping(String _thisBcTokenContract, BigInteger _otherBcId, String _otherTokenContract, Boolean _thisBcMassC) {
public String getABI_addContractFirstMapping(String _thisBcTokenContract, BigInteger _otherBcId, String _otherTokenContract, Boolean _thisBcMassC) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_ADDCONTRACTFIRSTMAPPING,
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _thisBcTokenContract),
Expand All @@ -590,7 +590,7 @@ public RemoteFunctionCall<TransactionReceipt> addRemoteERC20Bridge(BigInteger _o
return executeRemoteCallTransaction(function);
}

public String getRLP_addRemoteERC20Bridge(BigInteger _otherBcId, String _otherErc20Bridge) {
public String getABI_addRemoteERC20Bridge(BigInteger _otherBcId, String _otherErc20Bridge) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_ADDREMOTEERC20BRIDGE,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_otherBcId),
Expand All @@ -609,7 +609,7 @@ public RemoteFunctionCall<TransactionReceipt> changeContractMapping(String _this
return executeRemoteCallTransaction(function);
}

public String getRLP_changeContractMapping(String _thisBcTokenContract, BigInteger _otherBcId, String _otherTokenContract) {
public String getABI_changeContractMapping(String _thisBcTokenContract, BigInteger _otherBcId, String _otherTokenContract) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_CHANGECONTRACTMAPPING,
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _thisBcTokenContract),
Expand All @@ -627,7 +627,7 @@ public RemoteFunctionCall<String> getBcIdTokenMaping(BigInteger _bcId, String _t
return executeRemoteCallSingleValueReturn(function, String.class);
}

public String getRLP_getBcIdTokenMaping(BigInteger _bcId, String _tokenContract) {
public String getABI_getBcIdTokenMaping(BigInteger _bcId, String _tokenContract) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_GETBCIDTOKENMAPING,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId),
Expand All @@ -643,7 +643,7 @@ public RemoteFunctionCall<String> getRemoteErc20BridgeContract(BigInteger _bcId)
return executeRemoteCallSingleValueReturn(function, String.class);
}

public String getRLP_getRemoteErc20BridgeContract(BigInteger _bcId) {
public String getABI_getRemoteErc20BridgeContract(BigInteger _bcId) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_GETREMOTEERC20BRIDGECONTRACT,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId)),
Expand All @@ -658,7 +658,7 @@ public RemoteFunctionCall<byte[]> getRoleAdmin(byte[] role) {
return executeRemoteCallSingleValueReturn(function, byte[].class);
}

public String getRLP_getRoleAdmin(byte[] role) {
public String getABI_getRoleAdmin(byte[] role) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_GETROLEADMIN,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(role)),
Expand All @@ -675,7 +675,7 @@ public RemoteFunctionCall<TransactionReceipt> grantRole(byte[] role, String acco
return executeRemoteCallTransaction(function);
}

public String getRLP_grantRole(byte[] role, String account) {
public String getABI_grantRole(byte[] role, String account) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_GRANTROLE,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(role),
Expand All @@ -692,7 +692,7 @@ public RemoteFunctionCall<Boolean> hasRole(byte[] role, String account) {
return executeRemoteCallSingleValueReturn(function, Boolean.class);
}

public String getRLP_hasRole(byte[] role, String account) {
public String getABI_hasRole(byte[] role, String account) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_HASROLE,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(role),
Expand All @@ -709,7 +709,7 @@ public RemoteFunctionCall<Boolean> isBcIdTokenAllowed(BigInteger _bcId, String _
return executeRemoteCallSingleValueReturn(function, Boolean.class);
}

public String getRLP_isBcIdTokenAllowed(BigInteger _bcId, String _tokenContract) {
public String getABI_isBcIdTokenAllowed(BigInteger _bcId, String _tokenContract) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_ISBCIDTOKENALLOWED,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId),
Expand All @@ -726,7 +726,7 @@ public RemoteFunctionCall<TransactionReceipt> pause() {
return executeRemoteCallTransaction(function);
}

public String getRLP_pause() {
public String getABI_pause() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_PAUSE,
Arrays.<Type>asList(),
Expand All @@ -741,7 +741,7 @@ public RemoteFunctionCall<Boolean> paused() {
return executeRemoteCallSingleValueReturn(function, Boolean.class);
}

public String getRLP_paused() {
public String getABI_paused() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_PAUSED,
Arrays.<Type>asList(),
Expand All @@ -759,7 +759,7 @@ public RemoteFunctionCall<TransactionReceipt> receiveFromOtherBlockchain(String
return executeRemoteCallTransaction(function);
}

public String getRLP_receiveFromOtherBlockchain(String _destTokenContract, String _recipient, BigInteger _amount) {
public String getABI_receiveFromOtherBlockchain(String _destTokenContract, String _recipient, BigInteger _amount) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_RECEIVEFROMOTHERBLOCKCHAIN,
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _destTokenContract),
Expand All @@ -777,7 +777,7 @@ public RemoteFunctionCall<TransactionReceipt> removeApprovedRootBcId(BigInteger
return executeRemoteCallTransaction(function);
}

public String getRLP_removeApprovedRootBcId(BigInteger _bcId) {
public String getABI_removeApprovedRootBcId(BigInteger _bcId) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_REMOVEAPPROVEDROOTBCID,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_bcId)),
Expand All @@ -794,7 +794,7 @@ public RemoteFunctionCall<TransactionReceipt> renounceRole(byte[] role, String a
return executeRemoteCallTransaction(function);
}

public String getRLP_renounceRole(byte[] role, String account) {
public String getABI_renounceRole(byte[] role, String account) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_RENOUNCEROLE,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(role),
Expand All @@ -812,7 +812,7 @@ public RemoteFunctionCall<TransactionReceipt> revokeRole(byte[] role, String acc
return executeRemoteCallTransaction(function);
}

public String getRLP_revokeRole(byte[] role, String account) {
public String getABI_revokeRole(byte[] role, String account) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_REVOKEROLE,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes32(role),
Expand All @@ -830,7 +830,7 @@ public RemoteFunctionCall<TransactionReceipt> setTokenConfig(String _thisBcToken
return executeRemoteCallTransaction(function);
}

public String getRLP_setTokenConfig(String _thisBcTokenContract, Boolean _thisBcMassC) {
public String getABI_setTokenConfig(String _thisBcTokenContract, Boolean _thisBcMassC) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_SETTOKENCONFIG,
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _thisBcTokenContract),
Expand All @@ -846,7 +846,7 @@ public RemoteFunctionCall<Boolean> supportsInterface(byte[] interfaceId) {
return executeRemoteCallSingleValueReturn(function, Boolean.class);
}

public String getRLP_supportsInterface(byte[] interfaceId) {
public String getABI_supportsInterface(byte[] interfaceId) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_SUPPORTSINTERFACE,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Bytes4(interfaceId)),
Expand All @@ -861,7 +861,7 @@ public RemoteFunctionCall<BigInteger> tokenContractConfiguration(String param0)
return executeRemoteCallSingleValueReturn(function, BigInteger.class);
}

public String getRLP_tokenContractConfiguration(String param0) {
public String getABI_tokenContractConfiguration(String param0) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_TOKENCONTRACTCONFIGURATION,
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, param0)),
Expand All @@ -881,7 +881,7 @@ public RemoteFunctionCall<TransactionReceipt> transferFromAccountToOtherBlockcha
return executeRemoteCallTransaction(function);
}

public String getRLP_transferFromAccountToOtherBlockchain(String _sender, BigInteger _destBcId, String _srcTokenContract, String _recipient, BigInteger _amount) {
public String getABI_transferFromAccountToOtherBlockchain(String _sender, BigInteger _destBcId, String _srcTokenContract, String _recipient, BigInteger _amount) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_TRANSFERFROMACCOUNTTOOTHERBLOCKCHAIN,
Arrays.<Type>asList(new org.web3j.abi.datatypes.Address(160, _sender),
Expand All @@ -904,7 +904,7 @@ public RemoteFunctionCall<TransactionReceipt> transferToOtherBlockchain(BigInteg
return executeRemoteCallTransaction(function);
}

public String getRLP_transferToOtherBlockchain(BigInteger _destBcId, String _srcTokenContract, String _recipient, BigInteger _amount) {
public String getABI_transferToOtherBlockchain(BigInteger _destBcId, String _srcTokenContract, String _recipient, BigInteger _amount) {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_TRANSFERTOOTHERBLOCKCHAIN,
Arrays.<Type>asList(new org.web3j.abi.datatypes.generated.Uint256(_destBcId),
Expand All @@ -923,7 +923,7 @@ public RemoteFunctionCall<TransactionReceipt> unpause() {
return executeRemoteCallTransaction(function);
}

public String getRLP_unpause() {
public String getABI_unpause() {
final org.web3j.abi.datatypes.Function function = new org.web3j.abi.datatypes.Function(
FUNC_UNPAUSE,
Arrays.<Type>asList(),
Expand Down
Loading

0 comments on commit 29b0f2a

Please sign in to comment.