Refs #39
File: crates/charon-flashloan/src/aave.rs — build_flashloan_calldata()
Problem
The adapter encodes flashLoanSimple(receiver, asset, amount, params=0x, referralCode=0). Aave V3 passes the params bytes verbatim into executeOperation(asset, amount, premium, initiator, params) on the receiver.
CharonLiquidator.sol (landed in PR #37) ABI-decodes params inside executeOperation to extract the borrower address, collateral vtoken, debt vtoken, repay amount, and swap-route data. With params = 0x (empty), abi.decode reverts on every call. This means every call produced by build_flashloan_calldata will revert at the contract, making the entire flash-loan liquidation path non-functional.
Impact: Complete functional failure of the liquidation execution path. Every on-chain liquidation attempt will revert.
Fix
Update the FlashLoanProvider trait signature to accept the encoded liquidation params:
fn build_flashloan_calldata(
&self,
asset: Address,
amount: U256,
liquidation_params: &[u8],
) -> Result<Bytes>;
The caller passes in the output of LendingProtocol::build_liquidation_calldata (already ABI-encoded). The adapter forwards this slice into the params slot of flashLoanSimple.
Refs #39
File: crates/charon-flashloan/src/aave.rs — build_flashloan_calldata()
Problem
The adapter encodes flashLoanSimple(receiver, asset, amount, params=0x, referralCode=0). Aave V3 passes the params bytes verbatim into executeOperation(asset, amount, premium, initiator, params) on the receiver.
CharonLiquidator.sol (landed in PR #37) ABI-decodes params inside executeOperation to extract the borrower address, collateral vtoken, debt vtoken, repay amount, and swap-route data. With params = 0x (empty), abi.decode reverts on every call. This means every call produced by build_flashloan_calldata will revert at the contract, making the entire flash-loan liquidation path non-functional.
Impact: Complete functional failure of the liquidation execution path. Every on-chain liquidation attempt will revert.
Fix
Update the FlashLoanProvider trait signature to accept the encoded liquidation params:
The caller passes in the output of LendingProtocol::build_liquidation_calldata (already ABI-encoded). The adapter forwards this slice into the params slot of flashLoanSimple.