From 74910606ecd99af8b76180d833aa3a1ea752a457 Mon Sep 17 00:00:00 2001 From: Stas Leshchina <66851165+Sorizen@users.noreply.github.com> Date: Fri, 16 Aug 2024 15:34:13 +0300 Subject: [PATCH] feature/dashboard page (#59) * feature dashboard page * wallet balance fix * Update yarn.lock * fixes after review --- src/abi/MOR1967.json | 855 +++++++++++++ src/common/InfoDashboard/index.vue | 128 +- src/common/WalletBalances.vue | 39 +- .../modals/compositions/ChangeLockModal.vue | 6 +- src/composables/use-contract.ts | 3 +- src/composables/use-form-validation.ts | 5 +- src/composables/use-pool.ts | 94 +- src/const/time.const.ts | 2 + src/enums/errors.enum.ts | 7 + src/enums/index.ts | 1 + src/enums/route-names.enum.ts | 2 + src/errors/custom.errors.ts | 36 + src/errors/index.ts | 2 + src/forms/DepositForm.vue | 65 +- src/helpers/error-handler.ts | 15 + src/localization/resources/en.json | 27 +- .../components/ZeroPoolDescription.vue | 41 +- src/pages/HomePage/index.vue | 8 +- src/pages/HomePage/views/PrivatePoolView.vue | 2 +- src/pages/HomePage/views/PublicPoolView.vue | 136 ++- src/router/index.ts | 15 + src/store/modules/web3-providers.module.ts | 171 ++- src/types/contracts/MOR1967.ts | 1060 +++++++++++++++++ .../contracts/factories/MOR1967__factory.ts | 876 ++++++++++++++ src/types/contracts/factories/index.ts | 1 + src/types/contracts/index.ts | 2 + src/types/index.ts | 1 + src/types/info-dashboard.types.ts | 9 + src/types/mor1967-proxy.types.ts | 27 + 29 files changed, 3427 insertions(+), 209 deletions(-) create mode 100644 src/abi/MOR1967.json create mode 100644 src/enums/errors.enum.ts create mode 100644 src/errors/custom.errors.ts create mode 100644 src/types/contracts/MOR1967.ts create mode 100644 src/types/contracts/factories/MOR1967__factory.ts create mode 100644 src/types/mor1967-proxy.types.ts diff --git a/src/abi/MOR1967.json b/src/abi/MOR1967.json new file mode 100644 index 0000000..a63a0f6 --- /dev/null +++ b/src/abi/MOR1967.json @@ -0,0 +1,855 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes", + "name": "uniqueId", + "type": "bytes" + } + ], + "name": "OverplusBridged", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "payoutStart", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "decreaseInterval", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "claimLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriodAfterStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "initialReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDecrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimalStake", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPublic", + "type": "bool" + } + ], + "indexed": false, + "internalType": "struct IDistribution.Pool", + "name": "pool", + "type": "tuple" + } + ], + "name": "PoolCreated", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "payoutStart", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "decreaseInterval", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "claimLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriodAfterStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "initialReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDecrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimalStake", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPublic", + "type": "bool" + } + ], + "indexed": false, + "internalType": "struct IDistribution.Pool", + "name": "pool", + "type": "tuple" + } + ], + "name": "PoolEdited", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "receiver", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "UserClaimed", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "UserStaked", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "poolId", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "user", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "amount", + "type": "uint256" + } + ], + "name": "UserWithdrawn", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "depositToken_", + "type": "address" + }, + { + "internalType": "address", + "name": "l1Sender_", + "type": "address" + }, + { + "internalType": "address", + "name": "feeConfig_", + "type": "address" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "payoutStart", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "decreaseInterval", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "claimLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriodAfterStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "initialReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDecrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimalStake", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPublic", + "type": "bool" + } + ], + "internalType": "struct IDistribution.Pool[]", + "name": "poolsInfo_", + "type": "tuple[]" + } + ], + "name": "Distribution_init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "gasLimit_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxFeePerGas_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "maxSubmissionCost_", + "type": "uint256" + } + ], + "name": "bridgeOverplus", + "outputs": [ + { + "internalType": "bytes", + "name": "", + "type": "bytes" + } + ], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "receiver_", + "type": "address" + } + ], + "name": "claim", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "uint128", + "name": "payoutStart", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "decreaseInterval", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "claimLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriodAfterStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "initialReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDecrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimalStake", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPublic", + "type": "bool" + } + ], + "internalType": "struct IDistribution.Pool", + "name": "pool_", + "type": "tuple" + } + ], + "name": "createPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "depositToken", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "components": [ + { + "internalType": "uint128", + "name": "payoutStart", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "decreaseInterval", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "claimLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriodAfterStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "initialReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDecrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimalStake", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPublic", + "type": "bool" + } + ], + "internalType": "struct IDistribution.Pool", + "name": "pool_", + "type": "tuple" + } + ], + "name": "editPool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "feeConfig", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "internalType": "address", + "name": "user_", + "type": "address" + } + ], + "name": "getCurrentUserReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "internalType": "uint128", + "name": "startTime_", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "endTime_", + "type": "uint128" + } + ], + "name": "getPeriodReward", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "l1Sender", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "internalType": "address[]", + "name": "users_", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "amounts_", + "type": "uint256[]" + } + ], + "name": "manageUsersInPrivatePool", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "overplus", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "pools", + "outputs": [ + { + "internalType": "uint128", + "name": "payoutStart", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "decreaseInterval", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "claimLockPeriod", + "type": "uint128" + }, + { + "internalType": "uint128", + "name": "withdrawLockPeriodAfterStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "initialReward", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rewardDecrease", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "minimalStake", + "type": "uint256" + }, + { + "internalType": "bool", + "name": "isPublic", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "poolsData", + "outputs": [ + { + "internalType": "uint128", + "name": "lastUpdate", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "rate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "totalDeposited", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + } + ], + "name": "stake", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "totalDepositedInPublicPools", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "usersData", + "outputs": [ + { + "internalType": "uint128", + "name": "lastStake", + "type": "uint128" + }, + { + "internalType": "uint256", + "name": "deposited", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "rate", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "pendingRewards", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "poolId_", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount_", + "type": "uint256" + } + ], + "name": "withdraw", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/common/InfoDashboard/index.vue b/src/common/InfoDashboard/index.vue index 3bd5652..63bcd59 100644 --- a/src/common/InfoDashboard/index.vue +++ b/src/common/InfoDashboard/index.vue @@ -2,55 +2,57 @@
- {{ chartSubtitle }} -
-+ {{ chartSubtitle }} +
+