Flash Loan Truffle Box

Hi @everyone . I am following the tutorial to start a flash loan contract in Truffle (https://docs.aave.com/developers/tutorials/performing-a-flash-loan/…-with-truffle) and I am getting the following error when I execute the command migrate --reset:

Error: Expected parameter ‘from’ not passed to function.
at expected_keys.forEach.key (/usr/local/lib/node_modules/truffle/build/webpack:/packages/expect/index.js:5:1)
at Array.forEach ()
at Object.options (/usr/local/lib/node_modules/truffle/build/webpack:/packages/expect/index.js:3:1)
at Object.run (/usr/local/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:65:1)
at runMigrations (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:269:1)

Can someone give a me a hint?
Please, notice that I am in truffle(ropsten)>

Seriously, any help will be very appreciated!

Hi @AtticusLscott - welcome to the Infura community! From your error message, it sounds like you’re missing a ‘from’ parameter. This stackexchange thread might help point you in the right direction!

Hi Leiya.

Thank you for your reply. Yes, I added the parameter ‘from’ and works:

I am deploying using the Ropster network and changed the file to:

// const path = require(“path”);
const HDWalletProvider = require("@truffle/hdwallet-provider")
require(“dotenv”).config()

module.exports = {
// See http://truffleframework.com/docs/advanced/configuration to customize your Truffle configuration!
// contracts_build_directory: path.join(__dirname, “client/src/contracts”),
networks: {
development: {
host: “127.0.0.1”,
port: 8545,
// gas: 20000000,
network_id: “*”,
skipDryRun: true
},
ropsten: {
provider: new HDWalletProvider(process.env.DEPLOYMENT_ACCOUNT_KEY, “https://ropsten.infura.io/v3/” + process.env.INFURA_API_KEY),
network_id: 3,
from:0xCAFE…
gas: 5000000,
gasPrice: 5000000000, // 5 Gwei
skipDryRun: true
},

Finally, Can you review or update the documentation mentioning explicitly that you need the “from” field?

Thank you.

Regards.

Glad that fixed it! Those are actually Truffle docs, so you may want to reach out to that team with the request to update their documentation to move “from” from the optional config values to a required value.

Hey @AtticusLscott - I connected with the Truffle team and that from is only required if eth_accounts doesn’t return anything, which is the case for Infura endpoints, as they don’t have a wallet. Using something like Ganache or geth RPC endpoints would not need a from and default to the first account.

That being said, I’ve requested Truffle update their documentation to include that caveat, as it’s not super clear in their documentation :slight_smile:

Hi Leiya.

I think you have super powers with the Truffle people :).

I keep trying to deploy the Flash-loan-box example, but with no success.

Currently, I have the following error after the

migrate --reset

I am getting the following error:

Deploying ‘Migrations’

Error: *** Deployment Failed ***

“Migrations” – senderAddress.toLowerCase is not a function.

at /usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:364:1
at process._tickCallback (internal/process/next_tick.js:68:7)

Maybe, please, Can you help me (and to the community :slight_smile: ) asking them (Aave or Truffle) what it is missing in the tutorial to deploy this successfully with Infura?

I know this is not totally related with Infura, but maybe, you can help us.

Regards.

Atticus.

Hi @AtticusLscott - no problem! Can you post your code file that you’re calling that senderAddress.toLowerCase in? It looks like maybe the toLowerCase hasn’t been declared as a function yet, but I’m not sure without seeing the actual code :slight_smile:

Thank you so much @Leiya_Kenney. That is the problem, this file does not exist:
/usr/local/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:364:1

I have my project in GitHub: https://github.com/AtticusLScott/flashloanSep6

Again, I know it is out of scope of Infura, but if you can help me, or tell me where I can ask. Unfortunately I put an issue in GitHub but I have not received any answer.

Thank you again!

Regards

Ah, I see. You may have to re-setup your Node - I’ve run into issues like this before where it says a file doesn’t exist that should. I used this page to get mine up and running correctly. Let me know if that helps!