diff --git a/Ethereum/ethereum-ens/abis/EthRegistrarController.json b/Ethereum/ethereum-ens/abis/EthRegistrarController.json index 21c16401..9e41bed0 100644 --- a/Ethereum/ethereum-ens/abis/EthRegistrarController.json +++ b/Ethereum/ethereum-ens/abis/EthRegistrarController.json @@ -35,6 +35,81 @@ "stateMutability": "nonpayable", "type": "constructor" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooNew", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "CommitmentTooOld", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "duration", + "type": "uint256" + } + ], + "name": "DurationTooShort", + "type": "error" + }, + { + "inputs": [], + "name": "InsufficientValue", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooHigh", + "type": "error" + }, + { + "inputs": [], + "name": "MaxCommitmentAgeTooLow", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "string", + "name": "name", + "type": "string" + } + ], + "name": "NameNotAvailable", + "type": "error" + }, + { + "inputs": [], + "name": "ResolverRequiredWhenDataSupplied", + "type": "error" + }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "commitment", + "type": "bytes32" + } + ], + "name": "UnexpiredCommitmentExists", + "type": "error" + }, { "anonymous": false, "inputs": [ @@ -230,14 +305,9 @@ "type": "bool" }, { - "internalType": "uint32", - "name": "fuses", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "wrapperExpiry", - "type": "uint64" + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" } ], "name": "makeCommitment", @@ -316,6 +386,29 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -354,14 +447,9 @@ "type": "bool" }, { - "internalType": "uint32", - "name": "fuses", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "wrapperExpiry", - "type": "uint64" + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" } ], "name": "register", diff --git a/Ethereum/ethereum-ens/abis/NameWrapper.json b/Ethereum/ethereum-ens/abis/NameWrapper.json index 303bd48f..da09743c 100644 --- a/Ethereum/ethereum-ens/abis/NameWrapper.json +++ b/Ethereum/ethereum-ens/abis/NameWrapper.json @@ -80,7 +80,7 @@ }, { "inputs": [], - "name": "NameNotFound", + "name": "NameIsNotWrapped", "type": "error" }, { @@ -163,12 +163,6 @@ "name": "node", "type": "bytes32" }, - { - "indexed": false, - "internalType": "uint32", - "name": "fuses", - "type": "uint32" - }, { "indexed": false, "internalType": "uint64", @@ -176,6 +170,25 @@ "type": "uint64" } ], + "name": "ExpiryExtended", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "indexed": false, + "internalType": "uint32", + "name": "fuses", + "type": "uint32" + } + ], "name": "FusesSet", "type": "event" }, @@ -438,6 +451,30 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + }, + { + "internalType": "address", + "name": "addr", + "type": "address" + } + ], + "name": "canModifyName", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -473,22 +510,14 @@ { "inputs": [ { - "internalType": "uint256", - "name": "tokenId", - "type": "uint256" - } - ], - "name": "getData", - "outputs": [ - { - "internalType": "address", - "name": "owner", - "type": "address" + "internalType": "bytes32", + "name": "parentNode", + "type": "bytes32" }, { - "internalType": "uint32", - "name": "fuses", - "type": "uint32" + "internalType": "bytes32", + "name": "labelhash", + "type": "bytes32" }, { "internalType": "uint64", @@ -496,19 +525,32 @@ "type": "uint64" } ], - "stateMutability": "view", + "name": "extendExpiry", + "outputs": [ + { + "internalType": "uint64", + "name": "", + "type": "uint64" + } + ], + "stateMutability": "nonpayable", "type": "function" }, { "inputs": [ { - "internalType": "bytes32", - "name": "node", - "type": "bytes32" + "internalType": "uint256", + "name": "id", + "type": "uint256" } ], - "name": "getFuses", + "name": "getData", "outputs": [ + { + "internalType": "address", + "name": "owner", + "type": "address" + }, { "internalType": "uint32", "name": "fuses", @@ -553,14 +595,9 @@ "internalType": "bytes32", "name": "node", "type": "bytes32" - }, - { - "internalType": "address", - "name": "addr", - "type": "address" } ], - "name": "isTokenOwnerOrApproved", + "name": "isWrapped", "outputs": [ { "internalType": "bool", @@ -584,6 +621,19 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, { "inputs": [ { @@ -669,6 +719,29 @@ "stateMutability": "view", "type": "function" }, + { + "inputs": [ + { + "internalType": "address", + "name": "_token", + "type": "address" + }, + { + "internalType": "address", + "name": "_to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_amount", + "type": "uint256" + } + ], + "name": "recoverFunds", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, { "inputs": [ { @@ -692,14 +765,9 @@ "type": "address" }, { - "internalType": "uint32", - "name": "fuses", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "expiry", - "type": "uint64" + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" } ], "name": "registerAndWrapETH2LD", @@ -737,11 +805,6 @@ "internalType": "uint256", "name": "duration", "type": "uint256" - }, - { - "internalType": "uint64", - "name": "expiry", - "type": "uint64" } ], "name": "renew", @@ -900,9 +963,9 @@ "type": "bytes32" }, { - "internalType": "uint32", - "name": "fuses", - "type": "uint32" + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" } ], "name": "setFuses", @@ -920,7 +983,7 @@ "inputs": [ { "internalType": "contract IMetadataService", - "name": "_newMetadataService", + "name": "_metadataService", "type": "address" } ], @@ -989,7 +1052,7 @@ }, { "internalType": "address", - "name": "newOwner", + "name": "owner", "type": "address" }, { @@ -1028,7 +1091,7 @@ }, { "internalType": "address", - "name": "newOwner", + "name": "owner", "type": "address" }, { @@ -1053,7 +1116,13 @@ } ], "name": "setSubnodeRecord", - "outputs": [], + "outputs": [ + { + "internalType": "bytes32", + "name": "node", + "type": "bytes32" + } + ], "stateMutability": "nonpayable", "type": "function" }, @@ -1134,7 +1203,7 @@ }, { "internalType": "address", - "name": "newController", + "name": "controller", "type": "address" } ], @@ -1152,12 +1221,12 @@ }, { "internalType": "address", - "name": "newRegistrant", + "name": "registrant", "type": "address" }, { "internalType": "address", - "name": "newController", + "name": "controller", "type": "address" } ], @@ -1285,14 +1354,9 @@ "type": "address" }, { - "internalType": "uint32", - "name": "fuses", - "type": "uint32" - }, - { - "internalType": "uint64", - "name": "expiry", - "type": "uint64" + "internalType": "uint16", + "name": "ownerControlledFuses", + "type": "uint16" }, { "internalType": "address", @@ -1301,13 +1365,7 @@ } ], "name": "wrapETH2LD", - "outputs": [ - { - "internalType": "uint64", - "name": "", - "type": "uint64" - } - ], + "outputs": [], "stateMutability": "nonpayable", "type": "function" } diff --git a/Ethereum/ethereum-ens/project-sepolia.ts b/Ethereum/ethereum-ens/project-sepolia.ts new file mode 100644 index 00000000..49d7a11b --- /dev/null +++ b/Ethereum/ethereum-ens/project-sepolia.ts @@ -0,0 +1,395 @@ +import { + EthereumProject, + EthereumDatasourceKind, + EthereumHandlerKind, +} from "@subql/types-ethereum"; + +// Can expand the Datasource processor types via the generic param +const project: EthereumProject = { + specVersion: "1.0.0", + version: "0.0.1", + name: "subquery-example-ens", + description: + "This project can be use as a starting point for developing your new Ethereum SubQuery project", + runner: { + node: { + name: "@subql/node-ethereum", + version: ">=3.0.0", + }, + query: { + name: "@subql/query", + version: "*", + }, + }, + schema: { + file: "./schema.graphql", + }, + network: { + /** + * chainId is the EVM Chain ID, for Ethereum this is 1 + * https://chainlist.org/chain/1 + */ + chainId: "11155111", + /** + * These endpoint(s) should be public non-pruned archive node + * We recommend providing more than one endpoint for improved reliability, performance, and uptime + * Public nodes may be rate limited, which can affect indexing speed + * When developing your project we suggest getting a private API key + * If you use a rate limited endpoint, adjust the --batch-size and --workers parameters + * These settings can be found in your docker-compose.yaml, they will slow indexing but prevent your project being rate limited + */ + endpoint: ["https://ethereum-sepolia.publicnode.com"], + }, + dataSources: [ + // ENSRegistry + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3702728, + + options: { + // Must be a key of assets + abi: "EnsRegistry", + address: "0x00000000000C2E074eC69A0dFb2997BA6C7d2e1e", + }, + assets: new Map([["EnsRegistry", { file: "./abis/Registry.json" }]]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleTransfer", + filter: { + topics: ["Transfer(bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNewOwner", + filter: { + topics: ["NewOwner(bytes32,bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNewResolver", + filter: { + topics: ["NewResolver(bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNewTTL", + filter: { + topics: ["NewTTL(bytes32,uint64)"], + }, + }, + ], + }, + }, + // ENSRegistryOld + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3702721, + + options: { + // Must be a key of assets + abi: "EnsRegistry", + address: "0x94f523b8261B815b87EFfCf4d18E6aBeF18d6e4b", + }, + assets: new Map([["EnsRegistry", { file: "./abis/Registry.json" }]]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleTransferOldRegistry", + filter: { + topics: ["Transfer(bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNewOwnerOldRegistry", + filter: { + topics: ["NewOwner(bytes32,bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNewResolverOldRegistry", + filter: { + topics: ["NewResolver(bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNewTTLOldRegistry", + filter: { + topics: ["NewTTL(bytes32,uint64)"], + }, + }, + ], + }, + }, + // Resolver + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3702721, + + options: { + // Must be a key of assets + abi: "Resolver", + // address: '0x8FADE66B79cC9f707aB26799354482EB93a5B7dD', + }, + assets: new Map([["Resolver", { file: "./abis/PublicResolver.json" }]]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleABIChanged", + filter: { + topics: ["ABIChanged(bytes32,uint256)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleAddrChanged", + filter: { + topics: ["AddrChanged(bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleMulticoinAddrChanged", + filter: { + topics: ["AddressChanged(bytes32,uint256,bytes)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleAuthorisationChanged", + filter: { + topics: ["AuthorisationChanged(bytes32,address,address,bool)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleContentHashChanged", + filter: { + topics: ["ContenthashChanged(bytes32,bytes)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleInterfaceChanged", + filter: { + topics: ["InterfaceChanged(bytes32,bytes4,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNameChanged", + filter: { + topics: ["NameChanged(bytes32,string)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handlePubkeyChanged", + filter: { + topics: ["PubkeyChanged(bytes32,bytes32,bytes32)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleTextChanged", + filter: { + topics: ["TextChanged(bytes32,string,string)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleTextChangedWithValue", + filter: { + topics: ["TextChanged(bytes32,string,string,string)"], + }, + }, + ], + }, + }, + // BaseRegistrar + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3702731, + + options: { + // Must be a key of assets + abi: "BaseRegistrar", + address: "0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85", + }, + assets: new Map([ + ["BaseRegistrar", { file: "./abis/BaseRegistrar.json" }], + ]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleNameRegistered", + filter: { + topics: ["NameRegistered(uint256,address,uint256)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNameRenewed", + filter: { + topics: ["NameRenewed( uint256,uint256)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNameTransferred", + filter: { + topics: ["Transfer(address,address,uint256)"], + }, + }, + ], + }, + }, + // EthRegistrarControllerOld + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3790197, + options: { + // Must be a key of assets + abi: "EthRegistrarControllerOld", + address: "0x7e02892cfc2Bfd53a75275451d73cF620e793fc0", + }, + assets: new Map([ + [ + "EthRegistrarControllerOld", + { file: "./abis/EthRegistrarControllerOld.json" }, + ], + ]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleNameRegisteredByControllerOld", + filter: { + topics: [ + "NameRegistered(string, bytes32, address,uint256,uint256)", + ], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNameRenewedByController", + filter: { + topics: ["NameRenewed(string,bytes32,uint256,uint256)"], + }, + }, + ], + }, + }, + // EthRegistrarController + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3790244, + options: { + // Must be a key of assets + abi: "EthRegistrarController", + address: "0xFED6a969AaA60E4961FCD3EBF1A2e8913ac65B72" + }, + assets: new Map([ + [ + "EthRegistrarController", + { file: "./abis/EthRegistrarController.json" }, + ], + ]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleNameRegisteredByController", + filter: { + topics: [ + "NameRegistered(string, bytes32, address,uint256,uint256,uint256)", + ], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNameRenewedByController", + filter: { + topics: ["NameRenewed(string, bytes32,uint256,uint256)"], + }, + }, + ], + }, + }, + // NameWrapper + { + kind: EthereumDatasourceKind.Runtime, + startBlock: 3790153, + options: { + // Must be a key of assets + abi: "NameWrapper", + address: "0x0635513f179D50A207757E05759CbD106d7dFcE8" + }, + assets: new Map([["NameWrapper", { file: "./abis/NameWrapper.json" }]]), + mapping: { + file: "./dist/index.js", + handlers: [ + { + kind: EthereumHandlerKind.Event, + handler: "handleNameWrapped", + filter: { + topics: ["NameWrapped( bytes32,bytes,address,uint32,uint64)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleNameUnwrapped", + filter: { + topics: ["NameUnwrapped( bytes32,address)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleFusesSet", + filter: { + topics: ["FusesSet( bytes32,uint32,uint64)"], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleTransferSingle", + filter: { + topics: [ + "TransferSingle( address, address, address,uint256,uint256)", + ], + }, + }, + { + kind: EthereumHandlerKind.Event, + handler: "handleTransferBatch", + filter: { + topics: [ + "TransferBatch( address, address, address,uint256[],uint256[])", + ], + }, + }, + ], + }, + }, + ], + repository: "https://github.com/subquery/ethereum-subql-starter", +}; + +// Must set default to the project instance +export default project; diff --git a/Ethereum/ethereum-ens/project.ts b/Ethereum/ethereum-ens/project.ts index d069be48..b9f76687 100644 --- a/Ethereum/ethereum-ens/project.ts +++ b/Ethereum/ethereum-ens/project.ts @@ -139,6 +139,7 @@ const project: EthereumProject = { options: { // Must be a key of assets abi: "Resolver", + address: '0x231b0Ee14048e9dCcD1d247744d114a4EB5E8E63', }, assets: new Map([["Resolver", { file: "./abis/PublicResolver.json" }]]), mapping: { @@ -301,6 +302,7 @@ const project: EthereumProject = { options: { // Must be a key of assets abi: "EthRegistrarController", + address: '0x253553366Da8546fC250F225fe3d25d0C782303b', }, assets: new Map([ [ @@ -337,6 +339,7 @@ const project: EthereumProject = { options: { // Must be a key of assets abi: "NameWrapper", + address: '0xD4416b13d2b3a9aBae7AcD5D6C2BbDBE25686401', }, assets: new Map([["NameWrapper", { file: "./abis/NameWrapper.json" }]]), mapping: { diff --git a/Ethereum/ethereum-ens/src/mappings/ensRegistry.ts b/Ethereum/ethereum-ens/src/mappings/ensRegistry.ts index 0d8dbd5c..aea18631 100644 --- a/Ethereum/ethereum-ens/src/mappings/ensRegistry.ts +++ b/Ethereum/ethereum-ens/src/mappings/ensRegistry.ts @@ -3,9 +3,7 @@ import { keccak256 } from "@ethersproject/keccak256"; // Import event types from the registry contract ABI import { - NewOwnerEvent, TransferEvent, - NewResolverEvent, NewTTLEvent, } from "../types/contracts/Registry"; @@ -89,10 +87,7 @@ async function _handleNewOwner( isMigrated: boolean, subnode?: string ): Promise { - if(!event.args){ - return - } - + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let account = new Account(event.args.owner); // await account.save() @@ -140,10 +135,7 @@ async function _handleNewOwner( if (label === null || label == undefined) { label = "[" + event.args.label.slice(2) + "]"; } - if ( - event.args.node == - "0x0000000000000000000000000000000000000000000000000000000000000000" - ) { + if (event.args.node == ROOT_NODE) { domain.name = label; } else { parent = parent!; @@ -201,14 +193,12 @@ export async function handleTransfer(event: TransferEvent): Promise { export async function handleNewResolver( event: NewResolverLog ): Promise { - if(!event.args){ - return - } + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let id = event.args.resolver.concat("-").concat(event.args.node); let node = event.args.node; let domain = await getDomain(node); - assert(domain, "cant find domain"); + assert(domain, `cant find domain id="${node}"`); domain.resolverId = id; let resolver = await Resolver.get(id); @@ -265,9 +255,7 @@ export async function handleNewOwnerOldRegistry( event: NewOwnerLog ): Promise { let subnode = makeSubnode(event); - const start1 = Date.now(); let domain = await getDomain(subnode); - const end1 = Date.now(); // logger.info(`handleNewOwnerOldRegistry getDomain ${end1-start1} ms`) if (domain == undefined || domain.isMigrated == false) { diff --git a/Ethereum/ethereum-ens/src/mappings/ethRegistrar.ts b/Ethereum/ethereum-ens/src/mappings/ethRegistrar.ts index 90297796..17ddfdde 100644 --- a/Ethereum/ethereum-ens/src/mappings/ethRegistrar.ts +++ b/Ethereum/ethereum-ens/src/mappings/ethRegistrar.ts @@ -1,4 +1,5 @@ import { + ETH_NODE, byteArrayFromHex, concat, createEventID, @@ -7,7 +8,6 @@ import { // Import event types from the registry contract ABI import { - NameRegisteredEvent, NameRenewedEvent, TransferEvent, } from "../types/contracts/BaseRegistrar"; @@ -30,27 +30,23 @@ import { } from "../types/models"; import { keccak256 } from "@ethersproject/keccak256"; import assert from "assert"; -import {NameRegisteredLog} from "../types/abi-interfaces/EthRegistrarController"; +import {NameRegisteredLog} from "../types/abi-interfaces/BaseRegistrar"; -var rootNode = byteArrayFromHex( - "93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae" -); +var rootNode = byteArrayFromHex(ETH_NODE); export async function handleNameRegistered( event: NameRegisteredLog ): Promise { - if(!event.args){ - return - } + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let account = new Account(event.args.owner); await account.save(); - let label = uint256ToByteArray(event.args.label); + let label = uint256ToByteArray(event.args.id.toHexString()); let domain = await Domain.get( keccak256(concat(rootNode.toString(), label.toString())) ); - assert(domain, "can't find domain"); + assert(domain, `can't find domain id="${keccak256(concat(rootNode.toString(), label.toString()))}"`); let registration = Registration.create({ id: label.toString(), @@ -156,10 +152,11 @@ async function setNamePreimage( export async function handleNameRenewed( event: NameRenewedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let label = uint256ToByteArray(event.args.id.toHexString()); // let label = event.args.id.toHexString() let registration = await Registration.get(label.toString()); - assert(registration, "Cant find registration"); + assert(registration, `Cant find registration id="${label.toString()}"`); registration.expiryDate = event.args.expires.toBigInt(); await registration.save(); @@ -177,6 +174,7 @@ export async function handleNameRenewed( export async function handleNameTransferred( event: TransferEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let account = new Account(event.args.to); await account.save(); diff --git a/Ethereum/ethereum-ens/src/mappings/nameWrapper.ts b/Ethereum/ethereum-ens/src/mappings/nameWrapper.ts index f1b9e929..c0390af9 100644 --- a/Ethereum/ethereum-ens/src/mappings/nameWrapper.ts +++ b/Ethereum/ethereum-ens/src/mappings/nameWrapper.ts @@ -1,4 +1,5 @@ // Import event types from the registry contract ABI +import assert from "assert"; import { FusesSetEvent, NameUnwrappedEvent, @@ -51,6 +52,7 @@ function decodeName(buf: Buffer): Array { export async function handleNameWrapped( event: NameWrappedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let decoded = decodeName(Buffer.from(event.args.name)); let label = decoded[0]; let name = decoded[1]; @@ -94,6 +96,7 @@ export async function handleNameWrapped( export async function handleNameUnwrapped( event: NameUnwrappedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let node = event.args.node; let blockNumber = event.blockNumber; let transactionID = event.transactionHash; @@ -112,6 +115,7 @@ export async function handleNameUnwrapped( } export async function handleFusesSet(event: FusesSetEvent): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let node = event.args.node; let fuses = event.args.fuses; let expiry = event.args.expiry; @@ -172,6 +176,7 @@ async function makeWrappedTransfer( export async function handleTransferSingle( event: TransferSingleEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); await makeWrappedTransfer( event.blockNumber, event.transactionHash, @@ -184,6 +189,7 @@ export async function handleTransferSingle( export async function handleTransferBatch( event: TransferBatchEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let blockNumber = event.blockNumber; let transactionID = event.transactionHash; let ids = event.args.ids; diff --git a/Ethereum/ethereum-ens/src/mappings/resolver.ts b/Ethereum/ethereum-ens/src/mappings/resolver.ts index 77f384fd..716ed56f 100644 --- a/Ethereum/ethereum-ens/src/mappings/resolver.ts +++ b/Ethereum/ethereum-ens/src/mappings/resolver.ts @@ -1,3 +1,4 @@ +import assert from "assert"; import { ABIChangedEvent, AddrChangedEvent, @@ -32,6 +33,7 @@ import { createEventID } from "./utils"; export async function handleAddrChanged( event: AddrChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let account = new Account(event.args.a); await account.save(); @@ -62,6 +64,7 @@ export async function handleAddrChanged( export async function handleMulticoinAddrChanged( event: AddressChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolver = await getOrCreateResolver(event.args.node, event.address); let coinType = event.args.coinType; if (resolver.coinTypes == null || resolver.coinTypes == undefined) { @@ -90,6 +93,7 @@ export async function handleMulticoinAddrChanged( export async function handleNameChanged( event: NameChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); if (event.args.name.indexOf("\u0000") != -1) return; let resolverEvent = NameChanged.create({ @@ -107,6 +111,7 @@ export async function handleNameChanged( } export async function handleABIChanged(event: ABIChangedEvent): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolverEvent = AbiChanged.create({ id: createEventID(event.blockNumber, event.logIndex), resolverId: createResolverID(event.args.node, event.address), @@ -120,6 +125,7 @@ export async function handleABIChanged(event: ABIChangedEvent): Promise { export async function handlePubkeyChanged( event: PubkeyChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolverEvent = PubkeyChanged.create({ id: createEventID(event.blockNumber, event.logIndex), resolverId: createResolverID(event.args.node, event.address), @@ -134,6 +140,7 @@ export async function handlePubkeyChanged( export async function handleTextChanged( event: TextChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolver = await getOrCreateResolver(event.args.node, event.address); const key = event.args[2]; @@ -162,6 +169,7 @@ export async function handleTextChanged( export async function handleTextChangedWithValue( event: TextChangedWithValueEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolver = await getOrCreateResolver(event.args.node, event.address); let key = event.args.key; if (resolver.texts == null || resolver.texts == undefined) { @@ -190,6 +198,7 @@ export async function handleTextChangedWithValue( export async function handleContentHashChanged( event: ContenthashChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolver = await getOrCreateResolver(event.args.node, event.address); resolver.contentHash = event.args.hash; await resolver.save(); @@ -205,6 +214,7 @@ export async function handleContentHashChanged( } export function handleInterfaceChanged(event: InterfaceChangedEvent): void { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolverEvent = InterfaceChanged.create({ id: createEventID(event.blockNumber, event.logIndex), resolverId: createResolverID(event.args.node, event.address), @@ -219,6 +229,7 @@ export function handleInterfaceChanged(event: InterfaceChangedEvent): void { export async function handleAuthorisationChanged( event: AuthorisationChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolverEvent = AuthorisationChanged.create({ id: createEventID(event.blockNumber, event.logIndex), resolverId: createResolverID(event.args.node, event.address), @@ -234,6 +245,7 @@ export async function handleAuthorisationChanged( export async function handleVersionChanged( event: VersionChangedEvent ): Promise { + assert(event.args, `expected args for event ${event.transactionHash}-${event.logIndex}`); let resolverEvent = VersionChanged.create({ id: createEventID(event.blockNumber, event.logIndex), resolverId: createResolverID(event.args.node, event.address), diff --git a/Ethereum/ethereum-ens/src/mappings/utils.ts b/Ethereum/ethereum-ens/src/mappings/utils.ts index b0252898..3167eb44 100644 --- a/Ethereum/ethereum-ens/src/mappings/utils.ts +++ b/Ethereum/ethereum-ens/src/mappings/utils.ts @@ -7,8 +7,8 @@ export function createEventID(blockNumber: number, logIndex: number): string { declare type u32 = number; -export const ROOT_NODE = - "0x0000000000000000000000000000000000000000000000000000000000000000"; +export const ETH_NODE = '93cdeb708b7545dc668eb9280176169d1c33cfd8ed6f04690a0bcc88a93fc4ae' +export const ROOT_NODE = "0x0000000000000000000000000000000000000000000000000000000000000000"; export const EMPTY_ADDRESS = "0x0000000000000000000000000000000000000000"; // Helper for concatenating two string to byteArray diff --git a/Multi-Chain/polygon-plasma-bridge/ethereum.yaml b/Multi-Chain/polygon-plasma-bridge/ethereum.yaml index 28bb32cc..6952b8aa 100644 --- a/Multi-Chain/polygon-plasma-bridge/ethereum.yaml +++ b/Multi-Chain/polygon-plasma-bridge/ethereum.yaml @@ -1,6 +1,6 @@ specVersion: "1.0.0" -name: "polygon-plasma-bridge" +name: "multi-chain-polygon-plasma-bridge-eth" version: "0.0.1" runner: node: diff --git a/Multi-Chain/polygon-plasma-bridge/package.json b/Multi-Chain/polygon-plasma-bridge/package.json index c18e6e9d..66267f16 100644 --- a/Multi-Chain/polygon-plasma-bridge/package.json +++ b/Multi-Chain/polygon-plasma-bridge/package.json @@ -1,5 +1,5 @@ { - "name": "polygon-plasma-bridge", + "name": "multi-chain-polygon-plasma-bridge", "version": "0.0.1", "description": "This sample project indexes transactions on the Plasma Bridge, transferring assets from Polygon to Ethereum", "main": "dist/index.js", @@ -34,4 +34,4 @@ "ethers": "^5.7.2", "typescript": "4.5.5" } -} \ No newline at end of file +} diff --git a/Multi-Chain/safe/package.json b/Multi-Chain/safe/package.json index 3a89549a..f3782735 100644 --- a/Multi-Chain/safe/package.json +++ b/Multi-Chain/safe/package.json @@ -1,5 +1,5 @@ { - "name": "ethereum-snapshot", + "name": "multichain-safe", "version": "0.0.1", "description": "This project indexes Safe multisig signatures data from various chains", "main": "dist/index.js", diff --git a/Multi-Chain/snapshot/arbitrum.yaml b/Multi-Chain/snapshot/arbitrum.yaml index 16caaca4..db4e96be 100644 --- a/Multi-Chain/snapshot/arbitrum.yaml +++ b/Multi-Chain/snapshot/arbitrum.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: arbitrum-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: diff --git a/Multi-Chain/snapshot/bsc.yaml b/Multi-Chain/snapshot/bsc.yaml index c1a37f79..77a99a5d 100644 --- a/Multi-Chain/snapshot/bsc.yaml +++ b/Multi-Chain/snapshot/bsc.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: bsc-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: diff --git a/Multi-Chain/snapshot/fantom.yaml b/Multi-Chain/snapshot/fantom.yaml index e8be09c6..e4ad8f02 100644 --- a/Multi-Chain/snapshot/fantom.yaml +++ b/Multi-Chain/snapshot/fantom.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: fantom-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: diff --git a/Multi-Chain/snapshot/gnosis.yaml b/Multi-Chain/snapshot/gnosis.yaml index 3d1535a3..c0b8c0d2 100644 --- a/Multi-Chain/snapshot/gnosis.yaml +++ b/Multi-Chain/snapshot/gnosis.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: gnosis-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: diff --git a/Multi-Chain/snapshot/goerli.yaml b/Multi-Chain/snapshot/goerli.yaml index 6cefdd21..b7c0a662 100644 --- a/Multi-Chain/snapshot/goerli.yaml +++ b/Multi-Chain/snapshot/goerli.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: goreli-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: diff --git a/Multi-Chain/snapshot/matic.yaml b/Multi-Chain/snapshot/matic.yaml index 1bbb3ee2..22b984da 100644 --- a/Multi-Chain/snapshot/matic.yaml +++ b/Multi-Chain/snapshot/matic.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: matic-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: diff --git a/Multi-Chain/snapshot/op.yaml b/Multi-Chain/snapshot/op.yaml index 9bb8e773..ff427db9 100644 --- a/Multi-Chain/snapshot/op.yaml +++ b/Multi-Chain/snapshot/op.yaml @@ -1,6 +1,6 @@ specVersion: 1.0.0 version: 0.0.1 -name: ethereum-snapshot +name: op-snapshot description: This project indexes the Snapshot Protocol delegation data from various chains runner: node: