Search in sources :

Example 1 with FreezeNotApplicable

use of com.hederahashgraph.api.proto.java.TokenFreezeStatus.FreezeNotApplicable in project hedera-services by hashgraph.

the class TokenAssociationSpecs method expiredAndDeletedTokensStillAppearInContractInfo.

public HapiApiSpec expiredAndDeletedTokensStillAppearInContractInfo() {
    final String contract = "nothingMattersAnymore";
    final String treasury = "something";
    final String expiringToken = "expiringToken";
    final long lifetimeSecs = 10;
    final long xfer = 123L;
    AtomicLong now = new AtomicLong();
    return defaultHapiSpec("ExpiredAndDeletedTokensStillAppearInContractInfo").given(newKeyNamed("admin"), cryptoCreate(treasury), fileCreate("bytecode").path(ContractResources.FUSE_BYTECODE_PATH), contractCreate(contract).bytecode("bytecode").gas(300_000).via("creation"), withOpContext((spec, opLog) -> {
        var subOp = getTxnRecord("creation");
        allRunFor(spec, subOp);
        var record = subOp.getResponseRecord();
        now.set(record.getConsensusTimestamp().getSeconds());
    }), sourcing(() -> tokenCreate(expiringToken).decimals(666).adminKey("admin").treasury(treasury).expiry(now.get() + lifetimeSecs))).when(tokenAssociate(contract, expiringToken), cryptoTransfer(moving(xfer, expiringToken).between(treasury, contract))).then(getAccountBalance(contract).hasTokenBalance(expiringToken, xfer), getContractInfo(contract).hasToken(relationshipWith(expiringToken).freeze(FreezeNotApplicable)), sleepFor(lifetimeSecs * 1_000L), getAccountBalance(contract).hasTokenBalance(expiringToken, xfer, 666), getContractInfo(contract).hasToken(relationshipWith(expiringToken).freeze(FreezeNotApplicable)), tokenDelete(expiringToken), getAccountBalance(contract).hasTokenBalance(expiringToken, xfer), getContractInfo(contract).hasToken(relationshipWith(expiringToken).decimals(666).freeze(FreezeNotApplicable)));
}
Also used : TxnVerbs.cryptoCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate) UtilVerbs.sourcing(com.hedera.services.bdd.spec.utilops.UtilVerbs.sourcing) TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES(com.hederahashgraph.api.proto.java.ResponseCodeEnum.TRANSACTION_REQUIRES_ZERO_TOKEN_BALANCES) TxnVerbs.cryptoTransfer(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer) TokenTransferList(com.hederahashgraph.api.proto.java.TokenTransferList) QueryVerbs.getContractInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getContractInfo) TxnVerbs.tokenDelete(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenDelete) QueryVerbs.getTxnRecord(com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord) UtilVerbs.sleepFor(com.hedera.services.bdd.spec.utilops.UtilVerbs.sleepFor) QueryVerbs.getAccountInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountInfo) ACCOUNT_IS_TREASURY(com.hederahashgraph.api.proto.java.ResponseCodeEnum.ACCOUNT_IS_TREASURY) ExpectedTokenRel.relationshipWith(com.hedera.services.bdd.spec.queries.crypto.ExpectedTokenRel.relationshipWith) HapiApiSpec.defaultHapiSpec(com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec) Frozen(com.hederahashgraph.api.proto.java.TokenFreezeStatus.Frozen) SomeFungibleTransfers.changingFungibleBalances(com.hedera.services.bdd.spec.assertions.SomeFungibleTransfers.changingFungibleBalances) UtilVerbs.newKeyNamed(com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed) TransactionRecordAsserts.recordWith(com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith) TOKEN_NOT_ASSOCIATED_TO_ACCOUNT(com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_NOT_ASSOCIATED_TO_ACCOUNT) TokenMovement(com.hedera.services.bdd.spec.transactions.token.TokenMovement) StandardCharsets(java.nio.charset.StandardCharsets) NoTokenTransfers.emptyTokenTransfers(com.hedera.services.bdd.spec.assertions.NoTokenTransfers.emptyTokenTransfers) ByteString(com.google.protobuf.ByteString) BaseErroringAssertsProvider(com.hedera.services.bdd.spec.assertions.BaseErroringAssertsProvider) AccountAmount(com.hederahashgraph.api.proto.java.AccountAmount) List(java.util.List) Logger(org.apache.logging.log4j.Logger) HapiSpecOperation(com.hedera.services.bdd.spec.HapiSpecOperation) TxnVerbs.tokenDissociate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenDissociate) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) TxnVerbs.tokenAssociate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenAssociate) KycNotApplicable(com.hederahashgraph.api.proto.java.TokenKycStatus.KycNotApplicable) UtilVerbs.withOpContext(com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext) Granted(com.hederahashgraph.api.proto.java.TokenKycStatus.Granted) ErroringAsserts(com.hedera.services.bdd.spec.assertions.ErroringAsserts) Unfrozen(com.hederahashgraph.api.proto.java.TokenFreezeStatus.Unfrozen) INVALID_SIGNATURE(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_SIGNATURE) ContractResources(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources) TokenMovement.moving(com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) Assertions.assertEquals(org.junit.jupiter.api.Assertions.assertEquals) FreezeNotApplicable(com.hederahashgraph.api.proto.java.TokenFreezeStatus.FreezeNotApplicable) TxnVerbs.mintToken(com.hedera.services.bdd.spec.transactions.TxnVerbs.mintToken) TxnVerbs.tokenCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenCreate) ACCOUNT_FROZEN_FOR_TOKEN(com.hederahashgraph.api.proto.java.ResponseCodeEnum.ACCOUNT_FROZEN_FOR_TOKEN) TxnVerbs.tokenFreeze(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenFreeze) INVALID_TOKEN_ID(com.hederahashgraph.api.proto.java.ResponseCodeEnum.INVALID_TOKEN_ID) QueryVerbs.getAccountBalance(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance) CustomSpecAssert.allRunFor(com.hedera.services.bdd.spec.utilops.CustomSpecAssert.allRunFor) TokenType(com.hederahashgraph.api.proto.java.TokenType) AtomicLong(java.util.concurrent.atomic.AtomicLong) TxnVerbs.fileCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate) TxnVerbs.contractCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCreate) LogManager(org.apache.logging.log4j.LogManager) Collections(java.util.Collections) TxnVerbs.tokenUnfreeze(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenUnfreeze) AtomicLong(java.util.concurrent.atomic.AtomicLong) ByteString(com.google.protobuf.ByteString)

Aggregations

ByteString (com.google.protobuf.ByteString)1 HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)1 HapiApiSpec.defaultHapiSpec (com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec)1 HapiSpecOperation (com.hedera.services.bdd.spec.HapiSpecOperation)1 BaseErroringAssertsProvider (com.hedera.services.bdd.spec.assertions.BaseErroringAssertsProvider)1 ErroringAsserts (com.hedera.services.bdd.spec.assertions.ErroringAsserts)1 NoTokenTransfers.emptyTokenTransfers (com.hedera.services.bdd.spec.assertions.NoTokenTransfers.emptyTokenTransfers)1 SomeFungibleTransfers.changingFungibleBalances (com.hedera.services.bdd.spec.assertions.SomeFungibleTransfers.changingFungibleBalances)1 TransactionRecordAsserts.recordWith (com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith)1 ContractResources (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources)1 QueryVerbs.getAccountBalance (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance)1 QueryVerbs.getAccountInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountInfo)1 QueryVerbs.getContractInfo (com.hedera.services.bdd.spec.queries.QueryVerbs.getContractInfo)1 QueryVerbs.getTxnRecord (com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord)1 ExpectedTokenRel.relationshipWith (com.hedera.services.bdd.spec.queries.crypto.ExpectedTokenRel.relationshipWith)1 TxnVerbs.contractCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCreate)1 TxnVerbs.cryptoCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate)1 TxnVerbs.cryptoTransfer (com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer)1 TxnVerbs.fileCreate (com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate)1 TxnVerbs.mintToken (com.hedera.services.bdd.spec.transactions.TxnVerbs.mintToken)1