use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_WAS_DELETED in project hedera-services by hashgraph.
the class ScheduleExecutionSpecs method scheduledXferFailingWithDeletedTokenPaysServiceFeeButNoImpact.
private HapiApiSpec scheduledXferFailingWithDeletedTokenPaysServiceFeeButNoImpact() {
String xToken = "XXX";
String validSchedule = "withLiveToken";
String invalidSchedule = "withDeletedToken";
String schedulePayer = "somebody", xTreasury = "xt", xCivilian = "xc";
String successTxn = "good", failedTxn = "bad";
AtomicReference<Map<AccountID, Long>> successFeesObs = new AtomicReference<>();
AtomicReference<Map<AccountID, Long>> failureFeesObs = new AtomicReference<>();
return defaultHapiSpec("ScheduledXferFailingWithDeletedTokenPaysServiceFeeButNoImpact").given(newKeyNamed("admin"), cryptoCreate(schedulePayer), cryptoCreate(xTreasury), cryptoCreate(xCivilian), tokenCreate(xToken).treasury(xTreasury).initialSupply(101).adminKey("admin"), tokenAssociate(xCivilian, xToken)).when(scheduleCreate(validSchedule, cryptoTransfer(moving(1, xToken).between(xTreasury, xCivilian)).memo(randomUppercase(100))).via(successTxn).alsoSigningWith(xTreasury, schedulePayer).designatingPayer(schedulePayer), getAccountBalance(xTreasury).hasTokenBalance(xToken, 100), getAccountBalance(xCivilian).hasTokenBalance(xToken, 1), getTxnRecord(successTxn).scheduled().logged().revealingDebitsTo(successFeesObs::set), tokenDelete(xToken), scheduleCreate(invalidSchedule, cryptoTransfer(moving(1, xToken).between(xTreasury, xCivilian)).memo(randomUppercase(100))).via(failedTxn).alsoSigningWith(xTreasury, schedulePayer).designatingPayer(schedulePayer)).then(getTxnRecord(failedTxn).scheduled().hasPriority(recordWith().status(TOKEN_WAS_DELETED)).revealingDebitsTo(failureFeesObs::set), getAccountBalance(xTreasury).hasTokenBalance(xToken, 100), assertionsHold((spec, opLog) -> assertBasicallyIdentical(successFeesObs.get(), failureFeesObs.get(), 1.0)));
}
Aggregations