From a6639d0c2ae153c6dca23721a26221109f6b15a3 Mon Sep 17 00:00:00 2001 From: ollie <67156692+0xEillo@users.noreply.github.com> Date: Mon, 4 Dec 2023 18:27:53 +0000 Subject: [PATCH] chore: add stdlib deploy script (#440) --- .../arbitrum-goerli/stdlib/ECDSAModule.json | 185 ++++++++++++ .../arbitrum-goerli/stdlib/ERC1721Module.json | 225 ++++++++++++++ .../arbitrum-goerli/stdlib/FeeModule.json | 185 ++++++++++++ .../arbitrum-goerli/stdlib/IndexerModule.json | 285 ++++++++++++++++++ .../arbitrum-goerli/stdlib/SchemaModule.json | 185 ++++++++++++ .../arbitrum-goerli/stdlib/SenderModule.json | 160 ++++++++++ contracts/package.json | 1 + contracts/script/deploy/deployStdLib.ts | 159 ++++++++++ 8 files changed, 1385 insertions(+) create mode 100644 contracts/deployments/arbitrum-goerli/stdlib/ECDSAModule.json create mode 100644 contracts/deployments/arbitrum-goerli/stdlib/ERC1721Module.json create mode 100644 contracts/deployments/arbitrum-goerli/stdlib/FeeModule.json create mode 100644 contracts/deployments/arbitrum-goerli/stdlib/IndexerModule.json create mode 100644 contracts/deployments/arbitrum-goerli/stdlib/SchemaModule.json create mode 100644 contracts/deployments/arbitrum-goerli/stdlib/SenderModule.json create mode 100644 contracts/script/deploy/deployStdLib.ts diff --git a/contracts/deployments/arbitrum-goerli/stdlib/ECDSAModule.json b/contracts/deployments/arbitrum-goerli/stdlib/ECDSAModule.json new file mode 100644 index 00000000..6d63d9f7 --- /dev/null +++ b/contracts/deployments/arbitrum-goerli/stdlib/ECDSAModule.json @@ -0,0 +1,185 @@ +{ + "address": "0x385C52D44427ACf361e0Abb25fCF2e82c100AeD2", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_portalRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ArrayLengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPortalOwner", + "type": "error" + }, + { + "inputs": [], + "name": "SignerNotAuthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "signers", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "bool[]", + "name": "authorizationStatus", + "type": "bool[]" + } + ], + "name": "SignersAuthorized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "address", + "name": "signer", + "type": "address" + } + ], + "name": "authorizedSigners", + "outputs": [ + { + "internalType": "bool", + "name": "authorizedSigners", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "portalRegistry", + "outputs": [ + { + "internalType": "contract PortalRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationDate", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "attestationData", + "type": "bytes" + } + ], + "internalType": "struct AttestationPayload", + "name": "_attestationPayload", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "_validationPayload", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "address[]", + "name": "signers", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "authorizationStatus", + "type": "bool[]" + } + ], + "name": "setAuthorizedSigners", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/contracts/deployments/arbitrum-goerli/stdlib/ERC1721Module.json b/contracts/deployments/arbitrum-goerli/stdlib/ERC1721Module.json new file mode 100644 index 00000000..67e9b483 --- /dev/null +++ b/contracts/deployments/arbitrum-goerli/stdlib/ERC1721Module.json @@ -0,0 +1,225 @@ +{ + "address": "0x43F078416EA2b2e344EF9ba43FBAA3A1deaAc81d", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_portalRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ArrayLengthMismatch", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "msg", + "type": "string" + } + ], + "name": "InvalidSignature", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidSignatureLength", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPortalOwner", + "type": "error" + }, + { + "inputs": [], + "name": "SignerNotAuthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "indexed": false, + "internalType": "address[]", + "name": "signers", + "type": "address[]" + }, + { + "indexed": false, + "internalType": "bool[]", + "name": "authorizationStatus", + "type": "bool[]" + } + ], + "name": "SignersAuthorized", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "address", + "name": "signer", + "type": "address" + } + ], + "name": "authorizedSigners", + "outputs": [ + { + "internalType": "bool", + "name": "authorizedSigners", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "_hash", + "type": "bytes32" + }, + { + "internalType": "bytes", + "name": "_signature", + "type": "bytes" + } + ], + "name": "isValidSignature", + "outputs": [ + { + "internalType": "bytes4", + "name": "magicValue", + "type": "bytes4" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "portalRegistry", + "outputs": [ + { + "internalType": "contract PortalRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationDate", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "attestationData", + "type": "bytes" + } + ], + "internalType": "struct AttestationPayload", + "name": "attestationPayload", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "validationPayload", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "address[]", + "name": "signers", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "authorizationStatus", + "type": "bool[]" + } + ], + "name": "setAuthorizedSigners", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/contracts/deployments/arbitrum-goerli/stdlib/FeeModule.json b/contracts/deployments/arbitrum-goerli/stdlib/FeeModule.json new file mode 100644 index 00000000..7fbbe855 --- /dev/null +++ b/contracts/deployments/arbitrum-goerli/stdlib/FeeModule.json @@ -0,0 +1,185 @@ +{ + "address": "0xBF7b8F1AB43b68902439001Dc5120996B26bD14C", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_portalRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ArrayLengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "InvalidAttestationFee", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPortalOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "schemaIds", + "type": "bytes32[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "attestationFees", + "type": "uint256[]" + } + ], + "name": "FeesSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + } + ], + "name": "attestationFees", + "outputs": [ + { + "internalType": "uint256", + "name": "attestationFee", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "portalRegistry", + "outputs": [ + { + "internalType": "contract PortalRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationDate", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "attestationData", + "type": "bytes" + } + ], + "internalType": "struct AttestationPayload", + "name": "_attestationPayload", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_value", + "type": "uint256" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "schemaIds", + "type": "bytes32[]" + }, + { + "internalType": "uint256[]", + "name": "_attestationFees", + "type": "uint256[]" + } + ], + "name": "setFees", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/contracts/deployments/arbitrum-goerli/stdlib/IndexerModule.json b/contracts/deployments/arbitrum-goerli/stdlib/IndexerModule.json new file mode 100644 index 00000000..049d51a9 --- /dev/null +++ b/contracts/deployments/arbitrum-goerli/stdlib/IndexerModule.json @@ -0,0 +1,285 @@ +{ + "address": "0x3206557F2AFa7D45DabFA64C3b792e9C4C33491A", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_router", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "OnlyPortalOwner", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + } + ], + "name": "AttestationIndexed", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "attester", + "type": "address" + } + ], + "name": "getAttestationIdsByAttester", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + } + ], + "name": "getAttestationIdsByPortal", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + } + ], + "name": "getAttestationIdsByPortalBySubject", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "schema", + "type": "bytes32" + } + ], + "name": "getAttestationIdsBySchema", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + } + ], + "name": "getAttestationIdsBySubject", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + } + ], + "name": "getAttestationIdsBySubjectBySchema", + "outputs": [ + { + "internalType": "bytes32[]", + "name": "", + "type": "bytes32[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + } + ], + "name": "getIndexedAttestationStatus", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "attestationId", + "type": "bytes32" + } + ], + "name": "indexAttestation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "attestationIds", + "type": "bytes32[]" + } + ], + "name": "indexAttestations", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "router", + "outputs": [ + { + "internalType": "contract Router", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationDate", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "attestationData", + "type": "bytes" + } + ], + "internalType": "struct AttestationPayload", + "name": "_attestationPayload", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/contracts/deployments/arbitrum-goerli/stdlib/SchemaModule.json b/contracts/deployments/arbitrum-goerli/stdlib/SchemaModule.json new file mode 100644 index 00000000..5ab7816e --- /dev/null +++ b/contracts/deployments/arbitrum-goerli/stdlib/SchemaModule.json @@ -0,0 +1,185 @@ +{ + "address": "0xDd3DAD7A9dE12a295DDe5B7980FF4e7f5A80e754", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_portalRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ArraylengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPortalOwner", + "type": "error" + }, + { + "inputs": [], + "name": "SchemaNotAuthorized", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "indexed": false, + "internalType": "bytes32[]", + "name": "schemaIds", + "type": "bytes32[]" + }, + { + "indexed": false, + "internalType": "bool[]", + "name": "authorizedStatus", + "type": "bool[]" + } + ], + "name": "SchemaIdsSet", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + } + ], + "name": "authorizedSchemaIds", + "outputs": [ + { + "internalType": "bool", + "name": "authorized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "portalRegistry", + "outputs": [ + { + "internalType": "contract PortalRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationDate", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "attestationData", + "type": "bytes" + } + ], + "internalType": "struct AttestationPayload", + "name": "_attestationPayload", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "schemaIds", + "type": "bytes32[]" + }, + { + "internalType": "bool[]", + "name": "authorizedStatus", + "type": "bool[]" + } + ], + "name": "setAuthorizedSchemaIds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/contracts/deployments/arbitrum-goerli/stdlib/SenderModule.json b/contracts/deployments/arbitrum-goerli/stdlib/SenderModule.json new file mode 100644 index 00000000..a8b588cb --- /dev/null +++ b/contracts/deployments/arbitrum-goerli/stdlib/SenderModule.json @@ -0,0 +1,160 @@ +{ + "address": "0xEF0327003A0a9727c4629D40f8897D7fE0aA6ACe", + "abi": [ + { + "inputs": [ + { + "internalType": "address", + "name": "_portalRegistry", + "type": "address" + } + ], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "ArraylengthMismatch", + "type": "error" + }, + { + "inputs": [], + "name": "OnlyPortalOwner", + "type": "error" + }, + { + "inputs": [], + "name": "UnauthorizedSender", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "address", + "name": "sender", + "type": "address" + } + ], + "name": "authorizedSenders", + "outputs": [ + { + "internalType": "bool", + "name": "authorized", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "portalRegistry", + "outputs": [ + { + "internalType": "contract PortalRegistry", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "components": [ + { + "internalType": "bytes32", + "name": "schemaId", + "type": "bytes32" + }, + { + "internalType": "uint64", + "name": "expirationDate", + "type": "uint64" + }, + { + "internalType": "bytes", + "name": "subject", + "type": "bytes" + }, + { + "internalType": "bytes", + "name": "attestationData", + "type": "bytes" + } + ], + "internalType": "struct AttestationPayload", + "name": "", + "type": "tuple" + }, + { + "internalType": "bytes", + "name": "", + "type": "bytes" + }, + { + "internalType": "address", + "name": "_txSender", + "type": "address" + }, + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "name": "run", + "outputs": [], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "portal", + "type": "address" + }, + { + "internalType": "address[]", + "name": "senders", + "type": "address[]" + }, + { + "internalType": "bool[]", + "name": "authorizedStatus", + "type": "bool[]" + } + ], + "name": "setAuthorizedSenders", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceID", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "pure", + "type": "function" + } + ] +} diff --git a/contracts/package.json b/contracts/package.json index 3c6d2e89..638cd23d 100644 --- a/contracts/package.json +++ b/contracts/package.json @@ -25,6 +25,7 @@ "decode": "npx hardhat run script/decode.ts", "deploy": "npx hardhat run script/deploy/deployEverything.ts --network", "deploy:post": "npx hardhat run script/deploy/postDeployment.ts --network", + "deploy:stdlib": "npx hardhat run script/deploy/deployStdLib.ts --network", "encode": "npx hardhat run script/encode.ts", "lint": "pnpm solhint \"{script,src,test}/**/*.sol\"", "massImport:prepare": "npx hardhat run script/massImport/prepareData.ts", diff --git a/contracts/script/deploy/deployStdLib.ts b/contracts/script/deploy/deployStdLib.ts new file mode 100644 index 00000000..d08be632 --- /dev/null +++ b/contracts/script/deploy/deployStdLib.ts @@ -0,0 +1,159 @@ +import { ethers, run } from "hardhat"; +import dotenv from "dotenv"; + +dotenv.config({ path: "../.env" }); + +const PORTAL_REGISTRY_ADDRESS = process.env.PORTAL_REGISTRY_ADDRESS ?? ""; +const MODULE_REGISTRY_ADDRESS = process.env.MODULE_REGISTRY_ADDRESS ?? ""; + +async function main() { + console.log(`START SCRIPT`); + + console.log("Deploying ECDSAModule..."); + const ECDSAModule = await ethers.getContractFactory("ECDSAModule"); + const ecdsaModule = await ECDSAModule.deploy(PORTAL_REGISTRY_ADDRESS); + await ecdsaModule.waitForDeployment(); + const ecdsaModuleAddress = await ecdsaModule.getAddress(); + console.log(`ECDSAModule deployed to: ${ecdsaModuleAddress}`); + await run("verify:verify", { + address: ecdsaModuleAddress, + constructorArguments: [PORTAL_REGISTRY_ADDRESS], + }); + + console.log(`\n----\n`); + + console.log("Deploying ERC1271Module..."); + const ERC1271Module = await ethers.getContractFactory("ERC1271Module"); + const erc1271Module = await ERC1271Module.deploy(PORTAL_REGISTRY_ADDRESS); + await erc1271Module.waitForDeployment(); + const erc1271ModuleAddress = await erc1271Module.getAddress(); + console.log(`ERC1271Module deployed to: ${erc1271ModuleAddress}`); + await run("verify:verify", { + address: erc1271ModuleAddress, + constructorArguments: [PORTAL_REGISTRY_ADDRESS], + }); + + console.log(`\n----\n`); + + console.log("Deploying FeeModule..."); + const FeeModule = await ethers.getContractFactory("FeeModule"); + const feeModule = await FeeModule.deploy(PORTAL_REGISTRY_ADDRESS); + await feeModule.waitForDeployment(); + const feeModuleAddress = await feeModule.getAddress(); + console.log(`FeeModule deployed to: ${feeModuleAddress}`); + await run("verify:verify", { + address: feeModuleAddress, + constructorArguments: [PORTAL_REGISTRY_ADDRESS], + }); + + console.log(`\n----\n`); + + console.log("Deploying IndexerModule..."); + const IndexerModule = await ethers.getContractFactory("IndexerModule"); + const indexerModule = await IndexerModule.deploy(PORTAL_REGISTRY_ADDRESS); + await indexerModule.waitForDeployment(); + const indexerModuleAddress = await indexerModule.getAddress(); + console.log(`IndexerModule deployed to: ${indexerModuleAddress}`); + await run("verify:verify", { + address: indexerModuleAddress, + constructorArguments: [PORTAL_REGISTRY_ADDRESS], + }); + + console.log(`\n----\n`); + + console.log("Deploying SchemaModule..."); + const SchemaModule = await ethers.getContractFactory("SchemaModule"); + const schemaModule = await SchemaModule.deploy(PORTAL_REGISTRY_ADDRESS); + await schemaModule.waitForDeployment(); + const schemaModuleAddress = await schemaModule.getAddress(); + console.log(`SchemaModule deployed to: ${schemaModuleAddress}`); + await run("verify:verify", { + address: schemaModuleAddress, + constructorArguments: [PORTAL_REGISTRY_ADDRESS], + }); + + console.log(`\n----\n`); + + console.log("Deploying SenderModule..."); + const SenderModule = await ethers.getContractFactory("SenderModule"); + const senderModule = await SenderModule.deploy(PORTAL_REGISTRY_ADDRESS); + await senderModule.waitForDeployment(); + const senderModuleAddress = await senderModule.getAddress(); + console.log(`SenderModule deployed to: ${senderModuleAddress}`); + await run("verify:verify", { + address: senderModuleAddress, + constructorArguments: [PORTAL_REGISTRY_ADDRESS], + }); + + console.log(`\n----\n`); + + console.log("ALL MODULES DEPLOYED!"); + + console.log(`\n----\n`); + + console.log("Registering modules on the ModuleRegistry..."); + const moduleRegistry = await ethers.getContractAt("ModuleRegistry", MODULE_REGISTRY_ADDRESS); + + const registerECDSAModule = await moduleRegistry.register( + "ECDSAModule", + "A standard library module deployed by Verax, allowing ECDSA signature verification", + ecdsaModuleAddress, + ); + await registerECDSAModule.wait(); + console.log("ECDSAModule registered"); + + const registerERC1271Module = await moduleRegistry.register( + "ERC1271Module", + "A standard library module deployed by Verax, allowing ERC1271 signature verification", + erc1271ModuleAddress, + ); + await registerERC1271Module.wait(); + console.log("ERC1271Module registered"); + + const registerFeeModule = await moduleRegistry.register( + "FeeModule", + "A standard library module deployed by Verax, allowing attestation fees", + feeModuleAddress, + ); + await registerFeeModule.wait(); + console.log("FeeModule registered"); + + const registerIndexerModule = await moduleRegistry.register( + "IndexerModule", + "A standard library module deployed by Verax, indexing attestations", + indexerModuleAddress, + ); + await registerIndexerModule.wait(); + console.log("IndexerModule registered"); + + const registerSchemaModule = await moduleRegistry.register( + "SchemaModule", + "A standard library module deployed by Verax, checking attestation schemas", + schemaModuleAddress, + ); + await registerSchemaModule.wait(); + console.log("SchemaModule registered"); + + const registerSenderModule = await moduleRegistry.register( + "SenderModule", + "A standard library module deployed by Verax, checking attestation senders", + senderModuleAddress, + ); + await registerSenderModule.wait(); + console.log("SenderModule registered"); + + console.log("ALL MODULES REGISTERED!"); + + console.log("Module Addresses:"); + console.log("ECDSAModule: " + ecdsaModuleAddress); + console.log("ERC1271Module: " + erc1271ModuleAddress); + console.log("FeeModule: " + feeModuleAddress); + console.log("IndexerModule: " + indexerModuleAddress); + console.log("SchemaModule: " + schemaModuleAddress); + console.log("SenderModule: " + senderModuleAddress); +} + +main().catch((error) => { + console.error(error); + process.exitCode = 1; +});