Cyfrin / foundry-nft-cu

21 stars 22 forks source link

The path broadcast is not allowed to be accessed for read operations #28

Closed spomaria closed 5 months ago

spomaria commented 5 months ago

I deployed my BasicNft contract to the Sepolia network successfully. When I tried to mint the nft using using the Interactions.s.sol Script, I get this error message

Compiler run successful!
Traces:
  [1131599] → new DevOpsTools@0x445F9f27BD5c13Cd85dB5dB7e3554973C4FF37a5
    └─ ← [Return] 5652 bytes of code

  [251393] → new MintBasicNft@0x5b73C5498c1E3b4dbA84de0F1833c4a029d90519
    └─ ← [Return] 1145 bytes of code

  [6901] MintBasicNft::run()
    ├─ [3925] DevOpsTools::get_most_recent_deployment("BasicNft", 11155111 [1.115e7]) [delegatecall]
    │   ├─ [0] VM::readDir("./broadcast", 3) [staticcall]
    │   │   └─ ← [Revert] the path broadcast is not allowed to be accessed for read operations
    │   └─ ← [Revert] the path broadcast is not allowed to be accessed for read operations
    └─ ← [Revert] the path broadcast is not allowed to be accessed for read operations

Error: 
script failed: the path broadcast is not allowed to be accessed for read operations
make: *** [Makefile:51: mint] Error 1

Please how can I resolve this error? Below is my Interactions.s.sol script

// SPDX-License-Identifier: MIT

pragma solidity ^0.8.18;

import { Script } from "forge-std/Script.sol";
import { DevOpsTools} from "foundry-devops/src/DevOpsTools.sol";
import { BasicNft} from "../src/BasicNft.sol";

contract MintBasicNft is Script {
    string public constant PUG_URI =
        "ipfs://bafybeig37ioir76s7mg5oobetncojcm3c3hxasyd4rvid4jqhy4gkaheg4/?filename=0-PUG.json";
    string public constant BABYBOO = "ipfs://bafybeihjyotci6kduji3glrfanpqzqr5wlfbkm3wzoqp7mbcfij3uslzo4/";

    function run() public{
        address recentlyDeployed = DevOpsTools.get_most_recent_deployment(
            "BasicNft", block.chainid
        );

        mintNftOnContract(recentlyDeployed);
    }

    function mintNftOnContract(address contractAddress) public {
        vm.startBroadcast();
        BasicNft(contractAddress).mintNFT(BABYBOO);
        // BasicNft(contractAddress).mintNFT(PUG_URI);
        vm.stopBroadcast();
    }

}
spomaria commented 5 months ago

I am getting the same error when I deploy the contract to Anvil

PatrickAlphaC commented 5 months ago

Could you try this?

https://github.com/Cyfrin/foundry-full-course-f23/discussions/1302#discussioncomment-8105469

spomaria commented 5 months ago

Thanks @PatrickAlphaC, problem solved.

spomaria commented 5 months ago

Thank you for your email, it solved my problem.

Nengak Emmanuel Goltong

On Tue, Apr 16, 2024 at 10:17 PM Patrick Collins @.***> wrote:

Could you try this?

Cyfrin/foundry-full-course-f23#1302 (comment) https://github.com/Cyfrin/foundry-full-course-f23/discussions/1302#discussioncomment-8105469

— Reply to this email directly, view it on GitHub https://github.com/Cyfrin/foundry-nft-f23/issues/28#issuecomment-2059936785, or unsubscribe https://github.com/notifications/unsubscribe-auth/AUBUGZPRGKX4U233B3V2V3TY5WIPHAVCNFSM6AAAAABGHCLBBOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDANJZHEZTMNZYGU . You are receiving this because you authored the thread.Message ID: @.***>