changed try/except for wrap/unwrap
This commit is contained in:
parent
0e86839a3a
commit
2dfb7c3a36
1 changed files with 10 additions and 10 deletions
4
core.py
4
core.py
|
|
@ -676,11 +676,11 @@ def to_token_decimals(amount, decimals):
|
|||
|
||||
def unwrap_pls(account, amount, attempts=18):
|
||||
wpls_contract = load_contract("0xA1077a294dDE1B09bB078844df40758a5D0f9a27")
|
||||
try:
|
||||
tx = wpls_contract.functions.withdraw(to_token_decimals(amount, 18)).build_transaction({
|
||||
"from": account.address,
|
||||
"nonce": get_nonce(account.address)
|
||||
})
|
||||
try:
|
||||
return broadcast_transaction(account, tx, True, attempts)
|
||||
except Exception as e:
|
||||
if error := interpret_exception_message(e):
|
||||
|
|
@ -690,12 +690,12 @@ def unwrap_pls(account, amount, attempts=18):
|
|||
|
||||
def wrap_pls(account, amount, attempts=18):
|
||||
wpls_contract = load_contract("0xA1077a294dDE1B09bB078844df40758a5D0f9a27")
|
||||
try:
|
||||
tx = wpls_contract.functions.deposit().build_transaction({
|
||||
"from": account.address,
|
||||
"nonce": get_nonce(account.address),
|
||||
"value": to_token_decimals(amount, 18)
|
||||
})
|
||||
try:
|
||||
return broadcast_transaction(account, tx, True, attempts)
|
||||
except Exception as e:
|
||||
if error := interpret_exception_message(e):
|
||||
|
|
|
|||
Loading…
Reference in a new issue