Skip to content

Commit

Permalink
feat: Contract Transfer Success!!!!!!
Browse files Browse the repository at this point in the history
  • Loading branch information
Dhruv1238 committed Dec 7, 2024
1 parent 92f7f34 commit bb89de2
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion packages/hardhat/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const config: HardhatUserConfig = {
url: `https://eth-mainnet.alchemyapi.io/v2/${providerApiKey}`,
enabled: process.env.MAINNET_FORKING_ENABLED === "true",
},

},
mainnet: {
url: `https://eth-mainnet.alchemyapi.io/v2/${providerApiKey}`,
Expand Down Expand Up @@ -148,4 +149,23 @@ const config: HardhatUserConfig = {
},
};

export default config;

export default config;

import { task } from "hardhat/config";

// Define the custom task here
task("transfer-ownership", "Transfers ownership of the NFT")
.addParam("contract", "The contract's address")
.addParam("newOwner", "The new owner's address")
.setAction(async ({ contract, newOwner }, { ethers, getNamedAccounts }) => {
const { deployer } = await getNamedAccounts();
const signer = await ethers.provider.getSigner(deployer);
const nft = await ethers.getContractAt("StepStakeDynamicNFT", contract, signer);

console.log(`Initiating ownership transfer from deployer (${deployer}) to new owner (${newOwner}).`);
const tx = await nft.transferOwnership(newOwner);
console.log(`Transaction sent. Tx hash: ${tx.hash}`);
const receipt = await tx.wait();
console.log(`Transaction confirmed in block ${receipt?.blockNumber}`);
});

0 comments on commit bb89de2

Please sign in to comment.