Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

deploy #120

Merged
merged 1 commit into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions .github/workflows/test-contract.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,22 +37,22 @@ jobs:
env:
PRIVATE_KEY: "0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80"

- name: Generate Gas Report
run: |
npx hardhat test --network hardhat > ./gas-report.txt
echo "\n### Gas Report" >> ./comments
echo "\`\`\`\n$(cat ./gas-report.txt)" >> ./comments
working-directory: ./pkgs/contract

- name: Upload Gas Report as Artifact
uses: actions/upload-artifact@v3
with:
name: gas-report
path: ./pkgs/contract/gas-report.txt

# GitHub PRにテスト結果とガスレポートをコメントとして投稿
- name: Post comments
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
URL: ${{ github.event.pull_request.html_url }}
run: gh pr comment -F ./comments "${URL}"
# - name: Generate Gas Report
# run: |
# npx hardhat test --network hardhat > ./gas-report.txt
# echo "\n### Gas Report" >> ./comments
# echo "\`\`\`\n$(cat ./gas-report.txt)" >> ./comments
# working-directory: ./pkgs/contract

# - name: Upload Gas Report as Artifact
# uses: actions/upload-artifact@v3
# with:
# name: gas-report
# path: ./pkgs/contract/gas-report.txt

# # GitHub PRにテスト結果とガスレポートをコメントとして投稿
# - name: Post comments
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# URL: ${{ github.event.pull_request.html_url }}
# run: gh pr comment -F ./comments "${URL}"
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,14 @@ These solutions were combined with ideas from [Hats Protocol](https://www.hatspr

### Holesky

| ContractAddress | Name | Memo |
| ------------------------------------------ | ----------------- | ---- |
| 0x3bc1A0Ad72417f2d411118085256fC53CBdDd137 | Hats | |
| 0xfE661c01891172046feE16D3a57c3Cf456729efA | HatsModuleFactory | |
| 0x80f1B766817D04870f115fEBbcCADF8DBF75E017 | PullSplitsFactory | |
| ContractAddress | Name | Memo |
| ------------------------------------------ | -------------------- | ---- |
| 0xa55410b75578c8941a76249c18c72167459253c7 | BigBang | |
| 0x143a4605b682ec096274cef9fde5b3c077498942 | FractionToken | |
| 0xea4ee24c8411a71a7ce2cd676e1f17ebe18c2a98 | SplitsCreatorFactory | |
| 0x3bc1A0Ad72417f2d411118085256fC53CBdDd137 | Hats | |
| 0xfE661c01891172046feE16D3a57c3Cf456729efA | HatsModuleFactory | |
| 0x80f1B766817D04870f115fEBbcCADF8DBF75E017 | PullSplitsFactory | |

## How to work

Expand Down
22 changes: 14 additions & 8 deletions pkgs/contract/contracts/bigbang/BigBang.sol
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ contract BigBang is ERC2771Context {

address public HatsTimeFrameModule_IMPL;

address public splitFactoryV2;

address public fractionToken;

event Executed(
address indexed owner,
uint256 indexed topHatId,
Expand All @@ -30,18 +34,24 @@ contract BigBang is ERC2771Context {
* @param _hatsModuleFactory Address of the hats module factory contract.
* @param _hatsTimeFrameModule_IMPL Address of the hats time frame module implementation contract.
* @param _splitsCreatorFactory Address of the splits creator factory contract.
* @param _splitFactoryV2 Address of the split factory V2 contract.
* @param _fractionToken Address of the fraction token contract.
*/
constructor(
address _trustedForwarder,
address _hatsAddress,
address _hatsModuleFactory,
address _hatsTimeFrameModule_IMPL,
address _splitsCreatorFactory
address _splitsCreatorFactory,
address _splitFactoryV2,
address _fractionToken
) ERC2771Context(_trustedForwarder) {
Hats = IHats(_hatsAddress);
HatsModuleFactory = IHatsModuleFactory(_hatsModuleFactory);
HatsTimeFrameModule_IMPL = _hatsTimeFrameModule_IMPL;
SplitsCreatorFactory = ISplitsCreatorFactory(_splitsCreatorFactory);
splitFactoryV2 = _splitFactoryV2;
fractionToken = _fractionToken;
}

/**
Expand All @@ -52,8 +62,6 @@ contract BigBang is ERC2771Context {
* @param _hatterHatDetails The details of the hatterHat.
* @param _hatterHatImageURI The image URI of the hatterHat.
* @param _trustedForwarder The address of the trusted forwarder.
* @param _splitFactoryV2 The address of the splitFactoryV2 contract.
* @param _fractionToken The address of the fractionToken contract.
* @return topHatId The ID used for navigating to the ProjectTop page after project creation.
*/
function bigbang(
Expand All @@ -62,9 +70,7 @@ contract BigBang is ERC2771Context {
string calldata _topHatImageURI,
string calldata _hatterHatDetails,
string calldata _hatterHatImageURI,
address _trustedForwarder,
address _splitFactoryV2,
address _fractionToken
address _trustedForwarder
) external returns (uint256) {
// 1. TopHatのMint

Expand Down Expand Up @@ -106,9 +112,9 @@ contract BigBang is ERC2771Context {
.createSplitCreatorDeterministic(
topHatId,
_trustedForwarder,
_splitFactoryV2,
splitFactoryV2,
hatsTimeFrameModule,
_fractionToken,
fractionToken,
keccak256(abi.encodePacked(topHatId))
);

Expand Down
31 changes: 31 additions & 0 deletions pkgs/contract/gas-report.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
·------------------------|----------------------------|-------------|-----------------------------·
| Solc version: 0.8.24 · Optimizer enabled: false · Runs: 200 · Block limit: 30000000 gas │
·························|····························|·············|······························
| Methods │
··············|··········|··············|·············|·············|···············|··············
| Contract · Method · Min · Max · Avg · # calls · usd (avg) │
··············|··········|··············|·············|·············|···············|··············
| Deployments · · % of limit · │
·························|··············|·············|·············|···············|··············
| BigBang · - · - · 1089851 · 3.6 % · - │
·························|··············|·············|·············|···············|··············
| FractionToken · - · - · 2573797 · 8.6 % · - │
·························|··············|·············|·············|···············|··············
| Hats · - · - · 7032431 · 23.4 % · - │
·························|··············|·············|·············|···············|··············
| HatsModule · - · - · 754132 · 2.5 % · - │
·························|··············|·············|·············|···············|··············
| HatsModuleFactory · - · - · 1101122 · 3.7 % · - │
·························|··············|·············|·············|···············|··············
| HatsTimeFrameModule · - · - · 1115811 · 3.7 % · - │
·························|··············|·············|·············|···············|··············
| PullSplitFactory · 4535815 · 4535827 · 4535824 · 15.1 % · - │
·························|··············|·············|·············|···············|··············
| PushSplitFactory · 4483101 · 4483113 · 4483110 · 14.9 % · - │
·························|··············|·············|·············|···············|··············
| SplitsCreator · - · - · 1515444 · 5.1 % · - │
·························|··············|·············|·············|···············|··············
| SplitsCreatorFactory · - · - · 526836 · 1.8 % · - │
·························|··············|·············|·············|···············|··············
| SplitsWarehouse · - · - · 3934655 · 13.1 % · - │
·------------------------|--------------|-------------|-------------|---------------|-------------·
5 changes: 5 additions & 0 deletions pkgs/contract/hardhat.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,15 @@ const config: HardhatUserConfig = {
url: `https://eth-sepolia.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
},
holesky: {
url: `https://eth-holesky.g.alchemy.com/v2/${ALCHEMY_API_KEY}`,
accounts: PRIVATE_KEY !== undefined ? [PRIVATE_KEY] : [],
},
},
etherscan: {
apiKey: {
sepolia: ETHERSCAN_API_KEY!,
holesky: ETHERSCAN_API_KEY!,
},
},
gasReporter: {
Expand Down
4 changes: 4 additions & 0 deletions pkgs/contract/helpers/deploy/BigBang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,17 @@ export const deployBigBang = async (params: {
hatsModuleFacotryAddress: Address;
hatsTimeFrameModule_impl: Address;
splitsCreatorFactoryAddress: Address;
splitsFactoryV2Address: Address;
fractionTokenAddress: Address;
}) => {
const BigBang = await viem.deployContract("BigBang", [
params.trustedForwarder,
params.hatsContractAddress,
params.hatsModuleFacotryAddress,
params.hatsTimeFrameModule_impl,
params.splitsCreatorFactoryAddress,
params.splitsFactoryV2Address,
params.fractionTokenAddress,
]);

return { BigBang };
Expand Down
46 changes: 46 additions & 0 deletions pkgs/contract/scripts/deploy/all.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
import { Address, zeroAddress } from "viem";
import { deployFractionToken } from "../../helpers/deploy/FractionToken";
import { deployHatsTimeFrameModule } from "../../helpers/deploy/Hats";
import {
deploySplitsCreator,
deploySplitsCreatorFactory,
} from "../../helpers/deploy/Splits";
import { deployBigBang } from "../../helpers/deploy/BigBang";

const deployAll = async () => {
const { HatsTimeFrameModule } = await deployHatsTimeFrameModule();

const { FractionToken } = await deployFractionToken(
"",
10000n,
process.env.HATS_ADDRESS as Address,
zeroAddress
);

const { SplitsCreator } = await deploySplitsCreator();

const { SplitsCreatorFactory } = await deploySplitsCreatorFactory(
SplitsCreator.address
);

const { BigBang } = await deployBigBang({
trustedForwarder: zeroAddress,
hatsContractAddress: process.env.HATS_ADDRESS as Address,
hatsModuleFacotryAddress: process.env
.HATS_MODULE_FACTORY_ADDRESS as Address,
hatsTimeFrameModule_impl: HatsTimeFrameModule.address,
splitsCreatorFactoryAddress: SplitsCreatorFactory.address,
splitsFactoryV2Address: process.env.PULL_SPLITS_FACTORY_ADDRESS as Address,
fractionTokenAddress: FractionToken.address,
});

console.log("BigBang deployed at", BigBang.address);
console.log("FractionToken deployed at", FractionToken.address);
console.log("SplitsCreatorFactory deployed at", SplitsCreatorFactory.address);
console.log("SplitsCreator deployed at", SplitsCreator.address);
console.log("HatsTimeFrameModule deployed at", HatsTimeFrameModule.address);

return;
};

deployAll();
4 changes: 2 additions & 2 deletions pkgs/contract/test/BigBang.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@ describe("BigBang", () => {
hatsModuleFacotryAddress: HatsModuleFactory.address,
hatsTimeFrameModule_impl: HatsTimeFrameModule_IMPL.address,
splitsCreatorFactoryAddress: SplitsCreatorFactory.address,
splitsFactoryV2Address: PullSplitsFactory.address,
fractionTokenAddress: FractionToken.address,
});

expect(_BigBang.address).to.not.be.undefined;
Expand All @@ -106,8 +108,6 @@ describe("BigBang", () => {
"hatterhatDetails",
"hatterhatURI",
address1.account?.address!,
PullSplitsFactory.address,
FractionToken.address,
],
{ account: address1.account }
);
Expand Down
31 changes: 0 additions & 31 deletions pkgs/contract/utils/signTx.ts

This file was deleted.

Loading