Search in sources :

Example 1 with MINT_CONS_ABI

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));
}
Also used : QueryVerbs.getTokenNftInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getTokenNftInfo) Arrays(java.util.Arrays) TxnVerbs.cryptoCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate) UtilVerbs.sourcing(com.hedera.services.bdd.spec.utilops.UtilVerbs.sourcing) ON(com.hedera.services.bdd.spec.keys.SigControl.ON) TxnVerbs.cryptoTransfer(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer) ContractLogAsserts.logWith(com.hedera.services.bdd.spec.assertions.ContractLogAsserts.logWith) QueryVerbs.getTxnRecord(com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord) HapiApiSpec.defaultHapiSpec(com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec) SomeFungibleTransfers.changingFungibleBalances(com.hedera.services.bdd.spec.assertions.SomeFungibleTransfers.changingFungibleBalances) TxnVerbs.contractCall(com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCall) ContractFnResultAsserts.resultWith(com.hedera.services.bdd.spec.assertions.ContractFnResultAsserts.resultWith) UtilVerbs.newKeyNamed(com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed) TransactionRecordAsserts.recordWith(com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) Utils.extractByteCode(com.hedera.services.bdd.suites.contract.Utils.extractByteCode) NonFungibleTransfers(com.hedera.services.bdd.spec.assertions.NonFungibleTransfers) List(java.util.List) Logger(org.apache.logging.log4j.Logger) TxnVerbs.tokenUpdate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenUpdate) NotNull(org.jetbrains.annotations.NotNull) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) KeyShape.sigs(com.hedera.services.bdd.spec.keys.KeyShape.sigs) HW_MINT_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_MINT_CALL_ABI) TxnVerbs.tokenAssociate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenAssociate) UtilVerbs.withOpContext(com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext) QueryVerbs.getTokenInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getTokenInfo) MINT_CONS_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_CONS_ABI) DELEGATE_CONTRACT(com.hedera.services.bdd.spec.keys.KeyShape.DELEGATE_CONTRACT) ContractResources(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources) MINT_FUNGIBLE_WITH_EVENT_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_FUNGIBLE_WITH_EVENT_CALL_ABI) TxnVerbs.cryptoUpdate(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoUpdate) TokenMovement.moving(com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving) UtilVerbs.childRecordsCheck(com.hedera.services.bdd.spec.utilops.UtilVerbs.childRecordsCheck) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) HapiPropertySource.asDotDelimitedLongArray(com.hedera.services.bdd.spec.HapiPropertySource.asDotDelimitedLongArray) HW_MINT_CONS_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_MINT_CONS_ABI) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape) HTSPrecompileResult.htsPrecompileResult(com.hedera.services.bdd.suites.utils.contracts.precompile.HTSPrecompileResult.htsPrecompileResult) HW_BRRR_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_BRRR_CALL_ABI) TxnVerbs.tokenCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenCreate) HTSPrecompileResult(com.hedera.services.bdd.suites.utils.contracts.precompile.HTSPrecompileResult) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI) UtilVerbs.updateLargeFile(com.hedera.services.bdd.spec.utilops.UtilVerbs.updateLargeFile) QueryVerbs.getAccountBalance(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance) CustomSpecAssert.allRunFor(com.hedera.services.bdd.spec.utilops.CustomSpecAssert.allRunFor) TokenType(com.hederahashgraph.api.proto.java.TokenType) AtomicLong(java.util.concurrent.atomic.AtomicLong) TxnVerbs.fileCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate) Utils.asAddress(com.hedera.services.bdd.suites.contract.Utils.asAddress) TxnVerbs.contractCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCreate) Utils.parsedToByteString(com.hedera.services.bdd.suites.contract.Utils.parsedToByteString) AssertUtils.inOrder(com.hedera.services.bdd.spec.assertions.AssertUtils.inOrder) LogManager(org.apache.logging.log4j.LogManager) TokenSupplyType(com.hederahashgraph.api.proto.java.TokenSupplyType) AtomicLong(java.util.concurrent.atomic.AtomicLong)

Example 2 with MINT_CONS_ABI

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));
}
Also used : QueryVerbs.getTokenNftInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getTokenNftInfo) Arrays(java.util.Arrays) TxnVerbs.cryptoCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoCreate) UtilVerbs.sourcing(com.hedera.services.bdd.spec.utilops.UtilVerbs.sourcing) ON(com.hedera.services.bdd.spec.keys.SigControl.ON) TxnVerbs.cryptoTransfer(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoTransfer) ContractLogAsserts.logWith(com.hedera.services.bdd.spec.assertions.ContractLogAsserts.logWith) QueryVerbs.getTxnRecord(com.hedera.services.bdd.spec.queries.QueryVerbs.getTxnRecord) HapiApiSpec.defaultHapiSpec(com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec) SomeFungibleTransfers.changingFungibleBalances(com.hedera.services.bdd.spec.assertions.SomeFungibleTransfers.changingFungibleBalances) TxnVerbs.contractCall(com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCall) ContractFnResultAsserts.resultWith(com.hedera.services.bdd.spec.assertions.ContractFnResultAsserts.resultWith) UtilVerbs.newKeyNamed(com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed) TransactionRecordAsserts.recordWith(com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith) SUCCESS(com.hederahashgraph.api.proto.java.ResponseCodeEnum.SUCCESS) Utils.extractByteCode(com.hedera.services.bdd.suites.contract.Utils.extractByteCode) NonFungibleTransfers(com.hedera.services.bdd.spec.assertions.NonFungibleTransfers) List(java.util.List) Logger(org.apache.logging.log4j.Logger) TxnVerbs.tokenUpdate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenUpdate) NotNull(org.jetbrains.annotations.NotNull) HapiApiSpec(com.hedera.services.bdd.spec.HapiApiSpec) KeyShape.sigs(com.hedera.services.bdd.spec.keys.KeyShape.sigs) HW_MINT_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_MINT_CALL_ABI) TxnVerbs.tokenAssociate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenAssociate) UtilVerbs.withOpContext(com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext) QueryVerbs.getTokenInfo(com.hedera.services.bdd.spec.queries.QueryVerbs.getTokenInfo) MINT_CONS_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_CONS_ABI) DELEGATE_CONTRACT(com.hedera.services.bdd.spec.keys.KeyShape.DELEGATE_CONTRACT) ContractResources(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources) MINT_FUNGIBLE_WITH_EVENT_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_FUNGIBLE_WITH_EVENT_CALL_ABI) TxnVerbs.cryptoUpdate(com.hedera.services.bdd.spec.transactions.TxnVerbs.cryptoUpdate) TokenMovement.moving(com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving) UtilVerbs.childRecordsCheck(com.hedera.services.bdd.spec.utilops.UtilVerbs.childRecordsCheck) HapiApiSuite(com.hedera.services.bdd.suites.HapiApiSuite) HapiPropertySource.asDotDelimitedLongArray(com.hedera.services.bdd.spec.HapiPropertySource.asDotDelimitedLongArray) HW_MINT_CONS_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_MINT_CONS_ABI) KeyShape(com.hedera.services.bdd.spec.keys.KeyShape) HTSPrecompileResult.htsPrecompileResult(com.hedera.services.bdd.suites.utils.contracts.precompile.HTSPrecompileResult.htsPrecompileResult) HW_BRRR_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_BRRR_CALL_ABI) TxnVerbs.tokenCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.tokenCreate) HTSPrecompileResult(com.hedera.services.bdd.suites.utils.contracts.precompile.HTSPrecompileResult) ResponseCodeEnum(com.hederahashgraph.api.proto.java.ResponseCodeEnum) MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI(com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI) UtilVerbs.updateLargeFile(com.hedera.services.bdd.spec.utilops.UtilVerbs.updateLargeFile) QueryVerbs.getAccountBalance(com.hedera.services.bdd.spec.queries.QueryVerbs.getAccountBalance) CustomSpecAssert.allRunFor(com.hedera.services.bdd.spec.utilops.CustomSpecAssert.allRunFor) TokenType(com.hederahashgraph.api.proto.java.TokenType) AtomicLong(java.util.concurrent.atomic.AtomicLong) TxnVerbs.fileCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.fileCreate) Utils.asAddress(com.hedera.services.bdd.suites.contract.Utils.asAddress) TxnVerbs.contractCreate(com.hedera.services.bdd.spec.transactions.TxnVerbs.contractCreate) Utils.parsedToByteString(com.hedera.services.bdd.suites.contract.Utils.parsedToByteString) AssertUtils.inOrder(com.hedera.services.bdd.spec.assertions.AssertUtils.inOrder) LogManager(org.apache.logging.log4j.LogManager) TokenSupplyType(com.hederahashgraph.api.proto.java.TokenSupplyType) AtomicLong(java.util.concurrent.atomic.AtomicLong)

Aggregations

HapiApiSpec (com.hedera.services.bdd.spec.HapiApiSpec)2 HapiApiSpec.defaultHapiSpec (com.hedera.services.bdd.spec.HapiApiSpec.defaultHapiSpec)2 HapiPropertySource.asDotDelimitedLongArray (com.hedera.services.bdd.spec.HapiPropertySource.asDotDelimitedLongArray)2 AssertUtils.inOrder (com.hedera.services.bdd.spec.assertions.AssertUtils.inOrder)2 ContractFnResultAsserts.resultWith (com.hedera.services.bdd.spec.assertions.ContractFnResultAsserts.resultWith)2 ContractLogAsserts.logWith (com.hedera.services.bdd.spec.assertions.ContractLogAsserts.logWith)2 NonFungibleTransfers (com.hedera.services.bdd.spec.assertions.NonFungibleTransfers)2 SomeFungibleTransfers.changingFungibleBalances (com.hedera.services.bdd.spec.assertions.SomeFungibleTransfers.changingFungibleBalances)2 TransactionRecordAsserts.recordWith (com.hedera.services.bdd.spec.assertions.TransactionRecordAsserts.recordWith)2 ContractResources (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources)2 HW_BRRR_CALL_ABI (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_BRRR_CALL_ABI)2 HW_MINT_CALL_ABI (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_MINT_CALL_ABI)2 HW_MINT_CONS_ABI (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.HW_MINT_CONS_ABI)2 MINT_CONS_ABI (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_CONS_ABI)2 MINT_FUNGIBLE_WITH_EVENT_CALL_ABI (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_FUNGIBLE_WITH_EVENT_CALL_ABI)2 MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI (com.hedera.services.bdd.spec.infrastructure.meta.ContractResources.MINT_NON_FUNGIBLE_WITH_EVENT_CALL_ABI)2 KeyShape (com.hedera.services.bdd.spec.keys.KeyShape)2 DELEGATE_CONTRACT (com.hedera.services.bdd.spec.keys.KeyShape.DELEGATE_CONTRACT)2 KeyShape.sigs (com.hedera.services.bdd.spec.keys.KeyShape.sigs)2 ON (com.hedera.services.bdd.spec.keys.SigControl.ON)2