From 14cf8a42f195065b5a42142cd86fd49d2d9737b7 Mon Sep 17 00:00:00 2001 From: hernandoagf Date: Mon, 28 Oct 2024 19:49:30 -0300 Subject: [PATCH 1/3] Check v1 delegate first --- .../abis/tenderly/voteDelegateFactoryOld.json | 1 + modules/contracts/eth-sdk.config.ts | 1 + .../helpers/getDelegateContractAddress.ts | 7 ++++- modules/tags/constants/poll-tags-mapping.json | 27 +++++++++++++++++++ 4 files changed, 35 insertions(+), 1 deletion(-) 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..1211cfde9 100644 --- a/modules/contracts/eth-sdk.config.ts +++ b/modules/contracts/eth-sdk.config.ts @@ -55,6 +55,7 @@ const config: EthSdkConfig = { pot: '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7', vat: '0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B', voteDelegateFactory: '0xC3D809E87A2C9da4F6d98fECea9135d834d6F5A0', + voteDelegateFactoryOld: '0xD897F108670903D1d6070fcf818f9db3615AF272', voteProxyFactory: '0x6FCD258af181B3221073A96dD90D1f7AE7eEc408', voteProxyFactoryOld: '0xa63E145309cadaa6A903a19993868Ef7E85058BE', vow: '0xA950524441892A31ebddF91d3cEEFa04Bf454466' diff --git a/modules/delegates/helpers/getDelegateContractAddress.ts b/modules/delegates/helpers/getDelegateContractAddress.ts index 323943c49..3d21681e1 100644 --- a/modules/delegates/helpers/getDelegateContractAddress.ts +++ b/modules/delegates/helpers/getDelegateContractAddress.ts @@ -14,5 +14,10 @@ export async function getDelegateContractAddress( address: string ): Promise { const voteDelegateAdress = await contracts.voteDelegateFactory.delegates(address); - return voteDelegateAdress !== ZERO_ADDRESS ? voteDelegateAdress : undefined; + const v1VoteDelegateAddress = await contracts.voteDelegateFactoryOld.delegates(address); + return v1VoteDelegateAddress !== ZERO_ADDRESS + ? v1VoteDelegateAddress + : voteDelegateAdress !== ZERO_ADDRESS + ? voteDelegateAdress + : undefined; } 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 From 7ce6ea265fab1d516af7db948ad0c984cfd6e9a0 Mon Sep 17 00:00:00 2001 From: hernandoagf Date: Tue, 29 Oct 2024 11:21:45 -0300 Subject: [PATCH 2/3] Update Tenderly VDF v2 contract and use Tenderly SDK --- modules/contracts/eth-sdk.config.ts | 2 +- modules/web3/helpers/getContracts.ts | 4 ++-- modules/web3/helpers/getReadOnlyContracts.ts | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/modules/contracts/eth-sdk.config.ts b/modules/contracts/eth-sdk.config.ts index 1211cfde9..c1ad90801 100644 --- a/modules/contracts/eth-sdk.config.ts +++ b/modules/contracts/eth-sdk.config.ts @@ -54,7 +54,7 @@ const config: EthSdkConfig = { pollingOld: '0xF9be8F0945acDdeeDaA64DFCA5Fe9629D0CF8E5D', pot: '0x197E90f9FAD81970bA7976f33CbD77088E5D7cf7', vat: '0x35D1b3F3D7966A1DFe207aa4514C12a259A0492B', - voteDelegateFactory: '0xC3D809E87A2C9da4F6d98fECea9135d834d6F5A0', + voteDelegateFactory: '0x093d305366218d6d09ba10448922f10814b031dd', voteDelegateFactoryOld: '0xD897F108670903D1d6070fcf818f9db3615AF272', voteProxyFactory: '0x6FCD258af181B3221073A96dD90D1f7AE7eEc408', voteProxyFactoryOld: '0xa63E145309cadaa6A903a19993868Ef7E85058BE', 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; From 3d51c5d4e239fbe159350f81e55b2902395e281c Mon Sep 17 00:00:00 2001 From: hernandoagf Date: Tue, 29 Oct 2024 11:30:41 -0300 Subject: [PATCH 3/3] Add test delegate migration --- modules/migration/delegateAddressLinks.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/modules/migration/delegateAddressLinks.ts b/modules/migration/delegateAddressLinks.ts index 769bcc2c0..d72a611e6 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