From 4503d6000888f28319d0d0d16c72619223d1a507 Mon Sep 17 00:00:00 2001 From: Jan-Felix Date: Tue, 9 Jan 2024 12:53:42 +0100 Subject: [PATCH] include Integrity errors directly in the ABI json this way also the exported contract factories will support decoding these errors --- sdk/abi/RolesV2.json | 76 +++++++++++++++++++++++ sdk/abi/RolesV2Integrity.json | 113 ---------------------------------- sdk/contracts.ts | 7 +-- 3 files changed, 77 insertions(+), 119 deletions(-) delete mode 100644 sdk/abi/RolesV2Integrity.json diff --git a/sdk/abi/RolesV2.json b/sdk/abi/RolesV2.json index 32948967..f9b0337f 100644 --- a/sdk/abi/RolesV2.json +++ b/sdk/abi/RolesV2.json @@ -1,4 +1,80 @@ [ + { + "inputs": [], + "name": "NotBFS", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "UnsuitableChildCount", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "UnsuitableChildTypeTree", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "UnsuitableCompValue", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "UnsuitableParameterType", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "UnsuitableParent", + "type": "error" + }, + { + "inputs": [], + "name": "UnsuitableRootNode", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "index", + "type": "uint256" + } + ], + "name": "UnsupportedOperator", + "type": "error" + }, { "inputs": [ { diff --git a/sdk/abi/RolesV2Integrity.json b/sdk/abi/RolesV2Integrity.json deleted file mode 100644 index 0de4fe88..00000000 --- a/sdk/abi/RolesV2Integrity.json +++ /dev/null @@ -1,113 +0,0 @@ -[ - { - "inputs": [], - "name": "NotBFS", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "UnsuitableChildCount", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "UnsuitableChildTypeTree", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "UnsuitableCompValue", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "UnsuitableParameterType", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "UnsuitableParent", - "type": "error" - }, - { - "inputs": [], - "name": "UnsuitableRootNode", - "type": "error" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "index", - "type": "uint256" - } - ], - "name": "UnsupportedOperator", - "type": "error" - }, - { - "inputs": [ - { - "components": [ - { - "internalType": "uint8", - "name": "parent", - "type": "uint8" - }, - { - "internalType": "enum ParameterType", - "name": "paramType", - "type": "ParameterType" - }, - { - "internalType": "enum Operator", - "name": "operator", - "type": "Operator" - }, - { - "internalType": "bytes", - "name": "compValue", - "type": "bytes" - } - ], - "internalType": "struct ConditionFlat[]", - "name": "conditions", - "type": "tuple[]" - } - ], - "name": "enforce", - "outputs": [], - "stateMutability": "pure", - "type": "function" - } -] \ No newline at end of file diff --git a/sdk/contracts.ts b/sdk/contracts.ts index 4f3d3a54..5a429112 100644 --- a/sdk/contracts.ts +++ b/sdk/contracts.ts @@ -17,7 +17,6 @@ import RealityErc20Abi from "./abi/RealityErc20.json"; import RealityEthAbi from "./abi/RealityEth.json"; import RolesV1Abi from "./abi/RolesV1.json"; import RolesV2Abi from "./abi/RolesV2.json"; -import RolesV2IntegrityAbi from "./abi/RolesV2Integrity.json"; import ScopeGuardAbi from "./abi/ScopeGuard.json"; import TellorAbi from "./abi/Tellor.json"; import { KnownContracts } from "./factory/types"; @@ -248,11 +247,7 @@ export const ContractAbis: Record = { [KnownContracts.REALITY_ETH]: RealityEthAbi, [KnownContracts.ROLES]: RolesV1Abi, [KnownContracts.ROLES_V1]: RolesV1Abi, - [KnownContracts.ROLES_V2]: [ - ...RolesV2Abi, - // we add the custom errors from the Integrity lib so integrity check errors can be decoded - RolesV2IntegrityAbi.filter((fragment) => fragment.type === "error"), - ], + [KnownContracts.ROLES_V2]: RolesV2Abi, // we've manually added custom errors from Integrity.sol to the ABI in RolesV2.json [KnownContracts.SCOPE_GUARD]: ScopeGuardAbi, [KnownContracts.TELLOR]: TellorAbi, [KnownContracts.MULTISEND_ENCODER]: MultisendEncoderAbi,