I need HELP!!!! section 6 thunder loan #321
jupiter-Pulin
started this conversation in
General
Replies: 1 comment 14 replies
-
Hello, @jupiter-Pulin, Can you print out the |
Beta Was this translation helpful? Give feedback.
14 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Detailed Calculation
Assumptions:
Initial deposit = 1000e18 tokens
Flash loan amount = AMOUNT
Fee = 30e15 (0.03 ETH)
Initial exchangeRate = 1e18
First flash loan:
New exchangeRate = 1e18 * (1000e18 + 0.03e18) / 1000e18 = 1.00003e18
Tokens in the pool = 1000e18 + 0.03e18 = 1000.03e18
Second flash loan:
New exchangeRate = 1.00003e18 * (1000e18 + 0.03e18) / 1000e18 = 1.00006e18
Tokens in the pool = 1000.03e18 + 0.03e18 = 1000.06e18
Redemption calculation:
LP-owned assetToken = 1000e18
Base tokens to be received = 1000e18 * 1.00006e18 / 1e18 = 1000.06e18
According to this calculation, the tokens in the pool should exactly match the amount needed for redemption, but an error occurred in practice. This is indeed strange.
This is my detailed code:
My receiver contract:
logs:
Beta Was this translation helpful? Give feedback.
All reactions