-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathClaimPredicateOr.cs
More file actions
37 lines (33 loc) · 1.29 KB
/
ClaimPredicateOr.cs
File metadata and controls
37 lines (33 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using StellarDotnetSdk.Xdr;
namespace StellarDotnetSdk.Claimants;
/// <summary>
/// Represents a logical OR combination of two claim predicates.
/// A claimable balance can be claimed when either the left or right predicate (or both) is satisfied.
/// </summary>
public class ClaimPredicateOr : ClaimPredicate
{
/// <summary>
/// Initializes a new instance of the <see cref="ClaimPredicateOr" /> class with two predicates
/// where at least one must be satisfied for the claim to succeed.
/// </summary>
/// <param name="leftPredicate">The first predicate.</param>
/// <param name="rightPredicate">The second predicate.</param>
public ClaimPredicateOr(ClaimPredicate leftPredicate, ClaimPredicate rightPredicate)
{
LeftPredicate = leftPredicate;
RightPredicate = rightPredicate;
}
public ClaimPredicate LeftPredicate { get; }
public ClaimPredicate RightPredicate { get; }
public override Xdr.ClaimPredicate ToXdr()
{
return new Xdr.ClaimPredicate
{
Discriminant = new ClaimPredicateType
{
InnerValue = ClaimPredicateType.ClaimPredicateTypeEnum.CLAIM_PREDICATE_OR,
},
OrPredicates = new[] { LeftPredicate.ToXdr(), RightPredicate.ToXdr() },
};
}
}