Search in sources :

Example 1 with TokenOpsUsage

use of com.hedera.services.usage.token.TokenOpsUsage 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);
}
Also used : BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage)

Example 2 with TokenOpsUsage

use of com.hedera.services.usage.token.TokenOpsUsage 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);
}
Also used : BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage)

Example 3 with TokenOpsUsage

use of com.hedera.services.usage.token.TokenOpsUsage 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);
}
Also used : BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage)

Example 4 with TokenOpsUsage

use of com.hedera.services.usage.token.TokenOpsUsage 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);
}
Also used : BaseTransactionMeta(com.hedera.services.usage.BaseTransactionMeta) UsageAccumulator(com.hedera.services.usage.state.UsageAccumulator) TokenOpsUsage(com.hedera.services.usage.token.TokenOpsUsage)

Example 5 with TokenOpsUsage

use of com.hedera.services.usage.token.TokenOpsUsage 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)

Aggregations

BaseTransactionMeta (com.hedera.services.usage.BaseTransactionMeta)8 UsageAccumulator (com.hedera.services.usage.state.UsageAccumulator)8 TokenOpsUsage (com.hedera.services.usage.token.TokenOpsUsage)8