From 19efd0da4d5e1e363934bd8585d0de6ae632f95d Mon Sep 17 00:00:00 2001 From: Eva Date: Tue, 3 Sep 2024 16:54:15 +0300 Subject: [PATCH 1/7] new token airdrop test added AIRDROP_27 Signed-off-by: Eva --- .../bdd/suites/hip904/TokenAirdropTest.java | 307 +++++++++++++++++- 1 file changed, 306 insertions(+), 1 deletion(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java index 5f984445f8c3..10d72cfbfdb0 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java @@ -49,6 +49,8 @@ import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHbarFee; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHbarFeeInheritingRoyaltyCollector; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHtsFee; +import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fractionalFeeNetOfTransfers; +import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeNoFallback; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeWithFallback; import static com.hedera.services.bdd.spec.transactions.token.HapiTokenClaimAirdrop.pendingAirdrop; import static com.hedera.services.bdd.spec.transactions.token.HapiTokenReject.rejectingToken; @@ -113,6 +115,7 @@ import edu.umd.cs.findbugs.annotations.NonNull; import java.util.List; import java.util.Map; +import java.util.OptionalLong; import java.util.stream.IntStream; import java.util.stream.Stream; import org.junit.jupiter.api.Assertions; @@ -785,10 +788,11 @@ final Stream tokenNotAssociatedAfterPendingAirdrop() { class AirdropTokensWithCustomFees { private static final long HBAR_FEE = 1000L; private static final long HTS_FEE = 100L; + private static final long TOKEN_TOTAL = 1_000_000L; @BeforeAll static void beforeAll(@NonNull final TestLifecycle lifecycle) { - lifecycle.doAdhoc(setUpTokensWithCustomFees(1_000_000L, HBAR_FEE, HTS_FEE)); + lifecycle.doAdhoc(setUpTokensWithCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE)); } @HapiTest @@ -1071,6 +1075,307 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo .between(FT_ALL_COLLECTORS_EXEMPT_OWNER, FT_ALL_COLLECTORS_EXEMPT_RECEIVER)) .signedByPayerAnd(FT_ALL_COLLECTORS_EXEMPT_RECEIVER, FT_ALL_COLLECTORS_EXEMPT_OWNER)); } + + // AIRDROP_27 + @HapiTest + @DisplayName( + "airdrop max number of 10 tokens with custom fees to not associated accounts and different fee collectors does not hit the transaction limit") + final Stream + transferMultipleFTAndNFTWithAllCustomFeesToNotAssociatedAccountsWithDifferentFeeCollectors() { + final var initialBalance = 100 * ONE_HUNDRED_HBARS; + // owner + final String OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES = "ownerOfTokensWithAllCustomFees"; + // receivers + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE = "receiverWIth0AutoAssociationsHbarFee"; + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE = + "receiverWith0AutoAssociationsFractionalFee"; + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE = "receiverWith0AutoAssociationsHtsFee"; + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND = "receiverWith0AutoAssociationsHtsFeeSecond"; + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE = + "receiverWith0AutoAssociationsForNftHbarFee"; + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE = + "receiverWith0AutoAssociationsForNftHtsFee"; + final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK = + "receiverWith0AutoAssociationsForNftRoyaltyFeeNoFallback"; + // collectors + final String FT_HBAR_COLLECTOR = "ftHbarCollector"; + final String FT_FRACTIONAL_COLLECTOR = "ftFractionalCollector"; + final String FT_WITH_HTS_FEE_COLLECTOR = "ftWithHtsCollector"; + final String NFT_HBAR_COLLECTOR = "nftHBarCollector"; + final String NFT_HTS_COLLECTOR = "nftHtsCollector"; + final String NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK = "nftRoyaltyFeeCollectorNoFallback"; + // FT tokens + final String FT_WITH_HBAR_FEE = "ftWithHbarFee"; + final String FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS = "ftWithFractionalFeeWithNetOfTransfers"; + final String FT_WITH_HTS_FEE = "ftWithHtsFee"; + final String DENOM_TOKEN_HTS = "denomTokenHts"; + // NFT tokens + final String NFT_WITH_HBAR_FIXED_FEE = "nftWithHBarFixedFee"; + final String NFT_WITH_HTS_FIXED_FEE = "nftWithHtsFixedFee"; + final String NFT_WITH_ROYALTY_FEE_NO_FALLBACK = "nftWithRoyaltyFeeNoFallback"; + final String nftWithCustomFeeSupplyKey = "nftWithCustomFeeSupplyKey"; + return defaultHapiSpec( + "Send multiple FT and NFT with all custom fees from EOA to not associated account without auto-association slots and with different fee collector accounts for each fee") + .given( + // create owner and receiver accounts + cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE) + .maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE) + .maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE) + .maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE) + .maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE) + .maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK) + .maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND) + .maxAutomaticTokenAssociations(0), + + // create collector accounts + cryptoCreate(FT_HBAR_COLLECTOR).balance(0L), + cryptoCreate(FT_FRACTIONAL_COLLECTOR).balance(ONE_HUNDRED_HBARS), + cryptoCreate(FT_WITH_HTS_FEE_COLLECTOR).balance(0L), + cryptoCreate(NFT_HBAR_COLLECTOR).balance(0L), + cryptoCreate(NFT_HTS_COLLECTOR).balance(0L), + cryptoCreate(NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK).balance(0L), + + // create FT with HBAR fee + tokenCreate(FT_WITH_HBAR_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(FUNGIBLE_COMMON) + .withCustom(fixedHbarFee(HBAR_FEE, FT_HBAR_COLLECTOR)), + // create FT with Fractional fee and Net of transfers + tokenCreate(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(FUNGIBLE_COMMON) + .withCustom(fractionalFeeNetOfTransfers( + 1, 10L, 1L, OptionalLong.of(100), FT_FRACTIONAL_COLLECTOR)) + .initialSupply(Long.MAX_VALUE) + .payingWith(FT_FRACTIONAL_COLLECTOR), + // create denom token for FT with HTS fee + tokenCreate(DENOM_TOKEN_HTS) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .initialSupply(TOKEN_TOTAL), + // create FT with HTS fee + tokenAssociate(FT_WITH_HTS_FEE_COLLECTOR, DENOM_TOKEN_HTS), + tokenCreate(FT_WITH_HTS_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(FUNGIBLE_COMMON) + .withCustom(fixedHtsFee(HTS_FEE, DENOM_TOKEN_HTS, FT_WITH_HTS_FEE_COLLECTOR)) + .initialSupply(TOKEN_TOTAL), + + // create NFT with HBar fixed fee + newKeyNamed(nftWithCustomFeeSupplyKey), + tokenCreate(NFT_WITH_HBAR_FIXED_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(NON_FUNGIBLE_UNIQUE) + .supplyKey(nftWithCustomFeeSupplyKey) + .supplyType(TokenSupplyType.INFINITE) + .initialSupply(0) + .withCustom(fixedHbarFee(HBAR_FEE, NFT_HBAR_COLLECTOR)), + mintToken( + NFT_WITH_HBAR_FIXED_FEE, + List.of(ByteStringUtils.wrapUnsafely("tokenWithHbarCustomFee".getBytes()))), + + // create NFT with HTS fixed fee - two layers of fees + tokenAssociate(NFT_HTS_COLLECTOR, FT_WITH_HTS_FEE), + newKeyNamed(nftWithCustomFeeSupplyKey), + tokenCreate(NFT_WITH_HTS_FIXED_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(NON_FUNGIBLE_UNIQUE) + .supplyKey(nftWithCustomFeeSupplyKey) + .supplyType(TokenSupplyType.INFINITE) + .initialSupply(0) + .withCustom(fixedHtsFee(HTS_FEE, FT_WITH_HTS_FEE, NFT_HTS_COLLECTOR)), + mintToken( + NFT_WITH_HTS_FIXED_FEE, + List.of(ByteStringUtils.wrapUnsafely("tokenWithHtsCustomFee".getBytes()))), + + // create NFT with Royalty fee no fallback + newKeyNamed(nftWithCustomFeeSupplyKey), + tokenCreate(NFT_WITH_ROYALTY_FEE_NO_FALLBACK) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(NON_FUNGIBLE_UNIQUE) + .supplyKey(nftWithCustomFeeSupplyKey) + .supplyType(TokenSupplyType.INFINITE) + .initialSupply(0) + .withCustom(royaltyFeeNoFallback(1, 2L, NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK)), + mintToken( + NFT_WITH_ROYALTY_FEE_NO_FALLBACK, + List.of(ByteStringUtils.wrapUnsafely("tokenWithRoyaltyFee".getBytes()))), + + // create owner of tokens with all kinds of custom fees and associate it to the tokens + cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), + // HBAR fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HBAR_FEE), + cryptoTransfer(moving(1000, FT_WITH_HBAR_FEE) + .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // FRACTIONAL fee + tokenAssociate( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS), + cryptoTransfer(moving(1000, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // HTS fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HTS_FEE), + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, DENOM_TOKEN_HTS), + cryptoTransfer( + moving(1000, FT_WITH_HTS_FEE) + .between( + TREASURY_FOR_CUSTOM_FEE_TOKENS, + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES), + moving(TOKEN_TOTAL, DENOM_TOKEN_HTS) + .between( + TREASURY_FOR_CUSTOM_FEE_TOKENS, + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // NFT with HBAR fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HBAR_FIXED_FEE), + cryptoTransfer(movingUnique(NFT_WITH_HBAR_FIXED_FEE, 1L) + .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // NFT with HTS fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HTS_FIXED_FEE), + cryptoTransfer(movingUnique(NFT_WITH_HTS_FIXED_FEE, 1L) + .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // NFT with Royalty fee no fallback + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK), + cryptoTransfer(movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) + .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES))) + .when(tokenAirdrop( + moving(1, FT_WITH_HBAR_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS), + moving(1, FT_WITH_HBAR_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE), + moving(10, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE), + moving(10, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE), + moving(1, FT_WITH_HTS_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE), + moving(1, FT_WITH_HTS_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE), + moving(1, FT_WITH_HTS_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND), + movingUnique(NFT_WITH_HBAR_FIXED_FEE, 1) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE), + movingUnique(NFT_WITH_HTS_FIXED_FEE, 1L) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE), + movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK)) + .payingWith(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .via("multiple tokens transactions")) + .then( + getTxnRecord("multiple tokens transactions") + .hasPriority( + recordWith() + .pendingAirdrops( + includingFungiblePendingAirdrop( + moving(1, FT_WITH_HBAR_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS), + moving(1, FT_WITH_HBAR_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE), + moving( + 20, + FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE), + moving(2, FT_WITH_HTS_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE), + moving(1, FT_WITH_HTS_FEE) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND))) + .pendingAirdrops( + includingNftPendingAirdrop( + movingUnique(NFT_WITH_HBAR_FIXED_FEE, 1L) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE), + movingUnique(NFT_WITH_HTS_FIXED_FEE, 1L) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE), + movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK)))), + // receiver + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS).hasTokenBalance(FT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE) + .hasTokenBalance(FT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE) + .hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND) + .hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE) + .hasTokenBalance(NFT_WITH_HBAR_FIXED_FEE, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE) + .hasTokenBalance(NFT_WITH_HTS_FIXED_FEE, 0), + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK) + .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 0), + + // collectors + getAccountBalance(FT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), + getAccountBalance(FT_FRACTIONAL_COLLECTOR) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 2), + getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(DENOM_TOKEN_HTS, 2 * HTS_FEE), + getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(NFT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), + getAccountBalance(NFT_HTS_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, HTS_FEE), + getAccountBalance(NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK) + .hasTinyBars(0), + // owner + withOpContext((spec, log) -> { + final var record = getTxnRecord("multiple tokens transactions"); + allRunFor(spec, record); + final var txFee = record.getResponseRecord().getTransactionFee(); + // the token should not be transferred but the custom fee should be charged + final var ownerBalance = getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTinyBars(initialBalance - (txFee + 2 * HBAR_FEE)) + .hasTokenBalance(FT_WITH_HBAR_FEE, 1000) + .hasTokenBalance(NFT_WITH_HBAR_FIXED_FEE, 1L); + allRunFor(spec, ownerBalance); + }), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 998), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(FT_WITH_HTS_FEE, 1000 - HTS_FEE), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(DENOM_TOKEN_HTS, TOKEN_TOTAL - 2 * HTS_FEE), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1), + validateChargedUsd("multiple tokens transactions", 0.8, 10)); + } } @Nested From 761e6179fb46be74b07d5a5c8030fbd862a6ea49 Mon Sep 17 00:00:00 2001 From: Eva Date: Thu, 5 Sep 2024 10:51:10 +0300 Subject: [PATCH 2/7] airdrop_27 test fixes Signed-off-by: Eva --- .../bdd/suites/hip904/TokenAirdropBase.java | 147 +++++++++ .../bdd/suites/hip904/TokenAirdropTest.java | 283 ++++-------------- 2 files changed, 205 insertions(+), 225 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java index 5ebe3fe159b8..19bc50f83097 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java @@ -28,8 +28,10 @@ import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHtsFee; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fractionalFee; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fractionalFeeNetOfTransfers; +import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeNoFallback; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeWithFallback; import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving; +import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.movingUnique; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext; import static com.hedera.services.bdd.suites.HapiSuite.ONE_HUNDRED_HBARS; @@ -95,6 +97,34 @@ public class TokenAirdropBase { protected static final String FT_ALL_COLLECTORS_EXEMPT_COLLECTOR = "ftAllCollectorsExemptCollector"; protected static final String FT_ALL_COLLECTORS_EXEMPT_TOKEN = "ftAllCollectorsExemptToken"; + // owner, receivers with 0 auto-associations, collectors and tokens for multiple tokens with all custom fees airdrop test + // owner + protected static final String OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES = "ownerOfTokensWithAllCustomFees"; + // receivers + protected static final String RECEIVER_HBAR_FEE = "receiverHbarFee"; + protected static final String RECEIVER_FRACTIONAL_FEE = "receiverFractionalFee"; + protected static final String RECEIVER_HTS_FEE_SECOND = "receiverHtsFeeSecond"; + protected static final String RECEIVER_HTS_FEE = "receiverHtsFee"; + protected static final String RECEIVER_NFT_HBAR_FEE = "receiverNftHbarFee"; + protected static final String RECEIVER_NFT_HTS_FEE = "receiverNftHtsFee"; + protected static final String RECEIVER_NFT_ROYALTY_FEE = "receiverNftRoyaltyFee"; + // collectors + protected static final String FT_HBAR_COLLECTOR = "ftHbarCollector"; + protected static final String FT_FRACTIONAL_COLLECTOR = "ftFractionalCollector"; + protected static final String FT_WITH_HTS_FEE_COLLECTOR = "ftWithHtsCollector"; + protected static final String NFT_HBAR_COLLECTOR = "nftHBarCollector"; + protected static final String NFT_HTS_COLLECTOR = "nftHtsCollector"; + protected static final String NFT_ROYALTY_FEE_COLLECTOR = "nftRoyaltyFeeCollector"; + // FT tokens + protected static final String FT_WITH_HBAR_FEE = "ftWithHbarFee"; + protected static final String FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS = "ftWithFractionalFeeWithNetOfTransfers"; + protected static final String FT_WITH_HTS_FEE = "ftWithHtsFee"; + protected static final String DENOM_TOKEN_HTS = "denomTokenHts"; + // NFT tokens + protected static final String NFT_WITH_HBAR_FEE = "nftWithHBarFee"; + protected static final String NFT_WITH_HTS_FEE = "nftWithHtsFee"; + protected static final String NFT_WITH_ROYALTY_FEE_NO_FALLBACK = "nftWithRoyaltyFeeNoFallback"; + protected TokenMovement defaultMovementOfToken(String token) { return moving(10, token).between(OWNER, RECEIVER_WITH_UNLIMITED_AUTO_ASSOCIATIONS); } @@ -290,6 +320,123 @@ protected static SpecOperation[] setUpTokensWithCustomFees(long tokenTotal, long return t.toArray(new SpecOperation[0]); } + protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees(long tokenTotal, long hbarFee, long htsFee) { + var nftWithCustomFeeSupplyKey = "nftWithCustomFeeSupplyKey"; + final var initialBalance = 100 * ONE_HUNDRED_HBARS; + final var t = new ArrayList(List.of( + // create owner and receiver accounts + cryptoCreate(TREASURY_FOR_CUSTOM_FEE_TOKENS), + cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), + cryptoCreate(RECEIVER_HBAR_FEE).maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_FRACTIONAL_FEE).maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_HTS_FEE).maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_NFT_HBAR_FEE).maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_NFT_HTS_FEE).maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_NFT_ROYALTY_FEE).maxAutomaticTokenAssociations(0), + cryptoCreate(RECEIVER_HTS_FEE_SECOND).maxAutomaticTokenAssociations(0), + + // create collector accounts + cryptoCreate(FT_HBAR_COLLECTOR).balance(0L), + cryptoCreate(FT_FRACTIONAL_COLLECTOR).balance(ONE_HUNDRED_HBARS), + cryptoCreate(FT_WITH_HTS_FEE_COLLECTOR).balance(0L), + cryptoCreate(NFT_HBAR_COLLECTOR).balance(0L), + cryptoCreate(NFT_HTS_COLLECTOR).balance(0L), + cryptoCreate(NFT_ROYALTY_FEE_COLLECTOR).balance(0L), + + // create FT with HBAR fee + tokenCreate(FT_WITH_HBAR_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(FUNGIBLE_COMMON) + .withCustom(fixedHbarFee(hbarFee, FT_HBAR_COLLECTOR)), + + // create FT with Fractional fee and Net of transfers + tokenCreate(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(FUNGIBLE_COMMON) + .withCustom(fractionalFeeNetOfTransfers( + 1, 10L, 1L, OptionalLong.of(100), FT_FRACTIONAL_COLLECTOR)) + .initialSupply(Long.MAX_VALUE) + .payingWith(FT_FRACTIONAL_COLLECTOR), + + // create denom token for FT with HTS fee + tokenCreate(DENOM_TOKEN_HTS) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .initialSupply(tokenTotal), + + // create FT with HTS fee + tokenAssociate(FT_WITH_HTS_FEE_COLLECTOR, DENOM_TOKEN_HTS), + tokenCreate(FT_WITH_HTS_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(FUNGIBLE_COMMON) + .withCustom(fixedHtsFee(htsFee, DENOM_TOKEN_HTS, FT_WITH_HTS_FEE_COLLECTOR)) + .initialSupply(tokenTotal), + + // create NFT with HBar fixed fee + newKeyNamed(nftWithCustomFeeSupplyKey), + tokenCreate(NFT_WITH_HBAR_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(NON_FUNGIBLE_UNIQUE) + .supplyKey(nftWithCustomFeeSupplyKey) + .supplyType(TokenSupplyType.INFINITE) + .initialSupply(0) + .withCustom(fixedHbarFee(hbarFee, NFT_HBAR_COLLECTOR)), + mintToken( + NFT_WITH_HBAR_FEE, + List.of(ByteStringUtils.wrapUnsafely("tokenWithHbarCustomFee".getBytes()))), + + // create NFT with HTS fixed fee - two layers of fees + tokenAssociate(NFT_HTS_COLLECTOR, FT_WITH_HTS_FEE), + newKeyNamed(nftWithCustomFeeSupplyKey), + tokenCreate(NFT_WITH_HTS_FEE) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(NON_FUNGIBLE_UNIQUE) + .supplyKey(nftWithCustomFeeSupplyKey) + .supplyType(TokenSupplyType.INFINITE) + .initialSupply(0) + .withCustom(fixedHtsFee(htsFee, FT_WITH_HTS_FEE, NFT_HTS_COLLECTOR)), + mintToken( + NFT_WITH_HTS_FEE, + List.of(ByteStringUtils.wrapUnsafely("tokenWithHtsCustomFee".getBytes()))), + + // create NFT with Royalty fee no fallback + newKeyNamed(nftWithCustomFeeSupplyKey), + tokenCreate(NFT_WITH_ROYALTY_FEE_NO_FALLBACK) + .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .tokenType(NON_FUNGIBLE_UNIQUE) + .supplyKey(nftWithCustomFeeSupplyKey) + .supplyType(TokenSupplyType.INFINITE) + .initialSupply(0) + .withCustom(royaltyFeeNoFallback(1, 2L, NFT_ROYALTY_FEE_COLLECTOR)), + mintToken( + NFT_WITH_ROYALTY_FEE_NO_FALLBACK, + List.of(ByteStringUtils.wrapUnsafely("tokenWithRoyaltyFee".getBytes()))), + + // create owner of tokens with all kinds of custom fees and associate it to the tokens + cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), + + // HBAR fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HBAR_FEE), + + // FRACTIONAL fee + tokenAssociate( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS), + + // HTS fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HTS_FEE), + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, DENOM_TOKEN_HTS), + + // NFT with HBAR fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HBAR_FEE), + + // NFT with HTS fee + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HTS_FEE), + // NFT with Royalty fee no fallback + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK) + )); + + return t.toArray(new SpecOperation[0]); + } + protected static SpecOperation[] setUpEntitiesPreHIP904() { final var validAlias = "validAlias"; final var aliasTwo = "alias2.0"; diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java index 79d2e0835f87..65086e0f3161 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java @@ -805,6 +805,7 @@ class AirdropTokensWithCustomFees { @BeforeAll static void beforeAll(@NonNull final TestLifecycle lifecycle) { lifecycle.doAdhoc(setUpTokensWithCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE)); + lifecycle.doAdhoc(setUpAccountsAndTokensWithAllCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE)); } @HapiTest @@ -1095,144 +1096,16 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo final Stream transferMultipleFTAndNFTWithAllCustomFeesToNotAssociatedAccountsWithDifferentFeeCollectors() { final var initialBalance = 100 * ONE_HUNDRED_HBARS; - // owner - final String OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES = "ownerOfTokensWithAllCustomFees"; - // receivers - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE = "receiverWIth0AutoAssociationsHbarFee"; - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE = - "receiverWith0AutoAssociationsFractionalFee"; - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE = "receiverWith0AutoAssociationsHtsFee"; - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND = "receiverWith0AutoAssociationsHtsFeeSecond"; - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE = - "receiverWith0AutoAssociationsForNftHbarFee"; - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE = - "receiverWith0AutoAssociationsForNftHtsFee"; - final String RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK = - "receiverWith0AutoAssociationsForNftRoyaltyFeeNoFallback"; - // collectors - final String FT_HBAR_COLLECTOR = "ftHbarCollector"; - final String FT_FRACTIONAL_COLLECTOR = "ftFractionalCollector"; - final String FT_WITH_HTS_FEE_COLLECTOR = "ftWithHtsCollector"; - final String NFT_HBAR_COLLECTOR = "nftHBarCollector"; - final String NFT_HTS_COLLECTOR = "nftHtsCollector"; - final String NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK = "nftRoyaltyFeeCollectorNoFallback"; - // FT tokens - final String FT_WITH_HBAR_FEE = "ftWithHbarFee"; - final String FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS = "ftWithFractionalFeeWithNetOfTransfers"; - final String FT_WITH_HTS_FEE = "ftWithHtsFee"; - final String DENOM_TOKEN_HTS = "denomTokenHts"; - // NFT tokens - final String NFT_WITH_HBAR_FIXED_FEE = "nftWithHBarFixedFee"; - final String NFT_WITH_HTS_FIXED_FEE = "nftWithHtsFixedFee"; - final String NFT_WITH_ROYALTY_FEE_NO_FALLBACK = "nftWithRoyaltyFeeNoFallback"; - final String nftWithCustomFeeSupplyKey = "nftWithCustomFeeSupplyKey"; return defaultHapiSpec( "Send multiple FT and NFT with all custom fees from EOA to not associated account without auto-association slots and with different fee collector accounts for each fee") .given( - // create owner and receiver accounts - cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE) - .maxAutomaticTokenAssociations(0), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE) - .maxAutomaticTokenAssociations(0), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE) - .maxAutomaticTokenAssociations(0), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE) - .maxAutomaticTokenAssociations(0), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE) - .maxAutomaticTokenAssociations(0), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK) - .maxAutomaticTokenAssociations(0), - cryptoCreate(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND) - .maxAutomaticTokenAssociations(0), - - // create collector accounts - cryptoCreate(FT_HBAR_COLLECTOR).balance(0L), - cryptoCreate(FT_FRACTIONAL_COLLECTOR).balance(ONE_HUNDRED_HBARS), - cryptoCreate(FT_WITH_HTS_FEE_COLLECTOR).balance(0L), - cryptoCreate(NFT_HBAR_COLLECTOR).balance(0L), - cryptoCreate(NFT_HTS_COLLECTOR).balance(0L), - cryptoCreate(NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK).balance(0L), - - // create FT with HBAR fee - tokenCreate(FT_WITH_HBAR_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .tokenType(FUNGIBLE_COMMON) - .withCustom(fixedHbarFee(HBAR_FEE, FT_HBAR_COLLECTOR)), - // create FT with Fractional fee and Net of transfers - tokenCreate(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .tokenType(FUNGIBLE_COMMON) - .withCustom(fractionalFeeNetOfTransfers( - 1, 10L, 1L, OptionalLong.of(100), FT_FRACTIONAL_COLLECTOR)) - .initialSupply(Long.MAX_VALUE) - .payingWith(FT_FRACTIONAL_COLLECTOR), - // create denom token for FT with HTS fee - tokenCreate(DENOM_TOKEN_HTS) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .initialSupply(TOKEN_TOTAL), - // create FT with HTS fee - tokenAssociate(FT_WITH_HTS_FEE_COLLECTOR, DENOM_TOKEN_HTS), - tokenCreate(FT_WITH_HTS_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .tokenType(FUNGIBLE_COMMON) - .withCustom(fixedHtsFee(HTS_FEE, DENOM_TOKEN_HTS, FT_WITH_HTS_FEE_COLLECTOR)) - .initialSupply(TOKEN_TOTAL), - - // create NFT with HBar fixed fee - newKeyNamed(nftWithCustomFeeSupplyKey), - tokenCreate(NFT_WITH_HBAR_FIXED_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .tokenType(NON_FUNGIBLE_UNIQUE) - .supplyKey(nftWithCustomFeeSupplyKey) - .supplyType(TokenSupplyType.INFINITE) - .initialSupply(0) - .withCustom(fixedHbarFee(HBAR_FEE, NFT_HBAR_COLLECTOR)), - mintToken( - NFT_WITH_HBAR_FIXED_FEE, - List.of(ByteStringUtils.wrapUnsafely("tokenWithHbarCustomFee".getBytes()))), - - // create NFT with HTS fixed fee - two layers of fees - tokenAssociate(NFT_HTS_COLLECTOR, FT_WITH_HTS_FEE), - newKeyNamed(nftWithCustomFeeSupplyKey), - tokenCreate(NFT_WITH_HTS_FIXED_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .tokenType(NON_FUNGIBLE_UNIQUE) - .supplyKey(nftWithCustomFeeSupplyKey) - .supplyType(TokenSupplyType.INFINITE) - .initialSupply(0) - .withCustom(fixedHtsFee(HTS_FEE, FT_WITH_HTS_FEE, NFT_HTS_COLLECTOR)), - mintToken( - NFT_WITH_HTS_FIXED_FEE, - List.of(ByteStringUtils.wrapUnsafely("tokenWithHtsCustomFee".getBytes()))), - - // create NFT with Royalty fee no fallback - newKeyNamed(nftWithCustomFeeSupplyKey), - tokenCreate(NFT_WITH_ROYALTY_FEE_NO_FALLBACK) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) - .tokenType(NON_FUNGIBLE_UNIQUE) - .supplyKey(nftWithCustomFeeSupplyKey) - .supplyType(TokenSupplyType.INFINITE) - .initialSupply(0) - .withCustom(royaltyFeeNoFallback(1, 2L, NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK)), - mintToken( - NFT_WITH_ROYALTY_FEE_NO_FALLBACK, - List.of(ByteStringUtils.wrapUnsafely("tokenWithRoyaltyFee".getBytes()))), - - // create owner of tokens with all kinds of custom fees and associate it to the tokens - cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), - // HBAR fee - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HBAR_FEE), +// // HBAR fee cryptoTransfer(moving(1000, FT_WITH_HBAR_FEE) .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // FRACTIONAL fee - tokenAssociate( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS), +// // FRACTIONAL fee cryptoTransfer(moving(1000, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // HTS fee - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HTS_FEE), - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, DENOM_TOKEN_HTS), +// // HTS fee cryptoTransfer( moving(1000, FT_WITH_HTS_FEE) .between( @@ -1242,130 +1115,89 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo .between( TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // NFT with HBAR fee - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HBAR_FIXED_FEE), - cryptoTransfer(movingUnique(NFT_WITH_HBAR_FIXED_FEE, 1L) +// // NFT with HBAR fee + cryptoTransfer(movingUnique(NFT_WITH_HBAR_FEE, 1L) .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // NFT with HTS fee - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HTS_FIXED_FEE), - cryptoTransfer(movingUnique(NFT_WITH_HTS_FIXED_FEE, 1L) +// // NFT with HTS fee + cryptoTransfer(movingUnique(NFT_WITH_HTS_FEE, 1L) .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // NFT with Royalty fee no fallback - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK), +// // NFT with Royalty fee no fallback cryptoTransfer(movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) - .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES))) - .when(tokenAirdrop( + .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)) + ) + .when( + tokenAirdrop( moving(1, FT_WITH_HBAR_FEE) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_WITH_0_AUTO_ASSOCIATIONS), moving(1, FT_WITH_HBAR_FEE) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HBAR_FEE), moving(10, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), moving(10, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), moving(1, FT_WITH_HTS_FEE) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), moving(1, FT_WITH_HTS_FEE) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), moving(1, FT_WITH_HTS_FEE) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND), - movingUnique(NFT_WITH_HBAR_FIXED_FEE, 1) + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE_SECOND), + movingUnique(NFT_WITH_HBAR_FEE, 1) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE), - movingUnique(NFT_WITH_HTS_FIXED_FEE, 1L) + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HBAR_FEE), + movingUnique(NFT_WITH_HTS_FEE, 1L) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HTS_FEE), movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK)) + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_ROYALTY_FEE) + ) .payingWith(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .via("multiple tokens transactions")) + .via("multiple tokens transactions") + ) .then( getTxnRecord("multiple tokens transactions") - .hasPriority( - recordWith() - .pendingAirdrops( - includingFungiblePendingAirdrop( - moving(1, FT_WITH_HBAR_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS), - moving(1, FT_WITH_HBAR_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE), - moving( - 20, - FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE), - moving(2, FT_WITH_HTS_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE), - moving(1, FT_WITH_HTS_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND))) - .pendingAirdrops( - includingNftPendingAirdrop( - movingUnique(NFT_WITH_HBAR_FIXED_FEE, 1L) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE), - movingUnique(NFT_WITH_HTS_FIXED_FEE, 1L) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE), - movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, - RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK)))), + .hasPriority(recordWith().pendingAirdrops(includingFungiblePendingAirdrop( + moving(1, FT_WITH_HBAR_FEE) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_WITH_0_AUTO_ASSOCIATIONS), + moving(1, FT_WITH_HBAR_FEE) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HBAR_FEE), + moving(20, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), + moving(2, FT_WITH_HTS_FEE) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), + moving(1, FT_WITH_HTS_FEE) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE_SECOND))) + .pendingAirdrops(includingNftPendingAirdrop( + movingUnique(NFT_WITH_HBAR_FEE, 1L) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HBAR_FEE), + movingUnique(NFT_WITH_HTS_FEE, 1L) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HTS_FEE), + movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_ROYALTY_FEE)))), // receiver getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS).hasTokenBalance(FT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HBAR_FEE) - .hasTokenBalance(FT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FRACTIONAL_FEE) - .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE) - .hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_HTS_FEE_SECOND) - .hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HBAR_FEE) - .hasTokenBalance(NFT_WITH_HBAR_FIXED_FEE, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_HTS_FEE) - .hasTokenBalance(NFT_WITH_HTS_FIXED_FEE, 0), - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS_FOR_NFT_ROYALTY_FEE_NO_FALLBACK) - .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 0), - + getAccountBalance(RECEIVER_HBAR_FEE).hasTokenBalance(FT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_FRACTIONAL_FEE).hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 0), + getAccountBalance(RECEIVER_HTS_FEE).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_HTS_FEE_SECOND).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_NFT_HBAR_FEE).hasTokenBalance(NFT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_NFT_HTS_FEE).hasTokenBalance(NFT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_NFT_ROYALTY_FEE).hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 0), // collectors getAccountBalance(FT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), - getAccountBalance(FT_FRACTIONAL_COLLECTOR) - .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 2), + getAccountBalance(FT_FRACTIONAL_COLLECTOR).hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 2), getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(DENOM_TOKEN_HTS, 2 * HTS_FEE), getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, 0), getAccountBalance(NFT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), getAccountBalance(NFT_HTS_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, HTS_FEE), - getAccountBalance(NFT_ROYALTY_FEE_COLLECTOR_NO_FALLBACK) - .hasTinyBars(0), + getAccountBalance(NFT_ROYALTY_FEE_COLLECTOR).hasTinyBars(0), // owner withOpContext((spec, log) -> { final var record = getTxnRecord("multiple tokens transactions"); @@ -1375,7 +1207,7 @@ final var record = getTxnRecord("multiple tokens transactions"); final var ownerBalance = getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) .hasTinyBars(initialBalance - (txFee + 2 * HBAR_FEE)) .hasTokenBalance(FT_WITH_HBAR_FEE, 1000) - .hasTokenBalance(NFT_WITH_HBAR_FIXED_FEE, 1L); + .hasTokenBalance(NFT_WITH_HBAR_FEE, 1L); allRunFor(spec, ownerBalance); }), getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) @@ -1386,7 +1218,8 @@ final var record = getTxnRecord("multiple tokens transactions"); .hasTokenBalance(DENOM_TOKEN_HTS, TOKEN_TOTAL - 2 * HTS_FEE), getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1), - validateChargedUsd("multiple tokens transactions", 0.8, 10)); + validateChargedUsd("multiple tokens transactions", 0.8, 10) + ); } } From bf6c944e75e988040af41fba1a9be7695fd0437f Mon Sep 17 00:00:00 2001 From: Eva Date: Thu, 5 Sep 2024 12:01:36 +0300 Subject: [PATCH 3/7] Airdrop_27 test latest fixes Signed-off-by: Eva --- .../bdd/suites/hip904/TokenAirdropBase.java | 55 +++-- .../bdd/suites/hip904/TokenAirdropTest.java | 208 +++++++++--------- 2 files changed, 129 insertions(+), 134 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java index 19bc50f83097..012192a5b7bc 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java @@ -31,7 +31,6 @@ import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeNoFallback; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeWithFallback; import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving; -import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.movingUnique; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext; import static com.hedera.services.bdd.suites.HapiSuite.ONE_HUNDRED_HBARS; @@ -97,10 +96,13 @@ public class TokenAirdropBase { protected static final String FT_ALL_COLLECTORS_EXEMPT_COLLECTOR = "ftAllCollectorsExemptCollector"; protected static final String FT_ALL_COLLECTORS_EXEMPT_TOKEN = "ftAllCollectorsExemptToken"; - // owner, receivers with 0 auto-associations, collectors and tokens for multiple tokens with all custom fees airdrop test - // owner + // owner, receivers with 0 auto-associations, collectors and tokens for multiple tokens with all custom fees airdrop + // test + // treasury + protected static final String TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS = "treasuryForAllCustomFeeTokens"; + // owner protected static final String OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES = "ownerOfTokensWithAllCustomFees"; - // receivers + // receivers protected static final String RECEIVER_HBAR_FEE = "receiverHbarFee"; protected static final String RECEIVER_FRACTIONAL_FEE = "receiverFractionalFee"; protected static final String RECEIVER_HTS_FEE_SECOND = "receiverHtsFeeSecond"; @@ -108,19 +110,20 @@ public class TokenAirdropBase { protected static final String RECEIVER_NFT_HBAR_FEE = "receiverNftHbarFee"; protected static final String RECEIVER_NFT_HTS_FEE = "receiverNftHtsFee"; protected static final String RECEIVER_NFT_ROYALTY_FEE = "receiverNftRoyaltyFee"; - // collectors + // collectors protected static final String FT_HBAR_COLLECTOR = "ftHbarCollector"; protected static final String FT_FRACTIONAL_COLLECTOR = "ftFractionalCollector"; protected static final String FT_WITH_HTS_FEE_COLLECTOR = "ftWithHtsCollector"; protected static final String NFT_HBAR_COLLECTOR = "nftHBarCollector"; protected static final String NFT_HTS_COLLECTOR = "nftHtsCollector"; protected static final String NFT_ROYALTY_FEE_COLLECTOR = "nftRoyaltyFeeCollector"; - // FT tokens + // FT tokens protected static final String FT_WITH_HBAR_FEE = "ftWithHbarFee"; - protected static final String FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS = "ftWithFractionalFeeWithNetOfTransfers"; + protected static final String FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS = + "ftWithFractionalFeeWithNetOfTransfers"; protected static final String FT_WITH_HTS_FEE = "ftWithHtsFee"; protected static final String DENOM_TOKEN_HTS = "denomTokenHts"; - // NFT tokens + // NFT tokens protected static final String NFT_WITH_HBAR_FEE = "nftWithHBarFee"; protected static final String NFT_WITH_HTS_FEE = "nftWithHtsFee"; protected static final String NFT_WITH_ROYALTY_FEE_NO_FALLBACK = "nftWithRoyaltyFeeNoFallback"; @@ -320,12 +323,13 @@ protected static SpecOperation[] setUpTokensWithCustomFees(long tokenTotal, long return t.toArray(new SpecOperation[0]); } - protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees(long tokenTotal, long hbarFee, long htsFee) { + protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( + long tokenTotal, long hbarFee, long htsFee) { var nftWithCustomFeeSupplyKey = "nftWithCustomFeeSupplyKey"; final var initialBalance = 100 * ONE_HUNDRED_HBARS; final var t = new ArrayList(List.of( // create owner and receiver accounts - cryptoCreate(TREASURY_FOR_CUSTOM_FEE_TOKENS), + cryptoCreate(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS), cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), cryptoCreate(RECEIVER_HBAR_FEE).maxAutomaticTokenAssociations(0), cryptoCreate(RECEIVER_FRACTIONAL_FEE).maxAutomaticTokenAssociations(0), @@ -345,28 +349,28 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees(long to // create FT with HBAR fee tokenCreate(FT_WITH_HBAR_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(FUNGIBLE_COMMON) .withCustom(fixedHbarFee(hbarFee, FT_HBAR_COLLECTOR)), // create FT with Fractional fee and Net of transfers tokenCreate(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(FUNGIBLE_COMMON) - .withCustom(fractionalFeeNetOfTransfers( - 1, 10L, 1L, OptionalLong.of(100), FT_FRACTIONAL_COLLECTOR)) + .withCustom( + fractionalFeeNetOfTransfers(1, 10L, 1L, OptionalLong.of(100), FT_FRACTIONAL_COLLECTOR)) .initialSupply(Long.MAX_VALUE) .payingWith(FT_FRACTIONAL_COLLECTOR), // create denom token for FT with HTS fee tokenCreate(DENOM_TOKEN_HTS) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .initialSupply(tokenTotal), // create FT with HTS fee tokenAssociate(FT_WITH_HTS_FEE_COLLECTOR, DENOM_TOKEN_HTS), tokenCreate(FT_WITH_HTS_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(FUNGIBLE_COMMON) .withCustom(fixedHtsFee(htsFee, DENOM_TOKEN_HTS, FT_WITH_HTS_FEE_COLLECTOR)) .initialSupply(tokenTotal), @@ -374,34 +378,31 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees(long to // create NFT with HBar fixed fee newKeyNamed(nftWithCustomFeeSupplyKey), tokenCreate(NFT_WITH_HBAR_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(NON_FUNGIBLE_UNIQUE) .supplyKey(nftWithCustomFeeSupplyKey) .supplyType(TokenSupplyType.INFINITE) .initialSupply(0) .withCustom(fixedHbarFee(hbarFee, NFT_HBAR_COLLECTOR)), mintToken( - NFT_WITH_HBAR_FEE, - List.of(ByteStringUtils.wrapUnsafely("tokenWithHbarCustomFee".getBytes()))), + NFT_WITH_HBAR_FEE, List.of(ByteStringUtils.wrapUnsafely("tokenWithHbarCustomFee".getBytes()))), // create NFT with HTS fixed fee - two layers of fees tokenAssociate(NFT_HTS_COLLECTOR, FT_WITH_HTS_FEE), newKeyNamed(nftWithCustomFeeSupplyKey), tokenCreate(NFT_WITH_HTS_FEE) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(NON_FUNGIBLE_UNIQUE) .supplyKey(nftWithCustomFeeSupplyKey) .supplyType(TokenSupplyType.INFINITE) .initialSupply(0) .withCustom(fixedHtsFee(htsFee, FT_WITH_HTS_FEE, NFT_HTS_COLLECTOR)), - mintToken( - NFT_WITH_HTS_FEE, - List.of(ByteStringUtils.wrapUnsafely("tokenWithHtsCustomFee".getBytes()))), + mintToken(NFT_WITH_HTS_FEE, List.of(ByteStringUtils.wrapUnsafely("tokenWithHtsCustomFee".getBytes()))), // create NFT with Royalty fee no fallback newKeyNamed(nftWithCustomFeeSupplyKey), tokenCreate(NFT_WITH_ROYALTY_FEE_NO_FALLBACK) - .treasury(TREASURY_FOR_CUSTOM_FEE_TOKENS) + .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(NON_FUNGIBLE_UNIQUE) .supplyKey(nftWithCustomFeeSupplyKey) .supplyType(TokenSupplyType.INFINITE) @@ -418,8 +419,7 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees(long to tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HBAR_FEE), // FRACTIONAL fee - tokenAssociate( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS), + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS), // HTS fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HTS_FEE), @@ -431,8 +431,7 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees(long to // NFT with HTS fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HTS_FEE), // NFT with Royalty fee no fallback - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK) - )); + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK))); return t.toArray(new SpecOperation[0]); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java index 65086e0f3161..fa5b9c230bfd 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java @@ -54,8 +54,6 @@ import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHbarFee; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHbarFeeInheritingRoyaltyCollector; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fixedHtsFee; -import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.fractionalFeeNetOfTransfers; -import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeNoFallback; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeWithFallback; import static com.hedera.services.bdd.spec.transactions.token.HapiTokenClaimAirdrop.pendingAirdrop; import static com.hedera.services.bdd.spec.transactions.token.HapiTokenReject.rejectingToken; @@ -126,7 +124,6 @@ import java.math.BigInteger; import java.util.List; import java.util.Map; -import java.util.OptionalLong; import java.util.concurrent.atomic.AtomicReference; import java.util.stream.IntStream; import java.util.stream.Stream; @@ -805,7 +802,6 @@ class AirdropTokensWithCustomFees { @BeforeAll static void beforeAll(@NonNull final TestLifecycle lifecycle) { lifecycle.doAdhoc(setUpTokensWithCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE)); - lifecycle.doAdhoc(setUpAccountsAndTokensWithAllCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE)); } @HapiTest @@ -1096,130 +1092,130 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo final Stream transferMultipleFTAndNFTWithAllCustomFeesToNotAssociatedAccountsWithDifferentFeeCollectors() { final var initialBalance = 100 * ONE_HUNDRED_HBARS; - return defaultHapiSpec( - "Send multiple FT and NFT with all custom fees from EOA to not associated account without auto-association slots and with different fee collector accounts for each fee") - .given( -// // HBAR fee - cryptoTransfer(moving(1000, FT_WITH_HBAR_FEE) - .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), -// // FRACTIONAL fee - cryptoTransfer(moving(1000, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), -// // HTS fee - cryptoTransfer( - moving(1000, FT_WITH_HTS_FEE) - .between( - TREASURY_FOR_CUSTOM_FEE_TOKENS, - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES), - moving(TOKEN_TOTAL, DENOM_TOKEN_HTS) - .between( - TREASURY_FOR_CUSTOM_FEE_TOKENS, - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), -// // NFT with HBAR fee - cryptoTransfer(movingUnique(NFT_WITH_HBAR_FEE, 1L) - .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), -// // NFT with HTS fee - cryptoTransfer(movingUnique(NFT_WITH_HTS_FEE, 1L) - .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), -// // NFT with Royalty fee no fallback - cryptoTransfer(movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) - .between(TREASURY_FOR_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)) - ) - .when( - tokenAirdrop( + return hapiTest(flattened( + setUpAccountsAndTokensWithAllCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE), + // create test data + // HBAR fee + cryptoTransfer(moving(1000, FT_WITH_HBAR_FEE) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // FRACTIONAL fee + cryptoTransfer(moving(1000, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // HTS fee + cryptoTransfer( + moving(1000, FT_WITH_HTS_FEE) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES), + moving(TOKEN_TOTAL, DENOM_TOKEN_HTS) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // NFT with HBAR fee + cryptoTransfer(movingUnique(NFT_WITH_HBAR_FEE, 1L) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // NFT with HTS fee + cryptoTransfer(movingUnique(NFT_WITH_HTS_FEE, 1L) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + // NFT with Royalty fee no fallback + cryptoTransfer(movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), + + // create Airdrop + tokenAirdrop( moving(1, FT_WITH_HBAR_FEE) .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_WITH_0_AUTO_ASSOCIATIONS), + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS), moving(1, FT_WITH_HBAR_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HBAR_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HBAR_FEE), moving(10, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), moving(10, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), moving(1, FT_WITH_HTS_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), moving(1, FT_WITH_HTS_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), moving(1, FT_WITH_HTS_FEE) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE_SECOND), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE_SECOND), movingUnique(NFT_WITH_HBAR_FEE, 1) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HBAR_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HBAR_FEE), movingUnique(NFT_WITH_HTS_FEE, 1L) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HTS_FEE), + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HTS_FEE), movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) - .between( - OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_ROYALTY_FEE) - ) + .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_ROYALTY_FEE)) .payingWith(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .via("multiple tokens transactions") - ) - .then( - getTxnRecord("multiple tokens transactions") - .hasPriority(recordWith().pendingAirdrops(includingFungiblePendingAirdrop( + .via("multiple tokens transactions"), + + // assert outcomes + getTxnRecord("multiple tokens transactions") + .hasPriority(recordWith() + .pendingAirdrops(includingFungiblePendingAirdrop( moving(1, FT_WITH_HBAR_FEE) - .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_WITH_0_AUTO_ASSOCIATIONS), + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_WITH_0_AUTO_ASSOCIATIONS), moving(1, FT_WITH_HBAR_FEE) .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HBAR_FEE), moving(20, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_FRACTIONAL_FEE), + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_FRACTIONAL_FEE), moving(2, FT_WITH_HTS_FEE) .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE), moving(1, FT_WITH_HTS_FEE) - .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE_SECOND))) - .pendingAirdrops(includingNftPendingAirdrop( + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_HTS_FEE_SECOND))) + .pendingAirdrops(includingNftPendingAirdrop( movingUnique(NFT_WITH_HBAR_FEE, 1L) - .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HBAR_FEE), + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_NFT_HBAR_FEE), movingUnique(NFT_WITH_HTS_FEE, 1L) - .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HTS_FEE), + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_HTS_FEE), movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) - .between(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_ROYALTY_FEE)))), - // receiver - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS).hasTokenBalance(FT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_HBAR_FEE).hasTokenBalance(FT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_FRACTIONAL_FEE).hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 0), - getAccountBalance(RECEIVER_HTS_FEE).hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_HTS_FEE_SECOND).hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_NFT_HBAR_FEE).hasTokenBalance(NFT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_NFT_HTS_FEE).hasTokenBalance(NFT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_NFT_ROYALTY_FEE).hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 0), - // collectors - getAccountBalance(FT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), - getAccountBalance(FT_FRACTIONAL_COLLECTOR).hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 2), - getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(DENOM_TOKEN_HTS, 2 * HTS_FEE), - getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(NFT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), - getAccountBalance(NFT_HTS_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, HTS_FEE), - getAccountBalance(NFT_ROYALTY_FEE_COLLECTOR).hasTinyBars(0), - // owner - withOpContext((spec, log) -> { - final var record = getTxnRecord("multiple tokens transactions"); - allRunFor(spec, record); - final var txFee = record.getResponseRecord().getTransactionFee(); - // the token should not be transferred but the custom fee should be charged - final var ownerBalance = getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTinyBars(initialBalance - (txFee + 2 * HBAR_FEE)) - .hasTokenBalance(FT_WITH_HBAR_FEE, 1000) - .hasTokenBalance(NFT_WITH_HBAR_FEE, 1L); - allRunFor(spec, ownerBalance); - }), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 998), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(FT_WITH_HTS_FEE, 1000 - HTS_FEE), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(DENOM_TOKEN_HTS, TOKEN_TOTAL - 2 * HTS_FEE), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1), - validateChargedUsd("multiple tokens transactions", 0.8, 10) - ); + .between( + OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, + RECEIVER_NFT_ROYALTY_FEE)))), + // receiver + getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS).hasTokenBalance(FT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_HBAR_FEE).hasTokenBalance(FT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_FRACTIONAL_FEE) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 0), + getAccountBalance(RECEIVER_HTS_FEE).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_HTS_FEE_SECOND).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_NFT_HBAR_FEE).hasTokenBalance(NFT_WITH_HBAR_FEE, 0), + getAccountBalance(RECEIVER_NFT_HTS_FEE).hasTokenBalance(NFT_WITH_HTS_FEE, 0), + getAccountBalance(RECEIVER_NFT_ROYALTY_FEE).hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 0), + // collectors + getAccountBalance(FT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), + getAccountBalance(FT_FRACTIONAL_COLLECTOR) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 2), + getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(DENOM_TOKEN_HTS, 2 * HTS_FEE), + getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(NFT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), + getAccountBalance(NFT_HTS_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, HTS_FEE), + getAccountBalance(NFT_ROYALTY_FEE_COLLECTOR).hasTinyBars(0), + // owner + withOpContext((spec, log) -> { + final var record = getTxnRecord("multiple tokens transactions"); + allRunFor(spec, record); + final var txFee = record.getResponseRecord().getTransactionFee(); + // the token should not be transferred but the custom fee should be charged + final var ownerBalance = getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTinyBars(initialBalance - (txFee + 2 * HBAR_FEE)) + .hasTokenBalance(FT_WITH_HBAR_FEE, 1000) + .hasTokenBalance(NFT_WITH_HBAR_FEE, 1L); + allRunFor(spec, ownerBalance); + }), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 998), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(FT_WITH_HTS_FEE, 1000 - HTS_FEE), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(DENOM_TOKEN_HTS, TOKEN_TOTAL - 2 * HTS_FEE), + getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1), + validateChargedUsd("multiple tokens transactions", 0.8, 10))); } } From c0397087fb26972d2fef1cb7c871d077d029c74d Mon Sep 17 00:00:00 2001 From: Eva Date: Thu, 5 Sep 2024 12:07:29 +0300 Subject: [PATCH 4/7] Airdrop_27 latest fixes Signed-off-by: Eva --- .../com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java index fa5b9c230bfd..dce42a0ea441 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java @@ -1088,7 +1088,7 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo // AIRDROP_27 @HapiTest @DisplayName( - "airdrop max number of 10 tokens with custom fees to not associated accounts and different fee collectors does not hit the transaction limit") + "airdrop with max 10 tokens with custom fees to not associated accounts and different fee collectors does not hit the transaction limit") final Stream transferMultipleFTAndNFTWithAllCustomFeesToNotAssociatedAccountsWithDifferentFeeCollectors() { final var initialBalance = 100 * ONE_HUNDRED_HBARS; From 9d2e69f55404e1a3d2b82d6ec3455b0af9d385c6 Mon Sep 17 00:00:00 2001 From: Eva Date: Mon, 9 Sep 2024 12:39:11 +0300 Subject: [PATCH 5/7] airdrop_27 test fixes Signed-off-by: Eva --- .../bdd/suites/hip904/TokenAirdropBase.java | 24 ++++--- .../bdd/suites/hip904/TokenAirdropTest.java | 62 +++++-------------- 2 files changed, 33 insertions(+), 53 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java index 012192a5b7bc..10a6606abaaf 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java @@ -31,6 +31,7 @@ import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeNoFallback; import static com.hedera.services.bdd.spec.transactions.token.CustomFeeSpecs.royaltyFeeWithFallback; import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.moving; +import static com.hedera.services.bdd.spec.transactions.token.TokenMovement.movingUnique; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.newKeyNamed; import static com.hedera.services.bdd.spec.utilops.UtilVerbs.withOpContext; import static com.hedera.services.bdd.suites.HapiSuite.ONE_HUNDRED_HBARS; @@ -414,25 +415,34 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( // create owner of tokens with all kinds of custom fees and associate it to the tokens cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), - // HBAR fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HBAR_FEE), - + cryptoTransfer(moving(1000, FT_WITH_HBAR_FEE) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), // FRACTIONAL fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS), - + cryptoTransfer(moving(1000, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), // HTS fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, FT_WITH_HTS_FEE), tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, DENOM_TOKEN_HTS), - + cryptoTransfer( + moving(1000, FT_WITH_HTS_FEE) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES), + moving(tokenTotal, DENOM_TOKEN_HTS) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), // NFT with HBAR fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HBAR_FEE), - + cryptoTransfer(movingUnique(NFT_WITH_HBAR_FEE, 1L) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), // NFT with HTS fee tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_HTS_FEE), + cryptoTransfer(movingUnique(NFT_WITH_HTS_FEE, 1L) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), // NFT with Royalty fee no fallback - tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK))); - + tokenAssociate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, NFT_WITH_ROYALTY_FEE_NO_FALLBACK), + cryptoTransfer(movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) + .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)))); return t.toArray(new SpecOperation[0]); } diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java index dce42a0ea441..2f6157185ae6 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java @@ -1088,35 +1088,12 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo // AIRDROP_27 @HapiTest @DisplayName( - "airdrop with max 10 tokens with custom fees to not associated accounts and different fee collectors does not hit the transaction limit") - final Stream - transferMultipleFTAndNFTWithAllCustomFeesToNotAssociatedAccountsWithDifferentFeeCollectors() { + "max 10 tokens to not associated account and different fee collectors does not hit the transaction limit") + final Stream maxTokensNumberWithAllCustomFeesToNotAssociatedAccountWithDifferentFeeCollectors() { final var initialBalance = 100 * ONE_HUNDRED_HBARS; return hapiTest(flattened( + // test setup setUpAccountsAndTokensWithAllCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE), - // create test data - // HBAR fee - cryptoTransfer(moving(1000, FT_WITH_HBAR_FEE) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // FRACTIONAL fee - cryptoTransfer(moving(1000, FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // HTS fee - cryptoTransfer( - moving(1000, FT_WITH_HTS_FEE) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES), - moving(TOKEN_TOTAL, DENOM_TOKEN_HTS) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // NFT with HBAR fee - cryptoTransfer(movingUnique(NFT_WITH_HBAR_FEE, 1L) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // NFT with HTS fee - cryptoTransfer(movingUnique(NFT_WITH_HTS_FEE, 1L) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // NFT with Royalty fee no fallback - cryptoTransfer(movingUnique(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1L) - .between(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS, OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES)), - // create Airdrop tokenAirdrop( moving(1, FT_WITH_HBAR_FEE) @@ -1147,6 +1124,7 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo // assert outcomes getTxnRecord("multiple tokens transactions") .hasPriority(recordWith() + // assert FT pending airdrops .pendingAirdrops(includingFungiblePendingAirdrop( moving(1, FT_WITH_HBAR_FEE) .between( @@ -1164,6 +1142,7 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo .between( OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_HTS_FEE_SECOND))) + // assert NFT pending airdrops .pendingAirdrops(includingNftPendingAirdrop( movingUnique(NFT_WITH_HBAR_FEE, 1L) .between( @@ -1176,26 +1155,19 @@ final Stream ftWithARoyaltyFeeAndAllCollectorsExemptTrueAirdropToCo .between( OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES, RECEIVER_NFT_ROYALTY_FEE)))), - // receiver - getAccountBalance(RECEIVER_WITH_0_AUTO_ASSOCIATIONS).hasTokenBalance(FT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_HBAR_FEE).hasTokenBalance(FT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_FRACTIONAL_FEE) - .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 0), - getAccountBalance(RECEIVER_HTS_FEE).hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_HTS_FEE_SECOND).hasTokenBalance(FT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_NFT_HBAR_FEE).hasTokenBalance(NFT_WITH_HBAR_FEE, 0), - getAccountBalance(RECEIVER_NFT_HTS_FEE).hasTokenBalance(NFT_WITH_HTS_FEE, 0), - getAccountBalance(RECEIVER_NFT_ROYALTY_FEE).hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 0), - // collectors + // assert collectors balances getAccountBalance(FT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), getAccountBalance(FT_FRACTIONAL_COLLECTOR) .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 2), - getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(DENOM_TOKEN_HTS, 2 * HTS_FEE), - getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, 0), + getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR) + .hasTokenBalance(DENOM_TOKEN_HTS, 2 * HTS_FEE) + .hasTokenBalance(FT_WITH_HTS_FEE, 0), + // getAccountBalance(FT_WITH_HTS_FEE_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, + // 0), getAccountBalance(NFT_HBAR_COLLECTOR).hasTinyBars(HBAR_FEE), getAccountBalance(NFT_HTS_COLLECTOR).hasTokenBalance(FT_WITH_HTS_FEE, HTS_FEE), getAccountBalance(NFT_ROYALTY_FEE_COLLECTOR).hasTinyBars(0), - // owner + // assert owner balance withOpContext((spec, log) -> { final var record = getTxnRecord("multiple tokens transactions"); allRunFor(spec, record); @@ -1208,12 +1180,10 @@ final var record = getTxnRecord("multiple tokens transactions"); allRunFor(spec, ownerBalance); }), getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 998), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(FT_WITH_HTS_FEE, 1000 - HTS_FEE), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) - .hasTokenBalance(DENOM_TOKEN_HTS, TOKEN_TOTAL - 2 * HTS_FEE), - getAccountBalance(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES) + .hasTokenBalance(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS, 998) + .hasTokenBalance(FT_WITH_HTS_FEE, 1000 - HTS_FEE) + .hasTokenBalance(FT_WITH_HTS_FEE, 1000 - HTS_FEE) + .hasTokenBalance(DENOM_TOKEN_HTS, TOKEN_TOTAL - 2 * HTS_FEE) .hasTokenBalance(NFT_WITH_ROYALTY_FEE_NO_FALLBACK, 1), validateChargedUsd("multiple tokens transactions", 0.8, 10))); } From 60bbb33912ba221b6a439a72e272a594f9dff16c Mon Sep 17 00:00:00 2001 From: Eva Date: Mon, 9 Sep 2024 13:53:36 +0300 Subject: [PATCH 6/7] codacy errors fix Signed-off-by: Eva --- .../bdd/suites/hip904/TokenAirdropBase.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java index 10a6606abaaf..9c38924f7058 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java @@ -98,7 +98,6 @@ public class TokenAirdropBase { protected static final String FT_ALL_COLLECTORS_EXEMPT_TOKEN = "ftAllCollectorsExemptToken"; // owner, receivers with 0 auto-associations, collectors and tokens for multiple tokens with all custom fees airdrop - // test // treasury protected static final String TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS = "treasuryForAllCustomFeeTokens"; // owner @@ -324,8 +323,17 @@ protected static SpecOperation[] setUpTokensWithCustomFees(long tokenTotal, long return t.toArray(new SpecOperation[0]); } + /** + * Create Fungible and Non-Fungible tokens and set up all scenario receivers and fee collector accounts + * - all receivers are with 0 auto associations + * - Fungible tokens with hBar, Fractional and HTS fees + * - Non-Fungible tokens with hBar, HTS and Royalty fees + * - different fee collector account for each token + * + * @return array of operations + */ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( - long tokenTotal, long hbarFee, long htsFee) { + final long tokenTotal, final long hbarFee, final long htsFee) { var nftWithCustomFeeSupplyKey = "nftWithCustomFeeSupplyKey"; final var initialBalance = 100 * ONE_HUNDRED_HBARS; final var t = new ArrayList(List.of( @@ -339,7 +347,6 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( cryptoCreate(RECEIVER_NFT_HTS_FEE).maxAutomaticTokenAssociations(0), cryptoCreate(RECEIVER_NFT_ROYALTY_FEE).maxAutomaticTokenAssociations(0), cryptoCreate(RECEIVER_HTS_FEE_SECOND).maxAutomaticTokenAssociations(0), - // create collector accounts cryptoCreate(FT_HBAR_COLLECTOR).balance(0L), cryptoCreate(FT_FRACTIONAL_COLLECTOR).balance(ONE_HUNDRED_HBARS), @@ -347,13 +354,11 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( cryptoCreate(NFT_HBAR_COLLECTOR).balance(0L), cryptoCreate(NFT_HTS_COLLECTOR).balance(0L), cryptoCreate(NFT_ROYALTY_FEE_COLLECTOR).balance(0L), - // create FT with HBAR fee tokenCreate(FT_WITH_HBAR_FEE) .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .tokenType(FUNGIBLE_COMMON) .withCustom(fixedHbarFee(hbarFee, FT_HBAR_COLLECTOR)), - // create FT with Fractional fee and Net of transfers tokenCreate(FT_WITH_FRACTIONAL_FEE_WITH_NET_OF_TRANSFERS) .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) @@ -362,12 +367,10 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( fractionalFeeNetOfTransfers(1, 10L, 1L, OptionalLong.of(100), FT_FRACTIONAL_COLLECTOR)) .initialSupply(Long.MAX_VALUE) .payingWith(FT_FRACTIONAL_COLLECTOR), - // create denom token for FT with HTS fee tokenCreate(DENOM_TOKEN_HTS) .treasury(TREASURY_FOR_ALL_CUSTOM_FEE_TOKENS) .initialSupply(tokenTotal), - // create FT with HTS fee tokenAssociate(FT_WITH_HTS_FEE_COLLECTOR, DENOM_TOKEN_HTS), tokenCreate(FT_WITH_HTS_FEE) @@ -375,7 +378,6 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( .tokenType(FUNGIBLE_COMMON) .withCustom(fixedHtsFee(htsFee, DENOM_TOKEN_HTS, FT_WITH_HTS_FEE_COLLECTOR)) .initialSupply(tokenTotal), - // create NFT with HBar fixed fee newKeyNamed(nftWithCustomFeeSupplyKey), tokenCreate(NFT_WITH_HBAR_FEE) @@ -387,7 +389,6 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( .withCustom(fixedHbarFee(hbarFee, NFT_HBAR_COLLECTOR)), mintToken( NFT_WITH_HBAR_FEE, List.of(ByteStringUtils.wrapUnsafely("tokenWithHbarCustomFee".getBytes()))), - // create NFT with HTS fixed fee - two layers of fees tokenAssociate(NFT_HTS_COLLECTOR, FT_WITH_HTS_FEE), newKeyNamed(nftWithCustomFeeSupplyKey), @@ -399,7 +400,6 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( .initialSupply(0) .withCustom(fixedHtsFee(htsFee, FT_WITH_HTS_FEE, NFT_HTS_COLLECTOR)), mintToken(NFT_WITH_HTS_FEE, List.of(ByteStringUtils.wrapUnsafely("tokenWithHtsCustomFee".getBytes()))), - // create NFT with Royalty fee no fallback newKeyNamed(nftWithCustomFeeSupplyKey), tokenCreate(NFT_WITH_ROYALTY_FEE_NO_FALLBACK) @@ -412,7 +412,6 @@ protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( mintToken( NFT_WITH_ROYALTY_FEE_NO_FALLBACK, List.of(ByteStringUtils.wrapUnsafely("tokenWithRoyaltyFee".getBytes()))), - // create owner of tokens with all kinds of custom fees and associate it to the tokens cryptoCreate(OWNER_OF_TOKENS_WITH_ALL_CUSTOM_FEES).balance(initialBalance), // HBAR fee From aa2aac67d3eba7a53d335cb18136d0dc81e5c443 Mon Sep 17 00:00:00 2001 From: Eva Date: Tue, 10 Sep 2024 10:10:19 +0300 Subject: [PATCH 7/7] fix codacy error Signed-off-by: Eva --- .../com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java | 2 +- .../com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java index 9c38924f7058..f433fc78825d 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropBase.java @@ -332,7 +332,7 @@ protected static SpecOperation[] setUpTokensWithCustomFees(long tokenTotal, long * * @return array of operations */ - protected static SpecOperation[] setUpAccountsAndTokensWithAllCustomFees( + protected static SpecOperation[] createAccountsAndTokensWithAllCustomFees( final long tokenTotal, final long hbarFee, final long htsFee) { var nftWithCustomFeeSupplyKey = "nftWithCustomFeeSupplyKey"; final var initialBalance = 100 * ONE_HUNDRED_HBARS; diff --git a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java index 2f6157185ae6..c41ddc91be3c 100644 --- a/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java +++ b/hedera-node/test-clients/src/main/java/com/hedera/services/bdd/suites/hip904/TokenAirdropTest.java @@ -1093,7 +1093,7 @@ final Stream maxTokensNumberWithAllCustomFeesToNotAssociatedAccount final var initialBalance = 100 * ONE_HUNDRED_HBARS; return hapiTest(flattened( // test setup - setUpAccountsAndTokensWithAllCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE), + createAccountsAndTokensWithAllCustomFees(TOKEN_TOTAL, HBAR_FEE, HTS_FEE), // create Airdrop tokenAirdrop( moving(1, FT_WITH_HBAR_FEE)