-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #297 from KPrasch/dkg-init
Rework ritual initiation script for use on mainnet
- Loading branch information
Showing
5 changed files
with
181 additions
and
55 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import click | ||
from eth_utils import to_checksum_address | ||
|
||
|
||
class MinInt(click.ParamType): | ||
name = "minint" | ||
|
||
def __init__(self, min_value): | ||
self.min_value = min_value | ||
|
||
def convert(self, value, param, ctx): | ||
try: | ||
ivalue = int(value) | ||
except ValueError: | ||
self.fail(f"{value} is not a valid integer", param, ctx) | ||
if ivalue < self.min_value: | ||
self.fail( | ||
f"{value} is less than the minimum allowed value of {self.min_value}", param, ctx | ||
) | ||
return ivalue | ||
|
||
|
||
class ChecksumAddress(click.ParamType): | ||
name = "checksum_address" | ||
|
||
def convert(self, value, param, ctx): | ||
try: | ||
value = to_checksum_address(value=value) | ||
except ValueError: | ||
self.fail("Invalid ethereum address") | ||
else: | ||
return value |
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
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