Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "fix unable to parse tuples containing dynamic types" #71

Merged
merged 1 commit into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -477,11 +477,7 @@ public TupleType() {

@Override
public boolean isDynamicType() {
return containsDynamicTypes();
}

private boolean containsDynamicTypes(){
return types.stream().anyMatch(SolidityType::isDynamicType);
return false;
}

@Override
Expand Down Expand Up @@ -519,4 +515,4 @@ public byte[] encode(Object value) {
return super.encode(ByteUtil.merge((byte[]) value, new byte[8]));
}
}
}
}
23 changes: 0 additions & 23 deletions src/test/java/net/osslabz/evm/abi/AbiDecoderTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -126,29 +126,6 @@ public void testDecodeFunctionCallUniswapV3SwapRouter02Swap() throws IOException
List<DecodedFunctionCall> decodedFunctionCalls = uniswapv3SwapRouter02Abi.decodeFunctionsCalls(inputData);


int i = 0;
for (DecodedFunctionCall func : decodedFunctionCalls) {
log.debug("{}: function: {}", i, func.getName());
int p = 0;
for (DecodedFunctionCall.Param param : func.getParams()) {
log.debug("param {}: name={}, type={}, value={}", p, param.getName(), param.getType(), param.getValue());
p++;
}
i++;
log.debug("-------------------------");
}
}

@Test
public void testDecodeFunctionCallTupleContainingDynamicTypes() throws IOException {

// https://api-testnet.bscscan.com/api?module=contract&action=getabi&address=0xb7564227245bb161ebf4d350e1056c26801f1366&format=raw
AbiDecoder sereshForwarderAbi = new AbiDecoder(this.getClass().getResource("/abiFiles/SereshForwarder.json").getFile());

// https://testnet.bscscan.com/tx/0x73b80d49777f0c32d45a0a5a7c3487eb9e8da2c93922540c260cdafc3e81a165
String inputData = "0x005575f20000000000000000000000000000000000000000000000000000000000000080967c9812e5f939318262ccbd023be072015c3ad2f470d47ab5e6b13e1ca810a540274bf9ce7b9da08b0003fc05e67d74e993f3381bf00bcba0fef022bf3b8d6a000000000000000000000000000000000000000000000000000000000000001b000000000000000000000000ddcfc6f09a26413c2b0d6224b29738e74102de04000000000000000000000000cbb869911c0acd242c15a03c42ce3ddcdd82ea1b000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000038d7ea4c68000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000c000000000000000000000000000000000000000000000000000000000000001e4216f62d8000000000000000000000000000000000000000000000000000000000000008000000000000000000000000000000000000000000000000000000000000000e0000000000000000000000000000000000000000000000000000000000000014000000000000000000000000000000000000000000000000000000000000001a0000000000000000000000000000000000000000000000000000000000000003b6261666b7265696263796c746f36667974667336746f796f6f716f6b6272366e333566673767683236646e6f3464766a716c6d743464687a34716d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b726569647533356c64727965703433797574337275616a747936743278346b3773787077737365347572616b7676366d723763657a696d0000000000000000000000000000000000000000000000000000000000000000000000003b6261666b7265696567616e657563727a6e646b6676726a64346a63346235356174646b707475326d6d3779327372783235617068626b623666373400000000000000000000000000000000000000000000000000000000000000000000000001000000000000000000000000ddcfc6f09a26413c2b0d6224b29738e74102de0400000000000000000000000000000000000000000000000000000000";
List<DecodedFunctionCall> decodedFunctionCalls = sereshForwarderAbi.decodeFunctionsCalls(inputData);

int i = 0;
for (DecodedFunctionCall func : decodedFunctionCalls) {
log.debug("{}: function: {}", i, func.getName());
Expand Down
263 changes: 0 additions & 263 deletions src/test/resources/abiFiles/SereshForwarder.json

This file was deleted.