Skip to content

Commit

Permalink
only check prioritized per level
Browse files Browse the repository at this point in the history
  • Loading branch information
trevormil committed Apr 30, 2024
1 parent dd7b88e commit f57a71d
Show file tree
Hide file tree
Showing 6 changed files with 328 additions and 200 deletions.
12 changes: 10 additions & 2 deletions proto/badges/transfers.proto
Original file line number Diff line number Diff line change
Expand Up @@ -446,9 +446,17 @@ message Transfer {
// Whether to only check prioritized approvals for the transfer.
// If true, we will only check the prioritized approvals and fail if none of them match (i.e. do not check any non-prioritized approvals).
// If false, we will check the prioritized approvals first and then scan through the rest of the approvals.
bool onlyCheckPrioritizedApprovals = 8;
bool onlyCheckPrioritizedCollectionApprovals = 8;
// Whether to only check prioritized approvals for the transfer.
// If true, we will only check the prioritized approvals and fail if none of them match (i.e. do not check any non-prioritized approvals).
// If false, we will check the prioritized approvals first and then scan through the rest of the approvals.
bool onlyCheckPrioritizedIncomingApprovals = 9;
// Whether to only check prioritized approvals for the transfer.
// If true, we will only check the prioritized approvals and fail if none of them match (i.e. do not check any non-prioritized approvals).
// If false, we will check the prioritized approvals first and then scan through the rest of the approvals.
bool onlyCheckPrioritizedOutgoingApprovals = 10;
// The ZKPs that need to be solved for approval.
repeated ZkProofSolution zkProofSolutions = 9;
repeated ZkProofSolution zkProofSolutions = 11;
}

// MerklePathItem represents an item in a Merkle path.
Expand Down
10 changes: 9 additions & 1 deletion x/badges/keeper/approved_transfers.go
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,15 @@ func (k Keeper) DeductAndGetUserApprovals(
) ([]*UserApprovalsToCheck, error) {
prioritizedApprovals := transfer.PrioritizedApprovals
fromAddress := transfer.From
onlyCheckPrioritized := transfer.OnlyCheckPrioritizedApprovals
onlyCheckPrioritized := false
if approvalLevel == "collection" && transfer.OnlyCheckPrioritizedCollectionApprovals {
onlyCheckPrioritized = true
} else if approvalLevel == "outgoing" && transfer.OnlyCheckPrioritizedOutgoingApprovals {
onlyCheckPrioritized = true
} else if approvalLevel == "incoming" && transfer.OnlyCheckPrioritizedIncomingApprovals {
onlyCheckPrioritized = true
}

zkProofSolutions := transfer.ZkProofSolutions
originalTransferBalances = types.DeepCopyBalances(originalTransferBalances)

Expand Down
Loading

0 comments on commit f57a71d

Please sign in to comment.