use of com.hederahashgraph.api.proto.java.ResponseCodeEnum.TOKEN_ID_REPEATED_IN_TOKEN_LIST in project hedera-services by hashgraph.
the class ScheduleExecutionSpecs method scheduledXferFailingWithRepeatedTokenIdPaysServiceFeeButNoImpact.
private HapiApiSpec scheduledXferFailingWithRepeatedTokenIdPaysServiceFeeButNoImpact() {
String xToken = "XXX", yToken = "YYY";
String validSchedule = "withNoRepeats";
String invalidSchedule = "withRepeats";
String schedulePayer = "somebody", xTreasury = "xt", yTreasury = "yt";
String successTxn = "good", failedTxn = "bad";
AtomicReference<Map<AccountID, Long>> successFeesObs = new AtomicReference<>();
AtomicReference<Map<AccountID, Long>> failureFeesObs = new AtomicReference<>();
return defaultHapiSpec("ScheduledXferFailingWithRepeatedTokenIdPaysServiceFeeButNoImpact").given(cryptoCreate(schedulePayer), cryptoCreate(xTreasury), cryptoCreate(yTreasury), tokenCreate(xToken).treasury(xTreasury).initialSupply(101), tokenCreate(yToken).treasury(yTreasury).initialSupply(101), tokenAssociate(xTreasury, yToken), tokenAssociate(yTreasury, xToken)).when(scheduleCreate(validSchedule, cryptoTransfer(moving(1, xToken).between(xTreasury, yTreasury), moving(1, yToken).between(yTreasury, xTreasury))).via(successTxn).alsoSigningWith(xTreasury, yTreasury, schedulePayer).designatingPayer(schedulePayer), getAccountBalance(xTreasury).hasTokenBalance(xToken, 100), getAccountBalance(xTreasury).hasTokenBalance(yToken, 1), getAccountBalance(yTreasury).hasTokenBalance(yToken, 100), getAccountBalance(yTreasury).hasTokenBalance(xToken, 1), getTxnRecord(successTxn).scheduled().logged().revealingDebitsTo(successFeesObs::set), scheduleCreate(invalidSchedule, cryptoTransfer(moving(1, xToken).between(xTreasury, yTreasury)).appendingTokenFromTo(xToken, xTreasury, yTreasury, 1)).via(failedTxn).alsoSigningWith(xTreasury, schedulePayer).designatingPayer(schedulePayer)).then(getTxnRecord(failedTxn).scheduled().hasPriority(recordWith().status(TOKEN_ID_REPEATED_IN_TOKEN_LIST)).revealingDebitsTo(failureFeesObs::set), getAccountBalance(xTreasury).hasTokenBalance(xToken, 100), getAccountBalance(xTreasury).hasTokenBalance(yToken, 1), getAccountBalance(yTreasury).hasTokenBalance(yToken, 100), getAccountBalance(yTreasury).hasTokenBalance(xToken, 1), assertionsHold((spec, opLog) -> assertBasicallyIdentical(successFeesObs.get(), failureFeesObs.get(), 1.0)));
}
Aggregations