use of com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.BURN_TOKEN_ORDINARY_CALL in project hedera-services by hashgraph.
the class ContractKeysHTSSuite method burnTokenWithFullPrefixAndPartialPrefixKeys.
private HapiApiSpec burnTokenWithFullPrefixAndPartialPrefixKeys() {
final var theAccount = "anybody";
final var burnContractByteCode = "burnContractByteCode";
final var amount = 99L;
final var fungibleToken = "fungibleToken";
final var theContract = "mintContract";
final var firstBurnTxn = "firstBurnTxn";
final var secondBurnTxn = "secondBurnTxn";
final AtomicLong fungibleNum = new AtomicLong();
return defaultHapiSpec("burnTokenWithFullPrefixAndPartialPrefixKeys").given(newKeyNamed(MULTI_KEY), cryptoCreate(theAccount).balance(10 * ONE_HUNDRED_HBARS), cryptoCreate(TOKEN_TREASURY), fileCreate(burnContractByteCode).payingWith(theAccount), updateLargeFile(theAccount, burnContractByteCode, extractByteCode(ContractResources.ORDINARY_CALLS_CONTRACT)), tokenCreate(fungibleToken).tokenType(TokenType.FUNGIBLE_COMMON).initialSupply(100).treasury(TOKEN_TREASURY).adminKey(MULTI_KEY).supplyKey(MULTI_KEY).exposingCreatedIdTo(idLit -> fungibleNum.set(asDotDelimitedLongArray(idLit)[2]))).when(sourcing(() -> contractCreate(theContract).bytecode(burnContractByteCode).payingWith(theAccount).gas(GAS_TO_OFFER))).then(withOpContext((spec, opLog) -> allRunFor(spec, contractCall(theContract, BURN_TOKEN_ORDINARY_CALL, asAddress(spec.registry().getTokenID(fungibleToken)), 1, new ArrayList<Long>()).via(firstBurnTxn).payingWith(theAccount).signedBy(MULTI_KEY).signedBy(theAccount).hasKnownStatus(SUCCESS), contractCall(theContract, BURN_TOKEN_ORDINARY_CALL, asAddress(spec.registry().getTokenID(fungibleToken)), 1, new ArrayList<Long>()).via(secondBurnTxn).payingWith(theAccount).alsoSigningWithFullPrefix(MULTI_KEY).hasKnownStatus(SUCCESS))), childRecordsCheck(firstBurnTxn, SUCCESS, recordWith().status(INVALID_SIGNATURE)), childRecordsCheck(secondBurnTxn, SUCCESS, recordWith().status(SUCCESS).newTotalSupply(99)), getTokenInfo(fungibleToken).hasTotalSupply(amount), getAccountBalance(TOKEN_TREASURY).hasTokenBalance(fungibleToken, amount));
}
Aggregations