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

Flash Loans require too many assumptions #16

Open
Kiser360 opened this issue Nov 28, 2022 · 0 comments
Open

Flash Loans require too many assumptions #16

Kiser360 opened this issue Nov 28, 2022 · 0 comments

Comments

@Kiser360
Copy link

assert(Gtxn[asset_1_txn_index].TypeEnum == Axfer)

The amm only cares about getting paid back the correct amount, why does it need to know information about the txn that pays it back? What if I interact with something on-chain that uses an innerTxn to pay back the pool, like an on-chain router? What if I pay the pool back from an account that has been rekeyed to me (resulting in a different sender)?

Additionally this further imposes a limitation on the size of txn groups, I have to use at least 3/16 txns just on the flash-loan (potentially 4 if borrowing both assets)

What if instead the amm just verified its balances have been restored +fees when 'verify' is invoked?

  • Any necessary state (like expected balances) between the loan and the verify can be persisted in the ScratchSpace of the loan txn or into global state like the 'lock' field.

P.S. I haven't got to flash-swaps yet, potentially the same suggestions still apply

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant