From 70943c523cd2b427a1c3eec60e0cff0ac81e27bf Mon Sep 17 00:00:00 2001 From: Maciek Date: Wed, 5 Apr 2023 14:53:55 +0200 Subject: [PATCH 1/4] chore(deposits): persistence of deposit form state (#3348) --- libs/deposits/src/lib/deposit-form.spec.tsx | 1 + libs/deposits/src/lib/deposit-form.tsx | 26 +++++++----- libs/deposits/src/lib/deposit-manager.tsx | 16 ++++++- .../src/lib/use-persistent-deposit.spec.ts | 21 ++++++++++ .../src/lib/use-persistent-deposit.ts | 42 +++++++++++++++++++ 5 files changed, 94 insertions(+), 12 deletions(-) create mode 100644 libs/deposits/src/lib/use-persistent-deposit.spec.ts create mode 100644 libs/deposits/src/lib/use-persistent-deposit.ts diff --git a/libs/deposits/src/lib/deposit-form.spec.tsx b/libs/deposits/src/lib/deposit-form.spec.tsx index 410d7a384..3ce7565b4 100644 --- a/libs/deposits/src/lib/deposit-form.spec.tsx +++ b/libs/deposits/src/lib/deposit-form.spec.tsx @@ -61,6 +61,7 @@ beforeEach(() => { submitDeposit: jest.fn(), submitFaucet: jest.fn(), onDisconnect: jest.fn(), + handleAmountChange: jest.fn(), approveTxId: null, faucetTxId: null, isFaucetable: true, diff --git a/libs/deposits/src/lib/deposit-form.tsx b/libs/deposits/src/lib/deposit-form.tsx index df9f1701b..e403a0bf5 100644 --- a/libs/deposits/src/lib/deposit-form.tsx +++ b/libs/deposits/src/lib/deposit-form.tsx @@ -25,11 +25,9 @@ import { import { useVegaWallet } from '@vegaprotocol/wallet'; import { useWeb3React } from '@web3-react/core'; import BigNumber from 'bignumber.js'; -import type { ButtonHTMLAttributes, ReactNode } from 'react'; -import { useState } from 'react'; -import { useMemo } from 'react'; -import { useWatch } from 'react-hook-form'; -import { Controller, useForm } from 'react-hook-form'; +import type { ButtonHTMLAttributes, ChangeEvent, ReactNode } from 'react'; +import { useMemo, useState } from 'react'; +import { useWatch, Controller, useForm } from 'react-hook-form'; import { DepositLimits } from './deposit-limits'; import { useAssetDetailsDialogStore } from '@vegaprotocol/assets'; import { @@ -40,6 +38,7 @@ import { import type { DepositBalances } from './use-deposit-balances'; import { FaucetNotification } from './faucet-notification'; import { ApproveNotification } from './approve-notification'; +import { usePersistentDeposit } from './use-persistent-deposit'; interface FormFields { asset: string; @@ -53,6 +52,7 @@ export interface DepositFormProps { selectedAsset?: Asset; balances: DepositBalances | null; onSelectAsset: (assetId: string) => void; + handleAmountChange: (amount: string) => void; onDisconnect: () => void; submitApprove: () => void; approveTxId: number | null; @@ -71,6 +71,7 @@ export const DepositForm = ({ selectedAsset, balances, onSelectAsset, + handleAmountChange, onDisconnect, submitApprove, submitDeposit, @@ -85,6 +86,8 @@ export const DepositForm = ({ const { pubKey, pubKeys: _pubKeys } = useVegaWallet(); const [approveNotificationIntent, setApproveNotificationIntent] = useState(Intent.Warning); + const [persistedDeposit] = usePersistentDeposit(selectedAsset?.id); + const { register, handleSubmit, @@ -95,7 +98,8 @@ export const DepositForm = ({ } = useForm({ defaultValues: { to: pubKey ? pubKey : undefined, - asset: selectedAsset?.id || '', + asset: selectedAsset?.id, + amount: persistedDeposit.amount, }, }); @@ -333,6 +337,9 @@ export const DepositForm = ({ return maxSafe(balances?.balance || new BigNumber(0))(v); }, }, + onChange: (e: ChangeEvent) => { + handleAmountChange(e.target.value || ''); + }, })} /> {errors.amount?.message && ( @@ -343,10 +350,9 @@ export const DepositForm = ({ {selectedAsset && balances && ( { - setValue( - 'amount', - balances.balance.toFixed(selectedAsset.decimals) - ); + const amount = balances.balance.toFixed(selectedAsset.decimals); + setValue('amount', amount); + handleAmountChange(amount); clearErrors('amount'); }} > diff --git a/libs/deposits/src/lib/deposit-manager.tsx b/libs/deposits/src/lib/deposit-manager.tsx index 1086d75ea..5288ccc7a 100644 --- a/libs/deposits/src/lib/deposit-manager.tsx +++ b/libs/deposits/src/lib/deposit-manager.tsx @@ -5,7 +5,7 @@ import { prepend0x } from '@vegaprotocol/smart-contracts'; import sortBy from 'lodash/sortBy'; import { useSubmitApproval } from './use-submit-approval'; import { useSubmitFaucet } from './use-submit-faucet'; -import { useState } from 'react'; +import { useCallback, useState } from 'react'; import { useDepositBalances } from './use-deposit-balances'; import { useDepositDialog } from './deposit-dialog'; import type { Asset } from '@vegaprotocol/assets'; @@ -14,6 +14,7 @@ import { useBridgeContract, useEthereumConfig, } from '@vegaprotocol/web3'; +import { usePersistentDeposit } from './use-persistent-deposit'; interface DepositManagerProps { assetId?: string; @@ -28,7 +29,9 @@ export const DepositManager = ({ }: DepositManagerProps) => { const createEthTransaction = useEthTransactionStore((state) => state.create); const { config } = useEthereumConfig(); - const [assetId, setAssetId] = useState(initialAssetId); + const [persistentDeposit, savePersistentDeposit] = + usePersistentDeposit(initialAssetId); + const [assetId, setAssetId] = useState(persistentDeposit?.assetId); const asset = assets.find((a) => a.id === assetId); const bridgeContract = useBridgeContract(); const closeDepositDialog = useDepositDialog((state) => state.close); @@ -65,17 +68,26 @@ export const DepositManager = ({ closeDepositDialog(); }; + const onAmountChange = useCallback( + (amount: string) => { + savePersistentDeposit({ ...persistentDeposit, amount }); + }, + [savePersistentDeposit, persistentDeposit] + ); + return ( { setAssetId(id); + savePersistentDeposit({ assetId: id }); // When we change asset, also clear the tracked faucet/approve transactions so // we dont render stale UI approve.reset(); faucet.reset(); }} + handleAmountChange={onAmountChange} assets={sortBy(assets, 'name')} submitApprove={approve.perform} submitDeposit={submitDeposit} diff --git a/libs/deposits/src/lib/use-persistent-deposit.spec.ts b/libs/deposits/src/lib/use-persistent-deposit.spec.ts new file mode 100644 index 000000000..e28c23ce4 --- /dev/null +++ b/libs/deposits/src/lib/use-persistent-deposit.spec.ts @@ -0,0 +1,21 @@ +import { renderHook, waitFor, act } from '@testing-library/react'; +import { usePersistentDeposit } from './use-persistent-deposit'; + +describe('usePersistenDeposit', () => { + it('should return empty data', () => { + const { result } = renderHook(() => usePersistentDeposit()); + expect(result.current).toEqual([{ assetId: '' }, expect.any(Function)]); + }); + it('should return empty and properly saved data', async () => { + const aId = 'test'; + const retObj = { assetId: 'test', amount: '1.00000' }; + const { result } = renderHook(() => usePersistentDeposit(aId)); + expect(result.current).toEqual([{ assetId: 'test' }, expect.any(Function)]); + await act(() => { + result.current[1](retObj); + }); + await waitFor(() => { + expect(result.current[0]).toEqual(retObj); + }); + }); +}); diff --git a/libs/deposits/src/lib/use-persistent-deposit.ts b/libs/deposits/src/lib/use-persistent-deposit.ts new file mode 100644 index 000000000..4943aaab7 --- /dev/null +++ b/libs/deposits/src/lib/use-persistent-deposit.ts @@ -0,0 +1,42 @@ +import { useMemo } from 'react'; +import { create } from 'zustand'; +import { persist } from 'zustand/middleware'; +import { immer } from 'zustand/middleware/immer'; + +const STORAGE_KEY = 'vega_deposit_store'; +interface PersistedDeposit { + assetId: string; + amount?: string; +} +type PersistedDepositData = Record; + +const usePersistentDepositStore = create<{ + deposits: PersistedDepositData; + saveValue: (entry: PersistedDeposit) => void; + lastVisited?: PersistedDeposit; +}>()( + persist( + immer((set) => ({ + deposits: {}, + saveValue: (entry) => + set((state) => { + const oldValue = state.deposits[entry.assetId] || null; + state.deposits[entry.assetId] = { ...oldValue, ...entry }; + state.lastVisited = { ...oldValue, ...entry }; + return state; + }), + })), + { name: STORAGE_KEY } + ) +); + +export const usePersistentDeposit = ( + assetId?: string +): [PersistedDeposit, (entry: PersistedDeposit) => void] => { + const { deposits, lastVisited, saveValue } = usePersistentDepositStore(); + const discoveredData = useMemo(() => { + return deposits[assetId || ''] || lastVisited || { assetId: assetId || '' }; + }, [deposits, lastVisited, assetId]); + + return [discoveredData, saveValue]; +}; From f390448c243904885003f42a55a72cdd66b29b4f Mon Sep 17 00:00:00 2001 From: dexturr Date: Wed, 5 Apr 2023 18:09:37 +0000 Subject: [PATCH 2/4] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 96 ++++++++++++++++---- 1 file changed, 78 insertions(+), 18 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index c2be9f085..12fa22e15 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -3,9 +3,9 @@ "tranche_id": 56, "tranche_start": "2023-04-20T00:00:00.000Z", "tranche_end": "2023-05-20T00:00:00.000Z", - "total_added": "11103.75", + "total_added": "12395.75", "total_removed": "0", - "locked_amount": "11103.75", + "locked_amount": "12395.75", "deposits": [ { "amount": "50", @@ -41,6 +41,16 @@ "amount": "379.5", "user": "0x6536B87D6a31a37645c2E0E948BB1a2166FAcdaE", "tx": "0x6dc1c78046509fc85f149ad55a0683e059f46d53eab51397ff202c22ee55938f" + }, + { + "amount": "138", + "user": "0x9f709F2b44e14B2832832FC35aC378e41Bf14bBC", + "tx": "0x1b2921c481d2af4dead917173e4fc821ca119bc9408460caff9c25ae09e06a3d" + }, + { + "amount": "1154", + "user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", + "tx": "0x3e8baadb612f97fd9fa0b4a8f28c57381d87ff43a083117e19d0332e37869a7f" } ], "withdrawals": [], @@ -149,6 +159,36 @@ "total_tokens": "379.5", "withdrawn_tokens": "0", "remaining_tokens": "379.5" + }, + { + "address": "0x9f709F2b44e14B2832832FC35aC378e41Bf14bBC", + "deposits": [ + { + "amount": "138", + "user": "0x9f709F2b44e14B2832832FC35aC378e41Bf14bBC", + "tranche_id": 56, + "tx": "0x1b2921c481d2af4dead917173e4fc821ca119bc9408460caff9c25ae09e06a3d" + } + ], + "withdrawals": [], + "total_tokens": "138", + "withdrawn_tokens": "0", + "remaining_tokens": "138" + }, + { + "address": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", + "deposits": [ + { + "amount": "1154", + "user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", + "tranche_id": 56, + "tx": "0x3e8baadb612f97fd9fa0b4a8f28c57381d87ff43a083117e19d0332e37869a7f" + } + ], + "withdrawals": [], + "total_tokens": "1154", + "withdrawn_tokens": "0", + "remaining_tokens": "1154" } ] }, @@ -763,7 +803,7 @@ "tranche_end": "2023-04-06T00:00:00.000Z", "total_added": "14099", "total_removed": "165.10784124668", - "locked_amount": "224.192208034646958248", + "locked_amount": "110.66430592891317977", "deposits": [ { "amount": "30", @@ -3551,7 +3591,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "57815.4286010790859272716", + "locked_amount": "57756.158813300075873473", "deposits": [ { "amount": "86666.297", @@ -3617,7 +3657,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "776.001920533170575", + "locked_amount": "772.573101088726", "deposits": [ { "amount": "2500", @@ -3738,7 +3778,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "14122.9698193438015", + "locked_amount": "14099.22897166868", "deposits": [ { "amount": "12500", @@ -4005,7 +4045,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "11781.2245815", - "locked_amount": "24342.459906384285", + "locked_amount": "24290.74345841006625", "deposits": [ { "amount": "7500", @@ -4325,7 +4365,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "57762.679297096771897515", + "locked_amount": "57703.463585541498254355", "deposits": [ { "amount": "129999.45", @@ -4358,7 +4398,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "53478.00750101943585405563", + "locked_amount": "53441.07987456501837419469", "deposits": [ { "amount": "54144.7663", @@ -4391,7 +4431,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "25810.56995180111776", + "locked_amount": "25767.75874556062762", "deposits": [ { "amount": "10000", @@ -4584,7 +4624,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "2253.32794266869585", + "locked_amount": "2249.908517250127", "deposits": [ { "amount": "5000", @@ -5103,7 +5143,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "6357.929999175", - "locked_amount": "3169.01185543278045", + "locked_amount": "3137.98198664825145", "deposits": [ { "amount": "7500", @@ -5543,7 +5583,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "928642.9598472029154", - "locked_amount": "305567.6317709348835147958", + "locked_amount": "304240.943688379690701449", "deposits": [ { "amount": "1852091.69", @@ -11031,7 +11071,7 @@ "tranche_id": 11, "tranche_start": "2021-09-03T00:00:00.000Z", "tranche_end": "2022-09-03T00:00:00.000Z", - "total_added": "57213.000000000000000003", + "total_added": "57238.000000000000000003", "total_removed": "48157.21518131551", "locked_amount": "0", "deposits": [ @@ -11055,6 +11095,11 @@ "user": "0x363D3d06d70761c34D6EfEB25E409A9549E6970D", "tx": "0x180cd3aca2d716aa233483a9a52b02e83d9ac88716ca85d998269965c7a01a96" }, + { + "amount": "25", + "user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", + "tx": "0xac528ad2b9d958135e7556c5d9d36ce97eb6fb723dd44b3430374276e0fae9be" + }, { "amount": "150", "user": "0xEb01fF124D71b6C7E6613fd6E0A86c28C733F008", @@ -22858,6 +22903,21 @@ "withdrawn_tokens": "0", "remaining_tokens": "25" }, + { + "address": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", + "deposits": [ + { + "amount": "25", + "user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", + "tranche_id": 11, + "tx": "0xac528ad2b9d958135e7556c5d9d36ce97eb6fb723dd44b3430374276e0fae9be" + } + ], + "withdrawals": [], + "total_tokens": "25", + "withdrawn_tokens": "0", + "remaining_tokens": "25" + }, { "address": "0xEb01fF124D71b6C7E6613fd6E0A86c28C733F008", "deposits": [ @@ -39276,7 +39336,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "700133.348465855088393", - "locked_amount": "494052.387411363117222196857", + "locked_amount": "492013.729732206686798975272", "deposits": [ { "amount": "1998.95815", @@ -40658,7 +40718,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "815921.67873801845247952", - "locked_amount": "7051565.6302064045342393167928833721438227", + "locked_amount": "7044336.6809704508767487714278225047431739", "deposits": [ { "amount": "16249.93", @@ -46972,7 +47032,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "5808173.326897276766376406", - "locked_amount": "788515.1388445815139999883144135346", + "locked_amount": "781841.4190672246241239369447994325", "deposits": [ { "amount": "129284.449", @@ -56719,7 +56779,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", "total_removed": "41316.3370079701949", - "locked_amount": "78285.424909176752146146526230336", + "locked_amount": "77962.38794645034017680735971588", "deposits": [ { "amount": "3000", From e1185b9a963dc01eb8e18960c1794012ecb38fe7 Mon Sep 17 00:00:00 2001 From: dexturr Date: Thu, 6 Apr 2023 00:13:22 +0000 Subject: [PATCH 3/4] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 90 ++++++++++++++------ 1 file changed, 66 insertions(+), 24 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 12fa22e15..5c611dcaf 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -3,9 +3,9 @@ "tranche_id": 56, "tranche_start": "2023-04-20T00:00:00.000Z", "tranche_end": "2023-05-20T00:00:00.000Z", - "total_added": "12395.75", + "total_added": "12533.75", "total_removed": "0", - "locked_amount": "12395.75", + "locked_amount": "12533.75", "deposits": [ { "amount": "50", @@ -51,6 +51,11 @@ "amount": "1154", "user": "0x981D29D939cAa4ADC04A5e44224dBB45539E8730", "tx": "0x3e8baadb612f97fd9fa0b4a8f28c57381d87ff43a083117e19d0332e37869a7f" + }, + { + "amount": "138", + "user": "0xF2c8658Bad7314c3c3c1FED7e300a1691EC4f98A", + "tx": "0xa9db9e09f9841a8cbcaf161bf98d32e67f24c2c162f13c364450487ccaf8ebd6" } ], "withdrawals": [], @@ -189,6 +194,21 @@ "total_tokens": "1154", "withdrawn_tokens": "0", "remaining_tokens": "1154" + }, + { + "address": "0xF2c8658Bad7314c3c3c1FED7e300a1691EC4f98A", + "deposits": [ + { + "amount": "138", + "user": "0xF2c8658Bad7314c3c3c1FED7e300a1691EC4f98A", + "tranche_id": 56, + "tx": "0xa9db9e09f9841a8cbcaf161bf98d32e67f24c2c162f13c364450487ccaf8ebd6" + } + ], + "withdrawals": [], + "total_tokens": "138", + "withdrawn_tokens": "0", + "remaining_tokens": "138" } ] }, @@ -251,7 +271,7 @@ "tranche_end": "2023-05-06T00:00:00.000Z", "total_added": "8565", "total_removed": "0", - "locked_amount": "8565", + "locked_amount": "8562.3498726851853015", "deposits": [ { "amount": "33", @@ -802,8 +822,8 @@ "tranche_start": "2023-03-06T00:00:00.000Z", "tranche_end": "2023-04-06T00:00:00.000Z", "total_added": "14099", - "total_removed": "165.10784124668", - "locked_amount": "110.66430592891317977", + "total_removed": "192.88824447236", + "locked_amount": "0", "deposits": [ { "amount": "30", @@ -1577,6 +1597,11 @@ "user": "0x6A228Fffda4D1B3C773b9ce38DA43592581b36FC", "tx": "0x5a8d0a823b77eb011079663279e0f2eaf0bd8773114dd6d5bfe65c2ab47680e6" }, + { + "amount": "27.78040322568", + "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", + "tx": "0x47ef65d8ea128dfa3308d25fadf4e3b6b2b95a91f98bd074b268c002babf1edf" + }, { "amount": "14.85013776876", "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", @@ -1815,6 +1840,12 @@ } ], "withdrawals": [ + { + "amount": "27.78040322568", + "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", + "tranche_id": 53, + "tx": "0x47ef65d8ea128dfa3308d25fadf4e3b6b2b95a91f98bd074b268c002babf1edf" + }, { "amount": "14.85013776876", "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", @@ -1829,8 +1860,8 @@ } ], "total_tokens": "63", - "withdrawn_tokens": "35.00279905878", - "remaining_tokens": "27.99720094122" + "withdrawn_tokens": "62.78320228446", + "remaining_tokens": "0.21679771554" }, { "address": "0x8499411Bff99ddE9A02903008F917EEa0E27B42A", @@ -3591,7 +3622,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "57756.158813300075873473", + "locked_amount": "57696.1799975965908537001", "deposits": [ { "amount": "86666.297", @@ -3657,7 +3688,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "772.573101088726", + "locked_amount": "769.1032636345135", "deposits": [ { "amount": "2500", @@ -3778,7 +3809,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "14099.22897166868", + "locked_amount": "14075.20411886071", "deposits": [ { "amount": "12500", @@ -4045,7 +4076,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "11781.2245815", - "locked_amount": "24290.74345841006625", + "locked_amount": "24238.40834100675375", "deposits": [ { "amount": "7500", @@ -4365,7 +4396,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "57703.463585541498254355", + "locked_amount": "57643.5394929605109381", "deposits": [ { "amount": "129999.45", @@ -4398,7 +4429,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "53441.07987456501837419469", + "locked_amount": "53403.7104932246597802105", "deposits": [ { "amount": "54144.7663", @@ -4431,7 +4462,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "25767.75874556062762", + "locked_amount": "25724.4354008117668", "deposits": [ { "amount": "10000", @@ -4624,7 +4655,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "2249.908517250127", + "locked_amount": "2246.4481861998985", "deposits": [ { "amount": "5000", @@ -5143,7 +5174,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "6357.929999175", - "locked_amount": "3137.98198664825145", + "locked_amount": "3106.580916206260575", "deposits": [ { "amount": "7500", @@ -5583,7 +5614,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "928642.9598472029154", - "locked_amount": "304240.943688379690701449", + "locked_amount": "302898.3848066730155737668", "deposits": [ { "amount": "1852091.69", @@ -39336,7 +39367,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "700133.348465855088393", - "locked_amount": "492013.729732206686798975272", + "locked_amount": "489950.684160380387338024176", "deposits": [ { "amount": "1998.95815", @@ -40718,7 +40749,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "815921.67873801845247952", - "locked_amount": "7044336.6809704508767487714278225047431739", + "locked_amount": "7037021.253832938661160878891016318234658", "deposits": [ { "amount": "16249.93", @@ -47032,7 +47063,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "5808173.326897276766376406", - "locked_amount": "781841.4190672246241239369447994325", + "locked_amount": "775087.863443318864292226559236425", "deposits": [ { "amount": "129284.449", @@ -56778,8 +56809,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "41316.3370079701949", - "locked_amount": "77962.38794645034017680735971588", + "total_removed": "41468.4146335381949", + "locked_amount": "77635.48658272315360179984373416", "deposits": [ { "amount": "3000", @@ -63468,6 +63499,11 @@ "user": "0x9405F540EcC1204801De5C4444D06386BD6693F0", "tx": "0x0df6ec04cbdda41c8649a5e360ec541d14371e3877d82e1404308180024ede02" }, + { + "amount": "152.077625568", + "user": "0x7345AaA0D0e4C4A46d921fA9323973956F2b7392", + "tx": "0xf2737eb145aea0c573c2f604ae4b840fd56358a89f1470e37a26fff91df2e38d" + }, { "amount": "154.812094114", "user": "0x27e2254A2A8c9c9D1321E5Fe64cAD88e7A4f0ba7", @@ -81841,6 +81877,12 @@ } ], "withdrawals": [ + { + "amount": "152.077625568", + "user": "0x7345AaA0D0e4C4A46d921fA9323973956F2b7392", + "tranche_id": 5, + "tx": "0xf2737eb145aea0c573c2f604ae4b840fd56358a89f1470e37a26fff91df2e38d" + }, { "amount": "94.45296804", "user": "0x7345AaA0D0e4C4A46d921fA9323973956F2b7392", @@ -81891,8 +81933,8 @@ } ], "total_tokens": "1200", - "withdrawn_tokens": "850.0164003", - "remaining_tokens": "349.9835997" + "withdrawn_tokens": "1002.094025868", + "remaining_tokens": "197.905974132" }, { "address": "0x47181cf36aDFb0b5dB7EfDB123f403D890607841", From 84068c8081660bd6635921fbddec8baffb5d23c6 Mon Sep 17 00:00:00 2001 From: dexturr Date: Thu, 6 Apr 2023 06:09:30 +0000 Subject: [PATCH 4/4] chore: update tranches Signed-off-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> --- apps/static/src/assets/mainnet-tranches.json | 89 +++++++++++++++----- 1 file changed, 66 insertions(+), 23 deletions(-) diff --git a/apps/static/src/assets/mainnet-tranches.json b/apps/static/src/assets/mainnet-tranches.json index 5c611dcaf..142369698 100644 --- a/apps/static/src/assets/mainnet-tranches.json +++ b/apps/static/src/assets/mainnet-tranches.json @@ -269,9 +269,9 @@ "tranche_id": 54, "tranche_start": "2023-04-06T00:00:00.000Z", "tranche_end": "2023-05-06T00:00:00.000Z", - "total_added": "8565", + "total_added": "8661", "total_removed": "0", - "locked_amount": "8562.3498726851853015", + "locked_amount": "8586.9203819444447973", "deposits": [ { "amount": "33", @@ -303,6 +303,11 @@ "user": "0xf96afaB11e5617560b9183766470B23F45c38C56", "tx": "0x49ab3f37bda02347cb1966e8fa21885a463f09d0593a890e96b2e36dfb8dec49" }, + { + "amount": "96", + "user": "0x6324334064d1d807940191C658d925DA7d323b12", + "tx": "0x96b16197328b59556848409bcc4ebf1f71648485fabedde2848461247aa4be32" + }, { "amount": "111", "user": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D", @@ -476,6 +481,21 @@ "withdrawn_tokens": "0", "remaining_tokens": "2523" }, + { + "address": "0x6324334064d1d807940191C658d925DA7d323b12", + "deposits": [ + { + "amount": "96", + "user": "0x6324334064d1d807940191C658d925DA7d323b12", + "tranche_id": 54, + "tx": "0x96b16197328b59556848409bcc4ebf1f71648485fabedde2848461247aa4be32" + } + ], + "withdrawals": [], + "total_tokens": "96", + "withdrawn_tokens": "0", + "remaining_tokens": "96" + }, { "address": "0x268070d5EEd5b24E34a5F4C17B5482178b18089D", "deposits": [ @@ -822,7 +842,7 @@ "tranche_start": "2023-03-06T00:00:00.000Z", "tranche_end": "2023-04-06T00:00:00.000Z", "total_added": "14099", - "total_removed": "192.88824447236", + "total_removed": "332.88824447236", "locked_amount": "0", "deposits": [ { @@ -1602,6 +1622,11 @@ "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", "tx": "0x47ef65d8ea128dfa3308d25fadf4e3b6b2b95a91f98bd074b268c002babf1edf" }, + { + "amount": "140", + "user": "0xF3C6c37B9EBB4D21e8bf119841C0e0e296e3EA04", + "tx": "0x3af459fccc854056f4a3a3d0223e5b5fec587f2990c0ec48f0f1be65882e5d96" + }, { "amount": "14.85013776876", "user": "0x6F32AA5A6198329c16e438512F992a0548C856f9", @@ -2261,10 +2286,17 @@ "tx": "0x46d80a145d2f49ef3152cbfaa6d2bb054deabe21396ab43553a3f076e2db62e1" } ], - "withdrawals": [], + "withdrawals": [ + { + "amount": "140", + "user": "0xF3C6c37B9EBB4D21e8bf119841C0e0e296e3EA04", + "tranche_id": 53, + "tx": "0x3af459fccc854056f4a3a3d0223e5b5fec587f2990c0ec48f0f1be65882e5d96" + } + ], "total_tokens": "140", - "withdrawn_tokens": "0", - "remaining_tokens": "140" + "withdrawn_tokens": "140", + "remaining_tokens": "0" }, { "address": "0xEb01fF124D71b6C7E6613fd6E0A86c28C733F008", @@ -3622,7 +3654,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "86666.297", "total_removed": "0", - "locked_amount": "57696.1799975965908537001", + "locked_amount": "57637.4570956972995656974", "deposits": [ { "amount": "86666.297", @@ -3688,7 +3720,7 @@ "tranche_end": "2023-06-01T00:00:00.000Z", "total_added": "2500", "total_removed": "0", - "locked_amount": "769.1032636345135", + "locked_amount": "765.7060821123321", "deposits": [ { "amount": "2500", @@ -3809,7 +3841,7 @@ "tranche_end": "2023-09-01T00:00:00.000Z", "total_added": "17500", "total_removed": "0", - "locked_amount": "14075.20411886071", + "locked_amount": "14051.682329408213", "deposits": [ { "amount": "12500", @@ -4076,7 +4108,7 @@ "tranche_end": "2023-08-01T00:00:00.000Z", "total_added": "37500", "total_removed": "11781.2245815", - "locked_amount": "24238.40834100675375", + "locked_amount": "24187.1690837937375", "deposits": [ { "amount": "7500", @@ -4396,7 +4428,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "129999.45", "total_removed": "0", - "locked_amount": "57643.5394929605109381", + "locked_amount": "57584.870168320415566065", "deposits": [ { "amount": "129999.45", @@ -4429,7 +4461,7 @@ "tranche_end": "2024-04-01T00:00:00.000Z", "total_added": "54144.7663", "total_removed": "0", - "locked_amount": "53403.7104932246597802105", + "locked_amount": "53367.12360019002586831048", "deposits": [ { "amount": "54144.7663", @@ -4462,7 +4494,7 @@ "tranche_end": "2023-09-03T00:00:00.000Z", "total_added": "62600", "total_removed": "0", - "locked_amount": "25724.4354008117668", + "locked_amount": "25682.0192161339434", "deposits": [ { "amount": "10000", @@ -4655,7 +4687,7 @@ "tranche_end": "2023-09-17T00:00:00.000Z", "total_added": "5000", "total_removed": "0", - "locked_amount": "2246.4481861998985", + "locked_amount": "2243.060312024353", "deposits": [ { "amount": "5000", @@ -5174,7 +5206,7 @@ "tranche_end": "2023-05-01T00:00:00.000Z", "total_added": "22500", "total_removed": "6357.929999175", - "locked_amount": "3106.580916206260575", + "locked_amount": "3075.8373618784524", "deposits": [ { "amount": "7500", @@ -5614,7 +5646,7 @@ "tranche_end": "2023-06-02T00:00:00.000Z", "total_added": "1939928.38", "total_removed": "928642.9598472029154", - "locked_amount": "302898.3848066730155737668", + "locked_amount": "301583.938154471032688225", "deposits": [ { "amount": "1852091.69", @@ -39367,7 +39399,7 @@ "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "3732368.4671", "total_removed": "700133.348465855088393", - "locked_amount": "489950.684160380387338024176", + "locked_amount": "487930.837297663877080092493", "deposits": [ { "amount": "1998.95815", @@ -40749,7 +40781,7 @@ "tranche_end": "2023-12-05T00:00:00.000Z", "total_added": "15870102.715470999700000001", "total_removed": "815921.67873801845247952", - "locked_amount": "7037021.253832938661160878891016318234658", + "locked_amount": "7029859.0065443106923818088552439038280617", "deposits": [ { "amount": "16249.93", @@ -47063,7 +47095,7 @@ "tranche_end": "2023-05-05T00:00:00.000Z", "total_added": "14597706.0446472999", "total_removed": "5808173.326897276766376406", - "locked_amount": "775087.863443318864292226559236425", + "locked_amount": "768475.722477836206720900273876518", "deposits": [ { "amount": "129284.449", @@ -56809,8 +56841,8 @@ "tranche_start": "2022-06-05T00:00:00.000Z", "tranche_end": "2023-06-05T00:00:00.000Z", "total_added": "472355.6199999996", - "total_removed": "41468.4146335381949", - "locked_amount": "77635.48658272315360179984373416", + "total_removed": "41480.0971297341949", + "locked_amount": "77315.43030138884441024977777776", "deposits": [ { "amount": "3000", @@ -63504,6 +63536,11 @@ "user": "0x7345AaA0D0e4C4A46d921fA9323973956F2b7392", "tx": "0xf2737eb145aea0c573c2f604ae4b840fd56358a89f1470e37a26fff91df2e38d" }, + { + "amount": "11.682496196", + "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", + "tx": "0xc757d9ea4d28133266b723ac41ba64d3bc5e1f4498e08b24745bf84e203009e0" + }, { "amount": "154.812094114", "user": "0x27e2254A2A8c9c9D1321E5Fe64cAD88e7A4f0ba7", @@ -82132,6 +82169,12 @@ "tranche_id": 5, "tx": "0x9d4c99fdeee2d95caee8d6725f6796f8e02f8a9fd2d911a8e151b2665e192ebc" }, + { + "amount": "11.682496196", + "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", + "tranche_id": 5, + "tx": "0xc757d9ea4d28133266b723ac41ba64d3bc5e1f4498e08b24745bf84e203009e0" + }, { "amount": "19.74474886", "user": "0xcB555C5602cC0b2434A27d277e14Cb5C7bF4Ead1", @@ -82164,8 +82207,8 @@ } ], "total_tokens": "400", - "withdrawn_tokens": "322.776395228", - "remaining_tokens": "77.223604772" + "withdrawn_tokens": "334.458891424", + "remaining_tokens": "65.541108576" }, { "address": "0x3738bec36216eA2F11B954891C65AAd1Bc852156",