From 0df4a6ee3205818f5ca377d4160e79edc9180bbb Mon Sep 17 00:00:00 2001 From: damnnou Date: Sun, 14 Sep 2025 20:31:08 +0300 Subject: [PATCH 1/3] config: init integral-1.2.2 --- .env | 4 ++-- codegen.ts | 4 ++-- package.json | 2 +- src/constants/addresses.ts | 15 +++++---------- yarn.lock | 8 ++++---- 5 files changed, 14 insertions(+), 19 deletions(-) diff --git a/.env b/.env index 1f7cc9f..d141871 100644 --- a/.env +++ b/.env @@ -1,5 +1,5 @@ -VITE_INFO_GRAPH=https://api.studio.thegraph.com/query/50593/integral-v12/v1.0.0 +VITE_INFO_GRAPH=https://api.studio.thegraph.com/query/82608/ve-analytics/v0.0.1 VITE_BLOCKS_GRAPH=https://api.studio.thegraph.com/query/50593/base-testnet-blocks/version/latest -VITE_FARMING_GRAPH=https://gateway.thegraph.com/api/4d7b59e4fd14365ae609945af85f3938/subgraphs/id/9vgT17hNEzkU5rboq6mGfuKZcyyFzaVwSm2XvcVipXih +VITE_FARMING_GRAPH=https://api.studio.thegraph.com/query/82608/ve-farms/v0.0.1 VITE_INFURA_RPC=https://base-sepolia-rpc.publicnode.com VITE_WALLETCONNECT_PROJECT_ID=79c313a96c99edbc26d06cd97bff1126 \ No newline at end of file diff --git a/codegen.ts b/codegen.ts index 4e2d7b8..84cc43c 100644 --- a/codegen.ts +++ b/codegen.ts @@ -3,9 +3,9 @@ import type { CodegenConfig } from "@graphql-codegen/cli"; const config: CodegenConfig = { overwrite: true, schema: [ - "https://api.studio.thegraph.com/query/50593/integral-v12/version/latest", + "https://api.studio.thegraph.com/query/82608/ve-analytics/v0.0.1", "https://api.studio.thegraph.com/query/50593/goerli-blocks/version/latest", - "https://api.studio.thegraph.com/query/50593/integral-v12-farming/version/latest", + "https://api.studio.thegraph.com/query/82608/ve-farms/v0.0.1", ], documents: "src/graphql/queries/!(*.d).{ts,tsx}", generates: { diff --git a/package.json b/package.json index 9d06a3e..f69b87b 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,7 @@ "dependencies": { "@apollo/client": "^3.9.6", "@cryptoalgebra/alm-sdk": "^1.0.9", - "@cryptoalgebra/custom-pools-and-sliding-fee-sdk": "npm:@cryptoalgebra/integral-sdk@1.0.0", + "@cryptoalgebra/custom-pools-and-sliding-fee-sdk": "npm:@cryptoalgebra/integral-sdk@1.0.1", "@radix-ui/react-checkbox": "^1.0.4", "@radix-ui/react-dialog": "^1.0.5", "@radix-ui/react-select": "^2.0.0", diff --git a/src/constants/addresses.ts b/src/constants/addresses.ts index ab0ef33..a47b9d5 100644 --- a/src/constants/addresses.ts +++ b/src/constants/addresses.ts @@ -1,16 +1,11 @@ import { Address } from "viem"; -export const ALGEBRA_FARMING_CENTER: Address = - "0x07B8114E9f6fC41963c060A9fD878977c4093B84"; +export const ALGEBRA_FARMING_CENTER: Address = "0xd5FBdE38734a2E8f28B12B12A3A617979bDe953E"; -export const ALGEBRA_ETERNAL_FARMING: Address = - "0xf7cA7d0F8Bbef9BBfEB66Cf2c9C84Eeb2dA60b22"; +export const ALGEBRA_ETERNAL_FARMING: Address = "0x3f8350ae86E7ABbE67B1f5Fd1CA6E85c309d4e21"; -export const ALGEBRA_FACTORY: Address = - "0xcD58521ecaC7724d1752F941C56490c27bAe9ab0"; +export const ALGEBRA_FACTORY: Address = "0xE4e7d1b09faE61B12F07EF86ED7eC590F1B6c6CF"; -export const PLUGIN_FACTORY: Address = - "0xdFEB2C88C32311792665b8626093193b959138D3"; +export const PLUGIN_FACTORY: Address = "0x9e6Fb37e3d320cc703e884b9A3A17fEc5fb3cDBD"; -export const ALGEBRA_STUB_PLUGIN: Address = - "0x85dD131EeC48416A3aFFB098140d2bf94c1934ee"; +export const ALGEBRA_STUB_PLUGIN: Address = "0x480b4B4f8F7D3f2ce48e592DBdEA2eFc8e144D68"; diff --git a/yarn.lock b/yarn.lock index 71dac9c..a10a53b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1473,10 +1473,10 @@ tsdx "^0.14.1" typechain "^8.0.0" -"@cryptoalgebra/custom-pools-and-sliding-fee-sdk@npm:@cryptoalgebra/integral-sdk@1.0.0": - version "1.0.0" - resolved "https://registry.yarnpkg.com/@cryptoalgebra/integral-sdk/-/integral-sdk-1.0.0.tgz#250047480c92df6f76e71e8f5acdafb811600742" - integrity sha512-HzRa0kHt8SPVZmVAgQUpQQxN13ZnQeG/4ZQ6FKmACucD6YTaYqRps6Ah9jqOZXDqb2MhJiThASMgf8mGUNPNdQ== +"@cryptoalgebra/custom-pools-and-sliding-fee-sdk@npm:@cryptoalgebra/integral-sdk@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@cryptoalgebra/integral-sdk/-/integral-sdk-1.0.1.tgz#d0e6bf83fd02dd0b2f72c0fe081f14141c2249c7" + integrity sha512-r4r5cBv7k8y+IkwarJFuC1G9883nIiz4H1ddVCJ7sLCl9xzLVj4jp2xuzWuwnh9nMN3W4s4tfbKL3QrAml83xA== dependencies: "@ethersproject/abi" "^5.7.0" "@ethersproject/address" "^5.7.0" From 52aed1a491aadd2177c2acea7199e5363c3dacdb Mon Sep 17 00:00:00 2001 From: damnnou Date: Tue, 16 Sep 2025 13:26:18 +0300 Subject: [PATCH 2/3] feat: add ve33 --- src/abis/index.ts | 17 +- src/abis/ve33/index.ts | 2 + src/abis/ve33/voter.ts | 608 + src/abis/ve33/votingReward.ts | 468 + .../common/EnterAmountCard/index.tsx | 74 + src/components/common/Header/index.tsx | 65 +- src/components/farms/CreateFarm/index.tsx | 2 +- src/components/gauge/GaugeDetails/index.tsx | 39 + src/components/gauge/GaugeRewards/index.tsx | 139 + src/components/gauges/CreateGauge/index.tsx | 115 + src/components/gauges/GaugesList/index.tsx | 89 + src/components/gauges/NewGaugeModal/index.tsx | 0 .../modals/TokenSelectorModal/index.tsx | 2 +- src/components/pool/PoolDetails/index.tsx | 11 +- src/constants/addresses.ts | 3 + src/generated.ts | 13483 +++++++++++----- src/graphql/generated/graphql.tsx | 182 +- src/graphql/queries/global.ts | 16 + src/hooks/common/useApprove.ts | 79 +- src/hooks/common/useNativePriceUSD.ts | 13 + src/hooks/gauges/useAllGauges.ts | 80 + src/hooks/gauges/useVotingPool.ts | 119 + src/hooks/gauges/useWhitelistForGauge.ts | 38 + src/main.tsx | 80 +- src/pages/Gauge/index.tsx | 43 + src/pages/Gauges/index.tsx | 45 + src/pages/NewGauge/index.tsx | 19 + src/types/gauge.ts | 25 + src/utils/common/formatAmount.ts | 61 + src/utils/common/isDefined.ts | 3 + wagmi.config.ts | 40 +- 31 files changed, 11493 insertions(+), 4467 deletions(-) create mode 100644 src/abis/ve33/index.ts create mode 100644 src/abis/ve33/voter.ts create mode 100644 src/abis/ve33/votingReward.ts create mode 100644 src/components/common/EnterAmountCard/index.tsx create mode 100644 src/components/gauge/GaugeDetails/index.tsx create mode 100644 src/components/gauge/GaugeRewards/index.tsx create mode 100644 src/components/gauges/CreateGauge/index.tsx create mode 100644 src/components/gauges/GaugesList/index.tsx create mode 100644 src/components/gauges/NewGaugeModal/index.tsx create mode 100644 src/graphql/queries/global.ts create mode 100644 src/hooks/common/useNativePriceUSD.ts create mode 100644 src/hooks/gauges/useAllGauges.ts create mode 100644 src/hooks/gauges/useVotingPool.ts create mode 100644 src/hooks/gauges/useWhitelistForGauge.ts create mode 100644 src/pages/Gauge/index.tsx create mode 100644 src/pages/Gauges/index.tsx create mode 100644 src/pages/NewGauge/index.tsx create mode 100644 src/types/gauge.ts create mode 100644 src/utils/common/formatAmount.ts create mode 100644 src/utils/common/isDefined.ts diff --git a/src/abis/index.ts b/src/abis/index.ts index 65f0dad..23b08ac 100644 --- a/src/abis/index.ts +++ b/src/abis/index.ts @@ -1,8 +1,9 @@ -export * from './eternalFarming'; -export * from './farmingCenter'; -export * from './algebraPool'; -export * from './algebraFactory'; -export * from './pluginFactory'; -export * from './algebraBasePlugin'; -export * from './algebraVirtualPool' -export * from './algebraStubPlugin' +export * from "./eternalFarming"; +export * from "./farmingCenter"; +export * from "./algebraPool"; +export * from "./algebraFactory"; +export * from "./pluginFactory"; +export * from "./algebraBasePlugin"; +export * from "./algebraVirtualPool"; +export * from "./algebraStubPlugin"; +export * from "./ve33"; diff --git a/src/abis/ve33/index.ts b/src/abis/ve33/index.ts new file mode 100644 index 0000000..37131e9 --- /dev/null +++ b/src/abis/ve33/index.ts @@ -0,0 +1,2 @@ +export * from "./voter"; +export * from "./votingReward"; diff --git a/src/abis/ve33/voter.ts b/src/abis/ve33/voter.ts new file mode 100644 index 0000000..f4da893 --- /dev/null +++ b/src/abis/ve33/voter.ts @@ -0,0 +1,608 @@ +export const voterABI = [ + { + type: "function", + name: "AUTHORIZED_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "DEFAULT_ADMIN_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "DURATION", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADE_INTERFACE_VERSION", + inputs: [], + outputs: [{ name: "", type: "string", internalType: "string" }], + stateMutability: "view", + }, + { type: "function", name: "acceptOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "algb", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IERC20" }], + stateMutability: "view", + }, + { + type: "function", + name: "algebraGaugeFactory", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract AlgebraGaugeFactory" }], + stateMutability: "view", + }, + { + type: "function", + name: "algebraVaultFactory", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IAlgebraVaultFactory" }], + stateMutability: "view", + }, + { + type: "function", + name: "carryVoteForward", + inputs: [ + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + { name: "_fromPeriod", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "checkPeriodVoted", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + ], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "claimVotingRewardBatch", + inputs: [ + { name: "_votingRewardList", type: "address[]", internalType: "address[]" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "createAlgebraGauge", + inputs: [{ name: "_poolAddress", type: "address", internalType: "address" }], + outputs: [ + { name: "_gauge", type: "address", internalType: "address" }, + { name: "_votingReward", type: "address", internalType: "address" }, + ], + stateMutability: "nonpayable", + }, + { type: "function", name: "createGauge", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "distribute", + inputs: [{ name: "_gauge", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "distribute", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_gauge", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { type: "function", name: "distributeAll", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "distributeRange", + inputs: [ + { name: "_start", type: "uint256", internalType: "uint256" }, + { name: "_amount", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "epoch0Period", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "gaugeToPool", + inputs: [{ name: "_gauge", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "address", internalType: "address" }], + stateMutability: "view", + }, + { + type: "function", + name: "getCurrentPeriod", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "getGauge", + inputs: [{ name: "_pool", type: "address", internalType: "address" }], + outputs: [ + { + name: "", + type: "tuple", + internalType: "struct IVoter.Gauge", + components: [ + { name: "gauge", type: "address", internalType: "address" }, + { name: "isAlgebra", type: "bool", internalType: "bool" }, + { name: "votingReward", type: "address", internalType: "address" }, + { name: "isAlive", type: "bool", internalType: "bool" }, + { name: "vault", type: "address", internalType: "address" }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getGaugeList", + inputs: [], + outputs: [{ name: "", type: "address[]", internalType: "address[]" }], + stateMutability: "view", + }, + { + type: "function", + name: "getPeriodData", + inputs: [{ name: "_period", type: "uint256", internalType: "uint256" }], + outputs: [ + { name: "_globalTotalVotes", type: "uint256", internalType: "uint256" }, + { name: "_gaugeList", type: "address[]", internalType: "address[]" }, + { name: "_gaugeTotalVotesList", type: "uint256[]", internalType: "uint256[]" }, + { name: "_totalEmissions", type: "uint256", internalType: "uint256" }, + { + name: "_gaugeEmissionsList", + type: "tuple[]", + internalType: "struct IVoter.Emissions[]", + components: [ + { name: "amount", type: "uint256", internalType: "uint256" }, + { name: "distributed", type: "bool", internalType: "bool" }, + ], + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getPoolList", + inputs: [], + outputs: [{ name: "", type: "address[]", internalType: "address[]" }], + stateMutability: "view", + }, + { + type: "function", + name: "getRoleAdmin", + inputs: [{ name: "role", type: "bytes32", internalType: "bytes32" }], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "getTokenIdVotes", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + ], + outputs: [ + { name: "_tokenIdVotedList", type: "address[]", internalType: "address[]" }, + { name: "_tokenIdVotes", type: "uint256[]", internalType: "uint256[]" }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "grantRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "hasRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [ + { name: "_veALGB", type: "address", internalType: "address" }, + { name: "_initialOwner", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "isAlive", + inputs: [{ name: "_gauge", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "isGauge", + inputs: [{ name: "_gauge", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "isWhitelisted", + inputs: [{ name: "_token", type: "address", internalType: "address" }], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "killGauge", + inputs: [{ name: "_gauge", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "minter", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IMinter" }], + stateMutability: "view", + }, + { + type: "function", + name: "notifyRewardAmount", + inputs: [{ name: "_amount", type: "uint256", internalType: "uint256" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "address" }], + stateMutability: "view", + }, + { + type: "function", + name: "pendingOwner", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "address" }], + stateMutability: "view", + }, + { + type: "function", + name: "period", + inputs: [{ name: "_period", type: "uint256", internalType: "uint256" }], + outputs: [ + { name: "globalTotalVotes", type: "uint256", internalType: "uint256" }, + { name: "totalEmissions", type: "uint256", internalType: "uint256" }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "rebaseReward", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IRebaseReward" }], + stateMutability: "view", + }, + { type: "function", name: "renounceOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "renounceRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "callerConfirmation", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "reviveGauge", + inputs: [{ name: "_gauge", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "revokeRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setAlgebraGaugeFactory", + inputs: [{ name: "_algebraGaugeFactory", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setAlgebraVaultFactory", + inputs: [{ name: "_algebraVaultFactory", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setMinter", + inputs: [{ name: "_minter", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setRebaseReward", + inputs: [{ name: "_rebaseReward", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setTokenStatus", + inputs: [ + { name: "_token", type: "address", internalType: "address" }, + { name: "_status", type: "bool", internalType: "bool" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "setVotingRewardFactory", + inputs: [{ name: "_votingRewardFactory", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { type: "function", name: "start", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "supportsInterface", + inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "transferOwnership", + inputs: [{ name: "newOwner", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { name: "newImplementation", type: "address", internalType: "address" }, + { name: "data", type: "bytes", internalType: "bytes" }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "veALGB", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IVotingEscrow" }], + stateMutability: "view", + }, + { + type: "function", + name: "vote", + inputs: [ + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + { name: "_poolList", type: "address[]", internalType: "address[]" }, + { name: "weightList", type: "uint256[]", internalType: "uint256[]" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "votingRewardFactory", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract VotingRewardFactory" }], + stateMutability: "view", + }, + { + type: "event", + name: "DistributeAlgebraFees", + inputs: [ + { name: "_pool", type: "address", indexed: false, internalType: "address" }, + { name: "_amount0", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_amount1", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "DistributeEmissions", + inputs: [ + { name: "_gauge", type: "address", indexed: false, internalType: "address" }, + { name: "_amount", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "GaugeCreated", + inputs: [ + { name: "_gauge", type: "address", indexed: false, internalType: "address" }, + { name: "_votingReward", type: "address", indexed: false, internalType: "address" }, + { name: "_pool", type: "address", indexed: false, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "GaugeKilled", + inputs: [{ name: "_gauge", type: "address", indexed: false, internalType: "address" }], + anonymous: false, + }, + { + type: "event", + name: "GaugeRevived", + inputs: [{ name: "_gauge", type: "address", indexed: false, internalType: "address" }], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [{ name: "version", type: "uint64", indexed: false, internalType: "uint64" }], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferStarted", + inputs: [ + { name: "previousOwner", type: "address", indexed: true, internalType: "address" }, + { name: "newOwner", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { name: "previousOwner", type: "address", indexed: true, internalType: "address" }, + { name: "newOwner", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleAdminChanged", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "previousAdminRole", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "newAdminRole", type: "bytes32", indexed: true, internalType: "bytes32" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleGranted", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "account", type: "address", indexed: true, internalType: "address" }, + { name: "sender", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleRevoked", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "account", type: "address", indexed: true, internalType: "address" }, + { name: "sender", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "TokenStatus", + inputs: [ + { name: "_token", type: "address", indexed: false, internalType: "address" }, + { name: "_status", type: "bool", indexed: false, internalType: "bool" }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [{ name: "implementation", type: "address", indexed: true, internalType: "address" }], + anonymous: false, + }, + { + type: "event", + name: "Voted", + inputs: [ + { name: "_tokenId", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_votingPower", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { type: "error", name: "AccessControlBadConfirmation", inputs: [] }, + { + type: "error", + name: "AccessControlUnauthorizedAccount", + inputs: [ + { name: "account", type: "address", internalType: "address" }, + { name: "neededRole", type: "bytes32", internalType: "bytes32" }, + ], + }, + { type: "error", name: "AddressEmptyCode", inputs: [{ name: "target", type: "address", internalType: "address" }] }, + { type: "error", name: "AlreadyVotedForPool", inputs: [] }, + { type: "error", name: "AlreadyVotedInPeriod", inputs: [] }, + { + type: "error", + name: "ERC1967InvalidImplementation", + inputs: [{ name: "implementation", type: "address", internalType: "address" }], + }, + { type: "error", name: "ERC1967NonPayable", inputs: [] }, + { type: "error", name: "EmissionsAlreadyDistributedForPeriod", inputs: [] }, + { type: "error", name: "FailedCall", inputs: [] }, + { type: "error", name: "GaugeAlreadyExist", inputs: [] }, + { type: "error", name: "GaugeDead", inputs: [] }, + { type: "error", name: "GaugeDoesNotExist", inputs: [] }, + { type: "error", name: "InvalidInitialization", inputs: [] }, + { type: "error", name: "InvalidParameters", inputs: [] }, + { type: "error", name: "InvalidPeriod", inputs: [] }, + { type: "error", name: "NotApprovedOrOwner", inputs: [] }, + { type: "error", name: "NotInitializing", inputs: [] }, + { type: "error", name: "OwnableInvalidOwner", inputs: [{ name: "owner", type: "address", internalType: "address" }] }, + { type: "error", name: "OwnableUnauthorizedAccount", inputs: [{ name: "account", type: "address", internalType: "address" }] }, + { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] }, + { type: "error", name: "SafeERC20FailedOperation", inputs: [{ name: "token", type: "address", internalType: "address" }] }, + { type: "error", name: "TokenNotWhitelisted", inputs: [] }, + { type: "error", name: "UUPSUnauthorizedCallContext", inputs: [] }, + { type: "error", name: "UUPSUnsupportedProxiableUUID", inputs: [{ name: "slot", type: "bytes32", internalType: "bytes32" }] }, + { type: "error", name: "Unauthorized", inputs: [] }, + { type: "error", name: "ZeroVotes", inputs: [] }, +] as const; diff --git a/src/abis/ve33/votingReward.ts b/src/abis/ve33/votingReward.ts new file mode 100644 index 0000000..0ebf2f0 --- /dev/null +++ b/src/abis/ve33/votingReward.ts @@ -0,0 +1,468 @@ +export const votingRewardABI = [ + { type: "constructor", inputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "DEFAULT_ADMIN_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "DURATION", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "NOTIFY_ROLE", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "PRECISION", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADE_INTERFACE_VERSION", + inputs: [], + outputs: [{ name: "", type: "string", internalType: "string" }], + stateMutability: "view", + }, + { + type: "function", + name: "_deposit", + inputs: [ + { name: "_amount", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "_withdraw", + inputs: [ + { name: "_amount", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { type: "function", name: "acceptOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "earnedForPeriod", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + { name: "_token", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "earnedForToken", + inputs: [ + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + { name: "_token", type: "address", internalType: "address" }, + ], + outputs: [{ name: "reward", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "earnedForTokenId", + inputs: [{ name: "_tokenId", type: "uint256", internalType: "uint256" }], + outputs: [ + { name: "rewardList", type: "uint256[]", internalType: "uint256[]" }, + { name: "tokenList", type: "address[]", internalType: "address[]" }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getCurrentPeriod", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "getRewardForOwner", + inputs: [{ name: "_tokenId", type: "uint256", internalType: "uint256" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getRewardForPeriod", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + { name: "_token", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getRewardForTokenId", + inputs: [{ name: "_tokenId", type: "uint256", internalType: "uint256" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getRewardList", + inputs: [], + outputs: [{ name: "", type: "address[]", internalType: "address[]" }], + stateMutability: "view", + }, + { + type: "function", + name: "getRoleAdmin", + inputs: [{ name: "role", type: "bytes32", internalType: "bytes32" }], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { + type: "function", + name: "grantNotifyRole", + inputs: [{ name: "_account", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "grantRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "hasRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "incentivize", + inputs: [ + { name: "_token", type: "address", internalType: "address" }, + { name: "_amount", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "initialize", + inputs: [ + { name: "_voter", type: "address", internalType: "address" }, + { name: "_veALGB", type: "address", internalType: "address" }, + { name: "_initialOwner", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "notifyRewardAmount", + inputs: [ + { name: "_token", type: "address", internalType: "address" }, + { name: "_amount", type: "uint256", internalType: "uint256" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "owner", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "address" }], + stateMutability: "view", + }, + { + type: "function", + name: "pendingOwner", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "address" }], + stateMutability: "view", + }, + { + type: "function", + name: "periodInit", + inputs: [], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [{ name: "", type: "bytes32", internalType: "bytes32" }], + stateMutability: "view", + }, + { type: "function", name: "renounceOwnership", inputs: [], outputs: [], stateMutability: "nonpayable" }, + { + type: "function", + name: "renounceRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "callerConfirmation", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "revokeRole", + inputs: [ + { name: "role", type: "bytes32", internalType: "bytes32" }, + { name: "account", type: "address", internalType: "address" }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "rewardForPeriod", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_reward", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [{ name: "interfaceId", type: "bytes4", internalType: "bytes4" }], + outputs: [{ name: "", type: "bool", internalType: "bool" }], + stateMutability: "view", + }, + { + type: "function", + name: "tokenIdRewardClaimedInPeriod", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + { name: "_reward", type: "address", internalType: "address" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "tokenIdVotesInPeriod", + inputs: [ + { name: "_period", type: "uint256", internalType: "uint256" }, + { name: "_tokenId", type: "uint256", internalType: "uint256" }, + ], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "totalVotesInPeriod", + inputs: [{ name: "_period", type: "uint256", internalType: "uint256" }], + outputs: [{ name: "", type: "uint256", internalType: "uint256" }], + stateMutability: "view", + }, + { + type: "function", + name: "transferERC20", + inputs: [{ name: "_token", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "transferOwnership", + inputs: [{ name: "newOwner", type: "address", internalType: "address" }], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { name: "newImplementation", type: "address", internalType: "address" }, + { name: "data", type: "bytes", internalType: "bytes" }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "function", + name: "veALGB", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IVotingEscrow" }], + stateMutability: "view", + }, + { + type: "function", + name: "voter", + inputs: [], + outputs: [{ name: "", type: "address", internalType: "contract IVoter" }], + stateMutability: "view", + }, + { + type: "event", + name: "ClaimReward", + inputs: [ + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_tokenId", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_token", type: "address", indexed: false, internalType: "address" }, + { name: "_to", type: "address", indexed: false, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "Deposit", + inputs: [ + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_amount", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_tokenId", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "IncentivizedReward", + inputs: [ + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_from", type: "address", indexed: false, internalType: "address" }, + { name: "_token", type: "address", indexed: false, internalType: "address" }, + { name: "amount", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "Initialized", + inputs: [{ name: "version", type: "uint64", indexed: false, internalType: "uint64" }], + anonymous: false, + }, + { + type: "event", + name: "NotifyReward", + inputs: [ + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_from", type: "address", indexed: false, internalType: "address" }, + { name: "_token", type: "address", indexed: false, internalType: "address" }, + { name: "amount", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferStarted", + inputs: [ + { name: "previousOwner", type: "address", indexed: true, internalType: "address" }, + { name: "newOwner", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "OwnershipTransferred", + inputs: [ + { name: "previousOwner", type: "address", indexed: true, internalType: "address" }, + { name: "newOwner", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleAdminChanged", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "previousAdminRole", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "newAdminRole", type: "bytes32", indexed: true, internalType: "bytes32" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleGranted", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "account", type: "address", indexed: true, internalType: "address" }, + { name: "sender", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleRevoked", + inputs: [ + { name: "role", type: "bytes32", indexed: true, internalType: "bytes32" }, + { name: "account", type: "address", indexed: true, internalType: "address" }, + { name: "sender", type: "address", indexed: true, internalType: "address" }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [{ name: "implementation", type: "address", indexed: true, internalType: "address" }], + anonymous: false, + }, + { + type: "event", + name: "Withdraw", + inputs: [ + { name: "_period", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_amount", type: "uint256", indexed: false, internalType: "uint256" }, + { name: "_tokenId", type: "uint256", indexed: false, internalType: "uint256" }, + ], + anonymous: false, + }, + { type: "error", name: "AccessControlBadConfirmation", inputs: [] }, + { + type: "error", + name: "AccessControlUnauthorizedAccount", + inputs: [ + { name: "account", type: "address", internalType: "address" }, + { name: "neededRole", type: "bytes32", internalType: "bytes32" }, + ], + }, + { type: "error", name: "AddressEmptyCode", inputs: [{ name: "target", type: "address", internalType: "address" }] }, + { + type: "error", + name: "ERC1967InvalidImplementation", + inputs: [{ name: "implementation", type: "address", internalType: "address" }], + }, + { type: "error", name: "ERC1967NonPayable", inputs: [] }, + { type: "error", name: "FailedCall", inputs: [] }, + { type: "error", name: "FuturePeriodNotClaimable", inputs: [] }, + { type: "error", name: "InvalidInitialization", inputs: [] }, + { type: "error", name: "NotApprovedOrOwner", inputs: [] }, + { type: "error", name: "NotInitializing", inputs: [] }, + { type: "error", name: "NotVoter", inputs: [] }, + { type: "error", name: "NotWhitelistedRewardToken", inputs: [] }, + { type: "error", name: "OwnableInvalidOwner", inputs: [{ name: "owner", type: "address", internalType: "address" }] }, + { type: "error", name: "OwnableUnauthorizedAccount", inputs: [{ name: "account", type: "address", internalType: "address" }] }, + { type: "error", name: "ReentrancyGuardReentrantCall", inputs: [] }, + { type: "error", name: "SafeERC20FailedOperation", inputs: [{ name: "token", type: "address", internalType: "address" }] }, + { type: "error", name: "UUPSUnauthorizedCallContext", inputs: [] }, + { type: "error", name: "UUPSUnsupportedProxiableUUID", inputs: [{ name: "slot", type: "bytes32", internalType: "bytes32" }] }, +] as const; diff --git a/src/components/common/EnterAmountCard/index.tsx b/src/components/common/EnterAmountCard/index.tsx new file mode 100644 index 0000000..9432d38 --- /dev/null +++ b/src/components/common/EnterAmountCard/index.tsx @@ -0,0 +1,74 @@ +import CurrencyLogo from "@/components/common/CurrencyLogo"; +import { Input } from "@/components/ui/input"; +import { formatAmount } from "@/utils/common/formatAmount"; +import { Currency } from "@cryptoalgebra/custom-pools-and-sliding-fee-sdk"; +import { useCallback, useMemo } from "react"; +import { Address } from "viem"; +import { useAccount, useBalance } from "wagmi"; + +interface EnterAmountsCardProps { + currency: Currency | undefined; + value: string; + handleChange: (value: string) => void; + valueUsd?: number | null; +} + +const EnterAmountCard = ({ currency, value, handleChange, valueUsd }: EnterAmountsCardProps) => { + const { address: account } = useAccount(); + + const { data: balance, isLoading } = useBalance({ + address: account, + token: currency?.isNative ? undefined : (currency?.wrapped.address as Address), + }); + + const balanceString = useMemo(() => { + if (isLoading) return "Loading..."; + + return formatAmount(balance?.formatted || "0"); + }, [balance, isLoading]); + + const handleInput = useCallback((value: string) => { + if (value === ".") value = "0."; + handleChange(value); + }, []); + + function setMax() { + handleChange(balance?.formatted || "0"); + } + + return ( +
+
+
+ + {currency ? currency.symbol : "Select a token"} +
+ {currency && ( +
+
+ Balance: + {balanceString} +
+ +
+ )} +
+ +
+ handleInput(v)} + className={`text-right border-none text-xl font-bold w-9/12 p-0 ring-0!`} + placeholder={"0.0"} + maxDecimals={currency?.decimals} + /> +
{valueUsd && `$${formatAmount(valueUsd, 2)}`}
+
+
+ ); +}; + +export default EnterAmountCard; diff --git a/src/components/common/Header/index.tsx b/src/components/common/Header/index.tsx index 973997b..8e1ce8a 100644 --- a/src/components/common/Header/index.tsx +++ b/src/components/common/Header/index.tsx @@ -1,11 +1,6 @@ -import { - Select, - SelectContent, - SelectItem, - SelectTrigger, -} from '@/components/ui/select'; -import { Link, NavLink, matchPath, useLocation } from 'react-router-dom'; -import { useAccount, useConnect, useDisconnect } from 'wagmi'; +import { Select, SelectContent, SelectItem, SelectTrigger } from "@/components/ui/select"; +import { Link, NavLink, matchPath, useLocation } from "react-router-dom"; +import { useAccount, useConnect, useDisconnect } from "wagmi"; const Connect = () => { const { connector, isConnected } = useAccount(); @@ -16,39 +11,25 @@ const Connect = () => {
{isConnected ? ( - ) : (