0

I'm using scaffold-eth2 with foundry as a base framework but when trying to deploy I am getting this error:

You seem to be using Foundry's default sender. Be sure to set your own --sender. No associated wallet for addresses: {0x1804c8ab1f12e6bbf3894d4083f33e07309d1f38}. Unlocked wallets: [0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266]

I know I can specify the deployer in the CLI with a flag but I'm worried it will mess up the rest of the interactions with scaffold. Currently I'm using scaffold's yarn deploy which is defined as forge build --build-info --build-info-path out/build-info/ && forge script script/Deploy.s.sol --rpc-url ${1:-default_network} --broadcast --legacy && node script/generateTsAbis.js

I've put my deploy file here:

//SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;

import "../contracts/TrailMixV2.sol";
import "./DeployHelpers.s.sol";
import {HelperConfig} from "./HelperConfig.s.sol";

contract DeployScript is ScaffoldETHDeploy {
    error InvalidPrivateKey(string);
    address public constant USER = address(1);

    function run() external {
        uint256 deployerPrivateKey = setupLocalhostEnv();

        if (deployerPrivateKey == 0) {
            revert InvalidPrivateKey(
                "You don't have a deployer account. Make sure you have set DEPLOYER_PRIVATE_KEY in .env or use `yarn generate` to generate a new random account"
            );
        }

        HelperConfig helperConfig = new HelperConfig();
        (
            address erc20Token,
            address stablecoin,
            address router,
            address priceFeed
        ) = helperConfig.activeNetworkConfig();

        vm.startBroadcast(deployerPrivateKey);
        TrailMix yourContract = new TrailMix(
            USER, // owner
            erc20Token,
            stablecoin,
            router,
            priceFeed,
            10 //trail percent
        );
        console.logString(
            string.concat(
                "YourContract deployed at: ",
                vm.toString(address(yourContract))
            )
        );
        vm.stopBroadcast();

        /**
         * This function generates the file containing the contracts Abi definitions.
         * These definitions are used to derive the types needed in the custom scaffold-eth hooks, for example.
         * This function should be called last.
         */
        exportDeployments();
    }

    function test() public {}
}

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.