diff --git a/.assets/25f9cbdfc80fe1053a3498957e9ebcc43204ca2e.svg b/.assets/25f9cbdfc80fe1053a3498957e9ebcc43204ca2e.svg new file mode 100644 index 0000000..87c395c --- /dev/null +++ b/.assets/25f9cbdfc80fe1053a3498957e9ebcc43204ca2e.svg @@ -0,0 +1 @@ + Borrow APR, variableBorrow APR, stable0%25%50%75%100%0%20%40%60%80%Optimal utilization 45%Optimal utilization 45% \ No newline at end of file diff --git a/.assets/c95444425ee9452f419610e3fd51b1682c09f4e7.svg b/.assets/c95444425ee9452f419610e3fd51b1682c09f4e7.svg new file mode 100644 index 0000000..87c395c --- /dev/null +++ b/.assets/c95444425ee9452f419610e3fd51b1682c09f4e7.svg @@ -0,0 +1 @@ + Borrow APR, variableBorrow APR, stable0%25%50%75%100%0%20%40%60%80%Optimal utilization 45%Optimal utilization 45% \ No newline at end of file diff --git a/package.json b/package.json index 3a4e41f..37b3503 100644 --- a/package.json +++ b/package.json @@ -57,21 +57,21 @@ "access": "public" }, "dependencies": { - "@bgd-labs/aave-address-book": "^2.25.1", - "@bgd-labs/aave-v3-governance-cache": "^0.0.13", - "@bgd-labs/js-utils": "^1.3.0", + "@bgd-labs/aave-address-book": "^3.0.0", + "@bgd-labs/aave-v3-governance-cache": "^1.0.6", + "@bgd-labs/js-utils": "^1.4.2", "@commander-js/extra-typings": "^11.1.0", "@inquirer/prompts": "^3.3.2", "chalk": "^4.1.2", "commander": "^11.1.0", "deepmerge": "^4.3.1", "dotenv": "^16.4.1", - "find-object-paths": "^1.0.2", + "find-object-paths": "^1.1.0", "gray-matter": "^4.0.3", "ipfs-only-hash": "^4.0.0", "json-bigint": "^1.0.0", "object-hash": "^3.0.0", - "viem": "^2.9.20", - "zod": "^3.22.4" + "viem": "^2.17.11", + "zod": "^3.23.8" } } diff --git a/src/commands/governance.ts b/src/commands/governance.ts index fc5ef9e..e827ed3 100644 --- a/src/commands/governance.ts +++ b/src/commands/governance.ts @@ -18,7 +18,11 @@ import {getCachedIpfs} from '../ipfs/getCachedProposalMetaData'; import {DEFAULT_GOVERNANCE, DEFAULT_GOVERNANCE_CLIENT, FORMAT} from '../utils/constants'; import {logError, logInfo, logSuccess} from '../utils/logger'; import {getBlock} from 'viem/actions'; -import {localCacheAdapter} from '@bgd-labs/aave-v3-governance-cache/localCache'; +import {customStorageProvider} from '@bgd-labs/aave-v3-governance-cache/customStorageProvider'; +import {fileSystemStorageAdapter} from '@bgd-labs/aave-v3-governance-cache/fileSystemStorageAdapter'; + +const localCacheAdapter = customStorageProvider(fileSystemStorageAdapter); + import {refreshCache} from '@bgd-labs/aave-v3-governance-cache/refreshCache'; enum DialogOptions { diff --git a/src/govv3/__snapshots__/generatePayloadReport.spec.ts.snap b/src/govv3/__snapshots__/generatePayloadReport.spec.ts.snap index 5706b2e..989e505 100644 --- a/src/govv3/__snapshots__/generatePayloadReport.spec.ts.snap +++ b/src/govv3/__snapshots__/generatePayloadReport.spec.ts.snap @@ -38,7 +38,7 @@ Dai (Dai) at \`0x6B175474E89094C44Da98b954EedeAC495271d0F\`[:ghost:](https://git + 115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457.5840 [115792089237316195423570985008687907853269984665640564039457584007913129639935, 18 decimals] \`\`\` -InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\` \`\`\`diff @@ \`_reserves\` key \`0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (symbol: USDC).liquidityIndex\` @@ - 1.1259 [1125972900043692179606694722, 27 decimals] @@ -187,7 +187,7 @@ TetherToken (Tether) at \`0xdAC17F958D2ee523a2206206994597C13D831ec7\`[:ghost:]( - InitializableImmutableAdminUpgradeabilityProxy at \`0xd784927Ff2f95ba542BfC824c8a8a98F3495f6b5\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.DEFAULT_INCENTIVES_CONTROLLER") - \`UserIndexUpdated(user: 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a, asset: 0xbcca60bb61934080951369a648fb03df4f96263c (symbol: aUSDC), index: 35777739039773953913685859)\` -- InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +- InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\` - \`ReserveUsedAsCollateralEnabled(reserve: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (symbol: USDC), user: 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a)\` - \`ReserveDataUpdated(reserve: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (symbol: USDC), liquidityRate: 123029815053899026525991182, stableBorrowRate: 230113117017905438863598858, variableBorrowRate: 180113117017905438863598858, liquidityIndex: 1.1259 [1125991030272021514250652312, 27 decimals], variableBorrowIndex: 1.1850 [1185097276944910539318953337, 27 decimals])\` - \`ReserveUsedAsCollateralDisabled(reserve: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (symbol: USDC), user: 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a)\` @@ -236,7 +236,7 @@ TetherToken (Tether) at \`0xdAC17F958D2ee523a2206206994597C13D831ec7\`[:ghost:]( - TransparentUpgradeableProxy at \`0x3ea64b1C0194524b48F9118462C8E9cd61a243c7\`[:ghost:](https://github.com/bgd-labs/aave-address-book "MiscEthereum.AAVE_SWAPPER") with implementation AaveSwapper at \`0x0bbdB9a4657912d7a4b198310397EF178DBa0893\` - \`SwapRequested(milkman: 0x11c76ad590abdffcd980afec9ad951b160f02797, fromToken: 0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (symbol: USDC), toToken: 0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f (symbol: GHO), fromOracle: 0x8fffffd4afb6115b954bd326cbe7b4ba576818f6, toOracle: 0x3f12643d3f6f874d39c2a4c9f2cd6f2dbac877fc, amount: 1000000000000, recipient: 0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c, slippage: 100)\` - \`SwapRequested(milkman: 0x11c76ad590abdffcd980afec9ad951b160f02797, fromToken: 0x6b175474e89094c44da98b954eedeac495271d0f (symbol: DAI), toToken: 0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f (symbol: GHO), fromOracle: 0xaed0c38402a5d19df6e4c03f4e2dced6e29c1ee9, toOracle: 0x3f12643d3f6f874d39c2a4c9f2cd6f2dbac877fc, amount: 500000000000000000000000, recipient: 0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c, slippage: 100)\` -- Executor at \`0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") +- Executor at \`0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, AaveV3EthereumLido.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") - \`ExecutedAction(target: 0x1f5cd22582b4cd85ff8382fd40b88776470c38fc, value: 0, signature: execute(), data: 0x, executionTime: 1705401311, withDelegatecall: true, resultData: 0x)\` - TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:ghost:](https://github.com/bgd-labs/aave-address-book "GovernanceV3Ethereum.PAYLOADS_CONTROLLER") with implementation PayloadsController at \`0x7222182cB9c5320587b5148BF03eeE107AD64578\` - \`PayloadExecuted(payloadId: 46)\` @@ -254,12 +254,12 @@ TetherToken (Tether) at \`0xdAC17F958D2ee523a2206206994597C13D831ec7\`[:ghost:]( - 0xd73a92be73efbfcf3854433a5fcbabf9c1316073: EOA (verification not applicable) - 0xdabad81af85554e9ae636395611c58f7ec1aaec5: Contract (verified) (TransparentUpgradeableProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "GovernanceV3Ethereum.PAYLOADS_CONTROLLER") - 0x7222182cb9c5320587b5148bf03eee107ad64578: Contract (verified) (PayloadsController) -- 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a: Contract (verified) (Executor) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") +- 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a: Contract (verified) (Executor) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, AaveV3EthereumLido.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") - 0x1f5cd22582b4cd85ff8382fd40b88776470c38fc: Contract (not verified) - 0xbcca60bb61934080951369a648fb03df4f96263c: Contract (verified) (InitializableImmutableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.USDC.A_TOKEN") - 0x1c050bca8babe53ef769d0d2e411f556e1a27e7b: Contract (verified) (AToken) - 0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9: Contract (verified) (InitializableImmutableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") -- 0x085e34722e04567df9e6d2c32e82fd74f3342e79: Contract (verified) (LendingPool) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +- 0x085e34722e04567df9e6d2c32e82fd74f3342e79: Contract (verified) (LendingPool) - 0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c: Contract (verified) (InitializableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.COLLECTOR, AaveV2EthereumAMM.COLLECTOR, AaveV2EthereumArc.COLLECTOR, AaveV3Ethereum.COLLECTOR") - 0x80f2c02224a2e548fc67c0bf705ebfa825dd5439: Contract (verified) (Collector) - 0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5: Contract (verified) (InitializableImmutableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.DEFAULT_INCENTIVES_CONTROLLER") @@ -314,10 +314,10 @@ TetherToken (Tether) at \`0xdAC17F958D2ee523a2206206994597C13D831ec7\`[:ghost:]( - [0xd73a92be73efbfcf3854433a5fcbabf9c1316073](https://etherscan.io/address/0xd73a92be73efbfcf3854433a5fcbabf9c1316073): EOA (may have code later) - [0xdabad81af85554e9ae636395611c58f7ec1aaec5](https://etherscan.io/address/0xdabad81af85554e9ae636395611c58f7ec1aaec5): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "GovernanceV3Ethereum.PAYLOADS_CONTROLLER") -- [0x5300a1a15135ea4dc7ad5a167152c01efc9b192a](https://etherscan.io/address/0x5300a1a15135ea4dc7ad5a167152c01efc9b192a): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") +- [0x5300a1a15135ea4dc7ad5a167152c01efc9b192a](https://etherscan.io/address/0x5300a1a15135ea4dc7ad5a167152c01efc9b192a): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, AaveV3EthereumLido.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") - [0xbcca60bb61934080951369a648fb03df4f96263c](https://etherscan.io/address/0xbcca60bb61934080951369a648fb03df4f96263c): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.USDC.A_TOKEN") - [0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9](https://etherscan.io/address/0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") -- [0x085e34722e04567df9e6d2c32e82fd74f3342e79](https://etherscan.io/address/0x085e34722e04567df9e6d2c32e82fd74f3342e79): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +- [0x085e34722e04567df9e6d2c32e82fd74f3342e79](https://etherscan.io/address/0x085e34722e04567df9e6d2c32e82fd74f3342e79): Contract (with DELEGATECALL) - [0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c](https://etherscan.io/address/0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.COLLECTOR, AaveV2EthereumAMM.COLLECTOR, AaveV2EthereumArc.COLLECTOR, AaveV3Ethereum.COLLECTOR") - [0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5](https://etherscan.io/address/0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.DEFAULT_INCENTIVES_CONTROLLER") - [0xb53c1a33016b2dc2ff3653530bff1848a515c8c5](https://etherscan.io/address/0xb53c1a33016b2dc2ff3653530bff1848a515c8c5): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADDRESSES_PROVIDER") @@ -525,7 +525,7 @@ InitializableAdminUpgradeabilityProxy at \`0x464C71f6c2F760DdA6093dCB91C24c39e5d + true \`\`\` -InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\` \`\`\`diff @@ \`_usersConfig\` key \`0xb812d0944f8f581dfaa3a93dda0d22ecef51a9cf.data\` @@ - 0 @@ -583,7 +583,7 @@ TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:g - InitializableAdminUpgradeabilityProxy (Aave) at \`0x7Fc66500c84A76Ad7e9c93437bFc5Ac33E2DDaE9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.AAVE.UNDERLYING, AaveV3Ethereum.ASSETS.AAVE.UNDERLYING") with implementation AaveTokenV3 at \`0x5D4Aa78B08Bc7C530e21bf7447988b1Be7991322\` - \`Transfer(from: 0x25f2226b597e8f9514b3f68f00f494cf4f286491, to: 0xb812d0944f8f581dfaa3a93dda0d22ecef51a9cf, value: 6,000 [6000000000000000000000, 18 decimals])\` -- InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +- InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\` - \`ReserveUsedAsCollateralEnabled(reserve: 0xdac17f958d2ee523a2206206994597c13d831ec7 (symbol: USDT), user: 0xb812d0944f8f581dfaa3a93dda0d22ecef51a9cf)\` - InitializableImmutableAdminUpgradeabilityProxy (Aave USDT) at \`0x3Ed3B47Dd13EC9a98b44e6204A523E766B225811\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.USDT.A_TOKEN") - \`BalanceTransfer(from: 0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c, to: 0xb812d0944f8f581dfaa3a93dda0d22ecef51a9cf, value: 960,000 [960000000000, 6 decimals], index: 1169527841491193591052135070)\` @@ -601,7 +601,7 @@ TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:g - InitializableAdminUpgradeabilityProxy at \`0x464C71f6c2F760DdA6093dCB91C24c39e5d6e18c\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.COLLECTOR, AaveV2EthereumAMM.COLLECTOR, AaveV2EthereumArc.COLLECTOR, AaveV3Ethereum.COLLECTOR") with implementation Collector at \`0x80f2c02224a2E548FC67c0bF705eBFA825dd5439\` - \`CreateStream(streamId: 100030, sender: 0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c, recipient: 0xb812d0944f8f581dfaa3a93dda0d22ecef51a9cf, deposit: 639999999999999988992000, tokenAddress: 0x40d16fc0246ad3160ccc09b8d0d3a2cd28ae6c2f, startTime: 1711922843, stopTime: 1727474843)\` - \`CreateStream(streamId: 100031, sender: 0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c, recipient: 0xb812d0944f8f581dfaa3a93dda0d22ecef51a9cf, deposit: 1140000000000, tokenAddress: 0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c, startTime: 1722290843, stopTime: 1722290844)\` -- Executor at \`0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") +- Executor at \`0x5300A1a15135EA4dc7aD5a167152C01EFc9b192A\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, AaveV3EthereumLido.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") - \`ExecutedAction(target: 0x97b53cd563da629640f55821189452315c05f177, value: 0, signature: execute(), data: 0x, executionTime: 1711922843, withDelegatecall: true, resultData: 0x)\` - TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:ghost:](https://github.com/bgd-labs/aave-address-book "GovernanceV3Ethereum.PAYLOADS_CONTROLLER") with implementation PayloadsController at \`0x7222182cB9c5320587b5148BF03eeE107AD64578\` - \`PayloadExecuted(payloadId: 87)\` @@ -629,7 +629,7 @@ TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:g - 0x365d47ced3d7eb6a9bdb3814aa23cc06b2d33ef8: Contract (verified) (ExecutionChainRobotKeeper) - 0xdabad81af85554e9ae636395611c58f7ec1aaec5: Contract (verified) (TransparentUpgradeableProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "GovernanceV3Ethereum.PAYLOADS_CONTROLLER") - 0x7222182cb9c5320587b5148bf03eee107ad64578: Contract (verified) (PayloadsController) -- 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a: Contract (verified) (Executor) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") +- 0x5300a1a15135ea4dc7ad5a167152c01efc9b192a: Contract (verified) (Executor) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, AaveV3EthereumLido.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") - 0x97b53cd563da629640f55821189452315c05f177: Contract (verified) (AaveV3Ethereum_AaveBGDPhase3_20240325) - 0x3d569673daa0575c936c7c67c4e6aeda69cc630c: Contract (verified) (AaveEcosystemReserveController) [:ghost:](https://github.com/bgd-labs/aave-address-book "MiscEthereum.AAVE_ECOSYSTEM_RESERVE_CONTROLLER") - 0x25f2226b597e8f9514b3f68f00f494cf4f286491: Contract (verified) (InitializableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "MiscEthereum.ECOSYSTEM_RESERVE") @@ -641,7 +641,7 @@ TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:g - 0x3ed3b47dd13ec9a98b44e6204a523e766b225811: Contract (verified) (InitializableImmutableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.USDT.A_TOKEN") - 0x9651f64bd77550691eb2aeeb58188cb67f005902: Contract (verified) (AToken) - 0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9: Contract (verified) (InitializableImmutableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") -- 0x085e34722e04567df9e6d2c32e82fd74f3342e79: Contract (verified) (LendingPool) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +- 0x085e34722e04567df9e6d2c32e82fd74f3342e79: Contract (verified) (LendingPool) - 0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5: Contract (verified) (InitializableImmutableAdminUpgradeabilityProxy) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.DEFAULT_INCENTIVES_CONTROLLER") - 0xd9ed413bcf58c266f95fe6ba63b13cf79299ce31: Contract (verified) (StakedTokenIncentivesController) - 0xb53c1a33016b2dc2ff3653530bff1848a515c8c5: Contract (verified) (LendingPoolAddressesProvider) [:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADDRESSES_PROVIDER") @@ -665,13 +665,13 @@ TransparentUpgradeableProxy at \`0xdAbad81aF85554E9ae636395611C58F7eC1aAEc5\`[:g #### Warnings - [0xdabad81af85554e9ae636395611c58f7ec1aaec5](https://etherscan.io/address/0xdabad81af85554e9ae636395611c58f7ec1aaec5): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "GovernanceV3Ethereum.PAYLOADS_CONTROLLER") -- [0x5300a1a15135ea4dc7ad5a167152c01efc9b192a](https://etherscan.io/address/0x5300a1a15135ea4dc7ad5a167152c01efc9b192a): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") +- [0x5300a1a15135ea4dc7ad5a167152c01efc9b192a](https://etherscan.io/address/0x5300a1a15135ea4dc7ad5a167152c01efc9b192a): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADMIN, AaveV2EthereumAMM.POOL_ADMIN, AaveV3Ethereum.ACL_ADMIN, AaveV3EthereumLido.ACL_ADMIN, GovernanceV3Ethereum.EXECUTOR_LVL_1") - [0x25f2226b597e8f9514b3f68f00f494cf4f286491](https://etherscan.io/address/0x25f2226b597e8f9514b3f68f00f494cf4f286491): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "MiscEthereum.ECOSYSTEM_RESERVE") - [0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9](https://etherscan.io/address/0x7fc66500c84a76ad7e9c93437bfc5ac33e2ddae9): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.AAVE.UNDERLYING, AaveV3Ethereum.ASSETS.AAVE.UNDERLYING") - [0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c](https://etherscan.io/address/0x464c71f6c2f760dda6093dcb91c24c39e5d6e18c): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.COLLECTOR, AaveV2EthereumAMM.COLLECTOR, AaveV2EthereumArc.COLLECTOR, AaveV3Ethereum.COLLECTOR") - [0x3ed3b47dd13ec9a98b44e6204a523e766b225811](https://etherscan.io/address/0x3ed3b47dd13ec9a98b44e6204a523e766b225811): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.ASSETS.USDT.A_TOKEN") - [0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9](https://etherscan.io/address/0x7d2768de32b0b80b7a3454c06bdac94a69ddc7a9): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") -- [0x085e34722e04567df9e6d2c32e82fd74f3342e79](https://etherscan.io/address/0x085e34722e04567df9e6d2c32e82fd74f3342e79): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +- [0x085e34722e04567df9e6d2c32e82fd74f3342e79](https://etherscan.io/address/0x085e34722e04567df9e6d2c32e82fd74f3342e79): Contract (with DELEGATECALL) - [0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5](https://etherscan.io/address/0xd784927ff2f95ba542bfc824c8a8a98f3495f6b5): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.DEFAULT_INCENTIVES_CONTROLLER") - [0xb53c1a33016b2dc2ff3653530bff1848a515c8c5](https://etherscan.io/address/0xb53c1a33016b2dc2ff3653530bff1848a515c8c5): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_ADDRESSES_PROVIDER") - [0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c](https://etherscan.io/address/0x98c23e9d8f34fefb1b7bd6a91b7ff122f4e16f5c): Contract (with DELEGATECALL)[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV3Ethereum.ASSETS.USDC.A_TOKEN") diff --git a/src/govv3/checks/__snapshots__/state.spec.ts.snap b/src/govv3/checks/__snapshots__/state.spec.ts.snap index 9ed0a90..df136e1 100644 --- a/src/govv3/checks/__snapshots__/state.spec.ts.snap +++ b/src/govv3/checks/__snapshots__/state.spec.ts.snap @@ -28,7 +28,7 @@ Dai (Dai) at \`0x6B175474E89094C44Da98b954EedeAC495271d0F\`[:ghost:](https://git + 115,792,089,237,316,195,423,570,985,008,687,907,853,269,984,665,640,564,039,457.5840 [115792089237316195423570985008687907853269984665640564039457584007913129639935, 18 decimals] \`\`\` -InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\` \`\`\`diff @@ \`_reserves\` key \`0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48 (symbol: USDC).liquidityIndex\` @@ - 1.1259 [1125972900043692179606694722, 27 decimals] @@ -180,7 +180,7 @@ exports[`state check > should correctly render state diff for config change 1`] "errors": [], "info": [ " -InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL_IMPL") +InitializableImmutableAdminUpgradeabilityProxy at \`0x7d2768dE32b0b80b7a3454c06BdAc94A69DDc7A9\`[:ghost:](https://github.com/bgd-labs/aave-address-book "AaveV2Ethereum.POOL") with implementation LendingPool at \`0x085E34722e04567Df9E6d2c32e82fd74f3342e79\` \`\`\`diff @@ \`_reserves\` key \`0x0000000000085d4780b73119b644ae5ecd22b376 (symbol: TUSD).configuration.data\` @@ - 184283194582935181459456 diff --git a/src/govv3/generatePayloadReport.spec.ts b/src/govv3/generatePayloadReport.spec.ts index 0b5569d..d644168 100644 --- a/src/govv3/generatePayloadReport.spec.ts +++ b/src/govv3/generatePayloadReport.spec.ts @@ -6,8 +6,10 @@ import {STREAM_PAYLOAD} from './mocks/streamPayload'; import {findPayloadsController} from './utils/checkAddress'; import {getPayloadsController} from './payloadsController'; import {Address} from 'viem'; -import {localCacheAdapter} from '@bgd-labs/aave-v3-governance-cache/localCache'; +import {customStorageProvider} from '@bgd-labs/aave-v3-governance-cache/customStorageProvider'; +import {fileSystemStorageAdapter} from '@bgd-labs/aave-v3-governance-cache/fileSystemStorageAdapter'; +const localCacheAdapter = customStorageProvider(fileSystemStorageAdapter); /** * Tenderly simulation results are insanely huge, so we're removing some stuff we don't need * @param mockData diff --git a/src/govv3/simulate.ts b/src/govv3/simulate.ts index 4424395..330c44f 100644 --- a/src/govv3/simulate.ts +++ b/src/govv3/simulate.ts @@ -6,10 +6,12 @@ import {generateReport} from './generatePayloadReport'; import {generateProposalReport} from './generateProposalReport'; import {getGovernance} from './governance'; import {getPayloadsController} from './payloadsController'; -import {localCacheAdapter} from '@bgd-labs/aave-v3-governance-cache/localCache'; import {refreshCache} from '@bgd-labs/aave-v3-governance-cache/refreshCache'; import {GetPayloadReturnType} from '@bgd-labs/aave-v3-governance-cache'; +import {customStorageProvider} from '@bgd-labs/aave-v3-governance-cache/customStorageProvider'; +import {fileSystemStorageAdapter} from '@bgd-labs/aave-v3-governance-cache/fileSystemStorageAdapter'; +const localCacheAdapter = customStorageProvider(fileSystemStorageAdapter); /** * Reference implementation, unused * @param governanceAddress diff --git a/src/reports/__snapshots__/adi-diff-report.spec.ts.snap b/src/reports/__snapshots__/adi-diff-report.spec.ts.snap new file mode 100644 index 0000000..024c323 --- /dev/null +++ b/src/reports/__snapshots__/adi-diff-report.spec.ts.snap @@ -0,0 +1,30 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`adi report > should generate a well formatted adi report 1`] = ` +"## Raw diff + +\`\`\`json +{ + "forwarderAdaptersByChain": { + "1": { + "destination_3": { + "from": "0xb13712De579E1f9943502FFCf72eab6ec348cF79", + "to": "0x1562F1b2487F892BBA8Ef325aF054Fd157510a71" + }, + "origin_3": { + "from": "0xb13712De579E1f9943502FFCf72eab6ec348cF79", + "to": "0x853649f897383f89d8441346Cf26a9ed02720B02" + } + } + }, + "receiverAdaptersByChain": { + "1": { + "receiver_3": { + "from": "0xb13712De579E1f9943502FFCf72eab6ec348cF79", + "to": "0x853649f897383f89d8441346Cf26a9ed02720B02" + } + } + } +} +\`\`\`" +`; diff --git a/src/reports/__snapshots__/diff.spec.ts.snap b/src/reports/__snapshots__/diff.spec.ts.snap new file mode 100644 index 0000000..b8f169c --- /dev/null +++ b/src/reports/__snapshots__/diff.spec.ts.snap @@ -0,0 +1,301 @@ +// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html + +exports[`diff > should find all the changes 1`] = ` +{ + "reserves": { + "0x0b3F868E0BE5597D5DB7fEB59E1CADBb0fdDa50a": { + "currentLiquidityRate": { + "from": 1.3415266124935912e+22, + "to": 1.3515266124935913e+22, + }, + "currentVariableBorrowRate": { + "from": 1.6150925573283835e+24, + "to": 1.7150925573283834e+24, + }, + "liquidityIndex": { + "from": 1.0030723628446084e+27, + "to": 1.1020723628446084e+27, + }, + "variableBorrowIndex": { + "from": 1.0191200042968116e+27, + "to": 1.0211200042968116e+27, + }, + }, + "0x385Eeac5cB85A38A9a07A70c73e0a3271CfB54A7": { + "reserveFactor": { + "from": 2000, + "to": 3500, + }, + }, + "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619": { + "interestRateStrategy": { + "from": "0x03733F4E008d36f2e37F0080fF1c8DF756622E6F", + "to": "0x27eFE5db315b71753b2a38ED3d5dd7E9362ba93F", + }, + "reserveFactor": { + "from": 1000, + "to": 1500, + }, + }, + "0x85955046DF4668e1DD369D2DE9f3AEB98DD2A369": { + "reserveFactor": { + "from": 2000, + "to": 3500, + }, + }, + "0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4": { + "interestRateStrategy": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + }, + "0xE111178A87A3BFf0c8d18DECBa5798827539Ae99": { + "interestRateStrategy": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + }, + "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1": { + "interestRateStrategy": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + "reserveFactor": { + "from": 1000, + "to": 2000, + }, + }, + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F": { + "interestRateStrategy": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + }, + }, + "strategies": { + "0x7ceB23fD6bC0adD59E62ac25578270cFf1b9f619": { + "address": { + "from": "0x03733F4E008d36f2e37F0080fF1c8DF756622E6F", + "to": "0x27eFE5db315b71753b2a38ED3d5dd7E9362ba93F", + }, + "baseStableBorrowRate": { + "from": 9e+25, + "to": 6.8e+25, + }, + "baseVariableBorrowRate": { + "from": 0, + "to": 1e+25, + }, + "maxExcessUsageRatio": { + "from": 5.5e+26, + "to": 2e+26, + }, + "optimalUsageRatio": { + "from": 4.5e+26, + "to": 8e+26, + }, + "stableRateSlope1": { + "from": 0, + "to": 4e+25, + }, + "stableRateSlope2": { + "from": 0, + "to": 8e+26, + }, + "variableRateSlope1": { + "from": 7e+25, + "to": 3.8e+25, + }, + "variableRateSlope2": { + "from": 3e+27, + "to": 8e+26, + }, + }, + "0xE0B52e49357Fd4DAf2c15e02058DCE6BC0057db4": { + "address": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + "maxExcessUsageRatio": { + "from": 1e+26, + "to": 2e+26, + }, + "optimalUsageRatio": { + "from": 9e+26, + "to": 8e+26, + }, + "stableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + "variableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + }, + "0xE111178A87A3BFf0c8d18DECBa5798827539Ae99": { + "address": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + "maxExcessUsageRatio": { + "from": 1e+26, + "to": 2e+26, + }, + "optimalUsageRatio": { + "from": 9e+26, + "to": 8e+26, + }, + "stableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + "variableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + }, + "0xa3Fa99A148fA48D14Ed51d610c367C61876997F1": { + "address": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + "maxExcessUsageRatio": { + "from": 1e+26, + "to": 2e+26, + }, + "optimalUsageRatio": { + "from": 9e+26, + "to": 8e+26, + }, + "stableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + "variableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + }, + "0xc2132D05D31c914a87C6611C10748AEb04B58e8F": { + "address": { + "from": "0x41B66b4b6b4c9dab039d96528D1b88f7BAF8C5A4", + "to": "0xA9F3C3caE095527061e6d270DBE163693e6fda9D", + }, + "maxExcessUsageRatio": { + "from": 1e+26, + "to": 2e+26, + }, + "optimalUsageRatio": { + "from": 9e+26, + "to": 8e+26, + }, + "stableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + "variableRateSlope2": { + "from": 6e+26, + "to": 7.5e+26, + }, + }, + }, +} +`; + +exports[`diff > should find all the changes 2`] = ` +{ + "reserves": { + "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0": { + "address": { + "from": null, + "to": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + }, + "baseVariableBorrowRate": { + "from": null, + "to": "0", + }, + "maxVariableBorrowRate": { + "from": null, + "to": "640000000000000000000000000", + }, + "optimalUsageRatio": { + "from": null, + "to": "450000000000000000000000000", + }, + "variableRateSlope1": { + "from": null, + "to": "40000000000000000000000000", + }, + "variableRateSlope2": { + "from": null, + "to": "600000000000000000000000000", + }, + }, + "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f": { + "address": { + "from": null, + "to": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + }, + "baseVariableBorrowRate": { + "from": null, + "to": "0", + }, + "maxVariableBorrowRate": { + "from": null, + "to": "640000000000000000000000000", + }, + "optimalUsageRatio": { + "from": null, + "to": "450000000000000000000000000", + }, + "variableRateSlope1": { + "from": null, + "to": "40000000000000000000000000", + }, + "variableRateSlope2": { + "from": null, + "to": "600000000000000000000000000", + }, + }, + "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac": { + "address": { + "from": null, + "to": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + }, + "baseVariableBorrowRate": { + "from": null, + "to": "0", + }, + "liquidationBonus": { + "from": 10500, + "to": 11100, + }, + "liquidationThreshold": { + "from": 8600, + "to": 9000, + }, + "ltv": { + "from": 8250, + "to": 6200, + }, + "maxVariableBorrowRate": { + "from": null, + "to": "640000000000000000000000000", + }, + "optimalUsageRatio": { + "from": null, + "to": "450000000000000000000000000", + }, + "variableRateSlope1": { + "from": null, + "to": "40000000000000000000000000", + }, + "variableRateSlope2": { + "from": null, + "to": "600000000000000000000000000", + }, + }, + }, +} +`; diff --git a/src/reports/__snapshots__/report.spec.ts.snap b/src/reports/__snapshots__/report.spec.ts.snap index 335b080..f5e1811 100644 --- a/src/reports/__snapshots__/report.spec.ts.snap +++ b/src/reports/__snapshots__/report.spec.ts.snap @@ -295,3 +295,147 @@ exports[`report > should generate a well formatted report 1`] = ` } \`\`\`" `; + +exports[`report > should generate a well formatted report for 3.1 1`] = ` +"## Reserve changes + +### Reserve altered + +#### WBTC (0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0) + +| description | value before | value after | +| --- | --- | --- | +| address | null | 0xF9514C867b37D36a5affB003582b1818dA3870eb | +| baseVariableBorrowRate | null | 0 | +| maxVariableBorrowRate | null | 640000000000000000000000000 | +| optimalUsageRatio | null | 450000000000000000000000000 | +| variableRateSlope1 | null | 40000000000000000000000000 | +| variableRateSlope2 | null | 600000000000000000000000000 | + + +#### WETH (0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f) + +| description | value before | value after | +| --- | --- | --- | +| address | null | 0xF9514C867b37D36a5affB003582b1818dA3870eb | +| baseVariableBorrowRate | null | 0 | +| maxVariableBorrowRate | null | 640000000000000000000000000 | +| optimalUsageRatio | null | 450000000000000000000000000 | +| variableRateSlope1 | null | 40000000000000000000000000 | +| variableRateSlope2 | null | 600000000000000000000000000 | + + +#### USDX (0xffD4505B3452Dc22f8473616d50503bA9E1710Ac) + +| description | value before | value after | +| --- | --- | --- | +| ltv | 82.5 % [8250] | 62 % [6200] | +| liquidationThreshold | 86 % [8600] | 90 % [9000] | +| liquidationBonus | 5 % | 11 % | +| address | null | 0xF9514C867b37D36a5affB003582b1818dA3870eb | +| baseVariableBorrowRate | null | 0 | +| maxVariableBorrowRate | null | 640000000000000000000000000 | +| optimalUsageRatio | null | 450000000000000000000000000 | +| variableRateSlope1 | null | 40000000000000000000000000 | +| variableRateSlope2 | null | 600000000000000000000000000 | + + +## Raw diff + +\`\`\`json +{ + "reserves": { + "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0": { + "address": { + "from": null, + "to": "0xF9514C867b37D36a5affB003582b1818dA3870eb" + }, + "baseVariableBorrowRate": { + "from": null, + "to": "0" + }, + "maxVariableBorrowRate": { + "from": null, + "to": "640000000000000000000000000" + }, + "optimalUsageRatio": { + "from": null, + "to": "450000000000000000000000000" + }, + "variableRateSlope1": { + "from": null, + "to": "40000000000000000000000000" + }, + "variableRateSlope2": { + "from": null, + "to": "600000000000000000000000000" + } + }, + "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f": { + "address": { + "from": null, + "to": "0xF9514C867b37D36a5affB003582b1818dA3870eb" + }, + "baseVariableBorrowRate": { + "from": null, + "to": "0" + }, + "maxVariableBorrowRate": { + "from": null, + "to": "640000000000000000000000000" + }, + "optimalUsageRatio": { + "from": null, + "to": "450000000000000000000000000" + }, + "variableRateSlope1": { + "from": null, + "to": "40000000000000000000000000" + }, + "variableRateSlope2": { + "from": null, + "to": "600000000000000000000000000" + } + }, + "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac": { + "liquidationBonus": { + "from": 10500, + "to": 11100 + }, + "liquidationThreshold": { + "from": 8600, + "to": 9000 + }, + "ltv": { + "from": 8250, + "to": 6200 + }, + "address": { + "from": null, + "to": "0xF9514C867b37D36a5affB003582b1818dA3870eb" + }, + "baseVariableBorrowRate": { + "from": null, + "to": "0" + }, + "maxVariableBorrowRate": { + "from": null, + "to": "640000000000000000000000000" + }, + "optimalUsageRatio": { + "from": null, + "to": "450000000000000000000000000" + }, + "variableRateSlope1": { + "from": null, + "to": "40000000000000000000000000" + }, + "variableRateSlope2": { + "from": null, + "to": "600000000000000000000000000" + } + } + } +} +\`\`\`" +`; diff --git a/src/reports/__snapshots__/reserve.spec.ts.snap b/src/reports/__snapshots__/reserve.spec.ts.snap index b7a78b9..86def61 100644 --- a/src/reports/__snapshots__/reserve.spec.ts.snap +++ b/src/reports/__snapshots__/reserve.spec.ts.snap @@ -44,6 +44,9 @@ exports[`reserve > renderReserve > should properly render new reserve 1`] = ` | stableBorrowRateEnabled | false | | isBorrowableInIsolation | false | | interestRateStrategy | [0x9b34E3e183c9b0d1a08fF57a8fb59c821616295f](https://etherscan.io/address/0x9b34E3e183c9b0d1a08fF57a8fb59c821616295f) | +| aTokenUnderlyingBalance | 0 WBTC [0] | +| virtualAccountingActive | true | +| virtualBalance | 0 WBTC [0] | " `; @@ -82,6 +85,9 @@ exports[`reserve > renderReserve > should properly render new reserve with local | stableBorrowRateEnabled | false | | isBorrowableInIsolation | false | | interestRateStrategy | 0x9b34E3e183c9b0d1a08fF57a8fb59c821616295f | +| aTokenUnderlyingBalance | 0 WBTC [0] | +| virtualAccountingActive | true | +| virtualBalance | 0 WBTC [0] | " `; diff --git a/src/reports/adi-report.spec.ts b/src/reports/adi-diff-report.spec.ts similarity index 100% rename from src/reports/adi-report.spec.ts rename to src/reports/adi-diff-report.spec.ts diff --git a/src/reports/diff.spec.ts b/src/reports/diff.spec.ts index e36c9c3..d5239fe 100644 --- a/src/reports/diff.spec.ts +++ b/src/reports/diff.spec.ts @@ -2,6 +2,8 @@ import {describe, expect, it} from 'vitest'; import {diff} from './diff'; import post from './mocks/postTestEngineArbV3.json'; import pre from './mocks/preTestEngineArbV3.json'; +import pre31 from './mocks/pre3-1.json'; +import post31 from './mocks/post3-1.json'; describe('diff', () => { it('should return same object if no changes were found', () => { @@ -25,6 +27,11 @@ describe('diff', () => { it('should find all the changes', () => { const out = diff(pre, post, true); - console.log(JSON.stringify(out, null, 2)); + expect(out).toMatchSnapshot(); + }); + + it('should find all the changes', () => { + const out = diff(pre31, post31, true); + expect(out).toMatchSnapshot(); }); }); diff --git a/src/reports/mocks/post3-1.json b/src/reports/mocks/post3-1.json new file mode 100644 index 0000000..feadf67 --- /dev/null +++ b/src/reports/mocks/post3-1.json @@ -0,0 +1,186 @@ +{ + "chainId": 31337, + "eModes": {}, + "poolConfig": { + "oracle": "0xA3102C4b8D385a0A4760dF3fAc4Ab5CB1d94Ce74", + "pool": "0xb21Bdf7973F6302236dACC401D45f919FcB53F13", + "poolAddressesProvider": "0xDF9ABb650b00831c5d826e95908dEa15cb8b7489", + "poolConfigurator": "0x8160B362Bd5664E5E8C69bFB7Ab229ebD8de6843", + "poolConfiguratorImpl": "0x0bB60150F9f38a3751e6B623A120E0B23319Be3c", + "poolImpl": "0xa2188f575649510E7130dde290f7B112B4e054E9", + "priceOracleSentinel": "0x0000000000000000000000000000000000000000", + "protocolDataProvider": "0xf7Fb61FDFEA9a31D44aC3a25b569E0Ab7f4D62Bc" + }, + "reserves": { + "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0": { + "aToken": "0xE8AF9f5a9dbe9D0D05C4AF8E0990F656Ff25734D", + "aTokenImpl": "0x810B46eD6f4252B2b736ec1968E3a9100B09356D", + "aTokenName": "Aave Local WBTC", + "aTokenSymbol": "aLocWBTC", + "aTokenUnderlyingBalance": 0, + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "borrowCap": 0, + "borrowingEnabled": true, + "debtCeiling": 0, + "decimals": 8, + "eModeCategory": 0, + "interestRateStrategy": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "isActive": true, + "isBorrowableInIsolation": false, + "isFlashloanable": true, + "isFrozen": false, + "isPaused": false, + "isSiloed": false, + "liquidationBonus": 10500, + "liquidationProtocolFee": 1000, + "liquidationThreshold": 8600, + "ltv": 8250, + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "oracle": "0x76006C4471fb6aDd17728e9c9c8B67d5AF06cDA0", + "oracleDecimals": 8, + "oracleLatestAnswer": 2700000000000, + "reserveFactor": 1000, + "stableBorrowRateEnabled": false, + "stableDebtToken": "0x16d5b202Ca1D554E7545eA51875fa0DCFff4b464", + "stableDebtTokenImpl": "0x120d8c3E70A8B0a50eFA5Ff2B2B6eBb122BF2061", + "stableDebtTokenName": "Aave Local Stable Debt WBTC", + "stableDebtTokenSymbol": "stableDebtLocWBTC", + "supplyCap": 0, + "symbol": "WBTC", + "underlying": "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0", + "usageAsCollateralEnabled": true, + "variableDebtToken": "0x879868dCb2a699Bc253E0281Ed08401cEc586072", + "variableDebtTokenImpl": "0x663b056e5373b6e62BA18F883783022923967Fa7", + "variableDebtTokenName": "Aave Local Variable Debt WBTC", + "variableDebtTokenSymbol": "variableDebtLocWBTC", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000", + "virtualAccountingActive": true, + "virtualBalance": 0 + }, + "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f": { + "aToken": "0xA98bB1Fe0F9d55e7118F4Dbb9Fc3fBF1F01B5482", + "aTokenImpl": "0x810B46eD6f4252B2b736ec1968E3a9100B09356D", + "aTokenName": "Aave Local WETH", + "aTokenSymbol": "aLocWETH", + "aTokenUnderlyingBalance": 0, + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "borrowCap": 0, + "borrowingEnabled": true, + "debtCeiling": 0, + "decimals": 18, + "eModeCategory": 0, + "interestRateStrategy": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "isActive": true, + "isBorrowableInIsolation": false, + "isFlashloanable": true, + "isFrozen": false, + "isPaused": false, + "isSiloed": false, + "liquidationBonus": 10500, + "liquidationProtocolFee": 1000, + "liquidationThreshold": 8600, + "ltv": 8250, + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "oracle": "0x6891e60906DEBeA401F670D74d01D117a3bEAD39", + "oracleDecimals": 8, + "oracleLatestAnswer": 180000000000, + "reserveFactor": 1000, + "stableBorrowRateEnabled": false, + "stableDebtToken": "0x6697E3eBE991C0be177A71FC40D5B2B0944e2bc9", + "stableDebtTokenImpl": "0x120d8c3E70A8B0a50eFA5Ff2B2B6eBb122BF2061", + "stableDebtTokenName": "Aave Local Stable Debt WETH", + "stableDebtTokenSymbol": "stableDebtLocWETH", + "supplyCap": 0, + "symbol": "WETH", + "underlying": "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f", + "usageAsCollateralEnabled": true, + "variableDebtToken": "0x1208b8D04046Bcfa16d0896e29219157794af99F", + "variableDebtTokenImpl": "0x663b056e5373b6e62BA18F883783022923967Fa7", + "variableDebtTokenName": "Aave Local Variable Debt WETH", + "variableDebtTokenSymbol": "variableDebtLocWETH", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000", + "virtualAccountingActive": true, + "virtualBalance": 0 + }, + "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac": { + "aToken": "0xcF63D4456FCF098EF4012F6dbd2FA3a30f122D43", + "aTokenImpl": "0x810B46eD6f4252B2b736ec1968E3a9100B09356D", + "aTokenName": "Aave Local USDX", + "aTokenSymbol": "aLocUSDX", + "aTokenUnderlyingBalance": 0, + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "borrowCap": 0, + "borrowingEnabled": true, + "debtCeiling": 0, + "decimals": 6, + "eModeCategory": 0, + "interestRateStrategy": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "isActive": true, + "isBorrowableInIsolation": false, + "isFlashloanable": true, + "isFrozen": false, + "isPaused": false, + "isSiloed": false, + "liquidationBonus": 11100, + "liquidationProtocolFee": 1000, + "liquidationThreshold": 9000, + "ltv": 6200, + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "oracle": "0x8d2C17FAd02B7bb64139109c6533b7C2b9CADb81", + "oracleDecimals": 8, + "oracleLatestAnswer": 100000000, + "reserveFactor": 1000, + "stableBorrowRateEnabled": false, + "stableDebtToken": "0x1b67680FdA181CcF8c813e0CabF1DEB8bdAE3a66", + "stableDebtTokenImpl": "0x120d8c3E70A8B0a50eFA5Ff2B2B6eBb122BF2061", + "stableDebtTokenName": "Aave Local Stable Debt USDX", + "stableDebtTokenSymbol": "stableDebtLocUSDX", + "supplyCap": 0, + "symbol": "USDX", + "underlying": "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac", + "usageAsCollateralEnabled": true, + "variableDebtToken": "0x9e1971387CA78910Ed778e240833388b16B214F0", + "variableDebtTokenImpl": "0x663b056e5373b6e62BA18F883783022923967Fa7", + "variableDebtTokenName": "Aave Local Variable Debt USDX", + "variableDebtTokenSymbol": "variableDebtLocUSDX", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000", + "virtualAccountingActive": true, + "virtualBalance": 0 + } + }, + "strategies": { + "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0": { + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000" + }, + "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f": { + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000" + }, + "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac": { + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000" + } + } +} diff --git a/src/reports/mocks/pre3-1.json b/src/reports/mocks/pre3-1.json new file mode 100644 index 0000000..1991940 --- /dev/null +++ b/src/reports/mocks/pre3-1.json @@ -0,0 +1,168 @@ +{ + "chainId": 31337, + "eModes": {}, + "poolConfig": { + "oracle": "0xA3102C4b8D385a0A4760dF3fAc4Ab5CB1d94Ce74", + "pool": "0xb21Bdf7973F6302236dACC401D45f919FcB53F13", + "poolAddressesProvider": "0xDF9ABb650b00831c5d826e95908dEa15cb8b7489", + "poolConfigurator": "0x8160B362Bd5664E5E8C69bFB7Ab229ebD8de6843", + "poolConfiguratorImpl": "0x0bB60150F9f38a3751e6B623A120E0B23319Be3c", + "poolImpl": "0xa2188f575649510E7130dde290f7B112B4e054E9", + "priceOracleSentinel": "0x0000000000000000000000000000000000000000", + "protocolDataProvider": "0xf7Fb61FDFEA9a31D44aC3a25b569E0Ab7f4D62Bc" + }, + "reserves": { + "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0": { + "aToken": "0xE8AF9f5a9dbe9D0D05C4AF8E0990F656Ff25734D", + "aTokenImpl": "0x810B46eD6f4252B2b736ec1968E3a9100B09356D", + "aTokenName": "Aave Local WBTC", + "aTokenSymbol": "aLocWBTC", + "aTokenUnderlyingBalance": 0, + "borrowCap": 0, + "borrowingEnabled": true, + "debtCeiling": 0, + "decimals": 8, + "eModeCategory": 0, + "interestRateStrategy": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "isActive": true, + "isBorrowableInIsolation": false, + "isFlashloanable": true, + "isFrozen": false, + "isPaused": false, + "isSiloed": false, + "liquidationBonus": 10500, + "liquidationProtocolFee": 1000, + "liquidationThreshold": 8600, + "ltv": 8250, + "oracle": "0x76006C4471fb6aDd17728e9c9c8B67d5AF06cDA0", + "oracleDecimals": 8, + "oracleLatestAnswer": 2700000000000, + "reserveFactor": 1000, + "stableBorrowRateEnabled": false, + "stableDebtToken": "0x16d5b202Ca1D554E7545eA51875fa0DCFff4b464", + "stableDebtTokenImpl": "0x120d8c3E70A8B0a50eFA5Ff2B2B6eBb122BF2061", + "stableDebtTokenName": "Aave Local Stable Debt WBTC", + "stableDebtTokenSymbol": "stableDebtLocWBTC", + "supplyCap": 0, + "symbol": "WBTC", + "underlying": "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0", + "usageAsCollateralEnabled": true, + "variableDebtToken": "0x879868dCb2a699Bc253E0281Ed08401cEc586072", + "variableDebtTokenImpl": "0x663b056e5373b6e62BA18F883783022923967Fa7", + "variableDebtTokenName": "Aave Local Variable Debt WBTC", + "variableDebtTokenSymbol": "variableDebtLocWBTC", + "virtualAccountingActive": true, + "virtualBalance": 0 + }, + "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f": { + "aToken": "0xA98bB1Fe0F9d55e7118F4Dbb9Fc3fBF1F01B5482", + "aTokenImpl": "0x810B46eD6f4252B2b736ec1968E3a9100B09356D", + "aTokenName": "Aave Local WETH", + "aTokenSymbol": "aLocWETH", + "aTokenUnderlyingBalance": 0, + "borrowCap": 0, + "borrowingEnabled": true, + "debtCeiling": 0, + "decimals": 18, + "eModeCategory": 0, + "interestRateStrategy": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "isActive": true, + "isBorrowableInIsolation": false, + "isFlashloanable": true, + "isFrozen": false, + "isPaused": false, + "isSiloed": false, + "liquidationBonus": 10500, + "liquidationProtocolFee": 1000, + "liquidationThreshold": 8600, + "ltv": 8250, + "oracle": "0x6891e60906DEBeA401F670D74d01D117a3bEAD39", + "oracleDecimals": 8, + "oracleLatestAnswer": 180000000000, + "reserveFactor": 1000, + "stableBorrowRateEnabled": false, + "stableDebtToken": "0x6697E3eBE991C0be177A71FC40D5B2B0944e2bc9", + "stableDebtTokenImpl": "0x120d8c3E70A8B0a50eFA5Ff2B2B6eBb122BF2061", + "stableDebtTokenName": "Aave Local Stable Debt WETH", + "stableDebtTokenSymbol": "stableDebtLocWETH", + "supplyCap": 0, + "symbol": "WETH", + "underlying": "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f", + "usageAsCollateralEnabled": true, + "variableDebtToken": "0x1208b8D04046Bcfa16d0896e29219157794af99F", + "variableDebtTokenImpl": "0x663b056e5373b6e62BA18F883783022923967Fa7", + "variableDebtTokenName": "Aave Local Variable Debt WETH", + "variableDebtTokenSymbol": "variableDebtLocWETH", + "virtualAccountingActive": true, + "virtualBalance": 0 + }, + "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac": { + "aToken": "0xcF63D4456FCF098EF4012F6dbd2FA3a30f122D43", + "aTokenImpl": "0x810B46eD6f4252B2b736ec1968E3a9100B09356D", + "aTokenName": "Aave Local USDX", + "aTokenSymbol": "aLocUSDX", + "aTokenUnderlyingBalance": 0, + "borrowCap": 0, + "borrowingEnabled": true, + "debtCeiling": 0, + "decimals": 6, + "eModeCategory": 0, + "interestRateStrategy": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "isActive": true, + "isBorrowableInIsolation": false, + "isFlashloanable": true, + "isFrozen": false, + "isPaused": false, + "isSiloed": false, + "liquidationBonus": 10500, + "liquidationProtocolFee": 1000, + "liquidationThreshold": 8600, + "ltv": 8250, + "oracle": "0x8d2C17FAd02B7bb64139109c6533b7C2b9CADb81", + "oracleDecimals": 8, + "oracleLatestAnswer": 100000000, + "reserveFactor": 1000, + "stableBorrowRateEnabled": false, + "stableDebtToken": "0x1b67680FdA181CcF8c813e0CabF1DEB8bdAE3a66", + "stableDebtTokenImpl": "0x120d8c3E70A8B0a50eFA5Ff2B2B6eBb122BF2061", + "stableDebtTokenName": "Aave Local Stable Debt USDX", + "stableDebtTokenSymbol": "stableDebtLocUSDX", + "supplyCap": 0, + "symbol": "USDX", + "underlying": "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac", + "usageAsCollateralEnabled": true, + "variableDebtToken": "0x9e1971387CA78910Ed778e240833388b16B214F0", + "variableDebtTokenImpl": "0x663b056e5373b6e62BA18F883783022923967Fa7", + "variableDebtTokenName": "Aave Local Variable Debt USDX", + "variableDebtTokenSymbol": "variableDebtLocUSDX", + "virtualAccountingActive": true, + "virtualBalance": 0 + } + }, + "strategies": { + "0x3C8Ca53ee5661D29d3d3C0732689a4b86947EAF0": { + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000" + }, + "0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f": { + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000" + }, + "0xffD4505B3452Dc22f8473616d50503bA9E1710Ac": { + "address": "0xF9514C867b37D36a5affB003582b1818dA3870eb", + "baseVariableBorrowRate": "0", + "maxVariableBorrowRate": "640000000000000000000000000", + "optimalUsageRatio": "450000000000000000000000000", + "variableRateSlope1": "40000000000000000000000000", + "variableRateSlope2": "600000000000000000000000000" + } + } +} diff --git a/src/reports/report.spec.ts b/src/reports/report.spec.ts index 6605e9e..bec3ecf 100644 --- a/src/reports/report.spec.ts +++ b/src/reports/report.spec.ts @@ -14,4 +14,15 @@ describe('report', () => { }, {timeout: 30000}, ); + it( + 'should generate a well formatted report for 3.1', + async () => { + const from = readJsonFile('/src/reports/mocks/pre3-1.json'); + const to = readJsonFile('/src/reports/mocks/post3-1.json'); + const content = await diffReports(from, to); + console.log(content); + expect(content).toMatchSnapshot(); + }, + {timeout: 30000}, + ); }); diff --git a/src/reports/reserve.spec.ts b/src/reports/reserve.spec.ts index 240d22b..5e5405f 100644 --- a/src/reports/reserve.spec.ts +++ b/src/reports/reserve.spec.ts @@ -6,6 +6,7 @@ import type {AaveV3Reserve, CHAIN_ID} from './snapshot-types'; const WBTC_MOCK = { aToken: '0x078f358208685046a11C85e8ad32895DED33A249', aTokenImpl: '0xa5ba6E5EC19a1Bf23C857991c857dB62b2Aa187B', + aTokenUnderlyingBalance: 0, borrowCap: 1115, borrowingEnabled: true, debtCeiling: 100000, @@ -36,6 +37,8 @@ const WBTC_MOCK = { usageAsCollateralEnabled: true, variableDebtToken: '0x92b42c66840C7AD907b4BF74879FF3eF7c529473', variableDebtTokenImpl: '0x81387c40EB75acB02757C1Ae55D5936E78c9dEd3', + virtualAccountingActive: true, + virtualBalance: 0, }; describe('reserve', () => { diff --git a/src/reports/reserve.ts b/src/reports/reserve.ts index e8303c9..1de4d47 100644 --- a/src/reports/reserve.ts +++ b/src/reports/reserve.ts @@ -12,6 +12,12 @@ export function renderReserveValue( return prettifyNumber({value: reserve[key] as string, decimals: 2, suffix: '%'}); if (['supplyCap', 'borrowCap'].includes(key)) return `${reserve[key].toLocaleString('en-US')} ${reserve.symbol}`; + if (['aTokenUnderlyingBalance', 'virtualBalance'].includes(key)) + return prettifyNumber({ + value: reserve[key] as string, + decimals: reserve.decimals, + suffix: reserve.symbol, + }); if (key === 'debtCeiling') return prettifyNumber({value: reserve[key] as string, decimals: 2, suffix: '$'}); if (['liquidityIndex', 'variableBorrowIndex'].includes(key)) diff --git a/yarn.lock b/yarn.lock index 76fc3d1..31eec45 100644 --- a/yarn.lock +++ b/yarn.lock @@ -33,20 +33,20 @@ chalk "^2.0.0" js-tokens "^4.0.0" -"@bgd-labs/aave-address-book@^2.25.1": - version "2.25.1" - resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-2.25.1.tgz#85de3030d94f7afcba5111c77238581faec63cf6" - integrity sha512-GRRdVgGgtYCVpvlFaXwUDXRcyUXzFR69zZLl09ay0/3sv82Abztb0kvhjQkFQY6foyUt1/pb4Dsgqlvuae5Hgw== +"@bgd-labs/aave-address-book@^3.0.0": + version "3.0.0" + resolved "https://registry.yarnpkg.com/@bgd-labs/aave-address-book/-/aave-address-book-3.0.0.tgz#a75cf2e217688e63728bec1b9c956b0134bc647c" + integrity sha512-ALT9T/aIZ7BztozWvGhjVKGAEfe6wLhop0z+0ZSwAdyHXrBfpXXDZa9siHNtOZfNojPVMPvkpgsiPnFmDD8OJQ== -"@bgd-labs/aave-v3-governance-cache@^0.0.13": - version "0.0.13" - resolved "https://registry.yarnpkg.com/@bgd-labs/aave-v3-governance-cache/-/aave-v3-governance-cache-0.0.13.tgz#f63d0fe9b9f03b8605e2524b35a51aa9490ac2f4" - integrity sha512-kXezI2gN6IeFQHOO2cjbIrrHmos2QuGTCKnn7t2nQcQHJ35wNBCX9+AZymoqROd6fyIgz7qTpatj+0/K5ifhdg== +"@bgd-labs/aave-v3-governance-cache@^1.0.6": + version "1.0.6" + resolved "https://registry.yarnpkg.com/@bgd-labs/aave-v3-governance-cache/-/aave-v3-governance-cache-1.0.6.tgz#a56268e5e759b84d3691c8b23f23743170d04468" + integrity sha512-FpWMBxt18c8pk+10gvWtHBuXhb1uVYF63PgIs6CY4WMSEs/42KCmGYJSamCNYR9nEEX4PVqjPViu3zBoqZOgCQ== -"@bgd-labs/js-utils@^1.3.0": - version "1.3.0" - resolved "https://registry.yarnpkg.com/@bgd-labs/js-utils/-/js-utils-1.3.0.tgz#0cb7649acf175c5127a5077f4a8168118a8966c2" - integrity sha512-jk3Wmw/qA9T2dTMTDN9B+O3dUxfuZhnlW8OaaJBo+Lb9uqH2irTi3ex9dNoR+JYw8cSw+RQnV7fI2UWLJ8vXOw== +"@bgd-labs/js-utils@^1.4.2": + version "1.4.2" + resolved "https://registry.yarnpkg.com/@bgd-labs/js-utils/-/js-utils-1.4.2.tgz#dd6d954fdda153d76cbcabaeff9b7e8adcf528b1" + integrity sha512-hKiorNIyEApdH1w7laYQ+sGkrCGZTem9kD5Ud7YP/ZKtkoPx12FcTAp+P+JZ42BerPEqzGLZMDRJDB2ZGKeAJw== dependencies: "@supercharge/promise-pool" "^3.1.1" bs58 "^5.0.0" @@ -424,22 +424,24 @@ resolved "https://registry.npmjs.org/@multiformats/base-x/-/base-x-4.0.1.tgz" integrity sha512-eMk0b9ReBbV23xXU693TAIrLyeO5iTgBZGSJfpqriG8UkYvr/hC9u9pyMlAakDNHWmbhMZCDs6KQO0jzKD8OTw== -"@noble/curves@1.2.0", "@noble/curves@~1.2.0": - version "1.2.0" - resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.2.0.tgz#92d7e12e4e49b23105a2555c6984d41733d65c35" - integrity sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw== +"@noble/curves@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.0.tgz#f05771ef64da724997f69ee1261b2417a49522d6" + integrity sha512-p+4cb332SFCrReJkCYe8Xzm0OWi4Jji5jVdIZRL/PmacmDkFNw6MrrV+gGpiPxLHbV+zKFRywUWbaseT+tZRXg== dependencies: - "@noble/hashes" "1.3.2" + "@noble/hashes" "1.4.0" -"@noble/hashes@1.3.2", "@noble/hashes@~1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.3.2.tgz#6f26dbc8fbc7205873ce3cee2f690eba0d421b39" - integrity sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ== +"@noble/curves@~1.4.0": + version "1.4.2" + resolved "https://registry.yarnpkg.com/@noble/curves/-/curves-1.4.2.tgz#40309198c76ed71bc6dbf7ba24e81ceb4d0d1fe9" + integrity sha512-TavHr8qycMChk8UwMld0ZDRvatedkzWfH8IiaeGCfymOP5i0hSCozz9vHOL0nkwk7HRMlFnAiKpS2jrUmSybcw== + dependencies: + "@noble/hashes" "1.4.0" -"@noble/hashes@~1.3.0": - version "1.3.1" - resolved "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.1.tgz" - integrity sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA== +"@noble/hashes@1.4.0", "@noble/hashes@~1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@noble/hashes/-/hashes-1.4.0.tgz#45814aa329f30e4fe0ba49426f49dfccdd066426" + integrity sha512-V1JJ1WTRUqHHrOSh597hURcMqVKVGL/ea3kv0gSnEdsEZ0/+VyPghM1lMNGc00z7CIQorSvbKpuJkxvuHbvdbg== "@nodelib/fs.scandir@2.1.5": version "2.1.5" @@ -645,32 +647,27 @@ resolved "https://registry.yarnpkg.com/@rollup/rollup-win32-x64-msvc/-/rollup-win32-x64-msvc-4.9.6.tgz#2c1fb69e02a3f1506f52698cfdc3a8b6386df9a6" integrity sha512-jqzNLhNDvIZOrt69Ce4UjGRpXJBzhUBzawMwnaDAwyHriki3XollsewxWzOzz+4yOFDkuJHtTsZFwMxhYJWmLQ== -"@scure/base@~1.1.0": - version "1.1.1" - resolved "https://registry.npmjs.org/@scure/base/-/base-1.1.1.tgz" - integrity sha512-ZxOhsSyxYwLJj3pLZCefNitxsj093tb2vq90mp2txoYeBqbcjDjqFhyM8eUjq/uFm6zJ+mUuqxlS2FkuSY1MTA== - -"@scure/base@~1.1.2": - version "1.1.3" - resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.3.tgz#8584115565228290a6c6c4961973e0903bb3df2f" - integrity sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q== +"@scure/base@~1.1.6": + version "1.1.7" + resolved "https://registry.yarnpkg.com/@scure/base/-/base-1.1.7.tgz#fe973311a5c6267846aa131bc72e96c5d40d2b30" + integrity sha512-PPNYBslrLNNUQ/Yad37MHYsNQtK67EhWb6WtSvNLLPo7SdVZgkUjD6Dg+5On7zNwmskf8OX7I7Nx5oN+MIWE0g== -"@scure/bip32@1.3.2": - version "1.3.2" - resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.3.2.tgz#90e78c027d5e30f0b22c1f8d50ff12f3fb7559f8" - integrity sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA== +"@scure/bip32@1.4.0": + version "1.4.0" + resolved "https://registry.yarnpkg.com/@scure/bip32/-/bip32-1.4.0.tgz#4e1f1e196abedcef395b33b9674a042524e20d67" + integrity sha512-sVUpc0Vq3tXCkDGYVWGIZTRfnvu8LoTDaev7vbwh0omSvVORONr960MQWdKqJDCReIEmTj3PAr73O3aoxz7OPg== dependencies: - "@noble/curves" "~1.2.0" - "@noble/hashes" "~1.3.2" - "@scure/base" "~1.1.2" + "@noble/curves" "~1.4.0" + "@noble/hashes" "~1.4.0" + "@scure/base" "~1.1.6" -"@scure/bip39@1.2.1": - version "1.2.1" - resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.2.1.tgz#5cee8978656b272a917b7871c981e0541ad6ac2a" - integrity sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg== +"@scure/bip39@1.3.0": + version "1.3.0" + resolved "https://registry.yarnpkg.com/@scure/bip39/-/bip39-1.3.0.tgz#0f258c16823ddd00739461ac31398b4e7d6a18c3" + integrity sha512-disdg7gHuTDZtY+ZdkmLpPCk7fxZSu3gBiEGuoC1XYxv9cGx3Z6cpTggCgW6odSOOIXCiDjuGejW+aJKCY/pIQ== dependencies: - "@noble/hashes" "~1.3.0" - "@scure/base" "~1.1.0" + "@noble/hashes" "~1.4.0" + "@scure/base" "~1.1.6" "@sinclair/typebox@^0.27.8": version "0.27.8" @@ -780,10 +777,10 @@ loupe "^2.3.7" pretty-format "^29.7.0" -abitype@1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.0.tgz#237176dace81d90d018bebf3a45cb42f2a2d9e97" - integrity sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ== +abitype@1.0.5: + version "1.0.5" + resolved "https://registry.yarnpkg.com/abitype/-/abitype-1.0.5.tgz#29d0daa3eea867ca90f7e4123144c1d1270774b6" + integrity sha512-YzDhti7cjlfaBhHutMaboYB21Ha3rXR9QTkNJFzYC4kC8YclaiwPBBBJY8ejFdu2wnJeZCVZSMlQJ7fi8S6hsw== acorn-walk@^8.3.2: version "8.3.2" @@ -1305,10 +1302,10 @@ fill-range@^7.0.1: dependencies: to-regex-range "^5.0.1" -find-object-paths@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/find-object-paths/-/find-object-paths-1.0.2.tgz#93148ebfda10aa1a4f44fa81f8c12d2b64d26754" - integrity sha512-V6gO/vcQnimA/1H1XqYyfJEn+QxEkQqnUwc0WZJ1TJcNVOYD5JNfMTmEHKGUB93iMgebRXBi0WjsPITzK0HIWA== +find-object-paths@^1.1.0: + version "1.1.0" + resolved "https://registry.yarnpkg.com/find-object-paths/-/find-object-paths-1.1.0.tgz#2d2fe99f24c95e63af4b51377a1ba0510490376c" + integrity sha512-UJvfPQibLUOrXl76PJ49cYbXJPsU1lYX6Pw7mHVW+ahaGx6kVHiozNIQriDc/EOlSvkDa6L9GyTFXPYQsa6sGA== find-up@^4.1.0: version "4.1.0" @@ -1622,10 +1619,10 @@ isexe@^2.0.0: resolved "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz" integrity sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw== -isows@1.0.3: - version "1.0.3" - resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.3.tgz#93c1cf0575daf56e7120bab5c8c448b0809d0d74" - integrity sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg== +isows@1.0.4: + version "1.0.4" + resolved "https://registry.yarnpkg.com/isows/-/isows-1.0.4.tgz#810cd0d90cc4995c26395d2aa4cfa4037ebdf061" + integrity sha512-hEzjY+x9u9hPmBom9IIAqdJCwNLax+xrPb51vEPpERoFlIxgmZcHzsT5jKG06nvInKOBGvReAVz80Umed5CczQ== it-all@^1.0.5: version "1.0.6" @@ -2743,19 +2740,19 @@ varint@^6.0.0: resolved "https://registry.npmjs.org/varint/-/varint-6.0.0.tgz" integrity sha512-cXEIW6cfr15lFv563k4GuVuW/fiwjknytD37jIOLSdSWuOI6WnO/oKwmP2FQTU2l01LP8/M5TSAJpzUaGe3uWg== -viem@^2.9.20: - version "2.9.20" - resolved "https://registry.yarnpkg.com/viem/-/viem-2.9.20.tgz#71c6a45d22a8150072adee3dcb7a93fff5347d16" - integrity sha512-PHb1MrBHMrSZ8Ayuk3Y/6wUTcMbzlACQaM6AJBSv9kRKX3xYSZ/kehi+gvS0swQJeAlTQ4eZM7jsHQJNAOarmg== +viem@^2.17.11: + version "2.17.11" + resolved "https://registry.yarnpkg.com/viem/-/viem-2.17.11.tgz#43554c1db8e04ed255dffdeecee626190b97a0e4" + integrity sha512-4dqMQyLVx0dWzuzVNPKzru6qrzHc4opD1WxeL/+NEtQaHcVGfE6f2uAqfoo0k0wwzWgLXbYLkODZ3s/3GDFXYA== dependencies: "@adraffy/ens-normalize" "1.10.0" - "@noble/curves" "1.2.0" - "@noble/hashes" "1.3.2" - "@scure/bip32" "1.3.2" - "@scure/bip39" "1.2.1" - abitype "1.0.0" - isows "1.0.3" - ws "8.13.0" + "@noble/curves" "1.4.0" + "@noble/hashes" "1.4.0" + "@scure/bip32" "1.4.0" + "@scure/bip39" "1.3.0" + abitype "1.0.5" + isows "1.0.4" + ws "8.17.1" vite-node@1.5.0: version "1.5.0" @@ -2861,10 +2858,10 @@ wrappy@1: resolved "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz" integrity sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ== -ws@8.13.0: - version "8.13.0" - resolved "https://registry.yarnpkg.com/ws/-/ws-8.13.0.tgz#9a9fb92f93cf41512a0735c8f4dd09b8a1211cd0" - integrity sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA== +ws@8.17.1: + version "8.17.1" + resolved "https://registry.yarnpkg.com/ws/-/ws-8.17.1.tgz#9293da530bb548febc95371d90f9c878727d919b" + integrity sha512-6XQFvXTkbfUOZOKKILFG1PDK2NDQs4azKQl26T0YS5CxqWLgXajbPZ+h4gZekJyRqFU8pvnbAbbs/3TgRPy+GQ== yallist@^4.0.0: version "4.0.0" @@ -2886,7 +2883,7 @@ yocto-queue@^1.0.0: resolved "https://registry.npmjs.org/yocto-queue/-/yocto-queue-1.0.0.tgz" integrity sha512-9bnSc/HEW2uRy67wc+T8UwauLuPJVn28jb+GtJY16iiKWyvmYJRXVT4UamsAEGQfPohgr2q4Tq0sQbQlxTfi1g== -zod@^3.22.4: - version "3.22.4" - resolved "https://registry.yarnpkg.com/zod/-/zod-3.22.4.tgz#f31c3a9386f61b1f228af56faa9255e845cf3fff" - integrity sha512-iC+8Io04lddc+mVqQ9AZ7OQ2MrUKGN+oIQyq1vemgt46jwCwLfhq7/pwnBnNXXXZb8VTVLKwp9EDkx+ryxIWmg== +zod@^3.23.8: + version "3.23.8" + resolved "https://registry.yarnpkg.com/zod/-/zod-3.23.8.tgz#e37b957b5d52079769fb8097099b592f0ef4067d" + integrity sha512-XBx9AXhXktjUqnepgTiE5flcKIYWi/rme0Eaj+5Y0lftuGBq+jyRu/md4WnuxqgP1ubdpNCsYEYPxrzVHD8d6g==