, Co
ToastViewport.displayName = ToastPrimitives.Viewport.displayName
const toastVariants = cva(
- 'data-[swipe=move]:transition-none grow-1 group relative pointer-events-auto flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full mt-4 data-[state=closed]:slide-out-to-right-full dark:border-slate-700 last:mt-0 sm:last:mt-4',
+ 'grow-1 data-[state=open]:animate-in data-[state=closed]:animate-out data-[swipe=end]:animate-out data-[state=closed]:fade-out-80 data-[state=open]:slide-in-from-top-full data-[state=open]:sm:slide-in-from-bottom-full data-[state=closed]:slide-out-to-right-full group pointer-events-auto relative mt-4 flex w-full items-center justify-between space-x-4 overflow-hidden rounded-md border p-6 pr-8 shadow-lg transition-all last:mt-0 data-[swipe=cancel]:translate-x-0 data-[swipe=end]:translate-x-[var(--radix-toast-swipe-end-x)] data-[swipe=move]:translate-x-[var(--radix-toast-swipe-move-x)] data-[swipe=move]:transition-none dark:border-slate-700 sm:last:mt-4',
{
variants: {
variant: {
- default: 'bg-white border-slate-200 dark:bg-slate-800 dark:border-slate-700',
- destructive: 'group destructive bg-red-600 text-white border-red-600 dark:border-red-600',
+ default: 'border-slate-200 bg-white dark:border-slate-700 dark:bg-slate-800',
+ destructive: 'destructive group border-red-600 bg-red-600 text-white dark:border-red-600',
},
},
defaultVariants: {
diff --git a/data/turbo-integrations.ts b/data/turbo-integrations.ts
index a66055df..0c5c6d3d 100644
--- a/data/turbo-integrations.ts
+++ b/data/turbo-integrations.ts
@@ -112,6 +112,14 @@ export const turboIntegrations = {
imgLight: '/integrations/moralis.png',
imgDark: '/integrations/moralis.png',
},
+ aave: {
+ name: 'Aave',
+ href: '/integration/aave',
+ url: 'https://docs.aave.com/hub/',
+ description: 'Aave is a decentralized non-custodial liquidity protocol.',
+ imgLight: '/integrations/aave.png',
+ imgDark: '/integrations/aave.png',
+ },
starter: {
name: 'Starter Template',
href: '/integration/starter',
diff --git a/integrations/aave/README.md b/integrations/aave/README.md
new file mode 100644
index 00000000..21640df8
--- /dev/null
+++ b/integrations/aave/README.md
@@ -0,0 +1,89 @@
+# Aave - TurboETH Integration
+
+This React Hook integrates with [Aave](https://aave.com/), enabling users to supply and borrow assets. The integration is built using [Wagmi CLI](https://wagmi.sh/cli/commands/generate), interacting with the Aave [UiPoolDataProvider](https://docs.aave.com/developers/periphery-contracts/uipooldataproviderv3) and [Pool](https://docs.aave.com/developers/core-contracts/pool) contracts.
+
+## Features
+
+- Get pools and users data on Aave with the `useAave` hook
+- Interact with the pool contract using Wagmi's generated hooks
+
+## Hooks
+
+### `useAave()`
+
+The `useAave()` hook retrieves and computes various data related to the user's activities on the Aave lending protocol.
+
+**Parameters:**
+
+The hook doesn't take any parameters.
+
+**Returns:**
+
+The hook returns an object `data` with the following properties:
+
+- `reservesData`: An array of data on the reserves fetched from the Aave protocol, with information about each asset in the pool, such as total liquidity, total borrowings, liquidity rate, variable borrow rate, and more.
+
+- `userReservesData`: An array of data about the user's reserves in the Aave protocol. This data includes information about each asset the user has in the pool.
+
+- `usdData`: An array derived from `userReservesData`, where each element is enriched with additional data like `reserveData`, `tokenPriceInUsd`, `amountInUsd`, and `debtInUsd`.
+
+- `balanceInUsd`: The user's total balance in USD, as calculated based on the user's reserves data.
+
+- `totalDebtInUsd`: The user's total debt in USD, as calculated based on the user's reserves data.
+
+- `collateralInUsd`: The total collateral in USD, as calculated based on the user's reserves data.
+
+- `maxBorrowableInUsd`: The maximum amount the user can borrow in USD, calculated based on the user's reserves data.
+
+- `healthFactor`: A metric calculated based on the user's collateral and debt that indicates the health of the user's position in the protocol.
+
+- `averageSupplyApy`: The average annual percentage yield (APY) for supplying assets, calculated based on the user's reserves data.
+
+- `averageBorrowApy`: The average APY for borrowing assets, calculated based on the user's reserves data.
+
+- `averageNetApy`: The average net APY, calculated based on the user's reserves data.
+
+- `poolAddress`: The address of the Aave lending pool.
+
+**Behavior:**
+
+- On initial render, and whenever there's a change in the user's reserves data, reserves data, market, or user, the hook calculates and updates multiple financial parameters.
+
+**Example:**
+
+```javascript
+const { data } = useAave()
+```
+
+Also check the hooks generated at `integrations/aave/generated/aave-wagmi.ts`
+
+## File Structure
+
+```
+integrations/aave
+├── abis
+│ ├── pool-abi.ts
+│ └── ui-pool-data-provider-abi.ts
+├── components
+│ ├── asset-to-borrow-item.tsx
+│ ├── asset-to-supply-item.tsx
+│ ├── borrowed-assets-item.tsx
+│ ├── general-info.tsx
+│ ├── health-factor.tsx
+│ ├── list-assets-to-borrow.tsx
+│ ├── list-assets-to-supply.tsx
+│ ├── list-borrowed-assets.tsx
+│ ├── list-supplied-assets.tsx
+│ ├── spinner.tsx
+│ └── supplied-assets-item.tsx
+├── generated
+│ └── aave-wagmi.ts
+├── hooks
+│ └── use-aave.ts
+├── utils
+│ ├── index.ts
+│ ├── market-config.ts
+│ └── types.ts
+│── wagmi.config.ts
+└── README.md
+```
diff --git a/integrations/aave/abis/pool-abi.ts b/integrations/aave/abis/pool-abi.ts
new file mode 100644
index 00000000..f329a036
--- /dev/null
+++ b/integrations/aave/abis/pool-abi.ts
@@ -0,0 +1,1715 @@
+export const poolAbi = [
+ {
+ inputs: [
+ {
+ internalType: 'contract IPoolAddressesProvider',
+ name: 'provider',
+ type: 'address',
+ },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'constructor',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'backer',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'fee',
+ type: 'uint256',
+ },
+ ],
+ name: 'BackUnbacked',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'enum DataTypes.InterestRateMode',
+ name: 'interestRateMode',
+ type: 'uint8',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'borrowRate',
+ type: 'uint256',
+ },
+ {
+ indexed: true,
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'Borrow',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'target',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: 'initiator',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'enum DataTypes.InterestRateMode',
+ name: 'interestRateMode',
+ type: 'uint8',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'premium',
+ type: 'uint256',
+ },
+ {
+ indexed: true,
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'FlashLoan',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'totalDebt',
+ type: 'uint256',
+ },
+ ],
+ name: 'IsolationModeTotalDebtUpdated',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'collateralAsset',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'debtAsset',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'debtToCover',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'liquidatedCollateralAmount',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: 'liquidator',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'bool',
+ name: 'receiveAToken',
+ type: 'bool',
+ },
+ ],
+ name: 'LiquidationCall',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ indexed: true,
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'MintUnbacked',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amountMinted',
+ type: 'uint256',
+ },
+ ],
+ name: 'MintedToTreasury',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'RebalanceStableBorrowRate',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'repayer',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'bool',
+ name: 'useATokens',
+ type: 'bool',
+ },
+ ],
+ name: 'Repay',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'liquidityRate',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'stableBorrowRate',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'variableBorrowRate',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'liquidityIndex',
+ type: 'uint256',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'variableBorrowIndex',
+ type: 'uint256',
+ },
+ ],
+ name: 'ReserveDataUpdated',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'ReserveUsedAsCollateralDisabled',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'ReserveUsedAsCollateralEnabled',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ indexed: true,
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'Supply',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'enum DataTypes.InterestRateMode',
+ name: 'interestRateMode',
+ type: 'uint8',
+ },
+ ],
+ name: 'SwapBorrowRateMode',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint8',
+ name: 'categoryId',
+ type: 'uint8',
+ },
+ ],
+ name: 'UserEModeSet',
+ type: 'event',
+ },
+ {
+ anonymous: false,
+ inputs: [
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'reserve',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ indexed: true,
+ internalType: 'address',
+ name: 'to',
+ type: 'address',
+ },
+ {
+ indexed: false,
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ ],
+ name: 'Withdraw',
+ type: 'event',
+ },
+ {
+ inputs: [],
+ name: 'ADDRESSES_PROVIDER',
+ outputs: [
+ {
+ internalType: 'contract IPoolAddressesProvider',
+ name: '',
+ type: 'address',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'BRIDGE_PROTOCOL_FEE',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'FLASHLOAN_PREMIUM_TOTAL',
+ outputs: [
+ {
+ internalType: 'uint128',
+ name: '',
+ type: 'uint128',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'FLASHLOAN_PREMIUM_TO_PROTOCOL',
+ outputs: [
+ {
+ internalType: 'uint128',
+ name: '',
+ type: 'uint128',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'MAX_NUMBER_RESERVES',
+ outputs: [
+ {
+ internalType: 'uint16',
+ name: '',
+ type: 'uint16',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'MAX_STABLE_RATE_BORROW_SIZE_PERCENT',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'POOL_REVISION',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'fee',
+ type: 'uint256',
+ },
+ ],
+ name: 'backUnbacked',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'interestRateMode',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ ],
+ name: 'borrow',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'uint8',
+ name: 'id',
+ type: 'uint8',
+ },
+ {
+ components: [
+ {
+ internalType: 'uint16',
+ name: 'ltv',
+ type: 'uint16',
+ },
+ {
+ internalType: 'uint16',
+ name: 'liquidationThreshold',
+ type: 'uint16',
+ },
+ {
+ internalType: 'uint16',
+ name: 'liquidationBonus',
+ type: 'uint16',
+ },
+ {
+ internalType: 'address',
+ name: 'priceSource',
+ type: 'address',
+ },
+ {
+ internalType: 'string',
+ name: 'label',
+ type: 'string',
+ },
+ ],
+ internalType: 'struct DataTypes.EModeCategory',
+ name: 'category',
+ type: 'tuple',
+ },
+ ],
+ name: 'configureEModeCategory',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'deposit',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ ],
+ name: 'dropReserve',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'from',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'to',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'balanceFromBefore',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'balanceToBefore',
+ type: 'uint256',
+ },
+ ],
+ name: 'finalizeTransfer',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'receiverAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address[]',
+ name: 'assets',
+ type: 'address[]',
+ },
+ {
+ internalType: 'uint256[]',
+ name: 'amounts',
+ type: 'uint256[]',
+ },
+ {
+ internalType: 'uint256[]',
+ name: 'interestRateModes',
+ type: 'uint256[]',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ internalType: 'bytes',
+ name: 'params',
+ type: 'bytes',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'flashLoan',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'receiverAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'bytes',
+ name: 'params',
+ type: 'bytes',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'flashLoanSimple',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ ],
+ name: 'getConfiguration',
+ outputs: [
+ {
+ components: [
+ {
+ internalType: 'uint256',
+ name: 'data',
+ type: 'uint256',
+ },
+ ],
+ internalType: 'struct DataTypes.ReserveConfigurationMap',
+ name: '',
+ type: 'tuple',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'uint8',
+ name: 'id',
+ type: 'uint8',
+ },
+ ],
+ name: 'getEModeCategoryData',
+ outputs: [
+ {
+ components: [
+ {
+ internalType: 'uint16',
+ name: 'ltv',
+ type: 'uint16',
+ },
+ {
+ internalType: 'uint16',
+ name: 'liquidationThreshold',
+ type: 'uint16',
+ },
+ {
+ internalType: 'uint16',
+ name: 'liquidationBonus',
+ type: 'uint16',
+ },
+ {
+ internalType: 'address',
+ name: 'priceSource',
+ type: 'address',
+ },
+ {
+ internalType: 'string',
+ name: 'label',
+ type: 'string',
+ },
+ ],
+ internalType: 'struct DataTypes.EModeCategory',
+ name: '',
+ type: 'tuple',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'uint16',
+ name: 'id',
+ type: 'uint16',
+ },
+ ],
+ name: 'getReserveAddressById',
+ outputs: [
+ {
+ internalType: 'address',
+ name: '',
+ type: 'address',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ ],
+ name: 'getReserveData',
+ outputs: [
+ {
+ components: [
+ {
+ components: [
+ {
+ internalType: 'uint256',
+ name: 'data',
+ type: 'uint256',
+ },
+ ],
+ internalType: 'struct DataTypes.ReserveConfigurationMap',
+ name: 'configuration',
+ type: 'tuple',
+ },
+ {
+ internalType: 'uint128',
+ name: 'liquidityIndex',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'currentLiquidityRate',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'variableBorrowIndex',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'currentVariableBorrowRate',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'currentStableBorrowRate',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint40',
+ name: 'lastUpdateTimestamp',
+ type: 'uint40',
+ },
+ {
+ internalType: 'uint16',
+ name: 'id',
+ type: 'uint16',
+ },
+ {
+ internalType: 'address',
+ name: 'aTokenAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'stableDebtTokenAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'variableDebtTokenAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'interestRateStrategyAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'uint128',
+ name: 'accruedToTreasury',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'unbacked',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'isolationModeTotalDebt',
+ type: 'uint128',
+ },
+ ],
+ internalType: 'struct DataTypes.ReserveData',
+ name: '',
+ type: 'tuple',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ ],
+ name: 'getReserveNormalizedIncome',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ ],
+ name: 'getReserveNormalizedVariableDebt',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'getReservesList',
+ outputs: [
+ {
+ internalType: 'address[]',
+ name: '',
+ type: 'address[]',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'getUserAccountData',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: 'totalCollateralBase',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'totalDebtBase',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'availableBorrowsBase',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'currentLiquidationThreshold',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'ltv',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'healthFactor',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'getUserConfiguration',
+ outputs: [
+ {
+ components: [
+ {
+ internalType: 'uint256',
+ name: 'data',
+ type: 'uint256',
+ },
+ ],
+ internalType: 'struct DataTypes.UserConfigurationMap',
+ name: '',
+ type: 'tuple',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'getUserEMode',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'aTokenAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'stableDebtAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'variableDebtAddress',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'interestRateStrategyAddress',
+ type: 'address',
+ },
+ ],
+ name: 'initReserve',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'contract IPoolAddressesProvider',
+ name: 'provider',
+ type: 'address',
+ },
+ ],
+ name: 'initialize',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'collateralAsset',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'debtAsset',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'debtToCover',
+ type: 'uint256',
+ },
+ {
+ internalType: 'bool',
+ name: 'receiveAToken',
+ type: 'bool',
+ },
+ ],
+ name: 'liquidationCall',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address[]',
+ name: 'assets',
+ type: 'address[]',
+ },
+ ],
+ name: 'mintToTreasury',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'mintUnbacked',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'user',
+ type: 'address',
+ },
+ ],
+ name: 'rebalanceStableBorrowRate',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'interestRateMode',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ ],
+ name: 'repay',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'interestRateMode',
+ type: 'uint256',
+ },
+ ],
+ name: 'repayWithATokens',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint256',
+ name: 'interestRateMode',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'deadline',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint8',
+ name: 'permitV',
+ type: 'uint8',
+ },
+ {
+ internalType: 'bytes32',
+ name: 'permitR',
+ type: 'bytes32',
+ },
+ {
+ internalType: 'bytes32',
+ name: 'permitS',
+ type: 'bytes32',
+ },
+ ],
+ name: 'repayWithPermit',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'token',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'to',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ ],
+ name: 'rescueTokens',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ ],
+ name: 'resetIsolationModeTotalDebt',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ components: [
+ {
+ internalType: 'uint256',
+ name: 'data',
+ type: 'uint256',
+ },
+ ],
+ internalType: 'struct DataTypes.ReserveConfigurationMap',
+ name: 'configuration',
+ type: 'tuple',
+ },
+ ],
+ name: 'setConfiguration',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'address',
+ name: 'rateStrategyAddress',
+ type: 'address',
+ },
+ ],
+ name: 'setReserveInterestRateStrategyAddress',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'uint8',
+ name: 'categoryId',
+ type: 'uint8',
+ },
+ ],
+ name: 'setUserEMode',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'bool',
+ name: 'useAsCollateral',
+ type: 'bool',
+ },
+ ],
+ name: 'setUserUseReserveAsCollateral',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ ],
+ name: 'supply',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'onBehalfOf',
+ type: 'address',
+ },
+ {
+ internalType: 'uint16',
+ name: 'referralCode',
+ type: 'uint16',
+ },
+ {
+ internalType: 'uint256',
+ name: 'deadline',
+ type: 'uint256',
+ },
+ {
+ internalType: 'uint8',
+ name: 'permitV',
+ type: 'uint8',
+ },
+ {
+ internalType: 'bytes32',
+ name: 'permitR',
+ type: 'bytes32',
+ },
+ {
+ internalType: 'bytes32',
+ name: 'permitS',
+ type: 'bytes32',
+ },
+ ],
+ name: 'supplyWithPermit',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'interestRateMode',
+ type: 'uint256',
+ },
+ ],
+ name: 'swapBorrowRateMode',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'uint256',
+ name: 'protocolFee',
+ type: 'uint256',
+ },
+ ],
+ name: 'updateBridgeProtocolFee',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'uint128',
+ name: 'flashLoanPremiumTotal',
+ type: 'uint128',
+ },
+ {
+ internalType: 'uint128',
+ name: 'flashLoanPremiumToProtocol',
+ type: 'uint128',
+ },
+ ],
+ name: 'updateFlashloanPremiums',
+ outputs: [],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+ {
+ inputs: [
+ {
+ internalType: 'address',
+ name: 'asset',
+ type: 'address',
+ },
+ {
+ internalType: 'uint256',
+ name: 'amount',
+ type: 'uint256',
+ },
+ {
+ internalType: 'address',
+ name: 'to',
+ type: 'address',
+ },
+ ],
+ name: 'withdraw',
+ outputs: [
+ {
+ internalType: 'uint256',
+ name: '',
+ type: 'uint256',
+ },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'function',
+ },
+] as const
diff --git a/integrations/aave/abis/ui-pool-data-provider-abi.ts b/integrations/aave/abis/ui-pool-data-provider-abi.ts
new file mode 100644
index 00000000..112733c0
--- /dev/null
+++ b/integrations/aave/abis/ui-pool-data-provider-abi.ts
@@ -0,0 +1,152 @@
+export const uiPoolDataProvider = [
+ {
+ inputs: [
+ { internalType: 'contract IEACAggregatorProxy', name: '_networkBaseTokenPriceInUsdProxyAggregator', type: 'address' },
+ { internalType: 'contract IEACAggregatorProxy', name: '_marketReferenceCurrencyPriceInUsdProxyAggregator', type: 'address' },
+ ],
+ stateMutability: 'nonpayable',
+ type: 'constructor',
+ },
+ {
+ inputs: [],
+ name: 'ETH_CURRENCY_UNIT',
+ outputs: [{ internalType: 'uint256', name: '', type: 'uint256' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ { inputs: [], name: 'MKR_ADDRESS', outputs: [{ internalType: 'address', name: '', type: 'address' }], stateMutability: 'view', type: 'function' },
+ {
+ inputs: [{ internalType: 'bytes32', name: '_bytes32', type: 'bytes32' }],
+ name: 'bytes32ToString',
+ outputs: [{ internalType: 'string', name: '', type: 'string' }],
+ stateMutability: 'pure',
+ type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'contract IPoolAddressesProvider', name: 'provider', type: 'address' }],
+ name: 'getReservesData',
+ outputs: [
+ {
+ components: [
+ { internalType: 'address', name: 'underlyingAsset', type: 'address' },
+ { internalType: 'string', name: 'name', type: 'string' },
+ { internalType: 'string', name: 'symbol', type: 'string' },
+ { internalType: 'uint256', name: 'decimals', type: 'uint256' },
+ { internalType: 'uint256', name: 'baseLTVasCollateral', type: 'uint256' },
+ { internalType: 'uint256', name: 'reserveLiquidationThreshold', type: 'uint256' },
+ { internalType: 'uint256', name: 'reserveLiquidationBonus', type: 'uint256' },
+ { internalType: 'uint256', name: 'reserveFactor', type: 'uint256' },
+ { internalType: 'bool', name: 'usageAsCollateralEnabled', type: 'bool' },
+ { internalType: 'bool', name: 'borrowingEnabled', type: 'bool' },
+ { internalType: 'bool', name: 'stableBorrowRateEnabled', type: 'bool' },
+ { internalType: 'bool', name: 'isActive', type: 'bool' },
+ { internalType: 'bool', name: 'isFrozen', type: 'bool' },
+ { internalType: 'uint128', name: 'liquidityIndex', type: 'uint128' },
+ { internalType: 'uint128', name: 'variableBorrowIndex', type: 'uint128' },
+ { internalType: 'uint128', name: 'liquidityRate', type: 'uint128' },
+ { internalType: 'uint128', name: 'variableBorrowRate', type: 'uint128' },
+ { internalType: 'uint128', name: 'stableBorrowRate', type: 'uint128' },
+ { internalType: 'uint40', name: 'lastUpdateTimestamp', type: 'uint40' },
+ { internalType: 'address', name: 'aTokenAddress', type: 'address' },
+ { internalType: 'address', name: 'stableDebtTokenAddress', type: 'address' },
+ { internalType: 'address', name: 'variableDebtTokenAddress', type: 'address' },
+ { internalType: 'address', name: 'interestRateStrategyAddress', type: 'address' },
+ { internalType: 'uint256', name: 'availableLiquidity', type: 'uint256' },
+ { internalType: 'uint256', name: 'totalPrincipalStableDebt', type: 'uint256' },
+ { internalType: 'uint256', name: 'averageStableRate', type: 'uint256' },
+ { internalType: 'uint256', name: 'stableDebtLastUpdateTimestamp', type: 'uint256' },
+ { internalType: 'uint256', name: 'totalScaledVariableDebt', type: 'uint256' },
+ { internalType: 'uint256', name: 'priceInMarketReferenceCurrency', type: 'uint256' },
+ { internalType: 'address', name: 'priceOracle', type: 'address' },
+ { internalType: 'uint256', name: 'variableRateSlope1', type: 'uint256' },
+ { internalType: 'uint256', name: 'variableRateSlope2', type: 'uint256' },
+ { internalType: 'uint256', name: 'stableRateSlope1', type: 'uint256' },
+ { internalType: 'uint256', name: 'stableRateSlope2', type: 'uint256' },
+ { internalType: 'uint256', name: 'baseStableBorrowRate', type: 'uint256' },
+ { internalType: 'uint256', name: 'baseVariableBorrowRate', type: 'uint256' },
+ { internalType: 'uint256', name: 'optimalUsageRatio', type: 'uint256' },
+ { internalType: 'bool', name: 'isPaused', type: 'bool' },
+ { internalType: 'bool', name: 'isSiloedBorrowing', type: 'bool' },
+ { internalType: 'uint128', name: 'accruedToTreasury', type: 'uint128' },
+ { internalType: 'uint128', name: 'unbacked', type: 'uint128' },
+ { internalType: 'uint128', name: 'isolationModeTotalDebt', type: 'uint128' },
+ { internalType: 'bool', name: 'flashLoanEnabled', type: 'bool' },
+ { internalType: 'uint256', name: 'debtCeiling', type: 'uint256' },
+ { internalType: 'uint256', name: 'debtCeilingDecimals', type: 'uint256' },
+ { internalType: 'uint8', name: 'eModeCategoryId', type: 'uint8' },
+ { internalType: 'uint256', name: 'borrowCap', type: 'uint256' },
+ { internalType: 'uint256', name: 'supplyCap', type: 'uint256' },
+ { internalType: 'uint16', name: 'eModeLtv', type: 'uint16' },
+ { internalType: 'uint16', name: 'eModeLiquidationThreshold', type: 'uint16' },
+ { internalType: 'uint16', name: 'eModeLiquidationBonus', type: 'uint16' },
+ { internalType: 'address', name: 'eModePriceSource', type: 'address' },
+ { internalType: 'string', name: 'eModeLabel', type: 'string' },
+ { internalType: 'bool', name: 'borrowableInIsolation', type: 'bool' },
+ ],
+ internalType: 'struct IUiPoolDataProviderV3.AggregatedReserveData[]',
+ name: '',
+ type: 'tuple[]',
+ },
+ {
+ components: [
+ { internalType: 'uint256', name: 'marketReferenceCurrencyUnit', type: 'uint256' },
+ { internalType: 'int256', name: 'marketReferenceCurrencyPriceInUsd', type: 'int256' },
+ { internalType: 'int256', name: 'networkBaseTokenPriceInUsd', type: 'int256' },
+ { internalType: 'uint8', name: 'networkBaseTokenPriceDecimals', type: 'uint8' },
+ ],
+ internalType: 'struct IUiPoolDataProviderV3.BaseCurrencyInfo',
+ name: '',
+ type: 'tuple',
+ },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [{ internalType: 'contract IPoolAddressesProvider', name: 'provider', type: 'address' }],
+ name: 'getReservesList',
+ outputs: [{ internalType: 'address[]', name: '', type: 'address[]' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [
+ { internalType: 'contract IPoolAddressesProvider', name: 'provider', type: 'address' },
+ { internalType: 'address', name: 'user', type: 'address' },
+ ],
+ name: 'getUserReservesData',
+ outputs: [
+ {
+ components: [
+ { internalType: 'address', name: 'underlyingAsset', type: 'address' },
+ { internalType: 'uint256', name: 'scaledATokenBalance', type: 'uint256' },
+ { internalType: 'bool', name: 'usageAsCollateralEnabledOnUser', type: 'bool' },
+ { internalType: 'uint256', name: 'stableBorrowRate', type: 'uint256' },
+ { internalType: 'uint256', name: 'scaledVariableDebt', type: 'uint256' },
+ { internalType: 'uint256', name: 'principalStableDebt', type: 'uint256' },
+ { internalType: 'uint256', name: 'stableBorrowLastUpdateTimestamp', type: 'uint256' },
+ ],
+ internalType: 'struct IUiPoolDataProviderV3.UserReserveData[]',
+ name: '',
+ type: 'tuple[]',
+ },
+ { internalType: 'uint8', name: '', type: 'uint8' },
+ ],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'marketReferenceCurrencyPriceInUsdProxyAggregator',
+ outputs: [{ internalType: 'contract IEACAggregatorProxy', name: '', type: 'address' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+ {
+ inputs: [],
+ name: 'networkBaseTokenPriceInUsdProxyAggregator',
+ outputs: [{ internalType: 'contract IEACAggregatorProxy', name: '', type: 'address' }],
+ stateMutability: 'view',
+ type: 'function',
+ },
+] as const
diff --git a/integrations/aave/components/asset-to-borrow-item.tsx b/integrations/aave/components/asset-to-borrow-item.tsx
new file mode 100644
index 00000000..d16bb8e7
--- /dev/null
+++ b/integrations/aave/components/asset-to-borrow-item.tsx
@@ -0,0 +1,192 @@
+import { useEffect, useState } from 'react'
+
+import Image from 'next/image'
+import { parseUnits } from 'viem'
+import { useAccount, useWaitForTransaction } from 'wagmi'
+
+import { ContractWriteButton } from '@/components/blockchain/contract-write-button'
+import { Button } from '@/components/ui/button'
+import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
+import { useErc20Decimals } from '@/lib/generated/blockchain'
+import { useToast } from '@/lib/hooks/use-toast'
+
+import { usePoolBorrow } from '../generated/aave-wagmi'
+import { useAave } from '../hooks/use-aave'
+
+interface IAssetToSupplyItem {
+ address: `0x${string}`
+ symbol: string
+ tokenPriceInUsd: number
+ aTokensBalance: number
+ variableBorrowRate: number
+ stableBorrowRate?: number
+ canBorrowStableRateMode?: boolean
+}
+
+export const AssetToBorrowItem = ({
+ address,
+ aTokensBalance,
+ symbol,
+ tokenPriceInUsd,
+ variableBorrowRate,
+ stableBorrowRate,
+ canBorrowStableRateMode,
+}: IAssetToSupplyItem) => {
+ const { maxBorrowableInUsd, poolAddress } = useAave()
+ const { address: user } = useAccount()
+ const [borrowAmount, setBorrowAmount] = useState('')
+ const [borrowVariableRateMode, setBorrowVariableRateMode] = useState(true)
+ const { data: decimals } = useErc20Decimals({ address })
+ const [open, setOpen] = useState(false)
+ const { toast } = useToast()
+
+ const handleToast = () => {
+ toast({
+ title: 'Success',
+ description: `${symbol} successfully borrowed`,
+ duration: 4200,
+ })
+ }
+
+ const {
+ data,
+ isLoading: isLoadingWrite,
+ write: borrowWrite,
+ } = usePoolBorrow({
+ address: poolAddress,
+ args: [address, parseUnits(`${Number(borrowAmount)}`, decimals ?? 18), borrowVariableRateMode ? BigInt(2) : BigInt(1), 0, user as `0x${string}`],
+ })
+
+ const { isLoading: isLoadingTx, isSuccess: isSuccessTx } = useWaitForTransaction({
+ hash: data?.hash,
+ })
+
+ const buttonAction = () => {
+ if (Number(borrowAmount) < aTokensBalance && !borrowVariableRateMode) {
+ return alert('You have to borrow more than the amount supplied on stable rate mode!')
+ }
+ borrowWrite()
+ }
+
+ const setMaxAmount = () => setBorrowAmount(((maxBorrowableInUsd / tokenPriceInUsd) * 0.8).toFixed(2))
+
+ useEffect(() => {
+ if (isSuccessTx) {
+ handleToast()
+ setOpen(false)
+ }
+ }, [isSuccessTx])
+
+ return (
+
+
+
+ {symbol}
+ |
+
+ {/* Only allowing borrowing 80% of max borrow amount to keep health factor safe */}
+ {maxBorrowableInUsd > 0 ? ((maxBorrowableInUsd / tokenPriceInUsd) * 0.8).toFixed(2) : '0'}{' '}
+ |
+ {variableBorrowRate.toFixed(2)}% |
+ {stableBorrowRate ? `${stableBorrowRate.toFixed(2)}%` : '—'} |
+
+
+ |
+
+ )
+}
diff --git a/integrations/aave/components/asset-to-supply-item.tsx b/integrations/aave/components/asset-to-supply-item.tsx
new file mode 100644
index 00000000..eedc04e8
--- /dev/null
+++ b/integrations/aave/components/asset-to-supply-item.tsx
@@ -0,0 +1,195 @@
+import { useEffect, useState } from 'react'
+
+import Image from 'next/image'
+import { TiTick } from 'react-icons/ti'
+import { formatUnits, parseUnits } from 'viem'
+import { useAccount, useWaitForTransaction } from 'wagmi'
+
+import { ContractWriteButton } from '@/components/blockchain/contract-write-button'
+import { Button } from '@/components/ui/button'
+import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
+import { useErc20Allowance, useErc20Approve, useErc20BalanceOf, useErc20Decimals } from '@/lib/generated/blockchain'
+import { useToast } from '@/lib/hooks/use-toast'
+
+import { usePoolSupply } from '../generated/aave-wagmi'
+import { useAave } from '../hooks/use-aave'
+
+interface IAssetToSupplyItem {
+ address: `0x${string}`
+ symbol: string
+ canBeCollateral: boolean
+ tokenPriceInUsd: number
+ liquidityRate: number
+ showIfZeroBalance: boolean
+}
+
+export const AssetToSupplyItem = ({ address, symbol, canBeCollateral, liquidityRate, showIfZeroBalance }: IAssetToSupplyItem) => {
+ const { poolAddress } = useAave()
+ const { address: user } = useAccount()
+ const [supplyAmount, setSupplyAmount] = useState('')
+ const [open, setOpen] = useState(false)
+
+ const { data: tokenBalance } = useErc20BalanceOf({ address, args: user ? [user] : undefined, watch: true })
+ const { data: decimals } = useErc20Decimals({ address })
+ const allowance = useErc20Allowance({ address, args: user ? [user, poolAddress] : undefined, watch: true }).data
+
+ const { toast } = useToast()
+
+ const handleToast = () => {
+ toast({
+ title: 'Success',
+ description: `${symbol} successfully supplied`,
+ duration: 4200,
+ })
+ }
+
+ const {
+ data: dataApprove,
+ isLoading: isLoadingApproveWrite,
+ write: approveWrite,
+ } = useErc20Approve({
+ address,
+ args: [poolAddress, parseUnits(`${Number(supplyAmount)}`, decimals ?? 18)],
+ })
+
+ const { isLoading: isLoadingApproveTx } = useWaitForTransaction({
+ hash: dataApprove?.hash,
+ })
+
+ const {
+ data: dataSupply,
+ isLoading: isLoadingSupplyWrite,
+ write: supplyWrite,
+ } = usePoolSupply({
+ address: poolAddress,
+ args: [address, parseUnits(`${Number(supplyAmount)}`, decimals ?? 18), user as `0x${string}`, 0],
+ })
+
+ const { isLoading: isLoadingSupplyTx, isSuccess: isSuccessTx } = useWaitForTransaction({
+ hash: dataSupply?.hash,
+ })
+
+ const buttonAction = () => {
+ if (Number(formatUnits(allowance ?? BigInt(1), decimals ?? 18)) < Number(supplyAmount)) {
+ approveWrite()
+ } else {
+ supplyWrite()
+ }
+ }
+
+ const isApproving = () => Number(formatUnits(allowance ?? BigInt(1), decimals ?? 18)) < Number(supplyAmount)
+
+ const setMaxAmount = () => setSupplyAmount(Number(formatUnits(tokenBalance ?? BigInt(1), decimals ?? 18)).toString())
+
+ useEffect(() => {
+ if (isSuccessTx) {
+ handleToast()
+ setOpen(false)
+ }
+ }, [isSuccessTx])
+
+ return tokenBalance !== BigInt(0) || showIfZeroBalance ? (
+
+
+
+ {symbol}
+ |
+ {tokenBalance === BigInt(0) ? (
+ 0 |
+ ) : (
+ {Number(formatUnits(tokenBalance ?? BigInt(1), decimals ?? 18)).toFixed(5)} |
+ )}
+
+ {liquidityRate !== 0 ? `${liquidityRate.toFixed(2)}%` : '0'} |
+ {canBeCollateral ? : — } |
+
+
+ |
+
+ ) : (
+
+ )
+}
diff --git a/integrations/aave/components/borrowed-assets-item.tsx b/integrations/aave/components/borrowed-assets-item.tsx
new file mode 100644
index 00000000..d46ea3a1
--- /dev/null
+++ b/integrations/aave/components/borrowed-assets-item.tsx
@@ -0,0 +1,270 @@
+import { useEffect, useState } from 'react'
+
+import Image from 'next/image'
+import { TiArrowRight } from 'react-icons/ti'
+import { formatUnits, parseUnits } from 'viem'
+import { useAccount, useWaitForTransaction } from 'wagmi'
+
+import { ContractWriteButton } from '@/components/blockchain/contract-write-button'
+import { Button } from '@/components/ui/button'
+import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
+import { useErc20Allowance, useErc20Approve, useErc20BalanceOf, useErc20Decimals, useErc20Symbol } from '@/lib/generated/blockchain'
+import { useToast } from '@/lib/hooks/use-toast'
+
+import { usePoolRepay, usePoolRepayWithATokens, usePoolSwapBorrowRateMode } from '../generated/aave-wagmi'
+import { useAave } from '../hooks/use-aave'
+import { limitDecimals } from '../utils'
+
+interface IBorrowedAssetsItemProps {
+ address: `0x${string}`
+ aTokenBalance: bigint
+ debt: number
+ borrowRate: number
+ rateMode: bigint
+ canSwitchRateMode?: boolean
+}
+
+const getSymbol = (symbol: string | undefined) => (symbol === 'WETH' ? 'ETH' : symbol)
+
+export const BorrowedAssetsItem = ({ address, aTokenBalance, debt, borrowRate, canSwitchRateMode, rateMode }: IBorrowedAssetsItemProps) => {
+ const { address: user } = useAccount()
+ const { poolAddress } = useAave()
+ const [repayAmount, setRepayAmount] = useState('')
+ const [repayWithATokens, setRepayWithATokens] = useState(false)
+ const [open, setOpen] = useState(false)
+
+ const symbol = getSymbol(useErc20Symbol({ address }).data)
+ const { data: tokenBalance } = useErc20BalanceOf({ address, args: user ? [user] : undefined, watch: true })
+ const { data: decimals } = useErc20Decimals({ address })
+ const allowance = useErc20Allowance({ address, args: user ? [user, poolAddress] : undefined, watch: true }).data
+
+ const { toast } = useToast()
+
+ const handleToast = () => {
+ toast({
+ title: 'Success',
+ description: `${symbol ?? ''} successfully repaid`,
+ duration: 4200,
+ })
+ }
+
+ const {
+ data: dataApprove,
+ isLoading: isLoadingApproveWrite,
+ write: approveWrite,
+ } = useErc20Approve({
+ address,
+ args: [poolAddress, parseUnits(`${Number(repayAmount)}`, decimals ?? 18)],
+ })
+
+ const { isLoading: isLoadingApproveTx } = useWaitForTransaction({
+ hash: dataApprove?.hash,
+ })
+
+ const {
+ data: dataRepay,
+ isLoading: isLoadingRepayWrite,
+ write: repayWrite,
+ } = usePoolRepay({
+ address: poolAddress,
+ args: [address, parseUnits(`${Number(repayAmount)}`, decimals ?? 18), rateMode, user as `0x${string}`],
+ })
+
+ const { isLoading: isLoadingRepayTx, isSuccess: isSuccessRepayTx } = useWaitForTransaction({
+ hash: dataRepay?.hash,
+ })
+
+ const {
+ data: dataRepayATokens,
+ isLoading: isLoadingRepayATokensWrite,
+ write: repayWithATokensWrite,
+ } = usePoolRepayWithATokens({
+ address: poolAddress,
+ args: [address, parseUnits(`${Number(repayAmount)}`, decimals ?? 18), rateMode],
+ })
+
+ const { isLoading: isLoadingRepayATokensTx, isSuccess: isSuccessRepayATokensTx } = useWaitForTransaction({
+ hash: dataRepayATokens?.hash,
+ })
+
+ const { write: swapBorrowRateModeWrite } = usePoolSwapBorrowRateMode({
+ address: poolAddress,
+ args: [address, rateMode],
+ })
+
+ const getRepayBalance = () => (repayWithATokens ? aTokenBalance : tokenBalance)
+
+ const buttonAction = () => {
+ if (Number(formatUnits(allowance ?? BigInt(1), decimals ?? 18)) < Number(repayAmount)) {
+ approveWrite()
+ } else {
+ if (repayWithATokens) {
+ repayWithATokensWrite()
+ } else {
+ repayWrite()
+ }
+ }
+ }
+
+ const isApproving = () => Number(formatUnits(allowance ?? BigInt(1), decimals ?? 18)) < Number(repayAmount)
+
+ const setMaxAmount = () => {
+ if (Number(formatUnits(getRepayBalance() ?? BigInt(1), decimals ?? 18)) > debt) {
+ setRepayAmount(debt.toString())
+ } else {
+ setRepayAmount(formatUnits(getRepayBalance() ?? BigInt(1), decimals ?? 18))
+ }
+ }
+
+ useEffect(() => {
+ if (isSuccessRepayTx || isSuccessRepayATokensTx) {
+ handleToast()
+ setOpen(false)
+ }
+ }, [isSuccessRepayTx, isSuccessRepayATokensTx])
+
+ return (
+
+
+
+ {symbol === 'WETH' ? 'ETH' : symbol}
+ |
+ {limitDecimals(debt.toString(), 5)} |
+ {borrowRate.toFixed(2)}% |
+
+
+ |
+
+
+ |
+
+ )
+}
diff --git a/integrations/aave/components/general-info.tsx b/integrations/aave/components/general-info.tsx
new file mode 100644
index 00000000..5575b2a6
--- /dev/null
+++ b/integrations/aave/components/general-info.tsx
@@ -0,0 +1,84 @@
+import { motion } from 'framer-motion'
+import Image from 'next/image'
+import { useNetwork, useSwitchNetwork } from 'wagmi'
+
+import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@/components/ui/select'
+import { FADE_DOWN_ANIMATION_VARIANTS } from '@/config/design'
+
+import { HealthFactor } from './health-factor'
+import { useAave } from '../hooks/use-aave'
+import { marketsData } from '../utils/market-config'
+
+export const GeneralInfo = () => {
+ const { chain } = useNetwork()
+ const { switchNetwork } = useSwitchNetwork()
+
+ const { balanceInUsd, totalDebtInUsd, healthFactor, averageNetApy } = useAave()
+
+ return (
+
+
+
Select Chain
+
+
+
+
+
+
+
+
Net Worth
+
+ $
+ {balanceInUsd > 0 ? (balanceInUsd - totalDebtInUsd).toFixed(2) : '0'}
+
{' '}
+
+
+
Net APY
+
+ {balanceInUsd > 0 ? (
+ <>
+ {averageNetApy.toFixed(2)}
+ %
+ >
+ ) : (
+ '—'
+ )}
+
{' '}
+
+ {totalDebtInUsd > 0 ? (
+
+
Health Factor
+
+
+ ) : (
+
+ )}
+
+
+
+ )
+}
diff --git a/integrations/aave/components/health-factor.tsx b/integrations/aave/components/health-factor.tsx
new file mode 100644
index 00000000..f2ee80eb
--- /dev/null
+++ b/integrations/aave/components/health-factor.tsx
@@ -0,0 +1,16 @@
+interface IHealthFactorProps {
+ value: number
+}
+
+export const HealthFactor = ({ value }: IHealthFactorProps) => {
+ let healthFactorColor = ''
+ if (value >= 3) {
+ healthFactorColor = 'text-green-500'
+ } else if (value > 1.5) {
+ healthFactorColor = 'text-yellow-500'
+ } else {
+ healthFactorColor = 'text-red-500'
+ }
+
+ return {value.toFixed(2)}
+}
diff --git a/integrations/aave/components/list-assets-to-borrow.tsx b/integrations/aave/components/list-assets-to-borrow.tsx
new file mode 100644
index 00000000..8050e920
--- /dev/null
+++ b/integrations/aave/components/list-assets-to-borrow.tsx
@@ -0,0 +1,50 @@
+import { AssetToBorrowItem } from './asset-to-borrow-item'
+import { useAave } from '../hooks/use-aave'
+
+export const ListAssetsToBorrow = () => {
+ const { usdData } = useAave()
+
+ return (
+
+
+
Asssets to borrow
+
+
+
+
+
+ Asset |
+ Available |
+ APY, variable |
+ APY, stable |
+
+
+
+ {usdData?.map((userReserve, index) => {
+ if (userReserve.reserveData.borrowingEnabled) {
+ return (
+
+ )
+ }
+ })}
+
+
+
+
+ )
+}
diff --git a/integrations/aave/components/list-assets-to-supply.tsx b/integrations/aave/components/list-assets-to-supply.tsx
new file mode 100644
index 00000000..6b4bd07b
--- /dev/null
+++ b/integrations/aave/components/list-assets-to-supply.tsx
@@ -0,0 +1,52 @@
+import { useState } from 'react'
+
+import { Checkbox } from '@/components/ui/checkbox'
+
+import { AssetToSupplyItem } from './asset-to-supply-item'
+import { useAave } from '../hooks/use-aave'
+
+export const ListAssetsToSupply = () => {
+ const { usdData } = useAave()
+ const [showZeroBalanceAssets, setShowZeroBalanceAssets] = useState(false)
+
+ return (
+
+
+
Asssets to supply
+
+
+ setShowZeroBalanceAssets(!showZeroBalanceAssets)} />
+
+
+
+
+
+
+ Asset |
+ Wallet balance |
+ APY |
+ Can be collateral |
+
+
+
+ {usdData?.map((reserve, index) => {
+ return (
+
+ )
+ })}
+
+
+
+
+ )
+}
diff --git a/integrations/aave/components/list-borrowed-assets.tsx b/integrations/aave/components/list-borrowed-assets.tsx
new file mode 100644
index 00000000..7aaa7b32
--- /dev/null
+++ b/integrations/aave/components/list-borrowed-assets.tsx
@@ -0,0 +1,90 @@
+import { BorrowedAssetsItem } from './borrowed-assets-item'
+import { useAave } from '../hooks/use-aave'
+
+export const ListBorrowedAssets = () => {
+ const { usdData, totalDebtInUsd, averageBorrowApy } = useAave()
+
+ const filteredUserReserves = usdData?.filter((reserve) => {
+ // If debt > 0.00001
+ const exponent = reserve.reserveData.decimals - BigInt(5)
+ const comparisonValue = exponent >= 0 ? BigInt(1) * BigInt(10) ** exponent : BigInt(1) / BigInt(10) ** -exponent
+
+ return reserve.scaledVariableDebt > comparisonValue || reserve.principalStableDebt > comparisonValue
+ })
+
+ return (
+
+
+
Your Borrows
+
+ {filteredUserReserves && filteredUserReserves.length > 0 ? (
+ <>
+
+
+
+ Debt $
+ {totalDebtInUsd.toFixed(2)}
+
+
+
+
+ APY {averageBorrowApy.toFixed(2)}{' '}
+ %
+
+
+
+
+
+
+
+ Asset |
+ Debt |
+ APY |
+ APY Type |
+
+
+
+ {filteredUserReserves?.map((userReserve, index) => {
+ const reserve = usdData?.find((reserve) => reserve.underlyingAsset === userReserve.underlyingAsset)
+ const isVariableRate = userReserve.scaledVariableDebt > BigInt(0)
+ const decimalsAsNumber = Number(reserve?.reserveData.decimals) ?? 18
+
+ return (
+
+ )
+ })}
+
+
+
{' '}
+ >
+ ) : (
+
Nothing borrowed yet
+ )}
+
+ )
+}
diff --git a/integrations/aave/components/list-supplied-assets.tsx b/integrations/aave/components/list-supplied-assets.tsx
new file mode 100644
index 00000000..aceae0a2
--- /dev/null
+++ b/integrations/aave/components/list-supplied-assets.tsx
@@ -0,0 +1,82 @@
+import { useAave } from '../hooks/use-aave'
+import { SuppliedAssetsItem } from './supplied-assets-item'
+
+export const ListSuppliedAssets = () => {
+ const { usdData, balanceInUsd, collateralInUsd, averageSupplyApy } = useAave()
+
+ const filteredUserReserves = usdData?.filter((reserve) => {
+ // If balance > 0.00001
+ const exponent = reserve.reserveData.decimals - BigInt(5)
+ return exponent >= 0
+ ? reserve.scaledATokenBalance > BigInt(1) * BigInt(10) ** exponent
+ : reserve.scaledATokenBalance > BigInt(1) / BigInt(10) ** -exponent
+ })
+
+ return (
+
+
+
Your Supplies
+
+ {filteredUserReserves && filteredUserReserves.length > 0 ? (
+ <>
+
+
+
+ Balance $
+ {balanceInUsd.toFixed(2)}
+
+
+
+
+ APY {averageSupplyApy.toFixed(2)}{' '}
+ %
+
+
+
+
+ Collateral $
+ {collateralInUsd.toFixed(2)}
+
+
+
+
+
+
+
+ Asset |
+ Balance |
+ APY |
+ Collateral |
+
+
+
+ {filteredUserReserves.map((reserve, index) => {
+ return (
+
+ )
+ })}
+
+
+
+ >
+ ) : (
+
Nothing supplied yet
+ )}
+
+ )
+}
diff --git a/integrations/aave/components/spinner.tsx b/integrations/aave/components/spinner.tsx
new file mode 100644
index 00000000..eeeb4868
--- /dev/null
+++ b/integrations/aave/components/spinner.tsx
@@ -0,0 +1,10 @@
+import { HTMLAttributes } from 'react'
+
+import { cn } from '@/lib/utils'
+export const Spinner = ({ className, ...props }: HTMLAttributes) => {
+ return (
+
+ )
+}
diff --git a/integrations/aave/components/supplied-assets-item.tsx b/integrations/aave/components/supplied-assets-item.tsx
new file mode 100644
index 00000000..0a64d2e4
--- /dev/null
+++ b/integrations/aave/components/supplied-assets-item.tsx
@@ -0,0 +1,210 @@
+import { useEffect, useState } from 'react'
+
+import Image from 'next/image'
+import { TiArrowRight } from 'react-icons/ti'
+import { parseUnits } from 'viem'
+import { useAccount, useWaitForTransaction } from 'wagmi'
+
+import { ContractWriteButton } from '@/components/blockchain/contract-write-button'
+import { Button } from '@/components/ui/button'
+import { Dialog, DialogContent, DialogDescription, DialogTitle, DialogTrigger } from '@/components/ui/dialog'
+import { Switch } from '@/components/ui/switch'
+import { useErc20Decimals, useErc20Symbol } from '@/lib/generated/blockchain'
+import { useToast } from '@/lib/hooks/use-toast'
+
+import { usePoolSetUserUseReserveAsCollateral, usePoolWithdraw } from '../generated/aave-wagmi'
+import { useAave } from '../hooks/use-aave'
+
+interface ISuppliedAssetsItemProps {
+ address: `0x${string}`
+ balance: number
+ collateralEnabled: boolean
+ liquidityRate: number
+ canBeCollateral: boolean
+}
+
+const getSymbol = (symbol: string | undefined) => (symbol === 'WETH' ? 'ETH' : symbol)
+
+export const SuppliedAssetsItem = ({ address, balance, collateralEnabled, canBeCollateral, liquidityRate }: ISuppliedAssetsItemProps) => {
+ const { address: user } = useAccount()
+ const { poolAddress } = useAave()
+
+ const symbol = getSymbol(useErc20Symbol({ address }).data)
+ const { data: decimals } = useErc20Decimals({ address })
+
+ const [withdrawAmount, setWithdrawAmount] = useState('')
+ const [open, setOpen] = useState(false)
+
+ const { toast } = useToast()
+
+ const handleToast = () => {
+ toast({
+ title: 'Success',
+ description: `${symbol ?? ''} successfully withdrawn`,
+ duration: 4200,
+ })
+ }
+
+ const switchCollateralUsage = () => {
+ writeSetUserUseReserveAsCollateral()
+ }
+
+ const buttonAction = () => {
+ withdrawWrite()
+ }
+
+ const getWithdrawAmount = () => {
+ return parseUnits(`${Number(withdrawAmount)}`, decimals ?? 18)
+ }
+
+ const { error: setUserUseReserveAsCollateralError, write: writeSetUserUseReserveAsCollateral } = usePoolSetUserUseReserveAsCollateral({
+ address: poolAddress,
+ args: [address, !collateralEnabled],
+ })
+
+ const {
+ error: withdrawError,
+ data: data,
+ isLoading: isLoadingWrite,
+ write: withdrawWrite,
+ } = usePoolWithdraw({
+ address: poolAddress,
+ args: [address, getWithdrawAmount(), user as `0x${string}`],
+ })
+
+ const { isLoading: isLoadingTx, isSuccess: isSuccessTx } = useWaitForTransaction({
+ hash: data?.hash,
+ })
+
+ const setMaxAmount = () => setWithdrawAmount(balance.toString())
+
+ useEffect(() => {
+ if (setUserUseReserveAsCollateralError) {
+ if (setUserUseReserveAsCollateralError?.name === 'ContractFunctionExecutionError') {
+ alert("You can't switch collateral mode because it will cause collateral call!")
+ }
+ }
+ }, [setUserUseReserveAsCollateralError])
+
+ useEffect(() => {
+ if (withdrawError) {
+ if (withdrawError?.name === 'ContractFunctionExecutionError') {
+ alert("You can't withdraw that amount because it will cause collateral call!")
+ }
+ }
+ }, [withdrawError])
+
+ useEffect(() => {
+ if (isSuccessTx) {
+ handleToast()
+ setOpen(false)
+ }
+ }, [isSuccessTx])
+
+ return (
+
+
+
+ {symbol === 'WETH' ? 'ETH' : symbol}
+ |
+ {balance.toFixed(5)} |
+ {liquidityRate !== 0 ? `${liquidityRate.toFixed(2)}%` : '0'} |
+
+
+ |
+
+
+ |
+
+ )
+}
diff --git a/integrations/aave/generated/aave-wagmi.ts b/integrations/aave/generated/aave-wagmi.ts
new file mode 100644
index 00000000..c0bf8bbd
--- /dev/null
+++ b/integrations/aave/generated/aave-wagmi.ts
@@ -0,0 +1,2310 @@
+// Generated by @wagmi/cli@1.1.0 on 8/1/2023 at 4:35:23 PM
+import {
+ useContractRead,
+ UseContractReadConfig,
+ useContractWrite,
+ UseContractWriteConfig,
+ usePrepareContractWrite,
+ UsePrepareContractWriteConfig,
+ useContractEvent,
+ UseContractEventConfig,
+} from 'wagmi'
+import { ReadContractResult, WriteContractMode, PrepareWriteContractResult } from 'wagmi/actions'
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// ui-pool-data-provider
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+export const uiPoolDataProviderABI = [
+ {
+ stateMutability: 'nonpayable',
+ type: 'constructor',
+ inputs: [
+ { name: '_networkBaseTokenPriceInUsdProxyAggregator', internalType: 'contract IEACAggregatorProxy', type: 'address' },
+ { name: '_marketReferenceCurrencyPriceInUsdProxyAggregator', internalType: 'contract IEACAggregatorProxy', type: 'address' },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'ETH_CURRENCY_UNIT',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ { stateMutability: 'view', type: 'function', inputs: [], name: 'MKR_ADDRESS', outputs: [{ name: '', internalType: 'address', type: 'address' }] },
+ {
+ stateMutability: 'pure',
+ type: 'function',
+ inputs: [{ name: '_bytes32', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'bytes32ToString',
+ outputs: [{ name: '', internalType: 'string', type: 'string' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'provider', internalType: 'contract IPoolAddressesProvider', type: 'address' }],
+ name: 'getReservesData',
+ outputs: [
+ {
+ name: '',
+ internalType: 'struct IUiPoolDataProviderV3.AggregatedReserveData[]',
+ type: 'tuple[]',
+ components: [
+ { name: 'underlyingAsset', internalType: 'address', type: 'address' },
+ { name: 'name', internalType: 'string', type: 'string' },
+ { name: 'symbol', internalType: 'string', type: 'string' },
+ { name: 'decimals', internalType: 'uint256', type: 'uint256' },
+ { name: 'baseLTVasCollateral', internalType: 'uint256', type: 'uint256' },
+ { name: 'reserveLiquidationThreshold', internalType: 'uint256', type: 'uint256' },
+ { name: 'reserveLiquidationBonus', internalType: 'uint256', type: 'uint256' },
+ { name: 'reserveFactor', internalType: 'uint256', type: 'uint256' },
+ { name: 'usageAsCollateralEnabled', internalType: 'bool', type: 'bool' },
+ { name: 'borrowingEnabled', internalType: 'bool', type: 'bool' },
+ { name: 'stableBorrowRateEnabled', internalType: 'bool', type: 'bool' },
+ { name: 'isActive', internalType: 'bool', type: 'bool' },
+ { name: 'isFrozen', internalType: 'bool', type: 'bool' },
+ { name: 'liquidityIndex', internalType: 'uint128', type: 'uint128' },
+ { name: 'variableBorrowIndex', internalType: 'uint128', type: 'uint128' },
+ { name: 'liquidityRate', internalType: 'uint128', type: 'uint128' },
+ { name: 'variableBorrowRate', internalType: 'uint128', type: 'uint128' },
+ { name: 'stableBorrowRate', internalType: 'uint128', type: 'uint128' },
+ { name: 'lastUpdateTimestamp', internalType: 'uint40', type: 'uint40' },
+ { name: 'aTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'stableDebtTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'variableDebtTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'interestRateStrategyAddress', internalType: 'address', type: 'address' },
+ { name: 'availableLiquidity', internalType: 'uint256', type: 'uint256' },
+ { name: 'totalPrincipalStableDebt', internalType: 'uint256', type: 'uint256' },
+ { name: 'averageStableRate', internalType: 'uint256', type: 'uint256' },
+ { name: 'stableDebtLastUpdateTimestamp', internalType: 'uint256', type: 'uint256' },
+ { name: 'totalScaledVariableDebt', internalType: 'uint256', type: 'uint256' },
+ { name: 'priceInMarketReferenceCurrency', internalType: 'uint256', type: 'uint256' },
+ { name: 'priceOracle', internalType: 'address', type: 'address' },
+ { name: 'variableRateSlope1', internalType: 'uint256', type: 'uint256' },
+ { name: 'variableRateSlope2', internalType: 'uint256', type: 'uint256' },
+ { name: 'stableRateSlope1', internalType: 'uint256', type: 'uint256' },
+ { name: 'stableRateSlope2', internalType: 'uint256', type: 'uint256' },
+ { name: 'baseStableBorrowRate', internalType: 'uint256', type: 'uint256' },
+ { name: 'baseVariableBorrowRate', internalType: 'uint256', type: 'uint256' },
+ { name: 'optimalUsageRatio', internalType: 'uint256', type: 'uint256' },
+ { name: 'isPaused', internalType: 'bool', type: 'bool' },
+ { name: 'isSiloedBorrowing', internalType: 'bool', type: 'bool' },
+ { name: 'accruedToTreasury', internalType: 'uint128', type: 'uint128' },
+ { name: 'unbacked', internalType: 'uint128', type: 'uint128' },
+ { name: 'isolationModeTotalDebt', internalType: 'uint128', type: 'uint128' },
+ { name: 'flashLoanEnabled', internalType: 'bool', type: 'bool' },
+ { name: 'debtCeiling', internalType: 'uint256', type: 'uint256' },
+ { name: 'debtCeilingDecimals', internalType: 'uint256', type: 'uint256' },
+ { name: 'eModeCategoryId', internalType: 'uint8', type: 'uint8' },
+ { name: 'borrowCap', internalType: 'uint256', type: 'uint256' },
+ { name: 'supplyCap', internalType: 'uint256', type: 'uint256' },
+ { name: 'eModeLtv', internalType: 'uint16', type: 'uint16' },
+ { name: 'eModeLiquidationThreshold', internalType: 'uint16', type: 'uint16' },
+ { name: 'eModeLiquidationBonus', internalType: 'uint16', type: 'uint16' },
+ { name: 'eModePriceSource', internalType: 'address', type: 'address' },
+ { name: 'eModeLabel', internalType: 'string', type: 'string' },
+ { name: 'borrowableInIsolation', internalType: 'bool', type: 'bool' },
+ ],
+ },
+ {
+ name: '',
+ internalType: 'struct IUiPoolDataProviderV3.BaseCurrencyInfo',
+ type: 'tuple',
+ components: [
+ { name: 'marketReferenceCurrencyUnit', internalType: 'uint256', type: 'uint256' },
+ { name: 'marketReferenceCurrencyPriceInUsd', internalType: 'int256', type: 'int256' },
+ { name: 'networkBaseTokenPriceInUsd', internalType: 'int256', type: 'int256' },
+ { name: 'networkBaseTokenPriceDecimals', internalType: 'uint8', type: 'uint8' },
+ ],
+ },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'provider', internalType: 'contract IPoolAddressesProvider', type: 'address' }],
+ name: 'getReservesList',
+ outputs: [{ name: '', internalType: 'address[]', type: 'address[]' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [
+ { name: 'provider', internalType: 'contract IPoolAddressesProvider', type: 'address' },
+ { name: 'user', internalType: 'address', type: 'address' },
+ ],
+ name: 'getUserReservesData',
+ outputs: [
+ {
+ name: '',
+ internalType: 'struct IUiPoolDataProviderV3.UserReserveData[]',
+ type: 'tuple[]',
+ components: [
+ { name: 'underlyingAsset', internalType: 'address', type: 'address' },
+ { name: 'scaledATokenBalance', internalType: 'uint256', type: 'uint256' },
+ { name: 'usageAsCollateralEnabledOnUser', internalType: 'bool', type: 'bool' },
+ { name: 'stableBorrowRate', internalType: 'uint256', type: 'uint256' },
+ { name: 'scaledVariableDebt', internalType: 'uint256', type: 'uint256' },
+ { name: 'principalStableDebt', internalType: 'uint256', type: 'uint256' },
+ { name: 'stableBorrowLastUpdateTimestamp', internalType: 'uint256', type: 'uint256' },
+ ],
+ },
+ { name: '', internalType: 'uint8', type: 'uint8' },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'marketReferenceCurrencyPriceInUsdProxyAggregator',
+ outputs: [{ name: '', internalType: 'contract IEACAggregatorProxy', type: 'address' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'networkBaseTokenPriceInUsdProxyAggregator',
+ outputs: [{ name: '', internalType: 'contract IEACAggregatorProxy', type: 'address' }],
+ },
+] as const
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// pool
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+export const poolABI = [
+ {
+ stateMutability: 'nonpayable',
+ type: 'constructor',
+ inputs: [{ name: 'provider', internalType: 'contract IPoolAddressesProvider', type: 'address' }],
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'backer', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'fee', internalType: 'uint256', type: 'uint256', indexed: false },
+ ],
+ name: 'BackUnbacked',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: false },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'interestRateMode', internalType: 'enum DataTypes.InterestRateMode', type: 'uint8', indexed: false },
+ { name: 'borrowRate', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16', indexed: true },
+ ],
+ name: 'Borrow',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'target', internalType: 'address', type: 'address', indexed: true },
+ { name: 'initiator', internalType: 'address', type: 'address', indexed: false },
+ { name: 'asset', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'interestRateMode', internalType: 'enum DataTypes.InterestRateMode', type: 'uint8', indexed: false },
+ { name: 'premium', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16', indexed: true },
+ ],
+ name: 'FlashLoan',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address', indexed: true },
+ { name: 'totalDebt', internalType: 'uint256', type: 'uint256', indexed: false },
+ ],
+ name: 'IsolationModeTotalDebtUpdated',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'collateralAsset', internalType: 'address', type: 'address', indexed: true },
+ { name: 'debtAsset', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ { name: 'debtToCover', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'liquidatedCollateralAmount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'liquidator', internalType: 'address', type: 'address', indexed: false },
+ { name: 'receiveAToken', internalType: 'bool', type: 'bool', indexed: false },
+ ],
+ name: 'LiquidationCall',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: false },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16', indexed: true },
+ ],
+ name: 'MintUnbacked',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amountMinted', internalType: 'uint256', type: 'uint256', indexed: false },
+ ],
+ name: 'MintedToTreasury',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ ],
+ name: 'RebalanceStableBorrowRate',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ { name: 'repayer', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'useATokens', internalType: 'bool', type: 'bool', indexed: false },
+ ],
+ name: 'Repay',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'liquidityRate', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'stableBorrowRate', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'variableBorrowRate', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'liquidityIndex', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'variableBorrowIndex', internalType: 'uint256', type: 'uint256', indexed: false },
+ ],
+ name: 'ReserveDataUpdated',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ ],
+ name: 'ReserveUsedAsCollateralDisabled',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ ],
+ name: 'ReserveUsedAsCollateralEnabled',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: false },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16', indexed: true },
+ ],
+ name: 'Supply',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ { name: 'interestRateMode', internalType: 'enum DataTypes.InterestRateMode', type: 'uint8', indexed: false },
+ ],
+ name: 'SwapBorrowRateMode',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ { name: 'categoryId', internalType: 'uint8', type: 'uint8', indexed: false },
+ ],
+ name: 'UserEModeSet',
+ },
+ {
+ type: 'event',
+ anonymous: false,
+ inputs: [
+ { name: 'reserve', internalType: 'address', type: 'address', indexed: true },
+ { name: 'user', internalType: 'address', type: 'address', indexed: true },
+ { name: 'to', internalType: 'address', type: 'address', indexed: true },
+ { name: 'amount', internalType: 'uint256', type: 'uint256', indexed: false },
+ ],
+ name: 'Withdraw',
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'ADDRESSES_PROVIDER',
+ outputs: [{ name: '', internalType: 'contract IPoolAddressesProvider', type: 'address' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'BRIDGE_PROTOCOL_FEE',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'FLASHLOAN_PREMIUM_TOTAL',
+ outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'FLASHLOAN_PREMIUM_TO_PROTOCOL',
+ outputs: [{ name: '', internalType: 'uint128', type: 'uint128' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'MAX_NUMBER_RESERVES',
+ outputs: [{ name: '', internalType: 'uint16', type: 'uint16' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'MAX_STABLE_RATE_BORROW_SIZE_PERCENT',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ { stateMutability: 'view', type: 'function', inputs: [], name: 'POOL_REVISION', outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }] },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'fee', internalType: 'uint256', type: 'uint256' },
+ ],
+ name: 'backUnbacked',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'interestRateMode', internalType: 'uint256', type: 'uint256' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ ],
+ name: 'borrow',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'borrow',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'id', internalType: 'uint8', type: 'uint8' },
+ {
+ name: 'category',
+ internalType: 'struct DataTypes.EModeCategory',
+ type: 'tuple',
+ components: [
+ { name: 'ltv', internalType: 'uint16', type: 'uint16' },
+ { name: 'liquidationThreshold', internalType: 'uint16', type: 'uint16' },
+ { name: 'liquidationBonus', internalType: 'uint16', type: 'uint16' },
+ { name: 'priceSource', internalType: 'address', type: 'address' },
+ { name: 'label', internalType: 'string', type: 'string' },
+ ],
+ },
+ ],
+ name: 'configureEModeCategory',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ ],
+ name: 'deposit',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'asset', internalType: 'address', type: 'address' }],
+ name: 'dropReserve',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'from', internalType: 'address', type: 'address' },
+ { name: 'to', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'balanceFromBefore', internalType: 'uint256', type: 'uint256' },
+ { name: 'balanceToBefore', internalType: 'uint256', type: 'uint256' },
+ ],
+ name: 'finalizeTransfer',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'receiverAddress', internalType: 'address', type: 'address' },
+ { name: 'assets', internalType: 'address[]', type: 'address[]' },
+ { name: 'amounts', internalType: 'uint256[]', type: 'uint256[]' },
+ { name: 'interestRateModes', internalType: 'uint256[]', type: 'uint256[]' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ { name: 'params', internalType: 'bytes', type: 'bytes' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ ],
+ name: 'flashLoan',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'receiverAddress', internalType: 'address', type: 'address' },
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'params', internalType: 'bytes', type: 'bytes' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ ],
+ name: 'flashLoanSimple',
+ outputs: [],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'asset', internalType: 'address', type: 'address' }],
+ name: 'getConfiguration',
+ outputs: [
+ {
+ name: '',
+ internalType: 'struct DataTypes.ReserveConfigurationMap',
+ type: 'tuple',
+ components: [{ name: 'data', internalType: 'uint256', type: 'uint256' }],
+ },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'id', internalType: 'uint8', type: 'uint8' }],
+ name: 'getEModeCategoryData',
+ outputs: [
+ {
+ name: '',
+ internalType: 'struct DataTypes.EModeCategory',
+ type: 'tuple',
+ components: [
+ { name: 'ltv', internalType: 'uint16', type: 'uint16' },
+ { name: 'liquidationThreshold', internalType: 'uint16', type: 'uint16' },
+ { name: 'liquidationBonus', internalType: 'uint16', type: 'uint16' },
+ { name: 'priceSource', internalType: 'address', type: 'address' },
+ { name: 'label', internalType: 'string', type: 'string' },
+ ],
+ },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'id', internalType: 'uint16', type: 'uint16' }],
+ name: 'getReserveAddressById',
+ outputs: [{ name: '', internalType: 'address', type: 'address' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'asset', internalType: 'address', type: 'address' }],
+ name: 'getReserveData',
+ outputs: [
+ {
+ name: '',
+ internalType: 'struct DataTypes.ReserveData',
+ type: 'tuple',
+ components: [
+ {
+ name: 'configuration',
+ internalType: 'struct DataTypes.ReserveConfigurationMap',
+ type: 'tuple',
+ components: [{ name: 'data', internalType: 'uint256', type: 'uint256' }],
+ },
+ { name: 'liquidityIndex', internalType: 'uint128', type: 'uint128' },
+ { name: 'currentLiquidityRate', internalType: 'uint128', type: 'uint128' },
+ { name: 'variableBorrowIndex', internalType: 'uint128', type: 'uint128' },
+ { name: 'currentVariableBorrowRate', internalType: 'uint128', type: 'uint128' },
+ { name: 'currentStableBorrowRate', internalType: 'uint128', type: 'uint128' },
+ { name: 'lastUpdateTimestamp', internalType: 'uint40', type: 'uint40' },
+ { name: 'id', internalType: 'uint16', type: 'uint16' },
+ { name: 'aTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'stableDebtTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'variableDebtTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'interestRateStrategyAddress', internalType: 'address', type: 'address' },
+ { name: 'accruedToTreasury', internalType: 'uint128', type: 'uint128' },
+ { name: 'unbacked', internalType: 'uint128', type: 'uint128' },
+ { name: 'isolationModeTotalDebt', internalType: 'uint128', type: 'uint128' },
+ ],
+ },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'asset', internalType: 'address', type: 'address' }],
+ name: 'getReserveNormalizedIncome',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'asset', internalType: 'address', type: 'address' }],
+ name: 'getReserveNormalizedVariableDebt',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [],
+ name: 'getReservesList',
+ outputs: [{ name: '', internalType: 'address[]', type: 'address[]' }],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'user', internalType: 'address', type: 'address' }],
+ name: 'getUserAccountData',
+ outputs: [
+ { name: 'totalCollateralBase', internalType: 'uint256', type: 'uint256' },
+ { name: 'totalDebtBase', internalType: 'uint256', type: 'uint256' },
+ { name: 'availableBorrowsBase', internalType: 'uint256', type: 'uint256' },
+ { name: 'currentLiquidationThreshold', internalType: 'uint256', type: 'uint256' },
+ { name: 'ltv', internalType: 'uint256', type: 'uint256' },
+ { name: 'healthFactor', internalType: 'uint256', type: 'uint256' },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'user', internalType: 'address', type: 'address' }],
+ name: 'getUserConfiguration',
+ outputs: [
+ {
+ name: '',
+ internalType: 'struct DataTypes.UserConfigurationMap',
+ type: 'tuple',
+ components: [{ name: 'data', internalType: 'uint256', type: 'uint256' }],
+ },
+ ],
+ },
+ {
+ stateMutability: 'view',
+ type: 'function',
+ inputs: [{ name: 'user', internalType: 'address', type: 'address' }],
+ name: 'getUserEMode',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'aTokenAddress', internalType: 'address', type: 'address' },
+ { name: 'stableDebtAddress', internalType: 'address', type: 'address' },
+ { name: 'variableDebtAddress', internalType: 'address', type: 'address' },
+ { name: 'interestRateStrategyAddress', internalType: 'address', type: 'address' },
+ ],
+ name: 'initReserve',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'provider', internalType: 'contract IPoolAddressesProvider', type: 'address' }],
+ name: 'initialize',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'collateralAsset', internalType: 'address', type: 'address' },
+ { name: 'debtAsset', internalType: 'address', type: 'address' },
+ { name: 'user', internalType: 'address', type: 'address' },
+ { name: 'debtToCover', internalType: 'uint256', type: 'uint256' },
+ { name: 'receiveAToken', internalType: 'bool', type: 'bool' },
+ ],
+ name: 'liquidationCall',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'args1', internalType: 'bytes32', type: 'bytes32' },
+ { name: 'args2', internalType: 'bytes32', type: 'bytes32' },
+ ],
+ name: 'liquidationCall',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'assets', internalType: 'address[]', type: 'address[]' }],
+ name: 'mintToTreasury',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ ],
+ name: 'mintUnbacked',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'rebalanceStableBorrowRate',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'user', internalType: 'address', type: 'address' },
+ ],
+ name: 'rebalanceStableBorrowRate',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'repay',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'interestRateMode', internalType: 'uint256', type: 'uint256' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ ],
+ name: 'repay',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'interestRateMode', internalType: 'uint256', type: 'uint256' },
+ ],
+ name: 'repayWithATokens',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'repayWithATokens',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'args', internalType: 'bytes32', type: 'bytes32' },
+ { name: 'r', internalType: 'bytes32', type: 'bytes32' },
+ { name: 's', internalType: 'bytes32', type: 'bytes32' },
+ ],
+ name: 'repayWithPermit',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'interestRateMode', internalType: 'uint256', type: 'uint256' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ { name: 'deadline', internalType: 'uint256', type: 'uint256' },
+ { name: 'permitV', internalType: 'uint8', type: 'uint8' },
+ { name: 'permitR', internalType: 'bytes32', type: 'bytes32' },
+ { name: 'permitS', internalType: 'bytes32', type: 'bytes32' },
+ ],
+ name: 'repayWithPermit',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'token', internalType: 'address', type: 'address' },
+ { name: 'to', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ ],
+ name: 'rescueTokens',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'asset', internalType: 'address', type: 'address' }],
+ name: 'resetIsolationModeTotalDebt',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ {
+ name: 'configuration',
+ internalType: 'struct DataTypes.ReserveConfigurationMap',
+ type: 'tuple',
+ components: [{ name: 'data', internalType: 'uint256', type: 'uint256' }],
+ },
+ ],
+ name: 'setConfiguration',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'rateStrategyAddress', internalType: 'address', type: 'address' },
+ ],
+ name: 'setReserveInterestRateStrategyAddress',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'categoryId', internalType: 'uint8', type: 'uint8' }],
+ name: 'setUserEMode',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'setUserUseReserveAsCollateral',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'useAsCollateral', internalType: 'bool', type: 'bool' },
+ ],
+ name: 'setUserUseReserveAsCollateral',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ ],
+ name: 'supply',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'supply',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'onBehalfOf', internalType: 'address', type: 'address' },
+ { name: 'referralCode', internalType: 'uint16', type: 'uint16' },
+ { name: 'deadline', internalType: 'uint256', type: 'uint256' },
+ { name: 'permitV', internalType: 'uint8', type: 'uint8' },
+ { name: 'permitR', internalType: 'bytes32', type: 'bytes32' },
+ { name: 'permitS', internalType: 'bytes32', type: 'bytes32' },
+ ],
+ name: 'supplyWithPermit',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'args', internalType: 'bytes32', type: 'bytes32' },
+ { name: 'r', internalType: 'bytes32', type: 'bytes32' },
+ { name: 's', internalType: 'bytes32', type: 'bytes32' },
+ ],
+ name: 'supplyWithPermit',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'swapBorrowRateMode',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'interestRateMode', internalType: 'uint256', type: 'uint256' },
+ ],
+ name: 'swapBorrowRateMode',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'protocolFee', internalType: 'uint256', type: 'uint256' }],
+ name: 'updateBridgeProtocolFee',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'flashLoanPremiumTotal', internalType: 'uint128', type: 'uint128' },
+ { name: 'flashLoanPremiumToProtocol', internalType: 'uint128', type: 'uint128' },
+ ],
+ name: 'updateFlashloanPremiums',
+ outputs: [],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [
+ { name: 'asset', internalType: 'address', type: 'address' },
+ { name: 'amount', internalType: 'uint256', type: 'uint256' },
+ { name: 'to', internalType: 'address', type: 'address' },
+ ],
+ name: 'withdraw',
+ outputs: [{ name: '', internalType: 'uint256', type: 'uint256' }],
+ },
+ {
+ stateMutability: 'nonpayable',
+ type: 'function',
+ inputs: [{ name: 'args', internalType: 'bytes32', type: 'bytes32' }],
+ name: 'withdraw',
+ outputs: [],
+ },
+] as const
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+// React
+//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__.
+ */
+export function useUiPoolDataProviderRead<
+ TFunctionName extends string,
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, ...config } as UseContractReadConfig)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"ETH_CURRENCY_UNIT"`.
+ */
+export function useUiPoolDataProviderEthCurrencyUnit<
+ TFunctionName extends 'ETH_CURRENCY_UNIT',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, functionName: 'ETH_CURRENCY_UNIT', ...config } as UseContractReadConfig<
+ typeof uiPoolDataProviderABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"MKR_ADDRESS"`.
+ */
+export function useUiPoolDataProviderMkrAddress<
+ TFunctionName extends 'MKR_ADDRESS',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, functionName: 'MKR_ADDRESS', ...config } as UseContractReadConfig<
+ typeof uiPoolDataProviderABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"bytes32ToString"`.
+ */
+export function useUiPoolDataProviderBytes32ToString<
+ TFunctionName extends 'bytes32ToString',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, functionName: 'bytes32ToString', ...config } as UseContractReadConfig<
+ typeof uiPoolDataProviderABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"getReservesData"`.
+ */
+export function useUiPoolDataProviderGetReservesData<
+ TFunctionName extends 'getReservesData',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, functionName: 'getReservesData', ...config } as UseContractReadConfig<
+ typeof uiPoolDataProviderABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"getReservesList"`.
+ */
+export function useUiPoolDataProviderGetReservesList<
+ TFunctionName extends 'getReservesList',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, functionName: 'getReservesList', ...config } as UseContractReadConfig<
+ typeof uiPoolDataProviderABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"getUserReservesData"`.
+ */
+export function useUiPoolDataProviderGetUserReservesData<
+ TFunctionName extends 'getUserReservesData',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: uiPoolDataProviderABI, functionName: 'getUserReservesData', ...config } as UseContractReadConfig<
+ typeof uiPoolDataProviderABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"marketReferenceCurrencyPriceInUsdProxyAggregator"`.
+ */
+export function useUiPoolDataProviderMarketReferenceCurrencyPriceInUsdProxyAggregator<
+ TFunctionName extends 'marketReferenceCurrencyPriceInUsdProxyAggregator',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({
+ abi: uiPoolDataProviderABI,
+ functionName: 'marketReferenceCurrencyPriceInUsdProxyAggregator',
+ ...config,
+ } as UseContractReadConfig)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"networkBaseTokenPriceInUsdProxyAggregator"`.
+ */
+export function useUiPoolDataProviderNetworkBaseTokenPriceInUsdProxyAggregator<
+ TFunctionName extends 'networkBaseTokenPriceInUsdProxyAggregator',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({
+ abi: uiPoolDataProviderABI,
+ functionName: 'networkBaseTokenPriceInUsdProxyAggregator',
+ ...config,
+ } as UseContractReadConfig)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__.
+ */
+export function usePoolRead>(
+ config: Omit, 'abi'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, ...config } as UseContractReadConfig)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"ADDRESSES_PROVIDER"`.
+ */
+export function usePoolAddressesProvider>(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, functionName: 'ADDRESSES_PROVIDER', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"BRIDGE_PROTOCOL_FEE"`.
+ */
+export function usePoolBridgeProtocolFee<
+ TFunctionName extends 'BRIDGE_PROTOCOL_FEE',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'BRIDGE_PROTOCOL_FEE', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"FLASHLOAN_PREMIUM_TOTAL"`.
+ */
+export function usePoolFlashloanPremiumTotal<
+ TFunctionName extends 'FLASHLOAN_PREMIUM_TOTAL',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'FLASHLOAN_PREMIUM_TOTAL', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"FLASHLOAN_PREMIUM_TO_PROTOCOL"`.
+ */
+export function usePoolFlashloanPremiumToProtocol<
+ TFunctionName extends 'FLASHLOAN_PREMIUM_TO_PROTOCOL',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'FLASHLOAN_PREMIUM_TO_PROTOCOL', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"MAX_NUMBER_RESERVES"`.
+ */
+export function usePoolMaxNumberReserves<
+ TFunctionName extends 'MAX_NUMBER_RESERVES',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'MAX_NUMBER_RESERVES', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"MAX_STABLE_RATE_BORROW_SIZE_PERCENT"`.
+ */
+export function usePoolMaxStableRateBorrowSizePercent<
+ TFunctionName extends 'MAX_STABLE_RATE_BORROW_SIZE_PERCENT',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'MAX_STABLE_RATE_BORROW_SIZE_PERCENT', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"POOL_REVISION"`.
+ */
+export function usePoolPoolRevision>(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, functionName: 'POOL_REVISION', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getConfiguration"`.
+ */
+export function usePoolGetConfiguration>(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, functionName: 'getConfiguration', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getEModeCategoryData"`.
+ */
+export function usePoolGetEModeCategoryData<
+ TFunctionName extends 'getEModeCategoryData',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'getEModeCategoryData', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveAddressById"`.
+ */
+export function usePoolGetReserveAddressById<
+ TFunctionName extends 'getReserveAddressById',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'getReserveAddressById', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveData"`.
+ */
+export function usePoolGetReserveData>(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, functionName: 'getReserveData', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveNormalizedIncome"`.
+ */
+export function usePoolGetReserveNormalizedIncome<
+ TFunctionName extends 'getReserveNormalizedIncome',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'getReserveNormalizedIncome', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveNormalizedVariableDebt"`.
+ */
+export function usePoolGetReserveNormalizedVariableDebt<
+ TFunctionName extends 'getReserveNormalizedVariableDebt',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'getReserveNormalizedVariableDebt', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReservesList"`.
+ */
+export function usePoolGetReservesList>(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, functionName: 'getReservesList', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getUserAccountData"`.
+ */
+export function usePoolGetUserAccountData<
+ TFunctionName extends 'getUserAccountData',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'getUserAccountData', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getUserConfiguration"`.
+ */
+export function usePoolGetUserConfiguration<
+ TFunctionName extends 'getUserConfiguration',
+ TSelectData = ReadContractResult
+>(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return useContractRead({ abi: poolABI, functionName: 'getUserConfiguration', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getUserEMode"`.
+ */
+export function usePoolGetUserEMode>(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return useContractRead({ abi: poolABI, functionName: 'getUserEMode', ...config } as UseContractReadConfig<
+ typeof poolABI,
+ TFunctionName,
+ TSelectData
+ >)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__.
+ */
+export function usePoolWrite(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], TFunctionName, TMode>
+ : UseContractWriteConfig & {
+ abi?: never
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"backUnbacked"`.
+ */
+export function usePoolBackUnbacked(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'backUnbacked', TMode> & {
+ functionName?: 'backUnbacked'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'backUnbacked'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'backUnbacked', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"borrow"`.
+ */
+export function usePoolBorrow(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'borrow', TMode> & { functionName?: 'borrow' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'borrow'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'borrow', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"configureEModeCategory"`.
+ */
+export function usePoolConfigureEModeCategory(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'configureEModeCategory',
+ TMode
+ > & { functionName?: 'configureEModeCategory' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'configureEModeCategory'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'configureEModeCategory', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"deposit"`.
+ */
+export function usePoolDeposit(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'deposit', TMode> & { functionName?: 'deposit' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'deposit'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'deposit', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"dropReserve"`.
+ */
+export function usePoolDropReserve(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'dropReserve', TMode> & {
+ functionName?: 'dropReserve'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'dropReserve'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'dropReserve', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"finalizeTransfer"`.
+ */
+export function usePoolFinalizeTransfer(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'finalizeTransfer', TMode> & {
+ functionName?: 'finalizeTransfer'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'finalizeTransfer'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'finalizeTransfer', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"flashLoan"`.
+ */
+export function usePoolFlashLoan(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'flashLoan', TMode> & {
+ functionName?: 'flashLoan'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'flashLoan'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'flashLoan', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"flashLoanSimple"`.
+ */
+export function usePoolFlashLoanSimple(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'flashLoanSimple', TMode> & {
+ functionName?: 'flashLoanSimple'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'flashLoanSimple'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'flashLoanSimple', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"initReserve"`.
+ */
+export function usePoolInitReserve(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'initReserve', TMode> & {
+ functionName?: 'initReserve'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'initReserve'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'initReserve', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"initialize"`.
+ */
+export function usePoolInitialize(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'initialize', TMode> & {
+ functionName?: 'initialize'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'initialize'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'initialize', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"liquidationCall"`.
+ */
+export function usePoolLiquidationCall(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'liquidationCall', TMode> & {
+ functionName?: 'liquidationCall'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'liquidationCall'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'liquidationCall', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"mintToTreasury"`.
+ */
+export function usePoolMintToTreasury(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'mintToTreasury', TMode> & {
+ functionName?: 'mintToTreasury'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'mintToTreasury'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'mintToTreasury', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"mintUnbacked"`.
+ */
+export function usePoolMintUnbacked(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'mintUnbacked', TMode> & {
+ functionName?: 'mintUnbacked'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'mintUnbacked'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'mintUnbacked', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"rebalanceStableBorrowRate"`.
+ */
+export function usePoolRebalanceStableBorrowRate(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'rebalanceStableBorrowRate',
+ TMode
+ > & { functionName?: 'rebalanceStableBorrowRate' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'rebalanceStableBorrowRate'
+ } = {} as any
+) {
+ return useContractWrite({
+ abi: poolABI,
+ functionName: 'rebalanceStableBorrowRate',
+ ...config,
+ } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repay"`.
+ */
+export function usePoolRepay(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'repay', TMode> & { functionName?: 'repay' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'repay'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'repay', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repayWithATokens"`.
+ */
+export function usePoolRepayWithATokens(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'repayWithATokens', TMode> & {
+ functionName?: 'repayWithATokens'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'repayWithATokens'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'repayWithATokens', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repayWithPermit"`.
+ */
+export function usePoolRepayWithPermit(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'repayWithPermit', TMode> & {
+ functionName?: 'repayWithPermit'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'repayWithPermit'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'repayWithPermit', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"rescueTokens"`.
+ */
+export function usePoolRescueTokens(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'rescueTokens', TMode> & {
+ functionName?: 'rescueTokens'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'rescueTokens'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'rescueTokens', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"resetIsolationModeTotalDebt"`.
+ */
+export function usePoolResetIsolationModeTotalDebt(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'resetIsolationModeTotalDebt',
+ TMode
+ > & { functionName?: 'resetIsolationModeTotalDebt' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'resetIsolationModeTotalDebt'
+ } = {} as any
+) {
+ return useContractWrite({
+ abi: poolABI,
+ functionName: 'resetIsolationModeTotalDebt',
+ ...config,
+ } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setConfiguration"`.
+ */
+export function usePoolSetConfiguration(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'setConfiguration', TMode> & {
+ functionName?: 'setConfiguration'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'setConfiguration'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'setConfiguration', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setReserveInterestRateStrategyAddress"`.
+ */
+export function usePoolSetReserveInterestRateStrategyAddress(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'setReserveInterestRateStrategyAddress',
+ TMode
+ > & { functionName?: 'setReserveInterestRateStrategyAddress' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'setReserveInterestRateStrategyAddress'
+ } = {} as any
+) {
+ return useContractWrite({
+ abi: poolABI,
+ functionName: 'setReserveInterestRateStrategyAddress',
+ ...config,
+ } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setUserEMode"`.
+ */
+export function usePoolSetUserEMode(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'setUserEMode', TMode> & {
+ functionName?: 'setUserEMode'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'setUserEMode'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'setUserEMode', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setUserUseReserveAsCollateral"`.
+ */
+export function usePoolSetUserUseReserveAsCollateral(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'setUserUseReserveAsCollateral',
+ TMode
+ > & { functionName?: 'setUserUseReserveAsCollateral' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'setUserUseReserveAsCollateral'
+ } = {} as any
+) {
+ return useContractWrite({
+ abi: poolABI,
+ functionName: 'setUserUseReserveAsCollateral',
+ ...config,
+ } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"supply"`.
+ */
+export function usePoolSupply(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'supply', TMode> & { functionName?: 'supply' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'supply'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'supply', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"supplyWithPermit"`.
+ */
+export function usePoolSupplyWithPermit(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'supplyWithPermit', TMode> & {
+ functionName?: 'supplyWithPermit'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'supplyWithPermit'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'supplyWithPermit', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"swapBorrowRateMode"`.
+ */
+export function usePoolSwapBorrowRateMode(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'swapBorrowRateMode', TMode> & {
+ functionName?: 'swapBorrowRateMode'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'swapBorrowRateMode'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'swapBorrowRateMode', ...config } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"updateBridgeProtocolFee"`.
+ */
+export function usePoolUpdateBridgeProtocolFee(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'updateBridgeProtocolFee',
+ TMode
+ > & { functionName?: 'updateBridgeProtocolFee' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'updateBridgeProtocolFee'
+ } = {} as any
+) {
+ return useContractWrite({
+ abi: poolABI,
+ functionName: 'updateBridgeProtocolFee',
+ ...config,
+ } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"updateFlashloanPremiums"`.
+ */
+export function usePoolUpdateFlashloanPremiums(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig<
+ PrepareWriteContractResult['request']['abi'],
+ 'updateFlashloanPremiums',
+ TMode
+ > & { functionName?: 'updateFlashloanPremiums' }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'updateFlashloanPremiums'
+ } = {} as any
+) {
+ return useContractWrite({
+ abi: poolABI,
+ functionName: 'updateFlashloanPremiums',
+ ...config,
+ } as any)
+}
+
+/**
+ * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"withdraw"`.
+ */
+export function usePoolWithdraw(
+ config: TMode extends 'prepared'
+ ? UseContractWriteConfig['request']['abi'], 'withdraw', TMode> & {
+ functionName?: 'withdraw'
+ }
+ : UseContractWriteConfig & {
+ abi?: never
+ functionName?: 'withdraw'
+ } = {} as any
+) {
+ return useContractWrite({ abi: poolABI, functionName: 'withdraw', ...config } as any)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__.
+ */
+export function usePreparePoolWrite(
+ config: Omit, 'abi'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"backUnbacked"`.
+ */
+export function usePreparePoolBackUnbacked(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'backUnbacked', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'backUnbacked'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"borrow"`.
+ */
+export function usePreparePoolBorrow(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'borrow', ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"configureEModeCategory"`.
+ */
+export function usePreparePoolConfigureEModeCategory(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'configureEModeCategory', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'configureEModeCategory'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"deposit"`.
+ */
+export function usePreparePoolDeposit(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'deposit', ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"dropReserve"`.
+ */
+export function usePreparePoolDropReserve(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'dropReserve', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'dropReserve'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"finalizeTransfer"`.
+ */
+export function usePreparePoolFinalizeTransfer(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'finalizeTransfer', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'finalizeTransfer'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"flashLoan"`.
+ */
+export function usePreparePoolFlashLoan(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'flashLoan', ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"flashLoanSimple"`.
+ */
+export function usePreparePoolFlashLoanSimple(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'flashLoanSimple', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'flashLoanSimple'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"initReserve"`.
+ */
+export function usePreparePoolInitReserve(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'initReserve', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'initReserve'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"initialize"`.
+ */
+export function usePreparePoolInitialize(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'initialize', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'initialize'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"liquidationCall"`.
+ */
+export function usePreparePoolLiquidationCall(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'liquidationCall', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'liquidationCall'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"mintToTreasury"`.
+ */
+export function usePreparePoolMintToTreasury(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'mintToTreasury', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'mintToTreasury'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"mintUnbacked"`.
+ */
+export function usePreparePoolMintUnbacked(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'mintUnbacked', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'mintUnbacked'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"rebalanceStableBorrowRate"`.
+ */
+export function usePreparePoolRebalanceStableBorrowRate(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'rebalanceStableBorrowRate', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'rebalanceStableBorrowRate'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repay"`.
+ */
+export function usePreparePoolRepay(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'repay', ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repayWithATokens"`.
+ */
+export function usePreparePoolRepayWithATokens(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'repayWithATokens', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'repayWithATokens'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repayWithPermit"`.
+ */
+export function usePreparePoolRepayWithPermit(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'repayWithPermit', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'repayWithPermit'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"rescueTokens"`.
+ */
+export function usePreparePoolRescueTokens(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'rescueTokens', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'rescueTokens'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"resetIsolationModeTotalDebt"`.
+ */
+export function usePreparePoolResetIsolationModeTotalDebt(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'resetIsolationModeTotalDebt', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'resetIsolationModeTotalDebt'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setConfiguration"`.
+ */
+export function usePreparePoolSetConfiguration(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'setConfiguration', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'setConfiguration'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setReserveInterestRateStrategyAddress"`.
+ */
+export function usePreparePoolSetReserveInterestRateStrategyAddress(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'setReserveInterestRateStrategyAddress', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'setReserveInterestRateStrategyAddress'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setUserEMode"`.
+ */
+export function usePreparePoolSetUserEMode(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'setUserEMode', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'setUserEMode'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setUserUseReserveAsCollateral"`.
+ */
+export function usePreparePoolSetUserUseReserveAsCollateral(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'setUserUseReserveAsCollateral', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'setUserUseReserveAsCollateral'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"supply"`.
+ */
+export function usePreparePoolSupply(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'supply', ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"supplyWithPermit"`.
+ */
+export function usePreparePoolSupplyWithPermit(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'supplyWithPermit', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'supplyWithPermit'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"swapBorrowRateMode"`.
+ */
+export function usePreparePoolSwapBorrowRateMode(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'swapBorrowRateMode', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'swapBorrowRateMode'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"updateBridgeProtocolFee"`.
+ */
+export function usePreparePoolUpdateBridgeProtocolFee(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'updateBridgeProtocolFee', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'updateBridgeProtocolFee'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"updateFlashloanPremiums"`.
+ */
+export function usePreparePoolUpdateFlashloanPremiums(
+ config: Omit, 'abi' | 'functionName'> = {} as any
+) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'updateFlashloanPremiums', ...config } as UsePrepareContractWriteConfig<
+ typeof poolABI,
+ 'updateFlashloanPremiums'
+ >)
+}
+
+/**
+ * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"withdraw"`.
+ */
+export function usePreparePoolWithdraw(config: Omit, 'abi' | 'functionName'> = {} as any) {
+ return usePrepareContractWrite({ abi: poolABI, functionName: 'withdraw', ...config } as UsePrepareContractWriteConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__.
+ */
+export function usePoolEvent(config: Omit, 'abi'> = {} as any) {
+ return useContractEvent({ abi: poolABI, ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"BackUnbacked"`.
+ */
+export function usePoolBackUnbackedEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'BackUnbacked', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"Borrow"`.
+ */
+export function usePoolBorrowEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'Borrow', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"FlashLoan"`.
+ */
+export function usePoolFlashLoanEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'FlashLoan', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"IsolationModeTotalDebtUpdated"`.
+ */
+export function usePoolIsolationModeTotalDebtUpdatedEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'IsolationModeTotalDebtUpdated', ...config } as UseContractEventConfig<
+ typeof poolABI,
+ 'IsolationModeTotalDebtUpdated'
+ >)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"LiquidationCall"`.
+ */
+export function usePoolLiquidationCallEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'LiquidationCall', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"MintUnbacked"`.
+ */
+export function usePoolMintUnbackedEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'MintUnbacked', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"MintedToTreasury"`.
+ */
+export function usePoolMintedToTreasuryEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'MintedToTreasury', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"RebalanceStableBorrowRate"`.
+ */
+export function usePoolRebalanceStableBorrowRateEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'RebalanceStableBorrowRate', ...config } as UseContractEventConfig<
+ typeof poolABI,
+ 'RebalanceStableBorrowRate'
+ >)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"Repay"`.
+ */
+export function usePoolRepayEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'Repay', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"ReserveDataUpdated"`.
+ */
+export function usePoolReserveDataUpdatedEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'ReserveDataUpdated', ...config } as UseContractEventConfig<
+ typeof poolABI,
+ 'ReserveDataUpdated'
+ >)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"ReserveUsedAsCollateralDisabled"`.
+ */
+export function usePoolReserveUsedAsCollateralDisabledEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'ReserveUsedAsCollateralDisabled', ...config } as UseContractEventConfig<
+ typeof poolABI,
+ 'ReserveUsedAsCollateralDisabled'
+ >)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"ReserveUsedAsCollateralEnabled"`.
+ */
+export function usePoolReserveUsedAsCollateralEnabledEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'ReserveUsedAsCollateralEnabled', ...config } as UseContractEventConfig<
+ typeof poolABI,
+ 'ReserveUsedAsCollateralEnabled'
+ >)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"Supply"`.
+ */
+export function usePoolSupplyEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'Supply', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"SwapBorrowRateMode"`.
+ */
+export function usePoolSwapBorrowRateModeEvent(
+ config: Omit, 'abi' | 'eventName'> = {} as any
+) {
+ return useContractEvent({ abi: poolABI, eventName: 'SwapBorrowRateMode', ...config } as UseContractEventConfig<
+ typeof poolABI,
+ 'SwapBorrowRateMode'
+ >)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"UserEModeSet"`.
+ */
+export function usePoolUserEModeSetEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'UserEModeSet', ...config } as UseContractEventConfig)
+}
+
+/**
+ * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"Withdraw"`.
+ */
+export function usePoolWithdrawEvent(config: Omit, 'abi' | 'eventName'> = {} as any) {
+ return useContractEvent({ abi: poolABI, eventName: 'Withdraw', ...config } as UseContractEventConfig)
+}
diff --git a/integrations/aave/hooks/use-aave.ts b/integrations/aave/hooks/use-aave.ts
new file mode 100644
index 00000000..e65628ff
--- /dev/null
+++ b/integrations/aave/hooks/use-aave.ts
@@ -0,0 +1,105 @@
+import { useEffect, useState } from 'react'
+
+import { useAccount, useNetwork } from 'wagmi'
+
+import { useUiPoolDataProviderGetReservesData, useUiPoolDataProviderGetUserReservesData } from '../generated/aave-wagmi'
+import { getDefaultUseAaveState } from '../utils'
+import { MarketDataType, marketsData } from '../utils/market-config'
+import { AaveState, ReserveData, UsdData, UserReserveData } from '../utils/types'
+
+export const useAave = () => {
+ const { address: user } = useAccount()
+ const { chain } = useNetwork()
+ const [market, setMarket] = useState(null)
+ const [data, setData] = useState(getDefaultUseAaveState())
+
+ const { data: reservesData } = useUiPoolDataProviderGetReservesData({
+ address: market?.addresses.UI_POOL_DATA_PROVIDER,
+ args: market ? [market?.addresses.LENDING_POOL_ADDRESS_PROVIDER] : undefined,
+ watch: true,
+ })
+
+ const userReservesData = useUiPoolDataProviderGetUserReservesData({
+ address: market?.addresses.UI_POOL_DATA_PROVIDER,
+ args: market && user ? [market?.addresses.LENDING_POOL_ADDRESS_PROVIDER, user] : undefined,
+ watch: true,
+ }).data?.[0] as UserReserveData[]
+
+ useEffect(() => {
+ setMarket(marketsData?.find((market) => market.chainId === chain?.id) ?? null)
+ }, [chain, userReservesData, reservesData])
+
+ useEffect(() => {
+ if (userReservesData) {
+ let balanceInUsd = 0
+ let collateralInUsd = 0
+ let totalDebtInUsd = 0
+ let maxBorrowableInUsd = 0
+
+ const usdData = userReservesData.map((userReserveData) => {
+ const reserveData = reservesData?.[0].find((reserve) => reserve.underlyingAsset === userReserveData.underlyingAsset) as ReserveData
+
+ const tokenPriceInUsd = Number(reserveData?.priceInMarketReferenceCurrency) / Number(reservesData?.[1].marketReferenceCurrencyPriceInUsd)
+ const amountInUsd =
+ (((Number(userReserveData.scaledATokenBalance) / 10 ** Number(reserveData.decimals)) * Number(reserveData.liquidityIndex)) / 10 ** 27) *
+ tokenPriceInUsd
+ const debtInUsd =
+ (((Number(userReserveData.scaledVariableDebt || userReserveData.principalStableDebt) / 10 ** 18) *
+ Number(reserveData.variableBorrowIndex)) /
+ 10 ** 27) *
+ tokenPriceInUsd
+
+ balanceInUsd += amountInUsd
+ totalDebtInUsd += debtInUsd
+
+ if (userReserveData.usageAsCollateralEnabledOnUser) {
+ collateralInUsd += amountInUsd
+ maxBorrowableInUsd += amountInUsd * (Number(reserveData.baseLTVasCollateral) / 10000)
+ }
+
+ return {
+ ...userReserveData,
+ reserveData,
+ tokenPriceInUsd,
+ amountInUsd,
+ debtInUsd,
+ }
+ }) as UsdData[]
+
+ const netWorth = balanceInUsd - totalDebtInUsd
+ let averageLiquidationThreshold = 0
+ let averageSupplyApy = 0
+ let averageBorrowApy = 0
+
+ usdData.forEach((data) => {
+ data.supplyProportion = data.amountInUsd / balanceInUsd
+ data.borrowProportion = data.debtInUsd / totalDebtInUsd
+ averageLiquidationThreshold += data.supplyProportion * (Number(data.reserveData.reserveLiquidationThreshold) / 10000)
+ averageSupplyApy += data.supplyProportion * (Number(data.reserveData.liquidityRate) / 10 ** 25)
+ averageBorrowApy += data.borrowProportion * (Number(data.reserveData.variableBorrowRate) / 10 ** 25)
+ })
+
+ const nativeTokenPrice = Number(reservesData?.[1].networkBaseTokenPriceInUsd) / Number(reservesData?.[1].marketReferenceCurrencyUnit)
+ const collateralInNativeToken = collateralInUsd / nativeTokenPrice
+ const debtInNativeToken = totalDebtInUsd / nativeTokenPrice
+ setData({
+ userReservesData,
+ usdData,
+ balanceInUsd,
+ collateralInUsd,
+ totalDebtInUsd,
+ averageSupplyApy,
+ averageBorrowApy,
+ averageNetApy: totalDebtInUsd > 0 ? (balanceInUsd * averageSupplyApy - totalDebtInUsd * averageBorrowApy) / netWorth : averageSupplyApy,
+ maxBorrowableInUsd: maxBorrowableInUsd - totalDebtInUsd,
+ healthFactor: (collateralInNativeToken * averageLiquidationThreshold) / debtInNativeToken,
+ poolAddress: (market?.addresses.LENDING_POOL ?? '') as `0x${string}`,
+ chainSupported: true,
+ })
+ } else {
+ setData({ ...data, chainSupported: false })
+ }
+ }, [userReservesData, market, user, chain])
+
+ return data
+}
diff --git a/integrations/aave/utils/index.ts b/integrations/aave/utils/index.ts
new file mode 100644
index 00000000..f70db7fa
--- /dev/null
+++ b/integrations/aave/utils/index.ts
@@ -0,0 +1,28 @@
+import { zeroAddress } from 'viem'
+
+import { AaveState } from './types'
+
+export const limitDecimals = (input: string, decimalPlaces: number): string => {
+ const parts = input.split('.')
+ if (parts[1]) {
+ parts[1] = parts[1].slice(0, decimalPlaces)
+ return parts.join('.')
+ } else {
+ return input
+ }
+}
+
+export const getDefaultUseAaveState = (): AaveState => ({
+ healthFactor: 0,
+ balanceInUsd: 0,
+ collateralInUsd: 0,
+ totalDebtInUsd: 0,
+ maxBorrowableInUsd: 0,
+ averageSupplyApy: 0,
+ averageBorrowApy: 0,
+ averageNetApy: 0,
+ poolAddress: zeroAddress,
+ chainSupported: false,
+ userReservesData: null,
+ usdData: null,
+})
diff --git a/integrations/aave/utils/market-config.ts b/integrations/aave/utils/market-config.ts
new file mode 100644
index 00000000..7003996e
--- /dev/null
+++ b/integrations/aave/utils/market-config.ts
@@ -0,0 +1,252 @@
+// disable eslint for this file due to @bgd-labs/aave-address-book import issues
+/* eslint-disable */
+
+import { ReactNode } from 'react'
+
+import {
+ AaveV3Arbitrum,
+ AaveV3ArbitrumGoerli,
+ AaveV3Ethereum,
+ AaveV3Goerli,
+ AaveV3Mumbai,
+ AaveV3Optimism,
+ AaveV3OptimismGoerli,
+ AaveV3Polygon,
+ AaveV3Sepolia,
+} from '@bgd-labs/aave-address-book'
+import { arbitrum, arbitrumGoerli, goerli, mainnet, optimism, optimismGoerli, polygon, polygonMumbai, sepolia } from 'wagmi/chains'
+
+export type MarketDataType = {
+ v3?: boolean
+ testnet?: boolean
+ marketTitle: string
+ chainId: number
+ enabledFeatures?: {
+ liquiditySwap?: boolean
+ staking?: boolean
+ governance?: boolean
+ faucet?: boolean
+ collateralRepay?: boolean
+ incentives?: boolean
+ permissions?: boolean
+ debtSwitch?: boolean
+ }
+ isFork?: boolean
+ permissionComponent?: ReactNode
+ disableCharts?: boolean
+ subgraphUrl?: string
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: `0x${string}`
+ LENDING_POOL: `0x${string}`
+ WETH_GATEWAY?: `0x${string}`
+ SWAP_COLLATERAL_ADAPTER?: `0x${string}`
+ REPAY_WITH_COLLATERAL_ADAPTER?: `0x${string}`
+ DEBT_SWITCH_ADAPTER?: `0x${string}`
+ FAUCET?: `0x${string}`
+ PERMISSION_MANAGER?: `0x${string}`
+ WALLET_BALANCE_PROVIDER: `0x${string}`
+ L2_ENCODER?: `0x${string}`
+ UI_POOL_DATA_PROVIDER: `0x${string}`
+ UI_INCENTIVE_DATA_PROVIDER?: `0x${string}`
+ COLLECTOR?: `0x${string}`
+ V3_MIGRATOR?: `0x${string}`
+ }
+ halIntegration?: {
+ URL: string
+ marketName: string
+ }
+}
+
+export const marketsData: MarketDataType[] = [
+ {
+ marketTitle: 'Ethereum',
+ chainId: mainnet.id,
+ v3: true,
+ enabledFeatures: {
+ governance: true,
+ staking: true,
+ liquiditySwap: true,
+ collateralRepay: true,
+ incentives: true,
+ debtSwitch: false,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Ethereum.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Ethereum.POOL,
+ WETH_GATEWAY: AaveV3Ethereum.WETH_GATEWAY,
+ REPAY_WITH_COLLATERAL_ADAPTER: AaveV3Ethereum.REPAY_WITH_COLLATERAL_ADAPTER,
+ SWAP_COLLATERAL_ADAPTER: AaveV3Ethereum.SWAP_COLLATERAL_ADAPTER,
+ WALLET_BALANCE_PROVIDER: AaveV3Ethereum.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Ethereum.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Ethereum.UI_INCENTIVE_DATA_PROVIDER,
+ COLLECTOR: AaveV3Ethereum.COLLECTOR,
+ },
+ },
+ {
+ marketTitle: 'Ethereum Sepolia',
+ v3: true,
+ testnet: true,
+ chainId: sepolia.id,
+ enabledFeatures: {
+ faucet: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Sepolia.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Sepolia.POOL,
+ WETH_GATEWAY: AaveV3Sepolia.WETH_GATEWAY,
+ FAUCET: AaveV3Sepolia.FAUCET,
+ WALLET_BALANCE_PROVIDER: AaveV3Sepolia.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Sepolia.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Sepolia.UI_INCENTIVE_DATA_PROVIDER,
+ },
+ },
+ {
+ marketTitle: 'Ethereum Görli',
+ v3: true,
+ testnet: true,
+ chainId: goerli.id,
+ enabledFeatures: {
+ faucet: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Goerli.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Goerli.POOL,
+ WETH_GATEWAY: AaveV3Goerli.WETH_GATEWAY,
+ FAUCET: AaveV3Goerli.FAUCET,
+ WALLET_BALANCE_PROVIDER: AaveV3Goerli.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Goerli.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Goerli.UI_INCENTIVE_DATA_PROVIDER,
+ },
+ },
+
+ {
+ marketTitle: 'Arbitrum',
+ v3: true,
+ chainId: arbitrum.id,
+ enabledFeatures: {
+ incentives: true,
+ liquiditySwap: true,
+ collateralRepay: true,
+ debtSwitch: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Arbitrum.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Arbitrum.POOL,
+ WETH_GATEWAY: AaveV3Arbitrum.WETH_GATEWAY,
+ WALLET_BALANCE_PROVIDER: AaveV3Arbitrum.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Arbitrum.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Arbitrum.UI_INCENTIVE_DATA_PROVIDER,
+ L2_ENCODER: AaveV3Arbitrum.L2_ENCODER,
+ COLLECTOR: AaveV3Arbitrum.COLLECTOR,
+ SWAP_COLLATERAL_ADAPTER: AaveV3Arbitrum.SWAP_COLLATERAL_ADAPTER,
+ REPAY_WITH_COLLATERAL_ADAPTER: AaveV3Arbitrum.REPAY_WITH_COLLATERAL_ADAPTER,
+ DEBT_SWITCH_ADAPTER: AaveV3Arbitrum.DEBT_SWAP_ADAPTER,
+ },
+ },
+ {
+ marketTitle: 'Arbitrum Görli',
+ v3: true,
+ testnet: true,
+ chainId: arbitrumGoerli.id,
+ enabledFeatures: {
+ faucet: true,
+ incentives: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3ArbitrumGoerli.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3ArbitrumGoerli.POOL,
+ WETH_GATEWAY: AaveV3ArbitrumGoerli.WETH_GATEWAY,
+ FAUCET: AaveV3ArbitrumGoerli.FAUCET,
+ WALLET_BALANCE_PROVIDER: AaveV3ArbitrumGoerli.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3ArbitrumGoerli.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3ArbitrumGoerli.UI_INCENTIVE_DATA_PROVIDER,
+ L2_ENCODER: AaveV3ArbitrumGoerli.L2_ENCODER,
+ },
+ },
+ {
+ marketTitle: 'Optimism Görli',
+ v3: true,
+ testnet: true,
+ chainId: optimismGoerli.id,
+ enabledFeatures: {
+ faucet: true,
+ incentives: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3OptimismGoerli.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3OptimismGoerli.POOL,
+ WETH_GATEWAY: AaveV3OptimismGoerli.WETH_GATEWAY,
+ FAUCET: AaveV3OptimismGoerli.FAUCET,
+ WALLET_BALANCE_PROVIDER: AaveV3OptimismGoerli.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3OptimismGoerli.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3OptimismGoerli.UI_INCENTIVE_DATA_PROVIDER,
+ L2_ENCODER: AaveV3OptimismGoerli.L2_ENCODER,
+ },
+ },
+ {
+ marketTitle: 'Optimism',
+ v3: true,
+ chainId: optimism.id,
+ enabledFeatures: {
+ incentives: true,
+ collateralRepay: true,
+ liquiditySwap: true,
+ debtSwitch: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Optimism.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Optimism.POOL,
+ WETH_GATEWAY: AaveV3Optimism.WETH_GATEWAY,
+ WALLET_BALANCE_PROVIDER: AaveV3Optimism.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Optimism.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Optimism.UI_INCENTIVE_DATA_PROVIDER,
+ L2_ENCODER: AaveV3Optimism.L2_ENCODER,
+ COLLECTOR: AaveV3Optimism.COLLECTOR,
+ SWAP_COLLATERAL_ADAPTER: AaveV3Optimism.SWAP_COLLATERAL_ADAPTER,
+ REPAY_WITH_COLLATERAL_ADAPTER: AaveV3Optimism.REPAY_WITH_COLLATERAL_ADAPTER,
+ DEBT_SWITCH_ADAPTER: AaveV3Optimism.DEBT_SWAP_ADAPTER,
+ },
+ },
+ {
+ marketTitle: 'Polygon',
+ chainId: polygon.id,
+ v3: true,
+ enabledFeatures: {
+ liquiditySwap: true,
+ incentives: true,
+ collateralRepay: true,
+ debtSwitch: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Polygon.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Polygon.POOL,
+ WETH_GATEWAY: AaveV3Polygon.WETH_GATEWAY,
+ REPAY_WITH_COLLATERAL_ADAPTER: AaveV3Polygon.REPAY_WITH_COLLATERAL_ADAPTER,
+ SWAP_COLLATERAL_ADAPTER: AaveV3Polygon.SWAP_COLLATERAL_ADAPTER,
+ WALLET_BALANCE_PROVIDER: AaveV3Polygon.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Polygon.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Polygon.UI_INCENTIVE_DATA_PROVIDER,
+ COLLECTOR: AaveV3Polygon.COLLECTOR,
+ DEBT_SWITCH_ADAPTER: AaveV3Polygon.DEBT_SWAP_ADAPTER,
+ },
+ },
+ {
+ marketTitle: 'Polygon Mumbai',
+ chainId: polygonMumbai.id,
+ testnet: true,
+ enabledFeatures: {
+ incentives: true,
+ faucet: true,
+ },
+ addresses: {
+ LENDING_POOL_ADDRESS_PROVIDER: AaveV3Mumbai.POOL_ADDRESSES_PROVIDER,
+ LENDING_POOL: AaveV3Mumbai.POOL,
+ WETH_GATEWAY: AaveV3Mumbai.WETH_GATEWAY,
+ FAUCET: AaveV3Mumbai.FAUCET,
+ WALLET_BALANCE_PROVIDER: AaveV3Mumbai.WALLET_BALANCE_PROVIDER,
+ UI_POOL_DATA_PROVIDER: AaveV3Mumbai.UI_POOL_DATA_PROVIDER,
+ UI_INCENTIVE_DATA_PROVIDER: AaveV3Mumbai.UI_INCENTIVE_DATA_PROVIDER,
+ },
+ v3: true,
+ },
+]
diff --git a/integrations/aave/utils/types.ts b/integrations/aave/utils/types.ts
new file mode 100644
index 00000000..ad193836
--- /dev/null
+++ b/integrations/aave/utils/types.ts
@@ -0,0 +1,92 @@
+interface UserReserveData {
+ underlyingAsset: `0x${string}`
+ scaledATokenBalance: bigint
+ usageAsCollateralEnabledOnUser: boolean
+ stableBorrowRate: bigint
+ scaledVariableDebt: bigint
+ principalStableDebt: bigint
+ stableBorrowLastUpdateTimestamp: bigint
+}
+
+interface ReserveData {
+ underlyingAsset: string
+ name: string
+ symbol: string
+ decimals: bigint
+ baseLTVasCollateral: bigint
+ reserveLiquidationThreshold: bigint
+ reserveLiquidationBonus: bigint
+ reserveFactor: bigint
+ usageAsCollateralEnabled: boolean
+ borrowingEnabled: boolean
+ stableBorrowRateEnabled: boolean
+ isActive: boolean
+ isFrozen: boolean
+ liquidityIndex: bigint
+ variableBorrowIndex: bigint
+ liquidityRate: bigint
+ variableBorrowRate: bigint
+ stableBorrowRate: bigint
+ lastUpdateTimestamp: number
+ aTokenAddress: string
+ stableDebtTokenAddress: string
+ variableDebtTokenAddress: string
+ interestRateStrategyAddress: string
+ availableLiquidity: bigint
+ totalPrincipalStableDebt: bigint
+ averageStableRate: bigint
+ stableDebtLastUpdateTimestamp: bigint
+ totalScaledVariableDebt: bigint
+ priceInMarketReferenceCurrency: bigint
+ priceOracle: string
+ variableRateSlope1: bigint
+ variableRateSlope2: bigint
+ stableRateSlope1: bigint
+ stableRateSlope2: bigint
+ baseStableBorrowRate: bigint
+ baseVariableBorrowRate: bigint
+ optimalUsageRatio: bigint
+ isPaused: boolean
+ isSiloedBorrowing: boolean
+ accruedToTreasury: bigint
+ unbacked: bigint
+ isolationModeTotalDebt: bigint
+ flashLoanEnabled: boolean
+ debtCeiling: bigint
+ debtCeilingDecimals: bigint
+ eModeCategoryId: number
+ borrowCap: bigint
+ supplyCap: bigint
+ eModeLtv: number
+ eModeLiquidationThreshold: number
+ eModeLiquidationBonus: number
+ eModePriceSource: string
+ eModeLabel: string
+ borrowableInIsolation: boolean
+}
+
+interface UsdData extends UserReserveData {
+ reserveData: ReserveData
+ tokenPriceInUsd: number
+ amountInUsd: number
+ debtInUsd: number
+ supplyProportion: number
+ borrowProportion: number
+}
+
+interface AaveState {
+ userReservesData: UserReserveData[] | null
+ healthFactor: number
+ balanceInUsd: number
+ collateralInUsd: number
+ totalDebtInUsd: number
+ maxBorrowableInUsd: number
+ averageSupplyApy: number
+ averageBorrowApy: number
+ averageNetApy: number
+ usdData: UsdData[] | null
+ poolAddress: `0x${string}`
+ chainSupported: boolean
+}
+
+export type { UserReserveData, ReserveData, UsdData, AaveState }
diff --git a/integrations/aave/wagmi.config.ts b/integrations/aave/wagmi.config.ts
new file mode 100644
index 00000000..aa5498c9
--- /dev/null
+++ b/integrations/aave/wagmi.config.ts
@@ -0,0 +1,20 @@
+import { defineConfig } from '@wagmi/cli'
+import { react } from '@wagmi/cli/plugins'
+
+import { poolAbi } from './abis/pool-abi'
+import { uiPoolDataProvider } from './abis/ui-pool-data-provider-abi'
+
+export default defineConfig({
+ out: './generated/aave-wagmi.ts',
+ contracts: [
+ {
+ name: 'ui-pool-data-provider',
+ abi: uiPoolDataProvider,
+ },
+ {
+ name: 'pool',
+ abi: poolAbi,
+ },
+ ],
+ plugins: [react()],
+})
diff --git a/integrations/erc20/components/erc20-deploy.tsx b/integrations/erc20/components/erc20-deploy.tsx
index 2761c426..59bad785 100644
--- a/integrations/erc20/components/erc20-deploy.tsx
+++ b/integrations/erc20/components/erc20-deploy.tsx
@@ -65,7 +65,7 @@ export function DeployERC20Contract() {
Deploy
{!token ? null : (
-