diff --git a/abi/BeneficiaryFactory.ts b/abi/BeneficiaryFactory.ts new file mode 100644 index 0000000..9dfb43c --- /dev/null +++ b/abi/BeneficiaryFactory.ts @@ -0,0 +1,542 @@ +import { type Abi } from "viem"; + +const beneficiaryFactoryAbi = [ + { + type: "constructor", + inputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "DEFAULT_ADMIN_ROLE", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADER_ROLE", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADE_INTERFACE_VERSION", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "beacon", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "create", + inputs: [ + { + name: "admin", + type: "address", + internalType: "address", + }, + { + name: "withdrawer", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "getRoleAdmin", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "grantRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "hasRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [ + { + name: "admin", + type: "address", + internalType: "address", + }, + { + name: "implementation", + type: "address", + internalType: "address", + }, + { + name: "slaAllocator_", + type: "address", + internalType: "contract SLAAllocator", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "instances", + inputs: [ + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + outputs: [ + { + name: "contractAddress", + type: "address", + internalType: "address", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "nonce", + inputs: [ + { + name: "admin", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + outputs: [ + { + name: "deployCounter", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "renounceRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "callerConfirmation", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "revokeRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "slaAllocator", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract SLAAllocator", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "ProxyCreated", + inputs: [ + { + name: "proxy", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "provider", + type: "uint64", + indexed: true, + internalType: "CommonTypes.FilActorId", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleAdminChanged", + inputs: [ + { + name: "role", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "previousAdminRole", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "newAdminRole", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleGranted", + inputs: [ + { + name: "role", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleRevoked", + inputs: [ + { + name: "role", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AccessControlBadConfirmation", + inputs: [], + }, + { + type: "error", + name: "AccessControlUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "neededRole", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "Create2EmptyBytecode", + inputs: [], + }, + { + type: "error", + name: "ERC1967InvalidImplementation", + inputs: [ + { + name: "implementation", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "ERC1967NonPayable", + inputs: [], + }, + { + type: "error", + name: "FailedCall", + inputs: [], + }, + { + type: "error", + name: "FailedDeployment", + inputs: [], + }, + { + type: "error", + name: "InstanceAlreadyExists", + inputs: [], + }, + { + type: "error", + name: "InsufficientBalance", + inputs: [ + { + name: "balance", + type: "uint256", + internalType: "uint256", + }, + { + name: "needed", + type: "uint256", + internalType: "uint256", + }, + ], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "NotInitializing", + inputs: [], + }, + { + type: "error", + name: "UUPSUnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UUPSUnsupportedProxiableUUID", + inputs: [ + { + name: "slot", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, +] as const satisfies Abi; + +export default beneficiaryFactoryAbi; diff --git a/abi/SLARegistry.ts b/abi/SLARegistry.ts new file mode 100644 index 0000000..95f5d34 --- /dev/null +++ b/abi/SLARegistry.ts @@ -0,0 +1,597 @@ +import { type Abi } from "viem"; + +const SLARegistryAbi = [ + { + type: "constructor", + inputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "DEFAULT_ADMIN_ROLE", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADER_ROLE", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "UPGRADE_INTERFACE_VERSION", + inputs: [], + outputs: [ + { + name: "", + type: "string", + internalType: "string", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "getRoleAdmin", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + ], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "grantRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "hasRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "initialize", + inputs: [ + { + name: "admin", + type: "address", + internalType: "address", + }, + { + name: "oracle_", + type: "address", + internalType: "contract SLIOracle", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "oracle", + inputs: [], + outputs: [ + { + name: "", + type: "address", + internalType: "contract SLIOracle", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "proxiableUUID", + inputs: [], + outputs: [ + { + name: "", + type: "bytes32", + internalType: "bytes32", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "registerSLA", + inputs: [ + { + name: "client", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + { + name: "slaParams", + type: "tuple", + internalType: "struct SLARegistry.SLAParams", + components: [ + { + name: "latency", + type: "uint32", + internalType: "uint32", + }, + { + name: "retention", + type: "uint16", + internalType: "uint16", + }, + { + name: "bandwidth", + type: "uint16", + internalType: "uint16", + }, + { + name: "stability", + type: "uint16", + internalType: "uint16", + }, + { + name: "availability", + type: "uint8", + internalType: "uint8", + }, + { + name: "indexing", + type: "uint8", + internalType: "uint8", + }, + { + name: "registered", + type: "bool", + internalType: "bool", + }, + ], + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "renounceRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "callerConfirmation", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "revokeRole", + inputs: [ + { + name: "role", + type: "bytes32", + internalType: "bytes32", + }, + { + name: "account", + type: "address", + internalType: "address", + }, + ], + outputs: [], + stateMutability: "nonpayable", + }, + { + type: "function", + name: "score", + inputs: [ + { + name: "client", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + outputs: [ + { + name: "", + type: "uint256", + internalType: "uint256", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "slas", + inputs: [ + { + name: "client", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + outputs: [ + { + name: "latency", + type: "uint32", + internalType: "uint32", + }, + { + name: "retention", + type: "uint16", + internalType: "uint16", + }, + { + name: "bandwidth", + type: "uint16", + internalType: "uint16", + }, + { + name: "stability", + type: "uint16", + internalType: "uint16", + }, + { + name: "availability", + type: "uint8", + internalType: "uint8", + }, + { + name: "indexing", + type: "uint8", + internalType: "uint8", + }, + { + name: "registered", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "supportsInterface", + inputs: [ + { + name: "interfaceId", + type: "bytes4", + internalType: "bytes4", + }, + ], + outputs: [ + { + name: "", + type: "bool", + internalType: "bool", + }, + ], + stateMutability: "view", + }, + { + type: "function", + name: "upgradeToAndCall", + inputs: [ + { + name: "newImplementation", + type: "address", + internalType: "address", + }, + { + name: "data", + type: "bytes", + internalType: "bytes", + }, + ], + outputs: [], + stateMutability: "payable", + }, + { + type: "event", + name: "Initialized", + inputs: [ + { + name: "version", + type: "uint64", + indexed: false, + internalType: "uint64", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleAdminChanged", + inputs: [ + { + name: "role", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "previousAdminRole", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "newAdminRole", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleGranted", + inputs: [ + { + name: "role", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "RoleRevoked", + inputs: [ + { + name: "role", + type: "bytes32", + indexed: true, + internalType: "bytes32", + }, + { + name: "account", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "sender", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "SLARegistered", + inputs: [ + { + name: "client", + type: "address", + indexed: true, + internalType: "address", + }, + { + name: "provider", + type: "uint64", + indexed: true, + internalType: "CommonTypes.FilActorId", + }, + ], + anonymous: false, + }, + { + type: "event", + name: "Upgraded", + inputs: [ + { + name: "implementation", + type: "address", + indexed: true, + internalType: "address", + }, + ], + anonymous: false, + }, + { + type: "error", + name: "AccessControlBadConfirmation", + inputs: [], + }, + { + type: "error", + name: "AccessControlUnauthorizedAccount", + inputs: [ + { + name: "account", + type: "address", + internalType: "address", + }, + { + name: "neededRole", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, + { + type: "error", + name: "AddressEmptyCode", + inputs: [ + { + name: "target", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "ERC1967InvalidImplementation", + inputs: [ + { + name: "implementation", + type: "address", + internalType: "address", + }, + ], + }, + { + type: "error", + name: "ERC1967NonPayable", + inputs: [], + }, + { + type: "error", + name: "FailedCall", + inputs: [], + }, + { + type: "error", + name: "InvalidInitialization", + inputs: [], + }, + { + type: "error", + name: "NotInitializing", + inputs: [], + }, + { + type: "error", + name: "SLAAlreadyRegistered", + inputs: [ + { + name: "client", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + }, + { + type: "error", + name: "SLAUnknown", + inputs: [ + { + name: "client", + type: "address", + internalType: "address", + }, + { + name: "provider", + type: "uint64", + internalType: "CommonTypes.FilActorId", + }, + ], + }, + { + type: "error", + name: "UUPSUnauthorizedCallContext", + inputs: [], + }, + { + type: "error", + name: "UUPSUnsupportedProxiableUUID", + inputs: [ + { + name: "slot", + type: "bytes32", + internalType: "bytes32", + }, + ], + }, +] as const satisfies Abi; + +export default SLARegistryAbi; diff --git a/app/(app)/page.tsx b/app/(app)/page.tsx index 6a18b03..b0cff6e 100644 --- a/app/(app)/page.tsx +++ b/app/(app)/page.tsx @@ -1,3 +1,5 @@ +"use client"; + import ScreenBreadcrumbs from "@/components/ScreenBreadcrumbs"; import { Button } from "@/components/ui/button"; import { @@ -7,9 +9,13 @@ import { CardHeader, CardTitle, } from "@/components/ui/card"; +import { filecoinDevnet } from "@/config/chains"; import Link from "next/link"; +import { useChainId } from "wagmi"; export default function HomePage() { + const chainId = useChainId(); + return (
- List and create new allocator contracts. Manage individual - allocators allowance. Manage contracts ownership and more. -
-+ List and create new allocator contracts. Manage individual + allocators allowance. Manage contracts ownership and more. +
+- Create new Client contracts. Manage individual clients allowance. - Manage contracts ownership and more. -
-+ Create new Client contracts. Manage individual clients + allowance. Manage contracts ownership and more. +
+Deploy new Beneficiary contracts and manage SLA registry.
+