Skip to content

Commit

Permalink
Added deploy scripts and code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Abhimanyu121 committed Oct 8, 2023
1 parent a08e0a2 commit a50b90b
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 36 deletions.
4 changes: 1 addition & 3 deletions contracts/src/hyperboards/HyperboardNFT.sol
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,7 @@ import { Strings } from "oz-contracts/contracts/utils/Strings.sol";

import { Ownable } from "oz-contracts/contracts/access/Ownable.sol";
import { CountersUpgradeable } from "oz-upgradeable/utils/CountersUpgradeable.sol";
import { Errors } from "../libs/errors.sol";
import { IERC6551Registry } from "../interfaces/IERC6551Registry.sol";
import "forge-std/console.sol";
import { Errors } from "../libs/Errors.sol";

/// @title A hyperboard NFT
/// @author Abhimanyu Shekhawat
Expand Down
30 changes: 0 additions & 30 deletions contracts/src/interfaces/IERC6551Registry.sol

This file was deleted.

45 changes: 45 additions & 0 deletions contracts/tasks/deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,48 @@ task("deploy-trader", "Deploy HypercertTrader and verify")
}
}
});

task("deploy-hyperboard", "Deploy Hyperboard and verify")
.addOptionalParam("output", "write the details of the deployment to this file if this is set")
.setAction(async ({ output }, { ethers, upgrades }) => {
const Hyperboard = await ethers.getContractFactory("Hyperboard");
const hyperboard = await upgrades.deployProxy(Hyperboard, {
kind: "uups",
unsafeAllow: ["constructor"],
});
const contract = await hyperboard.deployed();
console.log(`hyperboard is deployed to proxy address: ${hyperboard.address}`);

// If the `deploymentFile` option is set then write the deployed address to
// a json object on disk. This is intended to be deliberate with how we
// output the contract address and other contract information.
if (output) {
const txReceipt = await contract.provider.getTransactionReceipt(hyperboard.deployTransaction.hash);
await writeFile(
output,
JSON.stringify({
address: hyperboard.address,
blockNumber: txReceipt.blockNumber,
}),
"utf-8",
);
}

if (hre.network.name !== "hardhat" && hre.network.name !== "localhost") {
try {
const code = await hyperboard.instance?.provider.getCode(hyperboard.address);
if (code === "0x") {
console.log(`${hyperboard.name} contract deployment has not completed. waiting to verify...`);
await hyperboard.instance?.deployed();
}
await hre.run("verify:verify", {
address: hyperboard.address,
});
} catch ({ message }) {
if ((message as string).includes("Reason: Already Verified")) {
console.log("Reason: Already Verified");
}
console.error(message);
}
}
});
3 changes: 0 additions & 3 deletions contracts/test/foundry/HyperboardNFT.t.sol
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.16;
import { ERC20 } from "oz-contracts/contracts/token/ERC20/ERC20.sol";
// import { WalletImpl } from "./WalletImpl.sol"; // Replace with your wallet implementation contract
import { IERC6551Registry } from "../../src/interfaces/IERC6551Registry.sol";
import { Hyperboard } from "../../src/hyperboards/HyperboardNFT.sol";
import { Test } from "forge-std/Test.sol";
import { Vm } from "forge-std/Vm.sol";
Expand All @@ -15,7 +13,6 @@ import { IHypercertToken } from "../../src/interfaces/IHypercertToken.sol";
contract TestHyperboard is Test {
Hyperboard private _hyperboard;
// WalletImpl _walletImpl;
IERC6551Registry private _erc6551Registry;
address private _owner;
address private _user1;
address private _user2;
Expand Down

0 comments on commit a50b90b

Please sign in to comment.