@Test public void toFunction() { CreateERC67FundRequest erc67FundRequest = CreateERC67FundRequest .builder() .amount(new BigDecimal("100.837483")) .tokenAddress("0x02F96eF85cAd6639500CA1cc8356F0b5CA5bF1D2") .platform("github") .platformId("1") .build(); when(tokenInfoService.getTokenInfo(erc67FundRequest.getTokenAddress())).thenReturn(TokenInfoDto.builder().decimals(18).build()); String result = erc67Generator.toFunction(erc67FundRequest); assertThat(result).isEqualTo("approveAndCall(address 0xC16a102813B7bD98b0BEF2dF28FFCaf1Fbee97c0, uint256 100837483000000000000, bytes 0x6769746875627c4141437c31)"); }
public String toFunction(CreateERC67FundRequest erc67FundRequest) { TokenInfoDto tokenInfo = tokenInfoService.getTokenInfo(erc67FundRequest.getTokenAddress()); final StringBuilder builder = new StringBuilder("approveAndCall").append("("); builder.append("address ").append(fundRequestContractAddress).append(", "); builder.append("uint256 ").append(getRawValue(erc67FundRequest.getAmount(), tokenInfo.getDecimals()).toString()).append(", "); builder.append("bytes ").append("0x").append(Hex.encodeHexString((getData(erc67FundRequest)).getBytes())); builder.append(")"); return builder.toString(); }
Erc67Generator { public String toFunction(CreateERC67FundRequest erc67FundRequest) { TokenInfoDto tokenInfo = tokenInfoService.getTokenInfo(erc67FundRequest.getTokenAddress()); final StringBuilder builder = new StringBuilder("approveAndCall").append("("); builder.append("address ").append(fundRequestContractAddress).append(", "); builder.append("uint256 ").append(getRawValue(erc67FundRequest.getAmount(), tokenInfo.getDecimals()).toString()).append(", "); builder.append("bytes ").append("0x").append(Hex.encodeHexString((getData(erc67FundRequest)).getBytes())); builder.append(")"); return builder.toString(); } }
Erc67Generator { public String toFunction(CreateERC67FundRequest erc67FundRequest) { TokenInfoDto tokenInfo = tokenInfoService.getTokenInfo(erc67FundRequest.getTokenAddress()); final StringBuilder builder = new StringBuilder("approveAndCall").append("("); builder.append("address ").append(fundRequestContractAddress).append(", "); builder.append("uint256 ").append(getRawValue(erc67FundRequest.getAmount(), tokenInfo.getDecimals()).toString()).append(", "); builder.append("bytes ").append("0x").append(Hex.encodeHexString((getData(erc67FundRequest)).getBytes())); builder.append(")"); return builder.toString(); } Erc67Generator(TokenInfoService tokenInfoService, final @Value("${io.fundrequest.contract.fund-request.address}") String fundRequestContractAddress); }
Erc67Generator { public String toFunction(CreateERC67FundRequest erc67FundRequest) { TokenInfoDto tokenInfo = tokenInfoService.getTokenInfo(erc67FundRequest.getTokenAddress()); final StringBuilder builder = new StringBuilder("approveAndCall").append("("); builder.append("address ").append(fundRequestContractAddress).append(", "); builder.append("uint256 ").append(getRawValue(erc67FundRequest.getAmount(), tokenInfo.getDecimals()).toString()).append(", "); builder.append("bytes ").append("0x").append(Hex.encodeHexString((getData(erc67FundRequest)).getBytes())); builder.append(")"); return builder.toString(); } Erc67Generator(TokenInfoService tokenInfoService, final @Value("${io.fundrequest.contract.fund-request.address}") String fundRequestContractAddress); String toByteData(CreateERC67FundRequest erc67FundRequest); String toFunction(CreateERC67FundRequest erc67FundRequest); }
Erc67Generator { public String toFunction(CreateERC67FundRequest erc67FundRequest) { TokenInfoDto tokenInfo = tokenInfoService.getTokenInfo(erc67FundRequest.getTokenAddress()); final StringBuilder builder = new StringBuilder("approveAndCall").append("("); builder.append("address ").append(fundRequestContractAddress).append(", "); builder.append("uint256 ").append(getRawValue(erc67FundRequest.getAmount(), tokenInfo.getDecimals()).toString()).append(", "); builder.append("bytes ").append("0x").append(Hex.encodeHexString((getData(erc67FundRequest)).getBytes())); builder.append(")"); return builder.toString(); } Erc67Generator(TokenInfoService tokenInfoService, final @Value("${io.fundrequest.contract.fund-request.address}") String fundRequestContractAddress); String toByteData(CreateERC67FundRequest erc67FundRequest); String toFunction(CreateERC67FundRequest erc67FundRequest);  }