From 26041bb700288b5eac6aae0022030b51582746f3 Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Thu, 22 Aug 2024 10:08:16 +1000 Subject: [PATCH 1/2] feat: upgrade all contract details to use v2 --- packages/contracts/abis/ServiceNodeRewards.ts | 25 +++++------------ packages/contracts/constants.ts | 27 +++++++++++++++++++ packages/contracts/scripts/generate-abis.ts | 2 +- 3 files changed, 34 insertions(+), 20 deletions(-) diff --git a/packages/contracts/abis/ServiceNodeRewards.ts b/packages/contracts/abis/ServiceNodeRewards.ts index 83306c89..312994b5 100644 --- a/packages/contracts/abis/ServiceNodeRewards.ts +++ b/packages/contracts/abis/ServiceNodeRewards.ts @@ -121,7 +121,7 @@ export const ServiceNodeRewardsAbi = [ }, { internalType: 'address', - name: 'recipient', + name: 'contributor', type: 'address', }, ], @@ -326,7 +326,7 @@ export const ServiceNodeRewardsAbi = [ }, { internalType: 'address', - name: 'recipient', + name: 'contributor', type: 'address', }, ], @@ -402,7 +402,7 @@ export const ServiceNodeRewardsAbi = [ { indexed: false, internalType: 'address', - name: 'recipient', + name: 'initiator', type: 'address', }, { @@ -580,7 +580,7 @@ export const ServiceNodeRewardsAbi = [ { indexed: false, internalType: 'address', - name: 'recipient', + name: 'operator', type: 'address', }, { @@ -617,7 +617,7 @@ export const ServiceNodeRewardsAbi = [ { indexed: false, internalType: 'address', - name: 'recipient', + name: 'operator', type: 'address', }, { @@ -660,7 +660,7 @@ export const ServiceNodeRewardsAbi = [ { indexed: false, internalType: 'address', - name: 'recipient', + name: 'contributor', type: 'address', }, { @@ -1597,19 +1597,6 @@ export const ServiceNodeRewardsAbi = [ stateMutability: 'nonpayable', type: 'function', }, - { - inputs: [ - { - internalType: 'uint64[]', - name: 'ids', - type: 'uint64[]', - }, - ], - name: 'removeNodeBySNID', - outputs: [], - stateMutability: 'nonpayable', - type: 'function', - }, { inputs: [], name: 'renounceOwnership', diff --git a/packages/contracts/constants.ts b/packages/contracts/constants.ts index d201472a..5f8ccff6 100644 --- a/packages/contracts/constants.ts +++ b/packages/contracts/constants.ts @@ -11,6 +11,33 @@ export type ContractName = (typeof contracts)[number]; // TODO - Replace Mainnet addresses with the correct addresses once they are available export const addresses: Record> = { + SENT: { + /** @deprecated - The Mainnet value is a mock value */ + [CHAIN.MAINNET]: '0x70c1f36C9cEBCa51B9344121D284D85BE36CD6bB', + /** @deprecated - The Eth value is a mock value */ + [CHAIN.ETHEREUM]: '0x70c1f36C9cEBCa51B9344121D284D85BE36CD6bB', + [CHAIN.TESTNET]: '0x70c1f36C9cEBCa51B9344121D284D85BE36CD6bB', + }, + ServiceNodeRewards: { + /** @deprecated - The Mainnet value is a mock value */ + [CHAIN.MAINNET]: '0xb691e7C159369475D0a3d4694639ae0144c7bAB2', + /** @deprecated - The Eth value is a mock value */ + [CHAIN.ETHEREUM]: '0xb691e7C159369475D0a3d4694639ae0144c7bAB2', + [CHAIN.TESTNET]: '0xb691e7C159369475D0a3d4694639ae0144c7bAB2', + }, + RewardRatePool: { + /** @deprecated - The Mainnet value is a mock value */ + [CHAIN.MAINNET]: '0x84a648F74Eaf037dD9558987F6179E692d5F2566', + /** @deprecated - The Eth value is a mock value */ + [CHAIN.ETHEREUM]: '0x84a648F74Eaf037dD9558987F6179E692d5F2566', + [CHAIN.TESTNET]: '0x84a648F74Eaf037dD9558987F6179E692d5F2566', + }, +} as const; + +/** + * @deprecated - Use {@link addresses} instead + */ +export const addressesV1: Record> = { SENT: { /** @deprecated - The Mainnet value is a mock value */ [CHAIN.MAINNET]: '0x7FBDC29b81e410eB0eaE75Dca64a76d898EAc4A9', diff --git a/packages/contracts/scripts/generate-abis.ts b/packages/contracts/scripts/generate-abis.ts index 59c90647..2c7d6fff 100644 --- a/packages/contracts/scripts/generate-abis.ts +++ b/packages/contracts/scripts/generate-abis.ts @@ -76,7 +76,7 @@ async function downloadRepository({ // Clone the repository execSync(`git clone ${url} ${destinationPath}`); logger.info('Repository downloaded successfully!'); - execSync(`cd ${destinationPath} && git switch integration`); + execSync(`cd ${destinationPath} && git switch master`); } catch (error) { logger.error('Error downloading repository:', error); } From 625edbe820bff7d4402f767fdda3c4bcefdacd79 Mon Sep 17 00:00:00 2001 From: Ryan Miller Date: Thu, 22 Aug 2024 10:09:15 +1000 Subject: [PATCH 2/2] chore: enable registration and add new token contract banner --- apps/staking/app/layout.tsx | 19 ++++--- .../register/[nodeId]/NodeRegistration.tsx | 2 +- .../components/NewTokenContractInfo.tsx | 49 +++++++++++++++++++ apps/staking/lib/constants.ts | 1 + apps/staking/locales/en.json | 3 +- 5 files changed, 64 insertions(+), 10 deletions(-) create mode 100644 apps/staking/components/NewTokenContractInfo.tsx diff --git a/apps/staking/app/layout.tsx b/apps/staking/app/layout.tsx index af65cdbe..a9570987 100644 --- a/apps/staking/app/layout.tsx +++ b/apps/staking/app/layout.tsx @@ -13,9 +13,9 @@ import ChainBanner from '@/components/ChainBanner'; import Header from '@/components/Header'; import { GlobalProvider } from '@/providers/global-provider'; import { TOSHandler } from '@/components/TOSHandler'; -import { RegistrationPausedInfo } from '@/components/RegistrationPausedInfo'; -import { Banner } from '@session/ui/components/Banner'; import { getBuildInfo } from '@session/util/build'; +import { Banner } from '@session/ui/components/Banner'; +import { NewTokenContractInfo } from '@/components/NewTokenContractInfo'; const wagmiConfig = createWagmiConfig({ projectId: NEXT_PUBLIC_WALLET_CONNECT_PROJECT_ID, @@ -45,12 +45,15 @@ export default async function RootLayout({ children }: { children: React.ReactNo wagmiMetadata={wagmiMetadata} > - - -
-
{children}
- {!isProduction ? : null} - + + + + + {/**/} +
+
{children}
+ {!isProduction ? : null} + diff --git a/apps/staking/app/register/[nodeId]/NodeRegistration.tsx b/apps/staking/app/register/[nodeId]/NodeRegistration.tsx index 68e355ee..a8e7c4ed 100644 --- a/apps/staking/app/register/[nodeId]/NodeRegistration.tsx +++ b/apps/staking/app/register/[nodeId]/NodeRegistration.tsx @@ -34,7 +34,7 @@ import { toast } from '@session/ui/lib/sonner'; import { RegistrationPausedInfo } from '@/components/RegistrationPausedInfo'; // TODO - remove with feature flag pr -const registrationPaused = true; +const registrationPaused = false; export default function NodeRegistration({ nodeId }: { nodeId: string }) { const showMockRegistration = useFeatureFlag(FEATURE_FLAG.MOCK_REGISTRATION); diff --git a/apps/staking/components/NewTokenContractInfo.tsx b/apps/staking/components/NewTokenContractInfo.tsx new file mode 100644 index 00000000..9d4d8c3b --- /dev/null +++ b/apps/staking/components/NewTokenContractInfo.tsx @@ -0,0 +1,49 @@ +'use client'; + +import Link from 'next/link'; +import { BASE_URL, SOCIALS, URL } from '@/lib/constants'; +import { Social } from '@session/ui/components/SocialLinkList'; +import { ReactNode } from 'react'; +import { useTranslations } from 'next-intl'; +import { useAddSessionTokenToWallet } from '@session/wallet/hooks/wallet-hooks'; + +export function NewTokenContractInfo() { + const dictionary = useTranslations('banner'); + const { addToken } = useAddSessionTokenToWallet(`${BASE_URL}/images/token_logo.svg`); + return ( + + {dictionary.rich('newTokenContract', { + 'remove-token-link': (children: ReactNode) => ( + + {children} + + ), + 'watch-token': (children: ReactNode) => ( + + {children} + + ), + link: (children: ReactNode) => ( + + {children} + + ), + })} + + ); +} diff --git a/apps/staking/lib/constants.ts b/apps/staking/lib/constants.ts index 1e22f282..45788791 100644 --- a/apps/staking/lib/constants.ts +++ b/apps/staking/lib/constants.ts @@ -24,6 +24,7 @@ export enum URL { BUG_BOUNTY_PROGRAM = 'https://token.getsession.org/bug-bounty-program', BUG_BOUNTY_TOS = 'https://token.getsession.org/bug-bounty-terms', SESSION_NODE_SOLO_SETUP_DOCS = 'https://docs.getsession.org/class-is-in-session/session-stagenet-single-contributor-node-setup', + REMOVE_TOKEN_FROM_WATCH_LIST = 'https://support.metamask.io/managing-my-tokens/custom-tokens/how-to-remove-a-token/', } export const LANDING_BUTTON_URL = { diff --git a/apps/staking/locales/en.json b/apps/staking/locales/en.json index 555a459e..8e7935ec 100644 --- a/apps/staking/locales/en.json +++ b/apps/staking/locales/en.json @@ -160,7 +160,8 @@ "testnet": "You are currently on {testnetName}." }, "banner": { - "registrationPaused": "Stagenet node registration is temporarily paused. Apologies for any inconvenience, we expect to be able to re-enable registrations soon. For updates, visit the Session Token discord." + "registrationPaused": "Stagenet node registration is temporarily paused. Apologies for any inconvenience, we expect to be able to re-enable registrations soon. For updates, visit the Session Token discord.", + "newTokenContract": "The Session Token contract has been updated. Remove the old token and add the new token contract to your wallet watch list to continue using the Staking Portal. If you have any questions, visit the Session Token Discord." }, "modules": { "title": {