@raac/rpc 1.1.0-beta.6 → 1.1.0-beta.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/RPCLibrary.js +14 -0
- package/dist/artifacts/core/tokens/RWAIndexToken.sol/RWAIndexToken.json +591 -0
- package/dist/configs/chains/11155111.json +8 -3
- package/dist/configs/chains/17000.json +16 -17
- package/dist/configs/chains/8453.json +32 -33
- package/dist/configs/createConfig.js +3 -3
- package/dist/pools/lendingPool/_helpers.js +12 -0
- package/dist/pools/lendingPool/adapters/erc20/getERC20AdapterBalance.js +1 -1
- package/dist/pools/lendingPool/adapters/erc20/getERC20AdapterInfo.js +1 -1
- package/dist/pools/lendingPool/adapters/erc721/getERC721AdapterDeposits.js +1 -1
- package/dist/pools/lendingPool/adapters/erc721/getERC721AdapterInfo.js +1 -1
- package/dist/pools/lendingPool/borrowFromLendingPool.js +11 -14
- package/dist/pools/lendingPool/borrowFromLendingPoolWithInsurance.js +10 -29
- package/dist/pools/lendingPool/calculateInsuranceFee.js +11 -8
- package/dist/pools/lendingPool/closeLiquidation.js +15 -14
- package/dist/pools/lendingPool/depositAssetToLendingPool.js +11 -49
- package/dist/pools/lendingPool/depositToLendingPool.js +2 -5
- package/dist/pools/lendingPool/getAdapterAddress.js +44 -0
- package/dist/pools/lendingPool/getAdapters.js +2 -6
- package/dist/pools/lendingPool/getEligibleUserDeposits.js +2 -5
- package/dist/pools/lendingPool/getHealthFactor.js +15 -13
- package/dist/pools/lendingPool/getLendingPoolInfo.js +6 -12
- package/dist/pools/lendingPool/getLendingPoolTotalLiquidity.js +2 -6
- package/dist/pools/lendingPool/getParameters.js +2 -6
- package/dist/pools/lendingPool/getPositionDebt.js +11 -11
- package/dist/pools/lendingPool/getPositionScaledDebt.js +15 -13
- package/dist/pools/lendingPool/getPositionView.js +13 -10
- package/dist/pools/lendingPool/getPositionsScaledDebt.js +2 -5
- package/dist/pools/lendingPool/getRawUserDepositsInLendingPool.js +2 -5
- package/dist/pools/lendingPool/getUserCollateralValue.js +2 -5
- package/dist/pools/lendingPool/getWithdrawRequestInfo.js +25 -0
- package/dist/pools/lendingPool/initializeLiquidation.js +12 -12
- package/dist/pools/lendingPool/openVaultPosition.js +42 -0
- package/dist/pools/lendingPool/repayToLendingPool.js +11 -14
- package/dist/pools/lendingPool/requestWithdraw.js +28 -0
- package/dist/pools/lendingPool/types.js +2 -0
- package/dist/pools/lendingPool/withdrawAssetFromLendingPool.js +15 -17
- package/dist/pools/lendingPool/withdrawFromLendingPool.js +3 -4
- package/dist/pools/rwaVault/_helpers.js +41 -0
- package/dist/pools/rwaVault/adapters/erc20/getERC20VaultAdapterAssetValue.js +2 -2
- package/dist/pools/rwaVault/adapters/erc20/getERC20VaultAdapterInfo.js +2 -2
- package/dist/pools/rwaVault/adapters/erc20/getERC20VaultAdapterTotalValue.js +2 -2
- package/dist/pools/rwaVault/adapters/erc721/getERC721VaultAdapterAssetValue.js +1 -1
- package/dist/pools/rwaVault/adapters/erc721/getERC721VaultAdapterDeposits.js +2 -2
- package/dist/pools/rwaVault/adapters/erc721/getERC721VaultAdapterInfo.js +2 -2
- package/dist/pools/rwaVault/adapters/erc721/getERC721VaultAdapterTotalValue.js +2 -2
- package/dist/pools/rwaVault/depositToRWAVault.js +2 -6
- package/dist/pools/rwaVault/getAdapterAddress.js +43 -0
- package/dist/pools/rwaVault/getAdapters.js +20 -0
- package/dist/pools/rwaVault/getNextRandomNFT.js +2 -6
- package/dist/pools/rwaVault/getRWAVaultInfo.js +2 -6
- package/dist/pools/rwaVault/redeemNFTFromRWAVault.js +2 -6
- package/dist/pools/rwaVault/requestRandomSeed.js +2 -6
- package/dist/pools/rwaVault/types.js +2 -0
- package/dist/scripts/index.js +169 -219
- package/dist/types/RPCLibrary.d.ts +15 -1
- package/dist/types/configs/createConfig.d.ts +1 -1
- package/dist/types/pools/lendingPool/_helpers.d.ts +2 -0
- package/dist/types/pools/lendingPool/adapters/erc20/getERC20AdapterBalance.d.ts +1 -2
- package/dist/types/pools/lendingPool/adapters/erc20/getERC20AdapterInfo.d.ts +1 -2
- package/dist/types/pools/lendingPool/adapters/erc721/getERC721AdapterDeposits.d.ts +1 -2
- package/dist/types/pools/lendingPool/adapters/erc721/getERC721AdapterInfo.d.ts +1 -2
- package/dist/types/pools/lendingPool/borrowFromLendingPool.d.ts +4 -3
- package/dist/types/pools/lendingPool/borrowFromLendingPoolWithInsurance.d.ts +4 -3
- package/dist/types/pools/lendingPool/calculateInsuranceFee.d.ts +2 -1
- package/dist/types/pools/lendingPool/closeLiquidation.d.ts +7 -5
- package/dist/types/pools/lendingPool/depositAssetToLendingPool.d.ts +3 -2
- package/dist/types/pools/lendingPool/getAdapterAddress.d.ts +16 -0
- package/dist/types/pools/lendingPool/getHealthFactor.d.ts +6 -4
- package/dist/types/pools/lendingPool/getPositionDebt.d.ts +4 -3
- package/dist/types/pools/lendingPool/getPositionScaledDebt.d.ts +8 -5
- package/dist/types/pools/lendingPool/getPositionView.d.ts +5 -12
- package/dist/types/pools/lendingPool/getWithdrawRequestInfo.d.ts +8 -0
- package/dist/types/pools/lendingPool/initializeLiquidation.d.ts +4 -3
- package/dist/types/pools/lendingPool/openVaultPosition.d.ts +4 -0
- package/dist/types/pools/lendingPool/repayToLendingPool.d.ts +4 -3
- package/dist/types/pools/lendingPool/requestWithdraw.d.ts +4 -0
- package/dist/types/pools/lendingPool/types.d.ts +7 -0
- package/dist/types/pools/lendingPool/withdrawAssetFromLendingPool.d.ts +3 -2
- package/dist/types/pools/rwaVault/_helpers.d.ts +10 -0
- package/dist/types/pools/rwaVault/adapters/erc20/getERC20VaultAdapterAssetValue.d.ts +1 -2
- package/dist/types/pools/rwaVault/adapters/erc20/getERC20VaultAdapterInfo.d.ts +1 -2
- package/dist/types/pools/rwaVault/adapters/erc20/getERC20VaultAdapterTotalValue.d.ts +1 -2
- package/dist/types/pools/rwaVault/adapters/erc721/getERC721VaultAdapterAssetValue.d.ts +1 -2
- package/dist/types/pools/rwaVault/adapters/erc721/getERC721VaultAdapterDeposits.d.ts +1 -2
- package/dist/types/pools/rwaVault/adapters/erc721/getERC721VaultAdapterInfo.d.ts +1 -2
- package/dist/types/pools/rwaVault/adapters/erc721/getERC721VaultAdapterTotalValue.d.ts +1 -2
- package/dist/types/pools/rwaVault/depositToRWAVault.d.ts +3 -2
- package/dist/types/pools/rwaVault/getAdapterAddress.d.ts +16 -0
- package/dist/types/pools/rwaVault/getAdapters.d.ts +8 -0
- package/dist/types/pools/rwaVault/redeemNFTFromRWAVault.d.ts +2 -2
- package/dist/types/pools/rwaVault/requestRandomSeed.d.ts +2 -2
- package/dist/types/pools/rwaVault/types.d.ts +7 -0
- package/dist/types/scripts/index.d.ts +1 -0
- package/dist/types/utils/artifacts.d.ts +48 -81
- package/dist/types/wallet/assets/getBalance.d.ts +5 -1
- package/dist/utils/artifacts.js +3 -3
- package/dist/wallet/assets/getBalance.js +9 -3
- package/package.json +1 -1
- package/dist/artifacts/core/tokens/IndexToken.sol/IndexToken.json +0 -770
|
@@ -1,11 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ChainId } from "../../configs/chains";
|
|
2
|
+
import { LendingPoolAdapterId } from "./types";
|
|
3
|
+
import { BytesLike } from "ethers";
|
|
3
4
|
/**
|
|
4
5
|
* @description Get the scaled debt of the user on a NFT (contains the accured interest)
|
|
5
6
|
* @param chainId
|
|
6
|
-
* @param
|
|
7
|
-
* @param
|
|
7
|
+
* @param lendingPoolAddress
|
|
8
|
+
* @param adapterName
|
|
9
|
+
* @param userAddress
|
|
10
|
+
* @param data
|
|
8
11
|
* @returns The debt of the user on a NFT with the accured interest
|
|
9
12
|
*/
|
|
10
|
-
declare function getPositionScaledDebt(chainId: ChainId,
|
|
13
|
+
declare function getPositionScaledDebt(chainId: ChainId, adapterName: LendingPoolAdapterId, userAddress: string, data: BytesLike): Promise<bigint>;
|
|
11
14
|
export default getPositionScaledDebt;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { BytesLike, Provider } from "ethers";
|
|
2
2
|
import { ChainId } from "../../configs/chains/index";
|
|
3
|
+
import { LendingPoolAdapterId } from "./types";
|
|
3
4
|
export declare function transformPositionView(positionView: any): {
|
|
4
5
|
rawDebtBalance: string;
|
|
5
6
|
scaledDebtBalance: string;
|
|
@@ -14,19 +15,11 @@ export declare function transformPositionView(positionView: any): {
|
|
|
14
15
|
/**
|
|
15
16
|
* @description Return all the information about a NFT position
|
|
16
17
|
* @param chainId
|
|
17
|
-
* @param
|
|
18
|
+
* @param adapterName
|
|
19
|
+
* @param userAddress
|
|
20
|
+
* @param data
|
|
18
21
|
* @param provider
|
|
19
22
|
* @returns All information about a NFT position
|
|
20
23
|
*/
|
|
21
|
-
declare function getPositionView(chainId: ChainId,
|
|
22
|
-
rawDebtBalance: string;
|
|
23
|
-
scaledDebtBalance: string;
|
|
24
|
-
healthFactor: any;
|
|
25
|
-
isUnderLiquidation: any;
|
|
26
|
-
liquidationStartTime: any;
|
|
27
|
-
positionIndex: any;
|
|
28
|
-
isInsured: any;
|
|
29
|
-
adapter: any;
|
|
30
|
-
asset: any;
|
|
31
|
-
}>;
|
|
24
|
+
declare function getPositionView(chainId: ChainId, adapterName: LendingPoolAdapterId, userAddress: string, data: BytesLike, provider: Provider): Promise<ReturnType<typeof transformPositionView>>;
|
|
32
25
|
export default getPositionView;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Signer } from "ethers";
|
|
2
|
+
import { ChainId } from "../../configs/chains";
|
|
3
|
+
interface WithdrawRequestInfo {
|
|
4
|
+
amount: string;
|
|
5
|
+
readyAt: number;
|
|
6
|
+
}
|
|
7
|
+
export declare function getWithdrawRequestInfo(chainId: ChainId, userAddress: string, signer: Signer): Promise<WithdrawRequestInfo | null>;
|
|
8
|
+
export {};
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { ChainId } from "../../configs/chains";
|
|
2
|
+
import { LendingPoolAdapterId } from "./types";
|
|
3
|
+
import { BytesLike } from "ethers";
|
|
3
4
|
/**
|
|
4
5
|
* @description Get the sum of all the scaled debts of a user over all NFTs
|
|
5
6
|
* @param chainId
|
|
@@ -7,5 +8,5 @@ import { ChainId } from "../../configs/chains/index";
|
|
|
7
8
|
* @param provider
|
|
8
9
|
* @returns The debt of the user
|
|
9
10
|
*/
|
|
10
|
-
declare function initializeLiquidation(chainId: ChainId,
|
|
11
|
+
declare function initializeLiquidation(chainId: ChainId, adapterName: LendingPoolAdapterId, userAddress: string, data: BytesLike): Promise<boolean>;
|
|
11
12
|
export default initializeLiquidation;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import { ChainId } from "../../configs/chains";
|
|
2
|
+
import { LendingPoolAdapterId } from "./types";
|
|
3
|
+
import { BytesLike } from "ethers";
|
|
4
|
+
declare function repayToLendingPool(chainId: ChainId, adapterName: LendingPoolAdapterId, amount: bigint, data: BytesLike): Promise<boolean>;
|
|
4
5
|
export default repayToLendingPool;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { BytesLike
|
|
1
|
+
import { BytesLike } from "ethers";
|
|
2
2
|
import { ChainId } from "../../configs/chains/index";
|
|
3
|
-
|
|
3
|
+
import { LendingPoolAdapterId } from "./types";
|
|
4
4
|
export default withdrawAssetFromLendingPool;
|
|
5
|
+
export declare function withdrawAssetFromLendingPool(chainId: ChainId, adapterName: LendingPoolAdapterId, data: BytesLike): Promise<boolean>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BytesLike, ethers } from "ethers";
|
|
2
|
+
import { ChainId } from "../../configs/chains";
|
|
3
|
+
import { Adapter } from "../../configs/chains/chain";
|
|
4
|
+
import { RWAVault } from "../../typechain-types";
|
|
5
|
+
export declare function encodeERC721(tokenId: string): string;
|
|
6
|
+
export declare function decodeERC721(data: BytesLike): ethers.Result;
|
|
7
|
+
export declare function encodeERC20(amount: string): string;
|
|
8
|
+
export declare function decodeERC20(data: BytesLike): bigint;
|
|
9
|
+
export declare function getRWAVaultAdapterByAddress(chainId: ChainId, address: string): Adapter;
|
|
10
|
+
export declare function getRWAVaultContract(chainId: ChainId): Promise<RWAVault>;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
|
|
3
|
-
declare function getERC20VaultAdapterAssetValue(chainId: ChainId, adapterAddress: string, amount: bigint, signer: Signer): Promise<bigint>;
|
|
2
|
+
declare function getERC20VaultAdapterAssetValue(adapterAddress: string, amount: bigint, signer: Signer): Promise<bigint>;
|
|
4
3
|
export default getERC20VaultAdapterAssetValue;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
import { ChainId } from "../../../../configs/chains/index";
|
|
3
2
|
interface ERC20VaultAdapterInfo {
|
|
4
3
|
token: string;
|
|
5
4
|
priceOracle: string;
|
|
6
5
|
vault: string;
|
|
7
6
|
assetType: string;
|
|
8
7
|
}
|
|
9
|
-
declare function getERC20VaultAdapterInfo(
|
|
8
|
+
declare function getERC20VaultAdapterInfo(adapterAddress: string, signer: Signer): Promise<ERC20VaultAdapterInfo>;
|
|
10
9
|
export default getERC20VaultAdapterInfo;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
|
|
3
|
-
declare function getERC20VaultAdapterTotalValue(chainId: ChainId, adapterAddress: string, signer: Signer): Promise<bigint>;
|
|
2
|
+
declare function getERC20VaultAdapterTotalValue(adapterAddress: string, signer: Signer): Promise<bigint>;
|
|
4
3
|
export default getERC20VaultAdapterTotalValue;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
|
|
3
|
-
declare function getERC721VaultAdapterAssetValue(chainId: ChainId, adapterAddress: string, tokenId: bigint, signer: Signer): Promise<bigint>;
|
|
2
|
+
declare function getERC721VaultAdapterAssetValue(adapterAddress: string, tokenId: bigint, signer: Signer): Promise<bigint>;
|
|
4
3
|
export default getERC721VaultAdapterAssetValue;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
|
|
3
|
-
declare function getERC721VaultAdapterDeposits(chainId: ChainId, adapterAddress: string, signer: Signer): Promise<bigint[]>;
|
|
2
|
+
declare function getERC721VaultAdapterDeposits(adapterAddress: string, signer: Signer): Promise<bigint[]>;
|
|
4
3
|
export default getERC721VaultAdapterDeposits;
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
import { ChainId } from "../../../../configs/chains/index";
|
|
3
2
|
interface ERC721VaultAdapterInfo {
|
|
4
3
|
token: string;
|
|
5
4
|
priceOracle: string;
|
|
6
5
|
vault: string;
|
|
7
6
|
assetType: string;
|
|
8
7
|
}
|
|
9
|
-
declare function getERC721VaultAdapterInfo(
|
|
8
|
+
declare function getERC721VaultAdapterInfo(adapterAddress: string, signer: Signer): Promise<ERC721VaultAdapterInfo>;
|
|
10
9
|
export default getERC721VaultAdapterInfo;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
1
|
import { Signer } from "ethers";
|
|
2
|
-
|
|
3
|
-
declare function getERC721VaultAdapterTotalValue(chainId: ChainId, adapterAddress: string, signer: Signer): Promise<bigint>;
|
|
2
|
+
declare function getERC721VaultAdapterTotalValue(adapterAddress: string, signer: Signer): Promise<bigint>;
|
|
4
3
|
export default getERC721VaultAdapterTotalValue;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { BytesLike, Signer } from "ethers";
|
|
2
2
|
import { ChainId } from "../../configs/chains/index";
|
|
3
|
-
|
|
3
|
+
import { RWAVaultAdapterId } from "./types";
|
|
4
|
+
declare function depositToRWAVault(chainId: ChainId, adapter: RWAVaultAdapterId, data: BytesLike, receiver: string, signer: Signer): Promise<import("ethers").ContractTransactionReceipt>;
|
|
4
5
|
export default depositToRWAVault;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ChainId } from "../../configs/chains";
|
|
2
|
+
import { AdapterInfo, RWAVaultAdapterId } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Get the adapter address and type for a given adapter name
|
|
5
|
+
* @param chainId The chain ID
|
|
6
|
+
* @param adapterName The name of the adapter (e.g., "raacnftadapter")
|
|
7
|
+
* @returns The adapter address and type, or null if not found
|
|
8
|
+
*/
|
|
9
|
+
export declare function getAdapterAddress(chainId: ChainId, adapterName: RWAVaultAdapterId): AdapterInfo | null;
|
|
10
|
+
/**
|
|
11
|
+
* Get the adapter address for a given adapter name
|
|
12
|
+
* @param chainId The chain ID
|
|
13
|
+
* @param adapterName The name of the adapter (e.g., "raacnftadapter")
|
|
14
|
+
* @returns The adapter address, or null if not found
|
|
15
|
+
*/
|
|
16
|
+
export declare function getAdapterAddressOnly(chainId: ChainId, adapterName: RWAVaultAdapterId): string | null;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Provider } from "ethers";
|
|
2
|
+
import { ChainId } from "../../configs/chains/index";
|
|
3
|
+
import { Adapters } from "../../configs/chains/chain";
|
|
4
|
+
declare function getAdapters(chainId: ChainId, provider: Provider): Promise<{
|
|
5
|
+
adapters: string[];
|
|
6
|
+
adapterConfig: Adapters;
|
|
7
|
+
}>;
|
|
8
|
+
export default getAdapters;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Signer } from "ethers";
|
|
2
2
|
import { ChainId } from "../../configs/chains/index";
|
|
3
|
-
declare function redeemNFTFromRWAVault(chainId: ChainId, signer: Signer): Promise<ethers.ContractTransactionReceipt>;
|
|
3
|
+
declare function redeemNFTFromRWAVault(chainId: ChainId, signer: Signer): Promise<import("ethers").ContractTransactionReceipt>;
|
|
4
4
|
export default redeemNFTFromRWAVault;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Signer } from "ethers";
|
|
2
2
|
import { ChainId } from "../../configs/chains/index";
|
|
3
|
-
declare function requestRandomSeed(chainId: ChainId, signer: Signer): Promise<ethers.ContractTransactionReceipt>;
|
|
3
|
+
declare function requestRandomSeed(chainId: ChainId, signer: Signer): Promise<import("ethers").ContractTransactionReceipt>;
|
|
4
4
|
export default requestRandomSeed;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -979,7 +979,7 @@ declare const ABIS: {
|
|
|
979
979
|
type: string;
|
|
980
980
|
anonymous?: undefined;
|
|
981
981
|
})[];
|
|
982
|
-
|
|
982
|
+
mockvrfcoordinator: ({
|
|
983
983
|
inputs: {
|
|
984
984
|
internalType: string;
|
|
985
985
|
name: string;
|
|
@@ -1029,9 +1029,7 @@ declare const ABIS: {
|
|
|
1029
1029
|
type: string;
|
|
1030
1030
|
anonymous?: undefined;
|
|
1031
1031
|
} | {
|
|
1032
|
-
inputs:
|
|
1033
|
-
name: string;
|
|
1034
|
-
outputs: {
|
|
1032
|
+
inputs: {
|
|
1035
1033
|
components: {
|
|
1036
1034
|
internalType: string;
|
|
1037
1035
|
name: string;
|
|
@@ -1041,11 +1039,17 @@ declare const ABIS: {
|
|
|
1041
1039
|
name: string;
|
|
1042
1040
|
type: string;
|
|
1043
1041
|
}[];
|
|
1042
|
+
name: string;
|
|
1043
|
+
outputs: {
|
|
1044
|
+
internalType: string;
|
|
1045
|
+
name: string;
|
|
1046
|
+
type: string;
|
|
1047
|
+
}[];
|
|
1044
1048
|
stateMutability: string;
|
|
1045
1049
|
type: string;
|
|
1046
1050
|
anonymous?: undefined;
|
|
1047
1051
|
})[];
|
|
1048
|
-
|
|
1052
|
+
vrfconsumer: ({
|
|
1049
1053
|
inputs: {
|
|
1050
1054
|
internalType: string;
|
|
1051
1055
|
name: string;
|
|
@@ -1080,11 +1084,7 @@ declare const ABIS: {
|
|
|
1080
1084
|
stateMutability?: undefined;
|
|
1081
1085
|
outputs?: undefined;
|
|
1082
1086
|
} | {
|
|
1083
|
-
inputs:
|
|
1084
|
-
internalType: string;
|
|
1085
|
-
name: string;
|
|
1086
|
-
type: string;
|
|
1087
|
-
}[];
|
|
1087
|
+
inputs: any[];
|
|
1088
1088
|
name: string;
|
|
1089
1089
|
outputs: {
|
|
1090
1090
|
internalType: string;
|
|
@@ -1095,7 +1095,9 @@ declare const ABIS: {
|
|
|
1095
1095
|
type: string;
|
|
1096
1096
|
anonymous?: undefined;
|
|
1097
1097
|
} | {
|
|
1098
|
-
inputs:
|
|
1098
|
+
inputs: any[];
|
|
1099
|
+
name: string;
|
|
1100
|
+
outputs: {
|
|
1099
1101
|
components: {
|
|
1100
1102
|
internalType: string;
|
|
1101
1103
|
name: string;
|
|
@@ -1105,17 +1107,22 @@ declare const ABIS: {
|
|
|
1105
1107
|
name: string;
|
|
1106
1108
|
type: string;
|
|
1107
1109
|
}[];
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
+
stateMutability: string;
|
|
1111
|
+
type: string;
|
|
1112
|
+
anonymous?: undefined;
|
|
1113
|
+
} | {
|
|
1114
|
+
inputs: {
|
|
1110
1115
|
internalType: string;
|
|
1111
1116
|
name: string;
|
|
1112
1117
|
type: string;
|
|
1113
1118
|
}[];
|
|
1119
|
+
name: string;
|
|
1120
|
+
outputs: any[];
|
|
1114
1121
|
stateMutability: string;
|
|
1115
1122
|
type: string;
|
|
1116
1123
|
anonymous?: undefined;
|
|
1117
1124
|
})[];
|
|
1118
|
-
|
|
1125
|
+
raacprimerateoracle: ({
|
|
1119
1126
|
inputs: {
|
|
1120
1127
|
internalType: string;
|
|
1121
1128
|
name: string;
|
|
@@ -1150,25 +1157,13 @@ declare const ABIS: {
|
|
|
1150
1157
|
stateMutability?: undefined;
|
|
1151
1158
|
outputs?: undefined;
|
|
1152
1159
|
} | {
|
|
1153
|
-
inputs:
|
|
1154
|
-
name: string;
|
|
1155
|
-
outputs: {
|
|
1160
|
+
inputs: {
|
|
1156
1161
|
internalType: string;
|
|
1157
1162
|
name: string;
|
|
1158
1163
|
type: string;
|
|
1159
1164
|
}[];
|
|
1160
|
-
stateMutability: string;
|
|
1161
|
-
type: string;
|
|
1162
|
-
anonymous?: undefined;
|
|
1163
|
-
} | {
|
|
1164
|
-
inputs: any[];
|
|
1165
1165
|
name: string;
|
|
1166
1166
|
outputs: {
|
|
1167
|
-
components: {
|
|
1168
|
-
internalType: string;
|
|
1169
|
-
name: string;
|
|
1170
|
-
type: string;
|
|
1171
|
-
}[];
|
|
1172
1167
|
internalType: string;
|
|
1173
1168
|
name: string;
|
|
1174
1169
|
type: string;
|
|
@@ -1176,19 +1171,8 @@ declare const ABIS: {
|
|
|
1176
1171
|
stateMutability: string;
|
|
1177
1172
|
type: string;
|
|
1178
1173
|
anonymous?: undefined;
|
|
1179
|
-
} | {
|
|
1180
|
-
inputs: {
|
|
1181
|
-
internalType: string;
|
|
1182
|
-
name: string;
|
|
1183
|
-
type: string;
|
|
1184
|
-
}[];
|
|
1185
|
-
name: string;
|
|
1186
|
-
outputs: any[];
|
|
1187
|
-
stateMutability: string;
|
|
1188
|
-
type: string;
|
|
1189
|
-
anonymous?: undefined;
|
|
1190
1174
|
})[];
|
|
1191
|
-
|
|
1175
|
+
rwavault: ({
|
|
1192
1176
|
inputs: {
|
|
1193
1177
|
internalType: string;
|
|
1194
1178
|
name: string;
|
|
@@ -1238,7 +1222,7 @@ declare const ABIS: {
|
|
|
1238
1222
|
type: string;
|
|
1239
1223
|
anonymous?: undefined;
|
|
1240
1224
|
})[];
|
|
1241
|
-
|
|
1225
|
+
erc20assetadapter: ({
|
|
1242
1226
|
inputs: {
|
|
1243
1227
|
internalType: string;
|
|
1244
1228
|
name: string;
|
|
@@ -1288,7 +1272,7 @@ declare const ABIS: {
|
|
|
1288
1272
|
type: string;
|
|
1289
1273
|
anonymous?: undefined;
|
|
1290
1274
|
})[];
|
|
1291
|
-
|
|
1275
|
+
erc721assetadapter: ({
|
|
1292
1276
|
inputs: {
|
|
1293
1277
|
internalType: string;
|
|
1294
1278
|
name: string;
|
|
@@ -1338,7 +1322,7 @@ declare const ABIS: {
|
|
|
1338
1322
|
type: string;
|
|
1339
1323
|
anonymous?: undefined;
|
|
1340
1324
|
})[];
|
|
1341
|
-
|
|
1325
|
+
erc20vaultadapter: ({
|
|
1342
1326
|
inputs: {
|
|
1343
1327
|
internalType: string;
|
|
1344
1328
|
name: string;
|
|
@@ -1388,7 +1372,7 @@ declare const ABIS: {
|
|
|
1388
1372
|
type: string;
|
|
1389
1373
|
anonymous?: undefined;
|
|
1390
1374
|
})[];
|
|
1391
|
-
|
|
1375
|
+
erc721vaultadapter: ({
|
|
1392
1376
|
inputs: {
|
|
1393
1377
|
internalType: string;
|
|
1394
1378
|
name: string;
|
|
@@ -1438,7 +1422,7 @@ declare const ABIS: {
|
|
|
1438
1422
|
type: string;
|
|
1439
1423
|
anonymous?: undefined;
|
|
1440
1424
|
})[];
|
|
1441
|
-
|
|
1425
|
+
rwaindextoken: ({
|
|
1442
1426
|
inputs: {
|
|
1443
1427
|
internalType: string;
|
|
1444
1428
|
name: string;
|
|
@@ -1488,11 +1472,10 @@ declare const ABIS: {
|
|
|
1488
1472
|
type: string;
|
|
1489
1473
|
anonymous?: undefined;
|
|
1490
1474
|
})[];
|
|
1491
|
-
eth: any[];
|
|
1492
1475
|
};
|
|
1493
1476
|
export type AssetType = keyof typeof ABIS | string;
|
|
1494
1477
|
export type ContractType = keyof typeof ABIS;
|
|
1495
|
-
declare const getABI: (name: keyof typeof ABIS) =>
|
|
1478
|
+
declare const getABI: (name: keyof typeof ABIS) => ({
|
|
1496
1479
|
inputs: {
|
|
1497
1480
|
internalType: string;
|
|
1498
1481
|
name: string;
|
|
@@ -2457,9 +2440,7 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2457
2440
|
type: string;
|
|
2458
2441
|
anonymous?: undefined;
|
|
2459
2442
|
} | {
|
|
2460
|
-
inputs:
|
|
2461
|
-
name: string;
|
|
2462
|
-
outputs: {
|
|
2443
|
+
inputs: {
|
|
2463
2444
|
components: {
|
|
2464
2445
|
internalType: string;
|
|
2465
2446
|
name: string;
|
|
@@ -2469,6 +2450,12 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2469
2450
|
name: string;
|
|
2470
2451
|
type: string;
|
|
2471
2452
|
}[];
|
|
2453
|
+
name: string;
|
|
2454
|
+
outputs: {
|
|
2455
|
+
internalType: string;
|
|
2456
|
+
name: string;
|
|
2457
|
+
type: string;
|
|
2458
|
+
}[];
|
|
2472
2459
|
stateMutability: string;
|
|
2473
2460
|
type: string;
|
|
2474
2461
|
anonymous?: undefined;
|
|
@@ -2507,11 +2494,7 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2507
2494
|
stateMutability?: undefined;
|
|
2508
2495
|
outputs?: undefined;
|
|
2509
2496
|
} | {
|
|
2510
|
-
inputs:
|
|
2511
|
-
internalType: string;
|
|
2512
|
-
name: string;
|
|
2513
|
-
type: string;
|
|
2514
|
-
}[];
|
|
2497
|
+
inputs: any[];
|
|
2515
2498
|
name: string;
|
|
2516
2499
|
outputs: {
|
|
2517
2500
|
internalType: string;
|
|
@@ -2522,7 +2505,9 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2522
2505
|
type: string;
|
|
2523
2506
|
anonymous?: undefined;
|
|
2524
2507
|
} | {
|
|
2525
|
-
inputs:
|
|
2508
|
+
inputs: any[];
|
|
2509
|
+
name: string;
|
|
2510
|
+
outputs: {
|
|
2526
2511
|
components: {
|
|
2527
2512
|
internalType: string;
|
|
2528
2513
|
name: string;
|
|
@@ -2532,12 +2517,17 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2532
2517
|
name: string;
|
|
2533
2518
|
type: string;
|
|
2534
2519
|
}[];
|
|
2535
|
-
|
|
2536
|
-
|
|
2520
|
+
stateMutability: string;
|
|
2521
|
+
type: string;
|
|
2522
|
+
anonymous?: undefined;
|
|
2523
|
+
} | {
|
|
2524
|
+
inputs: {
|
|
2537
2525
|
internalType: string;
|
|
2538
2526
|
name: string;
|
|
2539
2527
|
type: string;
|
|
2540
2528
|
}[];
|
|
2529
|
+
name: string;
|
|
2530
|
+
outputs: any[];
|
|
2541
2531
|
stateMutability: string;
|
|
2542
2532
|
type: string;
|
|
2543
2533
|
anonymous?: undefined;
|
|
@@ -2576,25 +2566,13 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2576
2566
|
stateMutability?: undefined;
|
|
2577
2567
|
outputs?: undefined;
|
|
2578
2568
|
} | {
|
|
2579
|
-
inputs:
|
|
2580
|
-
name: string;
|
|
2581
|
-
outputs: {
|
|
2569
|
+
inputs: {
|
|
2582
2570
|
internalType: string;
|
|
2583
2571
|
name: string;
|
|
2584
2572
|
type: string;
|
|
2585
2573
|
}[];
|
|
2586
|
-
stateMutability: string;
|
|
2587
|
-
type: string;
|
|
2588
|
-
anonymous?: undefined;
|
|
2589
|
-
} | {
|
|
2590
|
-
inputs: any[];
|
|
2591
2574
|
name: string;
|
|
2592
2575
|
outputs: {
|
|
2593
|
-
components: {
|
|
2594
|
-
internalType: string;
|
|
2595
|
-
name: string;
|
|
2596
|
-
type: string;
|
|
2597
|
-
}[];
|
|
2598
2576
|
internalType: string;
|
|
2599
2577
|
name: string;
|
|
2600
2578
|
type: string;
|
|
@@ -2602,17 +2580,6 @@ declare const getABI: (name: keyof typeof ABIS) => any[] | ({
|
|
|
2602
2580
|
stateMutability: string;
|
|
2603
2581
|
type: string;
|
|
2604
2582
|
anonymous?: undefined;
|
|
2605
|
-
} | {
|
|
2606
|
-
inputs: {
|
|
2607
|
-
internalType: string;
|
|
2608
|
-
name: string;
|
|
2609
|
-
type: string;
|
|
2610
|
-
}[];
|
|
2611
|
-
name: string;
|
|
2612
|
-
outputs: any[];
|
|
2613
|
-
stateMutability: string;
|
|
2614
|
-
type: string;
|
|
2615
|
-
anonymous?: undefined;
|
|
2616
2583
|
})[] | ({
|
|
2617
2584
|
inputs: {
|
|
2618
2585
|
internalType: string;
|
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
import { Provider } from "ethers";
|
|
2
2
|
import { AssetType } from "../../utils/artifacts";
|
|
3
3
|
import { ChainId } from "../../configs/chains/index";
|
|
4
|
-
declare function getBalance(chainId: ChainId, assetId: AssetType, address: string, provider: Provider): Promise<
|
|
4
|
+
declare function getBalance(chainId: ChainId, assetId: AssetType, address: string, provider: Provider): Promise<number | {
|
|
5
|
+
balance: string;
|
|
6
|
+
symbol: any;
|
|
7
|
+
decimals: any;
|
|
8
|
+
}>;
|
|
5
9
|
export default getBalance;
|
package/dist/utils/artifacts.js
CHANGED
|
@@ -20,7 +20,6 @@ const Auction_json_1 = __importDefault(require("../artifacts/zeno/Auction.sol/Au
|
|
|
20
20
|
const ZenoFactory_json_1 = __importDefault(require("../artifacts/zeno/ZenoFactory.sol/ZenoFactory.json")); // assert { type: "json" };
|
|
21
21
|
const Zeno_json_1 = __importDefault(require("../artifacts/zeno/Zeno.sol/Zeno.json")); // assert { type: "json" };
|
|
22
22
|
const FeeCollector_json_1 = __importDefault(require("../artifacts/core/collectors/FeeCollector.sol/FeeCollector.json")); // assert { type: "json" };
|
|
23
|
-
const IndexToken_json_1 = __importDefault(require("../artifacts/core/tokens/IndexToken.sol/IndexToken.json")); // assert { type: "json" };
|
|
24
23
|
const MockVRFCoordinatorV2_json_1 = __importDefault(require("../artifacts/mocks/core/oracles/MockVRFCoordinatorV2.sol/MockVRFCoordinatorV2.json")); // assert { type: "json" };
|
|
25
24
|
const BaseVRFv2Consumer_json_1 = __importDefault(require("../artifacts/core/oracles/BaseVRFv2Consumer.sol/BaseVRFv2Consumer.json")); // assert { type: "json" };
|
|
26
25
|
const RAACPrimeRateOracle_json_1 = __importDefault(require("../artifacts/core/oracles/RAACPrimeRateOracle.sol/RAACPrimeRateOracle.json")); // assert { type: "json" };
|
|
@@ -29,6 +28,7 @@ const ERC20AssetAdapter_json_1 = __importDefault(require("../artifacts/core/pool
|
|
|
29
28
|
const ERC721AssetAdapter_json_1 = __importDefault(require("../artifacts/core/pools/LendingPool/ERC721AssetAdapter.sol/ERC721AssetAdapter.json")); // assert { type: "json" };
|
|
30
29
|
const ERC20VaultAdapter_json_1 = __importDefault(require("../artifacts/core/vaults/ERC20VaultAdapter.sol/ERC20VaultAdapter.json"));
|
|
31
30
|
const ERC721VaultAdapter_json_1 = __importDefault(require("../artifacts/core/vaults/ERC721VaultAdapter.sol/ERC721VaultAdapter.json"));
|
|
31
|
+
const RWAIndexToken_json_1 = __importDefault(require("../artifacts/core/tokens/RWAIndexToken.sol/RWAIndexToken.json"));
|
|
32
32
|
const CRVUSD_ABI = crvUSDToken_json_1.default.abi;
|
|
33
33
|
const RToken_json_2 = __importDefault(require("../artifacts/core/tokens/RToken.sol/RToken.json")); // assert { type: "json" }; // TODO: Isnt this same as rcrvusd?
|
|
34
34
|
const RTOKEN_ABI = RToken_json_2.default.abi;
|
|
@@ -46,6 +46,7 @@ const FEECOLLECTOR_ABI = FeeCollector_json_1.default.abi;
|
|
|
46
46
|
const RWAVAULT_ABI = RWAVault_json_1.default.abi;
|
|
47
47
|
const ERC20ASSETADAPTER_ABI = ERC20AssetAdapter_json_1.default.abi;
|
|
48
48
|
const ERC721ASSETADAPTER_ABI = ERC721AssetAdapter_json_1.default.abi;
|
|
49
|
+
const RWAINDEXTOKEN_ABI = RWAIndexToken_json_1.default.abi;
|
|
49
50
|
const ABIS = {
|
|
50
51
|
// Tokens
|
|
51
52
|
crvusd: CRVUSD_ABI,
|
|
@@ -71,7 +72,6 @@ const ABIS = {
|
|
|
71
72
|
auctionfactory: AuctionFactory_json_1.default.abi,
|
|
72
73
|
zeno: Zeno_json_1.default.abi,
|
|
73
74
|
zenofactory: ZenoFactory_json_1.default.abi,
|
|
74
|
-
indextoken: IndexToken_json_1.default.abi,
|
|
75
75
|
mockvrfcoordinator: MockVRFCoordinatorV2_json_1.default.abi,
|
|
76
76
|
vrfconsumer: BaseVRFv2Consumer_json_1.default.abi,
|
|
77
77
|
raacprimerateoracle: RAACPrimeRateOracle_json_1.default.abi,
|
|
@@ -80,7 +80,7 @@ const ABIS = {
|
|
|
80
80
|
erc721assetadapter: ERC721ASSETADAPTER_ABI,
|
|
81
81
|
erc20vaultadapter: ERC20VaultAdapter_json_1.default.abi,
|
|
82
82
|
erc721vaultadapter: ERC721VaultAdapter_json_1.default.abi,
|
|
83
|
-
|
|
83
|
+
rwaindextoken: RWAINDEXTOKEN_ABI,
|
|
84
84
|
};
|
|
85
85
|
exports.ABIS = ABIS;
|
|
86
86
|
const getABI = (name) => {
|
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
const ethers_1 = require("ethers");
|
|
4
4
|
const contracts_1 = require("../../utils/contracts");
|
|
5
5
|
async function getBalance(chainId, assetId, address, provider) {
|
|
6
|
-
const BALANCE_OF_ABI = ["function balanceOf(address) view returns (uint256)"];
|
|
6
|
+
const BALANCE_OF_ABI = ["function balanceOf(address) view returns (uint256)", "function symbol() view returns (string)", "function decimals() view returns (uint8)"];
|
|
7
7
|
try {
|
|
8
8
|
if (assetId === "eth") {
|
|
9
9
|
const balance = await provider.getBalance(address);
|
|
@@ -13,8 +13,14 @@ async function getBalance(chainId, assetId, address, provider) {
|
|
|
13
13
|
const contractAddress = (0, contracts_1.getContractAddress)(chainId, assetId);
|
|
14
14
|
const contract = new ethers_1.ethers.Contract(contractAddress, BALANCE_OF_ABI, provider);
|
|
15
15
|
const balance = await contract.balanceOf(address);
|
|
16
|
-
const
|
|
17
|
-
|
|
16
|
+
const symbol = await contract.symbol();
|
|
17
|
+
const decimals = await contract.decimals();
|
|
18
|
+
const parsedBalance = ethers_1.ethers.formatUnits(balance, decimals);
|
|
19
|
+
return {
|
|
20
|
+
balance: parsedBalance,
|
|
21
|
+
symbol,
|
|
22
|
+
decimals,
|
|
23
|
+
};
|
|
18
24
|
}
|
|
19
25
|
catch (error) {
|
|
20
26
|
console.error(`Error getting balance for asset ${assetId}:`, error);
|