diff --git a/src/abis/umbrellaBatchHelper.ts b/src/abis/umbrellaBatchHelper.ts index f642aa8..8ab1cd8 100644 --- a/src/abis/umbrellaBatchHelper.ts +++ b/src/abis/umbrellaBatchHelper.ts @@ -1,33 +1,26 @@ export const UMBRELLA_BATCH_HELPER_ABI = [ { inputs: [ - { internalType: "address", name: "rewardsController", type: "address" }, - { internalType: "address", name: "owner", type: "address" }, + { internalType: "address", name: "rewardsController_", type: "address" }, + { internalType: "address", name: "owner_", type: "address" }, ], stateMutability: "nonpayable", type: "constructor", }, - { - inputs: [{ internalType: "address", name: "target", type: "address" }], - name: "AddressEmptyCode", - type: "error", - }, + { inputs: [{ internalType: "address", name: "target", type: "address" }], name: "AddressEmptyCode", type: "error" }, + { inputs: [], name: "EnforcedPause", type: "error" }, { inputs: [], name: "EthTransferFailed", type: "error" }, + { inputs: [], name: "ExpectedPause", type: "error" }, { inputs: [], name: "FailedCall", type: "error" }, { inputs: [], name: "InvalidEdgeToken", type: "error" }, { inputs: [], name: "NotInitializedStake", type: "error" }, { inputs: [], name: "OnlyRescueGuardian", type: "error" }, - { - inputs: [{ internalType: "address", name: "owner", type: "address" }], - name: "OwnableInvalidOwner", - type: "error", - }, + { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "OwnableInvalidOwner", type: "error" }, { inputs: [{ internalType: "address", name: "account", type: "address" }], name: "OwnableUnauthorizedAccount", type: "error", }, - { inputs: [], name: "PathFromOnlyStakeTokenCouldBeInitialized", type: "error" }, { inputs: [{ internalType: "address", name: "token", type: "address" }], name: "SafeERC20FailedOperation", @@ -37,7 +30,7 @@ export const UMBRELLA_BATCH_HELPER_ABI = [ { inputs: [], name: "ZeroAmount", type: "error" }, { anonymous: false, - inputs: [{ indexed: false, internalType: "address", name: "stakeToken", type: "address" }], + inputs: [{ indexed: true, internalType: "address", name: "stakeToken", type: "address" }], name: "AssetPathInitialized", type: "event", }, @@ -71,6 +64,18 @@ export const UMBRELLA_BATCH_HELPER_ABI = [ name: "OwnershipTransferred", type: "event", }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Paused", + type: "event", + }, + { + anonymous: false, + inputs: [{ indexed: false, internalType: "address", name: "account", type: "address" }], + name: "Unpaused", + type: "event", + }, { inputs: [], name: "REWARDS_CONTROLLER", @@ -187,6 +192,14 @@ export const UMBRELLA_BATCH_HELPER_ABI = [ stateMutability: "view", type: "function", }, + { inputs: [], name: "pause", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [], + name: "paused", + outputs: [{ internalType: "bool", name: "", type: "bool" }], + stateMutability: "view", + type: "function", + }, { inputs: [ { @@ -226,13 +239,7 @@ export const UMBRELLA_BATCH_HELPER_ABI = [ stateMutability: "nonpayable", type: "function", }, - { - inputs: [], - name: "renounceOwnership", - outputs: [], - stateMutability: "nonpayable", - type: "function", - }, + { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [{ internalType: "address", name: "newOwner", type: "address" }], name: "transferOwnership", @@ -240,6 +247,7 @@ export const UMBRELLA_BATCH_HELPER_ABI = [ stateMutability: "nonpayable", type: "function", }, + { inputs: [], name: "unpause", outputs: [], stateMutability: "nonpayable", type: "function" }, { inputs: [], name: "whoCanRescue", diff --git a/src/abis/umbrellaDataAggregationHelper.ts b/src/abis/umbrellaDataAggregationHelper.ts index 90b4419..5928841 100644 --- a/src/abis/umbrellaDataAggregationHelper.ts +++ b/src/abis/umbrellaDataAggregationHelper.ts @@ -1,12 +1,88 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ + { + inputs: [ + { internalType: "address", name: "rewardsController_", type: "address" }, + { internalType: "address", name: "owner_", type: "address" }, + ], + stateMutability: "nonpayable", + type: "constructor", + }, + { inputs: [], name: "EthTransferFailed", type: "error" }, + { inputs: [], name: "OnlyRescueGuardian", type: "error" }, + { inputs: [{ internalType: "address", name: "owner", type: "address" }], name: "OwnableInvalidOwner", type: "error" }, + { + inputs: [{ internalType: "address", name: "account", type: "address" }], + name: "OwnableUnauthorizedAccount", + type: "error", + }, + { + inputs: [{ internalType: "address", name: "token", type: "address" }], + name: "SafeERC20FailedOperation", + type: "error", + }, + { inputs: [], name: "ZeroAddress", type: "error" }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "caller", type: "address" }, + { indexed: true, internalType: "address", name: "token", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "ERC20Rescued", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "caller", type: "address" }, + { indexed: true, internalType: "address", name: "to", type: "address" }, + { indexed: false, internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "NativeTokensRescued", + type: "event", + }, + { + anonymous: false, + inputs: [ + { indexed: true, internalType: "address", name: "previousOwner", type: "address" }, + { indexed: true, internalType: "address", name: "newOwner", type: "address" }, + ], + name: "OwnershipTransferred", + type: "event", + }, + { + inputs: [], + name: "REWARDS_CONTROLLER", + outputs: [{ internalType: "contract IRewardsController", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "emergencyEtherTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [ + { internalType: "address", name: "erc20Token", type: "address" }, + { internalType: "address", name: "to", type: "address" }, + { internalType: "uint256", name: "amount", type: "uint256" }, + ], + name: "emergencyTokenTransfer", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, { inputs: [ { internalType: "contract IUmbrella", name: "umbrella", type: "address" }, - { - internalType: "contract IAaveOracle", - name: "aaveOracle", - type: "address", - }, + { internalType: "contract IAaveOracle", name: "aaveOracle", type: "address" }, { internalType: "address", name: "user", type: "address" }, ], name: "getAllAggregatedData", @@ -26,6 +102,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ type: "tuple", }, { internalType: "uint256", name: "totalAssets", type: "uint256" }, + { internalType: "uint256", name: "maxTotalAssets", type: "uint256" }, { internalType: "uint256", name: "targetLiquidity", type: "uint256" }, { internalType: "address", name: "reserve", type: "address" }, { internalType: "bool", name: "isStakeConfigured", type: "bool" }, @@ -43,16 +120,8 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ name: "rewardTokenData", type: "tuple", }, - { - internalType: "uint256", - name: "maxEmissionPerSecond", - type: "uint256", - }, - { - internalType: "uint256", - name: "distributionEnd", - type: "uint256", - }, + { internalType: "uint256", name: "maxEmissionPerSecond", type: "uint256" }, + { internalType: "uint256", name: "distributionEnd", type: "uint256" }, ], internalType: "struct DataAggregationHelper.RewardTokenData[]", name: "rewardsTokenData", @@ -68,11 +137,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { internalType: "address", name: "stakeToken", type: "address" }, { components: [ - { - internalType: "enum DataAggregationHelper.TokenType", - name: "typeOfToken", - type: "uint8", - }, + { internalType: "enum DataAggregationHelper.TokenType", name: "typeOfToken", type: "uint8" }, { components: [ { internalType: "address", name: "token", type: "address" }, @@ -98,19 +163,11 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { components: [ { internalType: "address", name: "stakeToken", type: "address" }, - { - internalType: "uint256", - name: "stakeUserBalance", - type: "uint256", - }, + { internalType: "uint256", name: "stakeUserBalance", type: "uint256" }, { components: [ { internalType: "address", name: "reward", type: "address" }, - { - internalType: "uint256", - name: "currentReward", - type: "uint256", - }, + { internalType: "uint256", name: "currentReward", type: "uint256" }, ], internalType: "struct DataAggregationHelper.RewardTokenUserData[]", name: "rewardsTokenUserData", @@ -126,11 +183,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { internalType: "address", name: "stakeToken", type: "address" }, { components: [ - { - internalType: "enum DataAggregationHelper.TokenType", - name: "typeOfToken", - type: "uint8", - }, + { internalType: "enum DataAggregationHelper.TokenType", name: "typeOfToken", type: "uint8" }, { internalType: "address", name: "token", type: "address" }, { internalType: "uint256", name: "userBalance", type: "uint256" }, ], @@ -150,11 +203,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { inputs: [ { internalType: "contract IUmbrella", name: "umbrella", type: "address" }, - { - internalType: "contract IAaveOracle", - name: "aaveOracle", - type: "address", - }, + { internalType: "contract IAaveOracle", name: "aaveOracle", type: "address" }, ], name: "getTokensAggregatedData", outputs: [ @@ -173,6 +222,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ type: "tuple", }, { internalType: "uint256", name: "totalAssets", type: "uint256" }, + { internalType: "uint256", name: "maxTotalAssets", type: "uint256" }, { internalType: "uint256", name: "targetLiquidity", type: "uint256" }, { internalType: "address", name: "reserve", type: "address" }, { internalType: "bool", name: "isStakeConfigured", type: "bool" }, @@ -190,16 +240,8 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ name: "rewardTokenData", type: "tuple", }, - { - internalType: "uint256", - name: "maxEmissionPerSecond", - type: "uint256", - }, - { - internalType: "uint256", - name: "distributionEnd", - type: "uint256", - }, + { internalType: "uint256", name: "maxEmissionPerSecond", type: "uint256" }, + { internalType: "uint256", name: "distributionEnd", type: "uint256" }, ], internalType: "struct DataAggregationHelper.RewardTokenData[]", name: "rewardsTokenData", @@ -217,11 +259,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { inputs: [ { internalType: "contract IUmbrella", name: "umbrella", type: "address" }, - { - internalType: "contract IAaveOracle", - name: "aaveOracle", - type: "address", - }, + { internalType: "contract IAaveOracle", name: "aaveOracle", type: "address" }, ], name: "getTokensRouteData", outputs: [ @@ -230,11 +268,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { internalType: "address", name: "stakeToken", type: "address" }, { components: [ - { - internalType: "enum DataAggregationHelper.TokenType", - name: "typeOfToken", - type: "uint8", - }, + { internalType: "enum DataAggregationHelper.TokenType", name: "typeOfToken", type: "uint8" }, { components: [ { internalType: "address", name: "token", type: "address" }, @@ -264,11 +298,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { inputs: [ { internalType: "contract IUmbrella", name: "umbrella", type: "address" }, - { - internalType: "contract IAaveOracle", - name: "aaveOracle", - type: "address", - }, + { internalType: "contract IAaveOracle", name: "aaveOracle", type: "address" }, ], name: "getUmbrellaData", outputs: [ @@ -289,13 +319,10 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ type: "tuple", }, { internalType: "uint256", name: "totalAssets", type: "uint256" }, + { internalType: "uint256", name: "maxTotalAssets", type: "uint256" }, { internalType: "uint256", name: "totalSupply", type: "uint256" }, { internalType: "uint256", name: "cooldown", type: "uint256" }, - { - internalType: "uint256", - name: "unstakeWindow", - type: "uint256", - }, + { internalType: "uint256", name: "unstakeWindow", type: "uint256" }, ], internalType: "struct DataAggregationHelper.StakeTokenConfig", name: "stakeTokenConfig", @@ -303,51 +330,23 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ }, { components: [ - { - internalType: "uint256", - name: "targetLiquidity", - type: "uint256", - }, + { internalType: "uint256", name: "targetLiquidity", type: "uint256" }, { components: [ { components: [ - { - internalType: "address", - name: "token", - type: "address", - }, - { - internalType: "uint256", - name: "price", - type: "uint256", - }, + { internalType: "address", name: "token", type: "address" }, + { internalType: "uint256", name: "price", type: "uint256" }, { internalType: "string", name: "name", type: "string" }, - { - internalType: "string", - name: "symbol", - type: "string", - }, - { - internalType: "uint8", - name: "decimals", - type: "uint8", - }, + { internalType: "string", name: "symbol", type: "string" }, + { internalType: "uint8", name: "decimals", type: "uint8" }, ], internalType: "struct DataAggregationHelper.TokenData", name: "reward", type: "tuple", }, - { - internalType: "uint256", - name: "maxEmissionPerSecond", - type: "uint256", - }, - { - internalType: "uint256", - name: "distributionEnd", - type: "uint256", - }, + { internalType: "uint256", name: "maxEmissionPerSecond", type: "uint256" }, + { internalType: "uint256", name: "distributionEnd", type: "uint256" }, ], internalType: "struct DataAggregationHelper.RewardConfig[]", name: "rewardConfigs", @@ -361,16 +360,8 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { components: [ { internalType: "address", name: "reserve", type: "address" }, - { - internalType: "uint256", - name: "deficitOffset", - type: "uint256", - }, - { - internalType: "uint256", - name: "pendingDeficit", - type: "uint256", - }, + { internalType: "uint256", name: "deficitOffset", type: "uint256" }, + { internalType: "uint256", name: "pendingDeficit", type: "uint256" }, ], internalType: "struct DataAggregationHelper.UmbrellaConfig", name: "umbrellaConfig", @@ -395,19 +386,11 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { components: [ { internalType: "address", name: "stakeToken", type: "address" }, - { - internalType: "uint256", - name: "stakeUserBalance", - type: "uint256", - }, + { internalType: "uint256", name: "stakeUserBalance", type: "uint256" }, { components: [ { internalType: "address", name: "reward", type: "address" }, - { - internalType: "uint256", - name: "currentReward", - type: "uint256", - }, + { internalType: "uint256", name: "currentReward", type: "uint256" }, ], internalType: "struct DataAggregationHelper.RewardTokenUserData[]", name: "rewardsTokenUserData", @@ -434,11 +417,7 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ { internalType: "address", name: "stakeToken", type: "address" }, { components: [ - { - internalType: "enum DataAggregationHelper.TokenType", - name: "typeOfToken", - type: "uint8", - }, + { internalType: "enum DataAggregationHelper.TokenType", name: "typeOfToken", type: "uint8" }, { internalType: "address", name: "token", type: "address" }, { internalType: "uint256", name: "userBalance", type: "uint256" }, ], @@ -455,4 +434,33 @@ export const UMBRELLA_DATA_AGGREGATION_HELPER_ABI = [ stateMutability: "view", type: "function", }, + { + inputs: [{ internalType: "address", name: "", type: "address" }], + name: "maxRescue", + outputs: [{ internalType: "uint256", name: "", type: "uint256" }], + stateMutability: "pure", + type: "function", + }, + { + inputs: [], + name: "owner", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, + { inputs: [], name: "renounceOwnership", outputs: [], stateMutability: "nonpayable", type: "function" }, + { + inputs: [{ internalType: "address", name: "newOwner", type: "address" }], + name: "transferOwnership", + outputs: [], + stateMutability: "nonpayable", + type: "function", + }, + { + inputs: [], + name: "whoCanRescue", + outputs: [{ internalType: "address", name: "", type: "address" }], + stateMutability: "view", + type: "function", + }, ] as const; diff --git a/src/app/components/StakedSummary/StakedSummary.tsx b/src/app/components/StakedSummary/StakedSummary.tsx index b546dfe..93d4be0 100644 --- a/src/app/components/StakedSummary/StakedSummary.tsx +++ b/src/app/components/StakedSummary/StakedSummary.tsx @@ -42,6 +42,7 @@ export const StakedSummary = memo(({ stkTokens }: StakedSummaryProps) => { decimals, latestAnswerFormatted, targetLiquidity, + maxTotalAssets, underlying, isUnderlyingStataToken, apyData, @@ -49,6 +50,7 @@ export const StakedSummary = memo(({ stkTokens }: StakedSummaryProps) => { const stakedUSD = Number(formatUnits(totalAssets, decimals)) * latestAnswerFormatted; const targetLiquidityUSD = Number(formatUnits(targetLiquidity, decimals)) * latestAnswerFormatted; + const maxTotalAssetsUSD = Number(formatUnits(maxTotalAssets, decimals)) * latestAnswerFormatted; return (