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

Remove erc2771 #210

Merged
merged 2 commits into from
Dec 9, 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
398 changes: 398 additions & 0 deletions pkgs/contract/.openzeppelin/sepolia.json

Large diffs are not rendered by default.

73 changes: 0 additions & 73 deletions pkgs/contract/contracts/ERC2771ContextUpgradeable.sol

This file was deleted.

34 changes: 0 additions & 34 deletions pkgs/contract/contracts/Lock.sol

This file was deleted.

33 changes: 5 additions & 28 deletions pkgs/contract/contracts/bigbang/BigBang.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { IHats } from "../hats/src/Interfaces/IHats.sol";
import { IHatsModuleFactory } from "./IHatsModuleFactory.sol";
import { ISplitsCreatorFactory } from "../splitscreator/ISplitsCreatorFactory.sol";
import { HatsTimeFrameModule } from "../timeframe/HatsTimeFrameModule.sol";
import "./../ERC2771ContextUpgradeable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
contract BigBang is OwnableUpgradeable {
IHats public Hats;

IHatsModuleFactory public HatsModuleFactory;
Expand All @@ -22,16 +21,16 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
address public FractionToken;

event Executed(
address indexed creator,
address indexed owner,
uint256 indexed topHatId,
uint256 indexed hatterHatId,
uint256 hatterHatId,
address hatsTimeFrameModule,
address splitCreator
);

/**
* @dev Constructor to initialize the trusted forwarder.
* @param _trustedForwarder Address of the trusted forwarder contract.
* @param _hatsAddress Address of the hats protocol V1 contract.
* @param _hatsModuleFactory Address of the hats module factory contract.
* @param _hatsTimeFrameModule_IMPL Address of the hats time frame module implementation contract.
Expand All @@ -40,7 +39,6 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
* @param _fractionToken Address of the fraction token contract.
*/
function initialize(
address _trustedForwarder,
address _hatsAddress,
address _hatsModuleFactory,
address _hatsTimeFrameModule_IMPL,
Expand All @@ -49,7 +47,6 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
address _fractionToken
) public initializer {
__Ownable_init(_msgSender());
__ERC2771Context_init(address(_trustedForwarder));
Hats = IHats(_hatsAddress);
HatsModuleFactory = IHatsModuleFactory(_hatsModuleFactory);
HatsTimeFrameModule_IMPL = _hatsTimeFrameModule_IMPL;
Expand All @@ -65,16 +62,14 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
* @param _topHatImageURI The image URI of the topHat.
* @param _hatterHatDetails The details of the hatterHat.
* @param _hatterHatImageURI The image URI of the hatterHat.
* @param _trustedForwarder The address of the trusted forwarder.
* @return topHatId The ID used for navigating to the ProjectTop page after project creation.
*/
function bigbang(
address _owner,
string calldata _topHatDetails,
string calldata _topHatImageURI,
string calldata _hatterHatDetails,
string calldata _hatterHatImageURI,
address _trustedForwarder
string calldata _hatterHatImageURI
) external returns (uint256) {
// 1. TopHatのMint

Expand Down Expand Up @@ -115,7 +110,6 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
address splitCreator = SplitsCreatorFactory
.createSplitCreatorDeterministic(
topHatId,
_trustedForwarder,
address(Hats),
SplitsFactoryV2,
hatsTimeFrameModule,
Expand All @@ -124,6 +118,7 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
);

emit Executed(
msg.sender,
_owner,
topHatId,
hatterHatId,
Expand Down Expand Up @@ -163,22 +158,4 @@ contract BigBang is ERC2771ContextUpgradeable, OwnableUpgradeable {
function setFractionToken(address _fractionToken) external onlyOwner {
FractionToken = _fractionToken;
}

function _msgSender()
internal
view
override(ERC2771ContextUpgradeable, ContextUpgradeable)
returns (address sender)
{
return super._msgSender();
}

function _msgData()
internal
view
override(ERC2771ContextUpgradeable, ContextUpgradeable)
returns (bytes calldata)
{
return super._msgData();
}
}
29 changes: 2 additions & 27 deletions pkgs/contract/contracts/bigbang/mock/BigBang_Mock_v2.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,12 @@ import { IHats } from "../../hats/src/Interfaces/IHats.sol";
import { IHatsModuleFactory } from "../IHatsModuleFactory.sol";
import { ISplitsCreatorFactory } from "../../splitscreator/ISplitsCreatorFactory.sol";
import { HatsTimeFrameModule } from "../../timeframe/HatsTimeFrameModule.sol";
import "../../ERC2771ContextUpgradeable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

/**
* Upgradableになっている確認するための検証用BigBangコントラクト
*/
contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {
contract BigBang_Mock_v2 is OwnableUpgradeable {
IHats public Hats;

IHatsModuleFactory public HatsModuleFactory;
Expand All @@ -34,7 +33,6 @@ contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {

/**
* @dev Constructor to initialize the trusted forwarder.
* @param _trustedForwarder Address of the trusted forwarder contract.
* @param _hatsAddress Address of the hats protocol V1 contract.
* @param _hatsModuleFactory Address of the hats module factory contract.
* @param _hatsTimeFrameModule_IMPL Address of the hats time frame module implementation contract.
Expand All @@ -43,7 +41,6 @@ contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {
* @param _fractionToken Address of the fraction token contract.
*/
function initialize(
address _trustedForwarder,
address _hatsAddress,
address _hatsModuleFactory,
address _hatsTimeFrameModule_IMPL,
Expand All @@ -52,7 +49,6 @@ contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {
address _fractionToken
) public initializer {
__Ownable_init(_msgSender());
__ERC2771Context_init(address(_trustedForwarder));
Hats = IHats(_hatsAddress);
HatsModuleFactory = IHatsModuleFactory(_hatsModuleFactory);
HatsTimeFrameModule_IMPL = _hatsTimeFrameModule_IMPL;
Expand All @@ -68,16 +64,14 @@ contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {
* @param _topHatImageURI The image URI of the topHat.
* @param _hatterHatDetails The details of the hatterHat.
* @param _hatterHatImageURI The image URI of the hatterHat.
* @param _trustedForwarder The address of the trusted forwarder.
* @return topHatId The ID used for navigating to the ProjectTop page after project creation.
*/
function bigbang(
address _owner,
string calldata _topHatDetails,
string calldata _topHatImageURI,
string calldata _hatterHatDetails,
string calldata _hatterHatImageURI,
address _trustedForwarder
string calldata _hatterHatImageURI
) external returns (uint256) {
// 1. TopHatのMint

Expand Down Expand Up @@ -118,7 +112,6 @@ contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {
address splitCreator = SplitsCreatorFactory
.createSplitCreatorDeterministic(
topHatId,
_trustedForwarder,
address(Hats),
SplitsFactoryV2,
hatsTimeFrameModule,
Expand Down Expand Up @@ -167,24 +160,6 @@ contract BigBang_Mock_v2 is ERC2771ContextUpgradeable, OwnableUpgradeable {
FractionToken = _fractionToken;
}

function _msgSender()
internal
view
override(ERC2771ContextUpgradeable, ContextUpgradeable)
returns (address sender)
{
return super._msgSender();
}

function _msgData()
internal
view
override(ERC2771ContextUpgradeable, ContextUpgradeable)
returns (bytes calldata)
{
return super._msgData();
}

/**
* 検証用に追加した関数
*/
Expand Down
27 changes: 3 additions & 24 deletions pkgs/contract/contracts/fractiontoken/FractionToken.sol
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.24;

import { ERC1155Upgradeable, ContextUpgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import { ERC1155Upgradeable } from "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol";
import { IHats } from "../hats/src/Interfaces/IHats.sol";
import { ERC2771ContextUpgradeable } from "./../ERC2771ContextUpgradeable.sol";

contract FractionToken is ERC1155Upgradeable, ERC2771ContextUpgradeable {
contract FractionToken is ERC1155Upgradeable {
uint256 public TOKEN_SUPPLY;

mapping(uint256 => address[]) private tokenRecipients;
Expand All @@ -15,11 +14,9 @@ contract FractionToken is ERC1155Upgradeable, ERC2771ContextUpgradeable {
function initialize(
string memory _uri,
uint256 _tokenSupply,
address _hatsAddress,
address _trustedForwarderAddress
address _hatsAddress
) public initializer {
__ERC1155_init(_uri);
__ERC2771Context_init(address(_trustedForwarderAddress));
hatsContract = IHats(_hatsAddress);
TOKEN_SUPPLY = _tokenSupply;
}
Expand Down Expand Up @@ -191,22 +188,4 @@ contract FractionToken is ERC1155Upgradeable, ERC2771ContextUpgradeable {
) public view override(ERC1155Upgradeable) returns (string memory) {
return super.uri(tokenId);
}

function _msgSender()
internal
view
override(ERC2771ContextUpgradeable, ContextUpgradeable)
returns (address sender)
{
return super._msgSender();
}

function _msgData()
internal
view
override(ERC2771ContextUpgradeable, ContextUpgradeable)
returns (bytes calldata)
{
return super._msgData();
}
}
Loading
Loading