-
-
-
-
-
- <WalletAddress isLink truncate />
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: "One-click Deploy",
- description:
- "Start your next Web3 project in ⚡ Turbo Mode with a deploy to [Vercel](https://vercel.com/) in one click.",
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.disco.name,
- description: turboIntegrations.disco.description,
- href: turboIntegrations.disco.href,
- demo: (
-
-
-
- ),
- },
- {
- title: "Sign-In With Ethereum",
- description: turboIntegrations.siwe.description,
- href: turboIntegrations.siwe.href,
- demo: (
-
-
-
- ),
- },
- {
- title: "Rainbowkit",
- description:
- "The best way to connect a wallet. Designed for everyone. Built for developers.",
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.etherscan.name,
- description: turboIntegrations.etherscan.description,
- href: turboIntegrations.etherscan.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: "Web3 Login",
- description: "Authenticate using an Ethereum Account",
- demo: (
-
-
-
-
-
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: "ERC20 WAGMI",
- description:
- "Read and Write to ERC20 smart contracts using minimal UI components.",
- demo: (
-
-
-
- {" "}
- (
-
- )
-
-
- Decimals{" "}
-
-
-
- View Token Page
-
-
- ),
- },
- {
- title: "ERC721 WAGMI",
- description:
- "Read and Write to ERC721 smart contracts using minimal UI components.",
- demo: (
-
-
-
-
- View Token Page
-
-
- ),
- },
- {
- title: turboIntegrations.sessionKeys.name,
- description: turboIntegrations.sessionKeys.description,
- href: turboIntegrations.sessionKeys.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.litProtocol.name,
- description: turboIntegrations.litProtocol.description,
- href: turboIntegrations.litProtocol.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.openai.name,
- description: turboIntegrations.openai.description,
- href: turboIntegrations.openai.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.pooltogether_v4.name,
- description: turboIntegrations.pooltogether_v4.description,
- href: turboIntegrations.pooltogether_v4.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.livepeer.name,
- description: turboIntegrations.livepeer.description,
- href: turboIntegrations.livepeer.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.connext.name,
- description: turboIntegrations.connext.description,
- href: turboIntegrations.connext.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.gelato.name,
- description: turboIntegrations.gelato.description,
- href: turboIntegrations.gelato.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.push_protocol.name,
- description: turboIntegrations.push_protocol.description,
- href: turboIntegrations.push_protocol.href,
- demo: (
-
-
-
-
-
-
-
-
- ),
- },
- {
- title: turboIntegrations.moralis.name,
- description: turboIntegrations.moralis.description,
- href: turboIntegrations.moralis.href,
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.aave.name,
- description: turboIntegrations.aave.description,
- href: turboIntegrations.aave.href,
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.arweave.name,
- description: turboIntegrations.arweave.description,
- href: turboIntegrations.arweave.href,
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.gitcoinPassport.name,
- description: turboIntegrations.gitcoinPassport.description,
- href: turboIntegrations.gitcoinPassport.href,
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.lensProtocol.name,
- description: turboIntegrations.lensProtocol.description,
- href: turboIntegrations.lensProtocol.href,
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.defiLlama.name,
- description: turboIntegrations.defiLlama.description,
- href: turboIntegrations.defiLlama.href,
- demo: (
-
-
-
- ),
- },
- {
- title: turboIntegrations.starter.name,
- description: turboIntegrations.starter.description,
- href: turboIntegrations.starter.href,
- demo: (
-
-
-
- ),
- },
-]
-
-interface ExampleDemosProps extends MotionProps {
- className?: string
-}
-
-export function ExampleDemos({ className, ...props }: ExampleDemosProps) {
- return (
-
- {demos.map(({ title, description, href, demo, large }) => (
-
- ))}
-
- )
-}
-
-interface DemoCardProps extends MotionProps {
- demo: React.ReactNode
- title: string
- description: string
- large?: boolean
- href?: string
-}
-
-function DemoCard({ title, description, href, demo, large }: DemoCardProps) {
- return (
-
- {demo}
-
-
- {title}
-
-
-
- (
-
- ),
-
- code: ({ ...props }) => (
-
- ),
- }}
- >
- {description}
-
-
-
- {!href ? null : (
-
- Demo
-
- )}
-
-
- )
-}
diff --git a/components/ui/social/og-image-integrations.tsx b/components/ui/social/og-image-integrations.tsx
index 8f6864a..9796baf 100644
--- a/components/ui/social/og-image-integrations.tsx
+++ b/components/ui/social/og-image-integrations.tsx
@@ -1,5 +1,4 @@
import { ImageResponse } from "next/og"
-import { turboIntegrations } from "@/data/turbo-integrations"
import { env } from "env.mjs"
export const runtime = "edge"
@@ -14,9 +13,7 @@ export const contentType = "image/png"
const url = env.NEXT_PUBLIC_SITE_URL || "http://localhost:3000"
export function IntegrationOgImage(
- integration: keyof typeof turboIntegrations
) {
- const integrationData = turboIntegrations[integration]
return async function Image() {
return new ImageResponse(
@@ -36,41 +33,11 @@ export function IntegrationOgImage(
>
-
- {integrationData.name}
-
-
- {integrationData.description}
-
+
),
{
diff --git a/config/site.ts b/config/site.ts
index 17168b1..8c2aadd 100644
--- a/config/site.ts
+++ b/config/site.ts
@@ -28,7 +28,7 @@ export const siteConfig: SiteConfig = {
docs: "https://docs.meat.xyz",
discord: "https://discord.gg/uweMsAsGe",
twitter: "https://twitter.com/sausagers_xyz",
- github: "",
+ github: "https://github.com/MeatDeveloper/meat-page",
},
}
diff --git a/data/turbo-integrations.ts b/data/turbo-integrations.ts
deleted file mode 100644
index 4d26d3f..0000000
--- a/data/turbo-integrations.ts
+++ /dev/null
@@ -1,221 +0,0 @@
-export const integrationCategories = [
- "general",
- "protocols",
- "services",
-] as const
-
-interface TurboIntegration {
- name: string
- href: string
- url: string
- description: string
- imgLight: string
- imgDark: string
- category: (typeof integrationCategories)[number]
-}
-
-export const turboIntegrations = {
- siwe: {
- name: "SIWE",
- href: "/integration/sign-in-with-ethereum",
- url: "https://login.xyz/",
- description:
- "Sign-In with Ethereum is Web3 authentication using an Ethereum account.",
- imgLight: "/integrations/siwe.svg",
- imgDark: "/integrations/siwe.svg",
- category: "general",
- },
- erc20: {
- name: "ERC20",
- href: "/integration/erc20",
- url: "https://eips.ethereum.org/EIPS/eip-20",
- description: "ERC20 is a standard for fungible tokens on EVM chains",
- imgLight: "/integrations/erc20.png",
- imgDark: "/integrations/erc20.png",
- category: "protocols",
- },
- erc721: {
- name: "ERC721",
- href: "/integration/erc721",
- url: "https://eips.ethereum.org/EIPS/eip-721",
- description: "ERC721 is a standard for non-fungible tokens on EVM chains",
- imgLight: "/integrations/erc721-icon.png",
- imgDark: "/integrations/erc721-icon.png",
- category: "protocols",
- },
- erc1155: {
- name: "ERC1155",
- href: "/integration/erc1155",
- url: "https://eips.ethereum.org/EIPS/eip-1155",
- description: "ERC1155 is a multi-token standard on EVM chains",
- imgLight: "/integrations/erc1155-icon.png",
- imgDark: "/integrations/erc1155-icon.png",
- category: "protocols",
- },
- etherscan: {
- name: "Etherscan",
- href: "/integration/etherscan",
- url: "https://etherscan.io",
- description:
- "Etherscan is the leading block explorer and search, API & analytics platform for Ethereum.",
- imgLight: "/integrations/etherscan-light.svg",
- imgDark: "/integrations/etherscan-dark.svg",
- category: "general",
- },
- disco: {
- name: "Disco",
- href: "/integration/disco",
- url: "https://disco.xyz",
- description:
- "Disco is identity simplified. Giving the tools to consent to how information is shared and with whom.",
- imgLight: "/integrations/discoLight.png",
- imgDark: "/integrations/discoDark.png",
- category: "services",
- },
- sessionKeys: {
- name: "Session Keys",
- href: "/integration/session-keys",
- url: "https://viem.sh/",
- description:
- "Short-lived private keys enable transaction signing and the granting of temporary smart contract permissions.",
- imgLight: "/integrations/session-keys.png",
- imgDark: "/integrations/session-keys.png",
- category: "general",
- },
- litProtocol: {
- name: "Lit Protocol",
- href: "/integration/lit-protocol",
- url: "https://litprotocol.com/",
- description:
- "Lit is distributed key management for encryption, signing, and compute.",
- imgLight: "/integrations/lit-protocol.png",
- imgDark: "/integrations/lit-protocol.png",
- category: "services",
- },
- openai: {
- name: "OpenAI",
- href: "/integration/openai",
- url: "https://www.openai.com/",
- description:
- "OpenAI offers AI models designed for advanced natural language processing.",
- imgLight: "/integrations/openai-light.svg",
- imgDark: "/integrations/openai-dark.svg",
- category: "general",
- },
- pooltogether_v4: {
- name: "PoolTogether",
- href: "/integration/pooltogether-v4",
- url: "https://pooltogether.com/",
- description:
- "PoolTogether is a prize savings protocol, enable you to win by saving.",
- imgLight: "/integrations/pooltogether.svg",
- imgDark: "/integrations/pooltogether.svg",
- category: "protocols",
- },
- livepeer: {
- name: "Livepeer",
- href: "/integration/livepeer",
- url: "https://docs.livepeer.org/",
- description: "Livepeer is the world's open video infrastructure.",
- imgLight: "/integrations/livepeer.svg",
- imgDark: "/integrations/livepeer.svg",
- category: "protocols",
- },
- connext: {
- name: "Connext",
- href: "/integration/connext",
- url: "https://docs.connext.network/",
- description:
- "Connext is a modular protocol for securely passing funds and data between chains.",
- imgLight: "/integrations/connext.png",
- imgDark: "/integrations/connext.png",
- category: "protocols",
- },
- gelato: {
- name: "Gelato",
- href: "/integration/gelato",
- url: "https://docs.gelato.network/",
- description:
- "Enabling developers to create augmented smart contracts that are automated, gasless & off-chain aware",
- imgLight: "/integrations/gelato-light.svg",
- imgDark: "/integrations/gelato-light.svg",
- category: "protocols",
- },
- push_protocol: {
- name: "Push Protocol",
- href: "/integration/push-protocol",
- url: "https://push.org/",
- description:
- "Push Protocol is a web3 communication network, enabling cross-chain notifications and messaging for dapps, wallets, and services.",
- imgLight: "/integrations/push.svg",
- imgDark: "/integrations/push.svg",
- category: "protocols",
- },
- moralis: {
- name: "Moralis",
- href: "/integration/moralis",
- url: "https://docs.moralis.io/",
- description:
- "Moralis provides a complete end-to-end blockchain application development platform.",
- imgLight: "/integrations/moralis.png",
- imgDark: "/integrations/moralis.png",
- category: "services",
- },
- 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",
- category: "protocols",
- },
- arweave: {
- name: "Arweave",
- href: "/integration/arweave",
- url: "https://arwiki.arweave.dev",
- description:
- "Arweave is the first protocol that enables permanent data storage. Its design allows anyone to preserve data forever with just a single, one-time fee.",
- imgLight: "/integrations/arweave-light.png",
- imgDark: "/integrations/arweave-dark.png",
- category: "protocols",
- },
- lensProtocol: {
- name: "Lens Protocol",
- href: "/integration/lens-protocol",
- url: "https://www.lens.xyz/",
- description: "Lens Protocol is the social layer for Web3",
- imgLight: "/integrations/lensprotocol-light.svg",
- imgDark: "/integrations/lensprotocol-dark.svg",
- category: "protocols",
- },
- gitcoinPassport: {
- name: "Gitcoin Passport",
- href: "/integration/gitcoin-passport",
- url: "https://docs.passport.gitcoin.co/overview/introducing-gitcoin-passport",
- description:
- "Gitcoin Passport is an identity verification application. It enables you to collect verifiable credentials that prove your identity and trustworthiness without exposing personally identifying information.",
- imgLight: "/integrations/gitcoin-passport.svg",
- imgDark: "/integrations/gitcoin-passport.svg",
- category: "services",
- },
- defiLlama: {
- name: "DefiLlama",
- href: "/integration/defi-llama",
- url: "https://defillama.com/docs/api",
- description: "Open and transparent DeFi analytics. ",
- imgLight: "/integrations/defi-llama.png",
- category: "services",
- imgDark: "/integrations/defi-llama.png",
- },
- starter: {
- name: "Starter Template",
- href: "/integration/starter",
- url: "https://docs.turboeth.xyz/overview",
- description:
- "Use this template to get started building integrations with TurboETH.",
- imgLight: "/logo-gradient.png",
- category: "general",
- imgDark: "/logo-gradient.png",
- },
-} as const
diff --git a/integrations/aave/README.md b/integrations/aave/README.md
deleted file mode 100644
index 21640df..0000000
--- a/integrations/aave/README.md
+++ /dev/null
@@ -1,89 +0,0 @@
-# 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
deleted file mode 100644
index da65176..0000000
--- a/integrations/aave/abis/pool-abi.ts
+++ /dev/null
@@ -1,1715 +0,0 @@
-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
deleted file mode 100644
index 6d41cdd..0000000
--- a/integrations/aave/abis/ui-pool-data-provider-abi.ts
+++ /dev/null
@@ -1,358 +0,0 @@
-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
deleted file mode 100644
index f83017f..0000000
--- a/integrations/aave/components/asset-to-borrow-item.tsx
+++ /dev/null
@@ -1,244 +0,0 @@
-"use client"
-
-import { useEffect, useState } from "react"
-import Image from "next/image"
-import { parseUnits } from "viem"
-import { useAccount, useWaitForTransaction } from "wagmi"
-
-import { useErc20Decimals } from "@/lib/generated/blockchain"
-import { useToast } from "@/lib/hooks/use-toast"
-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 { ContractWriteButton } from "@/components/blockchain/contract-write-button"
-
-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)}%` : "—"}
-
-
-
-
-
- Borrow
-
-
-
- Borrow {symbol}
-
- {canBorrowStableRateMode && (
- <>
-
- Borrow APY rate
-
-
- setBorrowVariableRateMode(value === "variable")
- }
- >
-
-
-
-
-
-
- Variable
-
-
-
-
- Stable
-
-
-
-
- >
- )}
-
- Amount
-
-
-
-
{
- const regex = /^[0-9.,\b]+$/
- let value = e.target.value
- if (value === "" || regex.test(value)) {
- if (value.startsWith(".") || value.startsWith(",")) {
- value = `0${value}`
- }
- value = value.replace(",", ".")
- setBorrowAmount(value)
- if (
- Number(value) >
- (maxBorrowableInUsd / tokenPriceInUsd) * 0.8
- )
- setMaxAmount()
- }
- }}
- />
-
-
- {symbol}
-
-
-
-
-
-
- Available:{" "}
- {((maxBorrowableInUsd / tokenPriceInUsd) * 0.8).toFixed(
- 2
- )}
- {" "}
- {/* Showing 80% to keep health factor "safe" */}
-
- Max
-
-
-
-
-
- Borrow {symbol}
-
-
-
-
-
-
- )
-}
diff --git a/integrations/aave/components/asset-to-supply-item.tsx b/integrations/aave/components/asset-to-supply-item.tsx
deleted file mode 100644
index b652870..0000000
--- a/integrations/aave/components/asset-to-supply-item.tsx
+++ /dev/null
@@ -1,272 +0,0 @@
-"use client"
-
-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 {
- useErc20Allowance,
- useErc20Approve,
- useErc20BalanceOf,
- useErc20Decimals,
-} from "@/lib/generated/blockchain"
-import { useToast } from "@/lib/hooks/use-toast"
-import { Button } from "@/components/ui/button"
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogTitle,
- DialogTrigger,
-} from "@/components/ui/dialog"
-import { ContractWriteButton } from "@/components/blockchain/contract-write-button"
-
-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 ? : —
}
-
-
-
-
-
- Supply
-
-
-
- Supply {symbol}
-
-
- Amount
-
-
-
-
{
- const regex = /^[0-9.,\b]+$/
- let value = e.target.value
- if (value === "" || regex.test(value)) {
- if (value.startsWith(".") || value.startsWith(",")) {
- value = `0${value}`
- }
- value = value.replace(",", ".")
- setSupplyAmount(value)
- if (
- Number(value) >
- Number(
- formatUnits(
- tokenBalance ?? BigInt(1),
- decimals ?? 18
- )
- )
- )
- setMaxAmount()
- }
- }}
- />
-
-
- {symbol}
-
-
-
-
-
- Available:{" "}
- {Number(
- formatUnits(tokenBalance ?? BigInt(1), decimals ?? 18)
- ).toFixed(5)}
-
-
- Max
-
-
-
-
-
- Transaction overview
-
-
-
- Supply APY
-
- {liquidityRate !== 0 ? `${liquidityRate.toFixed(2)}` : "0"}%
-
-
-
- Collateralization
-
- {canBeCollateral ? "Enabled" : "Disabled"}
-
-
-
-
- {`${isApproving() ? `Approve` : `Supply`} ${symbol}`}
-
-
-
-
-
-
- ) : (
-
- )
-}
diff --git a/integrations/aave/components/borrowed-assets-item.tsx b/integrations/aave/components/borrowed-assets-item.tsx
deleted file mode 100644
index a68a26c..0000000
--- a/integrations/aave/components/borrowed-assets-item.tsx
+++ /dev/null
@@ -1,393 +0,0 @@
-"use client"
-
-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 {
- useErc20Allowance,
- useErc20Approve,
- useErc20BalanceOf,
- useErc20Decimals,
- useErc20Symbol,
-} from "@/lib/generated/blockchain"
-import { useToast } from "@/lib/hooks/use-toast"
-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 { ContractWriteButton } from "@/components/blockchain/contract-write-button"
-
-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)}%
-
- swapBorrowRateModeWrite()}
- >
-
-
-
-
-
- Variable
-
-
- Stable
-
-
-
-
-
-
-
- Repay
-
-
- Repay {symbol}
-
-
- Repay with
-
-
- setRepayWithATokens(value === "aTokens")
- }
- >
-
-
-
-
-
-
- Wallet balance
-
-
-
-
- Collateral
-
-
-
-
-
- Amount
-
-
-
-
{
- const regex = /^[0-9.,\b]+$/
- let value = e.target.value
- if (value === "" || regex.test(value)) {
- if (value.startsWith(".") || value.startsWith(",")) {
- value = `0${value}`
- }
- value = value.replace(",", ".")
- if (
- Number(value) >
- Number(
- formatUnits(
- getRepayBalance() ?? BigInt(1),
- decimals ?? 18
- )
- )
- )
- if (
- Number(
- formatUnits(
- getRepayBalance() ?? BigInt(1),
- decimals ?? 18
- )
- ) > debt
- ) {
- value = debt.toString()
- } else {
- value = formatUnits(
- getRepayBalance() ?? BigInt(1),
- decimals ?? 18
- )
- }
-
- setRepayAmount(value)
- }
- }}
- />
-
-
- {symbol}
-
-
-
-
-
-
- {repayWithATokens
- ? `a${symbol ?? ""} balance`
- : "Wallet balance"}
- :{" "}
- {limitDecimals(
- formatUnits(
- getRepayBalance() ?? BigInt(1),
- decimals ?? 18
- ),
- 5
- )}
-
-
- Max
-
-
-
-
-
- Transaction overview
-
-
-
-
Remaining debt
-
-
- {debt.toFixed(5)} {" "}
- {symbol}
-
- {Number(repayAmount) > 0 && (
- <>
-
-
-
- {(debt - Number(repayAmount)).toFixed(5)}
- {" "}
- {symbol}
-
- >
- )}
-
-
-
-
- {`${isApproving() ? `Approve` : `Repay`} ${symbol ?? ""}`}
-
-
-
-
-
-
- )
-}
diff --git a/integrations/aave/components/general-info.tsx b/integrations/aave/components/general-info.tsx
deleted file mode 100644
index f1b2e31..0000000
--- a/integrations/aave/components/general-info.tsx
+++ /dev/null
@@ -1,92 +0,0 @@
-"use client"
-
-import Image from "next/image"
-import { motion } from "framer-motion"
-import { useNetwork, useSwitchNetwork } from "wagmi"
-
-import { FADE_DOWN_ANIMATION_VARIANTS } from "@/config/design"
-import {
- Select,
- SelectContent,
- SelectItem,
- SelectTrigger,
- SelectValue,
-} from "@/components/ui/select"
-
-import { useAave } from "../hooks/use-aave"
-import { marketsData } from "../utils/market-config"
-import { HealthFactor } from "./health-factor"
-
-export const GeneralInfo = () => {
- const { chain } = useNetwork()
- const { switchNetwork } = useSwitchNetwork()
-
- const { balanceInUsd, totalDebtInUsd, healthFactor, averageNetApy } =
- useAave()
-
- return (
-
-
-
Select Chain
-
-
-
switchNetwork?.(+e)}
- >
-
-
-
-
- {marketsData.map((market, index) => (
-
-
-
- {market.marketTitle}
-
-
- ))}
-
-
-
-
-
-
-
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
deleted file mode 100644
index cdd8824..0000000
--- a/integrations/aave/components/health-factor.tsx
+++ /dev/null
@@ -1,16 +0,0 @@
-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
deleted file mode 100644
index 39ca521..0000000
--- a/integrations/aave/components/list-assets-to-borrow.tsx
+++ /dev/null
@@ -1,70 +0,0 @@
-"use client"
-
-import { useAave } from "../hooks/use-aave"
-import { AssetToBorrowItem } from "./asset-to-borrow-item"
-
-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
deleted file mode 100644
index abe15ec..0000000
--- a/integrations/aave/components/list-assets-to-supply.tsx
+++ /dev/null
@@ -1,72 +0,0 @@
-"use client"
-
-import { useState } from "react"
-
-import { Checkbox } from "@/components/ui/checkbox"
-
-import { useAave } from "../hooks/use-aave"
-import { AssetToSupplyItem } from "./asset-to-supply-item"
-
-export const ListAssetsToSupply = () => {
- const { usdData } = useAave()
- const [showZeroBalanceAssets, setShowZeroBalanceAssets] = useState(false)
-
- return (
-
-
-
Asssets to supply
-
-
-
- setShowZeroBalanceAssets(!showZeroBalanceAssets)
- }
- />
-
- Show assets with 0 balance
-
-
-
-
-
-
-
- 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
deleted file mode 100644
index 7e67e20..0000000
--- a/integrations/aave/components/list-borrowed-assets.tsx
+++ /dev/null
@@ -1,133 +0,0 @@
-"use client"
-
-import React from "react"
-import { parseUnits } from "viem"
-
-import { useAave } from "../hooks/use-aave"
-import { BorrowedAssetsItem } from "./borrowed-assets-item"
-
-export const ListBorrowedAssets = () => {
- const { usdData, totalDebtInUsd, averageBorrowApy } = useAave()
-
- const filteredUserReserves = usdData?.filter((reserve) => {
- // If debt > 0.00001
- const exponent = Number(reserve.reserveData.decimals - BigInt(5))
- const comparisonValue =
- exponent >= 0
- ? BigInt(1) * parseUnits("10", exponent)
- : BigInt(1) / parseUnits("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
deleted file mode 100644
index 93ef32a..0000000
--- a/integrations/aave/components/list-supplied-assets.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-"use client"
-
-import React from "react"
-import { parseUnits } from "viem"
-
-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 = Number(reserve.reserveData.decimals - BigInt(5))
- return exponent >= 0
- ? reserve.scaledATokenBalance > BigInt(1) * parseUnits("10", exponent)
- : reserve.scaledATokenBalance > BigInt(1) / parseUnits("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
deleted file mode 100644
index 8301885..0000000
--- a/integrations/aave/components/spinner.tsx
+++ /dev/null
@@ -1,14 +0,0 @@
-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
deleted file mode 100644
index 227c776..0000000
--- a/integrations/aave/components/supplied-assets-item.tsx
+++ /dev/null
@@ -1,256 +0,0 @@
-"use client"
-
-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 { useErc20Decimals, useErc20Symbol } from "@/lib/generated/blockchain"
-import { useToast } from "@/lib/hooks/use-toast"
-import { Button } from "@/components/ui/button"
-import {
- Dialog,
- DialogContent,
- DialogDescription,
- DialogTitle,
- DialogTrigger,
-} from "@/components/ui/dialog"
-import { Switch } from "@/components/ui/switch"
-import { ContractWriteButton } from "@/components/blockchain/contract-write-button"
-
-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"}
-
-
-
-
-
-
-
- Withdraw
-
-
- Withdraw {symbol}
-
-
- Amount
-
-
-
-
{
- const regex = /^[0-9.,\b]+$/
- let value = e.target.value
- if (value === "" || regex.test(value)) {
- if (value.startsWith(".") || value.startsWith(",")) {
- value = `0${value}`
- }
- value = value.replace(",", ".")
- setWithdrawAmount(value)
- if (balance - Number(value) < 0) setMaxAmount()
- }
- }}
- />
-
-
- {symbol}
-
-
-
-
-
- Available: {balance.toFixed(5)}
-
- Max
-
-
-
-
-
- Transaction overview
-
-
-
-
Remaining debt
-
-
- {balance.toFixed(5)} {" "}
- {symbol}
-
- {Number(withdrawAmount) > 0 && (
- <>
-
-
-
- {(balance - Number(withdrawAmount)).toFixed(5)}
- {" "}
- {symbol}
-
- >
- )}
-
-
-
-
- {`Withdraw ${symbol ?? ""}`}
-
-
-
-
-
-
- )
-}
diff --git a/integrations/aave/generated/aave-wagmi.ts b/integrations/aave/generated/aave-wagmi.ts
deleted file mode 100644
index ca8be50..0000000
--- a/integrations/aave/generated/aave-wagmi.ts
+++ /dev/null
@@ -1,3631 +0,0 @@
-// Generated by @wagmi/cli@1.1.0 on 8/24/2023 at 7:35:30 PM
-import {
- useContractEvent,
- UseContractEventConfig,
- useContractRead,
- UseContractReadConfig,
- useContractWrite,
- UseContractWriteConfig,
- usePrepareContractWrite,
- UsePrepareContractWriteConfig,
-} from "wagmi"
-import {
- PrepareWriteContractResult,
- ReadContractResult,
- WriteContractMode,
-} 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: "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: "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: "asset", internalType: "address", type: "address" },
- { name: "user", internalType: "address", type: "address" },
- ],
- name: "rebalanceStableBorrowRate",
- 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: "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: "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: "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: "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: "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" }],
- },
-] as const
-
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-// React
-//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__.
- */
-export function useUiPoolDataProviderRead<
- TFunctionName extends string,
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "abi"
- > = {} as any
-) {
- return useContractRead({
- abi: uiPoolDataProviderABI,
- ...config,
- } as UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * 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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "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<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: uiPoolDataProviderABI,
- functionName: "marketReferenceCurrencyPriceInUsdProxyAggregator",
- ...config,
- } as UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link uiPoolDataProviderABI}__ and `functionName` set to `"networkBaseTokenPriceInUsdProxyAggregator"`.
- */
-export function useUiPoolDataProviderNetworkBaseTokenPriceInUsdProxyAggregator<
- TFunctionName extends "networkBaseTokenPriceInUsdProxyAggregator",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: uiPoolDataProviderABI,
- functionName: "networkBaseTokenPriceInUsdProxyAggregator",
- ...config,
- } as UseContractReadConfig<
- typeof uiPoolDataProviderABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__.
- */
-export function usePoolRead<
- TFunctionName extends string,
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi"
- > = {} as any
-) {
- return useContractRead({ abi: poolABI, ...config } as UseContractReadConfig<
- typeof poolABI,
- TFunctionName,
- TSelectData
- >)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"ADDRESSES_PROVIDER"`.
- */
-export function usePoolAddressesProvider<
- TFunctionName extends "ADDRESSES_PROVIDER",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "ADDRESSES_PROVIDER",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * 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<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "BRIDGE_PROTOCOL_FEE",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * 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<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "FLASHLOAN_PREMIUM_TOTAL",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * 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<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "FLASHLOAN_PREMIUM_TO_PROTOCOL",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * 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<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "MAX_NUMBER_RESERVES",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * 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<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "MAX_STABLE_RATE_BORROW_SIZE_PERCENT",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"POOL_REVISION"`.
- */
-export function usePoolPoolRevision<
- TFunctionName extends "POOL_REVISION",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "POOL_REVISION",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getConfiguration"`.
- */
-export function usePoolGetConfiguration<
- TFunctionName extends "getConfiguration",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getConfiguration",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getEModeCategoryData"`.
- */
-export function usePoolGetEModeCategoryData<
- TFunctionName extends "getEModeCategoryData",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getEModeCategoryData",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveAddressById"`.
- */
-export function usePoolGetReserveAddressById<
- TFunctionName extends "getReserveAddressById",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getReserveAddressById",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveData"`.
- */
-export function usePoolGetReserveData<
- TFunctionName extends "getReserveData",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getReserveData",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveNormalizedIncome"`.
- */
-export function usePoolGetReserveNormalizedIncome<
- TFunctionName extends "getReserveNormalizedIncome",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getReserveNormalizedIncome",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReserveNormalizedVariableDebt"`.
- */
-export function usePoolGetReserveNormalizedVariableDebt<
- TFunctionName extends "getReserveNormalizedVariableDebt",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getReserveNormalizedVariableDebt",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getReservesList"`.
- */
-export function usePoolGetReservesList<
- TFunctionName extends "getReservesList",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getReservesList",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getUserAccountData"`.
- */
-export function usePoolGetUserAccountData<
- TFunctionName extends "getUserAccountData",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getUserAccountData",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getUserConfiguration"`.
- */
-export function usePoolGetUserConfiguration<
- TFunctionName extends "getUserConfiguration",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getUserConfiguration",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractRead}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"getUserEMode"`.
- */
-export function usePoolGetUserEMode<
- TFunctionName extends "getUserEMode",
- TSelectData = ReadContractResult
->(
- config: Omit<
- UseContractReadConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return useContractRead({
- abi: poolABI,
- functionName: "getUserEMode",
- ...config,
- } as UseContractReadConfig)
-}
-
-/**
- * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__.
- */
-export function usePoolWrite<
- TFunctionName extends string,
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "backUnbacked"
- >["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<
- PrepareWriteContractResult["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "configureEModeCategory"
- >["request"]["abi"],
- "configureEModeCategory",
- TMode
- > & { functionName?: "configureEModeCategory" }
- : UseContractWriteConfig<
- typeof poolABI,
- "configureEModeCategory",
- TMode
- > & {
- 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<
- PrepareWriteContractResult["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<
- PrepareWriteContractResult<
- typeof poolABI,
- "dropReserve"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "finalizeTransfer"
- >["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<
- PrepareWriteContractResult<
- typeof poolABI,
- "flashLoan"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "flashLoanSimple"
- >["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<
- PrepareWriteContractResult<
- typeof poolABI,
- "initReserve"
- >["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<
- PrepareWriteContractResult<
- typeof poolABI,
- "initialize"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "liquidationCall"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "mintToTreasury"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "mintUnbacked"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "rebalanceStableBorrowRate"
- >["request"]["abi"],
- "rebalanceStableBorrowRate",
- TMode
- > & { functionName?: "rebalanceStableBorrowRate" }
- : UseContractWriteConfig<
- typeof poolABI,
- "rebalanceStableBorrowRate",
- TMode
- > & {
- 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<
- PrepareWriteContractResult["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "repayWithATokens"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "repayWithPermit"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "rescueTokens"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "resetIsolationModeTotalDebt"
- >["request"]["abi"],
- "resetIsolationModeTotalDebt",
- TMode
- > & { functionName?: "resetIsolationModeTotalDebt" }
- : UseContractWriteConfig<
- typeof poolABI,
- "resetIsolationModeTotalDebt",
- TMode
- > & {
- 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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "setConfiguration"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "setReserveInterestRateStrategyAddress"
- >["request"]["abi"],
- "setReserveInterestRateStrategyAddress",
- TMode
- > & { functionName?: "setReserveInterestRateStrategyAddress" }
- : UseContractWriteConfig<
- typeof poolABI,
- "setReserveInterestRateStrategyAddress",
- TMode
- > & {
- abi?: never
- functionName?: "setReserveInterestRateStrategyAddress"
- } = {} as any
-) {
- return useContractWrite<
- typeof poolABI,
- "setReserveInterestRateStrategyAddress",
- TMode
- >({
- abi: poolABI,
- functionName: "setReserveInterestRateStrategyAddress",
- ...config,
- } as any)
-}
-
-/**
- * Wraps __{@link useContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setUserEMode"`.
- */
-export function usePoolSetUserEMode<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "setUserEMode"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "setUserUseReserveAsCollateral"
- >["request"]["abi"],
- "setUserUseReserveAsCollateral",
- TMode
- > & { functionName?: "setUserUseReserveAsCollateral" }
- : UseContractWriteConfig<
- typeof poolABI,
- "setUserUseReserveAsCollateral",
- TMode
- > & {
- abi?: never
- functionName?: "setUserUseReserveAsCollateral"
- } = {} as any
-) {
- return useContractWrite<
- typeof poolABI,
- "setUserUseReserveAsCollateral",
- TMode
- >({
- 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<
- PrepareWriteContractResult["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "supplyWithPermit"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "swapBorrowRateMode"
- >["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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "updateBridgeProtocolFee"
- >["request"]["abi"],
- "updateBridgeProtocolFee",
- TMode
- > & { functionName?: "updateBridgeProtocolFee" }
- : UseContractWriteConfig<
- typeof poolABI,
- "updateBridgeProtocolFee",
- TMode
- > & {
- 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<
- TMode extends WriteContractMode = undefined
->(
- config: TMode extends "prepared"
- ? UseContractWriteConfig<
- PrepareWriteContractResult<
- typeof poolABI,
- "updateFlashloanPremiums"
- >["request"]["abi"],
- "updateFlashloanPremiums",
- TMode
- > & { functionName?: "updateFlashloanPremiums" }
- : UseContractWriteConfig<
- typeof poolABI,
- "updateFlashloanPremiums",
- TMode
- > & {
- 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<
- PrepareWriteContractResult<
- typeof poolABI,
- "withdraw"
- >["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<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "backUnbacked",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"borrow"`.
- */
-export function usePreparePoolBorrow(
- config: Omit<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "configureEModeCategory",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"deposit"`.
- */
-export function usePreparePoolDeposit(
- config: Omit<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "dropReserve",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"finalizeTransfer"`.
- */
-export function usePreparePoolFinalizeTransfer(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "finalizeTransfer",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"flashLoan"`.
- */
-export function usePreparePoolFlashLoan(
- config: Omit<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "flashLoanSimple",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"initReserve"`.
- */
-export function usePreparePoolInitReserve(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "initReserve",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"initialize"`.
- */
-export function usePreparePoolInitialize(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "initialize",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"liquidationCall"`.
- */
-export function usePreparePoolLiquidationCall(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "liquidationCall",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"mintToTreasury"`.
- */
-export function usePreparePoolMintToTreasury(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "mintToTreasury",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"mintUnbacked"`.
- */
-export function usePreparePoolMintUnbacked(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "mintUnbacked",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"rebalanceStableBorrowRate"`.
- */
-export function usePreparePoolRebalanceStableBorrowRate(
- config: Omit<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "repayWithATokens",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"repayWithPermit"`.
- */
-export function usePreparePoolRepayWithPermit(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "repayWithPermit",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"rescueTokens"`.
- */
-export function usePreparePoolRescueTokens(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "rescueTokens",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"resetIsolationModeTotalDebt"`.
- */
-export function usePreparePoolResetIsolationModeTotalDebt(
- config: Omit<
- UsePrepareContractWriteConfig<
- typeof poolABI,
- "resetIsolationModeTotalDebt"
- >,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "setConfiguration",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setReserveInterestRateStrategyAddress"`.
- */
-export function usePreparePoolSetReserveInterestRateStrategyAddress(
- config: Omit<
- UsePrepareContractWriteConfig<
- typeof poolABI,
- "setReserveInterestRateStrategyAddress"
- >,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "setUserEMode",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"setUserUseReserveAsCollateral"`.
- */
-export function usePreparePoolSetUserUseReserveAsCollateral(
- config: Omit<
- UsePrepareContractWriteConfig<
- typeof poolABI,
- "setUserUseReserveAsCollateral"
- >,
- "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<
- UsePrepareContractWriteConfig,
- "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<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "supplyWithPermit",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"swapBorrowRateMode"`.
- */
-export function usePreparePoolSwapBorrowRateMode(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "swapBorrowRateMode",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"updateBridgeProtocolFee"`.
- */
-export function usePreparePoolUpdateBridgeProtocolFee(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "updateBridgeProtocolFee",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"updateFlashloanPremiums"`.
- */
-export function usePreparePoolUpdateFlashloanPremiums(
- config: Omit<
- UsePrepareContractWriteConfig,
- "abi" | "functionName"
- > = {} as any
-) {
- return usePrepareContractWrite({
- abi: poolABI,
- functionName: "updateFlashloanPremiums",
- ...config,
- } as UsePrepareContractWriteConfig)
-}
-
-/**
- * Wraps __{@link usePrepareContractWrite}__ with `abi` set to __{@link poolABI}__ and `functionName` set to `"withdraw"`.
- */
-export function usePreparePoolWithdraw(
- config: Omit<
- UsePrepareContractWriteConfig,
- "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<
- UseContractEventConfig,
- "abi"
- > = {} as any
-) {
- return useContractEvent({ abi: poolABI, ...config } as UseContractEventConfig<
- typeof poolABI,
- TEventName
- >)
-}
-
-/**
- * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"BackUnbacked"`.
- */
-export function usePoolBackUnbackedEvent(
- config: Omit<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "abi" | "eventName"
- > = {} as any
-) {
- return useContractEvent({
- abi: poolABI,
- eventName: "IsolationModeTotalDebtUpdated",
- ...config,
- } as UseContractEventConfig)
-}
-
-/**
- * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"LiquidationCall"`.
- */
-export function usePoolLiquidationCallEvent(
- config: Omit<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "abi" | "eventName"
- > = {} as any
-) {
- return useContractEvent({
- abi: poolABI,
- eventName: "RebalanceStableBorrowRate",
- ...config,
- } as UseContractEventConfig)
-}
-
-/**
- * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"Repay"`.
- */
-export function usePoolRepayEvent(
- config: Omit<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "abi" | "eventName"
- > = {} as any
-) {
- return useContractEvent({
- abi: poolABI,
- eventName: "ReserveDataUpdated",
- ...config,
- } as UseContractEventConfig)
-}
-
-/**
- * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"ReserveUsedAsCollateralDisabled"`.
- */
-export function usePoolReserveUsedAsCollateralDisabledEvent(
- config: Omit<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "abi" | "eventName"
- > = {} as any
-) {
- return useContractEvent({
- abi: poolABI,
- eventName: "ReserveUsedAsCollateralEnabled",
- ...config,
- } as UseContractEventConfig)
-}
-
-/**
- * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"Supply"`.
- */
-export function usePoolSupplyEvent(
- config: Omit<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "abi" | "eventName"
- > = {} as any
-) {
- return useContractEvent({
- abi: poolABI,
- eventName: "SwapBorrowRateMode",
- ...config,
- } as UseContractEventConfig)
-}
-
-/**
- * Wraps __{@link useContractEvent}__ with `abi` set to __{@link poolABI}__ and `eventName` set to `"UserEModeSet"`.
- */
-export function usePoolUserEModeSetEvent(
- config: Omit<
- UseContractEventConfig,
- "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<
- UseContractEventConfig,
- "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
deleted file mode 100644
index 1c3d65a..0000000
--- a/integrations/aave/hooks/use-aave.ts
+++ /dev/null
@@ -1,149 +0,0 @@
-"use client"
-
-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
deleted file mode 100644
index 3038ed9..0000000
--- a/integrations/aave/utils/index.ts
+++ /dev/null
@@ -1,28 +0,0 @@
-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
deleted file mode 100644
index 0cde0a2..0000000
--- a/integrations/aave/utils/market-config.ts
+++ /dev/null
@@ -1,269 +0,0 @@
-// 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
deleted file mode 100644
index ad19383..0000000
--- a/integrations/aave/utils/types.ts
+++ /dev/null
@@ -1,92 +0,0 @@
-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
deleted file mode 100644
index 47bf836..0000000
--- a/integrations/aave/wagmi.config.ts
+++ /dev/null
@@ -1,20 +0,0 @@
-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/arweave/README.md b/integrations/arweave/README.md
deleted file mode 100644
index 86d925d..0000000
--- a/integrations/arweave/README.md
+++ /dev/null
@@ -1,62 +0,0 @@
-# Starter TurboETH Integration
-
-Welcome to the Starter TurboETH Integration! This folder serves as a blueprint for creating new integrations in TurboETH. If you're looking to contribute a new integration, simply copy this directory, and also the starter page located at `app/integration/starter`, to begin your development.
-
-## Creating a new integration
-
-Below are the steps to create a new integration.
-
-1. Copy the integration folder template from `/integrations/starter` and add your integration code, adhering to the file structure patterns evident in this folder.
-
-2. Duplicate the integration page from `/app/(general)/integration/starter` and populate it with your integration pages' code.
-
-3. Locate any API endpoints associated with your integration in the `/api` folder within the page folder of your integration. An example API endpoint can be found at `/app/(general)/integration/starter/api/hello-world/route.ts`. These API endpoints should follow the new [Route Handlers](https://nextjs.org/docs/app/building-your-application/routing/router-handlers) patterns of Next.js 13.
-
-4. Enter the data related to your integration in `/data/turbo-integrations.ts`. Here, add a new object with the name, description, image, and URL of your integration.
-
-5. Update the OG image configuration of your integration page in the `opengraph-image.tsx` file. Do this by replacing the argument of the `IntegrationOgImage` function with the object key of your integration used in the previous step.
-
-## Understanding the Starter template
-
-Each component of the Starter TurboETH template is designed to help streamline your development process:
-
-- **abis/**: Put your contract's ABI here. Each ABI should be in its own TypeScript file.
-
-- **client/**: Any client initialization for your chosen module or SDK should be placed here.
-
-- **components/**: This is the home for your React components. 'Read' components, which display data from a contract, and 'write' components, that send transactions, should all be placed here.
-
-- **hooks/**: Place your custom React hooks in this folder. These hooks are intended to manage state updates and encapsulate the logic for interacting with Ethereum contracts.
-
-- **starter-wagmi.ts**: This is a generated file from [wagmi-cli](https://wagmi.sh/cli/getting-started). It includes hooks for your contracts .
-
-- **index.ts**: Consider this as the entry point for your integration. It should export all the hooks, components, and utility functions that your integration provides.
-
-- **wagmi.config.ts**: This file should hold the wagmi-cli configuration for your integration, which includes settings like compiler version and optimization.
-
-- **README.md**: Here, you should document your integration. Explain its purpose, its use, and any important information a new developer or user should know.
-
-Each of these elements plays a crucial role in making your integration functional and accessible.
-
-## File Structure
-
-```
-integrations/starter
-├─ abis/
-│ ├─ starter-abi.ts
-├─ client/
-│ ├─ index.ts
-├─ components/
-│ ├─ starter-header.tsx
-├─ generated/
-│ ├─ starter-wagmi.ts
-├─ hooks/
-│ ├─ use-starter.ts
-├─ utils/
-│ ├─ types.ts
-├─ index.ts
-├─ README.md
-├─ wagmi.config.ts
-```
-
-By using this template, you'll create well-organized and understandable integrations that are easy for you and others to navigate. Happy coding!
diff --git a/integrations/arweave/arweave-account.ts b/integrations/arweave/arweave-account.ts
deleted file mode 100644
index a084c35..0000000
--- a/integrations/arweave/arweave-account.ts
+++ /dev/null
@@ -1,76 +0,0 @@
-import Account, { ArAccount } from "arweave-account"
-import { ArAccountEncoded, T_profile } from "arweave-account/lib/types"
-import { JWKInterface } from "arweave/node/lib/wallet"
-
-import {
- createArweaveDataTx,
- getArweaveWalletAddress,
- signAndSendArweaveTx,
-} from "."
-import { SignAndSendArweaveTxResponse } from "./utils/types"
-
-export const ArweaveAccount = new Account()
-
-export const getUserAccount = async (
- wallet: JWKInterface
-): Promise => {
- const acc: ArAccount = await ArweaveAccount.get(
- await getArweaveWalletAddress(wallet)
- )
- return acc
-}
-export const getAccountByAddress = async (
- address: string
-): Promise => {
- const acc: ArAccount = await ArweaveAccount.get(address)
- return acc
-}
-
-export type UpdateArweaveAccountPayload = Partial &
- Pick
-
-export const updateArweaveAccount = async (
- wallet: JWKInterface,
- payload: UpdateArweaveAccountPayload
-): Promise => {
- const tx = await createArweaveDataTx(wallet, JSON.stringify(encode(payload)))
- const tags = [
- { name: "Protocol-Name", value: "Account-0.3" },
- { name: "handle", value: payload.handleName },
- ]
- return await signAndSendArweaveTx(wallet, tx, tags)
-}
-
-function encode(profile: UpdateArweaveAccountPayload): ArAccountEncoded | null {
- let data: ArAccountEncoded = { handle: profile.handleName }
- if (profile.avatar) data = { ...data, avatar: profile.avatar }
- if (profile.banner) data = { ...data, banner: profile.banner }
- if (profile.name) data = { ...data, name: profile.name }
- if (profile.bio) data = { ...data, bio: profile.bio }
- if (profile.email) data = { ...data, email: profile.email }
- if (profile.links) data = { ...data, links: profile.links }
- if (profile.wallets) data = { ...data, wallets: profile.wallets }
- return data
-}
-
-export const uploadArweaveAccountAvatar = async (
- wallet: JWKInterface,
- profile: T_profile,
- avatar: ArrayBuffer,
- avatarFileType: string
-): Promise => {
- const avatarTx = await createArweaveDataTx(wallet, avatar)
- const tags = [{ name: "Content-type", value: avatarFileType }]
- const { txId, response, insufficientBalance } = await signAndSendArweaveTx(
- wallet,
- avatarTx,
- tags
- )
- if (insufficientBalance) return { txId, response, insufficientBalance }
- if (response?.status === 200) {
- const avatarUrl = `ar://${txId}`
- const payload = { ...profile, avatar: avatarUrl }
- return await updateArweaveAccount(wallet, payload)
- }
- return { txId, response, insufficientBalance: false }
-}
diff --git a/integrations/arweave/components/arweave-account/form/controls.ts b/integrations/arweave/components/arweave-account/form/controls.ts
deleted file mode 100644
index d3a1dfb..0000000
--- a/integrations/arweave/components/arweave-account/form/controls.ts
+++ /dev/null
@@ -1,80 +0,0 @@
-export const arweaveAccountFormControls = [
- {
- formfieldName: "handleName",
- component: "input",
- label: "Handle Name",
- placeholder: "Insert your @ here",
- },
- {
- formfieldName: "name",
- component: "input",
- label: "Name",
- placeholder: "Insert your name here",
- },
- {
- formfieldName: "bio",
- component: "textArea",
- label: "Bio",
- placeholder: "Insert your bio here",
- },
- {
- formfieldName: "email",
- component: "input",
- label: "Email Address",
- placeholder: "Insert your Email here",
- },
- {
- formfieldName: "wallets.eth",
- component: "input",
- label: "Etheruem address",
- placeholder: "Insert your Etheruem address here",
- },
- {
- formfieldName: "links.twitter",
- component: "input",
- label: "Twitter link",
- placeholder: "Insert your Twitter link here",
- },
- {
- formfieldName: "links.github",
- component: "input",
- label: "Github link",
- placeholder: "Insert your Github link here",
- },
- {
- formfieldName: "links.instagram",
- component: "input",
- label: "Instagram link",
- placeholder: "Insert your Instagram link here",
- },
- {
- formfieldName: "links.discord",
- component: "input",
- label: "Discord link",
- placeholder: "Insert your Discord link here",
- },
- {
- formfieldName: "links.facebook",
- component: "input",
- label: "Facebook link",
- placeholder: "Insert your Facebook link here",
- },
- {
- formfieldName: "links.linkedin",
- component: "input",
- label: "LinkedIn link",
- placeholder: "Insert your LinkedIn link here",
- },
- {
- formfieldName: "links.youtube",
- component: "input",
- label: "Youtube link",
- placeholder: "Insert your Youtube link here",
- },
- {
- formfieldName: "links.twitch",
- component: "input",
- label: "Twitch link",
- placeholder: "Insert your Twitch link here",
- },
-]
diff --git a/integrations/arweave/components/arweave-account/form/hook.ts b/integrations/arweave/components/arweave-account/form/hook.ts
deleted file mode 100644
index 3e56d70..0000000
--- a/integrations/arweave/components/arweave-account/form/hook.ts
+++ /dev/null
@@ -1,112 +0,0 @@
-import { useEffect } from "react"
-import { zodResolver } from "@hookform/resolvers/zod"
-import { useMutation } from "@tanstack/react-query"
-import { JWKInterface } from "arweave/node/lib/wallet"
-import { ethers } from "ethers"
-import { useForm, useWatch } from "react-hook-form"
-import { useDebounce } from "usehooks-ts"
-import { z } from "zod"
-
-import {
- updateArweaveAccount,
- UpdateArweaveAccountPayload,
-} from "@/integrations/arweave/arweave-account"
-import { useArweaveWallet } from "@/integrations/arweave/hooks/use-arweave-wallet"
-import { useEstimateTxFee } from "@/integrations/arweave/hooks/use-estimate-tx-fee"
-
-const useEditProfileAPI = () => {
- return useMutation({
- mutationFn: async ({
- wallet,
- payload,
- }: {
- wallet: JWKInterface
- payload: UpdateArweaveAccountPayload
- }) => {
- const { txId, response, insufficientBalance } =
- await updateArweaveAccount(wallet, payload)
- if (insufficientBalance) throw { insufficientBalance: true }
- if (response?.status !== 200) {
- throw (response?.data as { error: string }).error
- }
- return txId
- },
- })
-}
-
-export const useArweaveAccountForm = () => {
- const { account, wallet } = useArweaveWallet()
- const { mutate, data, isLoading, isError, error, isSuccess } =
- useEditProfileAPI()
- const profileSchema = z.object({
- handleName: z.string().min(1),
- avatar: z.string().optional(),
- banner: z.string().optional(),
- name: z.string().optional(),
- bio: z.string().optional(),
- email: z.string().email().optional().or(z.literal("")),
- wallets: z.object({
- eth: z
- .string()
- .refine((value) => ethers.utils.isAddress(value), {
- message:
- "Provided address is invalid. Please insure you have typed correctly.",
- })
- .optional()
- .or(z.literal("")),
- }),
- links: z.object({
- twitter: z.string().optional(),
- github: z.string().optional(),
- instagram: z.string().optional(),
- discord: z.string().optional(),
- facebook: z.string().optional(),
- linkedin: z.string().optional(),
- youtube: z.string().optional(),
- twitch: z.string().optional(),
- }),
- })
- const profile = account?.profile ?? null
- const form = useForm>({
- resolver: zodResolver(profileSchema),
- defaultValues: { ...(profile ?? {}) },
- })
- const formData = useWatch({ control: form.control })
- const debouncedFormData = useDebounce(formData, 1000)
- const { estimatedTxFee, isEstimatingTxFee, estimationError, estimateTxFee } =
- useEstimateTxFee()
-
- useEffect(() => {
- if (form.formState.isValid && !form.formState.isValidating) {
- estimateTxFee(JSON.stringify(debouncedFormData))
- }
- }, [debouncedFormData])
-
- const onSubmit = (values: z.infer) => {
- try {
- if (!wallet) {
- console.error("No Arweave wallet connected.")
- return
- }
- mutate({ wallet, payload: values })
- } catch (error) {
- console.log(error)
- }
- }
-
- return {
- error,
- data,
- isError,
- isLoading,
- isSuccess,
- profileSchema,
- form,
- onSubmit,
- estimation: {
- estimatedTxFee,
- isEstimatingTxFee,
- estimationError,
- },
- }
-}
diff --git a/integrations/arweave/components/arweave-account/form/index.tsx b/integrations/arweave/components/arweave-account/form/index.tsx
deleted file mode 100644
index e2d3aa9..0000000
--- a/integrations/arweave/components/arweave-account/form/index.tsx
+++ /dev/null
@@ -1,123 +0,0 @@
-import { Button } from "@/components/ui/button"
-import { Card, CardContent, CardFooter } from "@/components/ui/card"
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "@/components/ui/form"
-import { Separator } from "@/components/ui/separator"
-
-import { useArweaveWallet } from "../../../hooks/use-arweave-wallet"
-import { getComponent } from "../../../utils/get-element-component"
-import { ConnectArweaveWallet } from "../../connect-arweave-wallet"
-import { FeeEstimation } from "../../fee-estimation"
-import { InsufficientBalanceError } from "../../insufficient-balance-error"
-import { PendingTx } from "../../pending-tx"
-import { Spinner } from "../../spinner"
-import { arweaveAccountFormControls } from "./controls"
-import { useArweaveAccountForm } from "./hook"
-
-// This wrapper exists so the form renders only if we're done getting account
-export const ArweaveAccountEdit = () => {
- const { wallet, address, account } = useArweaveWallet()
- if (!wallet || !address) return
- if (!account) return
- return
-}
-
-const ArweaveAccountForm = () => {
- const { userHasAccount, getAccount } = useArweaveWallet()
- const {
- onSubmit,
- form,
- isLoading,
- isError,
- isSuccess,
- error,
- data,
- estimation,
- } = useArweaveAccountForm()
- const { handleSubmit, register } = form
- return (
- <>
-
-
-
- {userHasAccount
- ? "Edit your Profile"
- : "Create your Arweave account"}
-
-
-
-
-
-
- Arweave account
-
- Arweave profile is the universal account in arweave ecosystem.
-
-
-
-
- {isSuccess && data && (
-
- )}
- >
- )
-}
diff --git a/integrations/arweave/components/arweave-account/index.tsx b/integrations/arweave/components/arweave-account/index.tsx
deleted file mode 100644
index 0e91dca..0000000
--- a/integrations/arweave/components/arweave-account/index.tsx
+++ /dev/null
@@ -1,197 +0,0 @@
-import { useCallback, useRef, useState } from "react"
-import Link from "next/link"
-
-import { cn } from "@/lib/utils"
-import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
-import { Button, buttonVariants } from "@/components/ui/button"
-import { Card, CardContent } from "@/components/ui/card"
-
-import { uploadArweaveAccountAvatar } from "../../arweave-account"
-import { useArweaveWallet } from "../../hooks/use-arweave-wallet"
-import { useEstimateTxFee } from "../../hooks/use-estimate-tx-fee"
-import { convertBlobToBase64 } from "../../utils"
-import { ConnectArweaveWallet } from "../connect-arweave-wallet"
-import { FeeEstimation } from "../fee-estimation"
-import { InsufficientBalanceError } from "../insufficient-balance-error"
-import { PendingTx } from "../pending-tx"
-import { Spinner } from "../spinner"
-
-export const ArweaveAccount = () => {
- const fileInputRef = useRef(null)
- const [picture, setPicture] = useState<{
- file: ArrayBuffer
- type: string
- url: string
- } | null>(null)
- const [error, setError] = useState(null)
- const [txId, setTxId] = useState(null)
- const [insufficientBalance, setInsufficientBalance] = useState(false)
- const [uploading, setUploading] = useState(false)
- const { address, account, wallet, getAccount } = useArweaveWallet()
- const handleName = account?.profile?.handleName ?? null
- const { estimatedTxFee, isEstimatingTxFee, estimationError, estimateTxFee } =
- useEstimateTxFee()
- const upload = useCallback(async () => {
- if (wallet && picture && account?.profile) {
- setUploading(true)
- const { txId, response, insufficientBalance } =
- await uploadArweaveAccountAvatar(
- wallet,
- account?.profile,
- picture.file,
- picture.type
- )
- if (insufficientBalance) {
- setInsufficientBalance(true)
- setUploading(false)
- return
- }
- if (response?.status !== 200) {
- setError(
- `${response?.statusText ?? ""} - ${
- (response?.data as { error: string }).error
- }`
- )
- setUploading(false)
- return
- }
- setTxId(txId)
- setUploading(false)
- }
- }, [wallet, picture])
- if (!wallet) return
- if (!account) return
- return (
-
-
-
-
-
-
- {(handleName ?? address ?? "").substring(0, 2)}
-
-
- {!picture ? (
-
fileInputRef.current?.click()}
- >
-
- Select profile picture
-
-
- ) : (
-
-
-
- setPicture(null)}
- >
- Cancel
-
- upload()}
- >
-
- {uploading ? "Storing on Arweave" : "Store on Arweave"}
-
-
-
-
- )}
- {insufficientBalance &&
}
- {error && (
-
- Error: {String(error)}
-
- )}
-
- {
- if (e.target.files) {
- setError(null)
- setInsufficientBalance(false)
- const blobUrl = URL.createObjectURL(e.target.files[0])
- fetch(blobUrl)
- .then((r) => r.blob())
- .then((blob) => {
- convertBlobToBase64(blob)
- .then((res) => {
- setPicture({
- url: blobUrl,
- file: res,
- type: e.target.files?.[0]?.type ?? "",
- })
- estimateTxFee(res)
- })
- .catch((e) => alert(e))
- })
- .catch((e) => console.error(e))
- }
- }}
- />
- {txId && (
- {
- getAccount()
- setPicture(null)
- }}
- />
- )}
-
-
-
Account Info
-
- Edit Account info
-
-
- {Object.entries(account.profile)
- .filter(
- ([k]) =>
- !["avatar", "avatarURL", "banner", "bannerURL"].includes(k)
- )
- .map(([key, val]) => (
-
-
- {key}
- {val instanceof Object ? ":" : ""}
-
-
- {val instanceof Object
- ? Object.entries(val).map(([key, val]) => (
-
-
- {key}
-
-
- {val ? val : "-"}
-
-
- ))
- : val
- ? val
- : "-"}
-
-
- ))}
-
-
-
- )
-}
diff --git a/integrations/arweave/components/arweave-account/sidebar-preview.tsx b/integrations/arweave/components/arweave-account/sidebar-preview.tsx
deleted file mode 100644
index 3a85b2f..0000000
--- a/integrations/arweave/components/arweave-account/sidebar-preview.tsx
+++ /dev/null
@@ -1,53 +0,0 @@
-import CopyToClipboard from "react-copy-to-clipboard"
-import { FaCopy } from "react-icons/fa"
-
-import { useToast } from "@/lib/hooks/use-toast"
-import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
-import { LinkComponent } from "@/components/shared/link-component"
-import { useArweaveWallet } from "@/integrations/arweave/hooks/use-arweave-wallet"
-import { truncateString } from "@/integrations/arweave/utils"
-
-export const ArweaveAccountPreview = () => {
- const { account, balance, address } = useArweaveWallet()
- const { toast, dismiss } = useToast()
-
- const handleToast = () => {
- toast({
- title: "Arweave wallet address Copied",
- })
-
- setTimeout(() => {
- dismiss()
- }, 4200)
- }
-
- const handleName = account?.profile?.handleName ?? null
- if (!account || !address) return null
- return (
-
-
-
-
- {(handleName ?? address).substring(0, 2)}
-
-
-
- {handleName &&
{handleName}
}
-
- {truncateString(address, 15)}
-
-
-
-
-
-
- {balance !== null && (
-
{balance?.ar} AR
- )}
-
-
- )
-}
diff --git a/integrations/arweave/components/connect-arweave-wallet.tsx b/integrations/arweave/components/connect-arweave-wallet.tsx
deleted file mode 100644
index 7d53337..0000000
--- a/integrations/arweave/components/connect-arweave-wallet.tsx
+++ /dev/null
@@ -1,81 +0,0 @@
-import { useEffect, useRef, useState } from "react"
-import { redirect } from "next/navigation"
-import { useAccount } from "wagmi"
-
-import { Button } from "@/components/ui/button"
-
-import { useArweaveWallet } from "../hooks/use-arweave-wallet"
-import { Spinner } from "./spinner"
-
-export function ConnectArweaveWallet() {
- const fileInputRef = useRef(null)
- const [loading, setLoading] = useState(false)
- const { generate, wallet, importFromFile, error, generateBasedOnEthAddress } =
- useArweaveWallet()
- const { address: ethAccountAddress } = useAccount()
- useEffect(() => {
- if (wallet || error) setLoading(false)
- }, [wallet, error])
-
- if (loading) return
-
- if (!wallet)
- return (
-
-
Use your Eth address
-
{
- if (ethAccountAddress) {
- setLoading(true)
- void generateBasedOnEthAddress()
- }
- }}
- >
- Generate wallet
-
-
- or -
-
Generate a new Arweave Wallet
-
{
- setLoading(true)
- void generate()
- }}
- >
- Generate wallet
-
-
- or -
-
Import your wallet KeyFile
-
fileInputRef.current?.click()}>
- Select a file
-
-
{
- if (e.target.files) {
- setLoading(true)
- void importFromFile(e.target.files[0])
- }
- }}
- />
- {error && (
-
- {error}
-
- )}
-
- You can get a backup of your Arweave wallet by clicking your wallet
- address in the sidebar once connected.
-
-
- )
-
- return redirect("/integration/arweave/settings")
-}
diff --git a/integrations/arweave/components/fee-estimation.tsx b/integrations/arweave/components/fee-estimation.tsx
deleted file mode 100644
index 60161ab..0000000
--- a/integrations/arweave/components/fee-estimation.tsx
+++ /dev/null
@@ -1,28 +0,0 @@
-import { ArweaveAmount } from "../utils/types"
-import { Spinner } from "./spinner"
-
-export const FeeEstimation = ({
- estimatedTxFee,
- isEstimatingTxFee,
- estimationError,
-}: {
- estimatedTxFee: ArweaveAmount | null
- isEstimatingTxFee: boolean
- estimationError: string | null
-}) => (
-
- Estimated Tx Fee:
- {isEstimatingTxFee ? (
-
- ) : estimationError ? (
- {estimationError}
- ) : estimatedTxFee ? (
-
- {estimatedTxFee?.ar} AR{" "}
- ({estimatedTxFee?.winston} winston)
-
- ) : (
- -
- )}
-
-)
diff --git a/integrations/arweave/components/form-new-post/hook.ts b/integrations/arweave/components/form-new-post/hook.ts
deleted file mode 100644
index ef33871..0000000
--- a/integrations/arweave/components/form-new-post/hook.ts
+++ /dev/null
@@ -1,138 +0,0 @@
-import { useEffect } from "react"
-import { zodResolver } from "@hookform/resolvers/zod"
-import { useMutation } from "@tanstack/react-query"
-import { JWKInterface } from "arweave/node/lib/wallet"
-import { useForm, useWatch } from "react-hook-form"
-import { useDebounce } from "usehooks-ts"
-import { z } from "zod"
-
-import {
- createArweaveDataTx,
- signAndSendArweaveTx,
-} from "@/integrations/arweave"
-import { useArweaveWallet } from "@/integrations/arweave/hooks/use-arweave-wallet"
-
-import { useEstimateTxFee } from "../../hooks/use-estimate-tx-fee"
-import { convertBlobToBase64 } from "../../utils"
-import { ArweaveTxTag } from "../../utils/types"
-
-type ArweavePost = { tags: ArweaveTxTag[] } & (
- | { data: string; file?: never }
- | { data?: never; file: string | ArrayBuffer }
-)
-
-const useCreateArweavePostAPI = () => {
- return useMutation({
- mutationFn: async ({
- wallet,
- payload,
- }: {
- wallet: JWKInterface
- payload: ArweavePost
- }) => {
- if (!wallet) throw "No wallet connected."
-
- if (!payload.data && !payload.file) {
- throw "No Data or Files selected"
- }
- const tx = await createArweaveDataTx(wallet, payload.data ?? payload.file)
- const { txId, response, insufficientBalance } =
- await signAndSendArweaveTx(wallet, tx, payload.tags, !!payload.file)
- if (insufficientBalance) throw { insufficientBalance: true }
- if (response?.status !== 200) {
- throw `${response?.statusText ?? ""} - ${
- (response?.data as { error: string }).error
- }`
- }
- return txId
- },
- })
-}
-
-export const useArweavePostForm = () => {
- const { wallet } = useArweaveWallet()
- const { mutate, data, isLoading, isError, error, isSuccess } =
- useCreateArweavePostAPI()
- const txSchema = z.object({
- data: z.string(),
- file: z.instanceof(File).optional(),
- tags: z.array(
- z.object({
- name: z.string(),
- value: z.string(),
- })
- ),
- })
- const form = useForm>({
- resolver: zodResolver(txSchema),
- defaultValues: {
- data: "",
- tags: [],
- },
- })
-
- const formData = useWatch({ name: "data", control: form.control })
- const formFile = useWatch({ name: "file", control: form.control })
- const debouncedFormData = useDebounce(formData, 1000)
- const {
- estimatedTxFee,
- isEstimatingTxFee,
- estimationError,
- estimateTxFee,
- setIsEstimatingTxFee,
- reset,
- } = useEstimateTxFee()
-
- useEffect(() => {
- if (form.formState.isValid && !form.formState.isValidating) {
- if (debouncedFormData === "") reset()
- else estimateTxFee(JSON.stringify(debouncedFormData))
- }
- }, [debouncedFormData])
-
- useEffect(() => {
- if (form.formState.isValid && !form.formState.isValidating) {
- if (formFile) {
- setIsEstimatingTxFee(true)
- convertBlobToBase64(formFile)
- .then((base64) => {
- estimateTxFee(base64)
- })
- .catch(console.error)
- .finally(() => setIsEstimatingTxFee(false))
- } else {
- reset()
- }
- }
- }, [formFile])
-
- const onSubmit = async (values: z.infer) => {
- try {
- if (!wallet) {
- console.error("No Arweave wallet connected.")
- return
- }
- if (values.file) {
- const base64File = await convertBlobToBase64(values.file)
- mutate({ wallet, payload: { file: base64File, tags: values.tags } })
- } else {
- mutate({ wallet, payload: { data: values.data, tags: values.tags } })
- }
- form.reset()
- } catch (error) {
- console.log(error)
- }
- }
-
- return {
- error,
- data,
- isError,
- isLoading,
- isSuccess,
- txSchema,
- form,
- onSubmit,
- estimation: { estimatedTxFee, isEstimatingTxFee, estimationError },
- }
-}
diff --git a/integrations/arweave/components/form-new-post/index.tsx b/integrations/arweave/components/form-new-post/index.tsx
deleted file mode 100644
index 1c4de37..0000000
--- a/integrations/arweave/components/form-new-post/index.tsx
+++ /dev/null
@@ -1,196 +0,0 @@
-import { useRef } from "react"
-import { useFieldArray } from "react-hook-form"
-
-import { Button } from "@/components/ui/button"
-import { Card, CardContent, CardFooter } from "@/components/ui/card"
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "@/components/ui/form"
-import { Input } from "@/components/ui/input"
-import { Separator } from "@/components/ui/separator"
-import { Textarea } from "@/components/ui/textarea"
-
-import { useArweaveWallet } from "../../hooks/use-arweave-wallet"
-import { truncateString } from "../../utils"
-import { ConnectArweaveWallet } from "../connect-arweave-wallet"
-import { FeeEstimation } from "../fee-estimation"
-import { InsufficientBalanceError } from "../insufficient-balance-error"
-import { PendingTx } from "../pending-tx"
-import { useArweavePostForm } from "./hook"
-import { FormListTags } from "./list-tags"
-
-export const FormNewPost = () => {
- const fileInputRef = useRef(null)
- const { wallet, address } = useArweaveWallet()
- const {
- onSubmit,
- form,
- isLoading,
- isError,
- isSuccess,
- error,
- data,
- estimation,
- } = useArweavePostForm()
- const { control, handleSubmit, register, getValues, setValue } = form
- const values = getValues()
- const {
- fields: tags,
- append: appendTag,
- remove: removeTag,
- } = useFieldArray({
- control,
- name: "tags",
- })
- if (!wallet || !address) return
- return (
- <>
-
-
- Create a new Arweave post
-
-
-
-
-
- {" "}
- Arweave post
-
- Arweave post is a type of transaction which can store data on-chain
- permanently.
-
-
-
- {isSuccess && data && (
-
-
-
-
-
- )}
- >
- )
-}
diff --git a/integrations/arweave/components/form-new-post/list-tags.tsx b/integrations/arweave/components/form-new-post/list-tags.tsx
deleted file mode 100644
index ef528ca..0000000
--- a/integrations/arweave/components/form-new-post/list-tags.tsx
+++ /dev/null
@@ -1,69 +0,0 @@
-import {
- FieldArrayWithId,
- UseFieldArrayAppend,
- UseFieldArrayRemove,
- useFormContext,
-} from "react-hook-form"
-
-import { Button } from "@/components/ui/button"
-import { FormControl } from "@/components/ui/form"
-import { Input } from "@/components/ui/input"
-
-type Form = {
- data: string
- tags: {
- value: string
- name: string
- }[]
- file?: File | undefined
-}
-
-export const FormListTags = ({
- fields,
- append,
- remove,
-}: {
- fields: FieldArrayWithId[]
- append: UseFieldArrayAppend
- remove: UseFieldArrayRemove
-}) => {
- const { register } = useFormContext()
- return (
-
-
-
append({ name: "", value: "" })}
- >
- + New Tag
-
-
- )
-}
diff --git a/integrations/arweave/components/insufficient-balance-error.tsx b/integrations/arweave/components/insufficient-balance-error.tsx
deleted file mode 100644
index fc81497..0000000
--- a/integrations/arweave/components/insufficient-balance-error.tsx
+++ /dev/null
@@ -1,22 +0,0 @@
-import Link from "next/link"
-
-import { cn } from "@/lib/utils"
-import { buttonVariants } from "@/components/ui/button"
-import { LinkComponent } from "@/components/shared/link-component"
-
-export const InsufficientBalanceError = () => {
- return (
-
- Insuffient balance. you can buy $AR at
-
- Binance
-
- and transfer to your Arweave wallet.
-
- )
-}
diff --git a/integrations/arweave/components/list-posts.tsx b/integrations/arweave/components/list-posts.tsx
deleted file mode 100644
index a70a2af..0000000
--- a/integrations/arweave/components/list-posts.tsx
+++ /dev/null
@@ -1,209 +0,0 @@
-import moment from "moment"
-import { Control, useFieldArray, UseFormRegister } from "react-hook-form"
-
-import { Button } from "@/components/ui/button"
-import { Card, CardContent } from "@/components/ui/card"
-import {
- Form,
- FormControl,
- FormField,
- FormItem,
- FormLabel,
- FormMessage,
-} from "@/components/ui/form"
-import { Input } from "@/components/ui/input"
-import { LinkComponent } from "@/components/shared/link-component"
-
-import { useArweaveWallet } from "../hooks/use-arweave-wallet"
-import { useGetPosts } from "../hooks/use-get-posts"
-import { humanFileSize } from "../utils"
-import { ConnectArweaveWallet } from "./connect-arweave-wallet"
-import { Spinner } from "./spinner"
-
-type FormType = {
- tags: {
- values: { value: string }[]
- name: string
- }[]
- address: string
-}
-
-const TagValues = ({
- control,
- tagIndex,
- register,
-}: {
- control: Control
- tagIndex: number
- register: UseFormRegister
-}) => {
- const { fields, append, remove } = useFieldArray({
- control,
- name: `tags.${tagIndex}.values`,
- })
- return (
-
- )
-}
-
-export const ListPosts = () => {
- const { wallet, address } = useArweaveWallet()
- const { posts, loading, form, onSubmit, hasNextPage, getNextPage } =
- useGetPosts()
- const { handleSubmit, control, register, setValue } = form
- const { fields, append, remove } = useFieldArray({
- control,
- name: "tags",
- })
-
- if (!wallet) return
- return (
-
-
-
- (
-
-
- Owner address
- setValue("address", address ?? "")}
- >
- Use connected wallet address
-
-
-
-
-
-
-
- )}
- />
-
-
Tags
-
-
append({ name: "", values: [{ value: "" }] })}
- >
- + New Tag
-
-
-
-
-
-
Posts
- {posts.map((p) => (
-
-
-
-
- {p.data.type?.replace("/", " ") ?? "data"}
-
- {p.tags.find((tag) => tag.name === "Protocol-Name")?.value ??
- "Data"}
-
-
-
-
- Size:{" "}
-
- {humanFileSize(p.data.size)}
-
-
-
- {p.block?.timestamp
- ? moment(parseInt(p.block?.timestamp) * 1000).format(
- "MMM D, YYYY h:mm A"
- )
- : ""}
-
-
-
-
-
- ))}
- {!loading && !posts.length &&
No post matched.
}
- {!loading && hasNextPage && (
-
getNextPage()}>
- Load more
-
- )}
- {loading && (
-
-
-
- )}
-
- )
-}
diff --git a/integrations/arweave/components/pending-tx.tsx b/integrations/arweave/components/pending-tx.tsx
deleted file mode 100644
index 788afc6..0000000
--- a/integrations/arweave/components/pending-tx.tsx
+++ /dev/null
@@ -1,77 +0,0 @@
-import { useEffect, useMemo } from "react"
-import Link from "next/link"
-import CopyToClipboard from "react-copy-to-clipboard"
-import { FaCheck, FaCopy } from "react-icons/fa"
-
-import { useToast } from "@/lib/hooks/use-toast"
-import { cn } from "@/lib/utils"
-import { buttonVariants } from "@/components/ui/button"
-import { Card, CardContent } from "@/components/ui/card"
-import { LinkComponent } from "@/components/shared/link-component"
-
-import { CONFIRMED_THRESHOLD } from ".."
-import { useArweaveWallet } from "../hooks/use-arweave-wallet"
-import { AddPendingTxPayload } from "../utils/types"
-import { Spinner } from "./spinner"
-
-export const PendingTx = ({ txId, onConfirmation }: AddPendingTxPayload) => {
- const { pendingTxs, addPendingTx } = useArweaveWallet()
- const { toast, dismiss } = useToast()
- const handleToast = () => {
- toast({
- title: "Arweave Tx ID Copied",
- })
-
- setTimeout(() => {
- dismiss()
- }, 4200)
- }
-
- useEffect(() => {
- addPendingTx({ txId, onConfirmation })
- }, [])
-
- const pendingTx = useMemo(
- () => pendingTxs.find((tx) => tx.txId === txId),
- [pendingTxs]
- )
- const isFinished =
- (pendingTx?.status?.confirmed?.number_of_confirmations ?? 0) >
- CONFIRMED_THRESHOLD
- return (
-
-
-
-
- {!isFinished ? (
-
- ) : (
-
- )}
-
-
- {txId}
-
- handleToast()}>
-
-
-
-
-
-
-
- View tx
-
-
-
-
- )
-}
diff --git a/integrations/arweave/components/post.tsx b/integrations/arweave/components/post.tsx
deleted file mode 100644
index 8c0d3d1..0000000
--- a/integrations/arweave/components/post.tsx
+++ /dev/null
@@ -1,241 +0,0 @@
-import { useEffect, useState } from "react"
-import Link from "next/link"
-import { ArAccount } from "arweave-account"
-import { TransactionStatusResponse } from "arweave/node/transactions"
-import moment from "moment"
-import CopyToClipboard from "react-copy-to-clipboard"
-import { FaCopy } from "react-icons/fa"
-
-import { useToast } from "@/lib/hooks/use-toast"
-import { cn } from "@/lib/utils"
-import { Avatar, AvatarFallback, AvatarImage } from "@/components/ui/avatar"
-import { buttonVariants } from "@/components/ui/button"
-import { Card, CardContent } from "@/components/ui/card"
-import { LinkComponent } from "@/components/shared/link-component"
-
-import { arweaveGatewayUrl, getArweaveTxData, getArweaveTxStatus } from ".."
-import { getAccountByAddress } from "../arweave-account"
-import { getArweaveTx } from "../queries/query-post"
-import { humanFileSize, truncateString } from "../utils"
-import { ArweavePost, ArweaveTxId } from "../utils/types"
-import { Spinner } from "./spinner"
-
-export const Post = ({ txId }: { txId: ArweaveTxId }) => {
- const [txDetails, setTxDetails] = useState(null)
- const [txStatus, setTxStatus] = useState(
- null
- )
- const [txData, setTxData] = useState(null)
- const [downloadLink, setDownloadLink] = useState(null)
- const [owner, setOwner] = useState(null)
- useEffect(() => {
- getArweaveTx(txId)
- .then((res) => {
- setTxDetails(res)
- if (res.data.type?.split("/")[0] === "image") {
- // TODO: Fix this conditional
- } else if (parseFloat(res.data.size) < 1024) {
- getArweaveTxData(txId)
- .then((res) => setTxData(res))
- .catch(console.error)
- } else {
- setDownloadLink(`${arweaveGatewayUrl}${txId}`)
- }
- })
- .catch(console.error)
- getArweaveTxStatus(txId)
- .then((res) => {
- setTxStatus(res)
- if (res && !res.confirmed) {
- const intervalId = setInterval(() => {
- getArweaveTxStatus(txId)
- .then((res) => {
- setTxStatus(res)
- if (res?.confirmed) clearInterval(intervalId)
- })
- .catch(console.error)
- }, 3000)
- }
- })
- .catch(console.error)
- }, [txId])
-
- useEffect(() => {
- if (txDetails?.owner)
- getAccountByAddress(txDetails.owner.address)
- .then((acc) => setOwner(acc))
- .catch(console.error)
- }, [txDetails])
-
- const { toast, dismiss } = useToast()
- const handleToast = (msg: string) => {
- toast({
- title: msg,
- })
-
- setTimeout(() => {
- dismiss()
- }, 4200)
- }
- return (
-
-
- Transaction
-
-
-
- {txId}
-
- handleToast("Arweave Tx ID Copied")}
- >
-
-
-
-
-
-
- View on Arweave.app
-
-
- {txStatus && (
-
-
Status
- {txStatus?.confirmed ? (
- <>
-
- Confirmations:
-
- {txStatus.confirmed?.number_of_confirmations}
-
-
-
- Block height:
-
- {txStatus.confirmed?.block_height}
-
-
-
- Block Hash:
-
- {txStatus.confirmed?.block_indep_hash}
-
-
- >
- ) : (
-
-
- Pending
-
- )}
-
- )}
- {txDetails && (
-
-
- Fee:
-
- {txDetails.fee.winston} winston
-
-
-
- Time:
-
- {txDetails.block?.timestamp
- ? moment(parseInt(txDetails.block.timestamp) * 1000).format(
- "MMM D, YYYY h:mm A"
- )
- : "-"}
-
-
-
Owner
-
-
-
-
- {(owner?.handle ?? txDetails.owner.address).substring(0, 2)}
-
-
-
- {owner?.handle && (
-
{owner?.handle}
- )}
-
- {truncateString(txDetails.owner.address, 15)}
- handleToast("Owner address Copied")}
- >
-
-
-
-
-
-
-
-
- )}
-
-
Tags
- {txDetails?.tags.map((tag) => (
-
-
- {tag.name}
- {tag.value}
-
-
- ))}
-
-
-
Data
- {txDetails && (
- <>
-
- Size:
-
- {humanFileSize(txDetails.data.size)}
-
-
-
- Type:
-
- {txDetails.data.type ?? "-"}
-
-
- >
- )}
- {txDetails?.data.type?.split("/")[0] === "image" && (
-
- )}
- {txData && (
-
- {txData}
-
- )}
- {downloadLink && (
-
- Download Data from Arweave
-
- )}
-
- {(!txDetails || !txStatus) && (
-
-
-
- )}
-
-
- )
-}
diff --git a/integrations/arweave/components/settings.tsx b/integrations/arweave/components/settings.tsx
deleted file mode 100644
index 6e2f29e..0000000
--- a/integrations/arweave/components/settings.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { Button } from "@/components/ui/button"
-
-import { useArweaveWallet } from "../hooks/use-arweave-wallet"
-import { ConnectArweaveWallet } from "./connect-arweave-wallet"
-
-export const ArweaveSettings = () => {
- const { wallet, disconnect, address, backupWallet } = useArweaveWallet()
- if (!wallet) return
- return (
-
-
- Connected to {address}
-
-
- backupWallet()}>backup keyfile
- disconnect()}>disconnect
-
-
- )
-}
diff --git a/integrations/arweave/components/spinner.tsx b/integrations/arweave/components/spinner.tsx
deleted file mode 100644
index 787e006..0000000
--- a/integrations/arweave/components/spinner.tsx
+++ /dev/null
@@ -1,26 +0,0 @@
-export const Spinner = ({ isSmall }: { isSmall?: boolean }) => {
- const cn = isSmall
- ? "mr-2 h-4 w-4 animate-spin fill-blue-600 text-muted-foreground"
- : "mr-2 h-8 w-8 animate-spin fill-blue-600 text-muted-foreground"
- return (
-
- )
-}
diff --git a/integrations/arweave/context/arweave-wallet.tsx b/integrations/arweave/context/arweave-wallet.tsx
deleted file mode 100644
index 90becce..0000000
--- a/integrations/arweave/context/arweave-wallet.tsx
+++ /dev/null
@@ -1,235 +0,0 @@
-"use client"
-
-import { createContext, useCallback, useEffect, useMemo, useState } from "react"
-import { ArAccount } from "arweave-account"
-import { JWKInterface } from "arweave/node/lib/wallet"
-import { TransactionStatusResponse } from "arweave/node/transactions"
-import { useAccount } from "wagmi"
-
-import {
- CONFIRMED_THRESHOLD,
- generateArweaveWallet,
- getArweaveTxStatus,
- getArweaveWalletAddress,
- getArweaveWalletBalance,
-} from ".."
-import { getUserAccount } from "../arweave-account"
-import { AddPendingTxPayload, ArweaveAmount, ArweaveTxId } from "../utils/types"
-
-type PendingTx = {
- txId: ArweaveTxId
- status: TransactionStatusResponse | null
-}
-
-export interface IArweaveWalletContext {
- account: ArAccount | null
- isAccountLoading: boolean
- userHasAccount: boolean
- wallet: JWKInterface | null
- error: string | null
- address: string | null
- balance: ArweaveAmount | null
- pendingTxs: PendingTx[]
- disconnect: () => void
- generate: () => Promise
- importFromFile: (file: File) => void
- backupWallet: () => void
- getBalance: () => Promise
- generateBasedOnEthAddress: () => Promise
- addPendingTx: ({ txId, onConfirmation }: AddPendingTxPayload) => void
- getAccount: () => void
-}
-
-export const ArweaveWalletContext = createContext({
- account: null,
- isAccountLoading: false,
- userHasAccount: false,
- wallet: null,
- error: null,
- address: null,
- balance: null,
- pendingTxs: [],
- disconnect: () => {
- return
- },
- generate: () => Promise.resolve(),
- importFromFile: () => Promise.resolve(),
- backupWallet: () => Promise.resolve(),
- getBalance: () => Promise.resolve(),
- generateBasedOnEthAddress: () => Promise.resolve(),
- addPendingTx: () => Promise.resolve(),
- getAccount: () => {
- return
- },
-})
-
-export const ArweaveWalletProvider = ({
- children,
-}: {
- children: React.ReactNode
-}) => {
- const [wallet, setWallet] = useState(null)
- const [error, setError] = useState(null)
- const [address, setAddress] = useState(null)
- const [pendingTxs, setPendingTxs] = useState([])
- const [balance, setBalance] = useState(null)
- const [account, setAccount] = useState