-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added factory contract, clones list dropdown button
- Loading branch information
1 parent
7584b11
commit 159499d
Showing
5 changed files
with
293 additions
and
2 deletions.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
//SPDX-License-Identifier: MIT | ||
pragma solidity >=0.8.0 <0.9.0; | ||
|
||
import "@openzeppelin/contracts/proxy/Clones.sol"; | ||
|
||
contract Factory { | ||
|
||
address public immutable implementation; | ||
address[] public cloneList; | ||
|
||
constructor (address _implementation) public { | ||
implementation = _implementation; | ||
} | ||
|
||
function cloneContract () public returns(address) { | ||
address cloneAddress = Clones.clone(implementation); | ||
cloneList.push(cloneAddress); | ||
return cloneAddress; | ||
} | ||
|
||
function readCloneList() public view returns (address[] memory) { | ||
address[] memory result = new address[](cloneList.length); | ||
for (uint256 i = 0; i < cloneList.length; i++){ | ||
result[i] = cloneList[i]; | ||
} | ||
return result; | ||
} | ||
|
||
} |
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
26 changes: 26 additions & 0 deletions
26
packages/nextjs/components/scaffold-eth/Contract/ClonesDropdown.tsx
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,26 @@ | ||
import { ChevronDownIcon } from "@heroicons/react/24/outline"; | ||
|
||
//import { useOutsideClick } from "~~/hooks/scaffold-eth"; | ||
|
||
export const ClonesDropdown = () => { | ||
//const [addressCopied, setAddressCopied] = useState(false); | ||
|
||
//const [selectingNetwork, setSelectingNetwork] = useState(false); | ||
|
||
return ( | ||
<> | ||
<details className="dropdown dropdown-end leading-3"> | ||
<summary tabIndex={0} className="btn btn-secondary btn-sm font-thin shadow-md dropdown-toggle gap-0 !h-auto"> | ||
Clones List | ||
<ChevronDownIcon className="h-6 w-4 ml-2 sm:ml-0" /> | ||
</summary> | ||
<ul | ||
tabIndex={0} | ||
className="dropdown-content menu z-[100] p-2 mt-2 shadow-center shadow-accent bg-base-200 rounded-box gap-1" | ||
> | ||
<li>Clones addresses go here</li> | ||
</ul> | ||
</details> | ||
</> | ||
); | ||
}; |
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