Skip to content

Commit

Permalink
Move mediation fee defaults to settings.py
Browse files Browse the repository at this point in the history
This is consistent with the pathfinding defaults and also allows reusing
the default values in multiple places, if necessary.
  • Loading branch information
karlb authored and palango committed Jul 24, 2019
1 parent cc6c2db commit 2ba85cb
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 5 deletions.
5 changes: 3 additions & 2 deletions raiden/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from raiden.network.proxies.user_deposit import UserDeposit
from raiden.raiden_service import RaidenService
from raiden.settings import (
DEFAULT_MEDIATION_MAX_IMBALANCE_FEE,
DEFAULT_NUMBER_OF_BLOCK_CONFIRMATIONS,
DEFAULT_PATHFINDING_IOU_TIMEOUT,
DEFAULT_PATHFINDING_MAX_FEE,
Expand All @@ -22,7 +23,7 @@
PRODUCTION_CONTRACT_VERSION,
)
from raiden.utils import typing
from raiden.utils.typing import Address, FeeAmount
from raiden.utils.typing import Address
from raiden_contracts.contract_manager import contracts_precompiled_path

log = structlog.get_logger(__name__)
Expand Down Expand Up @@ -59,7 +60,7 @@ class App: # pylint: disable=too-few-public-methods
"pathfinding_iou_timeout": DEFAULT_PATHFINDING_IOU_TIMEOUT,
"monitoring_enabled": False,
},
"max_imbalance_fee": FeeAmount(0),
"max_imbalance_fee": DEFAULT_MEDIATION_MAX_IMBALANCE_FEE,
}

def __init__(
Expand Down
4 changes: 4 additions & 0 deletions raiden/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
DEFAULT_PATHFINDING_MAX_FEE = 1000
DEFAULT_PATHFINDING_IOU_TIMEOUT = 50000 # now the pfs has 200h to cash in

DEFAULT_MEDIATION_FLAT_FEE = FeeAmount(0)
DEFAULT_MEDIATION_PROPORTIONAL_FEE = 0
DEFAULT_MEDIATION_MAX_IMBALANCE_FEE = FeeAmount(0)

ORACLE_BLOCKNUMBER_DRIFT_TOLERANCE = 3
ETHERSCAN_API = "https://{network}.etherscan.io/api?module=proxy&action={action}"

Expand Down
10 changes: 7 additions & 3 deletions raiden/ui/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
from raiden.network.utils import get_free_port
from raiden.settings import (
DEFAULT_HTTP_SERVER_PORT,
DEFAULT_MEDIATION_FLAT_FEE,
DEFAULT_MEDIATION_MAX_IMBALANCE_FEE,
DEFAULT_MEDIATION_PROPORTIONAL_FEE,
DEFAULT_PATHFINDING_IOU_TIMEOUT,
DEFAULT_PATHFINDING_MAX_FEE,
DEFAULT_PATHFINDING_MAX_PATHS,
Expand Down Expand Up @@ -400,21 +403,22 @@ def options(func):
option(
"--flat-fee",
help=("Flat fee required for every mediation in wei of the mediated token."),
default=FeeAmount(0),
default=DEFAULT_MEDIATION_FLAT_FEE,
type=FeeAmount,
show_default=True,
),
option(
"--proportional-fee",
help=("Mediation fee as ratio of mediated amount in parts-per-million (10^-6)."),
default=0,
default=DEFAULT_MEDIATION_PROPORTIONAL_FEE,
type=int,
show_default=True,
),
option(
"--max-imbalance-fee",
help="Set the worst-case imbalance fee in wei of the mediated token. (Preview)",
default=FeeAmount(0),
default=DEFAULT_MEDIATION_MAX_IMBALANCE_FEE,
type=FeeAmount,
show_default=True,
),
),
Expand Down

0 comments on commit 2ba85cb

Please sign in to comment.