Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Redeploying the same contract code when using linkContract not working #1

Open
n0thingness opened this issue Nov 16, 2024 · 0 comments

Comments

@n0thingness
Copy link
Contributor

n0thingness commented Nov 16, 2024

If you rerun the deploy script without creating a new contract version, the linking step of the new address to the existing contract fails because the instance is already linked to a version of the contract

forge script script/NFT.s.sol:MyScript --rpc-url $LOCAL_RPC_URL --broadcast --ffi
// SPDX-License-Identifier: UNLICENSED
pragma solidity ^0.8.13;

import {Script} from "forge-std/Script.sol";
import {MultiBaas} from "forge-multibaas/MultiBaas.sol";
import {NFT} from "../src/NFT.sol";
import {console} from "forge-std/console.sol";

contract MyScript is Script {
    function run() external {
        uint256 deployerPrivateKey = vm.envUint("PRIVATE_KEY");
        vm.startBroadcast(deployerPrivateKey);

        NFT nft = new NFT("First NFT Collection", "1ST", "baseUri");

        // Upload and link the contract in MultiBaas with default options
        MultiBaas.linkContract("NFT", address(nft));

        vm.stopBroadcast();
    }
}

This is a bit strange because the newly deployed and newly labelled address should not be linked with anything yet.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant