Skip to content

Commit

Permalink
Merge pull request #944 from AugustoL/fix-double-tx-proposal-decoding
Browse files Browse the repository at this point in the history
Fix double tx proposal decoding
  • Loading branch information
AugustoL authored Dec 5, 2022
2 parents 3923b37 + 9e61535 commit c896bbd
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 23 deletions.
6 changes: 4 additions & 2 deletions src/services/CacheService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1518,7 +1518,8 @@ export default class UtilsService {
transactionReceipt.logs.forEach(log => {
if (
log.topics[0] ===
'0x75b4ff136cc5de5957574c797de3334eb1c141271922b825eb071e0487ba2c5c'
'0x75b4ff136cc5de5957574c797de3334eb1c141271922b825eb071e0487ba2c5c' &&
log.logIndex === creationEvent.logIndex - 1
) {
decodedProposer = web3.eth.abi.decodeParameters(
[
Expand All @@ -1531,7 +1532,8 @@ export default class UtilsService {
}
if (
!creationLogDecoded &&
log.topics[0] === newProposalTopic[0]
log.topics[0] === newProposalTopic[0] &&
log.logIndex === creationEvent.logIndex
) {
creationLogDecoded = web3.eth.abi.decodeParameters(
schemeTypeData.creationLogEncoding[i],
Expand Down
22 changes: 3 additions & 19 deletions src/stores/ConfigStore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import { makeObservable, observable, action } from 'mobx';
import RootContext from '../contexts';

import {
CACHE_METADATA_ENS,
NETWORK_ASSET_SYMBOL,
NETWORK_NAMES,
NETWORK_DISPLAY_NAMES,
Expand Down Expand Up @@ -36,30 +35,15 @@ export default class ConfigStore {
}

async loadNetworkConfig() {
const { ensService, ipfsService } = this.context;
const { ipfsService } = this.context;

this.networkConfig = getAppConfig()[this.getActiveChainName()];
const isTestingEnv = !window?.location?.href?.includes('dxvote.eth');

if (this.getActiveChainName() !== 'localhost' && !this.networkConfigLoaded)
try {
const metadataHash = await ensService.resolveContentHash(
CACHE_METADATA_ENS
);
if (!metadataHash)
throw new Error('Cannot resolve content metadata hash.');

if (!isTestingEnv)
console.debug(
`[ConfigStore] Found metadata content hash from ENS: ${metadataHash}`,
metadataHash
);

const configRefs = isTestingEnv
? getDefaultConfigHashes()
: await ipfsService.getContentFromIPFS(metadataHash);
const configContentHash =
getDefaultConfigHashes()[this.getActiveChainName()];

const configContentHash = configRefs[this.getActiveChainName()];
if (!configContentHash)
throw new Error('Cannot resolve config metadata hash.');

Expand Down
2 changes: 0 additions & 2 deletions src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ export const DEFAULT_TOKEN_DECIMALS = 18;

export const MAX_BLOCKS_PER_EVENTS_FETCH: number = 1000000;

export const CACHE_METADATA_ENS = 'cache.dxvote.eth';

const defaultAlchemyKey = '7i7fiiOx1b7bGmgWY_oI9twyQBCsuXKC';

export const DISCOURSE_URL_ROOT = 'https://daotalk.org';
Expand Down

0 comments on commit c896bbd

Please sign in to comment.