From 410d849c27b63a9262ef0ddf368d257bb8c79c03 Mon Sep 17 00:00:00 2001 From: Aahna Ashina <95955389+aahna-ashina@users.noreply.github.com> Date: Thu, 4 Jan 2024 17:19:50 +0800 Subject: [PATCH 1/9] Update CODEOWNERS --- .github/CODEOWNERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS index b2608bd8..7d6a2fae 100644 --- a/.github/CODEOWNERS +++ b/.github/CODEOWNERS @@ -1 +1 @@ -* @nation3/developer-level-4 +* @nation3/developer-level-4 @nation3/developer-level-5 From bcbcbec5a151c633b8ce9401973a9f5a44dffb5c Mon Sep 17 00:00:00 2001 From: TTNguyenDev Date: Sat, 20 Jan 2024 00:12:43 +0700 Subject: [PATCH 2/9] remove nationPassportRevokeUnderBalance from config --- ui/lib/config.ts | 10 +++------- ui/lib/passport-expiration-hook.ts | 28 ++++++++++++++++++---------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/ui/lib/config.ts b/ui/lib/config.ts index 54839cd8..6c5bab4d 100644 --- a/ui/lib/config.ts +++ b/ui/lib/config.ts @@ -11,8 +11,7 @@ interface DeploymentConfig { nationPassportNFTIssuer: string, nationPassportAgreementStatement: string, nationPassportAgreementURI: string, - nationPassportRequiredBalance: string, - nationPassportRevokeUnderBalance: string, + nationPassportRequiredBalance: string } interface Config { @@ -29,8 +28,7 @@ interface Config { nationPassportNFTIssuer: string, nationPassportAgreementStatement: string, nationPassportAgreementURI: string, - nationPassportRequiredBalance: number, - nationPassportRevokeUnderBalance: number, + nationPassportRequiredBalance: number } const chain = process.env.NEXT_PUBLIC_CHAIN || "goerli"; @@ -49,8 +47,7 @@ const config: Config = { nationPassportNFTIssuer: defaultConfig.nationPassportNFTIssuer || zeroAddress, nationPassportAgreementStatement: defaultConfig.nationPassportAgreementStatement || "", nationPassportAgreementURI: defaultConfig.nationPassportAgreementURI || "", - nationPassportRequiredBalance: Number(defaultConfig.nationPassportRequiredBalance), - nationPassportRevokeUnderBalance: Number(defaultConfig.nationPassportRevokeUnderBalance) + nationPassportRequiredBalance: Number(defaultConfig.nationPassportRequiredBalance) } console.log(config) @@ -70,6 +67,5 @@ export const { nationPassportAgreementStatement, nationPassportAgreementURI, nationPassportRequiredBalance, - nationPassportRevokeUnderBalance } = config diff --git a/ui/lib/passport-expiration-hook.ts b/ui/lib/passport-expiration-hook.ts index f785d5c1..bff20483 100644 --- a/ui/lib/passport-expiration-hook.ts +++ b/ui/lib/passport-expiration-hook.ts @@ -3,20 +3,28 @@ import { useMemo } from "react"; import { getPassportExpirationDate } from "./passport-expiration"; import { useAccount } from "./use-wagmi"; import { useVeNationLock } from "./ve-token"; -import { nationPassportRevokeUnderBalance } from "../lib/config"; - +import { + useContractRead, +} from './use-wagmi' +import { nationPassportNFTIssuer } from '../lib/config' +import PassportIssuer from '../abis/PassportIssuer.json' export function usePassportExpirationDate(): Date | undefined { const { address } = useAccount() const { data: veNationLock } = useVeNationLock(address) - const threshold = ethers.BigNumber.from(String(nationPassportRevokeUnderBalance * 10 ** 18)); - + const contractParams = { + address: nationPassportNFTIssuer, + abi: PassportIssuer.abi, + } + const { data: revokeUnderBalance } = + useContractRead(contractParams, 'revokeUnderBalance') + return useMemo(() => { - if (!veNationLock) { - return undefined; - } + if (!veNationLock || !revokeUnderBalance) { + return undefined; + } - const [lockAmount, lockEnd]: [ethers.BigNumber, ethers.BigNumber] = veNationLock; - return getPassportExpirationDate(lockAmount, lockEnd, threshold); - }, [veNationLock, threshold]); + const [lockAmount, lockEnd]: [ethers.BigNumber, ethers.BigNumber] = veNationLock; + return getPassportExpirationDate(lockAmount, lockEnd, revokeUnderBalance); + }, [veNationLock, revokeUnderBalance]); } From 6464b53fd926a5fbd8ee702c2302fcaabd0d50fc Mon Sep 17 00:00:00 2001 From: TTNguyenDev Date: Sat, 20 Jan 2024 11:46:33 +0700 Subject: [PATCH 3/9] Use custom hook --- ui/lib/passport-expiration-hook.ts | 20 ++++++-------------- ui/lib/passport-nft.ts | 12 +++++++++++- 2 files changed, 17 insertions(+), 15 deletions(-) diff --git a/ui/lib/passport-expiration-hook.ts b/ui/lib/passport-expiration-hook.ts index bff20483..02d71a99 100644 --- a/ui/lib/passport-expiration-hook.ts +++ b/ui/lib/passport-expiration-hook.ts @@ -1,30 +1,22 @@ import { ethers } from "ethers"; import { useMemo } from "react"; import { getPassportExpirationDate } from "./passport-expiration"; +import { usePassportRevokeUnderBalance } from "./passport-nft"; import { useAccount } from "./use-wagmi"; import { useVeNationLock } from "./ve-token"; -import { - useContractRead, -} from './use-wagmi' -import { nationPassportNFTIssuer } from '../lib/config' -import PassportIssuer from '../abis/PassportIssuer.json' export function usePassportExpirationDate(): Date | undefined { const { address } = useAccount() const { data: veNationLock } = useVeNationLock(address) - const contractParams = { - address: nationPassportNFTIssuer, - abi: PassportIssuer.abi, - } - const { data: revokeUnderBalance } = - useContractRead(contractParams, 'revokeUnderBalance') + const { data: threshold } = usePassportRevokeUnderBalance() + console.log(threshold) return useMemo(() => { - if (!veNationLock || !revokeUnderBalance) { + if (!veNationLock) { return undefined; } const [lockAmount, lockEnd]: [ethers.BigNumber, ethers.BigNumber] = veNationLock; - return getPassportExpirationDate(lockAmount, lockEnd, revokeUnderBalance); - }, [veNationLock, revokeUnderBalance]); + return getPassportExpirationDate(lockAmount, lockEnd, threshold); + }, [veNationLock, threshold]); } diff --git a/ui/lib/passport-nft.ts b/ui/lib/passport-nft.ts index ccb8f6a4..1bbc051b 100644 --- a/ui/lib/passport-nft.ts +++ b/ui/lib/passport-nft.ts @@ -51,7 +51,7 @@ export function usePassport(address: any) { const { data: id, isLoading: loadingID } = useContractRead( { ...nftIssuerContractParams, - enable: Boolean(address) + enable: Boolean(address) }, 'passportId', [address], @@ -62,3 +62,13 @@ export function usePassport(address: any) { const { loading, nft } = useNft(nationPassportNFT || '', id) return { data: { id, nft }, isLoading: loadingID || loading } } + +export function usePassportRevokeUnderBalance() { + return useContractRead( + { + ...nftIssuerContractParams, + }, + 'revokeUnderBalance', + undefined + ) +} From 058dd138f91c122d8d30953556647b4adf83f059 Mon Sep 17 00:00:00 2001 From: TTNguyenDev Date: Sat, 20 Jan 2024 11:47:51 +0700 Subject: [PATCH 4/9] rm log --- ui/lib/passport-expiration-hook.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/ui/lib/passport-expiration-hook.ts b/ui/lib/passport-expiration-hook.ts index 02d71a99..99e8bfba 100644 --- a/ui/lib/passport-expiration-hook.ts +++ b/ui/lib/passport-expiration-hook.ts @@ -9,7 +9,6 @@ export function usePassportExpirationDate(): Date | undefined { const { data: veNationLock } = useVeNationLock(address) const { data: threshold } = usePassportRevokeUnderBalance() - console.log(threshold) return useMemo(() => { if (!veNationLock) { From e939381c02ee648553fe5392b7635099b890357e Mon Sep 17 00:00:00 2001 From: TTNguyenDev Date: Sat, 20 Jan 2024 11:55:30 +0700 Subject: [PATCH 5/9] fix: rm nationPassportRequiredBalance in deployment --- contracts/deployments/goerli.json | 3 +-- contracts/deployments/mainnet.json | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/contracts/deployments/goerli.json b/contracts/deployments/goerli.json index 7458bc9b..29226ab3 100644 --- a/contracts/deployments/goerli.json +++ b/contracts/deployments/goerli.json @@ -10,6 +10,5 @@ "nationPassportNFTIssuer": "0x8c16926819AB30B8b29A8E23F5C230d164337093", "nationPassportAgreementStatement": "By claiming a Nation3 passport I agree to the terms defined in the following URL", "nationPassportAgreementURI": "https://bafkreiadlf3apu3u7blxw7t2yxi7oyumeuzhoasq7gqmcbaaycq342xq74.ipfs.dweb.link", - "nationPassportRequiredBalance": 2, - "nationPassportRevokeUnderBalance": 1.5 + "nationPassportRequiredBalance": 2 } diff --git a/contracts/deployments/mainnet.json b/contracts/deployments/mainnet.json index 45332f20..b5003e46 100644 --- a/contracts/deployments/mainnet.json +++ b/contracts/deployments/mainnet.json @@ -13,6 +13,5 @@ "nationPassportNFTIssuer": "0x279c0b6bfCBBA977eaF4ad1B2FFe3C208aa068aC", "nationPassportAgreementStatement": "By claiming a Nation3 passport I agree to the terms defined in the following URL", "nationPassportAgreementURI": "https://bafkreiadlf3apu3u7blxw7t2yxi7oyumeuzhoasq7gqmcbaaycq342xq74.ipfs.dweb.link", - "nationPassportRequiredBalance": 2, - "nationPassportRevokeUnderBalance": 1.5 + "nationPassportRequiredBalance": 2 } From 28c1422651652c692f0c0b32ef6a63bab433836c Mon Sep 17 00:00:00 2001 From: TTNguyenDev Date: Wed, 24 Jan 2024 19:51:57 +0700 Subject: [PATCH 6/9] support sepolia --- README.md | 12 ++++++++++++ contracts/deployments/sepoila.json | 14 ++++++++++++++ ui/.env.sepolia | 5 +++++ ui/README.md | 5 +++++ 4 files changed, 36 insertions(+) create mode 100644 contracts/deployments/sepoila.json create mode 100644 ui/.env.sepolia diff --git a/README.md b/README.md index 005b3173..1dd176b8 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,18 @@ Start the development server: yarn dev ``` +## Testing against the Sepolia Ethereum testnet + +Add Sepolia testnet variables to your local development environment: +``` +cp .env.sepolia .env.local +``` + +Start the development server: +``` +yarn dev +``` + Once you go to http://localhost:42069, you will see the message "Nation3 uses Goerli as its preferred network": > Screen Shot 2022-05-21 at 11 10 06 AM diff --git a/contracts/deployments/sepoila.json b/contracts/deployments/sepoila.json new file mode 100644 index 00000000..30480e41 --- /dev/null +++ b/contracts/deployments/sepoila.json @@ -0,0 +1,14 @@ +{ + "nationToken": "0x23Ca3002706b71a440860E3cf8ff64679A00C9d7", + "veNationToken": "0x8100e77899C24b0F7B516153F84868f850C034BF", + "balancerLPToken": "0x6417755C00d5c17DeC196Df00a6F151E448B1471", + "lpRewardsContract": "0x534AB4F195Ac166B78d9edCdbeA04802392711aA", + "nationDropContracts": [ + "0xfa5742931300D9CcFB8FE789dbd72326DFf770fB", + "0x32ebd2b43fdF9Ac035Cb9947E5086F0Ca53be573" + ], + "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" +} diff --git a/ui/.env.sepolia b/ui/.env.sepolia new file mode 100644 index 00000000..37e2628d --- /dev/null +++ b/ui/.env.sepolia @@ -0,0 +1,5 @@ +NEXT_PUBLIC_CHAIN=sepolia +INFURA_ID= +ALCHEMY_ID= +ETHERSCAN_ID= +NFTSTORAGE_KEY= diff --git a/ui/README.md b/ui/README.md index b21e26e7..ff438d18 100644 --- a/ui/README.md +++ b/ui/README.md @@ -22,6 +22,11 @@ or ``` cp .env.goerli .env.local ``` +or +``` +cp .env.sepolia .env.local +``` + Build: ``` From bf7facfd566479b7d1f9c4398b9714ce3f825cde Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 25 Jan 2024 13:11:24 +0700 Subject: [PATCH 7/9] fix: update README.md & fix file name --- README.md | 13 ++++++++++--- .../deployments/{sepoila.json => sepolia.json} | 4 ---- 2 files changed, 10 insertions(+), 7 deletions(-) rename contracts/deployments/{sepoila.json => sepolia.json} (83%) diff --git a/README.md b/README.md index 1dd176b8..0a03a8fb 100644 --- a/README.md +++ b/README.md @@ -41,6 +41,14 @@ Start the development server: yarn dev ``` +Once you go to http://localhost:42069, you will see the message "Nation3 uses Goerli as its preferred network": + +> Screen Shot 2022-05-21 at 11 10 06 AM + +Solve this by switching to the _Goerli Test Network_ in MetaMask: + +> Screen Shot 2022-05-21 at 11 03 28 AM + ## Testing against the Sepolia Ethereum testnet Add Sepolia testnet variables to your local development environment: @@ -52,12 +60,11 @@ Start the development server: ``` yarn dev ``` - -Once you go to http://localhost:42069, you will see the message "Nation3 uses Goerli as its preferred network": +Once you go to http://localhost:42069, you will see the message "Nation3 uses Sepolia as its preferred network": > Screen Shot 2022-05-21 at 11 10 06 AM -Solve this by switching to the _Goerli Test Network_ in MetaMask: +Solve this by switching to the Sepolia Test Network_ in MetaMask: > Screen Shot 2022-05-21 at 11 03 28 AM diff --git a/contracts/deployments/sepoila.json b/contracts/deployments/sepolia.json similarity index 83% rename from contracts/deployments/sepoila.json rename to contracts/deployments/sepolia.json index 30480e41..5e894b60 100644 --- a/contracts/deployments/sepoila.json +++ b/contracts/deployments/sepolia.json @@ -3,10 +3,6 @@ "veNationToken": "0x8100e77899C24b0F7B516153F84868f850C034BF", "balancerLPToken": "0x6417755C00d5c17DeC196Df00a6F151E448B1471", "lpRewardsContract": "0x534AB4F195Ac166B78d9edCdbeA04802392711aA", - "nationDropContracts": [ - "0xfa5742931300D9CcFB8FE789dbd72326DFf770fB", - "0x32ebd2b43fdF9Ac035Cb9947E5086F0Ca53be573" - ], "nationPassportNFT": "0x11f30642277A70Dab74C6fAF4170a8b340BE2f98", "nationPassportNFTIssuer": "0xdad32e13E73ce4155a181cA0D350Fee0f2596940", "nationPassportAgreementStatement": "By claiming a Nation3 passport I agree to the terms defined in the following URL", From 8d18aa7074d25838ed9e395096e71b74cb78864d Mon Sep 17 00:00:00 2001 From: Chris Date: Thu, 25 Jan 2024 14:37:03 +0700 Subject: [PATCH 8/9] fix: README --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 0a03a8fb..7ff62e31 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,7 @@ # Nation3 App β˜οΈπŸ‡ΊπŸ‡³ ![Vercel](https://vercelbadge.vercel.app/api/nation3/app) - - - - + --- @@ -60,13 +57,14 @@ Start the development server: ``` yarn dev ``` + Once you go to http://localhost:42069, you will see the message "Nation3 uses Sepolia as its preferred network": -> Screen Shot 2022-05-21 at 11 10 06 AM +> Screenshot 2024-01-25 at 13 09 56 Solve this by switching to the Sepolia Test Network_ in MetaMask: -> Screen Shot 2022-05-21 at 11 03 28 AM +> Screenshot 2024-01-25 at 13 06 18 ## Run the smart contracts locally From f55c422f7e26fc829c1cc9c87926f727d88f7629 Mon Sep 17 00:00:00 2001 From: Chris Nguyen <42999269+TTNguyenDev@users.noreply.github.com> Date: Thu, 25 Jan 2024 14:45:42 +0700 Subject: [PATCH 9/9] Update README.md --- README.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 7ff62e31..dc7ef216 100644 --- a/README.md +++ b/README.md @@ -62,10 +62,9 @@ Once you go to http://localhost:42069, you will see the message "Nation3 uses Se > Screenshot 2024-01-25 at 13 09 56 -Solve this by switching to the Sepolia Test Network_ in MetaMask: - -> Screenshot 2024-01-25 at 13 06 18 +Solve this by switching to the Sepolia Test Network in MetaMask: +> Screenshot 2024-01-25 at 14 45 18 ## Run the smart contracts locally