Skip to content
Closed
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 @@ -242,17 +242,6 @@ public static long getTransactionAmount(Transaction.Contract contract, String ha
case TransferContract:
amount = contractParameter.unpack(TransferContract.class).getAmount();
break;
case TransferAssetContract:
amount = contractParameter.unpack(TransferAssetContract.class).getAmount();
break;
case VoteWitnessContract:
List<Vote> votesList = contractParameter.unpack(VoteWitnessContract.class).getVotesList();
long voteNumber = 0L;
for (Vote vote : votesList) {
voteNumber += vote.getVoteCount();
}
amount = voteNumber;
break;
case WitnessCreateContract:
amount = 9999_000_000L;
break;
Expand All @@ -261,22 +250,19 @@ public static long getTransactionAmount(Transaction.Contract contract, String ha
amount = 1024_000_000L;
break;
case ParticipateAssetIssueContract:
break;
case UnfreezeAssetContract:
case VoteWitnessContract:
case TransferAssetContract:
case ExchangeWithdrawContract:
case ExchangeInjectContract:
case ExchangeTransactionContract:
break;
case FreezeBalanceContract:
amount = contractParameter.unpack(FreezeBalanceContract.class).getFrozenBalance();
break;
case TriggerSmartContract:
amount = contractParameter.unpack(TriggerSmartContract.class).getCallValue();
break;
case ExchangeInjectContract:
amount = contractParameter.unpack(ExchangeInjectContract.class).getQuant();
break;
case ExchangeWithdrawContract:
amount = contractParameter.unpack(ExchangeWithdrawContract.class).getQuant();
break;
case ExchangeTransactionContract:
amount = contractParameter.unpack(ExchangeTransactionContract.class).getQuant();
break;
case AccountPermissionUpdateContract:
amount = 100_000_000L;
break;
Expand All @@ -296,10 +282,6 @@ public static long getTransactionAmount(Transaction.Contract contract, String ha
case CancelAllUnfreezeV2Contract:
amount = getAmountFromTransactionInfo(hash, contract.getType(), transactionInfo);
break;
case UnfreezeAssetContract:
amount = getUnfreezeAssetAmount(contractParameter.unpack(UnfreezeAssetContract.class)
.getOwnerAddress().toByteArray(), wallet);
break;
default:
}
} catch (Exception e) {
Expand Down Expand Up @@ -354,33 +336,6 @@ public static long getAmountFromTransactionInfo(String hash, ContractType contra
}
return amount;
}

public static long getUnfreezeAssetAmount(byte[] addressBytes, Wallet wallet) {
long amount = 0L;
try {
if (addressBytes == null) {
return amount;
}

AssetIssueList assetIssueList = wallet
.getAssetIssueByAccount(ByteString.copyFrom(addressBytes));
if (assetIssueList != null) {
if (assetIssueList.getAssetIssueCount() != 1) {
return amount;
} else {
AssetIssueContract assetIssue = assetIssueList.getAssetIssue(0);
for (FrozenSupply frozenSupply : assetIssue.getFrozenSupplyList()) {
amount += frozenSupply.getFrozenAmount();
}
}
}
} catch (Exception e) {
logger.warn("Exception happens when get token10 frozenAmount. Exception = [{}]",
Throwables.getStackTraceAsString(e));
}
return amount;
}

/**
* convert 40 or 42 hex string of address to byte array, compatible with "41"(T) ahead,
* padding 0 ahead if length is odd.
Expand Down