GG修改器破解版下载地址:https://ghb2023zs.bj.bcebos.com/d/z/p/d/dbzs.apk?GGXGQ
大家好,今天小编为大家分享关于gg无root修改器_gg无root修改器怎么用教学的内容,赶快来一起来看看吧。
DAO代表去中心化的自治组织。您可以将 DAO 视为类似于现实世界中的公司。从本质上讲,DAO 允许成员创建治理决策并对其进行投票。
在传统公司中,当需要做出决定时,公司的董事会或高管负责做出该决定。然而,在 DAO 中,这个过程是民主化的,任何成员都可以创建提案,所有其他成员都可以对其进行投票。创建的每个提案都有一个投票截止日期,在截止日期之后做出有利于投票结果的决定(是或否)。
DAO 的成员资格通常受到 ERC20 Token 所有权或 N.F.T 所有权的限制。成员资格和投票权与您拥有的Token数量成正比的 DAO 示例包括Uniswap和ENS。基于 N.F.T 的 DAO 示例包括Meebits DAO。
假如你想为你的CryptoDevsN.F.T 持有者启动一个 DAO。从通过 ICO 获得的 ETH 中,你建立了一个 DAO 库。DAO 现在有很多 ETH,但目前什么也没做。
您希望允许您的 N.F.T 持有者创建并投票使用该 ETH 从 N.F.T 市场购买其他 N.F.T 的提案,并推测价格。也许将来当你卖回 N.F.T 时,你会将利润分配给 DAO 的所有成员。
我们将从创建智能合约开始。我们将制作两个智能合约:
为此,我们将使用我们在过去几个教程中一直使用的Hardhat开发框架。
mkdir hardhat-tutorial
cd hardhat-tutorial
npm init --yes
npm install --save-dev hardhat
现在您已经安装了 Hardhat,我们可以设置一个项目。在终端中执行以下命令。
npx hardhat
现在你有一个安全帽项目准备好了!
如果您在 Windows 上,请执行此额外步骤并安装这些库:)
npm install --save-dev @nomicfoundation/hardhat-toolbox
并按下Enter所有问题(选择Create a basic sample project)选项。
npm install @openzeppelin/contracts
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
contract FakeN.F.TMarketplace {
/// @dev Maintain a mapping of Fake TokenID to Owner addresses
mapping(uint256 => address) public tokens;
/// @dev Set the purchase price for each Fake N.F.T
uint256 N.F.TPrice = 0.1 ether;
/// @dev purchase() accepts ETH and marks the owner of the given tokenId as the caller address
/// @param _tokenId - the fake N.F.T token Id to purchase
function purchase(uint256 _tokenId) external payable {
require(msg.value == N.F.TPrice, "This N.F.T costs 0.1 ether");
tokens[_tokenId] = msg.sender;
}
/// @dev getPrice() returns the price of one N.F.T
function getPrice() external view returns (uint256) {
return N.F.TPrice;
}
/// @dev available() checks whether the given tokenId has already been sold or not
/// @param _tokenId - the tokenId to check for
function available(uint256 _tokenId) external view returns (bool) {
// address(0) = 0x0000000000000000000000000000000000000000
// This is the default value for addresses in Solidity
if (tokens[_tokenId] == address(0)) {
return true;
}
return false;
}
}
npx pile
并确保没有编译错误。
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.0;
import "@openzeppelin/contracts/access/Ownable.sol";
// We will add the Interfaces here
contract CryptoDevsDAO is Ownable {
// We will write contract code here
}
/**
* Interface for the FakeN.F.TMarketplace
*/
interface IFakeN.F.TMarketplace {
/// @dev getPrice() returns the price of an N.F.T from the FakeN.F.TMarketplace
/// @return Returns the price in Wei for an N.F.T
function getPrice() external view returns (uint256);
/// @dev available() returns whether or not the given _tokenId has already been purchased
/// @return Returns a boolean value - true if available, false if not
function available(uint256 _tokenId) external view returns (bool);
/// @dev purchase() purchases an N.F.T from the FakeN.F.TMarketplace
/// @param _tokenId - the fake N.F.T tokenID to purchase
function purchase(uint256 _tokenId) external payable;
}
/**
* Minimal interface for CryptoDevsN.F.T containing only two functions
* that we are interested in
*/
interface ICryptoDevsN.F.T {
/// @dev balanceOf returns the number of N.F.Ts owned by the given address
/// @param owner - address to fetch number of N.F.Ts for
/// @return Returns the number of N.F.Ts owned
function balanceOf(address owner) external view returns (uint256);
/// @dev tokenOfOwnerByIndex returns a tokenID at given index for owner
/// @param owner - address to fetch the N.F.T TokenID for
/// @param index - index of N.F.T in owned tokens array to fetch
/// @return Returns the TokenID of the N.F.T
function tokenOfOwnerByIndex(address owner, uint256 index)
external
view
returns (uint256);
}
// Create a struct named Proposal containing all relevant information
struct Proposal {
// N.F.TTokenId - the tokenID of the N.F.T to purchase from FakeN.F.TMarketplace if the proposal passes
uint256 N.F.TTokenId;
// deadline - the UNIX timestamp until which this proposal is active. Proposal can be executed after the deadline has been exceeded.
uint256 deadline;
// yayVotes - number of yay votes for this proposal
uint256 yayVotes;
// nayVotes - number of nay votes for this proposal
uint256 nayVotes;
// executed - whether or not this proposal has been executed yet. Cannot be executed before the deadline has been exceeded.
bool executed;
// voters - a mapping of CryptoDevsN.F.T tokenIDs to booleans indicating whether that N.F.T has already been used to cast a vote or not
mapping(uint256 => bool) voters;
}
// Create a mapping of ID to Proposal
mapping(uint256 => Proposal) public proposals;
// Number of proposals that have been created
uint256 public numProposals;
IFakeN.F.TMarketplace N.F.TMarketplace;
ICryptoDevsN.F.T cryptoDevsN.F.T;
// Create a payable constructor which initializes the contract
// instances for FakeN.F.TMarketplace and CryptoDevsN.F.T
// The payable allows this constructor to accept an ETH deposit when it is being deployed
constructor(address _N.F.TMarketplace, address _cryptoDevsN.F.T) payable {
N.F.TMarketplace = IFakeN.F.TMarketplace(_N.F.TMarketplace);
cryptoDevsN.F.T = ICryptoDevsN.F.T(_cryptoDevsN.F.T);
}
// Create a modifier which only allows a function to be
// called by someone who owns at least 1 CryptoDevsN.F.T
modifier N.F.THolderOnly() {
require(cryptoDevsN.F.T.balanceOf(msg.sender) > 0, "NOT_A_DAO_MEMBER");
_;
}
/// @dev createProposal allows a CryptoDevsN.F.T holder to create a new proposal in the DAO
/// @param _N.F.TTokenId - the tokenID of the N.F.T to be purchased from FakeN.F.TMarketplace if this proposal passes
/// @return Returns the proposal index for the newly created proposal
function createProposal(uint256 _N.F.TTokenId)
external
N.F.THolderOnly
returns (uint256)
{
require(N.F.TMarketplace.available(_N.F.TTokenId), "N.F.T_NOT_FOR_SALE");
Proposal storage proposal = proposals[numProposals];
proposal.N.F.TTokenId = _N.F.TTokenId;
// Set the proposal’s voting deadline to be (current time + 5 minutes)
proposal.deadline = block.timestamp + 5 minutes;
numProposals++;
return numProposals - 1;
}
// Create a modifier which only allows a function to be
// called if the given proposal’s deadline has not been exceeded yet
modifier activeProposalOnly(uint256 proposalIndex) {
require(
proposals[proposalIndex].deadline > block.timestamp,
"DEADLINE_EXCEEDED"
);
_;
}
注意这个修改器是如何接受一个参数的!
// Create an enum named Vote containing possible options for a vote
enum Vote {
YAY, // YAY = 0
NAY // NAY = 1
}
/// @dev voteOnProposal allows a CryptoDevsN.F.T holder to cast their vote on an active proposal
/// @param proposalIndex - the index of the proposal to vote on in the proposals array
/// @param vote - the type of vote they want to cast
function voteOnProposal(uint256 proposalIndex, Vote vote)
external
N.F.THolderOnly
activeProposalOnly(proposalIndex)
{
Proposal storage proposal = proposals[proposalIndex];
uint256 voterN.F.TBalance = cryptoDevsN.F.T.balanceOf(msg.sender);
uint256 numVotes = 0;
// Calculate how many N.F.Ts are owned by the voter
// that haven’t already been used for voting on this proposal
for (uint256 i = 0; i < voterN.F.TBalance; i++) {
uint256 tokenId = cryptoDevsN.F.T.tokenOfOwnerByIndex(msg.sender, i);
if (proposal.voters[tokenId] == false) {
numVotes++;
proposal.voters[tokenId] = true;
}
}
require(numVotes > 0, "ALREADY_VOTED");
if (vote == Vote.YAY) {
proposal.yayVotes += numVotes;
} else {
proposal.nayVotes += numVotes;
}
}
// Create a modifier which only allows a function to be
// called if the given proposals’ deadline HAS been exceeded
// and if the proposal has not yet been executed
modifier inactiveProposalOnly(uint256 proposalIndex) {
require(
proposals[proposalIndex].deadline <= block.timestamp,
"DEADLINE_NOT_EXCEEDED"
);
require(
proposals[proposalIndex].executed == false,
"PROPOSAL_ALREADY_EXECUTED"
);
_;
}
注意这个修改器也需要一个参数!
/// @dev executeProposal allows any CryptoDevsN.F.T holder to execute a proposal after it’s deadline has been exceeded
/// @param proposalIndex - the index of the proposal to execute in the proposals array
function executeProposal(uint256 proposalIndex)
external
N.F.THolderOnly
inactiveProposalOnly(proposalIndex)
{
Proposal storage proposal = proposals[proposalIndex];
// If the proposal has more YAY votes than NAY votes
// purchase the N.F.T from the FakeN.F.TMarketplace
if (proposal.yayVotes > proposal.nayVotes) {
uint256 N.F.TPrice = N.F.TMarketplace.getPrice();
require(address(this).balance >= N.F.TPrice, "NOT_ENOUGH_FUNDS");
N.F.TMarketplace.purchase{value: N.F.TPrice}(proposal.N.F.TTokenId);
}
proposal.executed = true;
}
/// @dev withdrawEther allows the contract owner (deployer) to withdraw the ETH from the contract
function withdrawEther() external onlyOwner {
payable(owner()).transfer(address(this).balance);
}
这将把合约的全部ETH余额转移到业主地址
// The following two functions allow the contract to accept ETH deposits
// directly from a wallet without calling a function
receive() external payable {}
fallback() external payable {}
现在我们已经写好了合约,让我们把它们部署到Rinkeby Testnet[2]上。确保你在Rinkeby Testnet上有一些ETH。
npm install dotenv
// Go to https://www.alchemyapi.io, sign up, create
// a new App in its dashboard and select the network as Rinkeby, and replace "add-the-alchemy-key-url-here" with its key url
ALCHEMY_API_KEY_URL="add-the-alchemy-key-url-here"
// Replace this private key with your RINKEBY account private key
// To export your private key from Metamask, open Metamask and
// go to Account Details > Export Private Key
// Be aware of NEVER putting real Ether into testing accounts
RINKEBY_PRIVATE_KEY="add-the-rinkeby-private-key-here"
const { ethers } = require("hardhat");
const { CRYPTODEVS_N.F.T_CONTRACT_ADDRESS } = require("../constants");
async function main() {
// Deploy the FakeN.F.TMarketplace contract first
const FakeN.F.TMarketplace = await ethers.getContractFactory(
"FakeN.F.TMarketplace"
);
const fakeN.F.TMarketplace = await FakeN.F.TMarketplace.deploy();
await fakeN.F.TMarketplace.deployed();
console.log("FakeN.F.TMarketplace deployed to: ", fakeN.F.TMarketplace.address);
// Now deploy the CryptoDevsDAO contract
const CryptoDevsDAO = await ethers.getContractFactory("CryptoDevsDAO");
const cryptoDevsDAO = await CryptoDevsDAO.deploy(
fakeN.F.TMarketplace.address,
CRYPTODEVS_N.F.T_CONTRACT_ADDRESS,
{
// This assumes your account has at least 1 ETH in it’s account
// Change this value as you want
value: ethers.utils.parseEther("1"),
}
);
await cryptoDevsDAO.deployed();
console.log("CryptoDevsDAO deployed to: ", cryptoDevsDAO.address);
}
main()
.then(() => process.exit(0))
.catch((error) => {
console.error(error);
process.exit(1);
});
// Replace the value with your N.F.T contract address
const CRYPTODEVS_N.F.T_CONTRACT_ADDRESS =
"YOUR_CRYPTODEVS_N.F.T_CONTRACT_ADDRESS_HERE";
module.exports = { CRYPTODEVS_N.F.T_CONTRACT_ADDRESS };
require("@nomicfoundation/hardhat-toolbox");
require("dotenv").config({ path: ".env" });
const ALCHEMY_API_KEY_URL = process.env.ALCHEMY_API_KEY_URL;
const RINKEBY_PRIVATE_KEY = process.env.RINKEBY_PRIVATE_KEY;
module.exports = {
solidity: "0.8.9",
networks: {
rinkeby: {
url: ALCHEMY_API_KEY_URL,
accounts: [RINKEBY_PRIVATE_KEY],
},
},
};
npx pile
并确保没有编译错误。如果你确实遇到了编译错误,试着将你的代码与这里的最终版本[3]进行比较
npx hardhat run scripts/deploy.js --network rinkeby
哇!已经开发了这么多!
我们已经成功开发并部署了我们的合约到 Rinkeby 测试网。现在,是时候构建前端界面了,这样用户就可以从网站上创建提案并对其进行投票。
为了开发网站,我们将使用目前为止的Next.js[4],这是一个建立在React之上的元框架。
- DAO-Tutorial
- hardhat-tutorial
- my-app
npx create-next-app@latest
并按下Enter所有问题提示。这应该创建my-app文件夹并设置一个基本的 Next.js 项目。
cd my-app
npm run dev
npm install web3modal ethers
.main {
min-height: 90vh;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
font-family: "Courier New", Courier, monospace;
}
.footer {
display: flex;
padding: 2rem 0;
border-top: 1px solid #eaeaea;
justify-content: center;
align-items: center;
}
.jpg {
width: 70%;
height: 50%;
margin-left: 20%;
}
.title {
font-size: 2rem;
margin: 2rem 0;
}
.description {
line-height: 1;
margin: 2rem 0;
font-size: 1.2rem;
}
.button {
border-radius: 4px;
background-color: blue;
border: none;
color: #ffffff;
font-size: 15px;
padding: 10px;
width: 200px;
cursor: pointer;
margin-right: 2%;
}
.button2 {
border-radius: 4px;
background-color: indigo;
border: none;
color: #ffffff;
font-size: 15px;
padding: 10px;
cursor: pointer;
margin-right: 2%;
margin-top: 1rem;
}
.proposalCard {
width: fit-content;
margin-top: 0.25rem;
border: black 2px solid;
flex: 1;
flex-direction: column;
}
.container {
margin-top: 2rem;
}
.flex {
flex: 1;
justify-content: space-between;
}
@media (max-width: 1000px) {
.main {
width: 100%;
flex-direction: column;
justify-content: center;
align-items: center;
}
}
export const CRYPTODEVS_DAO_CONTRACT_ADDRESS = "";
export const CRYPTODEVS_N.F.T_CONTRACT_ADDRESS = "";
export const CRYPTODEVS_DAO_ABI = [];
export const CRYPTODEVS_N.F.T_ABI = [];
import { Contract, providers } from "ethers";
import { formatEther } from "ethers/lib/utils";
import Head from "next/head";
import { useEffect, useRef, useState } from "react";
import Web3Modal from "web3modal";
import {
CRYPTODEVS_DAO_ABI,
CRYPTODEVS_DAO_CONTRACT_ADDRESS,
CRYPTODEVS_N.F.T_ABI,
CRYPTODEVS_N.F.T_CONTRACT_ADDRESS,
} from "../constants";
import styles from "../styles/Home.module.css";
export default function Home() {
// ETH Balance of the DAO contract
const [treasuryBalance, setTreasuryBalance] = useState("0");
// Number of proposals created in the DAO
const [numProposals, setNumProposals] = useState("0");
// Array of all proposals created in the DAO
const [proposals, setProposals] = useState([]);
// User’s balance of CryptoDevs N.F.Ts
const [N.F.TBalance, setN.F.TBalance] = useState(0);
// Fake N.F.T Token ID to purchase. Used when creating a proposal.
const [fakeN.F.TTokenId, setFakeN.F.TTokenId] = useState("");
// One of "Create Proposal" or "View Proposals"
const [selectedTab, setSelectedTab] = useState("");
// True if waiting for a transaction to be mined, false otherwise.
const [loading, setLoading] = useState(false);
// True if user has connected their wallet, false otherwise
const [walletConnected, setWalletConnected] = useState(false);
const web3ModalRef = useRef();
// Helper function to connect wallet
const connectWallet = async () => {
try {
await getProviderOrSigner();
setWalletConnected(true);
} catch (error) {
console.error(error);
}
};
// Reads the ETH balance of the DAO contract and sets the `treasuryBalance` state variable
const getDAOTreasuryBalance = async () => {
try {
const provider = await getProviderOrSigner();
const balance = await provider.getBalance(
CRYPTODEVS_DAO_CONTRACT_ADDRESS
);
setTreasuryBalance(balance.toString());
} catch (error) {
console.error(error);
}
};
// Reads the number of proposals in the DAO contract and sets the `numProposals` state variable
const getNumProposalsInDAO = async () => {
try {
const provider = await getProviderOrSigner();
const contract = getDaoContractInstance(provider);
const daoNumProposals = await contract.numProposals();
setNumProposals(daoNumProposals.toString());
} catch (error) {
console.error(error);
}
};
// Reads the balance of the user’s CryptoDevs N.F.Ts and sets the `N.F.TBalance` state variable
const getUserN.F.TBalance = async () => {
try {
const signer = await getProviderOrSigner(true);
const N.F.TContract = getCryptodevsN.F.TContractInstance(signer);
const balance = await N.F.TContract.balanceOf(signer.getAddress());
setN.F.TBalance(parseInt(balance.toString()));
} catch (error) {
console.error(error);
}
};
// Calls the `createProposal` function in the contract, using the tokenId from `fakeN.F.TTokenId`
const createProposal = async () => {
try {
const signer = await getProviderOrSigner(true);
const daoContract = getDaoContractInstance(signer);
const txn = await daoContract.createProposal(fakeN.F.TTokenId);
setLoading(true);
await txn.wait();
await getNumProposalsInDAO();
setLoading(false);
} catch (error) {
console.error(error);
window.alert(error.data.message);
}
};
// Helper function to fetch and parse one proposal from the DAO contract
// Given the Proposal ID
// and converts the returned data into a Javascript object with values we can use
const fetchProposalById = async (id) => {
try {
const provider = await getProviderOrSigner();
const daoContract = getDaoContractInstance(provider);
const proposal = await daoContract.proposals(id);
const parsedProposal = {
proposalId: id,
N.F.TTokenId: proposal.N.F.TTokenId.toString(),
deadline: new Date(parseInt(proposal.deadline.toString()) * 1000),
yayVotes: proposal.yayVotes.toString(),
nayVotes: proposal.nayVotes.toString(),
executed: proposal.executed,
};
return parsedProposal;
} catch (error) {
console.error(error);
}
};
// Runs a loop `numProposals` times to fetch all proposals in the DAO
// and sets the `proposals` state variable
const fetchAllProposals = async () => {
try {
const proposals = [];
for (let i = 0; i < numProposals; i++) {
const proposal = await fetchProposalById(i);
proposals.push(proposal);
}
setProposals(proposals);
return proposals;
} catch (error) {
console.error(error);
}
};
// Calls the `voteOnProposal` function in the contract, using the passed
// proposal ID and Vote
const voteOnProposal = async (proposalId, _vote) => {
try {
const signer = await getProviderOrSigner(true);
const daoContract = getDaoContractInstance(signer);
let vote = _vote === "YAY" ? 0 : 1;
const txn = await daoContract.voteOnProposal(proposalId, vote);
setLoading(true);
await txn.wait();
setLoading(false);
await fetchAllProposals();
} catch (error) {
console.error(error);
window.alert(error.data.message);
}
};
// Calls the `executeProposal` function in the contract, using
// the passed proposal ID
const executeProposal = async (proposalId) => {
try {
const signer = await getProviderOrSigner(true);
const daoContract = getDaoContractInstance(signer);
const txn = await daoContract.executeProposal(proposalId);
setLoading(true);
await txn.wait();
setLoading(false);
await fetchAllProposals();
} catch (error) {
console.error(error);
window.alert(error.data.message);
}
};
// Helper function to fetch a Provider/Signer instance from Metamask
const getProviderOrSigner = async (needSigner = false) => {
const provider = await web3ModalRef.current.connect();
const web3Provider = new providers.Web3Provider(provider);
const { chainId } = await web3Provider.getNetwork();
if (chainId !== 4) {
window.alert("Please switch to the Rinkeby network!");
throw new Error("Please switch to the Rinkeby network");
}
if (needSigner) {
const signer = web3Provider.getSigner();
return signer;
}
return web3Provider;
};
// Helper function to return a DAO Contract instance
// given a Provider/Signer
const getDaoContractInstance = (providerOrSigner) => {
return new Contract(
CRYPTODEVS_DAO_CONTRACT_ADDRESS,
CRYPTODEVS_DAO_ABI,
providerOrSigner
);
};
// Helper function to return a CryptoDevs N.F.T Contract instance
// given a Provider/Signer
const getCryptodevsN.F.TContractInstance = (providerOrSigner) => {
return new Contract(
CRYPTODEVS_N.F.T_CONTRACT_ADDRESS,
CRYPTODEVS_N.F.T_ABI,
providerOrSigner
);
};
// piece of code that runs everytime the value of `walletConnected` changes
// so when a wallet connects or disconnects
// Prompts user to connect wallet if not connected
// and then calls helper functions to fetch the
// DAO Treasury Balance, User N.F.T Balance, and Number of Proposals in the DAO
useEffect(() => {
if (!walletConnected) {
web3ModalRef.current = new Web3Modal({
network: "rinkeby",
providerOptions: {},
disableInjectedProvider: false,
});
connectWallet().then(() => {
getDAOTreasuryBalance();
getUserN.F.TBalance();
getNumProposalsInDAO();
});
}
}, [walletConnected]);
// Piece of code that runs everytime the value of `selectedTab` changes
// Used to re-fetch all proposals in the DAO when user switches
// to the ’View Proposals’ tab
useEffect(() => {
if (selectedTab === "View Proposals") {
fetchAllProposals();
}
}, [selectedTab]);
// Render the contents of the appropriate tab based on `selectedTab`
function renderTabs() {
if (selectedTab === "Create Proposal") {
return renderCreateProposalTab();
} else if (selectedTab === "View Proposals") {
return renderViewProposalsTab();
}
return null;
}
// Renders the ’Create Proposal’ tab content
function renderCreateProposalTab() {
if (loading) {
return (
<div className={styles.description}>
Loading... Waiting for transaction...
</div>
);
} else if (N.F.TBalance === 0) {
return (
<div className={styles.description}>
You do not own any CryptoDevs N.F.Ts. <br />
<b>You cannot create or vote on proposals</b>
</div>
);
} else {
return (
<div className={styles.container}>
<label>Fake N.F.T Token ID to Purchase: </label>
<input
placeholder="0"
type="number"
onChange={(e) => setFakeN.F.TTokenId(e.target.value)}
/>
<button className={styles.button2} onClick={createProposal}>
Create
</button>
</div>
);
}
}
// Renders the ’View Proposals’ tab content
function renderViewProposalsTab() {
if (loading) {
return (
<div className={styles.description}>
Loading... Waiting for transaction...
</div>
);
} else if (proposals.length === 0) {
return (
<div className={styles.description}>
No proposals have been created
</div>
);
} else {
return (
<div>
{proposals.map((p, index) => (
<div key={index} className={styles.proposalCard}>
<p>Proposal ID: {p.proposalId}</p>
<p>Fake N.F.T to Purchase: {p.N.F.TTokenId}</p>
<p>Deadline: {p.deadline.toLocaleString()}</p>
<p>Yay Votes: {p.yayVotes}</p>
<p>Nay Votes: {p.nayVotes}</p>
<p>Executed?: {p.executed.toString()}</p>
{p.deadline.getTime() > Date.now() && !p.executed ? (
<div className={styles.flex}>
<button
className={styles.button2}
onClick={() => voteOnProposal(p.proposalId, "YAY")}
>
Vote YAY
</button>
<button
className={styles.button2}
onClick={() => voteOnProposal(p.proposalId, "NAY")}
>
Vote NAY
</button>
</div>
) : p.deadline.getTime() < Date.now() && !p.executed ? (
<div className={styles.flex}>
<button
className={styles.button2}
onClick={() => executeProposal(p.proposalId)}
>
Execute Proposal{" "}
{p.yayVotes > p.nayVotes ? "(YAY)" : "(NAY)"}
</button>
</div>
) : (
<div className={styles.description}>Proposal Executed</div>
)}
</div>
))}
</div>
);
}
}
return (
<div>
<Head>
<title>CryptoDevs DAO</title>
<meta name="description" content="CryptoDevs DAO" />
<link rel="icon" href="/favicon.ico" />
</Head>
<div className={styles.main}>
<div>
<h1 className={styles.title}>e to Crypto Devs!</h1>
<div className={styles.description}>e to the DAO!</div>
<div className={styles.description}>
Your CryptoDevs N.F.T Balance: {N.F.TBalance}
<br />
Treasury Balance: {formatEther(treasuryBalance)} ETH
<br />
Total Number of Proposals: {numProposals}
</div>
<div className={styles.flex}>
<button
className={styles.button}
onClick={() => setSelectedTab("Create Proposal")}
>
Create Proposal
</button>
<button
className={styles.button}
onClick={() => setSelectedTab("View Proposals")}
>
View Proposals
</button>
</div>
{renderTabs()}
</div>
<div>
<img className={styles.jpg} src="/cryptodevs/0.svg" />
</div>
</div>
<footer className={styles.footer}>
Made with ❤ by Crypto Devs
</footer>
</div>
);
}
npm run dev
来看看你的网站的运行情况。它应该看起来像本教程开头的截图。
祝贺您!您的CryptoDevs DAO网站现在应该可以运行了。你的CryptoDevs DAO网站现在应该工作了。
在继续下一步之前,请确保将所有这些代码推送到 Github。
如果您无法与他人共享网站,那么它有什么用?让我们努力将您的 dApp 部署到世界各地,以便您可以与所有 LearnWeb3DAO 朋友分享它。
恭喜!你们都完成了!
原文:https://www.learnweb3.io/tracks/sophomore/decentralized-autonomous-organizations
[1] N.F.T-Collection : https:///posts/web3/sophomore-tarck-9/
[2] Rinkeby Testnet: https://rinkeby./
[3] 这里的最终版本: https:///LearnWeb3DAO/Building-a-DAO/blob/main/hardhat-tutorial/contracts/CryptoDevsDAO.sol
[4] Next.js: https://nextjs.org/
[5] 下载图片: https:///LearnWeb3DAO/Building-a-DAO/blob/main/my-app/public/cryptodevs/0.svg
[6] Vercel 仪表板: https:///
以上就是关于gg无root修改器_gg无root修改器怎么用教学的全部内容,感谢大家的浏览观看,如果你喜欢本站的文章可以CTRL+D收藏哦。
gg游戏修改器该怎么用,如何使用gg游戏修改器? 大小:4.14MB3,713人安装 如果你是一个游戏爱好者,同时也是一个游戏修改器使用者,那么你一定会知道 gg游戏……
下载gg修改器下载中文框架,便捷而强大的gg修改器下载中文框架 大小:9.74MB3,790人安装 对于喜欢玩游戏的玩家来说,可能修改器已经不是新鲜词汇了。一个强大的修改器可以让……
下载gg修改器免root框架使用_GG修改器免ROOT框架安装教程 大小:17.61MB4,864人安装 大家好,今天小编为大家分享关于gg修改器免root框架使用_GG修改器免ROOT框架安装教……
下载gg修改器免框架版下载安装,gg修改器免费下载安装 大小:7.96MB4,129人安装 一向认为我是这个世界上最可爱的女孩子,直到遇见你,我才知道是我们俩。 大家好,……
下载root使用gg修改器_怎么使用gg修改器root 大小:8.40MB4,746人安装 大家好,今天小编为大家分享关于root使用gg修改器_怎么使用gg修改器root的内容,赶……
下载gg修改器root咋开启_GG修改器如何开启root 大小:15.76MB4,678人安装 大家好,今天小编为大家分享关于gg修改器root咋开启_GG修改器如何开启root的内容,……
下载gg饥荒修改器最新版,gg饥荒修改器最新版的强大功能 大小:18.24MB3,930人安装 对于玩家来说,玩饥荒已经是非常经典的游戏之一,不过有很多玩家在玩游戏的时候往往……
下载无需root版的gg修改器,无需Root版的GG修改器,助你玩转游戏 大小:15.65MB3,471人安装 对于热爱游戏的玩家来说,游戏内的道具和金币永远都不够。而一些游戏的难度也让人束……
下载gg游戏修改器能修改哪些游戏,2k20修改器下载GG 修改器 大小:15.43MB4,258人安装 全后台挂机, 一键隐藏, 一键呼出, 不反应影响做其他事情。 纯绿色脚本, 不改内……
下载下载最新gg修改器,尝试使用最新gg修改器,让游戏更有乐趣 大小:3.33MB3,873人安装 对于游戏爱好者来说,玩游戏是一种放松和享受的过程。但在游戏中,我们常常会遇到一……
下载