Skip to content

Commit eea2693

Browse files
committed
feat: add proposal decoding
1 parent 6a8a370 commit eea2693

File tree

2 files changed

+20
-3
lines changed

2 files changed

+20
-3
lines changed

src/views/index-dtf/governance/components/governance-proposal-preview.tsx

+17
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { useAtomValue } from 'jotai'
55
import { Address, decodeFunctionData, getAbiItem } from 'viem'
66

77
import dtfIndexAbi from '@/abis/dtf-index-abi'
8+
import dtfAdminAbi from '@/abis/dtf-admin-abi'
89
import dtfIndexGovernance from '@/abis/dtf-index-governance'
910
import dtfIndexStakingVault from '@/abis/dtf-index-staking-vault'
1011
import { Button } from '@/components/ui/button'
@@ -26,6 +27,10 @@ import { Abi, Hex } from 'viem'
2627
import BasketProposalPreview from '../views/propose/basket/components/proposal-basket-preview'
2728
import RawCallPreview from './proposal-preview/raw-call-preview'
2829
import TokenRewardPreview from './proposal-preview/token-reward-preview'
30+
import {
31+
spellAbi as governanceSpell_31_03_2025Abi,
32+
spellAddress as governanceSpell_31_03_2025Address,
33+
} from '../views/propose/components/propose-governance-spell-31-03-2025'
2934

3035
const dtfAbiMapppingAtom = atom((get) => {
3136
const dtf = get(indexDTFAtom)
@@ -34,6 +39,7 @@ const dtfAbiMapppingAtom = atom((get) => {
3439

3540
const abiMapping: Record<string, Abi> = {
3641
[dtf.id.toLowerCase()]: dtfIndexAbi,
42+
[dtf.proxyAdmin.toLowerCase()]: dtfAdminAbi,
3743
}
3844

3945
if (dtf.ownerGovernance) {
@@ -52,6 +58,11 @@ const dtfAbiMapppingAtom = atom((get) => {
5258
}
5359
}
5460

61+
if (governanceSpell_31_03_2025Address[dtf.chainId]) {
62+
abiMapping[governanceSpell_31_03_2025Address[dtf.chainId].toLowerCase()] =
63+
governanceSpell_31_03_2025Abi
64+
}
65+
5566
return abiMapping
5667
})
5768

@@ -62,6 +73,7 @@ const dtfContractAliasAtom = atom((get) => {
6273

6374
const aliasMapping: Record<string, string> = {
6475
[dtf.id.toLowerCase()]: 'Folio',
76+
[dtf.proxyAdmin.toLowerCase()]: 'ProxyAdmin',
6577
}
6678

6779
if (dtf.ownerGovernance) {
@@ -80,6 +92,11 @@ const dtfContractAliasAtom = atom((get) => {
8092
}
8193
}
8294

95+
if (governanceSpell_31_03_2025Address[dtf.chainId]) {
96+
aliasMapping[governanceSpell_31_03_2025Address[dtf.chainId].toLowerCase()] =
97+
'GovernanceSpell_31_03_2025'
98+
}
99+
83100
return aliasMapping
84101
})
85102

src/views/index-dtf/governance/views/propose/components/propose-governance-spell-31-03-2025.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,12 @@ import { getCurrentTime } from '@/utils'
2929
import { governanceProposalsAtom, refetchTokenAtom } from '../../../atoms'
3030
import { getProposalState, PartialProposal } from '@/lib/governance'
3131

32-
const spellAbi = parseAbi([
32+
export const spellAbi = parseAbi([
3333
'function upgradeStakingVaultGovernance(address stakingVault, address oldGovernor, address[] calldata guardians, bytes32 deploymentNonce) external returns (address newGovernor)',
3434
'function upgradeFolioGovernance(address folio, address proxyAdmin, address oldOwnerGovernor, address oldTradingGovernor, address[] calldata ownerGuardians, address[] calldata tradingGuardians, bytes32 deploymentNonce) external returns (address newOwnerGovernor, address newTradingGovernor)',
3535
])
3636

37-
const spellAddress = {
37+
export const spellAddress = {
3838
[ChainId.Mainnet]: getAddress('0x880F6ef00d13bAf60f3B99099451432F502EdA15'),
3939
[ChainId.Base]: getAddress('0xE7FAa62c3F71f743F3a2Fc442393182F6B64f156'),
4040
}
@@ -91,7 +91,7 @@ const ProposeGovernanceSpell31032025Folio = ({
9191
const ownerGuardians = dtf.ownerGovernance.timelock.guardians.filter(
9292
(guardian) => !isAddressEqual(guardian, oldOwnerGovernor)
9393
)
94-
const tradingGuardians = dtf.ownerGovernance.timelock.guardians.filter(
94+
const tradingGuardians = dtf.tradingGovernance.timelock.guardians.filter(
9595
(guardian) => !isAddressEqual(guardian, oldTradingGovernor)
9696
)
9797

0 commit comments

Comments
 (0)