Search in sources :

Example 16 with BaseTransactionMeta

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

the class HapiTokenMint method usageEstimate.

private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) throws Throwable {
    UsageAccumulator accumulator = new UsageAccumulator();
    long lifetime = 0L;
    if (subType == SubType.TOKEN_NON_FUNGIBLE_UNIQUE) {
        lifetime = info.getExpiry().getSeconds() - txn.getTransactionID().getTransactionValidStart().getSeconds();
    }
    final var tokenBurnMeta = TOKEN_OPS_USAGE_UTILS.tokenMintUsageFrom(txn, subType, lifetime);
    final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
    TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
    tokenOpsUsage.tokenMintUsage(suFrom(svo), baseTransactionMeta, tokenBurnMeta, 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 BaseTransactionMeta

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

the class HapiTokenPause method usageEstimate.

private FeeData usageEstimate(TransactionBody txn, SigValueObj svo) {
    UsageAccumulator accumulator = new UsageAccumulator();
    final var tokenPauseMeta = TOKEN_OPS_USAGE_UTILS.tokenPauseUsageFrom();
    final var baseTransactionMeta = new BaseTransactionMeta(txn.getMemoBytes().size(), 0);
    TokenOpsUsage tokenOpsUsage = new TokenOpsUsage();
    tokenOpsUsage.tokenPauseUsage(suFrom(svo), baseTransactionMeta, tokenPauseMeta, 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 18 with BaseTransactionMeta

use of com.hedera.services.usage.BaseTransactionMeta 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 19 with BaseTransactionMeta

use of com.hedera.services.usage.BaseTransactionMeta 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)19 UsageAccumulator (com.hedera.services.usage.state.UsageAccumulator)17 Test (org.junit.jupiter.api.Test)10 TokenOpsUsage (com.hedera.services.usage.token.TokenOpsUsage)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