diff --git a/packages/subgraph/src/utils/constants.ts b/packages/subgraph/src/utils/constants.ts index 611dc7e6..7e6d2617 100644 --- a/packages/subgraph/src/utils/constants.ts +++ b/packages/subgraph/src/utils/constants.ts @@ -1,27 +1,4 @@ export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'; -export const onERC721Received = '0x150b7a02'; -export const ERC721_safeTransferFromNoData = '0x42842e0e'; -export const ERC721_safeTransferFromWithData = '0xb88d4fde'; -export const ERC721_transferFrom = '0x23b872dd'; - -export const ERC20_transfer = '0xa9059cbb'; -export const ERC20_transferFrom = '0x23b872dd'; - -export const onERC1155Received = '0xf23a6e61'; // `bytes4(keccak256("onERC1155Received(address,address,uint256,uint256,bytes)"))` (i.e. 0xf23a6e61) if it accepts the transfer. -export const onERC1155BatchReceived = '0xbc197c81'; // `bytes4(keccak256("onERC1155BatchReceived(address,address,uint256[],uint256[],bytes)"))` (i.e. 0xbc197c81) if it accepts the transfer(s). -export const ERC1155_safeTransferFrom = '0xf242432a'; // `bytes4(keccak256("safeTransferFrom(address,address,uint256,uint256,bytes)"))` (i.e. 0xf242432a). -export const ERC1155_safeBatchTransferFrom = '0x2eb2c2d6'; // `bytes4(keccak256("safeBatchTransferFrom(address,address,uint256[],uint256[],bytes)"))` (i.e. 0x2eb2c2d6). - -export enum TransferType { - Withdraw, - Deposit, -} - -export const DECODE_OFFSET = - '0x0000000000000000000000000000000000000000000000000000000000000020'; - -export const ERC165_INTERFACE_ID = '01ffc9a7'; -export const ERC1155_INTERFACE_ID = 'd9b67a26'; // AS does not support initializing Map with data, a chain of sets is used instead export const VOTER_OPTIONS = new Map() diff --git a/packages/subgraph/src/utils/erc20.ts b/packages/subgraph/src/utils/erc20.ts index 166e640e..394df2c5 100644 --- a/packages/subgraph/src/utils/erc20.ts +++ b/packages/subgraph/src/utils/erc20.ts @@ -48,7 +48,7 @@ export function fetchOrCreateWrappedERC20Entity( if (totalSupply.reverted || balanceOf.reverted || underlying.reverted) { return null; } - // get and save the underliying contract + // get and save the underlying contract const underlyingContract = fetchOrCreateERC20Entity(underlying.value); if (!underlyingContract) { return null; diff --git a/packages/subgraph/src/utils/ids.ts b/packages/subgraph/src/utils/ids.ts index d81b3f8f..dbceda9b 100644 --- a/packages/subgraph/src/utils/ids.ts +++ b/packages/subgraph/src/utils/ids.ts @@ -1,35 +1,12 @@ -import {bigIntToBytes32} from './bytes'; import { - generateEntityIdFromAddress, - generateEntityIdFromBytes, + generateEntityIdFromAddress, // generateEntityIdFromBytes, } from '@aragon/osx-commons-subgraph'; -import {Address, BigInt, Bytes} from '@graphprotocol/graph-ts'; +import {Address} from '@graphprotocol/graph-ts'; export function generateTokenEntityId(tokenAddress: Address): string { return generateEntityIdFromAddress(tokenAddress); } -export function generateERC1155TransferEntityId( - txHash: Bytes, - logIndex: BigInt, - actionIndex: number, - batchIndex: number -): string { - return [ - generateEntityIdFromBytes(txHash), - logIndex.toString(), - actionIndex.toString(), - batchIndex.toString(), - ].join('_'); -} - -export function generateVoterEntityId( - memberEntityId: string, - proposalId: string -): string { - return [memberEntityId, proposalId].join('_'); -} - export function generateMemberEntityId( pluginAddress: Address, memberAddress: Address @@ -46,13 +23,3 @@ export function generateVoteEntityId( ): string { return [generateEntityIdFromAddress(memberAddress), proposalId].join('_'); } - -export function getProposalId( - plugin: Address, - pluginProposalId: BigInt -): string { - return plugin - .toHexString() - .concat('_') - .concat(bigIntToBytes32(pluginProposalId)); -} diff --git a/packages/subgraph/tests/utils/constants.ts b/packages/subgraph/tests/utils/constants.ts index 39eb128b..420441eb 100644 --- a/packages/subgraph/tests/utils/constants.ts +++ b/packages/subgraph/tests/utils/constants.ts @@ -1,7 +1,4 @@ -import { - generatePluginEntityId, - generateProposalEntityId, -} from '@aragon/osx-commons-subgraph'; +import {generateProposalEntityId} from '@aragon/osx-commons-subgraph'; import {Address, BigInt} from '@graphprotocol/graph-ts'; export const ADDRESS_ZERO = '0x0000000000000000000000000000000000000000'; @@ -28,14 +25,8 @@ export const PLUGIN_PROPOSAL_ID = ZERO; export const STRING_DATA = 'Some String Data ...'; export const ONE_ETH = '1000000000000000000'; -export const HALF_ETH = '500000000000000000'; -export const ERC20_AMOUNT_HALF = '10000'; export const ERC20_AMOUNT_FULL = '20000'; -export const ERC20_TOTAL_SUPPLY = '10'; -export const ERC20_DECIMALS = '6'; -export const TOKEN_SYMBOL = 'symbol'; -export const TOKEN_NAME = 'name'; export const HOUR = '3600'; export const TWO_HOURS = '7200'; @@ -62,28 +53,10 @@ export const MIN_VOTING_POWER = TWO; export const TOTAL_VOTING_POWER = THREE; export const CREATED_AT = ONE; -export const ZERO_BYTES32 = - '0x0000000000000000000000000000000000000000000000000000000000000000'; -export const ONE_BYTES32 = - '0x0000000000000000000000000000000000000000000000000000000000000001'; -export const HALF_UINT256_BYTES32 = - '0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; -export const MAX_UINT256_BYTES32 = - '0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff'; - -export const MAX_UINT256_NUMBER_STRING = - '115792089237316195423570985008687907853269984665640564039457584007913129639935'; - export const PLUGIN_SETUP_ID = '0xfb3fd2c4cd4e19944dd3f8437e67476240cd9e3efb2294ebd10c59c8f1d6817c'; -export const APPLIED_PLUGIN_SETUP_ID = - '0x00000000cd4e19944dd3f8437e67476240cd9e3efb2294ebd10c59c8f1d6817c'; export const PROPOSAL_ENTITY_ID = generateProposalEntityId( Address.fromString(CONTRACT_ADDRESS), BigInt.fromString(PLUGIN_PROPOSAL_ID) ); - -export const PLUGIN_ENTITY_ID = generatePluginEntityId( - Address.fromString(CONTRACT_ADDRESS) -);