From f94c31c17b292a2d8e851014a13a53ca2f25c5c6 Mon Sep 17 00:00:00 2001 From: bitbeckers Date: Tue, 29 Aug 2023 15:31:06 +0200 Subject: [PATCH] feat(graph): update graph for burn methods --- graph/.eslintrc.yml | 11 + graph/abis/HypercertMinter.json | 2189 +++++++++-------- .../HypercertMinter/HypercertMinter.ts | 255 +- graph/src/hypercert-minter.ts | 83 +- graph/tests/.latest.json | 2 +- graph/tests/hypercert-minter-burn.test.ts | 193 ++ graph/tests/hypercert-minter-utils.ts | 147 +- 7 files changed, 1622 insertions(+), 1258 deletions(-) create mode 100644 graph/.eslintrc.yml create mode 100644 graph/tests/hypercert-minter-burn.test.ts diff --git a/graph/.eslintrc.yml b/graph/.eslintrc.yml new file mode 100644 index 00000000..2c49e547 --- /dev/null +++ b/graph/.eslintrc.yml @@ -0,0 +1,11 @@ +root: false +ignorePatterns: ["tests/", "generated/"] +parser: "@typescript-eslint/parser" +plugins: + - "@typescript-eslint" +extends: + - "eslint:recommended" + - "plugin:@typescript-eslint/recommended" +rules: + "@typescript-eslint/ban-types": + - "warn" diff --git a/graph/abis/HypercertMinter.json b/graph/abis/HypercertMinter.json index a0bb3aee..feb7ccb2 100644 --- a/graph/abis/HypercertMinter.json +++ b/graph/abis/HypercertMinter.json @@ -1,1065 +1,1130 @@ [ - { - "inputs": [], - "stateMutability": "nonpayable", - "type": "constructor" - }, - { - "inputs": [], - "name": "ArraySize", - "type": "error" - }, - { - "inputs": [], - "name": "DoesNotExist", - "type": "error" - }, - { - "inputs": [], - "name": "DuplicateEntry", - "type": "error" - }, - { - "inputs": [], - "name": "FractionalBurn", - "type": "error" - }, - { - "inputs": [], - "name": "Invalid", - "type": "error" - }, - { - "inputs": [], - "name": "NotAllowed", - "type": "error" - }, - { - "inputs": [], - "name": "TransfersNotAllowed", - "type": "error" - }, - { - "inputs": [], - "name": "TypeMismatch", - "type": "error" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "previousAdmin", - "type": "address" - }, - { - "indexed": false, - "internalType": "address", - "name": "newAdmin", - "type": "address" - } - ], - "name": "AdminChanged", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "root", - "type": "bytes32" - } - ], - "name": "AllowlistCreated", - "type": "event" - }, - { - "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": false, - "internalType": "uint256[]", - "name": "claimIDs", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "fromTokenIDs", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "toTokenIDs", - "type": "uint256[]" - }, - { - "indexed": false, - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - } - ], - "name": "BatchValueTransfer", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "beacon", - "type": "address" - } - ], - "name": "BeaconUpgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "uint256", - "name": "claimID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "string", - "name": "uri", - "type": "string" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "totalUnits", - "type": "uint256" - } - ], - "name": "ClaimStored", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint8", - "name": "version", - "type": "uint8" - } - ], - "name": "Initialized", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "bytes32", - "name": "leaf", - "type": "bytes32" - } - ], - "name": "LeafClaimed", - "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": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Paused", - "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" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "address", - "name": "account", - "type": "address" - } - ], - "name": "Unpaused", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": true, - "internalType": "address", - "name": "implementation", - "type": "address" - } - ], - "name": "Upgraded", - "type": "event" - }, - { - "anonymous": false, - "inputs": [ - { - "indexed": false, - "internalType": "uint256", - "name": "claimID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "fromTokenID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "toTokenID", - "type": "uint256" - }, - { - "indexed": false, - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "ValueTransfer", - "type": "event" - }, - { - "inputs": [], - "name": "__SemiFungible1155_init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "__Upgradeable1155_init", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "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": [ - { - "internalType": "bytes32[][]", - "name": "proofs", - "type": "bytes32[][]" - }, - { - "internalType": "uint256[]", - "name": "claimIDs", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "units", - "type": "uint256[]" - } - ], - "name": "batchMintClaimsFromAllowlists", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "id", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "value", - "type": "uint256" - } - ], - "name": "burn", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256[]", - "name": "ids", - "type": "uint256[]" - }, - { - "internalType": "uint256[]", - "name": "values", - "type": "uint256[]" - } - ], - "name": "burnBatch", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenID", - "type": "uint256" - } - ], - "name": "burnValue", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "units", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "merkleRoot", - "type": "bytes32" - }, - { - "internalType": "string", - "name": "_uri", - "type": "string" - }, - { - "internalType": "enum IHypercertToken.TransferRestrictions", - "name": "restrictions", - "type": "uint8" - } - ], - "name": "createAllowlist", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "name": "hasBeenClaimed", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "initialize", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "uint256", - "name": "claimID", - "type": "uint256" - }, - { - "internalType": "bytes32", - "name": "leaf", - "type": "bytes32" - } - ], - "name": "isAllowedToClaim", - "outputs": [ - { - "internalType": "bool", - "name": "isAllowed", - "type": "bool" - } - ], - "stateMutability": "view", - "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": [ - { - "internalType": "uint256[]", - "name": "_fractionIDs", - "type": "uint256[]" - } - ], - "name": "mergeValue", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "units", - "type": "uint256" - }, - { - "internalType": "string", - "name": "_uri", - "type": "string" - }, - { - "internalType": "enum IHypercertToken.TransferRestrictions", - "name": "restrictions", - "type": "uint8" - } - ], - "name": "mintClaim", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "bytes32[]", - "name": "proof", - "type": "bytes32[]" - }, - { - "internalType": "uint256", - "name": "claimID", - "type": "uint256" - }, - { - "internalType": "uint256", - "name": "units", - "type": "uint256" - } - ], - "name": "mintClaimFromAllowlist", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "units", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "fractions", - "type": "uint256[]" - }, - { - "internalType": "string", - "name": "_uri", - "type": "string" - }, - { - "internalType": "enum IHypercertToken.TransferRestrictions", - "name": "restrictions", - "type": "uint8" - } - ], - "name": "mintClaimWithFractions", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "name", - "outputs": [ - { - "internalType": "string", - "name": "", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "owner", - "outputs": [ - { - "internalType": "address", - "name": "", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - } - ], - "name": "ownerOf", - "outputs": [ - { - "internalType": "address", - "name": "_owner", - "type": "address" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "pause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [], - "name": "paused", - "outputs": [ - { - "internalType": "bool", - "name": "", - "type": "bool" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "proxiableUUID", - "outputs": [ - { - "internalType": "bytes32", - "name": "", - "type": "bytes32" - } - ], - "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": "address", - "name": "_account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "_tokenID", - "type": "uint256" - }, - { - "internalType": "uint256[]", - "name": "_values", - "type": "uint256[]" - } - ], - "name": "splitValue", - "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": "address", - "name": "account", - "type": "address" - }, - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - } - ], - "name": "unitsOf", - "outputs": [ - { - "internalType": "uint256", - "name": "units", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - } - ], - "name": "unitsOf", - "outputs": [ - { - "internalType": "uint256", - "name": "units", - "type": "uint256" - } - ], - "stateMutability": "view", - "type": "function" - }, - { - "inputs": [], - "name": "unpause", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - } - ], - "name": "upgradeTo", - "outputs": [], - "stateMutability": "nonpayable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "address", - "name": "newImplementation", - "type": "address" - }, - { - "internalType": "bytes", - "name": "data", - "type": "bytes" - } - ], - "name": "upgradeToAndCall", - "outputs": [], - "stateMutability": "payable", - "type": "function" - }, - { - "inputs": [ - { - "internalType": "uint256", - "name": "tokenID", - "type": "uint256" - } - ], + { + "inputs": [], + "stateMutability": "nonpayable", + "type": "constructor" + }, + { + "inputs": [], + "name": "AlreadyClaimed", + "type": "error" + }, + { + "inputs": [], + "name": "ArraySize", + "type": "error" + }, + { + "inputs": [], + "name": "DoesNotExist", + "type": "error" + }, + { + "inputs": [], + "name": "DuplicateEntry", + "type": "error" + }, + { + "inputs": [], + "name": "Invalid", + "type": "error" + }, + { + "inputs": [], + "name": "NotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "NotApprovedOrOwner", + "type": "error" + }, + { + "inputs": [], + "name": "TransfersNotAllowed", + "type": "error" + }, + { + "inputs": [], + "name": "TypeMismatch", + "type": "error" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "previousAdmin", + "type": "address" + }, + { + "indexed": false, + "internalType": "address", + "name": "newAdmin", + "type": "address" + } + ], + "name": "AdminChanged", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "root", + "type": "bytes32" + } + ], + "name": "AllowlistCreated", + "type": "event" + }, + { + "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": false, + "internalType": "uint256[]", + "name": "claimIDs", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "fromTokenIDs", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "toTokenIDs", + "type": "uint256[]" + }, + { + "indexed": false, + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "BatchValueTransfer", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "beacon", + "type": "address" + } + ], + "name": "BeaconUpgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "uint256", + "name": "claimID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "string", "name": "uri", - "outputs": [ - { - "internalType": "string", - "name": "_uri", - "type": "string" - } - ], - "stateMutability": "view", - "type": "function" - } + "type": "string" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "totalUnits", + "type": "uint256" + } + ], + "name": "ClaimStored", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint8", + "name": "version", + "type": "uint8" + } + ], + "name": "Initialized", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "LeafClaimed", + "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": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Paused", + "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" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "address", + "name": "account", + "type": "address" + } + ], + "name": "Unpaused", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": true, + "internalType": "address", + "name": "implementation", + "type": "address" + } + ], + "name": "Upgraded", + "type": "event" + }, + { + "anonymous": false, + "inputs": [ + { + "indexed": false, + "internalType": "uint256", + "name": "claimID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "fromTokenID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "toTokenID", + "type": "uint256" + }, + { + "indexed": false, + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "ValueTransfer", + "type": "event" + }, + { + "inputs": [], + "name": "__SemiFungible1155_init", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "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": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_tokenIDs", + "type": "uint256[]" + } + ], + "name": "batchBurnFraction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[][]", + "name": "proofs", + "type": "bytes32[][]" + }, + { + "internalType": "uint256[]", + "name": "claimIDs", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "units", + "type": "uint256[]" + } + ], + "name": "batchMintClaimsFromAllowlists", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "id", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "value", + "type": "uint256" + } + ], + "name": "burn", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "ids", + "type": "uint256[]" + }, + { + "internalType": "uint256[]", + "name": "values", + "type": "uint256[]" + } + ], + "name": "burnBatch", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenID", + "type": "uint256" + } + ], + "name": "burnFraction", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "units", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "merkleRoot", + "type": "bytes32" + }, + { + "internalType": "string", + "name": "_uri", + "type": "string" + }, + { + "internalType": "enum IHypercertToken.TransferRestrictions", + "name": "restrictions", + "type": "uint8" + } + ], + "name": "createAllowlist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "name": "hasBeenClaimed", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "initialize", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "claimID", + "type": "uint256" + }, + { + "internalType": "bytes32", + "name": "leaf", + "type": "bytes32" + } + ], + "name": "isAllowedToClaim", + "outputs": [ + { + "internalType": "bool", + "name": "isAllowed", + "type": "bool" + } + ], + "stateMutability": "view", + "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": [ + { + "internalType": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256[]", + "name": "_fractionIDs", + "type": "uint256[]" + } + ], + "name": "mergeFractions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "units", + "type": "uint256" + }, + { + "internalType": "string", + "name": "_uri", + "type": "string" + }, + { + "internalType": "enum IHypercertToken.TransferRestrictions", + "name": "restrictions", + "type": "uint8" + } + ], + "name": "mintClaim", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "bytes32[]", + "name": "proof", + "type": "bytes32[]" + }, + { + "internalType": "uint256", + "name": "claimID", + "type": "uint256" + }, + { + "internalType": "uint256", + "name": "units", + "type": "uint256" + } + ], + "name": "mintClaimFromAllowlist", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "units", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "fractions", + "type": "uint256[]" + }, + { + "internalType": "string", + "name": "_uri", + "type": "string" + }, + { + "internalType": "enum IHypercertToken.TransferRestrictions", + "name": "restrictions", + "type": "uint8" + } + ], + "name": "mintClaimWithFractions", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "name", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "owner", + "outputs": [ + { + "internalType": "address", + "name": "", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + } + ], + "name": "ownerOf", + "outputs": [ + { + "internalType": "address", + "name": "_owner", + "type": "address" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "pause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [], + "name": "paused", + "outputs": [ + { + "internalType": "bool", + "name": "", + "type": "bool" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "proxiableUUID", + "outputs": [ + { + "internalType": "bytes32", + "name": "", + "type": "bytes32" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + } + ], + "name": "readTransferRestriction", + "outputs": [ + { + "internalType": "string", + "name": "", + "type": "string" + } + ], + "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": "address", + "name": "_account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "_tokenID", + "type": "uint256" + }, + { + "internalType": "uint256[]", + "name": "_newFractions", + "type": "uint256[]" + } + ], + "name": "splitFraction", + "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": "address", + "name": "account", + "type": "address" + }, + { + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + } + ], + "name": "unitsOf", + "outputs": [ + { + "internalType": "uint256", + "name": "units", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + } + ], + "name": "unitsOf", + "outputs": [ + { + "internalType": "uint256", + "name": "units", + "type": "uint256" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "unpause", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + } + ], + "name": "upgradeTo", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "newImplementation", + "type": "address" + }, + { + "internalType": "bytes", + "name": "data", + "type": "bytes" + } + ], + "name": "upgradeToAndCall", + "outputs": [], + "stateMutability": "payable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "uint256", + "name": "tokenID", + "type": "uint256" + } + ], + "name": "uri", + "outputs": [ + { + "internalType": "string", + "name": "_uri", + "type": "string" + } + ], + "stateMutability": "view", + "type": "function" + } ] diff --git a/graph/generated/HypercertMinter/HypercertMinter.ts b/graph/generated/HypercertMinter/HypercertMinter.ts index 41fdeb8c..988629ae 100644 --- a/graph/generated/HypercertMinter/HypercertMinter.ts +++ b/graph/generated/HypercertMinter/HypercertMinter.ts @@ -7,7 +7,7 @@ import { Entity, Bytes, Address, - BigInt + BigInt, } from "@graphprotocol/graph-ts"; export class AdminChanged extends ethereum.Event { @@ -401,8 +401,8 @@ export class HypercertMinter extends ethereum.SmartContract { "balanceOf(address,uint256):(uint256)", [ ethereum.Value.fromAddress(account), - ethereum.Value.fromUnsignedBigInt(id) - ] + ethereum.Value.fromUnsignedBigInt(id), + ], ); return result[0].toBigInt(); @@ -414,8 +414,8 @@ export class HypercertMinter extends ethereum.SmartContract { "balanceOf(address,uint256):(uint256)", [ ethereum.Value.fromAddress(account), - ethereum.Value.fromUnsignedBigInt(id) - ] + ethereum.Value.fromUnsignedBigInt(id), + ], ); if (result.reverted) { return new ethereum.CallResult(); @@ -430,8 +430,8 @@ export class HypercertMinter extends ethereum.SmartContract { "balanceOfBatch(address[],uint256[]):(uint256[])", [ ethereum.Value.fromAddressArray(accounts), - ethereum.Value.fromUnsignedBigIntArray(ids) - ] + ethereum.Value.fromUnsignedBigIntArray(ids), + ], ); return result[0].toBigIntArray(); @@ -439,15 +439,15 @@ export class HypercertMinter extends ethereum.SmartContract { try_balanceOfBatch( accounts: Array
, - ids: Array + ids: Array, ): ethereum.CallResult> { let result = super.tryCall( "balanceOfBatch", "balanceOfBatch(address[],uint256[]):(uint256[])", [ ethereum.Value.fromAddressArray(accounts), - ethereum.Value.fromUnsignedBigIntArray(ids) - ] + ethereum.Value.fromUnsignedBigIntArray(ids), + ], ); if (result.reverted) { return new ethereum.CallResult(); @@ -462,8 +462,8 @@ export class HypercertMinter extends ethereum.SmartContract { "hasBeenClaimed(uint256,bytes32):(bool)", [ ethereum.Value.fromUnsignedBigInt(param0), - ethereum.Value.fromFixedBytes(param1) - ] + ethereum.Value.fromFixedBytes(param1), + ], ); return result[0].toBoolean(); @@ -471,15 +471,15 @@ export class HypercertMinter extends ethereum.SmartContract { try_hasBeenClaimed( param0: BigInt, - param1: Bytes + param1: Bytes, ): ethereum.CallResult { let result = super.tryCall( "hasBeenClaimed", "hasBeenClaimed(uint256,bytes32):(bool)", [ ethereum.Value.fromUnsignedBigInt(param0), - ethereum.Value.fromFixedBytes(param1) - ] + ethereum.Value.fromFixedBytes(param1), + ], ); if (result.reverted) { return new ethereum.CallResult(); @@ -495,8 +495,8 @@ export class HypercertMinter extends ethereum.SmartContract { [ ethereum.Value.fromFixedBytesArray(proof), ethereum.Value.fromUnsignedBigInt(claimID), - ethereum.Value.fromFixedBytes(leaf) - ] + ethereum.Value.fromFixedBytes(leaf), + ], ); return result[0].toBoolean(); @@ -505,7 +505,7 @@ export class HypercertMinter extends ethereum.SmartContract { try_isAllowedToClaim( proof: Array, claimID: BigInt, - leaf: Bytes + leaf: Bytes, ): ethereum.CallResult { let result = super.tryCall( "isAllowedToClaim", @@ -513,8 +513,8 @@ export class HypercertMinter extends ethereum.SmartContract { [ ethereum.Value.fromFixedBytesArray(proof), ethereum.Value.fromUnsignedBigInt(claimID), - ethereum.Value.fromFixedBytes(leaf) - ] + ethereum.Value.fromFixedBytes(leaf), + ], ); if (result.reverted) { return new ethereum.CallResult(); @@ -529,8 +529,8 @@ export class HypercertMinter extends ethereum.SmartContract { "isApprovedForAll(address,address):(bool)", [ ethereum.Value.fromAddress(account), - ethereum.Value.fromAddress(operator) - ] + ethereum.Value.fromAddress(operator), + ], ); return result[0].toBoolean(); @@ -538,15 +538,15 @@ export class HypercertMinter extends ethereum.SmartContract { try_isApprovedForAll( account: Address, - operator: Address + operator: Address, ): ethereum.CallResult { let result = super.tryCall( "isApprovedForAll", "isApprovedForAll(address,address):(bool)", [ ethereum.Value.fromAddress(account), - ethereum.Value.fromAddress(operator) - ] + ethereum.Value.fromAddress(operator), + ], ); if (result.reverted) { return new ethereum.CallResult(); @@ -587,7 +587,7 @@ export class HypercertMinter extends ethereum.SmartContract { ownerOf(tokenID: BigInt): Address { let result = super.call("ownerOf", "ownerOf(uint256):(address)", [ - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); return result[0].toAddress(); @@ -595,7 +595,7 @@ export class HypercertMinter extends ethereum.SmartContract { try_ownerOf(tokenID: BigInt): ethereum.CallResult
{ let result = super.tryCall("ownerOf", "ownerOf(uint256):(address)", [ - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); if (result.reverted) { return new ethereum.CallResult(); @@ -629,7 +629,7 @@ export class HypercertMinter extends ethereum.SmartContract { let result = super.tryCall( "proxiableUUID", "proxiableUUID():(bytes32)", - [] + [], ); if (result.reverted) { return new ethereum.CallResult(); @@ -638,11 +638,34 @@ export class HypercertMinter extends ethereum.SmartContract { return ethereum.CallResult.fromValue(value[0].toBytes()); } + readTransferRestriction(tokenID: BigInt): string { + let result = super.call( + "readTransferRestriction", + "readTransferRestriction(uint256):(string)", + [ethereum.Value.fromUnsignedBigInt(tokenID)], + ); + + return result[0].toString(); + } + + try_readTransferRestriction(tokenID: BigInt): ethereum.CallResult { + let result = super.tryCall( + "readTransferRestriction", + "readTransferRestriction(uint256):(string)", + [ethereum.Value.fromUnsignedBigInt(tokenID)], + ); + if (result.reverted) { + return new ethereum.CallResult(); + } + let value = result.value; + return ethereum.CallResult.fromValue(value[0].toString()); + } + supportsInterface(interfaceId: Bytes): boolean { let result = super.call( "supportsInterface", "supportsInterface(bytes4):(bool)", - [ethereum.Value.fromFixedBytes(interfaceId)] + [ethereum.Value.fromFixedBytes(interfaceId)], ); return result[0].toBoolean(); @@ -652,7 +675,7 @@ export class HypercertMinter extends ethereum.SmartContract { let result = super.tryCall( "supportsInterface", "supportsInterface(bytes4):(bool)", - [ethereum.Value.fromFixedBytes(interfaceId)] + [ethereum.Value.fromFixedBytes(interfaceId)], ); if (result.reverted) { return new ethereum.CallResult(); @@ -664,7 +687,7 @@ export class HypercertMinter extends ethereum.SmartContract { unitsOf(account: Address, tokenID: BigInt): BigInt { let result = super.call("unitsOf", "unitsOf(address,uint256):(uint256)", [ ethereum.Value.fromAddress(account), - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); return result[0].toBigInt(); @@ -676,8 +699,8 @@ export class HypercertMinter extends ethereum.SmartContract { "unitsOf(address,uint256):(uint256)", [ ethereum.Value.fromAddress(account), - ethereum.Value.fromUnsignedBigInt(tokenID) - ] + ethereum.Value.fromUnsignedBigInt(tokenID), + ], ); if (result.reverted) { return new ethereum.CallResult(); @@ -688,7 +711,7 @@ export class HypercertMinter extends ethereum.SmartContract { unitsOf1(tokenID: BigInt): BigInt { let result = super.call("unitsOf", "unitsOf(uint256):(uint256)", [ - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); return result[0].toBigInt(); @@ -696,7 +719,7 @@ export class HypercertMinter extends ethereum.SmartContract { try_unitsOf1(tokenID: BigInt): ethereum.CallResult { let result = super.tryCall("unitsOf", "unitsOf(uint256):(uint256)", [ - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); if (result.reverted) { return new ethereum.CallResult(); @@ -707,7 +730,7 @@ export class HypercertMinter extends ethereum.SmartContract { uri(tokenID: BigInt): string { let result = super.call("uri", "uri(uint256):(string)", [ - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); return result[0].toString(); @@ -715,7 +738,7 @@ export class HypercertMinter extends ethereum.SmartContract { try_uri(tokenID: BigInt): ethereum.CallResult { let result = super.tryCall("uri", "uri(uint256):(string)", [ - ethereum.Value.fromUnsignedBigInt(tokenID) + ethereum.Value.fromUnsignedBigInt(tokenID), ]); if (result.reverted) { return new ethereum.CallResult(); @@ -777,28 +800,36 @@ export class __SemiFungible1155_initCall__Outputs { } } -export class __Upgradeable1155_initCall extends ethereum.Call { - get inputs(): __Upgradeable1155_initCall__Inputs { - return new __Upgradeable1155_initCall__Inputs(this); +export class BatchBurnFractionCall extends ethereum.Call { + get inputs(): BatchBurnFractionCall__Inputs { + return new BatchBurnFractionCall__Inputs(this); } - get outputs(): __Upgradeable1155_initCall__Outputs { - return new __Upgradeable1155_initCall__Outputs(this); + get outputs(): BatchBurnFractionCall__Outputs { + return new BatchBurnFractionCall__Outputs(this); } } -export class __Upgradeable1155_initCall__Inputs { - _call: __Upgradeable1155_initCall; +export class BatchBurnFractionCall__Inputs { + _call: BatchBurnFractionCall; - constructor(call: __Upgradeable1155_initCall) { + constructor(call: BatchBurnFractionCall) { this._call = call; } + + get _account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + + get _tokenIDs(): Array { + return this._call.inputValues[1].value.toBigIntArray(); + } } -export class __Upgradeable1155_initCall__Outputs { - _call: __Upgradeable1155_initCall; +export class BatchBurnFractionCall__Outputs { + _call: BatchBurnFractionCall; - constructor(call: __Upgradeable1155_initCall) { + constructor(call: BatchBurnFractionCall) { this._call = call; } } @@ -820,16 +851,20 @@ export class BatchMintClaimsFromAllowlistsCall__Inputs { this._call = call; } + get account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + get proofs(): Array> { - return this._call.inputValues[0].value.toBytesMatrix(); + return this._call.inputValues[1].value.toBytesMatrix(); } get claimIDs(): Array { - return this._call.inputValues[1].value.toBigIntArray(); + return this._call.inputValues[2].value.toBigIntArray(); } get units(): Array { - return this._call.inputValues[2].value.toBigIntArray(); + return this._call.inputValues[3].value.toBigIntArray(); } } @@ -917,20 +952,20 @@ export class BurnBatchCall__Outputs { } } -export class BurnValueCall extends ethereum.Call { - get inputs(): BurnValueCall__Inputs { - return new BurnValueCall__Inputs(this); +export class BurnFractionCall extends ethereum.Call { + get inputs(): BurnFractionCall__Inputs { + return new BurnFractionCall__Inputs(this); } - get outputs(): BurnValueCall__Outputs { - return new BurnValueCall__Outputs(this); + get outputs(): BurnFractionCall__Outputs { + return new BurnFractionCall__Outputs(this); } } -export class BurnValueCall__Inputs { - _call: BurnValueCall; +export class BurnFractionCall__Inputs { + _call: BurnFractionCall; - constructor(call: BurnValueCall) { + constructor(call: BurnFractionCall) { this._call = call; } @@ -943,10 +978,10 @@ export class BurnValueCall__Inputs { } } -export class BurnValueCall__Outputs { - _call: BurnValueCall; +export class BurnFractionCall__Outputs { + _call: BurnFractionCall; - constructor(call: BurnValueCall) { + constructor(call: BurnFractionCall) { this._call = call; } } @@ -968,20 +1003,24 @@ export class CreateAllowlistCall__Inputs { this._call = call; } + get account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + get units(): BigInt { - return this._call.inputValues[0].value.toBigInt(); + return this._call.inputValues[1].value.toBigInt(); } get merkleRoot(): Bytes { - return this._call.inputValues[1].value.toBytes(); + return this._call.inputValues[2].value.toBytes(); } get _uri(): string { - return this._call.inputValues[2].value.toString(); + return this._call.inputValues[3].value.toString(); } get restrictions(): i32 { - return this._call.inputValues[3].value.toI32(); + return this._call.inputValues[4].value.toI32(); } } @@ -1019,32 +1058,36 @@ export class InitializeCall__Outputs { } } -export class MergeValueCall extends ethereum.Call { - get inputs(): MergeValueCall__Inputs { - return new MergeValueCall__Inputs(this); +export class MergeFractionsCall extends ethereum.Call { + get inputs(): MergeFractionsCall__Inputs { + return new MergeFractionsCall__Inputs(this); } - get outputs(): MergeValueCall__Outputs { - return new MergeValueCall__Outputs(this); + get outputs(): MergeFractionsCall__Outputs { + return new MergeFractionsCall__Outputs(this); } } -export class MergeValueCall__Inputs { - _call: MergeValueCall; +export class MergeFractionsCall__Inputs { + _call: MergeFractionsCall; - constructor(call: MergeValueCall) { + constructor(call: MergeFractionsCall) { this._call = call; } + get _account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + get _fractionIDs(): Array { - return this._call.inputValues[0].value.toBigIntArray(); + return this._call.inputValues[1].value.toBigIntArray(); } } -export class MergeValueCall__Outputs { - _call: MergeValueCall; +export class MergeFractionsCall__Outputs { + _call: MergeFractionsCall; - constructor(call: MergeValueCall) { + constructor(call: MergeFractionsCall) { this._call = call; } } @@ -1066,16 +1109,20 @@ export class MintClaimCall__Inputs { this._call = call; } + get account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + get units(): BigInt { - return this._call.inputValues[0].value.toBigInt(); + return this._call.inputValues[1].value.toBigInt(); } get _uri(): string { - return this._call.inputValues[1].value.toString(); + return this._call.inputValues[2].value.toString(); } get restrictions(): i32 { - return this._call.inputValues[2].value.toI32(); + return this._call.inputValues[3].value.toI32(); } } @@ -1104,16 +1151,20 @@ export class MintClaimFromAllowlistCall__Inputs { this._call = call; } + get account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + get proof(): Array { - return this._call.inputValues[0].value.toBytesArray(); + return this._call.inputValues[1].value.toBytesArray(); } get claimID(): BigInt { - return this._call.inputValues[1].value.toBigInt(); + return this._call.inputValues[2].value.toBigInt(); } get units(): BigInt { - return this._call.inputValues[2].value.toBigInt(); + return this._call.inputValues[3].value.toBigInt(); } } @@ -1142,20 +1193,24 @@ export class MintClaimWithFractionsCall__Inputs { this._call = call; } + get account(): Address { + return this._call.inputValues[0].value.toAddress(); + } + get units(): BigInt { - return this._call.inputValues[0].value.toBigInt(); + return this._call.inputValues[1].value.toBigInt(); } get fractions(): Array { - return this._call.inputValues[1].value.toBigIntArray(); + return this._call.inputValues[2].value.toBigIntArray(); } get _uri(): string { - return this._call.inputValues[2].value.toString(); + return this._call.inputValues[3].value.toString(); } get restrictions(): i32 { - return this._call.inputValues[3].value.toI32(); + return this._call.inputValues[4].value.toI32(); } } @@ -1345,20 +1400,20 @@ export class SetApprovalForAllCall__Outputs { } } -export class SplitValueCall extends ethereum.Call { - get inputs(): SplitValueCall__Inputs { - return new SplitValueCall__Inputs(this); +export class SplitFractionCall extends ethereum.Call { + get inputs(): SplitFractionCall__Inputs { + return new SplitFractionCall__Inputs(this); } - get outputs(): SplitValueCall__Outputs { - return new SplitValueCall__Outputs(this); + get outputs(): SplitFractionCall__Outputs { + return new SplitFractionCall__Outputs(this); } } -export class SplitValueCall__Inputs { - _call: SplitValueCall; +export class SplitFractionCall__Inputs { + _call: SplitFractionCall; - constructor(call: SplitValueCall) { + constructor(call: SplitFractionCall) { this._call = call; } @@ -1370,15 +1425,15 @@ export class SplitValueCall__Inputs { return this._call.inputValues[1].value.toBigInt(); } - get _values(): Array { + get _newFractions(): Array { return this._call.inputValues[2].value.toBigIntArray(); } } -export class SplitValueCall__Outputs { - _call: SplitValueCall; +export class SplitFractionCall__Outputs { + _call: SplitFractionCall; - constructor(call: SplitValueCall) { + constructor(call: SplitFractionCall) { this._call = call; } } diff --git a/graph/src/hypercert-minter.ts b/graph/src/hypercert-minter.ts index a9f65e3a..2c9b2de7 100644 --- a/graph/src/hypercert-minter.ts +++ b/graph/src/hypercert-minter.ts @@ -11,37 +11,37 @@ import { URI as URIEvent, ValueTransfer as ValueTransferEvent, } from "../generated/HypercertMinter/HypercertMinter"; +import { ClaimToken } from "../generated/schema"; import { getID, getOrCreateAllowlist, getOrCreateClaim, getOrCreateClaimToken, } from "./utils"; -import { Address, BigInt, log } from "@graphprotocol/graph-ts"; -import { ClaimToken } from "../generated/schema"; +import { Address, log } from "@graphprotocol/graph-ts"; const ZERO_ADDRESS = Address.fromString( - "0x0000000000000000000000000000000000000000" + "0x0000000000000000000000000000000000000000", ); -const ZERO_TOKEN = BigInt.fromI32(0); export function handleAllowlistCreated(event: AllowlistCreatedEvent): void { - let allowlist = getOrCreateAllowlist( + const allowlist = getOrCreateAllowlist( event.params.tokenID, event.params.root, - event.address + event.address, ); allowlist.save(); } -export function handleApprovalForAll(event: ApprovalForAllEvent): void {} +// eslint-disable-next-line @typescript-eslint/no-empty-function +export function handleApprovalForAll(_event: ApprovalForAllEvent): void {} export function handleClaimStored(event: ClaimStoredEvent): void { - let claim = getOrCreateClaim( + const claim = getOrCreateClaim( event.params.claimID, event.address, - event.block.timestamp + event.block.timestamp, ); claim.uri = event.params.uri; @@ -52,19 +52,36 @@ export function handleClaimStored(event: ClaimStoredEvent): void { claim.save(); } -export function handleInitialized(event: InitializedEvent): void {} +// eslint-disable-next-line @typescript-eslint/no-empty-function +export function handleInitialized(_event: InitializedEvent): void {} -export function handleLeafClaimed(event: LeafClaimedEvent): void {} +// eslint-disable-next-line @typescript-eslint/no-empty-function +export function handleLeafClaimed(_event: LeafClaimedEvent): void {} export function handleOwnershipTransferred( - event: OwnershipTransferredEvent + _event: OwnershipTransferredEvent, + // eslint-disable-next-line @typescript-eslint/no-empty-function ): void {} -export function handleTransferBatch(event: TransferBatchEvent): void {} +// operator, from, to, ids, values +export function handleTransferBatch(event: TransferBatchEvent): void { + for (let i = 0; i < event.params.ids.length; i++) { + const id = getID(event.params.ids[i], event.address); + const token = ClaimToken.load(id); + + if (!token) { + log.debug("Transfered ClaimToken does not exist: {}", [id]); + return; + } + + token.owner = event.params.to; + token.save(); + } +} export function handleTransferSingle(event: TransferSingleEvent): void { - let id = getID(event.params.id, event.address); - let token = ClaimToken.load(id); + const id = getID(event.params.id, event.address); + const token = ClaimToken.load(id); if (!token) { log.debug("Transfered ClaimToken does not exist: {}", [id]); @@ -75,7 +92,8 @@ export function handleTransferSingle(event: TransferSingleEvent): void { token.save(); } -export function handleURI(event: URIEvent): void {} +// eslint-disable-next-line @typescript-eslint/no-empty-function +export function handleURI(_event: URIEvent): void {} export function handleValueTransfer(event: ValueTransferEvent): void { log.debug("Received ValueTransferEvent claimID: {}", [ @@ -92,18 +110,18 @@ export function handleValueTransfer(event: ValueTransferEvent): void { event.params.value.toString(), ]); - let from = getOrCreateClaimToken( + const from = getOrCreateClaimToken( event.params.claimID, event.params.fromTokenID, - event.address + event.address, ); - let to = getOrCreateClaimToken( + const to = getOrCreateClaimToken( event.params.claimID, event.params.toTokenID, - event.address + event.address, ); - let value = event.params.value; + const value = event.params.value; log.debug("Got from: {}", [from.id]); log.debug("Got to: {}", [to.id]); @@ -123,6 +141,7 @@ export function handleValueTransfer(event: ValueTransferEvent): void { // Burn value if (!from.tokenID.isZero() && to.tokenID.isZero()) { from.units = from.units.minus(value); + from.owner = ZERO_ADDRESS; } log.debug("Saving from: {}", [from.id]); @@ -134,18 +153,23 @@ export function handleValueTransfer(event: ValueTransferEvent): void { //TODO cleanup to nicer state handling export function handleBatchValueTransfer(event: BatchValueTransfer): void { - let claimIDs = event.params.claimIDs; - let fromIDs = event.params.fromTokenIDs; - let toIDs = event.params.toTokenIDs; - let values = event.params.values; + const claimIDs = event.params.claimIDs; + const fromIDs = event.params.fromTokenIDs; + const toIDs = event.params.toTokenIDs; + const values = event.params.values; + const contractAddress = event.address; - let size = claimIDs.length; + const size = claimIDs.length; for (let i = 0; i < size; i++) { - let from = getOrCreateClaimToken(claimIDs[i], fromIDs[i], event.address); - let to = getOrCreateClaimToken(claimIDs[i], toIDs[i], event.address); + const from = getOrCreateClaimToken( + claimIDs[i], + fromIDs[i], + contractAddress, + ); + const to = getOrCreateClaimToken(claimIDs[i], toIDs[i], contractAddress); - let value = values[i]; + const value = values[i]; log.debug("Got from: {}", [from.id]); log.debug("Got to: {}", [to.id]); @@ -164,6 +188,7 @@ export function handleBatchValueTransfer(event: BatchValueTransfer): void { // Burn value if (!from.tokenID.isZero() && to.tokenID.isZero()) { from.units = from.units.minus(value); + from.owner = ZERO_ADDRESS; } log.debug("Saving from: {}", [from.id]); diff --git a/graph/tests/.latest.json b/graph/tests/.latest.json index a6d8f561..113c99a7 100644 --- a/graph/tests/.latest.json +++ b/graph/tests/.latest.json @@ -1,4 +1,4 @@ { "version": "0.5.4", - "timestamp": 1688082385888 + "timestamp": 1693308593418 } diff --git a/graph/tests/hypercert-minter-burn.test.ts b/graph/tests/hypercert-minter-burn.test.ts new file mode 100644 index 00000000..496b7c8b --- /dev/null +++ b/graph/tests/hypercert-minter-burn.test.ts @@ -0,0 +1,193 @@ +import { + handleTransferSingle, + handleValueTransfer, + handleBatchValueTransfer, + handleTransferBatch, +} from "../src/hypercert-minter"; +import { + buildIDs, + buildValues, + buildZeroes, + createBatchValueTransferEvent, + createTransferBatchEvent, + createTransferSingleEvent, + createValueTransferEvent, + getDefaultContractAddress, + ZERO_ADDRESS, + ZERO_TOKEN, +} from "./hypercert-minter-utils"; +import { Address, BigInt, ethereum } from "@graphprotocol/graph-ts"; +import { + assert, + describe, + test, + clearStore, + beforeAll, + afterAll, + createMockedFunction, + afterEach, +} from "matchstick-as/assembly/index"; + +export { handleTransferSingle, handleValueTransfer, handleBatchValueTransfer }; + +describe("Describe entity assertions", () => { + beforeAll(() => {}); + + afterEach(() => { + clearStore(); + }); + + test("TransferSingle and TransferValue for an existing token to zero address burns the fraction", () => { + let from = Address.fromString("0x0000000000000000000000000000000000000001"); + + let claimID = BigInt.fromI64(1); + let fromID = BigInt.fromI64(0); + let toID = BigInt.fromI64(1); + let units = BigInt.fromI64(10000); + + // Create fraction token + let valueTransferEvent = createValueTransferEvent( + claimID, + fromID, + toID, + units, + ); + + createMockedFunction( + getDefaultContractAddress(), + "ownerOf", + "ownerOf(uint256):(address)", + ) + .withArgs([ethereum.Value.fromUnsignedBigInt(toID)]) + .returns([ethereum.Value.fromAddress(from)]); + + createMockedFunction( + getDefaultContractAddress(), + "ownerOf", + "ownerOf(uint256):(address)", + ) + .withArgs([ethereum.Value.fromUnsignedBigInt(fromID)]) + .returns([ethereum.Value.fromAddress(from)]); + + handleValueTransfer(valueTransferEvent); + + let fractionId = getDefaultContractAddress().toHexString().concat("-1"); + + assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); + assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); + + // Handle 1155 transfer to zero address + let transferSingleEvent = createTransferSingleEvent( + from, + from, + ZERO_ADDRESS, + BigInt.fromI64(1), + BigInt.fromI64(1), + ); + + handleTransferSingle(transferSingleEvent); + + assert.fieldEquals( + "ClaimToken", + fractionId, + "owner", + ZERO_ADDRESS.toHexString(), + ); + assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); + + // Handle hypercert units transfer + let valueTransferEvent2 = createValueTransferEvent( + claimID, + toID, + ZERO_TOKEN, + units, + ); + + handleValueTransfer(valueTransferEvent2); + + assert.fieldEquals( + "ClaimToken", + fractionId, + "owner", + ZERO_ADDRESS.toHexString(), + ); + assert.fieldEquals("ClaimToken", fractionId, "units", "0"); + }); + + test("TransferBatch and BatchTransferValue for an existing token to zero address burns the fraction", () => { + let from = Address.fromString("0x0000000000000000000000000000000000000001"); + + let claimID = BigInt.fromI64(1); + let fromID = BigInt.fromI64(0); + let toID = BigInt.fromI64(1); + let units = BigInt.fromI64(10000); + + // Create fraction token + let valueTransferEvent = createBatchValueTransferEvent( + [claimID], + [fromID], + [toID], + [units], + ); + + createMockedFunction( + getDefaultContractAddress(), + "ownerOf", + "ownerOf(uint256):(address)", + ) + .withArgs([ethereum.Value.fromUnsignedBigInt(toID)]) + .returns([ethereum.Value.fromAddress(from)]); + + createMockedFunction( + getDefaultContractAddress(), + "ownerOf", + "ownerOf(uint256):(address)", + ) + .withArgs([ethereum.Value.fromUnsignedBigInt(fromID)]) + .returns([ethereum.Value.fromAddress(from)]); + + handleBatchValueTransfer(valueTransferEvent); + + let fractionId = getDefaultContractAddress().toHexString().concat("-1"); + + assert.fieldEquals("ClaimToken", fractionId, "owner", from.toHexString()); + assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); + + // Handle 1155 transfer to zero address + let transferBatchEvent = createTransferBatchEvent( + from, + from, + ZERO_ADDRESS, + [BigInt.fromI64(1)], + [BigInt.fromI64(1)], + ); + + handleTransferBatch(transferBatchEvent); + + assert.fieldEquals( + "ClaimToken", + fractionId, + "owner", + ZERO_ADDRESS.toHexString(), + ); + assert.fieldEquals("ClaimToken", fractionId, "units", "10000"); + + // Handle hypercert units transfer + let valueTransferEvent2 = createBatchValueTransferEvent( + [claimID], + [toID], + [ZERO_TOKEN], + [units], + ); + + handleBatchValueTransfer(valueTransferEvent2); + + assert.fieldEquals( + "ClaimToken", + fractionId, + "owner", + ZERO_ADDRESS.toHexString(), + ); + assert.fieldEquals("ClaimToken", fractionId, "units", "0"); + }); +}); diff --git a/graph/tests/hypercert-minter-utils.ts b/graph/tests/hypercert-minter-utils.ts index 53a64853..e1694735 100644 --- a/graph/tests/hypercert-minter-utils.ts +++ b/graph/tests/hypercert-minter-utils.ts @@ -1,5 +1,3 @@ -import { newMockEvent } from "matchstick-as"; -import { ethereum, Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; import { AllowlistCreated, BatchValueTransfer, @@ -10,6 +8,13 @@ import { URI, ValueTransfer, } from "../generated/HypercertMinter/HypercertMinter"; +import { ethereum, Address, BigInt, Bytes } from "@graphprotocol/graph-ts"; +import { newMockEvent } from "matchstick-as"; + +export const ZERO_ADDRESS = Address.fromString( + "0x0000000000000000000000000000000000000000", +); +export const ZERO_TOKEN = BigInt.fromI32(0); export function getDefaultContractAddress(): Address { return Address.fromString("0x89205A3A3b2A69De6Dbf7f01ED13B2108B2c43e7"); @@ -28,7 +33,7 @@ export function buildZeroes(size: BigInt): BigInt[] { export function buildIDs( size: BigInt, - start: BigInt = BigInt.zero() + start: BigInt = BigInt.zero(), ): BigInt[] { let array: BigInt[] = []; for (let i = 0; i < size.toI32(); i++) { @@ -54,7 +59,7 @@ export function buildValues(size: BigInt): BigInt[] { export function createAllowlistCreatedEvent( tokenID: BigInt, - root: Bytes + root: Bytes, ): AllowlistCreated { let mockEvent = newMockEvent(); let parameters: ethereum.EventParam[] = new Array(); @@ -64,11 +69,11 @@ export function createAllowlistCreatedEvent( parameters.push( new ethereum.EventParam( "tokenID", - ethereum.Value.fromUnsignedBigInt(tokenID) - ) + ethereum.Value.fromUnsignedBigInt(tokenID), + ), ); parameters.push( - new ethereum.EventParam("root", ethereum.Value.fromFixedBytes(root)) + new ethereum.EventParam("root", ethereum.Value.fromFixedBytes(root)), ); let allowlistCreatedEvent = new AllowlistCreated( @@ -79,7 +84,7 @@ export function createAllowlistCreatedEvent( mockEvent.block, mockEvent.transaction, parameters, - mockEvent.receipt + mockEvent.receipt, ); return allowlistCreatedEvent; @@ -88,7 +93,7 @@ export function createAllowlistCreatedEvent( export function createClaimStoredEvent( claimID: BigInt, uri: string, - totalUnits: BigInt + totalUnits: BigInt, ): ClaimStored { let mockEvent = newMockEvent(); let parameters: ethereum.EventParam[] = new Array(); @@ -96,18 +101,18 @@ export function createClaimStoredEvent( parameters.push( new ethereum.EventParam( "claimID", - ethereum.Value.fromUnsignedBigInt(claimID) - ) + ethereum.Value.fromUnsignedBigInt(claimID), + ), ); parameters.push( - new ethereum.EventParam("uri", ethereum.Value.fromString(uri)) + new ethereum.EventParam("uri", ethereum.Value.fromString(uri)), ); parameters.push( new ethereum.EventParam( "totalUnits", - ethereum.Value.fromUnsignedBigInt(totalUnits) - ) + ethereum.Value.fromUnsignedBigInt(totalUnits), + ), ); let claimStoredEvent = new ClaimStored( @@ -118,7 +123,7 @@ export function createClaimStoredEvent( mockEvent.block, mockEvent.transaction, parameters, - mockEvent.receipt + mockEvent.receipt, ); return claimStoredEvent; @@ -126,7 +131,7 @@ export function createClaimStoredEvent( export function createLeafClaimedEvent( tokenID: BigInt, - leaf: Bytes + leaf: Bytes, ): LeafClaimed { let leafClaimedEvent = changetype(newMockEvent()); @@ -135,11 +140,11 @@ export function createLeafClaimedEvent( leafClaimedEvent.parameters.push( new ethereum.EventParam( "tokenID", - ethereum.Value.fromUnsignedBigInt(tokenID) - ) + ethereum.Value.fromUnsignedBigInt(tokenID), + ), ); leafClaimedEvent.parameters.push( - new ethereum.EventParam("leaf", ethereum.Value.fromFixedBytes(leaf)) + new ethereum.EventParam("leaf", ethereum.Value.fromFixedBytes(leaf)), ); return leafClaimedEvent; @@ -150,29 +155,39 @@ export function createTransferBatchEvent( from: Address, to: Address, ids: Array, - values: Array + values: Array, ): TransferBatch { - let transferBatchEvent = changetype(newMockEvent()); - - transferBatchEvent.parameters = new Array(); + let mockEvent = newMockEvent(); + let parameters: ethereum.EventParam[] = new Array(); - transferBatchEvent.parameters.push( - new ethereum.EventParam("operator", ethereum.Value.fromAddress(operator)) + parameters.push( + new ethereum.EventParam("operator", ethereum.Value.fromAddress(operator)), ); - transferBatchEvent.parameters.push( - new ethereum.EventParam("from", ethereum.Value.fromAddress(from)) + parameters.push( + new ethereum.EventParam("from", ethereum.Value.fromAddress(from)), ); - transferBatchEvent.parameters.push( - new ethereum.EventParam("to", ethereum.Value.fromAddress(to)) + parameters.push( + new ethereum.EventParam("to", ethereum.Value.fromAddress(to)), ); - transferBatchEvent.parameters.push( - new ethereum.EventParam("ids", ethereum.Value.fromUnsignedBigIntArray(ids)) + parameters.push( + new ethereum.EventParam("ids", ethereum.Value.fromUnsignedBigIntArray(ids)), ); - transferBatchEvent.parameters.push( + parameters.push( new ethereum.EventParam( "values", - ethereum.Value.fromUnsignedBigIntArray(values) - ) + ethereum.Value.fromUnsignedBigIntArray(values), + ), + ); + + let transferBatchEvent = new TransferBatch( + getDefaultContractAddress(), + mockEvent.logIndex, + mockEvent.transactionLogIndex, + mockEvent.logType, + mockEvent.block, + mockEvent.transaction, + parameters, + mockEvent.receipt, ); return transferBatchEvent; @@ -183,25 +198,25 @@ export function createTransferSingleEvent( from: Address, to: Address, id: BigInt, - value: BigInt + value: BigInt, ): TransferSingle { let mockEvent = newMockEvent(); let parameters: ethereum.EventParam[] = new Array(); parameters.push( - new ethereum.EventParam("operator", ethereum.Value.fromAddress(operator)) + new ethereum.EventParam("operator", ethereum.Value.fromAddress(operator)), ); parameters.push( - new ethereum.EventParam("from", ethereum.Value.fromAddress(from)) + new ethereum.EventParam("from", ethereum.Value.fromAddress(from)), ); parameters.push( - new ethereum.EventParam("to", ethereum.Value.fromAddress(to)) + new ethereum.EventParam("to", ethereum.Value.fromAddress(to)), ); parameters.push( - new ethereum.EventParam("id", ethereum.Value.fromUnsignedBigInt(id)) + new ethereum.EventParam("id", ethereum.Value.fromUnsignedBigInt(id)), ); parameters.push( - new ethereum.EventParam("value", ethereum.Value.fromUnsignedBigInt(value)) + new ethereum.EventParam("value", ethereum.Value.fromUnsignedBigInt(value)), ); let transferSingleEvent = new TransferSingle( @@ -212,7 +227,7 @@ export function createTransferSingleEvent( mockEvent.block, mockEvent.transaction, parameters, - mockEvent.receipt + mockEvent.receipt, ); return transferSingleEvent; @@ -224,20 +239,20 @@ export function createURIEvent(value: string, id: BigInt): URI { uriEvent.parameters = new Array(); uriEvent.parameters.push( - new ethereum.EventParam("value", ethereum.Value.fromString(value)) + new ethereum.EventParam("value", ethereum.Value.fromString(value)), ); uriEvent.parameters.push( - new ethereum.EventParam("id", ethereum.Value.fromUnsignedBigInt(id)) + new ethereum.EventParam("id", ethereum.Value.fromUnsignedBigInt(id)), ); return uriEvent; } export function createHypercertMinterUpgradedEvent( - implementation: Address + implementation: Address, ): HypercertMinterUpgraded { let hypercertMinterUpgradedEvent = changetype( - newMockEvent() + newMockEvent(), ); hypercertMinterUpgradedEvent.parameters = new Array(); @@ -245,8 +260,8 @@ export function createHypercertMinterUpgradedEvent( hypercertMinterUpgradedEvent.parameters.push( new ethereum.EventParam( "implementation", - ethereum.Value.fromAddress(implementation) - ) + ethereum.Value.fromAddress(implementation), + ), ); return hypercertMinterUpgradedEvent; @@ -256,7 +271,7 @@ export function createValueTransferEvent( claimID: BigInt, fromTokenID: BigInt, toTokenID: BigInt, - value: BigInt + value: BigInt, ): ValueTransfer { let mockEvent = newMockEvent(); let parameters: ethereum.EventParam[] = new Array(); @@ -264,24 +279,24 @@ export function createValueTransferEvent( parameters.push( new ethereum.EventParam( "claimID", - ethereum.Value.fromUnsignedBigInt(claimID) - ) + ethereum.Value.fromUnsignedBigInt(claimID), + ), ); parameters.push( new ethereum.EventParam( "fromTokenID", - ethereum.Value.fromUnsignedBigInt(fromTokenID) - ) + ethereum.Value.fromUnsignedBigInt(fromTokenID), + ), ); parameters.push( new ethereum.EventParam( "toTokenID", - ethereum.Value.fromUnsignedBigInt(toTokenID) - ) + ethereum.Value.fromUnsignedBigInt(toTokenID), + ), ); parameters.push( - new ethereum.EventParam("value", ethereum.Value.fromUnsignedBigInt(value)) + new ethereum.EventParam("value", ethereum.Value.fromUnsignedBigInt(value)), ); let valueTransferEvent = new ValueTransfer( @@ -292,7 +307,7 @@ export function createValueTransferEvent( mockEvent.block, mockEvent.transaction, parameters, - mockEvent.receipt + mockEvent.receipt, ); return valueTransferEvent; @@ -302,7 +317,7 @@ export function createBatchValueTransferEvent( claimIDs: BigInt[], fromTokenIDs: BigInt[], toTokenIDs: BigInt[], - values: BigInt[] + values: BigInt[], ): BatchValueTransfer { let mockEvent = newMockEvent(); let parameters: ethereum.EventParam[] = new Array(); @@ -310,26 +325,26 @@ export function createBatchValueTransferEvent( parameters.push( new ethereum.EventParam( "claimIDs", - ethereum.Value.fromUnsignedBigIntArray(claimIDs) - ) + ethereum.Value.fromUnsignedBigIntArray(claimIDs), + ), ); parameters.push( new ethereum.EventParam( "fromTokenIDs", - ethereum.Value.fromUnsignedBigIntArray(fromTokenIDs) - ) + ethereum.Value.fromUnsignedBigIntArray(fromTokenIDs), + ), ); parameters.push( new ethereum.EventParam( "toTokenIDs", - ethereum.Value.fromUnsignedBigIntArray(toTokenIDs) - ) + ethereum.Value.fromUnsignedBigIntArray(toTokenIDs), + ), ); parameters.push( new ethereum.EventParam( "values", - ethereum.Value.fromUnsignedBigIntArray(values) - ) + ethereum.Value.fromUnsignedBigIntArray(values), + ), ); let batchValueTransferEvent = new BatchValueTransfer( @@ -340,7 +355,7 @@ export function createBatchValueTransferEvent( mockEvent.block, mockEvent.transaction, parameters, - mockEvent.receipt + mockEvent.receipt, ); return batchValueTransferEvent;