Skip to content

Commit

Permalink
Check for presence of v1 delegate address (#959)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
Co-authored-by: Hector Rodriguez Fornies <[email protected]>
  • Loading branch information
3 people authored Oct 29, 2024
1 parent 13c1d6f commit e8b2534
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 9 deletions.
Original file line number Diff line number Diff line change
@@ -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"}]
3 changes: 2 additions & 1 deletion modules/contracts/eth-sdk.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
9 changes: 7 additions & 2 deletions modules/delegates/helpers/getDelegateContractAddress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ export async function getDelegateContractAddress(
contracts: EthSdk,
address: string
): Promise<string | undefined> {
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;
}
13 changes: 11 additions & 2 deletions modules/migration/delegateAddressLinks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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'
}
};

Expand Down
27 changes: 27 additions & 0 deletions modules/tags/constants/poll-tags-mapping.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
]
}
4 changes: 2 additions & 2 deletions modules/web3/helpers/getContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand All @@ -17,7 +17,7 @@ import { EthSdk, SdkGenerators } from '../types/contracts';

const sdkGenerators: SdkGenerators = {
mainnet: getMainnetSdk,
tenderly: getMainnetSdk
tenderly: getTenderlySdk
};

let connectedAccount: string | undefined;
Expand Down
4 changes: 2 additions & 2 deletions modules/web3/helpers/getReadOnlyContracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit e8b2534

Please sign in to comment.