Skip to content

Commit

Permalink
fix: correct phase 1 data
Browse files Browse the repository at this point in the history
  • Loading branch information
viet-nv committed Feb 19, 2024
1 parent 6f5a6c0 commit 7a8350b
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions src/pages/ElasticSnapshot/components/SelectTreasuryGrant.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ import { formatDisplayNumber } from 'utils/numbers'

import vesting3rdData from '../data/pendle_dappos_vesting.json'
import vestingData from '../data/vesting.json'
import vestingOptionA from '../data/vesting/optionA.json'
import vestingOptionB from '../data/vesting/optionB.json'
import ChooseGrantModal from './ChooseGrantModal'
import TermAndPolicyModal from './TermAndPolicyModal'

Expand Down Expand Up @@ -54,11 +56,24 @@ export default function SelectTreasuryGrant() {
const theme = useTheme()
const { account, chainId } = useActiveWeb3React()
const [showOptionModal, setShowOptionsModal] = useState(false)
const userData = vestingData.find(item => item.receiver.toLowerCase() === account?.toLowerCase())
const user3rdData = vesting3rdData.find(item => item.receiver.toLowerCase() === account?.toLowerCase())
const totalValue = (userData?.value || 0) + (user3rdData?.value || 0)

console.log(userData, user3rdData)
const addressesOptionA = vestingOptionA.map(item => item.claimData.receiver.toLowerCase())
const addressesOptionB = vestingOptionB.map(item => item.claimData.receiver.toLowerCase())
const userData = vestingData.find(
item =>
item.receiver.toLowerCase() === account?.toLowerCase() &&
(addressesOptionA.includes(item.receiver.toLowerCase()) || addressesOptionB.includes(item.receiver.toLowerCase)),
)

const userPhase2 = vestingData.find(
item =>
item.receiver.toLowerCase() === account?.toLowerCase() &&
!addressesOptionA.includes(item.receiver.toLowerCase()) &&
!addressesOptionB.includes(item.receiver.toLowerCase),
)
const user3rdData = vesting3rdData.find(item => item.receiver.toLowerCase() === account?.toLowerCase())
const totalPhase2Value = (user3rdData?.value || 0) + (userPhase2?.value || 0)
const totalValue = (userData?.value || 0) + totalPhase2Value

const [createOption] = useCreateOptionMutation()
const notify = useNotify()
Expand Down Expand Up @@ -240,7 +255,7 @@ export default function SelectTreasuryGrant() {
<Trans>Phase 2</Trans>
</Text>
<Text fontWeight="500" fontSize={upToMedium ? 16 : 20}>
{format(user3rdData?.value || 0)}
{format(totalPhase2Value || 0)}
</Text>
</Flex>
</Flex>
Expand Down

0 comments on commit 7a8350b

Please sign in to comment.