You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In above Solidity code, as recommended in the official Aave documentation, I am using poolAddressProvider contract to obtain the address of the POOL contract. Then calling executeFlashLoan, which is my endpoint, shuold run POOL.flashloan to request the loan. However, callng this endpoint failes due to flashLoan not properly being called.
Since truffle debug did not provide much information to indicate what went wrong, I tried to directly call flashLoan via web3 python, which did not work either.
pool_contract = w3.eth.contract(address=pool_address, abi=pool_abi)
# Proceed with your existing code using POOL_contract
address = '0xb9af6288810670DAb8bb01CB51A37Af334A90304'
assets = ["0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2"]
amounts = [Web3.to_wei(100, 'ether')]
modes = [0]
on_behalf_of = address
params = b""
logger.info(f'{address=}')
logger.info(f'{assets=}')
logger.info(f'{amounts=}')
logger.info(f'{modes=}')
logger.info(f'{on_behalf_of=}')
logger.info(f'{params=}')
try:
result = pool_contract.functions.flashLoan(
address,
assets,
amounts,
modes,
on_behalf_of,
params,
0
).call({'from': address})
logger.info("Flash loan simulation successful. Result:", result)
except Exception as e:
logger.error("Flash loan simulation error: %s", e)
2024-10-27 12:13:09 [INFO] address='0xb9af6288810670DAb8bb01CB51A37Af334A90304'
2024-10-27 12:13:09 [INFO] assets=['0xC02aaA39b223FE8D0A0e5C4F27eAD9083C756Cc2']
2024-10-27 12:13:09 [INFO] amounts=[100000000000000000000]
2024-10-27 12:13:09 [INFO] modes=[0]
2024-10-27 12:13:09 [INFO] on_behalf_of='0xb9af6288810670DAb8bb01CB51A37Af334A90304'
2024-10-27 12:13:09 [INFO] params=b''
2024-10-27 12:14:15 [ERROR] Flash loan simulation error: ("The function 'flashLoan' was not found in this contract's abi.", ' Are you sure you provided the correct contract abi?')
Since the erorr suggests that contract abi (or its address) is not accurate, I checked the following:
I'm passing the '0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e' to instanciate 'IPoolAddressesProvider,and it can be confirmed that this indeed belongs to the contract 'PoolAddressesProvider'
The address given to IPOOL to instantiate POOL contract is '0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2', and it can be confirmed that this belongs to 'InitializableImmutableAdminUpgradeabilityProxy'
On etherscan,at contract tab, 'InitializableImmutableAdminUpgradeabilityProxy' includes the flashLoan implementation in POOL.sol (this can be confirmed by looking into IDE)
I suspect that I might not be passing the parameters in the expected format, or not instanciating the POOL contract right, etc. Could anybody help me resolve this?
The text was updated successfully, but these errors were encountered:
sakulstra
added a commit
to bgd-labs/aave-v3-origin
that referenced
this issue
Dec 10, 2024
- adding `getReserveVariableDebtToken` getter
- adjusting close factor to apply to whole position, not per reserve
- adjusting close factor to increase to 100% when debt/collateral are below a threshold
- adjusting liquidations to force full liquidation/or keep a leftover that is high enough to allow further liqudiations
I'm trying to call POOL.flashLoan provided by Aave core v3. This is for a test and done on forked mainnet using ganache/truffle.
In above Solidity code, as recommended in the official Aave documentation, I am using poolAddressProvider contract to obtain the address of the POOL contract. Then calling
executeFlashLoan
, which is my endpoint, shuold runPOOL.flashloan
to request the loan. However, callng this endpoint failes due to flashLoan not properly being called.Since
truffle debug
did not provide much information to indicate what went wrong, I tried to directly callflashLoan
via web3 python, which did not work either.Since the erorr suggests that contract abi (or its address) is not accurate, I checked the following:
I'm passing the '0x2f39d218133AFaB8F2B819B1066c7E434Ad94E9e' to instanciate 'IPoolAddressesProvider,and it can be confirmed that this indeed belongs to the contract 'PoolAddressesProvider'
The address given to IPOOL to instantiate POOL contract is '0x87870Bca3F3fD6335C3F4ce8392D69350B4fA4E2', and it can be confirmed that this belongs to 'InitializableImmutableAdminUpgradeabilityProxy'
flashLoan
implementation in POOL.sol (this can be confirmed by looking into IDE)I suspect that I might not be passing the parameters in the expected format, or not instanciating the POOL contract right, etc. Could anybody help me resolve this?
The text was updated successfully, but these errors were encountered: