xiaoyong931011
2022-12-13 05a18b27be6ecfbbc080388f92c0d1857eeffb94
20221213转币
2 files modified
6 ■■■■ changed files
src/main/java/cc/mrbird/febs/dapp/contract/ContractMain.java 2 ●●●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java 4 ●●● patch | view | raw | blame | history
src/main/java/cc/mrbird/febs/dapp/contract/ContractMain.java
@@ -142,7 +142,9 @@
        Abi contract = Abi.load(contractAddr, getInstance(), credentials, getStaticGasProvider());
        try {
            TransactionReceipt send = contract.trans(amount, to1).send();
            if(ObjectUtil.isNotEmpty(send)){
            transactionHash = send.getTransactionHash();
            }
        } catch (Exception exception) {
            exception.printStackTrace();
        }
src/main/java/cc/mrbird/febs/dapp/service/impl/DappSystemServiceImpl.java
@@ -29,6 +29,7 @@
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.web3j.utils.Convert;
import java.math.BigDecimal;
import java.math.BigInteger;
@@ -565,7 +566,8 @@
        }
        String address = dappMemberEntity.getAddress();
        log.info("{}",address);
        String hash = contractMain.trans(new BigInteger(amount.toString()),address);
        BigInteger bigInteger = new BigInteger(Convert.toWei(amount.toString(), Convert.Unit.ETHER).setScale(0).toString());
        String hash = contractMain.trans(bigInteger,address);
        if(StrUtil.isEmpty(hash)){
            return;
        }