Skip to content

Commit

Permalink
fix: update dependencies (#83)
Browse files Browse the repository at this point in the history
  • Loading branch information
sakulstra authored Jan 12, 2024
1 parent 9d7a096 commit 830931d
Show file tree
Hide file tree
Showing 20 changed files with 560 additions and 575 deletions.
12 changes: 5 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@
},
"homepage": "https://github.com/bgd-labs/report-engine#readme",
"devDependencies": {
"@types/node-fetch": "^2.6.9",
"@types/object-hash": "^3.0.6",
"tsup": "^7.2.0",
"tsx": "^3.14.0",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
"tsx": "^4.7.0",
"typescript": "^5.3.3",
"vitest": "^1.1.3"
},
"type": "module",
"main": "./dist/index.cjs",
Expand All @@ -51,18 +50,17 @@
"access": "public"
},
"dependencies": {
"@bgd-labs/aave-address-book": "2.10.0",
"@bgd-labs/aave-address-book": "2.15.0",
"@bgd-labs/js-utils": "^1.0.3",
"@commander-js/extra-typings": "^11.1.0",
"@inquirer/prompts": "^3.3.0",
"bs58": "^5.0.0",
"chalk": "^4.1.2",
"commander": "^11.1.0",
"deepmerge": "^4.3.1",
"dotenv": "^16.3.1",
"gray-matter": "^4.0.3",
"ipfs-only-hash": "^4.0.0",
"json-bigint": "^1.0.0",
"node-fetch": "^2.6.9",
"object-hash": "^3.0.0",
"viem": "^1.18.9",
"zod": "^3.22.4"
Expand Down
2 changes: 1 addition & 1 deletion src/commands/fork.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { Command } from '@commander-js/extra-typings';
import { tenderly } from '../utils/tenderlyClient';
import { getGovernance } from '../govv3/governance';
import { CHAIN_ID_CLIENT_MAP } from '../utils/rpcClients';
import { getPayloadsController } from '../govv3/payloadsController';
import { Hex, PublicClient } from 'viem';
import { DEFAULT_GOVERNANCE, DEFAULT_GOVERNANCE_CLIENT } from '../utils/constants';
import { CHAIN_ID_CLIENT_MAP } from '@bgd-labs/js-utils';

export function addCommand(program: Command) {
program
Expand Down
2 changes: 1 addition & 1 deletion src/commands/governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Command } from '@commander-js/extra-typings';
import { simulateProposal } from '../govv3/simulate';
import { IDataWarehouse_ABI, IVotingMachineWithProofs_ABI, IVotingPortal_ABI } from '@bgd-labs/aave-address-book';
import { HUMAN_READABLE_STATE, getGovernance } from '../govv3/governance';
import { CHAIN_ID_CLIENT_MAP } from '../utils/rpcClients';
import { CHAIN_ID_CLIENT_MAP } from '@bgd-labs/js-utils';
import { logError, logInfo, logSuccess } from '../utils/logger';
import { Hex, PublicClient, encodeAbiParameters, encodeFunctionData, getContract } from 'viem';
import { confirm, input, select } from '@inquirer/prompts';
Expand Down
4 changes: 2 additions & 2 deletions src/govv3/generateProposalReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { checkLogs } from './checks/logs';
import { checkTouchedContractsVerifiedEtherscan } from './checks/targetsVerified';
import { Governance, HUMAN_READABLE_STATE } from './governance';
import { checkStateChanges } from './checks/state';
import { getProposalMetadata } from '../ipfs/parseIpfs';
import { getProposalMetadata } from '@bgd-labs/js-utils';

type GenerateReportRequest = {
proposalId: bigint;
Expand Down Expand Up @@ -60,7 +60,7 @@ export async function generateProposalReport({
<summary>Proposal text</summary>
${ipfsMeta.description}
</details>`;
</details>\n\n`;

// check if simulation was successful

Expand Down
6 changes: 3 additions & 3 deletions src/govv3/governance.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
toHex,
} from 'viem';
import merge from 'deepmerge';
import { LogWithTimestamp, getLogs } from '../utils/logs';
import { LogWithTimestamp, getAndCacheLogs } from '../utils/logs';
import {
AaveSafetyModule,
AaveV3Ethereum,
Expand All @@ -27,10 +27,10 @@ import {
} from '../utils/storageSlots';
import { setBits } from '../utils/storageSlots';
import { VOTING_SLOTS, WAREHOUSE_SLOTS, getAccountRPL, getProof } from './proofs';
import { readJSONCache, writeJSONCache } from '../utils/cache';
import { logInfo } from '../utils/logger';
import { GetProofReturnType } from 'viem/_types/actions/public/getProof';
import type { ExtractAbiEvent } from 'abitype';
import { readJSONCache, writeJSONCache } from '@bgd-labs/js-utils';

type CreatedEvent = ExtractAbiEvent<typeof IGovernanceCore_ABI, 'ProposalCreated'>;
type QueuedEvent = ExtractAbiEvent<typeof IGovernanceCore_ABI, 'ProposalQueued'>;
Expand Down Expand Up @@ -193,7 +193,7 @@ export const getGovernance = ({
return {
governanceContract,
async cacheLogs(searchStartBlock) {
const logs = await getLogs(
const logs = await getAndCacheLogs(
publicClient,
[
getAbiItem({ abi: IGovernanceCore_ABI, name: 'ProposalCreated' }),
Expand Down
4 changes: 2 additions & 2 deletions src/govv3/payloadsController.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
getAbiItem,
getContract,
} from 'viem';
import { LogWithTimestamp, getLogs } from '../utils/logs';
import { LogWithTimestamp, getAndCacheLogs } from '../utils/logs';
import { TenderlyRequest, tenderly, TenderlySimulationResponse } from '../utils/tenderlyClient';
import { EOA } from '../utils/constants';
import { getSolidityStorageSlotUint } from '../utils/storageSlots';
Expand Down Expand Up @@ -111,7 +111,7 @@ export const getPayloadsController = (address: Hex, publicClient: PublicClient):
return {
controllerContract,
cacheLogs: async (searchStartBlock) => {
const logs = await getLogs(
const logs = await getAndCacheLogs(
publicClient,
[
getAbiItem({ abi: IPayloadsControllerCore_ABI, name: 'PayloadCreated' }),
Expand Down
10 changes: 7 additions & 3 deletions src/govv3/simulate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { TenderlySimulationResponse } from '../utils/tenderlyClient';
import { getGovernance } from './governance';
import { Hex, PublicClient } from 'viem';
import { PayloadsController, getPayloadsController } from './payloadsController';
import { CHAIN_ID_CLIENT_MAP } from '../utils/rpcClients';
import { CHAIN_ID_CLIENT_MAP } from '@bgd-labs/js-utils';

/**
* Reference implementation, unused
Expand All @@ -29,8 +29,12 @@ export async function simulateProposal(governanceAddress: Hex, publicClient: Pub
);
const logs = await controllerContract.cacheLogs();
const config = await controllerContract.getPayload(payload.payloadId, logs);
const result = await controllerContract.simulatePayloadExecutionOnTenderly(payload.payloadId, config);
payloads.push({ payload: config, simulation: result });
try {
const result = await controllerContract.simulatePayloadExecutionOnTenderly(payload.payloadId, config);
payloads.push({ payload: config, simulation: result });
} catch (e) {
console.log('error simulating payload');
}
}
return { proposal, payloads };
}
2 changes: 0 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
export * from './reports/diff-reports';
export { simulateProposal } from './govv3/simulate';
export { getProposalMetadata } from './ipfs/parseIpfs';
export * from './govv3/governance';
export * from './govv3/payloadsController';
export * from './govv3/generatePayloadReport';
export * from './govv3/generateProposalReport';
export * from './utils/tenderlyClient';
export * from './utils/logger';
export * from './utils/rpcClients';
3 changes: 1 addition & 2 deletions src/ipfs/getCachedProposalMetaData.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { readJSONCache, writeJSONCache } from '../utils/cache';
import { ProposalMetadata, getProposalMetadata } from './parseIpfs';
import { ProposalMetadata, getProposalMetadata, readJSONCache, writeJSONCache } from '@bgd-labs/js-utils';

/**
* Slim caching layer on top of ipfs fetcher to speed up fetching of ipfs data
Expand Down
16 changes: 0 additions & 16 deletions src/ipfs/parseIpfs.spec.ts

This file was deleted.

59 changes: 0 additions & 59 deletions src/ipfs/parseIpfs.ts

This file was deleted.

78 changes: 39 additions & 39 deletions src/reports/__snapshots__/report.spec.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -74,47 +74,47 @@ exports[`report > should generate a well formatted report 1`] = `
\`\`\`json
{
\\"reserves\\": {
\\"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270\\": {
\\"eModeCategory\\": {
\\"from\\": 0,
\\"to\\": 2
"reserves": {
"0x0d500B1d8E8eF31E21C99d1Db9A6444d3ADf1270": {
"eModeCategory": {
"from": 0,
"to": 2
}
},
\\"0x9c2C5fd7b07E95EE044DDeba0E97a665F142394f\\": {
\\"from\\": null,
\\"to\\": {
\\"aToken\\": \\"0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40\\",
\\"aTokenImpl\\": \\"0xa5ba6E5EC19a1Bf23C857991c857dB62b2Aa187B\\",
\\"borrowCap\\": 60000,
\\"borrowingEnabled\\": true,
\\"debtCeiling\\": 0,
\\"decimals\\": 18,
\\"eModeCategory\\": 1,
\\"interestRateStrategy\\": \\"0x03733F4E008d36f2e37F0080fF1c8DF756622E6F\\",
\\"isActive\\": true,
\\"isBorrowableInIsolation\\": false,
\\"isFlashloanable\\": false,
\\"isFrozen\\": false,
\\"isSiloed\\": false,
\\"liquidationBonus\\": 10500,
\\"liquidationProtocolFee\\": 1000,
\\"liquidationThreshold\\": 8600,
\\"ltv\\": 8250,
\\"oracle\\": \\"0x443C5116CdF663Eb387e72C688D276e702135C87\\",
\\"oracleDecimals\\": 8,
\\"oracleDescription\\": \\"1INCH / USD\\",
\\"oracleLatestAnswer\\": 52690564,
\\"reserveFactor\\": 1000,
\\"stableBorrowRateEnabled\\": false,
\\"stableDebtToken\\": \\"0x173e54325AE58B072985DbF232436961981EA000\\",
\\"stableDebtTokenImpl\\": \\"0x52A1CeB68Ee6b7B5D13E0376A1E0E4423A8cE26e\\",
\\"supplyCap\\": 85000,
\\"symbol\\": \\"1INCH\\",
\\"underlying\\": \\"0x9c2C5fd7b07E95EE044DDeba0E97a665F142394f\\",
\\"usageAsCollateralEnabled\\": true,
\\"variableDebtToken\\": \\"0x77fA66882a8854d883101Fb8501BD3CaD347Fc32\\",
\\"variableDebtTokenImpl\\": \\"0x81387c40EB75acB02757C1Ae55D5936E78c9dEd3\\"
"0x9c2C5fd7b07E95EE044DDeba0E97a665F142394f": {
"from": null,
"to": {
"aToken": "0xf59036CAEBeA7dC4b86638DFA2E3C97dA9FcCd40",
"aTokenImpl": "0xa5ba6E5EC19a1Bf23C857991c857dB62b2Aa187B",
"borrowCap": 60000,
"borrowingEnabled": true,
"debtCeiling": 0,
"decimals": 18,
"eModeCategory": 1,
"interestRateStrategy": "0x03733F4E008d36f2e37F0080fF1c8DF756622E6F",
"isActive": true,
"isBorrowableInIsolation": false,
"isFlashloanable": false,
"isFrozen": false,
"isSiloed": false,
"liquidationBonus": 10500,
"liquidationProtocolFee": 1000,
"liquidationThreshold": 8600,
"ltv": 8250,
"oracle": "0x443C5116CdF663Eb387e72C688D276e702135C87",
"oracleDecimals": 8,
"oracleDescription": "1INCH / USD",
"oracleLatestAnswer": 52690564,
"reserveFactor": 1000,
"stableBorrowRateEnabled": false,
"stableDebtToken": "0x173e54325AE58B072985DbF232436961981EA000",
"stableDebtTokenImpl": "0x52A1CeB68Ee6b7B5D13E0376A1E0E4423A8cE26e",
"supplyCap": 85000,
"symbol": "1INCH",
"underlying": "0x9c2C5fd7b07E95EE044DDeba0E97a665F142394f",
"usageAsCollateralEnabled": true,
"variableDebtToken": "0x77fA66882a8854d883101Fb8501BD3CaD347Fc32",
"variableDebtTokenImpl": "0x81387c40EB75acB02757C1Ae55D5936E78c9dEd3"
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/reports/reserve.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Hex, formatUnits } from 'viem';
import { AaveV3Reserve, CHAIN_ID } from './snapshot-types';
import { toAddressLink } from '../govv3/utils/markdownUtils';
import { CHAIN_ID_CLIENT_MAP } from '../utils/rpcClients';
import { CHAIN_ID_CLIENT_MAP } from '@bgd-labs/js-utils';

export function renderReserveValue<T extends keyof AaveV3Reserve>(key: T, reserve: AaveV3Reserve, chainId: CHAIN_ID) {
if (['reserveFactor', 'liquidationProtocolFee', 'liquidationThreshold', 'ltv'].includes(key))
Expand Down
28 changes: 0 additions & 28 deletions src/utils/cache.ts

This file was deleted.

2 changes: 1 addition & 1 deletion src/utils/constants.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { GovernanceV3Ethereum } from '@bgd-labs/aave-address-book';
import { mainnetClient } from './rpcClients';
import { mainnetClient } from '@bgd-labs/js-utils';

// arbitrary from EOA for proposal executions
export const EOA = '0xD73a92Be73EfbFcF3854433A5FcbAbF9c1316073' as const;
Expand Down
16 changes: 0 additions & 16 deletions src/utils/logs.spec.ts

This file was deleted.

Loading

0 comments on commit 830931d

Please sign in to comment.