Skip to content

Commit

Permalink
Merge pull request #63 from VenusProtocol/fix-release-funds
Browse files Browse the repository at this point in the history
fix: fix release funds
  • Loading branch information
coreyar authored Sep 30, 2024
2 parents 0e1728e + 1b11d0d commit 2b8e460
Show file tree
Hide file tree
Showing 5 changed files with 1,405 additions and 647 deletions.
2 changes: 1 addition & 1 deletion packages/cli/source/commands/releaseFunds.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ function ReleaseFunds({ options = {} }: Props) {
const withBalances = allPools.reduce((acc, curr) => {
const tokensWithBalance = curr[1].filter(t => tokensWithBalances.has(t.underlyingAddress));
if (tokensWithBalance.length) {
acc[curr[0]] = tokensWithBalance.map(t => t.vTokenAddress);
acc[curr[0]] = tokensWithBalance.map(t => t.underlyingAddress);
}
return acc;
}, {} as Record<Address, readonly Address[]>);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { Address } from "viem";

import getConfig from "../../config";
import { coreComptrollerAbi, vBep20InterfaceAbi } from "../../config/abis/generated";
import { coreComptrollerAbi, coreVTokenAbi } from "../../config/abis/generated";
import getAddresses from "../../config/addresses";
import publicClient from "../../config/clients/publicClient";
import type { PoolAddressArray } from "../types";
Expand All @@ -16,10 +16,11 @@ export const getCoreMarkets = async (): Promise<PoolAddressArray[]> => {
functionName: "getAllMarkets",
});

// @ts-expect-error not infinte
const underlyingAddresses = await publicClient.multicall({
contracts: markets.map(m => ({
address: m,
abi: vBep20InterfaceAbi,
abi: coreVTokenAbi,
functionName: "underlying",
args: [],
})),
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import { Address } from "viem";

import { vBep20InterfaceAbi } from "../../config/abis/generated";
import { poolLensAbi } from "../../config/abis/generated";
import { ilVTokenAbi, poolLensAbi } from "../../config/abis/generated";
import getAddresses from "../../config/addresses";
import publicClient from "../../config/clients/publicClient";
import type { PoolAddressArray } from "../types";
Expand All @@ -16,11 +15,12 @@ export const getIsolatedMarkets = async (): Promise<PoolAddressArray[]> => {
});

const underlyingAddressesByPool = await Promise.all(
// @ts-expect-error not infinte
pools.map(async p => {
return await publicClient.multicall({
contracts: p.vTokens.map(m => ({
address: m.vToken,
abi: vBep20InterfaceAbi,
abi: ilVTokenAbi,
functionName: "underlying",
args: [],
})),
Expand Down
20 changes: 15 additions & 5 deletions packages/keeper-bots/wagmi.config.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1,19 @@
import ilComptrollerArtifact from "@venusprotocol/isolated-pools/artifacts/contracts/Comptroller.sol/Comptroller.json" assert { type: "json" };
import poolLensArtifact from "@venusprotocol/isolated-pools/artifacts/contracts/Lens/PoolLens.sol/PoolLens.json" assert { type: "json" };
import ilVTokenArtifact from "@venusprotocol/isolated-pools/artifacts/contracts/VToken.sol/VToken.json" assert { type: "json" };
import liquidationOperatorArtifact from "@venusprotocol/keeper-bot-contracts/artifacts/contracts/operators/LiquidationOperator.sol/LiquidationOperator.json" assert { type: "json" };
import tokenConverterOperatorArtifact from "@venusprotocol/keeper-bot-contracts/artifacts/contracts/operators/TokenConverterOperator.sol/TokenConverterOperator.json" assert { type: "json" };
import resilientOracleArtifact from "@venusprotocol/oracle/artifacts/contracts/ResilientOracle.sol/ResilientOracle.json" assert { type: "json" };
import protocolShareReserveArtifact from "@venusprotocol/protocol-reserve/artifacts/contracts/ProtocolReserve/ProtocolShareReserve.sol/ProtocolShareReserve.json" assert { type: "json" };
import tokenConverterArtifact from "@venusprotocol/protocol-reserve/artifacts/contracts/TokenConverter/AbstractTokenConverter.sol/AbstractTokenConverter.json" assert { type: "json" };
import vBnbAdminArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Admin/VBNBAdmin.sol/VBNBAdmin.json" assert { type: "json" };
import diamondComptrollerArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Comptroller/Diamond/DiamondConsolidated.sol/DiamondConsolidated.json" assert { type: "json" };
import venusLensArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Lens/VenusLens.sol/VenusLens.json" assert { type: "json" };
import coreVTokenArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VBep20Delegate.sol/VBep20Delegate.json" assert { type: "json" };
import vBep20InterfaceArtifact from "@venusprotocol/venus-protocol/artifacts/contracts/Tokens/VTokens/VTokenInterfaces.sol/VBep20Interface.json" assert { type: "json" };
import { defineConfig } from "@wagmi/cli";
import { Abi } from "abitype";

const getExternalContracts = async (): Promise<{ name: string; abi: Abi }[]> => [
{
abi: vBep20InterfaceArtifact.abi as Abi,
name: "VBep20Interface",
},
{
abi: poolLensArtifact.abi as Abi,
name: "PoolLens",
Expand All @@ -28,6 +26,18 @@ const getExternalContracts = async (): Promise<{ name: string; abi: Abi }[]> =>
abi: ilComptrollerArtifact.abi as Abi,
name: "IlComptroller",
},
{
abi: ilVTokenArtifact.abi as Abi,
name: "ilVToken",
},
{
abi: resilientOracleArtifact.abi as Abi,
name: "resilientOracle",
},
{
abi: liquidationOperatorArtifact.abi as Abi,
name: "liquidationOperator",
},
{
abi: coreVTokenArtifact.abi as Abi,
name: "CoreVToken",
Expand Down
Loading

0 comments on commit 2b8e460

Please sign in to comment.