Skip to content

Commit

Permalink
fix conflict
Browse files Browse the repository at this point in the history
  • Loading branch information
yu23ki14 committed Dec 21, 2024
2 parents 482f1bf + 83d2108 commit da0d9ab
Show file tree
Hide file tree
Showing 58 changed files with 16,972 additions and 428 deletions.
171 changes: 171 additions & 0 deletions pkgs/contract/.openzeppelin/sepolia.json
Original file line number Diff line number Diff line change
Expand Up @@ -1082,6 +1082,177 @@
]
}
}
},
"bc99c04f0dfb4992ed165e54e943343e226f7658165be2a79475a81a43158d28": {
"address": "0xE9087c88980D08c5C20C92792b7CfbfE8606E67A",
"txHash": "0x57b6be25d318764f5d965c683b83cb7e7ecda118c8ee28e7c9d2b5ec48dc4353",
"layout": {
"solcVersion": "0.8.24",
"storage": [
{
"label": "TOKEN_SUPPLY",
"offset": 0,
"slot": "0",
"type": "t_uint256",
"contract": "FractionToken",
"src": "contracts/fractiontoken/FractionToken.sol:10"
},
{
"label": "tokenRecipients",
"offset": 0,
"slot": "1",
"type": "t_mapping(t_uint256,t_array(t_address)dyn_storage)",
"contract": "FractionToken",
"src": "contracts/fractiontoken/FractionToken.sol:12"
},
{
"label": "hatsContract",
"offset": 0,
"slot": "2",
"type": "t_contract(IHats)7761",
"contract": "FractionToken",
"src": "contracts/fractiontoken/FractionToken.sol:14"
}
],
"types": {
"t_address": {
"label": "address",
"numberOfBytes": "20"
},
"t_bool": {
"label": "bool",
"numberOfBytes": "1"
},
"t_mapping(t_address,t_bool)": {
"label": "mapping(address => bool)",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_mapping(t_address,t_bool))": {
"label": "mapping(address => mapping(address => bool))",
"numberOfBytes": "32"
},
"t_mapping(t_address,t_uint256)": {
"label": "mapping(address => uint256)",
"numberOfBytes": "32"
},
"t_mapping(t_uint256,t_mapping(t_address,t_uint256))": {
"label": "mapping(uint256 => mapping(address => uint256))",
"numberOfBytes": "32"
},
"t_string_storage": {
"label": "string",
"numberOfBytes": "32"
},
"t_struct(ERC1155Storage)166_storage": {
"label": "struct ERC1155Upgradeable.ERC1155Storage",
"members": [
{
"label": "_balances",
"type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))",
"offset": 0,
"slot": "0"
},
{
"label": "_operatorApprovals",
"type": "t_mapping(t_address,t_mapping(t_address,t_bool))",
"offset": 0,
"slot": "1"
},
{
"label": "_uri",
"type": "t_string_storage",
"offset": 0,
"slot": "2"
}
],
"numberOfBytes": "96"
},
"t_struct(InitializableStorage)73_storage": {
"label": "struct Initializable.InitializableStorage",
"members": [
{
"label": "_initialized",
"type": "t_uint64",
"offset": 0,
"slot": "0"
},
{
"label": "_initializing",
"type": "t_bool",
"offset": 8,
"slot": "0"
}
],
"numberOfBytes": "32"
},
"t_uint256": {
"label": "uint256",
"numberOfBytes": "32"
},
"t_uint64": {
"label": "uint64",
"numberOfBytes": "8"
},
"t_array(t_address)dyn_storage": {
"label": "address[]",
"numberOfBytes": "32"
},
"t_contract(IHats)7761": {
"label": "contract IHats",
"numberOfBytes": "20"
},
"t_mapping(t_uint256,t_array(t_address)dyn_storage)": {
"label": "mapping(uint256 => address[])",
"numberOfBytes": "32"
}
},
"namespaces": {
"erc7201:openzeppelin.storage.ERC1155": [
{
"contract": "ERC1155Upgradeable",
"label": "_balances",
"type": "t_mapping(t_uint256,t_mapping(t_address,t_uint256))",
"src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:27",
"offset": 0,
"slot": "0"
},
{
"contract": "ERC1155Upgradeable",
"label": "_operatorApprovals",
"type": "t_mapping(t_address,t_mapping(t_address,t_bool))",
"src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:29",
"offset": 0,
"slot": "1"
},
{
"contract": "ERC1155Upgradeable",
"label": "_uri",
"type": "t_string_storage",
"src": "@openzeppelin/contracts-upgradeable/token/ERC1155/ERC1155Upgradeable.sol:32",
"offset": 0,
"slot": "2"
}
],
"erc7201:openzeppelin.storage.Initializable": [
{
"contract": "Initializable",
"label": "_initialized",
"type": "t_uint64",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:69",
"offset": 0,
"slot": "0"
},
{
"contract": "Initializable",
"label": "_initializing",
"type": "t_bool",
"src": "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol:73",
"offset": 8,
"slot": "0"
}
]
}
}
}
}
}
19 changes: 14 additions & 5 deletions pkgs/contract/contracts/fractiontoken/FractionToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ pragma solidity ^0.8.24;

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

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

mapping(uint256 => address[]) private tokenRecipients;
Expand All @@ -21,7 +23,11 @@ contract FractionToken is ERC1155Upgradeable {
TOKEN_SUPPLY = _tokenSupply;
}

function mintInitialSupply(uint256 hatId, address account) public {
function mintInitialSupply(
uint256 hatId,
address account,
uint256 amount
) public {
require(
_hasHatRole(account, hatId),
"This account does not have the role"
Expand All @@ -39,9 +45,12 @@ contract FractionToken is ERC1155Upgradeable {
"This account has already received"
);

_mint(account, tokenId, TOKEN_SUPPLY, "");
uint256 initialAmount = amount > 0 ? amount : TOKEN_SUPPLY;
_mint(account, tokenId, initialAmount, "");

tokenRecipients[tokenId].push(account);

emit InitialMint(account, hatId, tokenId);
}

function mint(uint256 hatId, address account, uint256 amount) public {
Expand Down Expand Up @@ -82,7 +91,7 @@ contract FractionToken is ERC1155Upgradeable {
uint256 tokenId,
uint256 amount,
bytes memory data
) public override {
) public override(ERC1155Upgradeable, IERC1155) {
super.safeTransferFrom(from, to, tokenId, amount, data);

if (!_containsRecipient(tokenId, to)) {
Expand All @@ -96,7 +105,7 @@ contract FractionToken is ERC1155Upgradeable {
uint256[] memory tokenIds,
uint256[] memory amounts,
bytes memory data
) public override {
) public override(ERC1155Upgradeable, IERC1155) {
super.safeBatchTransferFrom(from, to, tokenIds, amounts, data);

for (uint256 i = 0; i < tokenIds.length; i++) {
Expand Down
70 changes: 38 additions & 32 deletions pkgs/contract/contracts/fractiontoken/IFractionToken.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,39 +5,45 @@ pragma solidity ^0.8.24;
import "@openzeppelin/contracts/token/ERC1155/IERC1155.sol";

interface IFractionToken is IERC1155 {
function mintInitialSupply(
string memory hatId,
address account,
uint256 amount
) external;

function burn(
address from,
event InitialMint(
address indexed wearer,
uint256 indexed hatId,
uint256 indexed tokenId
);

function mintInitialSupply(
uint256 hatId,
address account,
uint256 amount
) external;

function mint(uint256 hatId, address account, uint256 amount) external;

function burn(
address from,
address wearer,
uint256 hatId,
uint256 value
) external;

function getTokenRecipients(
uint256 tokenId
) external view returns (address[] memory);

function getAllTokenIds() external view returns (uint256[] memory);

function getTokenId(
uint256 hatId,
address account
) external view returns (uint256);

function balanceOf(
address account,
address warer,
uint256 hatId
) external view returns (uint256);

function balanceOfBatch(
address[] memory accounts,
address[] memory warers,
uint256[] memory hatIds
) external view returns (uint256[] memory);
) external;

function getTokenRecipients(
uint256 tokenId
) external view returns (address[] memory);

function getTokenId(
uint256 hatId,
address account
) external view returns (uint256);

function balanceOf(
address account,
address warer,
uint256 hatId
) external view returns (uint256);

function balanceOfBatch(
address[] memory accounts,
address[] memory warers,
uint256[] memory hatIds
) external view returns (uint256[] memory);
}
23 changes: 21 additions & 2 deletions pkgs/contract/contracts/splitscreator/SplitsCreatorFactory.sol
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ pragma solidity ^0.8.24;
import { LibClone } from "solady/src/utils/LibClone.sol";
import { SplitsCreator } from "./SplitsCreator.sol";
import { ISplitsCreator } from "./ISplitsCreator.sol";
import { Initializable } from "@openzeppelin/contracts-upgradeable/proxy/utils/Initializable.sol";
import { OwnableUpgradeable } from "@openzeppelin/contracts-upgradeable/access/OwnableUpgradeable.sol";

contract SplitsCreatorFactory is Initializable {
contract SplitsCreatorFactory is OwnableUpgradeable {
event SplitCreatorCreated(
address indexed creator,
address indexed splitCreator,
Expand All @@ -18,10 +18,13 @@ contract SplitsCreatorFactory is Initializable {
);

address public SPLITS_CREATOR_IMPLEMENTATION;

address public BIG_BANG;

function initialize(
address _splitsCreatorImplementation
) public initializer {
__Ownable_init(_msgSender());
SPLITS_CREATOR_IMPLEMENTATION = _splitsCreatorImplementation;
}

Expand All @@ -33,6 +36,10 @@ contract SplitsCreatorFactory is Initializable {
address _fractionToken,
bytes32 _salt
) external returns (address splitCreator) {
if (_msgSender() != BIG_BANG) {
revert("SplitsCreatorFactory: Only BigBang can call this function");
}

splitCreator = LibClone.cloneDeterministic(
SPLITS_CREATOR_IMPLEMENTATION,
abi.encode(
Expand Down Expand Up @@ -90,6 +97,18 @@ contract SplitsCreatorFactory is Initializable {
);
}

function setImplementation(
address _implementation
) external onlyOwner {
SPLITS_CREATOR_IMPLEMENTATION = _implementation;
}

function setBigBang(
address _bigBang
) external onlyOwner {
BIG_BANG = _bigBang;
}

function _getSalt(
uint256 _topHatId,
address _hats,
Expand Down
Loading

0 comments on commit da0d9ab

Please sign in to comment.