Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -170,4 +170,26 @@ default boolean freezePeer() {
return false;
}

/**
* Whether or not this account has deep-frozen this trust line.
*
* @return {@code true} if this account has deep-frozen this trust line, otherwise {@code false}.
*/
@JsonProperty("deep_freeze")
@Value.Default
default boolean deepFreeze() {
return false;
}

/**
* Whether or not the peer account has deep-frozen this trust line.
*
* @return {@code true} if the peer account has deep-frozen this trust line, otherwise {@code false}.
*/
@JsonProperty("deep_freeze_peer")
@Value.Default
default boolean deepFreezePeer() {
return false;
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -67,6 +67,16 @@ public class RippleStateFlags extends Flags {
*/
public static final RippleStateFlags HIGH_FREEZE = new RippleStateFlags(0x00800000);

/**
* Constant {@link RippleStateFlags} for the {@code lsfLowDeepFreeze} flag.
*/
public static final RippleStateFlags LOW_DEEP_FREEZE = new RippleStateFlags(0x02000000);

/**
* Constant {@link RippleStateFlags} for the {@code lsfHighDeepFreeze} flag.
*/
public static final RippleStateFlags HIGH_DEEP_FREEZE = new RippleStateFlags(0x04000000);

private RippleStateFlags(long value) {
super(value);
}
Expand Down Expand Up @@ -157,4 +167,22 @@ public boolean lsfLowFreeze() {
public boolean lsfHighFreeze() {
return this.isSet(HIGH_FREEZE);
}

/**
* The low account has deep-frozen the trust line, preventing the high account from sending and receiving the asset.
*
* @return {@code true} if {@code lsfLowDeepFreeze} is set, otherwise {@code false}.
*/
public boolean lsfLowDeepFreeze() {
return this.isSet(LOW_DEEP_FREEZE);
}

/**
* The high account has deep-frozen the trust line, preventing the low account from sending and receiving the asset.
*
* @return {@code true} if {@code lsfHighDeepFreeze} is set, otherwise {@code false}.
*/
public boolean lsfHighDeepFreeze() {
return this.isSet(HIGH_DEEP_FREEZE);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -59,6 +59,16 @@ public class TrustSetFlags extends TransactionFlags {
*/
protected static final TrustSetFlags CLEAR_FREEZE = new TrustSetFlags(0x00200000);

/**
* Constant {@link TrustSetFlags} for the {@code tfSetDeepFreeze} flag.
*/
protected static final TrustSetFlags SET_DEEP_FREEZE = new TrustSetFlags(0x00400000);

/**
* Constant {@link TrustSetFlags} for the {@code tfClearDeepFreeze} flag.
*/
protected static final TrustSetFlags CLEAR_DEEP_FREEZE = new TrustSetFlags(0x00800000);

private TrustSetFlags(long value) {
super(value);
}
Expand All @@ -81,7 +91,9 @@ private static TrustSetFlags of(
boolean tfSetNoRipple,
boolean tfClearNoRipple,
boolean tfSetFreeze,
boolean tfClearFreeze
boolean tfClearFreeze,
boolean tfSetDeepFreeze,
boolean tfClearDeepFreeze
) {
return new TrustSetFlags(
Flags.of(
Expand All @@ -90,7 +102,9 @@ private static TrustSetFlags of(
tfSetNoRipple ? SET_NO_RIPPLE : UNSET,
tfClearNoRipple ? CLEAR_NO_RIPPLE : UNSET,
tfSetFreeze ? SET_FREEZE : UNSET,
tfClearFreeze ? CLEAR_FREEZE : UNSET).getValue()
tfClearFreeze ? CLEAR_FREEZE : UNSET,
tfSetDeepFreeze ? SET_DEEP_FREEZE : UNSET,
tfClearDeepFreeze ? CLEAR_DEEP_FREEZE : UNSET).getValue()
);
}

Expand Down Expand Up @@ -171,6 +185,24 @@ public boolean tfClearFreeze() {
return this.isSet(CLEAR_FREEZE);
}

/**
* <a href="https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0077-deep-freeze">Deep freeze</a> the trust line.
*
* @return {@code true} if {@code tfSetDeepFreeze} is set, otherwise {@code false}.
*/
public boolean tfSetDeepFreeze() {
return this.isSet(SET_DEEP_FREEZE);
}

/**
* <a href="https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0077-deep-freeze">Clear deep freeze</a> on the trust line.
*
* @return {@code true} if {@code tfClearDeepFreeze} is set, otherwise {@code false}.
*/
public boolean tfClearDeepFreeze() {
return this.isSet(CLEAR_DEEP_FREEZE);
}

/**
* A builder class for {@link TrustSetFlags}.
*/
Expand All @@ -180,6 +212,8 @@ public static class Builder {
private boolean tfClearNoRipple = false;
private boolean tfSetFreeze = false;
private boolean tfClearFreeze = false;
private boolean tfSetDeepFreeze = false;
private boolean tfClearDeepFreeze = false;

/**
* Set {@code tfSetfAuth} to the given value.
Expand Down Expand Up @@ -233,6 +267,26 @@ public Builder tfClearFreeze() {
return this;
}

/**
* Set {@code tfSetDeepFreeze} to {@code true}.
*
* @return The same {@link Builder}.
*/
public Builder tfSetDeepFreeze() {
this.tfSetDeepFreeze = true;
return this;
}

/**
* Set {@code tfClearDeepFreeze} to {@code true}.
*
* @return The same {@link Builder}.
*/
public Builder tfClearDeepFreeze() {
this.tfClearDeepFreeze = true;
return this;
}

/**
* Build a new {@link TrustSetFlags} from the current boolean values.
*
Expand All @@ -245,7 +299,9 @@ public TrustSetFlags build() {
tfSetNoRipple,
tfClearNoRipple,
tfSetFreeze,
tfClearFreeze
tfClearFreeze,
tfSetDeepFreeze,
tfClearDeepFreeze
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand Down Expand Up @@ -75,6 +75,8 @@ public void testJson() throws JsonProcessingException, JSONException {
" \"peer_authorized\": false,\n" +
" \"freeze\": false,\n" +
" \"freeze_peer\": false,\n" +
" \"deep_freeze\": false,\n" +
" \"deep_freeze_peer\": false,\n" +
" \"quality_in\": 0,\n" +
" \"quality_out\": 0\n" +
" },\n" +
Expand All @@ -90,6 +92,8 @@ public void testJson() throws JsonProcessingException, JSONException {
" \"peer_authorized\": false,\n" +
" \"freeze\": false,\n" +
" \"freeze_peer\": false,\n" +
" \"deep_freeze\": false,\n" +
" \"deep_freeze_peer\": false,\n" +
" \"quality_in\": 0,\n" +
" \"quality_out\": 0\n" +
" }\n" +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -33,7 +33,7 @@
public class RippleStateFlagsTests extends AbstractFlagsTest {

public static Stream<Arguments> data() {
return getBooleanCombinations(8);
return getBooleanCombinations(10);
}

@ParameterizedTest
Expand All @@ -46,7 +46,9 @@ public void testDeriveIndividualFlagsFromFlags(
boolean lsfLowNoRipple,
boolean lsfHighNoRipple,
boolean lsfLowFreeze,
boolean lsfHighFreeze
boolean lsfHighFreeze,
boolean lsfLowDeepFreeze,
boolean lsfHighDeepFreeze
) {
long expectedFlags = getExpectedFlags(
lsfLowReserve,
Expand All @@ -56,7 +58,9 @@ public void testDeriveIndividualFlagsFromFlags(
lsfLowNoRipple,
lsfHighNoRipple,
lsfLowFreeze,
lsfHighFreeze
lsfHighFreeze,
lsfLowDeepFreeze,
lsfHighDeepFreeze
);
RippleStateFlags flags = RippleStateFlags.of(expectedFlags);

Expand All @@ -69,6 +73,8 @@ public void testDeriveIndividualFlagsFromFlags(
assertThat(flags.lsfHighNoRipple()).isEqualTo(lsfHighNoRipple);
assertThat(flags.lsfLowFreeze()).isEqualTo(lsfLowFreeze);
assertThat(flags.lsfHighFreeze()).isEqualTo(lsfHighFreeze);
assertThat(flags.lsfLowDeepFreeze()).isEqualTo(lsfLowDeepFreeze);
assertThat(flags.lsfHighDeepFreeze()).isEqualTo(lsfHighDeepFreeze);
}

@ParameterizedTest
Expand All @@ -81,7 +87,9 @@ void testJson(
boolean lsfLowNoRipple,
boolean lsfHighNoRipple,
boolean lsfLowFreeze,
boolean lsfHighFreeze
boolean lsfHighFreeze,
boolean lsfLowDeepFreeze,
boolean lsfHighDeepFreeze
) throws JSONException, JsonProcessingException {
long expectedFlags = getExpectedFlags(
lsfLowReserve,
Expand All @@ -91,7 +99,9 @@ void testJson(
lsfLowNoRipple,
lsfHighNoRipple,
lsfLowFreeze,
lsfHighFreeze
lsfHighFreeze,
lsfLowDeepFreeze,
lsfHighDeepFreeze
);

RippleStateFlags flags = RippleStateFlags.of(expectedFlags);
Expand All @@ -113,7 +123,9 @@ protected long getExpectedFlags(
boolean lsfLowNoRipple,
boolean lsfHighNoRipple,
boolean lsfLowFreeze,
boolean lsfHighFreeze
boolean lsfHighFreeze,
boolean lsfLowDeepFreeze,
boolean lsfHighDeepFreeze
) {
return (lsfLowReserve ? RippleStateFlags.LOW_RESERVE.getValue() : 0L) |
(lsfHighReserve ? RippleStateFlags.HIGH_RESERVE.getValue() : 0L) |
Expand All @@ -122,6 +134,8 @@ protected long getExpectedFlags(
(lsfLowNoRipple ? RippleStateFlags.LOW_NO_RIPPLE.getValue() : 0L) |
(lsfHighNoRipple ? RippleStateFlags.HIGH_NO_RIPPLE.getValue() : 0L) |
(lsfLowFreeze ? RippleStateFlags.LOW_FREEZE.getValue() : 0L) |
(lsfHighFreeze ? RippleStateFlags.HIGH_FREEZE.getValue() : 0L);
(lsfHighFreeze ? RippleStateFlags.HIGH_FREEZE.getValue() : 0L) |
(lsfLowDeepFreeze ? RippleStateFlags.LOW_DEEP_FREEZE.getValue() : 0L) |
(lsfHighDeepFreeze ? RippleStateFlags.HIGH_DEEP_FREEZE.getValue() : 0L);
}
}
Loading
Loading