-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add flash lending functionality #10
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor feedback to keep action switch statement more consistent between actions.
Testing this will be tricky, we will need to add a MockErc3156
contract into test-utils
// the actual difference between the flash borrow and standard borrow. | ||
if !flash { | ||
actions.add_for_pool_transfer(token_address, transfer_amount); | ||
} else { | ||
actions.add_flash_borrow(token_address, transfer_amount); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It might be clearer to have the individualized code within the switch statement instead of in this function
} else { | ||
actions.add_flash_borrow(token_address, transfer_amount); | ||
} | ||
*check_health = true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should leave this line in the switch statement as well, to follow suit with how other external functions are called, like auction::fill
@@ -48,6 +49,25 @@ pub fn execute_submit( | |||
panic_with_error!(e, PoolError::InvalidHf); | |||
} | |||
|
|||
// deal with potential flash lending before dealing with the other transfers. | |||
// tbd: do we want to allow for multiple flash loans? There doesn't seem to be a risk in it so currently enabled. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree.
The only real use case I can imagine for this would probably not benefit from multiple contracts being invoked, however.
It seems more likely that a user would flash borrow multiple tokens to 1 contract to then invoke. However, this is would break moderc3156
interface.
IMO we can leave for now, but it's worth some additional thought.
cc: @markuspluna
@mootz12 thanks for reviewing.
|
tackles #7
This is not yet tested but should work. Will be adding more context on the issue.