SmartTokenLabs / dvp

Smart contracts and tokenscripts used for Delivery-versus-Payment usecases
https://tokenscript.org
0 stars 0 forks source link

conflict with org.web3j.tx.Contract for generating web3j wrapper #69

Closed lyhistory closed 6 years ago

lyhistory commented 6 years ago

reproduce: solc \contracts\spawnable-contract\schema1\MeetupContract.sol --bin --abi --optimize -o build/ web3j solidity generate build/TicketPro.bin build/TicketPro.abi -o src/main/java/ -p io.stormbird.token.management.contracts.generated

it will generate class TicketPro with a function: public RemoteCall<String> getContractAddress() { final Function function = new Function(FUNC_GETCONTRACTADDRESS, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {})); return executeRemoteCallSingleValueReturn(function, String.class); }

this generated wrapper extends org.web3j.tx.Contract which already has a getContractAddress() function with String as return public String getContractAddress() { return contractAddress; } this raise conflicts and cause compile fail

lyhistory commented 6 years ago

replied by Mr James Sangalli: This is common Change return type to string Sometimes you have to change it to something more generic for type

closed

lyhistory commented 6 years ago

have to reopen this ticket, don't know how to make this function override the parent function, (I simply workaround it by change the function name to getTheContractAddress())

public class TicketPro extends Contract { public RemoteCall<String> getContractAddress() { final Function function = new Function(FUNC_GETTHECONTRACTADDRESS, Arrays.<Type>asList(), Arrays.<TypeReference<?>>asList(new TypeReference<Address>() {})); return executeRemoteCallSingleValueReturn(function, String.class); } public abstract class Contract extends ManagedTransaction { public String getContractAddress() { return contractAddress; }