use of com.hederahashgraph.api.proto.java.Transaction in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method updateTokenFeeSchedule.
private void updateTokenFeeSchedule(TokenID tokenID, long consensusTimestamp, List<CustomFee> customFees) {
Transaction transaction = buildTransaction(builder -> builder.getTokenFeeScheduleUpdateBuilder().setTokenId(tokenID).addAllCustomFees(convertCustomFees(customFees)));
TransactionBody transactionBody = getTransactionBody(transaction);
TransactionRecord transactionRecord = buildTransactionRecord(builder -> builder.setConsensusTimestamp(TestUtils.toTimestamp(consensusTimestamp)), transactionBody, ResponseCodeEnum.SUCCESS.getNumber());
parseRecordItemAndCommit(new RecordItem(transaction, transactionRecord));
}
use of com.hederahashgraph.api.proto.java.Transaction in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method tokenDissociatePrecompile.
@Test
void tokenDissociatePrecompile() {
createAndAssociateToken(TOKEN_ID, FUNGIBLE_COMMON, SYMBOL, CREATE_TIMESTAMP, ASSOCIATE_TIMESTAMP, PAYER2, false, false, false, INITIAL_SUPPLY);
Transaction dissociateTransaction = tokenDissociate(List.of(TOKEN_ID), PAYER2);
long dissociateTimeStamp = 10L;
AtomicReference<ContractFunctionResult> contractFunctionResultAtomic = new AtomicReference<>();
insertAndParseTransaction(dissociateTimeStamp, dissociateTransaction, builder -> {
buildContractFunctionResult(builder.getContractCallResultBuilder());
contractFunctionResultAtomic.set(builder.getContractCallResult());
});
assertTokenAccountInRepository(TOKEN_ID, PAYER2, ASSOCIATE_TIMESTAMP, dissociateTimeStamp, false, TokenFreezeStatusEnum.NOT_APPLICABLE, TokenKycStatusEnum.NOT_APPLICABLE);
assertContractResult(dissociateTimeStamp, contractFunctionResultAtomic.get());
}
use of com.hederahashgraph.api.proto.java.Transaction in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method tokenAccountGrantKyc.
@Test
void tokenAccountGrantKyc() {
createAndAssociateToken(TOKEN_ID, FUNGIBLE_COMMON, SYMBOL, CREATE_TIMESTAMP, ASSOCIATE_TIMESTAMP, PAYER2, false, true, false, INITIAL_SUPPLY);
Transaction transaction = tokenKycTransaction(TOKEN_ID, true);
long grantTimeStamp = 10L;
insertAndParseTransaction(grantTimeStamp, transaction);
assertTokenAccountInRepository(TOKEN_ID, PAYER2, ASSOCIATE_TIMESTAMP, grantTimeStamp, true, TokenFreezeStatusEnum.NOT_APPLICABLE, TokenKycStatusEnum.GRANTED);
}
use of com.hederahashgraph.api.proto.java.Transaction in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method tokenBurnNftsPrecompile.
@Test
void tokenBurnNftsPrecompile() {
long mintTimestamp = 10L;
tokenSupplyMintNftsPrecompile(mintTimestamp);
long burnTimestamp = 15L;
Transaction transaction = tokenSupplyTransaction(TOKEN_ID, NON_FUNGIBLE_UNIQUE, false, 0, SERIAL_NUMBER_LIST);
AtomicReference<ContractFunctionResult> contractFunctionResultAtomic = new AtomicReference<>();
insertAndParseTransaction(burnTimestamp, transaction, builder -> {
builder.getReceiptBuilder().setNewTotalSupply(SERIAL_NUMBER_LIST.size()).addAllSerialNumbers(SERIAL_NUMBER_LIST);
buildContractFunctionResult(builder.getContractCallResultBuilder());
contractFunctionResultAtomic.set(builder.getContractCallResult());
});
assertNftInRepository(TOKEN_ID, SERIAL_NUMBER_1, true, mintTimestamp, burnTimestamp, METADATA.getBytes(), null, true);
assertNftInRepository(TOKEN_ID, SERIAL_NUMBER_2, true, mintTimestamp, burnTimestamp, METADATA.getBytes(), null, true);
assertContractResult(burnTimestamp, contractFunctionResultAtomic.get());
}
use of com.hederahashgraph.api.proto.java.Transaction in project hedera-mirror-node by hashgraph.
the class EntityRecordItemListenerTokenTest method tokenSupplyFtsPrecompile.
private void tokenSupplyFtsPrecompile(boolean isMint) {
createAndAssociateToken(TOKEN_ID, FUNGIBLE_COMMON, SYMBOL, CREATE_TIMESTAMP, ASSOCIATE_TIMESTAMP, PAYER2, false, false, false, INITIAL_SUPPLY);
long amount = 1000;
long mintTimestamp = 10L;
TokenTransferList tokenTransfer = tokenTransfer(TOKEN_ID, PAYER, amount);
Transaction transaction = tokenSupplyTransaction(TOKEN_ID, FUNGIBLE_COMMON, isMint, amount, null);
AtomicReference<ContractFunctionResult> contractFunctionResultAtomic = new AtomicReference<>();
insertAndParseTransaction(mintTimestamp, transaction, builder -> {
builder.getReceiptBuilder().setNewTotalSupply(INITIAL_SUPPLY + amount);
builder.addTokenTransferLists(tokenTransfer);
buildContractFunctionResult(builder.getContractCallResultBuilder());
contractFunctionResultAtomic.set(builder.getContractCallResult());
});
// Verify
assertThat(tokenTransferRepository.count()).isEqualTo(2L);
assertTokenTransferInRepository(TOKEN_ID, PAYER, CREATE_TIMESTAMP, INITIAL_SUPPLY);
assertTokenTransferInRepository(TOKEN_ID, PAYER, mintTimestamp, amount);
assertTokenInRepository(TOKEN_ID, true, CREATE_TIMESTAMP, mintTimestamp, SYMBOL, INITIAL_SUPPLY + amount);
assertContractResult(mintTimestamp, contractFunctionResultAtomic.get());
}
Aggregations