-
Description:There are two functions which are being called by one by one and i dont understand why one is static call and another is delegate call. Two functions : function getCalculatedFee(IERC20 token, uint256 amount) public view returns (uint256 fee) {
//slither-disable-next-line divide-before-multiply
uint256 valueOfBorrowedToken = (amount * getPriceInWeth(address(token))) / s_feePrecision;
//slither-disable-next-line divide-before-multiply
fee = (valueOfBorrowedToken * s_flashLoanFee) / s_feePrecision;
} This logs are generated while testing thunder Loan Redeem function which is function testRedeem() public setAllowedToken hasDeposits {
uint256 amountToBorrow = AMOUNT * 10;
uint256 calculatedFee = thunderLoan.getCalculatedFee(tokenA, amountToBorrow);
/*
vm.startPrank(user);
tokenA.mint(address(mockFlashLoanReceiver), calculatedFee);
thunderLoan.flashloan(address(mockFlashLoanReceiver), tokenA, amountToBorrow, "");
vm.stopPrank();
*/
vm.startPrank(liquidityProvider);
thunderLoan.redeem(tokenA,type(uint256).max);
vm.stopPrank();
} Proof of Logs: |
Beta Was this translation helpful? Give feedback.
Answered by
azhar0406
Feb 23, 2024
Replies: 1 comment 1 reply
-
You’re calling the ERC1967 proxy and to preserve the storage it will use a delegate call in the fallback function and pass it to the implementation contract. ![]() |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
DevSwayam
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You’re calling the ERC1967 proxy and to preserve the storage it will use a delegate call in the fallback function and pass it to the implementation contract.