Skip to content

Commit

Permalink
Merge pull request #4 from nation3/build/sepolia
Browse files Browse the repository at this point in the history
[WIP] Support sepolia testnet
  • Loading branch information
TTNguyenDev authored Jan 25, 2024
2 parents c395433 + ba38702 commit e89a83a
Show file tree
Hide file tree
Showing 3 changed files with 87 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .env.sepolia.sample
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
RPC_URL="https://rpc.sepolia.org"
ETHERSCAN_API_KEY=TZHJV2MCZ19jsdHFWG7DY9PS26EWGQ6G27F
DEPLOYER_PRIVATE_KEY=""

NATION_SUPPLY="42069000000000000000000"

10 changes: 10 additions & 0 deletions deployments/sepolia.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"nationToken": "0x23Ca3002706b71a440860E3cf8ff64679A00C9d7",
"veNationToken": "0x8100e77899C24b0F7B516153F84868f850C034BF",
"balancerLPToken": "0x6417755C00d5c17DeC196Df00a6F151E448B1471",
"lpRewardsContract": "0x534AB4F195Ac166B78d9edCdbeA04802392711aA",
"nationPassportNFT": "0x11f30642277A70Dab74C6fAF4170a8b340BE2f98",
"nationPassportNFTIssuer": "0xdad32e13E73ce4155a181cA0D350Fee0f2596940",
"nationPassportAgreementStatement": "By claiming a Nation3 passport I agree to the terms defined in the following URL",
"nationPassportAgreementURI": "https://bafkreiadlf3apu3u7blxw7t2yxi7oyumeuzhoasq7gqmcbaaycq342xq74.ipfs.dweb.link"
}
71 changes: 71 additions & 0 deletions scripts/dev-deploy.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ import { wallet, dec, save } from "./helpers";
import { ethers, BigNumber, Contract } from "ethers";
import { formatUnits } from "@ethersproject/units"

import { exec } from "child_process";

import Nation from '../out/NATION.sol/NATION.json';
import VotingEscrow from '../out/VotingEscrow.vy/VotingEscrow.json';
import LiquidityDistributor from '../out/BoostedLiquidityDistributor.sol/BoostedLiquidityDistributor.json';
Expand All @@ -22,6 +24,7 @@ const deployContract = async ({ name, deployer, factory, args }: { name: string,
return contract;
}


const deployNation = async () => {
const supply: BigNumber = BigNumber.from(process.env.NATION_SUPPLY ?? dec(42069, 18));
const Factory = getContractFactory(Nation);
Expand All @@ -38,6 +41,17 @@ const deployNation = async () => {

return nationToken;
}
const verifyNationContract = async (address: string, path: string, constructorArgs: Array<any>) => {
exec(
["forge verify-contract", address, path, "--chain-id", 11155111].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);

}

const deployVeNation = async (nationToken: Contract) => {
const Factory = getContractFactory(VotingEscrow);
Expand Down Expand Up @@ -106,6 +120,30 @@ const deployLiquidityDistributor = async (rewardsToken: Contract, boostToken: Co
return { "lpToken": lpToken, "lpRewardsContract": distributor }
}

const verifyLpToken = async (address: string, path: string) => {
const tokenFactory = getContractFactory(MockERC20);
const args = tokenFactory.interface.encodeDeploy(["80NATION-20WETH", "80NATION-20WETH", BigNumber.from(dec(314, 18))])
exec(
["forge verify-contract", address, path, "--constructor-args", args, "--chain-id", 11155111].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}

const verifyLiquidityDistributor = async (address: string, path: string) => {
exec(
["forge verify-contract", address, path, "--chain-id", 11155111].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}

const deployPassport = async (governanceToken: Contract) => {
const agreementStatement = "By claiming a Nation3 passport I agree to the terms defined in the following URL";
const agreementURI = "https://bafkreiadlf3apu3u7blxw7t2yxi7oyumeuzhoasq7gqmcbaaycq342xq74.ipfs.dweb.link";
Expand Down Expand Up @@ -139,6 +177,30 @@ const deployPassport = async (governanceToken: Contract) => {
return { "passportToken": passportToken, "passportIssuer": passportIssuer, "agreementStatement": agreementStatement, "agreementURI": agreementURI }
}

const verifyPassport = async (address: string, path: string) => {
const passportFactory = getContractFactory(Passport);
const args = passportFactory.interface.encodeDeploy(["Nation3 Passport", "PASS3"])
exec(
["forge verify-contract", address, path, "--constructor-args", args, "--chain-id", 11155111].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}

const verifyPassportIssuer = async (address: string, path: string) => {
exec(
["forge verify-contract", address, path, "--chain-id", 11155111].join(" "),
(error, stdout, stderr) => {
console.log(error)
console.log(stdout)
console.log(stderr)
}
);
}

const main = async () => {
console.log(`Using deployer: ${wallet.address}`);

Expand Down Expand Up @@ -166,6 +228,15 @@ const main = async () => {
save(deployment, manifestFile);

console.log(`Deployment manifest saved to ${manifestFile}`)

console.log("Contract verification...")

await verifyNationContract("0x23Ca3002706b71a440860E3cf8ff64679A00C9d7", "src/tokens/NATION.sol:NATION", [])
await verifyLpToken("0x6417755C00d5c17DeC196Df00a6F151E448B1471", "src/test/utils/mocks/MockERC20.sol:MockERC20")
await verifyLiquidityDistributor("0x534AB4F195Ac166B78d9edCdbeA04802392711aA", "src/distributors/BoostedLiquidityDistributor.sol:BoostedLiquidityDistributor")
await verifyLiquidityDistributor("0x534AB4F195Ac166B78d9edCdbeA04802392711aA", "src/distributors/BoostedLiquidityDistributor.sol:BoostedLiquidityDistributor")
await verifyPassport("0x11f30642277A70Dab74C6fAF4170a8b340BE2f98", "src/passport/Passport.sol:Passport")
await verifyPassportIssuer("0xdad32e13E73ce4155a181cA0D350Fee0f2596940", "src/passport/PassportIssuer.sol:PassportIssuer")
}


Expand Down

0 comments on commit e89a83a

Please sign in to comment.