Skip to content

Commit

Permalink
refactor: remove goerli
Browse files Browse the repository at this point in the history
goerli has been all-but-decomissioned so the decision has been made to remove goerli from nftx.js

BREAKING CHANGE: all references to goerli have been removed
  • Loading branch information
jackmellis committed Mar 20, 2024
1 parent bc356ad commit 72c021d
Show file tree
Hide file tree
Showing 12 changed files with 8 additions and 195 deletions.
5 changes: 1 addition & 4 deletions packages/config/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface Config {
* @example
* ERC721_SUBGRAPH: {
* [Network.Mainnet]: 'https://my-subgraph-url.com',
* [Network.Goerli]: ['https://try-me-first.com', 'https://try-me-second.com']
* [Network.Sepolia]: ['https://try-me-first.com', 'https://try-me-second.com']
* }
*/
subgraph: {
Expand Down Expand Up @@ -124,7 +124,6 @@ const defaultConfig: Config = {
},
contracts: {
ethPrice: {
[Network.Goerli]: '2500000000', // $2.5k
[Network.Sepolia]: '2000000000', // $2k
},
},
Expand All @@ -138,13 +137,11 @@ const defaultConfig: Config = {
source: 'api',
requiredBlockNumber: {
[Network.Mainnet]: 0,
[Network.Goerli]: 0,
[Network.Sepolia]: 0,
[Network.Arbitrum]: 0,
},
apiBlockNumber: {
[Network.Mainnet]: 0,
[Network.Goerli]: 0,
[Network.Sepolia]: 0,
[Network.Arbitrum]: 0,
},
Expand Down
13 changes: 0 additions & 13 deletions packages/constants/src/addresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,15 +27,13 @@ export const ARTBLOCK_COLLECTIONS = [
export const WETH_TOKEN = {
[Network.Mainnet]: a('0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2'),
[Network.Arbitrum]: a('0x82af49447d8a07e3bd95bd0d56f35241523fbab1'),
[Network.Goerli]: a('0xb4fbf271143f4fbf7b91a5ded31805e42b2208d6'),
[Network.Sepolia]: a('0xfFf9976782d46CC05630D1f6eBAb18b2324d6B14'),
};

/** The address for USDC across networks */
export const USDC = {
[Network.Mainnet]: a('0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48'),
[Network.Arbitrum]: a('0xff970a61a04b1ca14834a43f5de4533ebddb5cc8'),
[Network.Goerli]: a('0x2f3a40a3db8a7e3d09b0adfefbce4f6f81927557'),
[Network.Sepolia]: a('0x2C032Aa43D119D7bf4Adc42583F1f94f3bf3023a'),
};

Expand All @@ -46,55 +44,48 @@ export const OPENSEA_COLLECTION = a(
/** Zap specifically for creating new vaults - CreateVaultZap */
export const CREATE_VAULT_ZAP = {
[Network.Mainnet]: a('0x56dab32697B4A313f353DA0CE42B5113eD8E6f74'),
[Network.Goerli]: a('0xc6464CC63bC20b64e1633A0293C2C9b202F4f1b6'),
[Network.Sepolia]: a('0xD80b916470F8e79FD8d09874cb159CbB8D13d8da'),
[Network.Arbitrum]: a('0xF9E891AB1ECa89B7A4B3cBD45aEBFDF3Ec38946F'),
};

/** Perform buy/sell/swaps - MarketplaceUniversalRouterZap */
export const MARKETPLACE_ZAP = {
[Network.Mainnet]: a('0x293A0c49c85F1D8851C665Ac3cE1f1DC2a79bE3d'),
[Network.Goerli]: a('0x0be2D766Eef4b6a72F1fAe2e49619F013d647B8A'),
[Network.Sepolia]: a('0xd88a3B9D0Fb2d39ec8394CfFD983aFBB2D4a6410'),
[Network.Arbitrum]: a('0xf56296B3010a59Ef7F0915569DD44E1302b9Ca40'),
};

/** Stake NFTs or vTokens for xNFTs - NFTXInventoryStakingV3Upgradable */
export const INVENTORY_STAKING = {
[Network.Mainnet]: a('0x889f313e2a3FDC1c9a45bC6020A8a18749CD6152'),
[Network.Goerli]: a('0xEf771a17e6970d8B4b208a76e94F175277554230'),
[Network.Sepolia]: a('0xfBFf0635f7c5327FD138E1EBa72BD9877A6a7C1C'),
[Network.Arbitrum]: a('0xe39a7E67d3E3b6eAF58BC02C4E80C3688847d155'),
};

/** AMM Router - nftxUniversalRouter */
export const NFTX_ROUTER = {
[Network.Mainnet]: a('0x250d62a67254A46c0De472d2c9215E1d890cC90f'),
[Network.Goerli]: a('0xF7c4FC5C2e30258e1E4d1197fc63aeDE371508f3'),
[Network.Sepolia]: a('0x12156cCA1958B6591CC49EaE03a5553458a4b424'),
[Network.Arbitrum]: a('0x4529ad73b2cc8d4db0b0deba90de165e35c4b628'),
};

/** Staking / Liquidity / Pools - NftxRouter */
export const POOL_ROUTER = {
[Network.Mainnet]: a('0x70A741A12262d4b5Ff45C0179c783a380EebE42a'),
[Network.Goerli]: a('0x8E16cdd0D9A15d2d0EFeA531660e8DbD0F6eE12D'),
[Network.Sepolia]: a('0x441b7DE4340AAa5aA86dB4DA43d9Badf7B2DAA66'),
[Network.Arbitrum]: a('0x52731751Dede22827ad47109f5e9697d75a3ef4d'),
};

/** NonfungiblePositionManager */
export const NONFUNGIBLE_POSITION_MANAGER = {
[Network.Mainnet]: a('0x26387fcA3692FCac1C1e8E4E2B22A6CF0d4b71bF'),
[Network.Goerli]: a('0xDa9411C5455a1bfDb527d0988c0A2764E2a104be'),
[Network.Sepolia]: a('0xA9bCC1e29d3460177875f68fDCC0264D22c40BF0'),
[Network.Arbitrum]: a('0x8AD238377531547838370B9C4aC346b9Ed5466Ea'),
};

/** The permit2 contract, needs an approval signature because the UniversalRouter only transfers tokens from user via Permit2 */
export const PERMIT2 = {
[Network.Mainnet]: a('0x000000000022d473030f116ddee9f6b43ac78ba3'),
[Network.Goerli]: a('0x000000000022d473030f116ddee9f6b43ac78ba3'),
[Network.Sepolia]: a('0x000000000022d473030f116ddee9f6b43ac78ba3'),
[Network.Arbitrum]: a('0x000000000022d473030f116ddee9f6b43ac78ba3'),
};
Expand All @@ -103,22 +94,19 @@ export const PERMIT2 = {
export const ENS_REGISTRAR = {
[Network.Mainnet]: a('0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85'),
[Network.Arbitrum]: a('0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85'),
[Network.Goerli]: a('0x57f1887a8BF19b14fC0dF6Fd9B2acc9Af147eA85'),
[Network.Sepolia]: a('0x57f1887a8bf19b14fc0df6fd9b2acc9af147ea85'),
};

/** UniswapV3FactoryUpgradeable */
export const AMM_FACTORY = {
[Network.Mainnet]: a('0xa70e10beB02fF9a44007D9D3695d4b96003db101'),
[Network.Goerli]: a('0xf25081B098c5929A26F562aa2502795fE89BC73f'),
[Network.Sepolia]: a('0xDD2dce9C403f93c10af1846543870D065419E70b'),
[Network.Arbitrum]: a('0xF4D0512FB47319B0CE9144EF582862e2921CaBF8'),
};

/** NFTXVaultFactoryUpgradableV3 */
export const VAULT_FACTORY = {
[Network.Mainnet]: a('0xC255335bc5aBd6928063F5788a5E420554858f01'),
[Network.Goerli]: a('0x1d552A0e6c2f680872C4a88b1e7def05F1858dF0'),
[Network.Sepolia]: a('0x31C56CaF49125043e80B4d3C7f8734f949d8178C'),
[Network.Arbitrum]: a('0x4dEeb9D2Bff2e9C35ce1f013DcC4582F891cb711'),
};
Expand All @@ -127,6 +115,5 @@ export const VAULT_FACTORY = {
export const NFTX_FEE_DISTRIBUTOR = {
[Network.Mainnet]: a('0xF4d96C5094FCD9eC24E612585e723b58F89e21fe'),
[Network.Sepolia]: a('0x66EF5B4b6ee05639194844CE4867515665F14fED'),
[Network.Goerli]: a('0xA8076Ec5Dbb95165e14624Ff43dE2290e78A6905'),
[Network.Arbitrum]: a('0x0d50970C7848ebbE52661e70057D7D063B7de886'),
};
1 change: 0 additions & 1 deletion packages/constants/src/networks.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
export enum Network {
Mainnet = 1,
Arbitrum = 42_161,
Goerli = 5,
Sepolia = 11_155_111,
}
13 changes: 4 additions & 9 deletions packages/constants/src/subgraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ export const ERC721_SUBGRAPH = {
'https://gateway-arbitrum.network.thegraph.com/api/49f332ad234c93d2f07d2c085f1ca6d6/subgraphs/id/CBf1FtUKFnipwKVm36mHyeMtkuhjmh4KHzY3uWNNq5ow',
[Network.Arbitrum]:
'https://api.thegraph.com/subgraphs/name/nftx-project/721-arbitrum-data-nexus',
[Network.Goerli]:
'https://api.thegraph.com/subgraphs/name/nftx-project/eip721-looksrare-goerli',
[Network.Sepolia]:
'https://api.thegraph.com/subgraphs/name/nftx-project/721-sepolia-data-nexus',
};
Expand All @@ -31,27 +29,24 @@ export const ERC1155_SUBGRAPH = {
'https://gateway-arbitrum.network.thegraph.com/api/49f332ad234c93d2f07d2c085f1ca6d6/subgraphs/id/5C6JRVzKcE9AVbT7S71EycV8eEGcfkJB9gGsyTbHMVmN',
[Network.Arbitrum]:
'https://api.thegraph.com/subgraphs/name/nftx-project/1155-arbitrum-data-nexus',
[Network.Goerli]:
'https://api.thegraph.com/subgraphs/name/nftx-project/eip1155-looksrare-goerli',
[Network.Sepolia]:
'https://api.thegraph.com/subgraphs/name/nftx-project/1155-sepolia-data-nexus',
};

export const NFTX_SUBGRAPH = {
[Network.Mainnet]:
'https://graph-proxy.nftx.xyz/nftx-indexer/subgraphs/id/QmTzyQKcTsLq1jLXM4gcEyu9XkRLX7wbJJ5mY4SCHRXgii',
[Network.Arbitrum]: `${SHARED_ROOT}/nftx-project/nftx-v2-arbitrum`,
[Network.Goerli]:
'https://api.thegraph.com/subgraphs/name/nftx-project/nftx-v3-vaults-goerli',
[Network.Arbitrum]:
'https://api.thegraph.com/subgraphs/name/nftx-project/nftx-v3-vaults-arbitrum',
[Network.Sepolia]:
'https://api.thegraph.com/subgraphs/name/nftx-project/nftx-v3-vaults-sepolia',
};

export const NFTX_UNISWAP_SUBGRAPH = {
[Network.Mainnet]:
'https://graph-proxy.nftx.xyz/nftx-indexer/subgraphs/id/QmTqJsUzqsmSzkvDeSGDmGYCcVu8v3Tr3j3MqNsTZvVCMm',
[Network.Goerli]:
'https://api.thegraph.com/subgraphs/name/nftx-project/nftx-v3-amm-goerli',
[Network.Sepolia]:
'https://api.thegraph.com/subgraphs/name/nftx-project/nftx-v3-amm-sepolia',
[Network.Arbitrum]:
'https://api.thegraph.com/subgraphs/name/nftx-project/nftx-v3-amm-arbitrum',
};
4 changes: 0 additions & 4 deletions packages/constants/src/ticks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,22 @@ import { Network } from './networks';
// 0.0001 ETH
export const RFBR_MIN_PRICE = {
[Network.Mainnet]: 100000000000000n,
[Network.Goerli]: 100000000000000n,
[Network.Sepolia]: 100000000000000n,
[Network.Arbitrum]: 100000000000000n,
};
// 10,000 ETH
export const RFBR_MAX_PRICE = {
[Network.Mainnet]: 10000000000000000000000n,
[Network.Goerli]: 10000000000000000000000n,
[Network.Sepolia]: 10000000000000000000000n,
[Network.Arbitrum]: 10000000000000000000000n,
};
export const RFBR_MIN_TICK = {
[Network.Mainnet]: -92160,
[Network.Goerli]: -92160,
[Network.Sepolia]: -92160,
[Network.Arbitrum]: -92160,
};
export const RFBR_MAX_TICK = {
[Network.Mainnet]: 92100,
[Network.Goerli]: 92100,
[Network.Sepolia]: 92100,
[Network.Arbitrum]: 92100,
};
Expand Down
3 changes: 0 additions & 3 deletions packages/constants/src/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,19 @@ import { Network } from './networks';

export const NFTX_ROUTER_URL = {
[Network.Mainnet]: 'https://api.nftx.xyz/v3/eth-mainnet/quote',
[Network.Goerli]: 'https://api.nftx.xyz/v3/eth-goerli/quote',
[Network.Sepolia]: 'https://api.nftx.xyz/v3/eth-sepolia/quote',
[Network.Arbitrum]: 'https://api.nftx.xyz/v3/arbitrum-one/quote',
};

export const NFTX_APR_URL = {
[Network.Mainnet]: 'https://data.nftx.xyz/vaultaprs',
[Network.Arbitrum]: 'https://data.nftx.xyz/vaultaprs',
[Network.Goerli]: 'https://data.nftx.xyz/vaultaprs',
};

export const NFTX_API_URL = 'https://api-v3.nftx.xyz';

export const RESERVOIR_URL = {
[Network.Mainnet]: 'https://api.reservoir.tools',
[Network.Goerli]: 'https://api-goerli.reservoir.tools',
[Network.Arbitrum]: 'https://api-arbitrum.reservoir.tools',
[Network.Sepolia]: 'https://api-sepolia.reservoir.tools',
};
3 changes: 1 addition & 2 deletions packages/constants/src/values.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ export const MaxUint256 =
export const PREMIUM_DURATION = {
[Network.Mainnet]: 36000, // 10 hours
[Network.Arbitrum]: 36000, // 10 hours
[Network.Goerli]: 36000, // 10 hours
[Network.Sepolia]: 3600, // 1 hour
[Network.Sepolia]: 36000, // 1 hour
};
77 changes: 0 additions & 77 deletions packages/core/src/assets/fetchUserHoldings/fetchErc1155s.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,75 +62,6 @@ const fetchErc1155sMainnet = async ({

const fetchErc1155sSepolia = fetchErc1155sMainnet;

const fetchErc1155sGoerli = async ({
lastId,
network,
userAddress,
querySubgraph,
}: {
network: number;
lastId: string;
userAddress: Address;
querySubgraph: QuerySubgraph;
}) => {
let holdings: Array<Holding> = [];
let nextId: string | undefined;
type Response = {
owners: {
id: Address;
totalTokens: string;
tokens: {
tokenID: `${number}`;
collection: { id: Address };
}[];
}[];
};

const query = gql<Response>`{
owners(
where: {
id: "${userAddress}"
}
) {
id
totalTokens
tokens(
first: 1000
orderBy: tokenID
where: {
tokenID_gt: "${lastId}"
}
) {
tokenID
collection {
id
}
}
}
}`;

const data = await querySubgraph({
url: getChainConstant(config.subgraph.ERC1155_SUBGRAPH, network),
query,
});

if (data?.owners?.[0]?.tokens?.length) {
holdings = data.owners[0].tokens.map((x) => {
return {
assetAddress: x.collection.id,
tokenId: BigInt(x.tokenID).toString() as TokenId,
quantity: 1n,
};
});
}
if (data?.owners?.[0]?.tokens?.length === 1000) {
nextId =
data.owners?.[0].tokens[data.owners?.[0].tokens.length - 1].tokenID;
}

return [holdings, nextId] as const;
};

const fetchErc1155sArbitrum = fetchErc1155sMainnet;

export const makeFetchErc1155s =
Expand Down Expand Up @@ -160,14 +91,6 @@ export const makeFetchErc1155s =
querySubgraph,
});
break;
case Network.Goerli:
[holdings, nextId] = await fetchErc1155sGoerli({
lastId,
network,
userAddress,
querySubgraph,
});
break;
case Network.Sepolia:
[holdings, nextId] = await fetchErc1155sSepolia({
lastId,
Expand Down
Loading

0 comments on commit 72c021d

Please sign in to comment.