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)));
}
Aggregations