|
1 | 1 | import typing |
| 2 | +from dataclasses import dataclass |
2 | 3 |
|
3 | | -from .module import MtcModule |
4 | | -from .pool import PoolModule |
5 | | -from .nominator_pool import NominatorPoolModule |
6 | | -from .single_pool import SingleNominatorModule |
7 | | -from .validator import ValidatorModule |
8 | | -from .controller import ControllerModule |
| 4 | +from modules.module import MtcModule |
| 5 | +from modules.pool import PoolModule |
| 6 | +from modules.nominator_pool import NominatorPoolModule |
| 7 | +from modules.single_pool import SingleNominatorModule |
| 8 | +from modules.validator import ValidatorModule |
| 9 | +from modules.controller import ControllerModule |
9 | 10 |
|
10 | 11 |
|
11 | 12 | MODES = { |
|
18 | 19 |
|
19 | 20 | def get_mode(mode_name: str) -> typing.Optional[MtcModule]: |
20 | 21 | return MODES.get(mode_name) |
| 22 | + |
| 23 | + |
| 24 | +@dataclass |
| 25 | +class Setting: |
| 26 | + mode: typing.Optional[str] |
| 27 | + default_value: typing.Any |
| 28 | + description: str |
| 29 | + |
| 30 | + |
| 31 | +SETTINGS = { |
| 32 | + 'stake': Setting('validator', False, 'Stake amount'), |
| 33 | + 'stakePercent': Setting('validator', 99, 'Stake percent if `stake` is null'), |
| 34 | + 'isSlashing': Setting('validator', None, 'Create complaints to validators'), |
| 35 | + 'maxFactor': Setting('validator', None, 'Param send to Elector. if null will be taken from 17 config param'), |
| 36 | + 'participateBeforeEnd': Setting('validator', None, 'Amount of seconds before start of round to participate'), |
| 37 | + 'liquid_pool_addr': Setting('liquid-staking', None, 'Liquid staking pool address'), |
| 38 | + 'min_loan': Setting('liquid-staking', 41000, 'Min loan amount'), |
| 39 | + 'max_loan': Setting('liquid-staking', 43000, 'Max loan amount'), |
| 40 | + 'max_interest_percent': Setting('liquid-staking', 10, 'Max interest percent'), |
| 41 | + 'duplicateSendfile': Setting(None, True, 'Duplicate external to public Liteservers'), |
| 42 | + 'sendTelemetry': Setting(None, True, 'Send node telemetry'), |
| 43 | + 'telemetryLiteUrl': Setting(None, 'https://telemetry.toncenter.com/report_status', 'Telemetry url'), |
| 44 | + 'overlayTelemetryUrl': Setting(None, 'https://telemetry.toncenter.com/report_overlays', 'Overlay telemetry url'), |
| 45 | + 'duplicateApi': Setting(None, 'sendTelemetry', 'Duplicate external to Toncenter'), |
| 46 | + 'duplicateApiUrl': Setting(None, 'https://[testnet.]toncenter.com/api/v2/sendBoc', 'Toncenter api url for duplicate'), |
| 47 | + 'liteclient_timeout': Setting(None, 3, 'Liteclient default timeout'), |
| 48 | + 'console_timeout': Setting(None, 3, 'Validator console default timeout'), |
| 49 | + 'fift_timeout': Setting(None, 3, 'Fift default timeout'), |
| 50 | + 'useDefaultCustomOverlays': Setting(None, True, 'Participate in default custom overlays node eligible to'), |
| 51 | + 'defaultCustomOverlaysUrl': Setting(None, 'https://ton-blockchain.github.io/fallback_custom_overlays.json', 'Default custom overlays config url'), |
| 52 | +} |
| 53 | + |
| 54 | + |
| 55 | +def get_setting(name: str) -> typing.Optional[Setting]: |
| 56 | + return SETTINGS.get(name) |
| 57 | + |
| 58 | + |
| 59 | +def get_mode_settings(name: str): |
| 60 | + return {k: v for k, v in SETTINGS.items() if v.mode == name} |
| 61 | + |
0 commit comments