-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add upgrade script and test code for deploying contracts to sepolia
- Added upgrade script and test code for deploying contracts to sepolia. - Created a new task file for calling the getWoreTime function. - Created a new task file for calling the mintHat function. - Updated the hardhat.config.ts file to include the new task files. - Updated the package.json file to include the new task scripts.
- Loading branch information
1 parent
f02cca6
commit da40b83
Showing
5 changed files
with
91 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import { task } from "hardhat/config"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { loadDeployedContractAddresses } from "../../helpers/deploy/contractsJsonHelper"; | ||
|
||
/** | ||
* 【Task】get getWoreTime of HatsTimeFrameModule | ||
*/ | ||
task("getWoreTime", "getWoreTime") | ||
.addParam("wearer", "address of wearer") | ||
.setAction(async (taskArgs: any, hre: HardhatRuntimeEnvironment) => { | ||
console.log( | ||
"################################### [START] ###################################" | ||
); | ||
|
||
// BigBangコントラクトのアドレスをjsonファイルから取得してくる。 | ||
const { | ||
contracts: { HatsTimeFrameModule }, | ||
} = loadDeployedContractAddresses(hre.network.name); | ||
|
||
// create HatsTimeFrameModule instance | ||
const hatsTimeFrameModuleByBigBang = await hre.viem.getContractAt( | ||
"HatsTimeFrameModule", | ||
HatsTimeFrameModule | ||
); | ||
|
||
// call getWoreTime method | ||
const woreTime = await hatsTimeFrameModuleByBigBang.read.getWoreTime([ | ||
taskArgs.wearer, | ||
0n, | ||
]); | ||
|
||
console.log(`woreTime: ${woreTime}`); | ||
|
||
console.log( | ||
"################################### [END] ###################################" | ||
); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import { task } from "hardhat/config"; | ||
import { HardhatRuntimeEnvironment } from "hardhat/types"; | ||
import { loadDeployedContractAddresses } from "../../helpers/deploy/contractsJsonHelper"; | ||
|
||
/** | ||
* 【Task】call mintHat of HatsTimeFrameModule | ||
*/ | ||
task("mintHat", "mintHat") | ||
.addParam("hatid", "hatid") | ||
.addParam("wearer", "address of wearer") | ||
.setAction(async (taskArgs: any, hre: HardhatRuntimeEnvironment) => { | ||
console.log( | ||
"################################### [START] ###################################" | ||
); | ||
|
||
// BigBangコントラクトのアドレスをjsonファイルから取得してくる。 | ||
const { | ||
contracts: { HatsTimeFrameModule }, | ||
} = loadDeployedContractAddresses(hre.network.name); | ||
|
||
// create HatsTimeFrameModule instance | ||
const hatsTimeFrameModuleByBigBang = await hre.viem.getContractAt( | ||
"HatsTimeFrameModule", | ||
HatsTimeFrameModule | ||
); | ||
|
||
// call mintHat method | ||
const tx = await hatsTimeFrameModuleByBigBang.write.mintHat([ | ||
taskArgs.hatid, | ||
taskArgs.wearer, | ||
]); | ||
|
||
console.log(`tx: ${tx}`); | ||
|
||
console.log( | ||
"################################### [END] ###################################" | ||
); | ||
}); |