Skip to content

Commit

Permalink
Remove tfTransferable check in NfTokenMint (#449)
Browse files Browse the repository at this point in the history
* remove the check in `NfTokenMint` that ensures tfTransferable is set if TransferFee is set.

* add test for setting TransferFee but not tfTransferable

* checkstyle
  • Loading branch information
nkramer44 authored Jul 13, 2023
1 parent 6e085fa commit 1da875a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -107,15 +107,4 @@ static ImmutableNfTokenMint.Builder builder() {
default NfTokenMintFlags flags() {
return NfTokenMintFlags.empty();
}

/**
* For secondary sale/brokered mode, tfTransferable flag must be set.
*/
@Value.Check
default void checkIfFlagIsSet() {
if (transferFee().isPresent()) {
Preconditions.checkArgument(flags().tfTransferable(),
"tfTransferable flag must be set for secondary sale.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
*/

import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatNoException;
import static org.junit.jupiter.api.Assertions.assertThrows;

import com.google.common.io.BaseEncoding;
Expand Down Expand Up @@ -78,16 +79,15 @@ public void buildTxWithTransferFee() {
}

@Test
public void transferFeeWithoutFlagSet() {
assertThrows(
IllegalArgumentException.class,
() -> NfTokenMint.builder()
.fee(XrpCurrencyAmount.ofDrops(1))
.account(Address.of("rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59Ba"))
.tokenTaxon(UnsignedLong.valueOf(146999694L))
.transferFee(TransferFee.of(UnsignedInteger.valueOf(1000)))
.build(),
"tfTransferable flag must be set for secondary sale."
public void transferFeeWithoutFlagSetDoesNotThrow() {
assertThatNoException().isThrownBy(() ->
NfTokenMint.builder()
.fee(XrpCurrencyAmount.ofDrops(1))
.account(Address.of("rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59Ba"))
.tokenTaxon(UnsignedLong.valueOf(146999694L))
.transferFee(TransferFee.of(UnsignedInteger.valueOf(1000)))
.flags(NfTokenMintFlags.empty())
.build()
);
}

Expand Down

0 comments on commit 1da875a

Please sign in to comment.