use of com.hedera.services.usage.BaseTransactionMeta in project hedera-services by hashgraph.
the class UsageAccumulatorTest method resetWorksForTxn.
@Test
void resetWorksForTxn() {
// given:
subject.addSbpr(3);
subject.addGas(5);
subject.addSbs(7);
// when:
subject.resetForTransaction(new BaseTransactionMeta(memoBytes, numTransfers), sigUsage);
// then:
assertEquals(baseBpr, subject.getBpr());
assertEquals(baseVpt, subject.getVpt());
assertEquals(baseBpt, subject.getBpt());
assertEquals(baseRbs, subject.getRbs());
assertEquals(baseNetworkRbs, subject.getNetworkRbs());
assertEquals(sigUsage.numPayerKeys(), subject.getNumPayerKeys());
// and:
assertEquals(0, subject.getSbpr());
assertEquals(0, subject.getGas());
assertEquals(0, subject.getSbs());
}
use of com.hedera.services.usage.BaseTransactionMeta in project hedera-services by hashgraph.
the class HapiTokenFreeze method usageEstimate.
private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
UsageAccumulator accumulator = new UsageAccumulator();
final var tokenFreezeMeta = TOKEN_OPS_USAGE_UTILS.tokenFreezeUsageFrom();
final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
tokenOpsUsage.tokenFreezeUsage(suFrom(svo), baseTransactionMeta, tokenFreezeMeta, accumulator);
return AdapterUtils.feeDataFrom(accumulator);
}
use of com.hedera.services.usage.BaseTransactionMeta in project hedera-services by hashgraph.
the class HapiTokenBurn method usageEstimate.
private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
UsageAccumulator accumulator = new UsageAccumulator();
final var tokenBurnMeta = TOKEN_OPS_USAGE_UTILS.tokenBurnUsageFrom(txn, subType);
final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
tokenOpsUsage.tokenBurnUsage(suFrom(svo), baseTransactionMeta, tokenBurnMeta, accumulator);
return AdapterUtils.feeDataFrom(accumulator);
}
use of com.hedera.services.usage.BaseTransactionMeta in project hedera-services by hashgraph.
the class HapiTokenCreate method usageEstimate.
private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
UsageAccumulator accumulator = new UsageAccumulator();
final var tokenCreateMeta = TOKEN_OPS_USAGE_UTILS.tokenCreateUsageFrom(txn);
final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
tokenOpsUsage.tokenCreateUsage(suFrom(svo), baseTransactionMeta, tokenCreateMeta, accumulator);
return AdapterUtils.feeDataFrom(accumulator);
}
use of com.hedera.services.usage.BaseTransactionMeta in project hedera-services by hashgraph.
the class HapiTokenWipe method usageEstimate.
private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
UsageAccumulator accumulator = new UsageAccumulator();
final var tokenWipeMeta = TOKEN_OPS_USAGE_UTILS.tokenWipeUsageFrom(txn, subType);
final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
tokenOpsUsage.tokenWipeUsage(suFrom(svo), baseTransactionMeta, tokenWipeMeta, accumulator);
return AdapterUtils.feeDataFrom(accumulator);
}
Aggregations