Skip to content

Commit

Permalink
modify frontend for authorities
Browse files Browse the repository at this point in the history
  • Loading branch information
yu23ki14 committed Jan 29, 2025
1 parent 2b07298 commit fa2789c
Show file tree
Hide file tree
Showing 14 changed files with 1,049 additions and 49 deletions.
24 changes: 24 additions & 0 deletions pkgs/contract/scripts/upgrade/hatsHatCreatorModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { network, viem } from "hardhat";
import { deployHatsHatCreatorModule } from "../../helpers/deploy/Hats";

const upgrade = async () => {
const module = await deployHatsHatCreatorModule(
"0x0000000000000000000000000000000000000001",
);

const bigBang = await viem.getContractAt(
"BigBang",
"0x3E70d10aCdcC14B6C31DA26DcC195a6EDf1C2c16",
);

await bigBang.write.setHatsHatCreatorModuleImpl([
module.HatsHatCreatorModule.address,
]);

console.log(
"HatsHatCreatorModule module:\n",
`npx hardhat verify ${module.HatsHatCreatorModule.address} "0.0.0" 0x0000000000000000000000000000000000000001 --network ${network.name}\n`,
);
};

upgrade();
24 changes: 24 additions & 0 deletions pkgs/contract/scripts/upgrade/hatsTimeFrameModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { network, viem } from "hardhat";
import { deployHatsTimeFrameModule } from "../../helpers/deploy/Hats";

const upgrade = async () => {
const module = await deployHatsTimeFrameModule(
"0x0000000000000000000000000000000000000001",
);

const bigBang = await viem.getContractAt(
"BigBang",
"0x3E70d10aCdcC14B6C31DA26DcC195a6EDf1C2c16",
);

await bigBang.write.setHatsTimeFrameModuleImpl([
module.HatsTimeFrameModule.address,
]);

console.log(
"HatsTimeframeModule module:\n",
`npx hardhat verify ${module.HatsTimeFrameModule.address} "0.0.0" 0x0000000000000000000000000000000000000001 --network ${network.name}\n`,
);
};

upgrade();
332 changes: 332 additions & 0 deletions pkgs/frontend/abi/hatsHatCreatorModule.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,332 @@
export const HATS_HAT_CREATOR_MODULE_ABI = [
{
inputs: [
{
internalType: "string",
name: "_version",
type: "string",
},
{
internalType: "address",
name: "_tmpOwner",
type: "address",
},
],
stateMutability: "nonpayable",
type: "constructor",
},
{
inputs: [],
name: "InvalidInitialization",
type: "error",
},
{
inputs: [],
name: "NotInitializing",
type: "error",
},
{
inputs: [
{
internalType: "address",
name: "owner",
type: "address",
},
],
name: "OwnableInvalidOwner",
type: "error",
},
{
inputs: [
{
internalType: "address",
name: "account",
type: "address",
},
],
name: "OwnableUnauthorizedAccount",
type: "error",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "authority",
type: "address",
},
],
name: "CreateHatAuthorityGranted",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "authority",
type: "address",
},
],
name: "CreateHatAuthorityRevoked",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: false,
internalType: "uint64",
name: "version",
type: "uint64",
},
],
name: "Initialized",
type: "event",
},
{
anonymous: false,
inputs: [
{
indexed: true,
internalType: "address",
name: "previousOwner",
type: "address",
},
{
indexed: true,
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "OwnershipTransferred",
type: "event",
},
{
inputs: [],
name: "HATS",
outputs: [
{
internalType: "contract IHats",
name: "",
type: "address",
},
],
stateMutability: "pure",
type: "function",
},
{
inputs: [],
name: "IMPLEMENTATION",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "pure",
type: "function",
},
{
inputs: [
{
internalType: "uint256",
name: "_admin",
type: "uint256",
},
{
internalType: "string",
name: "_details",
type: "string",
},
{
internalType: "uint32",
name: "_maxSupply",
type: "uint32",
},
{
internalType: "address",
name: "_eligibility",
type: "address",
},
{
internalType: "address",
name: "_toggle",
type: "address",
},
{
internalType: "bool",
name: "_mutable",
type: "bool",
},
{
internalType: "string",
name: "_imageURI",
type: "string",
},
],
name: "createHat",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
name: "createHatAuthorities",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "authority",
type: "address",
},
],
name: "grantCreateHatAuthority",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "authority",
type: "address",
},
],
name: "hasCreateHatAuthority",
outputs: [
{
internalType: "bool",
name: "",
type: "bool",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "hatId",
outputs: [
{
internalType: "uint256",
name: "",
type: "uint256",
},
],
stateMutability: "pure",
type: "function",
},
{
inputs: [],
name: "owner",
outputs: [
{
internalType: "address",
name: "",
type: "address",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "renounceOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "authority",
type: "address",
},
],
name: "revokeCreateHatAuthority",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "bytes",
name: "_initData",
type: "bytes",
},
],
name: "setUp",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [
{
internalType: "address",
name: "newOwner",
type: "address",
},
],
name: "transferOwnership",
outputs: [],
stateMutability: "nonpayable",
type: "function",
},
{
inputs: [],
name: "version",
outputs: [
{
internalType: "string",
name: "",
type: "string",
},
],
stateMutability: "view",
type: "function",
},
{
inputs: [],
name: "version_",
outputs: [
{
internalType: "string",
name: "",
type: "string",
},
],
stateMutability: "view",
type: "function",
},
] as const;
2 changes: 1 addition & 1 deletion pkgs/frontend/app/routes/$treeId_.$hatId.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ const RoleDetails: FC = () => {
// 各wearerのWearingElapsedTimeを取得
const { data } = useGetWorkspace(treeId);
const hatsTimeFrameModuleAddress = useMemo(
() => data?.workspace?.hatsTimeFrameModule,
() => data?.workspace?.hatsTimeFrameModule?.id,
[data],
);
const timeList = useWearingElapsedTime(
Expand Down
Loading

0 comments on commit fa2789c

Please sign in to comment.