-
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.
Merge pull request #129 from hackdays-io/issue/102
add bigbang
- Loading branch information
Showing
6 changed files
with
309 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,228 @@ | ||
export const BIGBANG_ABI = [ | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "_trustedForwarder", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_hatsAddress", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_hatsModuleFactory", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_hatsTimeFrameModule_IMPL", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_splitsCreatorFactory", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_splitFactoryV2", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_fractionToken", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "nonpayable", | ||
type: "constructor", | ||
}, | ||
{ | ||
anonymous: false, | ||
inputs: [ | ||
{ | ||
indexed: true, | ||
internalType: "address", | ||
name: "owner", | ||
type: "address", | ||
}, | ||
{ | ||
indexed: true, | ||
internalType: "uint256", | ||
name: "topHatId", | ||
type: "uint256", | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: "address", | ||
name: "hatsTimeFrameModule", | ||
type: "address", | ||
}, | ||
{ | ||
indexed: false, | ||
internalType: "address", | ||
name: "splitCreator", | ||
type: "address", | ||
}, | ||
], | ||
name: "Executed", | ||
type: "event", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "Hats", | ||
outputs: [ | ||
{ | ||
internalType: "contract IHats", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "HatsModuleFactory", | ||
outputs: [ | ||
{ | ||
internalType: "contract IHatsModuleFactory", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "HatsTimeFrameModule_IMPL", | ||
outputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "SplitsCreatorFactory", | ||
outputs: [ | ||
{ | ||
internalType: "contract ISplitsCreatorFactory", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "_owner", | ||
type: "address", | ||
}, | ||
{ | ||
internalType: "string", | ||
name: "_topHatDetails", | ||
type: "string", | ||
}, | ||
{ | ||
internalType: "string", | ||
name: "_topHatImageURI", | ||
type: "string", | ||
}, | ||
{ | ||
internalType: "string", | ||
name: "_hatterHatDetails", | ||
type: "string", | ||
}, | ||
{ | ||
internalType: "string", | ||
name: "_hatterHatImageURI", | ||
type: "string", | ||
}, | ||
{ | ||
internalType: "address", | ||
name: "_trustedForwarder", | ||
type: "address", | ||
}, | ||
], | ||
name: "bigbang", | ||
outputs: [ | ||
{ | ||
internalType: "uint256", | ||
name: "", | ||
type: "uint256", | ||
}, | ||
], | ||
stateMutability: "nonpayable", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "fractionToken", | ||
outputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [ | ||
{ | ||
internalType: "address", | ||
name: "forwarder", | ||
type: "address", | ||
}, | ||
], | ||
name: "isTrustedForwarder", | ||
outputs: [ | ||
{ | ||
internalType: "bool", | ||
name: "", | ||
type: "bool", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "splitFactoryV2", | ||
outputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
{ | ||
inputs: [], | ||
name: "trustedForwarder", | ||
outputs: [ | ||
{ | ||
internalType: "address", | ||
name: "", | ||
type: "address", | ||
}, | ||
], | ||
stateMutability: "view", | ||
type: "function", | ||
}, | ||
] as const; |
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,35 @@ | ||
import { Command } from "commander"; | ||
import { bigbang } from "../modules/bigbang"; | ||
import { zeroAddress } from "viem"; | ||
|
||
export const bigbangCommands = new Command(); | ||
|
||
bigbangCommands | ||
.name("bigbang") | ||
.description("This is a CLI bigbang for toban project") | ||
.version("1.0.0"); | ||
|
||
bigbangCommands | ||
.command("create") | ||
.description("Create project") | ||
.requiredOption("-o, --owner <owner>", "Owner") | ||
.requiredOption("-td, --topHatDetails <topHatDetails>", "Top hat details") | ||
.requiredOption("-ti, --topHatImageURI <topHatImageURI>", "Top hat image URI") | ||
.option("-hd, --hatterHatDetails <hatterHatDetails>", "Hatter hat details") | ||
.option( | ||
"-hi, --hatterHatImageURI <hatterHatImageURI>", | ||
"Hatter hat image URI" | ||
) | ||
.option("-f, --trustedForwarder <trustedForwarder>", "Trusted forwarder") | ||
.action(async (options) => { | ||
const hash = await bigbang({ | ||
owner: options.owner, | ||
topHatDetails: options.topHatDetails, | ||
topHatImageURI: options.topHatImageURI, | ||
hatterHatDetails: options.hatterHatDetails || "", | ||
hatterHatImageURI: options.hatterHatImageURI || "", | ||
trustedForwarder: options.trustedForwarder || zeroAddress, | ||
}); | ||
|
||
console.log(`Transaction hash: ${hash}`); | ||
}); |
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 @@ | ||
// ############################################################### | ||
// Write with viem | ||
// ############################################################### | ||
|
||
import { Address } from "viem"; | ||
import { publicClient, walletClient } from ".."; | ||
import { bigbangContractBaseConfig } from "../config"; | ||
|
||
/** | ||
* プロジェクト作成 | ||
*/ | ||
|
||
export const bigbang = async (params: { | ||
owner: Address; | ||
topHatDetails: string; | ||
topHatImageURI: string; | ||
hatterHatDetails: string; | ||
hatterHatImageURI: string; | ||
trustedForwarder: Address; | ||
}) => { | ||
const { request } = await publicClient.simulateContract({ | ||
...bigbangContractBaseConfig, | ||
account: walletClient.account, | ||
functionName: "bigbang", | ||
args: [ | ||
params.owner, | ||
params.topHatDetails, | ||
params.topHatImageURI, | ||
params.hatterHatDetails, | ||
params.hatterHatImageURI, | ||
params.trustedForwarder, | ||
], | ||
}); | ||
const transactionHash = await walletClient.writeContract(request); | ||
|
||
return transactionHash; | ||
}; |