Skip to content
Open
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
7 changes: 1 addition & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,7 @@ coverage
coverage.json
yarn-error.log

!env/
env/*
!env/.example.env
!env/.hardhat.env
!env/.baobab.env
!env/.env.development
env

deployments/hardhat
deployments/localhost
Expand Down
2 changes: 1 addition & 1 deletion .husky/pre-push
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn build
# yarn build
Empty file.
42 changes: 42 additions & 0 deletions deploy_scripts/goerli/todo/001_deploy_contracts.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import { HardhatRuntimeEnvironment } from "hardhat/types";
import { DeployFunction } from "hardhat-deploy/types";
import { View } from "../../../typechain";
import { wallet } from "../../../scripts/provider";
import { ethers } from "hardhat";

const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
const { deployments, getNamedAccounts } = hre;
const { deploy } = deployments;
const { deployer } = await getNamedAccounts();

// 배포 및 세팅 순서: View 컨트랙트 -> Voting 관련 컨트랙트 -> View에 각 컨트랙트 주소 저장

const View = await deploy("View", {
contract: "View",
from: deployer,
args: [],
log: true,
autoMine: true,
});

console.log("View 컨트랙트 배포 완료 🚀");

const VoteFactory = await deploy("VoteFactory", {
contract: "VoteFactory",
from: deployer,
args: [View.address],
log: true,
autoMine: true,
});

console.log("VoteFactory 컨트랙트 배포 완료 🚀");

const view = (await ethers.getContractAt(View.abi, View.address)).connect(wallet) as View;
await (await view.setVoteFactoryAddress(VoteFactory.address)).wait();

console.log("View setVoteFactory 완료 🚀");
};

export default func;

func.tags = ["deploy_contract"];
245 changes: 245 additions & 0 deletions deployments/goerli.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,245 @@
{
"name": "goerli",
"chainId": "5",
"contracts": {
"View": {
"address": "0x30e12a2f8C933ba13482BaB0B795524c48E3Aef8",
"abi": [
{
"anonymous": false,
"inputs": [
{
"indexed": true,
"internalType": "address",
"name": "previousOwner",
"type": "address"
},
{
"indexed": true,
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "OwnershipTransferred",
"type": "event"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "date",
"type": "uint256"
}
],
"name": "getVoteAddress",
"outputs": [
{
"internalType": "address",
"name": "voteContractAddress",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "getVoteFactoryAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [],
"name": "owner",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [],
"name": "renounceOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "voteFactoryAddress",
"type": "address"
}
],
"name": "setVoteFactoryAddress",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newOwner",
"type": "address"
}
],
"name": "transferOwnership",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
},
"VoteFactory": {
"address": "0x9516802877A213fB7D3269041D0f0c10acFaD91C",
"abi": [
{
"inputs": [
{
"internalType": "address",
"name": "viewAddr_",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "constructor"
},
{
"inputs": [],
"name": "admin",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "totalAudience",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "rewardPresenter",
"type": "uint256"
},
{
"internalType": "uint256",
"name": "rewardAudience",
"type": "uint256"
},
{
"internalType": "address[]",
"name": "memberList",
"type": "address[]"
},
{
"internalType": "address",
"name": "presenter",
"type": "address"
},
{
"internalType": "uint256",
"name": "date",
"type": "uint256"
}
],
"name": "createVote",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "",
"type": "uint256"
}
],
"name": "getVote",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "uint256",
"name": "date",
"type": "uint256"
}
],
"name": "getVoteAddress",
"outputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"stateMutability": "nonpayable",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "",
"type": "address"
}
],
"name": "isVote",
"outputs": [
{
"internalType": "bool",
"name": "",
"type": "bool"
}
],
"stateMutability": "view",
"type": "function"
},
{
"inputs": [
{
"internalType": "address",
"name": "newViewAddr",
"type": "address"
}
],
"name": "setViewAddr",
"outputs": [],
"stateMutability": "nonpayable",
"type": "function"
}
]
}
}
}
1 change: 1 addition & 0 deletions deployments/goerli/.chainId
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5
Loading