From 6bba49c96c14f10d7042baf2faa551f055fc024d Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Tue, 5 Sep 2023 14:41:04 +0000 Subject: [PATCH 01/46] very hack proof-of-concept of a batch call --- package.json | 1 + packages/widget/src/CommandHandlerContext.ts | 4 +- .../widget/src/CommandHandlerProvider.tsx | 206 ++- packages/widget/src/CommandHandlerState.ts | 37 +- packages/widget/src/CommandMapper.tsx | 282 ++- packages/widget/src/ContractWrite.ts | 38 +- packages/widget/src/ContractWriteButton.tsx | 103 +- packages/widget/src/ContractWriteManager.tsx | 7 +- packages/widget/src/ContractWriteStatus.tsx | 6 + packages/widget/src/commandHandlingReducer.ts | 37 +- packages/widget/src/commands.ts | 9 + packages/widget/src/core/wagmi-generated.ts | 1602 ++++++++++++++++- packages/widget/wagmi.config.ts | 24 + pnpm-lock.yaml | 5 +- 14 files changed, 2190 insertions(+), 171 deletions(-) diff --git a/package.json b/package.json index 4c5c8128..fd7e7760 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,7 @@ "pnpm": { "overrides": { "react-hook-form": "~7.44.3", + "@superfluid-finance/ethereum-contracts": "1.7.2", "eslint-plugin-react-hooks": "5.0.0-canary-7118f5dd7-20230705" } } diff --git a/packages/widget/src/CommandHandlerContext.ts b/packages/widget/src/CommandHandlerContext.ts index 5d90716b..770c9a16 100644 --- a/packages/widget/src/CommandHandlerContext.ts +++ b/packages/widget/src/CommandHandlerContext.ts @@ -1,6 +1,6 @@ import { createContext, useContext } from "react"; -import { CommandHandlingAggregate, State } from "./CommandHandlerState.js"; +import { State } from "./CommandHandlerState.js"; import { Command } from "./commands.js"; import { ContractWrite } from "./ContractWrite.js"; import { ContractWriteResult } from "./ContractWriteManager.js"; @@ -8,7 +8,7 @@ import { ContractWriteResult } from "./ContractWriteManager.js"; // TODO(KK): nested structure export type CommandHandlerContextValue = { status: State["status"]; - commands: ReadonlyArray; + commands: ReadonlyArray; contractWrites: ReadonlyArray; contractWriteResults: ReadonlyArray; sessionId: string | null; diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index 18ef3ba3..7140c6fb 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -1,4 +1,14 @@ -import { useCallback, useMemo } from "react"; +import { FormControlLabel, FormGroup, Switch } from "@mui/material"; +import { nanoid } from "nanoid"; +import { useCallback, useMemo, useState } from "react"; +import { + Abi, + Address, + ContractFunctionConfig, + encodeFunctionData, + GetValue, +} from "viem"; +import { useSignTypedData } from "wagmi"; import { CommandHandlerContext, @@ -7,7 +17,12 @@ import { import { useCommandHandlerReducer } from "./commandHandlingReducer.js"; import { CommandMapper } from "./CommandMapper.js"; import { Command } from "./commands.js"; +import { ContractWrite } from "./ContractWrite.js"; import { ContractWriteManager } from "./ContractWriteManager.js"; +import { + superfluidHostABI, + superfluidHostAddress, +} from "./core/wagmi-generated.js"; import { ChildrenProp, isDefined } from "./utils.js"; type Props = { @@ -17,21 +32,16 @@ type Props = { }; export function CommandHandlerProvider({ children }: Props) { - const [{ status, commands, sessionId }, dispatch] = + const [{ status, commands, contractWrites, sessionId }, dispatch] = useCommandHandlerReducer(); - const [contractWrites, contractWriteResults] = useMemo(() => { - const contractWrites_ = commands - .map((x) => x.contractWrites) - .flat() - .filter(isDefined); - - const contractWritesResults_ = contractWrites_ + const contractWriteResults = useMemo(() => { + const contractWritesResults_ = contractWrites .map((x) => x.result) .filter(isDefined); - return [contractWrites_, contractWritesResults_]; - }, [commands]); + return contractWritesResults_; + }, [contractWrites]); const writeIndex = contractWriteResults.filter( (x) => x.transactionResult.isSuccess, @@ -42,7 +52,12 @@ export function CommandHandlerProvider({ children }: Props) { void dispatch({ type: "set commands", payload: commands }), [dispatch], ); - const reset = useCallback(() => void dispatch({ type: "reset" }), [dispatch]); + + const [batch, setBatch] = useState(false); + const reset = useCallback(() => { + void dispatch({ type: "reset" }); + setBatch(false); + }, [dispatch]); const contextValue = useMemo( () => ({ @@ -59,40 +74,137 @@ export function CommandHandlerProvider({ children }: Props) { ); return ( - - {typeof children === "function" ? children(contextValue) : children} - {commands.map((cmd, commandIndex_) => ( - - void dispatch({ - type: "set contract writes", - payload: { - commandId: cmd.id, - contractWrites: x, - }, - }) - } - /> - ))} - {contractWrites.map((contractWrite, writeIndex_) => ( - - void dispatch({ - type: "set contract write result", - payload: { - commandId: contractWrite.commandId, - writeId: contractWrite.id, - result, - }, - }) - } - /> - ))} - + <> + {Boolean(contractWrites.length) && ( + + { + setBatch(true); + + console.log("hey"); + + if ( + contractWrites.filter((x) => !x.materializeForBatchCall) + .length === 0 + ) { + const chainId = contractWrites[0] + .chainId as keyof typeof superfluidHostAddress; + dispatch({ + type: "set contract writes", + payload: { + contractWrites: [ + createContractWrite({ + commandId: nanoid(), + displayTitle: "Batch Call", + chainId: chainId, + materialize: () => { + const args = [ + contractWrites.map( + (x) => x.materializeForBatchCall!()!, + ), + ] as const; // TODO(KK): bangs + + console.log({ + args, + }); + + return { + abi: superfluidHostABI, + address: superfluidHostAddress[chainId], + functionName: "batchCall", + args, + }; + }, + }), + ], + }, + }); + } else { + console.log("Should not be here..."); + } + }} + /> + } + label="Batch?" + /> + + )} + + {typeof children === "function" ? children(contextValue) : children} + {commands.map((cmd, commandIndex_) => ( + + void dispatch({ + type: "add contract writes", + payload: { + contractWrites: x, + }, + }) + } + /> + ))} + {contractWrites.map((contractWrite, writeIndex_) => ( + + void dispatch({ + type: "set contract write result", + payload: { + writeId: contractWrite.id, + result, + }, + }) + } + /> + ))} + + ); } + +const createContractWrite = < + TAbi extends Abi | readonly unknown[] = Abi, + TFunctionName extends string = string, +>( + arg: Pick & { + signatureRequest?: Parameters[0]; + materialize: ( + signature?: ReturnType["data"], + ) => ContractFunctionConfig & + GetValue; + materializeForBatchCall?: ( + signature?: ReturnType["data"], + ) => [ + number, + Address, + ContractFunctionConfig & + GetValue, + ]; + }, +): ContractWrite => + ({ + id: nanoid(), + ...arg, // TODO(KK): handle gnosis safe bug + materializeForBatchCall: (signature) => { + console.log("foo"); + + if (!arg.materializeForBatchCall) { + return undefined; + } + const [operationType, target, call] = + arg.materializeForBatchCall(signature); + + console.log({ + call, + }); + + return { operationType, target, data: encodeFunctionData(call) }; + }, + }) as ContractWrite; diff --git a/packages/widget/src/CommandHandlerState.ts b/packages/widget/src/CommandHandlerState.ts index d0f4ff76..29e3ddb6 100644 --- a/packages/widget/src/CommandHandlerState.ts +++ b/packages/widget/src/CommandHandlerState.ts @@ -7,24 +7,27 @@ export type State = Idle | Initialized | Handling; type Idle = { status: "idle"; commands: ReadonlyArray; + contractWrites: ReadonlyArray; sessionId: null; }; type Initialized = { status: "initialized"; - commands: ReadonlyArray; + commands: ReadonlyArray; + contractWrites: ReadonlyArray< + ContractWrite & { + result?: ContractWriteResult | undefined; + } + >; sessionId: null; }; type Handling = { status: "handling"; - commands: ReadonlyArray< - Command & { - contractWrites: ReadonlyArray< - ContractWrite & { - result: ContractWriteResult; - } - >; + commands: ReadonlyArray; + contractWrites: ReadonlyArray< + ContractWrite & { + result: ContractWriteResult; } >; sessionId: string; @@ -45,12 +48,12 @@ type Handling = { // sessionId: string; // }; -export type CommandHandlingAggregate = Command & { - contractWrites?: - | ReadonlyArray< - ContractWrite & { - result?: ContractWriteResult | undefined; - } - > - | undefined; -}; +// export type ContractWriteAggregate = { +// contractWrites?: +// | ReadonlyArray< +// ContractWrite & { +// result?: ContractWriteResult | undefined; +// } +// > +// | undefined; +// }; diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 42b71492..41a4c154 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -1,7 +1,15 @@ import { nanoid } from "nanoid"; import { useEffect, useMemo } from "react"; -import { Abi, ContractFunctionConfig, GetValue } from "viem"; -import { useContractRead, useContractReads } from "wagmi"; +import { + Abi, + Address, + ContractFunctionConfig, + encodeAbiParameters, + encodeFunctionData, + GetValue, + parseAbiParameters, +} from "viem"; +import { useContractRead, useContractReads, useSignTypedData } from "wagmi"; import { Command, @@ -16,6 +24,8 @@ import { autoWrapStrategyAddress, cfAv1ForwarderABI, cfAv1ForwarderAddress, + constantFlowAgreementV1ABI, + constantFlowAgreementV1Address, erc20ABI, mapTimePeriodToSeconds, nativeAssetSuperTokenABI, @@ -38,9 +48,44 @@ export function CommandMapper({ command: cmd, ...props }: CommandMapperProps) { return ; case "Subscribe": return ; + // case "Batch": + // return ; } } +// export function BatchCommandMapper({ +// command: cmd, +// onMapped, +// children, +// }: CommandMapperProps) { +// const contractWrites = useMemo(() => { +// const contractWrites_: ContractWrite[] = []; + +// contractWrites_.push( +// createContractWrite({ +// commandId: cmd.id, +// displayTitle: "Batch Call", +// chainId: cmd.chainId, +// materialize: () => ({ +// abi: superfluidHostABI, +// address: superfluidHostAddress[cmd.chainId], +// functionName: "batchCall", +// args: cmd.innerWrites.map(x => x.materializeForBatchCall!()!) as any // TODO(KK): readonly type annoyance +// }), +// }), +// ); + +// return contractWrites_; +// }, [cmd.id]); + +// useEffect( +// () => (onMapped?.(contractWrites)), +// [contractWrites], +// ); + +// return <>{children?.(contractWrites)}; +// } + export function EnableAutoWrapCommandMapper({ command: cmd, onMapped, @@ -87,17 +132,19 @@ export function EnableAutoWrapCommandMapper({ commandId: cmd.id, displayTitle: "Enable Auto-Wrap", chainId: cmd.chainId, - abi: autoWrapManagerABI, - address: autoWrapManagerAddress[cmd.chainId], - functionName: "createWrapSchedule", - args: [ - cmd.superTokenAddress, - autoWrapStrategyAddress[cmd.chainId], - cmd.underlyingTokenAddress, - 3000000000n, - 172800n, - 604800n, - ], + materialize: () => ({ + abi: autoWrapManagerABI, + address: autoWrapManagerAddress[cmd.chainId], + functionName: "createWrapSchedule", + args: [ + cmd.superTokenAddress, + autoWrapStrategyAddress[cmd.chainId], + cmd.underlyingTokenAddress, + 3000000000n, + 172800n, + 604800n, + ] as const, + }), }), ); } @@ -110,10 +157,12 @@ export function EnableAutoWrapCommandMapper({ getUnderlyingToken(cmd.underlyingTokenAddress).symbol } Allowance`, chainId: cmd.chainId, - abi: erc20ABI, - functionName: "approve", - address: cmd.underlyingTokenAddress, - args: [autoWrapStrategyAddress[cmd.chainId], MaxUint256], + materialize: () => ({ + abi: erc20ABI, + functionName: "approve", + address: cmd.underlyingTokenAddress, + args: [autoWrapStrategyAddress[cmd.chainId], MaxUint256] as const, + }), }), ); } @@ -161,29 +210,44 @@ export function WrapIntoSuperTokensCommandMapper({ getSuperToken(cmd.superTokenAddress).symbol }`, chainId: cmd.chainId, - abi: nativeAssetSuperTokenABI, - functionName: "upgradeByETH", - address: cmd.superTokenAddress, - value: cmd.amountWeiFromUnderlyingTokenDecimals, + materialize: () => ({ + abi: nativeAssetSuperTokenABI, + functionName: "upgradeByETH", + address: cmd.superTokenAddress, + value: cmd.amountWeiFromUnderlyingTokenDecimals, + }), + materializeForBatchCall: () => [ + 101, + cmd.superTokenAddress, + { + abi: nativeAssetSuperTokenABI, + functionName: "upgradeByETH", + address: cmd.superTokenAddress, + value: cmd.amountWeiFromUnderlyingTokenDecimals, + }, + ], }), ); } else { if (allowance !== undefined) { if (allowance < cmd.amountWeiFromUnderlyingTokenDecimals) { + const underlyingTokenAddress = cmd.underlyingToken.address; contractWrites_.push( createContractWrite({ commandId: cmd.id, displayTitle: `Approve ${ - getUnderlyingToken(cmd.underlyingToken.address).symbol + getUnderlyingToken(underlyingTokenAddress).symbol } Allowance`, chainId: cmd.chainId, - abi: erc20ABI, - functionName: "approve", - address: cmd.underlyingToken.address, - args: [ - cmd.superTokenAddress, - cmd.amountWeiFromUnderlyingTokenDecimals, - ], + materialize: () => ({ + abi: erc20ABI, + functionName: "approve", + address: underlyingTokenAddress, + args: [ + cmd.superTokenAddress, + cmd.amountWeiFromUnderlyingTokenDecimals, + ] as const, + }), }), ); } @@ -195,10 +259,22 @@ export function WrapIntoSuperTokensCommandMapper({ getUnderlyingToken(cmd.underlyingToken.address).symbol } into ${getSuperToken(cmd.superTokenAddress).symbol}`, chainId: cmd.chainId, - abi: superTokenABI, - address: cmd.superTokenAddress, - functionName: "upgrade", - args: [cmd.amountWeiFromSuperTokenDecimals], + materialize: () => ({ + abi: superTokenABI, + address: cmd.superTokenAddress, + functionName: "upgrade", + args: [cmd.amountWeiFromSuperTokenDecimals] as const, + }), + materializeForBatchCall: () => [ + 101, + cmd.superTokenAddress, + { + abi: superTokenABI, + address: cmd.superTokenAddress, + functionName: "upgrade", + args: [cmd.amountWeiFromSuperTokenDecimals] as const, + }, + ], }), ); } @@ -242,11 +318,24 @@ export function SubscribeCommandMapper({ createContractWrite({ commandId: cmd.id, displayTitle: "Transfer", - abi: erc20ABI, - address: cmd.superTokenAddress, chainId: cmd.chainId, - functionName: "transfer", - args: [cmd.receiverAddress, cmd.transferAmountWei], + materialize: () => ({ + abi: erc20ABI, + address: cmd.superTokenAddress, + functionName: "transfer", + args: [cmd.receiverAddress, cmd.transferAmountWei] as const, + }), + // TODO(KK): Is 2 correct? + materializeForBatchCall: () => [ + 2, + cmd.superTokenAddress, + { + abi: erc20ABI, + address: cmd.superTokenAddress, + functionName: "transfer", + args: [cmd.receiverAddress, cmd.transferAmountWei] as const, + }, + ], }), ); } @@ -259,16 +348,33 @@ export function SubscribeCommandMapper({ createContractWrite({ commandId: cmd.id, displayTitle: "Modify Stream", - abi: cfAv1ForwarderABI, - address: cfAv1ForwarderAddress[cmd.chainId], chainId: cmd.chainId, - functionName: "updateFlow", - args: [ - cmd.superTokenAddress, - cmd.accountAddress, - cmd.receiverAddress, - updatedFlowRate, - cmd.userData, + materialize: () => ({ + abi: cfAv1ForwarderABI, + address: cfAv1ForwarderAddress[cmd.chainId], + functionName: "updateFlow", + args: [ + cmd.superTokenAddress, + cmd.accountAddress, + cmd.receiverAddress, + updatedFlowRate, + cmd.userData, + ] as const, + }), + materializeForBatchCall: () => [ + 201, + constantFlowAgreementV1Address[cmd.chainId], + { + abi: constantFlowAgreementV1ABI, + address: constantFlowAgreementV1Address[cmd.chainId], + functionName: "updateFlow", + args: [ + cmd.superTokenAddress, + cmd.receiverAddress, + updatedFlowRate, + cmd.userData, + ] as const, + }, ], }), ); @@ -277,16 +383,33 @@ export function SubscribeCommandMapper({ createContractWrite({ commandId: cmd.id, displayTitle: "Send Stream", - abi: cfAv1ForwarderABI, - address: cfAv1ForwarderAddress[cmd.chainId], chainId: cmd.chainId, - functionName: "createFlow", - args: [ - cmd.superTokenAddress, - cmd.accountAddress, - cmd.receiverAddress, - flowRate, - cmd.userData, + materialize: () => ({ + abi: cfAv1ForwarderABI, + address: cfAv1ForwarderAddress[cmd.chainId], + functionName: "createFlow", + args: [ + cmd.superTokenAddress, + cmd.accountAddress, + cmd.receiverAddress, + flowRate, + cmd.userData, + ] as const, + }), + materializeForBatchCall: () => [ + 201, + constantFlowAgreementV1Address[cmd.chainId], + { + abi: constantFlowAgreementV1ABI, + address: constantFlowAgreementV1Address[cmd.chainId], + functionName: "createFlow", + args: [ + cmd.superTokenAddress, + cmd.receiverAddress, + flowRate, + cmd.userData, + ] as const, + }, ], }), ); @@ -304,16 +427,55 @@ export function SubscribeCommandMapper({ return <>{children?.(contractWrites)}; } +// TODO(KK): Get rid of batch call? +// TODO(KK): viem had some function to extract a call... const createContractWrite = < TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, >( - arg: ContractFunctionConfig & - GetValue & - Pick, + arg: Pick & { + signatureRequest?: Parameters[0]; + materialize: ( + signature?: ReturnType["data"], + ) => ContractFunctionConfig & + GetValue; + materializeForBatchCall?: ( + signature?: ReturnType["data"], + ) => [ + number, + Address, + ContractFunctionConfig & + GetValue, + ]; + }, ): ContractWrite => ({ id: nanoid(), - value: 0n, // Gnosis Safe has a bug that required "value" to be specified: https://github.com/wagmi-dev/wagmi/issues/2887 - ...arg, + ...arg, // TODO(KK): handle gnosis safe bug + materializeForBatchCall: (signature) => { + console.log("???"); + + if (!arg.materializeForBatchCall) { + return undefined; + } + + const [operationType, target, call] = + arg.materializeForBatchCall(signature); + + console.log({ + call, + }); + + const callData = encodeFunctionData(call); + const data = encodeAbiParameters(parseAbiParameters("bytes, bytes"), [ + callData, + "0x", + ]); + + console.log({ + callData, + }); + + return { operationType, target, data }; + }, }) as ContractWrite; diff --git a/packages/widget/src/ContractWrite.ts b/packages/widget/src/ContractWrite.ts index bc6b63b7..783329ac 100644 --- a/packages/widget/src/ContractWrite.ts +++ b/packages/widget/src/ContractWrite.ts @@ -1,15 +1,29 @@ -import { Abi, ContractFunctionConfig, GetValue } from "viem"; +import { + Abi, + Address, + ContractFunctionConfig, + encodeFunctionData, + GetValue, +} from "viem"; +import { useSignTypedData } from "wagmi"; import { ChainId } from "./core/index.js"; -export type ContractWrite = ContractFunctionConfig< - Abi, - string, - "payable" | "nonpayable" -> & - GetValue & { - id: string; - commandId: string; - displayTitle: string; - chainId: ChainId | number; - }; +export type ContractWrite = { + id: string; + displayTitle: string; + commandId: string; + chainId: ChainId | number; + signatureRequest?: Parameters[0]; + materialize: ( + signature?: ReturnType["data"], + ) => ContractFunctionConfig & + GetValue; + materializeForBatchCall?: ( + signature?: ReturnType["data"], + ) => Readonly<{ + operationType: number; + target: Address; + data: ReturnType; + }>; +}; diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index bfb9618a..2803283a 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -41,6 +41,20 @@ export default function ContractWriteButton({ }); }, [write, eventListeners.onButtonClick]); + // encodeFunctionData({ + // abi: , + // }); + + // useContractWrite({ + // abi: superfluidHostABI, + // address: superfluidHostAddress[expectedChainId as keyof typeof superfluidHostAddress], + // functionName: "batchCall", + // args: [ + // // SuperUpgrader + // // createFlow + // ] + // }) + return ( {needsToSwitchNetwork ? ( @@ -54,19 +68,84 @@ export default function ContractWriteButton({ Switch Network ) : ( - - {contractWrite.displayTitle} - + <> + {/* + {isSignatureSuccess &&
Signature: {signatureData}
} + {isSignatureError &&
Error signing message
} */} + + {contractWrite.displayTitle} + + )}
); } + +// const typedData: Parameters[0] = { +// "types": { +// // "EIP712Domain": [ +// // { +// // "name": "name", +// // "type": "string" +// // }, +// // { +// // "name": "version", +// // "type": "string" +// // }, +// // { +// // "name": "chainId", +// // "type": "uint256" +// // }, +// // { +// // "name": "verifyingContract", +// // "type": "address" +// // } +// // ], +// "Permit": [ +// { +// "name": "owner", +// "type": "address" +// }, +// { +// "name": "spender", +// "type": "address" +// }, +// { +// "name": "value", +// "type": "uint256" +// }, +// { +// "name": "nonce", +// "type": "uint256" +// }, +// { +// "name": "deadline", +// "type": "uint256" +// } +// ], +// }, +// "primaryType": "Permit", +// // "domain": { +// // "name": erc20name, +// // "version": version, +// // "chainId": chainid, +// // "verifyingContract": tokenAddress +// // }, +// // "message": { +// // "owner": owner, +// // "spender": spender, +// // "value": value, +// // "nonce": nonce, +// // "deadline": deadline +// // } +// }; +// const { data: signatureData, signTypedData, isLoading: isSignatureLoading, isSuccess: isSignatureSuccess, isError: isSignatureError } = useSignTypedData(); diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index 8ae10586..22cb626a 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -34,8 +34,13 @@ export function ContractWriteManager({ const { chain } = useNetwork(); const prepare = _prepare && contractWrite.chainId === chain?.id; + const materialized = useMemo( + () => contractWrite.materialize(), + [contractWrite.id], + ); + const prepareResult = usePrepareContractWrite( - prepare ? contractWrite : undefined, + prepare ? materialized : undefined, ); const writeResult = useContractWrite(prepareResult.config); const transactionResult = useWaitForTransaction({ diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index ee9bd4c2..fb0b11db 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -28,6 +28,12 @@ export function ContractWriteStatus( ? theme.palette.warning.main : theme.palette.action.selected; + if (latestError) { + console.log({ + latestError, + }); + } + return ( ; + }; + } + | { + type: "add contract writes"; + payload: { contractWrites: ReadonlyArray; }; } | { type: "set contract write result"; payload: { - commandId: string; writeId: string; result: ContractWriteResult; }; @@ -33,36 +37,35 @@ export const useCommandHandlerReducer = () => case "reset": { draft.status = "idle"; draft.commands = []; + draft.contractWrites = []; draft.sessionId = null; break; } case "set commands": { draft.status = "initialized"; draft.commands = castDraft(action.payload); + draft.contractWrites = []; draft.sessionId = nanoid(); break; } case "set contract writes": { - const command = draft.commands.find( - (x) => x.id === action.payload.commandId, - ); - - if (!command) - throw new Error( - `Command not found with ID: ${action.payload.commandId}`, - ); - - command.contractWrites = castDraft(action.payload.contractWrites); + draft.contractWrites = castDraft(action.payload.contractWrites); + break; + } + case "add contract writes": { + for (const write of action.payload.contractWrites) { + (draft.contractWrites as ContractWrite[]).push(write); + } break; } case "set contract write result": { - const contractWrite = draft.commands - .find((x) => x.id === action.payload.commandId) - ?.contractWrites?.find((x) => x.id === action.payload.writeId); + const contractWrite = (draft.contractWrites ?? []).find( + (x) => x.id === action.payload.writeId, + ); if (!contractWrite) throw new Error( - `ContractWrite not found with ID: ${action.payload.commandId}.${action.payload.writeId}`, + `ContractWrite not found with ID: ${action.payload.writeId}`, ); // Initialize session when first transaction invoked. @@ -79,5 +82,5 @@ export const useCommandHandlerReducer = () => } } }, - { status: "idle", commands: [], sessionId: null }, + { status: "idle", commands: [], contractWrites: [], sessionId: null }, ); diff --git a/packages/widget/src/commands.ts b/packages/widget/src/commands.ts index ef22ac53..d06d5d8a 100644 --- a/packages/widget/src/commands.ts +++ b/packages/widget/src/commands.ts @@ -48,7 +48,16 @@ export type SubscribeCommand = { userData: `0x${string}`; }; +// export type BatchCallCommand = { +// id: string; +// type: "Batch"; +// chainId: ChainId; +// superTokenAddress: Address; +// innerWrites: Pick[] +// } + export type Command = | WrapIntoSuperTokensCommand | EnableAutoWrapCommand | SubscribeCommand; +// | BatchCallCommand; diff --git a/packages/widget/src/core/wagmi-generated.ts b/packages/widget/src/core/wagmi-generated.ts index 4735ab20..7cc53285 100644 --- a/packages/widget/src/core/wagmi-generated.ts +++ b/packages/widget/src/core/wagmi-generated.ts @@ -1,4 +1,4 @@ -// Generated by @wagmi/cli@1.3.0 on 8/28/2023 at 2:20:27 PM +// Generated by @wagmi/cli@1.3.0 on 9/5/2023 at 11:47:34 AM ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Super Token @@ -1235,6 +1235,1606 @@ export const pureSuperTokenABI = [ { stateMutability: "payable", type: "receive" }, ] as const; +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constant Flow Agreement V1 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) + * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) + */ +export const constantFlowAgreementV1ABI = [ + { + stateMutability: "nonpayable", + type: "constructor", + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + ], + }, + { type: "error", inputs: [], name: "AGREEMENT_BASE_ONLY_HOST" }, + { + type: "error", + inputs: [{ name: "_code", internalType: "uint256", type: "uint256" }], + name: "APP_RULE", + }, + { type: "error", inputs: [], name: "CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_NEGATIVE_ALLOWANCE" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_CREATE" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_FLOW_OPERATOR" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_UPDATE" }, + { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_ACL_UNCLEAN_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_DEPOSIT_TOO_BIG" }, + { type: "error", inputs: [], name: "CFA_FLOW_ALREADY_EXISTS" }, + { type: "error", inputs: [], name: "CFA_FLOW_DOES_NOT_EXIST" }, + { type: "error", inputs: [], name: "CFA_FLOW_RATE_TOO_BIG" }, + { type: "error", inputs: [], name: "CFA_HOOK_OUT_OF_GAS" }, + { type: "error", inputs: [], name: "CFA_INSUFFICIENT_BALANCE" }, + { type: "error", inputs: [], name: "CFA_INVALID_FLOW_RATE" }, + { type: "error", inputs: [], name: "CFA_NON_CRITICAL_SENDER" }, + { type: "error", inputs: [], name: "CFA_NO_SELF_FLOW" }, + { type: "error", inputs: [], name: "CFA_ZERO_ADDRESS_RECEIVER" }, + { type: "error", inputs: [], name: "CFA_ZERO_ADDRESS_SENDER" }, + { type: "error", inputs: [], name: "OUT_OF_GAS" }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "uuid", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "codeAddress", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "CodeUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { + name: "sender", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "flowOperator", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "permissions", + internalType: "uint8", + type: "uint8", + indexed: false, + }, + { + name: "flowRateAllowance", + internalType: "int96", + type: "int96", + indexed: false, + }, + ], + name: "FlowOperatorUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { + name: "sender", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "receiver", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "flowRate", + internalType: "int96", + type: "int96", + indexed: false, + }, + { + name: "totalSenderFlowRate", + internalType: "int256", + type: "int256", + indexed: false, + }, + { + name: "totalReceiverFlowRate", + internalType: "int256", + type: "int256", + indexed: false, + }, + { + name: "userData", + internalType: "bytes", + type: "bytes", + indexed: false, + }, + ], + name: "FlowUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "flowOperator", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "deposit", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + ], + name: "FlowUpdatedExtension", + }, + { + type: "event", + anonymous: false, + inputs: [ + { name: "version", internalType: "uint8", type: "uint8", indexed: false }, + ], + name: "Initialized", + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "CFA_HOOK_GAS_LIMIT", + outputs: [{ name: "", internalType: "uint64", type: "uint64" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "DEFAULT_MINIMUM_DEPOSIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "MAXIMUM_DEPOSIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "MAXIMUM_FLOW_RATE", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "pure", + type: "function", + inputs: [ + { name: "existingPermissions", internalType: "uint8", type: "uint8" }, + { name: "permissionDelta", internalType: "uint8", type: "uint8" }, + ], + name: "addPermissions", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], + }, + { + stateMutability: "pure", + type: "function", + inputs: [], + name: "agreementType", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "authorizeFlowOperatorWithFullControl", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [], + name: "castrate", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "createFlow", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "createFlowByOperator", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { + name: "subtractedFlowRateAllowance", + internalType: "int96", + type: "int96", + }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "decreaseFlowRateAllowance", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "permissionsToRemove", internalType: "uint8", type: "uint8" }, + { + name: "subtractedFlowRateAllowance", + internalType: "int96", + type: "int96", + }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "decreaseFlowRateAllowanceWithPermissions", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "deleteFlow", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "deleteFlowByOperator", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "getAccountFlowInfo", + outputs: [ + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "getCodeAddress", + outputs: [ + { name: "codeAddress", internalType: "address", type: "address" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowRate", internalType: "int96", type: "int96" }, + ], + name: "getDepositRequiredForFlowRate", + outputs: [{ name: "deposit", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + ], + name: "getFlow", + outputs: [ + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowId", internalType: "bytes32", type: "bytes32" }, + ], + name: "getFlowByID", + outputs: [ + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "flowOperator", internalType: "address", type: "address" }, + ], + name: "getFlowOperatorData", + outputs: [ + { name: "flowOperatorId", internalType: "bytes32", type: "bytes32" }, + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperatorId", internalType: "bytes32", type: "bytes32" }, + ], + name: "getFlowOperatorDataByID", + outputs: [ + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + ], + name: "getMaximumFlowRateFromDeposit", + outputs: [{ name: "flowRate", internalType: "int96", type: "int96" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "getNetFlow", + outputs: [{ name: "flowRate", internalType: "int96", type: "int96" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "addedFlowRateAllowance", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "increaseFlowRateAllowance", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "permissionsToAdd", internalType: "uint8", type: "uint8" }, + { name: "addedFlowRateAllowance", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "increaseFlowRateAllowanceWithPermissions", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + ], + name: "isPatricianPeriod", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "isPatricianPeriodNow", + outputs: [ + { + name: "isCurrentlyPatricianPeriod", + internalType: "bool", + type: "bool", + }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + { name: "time", internalType: "uint256", type: "uint256" }, + ], + name: "realtimeBalanceOf", + outputs: [ + { name: "dynamicBalance", internalType: "int256", type: "int256" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "pure", + type: "function", + inputs: [ + { name: "existingPermissions", internalType: "uint8", type: "uint8" }, + { name: "permissionDelta", internalType: "uint8", type: "uint8" }, + ], + name: "removePermissions", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "revokeFlowOperatorWithFullControl", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "newAddress", internalType: "address", type: "address" }], + name: "updateCode", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "updateFlow", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "updateFlowByOperator", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "updateFlowOperatorPermissions", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, +] as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) + * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) + */ +export const constantFlowAgreementV1Address = { + 1: "0x2844c1BBdA121E9E43105630b9C8310e5c72744b", + 5: "0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8", + 10: "0x204C6f131bb7F258b2Ea1593f5309911d8E458eD", + 56: "0x49c38108870e74Cb9420C0991a85D3edd6363F75", + 100: "0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D", + 137: "0x6EeE6060f715257b970700bc2656De21dEdF074C", + 420: "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", + 1442: "0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee", + 8453: "0x19ba78B9cDB05A877718841c574325fdB53601bb", + 42161: "0x731FdBB12944973B500518aea61942381d7e240D", + 42220: "0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad", + 43113: "0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A", + 43114: "0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58", + 80001: "0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873", + 84531: "0x4C476F2Fb27272680F2f6f2592E94d9e704691bC", + 421613: "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", + 11155111: "0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef", +} as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) + * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) + */ +export const constantFlowAgreementV1Config = { + address: constantFlowAgreementV1Address, + abi: constantFlowAgreementV1ABI, +} as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// SuperfluidHost +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) + * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) + */ +export const superfluidHostABI = [ + { + stateMutability: "nonpayable", + type: "constructor", + inputs: [ + { name: "nonUpgradable", internalType: "bool", type: "bool" }, + { name: "appWhiteListingEnabled", internalType: "bool", type: "bool" }, + ], + }, + { + type: "error", + inputs: [{ name: "_code", internalType: "uint256", type: "uint256" }], + name: "APP_RULE", + }, + { type: "error", inputs: [], name: "HOST_AGREEMENT_ALREADY_REGISTERED" }, + { type: "error", inputs: [], name: "HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION" }, + { type: "error", inputs: [], name: "HOST_AGREEMENT_IS_NOT_REGISTERED" }, + { + type: "error", + inputs: [], + name: "HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS", + }, + { + type: "error", + inputs: [], + name: "HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS", + }, + { + type: "error", + inputs: [], + name: "HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE", + }, + { type: "error", inputs: [], name: "HOST_INVALID_CONFIG_WORD" }, + { + type: "error", + inputs: [], + name: "HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY", + }, + { type: "error", inputs: [], name: "HOST_MAX_256_AGREEMENTS" }, + { type: "error", inputs: [], name: "HOST_MUST_BE_CONTRACT" }, + { type: "error", inputs: [], name: "HOST_NEED_MORE_GAS" }, + { type: "error", inputs: [], name: "HOST_NON_UPGRADEABLE" }, + { type: "error", inputs: [], name: "HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX" }, + { type: "error", inputs: [], name: "HOST_NOT_A_SUPER_APP" }, + { type: "error", inputs: [], name: "HOST_NO_APP_REGISTRATION_PERMISSIONS" }, + { type: "error", inputs: [], name: "HOST_ONLY_GOVERNANCE" }, + { type: "error", inputs: [], name: "HOST_ONLY_LISTED_AGREEMENT" }, + { type: "error", inputs: [], name: "HOST_RECEIVER_IS_NOT_SUPER_APP" }, + { type: "error", inputs: [], name: "HOST_SENDER_IS_NOT_SUPER_APP" }, + { type: "error", inputs: [], name: "HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL" }, + { type: "error", inputs: [], name: "HOST_SUPER_APP_ALREADY_REGISTERED" }, + { type: "error", inputs: [], name: "HOST_SUPER_APP_IS_JAILED" }, + { type: "error", inputs: [], name: "HOST_UNAUTHORIZED_SUPER_APP_FACTORY" }, + { type: "error", inputs: [], name: "HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE" }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "agreementType", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "code", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "AgreementClassRegistered", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "agreementType", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "code", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "AgreementClassUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "app", + internalType: "contract ISuperApp", + type: "address", + indexed: true, + }, + ], + name: "AppRegistered", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "uuid", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "codeAddress", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "CodeUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "oldGov", + internalType: "contract ISuperfluidGovernance", + type: "address", + indexed: false, + }, + { + name: "newGov", + internalType: "contract ISuperfluidGovernance", + type: "address", + indexed: false, + }, + ], + name: "GovernanceReplaced", + }, + { + type: "event", + anonymous: false, + inputs: [ + { name: "version", internalType: "uint8", type: "uint8", indexed: false }, + ], + name: "Initialized", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "app", + internalType: "contract ISuperApp", + type: "address", + indexed: true, + }, + { + name: "reason", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + ], + name: "Jail", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "newFactory", + internalType: "contract ISuperTokenFactory", + type: "address", + indexed: false, + }, + ], + name: "SuperTokenFactoryUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "token", + internalType: "contract ISuperToken", + type: "address", + indexed: true, + }, + { + name: "code", + internalType: "address", + type: "address", + indexed: false, + }, + ], + name: "SuperTokenLogicUpdated", + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "APP_WHITE_LISTING_ENABLED", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "CALLBACK_GAS_LIMIT", + outputs: [{ name: "", internalType: "uint64", type: "uint64" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "MAX_APP_CALLBACK_LEVEL", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "MAX_NUM_AGREEMENTS", + outputs: [{ name: "", internalType: "uint32", type: "uint32" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "NON_UPGRADABLE_DEPLOYMENT", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "bitmap", internalType: "uint256", type: "uint256" }, + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + ], + name: "addToAgreementClassesBitmap", + outputs: [{ name: "newBitmap", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "targetApp", + internalType: "contract ISuperApp", + type: "address", + }, + ], + name: "allowCompositeApp", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "appCreditUsedDelta", internalType: "int256", type: "int256" }, + ], + name: "appCallbackPop", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "appCreditGranted", internalType: "uint256", type: "uint256" }, + { name: "appCreditUsed", internalType: "int256", type: "int256" }, + { + name: "appCreditToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + name: "appCallbackPush", + outputs: [{ name: "appCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "operations", + internalType: "struct ISuperfluid.Operation[]", + type: "tuple[]", + components: [ + { name: "operationType", internalType: "uint32", type: "uint32" }, + { name: "target", internalType: "address", type: "address" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], + }, + ], + name: "batchCall", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + ], + name: "callAgreement", + outputs: [{ name: "returnedData", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAgreementWithContext", + outputs: [ + { name: "newCtx", internalType: "bytes", type: "bytes" }, + { name: "returnedData", internalType: "bytes", type: "bytes" }, + ], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + ], + name: "callAppAction", + outputs: [{ name: "returnedData", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAppActionWithContext", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "isTermination", internalType: "bool", type: "bool" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAppAfterCallback", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "isTermination", internalType: "bool", type: "bool" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAppBeforeCallback", + outputs: [{ name: "cbdata", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [], + name: "castrate", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "appCreditUsedMore", internalType: "int256", type: "int256" }, + ], + name: "ctxUseCredit", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "pure", + type: "function", + inputs: [{ name: "ctx", internalType: "bytes", type: "bytes" }], + name: "decodeCtx", + outputs: [ + { + name: "context", + internalType: "struct ISuperfluid.Context", + type: "tuple", + components: [ + { name: "appCallbackLevel", internalType: "uint8", type: "uint8" }, + { name: "callType", internalType: "uint8", type: "uint8" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "msgSender", internalType: "address", type: "address" }, + { name: "agreementSelector", internalType: "bytes4", type: "bytes4" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + { + name: "appCreditGranted", + internalType: "uint256", + type: "uint256", + }, + { + name: "appCreditWantedDeprecated", + internalType: "uint256", + type: "uint256", + }, + { name: "appCreditUsed", internalType: "int256", type: "int256" }, + { name: "appAddress", internalType: "address", type: "address" }, + { + name: "appCreditToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + }, + ], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "operations", + internalType: "struct ISuperfluid.Operation[]", + type: "tuple[]", + components: [ + { name: "operationType", internalType: "uint32", type: "uint32" }, + { name: "target", internalType: "address", type: "address" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], + }, + ], + name: "forwardBatchCall", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + ], + name: "getAgreementClass", + outputs: [ + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "appAddr", internalType: "contract ISuperApp", type: "address" }, + ], + name: "getAppCallbackLevel", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + ], + name: "getAppManifest", + outputs: [ + { name: "isSuperApp", internalType: "bool", type: "bool" }, + { name: "isJailed", internalType: "bool", type: "bool" }, + { name: "noopMask", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "getCodeAddress", + outputs: [ + { name: "codeAddress", internalType: "address", type: "address" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "getGovernance", + outputs: [ + { + name: "", + internalType: "contract ISuperfluidGovernance", + type: "address", + }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "getNow", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "getSuperTokenFactory", + outputs: [ + { + name: "factory", + internalType: "contract ISuperTokenFactory", + type: "address", + }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "getSuperTokenFactoryLogic", + outputs: [{ name: "logic", internalType: "address", type: "address" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "gov", + internalType: "contract ISuperfluidGovernance", + type: "address", + }, + ], + name: "initialize", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + ], + name: "isAgreementClassListed", + outputs: [{ name: "yes", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + ], + name: "isAgreementTypeListed", + outputs: [{ name: "yes", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + ], + name: "isApp", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + ], + name: "isAppJailed", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { + name: "targetApp", + internalType: "contract ISuperApp", + type: "address", + }, + ], + name: "isCompositeAppAllowed", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "ctx", internalType: "bytes", type: "bytes" }], + name: "isCtxValid", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "forwarder", internalType: "address", type: "address" }], + name: "isTrustedForwarder", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "reason", internalType: "uint256", type: "uint256" }, + ], + name: "jailApp", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "bitmap", internalType: "uint256", type: "uint256" }], + name: "mapAgreementClasses", + outputs: [ + { + name: "agreementClasses", + internalType: "contract ISuperAgreement[]", + type: "address[]", + }, + ], + }, + { + stateMutability: "pure", + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "agreementClassLogic", + internalType: "contract ISuperAgreement", + type: "address", + }, + ], + name: "registerAgreementClass", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "configWord", internalType: "uint256", type: "uint256" }], + name: "registerApp", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "configWord", internalType: "uint256", type: "uint256" }, + ], + name: "registerAppByFactory", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "configWord", internalType: "uint256", type: "uint256" }, + { name: "registrationKey", internalType: "string", type: "string" }, + ], + name: "registerAppWithKey", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "bitmap", internalType: "uint256", type: "uint256" }, + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + ], + name: "removeFromAgreementClassesBitmap", + outputs: [{ name: "newBitmap", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "newGov", + internalType: "contract ISuperfluidGovernance", + type: "address", + }, + ], + name: "replaceGovernance", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "agreementClassLogic", + internalType: "contract ISuperAgreement", + type: "address", + }, + ], + name: "updateAgreementClass", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "newAddress", internalType: "address", type: "address" }], + name: "updateCode", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "newFactory", + internalType: "contract ISuperTokenFactory", + type: "address", + }, + ], + name: "updateSuperTokenFactory", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "newLogicOverride", internalType: "address", type: "address" }, + ], + name: "updateSuperTokenLogic", + outputs: [], + }, + { + stateMutability: "pure", + type: "function", + inputs: [], + name: "versionRecipient", + outputs: [{ name: "", internalType: "string", type: "string" }], + }, +] as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) + * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) + */ +export const superfluidHostAddress = { + 1: "0x4E583d9390082B65Bef884b629DFA426114CED6d", + 5: "0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9", + 10: "0x567c4B141ED61923967cA25Ef4906C8781069a10", + 56: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E", + 100: "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7", + 137: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7", + 420: "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", + 1442: "0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704", + 8453: "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74", + 42161: "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192", + 42220: "0xA4Ff07cF81C02CFD356184879D953970cA957585", + 43113: "0x85Fe79b998509B77BF10A8BD4001D58475D29386", + 43114: "0x60377C7016E4cdB03C87EF474896C11cB560752C", + 80001: "0xEB796bdb90fFA0f28255275e16936D25d3418603", + 84531: "0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6", + 421613: "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", + 11155111: "0x109412E3C84f0539b43d39dB691B08c90f58dC7c", +} as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) + * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) + */ +export const superfluidHostConfig = { + address: superfluidHostAddress, + abi: superfluidHostABI, +} as const; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // SuperfluidGovernance ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/packages/widget/wagmi.config.ts b/packages/widget/wagmi.config.ts index 869a83fd..4e52e0eb 100644 --- a/packages/widget/wagmi.config.ts +++ b/packages/widget/wagmi.config.ts @@ -1,4 +1,6 @@ +import constantFlowAgreementV1JSON from "@superfluid-finance/ethereum-contracts/artifacts/contracts/agreements/ConstantFlowAgreementV1.sol/ConstantFlowAgreementV1.json" assert { type: "json" }; import superfluidGovernanceJSON from "@superfluid-finance/ethereum-contracts/artifacts/contracts/gov/SuperfluidGovernanceII.sol/SuperfluidGovernanceII.json" assert { type: "json" }; +import superfluidHostJSON from "@superfluid-finance/ethereum-contracts/artifacts/contracts/superfluid/Superfluid.sol/Superfluid.json" assert { type: "json" }; import superTokenJSON from "@superfluid-finance/ethereum-contracts/artifacts/contracts/superfluid/SuperToken.sol/SuperToken.json" assert { type: "json" }; import pureSuperTokenJSON from "@superfluid-finance/ethereum-contracts/artifacts/contracts/tokens/PureSuperToken.sol/PureSuperToken.json" assert { type: "json" }; import nativeAssetSuperTokenJSON from "@superfluid-finance/ethereum-contracts/artifacts/contracts/tokens/SETH.sol/SETHProxy.json" assert { type: "json" }; @@ -28,6 +30,28 @@ export default defineConfig({ name: "Pure Super Token", abi: pureSuperTokenJSON.abi as Abi, }, + { + name: "Constant Flow Agreement V1", + abi: constantFlowAgreementV1JSON.abi as Abi, + address: superfluidMetadata.networks.reduce( + (acc, network) => { + acc[network.chainId] = network.contractsV1.cfaV1 as `0x${string}`; + return acc; + }, + {} as Record, + ), + }, + { + name: "SuperfluidHost", + abi: superfluidHostJSON.abi as Abi, + address: superfluidMetadata.networks.reduce( + (acc, network) => { + acc[network.chainId] = network.contractsV1.host as `0x${string}`; + return acc; + }, + {} as Record, + ), + }, { name: "SuperfluidGovernance", abi: superfluidGovernanceJSON.abi as Abi, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index a17bddca..c0840c4a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: false @@ -6,6 +6,7 @@ settings: overrides: react-hook-form: ~7.44.3 + '@superfluid-finance/ethereum-contracts': 1.7.2 eslint-plugin-react-hooks: 5.0.0-canary-7118f5dd7-20230705 importers: @@ -579,7 +580,7 @@ importers: specifier: ^5.14.6 version: 5.14.6(@emotion/react@11.11.1)(@emotion/styled@11.11.0)(@types/react@18.2.21)(react-dom@18.2.0)(react@18.2.0) '@superfluid-finance/ethereum-contracts': - specifier: ^1.7.2 + specifier: 1.7.2 version: 1.7.2 '@testing-library/react': specifier: ^14.0.0 From 426ed67be7ecb9b8f6cc5a401259f8c0263528a7 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Tue, 5 Sep 2023 16:39:02 +0000 Subject: [PATCH 02/46] add reference to SuperUpgrader and the permit token --- .../payment-option-view/PaymentOptionView.tsx | 6 +- .../SelectPaymentOption.tsx | 4 +- .../widget-preview/WidgetPreview.tsx | 43 ++- .../widget/src/CommandHandlerProvider.tsx | 20 +- packages/widget/src/CommandMapper.tsx | 254 +++++++++++++++--- packages/widget/src/ContractWriteButton.tsx | 89 +----- packages/widget/src/ContractWriteManager.tsx | 20 +- packages/widget/src/ContractWriteStatus.tsx | 6 - packages/widget/src/StepContentReview.tsx | 4 +- packages/widget/src/commands.ts | 25 +- packages/widget/src/core/wagmi-generated.ts | 219 ++++++++++++++- packages/widget/src/formValuesToCommands.ts | 2 +- packages/widget/wagmi.config.ts | 6 +- 13 files changed, 540 insertions(+), 158 deletions(-) diff --git a/apps/widget-builder/src/components/payment-option-view/PaymentOptionView.tsx b/apps/widget-builder/src/components/payment-option-view/PaymentOptionView.tsx index 53d9d85c..7ed04bdf 100644 --- a/apps/widget-builder/src/components/payment-option-view/PaymentOptionView.tsx +++ b/apps/widget-builder/src/components/payment-option-view/PaymentOptionView.tsx @@ -16,12 +16,12 @@ import { FlowRate, supportedNetworks, } from "@superfluid-finance/widget"; -import superTokenList from "@superfluid-finance/widget/tokenlist"; import Image from "next/image"; import { FC, ReactNode, useMemo } from "react"; import { getAddress } from "viem"; import NetworkAvatar from "../NetworkAvatar"; +import { widgetTokenList } from "../widget-preview/WidgetPreview"; type PaymentOptionRowProps = { label: string; @@ -84,11 +84,11 @@ const PaymentOptionView: FC = ({ const token = useMemo( () => - Object.values(superTokenList.tokens).find( + Object.values(widgetTokenList.tokens).find( (token) => token.address.toLowerCase() === superToken.address.toLowerCase(), ), - [superTokenList, superToken.address], + [superToken.address], ); const flowRateValue = useMemo(() => { diff --git a/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx b/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx index 47d1e12e..d8843180 100644 --- a/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx +++ b/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx @@ -41,7 +41,7 @@ import { ZodError } from "zod"; import InputWrapper, { InputInfo } from "../form/InputWrapper"; import NetworkAvatar from "../NetworkAvatar"; -import { WidgetProps } from "../widget-preview/WidgetPreview"; +import { WidgetProps, widgetTokenList } from "../widget-preview/WidgetPreview"; export type PaymentOptionWithSuperTokenAndNetwork = { network: NetworkAssetInfo; @@ -138,7 +138,7 @@ const SelectPaymentOption: FC = ({ const network = supportedNetworks.find( ({ name }) => name === selectedNetwork?.name, ); - return tokenList.tokens.filter( + return widgetTokenList.tokens.filter( (token) => token.chainId === network?.id && token.tags?.includes("supertoken"), ); diff --git a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx index d39bb3a2..e07b95a2 100644 --- a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx +++ b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx @@ -4,7 +4,10 @@ import SuperfluidWidget, { ProductDetails, WalletManager, } from "@superfluid-finance/widget"; -import tokenList from "@superfluid-finance/widget/tokenlist"; +import tokenList, { + SuperTokenList, + TokenInfo, +} from "@superfluid-finance/widget/tokenlist"; import { useWeb3Modal } from "@web3modal/react"; import { createContext, @@ -18,6 +21,40 @@ import { import useFontLoader from "../../hooks/useFontLoader"; +const permitTokens: TokenInfo[] = [ + { + address: "0x50c988f2c2cce525cc2067c93b8c4a43ec62a166", + name: "PERMIT: Super fUSDC Fake Token", + symbol: "pfUSDCx", + decimals: 18, + chainId: 80001, + extensions: { + superTokenInfo: { + type: "Wrapper", + underlyingTokenAddress: "0x60974a03baaa984ea79f4590ac1e88aaae31158a", + }, + }, + logoURI: + "https://raw.githubusercontent.com/superfluid-finance/assets/master/public/tokens/usdc/icon.svg", + tags: ["supertoken", "testnet"], + }, + { + address: "0x60974a03baaa984ea79f4590ac1e88aaae31158a", + name: "PERMIT: fUSDC Fake Token", + symbol: "pfUSDC", + decimals: 18, + chainId: 80001, + logoURI: + "https://raw.githubusercontent.com/superfluid-finance/assets/master/public/tokens/usdc/icon.svg", + tags: ["underlying", "testnet"], + }, +]; + +export const widgetTokenList = { + ...tokenList, + tokens: [...tokenList.tokens, ...permitTokens], +} as SuperTokenList; + export interface FontSettings { family: string; category: string; @@ -98,7 +135,7 @@ const switchLayout = ( { setBatch(true); - console.log("hey"); - if ( contractWrites.filter((x) => !x.materializeForBatchCall) .length === 0 @@ -100,17 +98,15 @@ export function CommandHandlerProvider({ children }: Props) { commandId: nanoid(), displayTitle: "Batch Call", chainId: chainId, - materialize: () => { + signatureRequest: contractWrites.find( + (x) => x.signatureRequest, + )?.signatureRequest, + materialize: (signature) => { const args = [ contractWrites.map( - (x) => x.materializeForBatchCall!()!, + (x) => x.materializeForBatchCall!(signature)!, ), ] as const; // TODO(KK): bangs - - console.log({ - args, - }); - return { abi: superfluidHostABI, address: superfluidHostAddress[chainId], @@ -193,18 +189,12 @@ const createContractWrite = < id: nanoid(), ...arg, // TODO(KK): handle gnosis safe bug materializeForBatchCall: (signature) => { - console.log("foo"); - if (!arg.materializeForBatchCall) { return undefined; } const [operationType, target, call] = arg.materializeForBatchCall(signature); - console.log({ - call, - }); - return { operationType, target, data: encodeFunctionData(call) }; }, }) as ContractWrite; diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 41a4c154..1337173a 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -7,6 +7,7 @@ import { encodeAbiParameters, encodeFunctionData, GetValue, + hexToSignature, parseAbiParameters, } from "viem"; import { useContractRead, useContractReads, useSignTypedData } from "wagmi"; @@ -15,6 +16,7 @@ import { Command, EnableAutoWrapCommand, SubscribeCommand, + SuperWrapIntoSuperTokensCommand, WrapIntoSuperTokensCommand, } from "./commands.js"; import { ContractWrite } from "./ContractWrite.js"; @@ -30,10 +32,15 @@ import { mapTimePeriodToSeconds, nativeAssetSuperTokenABI, superTokenABI, + superUpgraderABI, + superUpgraderAddress, } from "./core/index.js"; import { ChildrenProp, MaxUint256 } from "./utils.js"; import { useWidget } from "./WidgetContext.js"; +const NONCES_FN = "0x7ecebe00"; +const NAME_FN = "0x06fdde03"; + type CommandMapperProps = { command: TCommand; onMapped?: (contractWrites: ReadonlyArray) => void; @@ -48,43 +55,212 @@ export function CommandMapper({ command: cmd, ...props }: CommandMapperProps) { return ; case "Subscribe": return ; - // case "Batch": - // return ; + case "Super Wrap into Super Tokens": + return ; } } -// export function BatchCommandMapper({ -// command: cmd, -// onMapped, -// children, -// }: CommandMapperProps) { -// const contractWrites = useMemo(() => { -// const contractWrites_: ContractWrite[] = []; - -// contractWrites_.push( -// createContractWrite({ -// commandId: cmd.id, -// displayTitle: "Batch Call", -// chainId: cmd.chainId, -// materialize: () => ({ -// abi: superfluidHostABI, -// address: superfluidHostAddress[cmd.chainId], -// functionName: "batchCall", -// args: cmd.innerWrites.map(x => x.materializeForBatchCall!()!) as any // TODO(KK): readonly type annoyance -// }), -// }), -// ); - -// return contractWrites_; -// }, [cmd.id]); - -// useEffect( -// () => (onMapped?.(contractWrites)), -// [contractWrites], -// ); - -// return <>{children?.(contractWrites)}; -// } +export function SuperWrapIntoSuperTokensCommandMapper({ + command: cmd, + onMapped, + children, +}: CommandMapperProps) { + const { getSuperToken, getUnderlyingToken } = useWidget(); + + const isNativeAssetUnderlyingToken = cmd.underlyingToken.isNativeAsset; + + const { data: allowance, isSuccess } = useContractRead( + !isNativeAssetUnderlyingToken + ? { + chainId: cmd.chainId, + address: cmd.underlyingToken.address, + abi: erc20ABI, + functionName: "allowance", + args: [cmd.accountAddress, cmd.superTokenAddress], + } + : undefined, + ); + + const contractWrites = useMemo(() => { + const contractWrites_: ContractWrite[] = []; + + if (isNativeAssetUnderlyingToken) { + contractWrites_.push( + createContractWrite({ + commandId: cmd.id, + displayTitle: `Wrap to ${ + getSuperToken(cmd.superTokenAddress).symbol + }`, + chainId: cmd.chainId, + materialize: () => ({ + abi: nativeAssetSuperTokenABI, + functionName: "upgradeByETH", + address: cmd.superTokenAddress, + value: cmd.amountWeiFromUnderlyingTokenDecimals, + }), + materializeForBatchCall: () => [ + 101, + cmd.superTokenAddress, + { + abi: nativeAssetSuperTokenABI, + functionName: "upgradeByETH", + address: cmd.superTokenAddress, + value: cmd.amountWeiFromUnderlyingTokenDecimals, + }, + ], + }), + ); + } else { + if (allowance !== undefined) { + if (true) { + // TODO(KK) + const underlyingTokenAddress = cmd.underlyingToken.address; + contractWrites_.push( + createContractWrite({ + commandId: cmd.id, + displayTitle: `Approve ${ + getUnderlyingToken(underlyingTokenAddress).symbol + } Allowance & Wrap`, + chainId: cmd.chainId, + signatureRequest: { + types: { + EIP712Domain: [ + { + name: "name", + type: "string", + }, + { + name: "version", + type: "string", + }, + { + name: "chainId", + type: "uint256", + }, + { + name: "verifyingContract", + type: "address", + }, + ], + Permit: [ + { + name: "owner", + type: "address", + }, + { + name: "spender", + type: "address", + }, + { + name: "value", + type: "uint256", + }, + { + name: "nonce", + type: "uint256", + }, + { + name: "deadline", + type: "uint256", + }, + ], + }, + primaryType: "Permit", + domain: { + name: "8848c041d28adfad9910e0d402153ad1ab9333ba4ffe59cd611a2bf96f398366", + version: + "c89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + chainId: cmd.chainId, + verifyingContract: underlyingTokenAddress, + }, + message: { + owner: cmd.accountAddress, + spender: + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress + ], + value: cmd.amountWeiFromUnderlyingTokenDecimals * 2n, + nonce: 0, // TODO(KK): figure out + deadline: + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + }, + }, + materialize: (signature) => { + const sig = hexToSignature(signature!); + + console.log({ + v: Number(sig.v.toString()), + }); + + return { + abi: superUpgraderABI, + functionName: "manualUpgradeWithAuthorization", + address: + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress + ], + args: [ + cmd.amountWeiFromUnderlyingTokenDecimals, + cmd.amountWeiFromUnderlyingTokenDecimals * 2n, + BigInt( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + ), + Number(sig.v.toString()), + sig.r, + sig.s, + "0x", + ] as const, + }; + }, + materializeForBatchCall: (signature) => { + const sig = hexToSignature(signature!); + + console.log({ + v: Number(sig.v.toString()), + }); + + return [ + 202, + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress + ], + { + abi: superUpgraderABI, + functionName: "manualUpgradeWithAuthorization", + address: + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress + ], + args: [ + cmd.amountWeiFromUnderlyingTokenDecimals, + cmd.amountWeiFromUnderlyingTokenDecimals * 2n, + BigInt( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + ), + Number(sig.v.toString()), + sig.r, + sig.s, + "0x", + ] as const, + }, + ]; + }, + }), + ); + } + } + } + + return contractWrites_; + }, [cmd.id, isSuccess]); + + useEffect( + () => (isSuccess ? onMapped?.(contractWrites) : void 0), + [contractWrites], + ); + + return <>{children?.(contractWrites)}; +} export function EnableAutoWrapCommandMapper({ command: cmd, @@ -453,8 +629,6 @@ const createContractWrite = < id: nanoid(), ...arg, // TODO(KK): handle gnosis safe bug materializeForBatchCall: (signature) => { - console.log("???"); - if (!arg.materializeForBatchCall) { return undefined; } @@ -462,20 +636,12 @@ const createContractWrite = < const [operationType, target, call] = arg.materializeForBatchCall(signature); - console.log({ - call, - }); - const callData = encodeFunctionData(call); const data = encodeAbiParameters(parseAbiParameters("bytes, bytes"), [ callData, "0x", ]); - console.log({ - callData, - }); - return { operationType, target, data }; }, }) as ContractWrite; diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index 2803283a..a7614b26 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -11,6 +11,7 @@ export type ContractWriteButtonProps = ContractWriteResult; export default function ContractWriteButton({ contractWrite, + signatureResult, prepareResult, writeResult, transactionResult, @@ -41,19 +42,7 @@ export default function ContractWriteButton({ }); }, [write, eventListeners.onButtonClick]); - // encodeFunctionData({ - // abi: , - // }); - - // useContractWrite({ - // abi: superfluidHostABI, - // address: superfluidHostAddress[expectedChainId as keyof typeof superfluidHostAddress], - // functionName: "batchCall", - // args: [ - // // SuperUpgrader - // // createFlow - // ] - // }) + // const { data: signatureData, isLoading: isSignatureLoading, isSuccess: isSignatureSuccess, isError: isSignatureError, signTypedData } = useSignTypedData(contractWrite.signatureRequest); return ( @@ -69,9 +58,17 @@ export default function ContractWriteButton({ ) : ( <> - {/* - {isSignatureSuccess &&
Signature: {signatureData}
} - {isSignatureError &&
Error signing message
} */} + {Boolean(contractWrite.signatureRequest && !signatureResult.data) && ( + <> + + {signatureResult.isError &&
Error signing message
} + + )} ); } - -// const typedData: Parameters[0] = { -// "types": { -// // "EIP712Domain": [ -// // { -// // "name": "name", -// // "type": "string" -// // }, -// // { -// // "name": "version", -// // "type": "string" -// // }, -// // { -// // "name": "chainId", -// // "type": "uint256" -// // }, -// // { -// // "name": "verifyingContract", -// // "type": "address" -// // } -// // ], -// "Permit": [ -// { -// "name": "owner", -// "type": "address" -// }, -// { -// "name": "spender", -// "type": "address" -// }, -// { -// "name": "value", -// "type": "uint256" -// }, -// { -// "name": "nonce", -// "type": "uint256" -// }, -// { -// "name": "deadline", -// "type": "uint256" -// } -// ], -// }, -// "primaryType": "Permit", -// // "domain": { -// // "name": erc20name, -// // "version": version, -// // "chainId": chainid, -// // "verifyingContract": tokenAddress -// // }, -// // "message": { -// // "owner": owner, -// // "spender": spender, -// // "value": value, -// // "nonce": nonce, -// // "deadline": deadline -// // } -// }; -// const { data: signatureData, signTypedData, isLoading: isSignatureLoading, isSuccess: isSignatureSuccess, isError: isSignatureError } = useSignTypedData(); diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index 22cb626a..cea7f6d4 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -4,6 +4,7 @@ import { useContractWrite, useNetwork, usePrepareContractWrite, + useSignTypedData, useWaitForTransaction, } from "wagmi"; @@ -12,6 +13,7 @@ import { ChildrenProp } from "./utils.js"; export type ContractWriteResult = { contractWrite: ContractWrite; + signatureResult: ReturnType; prepareResult: ReturnType; writeResult: ReturnType; transactionResult: ReturnType; @@ -32,16 +34,23 @@ export function ContractWriteManager({ children, }: ContractWriteManagerProps) { const { chain } = useNetwork(); - const prepare = _prepare && contractWrite.chainId === chain?.id; + + const signatureResult = useSignTypedData(contractWrite.signatureRequest); const materialized = useMemo( - () => contractWrite.materialize(), - [contractWrite.id], + () => + !contractWrite.signatureRequest || signatureResult.data + ? contractWrite.materialize(signatureResult.data) + : undefined, + [contractWrite.id, signatureResult.data], ); + const prepare = + _prepare && materialized && contractWrite.chainId === chain?.id; const prepareResult = usePrepareContractWrite( prepare ? materialized : undefined, ); + const writeResult = useContractWrite(prepareResult.config); const transactionResult = useWaitForTransaction({ hash: writeResult.data?.hash, @@ -55,15 +64,18 @@ export function ContractWriteManager({ >, // TODO(KK): weird type mismatch writeResult, transactionResult, + signatureResult, latestError: (transactionResult.error || writeResult.error || - prepareResult.error) as unknown as BaseError, + prepareResult.error || + signatureResult.error) as unknown as BaseError, }), [ contractWrite.id, prepareResult.status, writeResult.status, transactionResult.status, + signatureResult.status, ], ); diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index fb0b11db..ee9bd4c2 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -28,12 +28,6 @@ export function ContractWriteStatus( ? theme.palette.warning.main : theme.palette.action.selected; - if (latestError) { - console.log({ - latestError, - }); - } - return ( await commandValidationSchema.safeParseAsync({ wrapIntoSuperTokensCommand: commands.find( - (x) => x.type === "Wrap into Super Tokens", + (x) => + x.type === "Wrap into Super Tokens" || + x.type === "Super Wrap into Super Tokens", // TODO(KK) ), subscribeCommand: commands.find((x) => x.type === "Subscribe"), }), diff --git a/packages/widget/src/commands.ts b/packages/widget/src/commands.ts index d06d5d8a..cad6e5ab 100644 --- a/packages/widget/src/commands.ts +++ b/packages/widget/src/commands.ts @@ -24,6 +24,28 @@ export type WrapIntoSuperTokensCommand = { amountWeiFromUnderlyingTokenDecimals: bigint; }; +export type SuperWrapIntoSuperTokensCommand = { + id: string; + type: "Super Wrap into Super Tokens"; + chainId: ChainId; + accountAddress: Address; + superTokenAddress: Address; + underlyingToken: + | { + isNativeAsset: false; + address: Address; + decimals: number; + } + | { + isNativeAsset: true; + address: undefined; + decimals: number; + }; + amountInUnits: `${number}`; + amountWeiFromSuperTokenDecimals: bigint; + amountWeiFromUnderlyingTokenDecimals: bigint; +}; + export type EnableAutoWrapCommand = { id: string; type: "Enable Auto-Wrap"; @@ -59,5 +81,6 @@ export type SubscribeCommand = { export type Command = | WrapIntoSuperTokensCommand | EnableAutoWrapCommand - | SubscribeCommand; + | SubscribeCommand + | SuperWrapIntoSuperTokensCommand; // | BatchCallCommand; diff --git a/packages/widget/src/core/wagmi-generated.ts b/packages/widget/src/core/wagmi-generated.ts index 7cc53285..5ee54449 100644 --- a/packages/widget/src/core/wagmi-generated.ts +++ b/packages/widget/src/core/wagmi-generated.ts @@ -1,4 +1,4 @@ -// Generated by @wagmi/cli@1.3.0 on 9/5/2023 at 11:47:34 AM +// Generated by @wagmi/cli@1.3.0 on 9/5/2023 at 2:44:28 PM ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Super Token @@ -3936,6 +3936,223 @@ export const erc721ABI = [ }, ] as const; +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// SuperUpgrader +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x80a18e53a1761cba151af445640c06046f0b62a5) + */ +export const superUpgraderABI = [ + { + stateMutability: "nonpayable", + type: "constructor", + inputs: [ + { name: "_usdc", internalType: "contract FakeUSDC", type: "address" }, + { name: "_usdcx", internalType: "contract ISuperToken", type: "address" }, + ], + }, + { type: "error", inputs: [], name: "BAD_ETH_TRANSFER" }, + { type: "error", inputs: [], name: "INVALID_HOST" }, + { type: "error", inputs: [], name: "LOWER_LIMIT_NOT_REACHED" }, + { type: "error", inputs: [], name: "NOT_ENOUGH_GAS_TANK_BALANCE" }, + { type: "error", inputs: [], name: "NOT_NEGATIVE_FLOW_RATE" }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "LOWER_LIMIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "TXN_SETUP_COST", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "UPPER_LIMIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + ], + name: "afterAgreementCreated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + ], + name: "afterAgreementTerminated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + ], + name: "afterAgreementUpdated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + ], + name: "beforeAgreementCreated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + ], + name: "beforeAgreementTerminated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + ], + name: "beforeAgreementUpdated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "", internalType: "address", type: "address" }], + name: "depositedEther", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "host", + outputs: [ + { name: "", internalType: "contract ISuperfluid", type: "address" }, + ], + }, + { + stateMutability: "payable", + type: "function", + inputs: [ + { + name: "initialUpgradeAmount", + internalType: "uint256", + type: "uint256", + }, + { + name: "totalAllowanceAmount", + internalType: "uint256", + type: "uint256", + }, + { name: "deadline", internalType: "uint256", type: "uint256" }, + { name: "v", internalType: "uint8", type: "uint8" }, + { name: "r", internalType: "bytes32", type: "bytes32" }, + { name: "s", internalType: "bytes32", type: "bytes32" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "manualUpgradeWithAuthorization", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "payable", + type: "function", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "topUpGasTank", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "upgradeWithAutomation", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "upgradeWithGasTankAutomation", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "usdc", + outputs: [{ name: "", internalType: "contract FakeUSDC", type: "address" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "usdcx", + outputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + ], + }, + { stateMutability: "payable", type: "receive" }, +] as const; + +/** + * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x80a18e53a1761cba151af445640c06046f0b62a5) + */ +export const superUpgraderAddress = { + 80001: "0x80A18e53a1761cba151af445640C06046F0b62a5", +} as const; + +/** + * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x80a18e53a1761cba151af445640c06046f0b62a5) + */ +export const superUpgraderConfig = { + address: superUpgraderAddress, + abi: superUpgraderABI, +} as const; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // CFAv1Forwarder ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/packages/widget/src/formValuesToCommands.ts b/packages/widget/src/formValuesToCommands.ts index 01a6dc1b..c663edc8 100644 --- a/packages/widget/src/formValuesToCommands.ts +++ b/packages/widget/src/formValuesToCommands.ts @@ -54,7 +54,7 @@ export const formValuesToCommands = ( if (amountWeiFromUnderlyingTokenDecimals !== 0n) { commands.push({ id: nanoid(), - type: "Wrap into Super Tokens", + type: "Super Wrap into Super Tokens", chainId: chainId, superTokenAddress, accountAddress, diff --git a/packages/widget/wagmi.config.ts b/packages/widget/wagmi.config.ts index 4e52e0eb..eb929dd6 100644 --- a/packages/widget/wagmi.config.ts +++ b/packages/widget/wagmi.config.ts @@ -71,8 +71,12 @@ export default defineConfig({ }), etherscan({ apiKey: "WW2B6KB1FAXNTWP8EJQJYFTK1CMG1W4DWZ", - chainId: 5, + chainId: 80001, contracts: [ + { + name: "SuperUpgrader", + address: "0x80a18e53a1761cba151af445640c06046f0b62a5", + }, { name: "CFAv1Forwarder", address: superfluidMetadata.networks.reduce( From 04cbb36d9aba1596a66a6f2e7d50124d9b6af459 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Wed, 6 Sep 2023 14:57:40 +0000 Subject: [PATCH 03/46] update viem & wagmi --- apps/hosted-widget/package.json | 4 +- .../hosted-widget/src/utils/deleteDemoFlow.ts | 2 +- apps/widget-builder/package.json | 4 +- examples/b2b-service-demo/package.json | 4 +- .../src/utils/deleteDemoFlow.tsx | 2 +- examples/donation-demo/package.json | 4 +- .../src/utils/deleteDemoFlow.tsx | 2 +- examples/gated-community-demo/package.json | 4 +- .../src/utils/deleteDemoFlow.ts | 2 +- .../widget-vite-react-rainbowkit/package.json | 4 +- .../widget-vite-react-web3modal/package.json | 4 +- packages/widget/package.json | 6 +- packages/widget/src/CommandMapper.tsx | 9 +- packages/widget/src/NetworkAvatar.tsx | 6 +- packages/widget/src/core/SupportedNetwork.ts | 6 +- pnpm-lock.yaml | 884 +++++++++--------- 16 files changed, 500 insertions(+), 447 deletions(-) diff --git a/apps/hosted-widget/package.json b/apps/hosted-widget/package.json index 9cd2d223..e9e36564 100644 --- a/apps/hosted-widget/package.json +++ b/apps/hosted-widget/package.json @@ -27,8 +27,8 @@ "react": "^18.2.0", "react-blockies": "^1.4.1", "react-dom": "^18.2.0", - "viem": "^1.8.1", - "wagmi": "^1.3.9", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.21.4" }, "devDependencies": { diff --git a/apps/hosted-widget/src/utils/deleteDemoFlow.ts b/apps/hosted-widget/src/utils/deleteDemoFlow.ts index 62fa1355..bf71e82c 100644 --- a/apps/hosted-widget/src/utils/deleteDemoFlow.ts +++ b/apps/hosted-widget/src/utils/deleteDemoFlow.ts @@ -1,6 +1,6 @@ import { cfAv1ForwarderABI } from "@superfluid-finance/widget"; import { getContract } from "viem"; -import { polygonMumbai } from "wagmi/chains"; +import { polygonMumbai } from "viem/chains"; import { wagmiConfigDemo } from "../DEMO-wagmi"; diff --git a/apps/widget-builder/package.json b/apps/widget-builder/package.json index b9a16307..cadb4328 100644 --- a/apps/widget-builder/package.json +++ b/apps/widget-builder/package.json @@ -33,8 +33,8 @@ "react": "^18.2.0", "react-dom": "^18.2.0", "react-hook-form": "~7.44.3", - "viem": "^1.8.1", - "wagmi": "^1.3.10", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.22.1", "zod-to-json-schema": "^3.21.4" }, diff --git a/examples/b2b-service-demo/package.json b/examples/b2b-service-demo/package.json index 54bc248e..3e7ca710 100644 --- a/examples/b2b-service-demo/package.json +++ b/examples/b2b-service-demo/package.json @@ -22,8 +22,8 @@ "react-dom": "18.2.0", "react-use-intercom": "^5.1.4", "typescript": "5.2.2", - "viem": "^1.8.1", - "wagmi": "^1.3.10", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.22.1" } } diff --git a/examples/b2b-service-demo/src/utils/deleteDemoFlow.tsx b/examples/b2b-service-demo/src/utils/deleteDemoFlow.tsx index 4856cd23..45ea505e 100644 --- a/examples/b2b-service-demo/src/utils/deleteDemoFlow.tsx +++ b/examples/b2b-service-demo/src/utils/deleteDemoFlow.tsx @@ -1,6 +1,6 @@ import { cfAv1ForwarderABI } from "@superfluid-finance/widget"; import { getContract } from "viem"; -import { polygonMumbai } from "wagmi/chains"; +import { polygonMumbai } from "viem/chains"; import configuration from "@/configuration"; diff --git a/examples/donation-demo/package.json b/examples/donation-demo/package.json index 888778a2..7071dee7 100644 --- a/examples/donation-demo/package.json +++ b/examples/donation-demo/package.json @@ -22,8 +22,8 @@ "react-dom": "18.2.0", "react-use-intercom": "^5.1.4", "typescript": "5.2.2", - "viem": "^1.8.1", - "wagmi": "^1.3.10", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.22.1" } } diff --git a/examples/donation-demo/src/utils/deleteDemoFlow.tsx b/examples/donation-demo/src/utils/deleteDemoFlow.tsx index 4856cd23..45ea505e 100644 --- a/examples/donation-demo/src/utils/deleteDemoFlow.tsx +++ b/examples/donation-demo/src/utils/deleteDemoFlow.tsx @@ -1,6 +1,6 @@ import { cfAv1ForwarderABI } from "@superfluid-finance/widget"; import { getContract } from "viem"; -import { polygonMumbai } from "wagmi/chains"; +import { polygonMumbai } from "viem/chains"; import configuration from "@/configuration"; diff --git a/examples/gated-community-demo/package.json b/examples/gated-community-demo/package.json index 063856ba..dce0dcdc 100644 --- a/examples/gated-community-demo/package.json +++ b/examples/gated-community-demo/package.json @@ -21,8 +21,8 @@ "react": "18.2.0", "react-dom": "18.2.0", "typescript": "5.2.2", - "viem": "^1.8.1", - "wagmi": "^1.3.10", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.22.1" } } diff --git a/examples/gated-community-demo/src/utils/deleteDemoFlow.ts b/examples/gated-community-demo/src/utils/deleteDemoFlow.ts index 4856cd23..45ea505e 100644 --- a/examples/gated-community-demo/src/utils/deleteDemoFlow.ts +++ b/examples/gated-community-demo/src/utils/deleteDemoFlow.ts @@ -1,6 +1,6 @@ import { cfAv1ForwarderABI } from "@superfluid-finance/widget"; import { getContract } from "viem"; -import { polygonMumbai } from "wagmi/chains"; +import { polygonMumbai } from "viem/chains"; import configuration from "@/configuration"; diff --git a/examples/widget-vite-react-rainbowkit/package.json b/examples/widget-vite-react-rainbowkit/package.json index 9c08dddb..d2311ee0 100644 --- a/examples/widget-vite-react-rainbowkit/package.json +++ b/examples/widget-vite-react-rainbowkit/package.json @@ -15,8 +15,8 @@ "@superfluid-finance/widget": "workspace:*", "react": "^18.2.0", "react-dom": "^18.2.0", - "viem": "^1.8.1", - "wagmi": "^1.3.10", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.22.2" }, "devDependencies": { diff --git a/examples/widget-vite-react-web3modal/package.json b/examples/widget-vite-react-web3modal/package.json index c7b4209c..61191bb5 100644 --- a/examples/widget-vite-react-web3modal/package.json +++ b/examples/widget-vite-react-web3modal/package.json @@ -16,8 +16,8 @@ "@web3modal/react": "^2.7.1", "react": "^18.2.0", "react-dom": "^18.2.0", - "viem": "^1.8.1", - "wagmi": "^1.3.10", + "viem": "^1.10.4", + "wagmi": "^1.4.1", "zod": "^3.22.1" }, "devDependencies": { diff --git a/packages/widget/package.json b/packages/widget/package.json index f5ca89eb..49017ae2 100644 --- a/packages/widget/package.json +++ b/packages/widget/package.json @@ -89,14 +89,14 @@ "@types/react": "^18.2.21", "@types/react-dom": "^18.2.7", "@vitejs/plugin-react": "^4.0.4", - "@wagmi/cli": "^1.3.0", + "@wagmi/cli": "^1.5.0", "jsdom": "^22.1.0", "tsconfig": "workspace:*", "typedoc": "^0.25.0", "typescript": "^5.2.2", - "viem": "^1.8.1", + "viem": "^1.10.4", "vitest": "^0.34.3", - "wagmi": "^1.3.10" + "wagmi": "^1.4.1" }, "peerDependencies": { "viem": ">=1", diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 1337173a..2ca28431 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -167,9 +167,8 @@ export function SuperWrapIntoSuperTokensCommandMapper({ }, primaryType: "Permit", domain: { - name: "8848c041d28adfad9910e0d402153ad1ab9333ba4ffe59cd611a2bf96f398366", - version: - "c89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6", + name: "Fake Permit USDC", + version: "1", chainId: cmd.chainId, verifyingContract: underlyingTokenAddress, }, @@ -189,7 +188,7 @@ export function SuperWrapIntoSuperTokensCommandMapper({ const sig = hexToSignature(signature!); console.log({ - v: Number(sig.v.toString()), + sig, }); return { @@ -216,7 +215,7 @@ export function SuperWrapIntoSuperTokensCommandMapper({ const sig = hexToSignature(signature!); console.log({ - v: Number(sig.v.toString()), + sig, }); return [ diff --git a/packages/widget/src/NetworkAvatar.tsx b/packages/widget/src/NetworkAvatar.tsx index 07142303..998b3420 100644 --- a/packages/widget/src/NetworkAvatar.tsx +++ b/packages/widget/src/NetworkAvatar.tsx @@ -1,7 +1,7 @@ import { Avatar, AvatarProps } from "@mui/material"; import { FC, useMemo } from "react"; -import { defaultNetworkAssets, SupportedNetwork } from "./core/index.js"; +import { defaultNetworkAssets,SupportedNetwork } from "./core/index.js"; export interface NetworkAvatarProps { network: SupportedNetwork; @@ -15,7 +15,9 @@ const NetworkAvatar: FC = ({ forceNetworkBackgroundColor, }) => { const networkAssetInfo = useMemo(() => { - return defaultNetworkAssets[network.id]; + return defaultNetworkAssets[ + network.id as keyof typeof defaultNetworkAssets + ]; }, [network]); const { sx: AvatarSx = {} } = AvatarProps; diff --git a/packages/widget/src/core/SupportedNetwork.ts b/packages/widget/src/core/SupportedNetwork.ts index 7de69748..1d91d9e3 100644 --- a/packages/widget/src/core/SupportedNetwork.ts +++ b/packages/widget/src/core/SupportedNetwork.ts @@ -15,7 +15,7 @@ import { optimismGoerli, polygon, polygonMumbai, -} from "wagmi/chains"; +} from "viem/chains"; import { z } from "zod"; export const supportedNetwork = { @@ -74,9 +74,9 @@ export const supportedNetworkSchema = z .object({ id: chainIdSchema, }) - .transform((x) => x as (typeof supportedNetworks_)[number]); + .transform((x) => x as (typeof supportedNetworks_)[number] & Chain); -export type SupportedNetwork = z.infer & Chain; +export type SupportedNetwork = z.infer; export const supportedNetworks = supportedNetworks_ as unknown as SupportedNetwork[]; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index c0840c4a..92970799 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -78,7 +78,7 @@ importers: version: link:../../packages/widget '@web3modal/ethereum': specifier: ^2.7.1 - version: 2.7.1(viem@1.8.1) + version: 2.7.1(viem@1.10.4) '@web3modal/react': specifier: ^2.7.1 version: 2.7.1(react-dom@18.2.0)(react@18.2.0) @@ -98,11 +98,11 @@ importers: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.9 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.21.4 version: 3.22.2 @@ -169,7 +169,7 @@ importers: version: link:../../packages/widget '@web3modal/ethereum': specifier: ^2.7.1 - version: 2.7.1(viem@1.8.1) + version: 2.7.1(viem@1.10.4) '@web3modal/react': specifier: ^2.7.1 version: 2.7.1(react-dom@18.2.0)(react@18.2.0) @@ -195,11 +195,11 @@ importers: specifier: ~7.44.3 version: 7.44.3(react@18.2.0) viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.22.1 version: 3.22.2 @@ -245,7 +245,7 @@ importers: version: 18.2.7 '@web3modal/ethereum': specifier: ^2.7.1 - version: 2.7.1(viem@1.8.1) + version: 2.7.1(viem@1.10.4) '@web3modal/react': specifier: ^2.7.1 version: 2.7.1(react-dom@18.2.0)(react@18.2.0) @@ -265,11 +265,11 @@ importers: specifier: 5.2.2 version: 5.2.2 viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.22.1 version: 3.22.2 @@ -293,7 +293,7 @@ importers: version: 18.2.7 '@web3modal/ethereum': specifier: ^2.7.1 - version: 2.7.1(viem@1.8.1) + version: 2.7.1(viem@1.10.4) '@web3modal/react': specifier: ^2.7.1 version: 2.7.1(react-dom@18.2.0)(react@18.2.0) @@ -313,11 +313,11 @@ importers: specifier: 5.2.2 version: 5.2.2 viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.22.1 version: 3.22.2 @@ -341,7 +341,7 @@ importers: version: 18.2.7 '@web3modal/ethereum': specifier: ^2.7.1 - version: 2.7.1(viem@1.8.1) + version: 2.7.1(viem@1.10.4) '@web3modal/react': specifier: ^2.7.1 version: 2.7.1(react-dom@18.2.0)(react@18.2.0) @@ -358,11 +358,11 @@ importers: specifier: 5.2.2 version: 5.2.2 viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.22.1 version: 3.22.2 @@ -371,7 +371,7 @@ importers: dependencies: '@rainbow-me/rainbowkit': specifier: ^1.0.9 - version: 1.0.9(@types/react@18.2.21)(react-dom@18.2.0)(react@18.2.0)(viem@1.8.1)(wagmi@1.3.10) + version: 1.0.9(@types/react@18.2.21)(react-dom@18.2.0)(react@18.2.0)(viem@1.10.4)(wagmi@1.4.1) '@superfluid-finance/widget': specifier: workspace:* version: link:../../packages/widget @@ -382,11 +382,11 @@ importers: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.22.2 version: 3.22.2 @@ -429,7 +429,7 @@ importers: version: link:../../packages/widget '@web3modal/ethereum': specifier: ^2.7.1 - version: 2.7.1(viem@1.8.1) + version: 2.7.1(viem@1.10.4) '@web3modal/react': specifier: ^2.7.1 version: 2.7.1(react-dom@18.2.0)(react@18.2.0) @@ -440,11 +440,11 @@ importers: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: specifier: ^3.22.1 version: 3.22.2 @@ -604,8 +604,8 @@ importers: specifier: ^4.0.4 version: 4.0.4(vite@4.4.9) '@wagmi/cli': - specifier: ^1.3.0 - version: 1.3.0(typescript@5.2.2)(wagmi@1.3.10) + specifier: ^1.5.0 + version: 1.5.0(typescript@5.2.2)(wagmi@1.4.1) jsdom: specifier: ^22.1.0 version: 22.1.0 @@ -619,14 +619,14 @@ importers: specifier: ^5.2.2 version: 5.2.2 viem: - specifier: ^1.8.1 - version: 1.8.1(typescript@5.2.2)(zod@3.22.2) + specifier: ^1.10.4 + version: 1.10.4(typescript@5.2.2)(zod@3.22.2) vitest: specifier: ^0.34.3 version: 0.34.3(jsdom@22.1.0) wagmi: - specifier: ^1.3.10 - version: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + specifier: ^1.4.1 + version: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) tests: devDependencies: @@ -657,11 +657,15 @@ packages: /@adraffy/ens-normalize@1.9.0: resolution: {integrity: sha512-iowxq3U30sghZotgl4s/oJRci6WPBfNO5YYgk2cIOMCHr3LeGPcsZjCEr+33Q4N+oV3OABDAtA+pyvWjbvBifQ==} + dev: true /@adraffy/ens-normalize@1.9.2: resolution: {integrity: sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==} dev: true + /@adraffy/ens-normalize@1.9.4: + resolution: {integrity: sha512-UK0bHA7hh9cR39V+4gl2/NnBBjoXIxkuWAPCaY4X7fbH4L/azIi7ilWOCjMUYfpJgraLUAqkRi2BqrjME8Rynw==} + /@ampproject/remapping@2.2.1: resolution: {integrity: sha512-lFMjJTrFL3j7L9yBxwYfCq2k6qqwHyzuUl/XBnif78PWTJYyL/dfowQHWE3sp6U6ZzqWiiIZnpTMO96zhkjwtg==} engines: {node: '>=6.0.0'} @@ -697,7 +701,7 @@ packages: '@babel/traverse': 7.22.8 '@babel/types': 7.22.5 convert-source-map: 1.9.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 gensync: 1.0.0-beta.2 json5: 2.2.3 semver: 6.3.1 @@ -862,6 +866,12 @@ packages: dependencies: regenerator-runtime: 0.14.0 + /@babel/runtime@7.22.15: + resolution: {integrity: sha512-T0O+aa+4w0u06iNmapipJXMV4HoUir03hpx3/YqXXhu9xim3w+dVphjFWl1OH8NbZHw5Lbm9k45drDkgq2VNNA==} + engines: {node: '>=6.9.0'} + dependencies: + regenerator-runtime: 0.14.0 + /@babel/template@7.22.5: resolution: {integrity: sha512-X7yV7eiwAxdj9k94NEylvbVHLiVG1nvzCV2EAowhxLTwODV1jl9UzZ48leOC0sH7OnuHrIkllaBgneUykIcZaw==} engines: {node: '>=6.9.0'} @@ -883,7 +893,7 @@ packages: '@babel/helper-split-export-declaration': 7.22.6 '@babel/parser': 7.22.7 '@babel/types': 7.22.5 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 globals: 11.12.0 transitivePeerDependencies: - supports-color @@ -1096,7 +1106,7 @@ packages: eth-rpc-errors: 4.0.2 json-rpc-engine: 6.1.0 keccak: 3.0.3 - preact: 10.17.0 + preact: 10.17.1 qs: 6.11.2 rxjs: 6.6.7 sha.js: 2.4.11 @@ -1421,7 +1431,7 @@ packages: /@ensdomains/ensjs@2.1.0: resolution: {integrity: sha512-GRbGPT8Z/OJMDuxs75U/jUNEC0tbL0aj7/L/QQznGYKm/tiasp+ndLOaoULy9kKJFC0TBByqfFliEHDgoLhyog==} dependencies: - '@babel/runtime': 7.22.11 + '@babel/runtime': 7.22.15 '@ensdomains/address-encoder': 0.1.9 '@ensdomains/ens': 0.4.5 '@ensdomains/resolver': 0.2.4 @@ -1439,6 +1449,15 @@ packages: deprecated: Please use @ensdomains/ens-contracts dev: true + /@esbuild/android-arm64@0.16.17: + resolution: {integrity: sha512-MIGl6p5sc3RDTLLkYL1MyL8BMRN4tLMRCn+yRJJmEDvYZ2M7tmAf80hx1kbNEUX2KJ50RRtxZ4JHLvCfuB6kBg==} + engines: {node: '>=12'} + cpu: [arm64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-arm64@0.18.20: resolution: {integrity: sha512-Nz4rJcchGDtENV0eMKUNa6L12zz2zBDXuhj/Vjh18zGqB44Bi7MBMSXjgunJgjRhCmKOjnPuZp4Mb6OKqtMHLQ==} engines: {node: '>=12'} @@ -1448,8 +1467,8 @@ packages: dev: true optional: true - /@esbuild/android-arm@0.15.13: - resolution: {integrity: sha512-RY2fVI8O0iFUNvZirXaQ1vMvK0xhCcl0gqRj74Z6yEiO1zAUa7hbsdwZM1kzqbxHK7LFyMizipfXT3JME+12Hw==} + /@esbuild/android-arm@0.16.17: + resolution: {integrity: sha512-N9x1CMXVhtWEAMS7pNNONyA14f71VPQN9Cnavj1XQh6T7bskqiLLrSca4O0Vr8Wdcga943eThxnVp3JLnBMYtw==} engines: {node: '>=12'} cpu: [arm] os: [android] @@ -1466,6 +1485,15 @@ packages: dev: true optional: true + /@esbuild/android-x64@0.16.17: + resolution: {integrity: sha512-a3kTv3m0Ghh4z1DaFEuEDfz3OLONKuFvI4Xqczqx4BqLyuFaFkuaG4j2MtA6fuWEFeC5x9IvqnX7drmRq/fyAQ==} + engines: {node: '>=12'} + cpu: [x64] + os: [android] + requiresBuild: true + dev: true + optional: true + /@esbuild/android-x64@0.18.20: resolution: {integrity: sha512-8GDdlePJA8D6zlZYJV/jnrRAi6rOiNaCC/JclcXpB+KIuvfBN4owLtgzY2bsxnx666XjJx2kDPUmnTtR8qKQUg==} engines: {node: '>=12'} @@ -1475,6 +1503,15 @@ packages: dev: true optional: true + /@esbuild/darwin-arm64@0.16.17: + resolution: {integrity: sha512-/2agbUEfmxWHi9ARTX6OQ/KgXnOWfsNlTeLcoV7HSuSTv63E4DqtAc+2XqGw1KHxKMHGZgbVCZge7HXWX9Vn+w==} + engines: {node: '>=12'} + cpu: [arm64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-arm64@0.18.20: resolution: {integrity: sha512-bxRHW5kHU38zS2lPTPOyuyTm+S+eobPUnTNkdJEfAddYgEcll4xkT8DB9d2008DtTbl7uJag2HuE5NZAZgnNEA==} engines: {node: '>=12'} @@ -1484,6 +1521,15 @@ packages: dev: true optional: true + /@esbuild/darwin-x64@0.16.17: + resolution: {integrity: sha512-2By45OBHulkd9Svy5IOCZt376Aa2oOkiE9QWUK9fe6Tb+WDr8hXL3dpqi+DeLiMed8tVXspzsTAvd0jUl96wmg==} + engines: {node: '>=12'} + cpu: [x64] + os: [darwin] + requiresBuild: true + dev: true + optional: true + /@esbuild/darwin-x64@0.18.20: resolution: {integrity: sha512-pc5gxlMDxzm513qPGbCbDukOdsGtKhfxD1zJKXjCCcU7ju50O7MeAZ8c4krSJcOIJGFR+qx21yMMVYwiQvyTyQ==} engines: {node: '>=12'} @@ -1493,6 +1539,15 @@ packages: dev: true optional: true + /@esbuild/freebsd-arm64@0.16.17: + resolution: {integrity: sha512-mt+cxZe1tVx489VTb4mBAOo2aKSnJ33L9fr25JXpqQqzbUIw/yzIzi+NHwAXK2qYV1lEFp4OoVeThGjUbmWmdw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-arm64@0.18.20: resolution: {integrity: sha512-yqDQHy4QHevpMAaxhhIwYPMv1NECwOvIpGCZkECn8w2WFHXjEwrBn3CeNIYsibZ/iZEUemj++M26W3cNR5h+Tw==} engines: {node: '>=12'} @@ -1502,6 +1557,15 @@ packages: dev: true optional: true + /@esbuild/freebsd-x64@0.16.17: + resolution: {integrity: sha512-8ScTdNJl5idAKjH8zGAsN7RuWcyHG3BAvMNpKOBaqqR7EbUhhVHOqXRdL7oZvz8WNHL2pr5+eIT5c65kA6NHug==} + engines: {node: '>=12'} + cpu: [x64] + os: [freebsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/freebsd-x64@0.18.20: resolution: {integrity: sha512-tgWRPPuQsd3RmBZwarGVHZQvtzfEBOreNuxEMKFcd5DaDn2PbBxfwLcj4+aenoh7ctXcbXmOQIn8HI6mCSw5MQ==} engines: {node: '>=12'} @@ -1511,6 +1575,15 @@ packages: dev: true optional: true + /@esbuild/linux-arm64@0.16.17: + resolution: {integrity: sha512-7S8gJnSlqKGVJunnMCrXHU9Q8Q/tQIxk/xL8BqAP64wchPCTzuM6W3Ra8cIa1HIflAvDnNOt2jaL17vaW+1V0g==} + engines: {node: '>=12'} + cpu: [arm64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm64@0.18.20: resolution: {integrity: sha512-2YbscF+UL7SQAVIpnWvYwM+3LskyDmPhe31pE7/aoTMFKKzIc9lLbyGUpmmb8a8AixOL61sQ/mFh3jEjHYFvdA==} engines: {node: '>=12'} @@ -1520,6 +1593,15 @@ packages: dev: true optional: true + /@esbuild/linux-arm@0.16.17: + resolution: {integrity: sha512-iihzrWbD4gIT7j3caMzKb/RsFFHCwqqbrbH9SqUSRrdXkXaygSZCZg1FybsZz57Ju7N/SHEgPyaR0LZ8Zbe9gQ==} + engines: {node: '>=12'} + cpu: [arm] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-arm@0.18.20: resolution: {integrity: sha512-/5bHkMWnq1EgKr1V+Ybz3s1hWXok7mDFUMQ4cG10AfW3wL02PSZi5kFpYKrptDsgb2WAJIvRcDm+qIvXf/apvg==} engines: {node: '>=12'} @@ -1529,6 +1611,15 @@ packages: dev: true optional: true + /@esbuild/linux-ia32@0.16.17: + resolution: {integrity: sha512-kiX69+wcPAdgl3Lonh1VI7MBr16nktEvOfViszBSxygRQqSpzv7BffMKRPMFwzeJGPxcio0pdD3kYQGpqQ2SSg==} + engines: {node: '>=12'} + cpu: [ia32] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ia32@0.18.20: resolution: {integrity: sha512-P4etWwq6IsReT0E1KHU40bOnzMHoH73aXp96Fs8TIT6z9Hu8G6+0SHSw9i2isWrD2nbx2qo5yUqACgdfVGx7TA==} engines: {node: '>=12'} @@ -1538,8 +1629,8 @@ packages: dev: true optional: true - /@esbuild/linux-loong64@0.15.13: - resolution: {integrity: sha512-+BoyIm4I8uJmH/QDIH0fu7MG0AEx9OXEDXnqptXCwKOlOqZiS4iraH1Nr7/ObLMokW3sOCeBNyD68ATcV9b9Ag==} + /@esbuild/linux-loong64@0.16.17: + resolution: {integrity: sha512-dTzNnQwembNDhd654cA4QhbS9uDdXC3TKqMJjgOWsC0yNCbpzfWoXdZvp0mY7HU6nzk5E0zpRGGx3qoQg8T2DQ==} engines: {node: '>=12'} cpu: [loong64] os: [linux] @@ -1556,6 +1647,15 @@ packages: dev: true optional: true + /@esbuild/linux-mips64el@0.16.17: + resolution: {integrity: sha512-ezbDkp2nDl0PfIUn0CsQ30kxfcLTlcx4Foz2kYv8qdC6ia2oX5Q3E/8m6lq84Dj/6b0FrkgD582fJMIfHhJfSw==} + engines: {node: '>=12'} + cpu: [mips64el] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-mips64el@0.18.20: resolution: {integrity: sha512-d5NeaXZcHp8PzYy5VnXV3VSd2D328Zb+9dEq5HE6bw6+N86JVPExrA6O68OPwobntbNJ0pzCpUFZTo3w0GyetQ==} engines: {node: '>=12'} @@ -1565,6 +1665,15 @@ packages: dev: true optional: true + /@esbuild/linux-ppc64@0.16.17: + resolution: {integrity: sha512-dzS678gYD1lJsW73zrFhDApLVdM3cUF2MvAa1D8K8KtcSKdLBPP4zZSLy6LFZ0jYqQdQ29bjAHJDgz0rVbLB3g==} + engines: {node: '>=12'} + cpu: [ppc64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-ppc64@0.18.20: resolution: {integrity: sha512-WHPyeScRNcmANnLQkq6AfyXRFr5D6N2sKgkFo2FqguP44Nw2eyDlbTdZwd9GYk98DZG9QItIiTlFLHJHjxP3FA==} engines: {node: '>=12'} @@ -1574,6 +1683,15 @@ packages: dev: true optional: true + /@esbuild/linux-riscv64@0.16.17: + resolution: {integrity: sha512-ylNlVsxuFjZK8DQtNUwiMskh6nT0vI7kYl/4fZgV1llP5d6+HIeL/vmmm3jpuoo8+NuXjQVZxmKuhDApK0/cKw==} + engines: {node: '>=12'} + cpu: [riscv64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-riscv64@0.18.20: resolution: {integrity: sha512-WSxo6h5ecI5XH34KC7w5veNnKkju3zBRLEQNY7mv5mtBmrP/MjNBCAlsM2u5hDBlS3NGcTQpoBvRzqBcRtpq1A==} engines: {node: '>=12'} @@ -1583,6 +1701,15 @@ packages: dev: true optional: true + /@esbuild/linux-s390x@0.16.17: + resolution: {integrity: sha512-gzy7nUTO4UA4oZ2wAMXPNBGTzZFP7mss3aKR2hH+/4UUkCOyqmjXiKpzGrY2TlEUhbbejzXVKKGazYcQTZWA/w==} + engines: {node: '>=12'} + cpu: [s390x] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-s390x@0.18.20: resolution: {integrity: sha512-+8231GMs3mAEth6Ja1iK0a1sQ3ohfcpzpRLH8uuc5/KVDFneH6jtAJLFGafpzpMRO6DzJ6AvXKze9LfFMrIHVQ==} engines: {node: '>=12'} @@ -1592,6 +1719,15 @@ packages: dev: true optional: true + /@esbuild/linux-x64@0.16.17: + resolution: {integrity: sha512-mdPjPxfnmoqhgpiEArqi4egmBAMYvaObgn4poorpUaqmvzzbvqbowRllQ+ZgzGVMGKaPkqUmPDOOFQRUFDmeUw==} + engines: {node: '>=12'} + cpu: [x64] + os: [linux] + requiresBuild: true + dev: true + optional: true + /@esbuild/linux-x64@0.18.20: resolution: {integrity: sha512-UYqiqemphJcNsFEskc73jQ7B9jgwjWrSayxawS6UVFZGWrAAtkzjxSqnoclCXxWtfwLdzU+vTpcNYhpn43uP1w==} engines: {node: '>=12'} @@ -1601,6 +1737,15 @@ packages: dev: true optional: true + /@esbuild/netbsd-x64@0.16.17: + resolution: {integrity: sha512-/PzmzD/zyAeTUsduZa32bn0ORug+Jd1EGGAUJvqfeixoEISYpGnAezN6lnJoskauoai0Jrs+XSyvDhppCPoKOA==} + engines: {node: '>=12'} + cpu: [x64] + os: [netbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/netbsd-x64@0.18.20: resolution: {integrity: sha512-iO1c++VP6xUBUmltHZoMtCUdPlnPGdBom6IrO4gyKPFFVBKioIImVooR5I83nTew5UOYrk3gIJhbZh8X44y06A==} engines: {node: '>=12'} @@ -1610,6 +1755,15 @@ packages: dev: true optional: true + /@esbuild/openbsd-x64@0.16.17: + resolution: {integrity: sha512-2yaWJhvxGEz2RiftSk0UObqJa/b+rIAjnODJgv2GbGGpRwAfpgzyrg1WLK8rqA24mfZa9GvpjLcBBg8JHkoodg==} + engines: {node: '>=12'} + cpu: [x64] + os: [openbsd] + requiresBuild: true + dev: true + optional: true + /@esbuild/openbsd-x64@0.18.20: resolution: {integrity: sha512-e5e4YSsuQfX4cxcygw/UCPIEP6wbIL+se3sxPdCiMbFLBWu0eiZOJ7WoD+ptCLrmjZBK1Wk7I6D/I3NglUGOxg==} engines: {node: '>=12'} @@ -1619,6 +1773,15 @@ packages: dev: true optional: true + /@esbuild/sunos-x64@0.16.17: + resolution: {integrity: sha512-xtVUiev38tN0R3g8VhRfN7Zl42YCJvyBhRKw1RJjwE1d2emWTVToPLNEQj/5Qxc6lVFATDiy6LjVHYhIPrLxzw==} + engines: {node: '>=12'} + cpu: [x64] + os: [sunos] + requiresBuild: true + dev: true + optional: true + /@esbuild/sunos-x64@0.18.20: resolution: {integrity: sha512-kDbFRFp0YpTQVVrqUd5FTYmWo45zGaXe0X8E1G/LKFC0v8x0vWrhOWSLITcCn63lmZIxfOMXtCfti/RxN/0wnQ==} engines: {node: '>=12'} @@ -1628,6 +1791,15 @@ packages: dev: true optional: true + /@esbuild/win32-arm64@0.16.17: + resolution: {integrity: sha512-ga8+JqBDHY4b6fQAmOgtJJue36scANy4l/rL97W+0wYmijhxKetzZdKOJI7olaBaMhWt8Pac2McJdZLxXWUEQw==} + engines: {node: '>=12'} + cpu: [arm64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-arm64@0.18.20: resolution: {integrity: sha512-ddYFR6ItYgoaq4v4JmQQaAI5s7npztfV4Ag6NrhiaW0RrnOXqBkgwZLofVTlq1daVTQNhtI5oieTvkRPfZrePg==} engines: {node: '>=12'} @@ -1637,6 +1809,15 @@ packages: dev: true optional: true + /@esbuild/win32-ia32@0.16.17: + resolution: {integrity: sha512-WnsKaf46uSSF/sZhwnqE4L/F89AYNMiD4YtEcYekBt9Q7nj0DiId2XH2Ng2PHM54qi5oPrQ8luuzGszqi/veig==} + engines: {node: '>=12'} + cpu: [ia32] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-ia32@0.18.20: resolution: {integrity: sha512-Wv7QBi3ID/rROT08SABTS7eV4hX26sVduqDOTe1MvGMjNd3EjOz4b7zeexIR62GTIEKrfJXKL9LFxTYgkyeu7g==} engines: {node: '>=12'} @@ -1646,6 +1827,15 @@ packages: dev: true optional: true + /@esbuild/win32-x64@0.16.17: + resolution: {integrity: sha512-y+EHuSchhL7FjHgvQL/0fnnFmO4T1bhvWANX6gcnqTjtnKWbTvUMCpGnv2+t+31d7RzyEAYAd4u2fnIhHL6N/Q==} + engines: {node: '>=12'} + cpu: [x64] + os: [win32] + requiresBuild: true + dev: true + optional: true + /@esbuild/win32-x64@0.18.20: resolution: {integrity: sha512-kTdfRcSiDfQca/y9QIkng02avJ+NCaQvrMejlsB3RRv5sE9rRoeBPISaZpKxHELzRxZyLvNts1P27W3wV+8geQ==} engines: {node: '>=12'} @@ -1673,7 +1863,7 @@ packages: engines: {node: ^12.22.0 || ^14.17.0 || >=16.0.0} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 espree: 9.6.1 globals: 13.21.0 ignore: 5.2.4 @@ -2125,7 +2315,7 @@ packages: engines: {node: '>=10.10.0'} dependencies: '@humanwhocodes/object-schema': 1.2.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 minimatch: 3.1.2 transitivePeerDependencies: - supports-color @@ -2262,7 +2452,7 @@ packages: engines: {node: '>=14.0.0'} dependencies: '@types/debug': 4.1.8 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 semver: 7.5.4 superstruct: 1.0.3 transitivePeerDependencies: @@ -2639,11 +2829,13 @@ packages: resolution: {integrity: sha512-2upgEu0iLiDVDZkNLeFV2+ht0BAVgQnEmCk6JsOch9Rp8xfkMCbvbAZlA2pBHQc73dbl+vFOXfqkf4uemdn0bw==} dependencies: '@noble/hashes': 1.3.0 + dev: true /@noble/curves@1.1.0: resolution: {integrity: sha512-091oBExgENk/kGj3AZmtBDMpxQPDtxQABR2B9lb1JbVTs6ytdzZNwvhxQ4MWasRNEzlbEH8jCWFCwhF/Obj5AA==} dependencies: '@noble/hashes': 1.3.1 + dev: true /@noble/curves@1.2.0: resolution: {integrity: sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==} @@ -2656,10 +2848,12 @@ packages: /@noble/hashes@1.3.0: resolution: {integrity: sha512-ilHEACi9DwqJB0pw7kv+Apvh50jiiSyR/cQ3y4W7lOR5mhvn/50FLUfsnfJz0BDZtl/RR16kXvptiv6q1msYZg==} + dev: true /@noble/hashes@1.3.1: resolution: {integrity: sha512-EbqwksQwz9xDRGfDST86whPBgM65E0OH/pCgqW0GBVzO22bNE+NuIbeTb714+IfSjU3aRk47EUvXIb5bTsenKA==} engines: {node: '>= 16'} + dev: true /@noble/hashes@1.3.2: resolution: {integrity: sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==} @@ -2716,7 +2910,7 @@ packages: /@popperjs/core@2.11.8: resolution: {integrity: sha512-P1st0aksCrn9sGZhp8GMYwBnQsbvAWsZAX44oXNNvLHGqAOcoVxmjZiohstwQ7SqKnbR47akdNi+uleWD8+g6A==} - /@rainbow-me/rainbowkit@1.0.9(@types/react@18.2.21)(react-dom@18.2.0)(react@18.2.0)(viem@1.8.1)(wagmi@1.3.10): + /@rainbow-me/rainbowkit@1.0.9(@types/react@18.2.21)(react-dom@18.2.0)(react@18.2.0)(viem@1.10.4)(wagmi@1.4.1): resolution: {integrity: sha512-BiMPCWDIR7L44Rq/6j09CPJd7qzUF3vhXo/EIpCF+J0AxQQEWDjwZ+RuWez2XTpzlFjGYl+RwEHZQzX1dKVr+w==} engines: {node: '>=12.4'} peerDependencies: @@ -2733,8 +2927,8 @@ packages: react: 18.2.0 react-dom: 18.2.0(react@18.2.0) react-remove-scroll: 2.5.4(@types/react@18.2.21)(react@18.2.0) - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) - wagmi: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) + wagmi: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) transitivePeerDependencies: - '@types/react' dev: false @@ -2790,8 +2984,8 @@ packages: /@safe-global/safe-apps-sdk@8.0.0(typescript@5.2.2)(zod@3.22.2): resolution: {integrity: sha512-gYw0ki/EAuV1oSyMxpqandHjnthZjYYy+YWpTAzf8BqfXM3ItcZLpjxfg+3+mXW8HIO+3jw6T9iiqEXsqHaMMw==} dependencies: - '@safe-global/safe-gateway-typescript-sdk': 3.9.0 - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) + '@safe-global/safe-gateway-typescript-sdk': 3.10.0 + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) transitivePeerDependencies: - bufferutil - encoding @@ -2802,8 +2996,8 @@ packages: /@safe-global/safe-apps-sdk@8.1.0(typescript@5.2.2)(zod@3.22.2): resolution: {integrity: sha512-XJbEPuaVc7b9n23MqlF6c+ToYIS3f7P2Sel8f3cSBQ9WORE4xrSuvhMpK9fDSFqJ7by/brc+rmJR/5HViRr0/w==} dependencies: - '@safe-global/safe-gateway-typescript-sdk': 3.9.0 - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) + '@safe-global/safe-gateway-typescript-sdk': 3.10.0 + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) transitivePeerDependencies: - bufferutil - encoding @@ -2856,8 +3050,8 @@ packages: semver: 7.5.4 dev: true - /@safe-global/safe-gateway-typescript-sdk@3.9.0: - resolution: {integrity: sha512-DxRM/sBBQhv955dPtdo0z2Bf2fXxrzoRUnGyTa3+4Z0RAhcyiqnffRP1Bt3tyuvlyfZnFL0RsvkqDcAIKzq3RQ==} + /@safe-global/safe-gateway-typescript-sdk@3.10.0: + resolution: {integrity: sha512-nhWjFRRgrGz4uZbyQ3Hgm4si1AixCWlnvi5WUCq/+V+e8EoA2Apj9xJEt8zzXvtELlddFqkH2sfTFy9LIjGXKg==} dependencies: cross-fetch: 3.1.8 transitivePeerDependencies: @@ -2892,6 +3086,10 @@ packages: /@scure/base@1.1.2: resolution: {integrity: sha512-sSCrnIdaUZQHhBxZThMuk7Wm1TWzMD3uJNdGgx3JS23xSqevu0tAOsg8k66nL3R2NwQe65AI9GgqpPOgZys/eA==} + dev: true + + /@scure/base@1.1.3: + resolution: {integrity: sha512-/+SgoRjLq7Xlf0CWuLHq2LUZeL/w65kfzAPG5NH9pcmBhs+nunQTn4gvdwgMTIXnt9b2C/1SeL2XiysZEyIC9Q==} /@scure/bip32@1.3.0: resolution: {integrity: sha512-bcKpo1oj54hGholplGLpqPHRbIsnbixFtc06nwuNM5/dwSXOq/AAYoIBRsBmnZJSdfeNW5rnff7NTAz3ZCqR9Q==} @@ -2899,27 +3097,35 @@ packages: '@noble/curves': 1.0.0 '@noble/hashes': 1.3.2 '@scure/base': 1.1.2 + dev: true /@scure/bip32@1.3.1: resolution: {integrity: sha512-osvveYtyzdEVbt3OfwwXFr4P2iVBL5u1Q3q4ONBfDY/UpOuXmOlbgwc1xECEboY8wIays8Yt6onaWMUdUbfl0A==} dependencies: '@noble/curves': 1.1.0 - '@noble/hashes': 1.3.2 - '@scure/base': 1.1.2 + '@noble/hashes': 1.3.1 + '@scure/base': 1.1.3 dev: true + /@scure/bip32@1.3.2: + resolution: {integrity: sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==} + dependencies: + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@scure/base': 1.1.3 + /@scure/bip39@1.2.0: resolution: {integrity: sha512-SX/uKq52cuxm4YFXWFaVByaSHJh2w3BnokVSeUJVCv6K7WulT9u2BuNRBhuFl8vAuYnzx9bEu9WgpcNYTrYieg==} dependencies: '@noble/hashes': 1.3.2 '@scure/base': 1.1.2 + dev: true /@scure/bip39@1.2.1: resolution: {integrity: sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==} dependencies: '@noble/hashes': 1.3.2 - '@scure/base': 1.1.2 - dev: true + '@scure/base': 1.1.3 /@segment/analytics-core@1.3.0: resolution: {integrity: sha512-ujScWZH49NK1hYlp2/EMw45nOPEh+pmTydAnR6gSkRNucZD4fuinvpPL03rmFCw8ibaMuKLAdgPJfQ0gkLKZ5A==} @@ -3178,7 +3384,7 @@ packages: /@solana/web3.js@1.78.4: resolution: {integrity: sha512-up5VG1dK+GPhykmuMIozJZBbVqpm77vbOG6/r5dS7NBGZonwHfTLdBbsYc3rjmaQ4DpCXUa3tUc4RZHRORvZrw==} dependencies: - '@babel/runtime': 7.22.11 + '@babel/runtime': 7.22.15 '@noble/curves': 1.2.0 '@noble/hashes': 1.3.2 '@solana/buffer-layout': 4.0.1 @@ -4452,29 +4658,29 @@ packages: defer-to-connect: 2.0.1 dev: true - /@tanstack/query-core@4.32.6: - resolution: {integrity: sha512-YVB+mVWENQwPyv+40qO7flMgKZ0uI41Ph7qXC2Zf1ft5AIGfnXnMZyifB2ghhZ27u+5wm5mlzO4Y6lwwadzxCA==} + /@tanstack/query-core@4.33.0: + resolution: {integrity: sha512-qYu73ptvnzRh6se2nyBIDHGBQvPY1XXl3yR769B7B6mIDD7s+EZhdlWHQ67JI6UOTFRaI7wupnTnwJ3gE0Mr/g==} - /@tanstack/query-persist-client-core@4.32.6: - resolution: {integrity: sha512-MJJ7CldvT5HOel50h/3wOZZwVlIcroFD5Vxn8vPsfo2C0qQ208ilmN/81JWutm/lWy4n2BjnCrrWv6HvVI7S0w==} + /@tanstack/query-persist-client-core@4.33.0: + resolution: {integrity: sha512-3P16+2JjcUU5CHi10jJuwd0ZQYvQtSuzLvCUCjVuAnj3GZjfSso1v8t6WAObAr9RPuIC6vDXeOQ3mr07EF/NxQ==} dependencies: - '@tanstack/query-core': 4.32.6 + '@tanstack/query-core': 4.33.0 - /@tanstack/query-sync-storage-persister@4.32.6: - resolution: {integrity: sha512-hTwNo5O5EvydbfdVvwnwY0nIrNg1BxKEV4WAA8A+0NP9yc/9xoWy8RxbIkcz1p4JN2JhagaTKek8Fa5h5KitsA==} + /@tanstack/query-sync-storage-persister@4.33.0: + resolution: {integrity: sha512-V6igMcdEOXPRpvmNFQ6I/iJaw9NhxWy7x8PWamm2cgSsLi8bHaDvUVuWkZm+ikI47QjoCUk7qll/82JYLaH+pw==} dependencies: - '@tanstack/query-persist-client-core': 4.32.6 + '@tanstack/query-persist-client-core': 4.33.0 - /@tanstack/react-query-persist-client@4.32.6(@tanstack/react-query@4.32.6): - resolution: {integrity: sha512-EmNnYpvFYpxS4j5WFeNmfVVBxqq4RDnEFDBZwNKRfb4pzukcx/hcWtwqFk7Qj0EI4Dk8QGl239MEYwJbAc83tQ==} + /@tanstack/react-query-persist-client@4.33.0(@tanstack/react-query@4.33.0): + resolution: {integrity: sha512-B3q0r1tqTTSkd9vctyqFj28xdGZJ+Dnr/7H05Ta1JF1w7EauVQl8ILrmXADecwvILnr1xoZO6lvi2W+mZxMinw==} peerDependencies: - '@tanstack/react-query': ^4.32.6 + '@tanstack/react-query': ^4.33.0 dependencies: - '@tanstack/query-persist-client-core': 4.32.6 - '@tanstack/react-query': 4.32.6(react-dom@18.2.0)(react@18.2.0) + '@tanstack/query-persist-client-core': 4.33.0 + '@tanstack/react-query': 4.33.0(react-dom@18.2.0)(react@18.2.0) - /@tanstack/react-query@4.32.6(react-dom@18.2.0)(react@18.2.0): - resolution: {integrity: sha512-AITu/IKJJJXsHHeXNBy5bclu12t08usMCY0vFC2dh9SP/w6JAk5U9GwfjOIPj3p+ATADZvxQPe8UiCtMLNeQbg==} + /@tanstack/react-query@4.33.0(react-dom@18.2.0)(react@18.2.0): + resolution: {integrity: sha512-97nGbmDK0/m0B86BdiXzx3EW9RcDYKpnyL2+WwyuLHEgpfThYAnXFaMMmnTDuAO4bQJXEhflumIEUfKmP7ESGA==} peerDependencies: react: ^16.8.0 || ^17.0.0 || ^18.0.0 react-dom: ^16.8.0 || ^17.0.0 || ^18.0.0 @@ -4485,7 +4691,7 @@ packages: react-native: optional: true dependencies: - '@tanstack/query-core': 4.32.6 + '@tanstack/query-core': 4.33.0 react: 18.2.0 react-dom: 18.2.0(react@18.2.0) use-sync-external-store: 1.2.0(react@18.2.0) @@ -4582,7 +4788,7 @@ packages: big.js: 6.2.1 bn.js: 5.2.1 cbor: 5.2.0 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 lodash: 4.17.21 semver: 7.5.2 utf8: 3.0.0 @@ -4602,7 +4808,7 @@ packages: resolution: {integrity: sha512-m13e1VlXEdxiXiqv/SmPlqbdtcuhjwIGTICm+JCEO8nt0NYBbdMC2paNkpUvGz9lK139JxIupMHctEV4vgkldw==} dependencies: ajv: 6.12.6 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -4617,7 +4823,7 @@ packages: '@truffle/error': 0.1.1 '@truffle/interface-adapter': 0.5.35 bignumber.js: 7.2.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 ethers: 4.0.49 web3: 1.7.4 web3-core-helpers: 1.7.4 @@ -4641,7 +4847,7 @@ packages: '@truffle/error': 0.2.1 '@truffle/interface-adapter': 0.5.35 bignumber.js: 7.2.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 ethers: 4.0.49 web3: 1.8.2 web3-core-helpers: 1.8.2 @@ -4662,7 +4868,7 @@ packages: '@trufflesuite/chromafi': 3.0.0 bn.js: 5.2.1 chalk: 2.4.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 highlightjs-solidity: 2.0.6 transitivePeerDependencies: - supports-color @@ -4713,13 +4919,13 @@ packages: /@types/bn.js@4.11.6: resolution: {integrity: sha512-pqr857jrp2kPuO9uRjZ3PwnJTjoQy+fcdxvBTvHm6dkmEL9q+hDD/2j/0ELOBPtPnS8LjCX0gI9nbl8lVkadpg==} dependencies: - '@types/node': 20.5.7 + '@types/node': 20.5.9 dev: true /@types/bn.js@5.1.1: resolution: {integrity: sha512-qNrYbZqMx0uJAfKnKclPh+dTwK33KfLHYqtyODwd5HnXOjnkhc4qgn3BrK6RWyGZm5+sIFE7Q7Vz6QQtJB7w7g==} dependencies: - '@types/node': 20.5.7 + '@types/node': 20.5.9 dev: true /@types/body-parser@1.19.2: @@ -4740,7 +4946,7 @@ packages: dependencies: '@types/http-cache-semantics': 4.0.1 '@types/keyv': 3.1.4 - '@types/node': 20.5.7 + '@types/node': 12.20.55 '@types/responselike': 1.0.0 dev: true @@ -4765,6 +4971,12 @@ packages: resolution: {integrity: sha512-cdeYyv4KWoEgpBISTxWvqYsVy444DOqehiF3fM3ne10AmJ62RSyNkUnxMJXHQWRQQX2eR94m5y1IZyDwBjV9FQ==} dependencies: '@types/node': 20.5.7 + dev: true + + /@types/connect@3.4.36: + resolution: {integrity: sha512-P63Zd/JUGq+PdrM1lv0Wv5SBYeA2+CORvbrXbngriYY0jzLUWfQMQQxOhjONEz/wlHOAxOdY7CY65rgQdTjq2w==} + dependencies: + '@types/node': 20.5.7 /@types/debug@4.1.8: resolution: {integrity: sha512-/vPO1EPOs306Cvhwv7KfVfYvOJqA/S/AXjaHQiJboCZzcNDb+TIJFN9/2C9DZ//ijSKWioNyUxD792QmDJ+HKQ==} @@ -4847,7 +5059,7 @@ packages: /@types/keyv@3.1.4: resolution: {integrity: sha512-BQ5aZNSCpj7D6K2ksrRCTmKRLEpnPvWDiLPfoGyhZ++8YtiK9d/3DBKPJgry359X/P1PfruyYwvnvwFjuEiEIg==} dependencies: - '@types/node': 20.5.7 + '@types/node': 12.20.55 dev: true /@types/lodash.isequal@4.5.6: @@ -4901,6 +5113,10 @@ packages: /@types/node@20.5.7: resolution: {integrity: sha512-dP7f3LdZIysZnmvP3ANJYTSwg+wLLl8p7RqniVlV7j+oXSXAbt9h0WIBFmJy5inWZoX9wZN6eXx+YXd9Rh3RBA==} + /@types/node@20.5.9: + resolution: {integrity: sha512-PcGNd//40kHAS3sTlzKB9C9XL4K0sTup8nbG5lC14kzEteTNuAFh9u5nA0o5TWnSG2r/JNPRXFVcHJIIeRlmqQ==} + dev: true + /@types/normalize-package-data@2.4.1: resolution: {integrity: sha512-Gj7cI7z+98M282Tqmp2K5EIsoouUEzbBJhQQzDE3jSIRk6r9gsz0oUokqIUR4u1R3dMHo0pDHM7sNOHyhulypw==} dev: true @@ -4911,7 +5127,7 @@ packages: /@types/pbkdf2@3.1.0: resolution: {integrity: sha512-Cf63Rv7jCQ0LaL8tNXmEyqTHuIJxRdlS5vMh1mj5voN4+QFhVZnlZruezqpWYDiJ8UTzhP0VmeLXCmBk66YrMQ==} dependencies: - '@types/node': 20.5.7 + '@types/node': 20.5.9 dev: true /@types/prop-types@15.7.5: @@ -4956,7 +5172,7 @@ packages: /@types/responselike@1.0.0: resolution: {integrity: sha512-85Y2BjiufFzaMIlvJDvTTB8Fxl2xfLo4HgmHzVBz08w4wDePCTjYw66PdrolO0kzli3yam/YCgRufyo1DdQVTA==} dependencies: - '@types/node': 20.5.7 + '@types/node': 12.20.55 dev: true /@types/retry@0.12.0: @@ -4969,7 +5185,7 @@ packages: /@types/secp256k1@4.0.3: resolution: {integrity: sha512-Da66lEIFeIz9ltsdMZcpQvmrmmoqrfju8pm1BH8WbYjZSwUgCwXLb9C+9XYogwBITnbsSaMdVPb2ekf7TV+03w==} dependencies: - '@types/node': 20.5.7 + '@types/node': 20.5.9 dev: true /@types/semver@7.5.0: @@ -5099,7 +5315,7 @@ packages: '@typescript-eslint/type-utils': 6.4.1(eslint@8.48.0)(typescript@5.2.2) '@typescript-eslint/utils': 6.4.1(eslint@8.48.0)(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.4.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 eslint: 8.48.0 graphemer: 1.4.0 ignore: 5.2.4 @@ -5125,7 +5341,7 @@ packages: '@typescript-eslint/types': 6.4.1 '@typescript-eslint/typescript-estree': 6.4.1(typescript@5.2.2) '@typescript-eslint/visitor-keys': 6.4.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 eslint: 8.48.0 typescript: 5.2.2 transitivePeerDependencies: @@ -5150,7 +5366,7 @@ packages: dependencies: '@typescript-eslint/typescript-estree': 6.4.1(typescript@5.2.2) '@typescript-eslint/utils': 6.4.1(eslint@8.48.0)(typescript@5.2.2) - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 eslint: 8.48.0 ts-api-utils: 1.0.2(typescript@5.2.2) typescript: 5.2.2 @@ -5173,7 +5389,7 @@ packages: dependencies: '@typescript-eslint/types': 6.4.1 '@typescript-eslint/visitor-keys': 6.4.1 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 globby: 11.1.0 is-glob: 4.0.3 semver: 7.5.4 @@ -5324,29 +5540,8 @@ packages: typescript: 5.2.2 dev: true - /@wagmi/chains@1.3.0(typescript@5.2.2): - resolution: {integrity: sha512-7tyr1irTZQpA4/4HoIiJP3XYZuJIZuWiZ1V1j5WEG3cjm8TXIlMEzO0N+hT/cZKw4/UtF2EukvB8GkDWa2S77w==} - peerDependencies: - typescript: '>=5.0.4' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - typescript: 5.2.2 - dev: true - - /@wagmi/chains@1.7.0(typescript@5.2.2): - resolution: {integrity: sha512-TKVeHv0GqP5sV1yQ8BDGYToAFezPnCexbbBpeH14x7ywi5a1dDStPffpt9x+ytE6LJWkZ6pAMs/HNWXBQ5Nqmw==} - peerDependencies: - typescript: '>=5.0.4' - peerDependenciesMeta: - typescript: - optional: true - dependencies: - typescript: 5.2.2 - - /@wagmi/cli@1.3.0(typescript@5.2.2)(wagmi@1.3.10): - resolution: {integrity: sha512-/YXmdp0XWgQEwRSVO8IjVB8KY5HK+6+eqJsZI3a+y3XMH4T/NxVBoT/JxTqV6HEivr3HOLgDcTzvQhNy3mZ0HA==} + /@wagmi/cli@1.5.0(typescript@5.2.2)(wagmi@1.4.1): + resolution: {integrity: sha512-3L1b/zgdkYPYsnBbtalRcEmSJWGy9hnZjCmkjAj5FDXfaslMmJFTJiNDDYpkpxCtL9iqjbYj0y3ECW7mDfJr7A==} engines: {node: '>=14'} hasBin: true peerDependencies: @@ -5361,10 +5556,9 @@ packages: wagmi: optional: true dependencies: - '@wagmi/chains': 1.3.0(typescript@5.2.2) abitype: 0.8.7(typescript@5.2.2)(zod@3.22.2) abort-controller: 3.0.0 - bundle-require: 3.1.2(esbuild@0.15.13) + bundle-require: 3.1.2(esbuild@0.16.17) cac: 6.7.14 change-case: 4.1.2 chokidar: 3.5.3 @@ -5372,7 +5566,7 @@ packages: detect-package-manager: 2.0.1 dotenv: 16.3.1 dotenv-expand: 10.0.0 - esbuild: 0.15.13 + esbuild: 0.16.17 execa: 6.1.0 find-up: 6.3.0 fs-extra: 10.1.0 @@ -5383,23 +5577,20 @@ packages: picocolors: 1.0.0 prettier: 2.8.8 typescript: 5.2.2 - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) - wagmi: 1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) + wagmi: 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) zod: 3.22.2 transitivePeerDependencies: - bufferutil - utf-8-validate dev: true - /@wagmi/connectors@2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2): - resolution: {integrity: sha512-1KOL0HTJl5kzSC/YdKwFwiokr6poUQn1V/tcT0TpG3iH2x0lSM7FTkvCjVVY/6lKzTXrLlo9y2aE7AsOPnkvqg==} + /@wagmi/connectors@3.1.1(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2): + resolution: {integrity: sha512-ewOV40AlrXcX018qckU0V9OCsDgHhs+KZjQJZhlplqRtc2ijjS62B5kcypXkcTtfU5qXUBA9KEwPsSTxGdT4ag==} peerDependencies: - '@wagmi/chains': '>=1.7.0' typescript: '>=5.0.4' viem: '>=0.3.35' peerDependenciesMeta: - '@wagmi/chains': - optional: true typescript: optional: true dependencies: @@ -5407,15 +5598,14 @@ packages: '@ledgerhq/connect-kit-loader': 1.1.2 '@safe-global/safe-apps-provider': 0.17.1(typescript@5.2.2)(zod@3.22.2) '@safe-global/safe-apps-sdk': 8.1.0(typescript@5.2.2)(zod@3.22.2) - '@wagmi/chains': 1.7.0(typescript@5.2.2) - '@walletconnect/ethereum-provider': 2.9.2(@walletconnect/modal@2.6.1) + '@walletconnect/ethereum-provider': 2.10.0(@walletconnect/modal@2.6.1) '@walletconnect/legacy-provider': 2.0.0 '@walletconnect/modal': 2.6.1(react@18.2.0) - '@walletconnect/utils': 2.9.2 + '@walletconnect/utils': 2.10.0 abitype: 0.8.7(typescript@5.2.2)(zod@3.22.2) eventemitter3: 4.0.7 typescript: 5.2.2 - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) transitivePeerDependencies: - '@react-native-async-storage/async-storage' - bufferutil @@ -5426,8 +5616,8 @@ packages: - utf-8-validate - zod - /@wagmi/core@1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2): - resolution: {integrity: sha512-SrnABCrsDvhiMCLLLyzyHnZbEumsFT/XWlJJQZeyEDcixL95R7XQwOaaoRI4MpNilCtMtu3jzN57tA5Z2iA+kw==} + /@wagmi/core@1.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2): + resolution: {integrity: sha512-b6LDFL0vZSCNcIHjnJzv++hakavTTt1/2WEQg2S5eEnaHTp7UoQlwfCyjKeiBhRih4yF34N06ea8cyEVjyjXrw==} peerDependencies: typescript: '>=5.0.4' viem: '>=0.3.35' @@ -5435,12 +5625,11 @@ packages: typescript: optional: true dependencies: - '@wagmi/chains': 1.7.0(typescript@5.2.2) - '@wagmi/connectors': 2.7.0(@wagmi/chains@1.7.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + '@wagmi/connectors': 3.1.1(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) abitype: 0.8.7(typescript@5.2.2)(zod@3.22.2) eventemitter3: 4.0.7 typescript: 5.2.2 - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) zustand: 4.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0) transitivePeerDependencies: - '@react-native-async-storage/async-storage' @@ -5454,8 +5643,8 @@ packages: - utf-8-validate - zod - /@walletconnect/core@2.9.2: - resolution: {integrity: sha512-VARMPAx8sIgodeyngDHbealP3B621PQqjqKsByFUTOep8ZI1/R/20zU+cmq6j9RCrL+kLKZcrZqeVzs8Z7OlqQ==} + /@walletconnect/core@2.10.0: + resolution: {integrity: sha512-Z8pdorfIMueuiBXLdnf7yloiO9JIiobuxN3j0OTal+MYc4q5/2O7d+jdD1DAXbLi1taJx3x60UXT/FPVkjIqIQ==} dependencies: '@walletconnect/heartbeat': 1.2.1 '@walletconnect/jsonrpc-provider': 1.0.13 @@ -5468,8 +5657,8 @@ packages: '@walletconnect/relay-auth': 1.0.4 '@walletconnect/safe-json': 1.0.2 '@walletconnect/time': 1.0.2 - '@walletconnect/types': 2.9.2 - '@walletconnect/utils': 2.9.2 + '@walletconnect/types': 2.10.0 + '@walletconnect/utils': 2.10.0 events: 3.3.0 lodash.isequal: 4.5.0 uint8arrays: 3.1.1 @@ -5501,8 +5690,8 @@ packages: dependencies: tslib: 1.14.1 - /@walletconnect/ethereum-provider@2.9.2(@walletconnect/modal@2.6.1): - resolution: {integrity: sha512-eO1dkhZffV1g7vpG19XUJTw09M/bwGUwwhy1mJ3AOPbOSbMPvwiCuRz2Kbtm1g9B0Jv15Dl+TvJ9vTgYF8zoZg==} + /@walletconnect/ethereum-provider@2.10.0(@walletconnect/modal@2.6.1): + resolution: {integrity: sha512-NyTm7RcrtAiSaYQPh6G4sOtr1kg/pL5Z3EDE6rBTV3Se5pMsYvtuwMiSol7MidsQpf4ux9HFhthTO3imcoWImw==} peerDependencies: '@walletconnect/modal': '>=2' peerDependenciesMeta: @@ -5514,10 +5703,10 @@ packages: '@walletconnect/jsonrpc-types': 1.0.3 '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/modal': 2.6.1(react@18.2.0) - '@walletconnect/sign-client': 2.9.2 - '@walletconnect/types': 2.9.2 - '@walletconnect/universal-provider': 2.9.2 - '@walletconnect/utils': 2.9.2 + '@walletconnect/sign-client': 2.10.0 + '@walletconnect/types': 2.10.0 + '@walletconnect/universal-provider': 2.10.0 + '@walletconnect/utils': 2.10.0 events: 3.3.0 transitivePeerDependencies: - '@react-native-async-storage/async-storage' @@ -5615,7 +5804,7 @@ packages: '@walletconnect/legacy-types': 2.0.0 '@walletconnect/legacy-utils': 2.0.0 copy-to-clipboard: 3.3.3 - preact: 10.17.0 + preact: 10.17.1 qrcode: 1.5.3 /@walletconnect/legacy-provider@2.0.0: @@ -5707,17 +5896,17 @@ packages: dependencies: tslib: 1.14.1 - /@walletconnect/sign-client@2.9.2: - resolution: {integrity: sha512-anRwnXKlR08lYllFMEarS01hp1gr6Q9XUgvacr749hoaC/AwGVlxYFdM8+MyYr3ozlA+2i599kjbK/mAebqdXg==} + /@walletconnect/sign-client@2.10.0: + resolution: {integrity: sha512-hbDljDS53kR/It3oXD91UkcOsT6diNnW5+Zzksm0YEfwww5dop/YfNlcdnc8+jKUhWOL/YDPNQCjzsCSNlVzbw==} dependencies: - '@walletconnect/core': 2.9.2 + '@walletconnect/core': 2.10.0 '@walletconnect/events': 1.0.1 '@walletconnect/heartbeat': 1.2.1 '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/logger': 2.0.1 '@walletconnect/time': 1.0.2 - '@walletconnect/types': 2.9.2 - '@walletconnect/utils': 2.9.2 + '@walletconnect/types': 2.10.0 + '@walletconnect/utils': 2.10.0 events: 3.3.0 transitivePeerDependencies: - '@react-native-async-storage/async-storage' @@ -5730,8 +5919,8 @@ packages: dependencies: tslib: 1.14.1 - /@walletconnect/types@2.9.2: - resolution: {integrity: sha512-7Rdn30amnJEEal4hk83cdwHUuxI1SWQ+K7fFFHBMqkuHLGi3tpMY6kpyfDxnUScYEZXqgRps4Jo5qQgnRqVM7A==} + /@walletconnect/types@2.10.0: + resolution: {integrity: sha512-kSTA/WZnbKdEbvbXSW16Ty6dOSzOZCHnGg6JH7q1MuraalD2HuNg00lVVu7QAZ/Rj1Gn9DAkrgP5Wd5a8Xq//Q==} dependencies: '@walletconnect/events': 1.0.1 '@walletconnect/heartbeat': 1.2.1 @@ -5743,17 +5932,17 @@ packages: - '@react-native-async-storage/async-storage' - lokijs - /@walletconnect/universal-provider@2.9.2: - resolution: {integrity: sha512-JmaolkO8D31UdRaQCHwlr8uIFUI5BYhBzqYFt54Mc6gbIa1tijGOmdyr6YhhFO70LPmS6gHIjljwOuEllmlrxw==} + /@walletconnect/universal-provider@2.10.0: + resolution: {integrity: sha512-jtVWf+AeTCqBcB3lCmWkv3bvSmdRCkQdo67GNoT5y6/pvVHMxfjgrJNBOUsWQMxpREpWDpZ993X0JRjsYVsMcA==} dependencies: '@walletconnect/jsonrpc-http-connection': 1.0.7 '@walletconnect/jsonrpc-provider': 1.0.13 '@walletconnect/jsonrpc-types': 1.0.3 '@walletconnect/jsonrpc-utils': 1.0.8 '@walletconnect/logger': 2.0.1 - '@walletconnect/sign-client': 2.9.2 - '@walletconnect/types': 2.9.2 - '@walletconnect/utils': 2.9.2 + '@walletconnect/sign-client': 2.10.0 + '@walletconnect/types': 2.10.0 + '@walletconnect/utils': 2.10.0 events: 3.3.0 transitivePeerDependencies: - '@react-native-async-storage/async-storage' @@ -5762,8 +5951,8 @@ packages: - lokijs - utf-8-validate - /@walletconnect/utils@2.9.2: - resolution: {integrity: sha512-D44hwXET/8JhhIjqljY6qxSu7xXnlPrf63UN/Qfl98vDjWlYVcDl2+JIQRxD9GPastw0S8XZXdRq59XDXLuZBg==} + /@walletconnect/utils@2.10.0: + resolution: {integrity: sha512-9GRyEz/7CJW+G04RvrjPET5k7hOEsB9b3fF9cWDk/iDCxSWpbkU/hv/urRB36C+gvQMAZgIZYX3dHfzJWkY/2g==} dependencies: '@stablelib/chacha20poly1305': 1.0.1 '@stablelib/hkdf': 1.0.1 @@ -5773,7 +5962,7 @@ packages: '@walletconnect/relay-api': 1.0.9 '@walletconnect/safe-json': 1.0.2 '@walletconnect/time': 1.0.2 - '@walletconnect/types': 2.9.2 + '@walletconnect/types': 2.10.0 '@walletconnect/window-getters': 1.0.1 '@walletconnect/window-metadata': 1.0.1 detect-browser: 5.3.0 @@ -5802,13 +5991,13 @@ packages: - react dev: false - /@web3modal/ethereum@2.7.1(viem@1.8.1): + /@web3modal/ethereum@2.7.1(viem@1.10.4): resolution: {integrity: sha512-1x3qhYh9qgtvw1MDQD4VeDf2ZOsVANKRPtUty4lF+N4L8xnAIwvNKUAMA4j6T5xSsjqUfq5Tdy5mYsNxLmsWMA==} peerDependencies: '@wagmi/core': '>=1' viem: '>=1' dependencies: - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) dev: false /@web3modal/react@2.7.1(react-dom@18.2.0)(react@18.2.0): @@ -5857,8 +6046,8 @@ packages: typescript: 5.2.2 zod: 3.22.2 - /abitype@0.9.3(typescript@5.2.2)(zod@3.22.2): - resolution: {integrity: sha512-dz4qCQLurx97FQhnb/EIYTk/ldQ+oafEDUqC0VVIeQS1Q48/YWt/9YNfMmp9SLFqN41ktxny3c8aYxHjmFIB/w==} + /abitype@0.9.8(typescript@5.2.2)(zod@3.22.2): + resolution: {integrity: sha512-puLifILdm+8sjyss4S+fsUN09obiT1g2YW6CtcQF+QDzxR0euzgEB29MZujC6zMk2a6SVmtttq1fc6+YFA7WYQ==} peerDependencies: typescript: '>=5.0.4' zod: ^3 >=3.19.1 @@ -5922,7 +6111,7 @@ packages: resolution: {integrity: sha512-RZNwNclF7+MS/8bDg70amg32dyeZGZxiDuQmZxKLAlQjr3jGyLx+4Kkk58UO7D2QdgFIQCovuSuZESne6RG6XQ==} engines: {node: '>= 6.0.0'} dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 transitivePeerDependencies: - supports-color @@ -6325,7 +6514,7 @@ packages: /axios@0.21.4: resolution: {integrity: sha512-ut5vewkiu8jjGBdqpM44XxjuCjq9LAKeHVmoVfHVzy8eHgxxq8SbAVQNovDA8mVi05kP0Ea/n/UzcSHcTJQfNg==} dependencies: - follow-redirects: 1.15.2(debug@4.3.4) + follow-redirects: 1.15.2 transitivePeerDependencies: - debug dev: false @@ -6765,15 +6954,15 @@ packages: engines: {node: '>=6.14.2'} requiresBuild: true dependencies: - node-gyp-build: 4.6.0 + node-gyp-build: 4.6.1 - /bundle-require@3.1.2(esbuild@0.15.13): + /bundle-require@3.1.2(esbuild@0.16.17): resolution: {integrity: sha512-Of6l6JBAxiyQ5axFxUM6dYeP/W7X2Sozeo/4EYB9sJhL+dqL7TKjg+shwxp6jlu/6ZSERfsYtIpSJ1/x3XkAEA==} engines: {node: ^12.20.0 || ^14.13.1 || >=16.0.0} peerDependencies: esbuild: '>=0.13' dependencies: - esbuild: 0.15.13 + esbuild: 0.16.17 load-tsconfig: 0.2.5 dev: true @@ -7725,6 +7914,16 @@ packages: dependencies: ms: 2.0.0 + /debug@3.2.7: + resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.3 + /debug@3.2.7(supports-color@8.1.1): resolution: {integrity: sha512-CFjzYYAi4ThfiQvizrFQevTTXHtnCqWfe7x1AhgEscTz6ZbLbfoLRLPugTQyBth6f8ZERVUSyWHFD/7Wu4t1XQ==} peerDependencies: @@ -7735,6 +7934,7 @@ packages: dependencies: ms: 2.1.3 supports-color: 8.1.1 + dev: true /debug@4.1.1: resolution: {integrity: sha512-pYAIzeRo8J6KPEaJ0VWOh5Pzkbw/RetuzehGM7QRRX5he4fPHx2rdKMB256ehJCkX+XRQm16eZLqLNS8RSZXZw==} @@ -7748,6 +7948,17 @@ packages: ms: 2.1.3 dev: true + /debug@4.3.4: + resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} + engines: {node: '>=6.0'} + peerDependencies: + supports-color: '*' + peerDependenciesMeta: + supports-color: + optional: true + dependencies: + ms: 2.1.2 + /debug@4.3.4(supports-color@8.1.1): resolution: {integrity: sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==} engines: {node: '>=6.0'} @@ -7759,6 +7970,7 @@ packages: dependencies: ms: 2.1.2 supports-color: 8.1.1 + dev: true /decamelize-keys@1.1.1: resolution: {integrity: sha512-WiPxgEirIV0/eIOMcnFBA3/IJZAZqKnwAwWyvvdi4lsr1WCN22nhdf/3db3DoZcUjTV2SqfzIwNyp6y2xs3nmg==} @@ -8422,214 +8634,34 @@ packages: ext: 1.7.0 dev: true - /esbuild-android-64@0.15.13: - resolution: {integrity: sha512-yRorukXBlokwTip+Sy4MYskLhJsO0Kn0/Fj43s1krVblfwP+hMD37a4Wmg139GEsMLl+vh8WXp2mq/cTA9J97g==} - engines: {node: '>=12'} - cpu: [x64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /esbuild-android-arm64@0.15.13: - resolution: {integrity: sha512-TKzyymLD6PiVeyYa4c5wdPw87BeAiTXNtK6amWUcXZxkV51gOk5u5qzmDaYSwiWeecSNHamFsaFjLoi32QR5/w==} - engines: {node: '>=12'} - cpu: [arm64] - os: [android] - requiresBuild: true - dev: true - optional: true - - /esbuild-darwin-64@0.15.13: - resolution: {integrity: sha512-WAx7c2DaOS6CrRcoYCgXgkXDliLnFv3pQLV6GeW1YcGEZq2Gnl8s9Pg7ahValZkpOa0iE/ojRVQ87sbUhF1Cbg==} - engines: {node: '>=12'} - cpu: [x64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-darwin-arm64@0.15.13: - resolution: {integrity: sha512-U6jFsPfSSxC3V1CLiQqwvDuj3GGrtQNB3P3nNC3+q99EKf94UGpsG9l4CQ83zBs1NHrk1rtCSYT0+KfK5LsD8A==} - engines: {node: '>=12'} - cpu: [arm64] - os: [darwin] - requiresBuild: true - dev: true - optional: true - - /esbuild-freebsd-64@0.15.13: - resolution: {integrity: sha512-whItJgDiOXaDG/idy75qqevIpZjnReZkMGCgQaBWZuKHoElDJC1rh7MpoUgupMcdfOd+PgdEwNQW9DAE6i8wyA==} - engines: {node: '>=12'} - cpu: [x64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-freebsd-arm64@0.15.13: - resolution: {integrity: sha512-6pCSWt8mLUbPtygv7cufV0sZLeylaMwS5Fznj6Rsx9G2AJJsAjQ9ifA+0rQEIg7DwJmi9it+WjzNTEAzzdoM3Q==} - engines: {node: '>=12'} - cpu: [arm64] - os: [freebsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-32@0.15.13: - resolution: {integrity: sha512-VbZdWOEdrJiYApm2kkxoTOgsoCO1krBZ3quHdYk3g3ivWaMwNIVPIfEE0f0XQQ0u5pJtBsnk2/7OPiCFIPOe/w==} - engines: {node: '>=12'} - cpu: [ia32] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-64@0.15.13: - resolution: {integrity: sha512-rXmnArVNio6yANSqDQlIO4WiP+Cv7+9EuAHNnag7rByAqFVuRusLbGi2697A5dFPNXoO//IiogVwi3AdcfPC6A==} - engines: {node: '>=12'} - cpu: [x64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-arm64@0.15.13: - resolution: {integrity: sha512-alEMGU4Z+d17U7KQQw2IV8tQycO6T+rOrgW8OS22Ua25x6kHxoG6Ngry6Aq6uranC+pNWNMB6aHFPh7aTQdORQ==} - engines: {node: '>=12'} - cpu: [arm64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-arm@0.15.13: - resolution: {integrity: sha512-Ac6LpfmJO8WhCMQmO253xX2IU2B3wPDbl4IvR0hnqcPrdfCaUa2j/lLMGTjmQ4W5JsJIdHEdW12dG8lFS0MbxQ==} - engines: {node: '>=12'} - cpu: [arm] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-mips64le@0.15.13: - resolution: {integrity: sha512-47PgmyYEu+yN5rD/MbwS6DxP2FSGPo4Uxg5LwIdxTiyGC2XKwHhHyW7YYEDlSuXLQXEdTO7mYe8zQ74czP7W8A==} - engines: {node: '>=12'} - cpu: [mips64el] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-ppc64le@0.15.13: - resolution: {integrity: sha512-z6n28h2+PC1Ayle9DjKoBRcx/4cxHoOa2e689e2aDJSaKug3jXcQw7mM+GLg+9ydYoNzj8QxNL8ihOv/OnezhA==} - engines: {node: '>=12'} - cpu: [ppc64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-riscv64@0.15.13: - resolution: {integrity: sha512-+Lu4zuuXuQhgLUGyZloWCqTslcCAjMZH1k3Xc9MSEJEpEFdpsSU0sRDXAnk18FKOfEjhu4YMGaykx9xjtpA6ow==} - engines: {node: '>=12'} - cpu: [riscv64] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-linux-s390x@0.15.13: - resolution: {integrity: sha512-BMeXRljruf7J0TMxD5CIXS65y7puiZkAh+s4XFV9qy16SxOuMhxhVIXYLnbdfLrsYGFzx7U9mcdpFWkkvy/Uag==} - engines: {node: '>=12'} - cpu: [s390x] - os: [linux] - requiresBuild: true - dev: true - optional: true - - /esbuild-netbsd-64@0.15.13: - resolution: {integrity: sha512-EHj9QZOTel581JPj7UO3xYbltFTYnHy+SIqJVq6yd3KkCrsHRbapiPb0Lx3EOOtybBEE9EyqbmfW1NlSDsSzvQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [netbsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-openbsd-64@0.15.13: - resolution: {integrity: sha512-nkuDlIjF/sfUhfx8SKq0+U+Fgx5K9JcPq1mUodnxI0x4kBdCv46rOGWbuJ6eof2n3wdoCLccOoJAbg9ba/bT2w==} - engines: {node: '>=12'} - cpu: [x64] - os: [openbsd] - requiresBuild: true - dev: true - optional: true - - /esbuild-sunos-64@0.15.13: - resolution: {integrity: sha512-jVeu2GfxZQ++6lRdY43CS0Tm/r4WuQQ0Pdsrxbw+aOrHQPHV0+LNOLnvbN28M7BSUGnJnHkHm2HozGgNGyeIRw==} - engines: {node: '>=12'} - cpu: [x64] - os: [sunos] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-32@0.15.13: - resolution: {integrity: sha512-XoF2iBf0wnqo16SDq+aDGi/+QbaLFpkiRarPVssMh9KYbFNCqPLlGAWwDvxEVz+ywX6Si37J2AKm+AXq1kC0JA==} - engines: {node: '>=12'} - cpu: [ia32] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-64@0.15.13: - resolution: {integrity: sha512-Et6htEfGycjDrtqb2ng6nT+baesZPYQIW+HUEHK4D1ncggNrDNk3yoboYQ5KtiVrw/JaDMNttz8rrPubV/fvPQ==} - engines: {node: '>=12'} - cpu: [x64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild-windows-arm64@0.15.13: - resolution: {integrity: sha512-3bv7tqntThQC9SWLRouMDmZnlOukBhOCTlkzNqzGCmrkCJI7io5LLjwJBOVY6kOUlIvdxbooNZwjtBvj+7uuVg==} - engines: {node: '>=12'} - cpu: [arm64] - os: [win32] - requiresBuild: true - dev: true - optional: true - - /esbuild@0.15.13: - resolution: {integrity: sha512-Cu3SC84oyzzhrK/YyN4iEVy2jZu5t2fz66HEOShHURcjSkOSAVL8C/gfUT+lDJxkVHpg8GZ10DD0rMHRPqMFaQ==} + /esbuild@0.16.17: + resolution: {integrity: sha512-G8LEkV0XzDMNwXKgM0Jwu3nY3lSTwSGY6XbxM9cr9+s0T/qSV1q1JVPBGzm3dcjhCic9+emZDmMffkwgPeOeLg==} engines: {node: '>=12'} hasBin: true requiresBuild: true optionalDependencies: - '@esbuild/android-arm': 0.15.13 - '@esbuild/linux-loong64': 0.15.13 - esbuild-android-64: 0.15.13 - esbuild-android-arm64: 0.15.13 - esbuild-darwin-64: 0.15.13 - esbuild-darwin-arm64: 0.15.13 - esbuild-freebsd-64: 0.15.13 - esbuild-freebsd-arm64: 0.15.13 - esbuild-linux-32: 0.15.13 - esbuild-linux-64: 0.15.13 - esbuild-linux-arm: 0.15.13 - esbuild-linux-arm64: 0.15.13 - esbuild-linux-mips64le: 0.15.13 - esbuild-linux-ppc64le: 0.15.13 - esbuild-linux-riscv64: 0.15.13 - esbuild-linux-s390x: 0.15.13 - esbuild-netbsd-64: 0.15.13 - esbuild-openbsd-64: 0.15.13 - esbuild-sunos-64: 0.15.13 - esbuild-windows-32: 0.15.13 - esbuild-windows-64: 0.15.13 - esbuild-windows-arm64: 0.15.13 + '@esbuild/android-arm': 0.16.17 + '@esbuild/android-arm64': 0.16.17 + '@esbuild/android-x64': 0.16.17 + '@esbuild/darwin-arm64': 0.16.17 + '@esbuild/darwin-x64': 0.16.17 + '@esbuild/freebsd-arm64': 0.16.17 + '@esbuild/freebsd-x64': 0.16.17 + '@esbuild/linux-arm': 0.16.17 + '@esbuild/linux-arm64': 0.16.17 + '@esbuild/linux-ia32': 0.16.17 + '@esbuild/linux-loong64': 0.16.17 + '@esbuild/linux-mips64el': 0.16.17 + '@esbuild/linux-ppc64': 0.16.17 + '@esbuild/linux-riscv64': 0.16.17 + '@esbuild/linux-s390x': 0.16.17 + '@esbuild/linux-x64': 0.16.17 + '@esbuild/netbsd-x64': 0.16.17 + '@esbuild/openbsd-x64': 0.16.17 + '@esbuild/sunos-x64': 0.16.17 + '@esbuild/win32-arm64': 0.16.17 + '@esbuild/win32-ia32': 0.16.17 + '@esbuild/win32-x64': 0.16.17 dev: true /esbuild@0.18.20: @@ -8729,7 +8761,7 @@ packages: /eslint-import-resolver-node@0.3.9: resolution: {integrity: sha512-WFj2isz22JahUv+B788TlO3N6zL3nNJGU8CcZbPZvVEkBPaJdCV4vy5wyghty5ROFbCRnm132v8BScu5/1BQ8g==} dependencies: - debug: 3.2.7(supports-color@8.1.1) + debug: 3.2.7 is-core-module: 2.13.0 resolve: 1.22.4 transitivePeerDependencies: @@ -8742,7 +8774,7 @@ packages: eslint: '*' eslint-plugin-import: '*' dependencies: - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 enhanced-resolve: 5.15.0 eslint: 8.48.0 eslint-module-utils: 2.8.0(@typescript-eslint/parser@6.4.1)(eslint-import-resolver-node@0.3.9)(eslint-import-resolver-typescript@3.6.0)(eslint@8.48.0) @@ -8779,7 +8811,7 @@ packages: optional: true dependencies: '@typescript-eslint/parser': 6.4.1(eslint@8.48.0)(typescript@5.2.2) - debug: 3.2.7(supports-color@8.1.1) + debug: 3.2.7 eslint: 8.48.0 eslint-import-resolver-node: 0.3.9 eslint-import-resolver-typescript: 3.6.0(@typescript-eslint/parser@6.4.1)(eslint-import-resolver-node@0.3.9)(eslint-plugin-import@2.28.1)(eslint@8.48.0) @@ -8801,7 +8833,7 @@ packages: array.prototype.findlastindex: 1.2.2 array.prototype.flat: 1.3.1 array.prototype.flatmap: 1.3.1 - debug: 3.2.7(supports-color@8.1.1) + debug: 3.2.7 doctrine: 2.1.0 eslint: 8.48.0 eslint-import-resolver-node: 0.3.9 @@ -8946,7 +8978,7 @@ packages: ajv: 6.12.6 chalk: 4.1.2 cross-spawn: 7.0.3 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 doctrine: 3.0.0 escape-string-regexp: 4.0.0 eslint-scope: 7.2.2 @@ -9675,6 +9707,16 @@ packages: /flatted@3.2.7: resolution: {integrity: sha512-5nqDSxl8nn5BSNxyR3n4I6eDmbolI6WT+QqR547RwxQapgjQBmtktdP+HTBb/a/zLsbzERTONyUB5pefh5TtjQ==} + /follow-redirects@1.15.2: + resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} + engines: {node: '>=4.0'} + peerDependencies: + debug: '*' + peerDependenciesMeta: + debug: + optional: true + dev: false + /follow-redirects@1.15.2(debug@4.3.4): resolution: {integrity: sha512-VQLG33o04KaQ8uYi2tVNbdrWp1QWxNNea+nmIB4EVM28v0hmP17z7aG1+wAkNzVq4KeXTq3221ye5qTJP91JwA==} engines: {node: '>=4.0'} @@ -9685,6 +9727,7 @@ packages: optional: true dependencies: debug: 4.3.4(supports-color@8.1.1) + dev: true /for-each@0.3.3: resolution: {integrity: sha512-jqYfLp7mo9vIyQf8ykW2v7A+2N4QjeCeI5+Dz9XraiO1ign81wjiH7Fb9vSOWvQfNtmSa4H2RoQTrrXivdUZmw==} @@ -10496,7 +10539,7 @@ packages: dependencies: '@tootallnate/once': 2.0.0 agent-base: 6.0.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 transitivePeerDependencies: - supports-color dev: true @@ -10570,7 +10613,7 @@ packages: engines: {node: '>= 6'} dependencies: agent-base: 6.0.2 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 transitivePeerDependencies: - supports-color @@ -11092,6 +11135,14 @@ packages: ws: '*' dependencies: ws: 8.12.0 + dev: true + + /isomorphic-ws@5.0.0(ws@8.13.0): + resolution: {integrity: sha512-muId7Zzn9ywDsyXgTIafTry2sV3nySZeUDe6YedVd1Hvuuep5AsIlqK+XefWpYTyJG5e503F2xIuT2lcU6rCSw==} + peerDependencies: + ws: '*' + dependencies: + ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10) /isstream@0.1.2: resolution: {integrity: sha512-Yljz7ffyPbrLpLngrMtZ7NduUgVvi6wG9RJ9IUcyCd59YQ911PBJphODUcbOVbqYfxe1wuYf/LJ8PauMRwsM/g==} @@ -11201,7 +11252,7 @@ packages: engines: {node: '>=8'} hasBin: true dependencies: - '@types/connect': 3.4.35 + '@types/connect': 3.4.36 '@types/node': 12.20.55 '@types/ws': 7.4.7 JSONStream: 1.3.5 @@ -11421,7 +11472,7 @@ packages: requiresBuild: true dependencies: node-addon-api: 2.0.2 - node-gyp-build: 4.6.0 + node-gyp-build: 4.6.1 readable-stream: 3.6.2 /keyv@3.0.0: @@ -11919,7 +11970,7 @@ packages: /media-query-parser@2.0.2: resolution: {integrity: sha512-1N4qp+jE0pL5Xv4uEcwVUhIkwdUO3S/9gML90nqKA7v7FcOS5vUtatfzok9S9U1EJU8dHWlcv95WLnKmmxZI9w==} dependencies: - '@babel/runtime': 7.22.11 + '@babel/runtime': 7.22.15 dev: false /media-typer@0.3.0: @@ -12383,8 +12434,8 @@ packages: engines: {node: '>= 6.13.0'} dev: true - /node-gyp-build@4.6.0: - resolution: {integrity: sha512-NTZVKn9IylLwUzaKjkas1e4u2DLNcV4rdYagA4PWdPwW87Bi7z+BznyKSRwS/761tV/lzCGXplWsiaMjLqP2zQ==} + /node-gyp-build@4.6.1: + resolution: {integrity: sha512-24vnklJmyRS8ViBNI8KbtK/r/DmXQMRiOMXTNz2nrTnAYUwjmEEbnnpB/+kt+yWRv73bPsSPRFddrcIbAxSiMQ==} hasBin: true /node-preload@0.2.1: @@ -13222,8 +13273,8 @@ packages: source-map-js: 1.0.2 dev: true - /preact@10.17.0: - resolution: {integrity: sha512-SNsI8cbaCcUS5tbv9nlXuCfIXnJ9ysBMWk0WnB6UWwcVA3qZ2O6FxqDFECMAMttvLQcW/HaNZUe2BLidyvrVYw==} + /preact@10.17.1: + resolution: {integrity: sha512-X9BODrvQ4Ekwv9GURm9AKAGaomqXmip7NQTZgY7gcNmr7XE83adOMJvd3N42id1tMFU7ojiynRsYnY6/BRFxLA==} /preferred-pm@3.0.3: resolution: {integrity: sha512-+wZgbxNES/KlJs9q40F/1sfOd/j7f1O9JaHcW5Dsn3aUUOZg3L2bjpVUcKV2jvtElYfoTuQiNeMfQJ4kwUAhCQ==} @@ -14050,7 +14101,7 @@ packages: /rpc-websockets@7.6.0: resolution: {integrity: sha512-Jgcs8q6t8Go98dEulww1x7RysgTkzpCMelVxZW4hvuyFtOGpeUz9prpr2KjUa/usqxgFCd9Tu3+yhHEP9GVmiQ==} dependencies: - '@babel/runtime': 7.22.11 + '@babel/runtime': 7.22.15 eventemitter3: 4.0.7 uuid: 8.3.2 ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10) @@ -14149,7 +14200,7 @@ packages: dependencies: elliptic: 6.5.4 node-addon-api: 2.0.2 - node-gyp-build: 4.6.0 + node-gyp-build: 4.6.1 dev: true /seek-bzip@1.0.6: @@ -14931,6 +14982,7 @@ packages: engines: {node: '>=10'} dependencies: has-flag: 4.0.0 + dev: true /supports-preserve-symlinks-flag@1.0.0: resolution: {integrity: sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==} @@ -15628,7 +15680,7 @@ packages: engines: {node: '>=6.14.2'} requiresBuild: true dependencies: - node-gyp-build: 4.6.0 + node-gyp-build: 4.6.1 /utf8@3.0.0: resolution: {integrity: sha512-E8VjFIQ/TyQgp+TZfS6l8yp/xWppSAHzidGiRrqe4bK4XP9pTRyKFgGJpO3SN7zdX4DeomTrwaseCHovfpFcqQ==} @@ -15750,25 +15802,24 @@ packages: - zod dev: true - /viem@1.8.1(typescript@5.2.2)(zod@3.22.2): - resolution: {integrity: sha512-g+8dW8K6uae+3k/5pezSmlwo3/G+uEZiQsHlJooH86Z4PT3clgtU179iL/GNEcNGwafyJh/Iq/1e+FTbHQKH8Q==} + /viem@1.10.4(typescript@5.2.2)(zod@3.22.2): + resolution: {integrity: sha512-GRnz1KLWh7rDFvR0fMUBt8orVu/QbGJ3QqlLo7M71H4rig39TvjDoVyMp7eFK18+Zs6niqev1f8woX9fv3cwVg==} peerDependencies: typescript: '>=5.0.4' peerDependenciesMeta: typescript: optional: true dependencies: - '@adraffy/ens-normalize': 1.9.0 - '@noble/curves': 1.1.0 - '@noble/hashes': 1.3.0 - '@scure/bip32': 1.3.0 - '@scure/bip39': 1.2.0 + '@adraffy/ens-normalize': 1.9.4 + '@noble/curves': 1.2.0 + '@noble/hashes': 1.3.2 + '@scure/bip32': 1.3.2 + '@scure/bip39': 1.2.1 '@types/ws': 8.5.5 - '@wagmi/chains': 1.7.0(typescript@5.2.2) - abitype: 0.9.3(typescript@5.2.2)(zod@3.22.2) - isomorphic-ws: 5.0.0(ws@8.12.0) + abitype: 0.9.8(typescript@5.2.2)(zod@3.22.2) + isomorphic-ws: 5.0.0(ws@8.13.0) typescript: 5.2.2 - ws: 8.12.0 + ws: 8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10) transitivePeerDependencies: - bufferutil - utf-8-validate @@ -15780,7 +15831,7 @@ packages: hasBin: true dependencies: cac: 6.7.14 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 mlly: 1.4.0 pathe: 1.1.1 picocolors: 1.0.0 @@ -15875,7 +15926,7 @@ packages: acorn-walk: 8.2.0 cac: 6.7.14 chai: 4.3.8 - debug: 4.3.4(supports-color@8.1.1) + debug: 4.3.4 jsdom: 22.1.0 local-pkg: 0.4.3 magic-string: 0.30.3 @@ -15913,8 +15964,8 @@ packages: xml-name-validator: 4.0.0 dev: true - /wagmi@1.3.10(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2): - resolution: {integrity: sha512-MMGJcnxOmeUZWDmzUxgRGcB1cqxbJoSFSa+pNY4vBCWMz0n4ptpE5F8FKISLCx+BGoDwsaz2ldcMALcdJZ+29w==} + /wagmi@1.4.1(@types/react@18.2.21)(immer@10.0.2)(react-dom@18.2.0)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2): + resolution: {integrity: sha512-v3xd+uYZfLCAs1I4fLU7U9hg/gCw+Ud005J7kNR0mi20BcFAEU1EDN1LxHxpjUV0qKhOzSlMlrLjJyBCmSYhFA==} peerDependencies: react: '>=17.0.0' typescript: '>=5.0.4' @@ -15923,15 +15974,15 @@ packages: typescript: optional: true dependencies: - '@tanstack/query-sync-storage-persister': 4.32.6 - '@tanstack/react-query': 4.32.6(react-dom@18.2.0)(react@18.2.0) - '@tanstack/react-query-persist-client': 4.32.6(@tanstack/react-query@4.32.6) - '@wagmi/core': 1.3.9(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.2.2)(viem@1.8.1)(zod@3.22.2) + '@tanstack/query-sync-storage-persister': 4.33.0 + '@tanstack/react-query': 4.33.0(react-dom@18.2.0)(react@18.2.0) + '@tanstack/react-query-persist-client': 4.33.0(@tanstack/react-query@4.33.0) + '@wagmi/core': 1.4.1(@types/react@18.2.21)(immer@10.0.2)(react@18.2.0)(typescript@5.2.2)(viem@1.10.4)(zod@3.22.2) abitype: 0.8.7(typescript@5.2.2)(zod@3.22.2) react: 18.2.0 typescript: 5.2.2 use-sync-external-store: 1.2.0(react@18.2.0) - viem: 1.8.1(typescript@5.2.2)(zod@3.22.2) + viem: 1.10.4(typescript@5.2.2)(zod@3.22.2) transitivePeerDependencies: - '@react-native-async-storage/async-storage' - '@types/react' @@ -17388,6 +17439,7 @@ packages: optional: true utf-8-validate: optional: true + dev: true /ws@8.13.0(bufferutil@4.0.7)(utf-8-validate@5.0.10): resolution: {integrity: sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==} From 651534b5bf8776b346a9433340c6e89bafeacd29 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Wed, 6 Sep 2023 15:46:50 +0000 Subject: [PATCH 04/46] working with batch call and signature --- packages/widget/src/CommandMapper.tsx | 19 ++++++++++++------- packages/widget/src/ContractWriteManager.tsx | 12 +++++++++++- 2 files changed, 23 insertions(+), 8 deletions(-) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 2ca28431..ccd45387 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -179,7 +179,7 @@ export function SuperWrapIntoSuperTokensCommandMapper({ cmd.chainId as keyof typeof superUpgraderAddress ], value: cmd.amountWeiFromUnderlyingTokenDecimals * 2n, - nonce: 0, // TODO(KK): figure out + nonce: 2, // TODO(KK): figure out deadline: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", }, @@ -635,12 +635,17 @@ const createContractWrite = < const [operationType, target, call] = arg.materializeForBatchCall(signature); - const callData = encodeFunctionData(call); - const data = encodeAbiParameters(parseAbiParameters("bytes, bytes"), [ - callData, - "0x", - ]); + if (operationType === 201) { + const callData = encodeFunctionData(call); + const data = encodeAbiParameters(parseAbiParameters("bytes, bytes"), [ + callData, + "0x", + ]); - return { operationType, target, data }; + return { operationType, target, data }; + } else { + const callData = encodeFunctionData(call); + return { operationType, target, data: callData }; + } }, }) as ContractWrite; diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index cea7f6d4..9e71d5a6 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -51,7 +51,17 @@ export function ContractWriteManager({ prepare ? materialized : undefined, ); - const writeResult = useContractWrite(prepareResult.config); + console.log({ + materialized, + }); + + const writeResult = useContractWrite( + prepareResult.isSuccess + ? prepareResult.config + : materialized + ? (materialized as any) + : prepareResult.config, + ); const transactionResult = useWaitForTransaction({ hash: writeResult.data?.hash, }); From d930617581de2e2508c14757ec8e1b0f1a2d226f Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Thu, 7 Sep 2023 12:00:28 +0000 Subject: [PATCH 05/46] working last contract solution --- packages/widget/src/CommandMapper.tsx | 28 +- packages/widget/src/NetworkAvatar.tsx | 2 +- packages/widget/src/core/wagmi-generated.ts | 6756 ++++++++++--------- packages/widget/wagmi.config.ts | 2 +- 4 files changed, 3446 insertions(+), 3342 deletions(-) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index ccd45387..4bc0ebf8 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -178,8 +178,10 @@ export function SuperWrapIntoSuperTokensCommandMapper({ superUpgraderAddress[ cmd.chainId as keyof typeof superUpgraderAddress ], - value: cmd.amountWeiFromUnderlyingTokenDecimals * 2n, - nonce: 2, // TODO(KK): figure out + value: BigInt( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + ), + nonce: 7, // TODO(KK): Read it on-chain deadline: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", }, @@ -187,20 +189,19 @@ export function SuperWrapIntoSuperTokensCommandMapper({ materialize: (signature) => { const sig = hexToSignature(signature!); - console.log({ - sig, - }); - return { abi: superUpgraderABI, - functionName: "manualUpgradeWithAuthorization", + functionName: "manualUpgradeWithPermit", address: superUpgraderAddress[ cmd.chainId as keyof typeof superUpgraderAddress ], + value: 100000000000000000n, args: [ cmd.amountWeiFromUnderlyingTokenDecimals, - cmd.amountWeiFromUnderlyingTokenDecimals * 2n, + BigInt( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + ), BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), @@ -214,10 +215,6 @@ export function SuperWrapIntoSuperTokensCommandMapper({ materializeForBatchCall: (signature) => { const sig = hexToSignature(signature!); - console.log({ - sig, - }); - return [ 202, superUpgraderAddress[ @@ -225,14 +222,17 @@ export function SuperWrapIntoSuperTokensCommandMapper({ ], { abi: superUpgraderABI, - functionName: "manualUpgradeWithAuthorization", + functionName: "manualUpgradeWithPermit", address: superUpgraderAddress[ cmd.chainId as keyof typeof superUpgraderAddress ], + value: 100000000000000000n, args: [ cmd.amountWeiFromUnderlyingTokenDecimals, - cmd.amountWeiFromUnderlyingTokenDecimals * 2n, + BigInt( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + ), BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), diff --git a/packages/widget/src/NetworkAvatar.tsx b/packages/widget/src/NetworkAvatar.tsx index 998b3420..263816f0 100644 --- a/packages/widget/src/NetworkAvatar.tsx +++ b/packages/widget/src/NetworkAvatar.tsx @@ -1,7 +1,7 @@ import { Avatar, AvatarProps } from "@mui/material"; import { FC, useMemo } from "react"; -import { defaultNetworkAssets,SupportedNetwork } from "./core/index.js"; +import { defaultNetworkAssets, SupportedNetwork } from "./core/index.js"; export interface NetworkAvatarProps { network: SupportedNetwork; diff --git a/packages/widget/src/core/wagmi-generated.ts b/packages/widget/src/core/wagmi-generated.ts index 5ee54449..b5f38f21 100644 --- a/packages/widget/src/core/wagmi-generated.ts +++ b/packages/widget/src/core/wagmi-generated.ts @@ -1,506 +1,541 @@ -// Generated by @wagmi/cli@1.3.0 on 9/5/2023 at 2:44:28 PM - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Super Token +// AutoWrapManager ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -export const superTokenABI = [ +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x0B82D14E9616ca4d260E77454834AdCf5887595F) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x3eAB3c6207F488E475b7955B631B564F0E6317B9) + */ +export const autoWrapManagerABI = [ { stateMutability: "nonpayable", type: "constructor", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "constantOutflowNFT", - internalType: "contract IConstantOutflowNFT", - type: "address", - }, - { - name: "constantInflowNFT", - internalType: "contract IConstantInflowNFT", - type: "address", - }, + { name: "_cfa", internalType: "address", type: "address" }, + { name: "_minLower", internalType: "uint64", type: "uint64" }, + { name: "_minUpper", internalType: "uint64", type: "uint64" }, ], }, - { type: "error", inputs: [], name: "SF_TOKEN_AGREEMENT_ALREADY_EXISTS" }, - { type: "error", inputs: [], name: "SF_TOKEN_AGREEMENT_DOES_NOT_EXIST" }, - { type: "error", inputs: [], name: "SF_TOKEN_BURN_INSUFFICIENT_BALANCE" }, - { type: "error", inputs: [], name: "SF_TOKEN_MOVE_INSUFFICIENT_BALANCE" }, - { type: "error", inputs: [], name: "SF_TOKEN_ONLY_HOST" }, - { type: "error", inputs: [], name: "SF_TOKEN_ONLY_LISTED_AGREEMENT" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS" }, { type: "error", - inputs: [], - name: "SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER", + inputs: [ + { name: "limitGiven", internalType: "uint64", type: "uint64" }, + { name: "minLimit", internalType: "uint64", type: "uint64" }, + ], + name: "InsufficientLimits", }, { type: "error", - inputs: [], - name: "SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED", + inputs: [ + { name: "expirationTimeGiven", internalType: "uint64", type: "uint64" }, + { name: "timeNow", internalType: "uint256", type: "uint256" }, + ], + name: "InvalidExpirationTime", }, - { type: "error", inputs: [], name: "SUPER_TOKEN_MINT_TO_ZERO_ADDRESS" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED" }, { type: "error", - inputs: [], - name: "SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT", + inputs: [{ name: "strategy", internalType: "address", type: "address" }], + name: "InvalidStrategy", }, - { type: "error", inputs: [], name: "SUPER_TOKEN_NO_UNDERLYING_TOKEN" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_ONLY_GOV_OWNER" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_ONLY_HOST" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_ONLY_SELF" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS" }, - { type: "error", inputs: [], name: "SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS" }, + { + type: "error", + inputs: [ + { name: "caller", internalType: "address", type: "address" }, + { name: "expectedCaller", internalType: "address", type: "address" }, + ], + name: "UnauthorizedCaller", + }, + { + type: "error", + inputs: [{ name: "superToken", internalType: "address", type: "address" }], + name: "UnsupportedSuperToken", + }, + { + type: "error", + inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], + name: "WrapNotRequired", + }, + { + type: "error", + inputs: [ + { name: "lowerLimit", internalType: "uint64", type: "uint64" }, + { name: "upperLimit", internalType: "uint64", type: "uint64" }, + ], + name: "WrongLimits", + }, + { type: "error", inputs: [], name: "ZeroAddress" }, { type: "event", anonymous: false, inputs: [ { - name: "agreementClass", + name: "strategy", internalType: "address", type: "address", indexed: true, }, - { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, - { - name: "data", - internalType: "bytes32[]", - type: "bytes32[]", - indexed: false, - }, ], - name: "AgreementCreated", + name: "AddedApprovedStrategy", }, { type: "event", anonymous: false, inputs: [ { - name: "agreementClass", - internalType: "address", - type: "address", - indexed: true, - }, - { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, - { - name: "penaltyAccount", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "rewardAccount", - internalType: "address", - type: "address", - indexed: true, + name: "lowerLimit", + internalType: "uint64", + type: "uint64", + indexed: false, }, { - name: "rewardAmount", - internalType: "uint256", - type: "uint256", + name: "upperLimit", + internalType: "uint64", + type: "uint64", indexed: false, }, ], - name: "AgreementLiquidated", + name: "LimitsChanged", }, { type: "event", anonymous: false, inputs: [ { - name: "liquidatorAccount", - internalType: "address", - type: "address", - indexed: false, - }, - { - name: "agreementClass", + name: "previousOwner", internalType: "address", type: "address", indexed: true, }, - { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, { - name: "penaltyAccount", + name: "newOwner", internalType: "address", type: "address", indexed: true, }, + ], + name: "OwnershipTransferred", + }, + { + type: "event", + anonymous: false, + inputs: [ { - name: "bondAccount", + name: "strategy", internalType: "address", type: "address", indexed: true, }, + ], + name: "RemovedApprovedStrategy", + }, + { + type: "event", + anonymous: false, + inputs: [ + { name: "id", internalType: "bytes32", type: "bytes32", indexed: true }, { - name: "rewardAmount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - { - name: "bailoutAmount", + name: "wrapAmount", internalType: "uint256", type: "uint256", indexed: false, }, ], - name: "AgreementLiquidatedBy", + name: "WrapExecuted", }, { type: "event", anonymous: false, inputs: [ + { name: "id", internalType: "bytes32", type: "bytes32", indexed: true }, + { name: "user", internalType: "address", type: "address", indexed: true }, { - name: "agreementClass", - internalType: "address", - type: "address", - indexed: true, - }, - { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, - { - name: "liquidatorAccount", + name: "superToken", internalType: "address", type: "address", indexed: true, }, { - name: "targetAccount", + name: "strategy", internalType: "address", type: "address", - indexed: true, + indexed: false, }, { - name: "rewardAmountReceiver", + name: "liquidityToken", internalType: "address", type: "address", indexed: false, }, { - name: "rewardAmount", + name: "expiry", internalType: "uint256", type: "uint256", indexed: false, }, { - name: "targetAccountBalanceDelta", - internalType: "int256", - type: "int256", + name: "lowerLimit", + internalType: "uint256", + type: "uint256", indexed: false, }, { - name: "liquidationTypeData", - internalType: "bytes", - type: "bytes", + name: "upperLimit", + internalType: "uint256", + type: "uint256", indexed: false, }, ], - name: "AgreementLiquidatedV2", + name: "WrapScheduleCreated", }, { type: "event", anonymous: false, inputs: [ + { name: "id", internalType: "bytes32", type: "bytes32", indexed: true }, + { name: "user", internalType: "address", type: "address", indexed: true }, { - name: "agreementClass", + name: "superToken", internalType: "address", type: "address", indexed: true, }, { - name: "account", + name: "strategy", internalType: "address", type: "address", - indexed: true, + indexed: false, }, { - name: "slotId", - internalType: "uint256", - type: "uint256", + name: "liquidityToken", + internalType: "address", + type: "address", indexed: false, }, ], - name: "AgreementStateUpdated", + name: "WrapScheduleDeleted", }, { - type: "event", - anonymous: false, - inputs: [ + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "strategy", internalType: "address", type: "address" }], + name: "addApprovedStrategy", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "", internalType: "address", type: "address" }], + name: "approvedStrategies", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "cfaV1", + outputs: [ { - name: "agreementClass", - internalType: "address", + name: "", + internalType: "contract IConstantFlowAgreementV1", type: "address", - indexed: true, }, - { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, ], - name: "AgreementTerminated", }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ - { - name: "agreementClass", - internalType: "address", - type: "address", - indexed: true, - }, - { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, - { - name: "data", - internalType: "bytes32[]", - type: "bytes32[]", - indexed: false, - }, + { name: "user", internalType: "address", type: "address" }, + { name: "superToken", internalType: "address", type: "address" }, + { name: "liquidityToken", internalType: "address", type: "address" }, ], - name: "AgreementUpdated", + name: "checkWrap", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { - type: "event", - anonymous: false, - inputs: [ - { - name: "owner", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "spender", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "value", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - ], - name: "Approval", + stateMutability: "view", + type: "function", + inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], + name: "checkWrapByIndex", + outputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "operator", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "tokenHolder", - internalType: "address", - type: "address", - indexed: true, - }, + { name: "superToken", internalType: "address", type: "address" }, + { name: "strategy", internalType: "address", type: "address" }, + { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "expiry", internalType: "uint64", type: "uint64" }, + { name: "lowerLimit", internalType: "uint64", type: "uint64" }, + { name: "upperLimit", internalType: "uint64", type: "uint64" }, ], - name: "AuthorizedOperator", + name: "createWrapSchedule", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "bailoutAccount", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "bailoutAmount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + { name: "user", internalType: "address", type: "address" }, + { name: "superToken", internalType: "address", type: "address" }, + { name: "liquidityToken", internalType: "address", type: "address" }, ], - name: "Bailout", + name: "deleteWrapSchedule", + outputs: [], }, { - type: "event", - anonymous: false, - inputs: [ - { - name: "operator", - internalType: "address", - type: "address", - indexed: true, - }, - { name: "from", internalType: "address", type: "address", indexed: true }, - { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - { name: "data", internalType: "bytes", type: "bytes", indexed: false }, - { - name: "operatorData", - internalType: "bytes", - type: "bytes", - indexed: false, - }, - ], - name: "Burned", + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], + name: "deleteWrapScheduleByIndex", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "uuid", - internalType: "bytes32", - type: "bytes32", - indexed: false, - }, - { - name: "codeAddress", - internalType: "address", - type: "address", - indexed: false, - }, + { name: "user", internalType: "address", type: "address" }, + { name: "superToken", internalType: "address", type: "address" }, + { name: "liquidityToken", internalType: "address", type: "address" }, ], - name: "CodeUpdated", + name: "executeWrap", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], + name: "executeWrapByIndex", + outputs: [], + }, + { + stateMutability: "view", + type: "function", inputs: [ + { name: "user", internalType: "address", type: "address" }, + { name: "superToken", internalType: "address", type: "address" }, + { name: "liquidityToken", internalType: "address", type: "address" }, + ], + name: "getWrapSchedule", + outputs: [ { - name: "constantInflowNFT", - internalType: "contract IConstantInflowNFT", - type: "address", - indexed: true, + name: "", + internalType: "struct IManager.WrapSchedule", + type: "tuple", + components: [ + { name: "user", internalType: "address", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, + { + name: "strategy", + internalType: "contract IStrategy", + type: "address", + }, + { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "expiry", internalType: "uint64", type: "uint64" }, + { name: "lowerLimit", internalType: "uint64", type: "uint64" }, + { name: "upperLimit", internalType: "uint64", type: "uint64" }, + ], }, ], - name: "ConstantInflowNFTCreated", }, { - type: "event", - anonymous: false, - inputs: [ + stateMutability: "view", + type: "function", + inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], + name: "getWrapScheduleByIndex", + outputs: [ { - name: "constantOutflowNFT", - internalType: "contract IConstantOutflowNFT", - type: "address", - indexed: true, + name: "", + internalType: "struct IManager.WrapSchedule", + type: "tuple", + components: [ + { name: "user", internalType: "address", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, + { + name: "strategy", + internalType: "contract IStrategy", + type: "address", + }, + { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "expiry", internalType: "uint64", type: "uint64" }, + { name: "lowerLimit", internalType: "uint64", type: "uint64" }, + { name: "upperLimit", internalType: "uint64", type: "uint64" }, + ], }, ], - name: "ConstantOutflowNFTCreated", }, { - type: "event", - anonymous: false, + stateMutability: "pure", + type: "function", inputs: [ - { name: "version", internalType: "uint8", type: "uint8", indexed: false }, + { name: "user", internalType: "address", type: "address" }, + { name: "superToken", internalType: "address", type: "address" }, + { name: "liquidityToken", internalType: "address", type: "address" }, ], - name: "Initialized", + name: "getWrapScheduleIndex", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, { - type: "event", - anonymous: false, - inputs: [ - { - name: "operator", - internalType: "address", - type: "address", - indexed: true, - }, - { name: "to", internalType: "address", type: "address", indexed: true }, - { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - { name: "data", internalType: "bytes", type: "bytes", indexed: false }, - { - name: "operatorData", - internalType: "bytes", - type: "bytes", - indexed: false, - }, - ], - name: "Minted", + stateMutability: "view", + type: "function", + inputs: [], + name: "minLower", + outputs: [{ name: "", internalType: "uint64", type: "uint64" }], }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", + inputs: [], + name: "minUpper", + outputs: [{ name: "", internalType: "uint64", type: "uint64" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "owner", + outputs: [{ name: "", internalType: "address", type: "address" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "strategy", internalType: "address", type: "address" }], + name: "removeApprovedStrategy", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [], + name: "renounceOwnership", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "operator", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "tokenHolder", - internalType: "address", - type: "address", - indexed: true, - }, + { name: "lowerLimit", internalType: "uint64", type: "uint64" }, + { name: "upperLimit", internalType: "uint64", type: "uint64" }, ], - name: "RevokedOperator", + name: "setLimits", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "newOwner", internalType: "address", type: "address" }], + name: "transferOwnership", + outputs: [], + }, +] as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x0B82D14E9616ca4d260E77454834AdCf5887595F) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x3eAB3c6207F488E475b7955B631B564F0E6317B9) + */ +export const autoWrapManagerAddress = { + 1: "0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1", + 5: "0x0B82D14E9616ca4d260E77454834AdCf5887595F", + 10: "0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23", + 56: "0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325", + 100: "0x8082e58681350876aFe8f52d3Bf8672034A03Db0", + 137: "0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32", + 42161: "0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272", + 43113: "0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1", + 43114: "0x8082e58681350876aFe8f52d3Bf8672034A03Db0", + 80001: "0x3eAB3c6207F488E475b7955B631B564F0E6317B9", +} as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x0B82D14E9616ca4d260E77454834AdCf5887595F) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x3eAB3c6207F488E475b7955B631B564F0E6317B9) + */ +export const autoWrapManagerConfig = { + address: autoWrapManagerAddress, + abi: autoWrapManagerABI, +} as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// AutoWrapStrategy +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x342076aA957B0ec8bC1d3893af719b288eA31e61) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x544728AFDBeEafBeC9e1329031788edb53017bC4) + */ +export const autoWrapStrategyABI = [ + { + stateMutability: "nonpayable", + type: "constructor", + inputs: [{ name: "_manager", internalType: "address", type: "address" }], + }, + { + type: "error", inputs: [ - { - name: "operator", - internalType: "address", - type: "address", - indexed: true, - }, - { name: "from", internalType: "address", type: "address", indexed: true }, - { name: "to", internalType: "address", type: "address", indexed: true }, - { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - { name: "data", internalType: "bytes", type: "bytes", indexed: false }, - { - name: "operatorData", - internalType: "bytes", - type: "bytes", - indexed: false, - }, + { name: "caller", internalType: "address", type: "address" }, + { name: "expectedCaller", internalType: "address", type: "address" }, ], - name: "Sent", + name: "UnauthorizedCaller", + }, + { + type: "error", + inputs: [{ name: "superToken", internalType: "address", type: "address" }], + name: "UnsupportedSuperToken", }, + { type: "error", inputs: [], name: "ZeroAddress" }, { type: "event", anonymous: false, inputs: [ { - name: "account", + name: "receiver", internalType: "address", type: "address", indexed: true, }, { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - ], - name: "TokenDowngraded", - }, - { - type: "event", - anonymous: false, - inputs: [ - { - name: "account", + name: "token", internalType: "address", type: "address", indexed: true, @@ -512,945 +547,1050 @@ export const superTokenABI = [ indexed: false, }, ], - name: "TokenUpgraded", + name: "EmergencyWithdrawInitiated", }, { type: "event", anonymous: false, inputs: [ - { name: "from", internalType: "address", type: "address", indexed: true }, - { name: "to", internalType: "address", type: "address", indexed: true }, { - name: "value", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - ], - name: "Transfer", - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "CONSTANT_INFLOW_NFT", - outputs: [ - { - name: "", - internalType: "contract IConstantInflowNFT", + name: "oldManager", + internalType: "address", type: "address", + indexed: true, }, - ], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "CONSTANT_OUTFLOW_NFT", - outputs: [ { - name: "", - internalType: "contract IConstantOutflowNFT", + name: "manager", + internalType: "address", type: "address", + indexed: true, }, ], + name: "ManagerChanged", }, { - stateMutability: "view", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, + { + name: "previousOwner", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "newOwner", + internalType: "address", + type: "address", + indexed: true, + }, ], - name: "allowance", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + name: "OwnershipTransferred", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "spender", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "user", internalType: "address", type: "address", indexed: true }, + { + name: "superToken", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "superTokenAmount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "approve", - outputs: [{ name: "", internalType: "bool", type: "bool" }], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [{ name: "operator", internalType: "address", type: "address" }], - name: "authorizeOperator", - outputs: [], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "balanceOf", - outputs: [{ name: "balance", internalType: "uint256", type: "uint256" }], + name: "Wrapped", }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, - ], - name: "burn", + inputs: [{ name: "newManager", internalType: "address", type: "address" }], + name: "changeManager", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [], - name: "castrate", + inputs: [{ name: "token", internalType: "address", type: "address" }], + name: "emergencyWithdraw", outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32" }, - { name: "data", internalType: "bytes32[]", type: "bytes32[]" }, + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, ], - name: "createAgreement", - outputs: [], + name: "isSupportedSuperToken", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { - stateMutability: "pure", + stateMutability: "view", type: "function", inputs: [], - name: "decimals", - outputs: [{ name: "", internalType: "uint8", type: "uint8" }], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [ - { name: "spender", internalType: "address", type: "address" }, - { name: "subtractedValue", internalType: "uint256", type: "uint256" }, - ], - name: "decreaseAllowance", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "manager", + outputs: [{ name: "", internalType: "address", type: "address" }], }, { stateMutability: "view", type: "function", inputs: [], - name: "defaultOperators", - outputs: [{ name: "", internalType: "address[]", type: "address[]" }], + name: "owner", + outputs: [{ name: "", internalType: "address", type: "address" }], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], - name: "downgrade", + inputs: [], + name: "renounceOwnership", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "to", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - ], - name: "downgradeTo", + inputs: [{ name: "newOwner", internalType: "address", type: "address" }], + name: "transferOwnership", outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "getAccountActiveAgreements", - outputs: [ + inputs: [ + { name: "user", internalType: "address", type: "address" }, { - name: "", - internalType: "contract ISuperAgreement[]", - type: "address[]", + name: "superToken", + internalType: "contract ISuperToken", + type: "address", }, + { name: "superTokenAmount", internalType: "uint256", type: "uint256" }, ], + name: "wrap", + outputs: [], }, +] as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x342076aA957B0ec8bC1d3893af719b288eA31e61) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x544728AFDBeEafBeC9e1329031788edb53017bC4) + */ +export const autoWrapStrategyAddress = { + 1: "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d", + 5: "0xea49AF829D3E28d3eC49E0e0a0Ba1E7860A56F60", + 10: "0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4", + 56: "0x9e308cb079ae130790F604b1030cDf386670f199", + 100: "0x51FBAbD31A615E14b1bC12E9d887f60997264a4E", + 137: "0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b", + 42161: "0x342076aA957B0ec8bC1d3893af719b288eA31e61", + 43113: "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d", + 43114: "0x51FBAbD31A615E14b1bC12E9d887f60997264a4E", + 80001: "0x544728AFDBeEafBeC9e1329031788edb53017bC4", +} as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x342076aA957B0ec8bC1d3893af719b288eA31e61) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x544728AFDBeEafBeC9e1329031788edb53017bC4) + */ +export const autoWrapStrategyConfig = { + address: autoWrapStrategyAddress, + abi: autoWrapStrategyABI, +} as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// CFAv1Forwarder +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + */ +export const cfAv1ForwarderABI = [ { - stateMutability: "view", - type: "function", - inputs: [ - { name: "agreementClass", internalType: "address", type: "address" }, - { name: "id", internalType: "bytes32", type: "bytes32" }, - { name: "dataLength", internalType: "uint256", type: "uint256" }, - ], - name: "getAgreementData", - outputs: [{ name: "data", internalType: "bytes32[]", type: "bytes32[]" }], - }, - { - stateMutability: "view", - type: "function", + stateMutability: "nonpayable", + type: "constructor", inputs: [ - { name: "agreementClass", internalType: "address", type: "address" }, - { name: "account", internalType: "address", type: "address" }, - { name: "slotId", internalType: "uint256", type: "uint256" }, - { name: "dataLength", internalType: "uint256", type: "uint256" }, - ], - name: "getAgreementStateSlot", - outputs: [ - { name: "slotData", internalType: "bytes32[]", type: "bytes32[]" }, - ], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "getCodeAddress", - outputs: [ - { name: "codeAddress", internalType: "address", type: "address" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, ], }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "getHost", - outputs: [{ name: "host", internalType: "address", type: "address" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "getUnderlyingToken", - outputs: [{ name: "", internalType: "address", type: "address" }], - }, - { - stateMutability: "pure", - type: "function", - inputs: [], - name: "granularity", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], - }, + { type: "error", inputs: [], name: "CFA_FWD_INVALID_FLOW_RATE" }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "spender", internalType: "address", type: "address" }, - { name: "addedValue", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowrate", internalType: "int96", type: "int96" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "increaseAllowance", + name: "createFlow", outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "underlyingToken", - internalType: "contract IERC20", - type: "address", - }, - { name: "underlyingDecimals", internalType: "uint8", type: "uint8" }, - { name: "n", internalType: "string", type: "string" }, - { name: "s", internalType: "string", type: "string" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "initialize", - outputs: [], + name: "deleteFlow", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", inputs: [ + { name: "token", internalType: "contract ISuperToken", type: "address" }, { name: "account", internalType: "address", type: "address" }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, ], - name: "isAccountCritical", - outputs: [{ name: "isCritical", internalType: "bool", type: "bool" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "isAccountCriticalNow", - outputs: [{ name: "isCritical", internalType: "bool", type: "bool" }], + name: "getAccountFlowInfo", + outputs: [ + { name: "lastUpdated", internalType: "uint256", type: "uint256" }, + { name: "flowrate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], }, { stateMutability: "view", type: "function", inputs: [ + { name: "token", internalType: "contract ISuperToken", type: "address" }, { name: "account", internalType: "address", type: "address" }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, ], - name: "isAccountSolvent", - outputs: [{ name: "isSolvent", internalType: "bool", type: "bool" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "isAccountSolventNow", - outputs: [{ name: "isSolvent", internalType: "bool", type: "bool" }], + name: "getAccountFlowrate", + outputs: [{ name: "flowrate", internalType: "int96", type: "int96" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "operator", internalType: "address", type: "address" }, - { name: "tokenHolder", internalType: "address", type: "address" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "flowrate", internalType: "int96", type: "int96" }, + ], + name: "getBufferAmountByFlowrate", + outputs: [ + { name: "bufferAmount", internalType: "uint256", type: "uint256" }, ], - name: "isOperatorFor", - outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32" }, - { name: "liquidationTypeData", internalType: "bytes", type: "bytes" }, - { name: "liquidatorAccount", internalType: "address", type: "address" }, - { name: "useDefaultRewardAccount", internalType: "bool", type: "bool" }, - { name: "targetAccount", internalType: "address", type: "address" }, - { name: "rewardAmount", internalType: "uint256", type: "uint256" }, - { - name: "targetAccountBalanceDelta", - internalType: "int256", - type: "int256", - }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + ], + name: "getFlowInfo", + outputs: [ + { name: "lastUpdated", internalType: "uint256", type: "uint256" }, + { name: "flowrate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, ], - name: "makeLiquidationPayoutsV2", - outputs: [], }, { stateMutability: "view", type: "function", - inputs: [], - name: "name", - outputs: [{ name: "", internalType: "string", type: "string" }], - }, - { - stateMutability: "nonpayable", - type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "flowOperator", internalType: "address", type: "address" }, + ], + name: "getFlowOperatorPermissions", + outputs: [ + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowrateAllowance", internalType: "int96", type: "int96" }, ], - name: "operationApprove", - outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, - { name: "subtractedValue", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, ], - name: "operationDecreaseAllowance", - outputs: [], + name: "getFlowrate", + outputs: [{ name: "flowrate", internalType: "int96", type: "int96" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "flowOperator", internalType: "address", type: "address" }, ], - name: "operationDowngrade", - outputs: [], + name: "grantPermissions", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, - { name: "addedValue", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "flowOperator", internalType: "address", type: "address" }, ], - name: "operationIncreaseAllowance", - outputs: [], + name: "revokePermissions", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "spender", internalType: "address", type: "address" }, - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowrate", internalType: "int96", type: "int96" }, ], - name: "operationSend", - outputs: [], + name: "setFlowrate", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowrate", internalType: "int96", type: "int96" }, ], - name: "operationTransferFrom", - outputs: [], + name: "setFlowrateFrom", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowrate", internalType: "int96", type: "int96" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "operationUpgrade", - outputs: [], + name: "updateFlow", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, - { name: "operatorData", internalType: "bytes", type: "bytes" }, + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowrateAllowance", internalType: "int96", type: "int96" }, ], - name: "operatorBurn", - outputs: [], + name: "updateFlowOperatorPermissions", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, +] as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + */ +export const cfAv1ForwarderAddress = { + 1: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 5: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 10: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 56: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 100: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 137: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 420: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 1442: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 8453: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 42161: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 42220: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 43113: "0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D", + 43114: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 80001: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 84531: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 421613: "0xcfA132E353cB4E398080B9700609bb008eceB125", + 11155111: "0xcfA132E353cB4E398080B9700609bb008eceB125", +} as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + */ +export const cfAv1ForwarderConfig = { + address: cfAv1ForwarderAddress, + abi: cfAv1ForwarderABI, +} as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Constant Flow Agreement V1 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x19ba78B9cDB05A877718841c574325fdB53601bb) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) + */ +export const constantFlowAgreementV1ABI = [ { stateMutability: "nonpayable", - type: "function", - inputs: [ - { name: "sender", internalType: "address", type: "address" }, - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, - { name: "operatorData", internalType: "bytes", type: "bytes" }, - ], - name: "operatorSend", - outputs: [], - }, - { - stateMutability: "pure", - type: "function", - inputs: [], - name: "proxiableUUID", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], - }, - { - stateMutability: "view", - type: "function", + type: "constructor", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, - ], - name: "realtimeBalanceOf", - outputs: [ - { name: "availableBalance", internalType: "int256", type: "int256" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, - ], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "realtimeBalanceOfNow", - outputs: [ - { name: "availableBalance", internalType: "int256", type: "int256" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, ], }, + { type: "error", inputs: [], name: "AGREEMENT_BASE_ONLY_HOST" }, { - stateMutability: "nonpayable", - type: "function", - inputs: [{ name: "operator", internalType: "address", type: "address" }], - name: "revokeOperator", - outputs: [], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - ], - name: "selfApproveFor", - outputs: [], + type: "error", + inputs: [{ name: "_code", internalType: "uint256", type: "uint256" }], + name: "APP_RULE", }, + { type: "error", inputs: [], name: "CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_NEGATIVE_ALLOWANCE" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_CREATE" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_FLOW_OPERATOR" }, + { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_UPDATE" }, + { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_ACL_UNCLEAN_PERMISSIONS" }, + { type: "error", inputs: [], name: "CFA_DEPOSIT_TOO_BIG" }, + { type: "error", inputs: [], name: "CFA_FLOW_ALREADY_EXISTS" }, + { type: "error", inputs: [], name: "CFA_FLOW_DOES_NOT_EXIST" }, + { type: "error", inputs: [], name: "CFA_FLOW_RATE_TOO_BIG" }, + { type: "error", inputs: [], name: "CFA_HOOK_OUT_OF_GAS" }, + { type: "error", inputs: [], name: "CFA_INSUFFICIENT_BALANCE" }, + { type: "error", inputs: [], name: "CFA_INVALID_FLOW_RATE" }, + { type: "error", inputs: [], name: "CFA_NON_CRITICAL_SENDER" }, + { type: "error", inputs: [], name: "CFA_NO_SELF_FLOW" }, + { type: "error", inputs: [], name: "CFA_ZERO_ADDRESS_RECEIVER" }, + { type: "error", inputs: [], name: "CFA_ZERO_ADDRESS_SENDER" }, + { type: "error", inputs: [], name: "OUT_OF_GAS" }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { + name: "uuid", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "codeAddress", + internalType: "address", + type: "address", + indexed: false, + }, ], - name: "selfBurn", - outputs: [], + name: "CodeUpdated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { + name: "sender", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "flowOperator", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "permissions", + internalType: "uint8", + type: "uint8", + indexed: false, + }, + { + name: "flowRateAllowance", + internalType: "int96", + type: "int96", + indexed: false, + }, ], - name: "selfMint", - outputs: [], + name: "FlowOperatorUpdated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "holder", internalType: "address", type: "address" }, - { name: "spender", internalType: "address", type: "address" }, - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { + name: "sender", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "receiver", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "flowRate", + internalType: "int96", + type: "int96", + indexed: false, + }, + { + name: "totalSenderFlowRate", + internalType: "int256", + type: "int256", + indexed: false, + }, + { + name: "totalReceiverFlowRate", + internalType: "int256", + type: "int256", + indexed: false, + }, + { + name: "userData", + internalType: "bytes", + type: "bytes", + indexed: false, + }, ], - name: "selfTransferFrom", - outputs: [], + name: "FlowUpdated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { + name: "flowOperator", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "deposit", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "send", - outputs: [], + name: "FlowUpdatedExtension", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "delta", internalType: "int256", type: "int256" }, + { name: "version", internalType: "uint8", type: "uint8", indexed: false }, ], - name: "settleBalance", - outputs: [], + name: "Initialized", }, { stateMutability: "view", type: "function", inputs: [], - name: "symbol", - outputs: [{ name: "", internalType: "string", type: "string" }], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32" }, - { name: "dataLength", internalType: "uint256", type: "uint256" }, - ], - name: "terminateAgreement", - outputs: [], + name: "CFA_HOOK_GAS_LIMIT", + outputs: [{ name: "", internalType: "uint64", type: "uint64" }], }, { stateMutability: "view", type: "function", inputs: [], - name: "totalSupply", + name: "DEFAULT_MINIMUM_DEPOSIT", outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - ], - name: "transfer", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "MAXIMUM_DEPOSIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "recipient", internalType: "address", type: "address" }], - name: "transferAll", - outputs: [], + inputs: [], + name: "MAXIMUM_FLOW_RATE", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "pure", type: "function", inputs: [ - { name: "holder", internalType: "address", type: "address" }, - { name: "recipient", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "existingPermissions", internalType: "uint8", type: "uint8" }, + { name: "permissionDelta", internalType: "uint8", type: "uint8" }, ], - name: "transferFrom", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "addPermissions", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], }, { - stateMutability: "nonpayable", + stateMutability: "pure", type: "function", - inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32" }, - { name: "data", internalType: "bytes32[]", type: "bytes32[]" }, - ], - name: "updateAgreementData", - outputs: [], + inputs: [], + name: "agreementType", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "account", internalType: "address", type: "address" }, - { name: "slotId", internalType: "uint256", type: "uint256" }, - { name: "slotData", internalType: "bytes32[]", type: "bytes32[]" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "updateAgreementStateSlot", - outputs: [], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [{ name: "newAddress", internalType: "address", type: "address" }], - name: "updateCode", - outputs: [], + name: "authorizeFlowOperatorWithFullControl", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], - name: "upgrade", + inputs: [], + name: "castrate", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "to", internalType: "address", type: "address" }, - { name: "amount", internalType: "uint256", type: "uint256" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "upgradeTo", - outputs: [], + name: "createFlow", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, -] as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Native Asset Super Token -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -export const nativeAssetSuperTokenABI = [ { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ { - name: "account", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, - }, - { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "TokenDowngraded", + name: "createFlowByOperator", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ { - name: "account", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, }, + { name: "flowOperator", internalType: "address", type: "address" }, { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, + name: "subtractedFlowRateAllowance", + internalType: "int96", + type: "int96", }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "TokenUpgraded", - }, - { stateMutability: "payable", type: "fallback" }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [{ name: "wad", internalType: "uint256", type: "uint256" }], - name: "downgradeToETH", - outputs: [], + name: "decreaseFlowRateAllowance", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "initialAddress", internalType: "address", type: "address" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "permissionsToRemove", internalType: "uint8", type: "uint8" }, + { + name: "subtractedFlowRateAllowance", + internalType: "int96", + type: "int96", + }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "initializeProxy", - outputs: [], - }, - { - stateMutability: "payable", - type: "function", - inputs: [], - name: "upgradeByETH", - outputs: [], - }, - { - stateMutability: "payable", - type: "function", - inputs: [{ name: "to", internalType: "address", type: "address" }], - name: "upgradeByETHTo", - outputs: [], + name: "decreaseFlowRateAllowanceWithPermissions", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, - { stateMutability: "payable", type: "receive" }, -] as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Pure Super Token -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -export const pureSuperTokenABI = [ - { stateMutability: "payable", type: "fallback" }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "name", internalType: "string", type: "string" }, - { name: "symbol", internalType: "string", type: "string" }, - { name: "initialSupply", internalType: "uint256", type: "uint256" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "initialize", - outputs: [], + name: "deleteFlow", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "initialAddress", internalType: "address", type: "address" }, - ], - name: "initializeProxy", - outputs: [], - }, - { stateMutability: "payable", type: "receive" }, -] as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// Constant Flow Agreement V1 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) - */ -export const constantFlowAgreementV1ABI = [ - { - stateMutability: "nonpayable", - type: "constructor", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], + name: "deleteFlowByOperator", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, - { type: "error", inputs: [], name: "AGREEMENT_BASE_ONLY_HOST" }, - { - type: "error", - inputs: [{ name: "_code", internalType: "uint256", type: "uint256" }], - name: "APP_RULE", - }, - { type: "error", inputs: [], name: "CFA_ACL_FLOW_RATE_ALLOWANCE_EXCEEDED" }, - { type: "error", inputs: [], name: "CFA_ACL_NO_NEGATIVE_ALLOWANCE" }, - { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_CREATE" }, - { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_FLOW_OPERATOR" }, - { type: "error", inputs: [], name: "CFA_ACL_NO_SENDER_UPDATE" }, - { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_CREATE_PERMISSIONS" }, - { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_DELETE_PERMISSIONS" }, - { type: "error", inputs: [], name: "CFA_ACL_OPERATOR_NO_UPDATE_PERMISSIONS" }, - { type: "error", inputs: [], name: "CFA_ACL_UNCLEAN_PERMISSIONS" }, - { type: "error", inputs: [], name: "CFA_DEPOSIT_TOO_BIG" }, - { type: "error", inputs: [], name: "CFA_FLOW_ALREADY_EXISTS" }, - { type: "error", inputs: [], name: "CFA_FLOW_DOES_NOT_EXIST" }, - { type: "error", inputs: [], name: "CFA_FLOW_RATE_TOO_BIG" }, - { type: "error", inputs: [], name: "CFA_HOOK_OUT_OF_GAS" }, - { type: "error", inputs: [], name: "CFA_INSUFFICIENT_BALANCE" }, - { type: "error", inputs: [], name: "CFA_INVALID_FLOW_RATE" }, - { type: "error", inputs: [], name: "CFA_NON_CRITICAL_SENDER" }, - { type: "error", inputs: [], name: "CFA_NO_SELF_FLOW" }, - { type: "error", inputs: [], name: "CFA_ZERO_ADDRESS_RECEIVER" }, - { type: "error", inputs: [], name: "CFA_ZERO_ADDRESS_SENDER" }, - { type: "error", inputs: [], name: "OUT_OF_GAS" }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ { - name: "uuid", - internalType: "bytes32", - type: "bytes32", - indexed: false, - }, - { - name: "codeAddress", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: false, }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "getAccountFlowInfo", + outputs: [ + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, ], - name: "CodeUpdated", }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", + inputs: [], + name: "getCodeAddress", + outputs: [ + { name: "codeAddress", internalType: "address", type: "address" }, + ], + }, + { + stateMutability: "view", + type: "function", inputs: [ { name: "token", internalType: "contract ISuperfluidToken", type: "address", - indexed: true, }, + { name: "flowRate", internalType: "int96", type: "int96" }, + ], + name: "getDepositRequiredForFlowRate", + outputs: [{ name: "deposit", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ { - name: "sender", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, }, + { name: "sender", internalType: "address", type: "address" }, + { name: "receiver", internalType: "address", type: "address" }, + ], + name: "getFlow", + outputs: [ + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ { - name: "flowOperator", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, - }, - { - name: "permissions", - internalType: "uint8", - type: "uint8", - indexed: false, - }, - { - name: "flowRateAllowance", - internalType: "int96", - type: "int96", - indexed: false, }, + { name: "flowId", internalType: "bytes32", type: "bytes32" }, + ], + name: "getFlowByID", + outputs: [ + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, ], - name: "FlowOperatorUpdated", }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ { name: "token", internalType: "contract ISuperfluidToken", type: "address", - indexed: true, }, + { name: "sender", internalType: "address", type: "address" }, + { name: "flowOperator", internalType: "address", type: "address" }, + ], + name: "getFlowOperatorData", + outputs: [ + { name: "flowOperatorId", internalType: "bytes32", type: "bytes32" }, + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ { - name: "sender", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, }, + { name: "flowOperatorId", internalType: "bytes32", type: "bytes32" }, + ], + name: "getFlowOperatorDataByID", + outputs: [ + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + ], + }, + { + stateMutability: "view", + type: "function", + inputs: [ { - name: "receiver", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, - }, - { - name: "flowRate", - internalType: "int96", - type: "int96", - indexed: false, - }, - { - name: "totalSenderFlowRate", - internalType: "int256", - type: "int256", - indexed: false, - }, - { - name: "totalReceiverFlowRate", - internalType: "int256", - type: "int256", - indexed: false, - }, - { - name: "userData", - internalType: "bytes", - type: "bytes", - indexed: false, }, + { name: "deposit", internalType: "uint256", type: "uint256" }, ], - name: "FlowUpdated", + name: "getMaximumFlowRateFromDeposit", + outputs: [{ name: "flowRate", internalType: "int96", type: "int96" }], }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ { - name: "flowOperator", - internalType: "address", + name: "token", + internalType: "contract ISuperfluidToken", type: "address", - indexed: true, }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "getNetFlow", + outputs: [{ name: "flowRate", internalType: "int96", type: "int96" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ { - name: "deposit", - internalType: "uint256", - type: "uint256", - indexed: false, + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "addedFlowRateAllowance", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "FlowUpdatedExtension", + name: "increaseFlowRateAllowance", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { name: "version", internalType: "uint8", type: "uint8", indexed: false }, + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "flowOperator", internalType: "address", type: "address" }, + { name: "permissionsToAdd", internalType: "uint8", type: "uint8" }, + { name: "addedFlowRateAllowance", internalType: "int96", type: "int96" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "Initialized", + name: "increaseFlowRateAllowanceWithPermissions", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "CFA_HOOK_GAS_LIMIT", - outputs: [{ name: "", internalType: "uint64", type: "uint64" }], + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + ], + name: "isPatricianPeriod", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "DEFAULT_MINIMUM_DEPOSIT", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "isPatricianPeriodNow", + outputs: [ + { + name: "isCurrentlyPatricianPeriod", + internalType: "bool", + type: "bool", + }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + ], }, { stateMutability: "view", type: "function", inputs: [], - name: "MAXIMUM_DEPOSIT", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "MAXIMUM_FLOW_RATE", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + inputs: [ + { + name: "token", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + { name: "time", internalType: "uint256", type: "uint256" }, + ], + name: "realtimeBalanceOf", + outputs: [ + { name: "dynamicBalance", internalType: "int256", type: "int256" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + ], }, { stateMutability: "pure", @@ -1459,16 +1599,9 @@ export const constantFlowAgreementV1ABI = [ { name: "existingPermissions", internalType: "uint8", type: "uint8" }, { name: "permissionDelta", internalType: "uint8", type: "uint8" }, ], - name: "addPermissions", + name: "removePermissions", outputs: [{ name: "", internalType: "uint8", type: "uint8" }], }, - { - stateMutability: "pure", - type: "function", - inputs: [], - name: "agreementType", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], - }, { stateMutability: "nonpayable", type: "function", @@ -1481,14 +1614,14 @@ export const constantFlowAgreementV1ABI = [ { name: "flowOperator", internalType: "address", type: "address" }, { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "authorizeFlowOperatorWithFullControl", + name: "revokeFlowOperatorWithFullControl", outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "nonpayable", type: "function", - inputs: [], - name: "castrate", + inputs: [{ name: "newAddress", internalType: "address", type: "address" }], + name: "updateCode", outputs: [], }, { @@ -1504,7 +1637,7 @@ export const constantFlowAgreementV1ABI = [ { name: "flowRate", internalType: "int96", type: "int96" }, { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "createFlow", + name: "updateFlow", outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { @@ -1521,7 +1654,7 @@ export const constantFlowAgreementV1ABI = [ { name: "flowRate", internalType: "int96", type: "int96" }, { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "createFlowByOperator", + name: "updateFlowByOperator", outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { @@ -1534,944 +1667,1007 @@ export const constantFlowAgreementV1ABI = [ type: "address", }, { name: "flowOperator", internalType: "address", type: "address" }, - { - name: "subtractedFlowRateAllowance", - internalType: "int96", - type: "int96", - }, + { name: "permissions", internalType: "uint8", type: "uint8" }, + { name: "flowRateAllowance", internalType: "int96", type: "int96" }, { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "decreaseFlowRateAllowance", + name: "updateFlowOperatorPermissions", outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, +] as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x19ba78B9cDB05A877718841c574325fdB53601bb) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) + */ +export const constantFlowAgreementV1Address = { + 1: "0x2844c1BBdA121E9E43105630b9C8310e5c72744b", + 5: "0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8", + 10: "0x204C6f131bb7F258b2Ea1593f5309911d8E458eD", + 56: "0x49c38108870e74Cb9420C0991a85D3edd6363F75", + 100: "0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D", + 137: "0x6EeE6060f715257b970700bc2656De21dEdF074C", + 420: "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", + 1442: "0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee", + 8453: "0x19ba78B9cDB05A877718841c574325fdB53601bb", + 42161: "0x731FdBB12944973B500518aea61942381d7e240D", + 42220: "0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad", + 43113: "0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A", + 43114: "0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58", + 80001: "0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873", + 84531: "0x4C476F2Fb27272680F2f6f2592E94d9e704691bC", + 421613: "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", + 11155111: "0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef", +} as const; + +/** + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x19ba78B9cDB05A877718841c574325fdB53601bb) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) + */ +export const constantFlowAgreementV1Config = { + address: constantFlowAgreementV1Address, + abi: constantFlowAgreementV1ABI, +} as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// ERC20 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const erc20ABI = [ + { + type: "event", + inputs: [ + { name: "owner", type: "address", indexed: true }, + { name: "spender", type: "address", indexed: true }, + { name: "value", type: "uint256", indexed: false }, + ], + name: "Approval", + }, + { + type: "event", + inputs: [ + { name: "from", type: "address", indexed: true }, + { name: "to", type: "address", indexed: true }, + { name: "value", type: "uint256", indexed: false }, + ], + name: "Transfer", + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "owner", type: "address" }, + { name: "spender", type: "address" }, + ], + name: "allowance", + outputs: [{ type: "uint256" }], + }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowOperator", internalType: "address", type: "address" }, - { name: "permissionsToRemove", internalType: "uint8", type: "uint8" }, - { - name: "subtractedFlowRateAllowance", - internalType: "int96", - type: "int96", - }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "spender", type: "address" }, + { name: "amount", type: "uint256" }, ], - name: "decreaseFlowRateAllowanceWithPermissions", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "approve", + outputs: [{ type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "account", type: "address" }], + name: "balanceOf", + outputs: [{ type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "decimals", + outputs: [{ type: "uint8" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "name", + outputs: [{ type: "string" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "symbol", + outputs: [{ type: "string" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "totalSupply", + outputs: [{ type: "uint256" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "recipient", type: "address" }, + { name: "amount", type: "uint256" }, + ], + name: "transfer", + outputs: [{ type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "sender", type: "address" }, + { name: "recipient", type: "address" }, + { name: "amount", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "spender", type: "address" }, + { name: "addedValue", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "spender", type: "address" }, + { name: "subtractedValue", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ type: "bool" }], + }, +] as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// ERC721 +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const erc721ABI = [ + { + type: "event", + inputs: [ + { name: "owner", type: "address", indexed: true }, + { name: "spender", type: "address", indexed: true }, + { name: "tokenId", type: "uint256", indexed: true }, + ], + name: "Approval", + }, + { + type: "event", + inputs: [ + { name: "owner", type: "address", indexed: true }, + { name: "operator", type: "address", indexed: true }, + { name: "approved", type: "bool", indexed: false }, + ], + name: "ApprovalForAll", + }, + { + type: "event", + inputs: [ + { name: "from", type: "address", indexed: true }, + { name: "to", type: "address", indexed: true }, + { name: "tokenId", type: "uint256", indexed: true }, ], - name: "deleteFlow", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "Transfer", }, { - stateMutability: "nonpayable", + stateMutability: "payable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "spender", type: "address" }, + { name: "tokenId", type: "uint256" }, ], - name: "deleteFlowByOperator", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "approve", + outputs: [], }, { stateMutability: "view", type: "function", - inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "account", internalType: "address", type: "address" }, - ], - name: "getAccountFlowInfo", - outputs: [ - { name: "timestamp", internalType: "uint256", type: "uint256" }, - { name: "flowRate", internalType: "int96", type: "int96" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, - ], + inputs: [{ name: "account", type: "address" }], + name: "balanceOf", + outputs: [{ type: "uint256" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "getCodeAddress", - outputs: [ - { name: "codeAddress", internalType: "address", type: "address" }, - ], + inputs: [{ name: "tokenId", type: "uint256" }], + name: "getApproved", + outputs: [{ type: "address" }], }, { stateMutability: "view", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowRate", internalType: "int96", type: "int96" }, + { name: "owner", type: "address" }, + { name: "operator", type: "address" }, ], - name: "getDepositRequiredForFlowRate", - outputs: [{ name: "deposit", internalType: "uint256", type: "uint256" }], + name: "isApprovedForAll", + outputs: [{ type: "bool" }], }, { stateMutability: "view", type: "function", - inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - ], - name: "getFlow", - outputs: [ - { name: "timestamp", internalType: "uint256", type: "uint256" }, - { name: "flowRate", internalType: "int96", type: "int96" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, - ], + inputs: [], + name: "name", + outputs: [{ type: "string" }], }, { stateMutability: "view", type: "function", + inputs: [{ name: "tokenId", type: "uint256" }], + name: "ownerOf", + outputs: [{ name: "owner", type: "address" }], + }, + { + stateMutability: "payable", + type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowId", internalType: "bytes32", type: "bytes32" }, - ], - name: "getFlowByID", - outputs: [ - { name: "timestamp", internalType: "uint256", type: "uint256" }, - { name: "flowRate", internalType: "int96", type: "int96" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + { name: "from", type: "address" }, + { name: "to", type: "address" }, + { name: "tokenId", type: "uint256" }, ], + name: "safeTransferFrom", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "sender", internalType: "address", type: "address" }, - { name: "flowOperator", internalType: "address", type: "address" }, - ], - name: "getFlowOperatorData", - outputs: [ - { name: "flowOperatorId", internalType: "bytes32", type: "bytes32" }, - { name: "permissions", internalType: "uint8", type: "uint8" }, - { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + { name: "from", type: "address" }, + { name: "to", type: "address" }, + { name: "id", type: "uint256" }, + { name: "data", type: "bytes" }, ], + name: "safeTransferFrom", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowOperatorId", internalType: "bytes32", type: "bytes32" }, - ], - name: "getFlowOperatorDataByID", - outputs: [ - { name: "permissions", internalType: "uint8", type: "uint8" }, - { name: "flowRateAllowance", internalType: "int96", type: "int96" }, + { name: "operator", type: "address" }, + { name: "approved", type: "bool" }, ], + name: "setApprovalForAll", + outputs: [], }, { stateMutability: "view", type: "function", - inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - ], - name: "getMaximumFlowRateFromDeposit", - outputs: [{ name: "flowRate", internalType: "int96", type: "int96" }], + inputs: [], + name: "symbol", + outputs: [{ type: "string" }], }, { stateMutability: "view", type: "function", - inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "account", internalType: "address", type: "address" }, - ], - name: "getNetFlow", - outputs: [{ name: "flowRate", internalType: "int96", type: "int96" }], + inputs: [{ name: "index", type: "uint256" }], + name: "tokenByIndex", + outputs: [{ type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowOperator", internalType: "address", type: "address" }, - { name: "addedFlowRateAllowance", internalType: "int96", type: "int96" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "owner", type: "address" }, + { name: "index", type: "uint256" }, ], - name: "increaseFlowRateAllowance", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "tokenByIndex", + outputs: [{ name: "tokenId", type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowOperator", internalType: "address", type: "address" }, - { name: "permissionsToAdd", internalType: "uint8", type: "uint8" }, - { name: "addedFlowRateAllowance", internalType: "int96", type: "int96" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, - ], - name: "increaseFlowRateAllowanceWithPermissions", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + inputs: [{ name: "tokenId", type: "uint256" }], + name: "tokenURI", + outputs: [{ type: "string" }], }, { stateMutability: "view", type: "function", + inputs: [], + name: "totalSupply", + outputs: [{ type: "uint256" }], + }, + { + stateMutability: "payable", + type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "account", internalType: "address", type: "address" }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "sender", type: "address" }, + { name: "recipient", type: "address" }, + { name: "tokenId", type: "uint256" }, ], - name: "isPatricianPeriod", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "transferFrom", + outputs: [], }, +] as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Native Asset Super Token +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const nativeAssetSuperTokenABI = [ { - stateMutability: "view", - type: "function", + type: "event", + anonymous: false, inputs: [ { - name: "token", - internalType: "contract ISuperfluidToken", + name: "account", + internalType: "address", type: "address", + indexed: true, }, - { name: "account", internalType: "address", type: "address" }, - ], - name: "isPatricianPeriodNow", - outputs: [ { - name: "isCurrentlyPatricianPeriod", - internalType: "bool", - type: "bool", - }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, - ], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "proxiableUUID", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + ], + name: "TokenDowngraded", }, { - stateMutability: "view", - type: "function", + type: "event", + anonymous: false, inputs: [ { - name: "token", - internalType: "contract ISuperfluidToken", + name: "account", + internalType: "address", type: "address", + indexed: true, + }, + { + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, }, - { name: "account", internalType: "address", type: "address" }, - { name: "time", internalType: "uint256", type: "uint256" }, - ], - name: "realtimeBalanceOf", - outputs: [ - { name: "dynamicBalance", internalType: "int256", type: "int256" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, ], + name: "TokenUpgraded", }, + { stateMutability: "payable", type: "fallback" }, { - stateMutability: "pure", + stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "existingPermissions", internalType: "uint8", type: "uint8" }, - { name: "permissionDelta", internalType: "uint8", type: "uint8" }, - ], - name: "removePermissions", - outputs: [{ name: "", internalType: "uint8", type: "uint8" }], + inputs: [{ name: "wad", internalType: "uint256", type: "uint256" }], + name: "downgradeToETH", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowOperator", internalType: "address", type: "address" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "initialAddress", internalType: "address", type: "address" }, ], - name: "revokeFlowOperatorWithFullControl", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "initializeProxy", + outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "payable", type: "function", - inputs: [{ name: "newAddress", internalType: "address", type: "address" }], - name: "updateCode", + inputs: [], + name: "upgradeByETH", outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "payable", type: "function", - inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "flowRate", internalType: "int96", type: "int96" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, - ], - name: "updateFlow", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + inputs: [{ name: "to", internalType: "address", type: "address" }], + name: "upgradeByETHTo", + outputs: [], }, + { stateMutability: "payable", type: "receive" }, +] as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// Pure Super Token +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +export const pureSuperTokenABI = [ + { stateMutability: "payable", type: "fallback" }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "flowRate", internalType: "int96", type: "int96" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "name", internalType: "string", type: "string" }, + { name: "symbol", internalType: "string", type: "string" }, + { name: "initialSupply", internalType: "uint256", type: "uint256" }, ], - name: "updateFlowByOperator", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "initialize", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "token", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "flowOperator", internalType: "address", type: "address" }, - { name: "permissions", internalType: "uint8", type: "uint8" }, - { name: "flowRateAllowance", internalType: "int96", type: "int96" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "initialAddress", internalType: "address", type: "address" }, ], - name: "updateFlowOperatorPermissions", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "initializeProxy", + outputs: [], }, + { stateMutability: "payable", type: "receive" }, ] as const; -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) - */ -export const constantFlowAgreementV1Address = { - 1: "0x2844c1BBdA121E9E43105630b9C8310e5c72744b", - 5: "0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8", - 10: "0x204C6f131bb7F258b2Ea1593f5309911d8E458eD", - 56: "0x49c38108870e74Cb9420C0991a85D3edd6363F75", - 100: "0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D", - 137: "0x6EeE6060f715257b970700bc2656De21dEdF074C", - 420: "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", - 1442: "0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee", - 8453: "0x19ba78B9cDB05A877718841c574325fdB53601bb", - 42161: "0x731FdBB12944973B500518aea61942381d7e240D", - 42220: "0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad", - 43113: "0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A", - 43114: "0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58", - 80001: "0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873", - 84531: "0x4C476F2Fb27272680F2f6f2592E94d9e704691bC", - 421613: "0xff48668fa670A85e55A7a822b352d5ccF3E7b18C", - 11155111: "0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef", -} as const; - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x2844c1BBdA121E9E43105630b9C8310e5c72744b) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xEd6BcbF6907D4feEEe8a8875543249bEa9D308E8) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x204C6f131bb7F258b2Ea1593f5309911d8E458eD) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x49c38108870e74Cb9420C0991a85D3edd6363F75) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xEbdA4ceF883A7B12c4E669Ebc58927FBa8447C7D) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x6EeE6060f715257b970700bc2656De21dEdF074C) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0x1EAa5ceA064aab2692AF257FB31f5291fdA3Cdee) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x731FdBB12944973B500518aea61942381d7e240D) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x9d369e78e1a682cE0F8d9aD849BeA4FE1c3bD3Ad) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x16843ac25Ccc58Aa7960ba05f61cBB17b36b130A) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x6946c5B38Ffea373b0a2340b4AEf0De8F6782e58) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x49e565Ed1bdc17F3d220f72DF0857C26FA83F873) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x4C476F2Fb27272680F2f6f2592E94d9e704691bC) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xff48668fa670A85e55A7a822b352d5ccF3E7b18C) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x6836F23d6171D74Ef62FcF776655aBcD2bcd62Ef) - */ -export const constantFlowAgreementV1Config = { - address: constantFlowAgreementV1Address, - abi: constantFlowAgreementV1ABI, -} as const; - ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// SuperfluidHost +// Super Token ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) - */ -export const superfluidHostABI = [ +export const superTokenABI = [ { stateMutability: "nonpayable", type: "constructor", inputs: [ - { name: "nonUpgradable", internalType: "bool", type: "bool" }, - { name: "appWhiteListingEnabled", internalType: "bool", type: "bool" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "constantOutflowNFT", + internalType: "contract IConstantOutflowNFT", + type: "address", + }, + { + name: "constantInflowNFT", + internalType: "contract IConstantInflowNFT", + type: "address", + }, ], }, - { - type: "error", - inputs: [{ name: "_code", internalType: "uint256", type: "uint256" }], - name: "APP_RULE", - }, - { type: "error", inputs: [], name: "HOST_AGREEMENT_ALREADY_REGISTERED" }, - { type: "error", inputs: [], name: "HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION" }, - { type: "error", inputs: [], name: "HOST_AGREEMENT_IS_NOT_REGISTERED" }, - { - type: "error", - inputs: [], - name: "HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS", - }, + { type: "error", inputs: [], name: "SF_TOKEN_AGREEMENT_ALREADY_EXISTS" }, + { type: "error", inputs: [], name: "SF_TOKEN_AGREEMENT_DOES_NOT_EXIST" }, + { type: "error", inputs: [], name: "SF_TOKEN_BURN_INSUFFICIENT_BALANCE" }, + { type: "error", inputs: [], name: "SF_TOKEN_MOVE_INSUFFICIENT_BALANCE" }, + { type: "error", inputs: [], name: "SF_TOKEN_ONLY_HOST" }, + { type: "error", inputs: [], name: "SF_TOKEN_ONLY_LISTED_AGREEMENT" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_APPROVE_FROM_ZERO_ADDRESS" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_APPROVE_TO_ZERO_ADDRESS" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_BURN_FROM_ZERO_ADDRESS" }, { type: "error", inputs: [], - name: "HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS", + name: "SUPER_TOKEN_CALLER_IS_NOT_OPERATOR_FOR_HOLDER", }, { type: "error", inputs: [], - name: "HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE", + name: "SUPER_TOKEN_INFLATIONARY_DEFLATIONARY_NOT_SUPPORTED", }, - { type: "error", inputs: [], name: "HOST_INVALID_CONFIG_WORD" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_MINT_TO_ZERO_ADDRESS" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_NFT_PROXY_ADDRESS_CHANGED" }, { type: "error", inputs: [], - name: "HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY", + name: "SUPER_TOKEN_NOT_ERC777_TOKENS_RECIPIENT", }, - { type: "error", inputs: [], name: "HOST_MAX_256_AGREEMENTS" }, - { type: "error", inputs: [], name: "HOST_MUST_BE_CONTRACT" }, - { type: "error", inputs: [], name: "HOST_NEED_MORE_GAS" }, - { type: "error", inputs: [], name: "HOST_NON_UPGRADEABLE" }, - { type: "error", inputs: [], name: "HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX" }, - { type: "error", inputs: [], name: "HOST_NOT_A_SUPER_APP" }, - { type: "error", inputs: [], name: "HOST_NO_APP_REGISTRATION_PERMISSIONS" }, - { type: "error", inputs: [], name: "HOST_ONLY_GOVERNANCE" }, - { type: "error", inputs: [], name: "HOST_ONLY_LISTED_AGREEMENT" }, - { type: "error", inputs: [], name: "HOST_RECEIVER_IS_NOT_SUPER_APP" }, - { type: "error", inputs: [], name: "HOST_SENDER_IS_NOT_SUPER_APP" }, - { type: "error", inputs: [], name: "HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL" }, - { type: "error", inputs: [], name: "HOST_SUPER_APP_ALREADY_REGISTERED" }, - { type: "error", inputs: [], name: "HOST_SUPER_APP_IS_JAILED" }, - { type: "error", inputs: [], name: "HOST_UNAUTHORIZED_SUPER_APP_FACTORY" }, - { type: "error", inputs: [], name: "HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_NO_UNDERLYING_TOKEN" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_ONLY_GOV_OWNER" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_ONLY_HOST" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_ONLY_SELF" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_TRANSFER_FROM_ZERO_ADDRESS" }, + { type: "error", inputs: [], name: "SUPER_TOKEN_TRANSFER_TO_ZERO_ADDRESS" }, { type: "event", anonymous: false, inputs: [ { - name: "agreementType", - internalType: "bytes32", - type: "bytes32", - indexed: false, - }, - { - name: "code", + name: "agreementClass", internalType: "address", type: "address", + indexed: true, + }, + { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, + { + name: "data", + internalType: "bytes32[]", + type: "bytes32[]", indexed: false, }, ], - name: "AgreementClassRegistered", + name: "AgreementCreated", }, { type: "event", anonymous: false, inputs: [ { - name: "agreementType", - internalType: "bytes32", - type: "bytes32", - indexed: false, + name: "agreementClass", + internalType: "address", + type: "address", + indexed: true, }, + { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, { - name: "code", + name: "penaltyAccount", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "rewardAccount", internalType: "address", type: "address", + indexed: true, + }, + { + name: "rewardAmount", + internalType: "uint256", + type: "uint256", indexed: false, }, ], - name: "AgreementClassUpdated", + name: "AgreementLiquidated", }, { type: "event", anonymous: false, inputs: [ { - name: "app", - internalType: "contract ISuperApp", + name: "liquidatorAccount", + internalType: "address", + type: "address", + indexed: false, + }, + { + name: "agreementClass", + internalType: "address", + type: "address", + indexed: true, + }, + { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, + { + name: "penaltyAccount", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "bondAccount", + internalType: "address", type: "address", indexed: true, }, + { + name: "rewardAmount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { + name: "bailoutAmount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "AppRegistered", + name: "AgreementLiquidatedBy", }, { type: "event", anonymous: false, inputs: [ { - name: "uuid", - internalType: "bytes32", - type: "bytes32", - indexed: false, + name: "agreementClass", + internalType: "address", + type: "address", + indexed: true, }, + { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, { - name: "codeAddress", + name: "liquidatorAccount", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "targetAccount", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "rewardAmountReceiver", internalType: "address", type: "address", indexed: false, }, + { + name: "rewardAmount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { + name: "targetAccountBalanceDelta", + internalType: "int256", + type: "int256", + indexed: false, + }, + { + name: "liquidationTypeData", + internalType: "bytes", + type: "bytes", + indexed: false, + }, ], - name: "CodeUpdated", + name: "AgreementLiquidatedV2", }, { type: "event", anonymous: false, inputs: [ { - name: "oldGov", - internalType: "contract ISuperfluidGovernance", + name: "agreementClass", + internalType: "address", type: "address", - indexed: false, + indexed: true, }, { - name: "newGov", - internalType: "contract ISuperfluidGovernance", + name: "account", + internalType: "address", type: "address", + indexed: true, + }, + { + name: "slotId", + internalType: "uint256", + type: "uint256", indexed: false, }, ], - name: "GovernanceReplaced", + name: "AgreementStateUpdated", }, { type: "event", anonymous: false, inputs: [ - { name: "version", internalType: "uint8", type: "uint8", indexed: false }, + { + name: "agreementClass", + internalType: "address", + type: "address", + indexed: true, + }, + { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, ], - name: "Initialized", + name: "AgreementTerminated", }, { type: "event", anonymous: false, inputs: [ { - name: "app", - internalType: "contract ISuperApp", + name: "agreementClass", + internalType: "address", type: "address", indexed: true, }, + { name: "id", internalType: "bytes32", type: "bytes32", indexed: false }, { - name: "reason", - internalType: "uint256", - type: "uint256", + name: "data", + internalType: "bytes32[]", + type: "bytes32[]", indexed: false, }, ], - name: "Jail", + name: "AgreementUpdated", }, { type: "event", anonymous: false, inputs: [ { - name: "newFactory", - internalType: "contract ISuperTokenFactory", + name: "owner", + internalType: "address", type: "address", + indexed: true, + }, + { + name: "spender", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "value", + internalType: "uint256", + type: "uint256", indexed: false, }, ], - name: "SuperTokenFactoryUpdated", + name: "Approval", }, { type: "event", anonymous: false, inputs: [ { - name: "token", - internalType: "contract ISuperToken", + name: "operator", + internalType: "address", type: "address", indexed: true, }, { - name: "code", + name: "tokenHolder", internalType: "address", type: "address", - indexed: false, + indexed: true, }, ], - name: "SuperTokenLogicUpdated", - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "APP_WHITE_LISTING_ENABLED", - outputs: [{ name: "", internalType: "bool", type: "bool" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "CALLBACK_GAS_LIMIT", - outputs: [{ name: "", internalType: "uint64", type: "uint64" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "MAX_APP_CALLBACK_LEVEL", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "MAX_NUM_AGREEMENTS", - outputs: [{ name: "", internalType: "uint32", type: "uint32" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "NON_UPGRADABLE_DEPLOYMENT", - outputs: [{ name: "", internalType: "bool", type: "bool" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [ - { name: "bitmap", internalType: "uint256", type: "uint256" }, - { name: "agreementType", internalType: "bytes32", type: "bytes32" }, - ], - name: "addToAgreementClassesBitmap", - outputs: [{ name: "newBitmap", internalType: "uint256", type: "uint256" }], + name: "AuthorizedOperator", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ { - name: "targetApp", - internalType: "contract ISuperApp", + name: "bailoutAccount", + internalType: "address", type: "address", + indexed: true, + }, + { + name: "bailoutAmount", + internalType: "uint256", + type: "uint256", + indexed: false, }, ], - name: "allowCompositeApp", - outputs: [], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [ - { name: "ctx", internalType: "bytes", type: "bytes" }, - { name: "appCreditUsedDelta", internalType: "int256", type: "int256" }, - ], - name: "appCallbackPop", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "Bailout", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "ctx", internalType: "bytes", type: "bytes" }, - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "appCreditGranted", internalType: "uint256", type: "uint256" }, - { name: "appCreditUsed", internalType: "int256", type: "int256" }, { - name: "appCreditToken", - internalType: "contract ISuperfluidToken", + name: "operator", + internalType: "address", type: "address", + indexed: true, + }, + { name: "from", internalType: "address", type: "address", indexed: true }, + { + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { name: "data", internalType: "bytes", type: "bytes", indexed: false }, + { + name: "operatorData", + internalType: "bytes", + type: "bytes", + indexed: false, }, ], - name: "appCallbackPush", - outputs: [{ name: "appCtx", internalType: "bytes", type: "bytes" }], + name: "Burned", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ { - name: "operations", - internalType: "struct ISuperfluid.Operation[]", - type: "tuple[]", - components: [ - { name: "operationType", internalType: "uint32", type: "uint32" }, - { name: "target", internalType: "address", type: "address" }, - { name: "data", internalType: "bytes", type: "bytes" }, - ], + name: "uuid", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "codeAddress", + internalType: "address", + type: "address", + indexed: false, }, ], - name: "batchCall", - outputs: [], + name: "CodeUpdated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ { - name: "agreementClass", - internalType: "contract ISuperAgreement", + name: "constantInflowNFT", + internalType: "contract IConstantInflowNFT", type: "address", + indexed: true, }, - { name: "callData", internalType: "bytes", type: "bytes" }, - { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "callAgreement", - outputs: [{ name: "returnedData", internalType: "bytes", type: "bytes" }], + name: "ConstantInflowNFTCreated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ { - name: "agreementClass", - internalType: "contract ISuperAgreement", + name: "constantOutflowNFT", + internalType: "contract IConstantOutflowNFT", type: "address", + indexed: true, }, - { name: "callData", internalType: "bytes", type: "bytes" }, - { name: "userData", internalType: "bytes", type: "bytes" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, - ], - name: "callAgreementWithContext", - outputs: [ - { name: "newCtx", internalType: "bytes", type: "bytes" }, - { name: "returnedData", internalType: "bytes", type: "bytes" }, ], + name: "ConstantOutflowNFTCreated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "version", internalType: "uint8", type: "uint8", indexed: false }, ], - name: "callAppAction", - outputs: [{ name: "returnedData", internalType: "bytes", type: "bytes" }], + name: "Initialized", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "callData", internalType: "bytes", type: "bytes" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { + name: "operator", + internalType: "address", + type: "address", + indexed: true, + }, + { name: "to", internalType: "address", type: "address", indexed: true }, + { + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { name: "data", internalType: "bytes", type: "bytes", indexed: false }, + { + name: "operatorData", + internalType: "bytes", + type: "bytes", + indexed: false, + }, ], - name: "callAppActionWithContext", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "Minted", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "callData", internalType: "bytes", type: "bytes" }, - { name: "isTermination", internalType: "bool", type: "bool" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { + name: "operator", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "tokenHolder", + internalType: "address", + type: "address", + indexed: true, + }, ], - name: "callAppAfterCallback", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "RevokedOperator", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "callData", internalType: "bytes", type: "bytes" }, - { name: "isTermination", internalType: "bool", type: "bool" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { + name: "operator", + internalType: "address", + type: "address", + indexed: true, + }, + { name: "from", internalType: "address", type: "address", indexed: true }, + { name: "to", internalType: "address", type: "address", indexed: true }, + { + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { name: "data", internalType: "bytes", type: "bytes", indexed: false }, + { + name: "operatorData", + internalType: "bytes", + type: "bytes", + indexed: false, + }, ], - name: "callAppBeforeCallback", - outputs: [{ name: "cbdata", internalType: "bytes", type: "bytes" }], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [], - name: "castrate", - outputs: [], + name: "Sent", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "ctx", internalType: "bytes", type: "bytes" }, - { name: "appCreditUsedMore", internalType: "int256", type: "int256" }, + { + name: "account", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "ctxUseCredit", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "TokenDowngraded", }, { - stateMutability: "pure", - type: "function", - inputs: [{ name: "ctx", internalType: "bytes", type: "bytes" }], - name: "decodeCtx", - outputs: [ - { - name: "context", - internalType: "struct ISuperfluid.Context", - type: "tuple", - components: [ - { name: "appCallbackLevel", internalType: "uint8", type: "uint8" }, - { name: "callType", internalType: "uint8", type: "uint8" }, - { name: "timestamp", internalType: "uint256", type: "uint256" }, - { name: "msgSender", internalType: "address", type: "address" }, - { name: "agreementSelector", internalType: "bytes4", type: "bytes4" }, - { name: "userData", internalType: "bytes", type: "bytes" }, - { - name: "appCreditGranted", - internalType: "uint256", - type: "uint256", - }, - { - name: "appCreditWantedDeprecated", - internalType: "uint256", - type: "uint256", - }, - { name: "appCreditUsed", internalType: "int256", type: "int256" }, - { name: "appAddress", internalType: "address", type: "address" }, - { - name: "appCreditToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - ], + type: "event", + anonymous: false, + inputs: [ + { + name: "account", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "amount", + internalType: "uint256", + type: "uint256", + indexed: false, }, ], + name: "TokenUpgraded", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ + { name: "from", internalType: "address", type: "address", indexed: true }, + { name: "to", internalType: "address", type: "address", indexed: true }, { - name: "operations", - internalType: "struct ISuperfluid.Operation[]", - type: "tuple[]", - components: [ - { name: "operationType", internalType: "uint32", type: "uint32" }, - { name: "target", internalType: "address", type: "address" }, - { name: "data", internalType: "bytes", type: "bytes" }, - ], + name: "value", + internalType: "uint256", + type: "uint256", + indexed: false, }, ], - name: "forwardBatchCall", - outputs: [], + name: "Transfer", }, { stateMutability: "view", type: "function", - inputs: [ - { name: "agreementType", internalType: "bytes32", type: "bytes32" }, - ], - name: "getAgreementClass", + inputs: [], + name: "CONSTANT_INFLOW_NFT", outputs: [ { - name: "agreementClass", - internalType: "contract ISuperAgreement", + name: "", + internalType: "contract IConstantInflowNFT", type: "address", }, ], @@ -2479,1164 +2675,915 @@ export const superfluidHostABI = [ { stateMutability: "view", type: "function", - inputs: [ - { name: "appAddr", internalType: "contract ISuperApp", type: "address" }, + inputs: [], + name: "CONSTANT_OUTFLOW_NFT", + outputs: [ + { + name: "", + internalType: "contract IConstantOutflowNFT", + type: "address", + }, ], - name: "getAppCallbackLevel", - outputs: [{ name: "", internalType: "uint8", type: "uint8" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "account", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, ], - name: "getAppManifest", - outputs: [ - { name: "isSuperApp", internalType: "bool", type: "bool" }, - { name: "isJailed", internalType: "bool", type: "bool" }, - { name: "noopMask", internalType: "uint256", type: "uint256" }, + name: "allowance", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "spender", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], + name: "approve", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "operator", internalType: "address", type: "address" }], + name: "authorizeOperator", + outputs: [], }, { stateMutability: "view", type: "function", - inputs: [], - name: "getCodeAddress", - outputs: [ - { name: "codeAddress", internalType: "address", type: "address" }, + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "balanceOf", + outputs: [{ name: "balance", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], + name: "burn", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [], - name: "getGovernance", - outputs: [ - { - name: "", - internalType: "contract ISuperfluidGovernance", - type: "address", - }, + name: "castrate", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "id", internalType: "bytes32", type: "bytes32" }, + { name: "data", internalType: "bytes32[]", type: "bytes32[]" }, ], + name: "createAgreement", + outputs: [], }, { - stateMutability: "view", + stateMutability: "pure", type: "function", inputs: [], - name: "getNow", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + name: "decimals", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", - inputs: [], - name: "getSuperTokenFactory", - outputs: [ - { - name: "factory", - internalType: "contract ISuperTokenFactory", - type: "address", - }, + inputs: [ + { name: "spender", internalType: "address", type: "address" }, + { name: "subtractedValue", internalType: "uint256", type: "uint256" }, ], + name: "decreaseAllowance", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", inputs: [], - name: "getSuperTokenFactoryLogic", - outputs: [{ name: "logic", internalType: "address", type: "address" }], + name: "defaultOperators", + outputs: [{ name: "", internalType: "address[]", type: "address[]" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], + name: "downgrade", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "gov", - internalType: "contract ISuperfluidGovernance", - type: "address", - }, + { name: "to", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "initialize", + name: "downgradeTo", outputs: [], }, { stateMutability: "view", type: "function", - inputs: [ + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "getAccountActiveAgreements", + outputs: [ { - name: "agreementClass", - internalType: "contract ISuperAgreement", - type: "address", + name: "", + internalType: "contract ISuperAgreement[]", + type: "address[]", }, ], - name: "isAgreementClassListed", - outputs: [{ name: "yes", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + { name: "agreementClass", internalType: "address", type: "address" }, + { name: "id", internalType: "bytes32", type: "bytes32" }, + { name: "dataLength", internalType: "uint256", type: "uint256" }, ], - name: "isAgreementTypeListed", - outputs: [{ name: "yes", internalType: "bool", type: "bool" }], + name: "getAgreementData", + outputs: [{ name: "data", internalType: "bytes32[]", type: "bytes32[]" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "agreementClass", internalType: "address", type: "address" }, + { name: "account", internalType: "address", type: "address" }, + { name: "slotId", internalType: "uint256", type: "uint256" }, + { name: "dataLength", internalType: "uint256", type: "uint256" }, + ], + name: "getAgreementStateSlot", + outputs: [ + { name: "slotData", internalType: "bytes32[]", type: "bytes32[]" }, ], - name: "isApp", - outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", - inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, + inputs: [], + name: "getCodeAddress", + outputs: [ + { name: "codeAddress", internalType: "address", type: "address" }, ], - name: "isAppJailed", - outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", - inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { - name: "targetApp", - internalType: "contract ISuperApp", - type: "address", - }, - ], - name: "isCompositeAppAllowed", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "getHost", + outputs: [{ name: "host", internalType: "address", type: "address" }], }, { stateMutability: "view", type: "function", - inputs: [{ name: "ctx", internalType: "bytes", type: "bytes" }], - name: "isCtxValid", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "getUnderlyingToken", + outputs: [{ name: "", internalType: "address", type: "address" }], }, { - stateMutability: "view", + stateMutability: "pure", type: "function", - inputs: [{ name: "forwarder", internalType: "address", type: "address" }], - name: "isTrustedForwarder", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "granularity", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "ctx", internalType: "bytes", type: "bytes" }, - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "reason", internalType: "uint256", type: "uint256" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "addedValue", internalType: "uint256", type: "uint256" }, ], - name: "jailApp", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "increaseAllowance", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", - inputs: [{ name: "bitmap", internalType: "uint256", type: "uint256" }], - name: "mapAgreementClasses", - outputs: [ + inputs: [ { - name: "agreementClasses", - internalType: "contract ISuperAgreement[]", - type: "address[]", + name: "underlyingToken", + internalType: "contract IERC20", + type: "address", }, - ], - }, - { - stateMutability: "pure", - type: "function", - inputs: [], - name: "proxiableUUID", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + { name: "underlyingDecimals", internalType: "uint8", type: "uint8" }, + { name: "n", internalType: "string", type: "string" }, + { name: "s", internalType: "string", type: "string" }, + ], + name: "initialize", + outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { - name: "agreementClassLogic", - internalType: "contract ISuperAgreement", - type: "address", - }, + { name: "account", internalType: "address", type: "address" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, ], - name: "registerAgreementClass", - outputs: [], + name: "isAccountCritical", + outputs: [{ name: "isCritical", internalType: "bool", type: "bool" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "configWord", internalType: "uint256", type: "uint256" }], - name: "registerApp", - outputs: [], + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "isAccountCriticalNow", + outputs: [{ name: "isCritical", internalType: "bool", type: "bool" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { name: "app", internalType: "contract ISuperApp", type: "address" }, - { name: "configWord", internalType: "uint256", type: "uint256" }, + { name: "account", internalType: "address", type: "address" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, ], - name: "registerAppByFactory", - outputs: [], + name: "isAccountSolvent", + outputs: [{ name: "isSolvent", internalType: "bool", type: "bool" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "configWord", internalType: "uint256", type: "uint256" }, - { name: "registrationKey", internalType: "string", type: "string" }, - ], - name: "registerAppWithKey", - outputs: [], + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "isAccountSolventNow", + outputs: [{ name: "isSolvent", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "bitmap", internalType: "uint256", type: "uint256" }, - { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + { name: "operator", internalType: "address", type: "address" }, + { name: "tokenHolder", internalType: "address", type: "address" }, ], - name: "removeFromAgreementClassesBitmap", - outputs: [{ name: "newBitmap", internalType: "uint256", type: "uint256" }], + name: "isOperatorFor", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ + { name: "id", internalType: "bytes32", type: "bytes32" }, + { name: "liquidationTypeData", internalType: "bytes", type: "bytes" }, + { name: "liquidatorAccount", internalType: "address", type: "address" }, + { name: "useDefaultRewardAccount", internalType: "bool", type: "bool" }, + { name: "targetAccount", internalType: "address", type: "address" }, + { name: "rewardAmount", internalType: "uint256", type: "uint256" }, { - name: "newGov", - internalType: "contract ISuperfluidGovernance", - type: "address", + name: "targetAccountBalanceDelta", + internalType: "int256", + type: "int256", }, ], - name: "replaceGovernance", + name: "makeLiquidationPayoutsV2", outputs: [], }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "name", + outputs: [{ name: "", internalType: "string", type: "string" }], + }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "agreementClassLogic", - internalType: "contract ISuperAgreement", - type: "address", - }, + { name: "account", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "updateAgreementClass", + name: "operationApprove", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "newAddress", internalType: "address", type: "address" }], - name: "updateCode", + inputs: [ + { name: "account", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "subtractedValue", internalType: "uint256", type: "uint256" }, + ], + name: "operationDecreaseAllowance", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "newFactory", - internalType: "contract ISuperTokenFactory", - type: "address", - }, + { name: "account", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "updateSuperTokenFactory", + name: "operationDowngrade", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "newLogicOverride", internalType: "address", type: "address" }, + { name: "account", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "addedValue", internalType: "uint256", type: "uint256" }, ], - name: "updateSuperTokenLogic", + name: "operationIncreaseAllowance", outputs: [], }, { - stateMutability: "pure", + stateMutability: "nonpayable", type: "function", - inputs: [], - name: "versionRecipient", - outputs: [{ name: "", internalType: "string", type: "string" }], - }, -] as const; - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) - */ -export const superfluidHostAddress = { - 1: "0x4E583d9390082B65Bef884b629DFA426114CED6d", - 5: "0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9", - 10: "0x567c4B141ED61923967cA25Ef4906C8781069a10", - 56: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E", - 100: "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7", - 137: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7", - 420: "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", - 1442: "0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704", - 8453: "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74", - 42161: "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192", - 42220: "0xA4Ff07cF81C02CFD356184879D953970cA957585", - 43113: "0x85Fe79b998509B77BF10A8BD4001D58475D29386", - 43114: "0x60377C7016E4cdB03C87EF474896C11cB560752C", - 80001: "0xEB796bdb90fFA0f28255275e16936D25d3418603", - 84531: "0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6", - 421613: "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", - 11155111: "0x109412E3C84f0539b43d39dB691B08c90f58dC7c", -} as const; - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) - */ -export const superfluidHostConfig = { - address: superfluidHostAddress, - abi: superfluidHostABI, -} as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// SuperfluidGovernance -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x3a648764a6d66440ca096343937c711a7ac1b1e9) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xee07D9fce4Cf2a891BC979E9d365929506C2982f) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xF74390BabA510ec2fE196c2e02B037380d7a6F12) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xbe20Bac0DCF6f01834F51CCDab2dD72707C6e9b6) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136) - */ -export const superfluidGovernanceABI = [ - { type: "error", inputs: [], name: "SF_GOV_II_ONLY_OWNER" }, - { - type: "error", - inputs: [], - name: "SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD", - }, - { type: "error", inputs: [], name: "SF_GOV_MUST_BE_CONTRACT" }, - { - type: "event", - anonymous: false, inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "factory", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "authorized", - internalType: "bool", - type: "bool", - indexed: false, - }, + { name: "spender", internalType: "address", type: "address" }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "AppFactoryAuthorizationChanged", + name: "operationSend", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "deployer", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "appRegistrationKey", - internalType: "string", - type: "string", - indexed: false, - }, - { - name: "expirationTs", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + { name: "account", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "AppRegistrationKeyChanged", + name: "operationTransferFrom", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - indexed: true, - }, - { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, - { - name: "liquidationPeriod", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + { name: "account", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "CFAv1LiquidationPeriodChanged", + name: "operationUpgrade", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "uuid", - internalType: "bytes32", - type: "bytes32", - indexed: false, - }, - { - name: "codeAddress", - internalType: "address", - type: "address", - indexed: false, - }, + { name: "account", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "operatorData", internalType: "bytes", type: "bytes" }, ], - name: "CodeUpdated", + name: "operatorBurn", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - indexed: true, - }, - { name: "key", internalType: "bytes32", type: "bytes32", indexed: false }, - { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, - { - name: "value", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + { name: "sender", internalType: "address", type: "address" }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "operatorData", internalType: "bytes", type: "bytes" }, ], - name: "ConfigChanged", + name: "operatorSend", + outputs: [], }, { - type: "event", - anonymous: false, - inputs: [ - { name: "version", internalType: "uint8", type: "uint8", indexed: false }, - ], - name: "Initialized", + stateMutability: "pure", + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ - { - name: "previousOwner", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "newOwner", - internalType: "address", - type: "address", - indexed: true, - }, + { name: "account", internalType: "address", type: "address" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + ], + name: "realtimeBalanceOf", + outputs: [ + { name: "availableBalance", internalType: "int256", type: "int256" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, ], - name: "OwnershipTransferred", }, { - type: "event", - anonymous: false, - inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - indexed: true, - }, - { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, - { - name: "liquidationPeriod", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - { - name: "patricianPeriod", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + stateMutability: "view", + type: "function", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "realtimeBalanceOfNow", + outputs: [ + { name: "availableBalance", internalType: "int256", type: "int256" }, + { name: "deposit", internalType: "uint256", type: "uint256" }, + { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, ], - name: "PPPConfigurationChanged", }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "operator", internalType: "address", type: "address" }], + name: "revokeOperator", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - indexed: true, - }, - { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, - { - name: "rewardAddress", - internalType: "address", - type: "address", - indexed: false, - }, + { name: "account", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "RewardAddressChanged", + name: "selfApproveFor", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - indexed: true, - }, - { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, - { - name: "minimumDeposit", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + { name: "account", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "SuperTokenMinimumDepositChanged", + name: "selfBurn", + outputs: [], }, { - type: "event", - anonymous: false, + stateMutability: "nonpayable", + type: "function", inputs: [ - { - name: "host", - internalType: "contract ISuperfluid", - type: "address", - indexed: true, - }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - indexed: true, - }, - { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, - { - name: "forwarder", - internalType: "address", - type: "address", - indexed: false, - }, - { name: "enabled", internalType: "bool", type: "bool", indexed: false }, + { name: "account", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "TrustedForwarderChanged", + name: "selfMint", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "factory", internalType: "address", type: "address" }, + { name: "holder", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "authorizeAppFactory", + name: "selfTransferFrom", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "tokens", - internalType: "contract ISuperToken[]", - type: "address[]", - }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "batchUpdateSuperTokenLogic", + name: "send", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "tokens", - internalType: "contract ISuperToken[]", - type: "address[]", - }, - { name: "tokenLogics", internalType: "address[]", type: "address[]" }, + { name: "account", internalType: "address", type: "address" }, + { name: "delta", internalType: "int256", type: "int256" }, ], - name: "batchUpdateSuperTokenLogic", + name: "settleBalance", outputs: [], }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "symbol", + outputs: [{ name: "", internalType: "string", type: "string" }], + }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "tokens", - internalType: "contract ISuperToken[]", - type: "address[]", - }, - { name: "minimumDeposits", internalType: "uint256[]", type: "uint256[]" }, + { name: "id", internalType: "bytes32", type: "bytes32" }, + { name: "dataLength", internalType: "uint256", type: "uint256" }, ], - name: "batchUpdateSuperTokenMinimumDeposit", + name: "terminateAgreement", outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [], - name: "castrate", - outputs: [], + name: "totalSupply", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "deployer", internalType: "address", type: "address" }, - { name: "registrationKey", internalType: "string", type: "string" }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "clearAppRegistrationKey", + name: "transfer", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [{ name: "recipient", internalType: "address", type: "address" }], + name: "transferAll", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "key", internalType: "bytes32", type: "bytes32" }, + { name: "holder", internalType: "address", type: "address" }, + { name: "recipient", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, ], - name: "clearConfig", - outputs: [], + name: "transferFrom", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, + { name: "id", internalType: "bytes32", type: "bytes32" }, + { name: "data", internalType: "bytes32[]", type: "bytes32[]" }, ], - name: "clearPPPConfig", + name: "updateAgreementData", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, + { name: "account", internalType: "address", type: "address" }, + { name: "slotId", internalType: "uint256", type: "uint256" }, + { name: "slotData", internalType: "bytes32[]", type: "bytes32[]" }, ], - name: "clearRewardAddress", + name: "updateAgreementStateSlot", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperToken", - type: "address", - }, - ], - name: "clearSuperTokenMinimumDeposit", + inputs: [{ name: "newAddress", internalType: "address", type: "address" }], + name: "updateCode", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "forwarder", internalType: "address", type: "address" }, - ], - name: "disableTrustedForwarder", + inputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], + name: "upgrade", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "forwarder", internalType: "address", type: "address" }, + { name: "to", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "enableTrustedForwarder", + name: "upgradeTo", outputs: [], }, +] as const; + +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// SuperUpgrader +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + */ +export const superUpgraderABI = [ + { + stateMutability: "nonpayable", + type: "constructor", + inputs: [ + { name: "_usdc", internalType: "contract FakeUSDC", type: "address" }, + { name: "_usdcx", internalType: "contract ISuperToken", type: "address" }, + { name: "_permit2", internalType: "contract IPermit2", type: "address" }, + { name: "_automate", internalType: "address", type: "address" }, + ], + }, + { type: "error", inputs: [], name: "BAD_ETH_TRANSFER" }, + { type: "error", inputs: [], name: "INVALID_HOST" }, + { type: "error", inputs: [], name: "LOWER_LIMIT_NOT_REACHED" }, + { type: "error", inputs: [], name: "NOT_ENOUGH_GAS_TANK_BALANCE" }, + { type: "error", inputs: [], name: "NOT_NEGATIVE_FLOW_RATE" }, + { type: "error", inputs: [], name: "TASK_ALREADY_EXISTS_FOR_USER" }, { stateMutability: "view", type: "function", inputs: [], - name: "getCodeAddress", - outputs: [ - { name: "codeAddress", internalType: "address", type: "address" }, - ], + name: "LOWER_LIMIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { stateMutability: "view", type: "function", + inputs: [], + name: "UPPER_LIMIT", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "key", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, ], - name: "getConfigAsAddress", - outputs: [{ name: "value", internalType: "address", type: "address" }], + name: "afterAgreementCreated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "key", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, ], - name: "getConfigAsUint256", - outputs: [{ name: "period", internalType: "uint256", type: "uint256" }], + name: "afterAgreementTerminated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - ], - name: "getPPPConfig", - outputs: [ - { name: "liquidationPeriod", internalType: "uint256", type: "uint256" }, - { name: "patricianPeriod", internalType: "uint256", type: "uint256" }, + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, ], + name: "afterAgreementUpdated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, { stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, + inputs: [], + name: "automate", + outputs: [ + { name: "", internalType: "contract IAutomate", type: "address" }, ], - name: "getRewardAddress", - outputs: [{ name: "", internalType: "address", type: "address" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, ], - name: "getSuperTokenMinimumDeposit", - outputs: [{ name: "value", internalType: "uint256", type: "uint256" }], + name: "beforeAgreementCreated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "factory", internalType: "address", type: "address" }, + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, ], - name: "isAuthorizedAppFactory", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "beforeAgreementTerminated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, { stateMutability: "view", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "forwarder", internalType: "address", type: "address" }, + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + { name: "", internalType: "bytes32", type: "bytes32" }, + { name: "", internalType: "bytes", type: "bytes" }, + { name: "", internalType: "bytes", type: "bytes" }, ], - name: "isTrustedForwarder", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "beforeAgreementUpdated", + outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "owner", - outputs: [{ name: "", internalType: "address", type: "address" }], + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "checker", + outputs: [ + { name: "canExec", internalType: "bool", type: "bool" }, + { name: "execPayload", internalType: "bytes", type: "bytes" }, + ], }, { - stateMutability: "pure", + stateMutability: "view", type: "function", inputs: [], - name: "proxiableUUID", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + name: "dedicatedMsgSender", + outputs: [{ name: "", internalType: "address", type: "address" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "agreementClass", internalType: "address", type: "address" }, - ], - name: "registerAgreementClass", - outputs: [], + inputs: [{ name: "", internalType: "address", type: "address" }], + name: "depositedEther", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [], - name: "renounceOwnership", - outputs: [], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "newGov", internalType: "address", type: "address" }, - ], - name: "replaceGovernance", - outputs: [], + name: "fundsOwner", + outputs: [{ name: "", internalType: "address", type: "address" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "deployer", internalType: "address", type: "address" }, - { name: "registrationKey", internalType: "string", type: "string" }, - { name: "expirationTs", internalType: "uint256", type: "uint256" }, + inputs: [], + name: "host", + outputs: [ + { name: "", internalType: "contract ISuperfluid", type: "address" }, ], - name: "setAppRegistrationKey", - outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "payable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", + name: "initialUpgradeAmount", + internalType: "uint256", + type: "uint256", }, - { name: "key", internalType: "bytes32", type: "bytes32" }, - { name: "value", internalType: "address", type: "address" }, + { + name: "totalAllowanceAmount", + internalType: "uint256", + type: "uint256", + }, + { name: "deadline", internalType: "uint256", type: "uint256" }, + { name: "v", internalType: "uint8", type: "uint8" }, + { name: "r", internalType: "bytes32", type: "bytes32" }, + { name: "s", internalType: "bytes32", type: "bytes32" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "setConfig", - outputs: [], + name: "manualUpgradeWithPermit", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { - stateMutability: "nonpayable", + stateMutability: "payable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", + name: "permitSingle", + internalType: "struct IAllowanceTransfer.PermitSingle", + type: "tuple", + components: [ + { + name: "details", + internalType: "struct IAllowanceTransfer.PermitDetails", + type: "tuple", + components: [ + { name: "token", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint160", type: "uint160" }, + { name: "expiration", internalType: "uint48", type: "uint48" }, + { name: "nonce", internalType: "uint48", type: "uint48" }, + ], + }, + { name: "spender", internalType: "address", type: "address" }, + { name: "sigDeadline", internalType: "uint256", type: "uint256" }, + ], }, - { name: "key", internalType: "bytes32", type: "bytes32" }, - { name: "value", internalType: "uint256", type: "uint256" }, + { name: "signature", internalType: "bytes", type: "bytes" }, + { + name: "initialUpgradeAmount", + internalType: "uint160", + type: "uint160", + }, + { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "setConfig", - outputs: [], + name: "manualUpgradeWithPermit2", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "liquidationPeriod", internalType: "uint256", type: "uint256" }, - { name: "patricianPeriod", internalType: "uint256", type: "uint256" }, - ], - name: "setPPPConfig", - outputs: [], + inputs: [], + name: "permit2", + outputs: [{ name: "", internalType: "contract IPermit2", type: "address" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperfluidToken", - type: "address", - }, - { name: "rewardAddress", internalType: "address", type: "address" }, - ], - name: "setRewardAddress", - outputs: [], + inputs: [{ name: "", internalType: "address", type: "address" }], + name: "taskIds", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, + inputs: [], + name: "taskTreasury", + outputs: [ { - name: "superToken", - internalType: "contract ISuperfluidToken", + name: "", + internalType: "contract ITaskTreasuryUpgradable", type: "address", }, - { name: "value", internalType: "uint256", type: "uint256" }, ], - name: "setSuperTokenMinimumDeposit", - outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "payable", type: "function", - inputs: [{ name: "newOwner", internalType: "address", type: "address" }], - name: "transferOwnership", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "topUpGasTank", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "factory", internalType: "address", type: "address" }, - ], - name: "unauthorizeAppFactory", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "upgradeWithAutomation", outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "newAddress", internalType: "address", type: "address" }], - name: "updateCode", - outputs: [], + inputs: [], + name: "usdc", + outputs: [{ name: "", internalType: "contract FakeUSDC", type: "address" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "hostNewLogic", internalType: "address", type: "address" }, - { - name: "agreementClassNewLogics", - internalType: "address[]", - type: "address[]", - }, - { - name: "superTokenFactoryNewLogic", - internalType: "address", - type: "address", - }, + inputs: [], + name: "usdcx", + outputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, ], - name: "updateContracts", - outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - { name: "deployer", internalType: "address", type: "address" }, - { name: "registrationKey", internalType: "string", type: "string" }, - ], - name: "verifyAppRegistrationKey", - outputs: [ - { name: "validNow", internalType: "bool", type: "bool" }, - { name: "expirationTs", internalType: "uint256", type: "uint256" }, + { name: "_amount", internalType: "uint256", type: "uint256" }, + { name: "_token", internalType: "address", type: "address" }, ], + name: "withdrawFunds", + outputs: [], }, + { stateMutability: "payable", type: "receive" }, ] as const; /** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x3a648764a6d66440ca096343937c711a7ac1b1e9) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xee07D9fce4Cf2a891BC979E9d365929506C2982f) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xF74390BabA510ec2fE196c2e02B037380d7a6F12) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xbe20Bac0DCF6f01834F51CCDab2dD72707C6e9b6) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136) + * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) */ -export const superfluidGovernanceAddress = { - 1: "0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653", - 5: "0x3A648764a6d66440Ca096343937c711A7ac1B1e9", - 10: "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D", - 56: "0xee07D9fce4Cf2a891BC979E9d365929506C2982f", - 100: "0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478", - 137: "0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087", - 420: "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f", - 1442: "0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083", - 8453: "0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D", - 42161: "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D", - 42220: "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D", - 43113: "0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D", - 43114: "0xF74390BabA510ec2fE196c2e02B037380d7a6F12", - 80001: "0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e", - 84531: "0xbe20Bac0DCF6f01834F51CCDab2dD72707C6e9b6", - 421613: "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f", - 11155111: "0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136", +export const superUpgraderAddress = { + 80001: "0xb7DB015AA9F37142340C94F09c543Ad51B53e961", +} as const; + +/** + * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + */ +export const superUpgraderConfig = { + address: superUpgraderAddress, + abi: superUpgraderABI, } as const; +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// SuperfluidGovernance +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + /** * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653) * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x3a648764a6d66440ca096343937c711a7ac1b1e9) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xee07D9fce4Cf2a891BC979E9d365929506C2982f) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478) * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087) * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D) * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D) @@ -3646,1497 +3593,1654 @@ export const superfluidGovernanceAddress = { * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136) */ -export const superfluidGovernanceConfig = { - address: superfluidGovernanceAddress, - abi: superfluidGovernanceABI, -} as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// ERC20 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -export const erc20ABI = [ +export const superfluidGovernanceABI = [ + { type: "error", inputs: [], name: "SF_GOV_II_ONLY_OWNER" }, + { + type: "error", + inputs: [], + name: "SF_GOV_INVALID_LIQUIDATION_OR_PATRICIAN_PERIOD", + }, + { type: "error", inputs: [], name: "SF_GOV_MUST_BE_CONTRACT" }, { type: "event", + anonymous: false, inputs: [ - { name: "owner", type: "address", indexed: true }, - { name: "spender", type: "address", indexed: true }, - { name: "value", type: "uint256", indexed: false }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "factory", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "authorized", + internalType: "bool", + type: "bool", + indexed: false, + }, ], - name: "Approval", + name: "AppFactoryAuthorizationChanged", }, { type: "event", + anonymous: false, inputs: [ - { name: "from", type: "address", indexed: true }, - { name: "to", type: "address", indexed: true }, - { name: "value", type: "uint256", indexed: false }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "deployer", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "appRegistrationKey", + internalType: "string", + type: "string", + indexed: false, + }, + { + name: "expirationTs", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "Transfer", + name: "AppRegistrationKeyChanged", }, { - stateMutability: "view", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "owner", type: "address" }, - { name: "spender", type: "address" }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, + { + name: "liquidationPeriod", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "allowance", - outputs: [{ type: "uint256" }], + name: "CFAv1LiquidationPeriodChanged", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "spender", type: "address" }, - { name: "amount", type: "uint256" }, + { + name: "uuid", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "codeAddress", + internalType: "address", + type: "address", + indexed: false, + }, ], - name: "approve", - outputs: [{ type: "bool" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "account", type: "address" }], - name: "balanceOf", - outputs: [{ type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "decimals", - outputs: [{ type: "uint8" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "name", - outputs: [{ type: "string" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "symbol", - outputs: [{ type: "string" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "totalSupply", - outputs: [{ type: "uint256" }], + name: "CodeUpdated", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "recipient", type: "address" }, - { name: "amount", type: "uint256" }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { name: "key", internalType: "bytes32", type: "bytes32", indexed: false }, + { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, + { + name: "value", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "transfer", - outputs: [{ type: "bool" }], + name: "ConfigChanged", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "sender", type: "address" }, - { name: "recipient", type: "address" }, - { name: "amount", type: "uint256" }, + { name: "version", internalType: "uint8", type: "uint8", indexed: false }, ], - name: "transferFrom", - outputs: [{ type: "bool" }], + name: "Initialized", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "spender", type: "address" }, - { name: "addedValue", type: "uint256" }, + { + name: "previousOwner", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "newOwner", + internalType: "address", + type: "address", + indexed: true, + }, ], - name: "increaseAllowance", - outputs: [{ type: "bool" }], + name: "OwnershipTransferred", }, { - stateMutability: "nonpayable", - type: "function", + type: "event", + anonymous: false, inputs: [ - { name: "spender", type: "address" }, - { name: "subtractedValue", type: "uint256" }, - ], - name: "decreaseAllowance", - outputs: [{ type: "bool" }], + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, + { + name: "liquidationPeriod", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + { + name: "patricianPeriod", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + ], + name: "PPPConfigurationChanged", }, -] as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// ERC721 -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -export const erc721ABI = [ { type: "event", + anonymous: false, inputs: [ - { name: "owner", type: "address", indexed: true }, - { name: "spender", type: "address", indexed: true }, - { name: "tokenId", type: "uint256", indexed: true }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, + { + name: "rewardAddress", + internalType: "address", + type: "address", + indexed: false, + }, ], - name: "Approval", + name: "RewardAddressChanged", }, { type: "event", + anonymous: false, inputs: [ - { name: "owner", type: "address", indexed: true }, - { name: "operator", type: "address", indexed: true }, - { name: "approved", type: "bool", indexed: false }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, + { + name: "minimumDeposit", + internalType: "uint256", + type: "uint256", + indexed: false, + }, ], - name: "ApprovalForAll", + name: "SuperTokenMinimumDepositChanged", }, { type: "event", + anonymous: false, inputs: [ - { name: "from", type: "address", indexed: true }, - { name: "to", type: "address", indexed: true }, - { name: "tokenId", type: "uint256", indexed: true }, + { + name: "host", + internalType: "contract ISuperfluid", + type: "address", + indexed: true, + }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + indexed: true, + }, + { name: "isKeySet", internalType: "bool", type: "bool", indexed: false }, + { + name: "forwarder", + internalType: "address", + type: "address", + indexed: false, + }, + { name: "enabled", internalType: "bool", type: "bool", indexed: false }, ], - name: "Transfer", + name: "TrustedForwarderChanged", }, { - stateMutability: "payable", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "spender", type: "address" }, - { name: "tokenId", type: "uint256" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "factory", internalType: "address", type: "address" }, ], - name: "approve", + name: "authorizeAppFactory", outputs: [], }, { - stateMutability: "view", - type: "function", - inputs: [{ name: "account", type: "address" }], - name: "balanceOf", - outputs: [{ type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "tokenId", type: "uint256" }], - name: "getApproved", - outputs: [{ type: "address" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [ - { name: "owner", type: "address" }, - { name: "operator", type: "address" }, - ], - name: "isApprovedForAll", - outputs: [{ type: "bool" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "name", - outputs: [{ type: "string" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "tokenId", type: "uint256" }], - name: "ownerOf", - outputs: [{ name: "owner", type: "address" }], - }, - { - stateMutability: "payable", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "from", type: "address" }, - { name: "to", type: "address" }, - { name: "tokenId", type: "uint256" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "tokens", + internalType: "contract ISuperToken[]", + type: "address[]", + }, ], - name: "safeTransferFrom", + name: "batchUpdateSuperTokenLogic", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "from", type: "address" }, - { name: "to", type: "address" }, - { name: "id", type: "uint256" }, - { name: "data", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "tokens", + internalType: "contract ISuperToken[]", + type: "address[]", + }, + { name: "tokenLogics", internalType: "address[]", type: "address[]" }, ], - name: "safeTransferFrom", + name: "batchUpdateSuperTokenLogic", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "operator", type: "address" }, - { name: "approved", type: "bool" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "tokens", + internalType: "contract ISuperToken[]", + type: "address[]", + }, + { name: "minimumDeposits", internalType: "uint256[]", type: "uint256[]" }, ], - name: "setApprovalForAll", + name: "batchUpdateSuperTokenMinimumDeposit", outputs: [], }, { - stateMutability: "view", - type: "function", - inputs: [], - name: "symbol", - outputs: [{ type: "string" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "index", type: "uint256" }], - name: "tokenByIndex", - outputs: [{ type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [ - { name: "owner", type: "address" }, - { name: "index", type: "uint256" }, - ], - name: "tokenByIndex", - outputs: [{ name: "tokenId", type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "tokenId", type: "uint256" }], - name: "tokenURI", - outputs: [{ type: "string" }], - }, - { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [], - name: "totalSupply", - outputs: [{ type: "uint256" }], - }, - { - stateMutability: "payable", - type: "function", - inputs: [ - { name: "sender", type: "address" }, - { name: "recipient", type: "address" }, - { name: "tokenId", type: "uint256" }, - ], - name: "transferFrom", + name: "castrate", outputs: [], }, -] as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// SuperUpgrader -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x80a18e53a1761cba151af445640c06046f0b62a5) - */ -export const superUpgraderABI = [ { stateMutability: "nonpayable", - type: "constructor", + type: "function", inputs: [ - { name: "_usdc", internalType: "contract FakeUSDC", type: "address" }, - { name: "_usdcx", internalType: "contract ISuperToken", type: "address" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "deployer", internalType: "address", type: "address" }, + { name: "registrationKey", internalType: "string", type: "string" }, ], - }, - { type: "error", inputs: [], name: "BAD_ETH_TRANSFER" }, - { type: "error", inputs: [], name: "INVALID_HOST" }, - { type: "error", inputs: [], name: "LOWER_LIMIT_NOT_REACHED" }, - { type: "error", inputs: [], name: "NOT_ENOUGH_GAS_TANK_BALANCE" }, - { type: "error", inputs: [], name: "NOT_NEGATIVE_FLOW_RATE" }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "LOWER_LIMIT", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "TXN_SETUP_COST", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "UPPER_LIMIT", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + name: "clearAppRegistrationKey", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - { name: "", internalType: "address", type: "address" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "key", internalType: "bytes32", type: "bytes32" }, ], - name: "afterAgreementCreated", - outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + name: "clearConfig", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - { name: "", internalType: "address", type: "address" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, ], - name: "afterAgreementTerminated", - outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + name: "clearPPPConfig", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - { name: "", internalType: "address", type: "address" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, ], - name: "afterAgreementUpdated", - outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + name: "clearRewardAddress", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - { name: "", internalType: "address", type: "address" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, ], - name: "beforeAgreementCreated", - outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + name: "clearSuperTokenMinimumDeposit", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - { name: "", internalType: "address", type: "address" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "forwarder", internalType: "address", type: "address" }, ], - name: "beforeAgreementTerminated", - outputs: [{ name: "", internalType: "bytes", type: "bytes" }], + name: "disableTrustedForwarder", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - { name: "", internalType: "address", type: "address" }, - { name: "", internalType: "bytes32", type: "bytes32" }, - { name: "", internalType: "bytes", type: "bytes" }, - { name: "", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "forwarder", internalType: "address", type: "address" }, ], - name: "beforeAgreementUpdated", - outputs: [{ name: "", internalType: "bytes", type: "bytes" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "", internalType: "address", type: "address" }], - name: "depositedEther", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + name: "enableTrustedForwarder", + outputs: [], }, { stateMutability: "view", type: "function", inputs: [], - name: "host", + name: "getCodeAddress", outputs: [ - { name: "", internalType: "contract ISuperfluid", type: "address" }, + { name: "codeAddress", internalType: "address", type: "address" }, ], }, { - stateMutability: "payable", + stateMutability: "view", type: "function", inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, { - name: "initialUpgradeAmount", - internalType: "uint256", - type: "uint256", + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", }, + { name: "key", internalType: "bytes32", type: "bytes32" }, + ], + name: "getConfigAsAddress", + outputs: [{ name: "value", internalType: "address", type: "address" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, { - name: "totalAllowanceAmount", - internalType: "uint256", - type: "uint256", + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", }, - { name: "deadline", internalType: "uint256", type: "uint256" }, - { name: "v", internalType: "uint8", type: "uint8" }, - { name: "r", internalType: "bytes32", type: "bytes32" }, - { name: "s", internalType: "bytes32", type: "bytes32" }, - { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "key", internalType: "bytes32", type: "bytes32" }, ], - name: "manualUpgradeWithAuthorization", - outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + name: "getConfigAsUint256", + outputs: [{ name: "period", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "payable", + stateMutability: "view", type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "topUpGasTank", - outputs: [], + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + name: "getPPPConfig", + outputs: [ + { name: "liquidationPeriod", internalType: "uint256", type: "uint256" }, + { name: "patricianPeriod", internalType: "uint256", type: "uint256" }, + ], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "upgradeWithAutomation", - outputs: [], + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + name: "getRewardAddress", + outputs: [{ name: "", internalType: "address", type: "address" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "upgradeWithGasTankAutomation", - outputs: [], + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + name: "getSuperTokenMinimumDeposit", + outputs: [{ name: "value", internalType: "uint256", type: "uint256" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "usdc", - outputs: [{ name: "", internalType: "contract FakeUSDC", type: "address" }], + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "factory", internalType: "address", type: "address" }, + ], + name: "isAuthorizedAppFactory", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", - inputs: [], - name: "usdcx", - outputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, + inputs: [ + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "forwarder", internalType: "address", type: "address" }, ], + name: "isTrustedForwarder", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "owner", + outputs: [{ name: "", internalType: "address", type: "address" }], }, - { stateMutability: "payable", type: "receive" }, -] as const; - -/** - * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x80a18e53a1761cba151af445640c06046f0b62a5) - */ -export const superUpgraderAddress = { - 80001: "0x80A18e53a1761cba151af445640C06046F0b62a5", -} as const; - -/** - * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x80a18e53a1761cba151af445640c06046f0b62a5) - */ -export const superUpgraderConfig = { - address: superUpgraderAddress, - abi: superUpgraderABI, -} as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// CFAv1Forwarder -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - */ -export const cfAv1ForwarderABI = [ { - stateMutability: "nonpayable", - type: "constructor", - inputs: [ - { name: "host", internalType: "contract ISuperfluid", type: "address" }, - ], + stateMutability: "pure", + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, - { type: "error", inputs: [], name: "CFA_FWD_INVALID_FLOW_RATE" }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "flowrate", internalType: "int96", type: "int96" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "agreementClass", internalType: "address", type: "address" }, ], - name: "createFlow", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "registerAgreementClass", + outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "userData", internalType: "bytes", type: "bytes" }, - ], - name: "deleteFlow", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "renounceOwnership", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "account", internalType: "address", type: "address" }, - ], - name: "getAccountFlowInfo", - outputs: [ - { name: "lastUpdated", internalType: "uint256", type: "uint256" }, - { name: "flowrate", internalType: "int96", type: "int96" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "newGov", internalType: "address", type: "address" }, ], + name: "replaceGovernance", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "account", internalType: "address", type: "address" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "deployer", internalType: "address", type: "address" }, + { name: "registrationKey", internalType: "string", type: "string" }, + { name: "expirationTs", internalType: "uint256", type: "uint256" }, ], - name: "getAccountFlowrate", - outputs: [{ name: "flowrate", internalType: "int96", type: "int96" }], + name: "setAppRegistrationKey", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "flowrate", internalType: "int96", type: "int96" }, - ], - name: "getBufferAmountByFlowrate", - outputs: [ - { name: "bufferAmount", internalType: "uint256", type: "uint256" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "key", internalType: "bytes32", type: "bytes32" }, + { name: "value", internalType: "address", type: "address" }, ], + name: "setConfig", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - ], - name: "getFlowInfo", - outputs: [ - { name: "lastUpdated", internalType: "uint256", type: "uint256" }, - { name: "flowrate", internalType: "int96", type: "int96" }, - { name: "deposit", internalType: "uint256", type: "uint256" }, - { name: "owedDeposit", internalType: "uint256", type: "uint256" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "key", internalType: "bytes32", type: "bytes32" }, + { name: "value", internalType: "uint256", type: "uint256" }, ], + name: "setConfig", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "flowOperator", internalType: "address", type: "address" }, - ], - name: "getFlowOperatorPermissions", - outputs: [ - { name: "permissions", internalType: "uint8", type: "uint8" }, - { name: "flowrateAllowance", internalType: "int96", type: "int96" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "liquidationPeriod", internalType: "uint256", type: "uint256" }, + { name: "patricianPeriod", internalType: "uint256", type: "uint256" }, ], + name: "setPPPConfig", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "rewardAddress", internalType: "address", type: "address" }, ], - name: "getFlowrate", - outputs: [{ name: "flowrate", internalType: "int96", type: "int96" }], + name: "setRewardAddress", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "flowOperator", internalType: "address", type: "address" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { + name: "superToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + { name: "value", internalType: "uint256", type: "uint256" }, ], - name: "grantPermissions", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "setSuperTokenMinimumDeposit", + outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "flowOperator", internalType: "address", type: "address" }, - ], - name: "revokePermissions", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [{ name: "newOwner", internalType: "address", type: "address" }], + name: "transferOwnership", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "flowrate", internalType: "int96", type: "int96" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "factory", internalType: "address", type: "address" }, ], - name: "setFlowrate", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "unauthorizeAppFactory", + outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "flowrate", internalType: "int96", type: "int96" }, - ], - name: "setFlowrateFrom", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [{ name: "newAddress", internalType: "address", type: "address" }], + name: "updateCode", + outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "sender", internalType: "address", type: "address" }, - { name: "receiver", internalType: "address", type: "address" }, - { name: "flowrate", internalType: "int96", type: "int96" }, - { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "hostNewLogic", internalType: "address", type: "address" }, + { + name: "agreementClassNewLogics", + internalType: "address[]", + type: "address[]", + }, + { + name: "superTokenFactoryNewLogic", + internalType: "address", + type: "address", + }, ], - name: "updateFlow", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "updateContracts", + outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [ - { name: "token", internalType: "contract ISuperToken", type: "address" }, - { name: "flowOperator", internalType: "address", type: "address" }, - { name: "permissions", internalType: "uint8", type: "uint8" }, - { name: "flowrateAllowance", internalType: "int96", type: "int96" }, + { name: "host", internalType: "contract ISuperfluid", type: "address" }, + { name: "deployer", internalType: "address", type: "address" }, + { name: "registrationKey", internalType: "string", type: "string" }, + ], + name: "verifyAppRegistrationKey", + outputs: [ + { name: "validNow", internalType: "bool", type: "bool" }, + { name: "expirationTs", internalType: "uint256", type: "uint256" }, ], - name: "updateFlowOperatorPermissions", - outputs: [{ name: "", internalType: "bool", type: "bool" }], }, ] as const; /** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - */ -export const cfAv1ForwarderAddress = { - 1: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 5: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 10: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 56: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 100: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 137: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 420: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 1442: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 8453: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 42161: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 42220: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 43113: "0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D", - 43114: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 80001: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 84531: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 421613: "0xcfA132E353cB4E398080B9700609bb008eceB125", - 11155111: "0xcfA132E353cB4E398080B9700609bb008eceB125", + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x3a648764a6d66440ca096343937c711a7ac1b1e9) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xee07D9fce4Cf2a891BC979E9d365929506C2982f) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xF74390BabA510ec2fE196c2e02B037380d7a6F12) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xbe20Bac0DCF6f01834F51CCDab2dD72707C6e9b6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136) + */ +export const superfluidGovernanceAddress = { + 1: "0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653", + 5: "0x3A648764a6d66440Ca096343937c711A7ac1B1e9", + 10: "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D", + 56: "0xee07D9fce4Cf2a891BC979E9d365929506C2982f", + 100: "0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478", + 137: "0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087", + 420: "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f", + 1442: "0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083", + 8453: "0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D", + 42161: "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D", + 42220: "0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D", + 43113: "0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D", + 43114: "0xF74390BabA510ec2fE196c2e02B037380d7a6F12", + 80001: "0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e", + 84531: "0xbe20Bac0DCF6f01834F51CCDab2dD72707C6e9b6", + 421613: "0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f", + 11155111: "0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136", } as const; /** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Zk Evm Testnet Blockscout__](https://explorer.public.zkevm-test.net/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x2CDd45c5182602a36d391F7F16DD9f8386C3bD8D) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xcfA132E353cB4E398080B9700609bb008eceB125) - * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0xcfA132E353cB4E398080B9700609bb008eceB125) + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0xe2E14e2C4518cB06c32Cd0818B4C01f53E1Ba653) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x3a648764a6d66440ca096343937c711a7ac1b1e9) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xee07D9fce4Cf2a891BC979E9d365929506C2982f) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0xaCc7380323681fdb8a0B9F2FE7d69dDFf0664478) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3AD3f7A0965Ce6f9358AD5CCE86Bc2b05F1EE087) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xF21019b8688e7730Ca6D9002569eCBaF8d1A3083) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x55F7758dd99d5e185f4CC08d4Ad95B71f598264D) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0x0170FFCC75d178d426EBad5b1a31451d00Ddbd0D) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0xA55632254Bc9F739bDe7191c8a4510aDdae3ef6D) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0xF74390BabA510ec2fE196c2e02B037380d7a6F12) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x2637eA93EE5cd887ff9AC98185eA67Bd70C5f62e) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0xbe20Bac0DCF6f01834F51CCDab2dD72707C6e9b6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0x777Be25F9fdcA87e8a0E06Ad4be93d65429FCb9f) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x21d4E9fbB9DB742E6ef4f29d189a7C18B0b59136) */ -export const cfAv1ForwarderConfig = { - address: cfAv1ForwarderAddress, - abi: cfAv1ForwarderABI, +export const superfluidGovernanceConfig = { + address: superfluidGovernanceAddress, + abi: superfluidGovernanceABI, } as const; ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// AutoWrapManager +// SuperfluidHost ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x0B82D14E9616ca4d260E77454834AdCf5887595F) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x3eAB3c6207F488E475b7955B631B564F0E6317B9) + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) */ -export const autoWrapManagerABI = [ +export const superfluidHostABI = [ { stateMutability: "nonpayable", type: "constructor", inputs: [ - { name: "_cfa", internalType: "address", type: "address" }, - { name: "_minLower", internalType: "uint64", type: "uint64" }, - { name: "_minUpper", internalType: "uint64", type: "uint64" }, - ], - }, - { - type: "error", - inputs: [ - { name: "limitGiven", internalType: "uint64", type: "uint64" }, - { name: "minLimit", internalType: "uint64", type: "uint64" }, - ], - name: "InsufficientLimits", - }, - { - type: "error", - inputs: [ - { name: "expirationTimeGiven", internalType: "uint64", type: "uint64" }, - { name: "timeNow", internalType: "uint256", type: "uint256" }, + { name: "nonUpgradable", internalType: "bool", type: "bool" }, + { name: "appWhiteListingEnabled", internalType: "bool", type: "bool" }, ], - name: "InvalidExpirationTime", }, { type: "error", - inputs: [{ name: "strategy", internalType: "address", type: "address" }], - name: "InvalidStrategy", + inputs: [{ name: "_code", internalType: "uint256", type: "uint256" }], + name: "APP_RULE", }, + { type: "error", inputs: [], name: "HOST_AGREEMENT_ALREADY_REGISTERED" }, + { type: "error", inputs: [], name: "HOST_AGREEMENT_CALLBACK_IS_NOT_ACTION" }, + { type: "error", inputs: [], name: "HOST_AGREEMENT_IS_NOT_REGISTERED" }, { type: "error", - inputs: [ - { name: "caller", internalType: "address", type: "address" }, - { name: "expectedCaller", internalType: "address", type: "address" }, - ], - name: "UnauthorizedCaller", + inputs: [], + name: "HOST_CALL_AGREEMENT_WITH_CTX_FROM_WRONG_ADDRESS", }, { type: "error", - inputs: [{ name: "superToken", internalType: "address", type: "address" }], - name: "UnsupportedSuperToken", + inputs: [], + name: "HOST_CALL_APP_ACTION_WITH_CTX_FROM_WRONG_ADDRESS", }, { type: "error", - inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], - name: "WrapNotRequired", + inputs: [], + name: "HOST_CANNOT_DOWNGRADE_TO_NON_UPGRADEABLE", }, + { type: "error", inputs: [], name: "HOST_INVALID_CONFIG_WORD" }, { type: "error", - inputs: [ - { name: "lowerLimit", internalType: "uint64", type: "uint64" }, - { name: "upperLimit", internalType: "uint64", type: "uint64" }, - ], - name: "WrongLimits", + inputs: [], + name: "HOST_INVALID_OR_EXPIRED_SUPER_APP_REGISTRATION_KEY", }, - { type: "error", inputs: [], name: "ZeroAddress" }, + { type: "error", inputs: [], name: "HOST_MAX_256_AGREEMENTS" }, + { type: "error", inputs: [], name: "HOST_MUST_BE_CONTRACT" }, + { type: "error", inputs: [], name: "HOST_NEED_MORE_GAS" }, + { type: "error", inputs: [], name: "HOST_NON_UPGRADEABLE" }, + { type: "error", inputs: [], name: "HOST_NON_ZERO_LENGTH_PLACEHOLDER_CTX" }, + { type: "error", inputs: [], name: "HOST_NOT_A_SUPER_APP" }, + { type: "error", inputs: [], name: "HOST_NO_APP_REGISTRATION_PERMISSIONS" }, + { type: "error", inputs: [], name: "HOST_ONLY_GOVERNANCE" }, + { type: "error", inputs: [], name: "HOST_ONLY_LISTED_AGREEMENT" }, + { type: "error", inputs: [], name: "HOST_RECEIVER_IS_NOT_SUPER_APP" }, + { type: "error", inputs: [], name: "HOST_SENDER_IS_NOT_SUPER_APP" }, + { type: "error", inputs: [], name: "HOST_SOURCE_APP_NEEDS_HIGHER_APP_LEVEL" }, + { type: "error", inputs: [], name: "HOST_SUPER_APP_ALREADY_REGISTERED" }, + { type: "error", inputs: [], name: "HOST_SUPER_APP_IS_JAILED" }, + { type: "error", inputs: [], name: "HOST_UNAUTHORIZED_SUPER_APP_FACTORY" }, + { type: "error", inputs: [], name: "HOST_UNKNOWN_BATCH_CALL_OPERATION_TYPE" }, { type: "event", anonymous: false, inputs: [ { - name: "strategy", + name: "agreementType", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "code", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "AddedApprovedStrategy", + name: "AgreementClassRegistered", }, { type: "event", anonymous: false, inputs: [ { - name: "lowerLimit", - internalType: "uint64", - type: "uint64", + name: "agreementType", + internalType: "bytes32", + type: "bytes32", indexed: false, }, { - name: "upperLimit", - internalType: "uint64", - type: "uint64", + name: "code", + internalType: "address", + type: "address", indexed: false, }, ], - name: "LimitsChanged", + name: "AgreementClassUpdated", }, { type: "event", anonymous: false, inputs: [ { - name: "previousOwner", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "newOwner", - internalType: "address", + name: "app", + internalType: "contract ISuperApp", type: "address", indexed: true, }, ], - name: "OwnershipTransferred", + name: "AppRegistered", }, { type: "event", anonymous: false, inputs: [ { - name: "strategy", + name: "uuid", + internalType: "bytes32", + type: "bytes32", + indexed: false, + }, + { + name: "codeAddress", internalType: "address", type: "address", - indexed: true, + indexed: false, }, ], - name: "RemovedApprovedStrategy", + name: "CodeUpdated", }, { type: "event", anonymous: false, inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32", indexed: true }, { - name: "wrapAmount", - internalType: "uint256", - type: "uint256", + name: "oldGov", + internalType: "contract ISuperfluidGovernance", + type: "address", + indexed: false, + }, + { + name: "newGov", + internalType: "contract ISuperfluidGovernance", + type: "address", indexed: false, }, ], - name: "WrapExecuted", + name: "GovernanceReplaced", + }, + { + type: "event", + anonymous: false, + inputs: [ + { name: "version", internalType: "uint8", type: "uint8", indexed: false }, + ], + name: "Initialized", }, { type: "event", anonymous: false, inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32", indexed: true }, - { name: "user", internalType: "address", type: "address", indexed: true }, - { - name: "superToken", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "strategy", - internalType: "address", - type: "address", - indexed: false, - }, { - name: "liquidityToken", - internalType: "address", + name: "app", + internalType: "contract ISuperApp", type: "address", - indexed: false, - }, - { - name: "expiry", - internalType: "uint256", - type: "uint256", - indexed: false, - }, - { - name: "lowerLimit", - internalType: "uint256", - type: "uint256", - indexed: false, + indexed: true, }, { - name: "upperLimit", + name: "reason", internalType: "uint256", type: "uint256", indexed: false, }, ], - name: "WrapScheduleCreated", + name: "Jail", }, { type: "event", anonymous: false, inputs: [ - { name: "id", internalType: "bytes32", type: "bytes32", indexed: true }, - { name: "user", internalType: "address", type: "address", indexed: true }, { - name: "superToken", - internalType: "address", + name: "newFactory", + internalType: "contract ISuperTokenFactory", type: "address", - indexed: true, + indexed: false, }, + ], + name: "SuperTokenFactoryUpdated", + }, + { + type: "event", + anonymous: false, + inputs: [ { - name: "strategy", - internalType: "address", + name: "token", + internalType: "contract ISuperToken", type: "address", - indexed: false, + indexed: true, }, { - name: "liquidityToken", + name: "code", internalType: "address", type: "address", indexed: false, }, ], - name: "WrapScheduleDeleted", + name: "SuperTokenLogicUpdated", }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "strategy", internalType: "address", type: "address" }], - name: "addApprovedStrategy", - outputs: [], + inputs: [], + name: "APP_WHITE_LISTING_ENABLED", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { stateMutability: "view", type: "function", - inputs: [{ name: "", internalType: "address", type: "address" }], - name: "approvedStrategies", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + inputs: [], + name: "CALLBACK_GAS_LIMIT", + outputs: [{ name: "", internalType: "uint64", type: "uint64" }], }, { stateMutability: "view", type: "function", inputs: [], - name: "cfaV1", - outputs: [ + name: "MAX_APP_CALLBACK_LEVEL", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "MAX_NUM_AGREEMENTS", + outputs: [{ name: "", internalType: "uint32", type: "uint32" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "NON_UPGRADABLE_DEPLOYMENT", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "bitmap", internalType: "uint256", type: "uint256" }, + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + ], + name: "addToAgreementClassesBitmap", + outputs: [{ name: "newBitmap", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ { - name: "", - internalType: "contract IConstantFlowAgreementV1", + name: "targetApp", + internalType: "contract ISuperApp", type: "address", }, ], + name: "allowCompositeApp", + outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { name: "user", internalType: "address", type: "address" }, - { name: "superToken", internalType: "address", type: "address" }, - { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "appCreditUsedDelta", internalType: "int256", type: "int256" }, ], - name: "checkWrap", - outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + name: "appCallbackPop", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", - inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], - name: "checkWrapByIndex", - outputs: [{ name: "amount", internalType: "uint256", type: "uint256" }], + inputs: [ + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "appCreditGranted", internalType: "uint256", type: "uint256" }, + { name: "appCreditUsed", internalType: "int256", type: "int256" }, + { + name: "appCreditToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + name: "appCallbackPush", + outputs: [{ name: "appCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "superToken", internalType: "address", type: "address" }, - { name: "strategy", internalType: "address", type: "address" }, - { name: "liquidityToken", internalType: "address", type: "address" }, - { name: "expiry", internalType: "uint64", type: "uint64" }, - { name: "lowerLimit", internalType: "uint64", type: "uint64" }, - { name: "upperLimit", internalType: "uint64", type: "uint64" }, + { + name: "operations", + internalType: "struct ISuperfluid.Operation[]", + type: "tuple[]", + components: [ + { name: "operationType", internalType: "uint32", type: "uint32" }, + { name: "target", internalType: "address", type: "address" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], + }, ], - name: "createWrapSchedule", + name: "batchCall", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "user", internalType: "address", type: "address" }, - { name: "superToken", internalType: "address", type: "address" }, - { name: "liquidityToken", internalType: "address", type: "address" }, + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "userData", internalType: "bytes", type: "bytes" }, ], - name: "deleteWrapSchedule", - outputs: [], + name: "callAgreement", + outputs: [{ name: "returnedData", internalType: "bytes", type: "bytes" }], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], - name: "deleteWrapScheduleByIndex", + inputs: [ + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAgreementWithContext", + outputs: [ + { name: "newCtx", internalType: "bytes", type: "bytes" }, + { name: "returnedData", internalType: "bytes", type: "bytes" }, + ], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + ], + name: "callAppAction", + outputs: [{ name: "returnedData", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAppActionWithContext", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "isTermination", internalType: "bool", type: "bool" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAppAfterCallback", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "callData", internalType: "bytes", type: "bytes" }, + { name: "isTermination", internalType: "bool", type: "bool" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "callAppBeforeCallback", + outputs: [{ name: "cbdata", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [], + name: "castrate", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "user", internalType: "address", type: "address" }, - { name: "superToken", internalType: "address", type: "address" }, - { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "appCreditUsedMore", internalType: "int256", type: "int256" }, + ], + name: "ctxUseCredit", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "pure", + type: "function", + inputs: [{ name: "ctx", internalType: "bytes", type: "bytes" }], + name: "decodeCtx", + outputs: [ + { + name: "context", + internalType: "struct ISuperfluid.Context", + type: "tuple", + components: [ + { name: "appCallbackLevel", internalType: "uint8", type: "uint8" }, + { name: "callType", internalType: "uint8", type: "uint8" }, + { name: "timestamp", internalType: "uint256", type: "uint256" }, + { name: "msgSender", internalType: "address", type: "address" }, + { name: "agreementSelector", internalType: "bytes4", type: "bytes4" }, + { name: "userData", internalType: "bytes", type: "bytes" }, + { + name: "appCreditGranted", + internalType: "uint256", + type: "uint256", + }, + { + name: "appCreditWantedDeprecated", + internalType: "uint256", + type: "uint256", + }, + { name: "appCreditUsed", internalType: "int256", type: "int256" }, + { name: "appAddress", internalType: "address", type: "address" }, + { + name: "appCreditToken", + internalType: "contract ISuperfluidToken", + type: "address", + }, + ], + }, ], - name: "executeWrap", - outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], - name: "executeWrapByIndex", + inputs: [ + { + name: "operations", + internalType: "struct ISuperfluid.Operation[]", + type: "tuple[]", + components: [ + { name: "operationType", internalType: "uint32", type: "uint32" }, + { name: "target", internalType: "address", type: "address" }, + { name: "data", internalType: "bytes", type: "bytes" }, + ], + }, + ], + name: "forwardBatchCall", outputs: [], }, { stateMutability: "view", type: "function", inputs: [ - { name: "user", internalType: "address", type: "address" }, - { name: "superToken", internalType: "address", type: "address" }, - { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, ], - name: "getWrapSchedule", + name: "getAgreementClass", outputs: [ { - name: "", - internalType: "struct IManager.WrapSchedule", - type: "tuple", - components: [ - { name: "user", internalType: "address", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperToken", - type: "address", - }, - { - name: "strategy", - internalType: "contract IStrategy", - type: "address", - }, - { name: "liquidityToken", internalType: "address", type: "address" }, - { name: "expiry", internalType: "uint64", type: "uint64" }, - { name: "lowerLimit", internalType: "uint64", type: "uint64" }, - { name: "upperLimit", internalType: "uint64", type: "uint64" }, - ], + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", }, ], }, { stateMutability: "view", type: "function", - inputs: [{ name: "index", internalType: "bytes32", type: "bytes32" }], - name: "getWrapScheduleByIndex", - outputs: [ - { - name: "", - internalType: "struct IManager.WrapSchedule", - type: "tuple", - components: [ - { name: "user", internalType: "address", type: "address" }, - { - name: "superToken", - internalType: "contract ISuperToken", - type: "address", - }, - { - name: "strategy", - internalType: "contract IStrategy", - type: "address", - }, - { name: "liquidityToken", internalType: "address", type: "address" }, - { name: "expiry", internalType: "uint64", type: "uint64" }, - { name: "lowerLimit", internalType: "uint64", type: "uint64" }, - { name: "upperLimit", internalType: "uint64", type: "uint64" }, - ], - }, + inputs: [ + { name: "appAddr", internalType: "contract ISuperApp", type: "address" }, ], + name: "getAppCallbackLevel", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], }, { - stateMutability: "pure", + stateMutability: "view", type: "function", inputs: [ - { name: "user", internalType: "address", type: "address" }, - { name: "superToken", internalType: "address", type: "address" }, - { name: "liquidityToken", internalType: "address", type: "address" }, + { name: "app", internalType: "contract ISuperApp", type: "address" }, + ], + name: "getAppManifest", + outputs: [ + { name: "isSuperApp", internalType: "bool", type: "bool" }, + { name: "isJailed", internalType: "bool", type: "bool" }, + { name: "noopMask", internalType: "uint256", type: "uint256" }, ], - name: "getWrapScheduleIndex", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], }, { stateMutability: "view", type: "function", inputs: [], - name: "minLower", - outputs: [{ name: "", internalType: "uint64", type: "uint64" }], + name: "getCodeAddress", + outputs: [ + { name: "codeAddress", internalType: "address", type: "address" }, + ], }, { stateMutability: "view", type: "function", inputs: [], - name: "minUpper", - outputs: [{ name: "", internalType: "uint64", type: "uint64" }], + name: "getGovernance", + outputs: [ + { + name: "", + internalType: "contract ISuperfluidGovernance", + type: "address", + }, + ], }, { stateMutability: "view", type: "function", inputs: [], - name: "owner", - outputs: [{ name: "", internalType: "address", type: "address" }], + name: "getNow", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "strategy", internalType: "address", type: "address" }], - name: "removeApprovedStrategy", - outputs: [], + inputs: [], + name: "getSuperTokenFactory", + outputs: [ + { + name: "factory", + internalType: "contract ISuperTokenFactory", + type: "address", + }, + ], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", inputs: [], - name: "renounceOwnership", - outputs: [], + name: "getSuperTokenFactoryLogic", + outputs: [{ name: "logic", internalType: "address", type: "address" }], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "lowerLimit", internalType: "uint64", type: "uint64" }, - { name: "upperLimit", internalType: "uint64", type: "uint64" }, + { + name: "gov", + internalType: "contract ISuperfluidGovernance", + type: "address", + }, ], - name: "setLimits", + name: "initialize", outputs: [], }, { - stateMutability: "nonpayable", + stateMutability: "view", type: "function", - inputs: [{ name: "newOwner", internalType: "address", type: "address" }], - name: "transferOwnership", - outputs: [], - }, -] as const; - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x0B82D14E9616ca4d260E77454834AdCf5887595F) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x3eAB3c6207F488E475b7955B631B564F0E6317B9) - */ -export const autoWrapManagerAddress = { - 1: "0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1", - 5: "0x0B82D14E9616ca4d260E77454834AdCf5887595F", - 10: "0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23", - 56: "0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325", - 100: "0x8082e58681350876aFe8f52d3Bf8672034A03Db0", - 137: "0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32", - 42161: "0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272", - 43113: "0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1", - 43114: "0x8082e58681350876aFe8f52d3Bf8672034A03Db0", - 80001: "0x3eAB3c6207F488E475b7955B631B564F0E6317B9", -} as const; - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x0B82D14E9616ca4d260E77454834AdCf5887595F) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x1fA76f2Cd0C3fe6c399A80111408d9C42C0CAC23) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x2AcdD61ac1EFFe1535109449c31889bdE8d7f325) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x2581c27E7f6D6AF452E63fCe884EDE3EDd716b32) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xf01825eAFAe5CD1Dab5593EFAF218efC8968D272) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x30aE282CF477E2eF28B14d0125aCEAd57Fe1d7a1) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x8082e58681350876aFe8f52d3Bf8672034A03Db0) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x3eAB3c6207F488E475b7955B631B564F0E6317B9) - */ -export const autoWrapManagerConfig = { - address: autoWrapManagerAddress, - abi: autoWrapManagerABI, -} as const; - -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// -// AutoWrapStrategy -////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - -/** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x342076aA957B0ec8bC1d3893af719b288eA31e61) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x544728AFDBeEafBeC9e1329031788edb53017bC4) - */ -export const autoWrapStrategyABI = [ - { - stateMutability: "nonpayable", - type: "constructor", - inputs: [{ name: "_manager", internalType: "address", type: "address" }], + inputs: [ + { + name: "agreementClass", + internalType: "contract ISuperAgreement", + type: "address", + }, + ], + name: "isAgreementClassListed", + outputs: [{ name: "yes", internalType: "bool", type: "bool" }], }, { - type: "error", + stateMutability: "view", + type: "function", inputs: [ - { name: "caller", internalType: "address", type: "address" }, - { name: "expectedCaller", internalType: "address", type: "address" }, + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, ], - name: "UnauthorizedCaller", + name: "isAgreementTypeListed", + outputs: [{ name: "yes", internalType: "bool", type: "bool" }], }, { - type: "error", - inputs: [{ name: "superToken", internalType: "address", type: "address" }], - name: "UnsupportedSuperToken", + stateMutability: "view", + type: "function", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + ], + name: "isApp", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, - { type: "error", inputs: [], name: "ZeroAddress" }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ - { - name: "receiver", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "token", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "amount", - internalType: "uint256", - type: "uint256", - indexed: false, - }, + { name: "app", internalType: "contract ISuperApp", type: "address" }, ], - name: "EmergencyWithdrawInitiated", + name: "isAppJailed", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, { - name: "oldManager", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "manager", - internalType: "address", + name: "targetApp", + internalType: "contract ISuperApp", type: "address", - indexed: true, }, ], - name: "ManagerChanged", + name: "isCompositeAppAllowed", + outputs: [{ name: "", internalType: "bool", type: "bool" }], }, { - type: "event", - anonymous: false, + stateMutability: "view", + type: "function", + inputs: [{ name: "ctx", internalType: "bytes", type: "bytes" }], + name: "isCtxValid", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "forwarder", internalType: "address", type: "address" }], + name: "isTrustedForwarder", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", inputs: [ + { name: "ctx", internalType: "bytes", type: "bytes" }, + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "reason", internalType: "uint256", type: "uint256" }, + ], + name: "jailApp", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "bitmap", internalType: "uint256", type: "uint256" }], + name: "mapAgreementClasses", + outputs: [ { - name: "previousOwner", - internalType: "address", - type: "address", - indexed: true, - }, - { - name: "newOwner", - internalType: "address", - type: "address", - indexed: true, + name: "agreementClasses", + internalType: "contract ISuperAgreement[]", + type: "address[]", }, ], - name: "OwnershipTransferred", }, { - type: "event", - anonymous: false, + stateMutability: "pure", + type: "function", + inputs: [], + name: "proxiableUUID", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + }, + { + stateMutability: "nonpayable", + type: "function", inputs: [ - { name: "user", internalType: "address", type: "address", indexed: true }, { - name: "superToken", - internalType: "address", + name: "agreementClassLogic", + internalType: "contract ISuperAgreement", type: "address", - indexed: true, - }, - { - name: "superTokenAmount", - internalType: "uint256", - type: "uint256", - indexed: false, }, ], - name: "Wrapped", + name: "registerAgreementClass", + outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "newManager", internalType: "address", type: "address" }], - name: "changeManager", + inputs: [{ name: "configWord", internalType: "uint256", type: "uint256" }], + name: "registerApp", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "token", internalType: "address", type: "address" }], - name: "emergencyWithdraw", + inputs: [ + { name: "app", internalType: "contract ISuperApp", type: "address" }, + { name: "configWord", internalType: "uint256", type: "uint256" }, + ], + name: "registerAppByFactory", outputs: [], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", inputs: [ - { - name: "superToken", - internalType: "contract ISuperToken", - type: "address", - }, + { name: "configWord", internalType: "uint256", type: "uint256" }, + { name: "registrationKey", internalType: "string", type: "string" }, ], - name: "isSupportedSuperToken", - outputs: [{ name: "", internalType: "bool", type: "bool" }], + name: "registerAppWithKey", + outputs: [], }, { stateMutability: "view", type: "function", - inputs: [], - name: "manager", - outputs: [{ name: "", internalType: "address", type: "address" }], + inputs: [ + { name: "bitmap", internalType: "uint256", type: "uint256" }, + { name: "agreementType", internalType: "bytes32", type: "bytes32" }, + ], + name: "removeFromAgreementClassesBitmap", + outputs: [{ name: "newBitmap", internalType: "uint256", type: "uint256" }], }, { - stateMutability: "view", + stateMutability: "nonpayable", type: "function", - inputs: [], - name: "owner", - outputs: [{ name: "", internalType: "address", type: "address" }], + inputs: [ + { + name: "newGov", + internalType: "contract ISuperfluidGovernance", + type: "address", + }, + ], + name: "replaceGovernance", + outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [], - name: "renounceOwnership", + inputs: [ + { + name: "agreementClassLogic", + internalType: "contract ISuperAgreement", + type: "address", + }, + ], + name: "updateAgreementClass", outputs: [], }, { stateMutability: "nonpayable", type: "function", - inputs: [{ name: "newOwner", internalType: "address", type: "address" }], - name: "transferOwnership", + inputs: [{ name: "newAddress", internalType: "address", type: "address" }], + name: "updateCode", outputs: [], }, { stateMutability: "nonpayable", type: "function", inputs: [ - { name: "user", internalType: "address", type: "address" }, { - name: "superToken", - internalType: "contract ISuperToken", + name: "newFactory", + internalType: "contract ISuperTokenFactory", type: "address", }, - { name: "superTokenAmount", internalType: "uint256", type: "uint256" }, ], - name: "wrap", + name: "updateSuperTokenFactory", + outputs: [], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "token", internalType: "contract ISuperToken", type: "address" }, + { name: "newLogicOverride", internalType: "address", type: "address" }, + ], + name: "updateSuperTokenLogic", outputs: [], }, + { + stateMutability: "pure", + type: "function", + inputs: [], + name: "versionRecipient", + outputs: [{ name: "", internalType: "string", type: "string" }], + }, ] as const; /** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x342076aA957B0ec8bC1d3893af719b288eA31e61) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x544728AFDBeEafBeC9e1329031788edb53017bC4) + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) */ -export const autoWrapStrategyAddress = { - 1: "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d", - 5: "0xea49AF829D3E28d3eC49E0e0a0Ba1E7860A56F60", - 10: "0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4", - 56: "0x9e308cb079ae130790F604b1030cDf386670f199", - 100: "0x51FBAbD31A615E14b1bC12E9d887f60997264a4E", - 137: "0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b", - 42161: "0x342076aA957B0ec8bC1d3893af719b288eA31e61", - 43113: "0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d", - 43114: "0x51FBAbD31A615E14b1bC12E9d887f60997264a4E", - 80001: "0x544728AFDBeEafBeC9e1329031788edb53017bC4", +export const superfluidHostAddress = { + 1: "0x4E583d9390082B65Bef884b629DFA426114CED6d", + 5: "0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9", + 10: "0x567c4B141ED61923967cA25Ef4906C8781069a10", + 56: "0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E", + 100: "0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7", + 137: "0x3E14dC1b13c488a8d5D310918780c983bD5982E7", + 420: "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", + 1442: "0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704", + 8453: "0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74", + 42161: "0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192", + 42220: "0xA4Ff07cF81C02CFD356184879D953970cA957585", + 43113: "0x85Fe79b998509B77BF10A8BD4001D58475D29386", + 43114: "0x60377C7016E4cdB03C87EF474896C11cB560752C", + 80001: "0xEB796bdb90fFA0f28255275e16936D25d3418603", + 84531: "0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6", + 421613: "0xE40983C2476032A0915600b9472B3141aA5B5Ba9", + 11155111: "0x109412E3C84f0539b43d39dB691B08c90f58dC7c", } as const; /** - * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xea49af829d3e28d3ec49e0e0a0ba1e7860a56f60) - * - [__View Contract on Optimism Optimism Explorer__](https://explorer.optimism.io/address/0x0Cf060a501c0040e9CCC708eFE94079F501c6Bb4) - * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0x9e308cb079ae130790F604b1030cDf386670f199) - * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet//address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) - * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0xb4afa36BAd8c76976Dc77a21c9Ad711EF720eE4b) - * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0x342076aA957B0ec8bC1d3893af719b288eA31e61) - * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x1D65c6d3AD39d454Ea8F682c49aE7744706eA96d) - * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x51FBAbD31A615E14b1bC12E9d887f60997264a4E) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x544728AFDBeEafBeC9e1329031788edb53017bC4) + * - [__View Contract on Ethereum Etherscan__](https://etherscan.io/address/0x4E583d9390082B65Bef884b629DFA426114CED6d) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x22ff293e14F1EC3A09B137e9e06084AFd63adDF9) + * - [__View Contract on Op Mainnet Optimism Explorer__](https://explorer.optimism.io/address/0x567c4B141ED61923967cA25Ef4906C8781069a10) + * - [__View Contract on Bnb Smart Chain Bsc Scan__](https://bscscan.com/address/0xd1e2cFb6441680002Eb7A44223160aB9B67d7E6E) + * - [__View Contract on Gnosis Gnosis Chain Explorer__](https://blockscout.com/xdai/mainnet/address/0x2dFe937cD98Ab92e59cF3139138f18c823a4efE7) + * - [__View Contract on Polygon Polygon Scan__](https://polygonscan.com/address/0x3E14dC1b13c488a8d5D310918780c983bD5982E7) + * - [__View Contract on Optimism Goerli Etherscan__](https://goerli-optimism.etherscan.io/address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Polygon Zk Evm Testnet Polygon Scan__](https://testnet-zkevm.polygonscan.com/address/0xe64f81d5dDdA1c7172e5C6d964E8ef1BD82D8704) + * - [__View Contract on Base Basescan__](https://basescan.org/address/0x4C073B3baB6d8826b8C5b229f3cfdC1eC6E47E74) + * - [__View Contract on Arbitrum One Arbiscan__](https://arbiscan.io/address/0xCf8Acb4eF033efF16E8080aed4c7D5B9285D2192) + * - [__View Contract on Celo Celo Explorer__](https://explorer.celo.org/mainnet/address/0xA4Ff07cF81C02CFD356184879D953970cA957585) + * - [__View Contract on Avalanche Fuji Snow Trace__](https://testnet.snowtrace.io/address/0x85Fe79b998509B77BF10A8BD4001D58475D29386) + * - [__View Contract on Avalanche Snow Trace__](https://snowtrace.io/address/0x60377C7016E4cdB03C87EF474896C11cB560752C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xEB796bdb90fFA0f28255275e16936D25d3418603) + * - [__View Contract on Base Goerli Basescan__](https://goerli.basescan.org/address/0x507c3a7C6Ccc253884A2e3a3ee2A211cC7E796a6) + * - [__View Contract on Arbitrum Goerli Arbiscan__](https://goerli.arbiscan.io//address/0xE40983C2476032A0915600b9472B3141aA5B5Ba9) + * - [__View Contract on Sepolia Etherscan__](https://sepolia.etherscan.io/address/0x109412E3C84f0539b43d39dB691B08c90f58dC7c) */ -export const autoWrapStrategyConfig = { - address: autoWrapStrategyAddress, - abi: autoWrapStrategyABI, +export const superfluidHostConfig = { + address: superfluidHostAddress, + abi: superfluidHostABI, } as const; diff --git a/packages/widget/wagmi.config.ts b/packages/widget/wagmi.config.ts index eb929dd6..935d6d77 100644 --- a/packages/widget/wagmi.config.ts +++ b/packages/widget/wagmi.config.ts @@ -75,7 +75,7 @@ export default defineConfig({ contracts: [ { name: "SuperUpgrader", - address: "0x80a18e53a1761cba151af445640c06046f0b62a5", + address: "0xb7db015aa9f37142340c94f09c543ad51b53e961", }, { name: "CFAv1Forwarder", From 84d91f1833b3507de6849772d8c2041649df367a Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 8 Sep 2023 10:08:37 +0000 Subject: [PATCH 06/46] add goerli support --- .../widget-preview/WidgetPreview.tsx | 33 +++++++++++++++++-- packages/widget/src/CommandMapper.tsx | 5 +-- packages/widget/src/core/wagmi-generated.ts | 10 ++++-- packages/widget/wagmi.config.ts | 7 ++-- 4 files changed, 44 insertions(+), 11 deletions(-) diff --git a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx index e07b95a2..5ed8766c 100644 --- a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx +++ b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx @@ -21,7 +21,7 @@ import { import useFontLoader from "../../hooks/useFontLoader"; -const permitTokens: TokenInfo[] = [ +const mumbaiPermitTokens: TokenInfo[] = [ { address: "0x50c988f2c2cce525cc2067c93b8c4a43ec62a166", name: "PERMIT: Super fUSDC Fake Token", @@ -50,9 +50,38 @@ const permitTokens: TokenInfo[] = [ }, ]; +const goerliPermitTokens: TokenInfo[] = [ + { + address: "0x19E6F96A887D0a27d60ef63942d7BF707fb1aD08", + name: "PERMIT: Super fUSDC Fake Token", + symbol: "pfUSDCx", + decimals: 18, + chainId: 5, + extensions: { + superTokenInfo: { + type: "Wrapper", + underlyingTokenAddress: "0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC", + }, + }, + logoURI: + "https://raw.githubusercontent.com/superfluid-finance/assets/master/public/tokens/usdc/icon.svg", + tags: ["supertoken", "testnet"], + }, + { + address: "0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC", + name: "PERMIT: fUSDC Fake Token", + symbol: "pfUSDC", + decimals: 18, + chainId: 5, + logoURI: + "https://raw.githubusercontent.com/superfluid-finance/assets/master/public/tokens/usdc/icon.svg", + tags: ["underlying", "testnet"], + }, +]; + export const widgetTokenList = { ...tokenList, - tokens: [...tokenList.tokens, ...permitTokens], + tokens: [...tokenList.tokens, ...mumbaiPermitTokens, ...goerliPermitTokens], } as SuperTokenList; export interface FontSettings { diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 4bc0ebf8..a0323e9c 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -38,9 +38,6 @@ import { import { ChildrenProp, MaxUint256 } from "./utils.js"; import { useWidget } from "./WidgetContext.js"; -const NONCES_FN = "0x7ecebe00"; -const NAME_FN = "0x06fdde03"; - type CommandMapperProps = { command: TCommand; onMapped?: (contractWrites: ReadonlyArray) => void; @@ -181,7 +178,7 @@ export function SuperWrapIntoSuperTokensCommandMapper({ value: BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), - nonce: 7, // TODO(KK): Read it on-chain + nonce: 1, // TODO(KK): Read it on-chain deadline: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", }, diff --git a/packages/widget/src/core/wagmi-generated.ts b/packages/widget/src/core/wagmi-generated.ts index b5f38f21..da423e4d 100644 --- a/packages/widget/src/core/wagmi-generated.ts +++ b/packages/widget/src/core/wagmi-generated.ts @@ -3264,7 +3264,8 @@ export const superTokenABI = [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) */ export const superUpgraderABI = [ { @@ -3556,14 +3557,17 @@ export const superUpgraderABI = [ ] as const; /** - * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) */ export const superUpgraderAddress = { + 5: "0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C", 80001: "0xb7DB015AA9F37142340C94F09c543Ad51B53e961", } as const; /** - * [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) */ export const superUpgraderConfig = { address: superUpgraderAddress, diff --git a/packages/widget/wagmi.config.ts b/packages/widget/wagmi.config.ts index 935d6d77..76a24ec2 100644 --- a/packages/widget/wagmi.config.ts +++ b/packages/widget/wagmi.config.ts @@ -71,11 +71,14 @@ export default defineConfig({ }), etherscan({ apiKey: "WW2B6KB1FAXNTWP8EJQJYFTK1CMG1W4DWZ", - chainId: 80001, + chainId: 5, contracts: [ { name: "SuperUpgrader", - address: "0xb7db015aa9f37142340c94f09c543ad51b53e961", + address: { + 80001: "0xb7db015aa9f37142340c94f09c543ad51b53e961", + 5: "0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C", + }, }, { name: "CFAv1Forwarder", From 7b40528b3bf8cbfe48a05066d494ba671d249543 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 8 Sep 2023 10:41:32 +0000 Subject: [PATCH 07/46] make batch call payable --- .../widget/src/CommandHandlerProvider.tsx | 20 +- packages/widget/src/CommandMapper.tsx | 26 ++- packages/widget/src/ContractWrite.ts | 1 + packages/widget/src/ContractWriteButton.tsx | 47 ++-- packages/widget/src/ContractWriteManager.tsx | 4 - packages/widget/src/core/wagmi-generated.ts | 214 +++++++++++++++++- packages/widget/wagmi.config.ts | 7 + 7 files changed, 283 insertions(+), 36 deletions(-) diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index b5c3a169..20de03b7 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -102,15 +102,25 @@ export function CommandHandlerProvider({ children }: Props) { (x) => x.signatureRequest, )?.signatureRequest, materialize: (signature) => { - const args = [ - contractWrites.map( - (x) => x.materializeForBatchCall!(signature)!, - ), - ] as const; // TODO(KK): bangs + let value = 0n; + const individualCalls = contractWrites.map( + (x) => { + const materialized = + x.materializeForBatchCall!(signature)!; + value += materialized.value; + return { + operationType: materialized.operationType, + target: materialized.target, + data: materialized.data, + }; + }, + ); + const args = [individualCalls] as const; // TODO(KK): bangs return { abi: superfluidHostABI, address: superfluidHostAddress[chainId], functionName: "batchCall", + value: value, args, }; }, diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index a0323e9c..759381b9 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -31,6 +31,7 @@ import { erc20ABI, mapTimePeriodToSeconds, nativeAssetSuperTokenABI, + permitUnderlyingABI, superTokenABI, superUpgraderABI, superUpgraderAddress, @@ -78,6 +79,18 @@ export function SuperWrapIntoSuperTokensCommandMapper({ : undefined, ); + const { data: nonce, isLoading: isNonceLoading } = useContractRead( + !isNativeAssetUnderlyingToken + ? { + chainId: cmd.chainId, + address: cmd.underlyingToken.address, + abi: permitUnderlyingABI, + functionName: "nonces", + args: [cmd.accountAddress], + } + : undefined, + ); + const contractWrites = useMemo(() => { const contractWrites_: ContractWrite[] = []; @@ -178,7 +191,7 @@ export function SuperWrapIntoSuperTokensCommandMapper({ value: BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), - nonce: 1, // TODO(KK): Read it on-chain + nonce: nonce, deadline: "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", }, @@ -248,7 +261,7 @@ export function SuperWrapIntoSuperTokensCommandMapper({ } return contractWrites_; - }, [cmd.id, isSuccess]); + }, [cmd.id, isSuccess, nonce]); useEffect( () => (isSuccess ? onMapped?.(contractWrites) : void 0), @@ -639,10 +652,15 @@ const createContractWrite = < "0x", ]); - return { operationType, target, data }; + return { operationType, target, data, value: call.value ?? 0n }; } else { const callData = encodeFunctionData(call); - return { operationType, target, data: callData }; + return { + operationType, + target, + data: callData, + value: call.value ?? 0n, + }; } }, }) as ContractWrite; diff --git a/packages/widget/src/ContractWrite.ts b/packages/widget/src/ContractWrite.ts index 783329ac..12cd0fae 100644 --- a/packages/widget/src/ContractWrite.ts +++ b/packages/widget/src/ContractWrite.ts @@ -25,5 +25,6 @@ export type ContractWrite = { operationType: number; target: Address; data: ReturnType; + value: bigint; }>; }; diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index a7614b26..260a29d3 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -58,29 +58,32 @@ export default function ContractWriteButton({ ) : ( <> - {Boolean(contractWrite.signatureRequest && !signatureResult.data) && ( - <> - - {signatureResult.isError &&
Error signing message
} - + {Boolean(contractWrite.signatureRequest && !signatureResult.data) ? ( + signatureResult.signTypedData()} + > + Sign + + ) : ( + + {contractWrite.displayTitle} + )} - - {contractWrite.displayTitle} - )}
diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index 9e71d5a6..41698b1a 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -51,10 +51,6 @@ export function ContractWriteManager({ prepare ? materialized : undefined, ); - console.log({ - materialized, - }); - const writeResult = useContractWrite( prepareResult.isSuccess ? prepareResult.config diff --git a/packages/widget/src/core/wagmi-generated.ts b/packages/widget/src/core/wagmi-generated.ts index da423e4d..b23b6a3b 100644 --- a/packages/widget/src/core/wagmi-generated.ts +++ b/packages/widget/src/core/wagmi-generated.ts @@ -2101,6 +2101,218 @@ export const nativeAssetSuperTokenABI = [ { stateMutability: "payable", type: "receive" }, ] as const; +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// +// PermitUnderlying +////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + +/** + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x60974a03baaa984ea79f4590ac1e88aaae31158a) + */ +export const permitUnderlyingABI = [ + { + stateMutability: "nonpayable", + type: "constructor", + inputs: [ + { name: "_name", internalType: "string", type: "string" }, + { name: "_symbol", internalType: "string", type: "string" }, + ], + }, + { + type: "event", + anonymous: false, + inputs: [ + { + name: "owner", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "spender", + internalType: "address", + type: "address", + indexed: true, + }, + { + name: "value", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + ], + name: "Approval", + }, + { + type: "event", + anonymous: false, + inputs: [ + { name: "from", internalType: "address", type: "address", indexed: true }, + { name: "to", internalType: "address", type: "address", indexed: true }, + { + name: "value", + internalType: "uint256", + type: "uint256", + indexed: false, + }, + ], + name: "Transfer", + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "DOMAIN_SEPARATOR", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "owner", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + ], + name: "allowance", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "spender", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + ], + name: "approve", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "balanceOf", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "decimals", + outputs: [{ name: "", internalType: "uint8", type: "uint8" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "spender", internalType: "address", type: "address" }, + { name: "subtractedValue", internalType: "uint256", type: "uint256" }, + ], + name: "decreaseAllowance", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "spender", internalType: "address", type: "address" }, + { name: "addedValue", internalType: "uint256", type: "uint256" }, + ], + name: "increaseAllowance", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "account", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + ], + name: "mint", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "name", + outputs: [{ name: "", internalType: "string", type: "string" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [{ name: "owner", internalType: "address", type: "address" }], + name: "nonces", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "owner", internalType: "address", type: "address" }, + { name: "spender", internalType: "address", type: "address" }, + { name: "value", internalType: "uint256", type: "uint256" }, + { name: "deadline", internalType: "uint256", type: "uint256" }, + { name: "v", internalType: "uint8", type: "uint8" }, + { name: "r", internalType: "bytes32", type: "bytes32" }, + { name: "s", internalType: "bytes32", type: "bytes32" }, + ], + name: "permit", + outputs: [], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "symbol", + outputs: [{ name: "", internalType: "string", type: "string" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "totalSupply", + outputs: [{ name: "", internalType: "uint256", type: "uint256" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "to", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + ], + name: "transfer", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { name: "from", internalType: "address", type: "address" }, + { name: "to", internalType: "address", type: "address" }, + { name: "amount", internalType: "uint256", type: "uint256" }, + ], + name: "transferFrom", + outputs: [{ name: "", internalType: "bool", type: "bool" }], + }, +] as const; + +/** + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x60974a03baaa984ea79f4590ac1e88aaae31158a) + */ +export const permitUnderlyingAddress = { + 5: "0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC", + 80001: "0x60974a03baaa984EA79f4590AC1E88aaAE31158a", +} as const; + +/** + * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC) + * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0x60974a03baaa984ea79f4590ac1e88aaae31158a) + */ +export const permitUnderlyingConfig = { + address: permitUnderlyingAddress, + abi: permitUnderlyingABI, +} as const; + ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Pure Super Token ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @@ -4704,7 +4916,7 @@ export const superfluidHostABI = [ outputs: [{ name: "appCtx", internalType: "bytes", type: "bytes" }], }, { - stateMutability: "nonpayable", + stateMutability: "payable", // TODO(KK): I manually changed to 'payable'. type: "function", inputs: [ { diff --git a/packages/widget/wagmi.config.ts b/packages/widget/wagmi.config.ts index 76a24ec2..9aa84228 100644 --- a/packages/widget/wagmi.config.ts +++ b/packages/widget/wagmi.config.ts @@ -80,6 +80,13 @@ export default defineConfig({ 5: "0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C", }, }, + { + name: "PermitUnderlying", + address: { + 80001: "0x60974a03baaa984ea79f4590ac1e88aaae31158a", + 5: "0xc3cA859682786B0f97Fa9c1239C249cbBb20cDaC", + }, + }, { name: "CFAv1Forwarder", address: superfluidMetadata.networks.reduce( From 5cbb9bd75bff8f3d95951030e301890eb892d02f Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 8 Sep 2023 11:04:20 +0000 Subject: [PATCH 08/46] handle non-permit tokens --- .../widget-preview/WidgetPreview.tsx | 4 +-- .../widget/src/CommandHandlerProvider.tsx | 7 +++- packages/widget/src/CommandMapper.tsx | 20 +++++++---- packages/widget/src/ContractWriteStatus.tsx | 26 +++++++------- packages/widget/src/StepContentReview.tsx | 4 +-- packages/widget/src/commands.ts | 34 +------------------ packages/widget/src/formValuesToCommands.ts | 2 +- 7 files changed, 39 insertions(+), 58 deletions(-) diff --git a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx index 5ed8766c..d63b347c 100644 --- a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx +++ b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx @@ -46,7 +46,7 @@ const mumbaiPermitTokens: TokenInfo[] = [ chainId: 80001, logoURI: "https://raw.githubusercontent.com/superfluid-finance/assets/master/public/tokens/usdc/icon.svg", - tags: ["underlying", "testnet"], + tags: ["permit", "underlying", "testnet"], }, ]; @@ -75,7 +75,7 @@ const goerliPermitTokens: TokenInfo[] = [ chainId: 5, logoURI: "https://raw.githubusercontent.com/superfluid-finance/assets/master/public/tokens/usdc/icon.svg", - tags: ["underlying", "testnet"], + tags: ["permit", "underlying", "testnet"], }, ]; diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index 20de03b7..64428f90 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -205,6 +205,11 @@ const createContractWrite = < const [operationType, target, call] = arg.materializeForBatchCall(signature); - return { operationType, target, data: encodeFunctionData(call) }; + return { + operationType, + target, + data: encodeFunctionData(call), + value: call.value, + }; }, }) as ContractWrite; diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 759381b9..5a98d2a2 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -16,7 +16,6 @@ import { Command, EnableAutoWrapCommand, SubscribeCommand, - SuperWrapIntoSuperTokensCommand, WrapIntoSuperTokensCommand, } from "./commands.js"; import { ContractWrite } from "./ContractWrite.js"; @@ -46,23 +45,32 @@ type CommandMapperProps = { }; export function CommandMapper({ command: cmd, ...props }: CommandMapperProps) { + const { getUnderlyingToken } = useWidget(); + switch (cmd.type) { case "Enable Auto-Wrap": return ; case "Wrap into Super Tokens": - return ; + const underlyingToken = cmd.underlyingToken.address + ? getUnderlyingToken(cmd.underlyingToken.address) + : undefined; + if (underlyingToken && underlyingToken.tags?.includes("permit")) { + return ( + + ); + } else { + return ; + } case "Subscribe": return ; - case "Super Wrap into Super Tokens": - return ; } } -export function SuperWrapIntoSuperTokensCommandMapper({ +export function PermitWrapIntoSuperTokensCommandMapper({ command: cmd, onMapped, children, -}: CommandMapperProps) { +}: CommandMapperProps) { const { getSuperToken, getUnderlyingToken } = useWidget(); const isNativeAssetUnderlyingToken = cmd.underlyingToken.isNativeAsset; diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index ee9bd4c2..ce7143f1 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -11,6 +11,8 @@ export function ContractWriteStatus( index: number, ) { const { + contractWrite, + signatureResult, contractWrite: { id, displayTitle }, transactionResult, writeResult, @@ -44,18 +46,18 @@ export function ContractWriteStatus( }. ${displayTitle}`} - {!latestError && ( - - { - // latestError ? "Something went wrong." this is a temporary fix - transactionResult.isSuccess - ? "Completed" - : writeResult?.isSuccess - ? "In progress" - : "Not started" - } - - )} + + { + // latestError ? "Something went wrong." this is a temporary fix + transactionResult.isSuccess + ? "Completed" + : writeResult?.isSuccess + ? "In progress" + : contractWrite.signatureRequest && !signatureResult.data + ? "Needs signature" + : "Not started" + } +
); diff --git a/packages/widget/src/StepContentReview.tsx b/packages/widget/src/StepContentReview.tsx index 305da551..345bca16 100644 --- a/packages/widget/src/StepContentReview.tsx +++ b/packages/widget/src/StepContentReview.tsx @@ -33,9 +33,7 @@ export default function StepContentReview() { async () => await commandValidationSchema.safeParseAsync({ wrapIntoSuperTokensCommand: commands.find( - (x) => - x.type === "Wrap into Super Tokens" || - x.type === "Super Wrap into Super Tokens", // TODO(KK) + (x) => x.type === "Wrap into Super Tokens", ), subscribeCommand: commands.find((x) => x.type === "Subscribe"), }), diff --git a/packages/widget/src/commands.ts b/packages/widget/src/commands.ts index cad6e5ab..ef22ac53 100644 --- a/packages/widget/src/commands.ts +++ b/packages/widget/src/commands.ts @@ -24,28 +24,6 @@ export type WrapIntoSuperTokensCommand = { amountWeiFromUnderlyingTokenDecimals: bigint; }; -export type SuperWrapIntoSuperTokensCommand = { - id: string; - type: "Super Wrap into Super Tokens"; - chainId: ChainId; - accountAddress: Address; - superTokenAddress: Address; - underlyingToken: - | { - isNativeAsset: false; - address: Address; - decimals: number; - } - | { - isNativeAsset: true; - address: undefined; - decimals: number; - }; - amountInUnits: `${number}`; - amountWeiFromSuperTokenDecimals: bigint; - amountWeiFromUnderlyingTokenDecimals: bigint; -}; - export type EnableAutoWrapCommand = { id: string; type: "Enable Auto-Wrap"; @@ -70,17 +48,7 @@ export type SubscribeCommand = { userData: `0x${string}`; }; -// export type BatchCallCommand = { -// id: string; -// type: "Batch"; -// chainId: ChainId; -// superTokenAddress: Address; -// innerWrites: Pick[] -// } - export type Command = | WrapIntoSuperTokensCommand | EnableAutoWrapCommand - | SubscribeCommand - | SuperWrapIntoSuperTokensCommand; -// | BatchCallCommand; + | SubscribeCommand; diff --git a/packages/widget/src/formValuesToCommands.ts b/packages/widget/src/formValuesToCommands.ts index c663edc8..01a6dc1b 100644 --- a/packages/widget/src/formValuesToCommands.ts +++ b/packages/widget/src/formValuesToCommands.ts @@ -54,7 +54,7 @@ export const formValuesToCommands = ( if (amountWeiFromUnderlyingTokenDecimals !== 0n) { commands.push({ id: nanoid(), - type: "Super Wrap into Super Tokens", + type: "Wrap into Super Tokens", chainId: chainId, superTokenAddress, accountAddress, From 4142377a2e8072d41127765d4e92089144784eaf Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 8 Sep 2023 12:05:21 +0000 Subject: [PATCH 09/46] make it possible to unbatch --- packages/widget/src/CommandHandlerContext.ts | 1 + .../widget/src/CommandHandlerProvider.tsx | 161 ++++++----- packages/widget/src/CommandMapper.tsx | 267 +++++++++--------- .../widget/src/StepContentTransactions.tsx | 2 + 4 files changed, 228 insertions(+), 203 deletions(-) diff --git a/packages/widget/src/CommandHandlerContext.ts b/packages/widget/src/CommandHandlerContext.ts index 770c9a16..830dd98b 100644 --- a/packages/widget/src/CommandHandlerContext.ts +++ b/packages/widget/src/CommandHandlerContext.ts @@ -13,6 +13,7 @@ export type CommandHandlerContextValue = { contractWriteResults: ReadonlyArray; sessionId: string | null; submitCommands: (commands: ReadonlyArray) => void; + setContractWrites: (contractWrites: ReadonlyArray) => void; writeIndex: number; }; diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index 64428f90..fc80fb30 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -1,6 +1,6 @@ -import { FormControlLabel, FormGroup, Switch } from "@mui/material"; +import { FormControlLabel, Switch } from "@mui/material"; import { nanoid } from "nanoid"; -import { useCallback, useMemo, useState } from "react"; +import { useCallback, useEffect, useMemo, useState } from "react"; import { Abi, Address, @@ -13,6 +13,7 @@ import { useSignTypedData } from "wagmi"; import { CommandHandlerContext, CommandHandlerContextValue, + useCommandHandler, } from "./CommandHandlerContext.js"; import { useCommandHandlerReducer } from "./commandHandlingReducer.js"; import { CommandMapper } from "./CommandMapper.js"; @@ -53,10 +54,19 @@ export function CommandHandlerProvider({ children }: Props) { [dispatch], ); - const [batch, setBatch] = useState(false); + const setContractWrites = useCallback( + (contractWrites: ReadonlyArray) => + void dispatch({ + type: "set contract writes", + payload: { + contractWrites: contractWrites, + }, + }), + [dispatch], + ); + const reset = useCallback(() => { void dispatch({ type: "reset" }); - setBatch(false); }, [dispatch]); const contextValue = useMemo( @@ -67,6 +77,7 @@ export function CommandHandlerProvider({ children }: Props) { contractWriteResults, sessionId, submitCommands, + setContractWrites, reset, writeIndex, }), @@ -75,69 +86,6 @@ export function CommandHandlerProvider({ children }: Props) { return ( <> - {Boolean(contractWrites.length) && ( - - { - setBatch(true); - - if ( - contractWrites.filter((x) => !x.materializeForBatchCall) - .length === 0 - ) { - const chainId = contractWrites[0] - .chainId as keyof typeof superfluidHostAddress; - dispatch({ - type: "set contract writes", - payload: { - contractWrites: [ - createContractWrite({ - commandId: nanoid(), - displayTitle: "Batch Call", - chainId: chainId, - signatureRequest: contractWrites.find( - (x) => x.signatureRequest, - )?.signatureRequest, - materialize: (signature) => { - let value = 0n; - const individualCalls = contractWrites.map( - (x) => { - const materialized = - x.materializeForBatchCall!(signature)!; - value += materialized.value; - return { - operationType: materialized.operationType, - target: materialized.target, - data: materialized.data, - }; - }, - ); - const args = [individualCalls] as const; // TODO(KK): bangs - return { - abi: superfluidHostABI, - address: superfluidHostAddress[chainId], - functionName: "batchCall", - value: value, - args, - }; - }, - }), - ], - }, - }); - } else { - console.log("Should not be here..."); - } - }} - /> - } - label="Batch?" - /> - - )} {typeof children === "function" ? children(contextValue) : children} {commands.map((cmd, commandIndex_) => ( @@ -175,6 +123,85 @@ export function CommandHandlerProvider({ children }: Props) { ); } +export function BatchHandler() { + const { contractWrites, sessionId, setContractWrites } = useCommandHandler(); + + const [batch, setBatch] = useState(false); + + useEffect(() => { + setBatch(false); + }, [sessionId]); + + const [beforeBatchWrites, setBeforeBatchWrites] = + useState | null>(null); + + return ( + { + if (checked) { + setBatch(true); + setBeforeBatchWrites(contractWrites); + + const batchableCalls = contractWrites.filter( + (x) => x.materializeForBatchCall, + ); + const nonBatchableCalls = contractWrites.filter( + (x) => !x.materializeForBatchCall, + ); + + const chainId = contractWrites[0] + .chainId as keyof typeof superfluidHostAddress; + + const newContractWrites = [ + ...nonBatchableCalls, + createContractWrite({ + commandId: nanoid(), + displayTitle: "Batch Call", + chainId: chainId, + signatureRequest: batchableCalls.find( + (x) => x.signatureRequest, + )?.signatureRequest, + materialize: (signature) => { + let value = 0n; + const individualCalls = batchableCalls.map((x) => { + const materialized = + x.materializeForBatchCall!(signature)!; + value += materialized.value; + return { + operationType: materialized.operationType, + target: materialized.target, + data: materialized.data, + }; + }); + const args = [individualCalls] as const; + return { + abi: superfluidHostABI, + address: superfluidHostAddress[chainId], + functionName: "batchCall", + value: value, + args, + }; + }, + }), + ]; + setContractWrites(newContractWrites); + } else { + setBatch(false); + setContractWrites(beforeBatchWrites!); + setBeforeBatchWrites(null); + } + }} + /> + } + label="Use batch call" + /> + ); +} + const createContractWrite = < TAbi extends Abi | readonly unknown[] = Abi, TFunctionName extends string = string, diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 5a98d2a2..bafa45c6 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -130,84 +130,113 @@ export function PermitWrapIntoSuperTokensCommandMapper({ ); } else { if (allowance !== undefined) { - if (true) { - // TODO(KK) - const underlyingTokenAddress = cmd.underlyingToken.address; - contractWrites_.push( - createContractWrite({ - commandId: cmd.id, - displayTitle: `Approve ${ - getUnderlyingToken(underlyingTokenAddress).symbol - } Allowance & Wrap`, - chainId: cmd.chainId, - signatureRequest: { - types: { - EIP712Domain: [ - { - name: "name", - type: "string", - }, - { - name: "version", - type: "string", - }, - { - name: "chainId", - type: "uint256", - }, - { - name: "verifyingContract", - type: "address", - }, + const underlyingTokenAddress = cmd.underlyingToken.address; + contractWrites_.push( + createContractWrite({ + commandId: cmd.id, + displayTitle: `Approve ${ + getUnderlyingToken(underlyingTokenAddress).symbol + } Allowance & Wrap`, + chainId: cmd.chainId, + signatureRequest: { + types: { + EIP712Domain: [ + { + name: "name", + type: "string", + }, + { + name: "version", + type: "string", + }, + { + name: "chainId", + type: "uint256", + }, + { + name: "verifyingContract", + type: "address", + }, + ], + Permit: [ + { + name: "owner", + type: "address", + }, + { + name: "spender", + type: "address", + }, + { + name: "value", + type: "uint256", + }, + { + name: "nonce", + type: "uint256", + }, + { + name: "deadline", + type: "uint256", + }, + ], + }, + primaryType: "Permit", + domain: { + name: "Fake Permit USDC", + version: "1", + chainId: cmd.chainId, + verifyingContract: underlyingTokenAddress, + }, + message: { + owner: cmd.accountAddress, + spender: + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress ], - Permit: [ - { - name: "owner", - type: "address", - }, - { - name: "spender", - type: "address", - }, - { - name: "value", - type: "uint256", - }, - { - name: "nonce", - type: "uint256", - }, - { - name: "deadline", - type: "uint256", - }, + value: BigInt( + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + ), + nonce: nonce, + deadline: + "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", + }, + }, + materialize: (signature) => { + const sig = hexToSignature(signature!); + + return { + abi: superUpgraderABI, + functionName: "manualUpgradeWithPermit", + address: + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress ], - }, - primaryType: "Permit", - domain: { - name: "Fake Permit USDC", - version: "1", - chainId: cmd.chainId, - verifyingContract: underlyingTokenAddress, - }, - message: { - owner: cmd.accountAddress, - spender: - superUpgraderAddress[ - cmd.chainId as keyof typeof superUpgraderAddress - ], - value: BigInt( + value: 100000000000000000n, + args: [ + cmd.amountWeiFromUnderlyingTokenDecimals, + BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), - nonce: nonce, - deadline: + BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - }, - }, - materialize: (signature) => { - const sig = hexToSignature(signature!); - - return { + ), + Number(sig.v.toString()), + sig.r, + sig.s, + "0x", + ] as const, + }; + }, + materializeForBatchCall: (signature) => { + const sig = hexToSignature(signature!); + + return [ + 202, + superUpgraderAddress[ + cmd.chainId as keyof typeof superUpgraderAddress + ], + { abi: superUpgraderABI, functionName: "manualUpgradeWithPermit", address: @@ -228,43 +257,11 @@ export function PermitWrapIntoSuperTokensCommandMapper({ sig.s, "0x", ] as const, - }; - }, - materializeForBatchCall: (signature) => { - const sig = hexToSignature(signature!); - - return [ - 202, - superUpgraderAddress[ - cmd.chainId as keyof typeof superUpgraderAddress - ], - { - abi: superUpgraderABI, - functionName: "manualUpgradeWithPermit", - address: - superUpgraderAddress[ - cmd.chainId as keyof typeof superUpgraderAddress - ], - value: 100000000000000000n, - args: [ - cmd.amountWeiFromUnderlyingTokenDecimals, - BigInt( - "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - ), - BigInt( - "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", - ), - Number(sig.v.toString()), - sig.r, - sig.s, - "0x", - ] as const, - }, - ]; - }, - }), - ); - } + }, + ]; + }, + }), + ); } } @@ -645,30 +642,28 @@ const createContractWrite = < ({ id: nanoid(), ...arg, // TODO(KK): handle gnosis safe bug - materializeForBatchCall: (signature) => { - if (!arg.materializeForBatchCall) { - return undefined; - } - - const [operationType, target, call] = - arg.materializeForBatchCall(signature); - - if (operationType === 201) { - const callData = encodeFunctionData(call); - const data = encodeAbiParameters(parseAbiParameters("bytes, bytes"), [ - callData, - "0x", - ]); - - return { operationType, target, data, value: call.value ?? 0n }; - } else { - const callData = encodeFunctionData(call); - return { - operationType, - target, - data: callData, - value: call.value ?? 0n, - }; - } - }, + materializeForBatchCall: !arg.materializeForBatchCall + ? undefined + : (signature) => { + const [operationType, target, call] = + arg.materializeForBatchCall!(signature); + + if (operationType === 201) { + const callData = encodeFunctionData(call); + const data = encodeAbiParameters( + parseAbiParameters("bytes, bytes"), + [callData, "0x"], + ); + + return { operationType, target, data, value: call.value ?? 0n }; + } else { + const callData = encodeFunctionData(call); + return { + operationType, + target, + data: callData, + value: call.value ?? 0n, + }; + } + }, }) as ContractWrite; diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index 2f5e78fd..cdf860a5 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -3,6 +3,7 @@ import { Box, IconButton, Stack, Typography } from "@mui/material"; import { useCallback, useEffect } from "react"; import { useCommandHandler } from "./CommandHandlerContext.js"; +import { BatchHandler } from "./CommandHandlerProvider.js"; import ContractWriteButton from "./ContractWriteButton.js"; import { ContractWriteCircularProgress } from "./ContractWriteCircularProgress.js"; import { ContractWriteStatus } from "./ContractWriteStatus.js"; @@ -55,6 +56,7 @@ export function StepContentTransactions() { + Date: Fri, 8 Sep 2023 12:37:30 +0000 Subject: [PATCH 10/46] add error logging --- packages/widget/src/ContractWriteStatus.tsx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index ce7143f1..15599727 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -1,5 +1,6 @@ import CircleIcon_ from "@mui/icons-material/Circle.js"; import { Paper, Stack, Typography, useTheme } from "@mui/material"; +import { useEffect } from "react"; import { ContractWriteResult } from "./ContractWriteManager.js"; import { normalizeIcon } from "./helpers/normalizeIcon.js"; @@ -21,6 +22,12 @@ export function ContractWriteStatus( const theme = useTheme(); + useEffect(() => { + if (latestError) { + console.error(latestError); + } + }, [latestError]); + const borderColor = // latestError // ? theme.palette.error.main //: temporary fix, don't show this for now From a12460597b7bcf4b1fb24fad39225601cf5b12a9 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 8 Sep 2023 12:57:02 +0000 Subject: [PATCH 11/46] Revert "add error logging" This reverts commit 80969c2e5cdfeb8dbaccca24d320596417c1024d. --- packages/widget/src/ContractWriteStatus.tsx | 7 ------- 1 file changed, 7 deletions(-) diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index 15599727..ce7143f1 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -1,6 +1,5 @@ import CircleIcon_ from "@mui/icons-material/Circle.js"; import { Paper, Stack, Typography, useTheme } from "@mui/material"; -import { useEffect } from "react"; import { ContractWriteResult } from "./ContractWriteManager.js"; import { normalizeIcon } from "./helpers/normalizeIcon.js"; @@ -22,12 +21,6 @@ export function ContractWriteStatus( const theme = useTheme(); - useEffect(() => { - if (latestError) { - console.error(latestError); - } - }, [latestError]); - const borderColor = // latestError // ? theme.palette.error.main //: temporary fix, don't show this for now From 355bfa7bb0dd6af63a5f38d0fa51f14af06dc1c5 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 15 Sep 2023 08:19:04 +0000 Subject: [PATCH 12/46] fix rendering issue --- .../widget/src/CommandHandlerProvider.tsx | 125 ++++++++++-------- packages/widget/src/ContractWriteStatus.tsx | 11 +- .../widget/src/StepContentPaymentOption.tsx | 2 +- .../widget/src/StepContentTransactions.tsx | 12 +- .../src/useSignificantFlowingDecimal.tsx | 2 +- 5 files changed, 88 insertions(+), 64 deletions(-) diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index fc80fb30..44fef054 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -1,4 +1,4 @@ -import { FormControlLabel, Switch } from "@mui/material"; +import { FormControlLabel, Switch, SwitchProps } from "@mui/material"; import { nanoid } from "nanoid"; import { useCallback, useEffect, useMemo, useState } from "react"; import { @@ -81,7 +81,17 @@ export function CommandHandlerProvider({ children }: Props) { reset, writeIndex, }), - [status, commands, contractWrites, contractWriteResults, sessionId], + [ + status, + commands, + contractWrites, + contractWriteResults, + sessionId, + submitCommands, + setContractWrites, + reset, + writeIndex, + ], ); return ( @@ -135,66 +145,69 @@ export function BatchHandler() { const [beforeBatchWrites, setBeforeBatchWrites] = useState | null>(null); + const onSwitchChange = useCallback["onChange"]>( + (_e, checked) => { + if (checked) { + setBatch(true); + setBeforeBatchWrites(contractWrites); + + const batchableCalls = contractWrites.filter( + (x) => x.materializeForBatchCall, + ); + const nonBatchableCalls = contractWrites.filter( + (x) => !x.materializeForBatchCall, + ); + + const chainId = contractWrites[0] + .chainId as keyof typeof superfluidHostAddress; + + const newContractWrites = [ + ...nonBatchableCalls, + createContractWrite({ + commandId: nanoid(), + displayTitle: "Batch Call", + chainId: chainId, + signatureRequest: batchableCalls.find((x) => x.signatureRequest) + ?.signatureRequest, + materialize: (signature) => { + let value = 0n; + const individualCalls = batchableCalls.map((x) => { + const materialized = x.materializeForBatchCall!(signature)!; + value += materialized.value; + return { + operationType: materialized.operationType, + target: materialized.target, + data: materialized.data, + }; + }); + const args = [individualCalls] as const; + return { + abi: superfluidHostABI, + address: superfluidHostAddress[chainId], + functionName: "batchCall", + value: value, + args, + }; + }, + }), + ]; + setContractWrites(newContractWrites); + } else { + setBatch(false); + setContractWrites(beforeBatchWrites!); + setBeforeBatchWrites(null); + } + }, + [contractWrites, beforeBatchWrites, setContractWrites], + ); + return ( { - if (checked) { - setBatch(true); - setBeforeBatchWrites(contractWrites); - - const batchableCalls = contractWrites.filter( - (x) => x.materializeForBatchCall, - ); - const nonBatchableCalls = contractWrites.filter( - (x) => !x.materializeForBatchCall, - ); - - const chainId = contractWrites[0] - .chainId as keyof typeof superfluidHostAddress; - - const newContractWrites = [ - ...nonBatchableCalls, - createContractWrite({ - commandId: nanoid(), - displayTitle: "Batch Call", - chainId: chainId, - signatureRequest: batchableCalls.find( - (x) => x.signatureRequest, - )?.signatureRequest, - materialize: (signature) => { - let value = 0n; - const individualCalls = batchableCalls.map((x) => { - const materialized = - x.materializeForBatchCall!(signature)!; - value += materialized.value; - return { - operationType: materialized.operationType, - target: materialized.target, - data: materialized.data, - }; - }); - const args = [individualCalls] as const; - return { - abi: superfluidHostABI, - address: superfluidHostAddress[chainId], - functionName: "batchCall", - value: value, - args, - }; - }, - }), - ]; - setContractWrites(newContractWrites); - } else { - setBatch(false); - setContractWrites(beforeBatchWrites!); - setBeforeBatchWrites(null); - } - }} + onChange={onSwitchChange} /> } label="Use batch call" diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index e248e4d9..907eb595 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -14,10 +14,13 @@ import { normalizeIcon } from "./helpers/normalizeIcon.js"; export const CircleIcon = normalizeIcon(CircleIcon_); -export function ContractWriteStatus( - result: ContractWriteResult, - index: number, -) { +export function ContractWriteStatus({ + result, + index, +}: { + result: ContractWriteResult; + index: number; +}) { const { contractWrite, signatureResult, diff --git a/packages/widget/src/StepContentPaymentOption.tsx b/packages/widget/src/StepContentPaymentOption.tsx index 583abe10..acce1b2d 100644 --- a/packages/widget/src/StepContentPaymentOption.tsx +++ b/packages/widget/src/StepContentPaymentOption.tsx @@ -54,7 +54,7 @@ export default function StepContentPaymentOption({ stepIndex }: StepProps) { const onContinue = useCallback(() => { handleNext(stepIndex); runEventListener(eventListeners.onButtonClick, { type: "next_step" }); - }, [handleNext, eventListeners.onButtonClick]); + }, [stepIndex, handleNext, eventListeners.onButtonClick]); return ( { handleBack(stepIndex); @@ -84,7 +84,15 @@ export function StepContentTransactions({ stepIndex }: StepProps) { total={total} /> - {contractWriteResults.map(ContractWriteStatus)} + + {contractWriteResults.map((result, index) => ( + + ))} + {/* // TODO(KK): We're not currently displaying the error anywhere. {currentResult?.relevantError && ( diff --git a/packages/widget/src/useSignificantFlowingDecimal.tsx b/packages/widget/src/useSignificantFlowingDecimal.tsx index f94134d2..d58b7cd4 100644 --- a/packages/widget/src/useSignificantFlowingDecimal.tsx +++ b/packages/widget/src/useSignificantFlowingDecimal.tsx @@ -32,4 +32,4 @@ export const useSignificantFlowingDecimal = ( // This will usually have the last 3 numbers flowing smoothly. return Math.min(lengthToFirstSignificatDecimal + 2, 18); // Don't go over 18. - }, [flowRate]); + }, [flowRate, animationStepTimeInMs]); From 81017ebfc204156afd1056fa43603231ddd69602 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 15 Sep 2023 08:43:32 +0000 Subject: [PATCH 13/46] improve transaction handling for robustness and fail-modes * with gnosis safe, a transaction succeeding on-chain is not guaranteed --- packages/widget/src/CommandHandlerContext.ts | 1 + .../widget/src/CommandHandlerProvider.tsx | 88 ++++++++---- packages/widget/src/CommandHandlerState.ts | 3 + packages/widget/src/CommandMapper.tsx | 42 +++--- packages/widget/src/ContractWriteButton.tsx | 106 +++++++++++--- packages/widget/src/ContractWriteManager.tsx | 61 ++++---- packages/widget/src/ContractWriteStatus.tsx | 86 +++++++++--- packages/widget/src/StepContentReview.tsx | 4 +- .../widget/src/StepContentTransactions.tsx | 37 +++-- packages/widget/src/StepperCTAButton.tsx | 6 +- packages/widget/src/commandHandlingReducer.ts | 10 +- packages/widget/src/core/wagmi-generated.ts | 132 +++++++++--------- packages/widget/wagmi.config.ts | 4 +- 13 files changed, 389 insertions(+), 191 deletions(-) diff --git a/packages/widget/src/CommandHandlerContext.ts b/packages/widget/src/CommandHandlerContext.ts index 5d90716b..ffa53c30 100644 --- a/packages/widget/src/CommandHandlerContext.ts +++ b/packages/widget/src/CommandHandlerContext.ts @@ -14,6 +14,7 @@ export type CommandHandlerContextValue = { sessionId: string | null; submitCommands: (commands: ReadonlyArray) => void; writeIndex: number; + handleNextWrite: (currentWriteIndex: number) => void; }; export const CommandHandlerContext = createContext< diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index 18ef3ba3..f158bbd7 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -5,9 +5,12 @@ import { CommandHandlerContextValue, } from "./CommandHandlerContext.js"; import { useCommandHandlerReducer } from "./commandHandlingReducer.js"; -import { CommandMapper } from "./CommandMapper.js"; +import { CommandMapper, CommandMapperProps } from "./CommandMapper.js"; import { Command } from "./commands.js"; -import { ContractWriteManager } from "./ContractWriteManager.js"; +import { + ContractWriteManager, + ContractWriteManagerProps, +} from "./ContractWriteManager.js"; import { ChildrenProp, isDefined } from "./utils.js"; type Props = { @@ -17,7 +20,7 @@ type Props = { }; export function CommandHandlerProvider({ children }: Props) { - const [{ status, commands, sessionId }, dispatch] = + const [{ status, commands, sessionId, writeIndex }, dispatch] = useCommandHandlerReducer(); const [contractWrites, contractWriteResults] = useMemo(() => { @@ -33,9 +36,11 @@ export function CommandHandlerProvider({ children }: Props) { return [contractWrites_, contractWritesResults_]; }, [commands]); - const writeIndex = contractWriteResults.filter( - (x) => x.transactionResult.isSuccess, - ).length; + const handleNextWrite = useCallback( + (writeIndex: number) => + void dispatch({ type: "set write index", payload: writeIndex + 1 }), + [dispatch], + ); const submitCommands = useCallback( (commands: ReadonlyArray) => @@ -44,6 +49,43 @@ export function CommandHandlerProvider({ children }: Props) { ); const reset = useCallback(() => void dispatch({ type: "reset" }), [dispatch]); + const onContractWrites = useCallback< + Required["onMapped"] + >( + ({ commandId, contractWrites }) => + void dispatch({ + type: "set contract writes", + payload: { + commandId, + contractWrites, + }, + }), + [], + ); + + const onContractWriteResult = useCallback< + Required["onChange"] + >( + (result) => { + void dispatch({ + type: "set contract write result", + payload: { + commandId: result.contractWrite.commandId, + writeId: result.contractWrite.id, + result, + }, + }); + + if ( + result.transactionResult.isSuccess && + result.contractWrite.id === contractWrites[writeIndex]?.id + ) { + handleNextWrite(writeIndex); + } + }, + [writeIndex, contractWrites, handleNextWrite], + ); + const contextValue = useMemo( () => ({ status, @@ -54,8 +96,19 @@ export function CommandHandlerProvider({ children }: Props) { submitCommands, reset, writeIndex, + handleNextWrite, }), - [status, commands, contractWrites, contractWriteResults, sessionId], + [ + status, + commands, + contractWrites, + contractWriteResults, + sessionId, + submitCommands, + reset, + writeIndex, + handleNextWrite, + ], ); return ( @@ -65,15 +118,7 @@ export function CommandHandlerProvider({ children }: Props) { - void dispatch({ - type: "set contract writes", - payload: { - commandId: cmd.id, - contractWrites: x, - }, - }) - } + onMapped={onContractWrites} /> ))} {contractWrites.map((contractWrite, writeIndex_) => ( @@ -81,16 +126,7 @@ export function CommandHandlerProvider({ children }: Props) { key={writeIndex_} prepare={writeIndex_ === writeIndex} contractWrite={contractWrite} - onChange={(result) => - void dispatch({ - type: "set contract write result", - payload: { - commandId: contractWrite.commandId, - writeId: contractWrite.id, - result, - }, - }) - } + onChange={onContractWriteResult} /> ))} diff --git a/packages/widget/src/CommandHandlerState.ts b/packages/widget/src/CommandHandlerState.ts index d0f4ff76..e77231b4 100644 --- a/packages/widget/src/CommandHandlerState.ts +++ b/packages/widget/src/CommandHandlerState.ts @@ -8,12 +8,14 @@ type Idle = { status: "idle"; commands: ReadonlyArray; sessionId: null; + writeIndex: 0; }; type Initialized = { status: "initialized"; commands: ReadonlyArray; sessionId: null; + writeIndex: 0; }; type Handling = { @@ -28,6 +30,7 @@ type Handling = { } >; sessionId: string; + writeIndex: number; }; // TODO(KK): Consider if we need this. diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 42b71492..1383dd54 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -21,13 +21,15 @@ import { nativeAssetSuperTokenABI, superTokenABI, } from "./core/index.js"; -import { ChildrenProp, MaxUint256 } from "./utils.js"; +import { MaxUint256 } from "./utils.js"; import { useWidget } from "./WidgetContext.js"; -type CommandMapperProps = { +export type CommandMapperProps = { command: TCommand; - onMapped?: (contractWrites: ReadonlyArray) => void; - children?: (contractWrites: ReadonlyArray) => ChildrenProp; + onMapped?: (result: { + commandId: string; + contractWrites: ReadonlyArray; + }) => void; }; export function CommandMapper({ command: cmd, ...props }: CommandMapperProps) { @@ -44,7 +46,6 @@ export function CommandMapper({ command: cmd, ...props }: CommandMapperProps) { export function EnableAutoWrapCommandMapper({ command: cmd, onMapped, - children, }: CommandMapperProps) { const { getUnderlyingToken } = useWidget(); @@ -122,23 +123,27 @@ export function EnableAutoWrapCommandMapper({ }, [cmd.id, isSuccess]); useEffect( - () => (isSuccess ? onMapped?.(contractWrites) : void 0), - [contractWrites], + () => + isSuccess ? onMapped?.({ commandId: cmd.id, contractWrites }) : void 0, + [cmd.id, contractWrites, isSuccess], ); - return <>{children?.(contractWrites)}; + return null; } export function WrapIntoSuperTokensCommandMapper({ command: cmd, onMapped, - children, }: CommandMapperProps) { const { getSuperToken, getUnderlyingToken } = useWidget(); const isNativeAssetUnderlyingToken = cmd.underlyingToken.isNativeAsset; - const { data: allowance, isSuccess } = useContractRead( + const { + data: allowance, + isSuccess, + isFetchedAfterMount, + } = useContractRead( !isNativeAssetUnderlyingToken ? { chainId: cmd.chainId, @@ -208,17 +213,17 @@ export function WrapIntoSuperTokensCommandMapper({ }, [cmd.id, isSuccess]); useEffect( - () => (isSuccess ? onMapped?.(contractWrites) : void 0), - [contractWrites], + () => + isSuccess ? onMapped?.({ commandId: cmd.id, contractWrites }) : void 0, + [cmd.id, contractWrites, isSuccess], ); - return <>{children?.(contractWrites)}; + return null; } export function SubscribeCommandMapper({ command: cmd, onMapped, - children, }: CommandMapperProps) { const { isSuccess: isSuccessForGetFlowRate, data: existingFlowRate } = useContractRead({ @@ -297,11 +302,14 @@ export function SubscribeCommandMapper({ }, [cmd.id, isSuccessForGetFlowRate]); useEffect( - () => (isSuccessForGetFlowRate ? onMapped?.(contractWrites) : void 0), - [contractWrites], + () => + isSuccessForGetFlowRate + ? onMapped?.({ commandId: cmd.id, contractWrites }) + : void 0, + [cmd.id, contractWrites, isSuccessForGetFlowRate], ); - return <>{children?.(contractWrites)}; + return null; } const createContractWrite = < diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index decf966f..88f05bd3 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -1,7 +1,10 @@ +import ReplayIcon_ from "@mui/icons-material/Replay"; +import SkipNextIcon_ from "@mui/icons-material/SkipNext"; import { LoadingButton } from "@mui/lab"; -import { Button, Stack } from "@mui/material"; -import { useCallback } from "react"; +import { Alert, Button, Stack } from "@mui/material"; +import { useCallback, useEffect, useState } from "react"; import { + BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ContractFunctionZeroDataError, @@ -10,18 +13,24 @@ import { useNetwork, useSwitchNetwork } from "wagmi"; import { ContractWriteResult } from "./ContractWriteManager.js"; import { runEventListener } from "./EventListeners.js"; +import { normalizeIcon } from "./helpers/normalizeIcon.js"; import { useWidget } from "./WidgetContext.js"; -export type ContractWriteButtonProps = ContractWriteResult; +const ReplayIcon = normalizeIcon(ReplayIcon_); +const SkipNextIcon = normalizeIcon(SkipNextIcon_); + +export type ContractWriteButtonProps = { + handleNextWrite: () => void; +} & ContractWriteResult; export default function ContractWriteButton({ + handleNextWrite: handleNextWrite_, contractWrite, prepareResult, writeResult, transactionResult, }: ContractWriteButtonProps) { const { eventListeners } = useWidget(); - const write = writeResult.write; const isLoading = @@ -52,8 +61,31 @@ export default function ContractWriteButton({ prepareResult.error instanceof ContractFunctionRevertedError || prepareResult.error instanceof ContractFunctionZeroDataError); + const [showNextWriteButton, setShowNextWriteButton] = useState(false); + + const handleNextWrite = useCallback(() => { + handleNextWrite_(); + setShowNextWriteButton(false); + }, [handleNextWrite_]); + + useEffect(() => { + if (transactionResult.isLoading) { + const timeoutId = setTimeout(() => { + setShowNextWriteButton(true); + }, 5000); + return () => clearTimeout(timeoutId); + } else { + setShowNextWriteButton(false); + } + }, [transactionResult.isLoading, handleNextWrite]); + return ( - + {needsToSwitchNetwork ? ( + ) : ( + + Send Transaction + {/* {contractWrite.displayTitle} */} + + )} + {showNextWriteButton && ( + + )} + )} ); diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index 75918dfe..9393b94b 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -13,7 +13,6 @@ import { import { ContractWrite } from "./ContractWrite.js"; import { TxFunctionName } from "./EventListeners.js"; -import { ChildrenProp } from "./utils.js"; import { useWidget } from "./WidgetContext.js"; export type ContractWriteResult = { @@ -24,18 +23,16 @@ export type ContractWriteResult = { currentError: BaseError | null; }; -type ContractWriteManagerProps = { +export type ContractWriteManagerProps = { prepare: boolean; contractWrite: ContractWrite; onChange?: (result: ContractWriteResult) => void; - children?: (result: ContractWriteResult) => ChildrenProp; }; export function ContractWriteManager({ prepare: _prepare, contractWrite, onChange, - children, }: ContractWriteManagerProps) { const { chain } = useNetwork(); const prepare = _prepare && contractWrite.chainId === chain?.id; @@ -60,25 +57,29 @@ export function ContractWriteManager({ }), }); - useEffect(() => { - if (writeResult.error instanceof TransactionExecutionError) { - if (writeResult.error.walk() instanceof UserRejectedRequestError) { - writeResult.reset(); // Clear wallet rejection errors. - } - } - }, [writeResult.error]); - const transactionResult = useWaitForTransaction({ hash: writeResult.data?.hash, onError: console.error, }); - const result: ContractWriteResult = useMemo( - () => ({ + const result: ContractWriteResult = useMemo(() => { + if ( + writeResult.isError && + writeResult.error instanceof TransactionExecutionError + ) { + if ( + writeResult.error.cause instanceof UserRejectedRequestError || + writeResult.error.walk() instanceof UserRejectedRequestError + ) { + writeResult.reset(); // Clear wallet rejection errors. + } + } + + return { contractWrite, prepareResult: prepareResult as ReturnType< typeof usePrepareContractWrite - >, // TODO(KK): weird type mismatch + >, writeResult, transactionResult, currentError: (transactionResult.error || @@ -86,16 +87,28 @@ export function ContractWriteManager({ (writeResult.isSuccess ? null : prepareResult.error)) as unknown as BaseError | null, - }), - [ - contractWrite.id, - prepareResult.status, - writeResult.status, - transactionResult.status, - ], - ); + }; + }, [ + contractWrite.id, + prepareResult.status, + writeResult.status, + transactionResult.status, + ]); + + // console.log({ + // currentError: result.currentError, + // writeResult + // }) + + // # Retry + // useEffect(() => { + // if (prepare && result.currentError && result.currentError === prepareResult.error) { + // const timeoutId = setTimeout(() => prepareResult.refetch(), 5000); + // return () => clearTimeout(timeoutId); + // } + // }, [prepare, result.currentError, prepareResult.error, prepareResult.refetch]); useEffect(() => void onChange?.(result), [result]); - return <>{children?.(result)}; + return null; } diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index 75452d75..afd853ea 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -8,16 +8,22 @@ import { decodeErrorResult, } from "viem"; +import { useCommandHandler } from "./CommandHandlerContext.js"; import { ContractWriteResult } from "./ContractWriteManager.js"; -import { superfluidErrorsABI } from "./core/wagmi-generated.js"; +import { errorsABI } from "./core/wagmi-generated.js"; import { normalizeIcon } from "./helpers/normalizeIcon.js"; export const CircleIcon = normalizeIcon(CircleIcon_); -export function ContractWriteStatus( - result: ContractWriteResult, - index: number, -) { +export function ContractWriteStatus({ + result, + index, +}: { + result: ContractWriteResult; + index: number; +}) { + const { writeIndex } = useCommandHandler(); + const { contractWrite: { id, displayTitle }, prepareResult, @@ -28,13 +34,39 @@ export function ContractWriteStatus( const theme = useTheme(); - const borderColor = currentError - ? theme.palette.error.main + const colors: { + border: string; + bullet: string; + text: string; + } = currentError + ? { + border: theme.palette.error.main, + bullet: theme.palette.error.main, + text: theme.palette.error.main, + } : transactionResult.isSuccess - ? theme.palette.success.main + ? { + border: theme.palette.success.main, + bullet: theme.palette.success.main, + text: theme.palette.success.main, + } : writeResult?.isSuccess - ? theme.palette.warning.main - : theme.palette.action.selected; + ? { + border: + index === writeIndex + ? theme.palette.action.active + : theme.palette.action.selected, + bullet: theme.palette.warning.main, + text: theme.palette.warning.main, + } + : { + border: + index === writeIndex + ? theme.palette.action.active + : theme.palette.action.selected, + bullet: theme.palette.text.secondary, + text: theme.palette.text.secondary, + }; const errorName = useMemo( () => (currentError ? tryParseErrorName(currentError) : undefined), @@ -47,24 +79,34 @@ export function ContractWriteStatus( key={id} sx={{ p: 1.5, - borderColor: borderColor, + borderColor: colors.border, borderRadius: "10px", }} > - - {`${ - index + 1 - }. ${displayTitle}`} - - - {currentError - ? errorName || "Something went wrong." + + + {`${index + 1}. ${displayTitle}`} + + + {transactionResult.isError + ? "Transaction failed" + : currentError + ? "Error" : transactionResult.isSuccess ? "Completed" : writeResult?.isSuccess - ? "In progress" - : "Not started"} + ? "Transaction sent" + : prepareResult.isLoading + ? "Preparing..." + : prepareResult.isSuccess + ? "Ready" + : "Queued"} + ); @@ -75,7 +117,7 @@ const tryParseErrorName = (error: BaseError): string | undefined => { const rootError = error.walk(); if (rootError instanceof AbiErrorSignatureNotFoundError) { return decodeErrorResult({ - abi: superfluidErrorsABI, + abi: errorsABI, data: rootError.signature, }).errorName; } else if (rootError instanceof ContractFunctionRevertedError) { diff --git a/packages/widget/src/StepContentReview.tsx b/packages/widget/src/StepContentReview.tsx index 04dc4437..958f0a58 100644 --- a/packages/widget/src/StepContentReview.tsx +++ b/packages/widget/src/StepContentReview.tsx @@ -60,7 +60,9 @@ export default function StepContentReview({ stepIndex }: StepProps) { ))} Continue diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index a4c81d27..2b985253 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -17,8 +17,12 @@ const CloseIcon = normalizeIcon(CloseIcon_); export function StepContentTransactions({ stepIndex }: StepProps) { const { handleBack, handleNext, setActiveStep, totalSteps } = useStepper(); - const { contractWrites, contractWriteResults, writeIndex } = - useCommandHandler(); // Cleaner to pass with props. + const { + contractWrites, + contractWriteResults, + writeIndex, + handleNextWrite: handleNextWrite_, + } = useCommandHandler(); // Cleaner to pass with props. const { eventListeners } = useWidget(); @@ -43,6 +47,11 @@ export function StepContentTransactions({ stepIndex }: StepProps) { const total = contractWrites.length; const currentResult = contractWriteResults[writeIndex]; + const handleNextWrite = useCallback( + () => handleNextWrite_(writeIndex), + [handleNextWrite_, writeIndex], + ); + return ( @@ -82,15 +91,21 @@ export function StepContentTransactions({ stepIndex }: StepProps) { total={total} /> - {contractWriteResults.map(ContractWriteStatus)} - {/* // TODO(KK): We're not currently displaying the error anywhere. - {currentResult?.relevantError && ( - - Error - {currentResult.relevantError.shortMessage} - - )} */} - {currentResult && } + + {contractWriteResults.map((result, index) => ( + + ))} + + {currentResult && ( + + )} ); diff --git a/packages/widget/src/StepperCTAButton.tsx b/packages/widget/src/StepperCTAButton.tsx index 7f0ce537..5ffc2de9 100644 --- a/packages/widget/src/StepperCTAButton.tsx +++ b/packages/widget/src/StepperCTAButton.tsx @@ -1,8 +1,8 @@ -import { Button, ButtonProps } from "@mui/material"; +import { LoadingButton, LoadingButtonProps } from "@mui/lab"; -export function StepperCTAButton(props: ButtonProps) { +export function StepperCTAButton(props: LoadingButtonProps) { return ( - ) : ( <> - {isSeriousPrepareError && ( + - {(prepareResult.error as BaseError).shortMessage} + {(prepareResult.error as BaseError)?.shortMessage} - )} + {isSeriousPrepareError ? ( - )} + )} diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index afd853ea..949d18b3 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -34,36 +34,40 @@ export function ContractWriteStatus({ const theme = useTheme(); + const isWriting = index === writeIndex; + const colors: { border: string; bullet: string; text: string; } = currentError ? { - border: theme.palette.error.main, + border: isWriting + ? theme.palette.action.active + : theme.palette.error.main, bullet: theme.palette.error.main, text: theme.palette.error.main, } : transactionResult.isSuccess ? { - border: theme.palette.success.main, + border: isWriting + ? theme.palette.action.active + : theme.palette.primary.main, bullet: theme.palette.success.main, text: theme.palette.success.main, } : writeResult?.isSuccess ? { - border: - index === writeIndex - ? theme.palette.action.active - : theme.palette.action.selected, + border: isWriting + ? theme.palette.action.active + : theme.palette.action.selected, bullet: theme.palette.warning.main, - text: theme.palette.warning.main, + text: theme.palette.text.secondary, } : { - border: - index === writeIndex - ? theme.palette.action.active - : theme.palette.action.selected, + border: isWriting + ? theme.palette.action.active + : theme.palette.action.selected, bullet: theme.palette.text.secondary, text: theme.palette.text.secondary, }; @@ -84,8 +88,14 @@ export function ContractWriteStatus({ }} > - - {`${index + 1}. ${displayTitle}`} + + {displayTitle} Date: Fri, 15 Sep 2023 10:43:38 +0000 Subject: [PATCH 15/46] generate for new contract --- .../widget-preview/WidgetPreview.tsx | 3 +- packages/widget/src/core/wagmi-generated.ts | 171 ++++++++++-------- packages/widget/wagmi.config.ts | 4 +- 3 files changed, 103 insertions(+), 75 deletions(-) diff --git a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx index 36e05471..bd7f0be6 100644 --- a/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx +++ b/apps/widget-builder/src/components/widget-preview/WidgetPreview.tsx @@ -81,7 +81,8 @@ const goerliPermitTokens: TokenInfo[] = [ export const widgetTokenList = { ...tokenList, - tokens: [...tokenList.tokens, ...mumbaiPermitTokens, ...goerliPermitTokens], + tokens: [...tokenList.tokens, ...goerliPermitTokens], + // ...mumbaiPermitTokens, } as SuperTokenList; export interface FontSettings { diff --git a/packages/widget/src/core/wagmi-generated.ts b/packages/widget/src/core/wagmi-generated.ts index 7704ba63..5bf1e9c4 100644 --- a/packages/widget/src/core/wagmi-generated.ts +++ b/packages/widget/src/core/wagmi-generated.ts @@ -5578,26 +5578,26 @@ export const superTokenABI = [ ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + * [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x429DF352d27637A49DA83BB81A067CD8137138cf) */ export const superUpgraderABI = [ { stateMutability: "nonpayable", type: "constructor", inputs: [ - { name: "_usdc", internalType: "contract FakeUSDC", type: "address" }, - { name: "_usdcx", internalType: "contract ISuperToken", type: "address" }, + { name: "_host", internalType: "contract ISuperfluid", type: "address" }, { name: "_permit2", internalType: "contract IPermit2", type: "address" }, { name: "_automate", internalType: "address", type: "address" }, ], }, { type: "error", inputs: [], name: "BAD_ETH_TRANSFER" }, + { type: "error", inputs: [], name: "INVALID_CTX" }, { type: "error", inputs: [], name: "INVALID_HOST" }, { type: "error", inputs: [], name: "LOWER_LIMIT_NOT_REACHED" }, { type: "error", inputs: [], name: "NOT_ENOUGH_GAS_TANK_BALANCE" }, { type: "error", inputs: [], name: "NOT_NEGATIVE_FLOW_RATE" }, { type: "error", inputs: [], name: "TASK_ALREADY_EXISTS_FOR_USER" }, + { type: "error", inputs: [], name: "UNDERLYING_MISMATCH" }, { stateMutability: "view", type: "function", @@ -5654,6 +5654,20 @@ export const superUpgraderABI = [ name: "afterAgreementUpdated", outputs: [{ name: "", internalType: "bytes", type: "bytes" }], }, + { + stateMutability: "nonpayable", + type: "function", + inputs: [ + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + ], + name: "autoUpgrade", + outputs: [], + }, { stateMutability: "view", type: "function", @@ -5705,7 +5719,14 @@ export const superUpgraderABI = [ { stateMutability: "view", type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], + inputs: [ + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, + { name: "account", internalType: "address", type: "address" }, + ], name: "checker", outputs: [ { name: "canExec", internalType: "bool", type: "bool" }, @@ -5742,10 +5763,71 @@ export const superUpgraderABI = [ { name: "", internalType: "contract ISuperfluid", type: "address" }, ], }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "permit2", + outputs: [{ name: "", internalType: "contract IPermit2", type: "address" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [ + { name: "", internalType: "contract ISuperToken", type: "address" }, + { name: "", internalType: "address", type: "address" }, + ], + name: "taskIdsByToken", + outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], + }, + { + stateMutability: "view", + type: "function", + inputs: [], + name: "taskTreasury", + outputs: [ + { + name: "", + internalType: "contract ITaskTreasuryUpgradable", + type: "address", + }, + ], + }, + { + stateMutability: "payable", + type: "function", + inputs: [{ name: "account", internalType: "address", type: "address" }], + name: "topUpGasTank", + outputs: [], + }, + { + stateMutability: "payable", + type: "function", + inputs: [ + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, + { + name: "initialUpgradeAmount", + internalType: "uint256", + type: "uint256", + }, + { name: "ctx", internalType: "bytes", type: "bytes" }, + ], + name: "upgradeWithAllowance", + outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], + }, { stateMutability: "payable", type: "function", inputs: [ + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, { name: "initialUpgradeAmount", internalType: "uint256", @@ -5762,13 +5844,18 @@ export const superUpgraderABI = [ { name: "s", internalType: "bytes32", type: "bytes32" }, { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "manualUpgradeWithPermit", + name: "upgradeWithPermit", outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, { stateMutability: "payable", type: "function", inputs: [ + { + name: "superToken", + internalType: "contract ISuperToken", + type: "address", + }, { name: "permitSingle", internalType: "struct IAllowanceTransfer.PermitSingle", @@ -5792,71 +5879,14 @@ export const superUpgraderABI = [ { name: "signature", internalType: "bytes", type: "bytes" }, { name: "initialUpgradeAmount", - internalType: "uint160", - type: "uint160", + internalType: "uint256", + type: "uint256", }, { name: "ctx", internalType: "bytes", type: "bytes" }, ], - name: "manualUpgradeWithPermit2", + name: "upgradeWithPermit2", outputs: [{ name: "newCtx", internalType: "bytes", type: "bytes" }], }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "permit2", - outputs: [{ name: "", internalType: "contract IPermit2", type: "address" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [{ name: "", internalType: "address", type: "address" }], - name: "taskIds", - outputs: [{ name: "", internalType: "bytes32", type: "bytes32" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "taskTreasury", - outputs: [ - { - name: "", - internalType: "contract ITaskTreasuryUpgradable", - type: "address", - }, - ], - }, - { - stateMutability: "payable", - type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "topUpGasTank", - outputs: [], - }, - { - stateMutability: "nonpayable", - type: "function", - inputs: [{ name: "account", internalType: "address", type: "address" }], - name: "upgradeWithAutomation", - outputs: [], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "usdc", - outputs: [{ name: "", internalType: "contract FakeUSDC", type: "address" }], - }, - { - stateMutability: "view", - type: "function", - inputs: [], - name: "usdcx", - outputs: [ - { name: "", internalType: "contract ISuperToken", type: "address" }, - ], - }, { stateMutability: "nonpayable", type: "function", @@ -5871,17 +5901,14 @@ export const superUpgraderABI = [ ] as const; /** - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + * [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x429DF352d27637A49DA83BB81A067CD8137138cf) */ export const superUpgraderAddress = { - 5: "0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C", - 80001: "0xb7DB015AA9F37142340C94F09c543Ad51B53e961", + 5: "0x429DF352d27637A49DA83BB81A067CD8137138cf", } as const; /** - * - [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C) - * - [__View Contract on Polygon Mumbai Polygon Scan__](https://mumbai.polygonscan.com/address/0xb7db015aa9f37142340c94f09c543ad51b53e961) + * [__View Contract on Goerli Etherscan__](https://goerli.etherscan.io/address/0x429DF352d27637A49DA83BB81A067CD8137138cf) */ export const superUpgraderConfig = { address: superUpgraderAddress, diff --git a/packages/widget/wagmi.config.ts b/packages/widget/wagmi.config.ts index f1b09816..3a3e3051 100644 --- a/packages/widget/wagmi.config.ts +++ b/packages/widget/wagmi.config.ts @@ -79,8 +79,8 @@ export default defineConfig({ { name: "SuperUpgrader", address: { - 80001: "0xb7db015aa9f37142340c94f09c543ad51b53e961", - 5: "0xAEf1F1Ee5b5652560f305e9c0278d137a6AB5e9C", + // 80001: "0xb7db015aa9f37142340c94f09c543ad51b53e961", + 5: "0x429DF352d27637A49DA83BB81A067CD8137138cf", }, }, { From 3056bcd9fde8bd4da2c20a207e41491d4dbc73fb Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 15 Sep 2023 11:12:01 +0000 Subject: [PATCH 16/46] change function call --- packages/widget/src/CommandMapper.tsx | 10 ++++++---- packages/widget/src/ContractWriteButton.tsx | 4 ++-- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index ff40c649..945a6ad7 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -208,14 +208,15 @@ export function PermitWrapIntoSuperTokensCommandMapper({ return { abi: superUpgraderABI, - functionName: "manualUpgradeWithPermit", + functionName: "upgradeWithPermit", address: superUpgraderAddress[ cmd.chainId as keyof typeof superUpgraderAddress ], value: 100000000000000000n, args: [ - cmd.amountWeiFromUnderlyingTokenDecimals, + cmd.superTokenAddress, + cmd.amountWeiFromSuperTokenDecimals, BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), @@ -239,14 +240,15 @@ export function PermitWrapIntoSuperTokensCommandMapper({ ], { abi: superUpgraderABI, - functionName: "manualUpgradeWithPermit", + functionName: "upgradeWithPermit", address: superUpgraderAddress[ cmd.chainId as keyof typeof superUpgraderAddress ], value: 100000000000000000n, args: [ - cmd.amountWeiFromUnderlyingTokenDecimals, + cmd.superTokenAddress, + cmd.amountWeiFromSuperTokenDecimals, BigInt( "0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff", ), diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index f918f584..dda3d497 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -103,12 +103,12 @@ export default function ContractWriteButton({ <> {Boolean(contractWrite.signatureRequest && !signatureResult.data) ? ( signatureResult.signTypedData()} > Sign From bde00abc3d55fb48567692cc88f66fa6cb8142a6 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Sat, 16 Sep 2023 06:50:30 +0000 Subject: [PATCH 17/46] add force write btn --- packages/widget/src/ContractWriteButton.tsx | 28 +++++++++++++++------ 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index 61a0f993..010abb2b 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -4,7 +4,6 @@ import { LoadingButton } from "@mui/lab"; import { Alert, Button, Collapse, Stack } from "@mui/material"; import { useCallback, useEffect, useState } from "react"; import { - BaseError, ContractFunctionExecutionError, ContractFunctionRevertedError, ContractFunctionZeroDataError, @@ -29,6 +28,7 @@ export default function ContractWriteButton({ prepareResult, writeResult, transactionResult, + currentError, }: ContractWriteButtonProps) { const { eventListeners } = useWidget(); const write = writeResult.write; @@ -79,6 +79,10 @@ export default function ContractWriteButton({ } }, [transactionResult.isLoading, handleNextWrite]); + const isPrepareError = Boolean( + currentError && currentError === prepareResult.error, + ); + return ( ) : ( <> - - - {(prepareResult.error as BaseError)?.shortMessage} - + + {currentError?.shortMessage} - {isSeriousPrepareError ? ( + {isPrepareError ? ( + ) : ( <> - - {currentError?.shortMessage} - - {isPrepareError ? ( + {showRetryButton ? ( ) : ( - Send Transaction - {/* {contractWrite.displayTitle} */} + {writeButtonText} )} - + - + diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index 949d18b3..d0c896e2 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -1,5 +1,14 @@ +import CheckCircleIcon_ from "@mui/icons-material/CheckCircle"; import CircleIcon_ from "@mui/icons-material/Circle.js"; -import { Paper, Stack, Typography, useTheme } from "@mui/material"; +import CircleOutlinedIcon_ from "@mui/icons-material/CircleOutlined"; +import OpenInNewIcon_ from "@mui/icons-material/OpenInNew"; +import { + IconButton, + ListItem, + ListItemIcon, + ListItemText, + useTheme, +} from "@mui/material"; import { useMemo } from "react"; import { AbiErrorSignatureNotFoundError, @@ -7,6 +16,7 @@ import { ContractFunctionRevertedError, decodeErrorResult, } from "viem"; +import { useNetwork } from "wagmi"; import { useCommandHandler } from "./CommandHandlerContext.js"; import { ContractWriteResult } from "./ContractWriteManager.js"; @@ -14,6 +24,9 @@ import { errorsABI } from "./core/wagmi-generated.js"; import { normalizeIcon } from "./helpers/normalizeIcon.js"; export const CircleIcon = normalizeIcon(CircleIcon_); +export const CircleOutlinedIcon = normalizeIcon(CircleOutlinedIcon_); +export const OpenInNewIcon = normalizeIcon(OpenInNewIcon_); +export const CheckCircleIcon = normalizeIcon(CheckCircleIcon_); export function ContractWriteStatus({ result, @@ -36,6 +49,7 @@ export function ContractWriteStatus({ const isWriting = index === writeIndex; + // TODO(KK): clean-up const colors: { border: string; bullet: string; @@ -43,7 +57,7 @@ export function ContractWriteStatus({ } = currentError ? { border: isWriting - ? theme.palette.action.active + ? theme.palette.action.selected : theme.palette.error.main, bullet: theme.palette.error.main, text: theme.palette.error.main, @@ -53,22 +67,32 @@ export function ContractWriteStatus({ border: isWriting ? theme.palette.action.active : theme.palette.primary.main, - bullet: theme.palette.success.main, + bullet: theme.palette.success.dark, text: theme.palette.success.main, } : writeResult?.isSuccess ? { border: isWriting - ? theme.palette.action.active - : theme.palette.action.selected, + ? theme.palette.action.selected + : theme.palette.action.active, + bullet: theme.palette.warning.main, + text: theme.palette.text.secondary, + } + : prepareResult.isLoading + ? { + border: isWriting + ? theme.palette.action.selected + : theme.palette.action.active, bullet: theme.palette.warning.main, text: theme.palette.text.secondary, } : { border: isWriting - ? theme.palette.action.active - : theme.palette.action.selected, - bullet: theme.palette.text.secondary, + ? theme.palette.action.selected + : theme.palette.action.active, + bullet: isWriting + ? theme.palette.warning.main + : theme.palette.action.disabled, text: theme.palette.text.secondary, }; @@ -77,48 +101,65 @@ export function ContractWriteStatus({ [currentError], ); + const { chains } = useNetwork(); + + const chain = useMemo( + () => chains.find((x) => x.id === result.contractWrite.chainId)!, + [chains, result.contractWrite.chainId], + ); + return ( - + + + ) + } > - - - {displayTitle} - - - {transactionResult.isError - ? "Transaction failed" - : currentError - ? "Error" + + + + - - - + ? "Ready to submit" + : "Queued" + } + > + ); } diff --git a/packages/widget/src/StepContentReview.tsx b/packages/widget/src/StepContentReview.tsx index 958f0a58..88655475 100644 --- a/packages/widget/src/StepContentReview.tsx +++ b/packages/widget/src/StepContentReview.tsx @@ -43,15 +43,8 @@ export default function StepContentReview({ stepIndex }: StepProps) { const isValidationError = validationResult?.success === false; return ( - + - - {isValidationError && ( - - {validationResult.error.issues[0].message} - - )} - {commands.map((cmd, index) => ( {index > 0 && } @@ -59,13 +52,20 @@ export default function StepContentReview({ stepIndex }: StepProps) { ))} + + {isValidationError && ( + + {validationResult.error.issues[0].message} + + )} + - Continue + {isValidating ? "Validating..." : "Continue"} ); diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index 2b985253..c0db0cd6 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -1,10 +1,18 @@ import CloseIcon_ from "@mui/icons-material/Close.js"; -import { Box, IconButton, Stack, Typography } from "@mui/material"; +import { + Alert, + Box, + Collapse, + IconButton, + List, + ListSubheader, + Stack, + Typography, +} from "@mui/material"; import { useCallback, useEffect } from "react"; import { useCommandHandler } from "./CommandHandlerContext.js"; import ContractWriteButton from "./ContractWriteButton.js"; -import { ContractWriteCircularProgress } from "./ContractWriteCircularProgress.js"; import { ContractWriteStatus } from "./ContractWriteStatus.js"; import { runEventListener } from "./EventListeners.js"; import { normalizeIcon } from "./helpers/normalizeIcon.js"; @@ -52,22 +60,29 @@ export function StepContentTransactions({ stepIndex }: StepProps) { [handleNextWrite_, writeIndex], ); + const showErrorAlert = Boolean( + currentResult && + currentResult.currentError && + currentResult.currentError.shortMessage, + ); + return ( - + - + @@ -76,10 +91,10 @@ export function StepContentTransactions({ stepIndex }: StepProps) { {`You're almost there!`} - Send the transactions from your wallet to finish your purchase. + Submit the transactions from your wallet to finish your purchase. - - - + */} + Transactions} + > {contractWriteResults.map((result, index) => ( ))} - + + {showErrorAlert && ( + + )} {currentResult && ( )} - + ); } diff --git a/packages/widget/src/StepContentWrap.tsx b/packages/widget/src/StepContentWrap.tsx index bd3b2460..64c68d28 100644 --- a/packages/widget/src/StepContentWrap.tsx +++ b/packages/widget/src/StepContentWrap.tsx @@ -276,12 +276,12 @@ export default function StepContentWrap({ stepIndex }: StepProps) { )} /> */} - + ); From 623a8517562ffb55a2ee435fdc6856a23514fb70 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Mon, 18 Sep 2023 11:28:26 +0000 Subject: [PATCH 19/46] add spacing and borders to list items --- packages/widget/src/ContractWriteButton.tsx | 18 ++++++++---------- packages/widget/src/ContractWriteStatus.tsx | 12 +++++++++--- .../widget/src/StepContentTransactions.tsx | 6 +++++- 3 files changed, 22 insertions(+), 14 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index b3612aaf..74331c55 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -88,10 +88,7 @@ export default function ContractWriteButton({ const showRetryButton = Boolean(isPrepareError && !writeResult.isLoading); return ( - + {needsToSwitchNetwork ? ( ) : ( )} - + diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index b94e312f..197f8050 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -155,13 +155,13 @@ export function ContractWriteStatus({ : transactionResult.isSuccess ? "Completed" : prepareResult.isLoading - ? "Preparing..." + ? "Estimating..." : currentError ? "Error" : writeResult?.isSuccess - ? "Transaction submitted" + ? "Transaction sent" : prepareResult.isSuccess - ? "Ready to submit" + ? "Ready to send" : "Queued" } > diff --git a/packages/widget/src/PoweredBySuperfluid.tsx b/packages/widget/src/PoweredBySuperfluid.tsx index 7acf346b..a20979f4 100644 --- a/packages/widget/src/PoweredBySuperfluid.tsx +++ b/packages/widget/src/PoweredBySuperfluid.tsx @@ -17,7 +17,7 @@ const PoweredBySuperfluid: FC = ({ sx = {} }) => ( ...sx, }} > - + Powered by diff --git a/packages/widget/src/StepContentPaymentOption.tsx b/packages/widget/src/StepContentPaymentOption.tsx index 583abe10..2349bb52 100644 --- a/packages/widget/src/StepContentPaymentOption.tsx +++ b/packages/widget/src/StepContentPaymentOption.tsx @@ -61,7 +61,7 @@ export default function StepContentPaymentOption({ stepIndex }: StepProps) { direction="column" alignItems="stretch" justifyContent="space-around" - gap={3} + spacing={3} sx={{ pb: 3, px: 3.5 }} > @@ -69,7 +69,7 @@ export default function StepContentPaymentOption({ stepIndex }: StepProps) { direction="row" alignItems="center" justifyContent="space-between" - gap={1} + spacing={1} sx={{ position: "relative" }} > diff --git a/packages/widget/src/StepContentReview.tsx b/packages/widget/src/StepContentReview.tsx index 88655475..563ce271 100644 --- a/packages/widget/src/StepContentReview.tsx +++ b/packages/widget/src/StepContentReview.tsx @@ -43,7 +43,7 @@ export default function StepContentReview({ stepIndex }: StepProps) { const isValidationError = validationResult?.success === false; return ( - + {commands.map((cmd, index) => ( @@ -52,21 +52,27 @@ export default function StepContentReview({ stepIndex }: StepProps) { ))} - - {isValidationError && ( - - {validationResult.error.issues[0].message} - - )} - - - {isValidating ? "Validating..." : "Continue"} - + + + {isValidationError && ( + + {validationResult.error.issues[0].message} + + )} + + + {isValidating ? "Validating..." : "Continue"} + + ); } diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index 6c3b66d4..ae79b11d 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -77,7 +77,7 @@ export function StepContentTransactions({ stepIndex }: StepProps) { aria-label="back" sx={{ mr: -1 }} > - + - Submit the transactions from your wallet to finish your purchase. + Send the transactions from your wallet to finish your purchase. {/* - Transactions + Transactions ({total}) } > diff --git a/packages/widget/src/StepContentWrap.tsx b/packages/widget/src/StepContentWrap.tsx index 64c68d28..c11ecd24 100644 --- a/packages/widget/src/StepContentWrap.tsx +++ b/packages/widget/src/StepContentWrap.tsx @@ -60,7 +60,7 @@ const WrapCard: FC = ({ variant="outlined" direction="row" alignItems="center" - gap={0.5} + spacing={0.5} title={token.address} sx={{ pl: 1.25, pr: 2, py: 1, borderRadius: 0.5 }} > diff --git a/packages/widget/src/Stepper.tsx b/packages/widget/src/Stepper.tsx index 1b16d102..d09dc463 100644 --- a/packages/widget/src/Stepper.tsx +++ b/packages/widget/src/Stepper.tsx @@ -15,7 +15,6 @@ import { useFormContext } from "react-hook-form"; import { CheckoutSummary } from "./CheckoutSummary.js"; import { runEventListener } from "./EventListeners.js"; -import ExpandIcon from "./ExpandIcon.js"; import { DraftFormValues } from "./formValues.js"; import StepContentPaymentOption from "./StepContentPaymentOption.js"; import StepContentReview from "./StepContentReview.js"; @@ -114,19 +113,33 @@ export default function Stepper() { return ( - { - setActiveStep(index); - runEventListener(eventListeners.onButtonClick, { - type: "step_label", - }); - }} - > + {visualActiveStep > index ? ( + { + setActiveStep(index); + runEventListener(eventListeners.onButtonClick, { + type: "step_label", + }); + }} + sx={(theme) => ({ + position: "relative", + width: "100%", + "&:hover": { + bgcolor: theme.palette.action.hover, + }, + })} + > + {labelText} + + ) : ( {labelText} - {orientation === "vertical" && ( + {/* {orientation === "vertical" && ( - )} + )} */} - + )} {Content} ); From a461379be9e65351d3393fa5f5ecedd2c67f94e8 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Mon, 18 Sep 2023 15:01:11 +0000 Subject: [PATCH 21/46] show skip button when TX fails --- packages/widget/src/ContractWriteButton.tsx | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index f4d23f2a..f1dacf6f 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -52,7 +52,9 @@ export default function ContractWriteButton({ }); }, [write, eventListeners.onButtonClick]); - const [showNextWriteButton, setShowNextWriteButton] = useState(false); + const [showNextWriteButton_, setShowNextWriteButton] = useState(false); + const showNextWriteButton = + showNextWriteButton_ || !transactionResult.isError; const handleNextWrite = useCallback(() => { handleNextWrite_(); @@ -63,7 +65,7 @@ export default function ContractWriteButton({ if (transactionResult.isLoading) { const timeoutId = setTimeout(() => { setShowNextWriteButton(true); - }, 15000); // TODO(KK): is 15 sec okay? + }, 20_000); // After 20 seconds, the button appears. return () => clearTimeout(timeoutId); } else { setShowNextWriteButton(false); From 490712de35eb1435fd1a0ccb7e8c406ac903c6f7 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Mon, 18 Sep 2023 15:01:45 +0000 Subject: [PATCH 22/46] enlarge close button --- packages/widget/src/StepContentTransactions.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index ae79b11d..982934d4 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -77,7 +77,7 @@ export function StepContentTransactions({ stepIndex }: StepProps) { aria-label="back" sx={{ mr: -1 }} > - + Date: Mon, 18 Sep 2023 15:22:45 +0000 Subject: [PATCH 23/46] flip the condition --- packages/widget/src/ContractWriteButton.tsx | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index f1dacf6f..489f2814 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -53,8 +53,7 @@ export default function ContractWriteButton({ }, [write, eventListeners.onButtonClick]); const [showNextWriteButton_, setShowNextWriteButton] = useState(false); - const showNextWriteButton = - showNextWriteButton_ || !transactionResult.isError; + const showNextWriteButton = showNextWriteButton_ || transactionResult.isError; const handleNextWrite = useCallback(() => { handleNextWrite_(); From 2be5f6fd931dbae7d9babc2904bf6656ccf8c997 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Mon, 18 Sep 2023 17:07:40 +0000 Subject: [PATCH 24/46] move transaction view title closer to the close icon --- packages/widget/src/ContractWriteStatus.tsx | 1 + .../widget/src/StepContentTransactions.tsx | 26 ++++++------------- 2 files changed, 9 insertions(+), 18 deletions(-) diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index 197f8050..c6f1ecfa 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -148,6 +148,7 @@ export function ContractWriteStatus({ + ({ color: theme.palette.text.secondary, mr: -1 })} > @@ -84,7 +83,7 @@ export function StepContentTransactions({ stepIndex }: StepProps) { direction="column" spacing={2.25} alignItems="stretch" - sx={{ width: "100%" }} + sx={{ width: "100%", mt: -1 }} > @@ -123,20 +122,11 @@ export function StepContentTransactions({ stepIndex }: StepProps) { /> ))} - {showErrorAlert && ( - - )} + {currentResult && ( Date: Tue, 19 Sep 2023 07:59:44 +0000 Subject: [PATCH 25/46] don't go out of bounds of the array --- packages/widget/src/ContractWriteButton.tsx | 2 +- packages/widget/src/StepContentTransactions.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index 489f2814..d10a8055 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -64,7 +64,7 @@ export default function ContractWriteButton({ if (transactionResult.isLoading) { const timeoutId = setTimeout(() => { setShowNextWriteButton(true); - }, 20_000); // After 20 seconds, the button appears. + }, 15_000); // After 15 seconds, the button appears. return () => clearTimeout(timeoutId); } else { setShowNextWriteButton(false); diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index 007992fd..887b16d4 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -53,7 +53,7 @@ export function StepContentTransactions({ stepIndex }: StepProps) { }, [handleBack, eventListeners.onButtonClick, stepIndex]); const total = contractWrites.length; - const currentResult = contractWriteResults[writeIndex]; + const currentResult = contractWriteResults[Math.min(writeIndex, total - 1)]; const handleNextWrite = useCallback( () => handleNextWrite_(writeIndex), From 965dddcbfd2fed6e5c696fc780ee144d23b2b8ff Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Tue, 19 Sep 2023 08:33:52 +0000 Subject: [PATCH 26/46] add error boundary --- packages/widget/package.json | 1 + packages/widget/src/Widget.tsx | 63 +++++++++++++++++++++++----------- pnpm-lock.yaml | 14 +++++++- 3 files changed, 57 insertions(+), 21 deletions(-) diff --git a/packages/widget/package.json b/packages/widget/package.json index 49a82577..779297c4 100644 --- a/packages/widget/package.json +++ b/packages/widget/package.json @@ -75,6 +75,7 @@ "nanoid": "^4.0.2", "react": "^18.2.0", "react-dom": "^18.2.0", + "react-error-boundary": "^4.0.11", "react-hook-form": "~7.46.1", "use-immer": "^0.9.0", "zod": "^3.22.1", diff --git a/packages/widget/src/Widget.tsx b/packages/widget/src/Widget.tsx index ae4d84cf..ef7b9600 100644 --- a/packages/widget/src/Widget.tsx +++ b/packages/widget/src/Widget.tsx @@ -1,6 +1,9 @@ +"use client"; + import { Alert, AlertTitle, + Container, createTheme, ThemeProvider, Typography, @@ -13,6 +16,7 @@ import defaultTokenList, { import memoize from "lodash.memoize"; import { nanoid } from "nanoid"; import { useCallback, useMemo } from "react"; +import { ErrorBoundary } from "react-error-boundary"; import { Address, zeroAddress } from "viem"; import { useConnect, useNetwork } from "wagmi"; import { InjectedConnector } from "wagmi/connectors/injected"; @@ -270,29 +274,48 @@ export function Widget({ ); return ( - - - {/* // TODO(KK): Probably don't want this in the widget. */} - {/* TODO: (M) Add ScopedCssBaseline to handle scrollbar styles */} - {validationResult.success ? ( - - ) : ( - - Input Error - + + + Oops! The Checkout Widget crashed +

+ Apologies for any inconvenience caused, but the Checkout Widget + just experienced an unexpected problem and failed to load. +

+

{ - fromZodError(validationResult.error, { - issueSeparator: "\n", - }).message + "We appreciate your understanding and patience. You might want to try reloading the page or come back later. If the issue persists, please don't hesitate to get in touch with us." } - +

- )} -
-
+ + } + > + + + {/* // TODO(KK): Probably don't want this in the widget. */} + {/* TODO: (M) Add ScopedCssBaseline to handle scrollbar styles */} + {validationResult.success ? ( + + ) : ( + + Input Error + + { + fromZodError(validationResult.error, { + issueSeparator: "\n", + }).message + } + + + )} + + + ); } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ef37989f..2bfe540f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,4 +1,4 @@ -lockfileVersion: '6.1' +lockfileVersion: '6.0' settings: autoInstallPeers: false @@ -588,6 +588,9 @@ importers: react-dom: specifier: ^18.2.0 version: 18.2.0(react@18.2.0) + react-error-boundary: + specifier: ^4.0.11 + version: 4.0.11(react@18.2.0) react-hook-form: specifier: ~7.46.1 version: 7.46.1(react@18.2.0) @@ -13662,6 +13665,15 @@ packages: react: 18.2.0 scheduler: 0.23.0 + /react-error-boundary@4.0.11(react@18.2.0): + resolution: {integrity: sha512-U13ul67aP5DOSPNSCWQ/eO0AQEYzEFkVljULQIjMV0KlffTAhxuDoBKdO0pb/JZ8mDhMKFZ9NZi0BmLGUiNphw==} + peerDependencies: + react: '>=16.13.1' + dependencies: + '@babel/runtime': 7.22.15 + react: 18.2.0 + dev: false + /react-google-recaptcha@3.1.0(react@18.2.0): resolution: {integrity: sha512-cYW2/DWas8nEKZGD7SCu9BSuVz8iOcOLHChHyi7upUuVhkpkhYG/6N3KDiTQ3XAiZ2UAZkfvYKMfAHOzBOcGEg==} peerDependencies: From 355071f38361e1de7ab4683adf13b52c77fbc815 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Tue, 19 Sep 2023 08:54:47 +0000 Subject: [PATCH 27/46] be more forceful with the force transaction btn --- packages/widget/src/ContractWriteManager.tsx | 27 ++++++++++++++++--- .../widget/src/StepContentTransactions.tsx | 2 +- 2 files changed, 24 insertions(+), 5 deletions(-) diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index 9393b94b..5e0c5cb1 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -5,6 +5,7 @@ import { UserRejectedRequestError, } from "viem"; import { + useAccount, useContractWrite, useNetwork, usePrepareContractWrite, @@ -35,7 +36,10 @@ export function ContractWriteManager({ onChange, }: ContractWriteManagerProps) { const { chain } = useNetwork(); - const prepare = _prepare && contractWrite.chainId === chain?.id; + const { isConnected, address: accountAddress } = useAccount(); + + const prepare = + accountAddress && _prepare && contractWrite.chainId === chain?.id; const { eventListeners } = useWidget(); @@ -46,9 +50,24 @@ export function ContractWriteManager({ // Always have a write ready. const writeResult = useContractWrite({ - ...(prepareResult.config.request - ? (prepareResult.config as unknown as ContractWrite) - : contractWrite), + ...(prepare + ? prepareResult.isError + ? { + mode: "prepared", + request: { + account: accountAddress, + chain: chain, + abi: contractWrite.abi, + address: contractWrite.address, + functionName: contractWrite.functionName, + args: contractWrite.args, + value: contractWrite.value, + }, + } + : prepareResult.isSuccess + ? prepareResult.config + : {} + : {}), onError: console.error, onSuccess: ({ hash }) => eventListeners.onTransactionSent?.({ diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index 887b16d4..b21943e7 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -122,7 +122,7 @@ export function StepContentTransactions({ stepIndex }: StepProps) { /> ))} - - {isValidating ? "Validating..." : "Continue"} + {isValidating + ? "Validating..." + : areContractWritesMapping + ? "Preparing transactions..." + : "Continue"}
diff --git a/packages/widget/src/Stepper.tsx b/packages/widget/src/Stepper.tsx index b1046d99..dbff02af 100644 --- a/packages/widget/src/Stepper.tsx +++ b/packages/widget/src/Stepper.tsx @@ -10,7 +10,7 @@ import { StepLabel, Stepper as MUIStepper, } from "@mui/material"; -import { useMemo,useRef } from "react"; +import { useMemo, useRef } from "react"; import { useFormContext } from "react-hook-form"; import { CheckoutSummary } from "./CheckoutSummary.js"; From 928aa2bf4b3183ccc0cecf2da33aade9ea5e2b3e Mon Sep 17 00:00:00 2001 From: elvijsTDL Date: Wed, 20 Sep 2023 14:03:32 +0200 Subject: [PATCH 36/46] Fix up test cases again --- .../components/stream-gating-editor/StreamGatingEditor.tsx | 6 +++++- tests/pageObjects/widgetPage.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/widget-builder/src/components/stream-gating-editor/StreamGatingEditor.tsx b/apps/widget-builder/src/components/stream-gating-editor/StreamGatingEditor.tsx index 51d7df7d..e544357c 100644 --- a/apps/widget-builder/src/components/stream-gating-editor/StreamGatingEditor.tsx +++ b/apps/widget-builder/src/components/stream-gating-editor/StreamGatingEditor.tsx @@ -230,7 +230,11 @@ const StreamGatingEditor: FC = ({ Gate your content with NFTs - + Create NFT your users will hold while they are paying for your product or service. diff --git a/tests/pageObjects/widgetPage.ts b/tests/pageObjects/widgetPage.ts index 31ed4655..15aaa7ce 100644 --- a/tests/pageObjects/widgetPage.ts +++ b/tests/pageObjects/widgetPage.ts @@ -150,7 +150,7 @@ export class WidgetPage extends BasePage { ); this.transactionStatusIcons = page.getByTestId("transaction-status-icon"); this.circleIcons = page.getByTestId("CircleIcon"); - this.checkmarkIcons = page.getByTestId("CheckCircleIcon"); + this.checkmarkIcons = page.getByTestId("CheckIcon"); } async changeCustomPaymentAmount(amount: string, timeunit = "month") { From dba4a142c359fd6cee3da7f9b05eb5c24cde1c26 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Wed, 20 Sep 2023 12:57:43 +0000 Subject: [PATCH 37/46] small clean-up --- packages/widget/src/ContractWriteButton.tsx | 6 ++++-- packages/widget/src/ContractWriteStatus.tsx | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index c4d15fe1..4a3dd64e 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -89,12 +89,14 @@ export default function ContractWriteButton({ }, [transactionResult.isLoading, onSkipButtonClick]); const isPrepareError = Boolean( - currentError && currentError === prepareResult.error, + currentError && + currentError === prepareResult.error && + !prepareResult.isLoading, ); const showForceSendButton = Boolean( isPrepareError && - !prepareResult.isFetching && + !prepareResult.isLoading && write && !writeResult.isLoading, ); diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index 0fe553eb..2920cdf1 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -61,8 +61,8 @@ export function ContractWriteStatus({ ? { text: "Completed", iconColor: palette.success.dark } : transactionResult.isError ? { text: "Failed", iconColor: palette.error.main } - : prepareResult.isFetching && !prepareResult.isSuccess - ? { text: "Estimating...", iconColor: palette.warning.main } + : prepareResult.isLoading && !prepareResult.isSuccess + ? { text: "Estimating transaction...", iconColor: palette.warning.main } : prepareResult.isError ? { text: "Estimation error", iconColor: palette.error.main } : writeResult.isSuccess From 231df78912f3452ce10c2a3809195d353718e688 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Wed, 20 Sep 2023 13:03:00 +0000 Subject: [PATCH 38/46] use cacheOnBlock when mapping commands --- packages/widget/src/CommandMapper.tsx | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index 965da99d..77c646a7 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -70,6 +70,7 @@ export function EnableAutoWrapCommandMapper({ args: [cmd.accountAddress, autoWrapStrategyAddress[cmd.chainId]], }, ], + cacheOnBlock: true, }); const [wrapScheduleData, allowanceData] = data ?? []; @@ -147,6 +148,7 @@ export function WrapIntoSuperTokensCommandMapper({ abi: erc20ABI, functionName: "allowance", args: [cmd.accountAddress, cmd.superTokenAddress], + cacheOnBlock: true, } : undefined, ); @@ -229,6 +231,7 @@ export function SubscribeCommandMapper({ abi: cfAv1ForwarderABI, functionName: "getFlowrate", args: [cmd.superTokenAddress, cmd.accountAddress, cmd.receiverAddress], + cacheOnBlock: true, }); const flowRate = From 5d35a032ad7b58db981125c61ae601420796ad51 Mon Sep 17 00:00:00 2001 From: elvijsTDL Date: Wed, 20 Sep 2023 15:28:12 +0200 Subject: [PATCH 39/46] Adjust the icon colors --- packages/widget/src/ContractWriteStatus.tsx | 1 - tests/pageObjects/widgetPage.ts | 16 ++++++++++++++-- tests/specs/widget.spec.ts | 18 ++++++++++-------- 3 files changed, 24 insertions(+), 11 deletions(-) diff --git a/packages/widget/src/ContractWriteStatus.tsx b/packages/widget/src/ContractWriteStatus.tsx index 0fe553eb..9cafaeab 100644 --- a/packages/widget/src/ContractWriteStatus.tsx +++ b/packages/widget/src/ContractWriteStatus.tsx @@ -120,7 +120,6 @@ export function ContractWriteStatus({ )} { for (const [index, transaction] of transactionList.entries()) { await expect( - this.transactionTypesAndStatuses.nth(index).locator("span"), + this.transactionTypesAndStatuses + .nth(index) + .locator("span.MuiTypography-root"), ).toHaveText(this.getTransactionTypeString(transaction) as string); await expect( this.transactionTypesAndStatuses.nth(index).locator("p"), @@ -448,7 +450,7 @@ export class WidgetPage extends BasePage { if (status === "Ready to send") { await expect( this.transactionStatusIcons.nth(index).locator(this.circleIcons), - ).toHaveCSS("color", "rgb(74, 193, 82)"); + ).toHaveCSS("color", "rgb(16, 187, 53)"); } if (status === "Queued") { await expect( @@ -460,11 +462,21 @@ export class WidgetPage extends BasePage { await expect( this.transactionStatusIcons.nth(index).locator(this.circleIcons), ).toHaveCSS("color", "rgb(243, 160, 2)"); + await expect( + this.transactionTypesAndStatuses + .nth(index) + .locator("span.MuiTouchRipple-root"), + ).toBeVisible(); } if (status === "Completed") { await expect( this.transactionStatusIcons.nth(index).locator(this.checkmarkIcons), ).toHaveCSS("color", "rgb(0, 137, 0)"); + await expect( + this.transactionTypesAndStatuses + .nth(index) + .locator("span.MuiTouchRipple-root"), + ).toBeVisible(); } if ( status === "Error" || diff --git a/tests/specs/widget.spec.ts b/tests/specs/widget.spec.ts index db3581ab..02913c6a 100644 --- a/tests/specs/widget.spec.ts +++ b/tests/specs/widget.spec.ts @@ -75,10 +75,11 @@ test("Approving and wrapping tokens", async ({ page }) => { await widgetPage.validateTransactionButtonTextAndClick("approve"); await widgetPage.validateTransactionButtonLoading(); await widgetPage.acceptMetamaskAllowanceTransaction("1"); - await widgetPage.validateTransactionStatuses( - ["approve", "wrap", "modify"], - ["Transaction sent", "Ready to send", "Queued"], - ); + // Checking the pending status makes the test case quite flaky + // await widgetPage.validateTransactionStatuses( + // ["approve", "wrap", "modify"], + // ["Transaction sent", "Ready to send", "Queued"], + // ); await widgetPage.validateTransactionStatuses( ["approve", "wrap", "modify"], ["Completed", "Ready to send", "Queued"], @@ -86,10 +87,11 @@ test("Approving and wrapping tokens", async ({ page }) => { await widgetPage.validateTransactionButtonTextAndClick("wrap"); await widgetPage.validateTransactionButtonLoading(); await widgetPage.acceptMetamaskTransaction(); - await widgetPage.validateTransactionStatuses( - ["approve", "wrap", "modify"], - ["Completed", "Transaction sent", "Queued"], - ); + // Checking the pending status makes the test case quite flaky + // await widgetPage.validateTransactionStatuses( + // ["approve", "wrap", "modify"], + // ["Completed", "Transaction sent", "Queued"], + // ); await widgetPage.validateTransactionStatuses( ["approve", "wrap", "modify"], ["Completed", "Completed", "Ready to send"], From 101225d5053486bb1bde523f88d9413779b0984b Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Wed, 20 Sep 2023 14:52:56 +0000 Subject: [PATCH 40/46] fix duplicate contract writes --- .../widget/src/CommandHandlerProvider.tsx | 3 +- packages/widget/src/commandHandlingReducer.ts | 34 ++++++++++++------- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/packages/widget/src/CommandHandlerProvider.tsx b/packages/widget/src/CommandHandlerProvider.tsx index 47324f73..c4480061 100644 --- a/packages/widget/src/CommandHandlerProvider.tsx +++ b/packages/widget/src/CommandHandlerProvider.tsx @@ -81,8 +81,9 @@ export function CommandHandlerProvider({ children }: Props) { >( ({ commandId, contractWrites }) => void dispatch({ - type: "add contract writes", + type: "set contract writes", payload: { + commandId, contractWrites, }, }), diff --git a/packages/widget/src/commandHandlingReducer.ts b/packages/widget/src/commandHandlingReducer.ts index 45a7e7b0..666d3b56 100644 --- a/packages/widget/src/commandHandlingReducer.ts +++ b/packages/widget/src/commandHandlingReducer.ts @@ -13,12 +13,7 @@ export type Action = | { type: "set contract writes"; payload: { - contractWrites: ReadonlyArray; - }; - } - | { - type: "add contract writes"; - payload: { + commandId?: string; contractWrites: ReadonlyArray; }; } @@ -52,13 +47,26 @@ export const useCommandHandlerReducer = () => break; } case "set contract writes": { - draft.contractWrites = castDraft(action.payload.contractWrites); - draft.writeIndex = 0; - break; - } - case "add contract writes": { - for (const write of action.payload.contractWrites) { - (draft.contractWrites as ContractWrite[]).push(write); + if (action.payload.commandId) { + const command = draft.commands.find( + (x) => x.id === action.payload.commandId, + ); + + if (!command) + throw new Error( + `Command not found with ID: ${action.payload.commandId}`, + ); + + const withoutPreviousCommandContractWrites = + draft.contractWrites.filter( + (x) => x.commandId !== action.payload.commandId, + ); + draft.contractWrites = castDraft([ + ...withoutPreviousCommandContractWrites, + ...action.payload.contractWrites, + ]); + } else { + draft.contractWrites = castDraft(action.payload.contractWrites); } draft.writeIndex = 0; break; From 63d71cffbfce9c06216cc1c18434941600d243cc Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Wed, 20 Sep 2023 15:49:45 +0000 Subject: [PATCH 41/46] re-render when fetch status changes --- packages/widget/src/ContractWriteButton.tsx | 45 ++++++++++--------- packages/widget/src/ContractWriteManager.tsx | 2 + .../widget/src/StepContentTransactions.tsx | 6 ++- 3 files changed, 31 insertions(+), 22 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index 4a3dd64e..bd384537 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -16,10 +16,12 @@ const SkipNextIcon = normalizeIcon(SkipNextIcon_); const WarningAmberIcon = normalizeIcon(WarningAmberIcon_); export type ContractWriteButtonProps = { + isLastWrite: boolean; handleNextWrite: () => void; } & ContractWriteResult; export default function ContractWriteButton({ + isLastWrite, handleNextWrite: handleNextWrite_, contractWrite, prepareResult, @@ -66,34 +68,35 @@ export default function ContractWriteButton({ write!(); }, [write, eventListeners.onButtonClick]); - const [showNextWriteButton_, setShowNextWriteButton] = useState(false); - const showNextWriteButton = showNextWriteButton_ || transactionResult.isError; + const isPrepareError = Boolean( + currentError && + currentError === prepareResult.error && + !prepareResult.isFetching, + ); + + const [allowNextWriteButton, setAllowNextWriteButton] = useState(false); + const showNextWriteButton = + (allowNextWriteButton || transactionResult.isError) && !isLastWrite; // Don't show the button for the last contract write. It would be confusing to show the success screen when possibly the last TX fails. const onSkipButtonClick = useCallback(() => { runEventListener(eventListeners.onButtonClick, { type: "skip_to_next", }); handleNextWrite_(); - setShowNextWriteButton(false); + setAllowNextWriteButton(false); }, [handleNextWrite_, eventListeners.onButtonClick]); useEffect(() => { if (transactionResult.isLoading) { const timeoutId = setTimeout(() => { - setShowNextWriteButton(true); + setAllowNextWriteButton(true); }, 15_000); // After 15 seconds, the button appears. return () => clearTimeout(timeoutId); } else { - setShowNextWriteButton(false); + setAllowNextWriteButton(false); } }, [transactionResult.isLoading, onSkipButtonClick]); - const isPrepareError = Boolean( - currentError && - currentError === prepareResult.error && - !prepareResult.isLoading, - ); - const showForceSendButton = Boolean( isPrepareError && !prepareResult.isLoading && @@ -150,28 +153,28 @@ export default function ContractWriteButton({ {writeButtonText}
)} - + - + diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index 04db2c63..baaa8738 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -121,8 +121,10 @@ export function ContractWriteManager({ }, [ contractWrite.id, prepareResult.status, + prepareResult.fetchStatus, writeResult.status, transactionResult.status, + transactionResult.fetchStatus, ]); useEffect(() => void onChange?.(result), [result]); diff --git a/packages/widget/src/StepContentTransactions.tsx b/packages/widget/src/StepContentTransactions.tsx index 67d6301d..8b6f6123 100644 --- a/packages/widget/src/StepContentTransactions.tsx +++ b/packages/widget/src/StepContentTransactions.tsx @@ -53,7 +53,10 @@ export function StepContentTransactions({ stepIndex }: StepProps) { }, [handleBack, eventListeners.onButtonClick, stepIndex]); const total = contractWrites.length; - const currentResult = contractWriteResults[Math.min(writeIndex, total - 1)]; + const lastWriteIndex = Math.max(total - 1, 0); + const isLastWrite = writeIndex === lastWriteIndex; + const currentResult = + contractWriteResults[Math.min(writeIndex, lastWriteIndex)]; const handleNextWrite = useCallback( () => handleNextWrite_(writeIndex), @@ -133,6 +136,7 @@ export function StepContentTransactions({ stepIndex }: StepProps) { {currentResult && ( )} From 06eeba82dcb4eaaef789e1ae61cd650c93a3ccf4 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Thu, 21 Sep 2023 07:56:13 +0000 Subject: [PATCH 42/46] add cache key and stale time to tx preparation --- packages/widget/src/ContractWriteButton.tsx | 2 +- packages/widget/src/ContractWriteManager.tsx | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/packages/widget/src/ContractWriteButton.tsx b/packages/widget/src/ContractWriteButton.tsx index bd384537..bc25c871 100644 --- a/packages/widget/src/ContractWriteButton.tsx +++ b/packages/widget/src/ContractWriteButton.tsx @@ -90,7 +90,7 @@ export default function ContractWriteButton({ if (transactionResult.isLoading) { const timeoutId = setTimeout(() => { setAllowNextWriteButton(true); - }, 15_000); // After 15 seconds, the button appears. + }, 30_000); // After 30 seconds, the button appears as an escape hatch. return () => clearTimeout(timeoutId); } else { setAllowNextWriteButton(false); diff --git a/packages/widget/src/ContractWriteManager.tsx b/packages/widget/src/ContractWriteManager.tsx index baaa8738..08fdb38f 100644 --- a/packages/widget/src/ContractWriteManager.tsx +++ b/packages/widget/src/ContractWriteManager.tsx @@ -54,7 +54,13 @@ export function ContractWriteManager({ const { eventListeners } = useWidget(); const prepareResult = usePrepareContractWrite({ - ...(prepare ? contractWrite : undefined), + ...(prepare + ? { + ...contractWrite, + scopeKey: contractWrite.commandId, + staleTime: 120_000, + } + : undefined), onError: console.error, }); From c3af8e745f0affbf34c0b22beae630ba5f96fe21 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Thu, 21 Sep 2023 13:04:14 +0000 Subject: [PATCH 43/46] fix batch call --- packages/widget/src/CommandMapper.tsx | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index aba1d8a3..fe8ff282 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -660,8 +660,9 @@ const createContractWrite = < const [operationType, target, call] = arg.materializeForBatchCall!(signature); + const callData = encodeFunctionData(call); + if (operationType === 201) { - const callData = encodeFunctionData(call); const data = encodeAbiParameters( parseAbiParameters("bytes, bytes"), [callData, "0x"], @@ -669,11 +670,14 @@ const createContractWrite = < return { operationType, target, data, value: call.value ?? 0n }; } else { - const callData = encodeFunctionData(call); + const data = encodeAbiParameters(parseAbiParameters("bytes"), [ + callData, + ]); + return { operationType, target, - data: callData, + data: data, value: call.value ?? 0n, }; } From ee1769fae4d458f5348029b86a7335e409ca6e2e Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 22 Sep 2023 10:16:04 +0000 Subject: [PATCH 44/46] the definite working solution for batch call --- packages/widget/src/CommandMapper.tsx | 32 +++++++++++++++++++++------ 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index fe8ff282..cacc025a 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -531,8 +531,12 @@ export function SubscribeCommandMapper({ { abi: erc20ABI, address: cmd.superTokenAddress, - functionName: "transfer", - args: [cmd.receiverAddress, cmd.transferAmountWei] as const, + functionName: "transferFrom", + args: [ + cmd.accountAddress, + cmd.receiverAddress, + cmd.transferAmountWei, + ] as const, }, ], }), @@ -669,17 +673,31 @@ const createContractWrite = < ); return { operationType, target, data, value: call.value ?? 0n }; + } else if (operationType === 202) { + return { + operationType, + target, + data: callData, + value: call.value ?? 0n, + }; } else { - const data = encodeAbiParameters(parseAbiParameters("bytes"), [ - callData, - ]); - return { operationType, target, - data: data, + data: removeSigHashFromCallData(callData), value: call.value ?? 0n, }; } }, }) as ContractWrite; + +const EMPTY = "0x"; + +/** + * Removes the 8-character (4 byte) signature hash from `callData`. + * @param callData + * @returns function parameters + */ +export const removeSigHashFromCallData = ( + callData: `0x${string}`, +): `0x${string}` => EMPTY.concat(callData.slice(10)) as `0x${string}`; From c0fd45797e5fb22f647347b27a680e292b5498ba Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 22 Sep 2023 10:20:57 +0000 Subject: [PATCH 45/46] refactor for better readability --- packages/widget/src/CommandMapper.tsx | 31 +++++++++++---------------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/packages/widget/src/CommandMapper.tsx b/packages/widget/src/CommandMapper.tsx index cacc025a..043fc99e 100644 --- a/packages/widget/src/CommandMapper.tsx +++ b/packages/widget/src/CommandMapper.tsx @@ -663,31 +663,26 @@ const createContractWrite = < : (signature) => { const [operationType, target, call] = arg.materializeForBatchCall!(signature); + const originalCallData = encodeFunctionData(call); - const callData = encodeFunctionData(call); - + let adjustedCallData: `0x${string}`; if (operationType === 201) { - const data = encodeAbiParameters( + adjustedCallData = encodeAbiParameters( parseAbiParameters("bytes, bytes"), - [callData, "0x"], + [originalCallData, "0x"], ); - - return { operationType, target, data, value: call.value ?? 0n }; } else if (operationType === 202) { - return { - operationType, - target, - data: callData, - value: call.value ?? 0n, - }; + adjustedCallData = originalCallData; } else { - return { - operationType, - target, - data: removeSigHashFromCallData(callData), - value: call.value ?? 0n, - }; + adjustedCallData = removeSigHashFromCallData(originalCallData); } + + return { + operationType, + target, + data: adjustedCallData, + value: call.value ?? 0n, + }; }, }) as ContractWrite; From a3dbfaee8cbb56fab5d3a7680578bfb2abc564d3 Mon Sep 17 00:00:00 2001 From: Kaspar Kallas Date: Fri, 22 Sep 2023 12:28:44 +0000 Subject: [PATCH 46/46] add link to mint permit underlying token & use permit super token as default payment option --- .../select-payment-option/SelectPaymentOption.tsx | 2 +- .../terms-and-privacy/TermsAndPrivacy.tsx | 14 ++++++++++++++ .../components/widget-preview/WidgetPreview.tsx | 4 ++-- apps/widget-builder/src/hooks/useDemoMode.ts | 8 ++++++-- 4 files changed, 23 insertions(+), 5 deletions(-) diff --git a/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx b/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx index e5c62acf..0edab6b5 100644 --- a/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx +++ b/apps/widget-builder/src/components/select-payment-option/SelectPaymentOption.tsx @@ -85,7 +85,7 @@ const SelectPaymentOption: FC = ({ if (value.superToken) { setSelectedToken( - tokenList.tokens.find( + widgetTokenList.tokens.find( ({ address }) => address.toLowerCase() === value.superToken.address.toLowerCase(), ) ?? null, diff --git a/apps/widget-builder/src/components/terms-and-privacy/TermsAndPrivacy.tsx b/apps/widget-builder/src/components/terms-and-privacy/TermsAndPrivacy.tsx index 285d74ab..c21185a4 100644 --- a/apps/widget-builder/src/components/terms-and-privacy/TermsAndPrivacy.tsx +++ b/apps/widget-builder/src/components/terms-and-privacy/TermsAndPrivacy.tsx @@ -2,6 +2,7 @@ import { Box } from "@mui/material"; import { FC } from "react"; import Link from "../../Link"; +import { goerliPermitTokens } from "../widget-preview/WidgetPreview"; const TermsAndPrivacy: FC = () => ( ( left: "540px", }} > + (x.tags ?? []).includes("underlying"))! + .address + }#writeContract#F4`} + > + {"Click here to mint Permit Super Token's underlying token on Goerli!"} + +
+ (x.tags ?? []).includes("supertoken"), + )!.address as Address, }, flowRate: { amountEther: "1",