From e8b2534a4bba22c68c75822a40f19b6410c36b88 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Hernando=20Guzm=C3=A1n?= Date: Tue, 29 Oct 2024 14:24:29 -0300 Subject: [PATCH] Check for presence of v1 delegate address (#959) * Check v1 delegate first * Add additional delegate links (#957) * Add byteron link * PBG and UPMaker * Update Tenderly VDF v2 contract and use Tenderly SDK * Add test delegate migration * Add vigilant v2 contract * Use more consistent names (#960) --------- Co-authored-by: Adam Goth Co-authored-by: Hector Rodriguez Fornies --- .../abis/tenderly/voteDelegateFactoryOld.json | 1 + modules/contracts/eth-sdk.config.ts | 3 ++- .../helpers/getDelegateContractAddress.ts | 9 +++++-- modules/migration/delegateAddressLinks.ts | 13 +++++++-- modules/tags/constants/poll-tags-mapping.json | 27 +++++++++++++++++++ modules/web3/helpers/getContracts.ts | 4 +-- modules/web3/helpers/getReadOnlyContracts.ts | 4 +-- 7 files changed, 52 insertions(+), 9 deletions(-) create mode 100644 modules/contracts/abis/tenderly/voteDelegateFactoryOld.json diff --git a/modules/contracts/abis/tenderly/voteDelegateFactoryOld.json b/modules/contracts/abis/tenderly/voteDelegateFactoryOld.json new file mode 100644 index 000000000..4aef771fe --- /dev/null +++ b/modules/contracts/abis/tenderly/voteDelegateFactoryOld.json @@ -0,0 +1 @@ +[{"inputs":[{"internalType":"address","name":"_chief","type":"address"},{"internalType":"address","name":"_polling","type":"address"}],"stateMutability":"nonpayable","type":"constructor"},{"anonymous":false,"inputs":[{"indexed":true,"internalType":"address","name":"delegate","type":"address"},{"indexed":true,"internalType":"address","name":"voteDelegate","type":"address"}],"name":"CreateVoteDelegate","type":"event"},{"inputs":[],"name":"chief","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"create","outputs":[{"internalType":"address","name":"voteDelegate","type":"address"}],"stateMutability":"nonpayable","type":"function"},{"inputs":[{"internalType":"address","name":"","type":"address"}],"name":"delegates","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"},{"inputs":[{"internalType":"address","name":"guy","type":"address"}],"name":"isDelegate","outputs":[{"internalType":"bool","name":"","type":"bool"}],"stateMutability":"view","type":"function"},{"inputs":[],"name":"polling","outputs":[{"internalType":"address","name":"","type":"address"}],"stateMutability":"view","type":"function"}] \ No newline at end of file diff --git a/modules/contracts/eth-sdk.config.ts b/modules/contracts/eth-sdk.config.ts index 492b55d25..c1ad90801 100644 --- a/modules/contracts/eth-sdk.config.ts +++ b/modules/contracts/eth-sdk.config.ts @@ -54,7 +54,8 @@ const config: EthSdkConfig = { pollingOld: '0xF9be8F0945acDdeeDaA64DFCA5Fe9629D0CF8E5D', pot: '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7', vat: '0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B', - voteDelegateFactory: '0xC3D809E87A2C9da4F6d98fECea9135d834d6F5A0', + voteDelegateFactory: '0x093d305366218d6d09ba10448922f10814b031dd', + voteDelegateFactoryOld: '0xD897F108670903D1d6070fcf818f9db3615AF272', voteProxyFactory: '0x6FCD258af181B3221073A96dD90D1f7AE7eEc408', voteProxyFactoryOld: '0xa63E145309cadaa6A903a19993868Ef7E85058BE', vow: '0xA950524441892A31ebddF91d3cEEFa04Bf454466' diff --git a/modules/delegates/helpers/getDelegateContractAddress.ts b/modules/delegates/helpers/getDelegateContractAddress.ts index 323943c49..036ba2bb9 100644 --- a/modules/delegates/helpers/getDelegateContractAddress.ts +++ b/modules/delegates/helpers/getDelegateContractAddress.ts @@ -13,6 +13,11 @@ export async function getDelegateContractAddress( contracts: EthSdk, address: string ): Promise { - const voteDelegateAdress = await contracts.voteDelegateFactory.delegates(address); - return voteDelegateAdress !== ZERO_ADDRESS ? voteDelegateAdress : undefined; + const voteDelegateAddress = await contracts.voteDelegateFactory.delegates(address); + const voteDelegateAddressOld = await contracts.voteDelegateFactoryOld.delegates(address); + return voteDelegateAddressOld !== ZERO_ADDRESS + ? voteDelegateAddressOld + : voteDelegateAddress !== ZERO_ADDRESS + ? voteDelegateAddress + : undefined; } diff --git a/modules/migration/delegateAddressLinks.ts b/modules/migration/delegateAddressLinks.ts index 769bcc2c0..4b1379a28 100644 --- a/modules/migration/delegateAddressLinks.ts +++ b/modules/migration/delegateAddressLinks.ts @@ -12,7 +12,8 @@ export const delegateAddressLinks = { // Format: Old Address -> new address [SupportedNetworks.TENDERLY]: { '0x3c85c3f4b0d610fd29cc132a2073f85c15f83f2b': '0xe5da2412d11200d478f77b0e881e7b5dbd190295', - '0x3eB576f858B20085419Fd3f09DEE38E2cA372Cd6': '0x4C033196bbDfae26e186f32b058AEe7610a84171' + '0x3eB576f858B20085419Fd3f09DEE38E2cA372Cd6': '0x4C033196bbDfae26e186f32b058AEe7610a84171', + '0x008C9Ef7bEF55E6731eE5ce466b18eE99A6D3eeD': '0x932adcc9c79EdaC2bb5A98733Fe90e1f4e91E5e5' }, [SupportedNetworks.MAINNET]: { // schuppi @@ -72,7 +73,15 @@ export const delegateAddressLinks = { // QGov V2 '0x4A92599433535b0E61d80085c5a90AeDf5a96467': '0x3B42d3C0F5c8f14A57C59f8BeA69b7cb02cEd1D5', // WBC V2 - '0x3C85C3F4B0d610Fd29cc132A2073f85C15F83f2b': '0x4C2134ABe86109dB784A5d0a34C98251Bb82a859' + '0x3C85C3F4B0d610Fd29cc132A2073f85C15F83f2b': '0x4C2134ABe86109dB784A5d0a34C98251Bb82a859', + // byteron V2 + '0x539400956A0B79963268fB7Ef4f95E9D618d58A6': '0x0f90ca538839d9354f987381bFc4151C4e0624B2', + // PBG V2 + '0x51C659ee6FccebF7183da4E7D42A83b652F6E741': '0x1989BC38403A8c7f3c9A6699c5366d9AF6301dD6', + // UPMaker V2 + '0x80ae9649fC445516f4792AF77b0B8F5809C38231': '0xB1b92313d93137E32FA2bE06455Cae5AEd78f33D', + // vigilant V2 + '0x37D58532a985c2aD7a84EC61b0413Cc4B2c48977': '0xFE67Cbec68B6e00D9327B4ECf32C0d526b60668D' } }; diff --git a/modules/tags/constants/poll-tags-mapping.json b/modules/tags/constants/poll-tags-mapping.json index 7d5982913..a1da57409 100644 --- a/modules/tags/constants/poll-tags-mapping.json +++ b/modules/tags/constants/poll-tags-mapping.json @@ -4579,5 +4579,32 @@ "1144": [ "high-impact", "endgame" + ], + "1145": [ + "high-impact", + "collateral-onboard", + "spark" + ], + "1146": [ + "high-impact", + "collateral-onboard", + "spark" + ], + "1147": [ + "high-impact", + "oracle", + "spark" + ], + "1148": [ + "high-impact", + "endgame" + ], + "1149": [ + "high-impact", + "endgame" + ], + "1150": [ + "high-impact", + "endgame" ] } \ No newline at end of file diff --git a/modules/web3/helpers/getContracts.ts b/modules/web3/helpers/getContracts.ts index 3d48c4f29..05ab4c92c 100644 --- a/modules/web3/helpers/getContracts.ts +++ b/modules/web3/helpers/getContracts.ts @@ -6,7 +6,7 @@ SPDX-License-Identifier: AGPL-3.0-or-later */ -import { getMainnetSdk } from '@dethcrypto/eth-sdk-client'; +import { getMainnetSdk, getTenderlySdk } from '@dethcrypto/eth-sdk-client'; import { providers } from 'ethers'; import { CHAIN_INFO, DEFAULT_NETWORK } from '../constants/networks'; import { SupportedChainId } from '../constants/chainID'; @@ -17,7 +17,7 @@ import { EthSdk, SdkGenerators } from '../types/contracts'; const sdkGenerators: SdkGenerators = { mainnet: getMainnetSdk, - tenderly: getMainnetSdk + tenderly: getTenderlySdk }; let connectedAccount: string | undefined; diff --git a/modules/web3/helpers/getReadOnlyContracts.ts b/modules/web3/helpers/getReadOnlyContracts.ts index 9b10e8f31..2dee30926 100644 --- a/modules/web3/helpers/getReadOnlyContracts.ts +++ b/modules/web3/helpers/getReadOnlyContracts.ts @@ -7,13 +7,13 @@ SPDX-License-Identifier: AGPL-3.0-or-later */ import { providers } from 'ethers'; -import { getMainnetSdk } from '@dethcrypto/eth-sdk-client'; +import { getMainnetSdk, getTenderlySdk } from '@dethcrypto/eth-sdk-client'; import { SupportedNetworks } from '../constants/networks'; import { EthSdk, SdkGenerators } from '../types/contracts'; const sdkGenerators: SdkGenerators = { mainnet: getMainnetSdk, - tenderly: getMainnetSdk + tenderly: getTenderlySdk }; let currentNetwork: string | undefined;