Search in sources :

Example 16 with UsageAccumulator

use of com.hedera.services.usage.state.UsageAccumulator in project hedera-services by hashgraph.

the class HapiTokenUnfreeze method usageEstimate.

private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
    UsageAccumulator accumulator = new UsageAccumulator();
    final var tokenUnfreezeMeta = TOKEN_OPS_USAGE_UTILS.tokenUnfreezeUsageFrom();
    final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
    TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
    tokenOpsUsage.tokenUnfreezeUsage(suFrom(svo), baseTransactionMeta, tokenUnfreezeMeta, accumulator);
    return AdapterUtils.feeDataFrom(accumulator);
}
Also used : BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage)

Example 17 with UsageAccumulator

use of com.hedera.services.usage.state.UsageAccumulator in project hedera-services by hashgraph.

the class HapiTokenUnpause method usageEstimate.

private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
    UsageAccumulator accumulator = new UsageAccumulator();
    final var tokenUnpauseMeta = TOKEN_OPS_USAGE_UTILS.tokenUnpauseUsageFrom();
    final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
    TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
    tokenOpsUsage.tokenUnpauseUsage(suFrom(svo), baseTransactionMeta, tokenUnpauseMeta, accumulator);
    return AdapterUtils.feeDataFrom(accumulator);
}
Also used : BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage)

Aggregations

BaseTransactionMeta (com.hedera.services.usage.BaseTransactionMeta)17 UsageAccumulator (com.hedera.services.usage.state.UsageAccumulator)17 TokenOpsUsage (com.hedera.services.usage.token.TokenOpsUsage)8 Test (org.junit.jupiter.api.Test)8 ByteString (com.google.protobuf.ByteString)6 Key (com.hederahashgraph.api.proto.java.Key)5 SigUsage (com.hedera.services.usage.SigUsage)4 SignatureMap (com.hederahashgraph.api.proto.java.SignatureMap)2 MoreObjects (com.google.common.base.MoreObjects)1 BoolValue (com.google.protobuf.BoolValue)1 Int32Value (com.google.protobuf.Int32Value)1 StringValue (com.google.protobuf.StringValue)1 UInt64Value (com.google.protobuf.UInt64Value)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 HapiPropertySource (com.hedera.services.bdd.spec.HapiPropertySource)1 PropertySource.asAccountString (com.hedera.services.bdd.spec.PropertySource.asAccountString)1 AdapterUtils (com.hedera.services.bdd.spec.fees.AdapterUtils)1 FeeCalculator (com.hedera.services.bdd.spec.fees.FeeCalculator)1 QueryVerbs.getAccountInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountInfo)1 HapiGetAccountInfo (com.hedera.services.bdd.spec.queries.crypto.HapiGetAccountInfo)1