use of com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_CONS_ABI in project hedera-services by hashgraph.
the class ContractMintHTSSuite method happyPathNonFungibleTokenMint.
private HapiApiSpec happyPathNonFungibleTokenMint() {
final var theAccount = "anybody";
final var mintContractByteCode = "mintContractByteCode";
final var nonFungibleToken = "nonFungibleToken";
final var multiKey = "purpose";
final var theContract = "mintContract";
final var firstMintTxn = "firstMintTxn";
final var totalSupply = 2;
final AtomicLong nonFungibleNum = new AtomicLong();
return defaultHapiSpec("NonFungibleMint").given(newKeyNamed(multiKey), cryptoCreate(theAccount).balance(10 * ONE_HUNDRED_HBARS), cryptoCreate(TOKEN_TREASURY), fileCreate(mintContractByteCode).payingWith(theAccount), updateLargeFile(theAccount, mintContractByteCode, extractByteCode(ContractResources.MINT_CONTRACT)), tokenCreate(nonFungibleToken).tokenType(TokenType.NON_FUNGIBLE_UNIQUE).supplyType(TokenSupplyType.INFINITE).initialSupply(0).treasury(TOKEN_TREASURY).adminKey(multiKey).supplyKey(multiKey).exposingCreatedIdTo(idLit -> nonFungibleNum.set(asDotDelimitedLongArray(idLit)[2]))).when(sourcing(() -> contractCreate(theContract, MINT_CONS_ABI, nonFungibleNum.get()).bytecode(mintContractByteCode).payingWith(theAccount).gas(GAS_TO_OFFER))).then(contractCall(theContract, MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI, Arrays.asList("Test metadata 1", "Test metadata 2")).via(firstMintTxn).payingWith(theAccount).gas(GAS_TO_OFFER).alsoSigningWithFullPrefix(multiKey), getTxnRecord(firstMintTxn).andAllChildRecords().logged(), getTxnRecord(firstMintTxn).hasPriority(recordWith().contractCallResult(resultWith().logs(inOrder(logWith().noData().withTopicsInOrder(List.of(parsedToByteString(totalSupply), parsedToByteString(1))))))), getTokenInfo(nonFungibleToken).hasTotalSupply(totalSupply), getAccountBalance(TOKEN_TREASURY).hasTokenBalance(nonFungibleToken, totalSupply));
}
use of com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_CONS_ABI in project hedera-services by hashgraph.
the class ContractMintHTSSuite method happyPathFungibleTokenMint.
private HapiApiSpec happyPathFungibleTokenMint() {
final var theAccount = "anybody";
final var mintContractByteCode = "mintContractByteCode";
final var amount = 10L;
final var fungibleToken = "fungibleToken";
final var multiKey = "purpose";
final var theContract = "mintContract";
final var firstMintTxn = "firstMintTxn";
final AtomicLong fungibleNum = new AtomicLong();
return defaultHapiSpec("FungibleMint").given(newKeyNamed(multiKey), cryptoCreate(theAccount).balance(ONE_HUNDRED_HBARS), cryptoCreate(TOKEN_TREASURY), fileCreate(mintContractByteCode).payingWith(theAccount), updateLargeFile(theAccount, mintContractByteCode, extractByteCode(ContractResources.MINT_CONTRACT)), tokenCreate(fungibleToken).tokenType(TokenType.FUNGIBLE_COMMON).initialSupply(0).treasury(TOKEN_TREASURY).adminKey(multiKey).supplyKey(multiKey).exposingCreatedIdTo(idLit -> fungibleNum.set(asDotDelimitedLongArray(idLit)[2]))).when(sourcing(() -> contractCreate(theContract, MINT_CONS_ABI, fungibleNum.get()).bytecode(mintContractByteCode).payingWith(theAccount).gas(GAS_TO_OFFER))).then(contractCall(theContract, MINT_FUNGIBLE_WITH_EVENT_CALL_ABI, amount).via(firstMintTxn).payingWith(theAccount).alsoSigningWithFullPrefix(multiKey), getTxnRecord(firstMintTxn).andAllChildRecords().logged(), getTxnRecord(firstMintTxn).hasPriority(recordWith().contractCallResult(resultWith().logs(inOrder(logWith().noData().withTopicsInOrder(List.of(parsedToByteString(amount), parsedToByteString(0))))))), getTokenInfo(fungibleToken).hasTotalSupply(amount), getAccountBalance(TOKEN_TREASURY).hasTokenBalance(fungibleToken, amount));
}
Aggregations