From 5dba84f79d09428d6c3ade6e444c5e1c10a2a8fe Mon Sep 17 00:00:00 2001 From: Alex Date: Mon, 13 Jan 2025 13:51:55 +0200 Subject: [PATCH] fix: add info about payloads to the developers docs --- README.md | 16 ++++++++++++ src/configs/appConfigInit.ts | 48 +++++++++++++++++++----------------- src/configs/configs.ts | 8 +++--- 3 files changed, 45 insertions(+), 27 deletions(-) diff --git a/README.md b/README.md index d4efafa3..0576fbd1 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,22 @@ We have our own hosted version from Vercel, you can access it on [https://vote.o ### 2. How to add new payloads controller support to the application? +2.1. First need to determine whether this will be added to a new chain or whether a new controller will be added to one of the existing chain. + +2.2. Need to update `@bgd-labs/aave-address-book`. + +2.3. If the controller is added to an existing chain: + +2.3.1. Need to find the required chain in the application payload controller configuration. [file](./src/configs/appConfigInit.ts) + +2.3.2. Need to leave the address of the payload controller from the address-book first, and insert the old address that was used earlier as the second element of the array. We leave the old address of the payload controller so that it would be possible to view the data on the payloads from the old controller in the UI. `TIP: Old payloads controller addresses will be added here in the array` + +2.3. If the controller is added to a new chain: + +2.3.1. Need to add support for the new chain to the application if it is not already done. How to add support for the new chain is described in the first point. + +2.3.2. Need to add the address of the payloads controller and the payloads controller data helper to the application payload controller configuration. [file](./src/configs/appConfigInit.ts) `TIP: Addresses for the new chain with a payload controller are added here` + ## License Copyright © 2023, Aave DAO, represented by its governance smart contracts. diff --git a/src/configs/appConfigInit.ts b/src/configs/appConfigInit.ts index 3a494b48..d1aaffbd 100644 --- a/src/configs/appConfigInit.ts +++ b/src/configs/appConfigInit.ts @@ -74,7 +74,7 @@ export const payloadsControllerConfig: Record< mainnet: { [mainnet.id]: { dataHelperContractAddress: GovernanceV3Ethereum.PC_DATA_HELPER, - contractAddresses: [GovernanceV3Ethereum.PAYLOADS_CONTROLLER], + contractAddresses: [GovernanceV3Ethereum.PAYLOADS_CONTROLLER], // TIP: Old payloads controller addresses will be added here in the array, after the address from the address-book, and so on for each network. }, [polygon.id]: { dataHelperContractAddress: GovernanceV3Polygon.PC_DATA_HELPER, @@ -116,6 +116,12 @@ export const payloadsControllerConfig: Record< dataHelperContractAddress: GovernanceV3ZkSync.PC_DATA_HELPER, contractAddresses: [GovernanceV3ZkSync.PAYLOADS_CONTROLLER], }, + // TIP: Addresses for the new chain with a payload controller are added here + // example: + // [newChain.id]: { + // dataHelperContractAddress: AddressBook.PC_DATA_HELPER, + // contractAddresses: [AddressBook.PAYLOADS_CONTROLLER], + // }, }, // testnets sepolia: { @@ -132,6 +138,15 @@ export const payloadsControllerConfig: Record< }, }; +export const payloadsControllerChainIds: Record = { + mainnet: Object.keys(payloadsControllerConfig['mainnet']).map((key) => + Number(key), + ), + sepolia: Object.keys(payloadsControllerConfig['sepolia']).map((key) => + Number(key), + ), +}; + const votingMachineConfig: Record< CoreNetworkName, Record @@ -168,6 +183,15 @@ const votingMachineConfig: Record< }, }; +export const votingMachineChainIds: Record = { + mainnet: Object.keys(votingMachineConfig['mainnet']).map((key) => + Number(key), + ), + sepolia: Object.keys(votingMachineConfig['sepolia']).map((key) => + Number(key), + ), +}; + const govCoreChainId: Record = { mainnet: mainnet.id, // testnets @@ -191,28 +215,6 @@ const aditionalsAddresses: Record> = { }, }; -export const payloadsControllerChainIds: Record = { - mainnet: [ - mainnet.id, - polygon.id, - avalanche.id, - base.id, - arbitrum.id, - metis.id, - optimism.id, - bsc.id, - gnosis.id, - scroll.id, - zkSync.id, - ], - sepolia: [sepolia.id, avalancheFuji.id], -}; - -export const votingMachineChainIds: Record = { - mainnet: [mainnet.id, polygon.id, avalanche.id], - sepolia: [sepolia.id, avalancheFuji.id], -}; - export const appConfigInit = (coreNetwork: CoreNetworkName) => { return { govCoreChainId: govCoreChainId[coreNetwork], diff --git a/src/configs/configs.ts b/src/configs/configs.ts index 3aec9d6c..6ee9a190 100644 --- a/src/configs/configs.ts +++ b/src/configs/configs.ts @@ -1,14 +1,14 @@ // ipfs gateway to get proposals metadata export const ipfsGateway = 'https://dweb.link/ipfs'; -// proposals list page size +// page size for paginated data export const PAGE_SIZE = 12; -// for balance formatting +// decimals count for balance formatting export const DECIMALS = 18; -// for API Requests +// endpoint for API Requests export const INITIAL_API_URL = `https://api.onaave.com/gov`; -// for data polling time +// data polling time for all polling on the UI export const DATA_POLLING_TIME = 60_000;