Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowance for debt asset #363

Closed
2 tasks done
brozorec opened this issue Mar 10, 2023 · 3 comments
Closed
2 tasks done

Allowance for debt asset #363

brozorec opened this issue Mar 10, 2023 · 3 comments
Assignees

Comments

@brozorec
Copy link
Contributor

brozorec commented Mar 10, 2023

Context

Currently, the allowance modal handles only the collateral asset that works when we deposit. It breaks when we want to pay back.

TODOs

  • extend the functionalities of the allowance modal to deal with the debt asset, too, based on the mode:
  • when DEPOSIT_AND_BORROW or DEPOSIT -> deal with allowance for the collateral asset
  • when PAYBACK_AND_WITHDRAW or PAYBACK -> deal with allowance for the debt asset
  • make changes to the borrow store to account for that (maybe add a param to allow() to differentiate between what allowance to deal with?)
@ferostabio ferostabio self-assigned this Mar 11, 2023
@ferostabio ferostabio mentioned this issue Mar 11, 2023
12 tasks
@ferostabio
Copy link
Contributor

@brozorec doing this I realized that even if I removed the infinite limit switch, the modal's text is all about it

<Typography mt="1rem">
  To avoid having to reapprove for subsequent transactions, you could enable infinite approval.
</Typography>

<Typography mt="1rem">
  Otherwise, only the exact amount for this transaction will be allowed to be transfered from your wallet.
</Typography>

@ferostabio
Copy link
Contributor

@brozorec we also need to decide what to do with

set(
  produce((s: BorrowState) => {
    if (s.collateral.allowance.value) {
      // optimistic: we assume transaction will success and update allowance according to that
      s.collateral.allowance.value -= parseFloat(s.collateral.input)
    }
  })
)

That code has been commented out, but we need to deal with it.

@brozorec
Copy link
Contributor Author

@ferostar

doing this I realized that even if I removed the infinite limit switch, the modal's text is all about it

Let's rewrite it as follows:
"Approve the router contract [ADDRESS](with an etherscan link) to use [XXX] from your wallet."

we also need to decide what to do with

I suggest we remove it and when the tx on the src chain gets confirmed, we re-fetch the allowance. Wdyt?

@brozorec brozorec closed this as completed Apr 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants