-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Multisig: Generalized for any multisig
- Loading branch information
1 parent
41f9b20
commit 6e2fb0b
Showing
4 changed files
with
76 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
lib-api/src/main/java/org/ergoplatform/appkit/SigningParticipants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package org.ergoplatform.appkit; | ||
|
||
import java.util.List; | ||
|
||
/** | ||
* Participants able to sign for a {@link ReducedTransaction} | ||
*/ | ||
abstract public class SigningParticipants { | ||
|
||
/** | ||
* @return true if multiple signers are needed | ||
*/ | ||
abstract public boolean isMultisig(); | ||
|
||
/** | ||
* Multisig requirement, k-out-of-n | ||
*/ | ||
public static class MultisigRequirement extends SigningParticipants { | ||
public final int hintsNeeded; | ||
public final List<SigningParticipants> hintbag; | ||
|
||
public MultisigRequirement(int hintsNeeded, List<SigningParticipants> hintbag) { | ||
this.hintsNeeded = hintsNeeded; | ||
this.hintbag = hintbag; | ||
} | ||
|
||
@Override | ||
public boolean isMultisig() { | ||
return hintsNeeded > 1; | ||
} | ||
} | ||
|
||
public static class SingleSigner extends SigningParticipants { | ||
public final Address address; | ||
|
||
public SingleSigner(Address address) { | ||
this.address = address; | ||
} | ||
|
||
@Override | ||
public boolean isMultisig() { | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters