ExtropyIO / defi-bot

Tutorial for building DeFi arbitrage bots
1.17k stars 462 forks source link

TradingBot hit a require or revert statement somewhere in its constructor. #11

Closed Nisthar closed 3 years ago

Nisthar commented 3 years ago

I get this error when running truffle migrate on ganache development blockchain.

TradingBot" hit a require or revert statement somewhere in its constructor. Try:
   * Verifying that your constructor params satisfy all require conditions.
   * Adding reason strings to your require statements.
restorepro commented 3 years ago

Did you add the console.table? npm install console.table --save

Nisthar commented 3 years ago

@restorepro its the same after installing node_modules

Nisthar commented 3 years ago
TradingBot" hit a require or revert statement somewhere in its constructor. Try:
   * Verifying that your constructor params satisfy all require conditions.
   * Adding reason strings to your require statements.
restorepro commented 3 years ago

Are you using VS Code as your ide?

Nisthar commented 3 years ago

@restorepro Yes i am using vs code. also i am not using remix to deploy like it says in the readme. But I am deploying it on a ganache development tool.

restorepro commented 3 years ago

Ok. The only truffle related issue that I had was the compiler version of the smart contract (FlashLoan.sol) was throwing a error when i ran 'truffle migrate' so I had to change it to ^0.5.17 from ^0.5.0 in vs code... Have you tried at all using Remix just to see if it works?

restorepro commented 3 years ago

I was able to get it to deploy using vs Code and truffle to the ropsten testnet... I coudnt get ganache to work.

Screen Shot 2021-06-01 at 7 33 25 PM
restorepro commented 3 years ago

Did you modify the truffle-config.js file and add 2_deploy_contracts.js file to the Migrations folder? I also had to change the flashloan.sol file compiler version to ^0.5.17 in the solidity file and the truffle-config.js file and then run truffle compile.

Screen Shot 2021-06-01 at 7 42 46 PM
Nisthar commented 3 years ago

Thanks I was trying to migrate the TradingBot.sol maybe i have to change it to the flashloan.sol. Have you tried compiling the contracts with hardhat instead?

restorepro commented 3 years ago

No i haven't tried using Hardhat yet but I will probably try and deploy it this weekend with Hardhat. Im still getting an error when I run the index.js file though..

Screen Shot 2021-06-02 at 6 17 00 PM
Nisthar commented 3 years ago

Thanks, i got it working with hardhat. But i am still getting the Insufficient funds error.

restorepro commented 3 years ago

Glad you got it deployed! Is your GAS error the same as mine?