use of com.hederahashgraph.fee.FeeObject in project hedera-services by hashgraph.
the class HTSPrecompiledContractTest method gasRequirementReturnsCorrectValueForAssociateTokens.
@Test
void gasRequirementReturnsCorrectValueForAssociateTokens() {
// given
givenFrameContext();
given(input.getInt(0)).willReturn(ABI_ID_ASSOCIATE_TOKENS);
given(decoder.decodeMultipleAssociations(any(), any())).willReturn(associateOp);
final var builder = TokenAssociateTransactionBody.newBuilder();
builder.setAccount(multiDissociateOp.accountId());
builder.addAllTokens(multiDissociateOp.tokenIds());
given(syntheticTxnFactory.createAssociate(any())).willReturn(TransactionBody.newBuilder().setTokenAssociate(builder));
given(feeCalculator.computeFee(any(), any(), any(), any())).willReturn(new FeeObject(TEST_NODE_FEE, TEST_NETWORK_FEE, TEST_SERVICE_FEE));
given(feeCalculator.estimatedGasPriceInTinybars(any(), any())).willReturn(DEFAULT_GAS_PRICE);
subject.prepareFields(messageFrame);
subject.prepareComputation(input, а -> а);
subject.computeGasRequirement(TEST_CONSENSUS_TIME);
// then
assertEquals(Gas.of(EXPECTED_GAS_PRICE), subject.gasRequirement(input));
}
use of com.hederahashgraph.fee.FeeObject in project hedera-services by hashgraph.
the class HTSPrecompiledContractTest method gasRequirementReturnsCorrectValueForDissociateTokens.
@Test
void gasRequirementReturnsCorrectValueForDissociateTokens() {
// given
givenFrameContext();
given(input.getInt(0)).willReturn(ABI_ID_DISSOCIATE_TOKENS);
given(decoder.decodeMultipleDissociations(any(), any())).willReturn(multiDissociateOp);
final var builder = TokenDissociateTransactionBody.newBuilder();
builder.setAccount(multiDissociateOp.accountId());
builder.addAllTokens(multiDissociateOp.tokenIds());
given(syntheticTxnFactory.createDissociate(any())).willReturn(TransactionBody.newBuilder().setTokenDissociate(builder));
given(feeCalculator.computeFee(any(), any(), any(), any())).willReturn(new FeeObject(TEST_NODE_FEE, TEST_NETWORK_FEE, TEST_SERVICE_FEE));
given(feeCalculator.estimatedGasPriceInTinybars(any(), any())).willReturn(DEFAULT_GAS_PRICE);
subject.prepareFields(messageFrame);
subject.prepareComputation(input, а -> а);
subject.computeGasRequirement(TEST_CONSENSUS_TIME);
// then
assertEquals(Gas.of(EXPECTED_GAS_PRICE), subject.gasRequirement(input));
}
use of com.hederahashgraph.fee.FeeObject in project hedera-services by hashgraph.
the class HTSPrecompiledContractTest method gasRequirementReturnsCorrectValueForMintToken.
@Test
void gasRequirementReturnsCorrectValueForMintToken() {
// given
givenFrameContext();
given(input.getInt(0)).willReturn(ABI_ID_MINT_TOKEN);
given(decoder.decodeMint(any())).willReturn(fungibleMint);
given(syntheticTxnFactory.createMint(any())).willReturn(TransactionBody.newBuilder().setTokenMint(TokenMintTransactionBody.newBuilder()));
given(feeCalculator.computeFee(any(), any(), any(), any())).willReturn(new FeeObject(TEST_NODE_FEE, TEST_NETWORK_FEE, TEST_SERVICE_FEE));
given(feeCalculator.estimatedGasPriceInTinybars(any(), any())).willReturn(DEFAULT_GAS_PRICE);
subject.prepareFields(messageFrame);
subject.prepareComputation(input, а -> а);
subject.computeGasRequirement(TEST_CONSENSUS_TIME);
// then
assertEquals(Gas.of(EXPECTED_GAS_PRICE), subject.gasRequirement(input));
}
use of com.hederahashgraph.fee.FeeObject in project hedera-services by hashgraph.
the class HTSPrecompiledContractTest method gasRequirementReturnsCorrectValueForSingleCryptoTransfer.
@Test
void gasRequirementReturnsCorrectValueForSingleCryptoTransfer() {
// given
givenFrameContext();
given(input.getInt(0)).willReturn(ABI_ID_CRYPTO_TRANSFER);
given(syntheticTxnFactory.createCryptoTransfer(any())).willReturn(TransactionBody.newBuilder().setCryptoTransfer(CryptoTransferTransactionBody.newBuilder()));
given(feeCalculator.computeFee(any(), any(), any(), any())).willReturn(new FeeObject(TEST_NODE_FEE, TEST_NETWORK_FEE, TEST_SERVICE_FEE));
given(feeCalculator.estimatedGasPriceInTinybars(any(), any())).willReturn(DEFAULT_GAS_PRICE);
subject.prepareFields(messageFrame);
subject.prepareComputation(input, а -> а);
subject.computeGasRequirement(TEST_CONSENSUS_TIME);
// then
assertEquals(Gas.of(EXPECTED_GAS_PRICE), subject.gasRequirement(input));
}
use of com.hederahashgraph.fee.FeeObject in project hedera-services by hashgraph.
the class HTSPrecompiledContractTest method gasRequirementReturnsCorrectValueForTransferNft.
@Test
void gasRequirementReturnsCorrectValueForTransferNft() {
// given
givenFrameContext();
given(input.getInt(0)).willReturn(ABI_ID_TRANSFER_NFT);
given(syntheticTxnFactory.createCryptoTransfer(any())).willReturn(TransactionBody.newBuilder().setCryptoTransfer(CryptoTransferTransactionBody.newBuilder()));
given(feeCalculator.computeFee(any(), any(), any(), any())).willReturn(new FeeObject(TEST_NODE_FEE, TEST_NETWORK_FEE, TEST_SERVICE_FEE));
given(feeCalculator.estimatedGasPriceInTinybars(any(), any())).willReturn(DEFAULT_GAS_PRICE);
subject.prepareFields(messageFrame);
subject.prepareComputation(input, а -> а);
subject.computeGasRequirement(TEST_CONSENSUS_TIME);
// then
assertEquals(Gas.of(EXPECTED_GAS_PRICE), subject.gasRequirement(input));
}
Aggregations