Closed digitalftl closed 2 years ago
Hi, I'm glad that you like it!
Have you changed scripts/sample-script.ts ?? Could you show me your scripts/sample-script.ts?? Also the smart contract you want to deploy??
Hi, yes I set Flashloan in sample-scripts.ts. Do I need to do something else?
import { ethers, run } from 'hardhat';
async function main() {
await run('compile');
const Flashloan = await ethers.getContractFactory('Flashloan');
const flashloan = await Flashloan.deploy("Hello, Flashloan");
console.log(`FlashBot deployed to ${flashloan.address}`);
}
main()
.then(() => process.exit(0))
.catch((err) => {
console.error(err);
process.exit(1);
});
You are passing an argument Hello, Flashloan
to the deploy function, which you are not supposed to.
It should be like the following code:
import { ethers, run } from 'hardhat';
async function main() {
await run('compile');
const Flashloan = await ethers.getContractFactory('Flashloan');
const flashloan = await Flashloan.deploy(); // Flashloan.sol deploy function takes no arguments
console.log(`FlashBot deployed to ${flashloan.address}`);
}
main()
.then(() => process.exit(0))
.catch((err) => {
console.error(err);
process.exit(1);
});
Notice this Flashloan contract does not have a constructor that takes one parameter.
https://github.com/yuichiroaoki/poly-flash/blob/main/contracts/Flashloan.sol
While this hardhat default Greeter contract has a constructor that takes one string parameter.
That's why when you deploy this Greeter contract, you pass a string, Hello, Hardhat!
to the deploy function.
Hope this makes sense😄
``Yes, it does make sense.
I've got 2 more questions.
Because I've started the bot, nothing happens, I see in the alchemy dashboard that there is only one request made every few seconds.
eth_chainId
and after a while I get this error
502
Error Request failed with status code 502
Thank you so much for your patience.
No, people usually verify their contracts so that everyone can use it like when they build a new Defi protocol. If you just want use it personally, I think don't have to.
Unless there's some errors fetching data from 1inch API or the bot finds an arbitrage, I think it doesn't show any console.log messages.
I think I need to update the docs and code, because you can't tell if the bot running properly or not.
The error message you got means probably the bot successfully sent a request to 1inch API, but 1inch failed to respond price data.
Hi there, I really appreciate you've made this open-source, really good work.
I'm new into this, I've been watching quite a few tutorials on how to deploy the contract with hardhat on mainnet. I believe I managed to config hardhat.configs for the mainnet, but when I run the command I get this error.
Would you be kind to guide me? What do I need to do?
Thank you!