Skip to content

Commit

Permalink
bigbangを実行するためのタスクファイルを追加
Browse files Browse the repository at this point in the history
  • Loading branch information
mashharuki committed Oct 27, 2024
1 parent e90a582 commit f02cca6
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,3 +201,11 @@ These solutions were combined with ideas from [Hats Protocol](https://www.hatspr
```bash
yarn contract registerSubdomain --label <your label> --network sepolia
```
- #### **call bigbang task**
Please set params when you execute.
```bash
yarn contract bigbang --owner 0x51908F598A5e0d8F1A3bAbFa6DF76F9704daD072 --tophatdetails "tophatDetails" --tophatimageuri "tophatURI" --hatterhatdetails "hatterhatURI" --hatterhatimageuri "tophatDetails" --forwarder 0x51908F598A5e0d8F1A3bAbFa6DF76F9704daD072 --network sepolia
```
2 changes: 1 addition & 1 deletion pkgs/contract/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const {
// タスクファイルを読み込むための設定
const SKIP_LOAD = process.env.SKIP_LOAD === "true";
if (!SKIP_LOAD) {
const taskPaths = ["", "utils", "ens"];
const taskPaths = ["", "utils", "ens", "BigBang"];
taskPaths.forEach((folder) => {
const tasksPath = path.join(__dirname, "tasks", folder);
fs.readdirSync(tasksPath)
Expand Down
3 changes: 2 additions & 1 deletion pkgs/contract/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@
"registerSubdomain": "npx hardhat registerSubdomain",
"createSplit": "npx hardhat run scripts/createSplit.ts",
"upgrade:FractionToken": "npx hardhat run scripts/upgrade/FractionToken.ts",
"upgrade:BigBang": "npx hardhat run scripts/upgrade/BigBang.ts"
"upgrade:BigBang": "npx hardhat run scripts/upgrade/BigBang.ts",
"bigbang": "npx hardhat bigbang"
},
"devDependencies": {
"@nomicfoundation/hardhat-ethers": "^3.0.0",
Expand Down
44 changes: 44 additions & 0 deletions pkgs/contract/tasks/BigBang/bigbang.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
import { task } from "hardhat/config";
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { loadDeployedContractAddresses } from "../../helpers/deploy/contractsJsonHelper";

/**
* 【Task】execute bigbang method
*/
task("bigbang", "bigbang")
.addParam("owner", "The address of the user who will own the topHat.")
.addParam("tophatdetails", "The details of the topHat.")
.addParam("tophatimageuri", "The image URI of the topHat.")
.addParam("hatterhatdetails", "The details of the hatterHat.")
.addParam("hatterhatimageuri", "The image URI of the hatterHat.")
.addParam("forwarder", "The address of the trusted forwarder.")
.setAction(async (taskArgs: any, hre: HardhatRuntimeEnvironment) => {
console.log(
"################################### [START] ###################################"
);
const [bobWalletClient] = await hre.viem.getWalletClients();

// BigBangコントラクトのアドレスをjsonファイルから取得してくる。
const {
contracts: { BigBang },
} = loadDeployedContractAddresses(hre.network.name);

// create BigBang instance
const bigbang = await hre.viem.getContractAt("BigBang", BigBang);

// call bigbang method
const tx = await bigbang.write.bigbang([
bobWalletClient.account?.address!,
taskArgs.tophatdetails,
taskArgs.tophatimageuri,
taskArgs.hatterhatdetails,
taskArgs.hatterhatimageuri,
taskArgs.forwarder,
]);

console.log(`tx: ${tx}`);

console.log(
"################################### [END] ###################################"
);
});

0 comments on commit f02cca6

Please sign in to comment.