Skip to content

Commit

Permalink
current progress
Browse files Browse the repository at this point in the history
  • Loading branch information
compojoom committed Oct 13, 2022
1 parent 3d972da commit b4a3805
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 24 deletions.
16 changes: 8 additions & 8 deletions safe_relay_service/relay/management/commands/setup_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,20 @@ class Command(BaseCommand):
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.deploy_safes_task",
"Deploy Safes",
20,
1,
IntervalSchedule.SECONDS,
),
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.check_balance_of_accounts_task",
"Check Balance of realy accounts",
"Check Balance of relay accounts",
1,
IntervalSchedule.HOURS,
),
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.check_create2_deployed_safes_task",
"Check and deploy Create2 Safes",
1,
IntervalSchedule.MINUTES,
IntervalSchedule.SECONDS,
),
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.find_erc_20_721_transfers_task",
Expand All @@ -54,23 +54,23 @@ class Command(BaseCommand):
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.check_pending_transactions",
"Check transactions not mined after a while",
10,
1,
IntervalSchedule.MINUTES,
),
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.check_and_update_pending_transactions",
"Check and update transactions when mined",
1,
IntervalSchedule.MINUTES,
5,
IntervalSchedule.SECONDS,
),
]

tasks_to_delete = [
CeleryTaskConfiguration(
"safe_relay_service.relay.tasks.find_internal_txs_task",
"Process Internal Txs for Safes",
2,
IntervalSchedule.MINUTES,
10,
IntervalSchedule.SECONDS,
),
]

Expand Down
6 changes: 3 additions & 3 deletions safe_relay_service/relay/services/safe_creation_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def create2_safe_tx(
threshold,
gas_price,
payment_token,
payment_receiver=self.funder_account.address,
payment_receiver=NULL_ADDRESS,
fallback_handler=self.default_callback_handler,
payment_token_eth_value=payment_token_eth_value,
fixed_creation_cost=self.safe_fixed_creation_cost,
Expand Down Expand Up @@ -249,7 +249,7 @@ def create2_safe_tx(
if safe_creation_tx.payment_token == NULL_ADDRESS
else safe_creation_tx.payment_token,
payment=safe_creation_tx.payment,
payment_receiver=safe_creation_tx.payment_receiver,
payment_receiver=NULL_ADDRESS,
setup_data=safe_creation_tx.safe_setup_data,
gas_estimated=safe_creation_tx.gas,
gas_price_estimated=self._get_configured_gas_price(),
Expand Down Expand Up @@ -375,7 +375,7 @@ def estimate_safe_creation2(
number_owners,
gas_price,
payment_token,
payment_receiver=self.funder_account.address,
payment_receiver=NULL_ADDRESS,
fallback_handler=self.default_callback_handler,
payment_token_eth_value=payment_token_eth_value,
fixed_creation_cost=fixed_creation_cost,
Expand Down
24 changes: 12 additions & 12 deletions safe_relay_service/relay/services/transaction_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -215,19 +215,19 @@ def _check_safe_gas_price(
def _estimate_tx_gas_price(
self, base_gas_price: int, gas_token: Optional[str] = None
) -> int:
if gas_token and gas_token != NULL_ADDRESS:
try:
gas_token_model = Token.objects.get(address=gas_token, gas=True)
estimated_gas_price = gas_token_model.calculate_gas_price(
base_gas_price
)
except Token.DoesNotExist:
raise InvalidGasToken("Gas token %s not found" % gas_token)
else:
estimated_gas_price = base_gas_price
# if gas_token and gas_token != NULL_ADDRESS:
# try:
# gas_token_model = Token.objects.get(address=gas_token, gas=True)
# estimated_gas_price = gas_token_model.calculate_gas_price(
# base_gas_price
# )
# except Token.DoesNotExist:
# raise InvalidGasToken("Gas token %s not found" % gas_token)
# else:
# estimated_gas_price = base_gas_price

# FIXME Remove 2 / 3, workaround to prevent frontrunning
return int(estimated_gas_price * 2 / 3)
return 0

def _get_configured_gas_price(self) -> int:
"""
Expand Down Expand Up @@ -298,7 +298,7 @@ def estimate_tx(
gas_price,
gas_token or NULL_ADDRESS,
last_used_nonce,
self.tx_sender_account.address,
NULL_ADDRESS,
)

def estimate_tx_for_all_tokens(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def test_deploy_create2_safe_tx(self):
self.assertIsNone(safe_creation_2.tx_hash)
self.assertEqual(
safe_creation_2.payment_receiver,
self.safe_creation_service.funder_account.address,
NULL_ADDRESS
)
with self.assertRaisesMessage(
NotEnoughFundingForCreation, str(safe_creation_2.payment)
Expand Down

0 comments on commit b4a3805

Please sign in to comment.