diff --git a/ui/.gitignore b/ui/.gitignore index 61056b0d2..692120a69 100644 --- a/ui/.gitignore +++ b/ui/.gitignore @@ -18,6 +18,7 @@ # misc .DS_Store *.pem +package-lock.json # debug npm-debug.log* @@ -41,4 +42,5 @@ cypress/videos notes.txt # sitemap -public/sitemap*.xml \ No newline at end of file +public/sitemap*.xml + diff --git a/ui/components/nance/RetroactiveRewards.tsx b/ui/components/nance/RetroactiveRewards.tsx index 1d86aa8db..fc9de50b5 100644 --- a/ui/components/nance/RetroactiveRewards.tsx +++ b/ui/components/nance/RetroactiveRewards.tsx @@ -6,6 +6,9 @@ import { DISTRIBUTION_TABLE_ADDRESSES, HATS_ADDRESS, PROJECT_ADDRESSES, + ARBITRUM_ASSETS_URL, + POLYGON_ASSETS_URL, + BASE_ASSETS_URL, } from 'const/config' import _ from 'lodash' import Image from 'next/image' @@ -209,7 +212,16 @@ export function RetroactiveRewards({ ) : {} - const { tokens } = useAssets() + const { tokens: mainnetTokens } = useAssets() + const { tokens: arbitrumTokens } = useAssets(ARBITRUM_ASSETS_URL) + const { tokens: polygonTokens } = useAssets(POLYGON_ASSETS_URL) + const { tokens: baseTokens } = useAssets(BASE_ASSETS_URL) + + const tokens = mainnetTokens + .concat(arbitrumTokens) + .concat(polygonTokens) + .concat(baseTokens) + console.log(tokens) const { ethBudget, usdBudget, mooneyBudget, ethPrice } = getBudget( tokens, @@ -328,7 +340,7 @@ export function RetroactiveRewards({ >
diff --git a/ui/const/config.ts b/ui/const/config.ts index 34e857ab8..3d9ea3879 100644 --- a/ui/const/config.ts +++ b/ui/const/config.ts @@ -18,13 +18,11 @@ interface DeploymentConfig { type Index = { [key: string]: string } //vMooneySweepstakesZeroG is always mainnet address (using infura provider) -const ethConfig = require( - `../../contracts/deployments/ethereum` -) as DeploymentConfig +const ethConfig = + require(`../../contracts/deployments/ethereum`) as DeploymentConfig -const polygonConfig = require( - `../../contracts/deployments/polygon` -) as DeploymentConfig +const polygonConfig = + require(`../../contracts/deployments/polygon`) as DeploymentConfig const arbitrumConfig = require('../../contracts/deployments/arbitrum') as DeploymentConfig @@ -32,13 +30,11 @@ const arbitrumConfig = const baseConfig = require('../../contracts/deployments/base') as DeploymentConfig -const goerliConfig = require( - `../../contracts/deployments/goerli` -) as DeploymentConfig +const goerliConfig = + require(`../../contracts/deployments/goerli`) as DeploymentConfig -const sepoliaConfig = require( - `../../contracts/deployments/sepolia` -) as DeploymentConfig +const sepoliaConfig = + require(`../../contracts/deployments/sepolia`) as DeploymentConfig const arbitrumSepoliaConfig = require('../../contracts/deployments/arbitrum-sepolia') as DeploymentConfig @@ -327,3 +323,10 @@ export const CHAIN_TOKEN_NAMES: Index = { arbitrum: 'ETH', sepolia: 'ETH', } + +export const ARBITRUM_ASSETS_URL = + 'https://safe-client.safe.global/v1/chains/42161/safes/0xAF26a002d716508b7e375f1f620338442F5470c0/balances/usd?trusted=true' +export const POLYGON_ASSETS_URL = + 'https://safe-client.safe.global/v1/chains/137/safes/0x8C0252c3232A2c7379DDC2E44214697ae8fF097a/balances/usd?trusted=true' +export const BASE_ASSETS_URL = + 'https://safe-client.safe.global/v1/chains/8453/safes/0x871e232Eb935E54Eb90B812cf6fe0934D45e7354/balances/usd?trusted=true' diff --git a/ui/lib/dashboard/hooks/useAssets.ts b/ui/lib/dashboard/hooks/useAssets.ts index 2f0f91b1a..f98fefbac 100644 --- a/ui/lib/dashboard/hooks/useAssets.ts +++ b/ui/lib/dashboard/hooks/useAssets.ts @@ -1,7 +1,8 @@ import { useState, useEffect } from 'react' -export function useAssets() { - const ASSETS_URL = process.env.NEXT_PUBLIC_ASSETS_URL as string +export function useAssets( + assetsUrl: string = process.env.NEXT_PUBLIC_ASSETS_URL as string +) { const [tokens, setTokens] = useState([]) const [balanceSum, setBalanceSum] = useState() const [isLoading, setIsLoading] = useState(false) @@ -9,7 +10,7 @@ export function useAssets() { useEffect(() => { setIsLoading(true) - fetch(ASSETS_URL) + fetch(assetsUrl) .then((res) => res.json()) .then( (result) => { @@ -29,7 +30,7 @@ export function useAssets() { setError(error) } ) - }, [ASSETS_URL]) + }, [assetsUrl]) return { tokens, isLoading, balanceSum, error } } diff --git a/ui/pages/withdraw.tsx b/ui/pages/withdraw.tsx index 1aeac5d29..90267db6a 100644 --- a/ui/pages/withdraw.tsx +++ b/ui/pages/withdraw.tsx @@ -78,20 +78,19 @@ export default function Withdraw() { !VMOONEYLockLoading && setHasLock(VMOONEYLock && VMOONEYLock[0] != 0) }, [VMOONEYLock, VMOONEYLockLoading, address]) - const [hasMoreThanSixMonths, setHasMoreThanSixMonths] = - useState(false) - const sixMonths = 6 * 30 * 24 * 60 * 60 * 1000 + // 3.75 years ~ 45 months + const [hasMoreThan45Months, setHasMoreThan45Months] = useState(false) + const fortyFiveMonths = 45 * 30 * 24 * 60 * 60 * 1000 useEffect(() => { - console.log() !VMOONEYLockLoading && - setHasMoreThanSixMonths( + setHasMoreThan45Months( VMOONEYLock && VMOONEYLock[1] != 0 && - BigNumber.from(+new Date() + sixMonths).lte( + BigNumber.from(+new Date() + fortyFiveMonths).lte( VMOONEYLock?.[1].toString() * 1000 ) ) - }, [VMOONEYLock, VMOONEYLockLoading, address, sixMonths]) + }, [VMOONEYLock, VMOONEYLockLoading, address, fortyFiveMonths]) const handleWithdraw = async () => { try { @@ -169,7 +168,7 @@ export default function Withdraw() { usd="" /> - {address && hasLock && hasMoreThanSixMonths ? ( + {address && hasLock && hasMoreThan45Months ? (