diff --git a/packages/contracts/Makefile b/packages/contracts/Makefile index a9ad5f3a0..93ba6d5f0 100755 --- a/packages/contracts/Makefile +++ b/packages/contracts/Makefile @@ -31,6 +31,12 @@ deploy-plumeTestnet: resume-plumeTestnet: $(MAKE) deploy RPC_URL=plumeTestnet EXTRA_FLAGS="--verify --verifier blockscout --verifier-url https://test-explorer.plumenetwork.xyz/api\? --legacy --skip-simulation --slow --resume" +deploy-plume: + $(MAKE) deploy RPC_URL=plume EXTRA_FLAGS="--verify --verifier blockscout --verifier-url https://phoenix-explorer.plumenetwork.xyz/api\? --legacy --skip-simulation --slow" + +resume-plume: + $(MAKE) deploy RPC_URL=plume EXTRA_FLAGS="--verify --verifier blockscout --verifier-url https://phoenix-explorer.plumenetwork.xyz/api\? --legacy --skip-simulation --slow --resume" + deploy-arbitrum: $(MAKE) deploy RPC_URL=arbitrum EXTRA_FLAGS="--verify --slow" diff --git a/packages/contracts/foundry.toml b/packages/contracts/foundry.toml index fb7ca54ec..6dfafc3b2 100755 --- a/packages/contracts/foundry.toml +++ b/packages/contracts/foundry.toml @@ -22,6 +22,7 @@ polygon = "https://polygon-mainnet.g.alchemy.com/v2/${ALCHEMY_API_KEY}" polygonMumbai = "https://polygon-mumbai.g.alchemy.com/v2/${ALCHEMY_API_KEY}" bitlayer = "https://rpc.bitlayer.org" bitlayerTestnet = "https://testnet-rpc.bitlayer.org" +plume = "https://phoenix-rpc.plumenetwork.xyz/${PLUME_API_KEY}" plumeDevnet = "https://devnet-rpc.plumenetwork.xyz" plumeTestnet_old = "https://testnet-rpc.plumenetwork.xyz" plumeTestnet= "https://test-rpc.plumenetwork.xyz" @@ -35,6 +36,7 @@ arbitrum = { key = "${ARB_ETHERSCAN_API_KEY}", url = "https://api.arbiscan.io/ap arbitrumSepolia = { key = "${ARB_SEPOLIA_ETHERSCAN_API_KEY}", url = "https://api-sepolia.arbiscan.io/api", chain=421614 } bitlayer = { key = "bitlayer", url="https://rpc.bitlayer.org" } bitlayerTestnet = { key = "bitlayerTestnet", url="https://testnet-scan.bitlayer.org" } +plume = { key = "plume", url = 'https://phoenix-explorer.plumenetwork.xyz/api\?', chain=98865 } plumeDevnet = { key = "plumeDevnet", url = 'https://devnet-explorer.plumenetwork.xyz/api\?', chain=18230 } plumeTestnet_old = { key = "plumeTestnet_old", url = 'https://testnet-explorer.plumenetwork.xyz/api\?', chain=161221135 } plumeTestnet = { key = "plumeTestnet", url = 'https://test-explorer.plumenetwork.xyz/api\?', chain=98864 } diff --git a/packages/contracts/resource/plumeMainnet.toml b/packages/contracts/resource/plumeMainnet.toml new file mode 100644 index 000000000..72d00d12c --- /dev/null +++ b/packages/contracts/resource/plumeMainnet.toml @@ -0,0 +1,41 @@ +## +# The Application Configuration for the Plume Mainnet Environment. +## + +[evm] +# blockchain id, e.g. plumeMainnet=98865, plumeTestnet=98864, plumeTestnet_old=161221135, plumeDevnet=18230 +chain_id = 98865 +deploy_mocks = false + + +[evm.address] +# credbull.cb.id admin/owner (#1) +owner = "0x0fEcd2f7B3EC4BeE8001B4F73df32e7917d8fdE3" +# credbulloper.cb.id operator (#2) +operator = "0xf589233a140F037976f2786C8A4Fba4920EB687b" +# credbullupgrader.cb.id upgrader (#4) +upgrader = "0x3E449960Ba36cB00B728A370F991c658e7cca459" +# credbullassetmgr.cb.id asset manager (#7) +asset_manager = "0x97BE1b79AA9dB55e7235a9dd5E686cc4A26A7959" + +# USDC.e token address (Fiat Proxy +usdc_token="0x0F3B6CC558A714ecf4Cc9ec8caFF0b57ECf65890" +# Liquid Continuous Multi Token Vault Proxy +liquid_vault_proxy="0xb89846b74f3B190F6e00fc35B3aFfCDF5d4BB9f9" +# Liquid Continuous Multi Token Vault Impl +liquid_vault_impl="0x8f87E1258d645d948F270221C34202Be0583F29b" + + +[evm.contracts.liquid_continuous_multi_token_vault] +# rate in basis points, e.g. 10% = 1000 bps +full_rate_bps = 10_00 +# rate in basis points, e.g. 5.5% = 550 bps +reduced_rate_bps = 5_50 +# January 1, 2025 2:00:00 PM UTC = 1735740000 +vault_start_timestamp = 1735740000 + +[services.supabase] +url = "" + +# Save the contract deployment details to the database. +update_contract_addresses = false \ No newline at end of file diff --git a/packages/contracts/resource/plumeTestnet.toml b/packages/contracts/resource/plumeTestnet.toml index 950e7ac3f..c602e602a 100644 --- a/packages/contracts/resource/plumeTestnet.toml +++ b/packages/contracts/resource/plumeTestnet.toml @@ -5,7 +5,7 @@ [evm] # blockchain id, e.g. plumeTestnet=98864, plumeTestnet_old=161221135, plumeDevnet=18230 chain_id = 98864 -deploy_mocks = true +deploy_mocks = false [evm.address] # credbull-devops wallets. wallet numbers are 1-based (as opposed to 0-based in anvil) @@ -19,12 +19,24 @@ custodian = "0x8561845F6a9511cD8e2daCae77A961e718A77cF6" upgrader = "0xaD3C004eE1f942BFDA2DA0D2DAaC94d6aC012F75" # devops asset manager (wallet 7) - public address, okay to share asset_manager = "0xd097E901FB9B75C2d2f97E142d73fA79C31FcAb3" +# CBL token address - Plume Testnet +cbl_token="0x931Cf9ab674bAbfa7De712EE635b75b5636b4D29" +# USDC.e token address - Plume Testnet +usdc_token="0x401eCb1D350407f13ba348573E5630B83638E30D" +# Liquid Continuous Multi Token Vault Proxy - Plume Testnet +liquid_vault_proxy="0x4B1fC984F324D2A0fDD5cD83925124b61175f5C6" +# Liquid Continuous Multi Token Vault Impl - Plume Testnet +liquid_vault_impl="0x9Db9df1D91c5cdE0c92cf02B9992d42f47028b4A" + [evm.contracts.liquid_continuous_multi_token_vault] # rate in basis points, e.g. 10% = 1000 bps full_rate_bps = 10_00 # rate in basis points, e.g. 5.5% = 550 bps reduced_rate_bps = 5_50 +# January 1, 2024 2:00:00 PM UTC = 1704117600 +vault_start_timestamp = 1704117600 + [evm.contracts.upside_vault] # 2 decimal place percentage (meaining value divided by 100) as integer. diff --git a/packages/contracts/resource/testnetArbSepolia.toml b/packages/contracts/resource/testnetArbSepolia.toml new file mode 100644 index 000000000..e7b476e41 --- /dev/null +++ b/packages/contracts/resource/testnetArbSepolia.toml @@ -0,0 +1,50 @@ +## +# The Application Configuration for the TestNet Environment. +## + +[evm] +# blockchain id, e.g. baseSepolia=84532, arbSepolia=421614 +chain_id = 421614 +deploy_mocks = false + +[evm.address] +# credbull-devops wallets. wallet numbers are 1-based (as opposed to 0-based in anvil) +# devops admin/owner (wallet 1) - public address, okay to share +owner = "0xD79Be36f61fce3B8EF2FBF22b13B2b9a68eE15A2" +# devops operator (wallet 2) - public address, okay to share +operator = "0xaD3C004eE1f942BFDA2DA0D2DAaC94d6aC012F75" +# devops custodian (wallet 3) - public address, okay to share +custodian = "0x8561845F6a9511cD8e2daCae77A961e718A77cF6" +# devops upgrader (wallet 4) - public address, okay to share +upgrader = "0xaD3C004eE1f942BFDA2DA0D2DAaC94d6aC012F75" +# devops asset manager (wallet 7) - public address, okay to share +asset_manager = "0xd097E901FB9B75C2d2f97E142d73fA79C31FcAb3" +# CBL token address - Arbitrum Sepolia +cbl_token="0x3Dd53Ec7DFff8cf774391867C83583E634363345" +# USDC token address - Arbitrum Sepolia +usdc_token="0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d" + +[evm.contracts.liquid_continuous_multi_token_vault] +# rate in basis points, e.g. 10% = 1000 bps +full_rate_bps = 10_00 +# rate in basis points, e.g. 5.5% = 550 bps +reduced_rate_bps = 5_50 + +[evm.contracts.upside_vault] +# 2 decimal place percentage (meaining value divided by 100) as integer. +collateral_percentage = 200 + +[evm.contracts.cbl] +# CBL token params +# devops admin/owner (wallet 1) - public address, okay to share +owner = "0xD79Be36f61fce3B8EF2FBF22b13B2b9a68eE15A2" +# devops operator (wallet 2) - public address, okay to share +minter = "0xaD3C004eE1f942BFDA2DA0D2DAaC94d6aC012F75" +# CBL token params +max_supply = 10_000_000 # 10 million in wei + +[services.supabase] +url = "" + +# Save the contract deployment details to the database. +update_contract_addresses = false diff --git a/packages/contracts/script/DeployLiquidMultiTokenVault.s.sol b/packages/contracts/script/DeployLiquidMultiTokenVault.s.sol index 7f9e647b4..7ddb0abfe 100644 --- a/packages/contracts/script/DeployLiquidMultiTokenVault.s.sol +++ b/packages/contracts/script/DeployLiquidMultiTokenVault.s.sol @@ -103,12 +103,13 @@ contract DeployLiquidMultiTokenVault is TomlConfig { IERC20Metadata asset, IYieldStrategy yieldStrategy, IRedeemOptimizer redeemOptimizer - ) public view returns (LiquidContinuousMultiTokenVault.VaultParams memory vaultParams_) { + ) public view virtual returns (LiquidContinuousMultiTokenVault.VaultParams memory vaultParams_) { uint256 fullRateBasisPoints = _tomlConfig.readUint(string.concat(CONTRACT_TOML_KEY, ".full_rate_bps")); uint256 reducedRateBasisPoints = _tomlConfig.readUint(string.concat(CONTRACT_TOML_KEY, ".reduced_rate_bps")); uint256 startTimestamp = _startTimestamp(); - uint256 scale = 10 ** asset.decimals(); + uint256 decimals = asset.decimals(); + uint256 scale = 10 ** decimals; TripleRateContext.ContextParams memory contextParams = TripleRateContext.ContextParams({ fullRateScaled: fullRateBasisPoints * scale / 100, @@ -118,7 +119,7 @@ contract DeployLiquidMultiTokenVault is TomlConfig { }), frequency: 360, tenor: 30, - decimals: asset.decimals() + decimals: decimals }); LiquidContinuousMultiTokenVault.VaultParams memory vaultParams = LiquidContinuousMultiTokenVault.VaultParams({ diff --git a/packages/contracts/script/utils/generateTsAbis.js b/packages/contracts/script/utils/generateTsAbis.js index 6577cdd7f..5c65fbb14 100644 --- a/packages/contracts/script/utils/generateTsAbis.js +++ b/packages/contracts/script/utils/generateTsAbis.js @@ -67,7 +67,7 @@ function getInheritedFunctions(mainArtifact) { } function main() { - const current_path_to_broadcast = path.join(__dirname, '../..', 'broadcast/DeployAndLoadLiquidMultiTokenVault.s.sol'); // data loading variant + const current_path_to_broadcast = path.join(__dirname, '../..', 'broadcast/DeployLiquidMultiTokenVault.s.sol'); // data loading variant const current_path_to_deployments = path.join(__dirname, '../..', 'broadcast'); const chains = getDirectories(current_path_to_broadcast); diff --git a/packages/contracts/test/src/LiquidStoneNinetyDayTest.t.sol b/packages/contracts/test/src/LiquidStoneNinetyDayTest.t.sol new file mode 100644 index 000000000..f03e9fd50 --- /dev/null +++ b/packages/contracts/test/src/LiquidStoneNinetyDayTest.t.sol @@ -0,0 +1,118 @@ +// SPDX-License-Identifier: MIT +pragma solidity ^0.8.20; + +import { LiquidContinuousMultiTokenVault } from "@credbull/yield/LiquidContinuousMultiTokenVault.sol"; +import { LiquidContinuousMultiTokenVaultTestBase } from "@test/test/yield/LiquidContinuousMultiTokenVaultTestBase.t.sol"; + +import { CalcSimpleInterest } from "@credbull/yield/CalcSimpleInterest.sol"; + +import { TestParamSet } from "@test/test/token/ERC1155/TestParamSet.t.sol"; + +import { IYieldStrategy } from "@credbull/yield/strategy/IYieldStrategy.sol"; +import { IRedeemOptimizer } from "@credbull/token/ERC1155/IRedeemOptimizer.sol"; +import { DeployLiquidMultiTokenVault } from "@script/DeployLiquidMultiTokenVault.s.sol"; + +import { IERC20Metadata } from "@openzeppelin/contracts/token/ERC20/extensions/IERC20Metadata.sol"; + +contract DeployLiquidStoneNinetyDay is DeployLiquidMultiTokenVault { + function _createVaultParams( + LiquidContinuousMultiTokenVault.VaultAuth memory vaultAuth, + IERC20Metadata asset, + IYieldStrategy yieldStrategy, + IRedeemOptimizer redeemOptimizer + ) public view override returns (LiquidContinuousMultiTokenVault.VaultParams memory vaultParams_) { + LiquidContinuousMultiTokenVault.VaultParams memory vaultParams = + super._createVaultParams(vaultAuth, asset, yieldStrategy, redeemOptimizer); + + uint256 scale = 10 ** asset.decimals(); + vaultParams.contextParams.tenor = 90; + vaultParams.redeemNoticePeriod = 0; + vaultParams.contextParams.fullRateScaled = 10 * scale; + vaultParams.contextParams.initialReducedRate.interestRate = 0; // zero for less than tenor + + return vaultParams; + } +} + +contract LiquidStoneNinetyDayTest is LiquidContinuousMultiTokenVaultTestBase { + using TestParamSet for TestParamSet.TestParam[]; + + function setUp() public virtual override { + DeployLiquidMultiTokenVault _deployVault = new DeployLiquidStoneNinetyDay(); + _liquidVault = _deployVault.run(_vaultAuth); + + // warp to a "real time" time rather than block.timestamp=1 + vm.warp(_liquidVault._vaultStartTimestamp() + 1); + + _asset = IERC20Metadata(_liquidVault.asset()); + _scale = 10 ** _asset.decimals(); + + _transferAndAssert(_asset, _vaultAuth.owner, alice, 100_000 * _scale); + _transferAndAssert(_asset, _vaultAuth.owner, bob, 100_000 * _scale); + } + + function test__LiquidStoneNinetyDay__VerifyDeployTenor() public view { + assertEq(90, _liquidVault.TENOR(), "tenor incorrect"); + } + + // TODO - need to implement and test for RetainedAssetsReceive1APY + + function test__LiquidStoneNinetyDay__RedeemFullTenor() public { + uint256 depositPeriod = 5; + uint256 redeemPeriod = depositPeriod + _liquidVault.TENOR(); + uint256 principal = 105 * _scale; + + TestParamSet.TestUsers memory aliceTestUsers = TestParamSet.toSingletonUsers(alice); + + TestParamSet.TestParam[] memory testParams = new TestParamSet.TestParam[](1); + testParams[0] = + TestParamSet.TestParam({ principal: principal, depositPeriod: depositPeriod, redeemPeriod: redeemPeriod }); + + uint256[] memory sharesAtPeriods = _testDepositOnly(aliceTestUsers, _liquidVault, testParams); + + uint256 expectedReturns = CalcSimpleInterest.calcInterest( + principal, _liquidVault.rateScaled(), redeemPeriod - depositPeriod, _liquidVault.frequency(), _scale + ); + + _transferFromTokenOwner(_asset, address(_liquidVault), expectedReturns); // give the vault enough to cover returns + + // warp to the redeem period + _warpToPeriod(_liquidVault, redeemPeriod); + + vm.prank(alice); + _liquidVault.requestRedeem(sharesAtPeriods[0], alice, alice); + + vm.prank(alice); + uint256 assets = _liquidVault.redeem(sharesAtPeriods[0], alice, alice); + + assertEq(principal + expectedReturns, assets, "wrong assets returned"); + } + + function test__LiquidStoneNinetyDay__EarlyRedemptionGivesZeroYield() public { + uint256 depositPeriod = 25; + uint256 earlyRedeemPeriod = depositPeriod + _liquidVault.TENOR() - 1; // less than full tenor period + uint256 principal = 125 * _scale; + + TestParamSet.TestUsers memory aliceTestUsers = TestParamSet.toSingletonUsers(alice); + + TestParamSet.TestParam[] memory testParams = new TestParamSet.TestParam[](1); + testParams[0] = TestParamSet.TestParam({ + principal: principal, + depositPeriod: depositPeriod, + redeemPeriod: earlyRedeemPeriod + }); + + uint256[] memory sharesAtPeriods = _testDepositOnly(aliceTestUsers, _liquidVault, testParams); + + // warp to the redeem period + _warpToPeriod(_liquidVault, earlyRedeemPeriod); + + vm.prank(alice); + _liquidVault.requestRedeem(sharesAtPeriods[0], alice, alice); + + vm.prank(alice); + uint256 assets = _liquidVault.redeem(sharesAtPeriods[0], alice, alice); + + assertEq(principal, assets, "early redemption should give back principal and zero returns"); + } +} diff --git a/spikes/spike-liquid-stone/package.json b/spikes/spike-liquid-stone/package.json index 9c18e4550..8734892d1 100644 --- a/spikes/spike-liquid-stone/package.json +++ b/spikes/spike-liquid-stone/package.json @@ -34,6 +34,7 @@ "verify": "yarn workspace @se-2/foundry verify" }, "devDependencies": { + "@types/dotenv": "^8.2.3", "husky": "^9.1.4", "lint-staged": "^15.2.9" }, @@ -44,6 +45,7 @@ "dependencies": { "@openzeppelin/contracts-upgradeable": "^5.0.2", "alchemy-sdk": "^3.4.2", + "dotenv": "^16.4.5", "ethers": "^6.13.3", "react-tooltip": "^5.28.0" }, diff --git a/spikes/spike-liquid-stone/packages/nextjs/.env.sample b/spikes/spike-liquid-stone/packages/nextjs/.env.sample index 730d53b1e..20ee3077d 100644 --- a/spikes/spike-liquid-stone/packages/nextjs/.env.sample +++ b/spikes/spike-liquid-stone/packages/nextjs/.env.sample @@ -1,3 +1,9 @@ NEXT_PUBLIC_NETWORK=localhost NEXT_PUBLIC_CUSTODIAN=0x3C44CdDdB6a900fa2b585dd299e03d12FA4293BC + +NEXT_PUBLIC_ALCHEMY_API_KEY= + +# Required for Plume Mainnet only +# TODO - do not check this in - API key! +PLUME_API_KEY= \ No newline at end of file diff --git a/spikes/spike-liquid-stone/packages/nextjs/app/helpers/_components/ViewSection.tsx b/spikes/spike-liquid-stone/packages/nextjs/app/helpers/_components/ViewSection.tsx index 273e0d0e5..b00f3be53 100644 --- a/spikes/spike-liquid-stone/packages/nextjs/app/helpers/_components/ViewSection.tsx +++ b/spikes/spike-liquid-stone/packages/nextjs/app/helpers/_components/ViewSection.tsx @@ -51,9 +51,9 @@ const ViewSection = () => { const { data: simpleUsdcContractData } = useDeployedContractInfo(contractNames[0]); const { data: implementationContractData, isLoading: implementationContractLoading } = useDeployedContractInfo( - contractNames[3], + contractNames[4], ); - const { data: proxyContractData, isLoading: proxyContractLoading } = useDeployedContractInfo(contractNames[4]); + const { data: proxyContractData, isLoading: proxyContractLoading } = useDeployedContractInfo(contractNames[5]); const custodian = process.env.NEXT_PUBLIC_CUSTODIAN || ""; @@ -106,7 +106,7 @@ const ViewSection = () => { const handleGrantRole = async (roleIndex: number) => { if (!userAccountToGrant) { - notification.error("Missing required fields"); + notification.error(`Grant Role: Missing userAccountToGrant`); return; } @@ -166,7 +166,7 @@ const ViewSection = () => { const handleRevokeRole = async (roleIndex: number) => { if (!userAccountToRevoke) { - notification.error("Missing required fields"); + notification.error(`Revoke Role: Missing userAccountToRevoke`); return; } @@ -226,7 +226,7 @@ const ViewSection = () => { const handleSetPeriod = async (directionIndex: number) => { if (!numOfPeriods) { - notification.error("Missing required fields"); + notification.error("Set Period. Missing numOfPeriods"); return; } @@ -293,7 +293,7 @@ const ViewSection = () => { const handleSetTimestamp = async () => { if (!selectedTimestamp) { - notification.error("Missing required fields"); + notification.error("Set Timestamp. Missing selectedTimestamp"); return; } @@ -349,7 +349,7 @@ const ViewSection = () => { const handleSetReducedRate = async () => { if (!reducedRate) { - notification.error("Missing required fields"); + notification.error("Set Reduced Rate. Missing reducedRate"); return; } @@ -388,12 +388,14 @@ const ViewSection = () => { const handleWithdraw = async (withdrawType: number) => { if (!custodian || !proxyContractData || !simpleUsdcContractData) { - notification.error("Missing required fields"); + notification.error( + `Handle Withdraw - Missing required fields. Custodian:${custodian} , ProxyContractData: ${proxyContractData} , SimpleUsdcContractData: ${simpleUsdcContractData}`, + ); return; } if (!withdrawType && !assets) { - notification.error("Missing required fields"); + notification.error(`Withdraw. Missing required fields. Withdraw Type: ${withdrawType} , assets: ${assets}`); return; } diff --git a/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx b/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx index ab65f6906..bd9f2b485 100644 --- a/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx +++ b/spikes/spike-liquid-stone/packages/nextjs/app/vault/_components/ViewSection.tsx @@ -1,7 +1,6 @@ "use client"; import { useEffect, useState } from "react"; -// import ActionLogSection from "./ActionLogSection"; import Button from "../../../components/general/Button"; import ContractValueBadge from "../../../components/general/ContractValueBadge"; import Input from "../../../components/general/Input"; @@ -9,7 +8,7 @@ import LoadingSpinner from "../../../components/general/LoadingSpinner"; import DepositPoolCard from "./DepositPoolCard"; import { ethers } from "ethers"; import { useTheme } from "next-themes"; -import { useAccount, useChainId, useWriteContract } from "wagmi"; +import { useAccount, useWriteContract } from "wagmi"; import { CheckCircleIcon } from "@heroicons/react/24/solid"; import ActionCard from "~~/components/general/ActionCard"; import { useFetchContractData } from "~~/hooks/custom/useFetchContractData"; @@ -30,16 +29,14 @@ const ViewSection = () => { const { data: simpleUsdcContractData } = useDeployedContractInfo(contractNames[0]); const { data: implementationContractData, isLoading: implementationContractLoading } = useDeployedContractInfo( - contractNames[3], + contractNames[4], ); - const { data: proxyContractData, isLoading: proxyContractLoading } = useDeployedContractInfo(contractNames[4]); + const { data: proxyContractData, isLoading: proxyContractLoading } = useDeployedContractInfo(contractNames[5]); const deployedContractAddress = proxyContractData?.address || ""; const deployedContractAbi = implementationContractData?.abi as ContractAbi; const deployedContractLoading = implementationContractLoading || proxyContractLoading; - const chainId = useChainId(); - const { resolvedTheme } = useTheme(); const [mounted, setMounted] = useState(false); const [refetch, setRefetch] = useState(false); @@ -71,8 +68,7 @@ const ViewSection = () => { dependencies: [refetch], }); - const { pools } = useFetchDepositPools({ - chainId, + const { pools, depositPoolsFetched } = useFetchDepositPools({ address: address || "", deployedContractAddress, deployedContractAbi, @@ -80,7 +76,7 @@ const ViewSection = () => { refetch, }); - const { redeemRequests } = useFetchRedeemRequests({ + const { redeemRequests, redeemRequestsFetched } = useFetchRedeemRequests({ address: address || "", deployedContractAddress, deployedContractAbi, @@ -92,8 +88,6 @@ const ViewSection = () => { const { writeContractAsync } = useWriteContract(); const handleRequestDeposit = async () => { - // const message = `Bought ${assets} currency tokens.`; - // setLog([...log, message]); if (!address || !assets) { notification.error("Missing required fields"); return; @@ -135,14 +129,10 @@ const ViewSection = () => { } } - // setLog(prevLog => [...prevLog, `Bought ${assets} currency tokens.`]); - setAssets(""); }; const handleRequestRedeem = () => { - // const message = `Requested to redeem ${sharesToRequest} component tokens.`; - // setLog([...log, message]); if (!address || !sharesToRequest) { notification.error("Missing required fields"); return; @@ -166,14 +156,10 @@ const ViewSection = () => { } } - // setLog(prevLog => [...prevLog, `Requested to redeem ${sharesToRequest} sharesToRequest.`]); - setSharesToRequest(""); }; const handleRedeem = () => { - // const message = `Redeemed of ${sharesToRedeem} shares.`; - // setLog([...log, message]); if (!address || !sharesToRedeem) { notification.error("Missing required fields"); return; @@ -203,8 +189,6 @@ const ViewSection = () => { } } - // setLog(prevLog => [...prevLog, `Bought ${assets} currency tokens.`]); - setSharesToRedeem(""); }; @@ -262,9 +246,17 @@ const ViewSection = () => { } p-4 rounded-lg grid gap-3`} >

Deposit Pools

- {pools.map((pool, index) => ( - - ))} + {!depositPoolsFetched ? ( + <> + + + ) : ( + <> + {pools.map((pool, index) => ( + + ))} + + )}
{ ) : (
- {redeemRequests?.map((request, index) => ( - - shares: {formatNumber(request?.shareAmount)} - assets: {formatNumber(request?.assetAmount)} USDC - - } - onClickHandler={() => setRequestAmountToRedeem(request)} - /> - ))} + {redeemRequestsFetched ? ( + <> + {redeemRequests?.map((request, index) => ( + + shares: {formatNumber(request?.shareAmount)} - assets: {formatNumber(request?.assetAmount)}{" "} + USDC + + } + onClickHandler={() => setRequestAmountToRedeem(request)} + /> + ))} + + ) : ( + <> + + + )}
)}
@@ -334,10 +335,6 @@ const ViewSection = () => {