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

Flashloan for token lending #1444

Merged
merged 141 commits into from May 7, 2021
Merged

Flashloan for token lending #1444

merged 141 commits into from May 7, 2021

Conversation

leofisG
Copy link
Contributor

@leofisG leofisG commented Mar 13, 2021

This PR adds flash loan to the token-lending program.
It also supports collecting fee's from flash loan which is set when initReserve.

Fixes: #997

@leofisG leofisG changed the title Flashloan Flashloan for token lending Mar 13, 2021
@leofisG
Copy link
Contributor Author

leofisG commented Mar 13, 2021

All the tests has passed except the one that involves loading the program via BpfLoader to load it by JS. I am getting the error:

Transaction simulation failed: blockhash not found

Any idea?

I tested it locally against solana-test-validator and I am able to deploy it using the solana command line utility but not the Javascript BpfLoader.

@leofisG
Copy link
Contributor Author

leofisG commented May 2, 2021

Hi @jordansexton , I have added a test for the failure case where the fund is 1 less than expected and have fixed other comments and improved on the suggestion that you gave.

Copy link
Contributor

@jordaaash jordaaash left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@leonardgee solid. This looks like it'll be ready to merge this week?

token-lending/program/src/processor.rs Outdated Show resolved Hide resolved
token-lending/program/src/processor.rs Show resolved Hide resolved
token-lending/program/src/instruction.rs Outdated Show resolved Hide resolved
token-lending/program/src/instruction.rs Outdated Show resolved Hide resolved
token-lending/program/src/instruction.rs Outdated Show resolved Hide resolved
token-lending/program/tests/flash_loan.rs Show resolved Hide resolved
token-lending/program/tests/helpers/flash_loan_receiver.rs Outdated Show resolved Hide resolved
token-lending/program/tests/helpers/mod.rs Show resolved Hide resolved
leofisG and others added 12 commits May 4, 2021 12:59
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
Co-authored-by: Jordan Sexton <jordan@jordansexton.com>
@leofisG
Copy link
Contributor Author

leofisG commented May 7, 2021

I hope I can get it merge soon... It's been a long journey.

@jordaaash
Copy link
Contributor

@leonardgee Thanks for all your hard work on this! This will be a great feature to use.

@jordaaash jordaaash merged commit 3045d7b into solana-labs:master May 7, 2021
@leofisG
Copy link
Contributor Author

leofisG commented May 7, 2021

Sorry that I didn't run the fmt.

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

Successfully merging this pull request may close these issues.

lending: Support for flash loans
4 participants