From fddeaef356c5ea5ff460f2bda54d9fd68314f6af Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Fri, 1 Sep 2023 14:11:18 +0200 Subject: [PATCH 01/22] chore: Add .env to .gitignore and add example env --- .env => .env.example | 0 .gitignore | 1 + 2 files changed, 1 insertion(+) rename .env => .env.example (100%) diff --git a/.env b/.env.example similarity index 100% rename from .env rename to .env.example diff --git a/.gitignore b/.gitignore index 44bc97aeb..d7ba48068 100644 --- a/.gitignore +++ b/.gitignore @@ -21,3 +21,4 @@ cypress/plugins # Yarn node_modules/ yarn-error.log +.env \ No newline at end of file From 6a4ff69b434aa946f8d0bcc15df437b5f6cb66ff Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Wed, 19 Jul 2023 18:46:26 +0200 Subject: [PATCH 02/22] Add Dockerfile --- Dockerfile | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 000000000..49a4b54cb --- /dev/null +++ b/Dockerfile @@ -0,0 +1,30 @@ +FROM node:14-alpine + +# Set the working directory inside the container +WORKDIR /app + +# Install the dependencies +RUN apk add --update --no-cache python3 make g++ && \ + apk update && apk add --no-cache git openssh-client ca-certificates && \ + git config --global url."https://".insteadOf git:// + +ENV PYTHON /usr/bin/python3 + +# Copy package.json and yarn.lock to the working directory +COPY package*.json yarn.lock ./ + +# Clean yarn cache and install dependencies +RUN yarn cache clean && yarn install + +# Copy the app's source code to the working directory +COPY . . + +# Build the React app +ENV NODE_OPTIONS=--max_old_space_size=4096 +RUN yarn build + +# Expose the container's port +EXPOSE 3000 + +# Set the command to run when the container starts +CMD ["yarn", "start"] From b20da2239967ed118789f46cce0bc2826aaba6b0 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Thu, 20 Jul 2023 15:51:37 +0200 Subject: [PATCH 03/22] Switch to debian image to avoid memory issues This still requires a lot of system resources, beware! --- Dockerfile | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/Dockerfile b/Dockerfile index 49a4b54cb..7e1ce87df 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,30 +1,23 @@ -FROM node:14-alpine +FROM node:14-buster-slim -# Set the working directory inside the container WORKDIR /app -# Install the dependencies -RUN apk add --update --no-cache python3 make g++ && \ - apk update && apk add --no-cache git openssh-client ca-certificates && \ - git config --global url."https://".insteadOf git:// +RUN apt-get update && apt-get install -y python3 make g++ git openssh-client ca-certificates && \ + git config --global url."https://".insteadOf git:// && \ + rm -rf /var/lib/apt/lists/* && \ + apt-get clean ENV PYTHON /usr/bin/python3 -# Copy package.json and yarn.lock to the working directory COPY package*.json yarn.lock ./ -# Clean yarn cache and install dependencies RUN yarn cache clean && yarn install -# Copy the app's source code to the working directory COPY . . -# Build the React app -ENV NODE_OPTIONS=--max_old_space_size=4096 +ENV NODE_OPTIONS=--max_old_space_size=3072 RUN yarn build -# Expose the container's port EXPOSE 3000 -# Set the command to run when the container starts CMD ["yarn", "start"] From 87b6d497f0414ca3e406157743505a4631ef78c6 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Thu, 24 Aug 2023 11:32:16 +0200 Subject: [PATCH 04/22] docs: Update local docker development instruction in README --- README.md | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/README.md b/README.md index d237a38a1..dc40f0438 100644 --- a/README.md +++ b/README.md @@ -114,3 +114,53 @@ The following procedure allows to deploy T token dashboard to production: approval of someone else from the development team. 5. Once the release action is approved, the new version is automatically deployed to `dashboard.threshold.network`. + + +## Local Development + +Update `package.json` to contain: + +```json + "@keep-network/coverage-pools": "goerli", + "@keep-network/ecdsa": "goerli", + "@keep-network/keep-core": "1.8.1-goerli.0", + "@keep-network/keep-ecdsa": "goerli", + "@keep-network/random-beacon": "goerli", + "@keep-network/tbtc": "goerli", + "@keep-network/tbtc-v2": "goerli", + "@keep-network/tbtc-v2.ts": "development", + "@threshold-network/components": "development", + "@threshold-network/solidity-contracts": "goerli", +``` + +Update `.env` to contain: + +``` +REACT_APP_SUPPORTED_CHAIN_ID=5 +REACT_APP_ETH_HOSTNAME_HTTP=https://goerli.infura.io/v3/<your API key here> +REACT_APP_ETH_HOSTNAME_WS=wss://goerli.infura.io/v3/<your API key here> +REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS + +REACT_APP_FEATURE_FLAG_TBTC_V2=true +REACT_APP_FEATURE_FLAG_TBTC_V2_REDEMPTION=true +REACT_APP_FEATURE_FLAG_MULTI_APP_STAKING=true +REACT_APP_FEATURE_FLAG_FEEDBACK_MODULE=false +REACT_APP_FEATURE_FLAG_POSTHOG=false +REACT_APP_FEATURE_FLAG_SENTRY=$SENTRY_SUPPORT +REACT_APP_SENTRY_DSN=$SENTRY_DSN + +REACT_APP_ELECTRUM_PROTOCOL=wss +REACT_APP_ELECTRUM_HOST=electrumx-server.test.tbtc.network +REACT_APP_ELECTRUM_PORT=8443 +REACT_APP_MOCK_BITCOIN_CLIENT=false + +REACT_APP_WALLET_CONNECT_PROJECT_ID=$WALLET_CONNECT_PROJECT_ID +``` + +Then build the docker container and run the dashboard: + +```bash +docker build -t dashboard:latest . +docker run -p 3000:3000 -d dashboard +``` + From 6cf86ba39cc7b8cdc7f15b7c925f8d7c50fe9cfa Mon Sep 17 00:00:00 2001 From: Kieran Prasch <kieranprasch@gmail.com> Date: Mon, 18 Sep 2023 15:04:15 +0200 Subject: [PATCH 05/22] Converts docker usage into docker compose and use a bind mount to reflect local filesystem changes during development Co-authored-by: James Campbell <james.campbell@tanti.org.uk> --- Dockerfile => Dockerfile.dev | 19 +++++++++---------- docker-compose.yml | 19 +++++++++++++++++++ 2 files changed, 28 insertions(+), 10 deletions(-) rename Dockerfile => Dockerfile.dev (61%) create mode 100644 docker-compose.yml diff --git a/Dockerfile b/Dockerfile.dev similarity index 61% rename from Dockerfile rename to Dockerfile.dev index 7e1ce87df..b90df6383 100644 --- a/Dockerfile +++ b/Dockerfile.dev @@ -1,23 +1,22 @@ +# Use the specified image FROM node:14-buster-slim +# Set the working directory WORKDIR /app +# Install dependencies RUN apt-get update && apt-get install -y python3 make g++ git openssh-client ca-certificates && \ git config --global url."https://".insteadOf git:// && \ rm -rf /var/lib/apt/lists/* && \ apt-get clean -ENV PYTHON /usr/bin/python3 +# Set the environment variables +ENV PYTHON=/usr/bin/python3 +ENV NODE_OPTIONS=--max_old_space_size=3072 +# Copy package files and install node modules COPY package*.json yarn.lock ./ +RUN yarn install -RUN yarn cache clean && yarn install - -COPY . . - -ENV NODE_OPTIONS=--max_old_space_size=3072 -RUN yarn build - +# Expose port 3000 EXPOSE 3000 - -CMD ["yarn", "start"] diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 000000000..47ef982a8 --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,19 @@ +version: "3.8" + +services: + threshold-dashboard: + image: node:14-buster-slim + container_name: threshold-dashboard + working_dir: /app + environment: + - PYTHON=/usr/bin/python3 + - NODE_OPTIONS=--max_old_space_size=3072 + ports: + - "3000:3000" + volumes: + - .:/app # Bind mount the current directory to /app in the container + - /app/node_modules # This will prevent node_modules from being overwritten by the local volume + command: bash -c "yarn format:fix && yarn start" + build: + context: . + dockerfile: Dockerfile.dev From 77f4feda3a1d19b9753e05ff70dae428cceb54da Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Fri, 1 Sep 2023 15:31:54 +0200 Subject: [PATCH 06/22] Replace pre with taco on varioius pages --- .../index.tsx | 8 +++ .../index.tsx | 2 +- src/enums/externalHref.ts | 1 + .../Staking/AuthorizeStakingApps/index.tsx | 22 +++++--- .../HowItWorks/StakingApplications/index.tsx | 56 +++++++++++-------- .../StakeCard/StakeApplications/index.tsx | 13 +++-- src/pages/Staking/StakeDetailsPage/index.tsx | 9 ++- src/store/staking-applications/slice.ts | 18 +++++- 8 files changed, 90 insertions(+), 39 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx index 69a944d3b..efd50d4f7 100644 --- a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx @@ -60,6 +60,7 @@ const MapOperatorToStakingProviderConfirmationModal: FC< operator, isOperatorMappedOnlyInTbtc, isOperatorMappedOnlyInRandomBeacon, + isOperatorMappedOnlyInTaco, closeModal, }) => { const { account } = useWeb3React() @@ -155,6 +156,13 @@ const MapOperatorToStakingProviderConfirmationModal: FC< stakingProvider={account ? account : AddressZero} /> )} + {!isOperatorMappedOnlyInTaco && ( + <OperatorMappingConfirmation + appName="taco" + operator={operator} + stakingProvider={account ? account : AddressZero} + /> + )} </ModalBody> <ModalFooter> <Button onClick={closeModal} variant="outline" mr={2}> diff --git a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx index 74c5f72de..21835a6ea 100644 --- a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx @@ -90,7 +90,7 @@ const MapOperatorToStakingProviderModal: FC< <ModalCloseButton /> <ModalBody> <InfoBox variant="modal"> - {isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc ? ( + {isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc || isOperatorMappedOnlyInTaco ? ( <H5> We noticed you've only mapped 1 application's Operator Address. </H5> diff --git a/src/enums/externalHref.ts b/src/enums/externalHref.ts index 46c1dd2f4..af62c2e3f 100644 --- a/src/enums/externalHref.ts +++ b/src/enums/externalHref.ts @@ -20,6 +20,7 @@ export enum ExternalHref { infStones = "https://infstones.com/", setupNodes = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup", tbtcNodeDocs = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup", + tacoNodeDocs = "https://docs.threshold.network/applications/threshold-access-control", randomBeaconNodeDocs = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup", analyticsReports = "SOME_URL", btcRecoveryAddress = "https://github.com/keep-network/tbtc-v2/blob/main/docs/rfc/rfc-1.adoc", diff --git a/src/pages/Staking/AuthorizeStakingApps/index.tsx b/src/pages/Staking/AuthorizeStakingApps/index.tsx index 2dc24b86b..30e403477 100644 --- a/src/pages/Staking/AuthorizeStakingApps/index.tsx +++ b/src/pages/Staking/AuthorizeStakingApps/index.tsx @@ -46,27 +46,28 @@ const AuthorizeStakingAppsPage: FC = () => { const { openModal } = useModal() const tbtcAppFormRef = useRef<FormikProps<FormValues>>(null) const randomBeaconAppFormRef = useRef<FormikProps<FormValues>>(null) - const preAppFormRef = useRef<FormikProps<FormValues>>(null) + const tacoAppFormRef = useRef<FormikProps<FormValues>>(null) const stakinAppNameToFormRef: Record< AppAuthDataProps["stakingAppId"], RefObject<FormikProps<FormValues>> > = { tbtc: tbtcAppFormRef, randomBeacon: randomBeaconAppFormRef, - pre: preAppFormRef, + taco: tacoAppFormRef, } const dispatch = useAppDispatch() const tbtcAppAddress = useStakingApplicationAddress("tbtc") const randomBeaconAddress = useStakingApplicationAddress("randomBeacon") + const TACoAddress = useStakingApplicationAddress("taco") const stakinAppNameToAddress: Record< AppAuthDataProps["stakingAppId"], string > = { tbtc: tbtcAppAddress, randomBeacon: randomBeaconAddress, - pre: AddressZero, + taco: TACoAddress, } useEffect(() => { @@ -91,6 +92,10 @@ const AuthorizeStakingAppsPage: FC = () => { "randomBeacon", stakingProviderAddress || AddressZero ) + const TACoApp = useStakingAppDataByStakingProvider( + "taco", + stakingProviderAddress || AddressZero + ) const appsAuthData: { [appName: string]: AppAuthDataProps & { address?: string } @@ -108,9 +113,10 @@ const AuthorizeStakingAppsPage: FC = () => { label: "Random Beacon", }, pre: { - stakingAppId: "pre", - label: "PRE", - status: "authorization-not-required", + ...TACoApp, + stakingAppId: "taco", + label: "TACo", + address: TACoAddress, }, } @@ -285,10 +291,10 @@ const AuthorizeStakingAppsPage: FC = () => { /> <AuthorizeApplicationsCardCheckbox mt={5} - appAuthData={appsAuthData.pre} + appAuthData={appsAuthData.taco} totalInTStake={stake.totalInTStake} onCheckboxClick={onCheckboxClick} - isSelected={isAppSelected("pre")} + isSelected={isAppSelected("taco")} maxAuthAmount={stake.totalInTStake} minAuthAmount={"0"} stakingProvider={stakingProviderAddress!} diff --git a/src/pages/Staking/HowItWorks/StakingApplications/index.tsx b/src/pages/Staking/HowItWorks/StakingApplications/index.tsx index f9a00bbbe..4f88f9ada 100644 --- a/src/pages/Staking/HowItWorks/StakingApplications/index.tsx +++ b/src/pages/Staking/HowItWorks/StakingApplications/index.tsx @@ -16,6 +16,8 @@ import randomBeaconAppIllustrationLight from "../../../../static/images/randomBe import randomBeaconAppIllustrationDark from "../../../../static/images/randomBeaconAppIllustrationDark.png" import preAppIllustrationLight from "../../../../static/images/preAppIllustrationLight.png" import preAppIllustrationDark from "../../../../static/images/preAppIllustrationDark.png" +// import tacoAppIllustrationLight from "../../../../static/images/tacoAppIllustrationLight.png" +// import tacoAppIllustrationDark from "../../../../static/images/tacoAppIllustrationDark.png" import listIconStarLight from "../../../../static/images/ListIconStarLight.png" import listIconStarDark from "../../../../static/images/ListIconStarDark.png" import listIconStockLight from "../../../../static/images/ListIconStockLight.png" @@ -31,7 +33,6 @@ import { Link as RouterLink } from "react-router-dom" import { ColorMode, List, ListItem, useColorMode } from "@chakra-ui/react" import ButtonLink from "../../../../components/ButtonLink" -const preNodeSteps = ["Run a PRE node", "Have a staked balance"] const randomBeaconNodeSteps = [ "Run a Random Beacon node", "Authorize a portion of your stake to Random Beacon", @@ -42,6 +43,11 @@ const tbtcNodeSteps = [ "Authorize a portion of your stake to tBTC", "Have a staked balance", ] +const tacoNodeSteps = [ + "Run a TACO node", + "Authorize a portion of your stake to TACO", + "Have a staked balance", +] const iconMap: { [iconName: string]: Record<ColorMode, string> } = { star: { light: listIconStarLight, dark: listIconStarDark }, @@ -55,14 +61,14 @@ const iconMap: { [iconName: string]: Record<ColorMode, string> } = { light: tbtcAppIllustrationLight, dark: tbtcAppIllustrationDark, }, - pre: { - light: preAppIllustrationLight, - dark: preAppIllustrationDark, - }, randomBeacon: { light: randomBeaconAppIllustrationLight, dark: randomBeaconAppIllustrationDark, }, + taco: { + light: preAppIllustrationLight, + dark: preAppIllustrationDark, + }, } const StakingApplications: PageComponent = () => { @@ -144,6 +150,28 @@ const StakingApplications: PageComponent = () => { } rewardSteps={tbtcNodeSteps} /> + <ApplicationDetailsCard + preTitle="TACO APP" + title="TACo is an access control plug-in that makes your Web3 application more secure, more private, and much more decentralized." + description="TACo is a plug-in service that enables the sharing of any form of private or sensitive data within Web3 applications. Private data is encrypted by a data owner and remains encrypted until it reaches the device of a recipient." + imgSrc={iconMap.taco[colorMode]} + ctaButtons={ + <VStack mb={6}> + <ButtonLink to="/staking" isFullWidth> + Authorize TACO + </ButtonLink> + <ButtonLink + isExternal + href={ExternalHref.tacoNodeDocs} + isFullWidth + variant="outline" + > + TACO Node Docs + </ButtonLink> + </VStack> + } + rewardSteps={tacoNodeSteps} + /> <ApplicationDetailsCard preTitle="Random Beacon APP" title="Random Beacon is a threshold relay that can generate verifiable randomness." @@ -166,24 +194,6 @@ const StakingApplications: PageComponent = () => { } rewardSteps={randomBeaconNodeSteps} /> - <ApplicationDetailsCard - preTitle="PRE APP" - title="Proxy Re-Encryption, or PRE, is cryptographic middleware for developing privacy-preserving applications." - description="PRE is a scalable end-to-end encryption protocol that allows a proxy entity to transform (or re-encrypt) encrypted data from one encryption key to another, without revealing the plaintext data. The nodes on the Threshold Network act as these proxy entities and use threshold cryptography to securely and cooperatively re-encrypt data for recipients based on access conditions defined by the data owner. " - imgSrc={iconMap.pre[colorMode]} - ctaButtons={ - <ButtonLink - isExternal - href={ExternalHref.preNodeSetup} - mb={6} - isFullWidth - variant="outline" - > - PRE Node Docs - </ButtonLink> - } - rewardSteps={preNodeSteps} - /> </Stack> </Card> ) diff --git a/src/pages/Staking/StakeCard/StakeApplications/index.tsx b/src/pages/Staking/StakeCard/StakeApplications/index.tsx index d0bd89c43..279d053fc 100644 --- a/src/pages/Staking/StakeCard/StakeApplications/index.tsx +++ b/src/pages/Staking/StakeCard/StakeApplications/index.tsx @@ -15,20 +15,25 @@ const StakeApplications: FC<{ stakingProvider: string }> = ({ "randomBeacon", stakingProvider ) + const tacoApp = useStakingAppDataByStakingProvider("taco", stakingProvider) const isTbtcFetching = useAppSelector( (state) => state.applications.tbtc.stakingProviders.isFetching ) const isRandomBeaconFetching = useAppSelector( (state) => state.applications.randomBeacon.stakingProviders.isFetching ) + const isTacoFetching = useAppSelector( + (state) => state.applications.taco.stakingProviders.isFetching + ) const { isInactiveStake } = useStakeCardContext() return ( <Box> <BodyMd mb="4">Applications</BodyMd> - {(!tbtcApp.isAuthorized || !randomBeaconApp.isAuthorized) && + {(!tbtcApp.isAuthorized || !randomBeaconApp.isAuthorized || !tacoApp.isAuthorized) && !isTbtcFetching && + !isTacoFetching && !isRandomBeaconFetching && <BundledRewardsAlert mb="4" />} <List spacing={4}> <AuthorizeApplicationRow @@ -47,9 +52,9 @@ const StakeApplications: FC<{ stakingProvider: string }> = ({ /> <AuthorizeApplicationRow as="li" - label="PRE" - isAuthorized={true} - percentage={isInactiveStake ? 0 : 100} + label="TACo" + isAuthorized={tacoApp.isAuthorized} + percentage={tacoApp.percentage} stakingProvider={stakingProvider} /> </List> diff --git a/src/pages/Staking/StakeDetailsPage/index.tsx b/src/pages/Staking/StakeDetailsPage/index.tsx index cdb638b85..197790998 100644 --- a/src/pages/Staking/StakeDetailsPage/index.tsx +++ b/src/pages/Staking/StakeDetailsPage/index.tsx @@ -61,6 +61,11 @@ const StakeDetailsPage: FC = () => { stakingProviderAddress || AddressZero ) + const tacoApp = useStakingAppDataByStakingProvider( + "taco", + stakingProviderAddress || AddressZero + ) + const isInActiveStake = BigNumber.from(stake?.totalInTStake ?? "0").isZero() const { total: rewardsForStake } = useAppSelector((state) => @@ -134,8 +139,8 @@ const StakeDetailsPage: FC = () => { isAddress address={stake.beneficiary} /> - <StakeDetailRow label="PRE Node Status"> - <NodeStatusLabel isAuthorized /> + <StakeDetailRow label="TACo Node Status"> + <NodeStatusLabel isAuthorized={tacoApp.isAuthorized} /> </StakeDetailRow> <StakeDetailRow label="tBTC Node Status"> <NodeStatusLabel isAuthorized={tbtcApp.isAuthorized} /> diff --git a/src/store/staking-applications/slice.ts b/src/store/staking-applications/slice.ts index a7aa48883..565775747 100644 --- a/src/store/staking-applications/slice.ts +++ b/src/store/staking-applications/slice.ts @@ -40,7 +40,7 @@ export interface StakingApplicationsState { randomBeacon: StakingApplicationState } -export type StakingAppName = "tbtc" | "randomBeacon" +export type StakingAppName = "tbtc" | "randomBeacon" | "taco" export const stakingApplicationsSlice = createSlice({ name: "staking-applications", @@ -77,6 +77,22 @@ export const stakingApplicationsSlice = createSlice({ data: {}, }, }, + taco: { + parameters: { + isFetching: false, + error: "", + data: { + authorizationDecreaseChangePeriod: "0", + minimumAuthorization: "0", + authorizationDecreaseDelay: "0", + }, + }, + stakingProviders: { + isFetching: false, + error: "", + data: {}, + }, + }, } as StakingApplicationsState, reducers: { getSupportedApps: (state: StakingApplicationsState, action) => {}, From 75f2fc5019aef862cfad79f984500c8bc73057f3 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Tue, 5 Sep 2023 16:37:36 +0200 Subject: [PATCH 07/22] Continue replacing PRE with TACo --- .../index.tsx | 1 + .../index.tsx | 4 +++ .../StakingSuccessModal/StakeSuccessOld.tsx | 4 +-- .../StakingApplicationOperationIcon/index.tsx | 4 +++ src/components/StakingTimeline/index.tsx | 26 +++++++++---------- src/enums/externalHref.ts | 4 +-- .../useStakingAppContract.ts | 3 ++- .../AppAuthorizationInfo.tsx | 8 +++--- .../index.tsx | 2 +- src/store/account/selectors.ts | 10 ++++--- src/store/staking-applications/slice.ts | 1 + src/threshold-ts/mas/index.ts | 26 +++++++++++++++++-- src/utils/getStakingAppLabel.ts | 2 ++ 13 files changed, 67 insertions(+), 28 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx index efd50d4f7..9f2e15b3a 100644 --- a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx @@ -55,6 +55,7 @@ const MapOperatorToStakingProviderConfirmationModal: FC< operator: string isOperatorMappedOnlyInTbtc: boolean isOperatorMappedOnlyInRandomBeacon: boolean + isOperatorMappedOnlyInTaco: boolean } > = ({ operator, diff --git a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx index 21835a6ea..ed113e268 100644 --- a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx @@ -36,6 +36,7 @@ import ModalCloseButton from "../ModalCloseButton" export interface MapOperatorToStakingProviderModalProps { mappedOperatorTbtc: string mappedOperatorRandomBeacon: string + mappedOperatorTaco: string } const MapOperatorToStakingProviderModal: FC< @@ -50,8 +51,10 @@ const MapOperatorToStakingProviderModal: FC< const { mappedOperatorTbtc, mappedOperatorRandomBeacon, + mappedOperatorTaco, isOperatorMappedOnlyInRandomBeacon, isOperatorMappedOnlyInTbtc, + isOperatorMappedOnlyInTaco, } = useAppSelector(selectMappedOperators) const onSubmit = async ({ @@ -62,6 +65,7 @@ const MapOperatorToStakingProviderModal: FC< operator, isOperatorMappedOnlyInTbtc, isOperatorMappedOnlyInRandomBeacon, + isOperatorMappedOnlyInTaco, }) } } diff --git a/src/components/Modal/StakingSuccessModal/StakeSuccessOld.tsx b/src/components/Modal/StakingSuccessModal/StakeSuccessOld.tsx index 56983c99c..f97b4fd76 100644 --- a/src/components/Modal/StakingSuccessModal/StakeSuccessOld.tsx +++ b/src/components/Modal/StakingSuccessModal/StakeSuccessOld.tsx @@ -19,7 +19,7 @@ import { useStakingState } from "../../../hooks/useStakingState" import ViewInBlockExplorer from "../../ViewInBlockExplorer" import { ExplorerDataType } from "../../../utils/createEtherscanLink" import InfoBox from "../../InfoBox" -import { PreSetupSteps } from "../../StakingTimeline" +import { TacoSetupSteps } from "../../StakingTimeline" import ModalCloseButton from "../ModalCloseButton" const StakeSuccessOld: FC<BaseModalProps & { transactionHash: string }> = ({ @@ -52,7 +52,7 @@ const StakeSuccessOld: FC<BaseModalProps & { transactionHash: string }> = ({ Go through Step 2 to make sure you get Rewards </H5> </InfoBox> - <PreSetupSteps /> + <TacoSetupSteps /> {transactionHash && ( <BodySm mt="2.5rem !important" align="center"> <ViewInBlockExplorer diff --git a/src/components/StakingApplicationOperationIcon/index.tsx b/src/components/StakingApplicationOperationIcon/index.tsx index 995d53e4b..2e05df289 100644 --- a/src/components/StakingApplicationOperationIcon/index.tsx +++ b/src/components/StakingApplicationOperationIcon/index.tsx @@ -17,6 +17,10 @@ const iconMap: Record<StakingAppName, Record<Operation, string>> = { increase: randomBeaconIncrease, decrease: randomBeaconDecrease, }, + taco: { + increase: tbtcIncrease, + decrease: tbtcDecrease, + }, } const StakingApplicationOperationIcon: FC< diff --git a/src/components/StakingTimeline/index.tsx b/src/components/StakingTimeline/index.tsx index 9ce108207..063e9a74f 100644 --- a/src/components/StakingTimeline/index.tsx +++ b/src/components/StakingTimeline/index.tsx @@ -31,7 +31,7 @@ export const StakingDepositStepsNonMAS: FC = () => { <BodySm color={useColorModeValue("gray.500", "gray.300")}> These will be automatically set up to your wallet address. If you want to use a Staking Provider check{" "} - <Link isExternal href={ExternalHref.preStakingProvidersList}> + <Link isExternal href={ExternalHref.tacoStakingProvidersList}> this </Link> </BodySm> @@ -141,40 +141,40 @@ export const LegacyStakesDepositSteps: FC = () => { }, ]} /> - <PreSetupSteps /> + <TacoSetupSteps /> </Box> ) } -export const PreSetupSteps: FC = () => { +export const TacoSetupSteps: FC = () => { return ( <ChecklistGroup title="Step 2 - PRE Setup" checklistItems={[ { - itemId: "run_a_pre_node__0", - itemTitle: "Run a PRE Node", + itemId: "run_a_taco_node__0", + itemTitle: "Run a TACo Node", itemSubTitle: ( <BodySm color={useColorModeValue("gray.500", "gray.300")}> - You will need to run a PRE node to get rewards. If you don’t have + You will need to run a TACo node to get rewards. If you don’t have one, learn how to do it here{" "} - <Link isExternal href={ExternalHref.preNodeSetup}> + <Link isExternal href={ExternalHref.tacoNodeSetup}> here </Link> , or contact{" "} - <Link isExternal href={ExternalHref.preStakingProvidersList}> + <Link isExternal href={ExternalHref.tacoStakingProvidersList}> a staking provider </Link> </BodySm> ), }, { - itemId: "run_a_pre_node__1", - itemTitle: "PRE Operator address", + itemId: "run_a_taco_node__1", + itemTitle: "TACo Operator address", itemSubTitle: ( <BodySm color={useColorModeValue("gray.500", "gray.300")}> - Make sure you add your PRE Operator address{" "} - <Link isExternal href={ExternalHref.preNodeSetup}> + Make sure you add your TACo Operator address{" "} + <Link isExternal href={ExternalHref.tacoNodeSetup}> here </Link>{" "} to gain rewards. @@ -236,7 +236,7 @@ const StakingTimeline: FC<{ statuses?: FlowStepStatus[] } & StackProps> = ({ <StakingDepositStepsNonMAS /> </Box> <Box> - <PreSetupSteps /> + <TacoSetupSteps /> </Box> </Stack> ) diff --git a/src/enums/externalHref.ts b/src/enums/externalHref.ts index af62c2e3f..dc1a239ec 100644 --- a/src/enums/externalHref.ts +++ b/src/enums/externalHref.ts @@ -3,8 +3,8 @@ export enum ExternalHref { thresholdDiscord = "https://discord.gg/WXK9PC6SRF", metamaskHomePage = "https://metamask.io/", stakingContractLeanMore = "https://github.com/threshold-network/solidity-contracts/issues/53", - preNodeSetup = "https://docs.nucypher.com/en/latest/pre_application/running_a_node.html", - preStakingProvidersList = "https://docs.nucypher.com/en/latest/pre_application/node_providers.html", + tacoNodeSetup = "https://docs.nucypher.com/en/latest/pre_application/running_a_node.html", + tacoStakingProvidersList = "https://docs.nucypher.com/en/latest/pre_application/node_providers.html", exchangeRateLearnMore = "https://blog.threshold.network/threshold-launch/", keepDapp = "https://dashboard.keep.network/", keepDappAuthPage = "https://dashboard.keep.network/applications/threshold", diff --git a/src/hooks/staking-applications/useStakingAppContract.ts b/src/hooks/staking-applications/useStakingAppContract.ts index 994036910..f80845305 100644 --- a/src/hooks/staking-applications/useStakingAppContract.ts +++ b/src/hooks/staking-applications/useStakingAppContract.ts @@ -3,10 +3,11 @@ import { useThreshold } from "../../contexts/ThresholdContext" export const stakingAppNameToThresholdAppService: Record< StakingAppName, - "ecdsa" | "randomBeacon" + "ecdsa" | "randomBeacon" | "taco" > = { tbtc: "ecdsa", randomBeacon: "randomBeacon", + taco: "taco", } export const useStakingAppContract = (appName: StakingAppName) => { diff --git a/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/AppAuthorizationInfo.tsx b/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/AppAuthorizationInfo.tsx index cc1588bf1..95f701bdd 100644 --- a/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/AppAuthorizationInfo.tsx +++ b/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/AppAuthorizationInfo.tsx @@ -21,7 +21,7 @@ import { AuthorizationStatus } from "../../../../types" interface CommonProps { label: string percentageAuthorized: number - stakingAppName: StakingAppName | "pre" + stakingAppName: StakingAppName } type ConditionalProps = @@ -42,7 +42,7 @@ const TooltipLearnMoreLink = () => { return <Link to="/staking/how-it-works/applications">here</Link> } -const tooltipText: Record<StakingAppName | "pre", JSX.Element> = { +const tooltipText: Record<StakingAppName, JSX.Element> = { tbtc: ( <> The tBTC application is the first decentralized bridge from Bitcoin to @@ -55,9 +55,9 @@ const tooltipText: Record<StakingAppName | "pre", JSX.Element> = { selection. Learn more <TooltipLearnMoreLink />. </> ), - pre: ( + taco: ( <> - The PRE application is cryptographic middleware for developing + The TACo application is cryptographic middleware for developing privacy-preserving applications. Learn more <TooltipLearnMoreLink />. . </> ), diff --git a/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/index.tsx b/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/index.tsx index 4c6b530e2..aa42c3c3a 100644 --- a/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/index.tsx +++ b/src/pages/Staking/AuthorizeStakingApps/AuthorizeApplicationsCardCheckbox/index.tsx @@ -37,7 +37,7 @@ import { StakingAppForm } from "../../../../components/StakingApplicationForms" import { AuthorizationStatus } from "../../../../types" interface CommonProps { - stakingAppId: StakingAppName | "pre" + stakingAppId: StakingAppName label: string } diff --git a/src/store/account/selectors.ts b/src/store/account/selectors.ts index 9cb2fdc85..44c3d4235 100644 --- a/src/store/account/selectors.ts +++ b/src/store/account/selectors.ts @@ -8,17 +8,21 @@ export const selectAccountState = (state: RootState) => state.account export const selectMappedOperators = createSelector( [selectAccountState], (accountState: AccountState) => { - const { randomBeacon, tbtc } = accountState.operatorMapping.data + const { randomBeacon, tbtc, taco } = accountState.operatorMapping.data const isOperatorMappedOnlyInTbtc = - !isAddressZero(tbtc) && isAddressZero(randomBeacon) + !isAddressZero(tbtc) && isAddressZero(randomBeacon) && isAddressZero(taco) const isOperatorMappedOnlyInRandomBeacon = - isAddressZero(tbtc) && !isAddressZero(randomBeacon) + isAddressZero(tbtc) && !isAddressZero(randomBeacon) && isAddressZero(taco) + const isOperatorMappedOnlyInTaco = + isAddressZero(tbtc) && isAddressZero(randomBeacon) && !isAddressZero(taco) return { mappedOperatorTbtc: tbtc, mappedOperatorRandomBeacon: randomBeacon, + mappedOperatorTaco: taco, isOperatorMappedOnlyInTbtc, isOperatorMappedOnlyInRandomBeacon, + isOperatorMappedOnlyInTaco, isOneOfTheAppsNotMapped: isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc, isOperatorMappedInBothApps: diff --git a/src/store/staking-applications/slice.ts b/src/store/staking-applications/slice.ts index 565775747..f6df67952 100644 --- a/src/store/staking-applications/slice.ts +++ b/src/store/staking-applications/slice.ts @@ -38,6 +38,7 @@ export type StakingApplicationState = { export interface StakingApplicationsState { tbtc: StakingApplicationState randomBeacon: StakingApplicationState + taco: StakingApplicationState } export type StakingAppName = "tbtc" | "randomBeacon" | "taco" diff --git a/src/threshold-ts/mas/index.ts b/src/threshold-ts/mas/index.ts index f63a84e9c..815c87253 100644 --- a/src/threshold-ts/mas/index.ts +++ b/src/threshold-ts/mas/index.ts @@ -12,11 +12,13 @@ import { EthereumConfig } from "../types" export interface SupportedAppAuthorizationParameters { tbtc: AuthorizationParameters randomBeacon: AuthorizationParameters + taco: AuthorizationParameters } export interface MappedOperatorsForStakingProvider { tbtc: string randomBeacon: string + taco: string } export class MultiAppStaking { @@ -24,6 +26,7 @@ export class MultiAppStaking { private _multicall: IMulticall public readonly randomBeacon: IApplication public readonly ecdsa: IApplication + public readonly taco: IApplication constructor( staking: IStaking, @@ -42,6 +45,11 @@ export class MultiAppStaking { abi: WalletRegistry.abi, ...config, }) + this.taco = new Application(this._staking, this._multicall, { + address: WalletRegistry.address, // TODO + abi: WalletRegistry.abi, // TODO + ...config, + }) } async getSupportedAppsAuthParameters(): Promise<SupportedAppAuthorizationParameters> { @@ -58,14 +66,21 @@ export class MultiAppStaking { method: "authorizationParameters", args: [], }, + { + interface: this.taco.contract.interface, + address: this.taco.address, + method: "authorizationParameters", + args: [], + }, ] - const [tbtcMinAuthorizationParams, randomBeaconMinAuthorizationParams] = + const [tbtcMinAuthorizationParams, randomBeaconMinAuthorizationParams, tacoMinAuthorizationParams] = await this._multicall.aggregate(calls) return { tbtc: tbtcMinAuthorizationParams, randomBeacon: randomBeaconMinAuthorizationParams, + taco: tacoMinAuthorizationParams, } } @@ -85,14 +100,21 @@ export class MultiAppStaking { method: "stakingProviderToOperator", args: [stakingProvider], }, + { + interface: this.taco.contract.interface, + address: this.taco.address, + method: "stakingProviderToOperator", + args: [stakingProvider], + }, ] - const [mappedOperatorTbtc, mappedOperatorRandomBeacon] = + const [mappedOperatorTbtc, mappedOperatorRandomBeacon, mappedOperatorTaco] = await this._multicall.aggregate(calls) return { tbtc: mappedOperatorTbtc.toString(), randomBeacon: mappedOperatorRandomBeacon.toString(), + taco: mappedOperatorTaco.toString(), } } } diff --git a/src/utils/getStakingAppLabel.ts b/src/utils/getStakingAppLabel.ts index f8ce7ec95..38abc343b 100644 --- a/src/utils/getStakingAppLabel.ts +++ b/src/utils/getStakingAppLabel.ts @@ -4,12 +4,14 @@ import { StakingAppName } from "../store/staking-applications" const stakingAppNameToAppLabel: Record<StakingAppName, string> = { tbtc: "tBTC", randomBeacon: "Random Beacon", + taco: "TACo" } const stakingAppAddressToName: { [key: string]: string } = { [threshold.multiAppStaking.ecdsa.address]: stakingAppNameToAppLabel.tbtc, [threshold.multiAppStaking.randomBeacon.address]: stakingAppNameToAppLabel.randomBeacon, + [threshold.multiAppStaking.taco.address]: stakingAppNameToAppLabel.taco } export const getStakingAppNameFromAddress = (stakingAppAddress: string) => { From 69955e80f1558c854d40877629bff3b54ac6d7df Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Mon, 11 Sep 2023 14:02:39 +0200 Subject: [PATCH 08/22] Update staking application authorization form --- .../index.tsx | 8 +++---- .../NewStakerAuthorizationForm.tsx | 22 +++++++++++++++++++ .../index.tsx | 19 ++++++++++++++++ src/components/StakingTimeline/index.tsx | 6 ++--- 4 files changed, 48 insertions(+), 7 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx index 9f2e15b3a..dfdc69ef7 100644 --- a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx @@ -136,10 +136,10 @@ const MapOperatorToStakingProviderConfirmationModal: FC< You are about to map Operator Addresses to your Provider Address </H5> <BodyLg mt="4"> - This will require{" "} - {isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc - ? "1 transaction" - : "2 transactions"} + This will require{" "} + {isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc || isOperatorMappedOnlyInTaco + ? "2 transaction" + : "3 transactions"} . Each mapping is one transaction </BodyLg> </InfoBox> diff --git a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx index cd49f3564..86e3d7c1a 100644 --- a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx +++ b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx @@ -22,6 +22,8 @@ export type FormValues = { isTbtcChecked: boolean randomBeaconAmountToAuthorize: string | number isRandomBeaconChecked: boolean + tacoAmountToAuthorize: string | number + isTacoChecked: boolean } export interface AuthInputConstraints { @@ -33,6 +35,7 @@ interface Props { onSubmitForm: (values: FormValues) => void tbtcInputConstraints: AuthInputConstraints randomBeaconInputConstraints: AuthInputConstraints + tacoInputConstraints: AuthInputConstraints } export const formikWrapper = withFormik<Props, FormValues>({ @@ -44,6 +47,8 @@ export const formikWrapper = withFormik<Props, FormValues>({ isTbtcChecked: true, randomBeaconAmountToAuthorize: props.randomBeaconInputConstraints.max, isRandomBeaconChecked: true, + tacoAmountToAuthorize: props.tacoInputConstraints.max, + isTacoChecked: true, }), validate: (values, props) => { const errors: FormikErrors<FormValues> = {} @@ -59,6 +64,12 @@ export const formikWrapper = withFormik<Props, FormValues>({ props.randomBeaconInputConstraints.max.toString(), props.randomBeaconInputConstraints.min.toString() ) + + errors.tacoAmountToAuthorize = validateAmountInRange( + values?.tacoAmountToAuthorize?.toString(), + props.tacoInputConstraints.max.toString(), + props.tacoInputConstraints.min.toString() + ) return getErrorsObj(errors) }, displayName: "AuthorizationForm", @@ -67,11 +78,13 @@ export const formikWrapper = withFormik<Props, FormValues>({ const NewStakerAuthorizationForm: FC<Props & FormikProps<FormValues>> = ({ tbtcInputConstraints, randomBeaconInputConstraints, + tacoInputConstraints, handleSubmit, }) => { const { closeModal } = useModal() const [, { value: isTbtcChecked }] = useField("isTbtcChecked") const [, { value: isRandomBeaconChecked }] = useField("isRandomBeaconChecked") + const [, { value: isTacoChecked }] = useField("isTbtcChecked") const bothAppsChecked = isTbtcChecked && isRandomBeaconChecked return ( @@ -104,6 +117,15 @@ const NewStakerAuthorizationForm: FC<Props & FormikProps<FormValues>> = ({ </BodyXs> </Alert> )} + <NewStakerAuthorizationCard + stakingAppName="taco" + min={tacoInputConstraints.min} + max={tacoInputConstraints.max} + inputId="tacoAmountToAuthorize" + checkBoxId="isTacoBeaconChecked" + label="TACo" + mb={6} + /> </Box> <Card bg="gray.50" boxShadow="none" mb={6}> <HStack justifyContent="space-between"> diff --git a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx index d4d9929a8..01814cad6 100644 --- a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx +++ b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx @@ -34,6 +34,8 @@ const NewStakerAuthorizeStakingApplicationModal: FC<BaseModalProps> = () => { const randomBeaconMinAuthAmount = useStakingAppMinAuthorizationAmount("randomBeacon") + const tacoMinAuthAmount = useStakingAppMinAuthorizationAmount("taco") + const tbtcInputConstraints = useMemo( () => ({ min: tbtcMinAuthAmount, @@ -50,8 +52,17 @@ const NewStakerAuthorizeStakingApplicationModal: FC<BaseModalProps> = () => { [stakeAmount, randomBeaconMinAuthAmount] ) + const tacoInputConstraints = useMemo( + () => ({ + min: tacoMinAuthAmount, + max: stakeAmount, + }), + [stakeAmount, tacoMinAuthAmount] + ) + const tbtcAppAddress = useStakingApplicationAddress("tbtc") const randomBeaconAppAddress = useStakingApplicationAddress("randomBeacon") + const tacoAppAddress = useStakingApplicationAddress("taco") const handleSubmit = (vals: FormValues) => { const tbtcAppInfo = { @@ -66,9 +77,16 @@ const NewStakerAuthorizeStakingApplicationModal: FC<BaseModalProps> = () => { authorizationAmount: vals.randomBeaconAmountToAuthorize, } + const tacoAppInfo = { + appName: "taco", + address: tacoAppAddress, + authorizationAmount: vals.tacoAmountToAuthorize, + } + const applications = [ vals.isRandomBeaconChecked ? randomBeaconAppInfo : null, vals.isTbtcChecked ? tbtcAppInfo : null, + vals.isTacoChecked ? tacoAppInfo: null, ].filter(Boolean) openModal(ModalType.AuthorizeStakingApps, { @@ -104,6 +122,7 @@ const NewStakerAuthorizeStakingApplicationModal: FC<BaseModalProps> = () => { <NewStakerAuthorizationForm tbtcInputConstraints={tbtcInputConstraints} randomBeaconInputConstraints={randomBeaconInputConstraints} + tacoInputConstraints={tacoInputConstraints} onSubmitForm={handleSubmit} /> </Stack> diff --git a/src/components/StakingTimeline/index.tsx b/src/components/StakingTimeline/index.tsx index 063e9a74f..67ac8d9b7 100644 --- a/src/components/StakingTimeline/index.tsx +++ b/src/components/StakingTimeline/index.tsx @@ -89,8 +89,8 @@ export const LegacyStakesDepositSteps: FC = () => { size="sm" > <BodyMd> - For each stake, there are three applications available. PRE does not - require authorization. To authorize tBTC and Random Beacon, go to + For each stake, there are three applications available. To authorize tBTC, TACo, + and Random Beacon, go to the <Link to="/staking">Staking Page</Link> and select “Configure Stake”. </BodyMd> @@ -149,7 +149,7 @@ export const LegacyStakesDepositSteps: FC = () => { export const TacoSetupSteps: FC = () => { return ( <ChecklistGroup - title="Step 2 - PRE Setup" + title="Step 2 - TACo Setup" checklistItems={[ { itemId: "run_a_taco_node__0", From 661e32bf6306622b37f0388674c3c1b9f422cb58 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Thu, 14 Sep 2023 12:38:05 +0200 Subject: [PATCH 09/22] Apply wording change Co-authored-by: Arjun Hassard <arjunhassard@gmail.com> --- src/pages/Staking/HowItWorks/StakingApplications/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Staking/HowItWorks/StakingApplications/index.tsx b/src/pages/Staking/HowItWorks/StakingApplications/index.tsx index 4f88f9ada..608449557 100644 --- a/src/pages/Staking/HowItWorks/StakingApplications/index.tsx +++ b/src/pages/Staking/HowItWorks/StakingApplications/index.tsx @@ -152,7 +152,7 @@ const StakingApplications: PageComponent = () => { /> <ApplicationDetailsCard preTitle="TACO APP" - title="TACo is an access control plug-in that makes your Web3 application more secure, more private, and much more decentralized." + title="TACo is an access control layer that enables decentralized e2e encrypted data sharing in Web3 applications." description="TACo is a plug-in service that enables the sharing of any form of private or sensitive data within Web3 applications. Private data is encrypted by a data owner and remains encrypted until it reaches the device of a recipient." imgSrc={iconMap.taco[colorMode]} ctaButtons={ From 88c76802936b2ff3344b40c512fc52215fc96ff8 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Thu, 14 Sep 2023 12:38:22 +0200 Subject: [PATCH 10/22] Apply review wording change Co-authored-by: Arjun Hassard <arjunhassard@gmail.com> --- src/pages/Staking/HowItWorks/StakingApplications/index.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/pages/Staking/HowItWorks/StakingApplications/index.tsx b/src/pages/Staking/HowItWorks/StakingApplications/index.tsx index 608449557..907ef271f 100644 --- a/src/pages/Staking/HowItWorks/StakingApplications/index.tsx +++ b/src/pages/Staking/HowItWorks/StakingApplications/index.tsx @@ -153,7 +153,7 @@ const StakingApplications: PageComponent = () => { <ApplicationDetailsCard preTitle="TACO APP" title="TACo is an access control layer that enables decentralized e2e encrypted data sharing in Web3 applications." - description="TACo is a plug-in service that enables the sharing of any form of private or sensitive data within Web3 applications. Private data is encrypted by a data owner and remains encrypted until it reaches the device of a recipient." + description="TACo is a plug-in access control layer and cryptographic primitive, operationally distributed across a cohort of Threshold nodes. Private data are encrypted by a data owner along with embedded access conditions. The data remain encrypted until it reaches the device of a qualifying recipient." imgSrc={iconMap.taco[colorMode]} ctaButtons={ <VStack mb={6}> From 743e9038f0ef823365dc82e0db6cecd1667c9cbf Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Thu, 14 Sep 2023 12:38:58 +0200 Subject: [PATCH 11/22] Update documentation urls Co-authored-by: Arjun Hassard <arjunhassard@gmail.com> --- src/enums/externalHref.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/enums/externalHref.ts b/src/enums/externalHref.ts index dc1a239ec..8d92ca366 100644 --- a/src/enums/externalHref.ts +++ b/src/enums/externalHref.ts @@ -20,7 +20,7 @@ export enum ExternalHref { infStones = "https://infstones.com/", setupNodes = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup", tbtcNodeDocs = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup", - tacoNodeDocs = "https://docs.threshold.network/applications/threshold-access-control", + tacoNodeDocs = "https://docs.threshold.network/staking-and-running-a-node/running-a-node/self-managed/taco-node-setup", randomBeaconNodeDocs = "https://docs.threshold.network/guides/threshold-applications/tbtc-v2-client-setup", analyticsReports = "SOME_URL", btcRecoveryAddress = "https://github.com/keep-network/tbtc-v2/blob/main/docs/rfc/rfc-1.adoc", From 72600d23cfdcdace4a00e9ab275bac4398a002e3 Mon Sep 17 00:00:00 2001 From: Kieran Prasch <kieranprasch@gmail.com> Date: Mon, 18 Sep 2023 15:05:42 +0200 Subject: [PATCH 12/22] automated linting --- .../index.tsx | 6 ++++-- .../Modal/MapOperatorToStakingProviderModal/index.tsx | 4 +++- .../NewStakerAuthorizeStakingApplicationModal/index.tsx | 2 +- src/components/StakingTimeline/index.tsx | 6 +++--- src/pages/Staking/StakeCard/StakeApplications/index.tsx | 4 +++- src/threshold-ts/mas/index.ts | 7 +++++-- src/utils/getStakingAppLabel.ts | 4 ++-- 7 files changed, 21 insertions(+), 12 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx index dfdc69ef7..6a4b64916 100644 --- a/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderConfirmationModal/index.tsx @@ -136,8 +136,10 @@ const MapOperatorToStakingProviderConfirmationModal: FC< You are about to map Operator Addresses to your Provider Address </H5> <BodyLg mt="4"> - This will require{" "} - {isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc || isOperatorMappedOnlyInTaco + This will require{" "} + {isOperatorMappedOnlyInRandomBeacon || + isOperatorMappedOnlyInTbtc || + isOperatorMappedOnlyInTaco ? "2 transaction" : "3 transactions"} . Each mapping is one transaction diff --git a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx index ed113e268..4253ca3d6 100644 --- a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx @@ -94,7 +94,9 @@ const MapOperatorToStakingProviderModal: FC< <ModalCloseButton /> <ModalBody> <InfoBox variant="modal"> - {isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc || isOperatorMappedOnlyInTaco ? ( + {isOperatorMappedOnlyInRandomBeacon || + isOperatorMappedOnlyInTbtc || + isOperatorMappedOnlyInTaco ? ( <H5> We noticed you've only mapped 1 application's Operator Address. </H5> diff --git a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx index 01814cad6..7e21e0298 100644 --- a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx +++ b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/index.tsx @@ -86,7 +86,7 @@ const NewStakerAuthorizeStakingApplicationModal: FC<BaseModalProps> = () => { const applications = [ vals.isRandomBeaconChecked ? randomBeaconAppInfo : null, vals.isTbtcChecked ? tbtcAppInfo : null, - vals.isTacoChecked ? tacoAppInfo: null, + vals.isTacoChecked ? tacoAppInfo : null, ].filter(Boolean) openModal(ModalType.AuthorizeStakingApps, { diff --git a/src/components/StakingTimeline/index.tsx b/src/components/StakingTimeline/index.tsx index 67ac8d9b7..4aa7f67cb 100644 --- a/src/components/StakingTimeline/index.tsx +++ b/src/components/StakingTimeline/index.tsx @@ -89,9 +89,9 @@ export const LegacyStakesDepositSteps: FC = () => { size="sm" > <BodyMd> - For each stake, there are three applications available. To authorize tBTC, TACo, - and Random Beacon, go to - the <Link to="/staking">Staking Page</Link> and select “Configure + For each stake, there are three applications available. To authorize + tBTC, TACo, and Random Beacon, go to the{" "} + <Link to="/staking">Staking Page</Link> and select “Configure Stake”. </BodyMd> </FlowStep> diff --git a/src/pages/Staking/StakeCard/StakeApplications/index.tsx b/src/pages/Staking/StakeCard/StakeApplications/index.tsx index 279d053fc..e87b993b1 100644 --- a/src/pages/Staking/StakeCard/StakeApplications/index.tsx +++ b/src/pages/Staking/StakeCard/StakeApplications/index.tsx @@ -31,7 +31,9 @@ const StakeApplications: FC<{ stakingProvider: string }> = ({ return ( <Box> <BodyMd mb="4">Applications</BodyMd> - {(!tbtcApp.isAuthorized || !randomBeaconApp.isAuthorized || !tacoApp.isAuthorized) && + {(!tbtcApp.isAuthorized || + !randomBeaconApp.isAuthorized || + !tacoApp.isAuthorized) && !isTbtcFetching && !isTacoFetching && !isRandomBeaconFetching && <BundledRewardsAlert mb="4" />} diff --git a/src/threshold-ts/mas/index.ts b/src/threshold-ts/mas/index.ts index 815c87253..9715f759c 100644 --- a/src/threshold-ts/mas/index.ts +++ b/src/threshold-ts/mas/index.ts @@ -74,8 +74,11 @@ export class MultiAppStaking { }, ] - const [tbtcMinAuthorizationParams, randomBeaconMinAuthorizationParams, tacoMinAuthorizationParams] = - await this._multicall.aggregate(calls) + const [ + tbtcMinAuthorizationParams, + randomBeaconMinAuthorizationParams, + tacoMinAuthorizationParams, + ] = await this._multicall.aggregate(calls) return { tbtc: tbtcMinAuthorizationParams, diff --git a/src/utils/getStakingAppLabel.ts b/src/utils/getStakingAppLabel.ts index 38abc343b..383cb55bc 100644 --- a/src/utils/getStakingAppLabel.ts +++ b/src/utils/getStakingAppLabel.ts @@ -4,14 +4,14 @@ import { StakingAppName } from "../store/staking-applications" const stakingAppNameToAppLabel: Record<StakingAppName, string> = { tbtc: "tBTC", randomBeacon: "Random Beacon", - taco: "TACo" + taco: "TACo", } const stakingAppAddressToName: { [key: string]: string } = { [threshold.multiAppStaking.ecdsa.address]: stakingAppNameToAppLabel.tbtc, [threshold.multiAppStaking.randomBeacon.address]: stakingAppNameToAppLabel.randomBeacon, - [threshold.multiAppStaking.taco.address]: stakingAppNameToAppLabel.taco + [threshold.multiAppStaking.taco.address]: stakingAppNameToAppLabel.taco, } export const getStakingAppNameFromAddress = (stakingAppAddress: string) => { From 7830f06b5321d0560cc352861c816346726d8ea6 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Mon, 18 Sep 2023 15:38:36 +0200 Subject: [PATCH 13/22] feat(store): add taco to operator info --- src/components/StakingTimeline/index.tsx | 4 ++-- src/store/account/effects.ts | 1 + src/store/account/slice.ts | 5 ++++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/StakingTimeline/index.tsx b/src/components/StakingTimeline/index.tsx index 4aa7f67cb..b3a709f56 100644 --- a/src/components/StakingTimeline/index.tsx +++ b/src/components/StakingTimeline/index.tsx @@ -211,8 +211,8 @@ const StakingTimeline: FC<{ statuses?: FlowStepStatus[] } & StackProps> = ({ preTitle="Step 2" status={statuses[1] ?? FlowStepStatus.inactive} > - For each stake, there are three applications available. PRE does not - require authorization. To authorize tBTC and Random Beacon, go to the{" "} + For each stake, there are three applications available. + To authorize tBTC, Random Beacon, and TACo, go to the{" "} <Link to="/staking">Staking page</Link> and select “Configure Stake”. </FlowStep> <FlowStep diff --git a/src/store/account/effects.ts b/src/store/account/effects.ts index a4f23ecbc..54be0b50e 100644 --- a/src/store/account/effects.ts +++ b/src/store/account/effects.ts @@ -51,6 +51,7 @@ export const getStakingProviderOperatorInfo = async ( setMappedOperators({ tbtc: mappedOperators.tbtc, randomBeacon: mappedOperators.randomBeacon, + taco: mappedOperators.taco, }) ) } catch (error: any) { diff --git a/src/store/account/slice.ts b/src/store/account/slice.ts index 570f397f8..0bf63e6eb 100644 --- a/src/store/account/slice.ts +++ b/src/store/account/slice.ts @@ -27,6 +27,7 @@ export const accountSlice = createSlice({ data: { tbtc: AddressZero, randomBeacon: AddressZero, + taco: AddressZero, }, isFetching: false, isInitialFetchDone: false, @@ -47,11 +48,13 @@ export const accountSlice = createSlice({ action: PayloadAction<{ tbtc: string randomBeacon: string + taco: string }> ) => { - const { tbtc, randomBeacon } = action.payload + const { tbtc, randomBeacon, taco } = action.payload state.operatorMapping.data.tbtc = tbtc state.operatorMapping.data.randomBeacon = randomBeacon + state.operatorMapping.data.taco = taco state.operatorMapping.isFetching = false state.operatorMapping.isInitialFetchDone = true state.operatorMapping.error = "" From b1a7adb3c74a4fb038f2d5f77e487d1e9ebf791a Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Mon, 18 Sep 2023 15:55:16 +0200 Subject: [PATCH 14/22] feat: Update labels and add TACo app mapping --- .../index.tsx | 2 +- .../NewStakerAuthorizationForm.tsx | 14 ++------ ...useRegisterMultipleOperatorsTransaction.ts | 34 +++++++++++++++---- src/store/account/selectors.ts | 6 ++-- 4 files changed, 35 insertions(+), 21 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx index 4253ca3d6..2bea1d1ca 100644 --- a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx @@ -128,7 +128,7 @@ const MapOperatorToStakingProviderModal: FC< ) : isOperatorMappedOnlyInTbtc ? ( <LabelSm>random beacon app</LabelSm> ) : ( - <LabelSm>tBTC + Random Beacon apps (requires 2txs)</LabelSm> + <LabelSm>tBTC + Random Beacon + TACo apps (requires 3txs)</LabelSm> )} <StakeAddressInfo stakingProvider={account ? account : AddressZero} /> <MapOperatorToStakingProviderForm diff --git a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx index 86e3d7c1a..0ba018764 100644 --- a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx +++ b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx @@ -84,7 +84,7 @@ const NewStakerAuthorizationForm: FC<Props & FormikProps<FormValues>> = ({ const { closeModal } = useModal() const [, { value: isTbtcChecked }] = useField("isTbtcChecked") const [, { value: isRandomBeaconChecked }] = useField("isRandomBeaconChecked") - const [, { value: isTacoChecked }] = useField("isTbtcChecked") + const [, { value: isTacoChecked }] = useField("isTacoChecked") const bothAppsChecked = isTbtcChecked && isRandomBeaconChecked return ( @@ -122,25 +122,17 @@ const NewStakerAuthorizationForm: FC<Props & FormikProps<FormValues>> = ({ min={tacoInputConstraints.min} max={tacoInputConstraints.max} inputId="tacoAmountToAuthorize" - checkBoxId="isTacoBeaconChecked" + checkBoxId="isTacoChecked" label="TACo" mb={6} /> </Box> - <Card bg="gray.50" boxShadow="none" mb={6}> - <HStack justifyContent="space-between"> - <LabelMd color="gray.500">PRE</LabelMd> - <Badge variant={"subtle"} colorScheme="gray" color={"gray.500"}> - Authorization not required - </Badge> - </HStack> - </Card> <HStack mb={6} justifyContent="flex-end"> <Button onClick={closeModal} variant="outline" mr={2}> Cancel </Button> <Button - disabled={isTbtcChecked === false && isRandomBeaconChecked === false} + disabled={isTbtcChecked === false && isRandomBeaconChecked === false && isTacoChecked === false} type="submit" > Authorize Selected Apps diff --git a/src/hooks/staking-applications/useRegisterMultipleOperatorsTransaction.ts b/src/hooks/staking-applications/useRegisterMultipleOperatorsTransaction.ts index 97443947c..a84627926 100644 --- a/src/hooks/staking-applications/useRegisterMultipleOperatorsTransaction.ts +++ b/src/hooks/staking-applications/useRegisterMultipleOperatorsTransaction.ts @@ -12,7 +12,9 @@ export const useRegisterMultipleOperatorsTransaction = () => { const { mappedOperatorTbtc, mappedOperatorRandomBeacon, - isOperatorMappedInBothApps, + mappedOperatorTaco, + isOperatorMappedOnlyInTaco, + isOperatorMappedInAllApps, isOperatorMappedOnlyInRandomBeacon, isOperatorMappedOnlyInTbtc, } = useAppSelector((state) => selectMappedOperators(state)) @@ -28,6 +30,10 @@ export const useRegisterMultipleOperatorsTransaction = () => { sendTransaction: sendRegisterOperatorTransactionRandomBeacon, status: registerOperatorRandomBeaconStatus, } = useRegisterOperatorTransaction("randomBeacon") + const { + sendTransaction: sendRegisterOperatorTransactionTaco, + status: registerOperatorTacoStatus, + } = useRegisterOperatorTransaction("taco") const registerMultipleOperators = useCallback( async (operator: string) => { @@ -36,8 +42,8 @@ export const useRegisterMultipleOperatorsTransaction = () => { throw new Error("Connect to the staking provider account first!") } - if (isOperatorMappedInBothApps) - throw new Error("Both apps already have mapped operator!") + if (isOperatorMappedInAllApps) + throw new Error("All apps already have mapped operator!") if (isOperatorMappedOnlyInRandomBeacon) throw new Error("Random beacon app already has mapped operator!") @@ -45,6 +51,8 @@ export const useRegisterMultipleOperatorsTransaction = () => { if (isOperatorMappedOnlyInTbtc) throw new Error("Tbtc app already have mapped operator!") + if (isOperatorMappedOnlyInTaco) + throw new Error("TACo app already have mapped operator!") // TODO: might also add a check if the operator is already used by another staking provider const successfullTxs: OperatorMappedSuccessTx[] = [] @@ -71,11 +79,22 @@ export const useRegisterMultipleOperatorsTransaction = () => { txHash: randomBeaconReceipt.transactionHash, }) } + const tacoReceipt = await sendRegisterOperatorTransactionTaco(operator) + if (tacoReceipt) { + successfullTxs.push({ + application: { + appName: "taco", + operator: operator, + stakingProvider: account, + }, + txHash: tacoReceipt.transactionHash, + }) + } - if (successfullTxs.length < 2) { + if (successfullTxs.length < 3) { openModal(ModalType.TransactionFailed, { error: new Error( - "Transaction rejected. You are required to map the Operator Address for both apps." + "Transaction rejected. You are required to map the Operator Address for all apps." ), closeModal: () => { closeModal() @@ -84,7 +103,7 @@ export const useRegisterMultipleOperatorsTransaction = () => { }) } - if (successfullTxs.length === 2) { + if (successfullTxs.length === 3) { openModal(ModalType.MapOperatorToStakingProviderSuccess, { transactions: successfullTxs, }) @@ -106,8 +125,10 @@ export const useRegisterMultipleOperatorsTransaction = () => { account, mappedOperatorRandomBeacon, mappedOperatorTbtc, + mappedOperatorTaco, sendRegisterOperatorTransactionTbtc, sendRegisterOperatorTransactionRandomBeacon, + sendRegisterOperatorTransactionTaco, openModal, ] ) @@ -116,5 +137,6 @@ export const useRegisterMultipleOperatorsTransaction = () => { registerMultipleOperators, registerOperatorTbtcStatus, registerOperatorRandomBeaconStatus, + registerOperatorTacoStatus, } } diff --git a/src/store/account/selectors.ts b/src/store/account/selectors.ts index 44c3d4235..8a2d479c6 100644 --- a/src/store/account/selectors.ts +++ b/src/store/account/selectors.ts @@ -24,9 +24,9 @@ export const selectMappedOperators = createSelector( isOperatorMappedOnlyInRandomBeacon, isOperatorMappedOnlyInTaco, isOneOfTheAppsNotMapped: - isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc, - isOperatorMappedInBothApps: - !isAddressZero(randomBeacon) && !isAddressZero(tbtc), + isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc || isOperatorMappedOnlyInTaco, + isOperatorMappedInAllApps: + !isAddressZero(randomBeacon) && !isAddressZero(tbtc) && !isAddressZero(taco), } } ) From 1cfb739f69baa203745ed42246816018f63059c8 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Mon, 18 Sep 2023 16:05:53 +0200 Subject: [PATCH 15/22] refactor: Rename variable TACoApp to tacoApp --- .../Staking/AuthorizeStakingApps/index.tsx | 22 ++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/src/pages/Staking/AuthorizeStakingApps/index.tsx b/src/pages/Staking/AuthorizeStakingApps/index.tsx index 30e403477..930168ba7 100644 --- a/src/pages/Staking/AuthorizeStakingApps/index.tsx +++ b/src/pages/Staking/AuthorizeStakingApps/index.tsx @@ -92,7 +92,7 @@ const AuthorizeStakingAppsPage: FC = () => { "randomBeacon", stakingProviderAddress || AddressZero ) - const TACoApp = useStakingAppDataByStakingProvider( + const tacoApp = useStakingAppDataByStakingProvider( "taco", stakingProviderAddress || AddressZero ) @@ -112,8 +112,8 @@ const AuthorizeStakingAppsPage: FC = () => { address: randomBeaconAddress, label: "Random Beacon", }, - pre: { - ...TACoApp, + taco: { + ...tacoApp, stakingAppId: "taco", label: "TACo", address: TACoAddress, @@ -134,11 +134,18 @@ const AuthorizeStakingAppsPage: FC = () => { ) ) } - }, [tbtcApp.isAuthorized, randomBeaconApp.isAuthorized]) + + if (tacoApp.isAuthorized) { + setSelectedApps((selectedApps) => + selectedApps.filter(({ stakingAppId }) => stakingAppId !== "taco") + ) + } + }, [tbtcApp.isAuthorized, randomBeaconApp.isAuthorized, tacoApp.isAuthorized]) const tbtcMinAuthAmount = useStakingAppMinAuthorizationAmount("tbtc") const randomBeaconMinAuthAmount = useStakingAppMinAuthorizationAmount("randomBeacon") + const tacoMinAuthAmount = useStakingAppMinAuthorizationAmount("taco") const stake = useSelector((state: RootState) => selectStakeByStakingProvider(state, stakingProviderAddress!) @@ -158,6 +165,7 @@ const AuthorizeStakingAppsPage: FC = () => { const onAuthorizeApps = async () => { const isTbtcSelected = isAppSelected("tbtc") const isRandomBeaconSelected = isAppSelected("randomBeacon") + const isTacoSelected = isAppSelected("taco") if (isTbtcSelected) { await tbtcAppFormRef.current?.validateForm() @@ -167,6 +175,10 @@ const AuthorizeStakingAppsPage: FC = () => { await randomBeaconAppFormRef.current?.validateForm() randomBeaconAppFormRef.current?.setTouched({ tokenAmount: true }, false) } + if (isTacoSelected) { + await tacoAppFormRef.current?.validateForm() + tacoAppFormRef.current?.setTouched({ tokenAmount: true }, false) + } if ( (isRandomBeaconSelected && isTbtcSelected && @@ -301,7 +313,7 @@ const AuthorizeStakingAppsPage: FC = () => { /> </> )} - {(!tbtcApp.isAuthorized || !randomBeaconApp.isAuthorized) && ( + {(!tbtcApp.isAuthorized || !randomBeaconApp.isAuthorized || !tacoApp.isAuthorized) && ( <Button disabled={selectedApps.length === 0 || !isLoggedInAsAuthorizer} variant="outline" From ab0e774b30fb4810d5723b950d09999291a1d665 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Mon, 18 Sep 2023 17:04:02 +0200 Subject: [PATCH 16/22] feat: Add support for authorizing Taco app --- .../Modal/MapOperatorToStakingProviderModal/index.tsx | 5 ++++- .../useAuthorizeMultipleAppsTransaction.ts | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx index 2bea1d1ca..2a48ce4d4 100644 --- a/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderModal/index.tsx @@ -128,7 +128,7 @@ const MapOperatorToStakingProviderModal: FC< ) : isOperatorMappedOnlyInTbtc ? ( <LabelSm>random beacon app</LabelSm> ) : ( - <LabelSm>tBTC + Random Beacon + TACo apps (requires 3txs)</LabelSm> + <LabelSm>tBTC + Random Beacon + TACo (requires 3txs)</LabelSm> )} <StakeAddressInfo stakingProvider={account ? account : AddressZero} /> <MapOperatorToStakingProviderForm @@ -139,6 +139,8 @@ const MapOperatorToStakingProviderModal: FC< ? mappedOperatorRandomBeacon : isOperatorMappedOnlyInTbtc ? mappedOperatorTbtc + : isOperatorMappedOnlyInTaco + ? mappedOperatorTaco : "" } onSubmitForm={onSubmit} @@ -147,6 +149,7 @@ const MapOperatorToStakingProviderModal: FC< } mappedOperatorTbtc={mappedOperatorTbtc} mappedOperatorRandomBeacon={mappedOperatorRandomBeacon} + mappedOperatorTaco={mappedOperatorTaco} /> </Box> <AlertBox diff --git a/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts b/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts index bbedeeddb..69f7e09ed 100644 --- a/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts +++ b/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts @@ -10,6 +10,7 @@ export const useAuthorizeMultipleAppsTransaction = () => { const threshold = useThreshold() const tbtcAppAddress = useStakingApplicationAddress("tbtc") const randomBeaconAppAddress = useStakingApplicationAddress("randomBeacon") + const tacoAppAddress = useStakingApplicationAddress("taco") const { openModal } = useModal() const { sendTransaction, status } = useSendTransactionFromFn( @@ -31,7 +32,8 @@ export const useAuthorizeMultipleAppsTransaction = () => { const includesOnlySupportedApps = applications.every( (_) => isSameETHAddress(_.address, tbtcAppAddress) || - isSameETHAddress(_.address, randomBeaconAppAddress) + isSameETHAddress(_.address, randomBeaconAppAddress) || + isSameETHAddress(_.address, tacoAppAddress) ) if (!includesOnlySupportedApps) @@ -70,7 +72,7 @@ export const useAuthorizeMultipleAppsTransaction = () => { }) } }, - [sendTransaction, randomBeaconAppAddress, tbtcAppAddress, openModal] + [sendTransaction, randomBeaconAppAddress, tbtcAppAddress, tacoAppAddress, openModal] ) return { authorizeMultipleApps, status } From 060d3e2ac75321d19f1ae0f7a973a9fe5ee0c637 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Tue, 19 Sep 2023 12:00:37 +0200 Subject: [PATCH 17/22] feat: Add mapping of operator address to TACo app --- .../MapOperatorToStakingProviderForm.tsx | 26 ++++++++++++++++--- .../Staking/OperatorAddressMappingCard.tsx | 5 +++- src/store/staking-applications/effects.ts | 5 +++- src/threshold-ts/mas/__test__/mas.test.ts | 9 +++++++ 4 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/components/Modal/MapOperatorToStakingProviderModal/MapOperatorToStakingProviderForm.tsx b/src/components/Modal/MapOperatorToStakingProviderModal/MapOperatorToStakingProviderForm.tsx index 5ac2f4d12..ef1127d4b 100644 --- a/src/components/Modal/MapOperatorToStakingProviderModal/MapOperatorToStakingProviderForm.tsx +++ b/src/components/Modal/MapOperatorToStakingProviderModal/MapOperatorToStakingProviderForm.tsx @@ -32,7 +32,8 @@ const validateInputtedOperatorAddress = async ( operator: string ) => Promise<boolean>, mappedOperatorTbtc: string, - mappedOperatorRandomBeacon: string + mappedOperatorRandomBeacon: string, + mappedOperatorTaco: string ): Promise<string | undefined> => { let validationMsg: string | undefined = "" @@ -46,11 +47,18 @@ const validateInputtedOperatorAddress = async ( const isOperatorMappedOnlyInTbtc = !isAddressZero(mappedOperatorTbtc) && - isAddressZero(mappedOperatorRandomBeacon) + isAddressZero(mappedOperatorRandomBeacon) && + isAddressZero(mappedOperatorTaco) const isOperatorMappedOnlyInRandomBeacon = isAddressZero(mappedOperatorTbtc) && - !isAddressZero(mappedOperatorRandomBeacon) + !isAddressZero(mappedOperatorRandomBeacon) && + isAddressZero(mappedOperatorTaco) + + const isOperatorMappedOnlyInTaco = + isAddressZero(mappedOperatorTbtc) && + isAddressZero(mappedOperatorRandomBeacon) && + !isAddressZero(mappedOperatorTaco) if ( isOperatorMappedOnlyInRandomBeacon && @@ -66,6 +74,13 @@ const validateInputtedOperatorAddress = async ( validationMsg = "The operator address doesn't match the one used in tbtc app" } + if ( + isOperatorMappedOnlyInTaco && + !isSameETHAddress(operator, mappedOperatorTaco) + ) { + validationMsg = + "The operator address doesn't match the one used in TACo app" + } } catch (error) { console.error("`MapOperatorToStakingProviderForm` validation error.", error) validationMsg = (error as Error)?.message @@ -78,6 +93,7 @@ type MapOperatorToStakingProviderFormProps = { initialAddress: string mappedOperatorTbtc: string mappedOperatorRandomBeacon: string + mappedOperatorTaco: string innerRef: Ref<FormikProps<MapOperatorToStakingProviderFormValues>> checkIfOperatorIsMappedToAnotherStakingProvider: ( operator: string @@ -96,6 +112,7 @@ const MapOperatorToStakingProviderForm = withFormik< const { mappedOperatorTbtc, mappedOperatorRandomBeacon, + mappedOperatorTaco, checkIfOperatorIsMappedToAnotherStakingProvider, } = props const errors: FormikErrors<MapOperatorToStakingProviderFormValues> = {} @@ -106,7 +123,8 @@ const MapOperatorToStakingProviderForm = withFormik< values.operator, checkIfOperatorIsMappedToAnotherStakingProvider, mappedOperatorTbtc, - mappedOperatorRandomBeacon + mappedOperatorRandomBeacon, + mappedOperatorTaco ) } diff --git a/src/pages/Staking/OperatorAddressMappingCard.tsx b/src/pages/Staking/OperatorAddressMappingCard.tsx index 3c4c303df..248bf0b90 100644 --- a/src/pages/Staking/OperatorAddressMappingCard.tsx +++ b/src/pages/Staking/OperatorAddressMappingCard.tsx @@ -33,12 +33,14 @@ const OperatorAddressMappingCard: FC<{ stakingProvider: string }> = ({ const { mappedOperatorTbtc, mappedOperatorRandomBeacon, + mappedOperatorTaco, isOneOfTheAppsNotMapped, } = useAppSelector(selectMappedOperators) const shoudlDisplaySuccessState = !isAddressZero(mappedOperatorTbtc) && - !isAddressZero(mappedOperatorRandomBeacon) + !isAddressZero(mappedOperatorRandomBeacon) && + !isAddressZero(mappedOperatorTaco) const onStartMappingClick = () => { openModal(ModalType.MapOperatorToStakingProvider) @@ -47,6 +49,7 @@ const OperatorAddressMappingCard: FC<{ stakingProvider: string }> = ({ const mappedOperators = { tbtc: mappedOperatorTbtc, randomBeacon: mappedOperatorRandomBeacon, + taco: mappedOperatorTaco } return ( diff --git a/src/store/staking-applications/effects.ts b/src/store/staking-applications/effects.ts index a37840f95..1fe694f42 100644 --- a/src/store/staking-applications/effects.ts +++ b/src/store/staking-applications/effects.ts @@ -196,12 +196,14 @@ export const displayMapOperatorToStakingProviderModalEffect = async ( const { tbtc: mappedOperatorTbtc, randomBeacon: mappedOperatorRandomBeacon, + taco: mappedOperatorTaco, } = action.payload if ( isStakingProvider && (isAddressZero(mappedOperatorTbtc) || - isAddressZero(mappedOperatorRandomBeacon)) + isAddressZero(mappedOperatorRandomBeacon) || + isAddressZero(mappedOperatorTaco)) ) { listenerApi.dispatch( openModal({ @@ -210,6 +212,7 @@ export const displayMapOperatorToStakingProviderModalEffect = async ( address, mappedOperatorTbtc: mappedOperatorTbtc, mappedOperatorRandomBeacon: mappedOperatorRandomBeacon, + mappedOperatorTaco: mappedOperatorTaco, }, }) ) diff --git a/src/threshold-ts/mas/__test__/mas.test.ts b/src/threshold-ts/mas/__test__/mas.test.ts index 88760890e..e303d7979 100644 --- a/src/threshold-ts/mas/__test__/mas.test.ts +++ b/src/threshold-ts/mas/__test__/mas.test.ts @@ -105,10 +105,12 @@ describe("Multi app staking test", () => { const mockOperator = "0x4" const mappedOperatorTbtc = mockOperator const mappedOperatorRandomBeacon = mockOperator + const mappedOperatorTaco = mockOperator const mulitcallMockResult = [ [mappedOperatorTbtc], [mappedOperatorRandomBeacon], + [mappedOperatorTaco], ] const spyOnMulticall = jest .spyOn(multicall, "aggregate") @@ -131,10 +133,17 @@ describe("Multi app staking test", () => { method: "stakingProviderToOperator", args: [mockStakingProvider], }, + { + interface: mas.taco.contract.interface, + address: mas.taco.address, + method: "stakingProviderToOperator", + args: [mockStakingProvider], + }, ]) expect(result).toEqual({ tbtc: mappedOperatorTbtc, randomBeacon: mappedOperatorRandomBeacon, + taco: mappedOperatorTaco, }) }) }) From 2bdaf4da04f40895e77722917434902ba39a0193 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Tue, 19 Sep 2023 12:27:45 +0200 Subject: [PATCH 18/22] feat: Add Taco Application abi and goerli address --- src/web3/abi/TacoApplication.json | 1155 +++++++++++++++++++++++++++++ src/web3/hooks/useTacoContract.ts | 28 + 2 files changed, 1183 insertions(+) create mode 100644 src/web3/abi/TacoApplication.json create mode 100644 src/web3/hooks/useTacoContract.ts diff --git a/src/web3/abi/TacoApplication.json b/src/web3/abi/TacoApplication.json new file mode 100644 index 000000000..2b94b1369 --- /dev/null +++ b/src/web3/abi/TacoApplication.json @@ -0,0 +1,1155 @@ +[ + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract IStaking", + "name": "_tStaking", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_minimumAuthorization", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_minOperatorSeconds", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_rewardDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_deauthorizationDuration", + "type": "uint256" + }, + { + "internalType": "uint64[]", + "name": "_commitmentDurationOptions", + "type": "uint64[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseApproved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationInvoluntaryDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationReSynchronized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endCommitment", + "type": "uint256" + } + ], + "name": "CommitmentMade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousOperator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "name": "OperatorBonded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "OperatorConfirmed", + "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": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "distributor", + "type": "address" + } + ], + "name": "RewardDistributorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "RewardsWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "investigator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "Slashed", + "type": "event" + }, + { + "inputs": [], + "name": "adjudicator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "authorizationDecreaseRequested", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "authorizationIncreased", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "authorizedOverall", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "authorizedStake", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "availableRewards", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "bondOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "childApplication", + "outputs": [ + { + "internalType": "contract ITACoRootToChild", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption1", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption2", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption3", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption4", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "confirmOperatorAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deauthorizationDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "finishAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxStakingProviders", + "type": "uint256" + } + ], + "name": "getActiveStakingProviders", + "outputs": [ + { + "internalType": "uint256", + "name": "allAuthorizedTokens", + "type": "uint256" + }, + { + "internalType": "uint256[2][]", + "name": "activeStakingProviders", + "type": "uint256[2][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "getBeneficiary", + "outputs": [ + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "getOperatorFromStakingProvider", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingProvidersLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "involuntaryAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "isAuthorized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "isOperatorConfirmed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTimeRewardApplicable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastUpdateTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint64", + "name": "_commitmentDuration", + "type": "uint64" + } + ], + "name": "makeCommitment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minOperatorSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumAuthorization", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_reward", + "type": "uint96" + } + ], + "name": "pushReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "resynchronizeAuthorization", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardDistributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerToken", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerTokenStored", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRateDecimals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_adjudicator", + "type": "address" + } + ], + "name": "setAdjudicator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITACoRootToChild", + "name": "_childApplication", + "type": "address" + } + ], + "name": "setChildApplication", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardDistributor", + "type": "address" + } + ], + "name": "setRewardDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_penalty", + "type": "uint96" + }, + { + "internalType": "address", + "name": "_investigator", + "type": "address" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "stakingProviderFromOperator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakingProviderInfo", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "operatorConfirmed", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "operatorStartTimestamp", + "type": "uint64" + }, + { + "internalType": "uint96", + "name": "authorized", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "deauthorizing", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "endDeauthorization", + "type": "uint64" + }, + { + "internalType": "uint96", + "name": "tReward", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "rewardPerTokenPaid", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "endCommitment", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakingProviders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tStaking", + "outputs": [ + { + "internalType": "contract IStaking", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "withdrawRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] \ No newline at end of file diff --git a/src/web3/hooks/useTacoContract.ts b/src/web3/hooks/useTacoContract.ts new file mode 100644 index 000000000..b1625190b --- /dev/null +++ b/src/web3/hooks/useTacoContract.ts @@ -0,0 +1,28 @@ +import TacoApplicationABI from "../abi/TacoApplication.json" +import { useContract } from "./useContract" +import { supportedChainId } from "../../utils/getEnvVariable" +import { ChainID } from "../../enums" +import { AddressZero } from "../utils" + +export const TACO_DEPLOYMENT_BLOCK = supportedChainId === "1" ? 14141140 : 0 + +const TACO_ADDRESSESS = { + // https://etherscan.io/address/0x7E01c9c03FD3737294dbD7630a34845B0F70E5Dd + [ChainID.Ethereum.valueOf().toString()]: + AddressZero, + // https://goerli.etherscan.io/address/0x829fdCDf6Be747FEA37518fBd83dF70EE371fCf2 + // As NuCypher hasn't depoyed the `SimplePreApplication` contract on Goerli, + // we're using a stub contract. + [ChainID.Goerli.valueOf().toString()]: + "0xA7FD8E3A4731FA6C3b9Bb65C21D7082151B38c36", + // Set the correct `SimplePREApplication` contract address. If you deployed + // the `@threshold-network/solidity-contracts` to your local chain and linked + // package using `yarn link @threshold-network/solidity-contracts` you can + // find the contract address at + // `node_modules/@threshold-network/solidity-contracts/artifacts/SimplePREApplication.json`. + [ChainID.Localhost.valueOf().toString()]: AddressZero, +} as Record<string, string> + +export const usePREContract = () => { + return useContract(TACO_ADDRESSESS[supportedChainId], TacoApplicationABI) +} From 8fd409e64e913d6447e1f1b56189b60b8820faa8 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Tue, 19 Sep 2023 12:44:56 +0200 Subject: [PATCH 19/22] Add some todos and export the Taco contract const --- src/contexts/StakeCardContext.tsx | 2 +- src/enums/externalHref.ts | 4 ++-- src/pages/Staking/StakeCard/index.tsx | 8 ++------ src/types/rewards.ts | 2 +- src/types/staking.ts | 2 +- src/web3/hooks/index.ts | 1 + src/web3/hooks/useTacoContract.ts | 10 +--------- 7 files changed, 9 insertions(+), 20 deletions(-) diff --git a/src/contexts/StakeCardContext.tsx b/src/contexts/StakeCardContext.tsx index d8d4ecd4a..0ef679557 100644 --- a/src/contexts/StakeCardContext.tsx +++ b/src/contexts/StakeCardContext.tsx @@ -5,7 +5,7 @@ interface StakeCardContext { canTopUpKepp: boolean canTopUpNu: boolean hasLegacyStakes: boolean - isPRESet: boolean + isPRESet: boolean // TODO THEREF } export const StakeCardContext = createContext<StakeCardContext | undefined>( diff --git a/src/enums/externalHref.ts b/src/enums/externalHref.ts index 8d92ca366..49c6a409e 100644 --- a/src/enums/externalHref.ts +++ b/src/enums/externalHref.ts @@ -3,8 +3,8 @@ export enum ExternalHref { thresholdDiscord = "https://discord.gg/WXK9PC6SRF", metamaskHomePage = "https://metamask.io/", stakingContractLeanMore = "https://github.com/threshold-network/solidity-contracts/issues/53", - tacoNodeSetup = "https://docs.nucypher.com/en/latest/pre_application/running_a_node.html", - tacoStakingProvidersList = "https://docs.nucypher.com/en/latest/pre_application/node_providers.html", + tacoNodeSetup = "https://docs.nucypher.com/en/latest/pre_application/running_a_node.html", // TODO THEREF + tacoStakingProvidersList = "https://docs.nucypher.com/en/latest/pre_application/node_providers.html", // TODO THEREF exchangeRateLearnMore = "https://blog.threshold.network/threshold-launch/", keepDapp = "https://dashboard.keep.network/", keepDappAuthPage = "https://dashboard.keep.network/applications/threshold", diff --git a/src/pages/Staking/StakeCard/index.tsx b/src/pages/Staking/StakeCard/index.tsx index 048b1b7a5..41471fb0e 100644 --- a/src/pages/Staking/StakeCard/index.tsx +++ b/src/pages/Staking/StakeCard/index.tsx @@ -43,9 +43,6 @@ const StakeCardProvider: FC<{ stake: StakeData }> = ({ stake }) => { const canTopUpKepp = BigNumber.from(stake.possibleKeepTopUpInT).gt(0) const canTopUpNu = BigNumber.from(stake.possibleNuTopUpInT).gt(0) const hasLegacyStakes = stake.nuInTStake !== "0" || stake.keepInTStake !== "0" - const isPRESet = - !isAddressZero(stake.preConfig.operator) && - stake.preConfig.isOperatorConfirmed return ( <StakeCardContext.Provider @@ -54,7 +51,6 @@ const StakeCardProvider: FC<{ stake: StakeData }> = ({ stake }) => { canTopUpKepp, canTopUpNu, hasLegacyStakes, - isPRESet, }} > <StakeCard stake={stake} /> @@ -67,7 +63,7 @@ const StakeCard: FC<{ stake: StakeData }> = ({ stake }) => { const [isStakeAction, setFlag] = useBoolean(true) const tBalance = useTokenBalance(Token.T) const { openModal } = useModal() - const { isInactiveStake, canTopUpKepp, canTopUpNu, isPRESet } = + const { isInactiveStake, canTopUpKepp, canTopUpNu } = useStakeCardContext() const { account } = useWeb3React() const availableAmountToUnstake = useAppSelector((state) => @@ -118,7 +114,7 @@ const StakeCard: FC<{ stake: StakeData }> = ({ stake }) => { const dividerColor = useColorModeValue("gray.300", "gray.700") return ( - <Card borderColor={isInactiveStake || !isPRESet ? "red.200" : undefined}> + <Card borderColor={isInactiveStake ? "red.200" : undefined}> <StakeCardHeader stakeType={stake.stakeType} onTabClick={onTabClick} /> <StakeRewards stakingProvider={stake.stakingProvider} /> <LineDivider borderColor={dividerColor} /> diff --git a/src/types/rewards.ts b/src/types/rewards.ts index 342f4776d..f739c7e21 100644 --- a/src/types/rewards.ts +++ b/src/types/rewards.ts @@ -11,7 +11,7 @@ export interface RewardsJSONData { } export interface BonusEligibility { - hasPREConfigured: boolean + hasPREConfigured: boolean // TODO THEREF hasActiveStake: boolean // No unstaking after the bonus deadline and until mid-July (not even partial // amounts). diff --git a/src/types/staking.ts b/src/types/staking.ts index 2a57dadfb..6737d417e 100644 --- a/src/types/staking.ts +++ b/src/types/staking.ts @@ -25,7 +25,7 @@ export interface UseStakingState { } } -export interface PreConfig { +export interface PreConfig { // TODO THEREF operator: string isOperatorConfirmed: boolean operatorStartTimestamp: string diff --git a/src/web3/hooks/index.ts b/src/web3/hooks/index.ts index d1a1b7293..4da9ff49c 100644 --- a/src/web3/hooks/index.ts +++ b/src/web3/hooks/index.ts @@ -7,6 +7,7 @@ export * from "./useSendTransaction" export * from "./useSubscribeToContractEvent" export * from "./useSubscribeToERC20TransferEvent" export * from "./useT" +export * from "./useTacoContract" export * from "./useUpgradeToT" export * from "./useVendingMachineContract" export * from "./useVendingMachineRatio" diff --git a/src/web3/hooks/useTacoContract.ts b/src/web3/hooks/useTacoContract.ts index b1625190b..5e57d7ee4 100644 --- a/src/web3/hooks/useTacoContract.ts +++ b/src/web3/hooks/useTacoContract.ts @@ -10,19 +10,11 @@ const TACO_ADDRESSESS = { // https://etherscan.io/address/0x7E01c9c03FD3737294dbD7630a34845B0F70E5Dd [ChainID.Ethereum.valueOf().toString()]: AddressZero, - // https://goerli.etherscan.io/address/0x829fdCDf6Be747FEA37518fBd83dF70EE371fCf2 - // As NuCypher hasn't depoyed the `SimplePreApplication` contract on Goerli, - // we're using a stub contract. [ChainID.Goerli.valueOf().toString()]: "0xA7FD8E3A4731FA6C3b9Bb65C21D7082151B38c36", - // Set the correct `SimplePREApplication` contract address. If you deployed - // the `@threshold-network/solidity-contracts` to your local chain and linked - // package using `yarn link @threshold-network/solidity-contracts` you can - // find the contract address at - // `node_modules/@threshold-network/solidity-contracts/artifacts/SimplePREApplication.json`. [ChainID.Localhost.valueOf().toString()]: AddressZero, } as Record<string, string> -export const usePREContract = () => { +export const useTacoContract = () => { return useContract(TACO_ADDRESSESS[supportedChainId], TacoApplicationABI) } From 33aa69c35f429c1e2f1cc592fdf4485491f4e247 Mon Sep 17 00:00:00 2001 From: James Campbell <james.campbell@tanti.org.uk> Date: Tue, 19 Sep 2023 13:33:28 +0200 Subject: [PATCH 20/22] Use the Taco Contract within MultiAppStaking --- src/contexts/StakeCardContext.tsx | 1 - src/store/staking-applications/effects.ts | 6 ++++++ src/store/staking-applications/slice.ts | 3 +++ src/threshold-ts/mas/index.ts | 7 +++++-- 4 files changed, 14 insertions(+), 3 deletions(-) diff --git a/src/contexts/StakeCardContext.tsx b/src/contexts/StakeCardContext.tsx index 0ef679557..0b724226e 100644 --- a/src/contexts/StakeCardContext.tsx +++ b/src/contexts/StakeCardContext.tsx @@ -5,7 +5,6 @@ interface StakeCardContext { canTopUpKepp: boolean canTopUpNu: boolean hasLegacyStakes: boolean - isPRESet: boolean // TODO THEREF } export const StakeCardContext = createContext<StakeCardContext | undefined>( diff --git a/src/store/staking-applications/effects.ts b/src/store/staking-applications/effects.ts index 1fe694f42..210b1d407 100644 --- a/src/store/staking-applications/effects.ts +++ b/src/store/staking-applications/effects.ts @@ -117,6 +117,12 @@ export const getSupportedAppsStakingProvidersData = async ( "randomBeacon", listenerApi ) + await getKeepStakingAppStakingProvidersData( + stakingProviders, + listenerApi.extra.threshold.multiAppStaking.taco, + "taco", + listenerApi + ) } catch (error) { console.log("Could not fetch apps data for staking providers ", error) listenerApi.subscribe() diff --git a/src/store/staking-applications/slice.ts b/src/store/staking-applications/slice.ts index f6df67952..9dd4bcdee 100644 --- a/src/store/staking-applications/slice.ts +++ b/src/store/staking-applications/slice.ts @@ -294,6 +294,9 @@ export const stakingApplicationsSlice = createSlice({ } state.tbtc.stakingProviders.data[stakingProvider] = { ...defaultAuthData, + + state.taco.stakingProviders.data[stakingProvider] = { + ...defaultAuthData, } } ) diff --git a/src/threshold-ts/mas/index.ts b/src/threshold-ts/mas/index.ts index 9715f759c..365681a41 100644 --- a/src/threshold-ts/mas/index.ts +++ b/src/threshold-ts/mas/index.ts @@ -1,5 +1,6 @@ import RandomBeacon from "@keep-network/random-beacon/artifacts/RandomBeacon.json" import WalletRegistry from "@keep-network/ecdsa/artifacts/WalletRegistry.json" +import useTacoContract from "../../web3/hooks/useTacoContract" import { Application, AuthorizationParameters, @@ -9,6 +10,8 @@ import { IMulticall, ContractCall } from "../multicall" import { IStaking } from "../staking" import { EthereumConfig } from "../types" +const tacoContract = useTacoContract() + export interface SupportedAppAuthorizationParameters { tbtc: AuthorizationParameters randomBeacon: AuthorizationParameters @@ -46,8 +49,8 @@ export class MultiAppStaking { ...config, }) this.taco = new Application(this._staking, this._multicall, { - address: WalletRegistry.address, // TODO - abi: WalletRegistry.abi, // TODO + address: tacoContract.address, // TODO + abi: tacoContract.abi, // TODO ...config, }) } From 431296a32e57b2da5e7e39d7277a42ce5d402809 Mon Sep 17 00:00:00 2001 From: Kieran Prasch <kieranprasch@gmail.com> Date: Tue, 19 Sep 2023 13:38:32 +0200 Subject: [PATCH 21/22] linting fixes, fix small typo. --- .../NewStakerAuthorizationForm.tsx | 6 +- src/components/StakingTimeline/index.tsx | 4 +- .../useAuthorizeMultipleAppsTransaction.ts | 8 +- .../Staking/AuthorizeStakingApps/index.tsx | 4 +- .../Staking/OperatorAddressMappingCard.tsx | 2 +- src/pages/Staking/StakeCard/index.tsx | 3 +- src/store/account/selectors.ts | 8 +- src/store/staking-applications/slice.ts | 2 +- src/types/staking.ts | 3 +- src/web3/abi/TacoApplication.json | 2308 ++++++++--------- src/web3/hooks/useTacoContract.ts | 3 +- 11 files changed, 1183 insertions(+), 1168 deletions(-) diff --git a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx index 0ba018764..84a1fd952 100644 --- a/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx +++ b/src/components/Modal/NewStakerAuthorizeStakingApplicationModal/NewStakerAuthorizationForm.tsx @@ -132,7 +132,11 @@ const NewStakerAuthorizationForm: FC<Props & FormikProps<FormValues>> = ({ Cancel </Button> <Button - disabled={isTbtcChecked === false && isRandomBeaconChecked === false && isTacoChecked === false} + disabled={ + isTbtcChecked === false && + isRandomBeaconChecked === false && + isTacoChecked === false + } type="submit" > Authorize Selected Apps diff --git a/src/components/StakingTimeline/index.tsx b/src/components/StakingTimeline/index.tsx index b3a709f56..ccb407e00 100644 --- a/src/components/StakingTimeline/index.tsx +++ b/src/components/StakingTimeline/index.tsx @@ -211,8 +211,8 @@ const StakingTimeline: FC<{ statuses?: FlowStepStatus[] } & StackProps> = ({ preTitle="Step 2" status={statuses[1] ?? FlowStepStatus.inactive} > - For each stake, there are three applications available. - To authorize tBTC, Random Beacon, and TACo, go to the{" "} + For each stake, there are three applications available. To authorize + tBTC, Random Beacon, and TACo, go to the{" "} <Link to="/staking">Staking page</Link> and select “Configure Stake”. </FlowStep> <FlowStep diff --git a/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts b/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts index 69f7e09ed..77fc0cb60 100644 --- a/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts +++ b/src/hooks/staking-applications/useAuthorizeMultipleAppsTransaction.ts @@ -72,7 +72,13 @@ export const useAuthorizeMultipleAppsTransaction = () => { }) } }, - [sendTransaction, randomBeaconAppAddress, tbtcAppAddress, tacoAppAddress, openModal] + [ + sendTransaction, + randomBeaconAppAddress, + tbtcAppAddress, + tacoAppAddress, + openModal, + ] ) return { authorizeMultipleApps, status } diff --git a/src/pages/Staking/AuthorizeStakingApps/index.tsx b/src/pages/Staking/AuthorizeStakingApps/index.tsx index 930168ba7..e21bf7799 100644 --- a/src/pages/Staking/AuthorizeStakingApps/index.tsx +++ b/src/pages/Staking/AuthorizeStakingApps/index.tsx @@ -313,7 +313,9 @@ const AuthorizeStakingAppsPage: FC = () => { /> </> )} - {(!tbtcApp.isAuthorized || !randomBeaconApp.isAuthorized || !tacoApp.isAuthorized) && ( + {(!tbtcApp.isAuthorized || + !randomBeaconApp.isAuthorized || + !tacoApp.isAuthorized) && ( <Button disabled={selectedApps.length === 0 || !isLoggedInAsAuthorizer} variant="outline" diff --git a/src/pages/Staking/OperatorAddressMappingCard.tsx b/src/pages/Staking/OperatorAddressMappingCard.tsx index 248bf0b90..f9440d9f1 100644 --- a/src/pages/Staking/OperatorAddressMappingCard.tsx +++ b/src/pages/Staking/OperatorAddressMappingCard.tsx @@ -49,7 +49,7 @@ const OperatorAddressMappingCard: FC<{ stakingProvider: string }> = ({ const mappedOperators = { tbtc: mappedOperatorTbtc, randomBeacon: mappedOperatorRandomBeacon, - taco: mappedOperatorTaco + taco: mappedOperatorTaco, } return ( diff --git a/src/pages/Staking/StakeCard/index.tsx b/src/pages/Staking/StakeCard/index.tsx index 41471fb0e..9a9861b71 100644 --- a/src/pages/Staking/StakeCard/index.tsx +++ b/src/pages/Staking/StakeCard/index.tsx @@ -63,8 +63,7 @@ const StakeCard: FC<{ stake: StakeData }> = ({ stake }) => { const [isStakeAction, setFlag] = useBoolean(true) const tBalance = useTokenBalance(Token.T) const { openModal } = useModal() - const { isInactiveStake, canTopUpKepp, canTopUpNu } = - useStakeCardContext() + const { isInactiveStake, canTopUpKepp, canTopUpNu } = useStakeCardContext() const { account } = useWeb3React() const availableAmountToUnstake = useAppSelector((state) => selectAvailableAmountToUnstakeByStakingProvider( diff --git a/src/store/account/selectors.ts b/src/store/account/selectors.ts index 8a2d479c6..1a66dd460 100644 --- a/src/store/account/selectors.ts +++ b/src/store/account/selectors.ts @@ -24,9 +24,13 @@ export const selectMappedOperators = createSelector( isOperatorMappedOnlyInRandomBeacon, isOperatorMappedOnlyInTaco, isOneOfTheAppsNotMapped: - isOperatorMappedOnlyInRandomBeacon || isOperatorMappedOnlyInTbtc || isOperatorMappedOnlyInTaco, + isOperatorMappedOnlyInRandomBeacon || + isOperatorMappedOnlyInTbtc || + isOperatorMappedOnlyInTaco, isOperatorMappedInAllApps: - !isAddressZero(randomBeacon) && !isAddressZero(tbtc) && !isAddressZero(taco), + !isAddressZero(randomBeacon) && + !isAddressZero(tbtc) && + !isAddressZero(taco), } } ) diff --git a/src/store/staking-applications/slice.ts b/src/store/staking-applications/slice.ts index 9dd4bcdee..4cd0fe065 100644 --- a/src/store/staking-applications/slice.ts +++ b/src/store/staking-applications/slice.ts @@ -294,7 +294,7 @@ export const stakingApplicationsSlice = createSlice({ } state.tbtc.stakingProviders.data[stakingProvider] = { ...defaultAuthData, - + } state.taco.stakingProviders.data[stakingProvider] = { ...defaultAuthData, } diff --git a/src/types/staking.ts b/src/types/staking.ts index 6737d417e..8899ca101 100644 --- a/src/types/staking.ts +++ b/src/types/staking.ts @@ -25,7 +25,8 @@ export interface UseStakingState { } } -export interface PreConfig { // TODO THEREF +export interface PreConfig { + // TODO THEREF operator: string isOperatorConfirmed: boolean operatorStartTimestamp: string diff --git a/src/web3/abi/TacoApplication.json b/src/web3/abi/TacoApplication.json index 2b94b1369..e9b0e3b88 100644 --- a/src/web3/abi/TacoApplication.json +++ b/src/web3/abi/TacoApplication.json @@ -1,1155 +1,1155 @@ [ - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "contract IStaking", - "name": "_tStaking", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_minimumAuthorization", - "type": "uint96" - }, - { - "internalType": "uint256", - "name": "_minOperatorSeconds", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_rewardDuration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_deauthorizationDuration", - "type": "uint256" - }, - { - "internalType": "uint64[]", - "name": "_commitmentDurationOptions", - "type": "uint64[]" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationDecreaseApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationDecreaseRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationIncreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationInvoluntaryDecreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationReSynchronized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "endCommitment", - "type": "uint256" - } - ], - "name": "CommitmentMade", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "previousOperator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "startTimestamp", - "type": "uint256" - } - ], - "name": "OperatorBonded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "OperatorConfirmed", - "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": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "distributor", - "type": "address" - } - ], - "name": "RewardDistributorSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "beneficiary", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "amount", - "type": "uint96" - } - ], - "name": "RewardsWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "penalty", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "investigator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "Slashed", - "type": "event" - }, - { - "inputs": [], - "name": "adjudicator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_fromAmount", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "_toAmount", - "type": "uint96" - } - ], - "name": "authorizationDecreaseRequested", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_fromAmount", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "_toAmount", - "type": "uint96" - } - ], - "name": "authorizationIncreased", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authorizedOverall", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "authorizedStake", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "availableRewards", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "bondOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "childApplication", - "outputs": [ - { - "internalType": "contract ITACoRootToChild", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption1", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption2", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption3", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption4", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "confirmOperatorAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deauthorizationDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "finishAuthorizationDecrease", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_startIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxStakingProviders", - "type": "uint256" - } - ], - "name": "getActiveStakingProviders", - "outputs": [ - { - "internalType": "uint256", - "name": "allAuthorizedTokens", - "type": "uint256" - }, - { - "internalType": "uint256[2][]", - "name": "activeStakingProviders", - "type": "uint256[2][]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "getBeneficiary", - "outputs": [ - { - "internalType": "address payable", - "name": "beneficiary", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "getOperatorFromStakingProvider", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingProvidersLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_fromAmount", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "_toAmount", - "type": "uint96" - } - ], - "name": "involuntaryAuthorizationDecrease", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "isAuthorized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "isOperatorConfirmed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastTimeRewardApplicable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastUpdateTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint64", - "name": "_commitmentDuration", - "type": "uint64" - } - ], - "name": "makeCommitment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "minOperatorSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumAuthorization", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "periodFinish", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint96", - "name": "_reward", - "type": "uint96" - } - ], - "name": "pushReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "resynchronizeAuthorization", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardDistributor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerToken", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerTokenStored", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardRateDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_adjudicator", - "type": "address" - } - ], - "name": "setAdjudicator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract ITACoRootToChild", - "name": "_childApplication", - "type": "address" - } - ], - "name": "setChildApplication", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_rewardDistributor", - "type": "address" - } - ], - "name": "setRewardDistributor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_penalty", - "type": "uint96" - }, - { - "internalType": "address", - "name": "_investigator", - "type": "address" - } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "stakingProviderFromOperator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stakingProviderInfo", - "outputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "operatorConfirmed", - "type": "bool" - }, - { - "internalType": "uint64", - "name": "operatorStartTimestamp", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "authorized", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "deauthorizing", - "type": "uint96" - }, - { - "internalType": "uint64", - "name": "endDeauthorization", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "tReward", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "rewardPerTokenPaid", - "type": "uint96" - }, - { - "internalType": "uint64", - "name": "endCommitment", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "stakingProviders", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tStaking", - "outputs": [ - { - "internalType": "contract IStaking", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "withdrawRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } - ] \ No newline at end of file + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract IStaking", + "name": "_tStaking", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_minimumAuthorization", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_minOperatorSeconds", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_rewardDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_deauthorizationDuration", + "type": "uint256" + }, + { + "internalType": "uint64[]", + "name": "_commitmentDurationOptions", + "type": "uint64[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseApproved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationInvoluntaryDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationReSynchronized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endCommitment", + "type": "uint256" + } + ], + "name": "CommitmentMade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousOperator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "name": "OperatorBonded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "OperatorConfirmed", + "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": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "distributor", + "type": "address" + } + ], + "name": "RewardDistributorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "RewardsWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "investigator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "Slashed", + "type": "event" + }, + { + "inputs": [], + "name": "adjudicator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "authorizationDecreaseRequested", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "authorizationIncreased", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "authorizedOverall", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "authorizedStake", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "availableRewards", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "bondOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "childApplication", + "outputs": [ + { + "internalType": "contract ITACoRootToChild", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption1", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption2", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption3", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption4", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "confirmOperatorAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deauthorizationDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "finishAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxStakingProviders", + "type": "uint256" + } + ], + "name": "getActiveStakingProviders", + "outputs": [ + { + "internalType": "uint256", + "name": "allAuthorizedTokens", + "type": "uint256" + }, + { + "internalType": "uint256[2][]", + "name": "activeStakingProviders", + "type": "uint256[2][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "getBeneficiary", + "outputs": [ + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "getOperatorFromStakingProvider", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingProvidersLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "involuntaryAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "isAuthorized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "isOperatorConfirmed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTimeRewardApplicable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastUpdateTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint64", + "name": "_commitmentDuration", + "type": "uint64" + } + ], + "name": "makeCommitment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minOperatorSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumAuthorization", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_reward", + "type": "uint96" + } + ], + "name": "pushReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "resynchronizeAuthorization", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardDistributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerToken", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerTokenStored", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRateDecimals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_adjudicator", + "type": "address" + } + ], + "name": "setAdjudicator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITACoRootToChild", + "name": "_childApplication", + "type": "address" + } + ], + "name": "setChildApplication", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardDistributor", + "type": "address" + } + ], + "name": "setRewardDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_penalty", + "type": "uint96" + }, + { + "internalType": "address", + "name": "_investigator", + "type": "address" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "stakingProviderFromOperator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakingProviderInfo", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "operatorConfirmed", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "operatorStartTimestamp", + "type": "uint64" + }, + { + "internalType": "uint96", + "name": "authorized", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "deauthorizing", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "endDeauthorization", + "type": "uint64" + }, + { + "internalType": "uint96", + "name": "tReward", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "rewardPerTokenPaid", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "endCommitment", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakingProviders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tStaking", + "outputs": [ + { + "internalType": "contract IStaking", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "withdrawRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/web3/hooks/useTacoContract.ts b/src/web3/hooks/useTacoContract.ts index 5e57d7ee4..b86fd8732 100644 --- a/src/web3/hooks/useTacoContract.ts +++ b/src/web3/hooks/useTacoContract.ts @@ -8,8 +8,7 @@ export const TACO_DEPLOYMENT_BLOCK = supportedChainId === "1" ? 14141140 : 0 const TACO_ADDRESSESS = { // https://etherscan.io/address/0x7E01c9c03FD3737294dbD7630a34845B0F70E5Dd - [ChainID.Ethereum.valueOf().toString()]: - AddressZero, + [ChainID.Ethereum.valueOf().toString()]: AddressZero, [ChainID.Goerli.valueOf().toString()]: "0xA7FD8E3A4731FA6C3b9Bb65C21D7082151B38c36", [ChainID.Localhost.valueOf().toString()]: AddressZero, From cb8f6378edfe052533ba236002ba911a307b5390 Mon Sep 17 00:00:00 2001 From: Kieran Prasch <kieranprasch@gmail.com> Date: Tue, 19 Sep 2023 13:58:42 +0200 Subject: [PATCH 22/22] Use a static deployment artifact registry for TacoApplication. --- src/threshold-ts/mas/index.ts | 8 +- src/web3/abi/TacoApplication.json | 2313 +++++++++++++++-------------- 2 files changed, 1161 insertions(+), 1160 deletions(-) diff --git a/src/threshold-ts/mas/index.ts b/src/threshold-ts/mas/index.ts index 365681a41..42a97d1e5 100644 --- a/src/threshold-ts/mas/index.ts +++ b/src/threshold-ts/mas/index.ts @@ -1,6 +1,6 @@ import RandomBeacon from "@keep-network/random-beacon/artifacts/RandomBeacon.json" import WalletRegistry from "@keep-network/ecdsa/artifacts/WalletRegistry.json" -import useTacoContract from "../../web3/hooks/useTacoContract" +import TacoRegistry from "../../web3/abi/TacoApplication.json" // TODO: use the npm package import { Application, AuthorizationParameters, @@ -10,8 +10,6 @@ import { IMulticall, ContractCall } from "../multicall" import { IStaking } from "../staking" import { EthereumConfig } from "../types" -const tacoContract = useTacoContract() - export interface SupportedAppAuthorizationParameters { tbtc: AuthorizationParameters randomBeacon: AuthorizationParameters @@ -49,8 +47,8 @@ export class MultiAppStaking { ...config, }) this.taco = new Application(this._staking, this._multicall, { - address: tacoContract.address, // TODO - abi: tacoContract.abi, // TODO + address: TacoRegistry.address, + abi: TacoRegistry.abi, ...config, }) } diff --git a/src/web3/abi/TacoApplication.json b/src/web3/abi/TacoApplication.json index e9b0e3b88..67b0dbb51 100644 --- a/src/web3/abi/TacoApplication.json +++ b/src/web3/abi/TacoApplication.json @@ -1,1155 +1,1158 @@ -[ - { - "inputs": [ - { - "internalType": "contract IERC20", - "name": "_token", - "type": "address" - }, - { - "internalType": "contract IStaking", - "name": "_tStaking", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_minimumAuthorization", - "type": "uint96" - }, - { - "internalType": "uint256", - "name": "_minOperatorSeconds", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_rewardDuration", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_deauthorizationDuration", - "type": "uint256" - }, - { - "internalType": "uint64[]", - "name": "_commitmentDurationOptions", - "type": "uint64[]" - } - ], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationDecreaseApproved", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationDecreaseRequested", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationIncreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationInvoluntaryDecreased", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "fromAmount", - "type": "uint96" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "toAmount", - "type": "uint96" - } - ], - "name": "AuthorizationReSynchronized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "endCommitment", - "type": "uint256" - } - ], - "name": "CommitmentMade", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "previousOperator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "startTimestamp", - "type": "uint256" - } - ], - "name": "OperatorBonded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "operator", - "type": "address" - } - ], - "name": "OperatorConfirmed", - "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": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardAdded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "distributor", - "type": "address" - } - ], - "name": "RewardDistributorSet", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": true, - "internalType": "address", - "name": "beneficiary", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "RewardPaid", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint96", - "name": "amount", - "type": "uint96" - } - ], - "name": "RewardsWithdrawn", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "stakingProvider", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "penalty", - "type": "uint256" - }, - { - "indexed": true, - "internalType": "address", - "name": "investigator", - "type": "address" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "reward", - "type": "uint256" - } - ], - "name": "Slashed", - "type": "event" - }, - { - "inputs": [], - "name": "adjudicator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_fromAmount", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "_toAmount", - "type": "uint96" - } - ], - "name": "authorizationDecreaseRequested", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_fromAmount", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "_toAmount", - "type": "uint96" - } - ], - "name": "authorizationIncreased", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "authorizedOverall", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "authorizedStake", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "availableRewards", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "bondOperator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "childApplication", - "outputs": [ - { - "internalType": "contract ITACoRootToChild", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption1", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption2", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption3", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "commitmentDurationOption4", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "confirmOperatorAddress", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "deauthorizationDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "finishAuthorizationDecrease", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "_startIndex", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "_maxStakingProviders", - "type": "uint256" - } - ], - "name": "getActiveStakingProviders", - "outputs": [ - { - "internalType": "uint256", - "name": "allAuthorizedTokens", - "type": "uint256" - }, - { - "internalType": "uint256[2][]", - "name": "activeStakingProviders", - "type": "uint256[2][]" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "getBeneficiary", - "outputs": [ - { - "internalType": "address payable", - "name": "beneficiary", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "getOperatorFromStakingProvider", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "getStakingProvidersLength", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_fromAmount", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "_toAmount", - "type": "uint96" - } - ], - "name": "involuntaryAuthorizationDecrease", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "isAuthorized", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "isOperatorConfirmed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastTimeRewardApplicable", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "lastUpdateTime", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint64", - "name": "_commitmentDuration", - "type": "uint64" - } - ], - "name": "makeCommitment", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "minOperatorSeconds", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "minimumAuthorization", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "periodFinish", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint96", - "name": "_reward", - "type": "uint96" - } - ], - "name": "pushReward", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "renounceOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "resynchronizeAuthorization", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "rewardDistributor", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardDuration", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerToken", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardPerTokenStored", - "outputs": [ - { - "internalType": "uint96", - "name": "", - "type": "uint96" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "rewardRateDecimals", - "outputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_adjudicator", - "type": "address" - } - ], - "name": "setAdjudicator", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "contract ITACoRootToChild", - "name": "_childApplication", - "type": "address" - } - ], - "name": "setChildApplication", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_rewardDistributor", - "type": "address" - } - ], - "name": "setRewardDistributor", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - }, - { - "internalType": "uint96", - "name": "_penalty", - "type": "uint96" - }, - { - "internalType": "address", - "name": "_investigator", - "type": "address" - } - ], - "name": "slash", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_operator", - "type": "address" - } - ], - "name": "stakingProviderFromOperator", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "name": "stakingProviderInfo", - "outputs": [ - { - "internalType": "address", - "name": "operator", - "type": "address" - }, - { - "internalType": "bool", - "name": "operatorConfirmed", - "type": "bool" - }, - { - "internalType": "uint64", - "name": "operatorStartTimestamp", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "authorized", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "deauthorizing", - "type": "uint96" - }, - { - "internalType": "uint64", - "name": "endDeauthorization", - "type": "uint64" - }, - { - "internalType": "uint96", - "name": "tReward", - "type": "uint96" - }, - { - "internalType": "uint96", - "name": "rewardPerTokenPaid", - "type": "uint96" - }, - { - "internalType": "uint64", - "name": "endCommitment", - "type": "uint64" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - } - ], - "name": "stakingProviders", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "tStaking", - "outputs": [ - { - "internalType": "contract IStaking", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "token", - "outputs": [ - { - "internalType": "contract IERC20", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newOwner", - "type": "address" - } - ], - "name": "transferOwnership", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_stakingProvider", - "type": "address" - } - ], - "name": "withdrawRewards", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - } -] +{ + "address": "0xA7FD8E3A4731FA6C3b9Bb65C21D7082151B38c36", + "abi": [ + { + "inputs": [ + { + "internalType": "contract IERC20", + "name": "_token", + "type": "address" + }, + { + "internalType": "contract IStaking", + "name": "_tStaking", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_minimumAuthorization", + "type": "uint96" + }, + { + "internalType": "uint256", + "name": "_minOperatorSeconds", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_rewardDuration", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_deauthorizationDuration", + "type": "uint256" + }, + { + "internalType": "uint64[]", + "name": "_commitmentDurationOptions", + "type": "uint64[]" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseApproved", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationDecreaseRequested", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationIncreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationInvoluntaryDecreased", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "fromAmount", + "type": "uint96" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "toAmount", + "type": "uint96" + } + ], + "name": "AuthorizationReSynchronized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "endCommitment", + "type": "uint256" + } + ], + "name": "CommitmentMade", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "previousOperator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "startTimestamp", + "type": "uint256" + } + ], + "name": "OperatorBonded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "OperatorConfirmed", + "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": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardAdded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "distributor", + "type": "address" + } + ], + "name": "RewardDistributorSet", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "beneficiary", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "RewardPaid", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint96", + "name": "amount", + "type": "uint96" + } + ], + "name": "RewardsWithdrawn", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "stakingProvider", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "penalty", + "type": "uint256" + }, + { + "indexed": true, + "internalType": "address", + "name": "investigator", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "reward", + "type": "uint256" + } + ], + "name": "Slashed", + "type": "event" + }, + { + "inputs": [], + "name": "adjudicator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "authorizationDecreaseRequested", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "authorizationIncreased", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "authorizedOverall", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "authorizedStake", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "availableRewards", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "bondOperator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "childApplication", + "outputs": [ + { + "internalType": "contract ITACoRootToChild", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption1", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption2", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption3", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "commitmentDurationOption4", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "confirmOperatorAddress", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "deauthorizationDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "finishAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_startIndex", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "_maxStakingProviders", + "type": "uint256" + } + ], + "name": "getActiveStakingProviders", + "outputs": [ + { + "internalType": "uint256", + "name": "allAuthorizedTokens", + "type": "uint256" + }, + { + "internalType": "uint256[2][]", + "name": "activeStakingProviders", + "type": "uint256[2][]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "getBeneficiary", + "outputs": [ + { + "internalType": "address payable", + "name": "beneficiary", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "getOperatorFromStakingProvider", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getStakingProvidersLength", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_fromAmount", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "_toAmount", + "type": "uint96" + } + ], + "name": "involuntaryAuthorizationDecrease", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "isAuthorized", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "isOperatorConfirmed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastTimeRewardApplicable", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "lastUpdateTime", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint64", + "name": "_commitmentDuration", + "type": "uint64" + } + ], + "name": "makeCommitment", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "minOperatorSeconds", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "minimumAuthorization", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "periodFinish", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint96", + "name": "_reward", + "type": "uint96" + } + ], + "name": "pushReward", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "resynchronizeAuthorization", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "rewardDistributor", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardDuration", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerToken", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardPerTokenStored", + "outputs": [ + { + "internalType": "uint96", + "name": "", + "type": "uint96" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "rewardRateDecimals", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_adjudicator", + "type": "address" + } + ], + "name": "setAdjudicator", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "contract ITACoRootToChild", + "name": "_childApplication", + "type": "address" + } + ], + "name": "setChildApplication", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_rewardDistributor", + "type": "address" + } + ], + "name": "setRewardDistributor", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + }, + { + "internalType": "uint96", + "name": "_penalty", + "type": "uint96" + }, + { + "internalType": "address", + "name": "_investigator", + "type": "address" + } + ], + "name": "slash", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_operator", + "type": "address" + } + ], + "name": "stakingProviderFromOperator", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "name": "stakingProviderInfo", + "outputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "operatorConfirmed", + "type": "bool" + }, + { + "internalType": "uint64", + "name": "operatorStartTimestamp", + "type": "uint64" + }, + { + "internalType": "uint96", + "name": "authorized", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "deauthorizing", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "endDeauthorization", + "type": "uint64" + }, + { + "internalType": "uint96", + "name": "tReward", + "type": "uint96" + }, + { + "internalType": "uint96", + "name": "rewardPerTokenPaid", + "type": "uint96" + }, + { + "internalType": "uint64", + "name": "endCommitment", + "type": "uint64" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "stakingProviders", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "tStaking", + "outputs": [ + { + "internalType": "contract IStaking", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "token", + "outputs": [ + { + "internalType": "contract IERC20", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_stakingProvider", + "type": "address" + } + ], + "name": "withdrawRewards", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } + ] +}