diff --git a/abi/ERC1155.json b/abi/ERC1155.json new file mode 100644 index 0000000..5b609d5 --- /dev/null +++ b/abi/ERC1155.json @@ -0,0 +1,384 @@ +[ + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": false, + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "ApprovalForAll", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "previousOwner", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "OwnershipTransferred", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "TransferBatch", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "indexed": true, + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "TransferSingle", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "string", + "name": "value", + "type": "string" + }, + { + "indexed": true, + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "URI", + "type": "event" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + } + ], + "name": "balanceOf", + "outputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address[]", + "name": "accounts", + "type": "address[]" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + } + ], + "name": "balanceOfBatch", + "outputs": [ + { + "internalType": "uint256[]", + "name": "", + "type": "uint256[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "contractURI", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "address", + "name": "operator", + "type": "address" + } + ], + "name": "isApprovedForAll", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "renounceOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "amounts", + "type": "uint256[]" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeBatchTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "from", + "type": "address" + }, + { + "internalType": "address", + "name": "to", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "amount", + "type": "uint256" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "safeTransferFrom", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "operator", + "type": "address" + }, + { + "internalType": "bool", + "name": "approved", + "type": "bool" + } + ], + "name": "setApprovalForAll", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes4", + "name": "interfaceId", + "type": "bytes4" + } + ], + "name": "supportsInterface", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newOwner", + "type": "address" + } + ], + "name": "transferOwnership", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "_tokenId", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "pure", + "type": "function" + } +] \ No newline at end of file diff --git a/db/migrations/1708227373111-Data.js b/db/migrations/1708227373111-Data.js new file mode 100644 index 0000000..8e200df --- /dev/null +++ b/db/migrations/1708227373111-Data.js @@ -0,0 +1,23 @@ +module.exports = class Data1708227373111 { + name = 'Data1708227373111' + + async up(db) { + await db.query(`CREATE TABLE "multi_token" ("id" character varying NOT NULL, CONSTRAINT "PK_4e75ed8d2f8368d7275126e1e0a" PRIMARY KEY ("id"))`) + await db.query(`CREATE TABLE "erc1155_deposit" ("id" character varying NOT NULL, "from" text NOT NULL, "transfers" jsonb, "token_id" character varying, CONSTRAINT "PK_e1ee5059e2ab545321addfc86ac" PRIMARY KEY ("id"))`) + await db.query(`CREATE INDEX "IDX_472cafd7ec482afd34406d4f5b" ON "erc1155_deposit" ("token_id") `) + await db.query(`ALTER TABLE "input" ADD "erc1155_deposit_id" character varying`) + await db.query(`CREATE INDEX "IDX_cbb39d6c16a954d68859315af8" ON "input" ("erc1155_deposit_id") `) + await db.query(`ALTER TABLE "erc1155_deposit" ADD CONSTRAINT "FK_472cafd7ec482afd34406d4f5bc" FOREIGN KEY ("token_id") REFERENCES "multi_token"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + await db.query(`ALTER TABLE "input" ADD CONSTRAINT "FK_cbb39d6c16a954d68859315af8d" FOREIGN KEY ("erc1155_deposit_id") REFERENCES "erc1155_deposit"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`) + } + + async down(db) { + await db.query(`DROP TABLE "multi_token"`) + await db.query(`DROP TABLE "erc1155_deposit"`) + await db.query(`DROP INDEX "public"."IDX_472cafd7ec482afd34406d4f5b"`) + await db.query(`ALTER TABLE "input" DROP COLUMN "erc1155_deposit_id"`) + await db.query(`DROP INDEX "public"."IDX_cbb39d6c16a954d68859315af8"`) + await db.query(`ALTER TABLE "erc1155_deposit" DROP CONSTRAINT "FK_472cafd7ec482afd34406d4f5bc"`) + await db.query(`ALTER TABLE "input" DROP CONSTRAINT "FK_cbb39d6c16a954d68859315af8d"`) + } +} diff --git a/package-lock.json b/package-lock.json index d8fec77..1f9485d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,6 +23,7 @@ "shelljs": "^0.8.5", "type-graphql": "^1.2.0-rc.1", "typeorm": "^0.3.16", + "viem": "^2.5.0", "yargs": "^17.7.2" }, "devDependencies": { @@ -38,9 +39,9 @@ } }, "node_modules/@adraffy/ens-normalize": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" }, "node_modules/@ampproject/remapping": { "version": "2.2.1", @@ -1138,27 +1139,27 @@ "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", "dev": true }, - "node_modules/@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "node_modules/@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "dependencies": { + "@noble/hashes": "1.3.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } }, - "node_modules/@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] + "node_modules/@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", @@ -2035,6 +2036,61 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, + "node_modules/@scure/base": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==", + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", + "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", + "dependencies": { + "@noble/curves": "~1.2.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.2" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip32/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "dependencies": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, + "node_modules/@scure/bip39/node_modules/@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==", + "engines": { + "node": ">= 16" + }, + "funding": { + "url": "https://paulmillr.com/funding/" + } + }, "node_modules/@sigstore/bundle": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz", @@ -3356,6 +3412,26 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "node_modules/abitype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", + "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", + "funding": { + "url": "https://github.com/sponsors/wevm" + }, + "peerDependencies": { + "typescript": ">=5.0.4", + "zod": "^3 >=3.22.0" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + }, + "zod": { + "optional": true + } + } + }, "node_modules/abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -5658,9 +5734,9 @@ } }, "node_modules/ethers": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.7.1.tgz", - "integrity": "sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz", + "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==", "funding": [ { "type": "individual", @@ -5672,9 +5748,9 @@ } ], "dependencies": { - "@adraffy/ens-normalize": "1.9.2", - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.7.1", + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", @@ -7543,6 +7619,20 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "node_modules/isows": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", + "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wagmi-dev" + } + ], + "peerDependencies": { + "ws": "*" + } + }, "node_modules/istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -13707,6 +13797,60 @@ "node": ">= 0.8" } }, + "node_modules/viem": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.5.0.tgz", + "integrity": "sha512-ytHXIWtlgPs4mcsGxXjJrQ25v+N4dE2hBzgCU8CVv4iXNh3PRFRgyYa7igZlmxiMVzkfSHHADOtivS980JhilA==", + "funding": [ + { + "type": "github", + "url": "https://github.com/sponsors/wevm" + } + ], + "dependencies": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@scure/bip32": "1.3.2", + "@scure/bip39": "1.2.1", + "abitype": "1.0.0", + "isows": "1.0.3", + "ws": "8.13.0" + }, + "peerDependencies": { + "typescript": ">=5.0.4" + }, + "peerDependenciesMeta": { + "typescript": { + "optional": true + } + } + }, + "node_modules/viem/node_modules/@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + }, + "node_modules/viem/node_modules/ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "engines": { + "node": ">=10.0.0" + }, + "peerDependencies": { + "bufferutil": "^4.0.1", + "utf-8-validate": ">=5.0.2" + }, + "peerDependenciesMeta": { + "bufferutil": { + "optional": true + }, + "utf-8-validate": { + "optional": true + } + } + }, "node_modules/vinyl": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", @@ -15694,9 +15838,9 @@ }, "dependencies": { "@adraffy/ens-normalize": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.1.tgz", + "integrity": "sha512-96Z2IP3mYmF1Xg2cDm8f1gWGf/HUVedQ3FMifV4kG/PQ4yEP51xDtRAEfhVNt5f/uzpNkZHwWQuUcu6D6K+Ekw==" }, "@ampproject/remapping": { "version": "2.2.1", @@ -16431,15 +16575,18 @@ "integrity": "sha512-GaHYm+c0O9MjZRu0ongGBRbinu8gVAMd2UZjji6jVmqKtZluZnptXGWhz1E8j8D2HJ3f/yMxKAUC0b+57wncIw==", "dev": true }, - "@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==" + "@noble/curves": { + "version": "1.2.0", + "resolved": "https://registry.npmjs.org/@noble/curves/-/curves-1.2.0.tgz", + "integrity": "sha512-oYclrNgRaM9SsBUBVbb8M6DTV7ZHRTKugureoYEncY5c65HOmRzvSiTE3y5CYaPYJA/GVkrhXEoF0M3Ya9PMnw==", + "requires": { + "@noble/hashes": "1.3.2" + } }, - "@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==" + "@noble/hashes": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.2.tgz", + "integrity": "sha512-MVC8EAQp7MvEcm30KWENFjgR+Mkmf+D189XJTkFIlwohU5hcBbn1ZkKq7KVTi2Hme3PMGF390DaL52beVrIihQ==" }, "@nodelib/fs.scandir": { "version": "2.1.5", @@ -17218,6 +17365,44 @@ "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz", "integrity": "sha512-Vvn3zZrhQZkkBE8LSuW3em98c0FwgO4nxzv6OdSxPKJIEKY2bGbHn+mhGIPerzI4twdxaP8/0+06HBpwf345Lw==" }, + "@scure/base": { + "version": "1.1.5", + "resolved": "https://registry.npmjs.org/@scure/base/-/base-1.1.5.tgz", + "integrity": "sha512-Brj9FiG2W1MRQSTB212YVPRrcbjkv48FoZi/u4l/zds/ieRrqsh7aUf6CLwkAq61oKXr/ZlTzlY66gLIj3TFTQ==" + }, + "@scure/bip32": { + "version": "1.3.2", + "resolved": "https://registry.npmjs.org/@scure/bip32/-/bip32-1.3.2.tgz", + "integrity": "sha512-N1ZhksgwD3OBlwTv3R6KFEcPojl/W4ElJOeCZdi+vuI5QmTFwLq3OFf2zd2ROpKvxFdgZ6hUpb0dx9bVNEwYCA==", + "requires": { + "@noble/curves": "~1.2.0", + "@noble/hashes": "~1.3.2", + "@scure/base": "~1.1.2" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + } + } + }, + "@scure/bip39": { + "version": "1.2.1", + "resolved": "https://registry.npmjs.org/@scure/bip39/-/bip39-1.2.1.tgz", + "integrity": "sha512-Z3/Fsz1yr904dduJD0NpiyRHhRYHdcnyh73FZWiV+/qhWi83wNJ3NWolYqCEN+ZWsUz2TWwajJggcRE9r1zUYg==", + "requires": { + "@noble/hashes": "~1.3.0", + "@scure/base": "~1.1.0" + }, + "dependencies": { + "@noble/hashes": { + "version": "1.3.3", + "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.3.3.tgz", + "integrity": "sha512-V7/fPHgl+jsVPXqqeOzT8egNj2iBIVt+ECeMMG8TdcnTikP3oaBtUVqpT/gYCR68aEBJSF+XbYUxStjbFMqIIA==" + } + } + }, "@sigstore/bundle": { "version": "1.1.0", "resolved": "https://registry.npmjs.org/@sigstore/bundle/-/bundle-1.1.0.tgz", @@ -18339,6 +18524,12 @@ "integrity": "sha512-nne9/IiQ/hzIhY6pdDnbBtz7DjPTKrY00P/zvPSm5pOFkl6xuGrGnXn/VtTNNfNtAfZ9/1RtehkszU9qcTii0Q==", "dev": true }, + "abitype": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/abitype/-/abitype-1.0.0.tgz", + "integrity": "sha512-NMeMah//6bJ56H5XRj8QCV4AwuW6hB6zqz2LnhhLdcWVQOsXki6/Pn3APeqxCma62nXIcmZWdu1DlHWS74umVQ==", + "requires": {} + }, "abort-controller": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/abort-controller/-/abort-controller-3.0.0.tgz", @@ -20133,13 +20324,13 @@ "integrity": "sha512-aIL5Fx7mawVa300al2BnEE4iNvo1qETxLrPI/o05L7z6go7fCw1J6EQmbK4FmJ2AS7kgVF/KEZWufBfdClMcPg==" }, "ethers": { - "version": "6.7.1", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.7.1.tgz", - "integrity": "sha512-qX5kxIFMfg1i+epfgb0xF4WM7IqapIIu50pOJ17aebkxxa4BacW5jFrQRmCJpDEg2ZK2oNtR5QjrQ1WDBF29dA==", + "version": "6.11.1", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.11.1.tgz", + "integrity": "sha512-mxTAE6wqJQAbp5QAe/+o+rXOID7Nw91OZXvgpjDa1r4fAbq2Nu314oEZSbjoRLacuCzs7kUC3clEvkCQowffGg==", "requires": { - "@adraffy/ens-normalize": "1.9.2", - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.7.1", + "@adraffy/ens-normalize": "1.10.1", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", "@types/node": "18.15.13", "aes-js": "4.0.0-beta.5", "tslib": "2.4.0", @@ -21528,6 +21719,12 @@ "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==", "dev": true }, + "isows": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/isows/-/isows-1.0.3.tgz", + "integrity": "sha512-2cKei4vlmg2cxEjm3wVSqn8pcoRF/LX/wpifuuNquFO4SQmPwarClT+SUCA2lt+l581tTeZIPIZuIDo2jWN1fg==", + "requires": {} + }, "istanbul-lib-coverage": { "version": "3.2.0", "resolved": "https://registry.npmjs.org/istanbul-lib-coverage/-/istanbul-lib-coverage-3.2.0.tgz", @@ -26148,6 +26345,34 @@ "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", "integrity": "sha512-BNGbWLfd0eUPabhkXUVm0j8uuvREyTh5ovRa/dyow/BqAbZJyC+5fU+IzQOzmAKzYqYRAISoRhdQr3eIZ/PXqg==" }, + "viem": { + "version": "2.5.0", + "resolved": "https://registry.npmjs.org/viem/-/viem-2.5.0.tgz", + "integrity": "sha512-ytHXIWtlgPs4mcsGxXjJrQ25v+N4dE2hBzgCU8CVv4iXNh3PRFRgyYa7igZlmxiMVzkfSHHADOtivS980JhilA==", + "requires": { + "@adraffy/ens-normalize": "1.10.0", + "@noble/curves": "1.2.0", + "@noble/hashes": "1.3.2", + "@scure/bip32": "1.3.2", + "@scure/bip39": "1.2.1", + "abitype": "1.0.0", + "isows": "1.0.3", + "ws": "8.13.0" + }, + "dependencies": { + "@adraffy/ens-normalize": { + "version": "1.10.0", + "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.10.0.tgz", + "integrity": "sha512-nA9XHtlAkYfJxY7bce8DcN7eKxWWCWkU+1GR9d+U6MbNpfwQp8TI7vqOsBsMcHoT4mBu2kypKoSKnghEzOOq5Q==" + }, + "ws": { + "version": "8.13.0", + "resolved": "https://registry.npmjs.org/ws/-/ws-8.13.0.tgz", + "integrity": "sha512-x9vcZYTrFPC7aSIbj7sRCYo7L/Xb8Iy+pW0ng0wt2vCJv7M9HOMy0UoN3rr+IFC7hb7vXoqS+P9ktyLLLhO+LA==", + "requires": {} + } + } + }, "vinyl": { "version": "2.2.1", "resolved": "https://registry.npmjs.org/vinyl/-/vinyl-2.2.1.tgz", diff --git a/package.json b/package.json index 8857287..cf0528f 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "shelljs": "^0.8.5", "type-graphql": "^1.2.0-rc.1", "typeorm": "^0.3.16", + "viem": "^2.5.0", "yargs": "^17.7.2" }, "devDependencies": { diff --git a/schema.graphql b/schema.graphql index f18fa49..49db9c3 100644 --- a/schema.graphql +++ b/schema.graphql @@ -24,6 +24,24 @@ type NFT @entity @cardinality(value: 10) { symbol: String } +# ERC-1155 contract representation +type MultiToken @entity @cardinality(value: 10) { + id: ID! +} + +# scalar for erc-1155 tokens data to be used for single and batch deposits +type Erc1155Transfer { + tokenIndex: BigInt! + amount: BigInt! +} + +type Erc1155Deposit @entity @cardinality(value: 100) { + id: ID! + from: String! + token: MultiToken! + transfers: [Erc1155Transfer!] +} + type Erc721Deposit @entity @cardinality(value: 100) { id: ID! from: String! @@ -50,4 +68,5 @@ type Input @entity @cardinality(value: 100) { transactionHash: String! erc20Deposit: Erc20Deposit erc721Deposit: Erc721Deposit + erc1155Deposit: Erc1155Deposit } diff --git a/src/config.ts b/src/config.ts index 0f6e658..7834911 100644 --- a/src/config.ts +++ b/src/config.ts @@ -14,6 +14,10 @@ export const ERC20PortalAddress = export const InputBoxAddress = mainnet.contracts.InputBox.address.toLowerCase(); export const ERC721PortalAddress = mainnet.contracts.ERC721Portal.address.toLowerCase(); +export const ERC1155SinglePortalAddress = + mainnet.contracts.ERC1155SinglePortal.address.toLowerCase(); +export const ERC1155BatchPortalAddress = + mainnet.contracts.ERC1155BatchPortal.address.toLowerCase(); export type ProcessorConfig = { dataSource: DataSource; diff --git a/src/handlers/EventHandler.ts b/src/handlers/EventHandler.ts index ac39c24..7c96935 100644 --- a/src/handlers/EventHandler.ts +++ b/src/handlers/EventHandler.ts @@ -3,9 +3,11 @@ import { Store } from '@subsquid/typeorm-store'; import { Application, ApplicationFactory, + Erc1155Deposit, Erc20Deposit, Erc721Deposit, Input, + MultiToken, NFT, Token, } from '../model'; @@ -22,6 +24,8 @@ export default class EventHandler { private readonly factories: Map; private readonly nfts: Map; private readonly erc721Deposits: Map; + private readonly multiTokens: Map; + private readonly erc1155Deposits: Map; private readonly applicationCreated: Handler; private readonly inputAdded: Handler; private readonly ownershipTransferred: Handler; @@ -34,6 +38,8 @@ export default class EventHandler { this.factories = new Map(); this.nfts = new Map(); this.erc721Deposits = new Map(); + this.multiTokens = new Map(); + this.erc1155Deposits = new Map(); this.applicationCreated = new ApplicationCreated( this.factories, this.applications, @@ -46,6 +52,8 @@ export default class EventHandler { this.inputs, this.nfts, this.erc721Deposits, + this.multiTokens, + this.erc1155Deposits, ); this.ownershipTransferred = new OwnershipTransferred(this.applications); @@ -67,6 +75,23 @@ export default class EventHandler { inputs: this.inputs, nfts: this.nfts, erc721Deposits: this.erc721Deposits, + multiTokens: this.multiTokens, + erc1155Deposits: this.erc1155Deposits, }; } + + getTotalHandled() { + return Object.values(this.getValues()).reduce( + (acc, entityMap) => acc + entityMap.size, + 0, + ); + } + + getSummary() { + return Object.entries(this.getValues()) + .map( + ([entityName, entityMap]) => `${entityName}: ${entityMap.size}`, + ) + .join(', '); + } } diff --git a/src/handlers/InputAdded.ts b/src/handlers/InputAdded.ts index 1dc314e..cdad3f9 100644 --- a/src/handlers/InputAdded.ts +++ b/src/handlers/InputAdded.ts @@ -1,19 +1,24 @@ import { BlockData, DataHandlerContext, Log } from '@subsquid/evm-processor'; import { Store } from '@subsquid/typeorm-store'; -import { dataSlice, getUint } from 'ethers'; +import { AbiCoder, dataSlice, getUint } from 'ethers'; import { Contract as ERC20 } from '../abi/ERC20'; import { Contract as ERC721 } from '../abi/ERC721'; import { events } from '../abi/InputBox'; import { + ERC1155BatchPortalAddress, + ERC1155SinglePortalAddress, ERC20PortalAddress, ERC721PortalAddress, InputBoxAddress, } from '../config'; import { Application, + Erc1155Deposit, + Erc1155Transfer, Erc20Deposit, Erc721Deposit, Input, + MultiToken, NFT, Token, } from '../model'; @@ -24,7 +29,6 @@ const logErrorAndReturnNull = ctx.log.error(reason); return null; }; - export default class InputAdded implements Handler { constructor( private tokenStorage: Map, @@ -33,6 +37,8 @@ export default class InputAdded implements Handler { private inputStorage: Map, private nftStorage: Map, private erc721DepositStorage: Map, + private multiTokenStorage: Map, + private erc1155DepositStorage: Map, ) {} private async prepareErc20Deposit( @@ -114,6 +120,63 @@ export default class InputAdded implements Handler { return deposit; } + private async prepareErc1155Deposit( + input: Input, + block: BlockData, + ctx: DataHandlerContext, + opts: { + inputId: String; + }, + ) { + if ( + input.msgSender !== ERC1155BatchPortalAddress && + input.msgSender !== ERC1155SinglePortalAddress + ) + return undefined; + + const tokenAddress = dataSlice(input.payload, 0, 20).toLowerCase(); // 20 bytes for token address + const from = dataSlice(input.payload, 20, 40).toLowerCase(); // 20 bytes for from address + let transfers: Erc1155Transfer[] = []; + + if (input.msgSender === ERC1155BatchPortalAddress) { + ctx.log.info(`${input.id} (ERC-1155) batch deposit`); + const data = dataSlice(input.payload, 40); // Data arbitrary size + const [tokenIds, amounts] = new AbiCoder().decode( + ['uint256[]', 'uint256[]'], + data, + ); + transfers = tokenIds.map( + (tokenIndex: bigint, idx: number) => + new Erc1155Transfer({ tokenIndex, amount: amounts[idx] }), + ); + } else if (input.msgSender === ERC1155SinglePortalAddress) { + ctx.log.info(`${input.id} (ERC-1155) single deposit`); + const tokenIndex = getUint(dataSlice(input.payload, 40, 72)); // 32 bytes for tokenId + const amount = getUint(dataSlice(input.payload, 72, 104)); // 32 bytes for value a.k.a amount + transfers = [new Erc1155Transfer({ tokenIndex, amount })]; + } + + let token = this.multiTokenStorage.get(tokenAddress); + + if (!token) { + token = new MultiToken({ id: tokenAddress }); + this.multiTokenStorage.set(tokenAddress, token); + ctx.log.info(`${tokenAddress} (ERC-1155) contract stored.`); + } + + const deposit = new Erc1155Deposit({ + id: input.id, + from, + token, + transfers, + }); + + this.erc1155DepositStorage.set(input.id, deposit); + ctx.log.info(`${input.id} (Erc1155Deposit) stored`); + + return deposit; + } + async handle(log: Log, block: BlockData, ctx: DataHandlerContext) { if ( log.address === InputBoxAddress && @@ -156,6 +219,8 @@ export default class InputAdded implements Handler { input.erc721Deposit = await this.prepareErc721Deposit(...params); + input.erc1155Deposit = await this.prepareErc1155Deposit(...params); + this.inputStorage.set(inputId, input); ctx.log.info(`${inputId} (Input) stored`); } diff --git a/src/main.ts b/src/main.ts index a7f05a7..48a70b1 100644 --- a/src/main.ts +++ b/src/main.ts @@ -35,37 +35,25 @@ processor.run(new TypeormDatabase({ supportHotBlocks: true }), async (ctx) => { inputs, nfts, erc721Deposits, + multiTokens, + erc1155Deposits, } = eventHandler.getValues(); - const total = - tokens.size + - applications.size + - factories.size + - deposits.size + - inputs.size + - nfts.size + - erc721Deposits.size; + const total = eventHandler.getTotalHandled(); if (total > 0) { - const summary = Object.entries({ - tokens: tokens.size, - applications: applications.size, - factories: factories.size, - deposits: deposits.size, - inputs: inputs.size, - nfts: nfts.size, - erc721Deposits: erc721Deposits.size, - }) - .map(([entity, count]) => `${entity}: ${count}`) - .join(', '); - ctx.log.info(`Flushing ${total} entities: ${summary}`); + ctx.log.info( + `Flushing ${total} entities: ${eventHandler.getSummary()}`, + ); } + await ctx.store.upsert([...multiTokens.values()]); await ctx.store.upsert([...tokens.values()]); await ctx.store.upsert([...nfts.values()]); await ctx.store.upsert([...factories.values()]); await ctx.store.upsert([...applications.values()]); await ctx.store.upsert([...deposits.values()]); await ctx.store.upsert([...erc721Deposits.values()]); + await ctx.store.upsert([...erc1155Deposits.values()]); await ctx.store.upsert([...inputs.values()]); }); diff --git a/tests/handlers/InputAdded.test.ts b/tests/handlers/InputAdded.test.ts index 9df1f43..87c10de 100644 --- a/tests/handlers/InputAdded.test.ts +++ b/tests/handlers/InputAdded.test.ts @@ -5,15 +5,20 @@ import { Contract as ERC721 } from '../../src/abi/ERC721'; import InputAdded from '../../src/handlers/InputAdded'; import { Application, + Erc1155Deposit, + Erc1155Transfer, Erc20Deposit, Erc721Deposit, Input, + MultiToken, NFT, Token, } from '../../src/model'; import { block, ctx, + logErc1155BatchTransfer, + logErc1155SingleTransfer, logErc20Transfer, logErc721Transfer, logs, @@ -30,6 +35,10 @@ vi.mock('../../src/model/', async () => { const Input = vi.fn(); const Erc721Deposit = vi.fn(); const NFT = vi.fn(); + const Erc1155Deposit = vi.fn(); + const MultiToken = vi.fn(); + const Erc1155Transfer = vi.fn(); + return { Application, Token, @@ -37,6 +46,9 @@ vi.mock('../../src/model/', async () => { Erc721Deposit, Input, NFT, + MultiToken, + Erc1155Deposit, + Erc1155Transfer, }; }); @@ -48,6 +60,9 @@ const ERC721DepositStub = vi.mocked(Erc721Deposit); const ERC20Mock = vi.mocked(ERC20, true); const ERC20DepositStub = vi.mocked(Erc20Deposit); const TokenStub = vi.mocked(Token); +const MultiTokenStub = vi.mocked(MultiToken); +const ERC1155DepositStub = vi.mocked(Erc1155Deposit); +const ERC1155TransferStub = vi.mocked(Erc1155Transfer); describe('InputAdded', () => { let inputAdded: InputAdded; @@ -57,6 +72,8 @@ describe('InputAdded', () => { const mockApplicationStorage = new Map(); const mockNftStorage = new Map(); const mockErc721DepositStorage = new Map(); + const mockMultiTokenStorage = new Map(); + const mockErc1155DepositStorage = new Map(); beforeEach(() => { inputAdded = new InputAdded( @@ -66,6 +83,8 @@ describe('InputAdded', () => { mockInputStorage, mockNftStorage, mockErc721DepositStorage, + mockMultiTokenStorage, + mockErc1155DepositStorage, ); mockTokenStorage.clear(); @@ -74,6 +93,8 @@ describe('InputAdded', () => { mockInputStorage.clear(); mockNftStorage.clear(); mockErc721DepositStorage.clear(); + mockMultiTokenStorage.clear(); + mockErc1155DepositStorage.clear(); }); afterEach(() => { @@ -282,5 +303,100 @@ describe('InputAdded', () => { }); }); }); + + describe('ERC-1155 deposits', () => { + const tokenAddress = '0x2960f4db2b0993ae5b59bc4a0f5ec7a1767e905e'; + + beforeEach(() => { + // Returning simple object as the Class type for assertion + InputMock.mockImplementationOnce((args) => { + return { ...args } as Input; + }); + + MultiTokenStub.mockImplementationOnce((args) => { + return { ...args } as MultiToken; + }); + + ERC1155TransferStub.mockImplementation((args) => { + return { ...args } as Erc1155Transfer; + }); + + ERC1155DepositStub.mockImplementationOnce((args) => { + return { ...args } as Erc1155Deposit; + }); + }); + + afterEach(() => { + vi.clearAllMocks(); + }); + + test('should store the token information', async () => { + expect(mockMultiTokenStorage.size).toBe(0); + + await inputAdded.handle(logErc1155SingleTransfer, block, ctx); + + expect(mockMultiTokenStorage.size).toBe(1); + const token = mockMultiTokenStorage.get(tokenAddress); + expect(token?.id).toEqual(tokenAddress); + }); + + test('should store the deposit information for single transfer', async () => { + const inputId = + '0x4ca2f6935200b9a782a78f408f640f17b29809d8-783'; + expect(mockErc1155DepositStorage.size).toBe(0); + await inputAdded.handle(logErc1155SingleTransfer, block, ctx); + + expect(mockErc1155DepositStorage.size).toBe(1); + + const deposit = mockErc1155DepositStorage.get(inputId); + + expect(deposit).toEqual({ + from: '0xa074683b5be015f053b5dceb064c41fc9d11b6e5', + id: inputId, + token: { + id: '0x2960f4db2b0993ae5b59bc4a0f5ec7a1767e905e', + }, + transfers: [ + { + amount: 10000000n, + tokenIndex: 2n, + }, + ], + }); + }); + + test('should store the deposit information for batch transfer', async () => { + const inputId = + '0x4ca2f6935200b9a782a78f408f640f17b29809d8-784'; + expect(mockErc1155DepositStorage.size).toBe(0); + await inputAdded.handle(logErc1155BatchTransfer, block, ctx); + + expect(mockErc1155DepositStorage.size).toBe(1); + + const deposit = mockErc1155DepositStorage.get(inputId); + + expect(deposit).toEqual({ + from: '0xa074683b5be015f053b5dceb064c41fc9d11b6e5', + id: inputId, + token: { + id: '0x2960f4db2b0993ae5b59bc4a0f5ec7a1767e905e', + }, + transfers: [ + { + amount: 100n, + tokenIndex: 0n, + }, + { + amount: 1000n, + tokenIndex: 1n, + }, + { + amount: 10000n, + tokenIndex: 2n, + }, + ], + }); + }); + }); }); }); diff --git a/tests/stubs/params.ts b/tests/stubs/params.ts index 6815a93..4f12d96 100644 --- a/tests/stubs/params.ts +++ b/tests/stubs/params.ts @@ -1,6 +1,7 @@ import { Chain } from '@subsquid/evm-processor/lib/interfaces/chain'; import { Logger } from '@subsquid/logger'; import { Store } from '@subsquid/typeorm-store'; +import { encodeAbiParameters } from 'viem'; import { vi } from 'vitest'; import { CartesiDAppFactoryAddress, @@ -30,6 +31,8 @@ vi.mock('@subsquid/typeorm-store', async (importOriginal) => { Store, }; }); + +const dappAddress = '0x4cA2f6935200b9a782A78f408F640F17B29809d8'; const payload = '0x494e5345525420494e544f20636572746966696572202056414c554553202827307866434432423566316346353562353643306632323464614439394331346234454530393237346433272c3130202c273078664344324235663163463535623536433066323234646144393943313462344545303932373464332729'; @@ -51,6 +54,7 @@ export const input = { '0xce6a0d404b4201b3bd4fb8309df0b6a64f6a5d7b71fa89bf2737d4574c58b32f', erc721Deposit: null, erc20Deposit: null, + erc1155Deposit: null, transactionHash: '0x6a3d76983453c0f74188bd89e01576c35f9d9b02daecdd49f7171aeb2bd3dc78', } satisfies Input; @@ -92,6 +96,80 @@ export const logErc721Transfer = { }, }; +export const logErc1155SingleTransfer = { + id: '0004867730-000035-2c78f', + address: InputBoxAddress, + logIndex: 35, + transactionIndex: 24, + topics: [ + '0x6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784', + encodeAbiParameters([{ type: 'address' }], [dappAddress]), + encodeAbiParameters([{ type: 'uint256' }], [783n]), + ], + data: '0x0000000000000000000000007cfb0193ca87eb6e48056885e026552c3a941fc4000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000001282960f4db2b0993ae5b59bc4a0f5ec7a1767e905ea074683b5be015f053b5dceb064c41fc9d11b6e500000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000989680000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + block: { + id: '0004867730-2c78f', + height: 4867730, + hash: '0x2c78fb73f84f2755f65533652983578bcf89a68ad173e756bc631b4d0d242b53', + parentHash: + '0x1bb7d54bde1c3dda41c6cc5ab40ad04b855d1ce5dec4175571dd158d3134ec3e', + timestamp: 1702321200000, + }, + transaction: { + id: '0004867730-000024-2c78f', + transactionIndex: 24, + from: '0xa074683b5be015f053b5dceb064c41fc9d11b6e5', + to: '0x7CFB0193Ca87eB6e48056885E026552c3A941FC4', + hash: '0x47c53eeddc2f927ef2a7a3dd9a95bfd70ecfda2c4efdf10a16c48ca98c86b881', + value: 0, + block: { + id: '0004867730-2c78f', + height: 4867730, + hash: '0x2c78fb73f84f2755f65533652983578bcf89a68ad173e756bc631b4d0d242b53', + parentHash: + '0x1bb7d54bde1c3dda41c6cc5ab40ad04b855d1ce5dec4175571dd158d3134ec3e', + timestamp: 1702321200000, + }, + }, +}; + +export const logErc1155BatchTransfer = { + id: '0004867730-000035-2c78f', + address: InputBoxAddress, + logIndex: 35, + transactionIndex: 24, + topics: [ + '0x6aaa400068bf4ca337265e2a1e1e841f66b8597fd5b452fdc52a44bed28a0784', + encodeAbiParameters([{ type: 'address' }], [dappAddress]), + encodeAbiParameters([{ type: 'uint256' }], [784n]), + ], + data: '0x000000000000000000000000edb53860a6b52bbb7561ad596416ee9965b055aa000000000000000000000000000000000000000000000000000000000000004000000000000000000000000000000000000000000000000000000000000002282960f4db2b0993ae5b59bc4a0f5ec7a1767e905ea074683b5be015f053b5dceb064c41fc9d11b6e500000000000000000000000000000000000000000000000000000000000000800000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000018000000000000000000000000000000000000000000000000000000000000001c000000000000000000000000000000000000000000000000000000000000000030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000003000000000000000000000000000000000000000000000000000000000000006400000000000000000000000000000000000000000000000000000000000003e800000000000000000000000000000000000000000000000000000000000027100000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000', + block: { + id: '0004867730-2c78f', + height: 4867730, + hash: '0x2c78fb73f84f2755f65533652983578bcf89a68ad173e756bc631b4d0d242b53', + parentHash: + '0x1bb7d54bde1c3dda41c6cc5ab40ad04b855d1ce5dec4175571dd158d3134ec3e', + timestamp: 1702321200000, + }, + transaction: { + id: '0004867730-000024-2c78f', + transactionIndex: 24, + from: '0xa074683b5be015f053b5dceb064c41fc9d11b6e5', + to: '0xedB53860A6B52bbb7561Ad596416ee9965B055Aa', + hash: '0x47c53eeddc2f927ef2a7a3dd9a95bfd70ecfda2c4efdf10a16c48ca98c86b881', + value: 0, + block: { + id: '0004867730-2c78f', + height: 4867730, + hash: '0x2c78fb73f84f2755f65533652983578bcf89a68ad173e756bc631b4d0d242b53', + parentHash: + '0x1bb7d54bde1c3dda41c6cc5ab40ad04b855d1ce5dec4175571dd158d3134ec3e', + timestamp: 1702321200000, + }, + }, +}; + export const logErc20Transfer = { id: '0004867730-000035-2c78f', address: InputBoxAddress,