Skip to content

Commit 80b8bb0

Browse files
1yamnesitor
authored andcommitted
fix: return false if error got returned while trying to estimate the gas cost in _simulate_create_tx_flow
1 parent ae6ad56 commit 80b8bb0

File tree

1 file changed

+16
-13
lines changed

1 file changed

+16
-13
lines changed

src/aleph/sdk/connectors/superfluid.py

Lines changed: 16 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -38,19 +38,22 @@ def __init__(self, account: ETHAccount):
3838
self.cfaV1Instance = CFA_V1(account.rpc, account.chain_id)
3939

4040
def _simulate_create_tx_flow(self, flow: Decimal, block=True) -> bool:
41-
operation = self.cfaV1Instance.create_flow(
42-
sender=self.normalized_address,
43-
receiver=to_normalized_address(
44-
"0x0000000000000000000000000000000000000001"
45-
), # Fake Address we do not sign/send this transactions
46-
super_token=self.super_token,
47-
flow_rate=int(to_wei_token(flow)),
48-
)
49-
50-
populated_transaction = operation._get_populated_transaction_request(
51-
self.account.rpc, self.account._account.key
52-
)
53-
return self.account.can_transact(tx=populated_transaction, block=block)
41+
try:
42+
operation = self.cfaV1Instance.create_flow(
43+
sender=self.normalized_address,
44+
receiver=to_normalized_address(
45+
"0x0000000000000000000000000000000000000001"
46+
), # Fake Address we do not sign/send this transactions
47+
super_token=self.super_token,
48+
flow_rate=int(to_wei_token(flow)),
49+
)
50+
51+
populated_transaction = operation._get_populated_transaction_request(
52+
self.account.rpc, self.account._account.key
53+
)
54+
return self.account.can_transact(tx=populated_transaction, block=block)
55+
except Exception:
56+
return False
5457

5558
async def _execute_operation_with_account(self, operation: Operation) -> str:
5659
"""

0 commit comments

Comments
 (0)